datapath: Use eth_proto_is_802_3.
[cascardo/ovs.git] / datapath / vport-internal_dev.c
index a1c4949..f38f9be 100644 (file)
@@ -38,6 +38,8 @@ struct internal_dev {
        struct vport *vport;
 };
 
+static struct vport_ops ovs_internal_vport_ops;
+
 static struct internal_dev *internal_dev_priv(struct net_device *netdev)
 {
        return netdev_priv(netdev);
@@ -143,6 +145,10 @@ static const struct net_device_ops internal_dev_netdev_ops = {
 #endif
 };
 
+static struct rtnl_link_ops internal_dev_link_ops __read_mostly = {
+       .kind = "openvswitch",
+};
+
 static void do_setup(struct net_device *netdev)
 {
        ether_setup(netdev);
@@ -153,6 +159,7 @@ static void do_setup(struct net_device *netdev)
        netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
        netdev->destructor = internal_dev_destructor;
        netdev->ethtool_ops = &internal_dev_ethtool_ops;
+       netdev->rtnl_link_ops = &internal_dev_link_ops;
        netdev->tx_queue_len = 0;
 
        netdev->features = NETIF_F_LLTX | NETIF_F_SG | NETIF_F_FRAGLIST |
@@ -249,10 +256,10 @@ static int internal_dev_recv(struct vport *vport, struct sk_buff *skb)
        }
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
-       if (vlan_tx_tag_present(skb)) {
-               if (unlikely(!__vlan_put_tag(skb,
-                                            skb->vlan_proto,
-                                            vlan_tx_tag_get(skb))))
+       if (skb_vlan_tag_present(skb)) {
+               if (unlikely(!vlan_insert_tag_set_proto(skb,
+                                                       skb->vlan_proto,
+                                                       skb_vlan_tag_get(skb))))
                        return 0;
 
                if (skb->ip_summed == CHECKSUM_COMPLETE)
@@ -280,7 +287,7 @@ static int internal_dev_recv(struct vport *vport, struct sk_buff *skb)
        return len;
 }
 
-const struct vport_ops ovs_internal_vport_ops = {
+static struct vport_ops ovs_internal_vport_ops = {
        .type           = OVS_VPORT_TYPE_INTERNAL,
        .create         = internal_dev_create,
        .destroy        = internal_dev_destroy,
@@ -300,3 +307,24 @@ struct vport *ovs_internal_dev_get_vport(struct net_device *netdev)
 
        return internal_dev_priv(netdev)->vport;
 }
+
+int ovs_internal_dev_rtnl_link_register(void)
+{
+       int err;
+
+       err = rtnl_link_register(&internal_dev_link_ops);
+       if (err < 0)
+               return err;
+
+       err = ovs_vport_ops_register(&ovs_internal_vport_ops);
+       if (err < 0)
+               rtnl_link_unregister(&internal_dev_link_ops);
+
+       return err;
+}
+
+void ovs_internal_dev_rtnl_link_unregister(void)
+{
+       ovs_vport_ops_unregister(&ovs_internal_vport_ops);
+       rtnl_link_unregister(&internal_dev_link_ops);
+}