From: Alexander Drozdov <al.drozdov@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
Jonathan Corbet <corbet@lwn.net>
Cc: Daniel Borkmann <dborkman@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Willem de Bruijn <willemb@google.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Tobias Klauser <tklauser@distanz.ch>,
linux-doc@vger.kernel.org, linux-api@vger.kernel.org,
Alexander Drozdov <al.drozdov@gmail.com>
Subject: [PATCH V2 1/2] af_packet: make tpacket_rcv to not set status value before run_filter
Date: Mon, 23 Mar 2015 09:11:12 +0300 [thread overview]
Message-ID: <1427091073-8129-1-git-send-email-al.drozdov@gmail.com> (raw)
In-Reply-To: <1426752102-12786-2-git-send-email-al.drozdov@gmail.com>
It is just an optimization. We don't need the value of status variable
if the packet is filtered.
Signed-off-by: Alexander Drozdov <al.drozdov@gmail.com>
---
net/packet/af_packet.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index f8db706..6ecf8dd 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1910,14 +1910,15 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
}
}
- if (skb->ip_summed == CHECKSUM_PARTIAL)
- status |= TP_STATUS_CSUMNOTREADY;
-
snaplen = skb->len;
res = run_filter(skb, sk, snaplen);
if (!res)
goto drop_n_restore;
+
+ if (skb->ip_summed == CHECKSUM_PARTIAL)
+ status |= TP_STATUS_CSUMNOTREADY;
+
if (snaplen > res)
snaplen = res;
--
1.9.1
next parent reply other threads:[~2015-03-23 6:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1426752102-12786-2-git-send-email-al.drozdov@gmail.com>
2015-03-23 6:11 ` Alexander Drozdov [this message]
2015-03-23 6:11 ` [PATCH V2 2/2] af_packet: pass checksum validation status to the user Alexander Drozdov
2015-03-24 2:01 ` David Miller
2015-03-24 2:01 ` [PATCH V2 1/2] af_packet: make tpacket_rcv to not set status value before run_filter 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=1427091073-8129-1-git-send-email-al.drozdov@gmail.com \
--to=al.drozdov@gmail.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=edumazet@google.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=tklauser@distanz.ch \
--cc=viro@zeniv.linux.org.uk \
--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).