[ovs-dev] [PATCH 07/10] netdev-vport: Remove the ability to send packets.

Ethan Jackson ethan at nicira.com
Thu Dec 20 03:11:44 UTC 2012


The only user of netdev_send() is dpif-netdev which doesn't support
vports.

Signed-off-by: Ethan Jackson <ethan at nicira.com>
---
 lib/dpif-linux.c   |   27 ---------------------------
 lib/dpif-linux.h   |    3 ---
 lib/netdev-vport.c |   34 +---------------------------------
 3 files changed, 1 insertion(+), 63 deletions(-)

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 87eb9c1..d9dd3b2 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 c9150b0..966abc1 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 2b493a7..ce4cea2 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);
     }
 
@@ -315,32 +309,6 @@ netdev_vport_set_config(struct netdev_dev *dev_, const struct smap *args)
 }
 
 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,                             \
-- 
1.7.9.5




More information about the dev mailing list