Re: [PATCH net-next 6/7] net: add common accessor for setting dropcount on packets
From: Eric Dumazet <hidden>
Date: 2015-02-26 04:43:06
From: Eric Dumazet <hidden>
Date: 2015-02-26 04:43:06
On Thu, 2015-02-26 at 04:10 +0200, Eyal Birger wrote:
As part of an effort to move skb->dropcount to skb->cb[], use a common function in order to set dropcount in struct sk_buff. Signed-off-by: Eyal Birger <redacted> --- include/net/sock.h | 5 +++++ net/core/sock.c | 2 +- net/packet/af_packet.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)diff --git a/include/net/sock.h b/include/net/sock.h index a2502d2..d462f5e 100644 --- a/include/net/sock.h +++ b/include/net/sock.h@@ -2081,6 +2081,11 @@ static inline int sock_intr_errno(long timeo) #define sock_skb_cb_check_size(size) \ BUILD_BUG_ON((size) > FIELD_SIZEOF(struct sk_buff, cb)) +static inline void sock_skb_set_dropcount(struct sock *sk, struct sk_buff *skb)
const struct sock *sk
+{
+ skb->dropcount = atomic_read(&sk->sk_drops);
+}