All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] af_packet: make tpacket_rcv to not set status value before run_filter
@ 2015-03-19  8:01 Alexander Drozdov
  2015-03-19  8:01 ` [PATCH 2/2] af_packet: pass checksum validation status to the user Alexander Drozdov
  0 siblings, 1 reply; 11+ messages in thread
From: Alexander Drozdov @ 2015-03-19  8:01 UTC (permalink / raw)
  To: David S. Miller
  Cc: Daniel Borkmann, Eric Dumazet, Al Viro, Willem de Bruijn,
	Michael S. Tsirkin, netdev, linux-kernel, Alexander Drozdov

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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-03-24  2:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19  8:01 [PATCH 1/2] af_packet: make tpacket_rcv to not set status value before run_filter Alexander Drozdov
2015-03-19  8:01 ` [PATCH 2/2] af_packet: pass checksum validation status to the user Alexander Drozdov
2015-03-19 15:29   ` Willem de Bruijn
2015-03-19 18:08     ` Alexander Drozdov
2015-03-19 18:50       ` Willem de Bruijn
2015-03-20  6:46         ` Alexander Drozdov
2015-03-20 15:29           ` Willem de Bruijn
2015-03-23  6:11   ` [PATCH V2 1/2] af_packet: make tpacket_rcv to not set status value before run_filter Alexander Drozdov
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.