From: Eyal Birger <eyal.birger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: willemb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
shmulik.ladkani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Eyal Birger <eyal.birger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH net-next v2 4/7] net: packet: use skb->dev as storage for skb orig len instead of skb->cb[]
Date: Thu, 26 Feb 2015 21:07:01 +0200 [thread overview]
Message-ID: <1424977624-649-5-git-send-email-eyal.birger@gmail.com> (raw)
In-Reply-To: <1424977624-649-1-git-send-email-eyal.birger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
As part of an effort to move skb->dropcount to skb->cb[], 4 bytes
of additional room are needed in skb->cb[] in packet sockets.
Store the skb original length in skb->dev instead of skb->cb[] for
this purpose.
Signed-off-by: Eyal Birger <eyal.birger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
net/packet/af_packet.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 9c28cec..9d571bc 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -216,7 +216,6 @@ static void prb_fill_vlan_info(struct tpacket_kbdq_core *,
static void packet_flush_mclist(struct sock *sk);
struct packet_skb_cb {
- unsigned int origlen;
union {
struct sockaddr_pkt pkt;
struct sockaddr_ll ll;
@@ -224,6 +223,7 @@ struct packet_skb_cb {
};
#define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb))
+#define PACKET_SKB_ORIGLEN(__skb) ((unsigned long *)&(__skb)->dev)
#define GET_PBDQC_FROM_RB(x) ((struct tpacket_kbdq_core *)(&(x)->prb_bdqc))
#define GET_PBLOCK_DESC(x, bid) \
@@ -1757,7 +1757,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_sock *po;
u8 *skb_head = skb->data;
int skb_len = skb->len;
- unsigned int snaplen, res;
+ unsigned int snaplen, origlen, res;
if (skb->pkt_type == PACKET_LOOPBACK)
goto drop;
@@ -1825,13 +1825,13 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
sll->sll_halen = dev_parse_header(skb, sll->sll_addr);
- PACKET_SKB_CB(skb)->origlen = skb->len;
+ origlen = skb->len;
if (pskb_trim(skb, snaplen))
goto drop_n_acct;
skb_set_owner_r(skb, sk);
- skb->dev = NULL;
+ *PACKET_SKB_ORIGLEN(skb) = origlen;
skb_dst_drop(skb);
/* drop conntrack reference */
@@ -3006,7 +3006,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,
aux.tp_status = TP_STATUS_USER;
if (skb->ip_summed == CHECKSUM_PARTIAL)
aux.tp_status |= TP_STATUS_CSUMNOTREADY;
- aux.tp_len = PACKET_SKB_CB(skb)->origlen;
+ aux.tp_len = *PACKET_SKB_ORIGLEN(skb);
aux.tp_snaplen = skb->len;
aux.tp_mac = 0;
aux.tp_net = skb_network_offset(skb);
--
2.1.4
next prev parent reply other threads:[~2015-02-26 19:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 19:06 [PATCH net-next v2 0/7] net: move skb->dropcount to skb->cb[] Eyal Birger
2015-02-26 19:06 ` [PATCH net-next v2 1/7] net: bluetooth: compact struct bt_skb_cb by inlining struct hci_req_ctrl Eyal Birger
2015-02-26 19:06 ` [PATCH net-next v2 2/7] net: bluetooth: compact struct bt_skb_cb by converting boolean fields to bit fields Eyal Birger
2015-02-26 19:07 ` [PATCH net-next v2 3/7] net: rxrpc: change call to sock_recv_ts_and_drops() on rxrpc recvmsg to sock_recv_timestamp() Eyal Birger
[not found] ` <1424977624-649-1-git-send-email-eyal.birger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-26 19:07 ` Eyal Birger [this message]
2015-02-28 19:21 ` [PATCH net-next v2 4/7] net: packet: use skb->dev as storage for skb orig len instead of skb->cb[] David Miller
[not found] ` <20150228.142135.470339626705046722.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2015-02-28 19:39 ` Eyal Birger
2015-02-28 20:08 ` David Miller
[not found] ` <20150228.150830.1726900309943339124.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2015-02-28 20:38 ` Eyal Birger
2015-02-28 21:00 ` David Miller
2015-03-01 5:09 ` Eyal Birger
[not found] ` <CAHsH6Gv8Dh3RQ0V7KURcca9bzZGY0FwiqGj-mP9oKA_Vv72nUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-01 5:31 ` David Miller
[not found] ` <20150301.003143.1281961486875434872.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2015-03-01 5:35 ` Eyal Birger
2015-02-26 19:07 ` [PATCH net-next v2 6/7] net: add common accessor for setting dropcount on packets Eyal Birger
2015-02-26 19:07 ` [PATCH net-next v2 5/7] net: use common macro for assering skb->cb[] available size in protocol families Eyal Birger
2015-02-26 19:07 ` [PATCH net-next v2 7/7] net: move skb->dropcount to skb->cb[] Eyal Birger
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=1424977624-649-5-git-send-email-eyal.birger@gmail.com \
--to=eyal.birger-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=shmulik.ladkani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=willemb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
/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).