/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
static int dpif_linux_init(void);
static int open_dpif(const struct dpif_linux_dp *, struct dpif **);
static uint32_t dpif_linux_port_get_pid(const struct dpif *,
- odp_port_t port_no);
+ odp_port_t port_no, uint32_t hash);
static int dpif_linux_refresh_channels(struct dpif *);
static void dpif_linux_vport_to_ofpbuf(const struct dpif_linux_vport *,
dpif->n_events = dpif->event_offset = 0;
/* Don't close dpif->epoll_fd since that would cause other threads that
- * call dpif_recv_wait(dpif) to wait on an arbitrary fd or a closed fd. */
+ * call dpif_recv_wait() to wait on an arbitrary fd or a closed fd. */
}
static int
ofpbuf_use_stack(&options, options_stub, sizeof options_stub);
nl_msg_put_u16(&options, OVS_TUNNEL_ATTR_DST_PORT,
ntohs(tnl_cfg->dst_port));
- request.options = options.data;
- request.options_len = options.size;
+ request.options = ofpbuf_data(&options);
+ request.options_len = ofpbuf_size(&options);
}
request.port_no = *port_nop;
}
static uint32_t
-dpif_linux_port_get_pid(const struct dpif *dpif_, odp_port_t port_no)
+dpif_linux_port_get_pid(const struct dpif *dpif_, odp_port_t port_no,
+ uint32_t hash OVS_UNUSED)
{
struct dpif_linux *dpif = dpif_linux_cast(dpif_);
uint32_t port_idx = odp_to_u32(port_no);
dpif_linux_flow_get_stats(&reply, stats);
}
if (actionsp) {
- buf->data = CONST_CAST(struct nlattr *, reply.actions);
- buf->size = reply.actions_len;
+ ofpbuf_set_data(buf, CONST_CAST(struct nlattr *, reply.actions));
+ ofpbuf_set_size(buf, reply.actions_len);
*actionsp = buf;
} else {
ofpbuf_delete(buf);
return error;
}
+static bool
+dpif_linux_flow_dump_next_may_destroy_keys(void *state_)
+{
+ struct dpif_linux_flow_state *state = state_;
+
+ return ofpbuf_size(&state->buffer) ? false : true;
+}
+
static int
dpif_linux_flow_dump_done(const struct dpif *dpif OVS_UNUSED, void *iter_)
{
unsigned int nl_status = nl_dump_done(&iter->dump);
atomic_read(&iter->status, &dump_status);
- atomic_destroy(&iter->status);
free(iter);
return dump_status ? dump_status : nl_status;
}
size_t key_ofs;
ofpbuf_prealloc_tailroom(buf, (64
- + d_exec->packet->size
+ + ofpbuf_size(d_exec->packet)
+ ODP_KEY_METADATA_SIZE
+ d_exec->actions_len));
k_exec->dp_ifindex = dp_ifindex;
nl_msg_put_unspec(buf, OVS_PACKET_ATTR_PACKET,
- d_exec->packet->data, d_exec->packet->size);
+ ofpbuf_data(d_exec->packet),
+ ofpbuf_size(d_exec->packet));
key_ofs = nl_msg_start_nested(buf, OVS_PACKET_ATTR_KEY);
odp_key_from_pkt_metadata(buf, &d_exec->md);
return error;
}
+static int
+dpif_linux_handlers_set(struct dpif *dpif_ OVS_UNUSED,
+ uint32_t n_handlers OVS_UNUSED)
+{
+ return 0;
+}
+
static int
dpif_linux_queue_to_priority(const struct dpif *dpif OVS_UNUSED,
uint32_t queue_id, uint32_t *priority)
struct ofpbuf b;
int type;
- ofpbuf_use_const(&b, buf->data, buf->size);
+ ofpbuf_use_const(&b, ofpbuf_data(buf), ofpbuf_size(buf));
nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
genl = ofpbuf_try_pull(&b, sizeof *genl);
nl_attr_get(a[OVS_PACKET_ATTR_PACKET])) - 1,
nl_attr_get_size(a[OVS_PACKET_ATTR_PACKET]) +
sizeof(struct nlattr));
- upcall->packet.data = (char *)upcall->packet.data + sizeof(struct nlattr);
- upcall->packet.size = nl_attr_get_size(a[OVS_PACKET_ATTR_PACKET]);
+ ofpbuf_set_data(&upcall->packet,
+ (char *)ofpbuf_data(&upcall->packet) + sizeof(struct nlattr));
+ ofpbuf_set_size(&upcall->packet, nl_attr_get_size(a[OVS_PACKET_ATTR_PACKET]));
*dp_ifindex = ovs_header->dp_ifindex;
}
static int
-dpif_linux_recv(struct dpif *dpif_, struct dpif_upcall *upcall,
- struct ofpbuf *buf)
+dpif_linux_recv(struct dpif *dpif_, uint32_t handler_id OVS_UNUSED,
+ struct dpif_upcall *upcall, struct ofpbuf *buf)
{
struct dpif_linux *dpif = dpif_linux_cast(dpif_);
int error;
}
static void
-dpif_linux_recv_wait(struct dpif *dpif_)
+dpif_linux_recv_wait(struct dpif *dpif_, uint32_t handler_id OVS_UNUSED)
{
struct dpif_linux *dpif = dpif_linux_cast(dpif_);
dpif_linux_flow_dump_state_init,
dpif_linux_flow_dump_start,
dpif_linux_flow_dump_next,
+ dpif_linux_flow_dump_next_may_destroy_keys,
dpif_linux_flow_dump_done,
dpif_linux_flow_dump_state_uninit,
dpif_linux_execute,
dpif_linux_operate,
dpif_linux_recv_set,
+ dpif_linux_handlers_set,
dpif_linux_queue_to_priority,
dpif_linux_recv,
dpif_linux_recv_wait,
dpif_linux_vport_init(vport);
- ofpbuf_use_const(&b, buf->data, buf->size);
+ ofpbuf_use_const(&b, ofpbuf_data(buf), ofpbuf_size(buf));
nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
genl = ofpbuf_try_pull(&b, sizeof *genl);
ovs_header = ofpbuf_try_pull(&b, sizeof *ovs_header);
dpif_linux_dp_init(dp);
- ofpbuf_use_const(&b, buf->data, buf->size);
+ ofpbuf_use_const(&b, ofpbuf_data(buf), ofpbuf_size(buf));
nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
genl = ofpbuf_try_pull(&b, sizeof *genl);
ovs_header = ofpbuf_try_pull(&b, sizeof *ovs_header);
dpif_linux_flow_init(flow);
- ofpbuf_use_const(&b, buf->data, buf->size);
+ ofpbuf_use_const(&b, ofpbuf_data(buf), ofpbuf_size(buf));
nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
genl = ofpbuf_try_pull(&b, sizeof *genl);
ovs_header = ofpbuf_try_pull(&b, sizeof *ovs_header);