X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Fvport-netdev.c;h=3bab666c888132a9936812f4a331e9ed90ff42ac;hb=7fae24e67c95b1dbe93497135ae533e39b61e110;hp=2583566b1afd884005e084542122ffc2840fbbbb;hpb=431488e6638d3fbb53d215fa10d2ff2d8f1c2824;p=openvswitch diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index 2583566b..3bab666c 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -38,7 +38,23 @@ MODULE_PARM_DESC(vlan_tso, "Enable TSO for VLAN packets"); static void netdev_port_receive(struct vport *vport, struct sk_buff *skb); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +/* Called with rcu_read_lock and bottom-halves disabled. */ +static rx_handler_result_t netdev_frame_hook(struct sk_buff **pskb) +{ + struct sk_buff *skb = *pskb; + struct vport *vport; + + if (unlikely(skb->pkt_type == PACKET_LOOPBACK)) + return RX_HANDLER_PASS; + + vport = netdev_get_vport(skb->dev); + + netdev_port_receive(vport, skb); + + return RX_HANDLER_CONSUMED; +} +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) /* Called with rcu_read_lock and bottom-halves disabled. */ static struct sk_buff *netdev_frame_hook(struct sk_buff *skb) { @@ -252,6 +268,11 @@ int netdev_get_mtu(const struct vport *vport) /* Must be called with rcu_read_lock. */ static void netdev_port_receive(struct vport *vport, struct sk_buff *skb) { + if (unlikely(!vport)) { + kfree_skb(skb); + return; + } + /* Make our own copy of the packet. Otherwise we will mangle the * packet for anyone who came before us (e.g. tcpdump via AF_PACKET). * (No one comes after us, since we tell handle_bridge() that we took