Skip to content

Commit d2e64db

Browse files
Alexander Duyckdavem330
authored andcommitted
net: Only define skb_mark_napi_id in one spot instead of two
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 <alexander.h.duyck@intel.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e590745 commit d2e64db

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

include/net/busy_poll.h

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ static inline bool busy_loop_timeout(unsigned long end_time)
7676

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

79-
/* used in the NIC receive handler to mark the skb */
80-
static inline void skb_mark_napi_id(struct sk_buff *skb,
81-
struct napi_struct *napi)
82-
{
83-
skb->napi_id = napi->napi_id;
84-
}
85-
86-
8779
#else /* CONFIG_NET_RX_BUSY_POLL */
8880
static inline unsigned long net_busy_loop_on(void)
8981
{
@@ -100,11 +92,6 @@ static inline bool sk_can_busy_loop(struct sock *sk)
10092
return false;
10193
}
10294

103-
static inline void skb_mark_napi_id(struct sk_buff *skb,
104-
struct napi_struct *napi)
105-
{
106-
}
107-
10895
static inline bool busy_loop_timeout(unsigned long end_time)
10996
{
11097
return true;
@@ -117,6 +104,15 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)
117104

118105
#endif /* CONFIG_NET_RX_BUSY_POLL */
119106

107+
/* used in the NIC receive handler to mark the skb */
108+
static inline void skb_mark_napi_id(struct sk_buff *skb,
109+
struct napi_struct *napi)
110+
{
111+
#ifdef CONFIG_NET_RX_BUSY_POLL
112+
skb->napi_id = napi->napi_id;
113+
#endif
114+
}
115+
120116
/* used in the protocol hanlder to propagate the napi_id to the socket */
121117
static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb)
122118
{

0 commit comments

Comments
 (0)