From: Eyal Birger <eyal.birger@gmail.com>
To: davem@davemloft.net
Cc: willemb@google.com, edumazet@google.com,
shmulik.ladkani@gmail.com, linux-bluetooth@vger.kernel.org,
marcel@holtmann.org, netdev@vger.kernel.org,
Eyal Birger <eyal.birger@gmail.com>
Subject: [PATCH net-next v3 6/7] net: add common accessor for setting dropcount on packets
Date: Sun, 1 Mar 2015 14:58:30 +0200 [thread overview]
Message-ID: <1425214711-9562-7-git-send-email-eyal.birger@gmail.com> (raw)
In-Reply-To: <1425214711-9562-1-git-send-email-eyal.birger@gmail.com>
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 <eyal.birger@gmail.com>
---
include/net/sock.h | 6 ++++++
net/core/sock.c | 2 +-
net/packet/af_packet.c | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index a2502d2..0996fe4 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2081,6 +2081,12 @@ 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(const struct sock *sk, struct sk_buff *skb)
+{
+ skb->dropcount = atomic_read(&sk->sk_drops);
+}
+
void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb);
void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
diff --git a/net/core/sock.c b/net/core/sock.c
index 93c8b20..9c74fc8 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -466,7 +466,7 @@ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
skb_dst_force(skb);
spin_lock_irqsave(&list->lock, flags);
- skb->dropcount = atomic_read(&sk->sk_drops);
+ sock_skb_set_dropcount(sk, skb);
__skb_queue_tail(list, skb);
spin_unlock_irqrestore(&list->lock, flags);
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 9cdb414..9db8369 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1845,7 +1845,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
spin_lock(&sk->sk_receive_queue.lock);
po->stats.stats1.tp_packets++;
- skb->dropcount = atomic_read(&sk->sk_drops);
+ sock_skb_set_dropcount(sk, skb);
__skb_queue_tail(&sk->sk_receive_queue, skb);
spin_unlock(&sk->sk_receive_queue.lock);
sk->sk_data_ready(sk);
--
2.1.4
next prev parent reply other threads:[~2015-03-01 12:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-01 12:58 [PATCH net-next v3 0/7] net: move skb->dropcount to skb->cb[] Eyal Birger
2015-03-01 12:58 ` [PATCH net-next v3 2/7] net: bluetooth: compact struct bt_skb_cb by converting boolean fields to bit fields Eyal Birger
2015-03-01 12:58 ` [PATCH net-next v3 4/7] net: packet: use sockaddr_ll fields as storage for skb original length in recvmsg path Eyal Birger
2015-03-01 12:58 ` Eyal Birger [this message]
[not found] ` <1425214711-9562-1-git-send-email-eyal.birger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-01 12:58 ` [PATCH net-next v3 1/7] net: bluetooth: compact struct bt_skb_cb by inlining struct hci_req_ctrl Eyal Birger
2015-03-01 12:58 ` [PATCH net-next v3 3/7] net: rxrpc: change call to sock_recv_ts_and_drops() on rxrpc recvmsg to sock_recv_timestamp() Eyal Birger
2015-03-01 12:58 ` [PATCH net-next v3 5/7] net: use common macro for assering skb->cb[] available size in protocol families Eyal Birger
2015-03-01 12:58 ` [PATCH net-next v3 7/7] net: move skb->dropcount to skb->cb[] Eyal Birger
2015-03-02 5:20 ` [PATCH net-next v3 0/7] " David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425214711-9562-7-git-send-email-eyal.birger@gmail.com \
--to=eyal.birger@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=netdev@vger.kernel.org \
--cc=shmulik.ladkani@gmail.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).