From 2158888d8d8f3b4c00dcf979390a19fa7fcf7942 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Fri, 14 May 2010 13:54:16 -0700 Subject: [PATCH] patch: Remove veth driver. Now that we have a new patch implementation, remove the veth driver and its userspace components. Then rename 'patchnew' to 'patch'. The new implementation is a drop-in replacement for the old one. --- acinclude.m4 | 11 - datapath/linux-2.6/Makefile.main.in | 1 - datapath/linux-2.6/Modules.mk | 5 - datapath/linux-2.6/compat-2.6/veth.c | 546 --------------------------- lib/netdev-linux.c | 208 ---------- lib/netdev-patch.c | 10 +- lib/netdev-provider.h | 3 +- lib/netdev.c | 3 +- xenserver/etc_init.d_openvswitch | 3 - xenserver/openvswitch-xen.spec | 3 - 10 files changed, 7 insertions(+), 786 deletions(-) delete mode 100644 datapath/linux-2.6/compat-2.6/veth.c diff --git a/acinclude.m4 b/acinclude.m4 index 6a37443a..cabe7d3a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -113,16 +113,6 @@ AC_DEFUN([OVS_DEFINE], [ echo '#define $1 1' >> datapath/linux-2.6/kcompat.h.new ]) -AC_DEFUN([OVS_CHECK_VETH], [ - AC_MSG_CHECKING([whether to build veth module]) - if test "$sublevel" = 18; then - AC_MSG_RESULT([yes]) - AC_SUBST([BUILD_VETH], 1) - else - AC_MSG_RESULT([no]) - fi -]) - AC_DEFUN([OVS_CHECK_LOG2_H], [ AC_MSG_CHECKING([for $KSRC26/include/linux/log2.h]) if test -e $KSRC26/include/linux/log2.h; then @@ -189,7 +179,6 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [ [OVS_DEFINE([HAVE_NLA_GET_BE16])]) OVS_CHECK_LOG2_H - OVS_CHECK_VETH if cmp -s datapath/linux-2.6/kcompat.h.new \ datapath/linux-2.6/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/linux-2.6/Makefile.main.in b/datapath/linux-2.6/Makefile.main.in index 4b875502..0809e612 100644 --- a/datapath/linux-2.6/Makefile.main.in +++ b/datapath/linux-2.6/Makefile.main.in @@ -4,7 +4,6 @@ export srcdir = @abs_srcdir@ export top_srcdir = @abs_top_srcdir@ export KSRC = @KBUILD26@ export VERSION = @VERSION@ -export BUILD_VETH = @BUILD_VETH@ include $(srcdir)/../Modules.mk include $(srcdir)/Modules.mk diff --git a/datapath/linux-2.6/Modules.mk b/datapath/linux-2.6/Modules.mk index b41a8d27..f5f13e2c 100644 --- a/datapath/linux-2.6/Modules.mk +++ b/datapath/linux-2.6/Modules.mk @@ -55,8 +55,3 @@ brcompat_sources = \ brc_procfs.c brcompat_headers = \ brc_procfs.h - -dist_modules += veth -build_modules += $(if $(BUILD_VETH),veth) -veth_sources = linux-2.6/compat-2.6/veth.c -veth_headers = diff --git a/datapath/linux-2.6/compat-2.6/veth.c b/datapath/linux-2.6/compat-2.6/veth.c deleted file mode 100644 index 26d8dd91..00000000 --- a/datapath/linux-2.6/compat-2.6/veth.c +++ /dev/null @@ -1,546 +0,0 @@ -/* veth driver port to Linux 2.6.18 */ - -/* - * drivers/net/veth.c - * - * Copyright (C) 2007, 2009 OpenVZ http://openvz.org, SWsoft Inc - * - * Author: Pavel Emelianov - * Ethtool interface from: Eric W. Biederman - * - */ - -#include -#include -#include -#include - -#include -#include - -#define DRV_NAME "veth" -#define DRV_VERSION "1.0" - -struct veth_net_stats { - unsigned long rx_packets; - unsigned long tx_packets; - unsigned long rx_bytes; - unsigned long tx_bytes; - unsigned long tx_dropped; -}; - -struct veth_priv { - struct net_device *peer; - struct net_device *dev; - struct list_head list; - struct veth_net_stats *stats; - unsigned ip_summed; - struct net_device_stats dev_stats; -}; - -static LIST_HEAD(veth_list); - -/* - * ethtool interface - */ - -static struct { - const char string[ETH_GSTRING_LEN]; -} ethtool_stats_keys[] = { - { "peer_ifindex" }, -}; - -static int veth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) -{ - cmd->supported = 0; - cmd->advertising = 0; - cmd->speed = SPEED_10000; - cmd->duplex = DUPLEX_FULL; - cmd->port = PORT_TP; - cmd->phy_address = 0; - cmd->transceiver = XCVR_INTERNAL; - cmd->autoneg = AUTONEG_DISABLE; - cmd->maxtxpkt = 0; - cmd->maxrxpkt = 0; - return 0; -} - -static void veth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) -{ - strcpy(info->driver, DRV_NAME); - strcpy(info->version, DRV_VERSION); - strcpy(info->fw_version, "N/A"); -} - -static void veth_get_strings(struct net_device *dev, u32 stringset, u8 *buf) -{ - switch(stringset) { - case ETH_SS_STATS: - memcpy(buf, ðtool_stats_keys, sizeof(ethtool_stats_keys)); - break; - } -} - -static void veth_get_ethtool_stats(struct net_device *dev, - struct ethtool_stats *stats, u64 *data) -{ - struct veth_priv *priv; - - priv = netdev_priv(dev); - data[0] = priv->peer->ifindex; -} - -static u32 veth_get_rx_csum(struct net_device *dev) -{ - struct veth_priv *priv; - - priv = netdev_priv(dev); - return priv->ip_summed == CHECKSUM_UNNECESSARY; -} - -static int veth_set_rx_csum(struct net_device *dev, u32 data) -{ - struct veth_priv *priv; - - priv = netdev_priv(dev); - priv->ip_summed = data ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE; - return 0; -} - -static u32 veth_get_tx_csum(struct net_device *dev) -{ - return (dev->features & NETIF_F_NO_CSUM) != 0; -} - -static int veth_set_tx_csum(struct net_device *dev, u32 data) -{ - if (data) - dev->features |= NETIF_F_NO_CSUM; - else - dev->features &= ~NETIF_F_NO_CSUM; - return 0; -} - -static struct ethtool_ops veth_ethtool_ops = { - .get_settings = veth_get_settings, - .get_drvinfo = veth_get_drvinfo, - .get_link = ethtool_op_get_link, - .get_rx_csum = veth_get_rx_csum, - .set_rx_csum = veth_set_rx_csum, - .get_tx_csum = veth_get_tx_csum, - .set_tx_csum = veth_set_tx_csum, - .get_sg = ethtool_op_get_sg, - .set_sg = ethtool_op_set_sg, - .get_strings = veth_get_strings, - .get_ethtool_stats = veth_get_ethtool_stats, -}; - -/* - * xmit - */ - -static int veth_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct net_device *rcv = NULL; - struct veth_priv *priv, *rcv_priv; - struct veth_net_stats *stats; - int length, cpu; - - skb_orphan(skb); - - priv = netdev_priv(dev); - rcv = priv->peer; - rcv_priv = netdev_priv(rcv); - - cpu = smp_processor_id(); - stats = per_cpu_ptr(priv->stats, cpu); - - if (!(rcv->flags & IFF_UP)) - goto outf; - - skb->dev = rcv; - skb->pkt_type = PACKET_HOST; - skb->protocol = eth_type_trans(skb, rcv); - if (dev->features & NETIF_F_NO_CSUM) - skb->ip_summed = rcv_priv->ip_summed; - - dst_release(skb->dst); - skb->dst = NULL; - secpath_reset(skb); - nf_reset(skb); - - length = skb->len; - - stats->tx_bytes += length; - stats->tx_packets++; - - stats = per_cpu_ptr(rcv_priv->stats, cpu); - stats->rx_bytes += length; - stats->rx_packets++; - - netif_rx(skb); - return 0; - -outf: - kfree_skb(skb); - stats->tx_dropped++; - return 0; -} - -/* - * general routines - */ - -static struct net_device_stats *veth_get_stats(struct net_device *dev) -{ - struct veth_priv *priv; - struct net_device_stats *dev_stats; - int cpu; - struct veth_net_stats *stats; - - priv = netdev_priv(dev); - dev_stats = &priv->dev_stats; - - dev_stats->rx_packets = 0; - dev_stats->tx_packets = 0; - dev_stats->rx_bytes = 0; - dev_stats->tx_bytes = 0; - dev_stats->tx_dropped = 0; - - for_each_online_cpu(cpu) { - stats = per_cpu_ptr(priv->stats, cpu); - - dev_stats->rx_packets += stats->rx_packets; - dev_stats->tx_packets += stats->tx_packets; - dev_stats->rx_bytes += stats->rx_bytes; - dev_stats->tx_bytes += stats->tx_bytes; - dev_stats->tx_dropped += stats->tx_dropped; - } - - return dev_stats; -} - -static int veth_open(struct net_device *dev) -{ - struct veth_priv *priv; - - priv = netdev_priv(dev); - if (priv->peer == NULL) - return -ENOTCONN; - - if (priv->peer->flags & IFF_UP) { - netif_carrier_on(dev); - netif_carrier_on(priv->peer); - } - return 0; -} - -static int veth_dev_init(struct net_device *dev) -{ - struct veth_net_stats *stats; - struct veth_priv *priv; - - stats = alloc_percpu(struct veth_net_stats); - if (stats == NULL) - return -ENOMEM; - - priv = netdev_priv(dev); - priv->stats = stats; - return 0; -} - -static void veth_dev_free(struct net_device *dev) -{ - struct veth_priv *priv; - - priv = netdev_priv(dev); - free_percpu(priv->stats); - free_netdev(dev); -} - -static void veth_setup(struct net_device *dev) -{ - ether_setup(dev); - - dev->hard_start_xmit = veth_xmit; - dev->get_stats = veth_get_stats; - dev->open = veth_open; - dev->ethtool_ops = &veth_ethtool_ops; - dev->features |= NETIF_F_LLTX; - dev->init = veth_dev_init; - dev->destructor = veth_dev_free; -} - -static void veth_change_state(struct net_device *dev) -{ - struct net_device *peer; - struct veth_priv *priv; - - priv = netdev_priv(dev); - peer = priv->peer; - - if (netif_carrier_ok(peer)) { - if (!netif_carrier_ok(dev)) - netif_carrier_on(dev); - } else { - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); - } -} - -static int veth_device_event(struct notifier_block *unused, - unsigned long event, void *ptr) -{ - struct net_device *dev = ptr; - - if (dev->open != veth_open) - goto out; - - switch (event) { - case NETDEV_CHANGE: - veth_change_state(dev); - break; - } -out: - return NOTIFY_DONE; -} - -static struct notifier_block veth_notifier_block __read_mostly = { - .notifier_call = veth_device_event, -}; - -/* - * netlink interface - */ - -static int veth_newlink(const char *devname, const char *peername) -{ - int err; - const char *names[2]; - struct net_device *devs[2]; - int i; - - names[0] = devname; - names[1] = peername; - devs[0] = devs[1] = NULL; - - for (i = 0; i < 2; i++) { - struct net_device *dev; - - err = -ENOMEM; - devs[i] = alloc_netdev(sizeof(struct veth_priv), - names[i], veth_setup); - if (!devs[i]) { - goto err; - } - - dev = devs[i]; - - if (strchr(dev->name, '%')) { - err = dev_alloc_name(dev, dev->name); - if (err < 0) - goto err; - } - random_ether_addr(dev->dev_addr); - - err = register_netdevice(dev); - if (err < 0) - goto err; - - netif_carrier_off(dev); - } - - /* - * tie the devices together - */ - - for (i = 0; i < 2; i++) { - struct veth_priv *priv = netdev_priv(devs[i]); - priv->dev = devs[i]; - priv->peer = devs[!i]; - if (!i) - list_add(&priv->list, &veth_list); - else - INIT_LIST_HEAD(&priv->list); - } - return 0; - -err: - for (i = 0; i < 2; i++) { - if (devs[i]) { - if (devs[i]->reg_state != NETREG_UNINITIALIZED) - unregister_netdevice(devs[i]); - else - free_netdev(devs[i]); - } - } - return err; -} - -static void veth_dellink(struct net_device *dev) -{ - struct veth_priv *priv; - struct net_device *peer; - - priv = netdev_priv(dev); - peer = priv->peer; - - if (!list_empty(&priv->list)) - list_del(&priv->list); - - priv = netdev_priv(peer); - if (!list_empty(&priv->list)) - list_del(&priv->list); - - unregister_netdevice(dev); - unregister_netdevice(peer); -} - -/* - * sysfs - */ - -/* - * "show" function for the veth_pairs attribute. - * The class parameter is ignored. - */ -static ssize_t veth_show_veth_pairs(struct class *cls, char *buffer) -{ - int res = 0; - struct veth_priv *priv; - - list_for_each_entry(priv, &veth_list, list) { - if (res > (PAGE_SIZE - (IFNAMSIZ * 2 + 1))) { - /* not enough space for another interface name */ - if ((PAGE_SIZE - res) > 10) - res = PAGE_SIZE - 10; - res += sprintf(buffer + res, "++more++"); - break; - } - res += sprintf(buffer + res, "%s,%s ", - priv->dev->name, priv->peer->name); - } - res += sprintf(buffer + res, "\n"); - res++; - return res; -} - -/* - * "store" function for the veth_pairs attribute. This is what - * creates and deletes veth pairs. - * - * The class parameter is ignored. - * - */ -static ssize_t veth_store_veth_pairs(struct class *cls, const char *buffer, - size_t count) -{ - int c = *buffer++; - int retval; - if (c == '+') { - char devname[IFNAMSIZ + 1] = ""; - char peername[IFNAMSIZ + 1] = ""; - char *comma = strchr(buffer, ','); - if (!comma) - goto err_no_cmd; - strncat(devname, buffer, - min_t(int, sizeof devname, comma - buffer)); - strncat(peername, comma + 1, - min_t(int, sizeof peername, strcspn(comma + 1, "\n"))); - if (!dev_valid_name(devname) || !dev_valid_name(peername)) - goto err_no_cmd; - rtnl_lock(); - retval = veth_newlink(devname, peername); - rtnl_unlock(); - return retval ? retval : count; - } else if (c == '-') { - char devname[IFNAMSIZ + 1] = ""; - struct net_device *dev; - - strncat(devname, buffer, - min_t(int, sizeof devname, strcspn(buffer, "\n"))); - rtnl_lock(); - dev = __dev_get_by_name(devname); - if (!dev) - retval = -ENODEV; - else if (dev->init != veth_dev_init) - retval = -EINVAL; - else { - veth_dellink(dev); - retval = count; - } - rtnl_unlock(); - - return retval; - } - -err_no_cmd: - printk(KERN_ERR DRV_NAME ": no command found in veth_pairs. Use +ifname,peername or -ifname.\n"); - return -EPERM; -} - -/* class attribute for veth_pairs file. This ends up in /sys/class/net */ -static CLASS_ATTR(veth_pairs, S_IWUSR | S_IRUGO, - veth_show_veth_pairs, veth_store_veth_pairs); - -static struct class *netdev_class; - -/* - * Initialize sysfs. This sets up the veth_pairs file in - * /sys/class/net. - */ -int veth_create_sysfs(void) -{ - struct net_device *dev = dev_get_by_name("lo"); - if (!dev) - return -ESRCH; - netdev_class = dev->class_dev.class; - if (!netdev_class) - return -ENODEV; - - return class_create_file(netdev_class, &class_attr_veth_pairs); -} - -/* - * Remove /sys/class/net/veth_pairs. - */ -void veth_destroy_sysfs(void) -{ - class_remove_file(netdev_class, &class_attr_veth_pairs); -} - - - -/* - * init/fini - */ - -static __init int veth_init(void) -{ - int retval = veth_create_sysfs(); - if (retval) - return retval; - register_netdevice_notifier(&veth_notifier_block); - return 0; -} - -static __exit void veth_exit(void) -{ - struct veth_priv *p, *n; - - rtnl_lock(); - - list_for_each_entry_safe(p, n, &veth_list, list) - veth_dellink(p->dev); - - rtnl_unlock(); - - unregister_netdevice_notifier(&veth_notifier_block); - veth_destroy_sysfs(); -} - -module_init(veth_init); -module_exit(veth_exit); - -MODULE_DESCRIPTION("Virtual Ethernet Tunnel"); -MODULE_LICENSE("GPL v2"); diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index e9fabc5b..b8d24ed9 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -90,10 +90,6 @@ struct tap_state { int fd; }; -struct patch_state { - char *peer; -}; - struct netdev_dev_linux { struct netdev_dev netdev_dev; @@ -115,7 +111,6 @@ struct netdev_dev_linux { union { struct tap_state tap; - struct patch_state patch; } state; }; @@ -243,123 +238,6 @@ netdev_linux_cache_cb(const struct rtnetlink_change *change, } } -static int -if_up(const char *name) -{ - struct ifreq ifr; - - strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name); - ifr.ifr_flags = IFF_UP; - - if (ioctl(af_inet_sock, SIOCSIFFLAGS, &ifr) == -1) { - VLOG_DBG_RL(&rl, "%s: failed to bring device up: %s", - name, strerror(errno)); - return errno; - } - - return 0; -} - -/* A veth may be created using the 'command' "+,". A veth may - * be destroyed by using the 'command' "-", where can be - * either side of the device. - */ -static int -modify_veth(const char *format, ...) -{ - FILE *veth_file; - va_list args; - int retval; - - veth_file = fopen("/sys/class/net/veth_pairs", "w"); - if (!veth_file) { - VLOG_WARN_RL(&rl, "could not open veth device. Are you running a " - "supported XenServer with the kernel module loaded?"); - return ENODEV; - } - setvbuf(veth_file, NULL, _IONBF, 0); - - va_start(args, format); - retval = vfprintf(veth_file, format, args); - va_end(args); - - fclose(veth_file); - if (retval < 0) { - VLOG_WARN_RL(&rl, "could not destroy patch: %s", strerror(errno)); - return errno; - } - - return 0; -} - -static int -create_patch(const char *name, const char *peer) -{ - int retval; - struct netdev_dev *peer_nd; - - - /* Only create the veth if the peer didn't already do it. */ - peer_nd = netdev_dev_from_name(peer); - if (peer_nd) { - if (!strcmp("patch", netdev_dev_get_type(peer_nd))) { - struct netdev_dev_linux *ndl = netdev_dev_linux_cast(peer_nd); - if (!strcmp(name, ndl->state.patch.peer)) { - return 0; - } else { - VLOG_WARN_RL(&rl, "peer '%s' already paired with '%s'", - peer, ndl->state.patch.peer); - return EINVAL; - } - } else { - VLOG_WARN_RL(&rl, "peer '%s' exists and is not a patch", peer); - return EINVAL; - } - } - - retval = modify_veth("+%s,%s", name, peer); - if (retval) { - return retval; - } - - retval = if_up(name); - if (retval) { - return retval; - } - - retval = if_up(peer); - if (retval) { - return retval; - } - - return 0; -} - -static int -setup_patch(const char *name, const struct shash *args, char **peer_) -{ - const char *peer; - - peer = shash_find_data(args, "peer"); - if (!peer) { - VLOG_WARN("patch type requires valid 'peer' argument"); - return EINVAL; - } - - if (shash_count(args) > 1) { - VLOG_WARN("patch type takes only a 'peer' argument"); - return EINVAL; - } - - if (strlen(peer) >= IFNAMSIZ) { - VLOG_WARN_RL(&rl, "patch 'peer' arg too long"); - return EINVAL; - } - - *peer_ = xstrdup(peer); - return create_patch(name, peer); -} - /* Creates the netdev device of 'type' with 'name'. */ static int netdev_linux_create_system(const char *name, const char *type OVS_UNUSED, @@ -444,28 +322,6 @@ error: return error; } -static int -netdev_linux_create_patch(const char *name, const char *type OVS_UNUSED, - const struct shash *args, struct netdev_dev **netdev_devp) -{ - struct netdev_dev_linux *netdev_dev; - char *peer = NULL; - int error; - - error = setup_patch(name, args, &peer); - if (error) { - free(peer); - return error; - } - - netdev_dev = xzalloc(sizeof *netdev_dev); - netdev_dev->state.patch.peer = peer; - netdev_dev_init(&netdev_dev->netdev_dev, name, &netdev_patch_class); - *netdev_devp = &netdev_dev->netdev_dev; - - return 0; -} - static void destroy_tap(struct netdev_dev_linux *netdev_dev) { @@ -476,19 +332,6 @@ destroy_tap(struct netdev_dev_linux *netdev_dev) } } -static void -destroy_patch(struct netdev_dev_linux *netdev_dev) -{ - const char *name = netdev_dev_get_name(&netdev_dev->netdev_dev); - struct patch_state *state = &netdev_dev->state.patch; - - /* Only destroy veth if 'peer' doesn't exist as an existing netdev. */ - if (!netdev_dev_from_name(state->peer)) { - modify_veth("-%s", name); - } - free(state->peer); -} - /* Destroys the netdev device 'netdev_dev_'. */ static void netdev_linux_destroy(struct netdev_dev *netdev_dev_) @@ -504,8 +347,6 @@ netdev_linux_destroy(struct netdev_dev *netdev_dev_) } } else if (!strcmp(type, "tap")) { destroy_tap(netdev_dev); - } else if (!strcmp(type, "patch")) { - destroy_patch(netdev_dev); } free(netdev_dev); @@ -1844,55 +1685,6 @@ const struct netdev_class netdev_tap_class = { netdev_linux_poll_remove, }; -const struct netdev_class netdev_patch_class = { - "patch", - - netdev_linux_init, - netdev_linux_run, - netdev_linux_wait, - - netdev_linux_create_patch, - netdev_linux_destroy, - NULL, /* reconfigure */ - - netdev_linux_open, - netdev_linux_close, - - NULL, /* enumerate */ - - netdev_linux_recv, - netdev_linux_recv_wait, - netdev_linux_drain, - - netdev_linux_send, - netdev_linux_send_wait, - - netdev_linux_set_etheraddr, - netdev_linux_get_etheraddr, - netdev_linux_get_mtu, - netdev_linux_get_ifindex, - netdev_linux_get_carrier, - netdev_linux_get_stats, - NULL, /* set_stats */ - - netdev_linux_get_features, - netdev_linux_set_advertisements, - netdev_linux_get_vlan_vid, - netdev_linux_set_policing, - - netdev_linux_get_in4, - netdev_linux_set_in4, - netdev_linux_get_in6, - netdev_linux_add_router, - netdev_linux_get_next_hop, - netdev_linux_arp_lookup, - - netdev_linux_update_flags, - - netdev_linux_poll_add, - netdev_linux_poll_remove, -}; - static int get_stats_via_netlink(int ifindex, struct netdev_stats *stats) diff --git a/lib/netdev-patch.c b/lib/netdev-patch.c index 21a03636..22353a19 100644 --- a/lib/netdev-patch.c +++ b/lib/netdev-patch.c @@ -41,14 +41,14 @@ struct netdev_patch { static struct netdev_dev_patch * netdev_dev_patch_cast(const struct netdev_dev *netdev_dev) { - netdev_dev_assert_class(netdev_dev, &netdev_patchnew_class); + netdev_dev_assert_class(netdev_dev, &netdev_patch_class); return CONTAINER_OF(netdev_dev, struct netdev_dev_patch, netdev_dev); } static struct netdev_patch * netdev_patch_cast(const struct netdev *netdev) { - netdev_assert_class(netdev, &netdev_patchnew_class); + netdev_assert_class(netdev, &netdev_patch_class); return CONTAINER_OF(netdev, struct netdev_patch, netdev); } @@ -119,7 +119,7 @@ netdev_patch_create(const char *name, const char *type OVS_UNUSED, } netdev_dev = xmalloc(sizeof *netdev_dev); - netdev_dev_init(&netdev_dev->netdev_dev, name, &netdev_patchnew_class); + netdev_dev_init(&netdev_dev->netdev_dev, name, &netdev_patch_class); *netdev_devp = &netdev_dev->netdev_dev; return 0; @@ -173,8 +173,8 @@ netdev_patch_close(struct netdev *netdev_) free(netdev); } -const struct netdev_class netdev_patchnew_class = { - "patchnew", +const struct netdev_class netdev_patch_class = { + "patch", NULL, /* init */ NULL, /* run */ diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index dcaaa869..024b1fb7 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -399,9 +399,8 @@ struct netdev_class { extern const struct netdev_class netdev_linux_class; extern const struct netdev_class netdev_tap_class; -extern const struct netdev_class netdev_gre_class; extern const struct netdev_class netdev_patch_class; -extern const struct netdev_class netdev_patchnew_class; +extern const struct netdev_class netdev_gre_class; #ifdef __cplusplus } diff --git a/lib/netdev.c b/lib/netdev.c index c2049bf3..c21afef8 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -44,9 +44,8 @@ static const struct netdev_class *base_netdev_classes[] = { &netdev_linux_class, &netdev_tap_class, - &netdev_gre_class, &netdev_patch_class, - &netdev_patchnew_class, + &netdev_gre_class, }; static struct shash netdev_classes = SHASH_INITIALIZER(&netdev_classes); diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch index a15ab2b4..c6cc66b5 100755 --- a/xenserver/etc_init.d_openvswitch +++ b/xenserver/etc_init.d_openvswitch @@ -146,9 +146,6 @@ function insert_modules_if_required { if [ "$ENABLE_BRCOMPAT" = "y" ] && [ -n "$BRCOMPATD_PIDFILE" ] && ! lsmod | grep -q "brcompat_mod"; then action "Inserting brcompat module" modprobe brcompat_mod fi - if [ -f "/lib/modules/`uname -r`/kernel/extra/openvswitch/veth_mod.ko" ] && ! lsmod | grep -q "veth_mod"; then - action "Inserting veth module" modprobe veth_mod - fi } function remove_modules { diff --git a/xenserver/openvswitch-xen.spec b/xenserver/openvswitch-xen.spec index bd9d27a4..3418dae1 100644 --- a/xenserver/openvswitch-xen.spec +++ b/xenserver/openvswitch-xen.spec @@ -337,9 +337,6 @@ fi /etc/profile.d/openvswitch.sh /lib/modules/%{xen_version}/kernel/extra/openvswitch/openvswitch_mod.ko /lib/modules/%{xen_version}/kernel/extra/openvswitch/brcompat_mod.ko -%if %(echo '%{xen_version}'|awk -F"[.-]" '{if ($3==18) print 1; else print 0;}') -/lib/modules/%{xen_version}/kernel/extra/openvswitch/veth_mod.ko -%endif /usr/share/openvswitch/scripts/refresh-network-uuids /usr/share/openvswitch/scripts/interface-reconfigure /usr/share/openvswitch/scripts/InterfaceReconfigure.py -- 2.30.2