Message ID | 20200524071358.34767-1-sriharsha.basavapatna@broadcom.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [ovs-dev] netdev-offload-dpdk: Support offload of VLAN PUSH/POP actions | expand |
On Sun, May 24, 2020 at 3:38 PM Sriharsha Basavapatna via dev <ovs-dev@openvswitch.org> wrote: > > Parse VLAN PUSH/POP OVS datapath actions and add respective RTE actions. One question, if pop vlan in the hw, then process it in userspace datapath, the metadata of vlan should restore it. I guess pop_vlan/pop_vxlan are same case. right ? > Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@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; > -- > 2.25.0.rc2 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
On Sun, May 24, 2020 at 2:52 PM Tonghao Zhang <xiangxia.m.yue@gmail.com> wrote: > > On Sun, May 24, 2020 at 3:38 PM Sriharsha Basavapatna via dev > <ovs-dev@openvswitch.org> wrote: > > > > Parse VLAN PUSH/POP OVS datapath actions and add respective RTE actions. > One question, if pop vlan in the hw, then process it in userspace > datapath, the metadata of vlan should restore it. It is not processed in userspace datapath. The packet is processed and forwarded entirely in HW (full-offload/SR-IOV VF use case). > I guess pop_vlan/pop_vxlan are same case. right ? No, they are not. pop_vlan pops the vlan tag in the packet. vxlan_decap pops the vxlan tunnel header. Thanks, -Harsha > > Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@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; > > -- > > 2.25.0.rc2 > > > > _______________________________________________ > > dev mailing list > > dev@openvswitch.org > > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > > > > -- > Best regards, Tonghao
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 > > Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@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;
On Thu, May 28, 2020 at 12:54 PM Eli Britstein <elibr@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@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;
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;
Parse VLAN PUSH/POP OVS datapath actions and add respective RTE actions. Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> --- lib/netdev-offload-dpdk.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)