Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 09/14] openvswitch: Drop packets when interdev is not up
@ 2014-11-04  6:01 Pravin B Shelar
  0 siblings, 0 replies; only message in thread
From: Pravin B Shelar @ 2014-11-04  6:01 UTC (permalink / raw)
  To: davem; +Cc: netdev, Chunhe Li, Pravin B Shelar

From: Chunhe Li <lichunhe@huawei.com>

If the internal device is not up, it should drop received
packets. Sometimes it receive the broadcast or multicast
packets, and the ip protocol stack will casue more cpu
usage wasted.

Signed-off-by: Chunhe Li <lichunhe@huawei.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
 net/openvswitch/vport-internal_dev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 10dc07e..6a55f71 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -224,6 +224,11 @@ static int internal_dev_recv(struct vport *vport, struct sk_buff *skb)
 	struct net_device *netdev = netdev_vport_priv(vport)->dev;
 	int len;
 
+	if (unlikely(!(netdev->flags & IFF_UP))) {
+		kfree_skb(skb);
+		return 0;
+	}
+
 	len = skb->len;
 
 	skb_dst_drop(skb);
-- 
1.9.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-05 20:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04  6:01 [PATCH net-next 09/14] openvswitch: Drop packets when interdev is not up Pravin B Shelar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox