Skip to content

Commit

Permalink
net: Only define skb_mark_napi_id in one spot instead of two
Browse files Browse the repository at this point in the history
Instead of defining two versions of skb_mark_napi_id I think it is more
readable to just match the format of the sk_mark_napi_id functions and just
wrap the contents of the function instead of defining two versions of the
function.  This way we can save a few lines of code since we only need 2 of
the ifdef/endif but needed 5 for the extra function declaration.

Signed-off-by: Alexander Duyck <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Alexander Duyck authored and davem330 committed Mar 25, 2017
1 parent e590745 commit d2e64db
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions include/net/busy_poll.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ static inline bool busy_loop_timeout(unsigned long end_time)

bool sk_busy_loop(struct sock *sk, int nonblock);

/* used in the NIC receive handler to mark the skb */
static inline void skb_mark_napi_id(struct sk_buff *skb,
struct napi_struct *napi)
{
skb->napi_id = napi->napi_id;
}


#else /* CONFIG_NET_RX_BUSY_POLL */
static inline unsigned long net_busy_loop_on(void)
{
Expand All @@ -100,11 +92,6 @@ static inline bool sk_can_busy_loop(struct sock *sk)
return false;
}

static inline void skb_mark_napi_id(struct sk_buff *skb,
struct napi_struct *napi)
{
}

static inline bool busy_loop_timeout(unsigned long end_time)
{
return true;
Expand All @@ -117,6 +104,15 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)

#endif /* CONFIG_NET_RX_BUSY_POLL */

/* used in the NIC receive handler to mark the skb */
static inline void skb_mark_napi_id(struct sk_buff *skb,
struct napi_struct *napi)
{
#ifdef CONFIG_NET_RX_BUSY_POLL
skb->napi_id = napi->napi_id;
#endif
}

/* used in the protocol hanlder to propagate the napi_id to the socket */
static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb)
{
Expand Down

0 comments on commit d2e64db

Please sign in to comment.