aboutsummaryrefslogtreecommitdiff
path: root/datapath/dp_dev.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2009-10-22 17:43:28 -0700
committerBen Pfaff <blp@nicira.com>2009-10-22 17:43:28 -0700
commit3f355f47f8e7343e909ccfa854454d667baf3c38 (patch)
tree21898eaab13a44cf3dadac0ff468a2f08d7df46a /datapath/dp_dev.c
parentadea354e28134f08008732062ef0c613954dc7e4 (diff)
parent2416b8eceae7b2508fe72efbc17d9cb71b69d330 (diff)
Merge "citrix" into "master".
This merge took a little bit of care due to two issues: - Crossport of "interface-reconfigure" fixes from master back to citrix that had happened and needed to be canceled out of the merge. - New script "refresh-xs-network-uuids" added on citrix branch that needed to be moved from /root/vswitch/scripts to /usr/share/vswitch/scripts.
Diffstat (limited to 'datapath/dp_dev.c')
-rw-r--r--datapath/dp_dev.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/datapath/dp_dev.c b/datapath/dp_dev.c
index 008f3f6c..284a6b52 100644
--- a/datapath/dp_dev.c
+++ b/datapath/dp_dev.c
@@ -157,22 +157,47 @@ static void dp_dev_free(struct net_device *netdev)
free_netdev(netdev);
}
+static int dp_dev_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+ if (dp_ioctl_hook)
+ return dp_ioctl_hook(dev, ifr, cmd);
+ return -EOPNOTSUPP;
+}
+
+#ifdef HAVE_NET_DEVICE_OPS
+static const struct net_device_ops dp_dev_netdev_ops = {
+ .ndo_init = dp_dev_init,
+ .ndo_open = dp_dev_open,
+ .ndo_stop = dp_dev_stop,
+ .ndo_start_xmit = dp_dev_xmit,
+ .ndo_set_mac_address = dp_dev_mac_addr,
+ .ndo_do_ioctl = dp_dev_do_ioctl,
+ .ndo_change_mtu = dp_dev_change_mtu,
+ .ndo_get_stats = dp_dev_get_stats,
+};
+#endif
+
static void
do_setup(struct net_device *netdev)
{
ether_setup(netdev);
- netdev->do_ioctl = dp_ioctl_hook;
+#ifdef HAVE_NET_DEVICE_OPS
+ netdev->netdev_ops = &dp_dev_netdev_ops;
+#else
+ netdev->do_ioctl = dp_dev_do_ioctl;
netdev->get_stats = dp_dev_get_stats;
netdev->hard_start_xmit = dp_dev_xmit;
netdev->open = dp_dev_open;
- SET_ETHTOOL_OPS(netdev, &dp_ethtool_ops);
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;
+#endif
+
netdev->destructor = dp_dev_free;
+ SET_ETHTOOL_OPS(netdev, &dp_ethtool_ops);
+ netdev->tx_queue_len = 0;
netdev->flags = IFF_BROADCAST | IFF_MULTICAST;
netdev->features = NETIF_F_LLTX; /* XXX other features? */
@@ -233,5 +258,9 @@ void dp_dev_destroy(struct net_device *netdev)
int is_dp_dev(struct net_device *netdev)
{
+#ifdef HAVE_NET_DEVICE_OPS
+ return netdev->netdev_ops == &dp_dev_netdev_ops;
+#else
return netdev->open == dp_dev_open;
+#endif
}