[ovs-dev] [PATCH] netdev-offload-dpdk: Support offload of VLAN PUSH/POP actions

Sriharsha Basavapatna sriharsha.basavapatna at broadcom.com
Fri May 29 06:31:18 UTC 2020


On Thu, May 28, 2020 at 12:54 PM Eli Britstein <elibr at mellanox.com> wrote:
>
>
> On 5/24/2020 10:13 AM, Sriharsha Basavapatna wrote:
> > Parse VLAN PUSH/POP OVS datapath actions and add respective RTE actions.
>
> Please add:
>
> - Parsing prints of those new actions (dump_flow_action)
>
> - NEWS
>
> - Documentation/howto/dpdk.rst
>

I'll add the above changes.

Thanks,
-Harsha
> >
> > Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna at broadcom.com>
> > ---
> >   lib/netdev-offload-dpdk.c | 34 ++++++++++++++++++++++++++++++++++
> >   1 file changed, 34 insertions(+)
> >
> > diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
> > index f8c46bbaa..9d7c0d4ce 100644
> > --- a/lib/netdev-offload-dpdk.c
> > +++ b/lib/netdev-offload-dpdk.c
> > @@ -970,6 +970,33 @@ parse_set_actions(struct flow_actions *actions,
> >       return 0;
> >   }
> >
> > +static int
> > +parse_vlan_push_action(struct flow_actions *actions,
> > +                       const struct ovs_action_push_vlan *vlan_push)
> > +{
> > +    struct rte_flow_action_of_push_vlan *rte_push_vlan;
> > +    struct rte_flow_action_of_set_vlan_pcp *rte_vlan_pcp;
> > +    struct rte_flow_action_of_set_vlan_vid *rte_vlan_vid;
> > +
> > +    rte_push_vlan = xzalloc(sizeof *rte_push_vlan);
> > +    rte_push_vlan->ethertype = vlan_push->vlan_tpid;
> > +    add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
> > +                    rte_push_vlan);
> > +
> > +    rte_vlan_pcp = xzalloc(sizeof *rte_vlan_pcp);
> > +    rte_vlan_pcp->vlan_pcp = vlan_tci_to_pcp(vlan_push->vlan_tci);
> > +    add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP,
> > +                    rte_vlan_pcp);
> > +
> > +    rte_vlan_vid = xzalloc(sizeof *rte_vlan_vid);
> > +    rte_vlan_vid->vlan_vid =
> > +        rte_cpu_to_be_16(vlan_tci_to_vid(vlan_push->vlan_tci));
> > +    add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID,
> > +                    rte_vlan_vid);
> > +
> > +    return 0;
> > +}
> > +
> >   static int
> >   parse_flow_actions(struct netdev *netdev,
> >                      struct flow_actions *actions,
> > @@ -998,6 +1025,13 @@ parse_flow_actions(struct netdev *netdev,
> >                                     masked)) {
> >                   return -1;
> >               }
> > +        } else if (nl_attr_type(nla) == OVS_ACTION_ATTR_PUSH_VLAN) {
> > +            const struct ovs_action_push_vlan *vlan = nl_attr_get(nla);
> > +            if (parse_vlan_push_action(actions, vlan)) {
> > +                return -1;
> > +            }
> > +        } else if (nl_attr_type(nla) == OVS_ACTION_ATTR_POP_VLAN) {
> > +            add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_POP_VLAN, NULL);
> >           } else {
> >               VLOG_DBG_RL(&rl, "Unsupported action type %d", nl_attr_type(nla));
> >               return -1;


More information about the dev mailing list