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_)
{
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;
};
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;
}
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);
}
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])
NULL, /* recv_wait */ \
NULL, /* drain */ \
\
- netdev_vport_send, /* send */ \
+ NULL, /* send */ \
NULL, /* send_wait */ \
\
netdev_vport_set_etheraddr, \