All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] bpf: netdev is never null in __dev_map_flush
@ 2017-08-24  1:20 Daniel Borkmann
  2017-08-24  1:25 ` Alexei Starovoitov
  2017-08-24  5:43 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Borkmann @ 2017-08-24  1:20 UTC (permalink / raw)
  To: davem; +Cc: ast, john.fastabend, netdev, Daniel Borkmann

No need to test for it in fast-path, every dev in bpf_dtab_netdev
is guaranteed to be non-NULL, otherwise dev_map_update_elem() will
fail in the first place.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
 kernel/bpf/devmap.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index bfecabf..ecf9f99 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -226,12 +226,10 @@ void __dev_map_flush(struct bpf_map *map)
 		if (unlikely(!dev))
 			continue;
 
-		netdev = dev->dev;
 		__clear_bit(bit, bitmap);
-		if (unlikely(!netdev || !netdev->netdev_ops->ndo_xdp_flush))
-			continue;
-
-		netdev->netdev_ops->ndo_xdp_flush(netdev);
+		netdev = dev->dev;
+		if (likely(netdev->netdev_ops->ndo_xdp_flush))
+			netdev->netdev_ops->ndo_xdp_flush(netdev);
 	}
 }
 
-- 
1.9.3

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

end of thread, other threads:[~2017-08-24  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24  1:20 [PATCH net-next] bpf: netdev is never null in __dev_map_flush Daniel Borkmann
2017-08-24  1:25 ` Alexei Starovoitov
2017-08-24  3:10   ` John Fastabend
2017-08-24  8:34     ` Daniel Borkmann
2017-08-24  5:43 ` 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.