datapath: Improve comments.
[openvswitch] / datapath / dp_dev.c
index 5aa32f0481cbbf58bfa0d9af3c7dfdece6ba40f3..d11e7f6f756f4880e8dfbef9616c39ea006b028e 100644 (file)
@@ -28,7 +28,6 @@ struct datapath *dp_dev_get_dp(struct net_device *netdev)
 {
        return dp_dev_priv(netdev)->dp;
 }
-EXPORT_SYMBOL(dp_dev_get_dp);
 
 static struct net_device_stats *dp_dev_get_stats(struct net_device *netdev)
 {
@@ -86,12 +85,6 @@ static int dp_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
        struct dp_dev *dp_dev = dp_dev_priv(netdev);
        struct pcpu_lstats *lb_stats;
 
-       /* By orphaning 'skb' we will screw up socket accounting slightly, but
-        * the effect is limited to the device queue length.  If we don't
-        * do this, then the sk_buff will be destructed eventually, but it is
-        * harder to predict when. */
-       skb_orphan(skb);
-
        /* dp_process_received_packet() needs its own clone. */
        skb = skb_share_check(skb, GFP_ATOMIC);
        if (!skb)
@@ -136,6 +129,15 @@ static struct ethtool_ops dp_ethtool_ops = {
        .get_tso = ethtool_op_get_tso,
 };
 
+static int dp_dev_change_mtu(struct net_device *dev, int new_mtu)
+{
+       if (new_mtu < 68 || new_mtu > dp_min_mtu(dp_dev_get_dp(dev)))
+               return -EINVAL;
+
+       dev->mtu = new_mtu;
+       return 0;
+}
+
 static int dp_dev_init(struct net_device *netdev)
 {
        struct dp_dev *dp_dev = dp_dev_priv(netdev);
@@ -168,6 +170,7 @@ do_setup(struct net_device *netdev)
        netdev->stop = dp_dev_stop;
        netdev->tx_queue_len = 0;
        netdev->set_mac_address = dp_dev_mac_addr;
+       netdev->change_mtu = dp_dev_change_mtu;
        netdev->init = dp_dev_init;
        netdev->destructor = dp_dev_free;
 
@@ -231,4 +234,3 @@ int is_dp_dev(struct net_device *netdev)
 {
        return netdev->open == dp_dev_open;
 }
-EXPORT_SYMBOL(is_dp_dev);