On Wed, Feb 08, 2017 at 05:29:25PM +0200, Roi Dayan wrote:
> From: Paul Blakey <[email protected]>
> 
> Using the new netdev flow api operate will now try and
> offload flows to the relevant netdev of the input port.
> Other operate methods flows will come in later patches.
> 
> Signed-off-by: Paul Blakey <[email protected]>
> Reviewed-by: Roi Dayan <[email protected]>
> ---
>  lib/dpif-netlink.c | 222 
> +++++++++++++++++++++++++++++++++++++++++++++++++++--
>  lib/odp-util.c     |  53 +++++++++++++
>  lib/odp-util.h     |   3 +
>  3 files changed, 271 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
> index 5519c10..a7525de 100644
> --- a/lib/dpif-netlink.c
> +++ b/lib/dpif-netlink.c

...

> @@ -1922,18 +1921,227 @@ dpif_netlink_operate__(struct dpif_netlink *dpif,
>      return n_ops;
>  }
>  
> +static int
> +parse_flow_get(struct dpif_netlink *dpif, struct dpif_flow_get *get)
> +{
> +    struct dpif_flow *dpif_flow = get->flow;
> +    struct match match;
> +    struct nlattr *actions;
> +    struct dpif_flow_stats stats;
> +    struct ofpbuf buf;
> +    uint64_t act_buf[1024 / 8];
> +    struct odputil_keybuf maskbuf;
> +    struct odputil_keybuf keybuf;
> +    struct odputil_keybuf actbuf;
> +    struct ofpbuf key, mask, act;
> +    int err;
> +
> +    ofpbuf_use_stack(&buf, &act_buf, sizeof act_buf);
> +    err = netdev_ports_flow_get(DPIF_HMAP_KEY(&dpif->dpif), &match,
> +                                &actions, &stats, get->ufid, &buf);
> +    if (err) {
> +        return err;
> +    }
> +
> +    VLOG_DBG("found flow from netdev, translating to dpif flow");
> +
> +    ofpbuf_use_stack(&key, &keybuf, sizeof keybuf);
> +    ofpbuf_use_stack(&act, &actbuf, sizeof actbuf);
> +    ofpbuf_use_stack(&mask, &maskbuf, sizeof maskbuf);
> +    dpif_netlink_netdev_match_to_dpif_flow(&match, &key, &mask, actions,
> +                                           &stats,
> +                                           (ovs_u128 *) get->ufid,
> +                                           dpif_flow,
> +                                           false);
> +    ofpbuf_put(get->buffer, nl_attr_get(actions), nl_attr_get_size(actions));
> +    dpif_flow->actions = ofpbuf_at(get->buffer, 0, 0);
> +    dpif_flow->actions_len = nl_attr_get_size(actions);
> +
> +    // XXX: missing ofpbuf_uninit?

If I am reading things right then the ofpufs are all initialised using
ofpbuf_use_stack(). If so then calling ofpbuf_uninit() should not be
necessary.

...
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to