From: Ethan Jackson Date: Thu, 22 Nov 2012 00:17:45 +0000 (-0800) Subject: netdev-vport: Remove the ability to send packets. X-Git-Tag: sliver-openvswitch-1.9.90-3~10^2~69 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=552e20d02a32cf70b4fcaa18d6f0817f80a3d8d0;p=sliver-openvswitch.git netdev-vport: Remove the ability to send packets. The only user of netdev_send() is dpif-netdev which doesn't support vports. Signed-off-by: Ethan Jackson --- diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index 87eb9c184..d9dd3b2ee 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -1376,33 +1376,6 @@ dpif_linux_is_internal_device(const char *name) return reply.type == OVS_VPORT_TYPE_INTERNAL; } -int -dpif_linux_vport_send(int dp_ifindex, uint32_t port_no, - const void *data, size_t size) -{ - struct ofpbuf actions, key, packet; - struct odputil_keybuf keybuf; - struct dpif_execute execute; - struct flow flow; - uint64_t action; - - ofpbuf_use_const(&packet, data, size); - flow_extract(&packet, 0, 0, NULL, 0, &flow); - - ofpbuf_use_stack(&key, &keybuf, sizeof keybuf); - odp_flow_key_from_flow(&key, &flow, OVSP_NONE); - - ofpbuf_use_stack(&actions, &action, sizeof action); - nl_msg_put_u32(&actions, OVS_ACTION_ATTR_OUTPUT, port_no); - - execute.key = key.data; - execute.key_len = key.size; - execute.actions = actions.data; - execute.actions_len = actions.size; - execute.packet = &packet; - return dpif_linux_execute__(dp_ifindex, &execute); -} - static bool dpif_linux_nln_parse(struct ofpbuf *buf, void *vport_) { diff --git a/lib/dpif-linux.h b/lib/dpif-linux.h index c9150b0d6..966abc100 100644 --- a/lib/dpif-linux.h +++ b/lib/dpif-linux.h @@ -56,7 +56,4 @@ int dpif_linux_vport_get(const char *name, struct dpif_linux_vport *reply, bool dpif_linux_is_internal_device(const char *name); -int dpif_linux_vport_send(int dp_ifindex, uint32_t port_no, - const void *data, size_t size); - #endif /* dpif-linux.h */ diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 2b493a7f9..ce4cea270 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -55,8 +55,6 @@ VLOG_DEFINE_THIS_MODULE(netdev_vport); struct netdev_dev_vport { struct netdev_dev netdev_dev; struct ofpbuf *options; - int dp_ifindex; /* -1 if unknown. */ - uint32_t port_no; /* UINT32_MAX if unknown. */ unsigned int change_seq; }; @@ -198,8 +196,6 @@ netdev_vport_create(const struct netdev_class *netdev_class, const char *name, dev = xmalloc(sizeof *dev); netdev_dev_init(&dev->netdev_dev, name, netdev_class); dev->options = NULL; - dev->dp_ifindex = -1; - dev->port_no = UINT32_MAX; dev->change_seq = 1; *netdev_devp = &dev->netdev_dev; @@ -258,8 +254,6 @@ netdev_vport_get_config(struct netdev_dev *dev_, struct smap *args) } dev->options = ofpbuf_clone_data(reply.options, reply.options_len); - dev->dp_ifindex = reply.dp_ifindex; - dev->port_no = reply.port_no; ofpbuf_delete(buf); } @@ -314,32 +308,6 @@ netdev_vport_set_config(struct netdev_dev *dev_, const struct smap *args) return error; } -static int -netdev_vport_send(struct netdev *netdev, const void *data, size_t size) -{ - struct netdev_dev *dev_ = netdev_get_dev(netdev); - struct netdev_dev_vport *dev = netdev_dev_vport_cast(dev_); - - if (dev->dp_ifindex == -1) { - const char *name = netdev_get_name(netdev); - struct dpif_linux_vport reply; - struct ofpbuf *buf; - int error; - - error = dpif_linux_vport_get(name, &reply, &buf); - if (error) { - VLOG_ERR_RL(&rl, "%s: failed to query vport for send (%s)", - name, strerror(error)); - return error; - } - dev->dp_ifindex = reply.dp_ifindex; - dev->port_no = reply.port_no; - ofpbuf_delete(buf); - } - - return dpif_linux_vport_send(dev->dp_ifindex, dev->port_no, data, size); -} - static int netdev_vport_set_etheraddr(struct netdev *netdev, const uint8_t mac[ETH_ADDR_LEN]) @@ -952,7 +920,7 @@ unparse_patch_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED, NULL, /* recv_wait */ \ NULL, /* drain */ \ \ - netdev_vport_send, /* send */ \ + NULL, /* send */ \ NULL, /* send_wait */ \ \ netdev_vport_set_etheraddr, \