2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

dpif: Support fetching flow mask via dpif_flow_get().

Change the interface to allow implementations to pass back a buffer, and
allow callers to specify which of actions, mask, and stats they wish to
receive. This will be used in the next commit.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Joe Stringer
2014-07-08 07:04:04 +00:00
parent bdb2e73bb1
commit 781fce1574
5 changed files with 73 additions and 41 deletions

View File

@@ -1203,7 +1203,10 @@ dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
static int
dpif_netdev_flow_get(const struct dpif *dpif,
const struct nlattr *nl_key, size_t nl_key_len,
struct ofpbuf **actionsp, struct dpif_flow_stats *stats)
struct ofpbuf **bufp,
struct nlattr **maskp, size_t *mask_len,
struct nlattr **actionsp, size_t *actions_len,
struct dpif_flow_stats *stats)
{
struct dp_netdev *dp = get_dp_netdev(dpif);
struct dp_netdev_flow *netdev_flow;
@@ -1222,11 +1225,23 @@ dpif_netdev_flow_get(const struct dpif *dpif,
get_dpif_flow_stats(netdev_flow, stats);
}
if (maskp) {
struct flow_wildcards wc;
*bufp = ofpbuf_new(sizeof(struct odputil_keybuf));
minimask_expand(&netdev_flow->cr.match.mask, &wc);
odp_flow_key_from_mask(*bufp, &wc.masks, &netdev_flow->flow,
odp_to_u32(wc.masks.in_port.odp_port),
SIZE_MAX, true);
*maskp = ofpbuf_data(*bufp);
*mask_len = ofpbuf_size(*bufp);
}
if (actionsp) {
struct dp_netdev_actions *actions;
actions = dp_netdev_flow_get_actions(netdev_flow);
*actionsp = ofpbuf_clone_data(actions->actions, actions->size);
*actionsp = actions->actions;
*actions_len = actions->size;
}
} else {
error = ENOENT;