diff mbox series

[ovs-dev,v1] netdev_offload_dpdk: Support vlan insertion in vxlan header.

Message ID 20250117031732.444-1-allen.chen@jaguarmicro.com
State Changes Requested
Delegated to: Kevin Traynor
Headers show
Series [ovs-dev,v1] netdev_offload_dpdk: Support vlan insertion in vxlan header. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Allen Chen Jan. 17, 2025, 3:17 a.m. UTC
Support vlan insertion in vxlan header

Signed-off-by: Allen Chen <allen.chen@jaguarmicro.com>

---
After vxlan encapsulation,an underlay packet becomes vxlan packet.
OVS will report an debug info if a vlan is inserted in vxlan header after vxlan encapsulation.
We can find the debug info "unsupported nested action inside clone(),action type:4" by
"cat /var/log/openvswitch/ovs-vswitchd.log",so the ovs flow can not be offloaded successfully.

For example,an underlay packet can be:Eth header/IP header/Payload,
after vxlan encapsulation,it can be:Outer Eth header/Outer IP header/Outer UDP/Vxlan header/Inner Eth header/Inner IP header/Payload,
after vlan insertion,it can be:Outer Eth header/Vlan header/Outer IP header/Outer UDP/Vxlan header/Inner Eth header/Inner IP header/Payload.(the debug info occur at this point)

This commit can fix the problem in this case.

The ovs configuration is listed:
ovs-vsctl add-br br-jmnd -- set bridge br-jmnd datapath_type=netdev -- br-set-external-id br-jmnd bridge-id br-jmnd -- set bridge br-jmnd fail-mode=standalone
ovs-vsctl add-br br-ext -- set bridge br-ext datapath_type=netdev -- br-set-external-id br-ext bridge-id br-ext -- set bridge br-ext fail-mode=standalone
ovs-vsctl add-port br-ext dpdk0 -- set Interface dpdk0 type=dpdk options:dpdk-devargs=0000:01:00.0 options:n_txq=8 options:n_rxq=8 options:n_rxq_desc=2048 options:n_txq_desc=2048 ofport_request=1
ovs-vsctl add-port br-jmnd vxlan0 -- set interface vxlan0 type=vxlan options:{remote_ip="192.188.2.222",local_ip="192.188.2.210",in_key=100,out_key=100}
ovs-vsctl add-port br-jmnd net0 -- set Interface net0 type=dpdk options:{dpdk-devargs="net_jmnd0,iface=/tmp/sock0,client=1,queues=8",n_rxq="8",n_rxq_desc="256",n_txq_desc="256"}
ovs-vsctl set Bridge br-ext other_config:hwaddr="02:02:03:04:05:06"
ovs-appctl tnl/arp/set br-ext 192.188.2.222 0A:00:27:00:00:0C
ovs-ofctl del-flows br-jmnd
ovs-ofctl add-flow br-jmnd in_port=vxlan0,action=output:net0
ovs-ofctl add-flow br-jmnd in_port=net0,ip,nw_src=172.0.1.2/32,nw_dst=172.0.1.1/32,action=output:vxlan0
ifconfig br-ext 192.188.2.210
ovs-vsctl set o . other_config:max-idle=5000
ifconfig br-ext up
ifconfig br-jmnd up
ovs-ofctl add-flow br-ext priority=1,ip,udp,nw_src=192.188.2.210,nw_dst=192.188.2.222,actions=mod_vlan_vid:3001,output:dpdk0
---
 lib/netdev-offload-dpdk.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Kevin Traynor Feb. 7, 2025, 5:18 p.m. UTC | #1
On 17/01/2025 03:17, Allen Chen via dev wrote:
> Support vlan insertion in vxlan header
> 
> Signed-off-by: Allen Chen <allen.chen@jaguarmicro.com>
> 
> ---
> After vxlan encapsulation,an underlay packet becomes vxlan packet.
> OVS will report an debug info if a vlan is inserted in vxlan header after vxlan encapsulation.
> We can find the debug info "unsupported nested action inside clone(),action type:4" by
> "cat /var/log/openvswitch/ovs-vswitchd.log",so the ovs flow can not be offloaded successfully.
> 
> For example,an underlay packet can be:Eth header/IP header/Payload,
> after vxlan encapsulation,it can be:Outer Eth header/Outer IP header/Outer UDP/Vxlan header/Inner Eth header/Inner IP header/Payload,
> after vlan insertion,it can be:Outer Eth header/Vlan header/Outer IP header/Outer UDP/Vxlan header/Inner Eth header/Inner IP header/Payload.(the debug info occur at this point)
> 
> This commit can fix the problem in this case.
> 
> The ovs configuration is listed:
> ovs-vsctl add-br br-jmnd -- set bridge br-jmnd datapath_type=netdev -- br-set-external-id br-jmnd bridge-id br-jmnd -- set bridge br-jmnd fail-mode=standalone
> ovs-vsctl add-br br-ext -- set bridge br-ext datapath_type=netdev -- br-set-external-id br-ext bridge-id br-ext -- set bridge br-ext fail-mode=standalone
> ovs-vsctl add-port br-ext dpdk0 -- set Interface dpdk0 type=dpdk options:dpdk-devargs=0000:01:00.0 options:n_txq=8 options:n_rxq=8 options:n_rxq_desc=2048 options:n_txq_desc=2048 ofport_request=1
> ovs-vsctl add-port br-jmnd vxlan0 -- set interface vxlan0 type=vxlan options:{remote_ip="192.188.2.222",local_ip="192.188.2.210",in_key=100,out_key=100}
> ovs-vsctl add-port br-jmnd net0 -- set Interface net0 type=dpdk options:{dpdk-devargs="net_jmnd0,iface=/tmp/sock0,client=1,queues=8",n_rxq="8",n_rxq_desc="256",n_txq_desc="256"}
> ovs-vsctl set Bridge br-ext other_config:hwaddr="02:02:03:04:05:06"
> ovs-appctl tnl/arp/set br-ext 192.188.2.222 0A:00:27:00:00:0C
> ovs-ofctl del-flows br-jmnd
> ovs-ofctl add-flow br-jmnd in_port=vxlan0,action=output:net0
> ovs-ofctl add-flow br-jmnd in_port=net0,ip,nw_src=172.0.1.2/32,nw_dst=172.0.1.1/32,action=output:vxlan0
> ifconfig br-ext 192.188.2.210
> ovs-vsctl set o . other_config:max-idle=5000
> ifconfig br-ext up
> ifconfig br-jmnd up
> ovs-ofctl add-flow br-ext priority=1,ip,udp,nw_src=192.188.2.210,nw_dst=192.188.2.222,actions=mod_vlan_vid:3001,output:dpdk0
> ---
>  lib/netdev-offload-dpdk.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
> index b1c848f4d..c9a927d7d 100644
> --- a/lib/netdev-offload-dpdk.c
> +++ b/lib/netdev-offload-dpdk.c
> @@ -2137,6 +2137,14 @@ parse_clone_actions(struct netdev *netdev,fire
>              if (add_output_action(netdev, actions, ca)) {
>                  return -1;
>              }
> +        } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) {
> +            const struct ovs_action_push_vlan *vlan = nl_attr_get(ca);
> +            if (parse_vlan_push_action(actions, vlan)) {

This does not return non-zero, so there is no need to check the return
value or log here. I see the return value is also checked elsewhere, I
will send a separate patch to change the return type to void and fix that.

> +                VLOG_DBG_RL(&rl,
> +                            "push vlan in vxlan header failed, "
> +                            "action type: %d", clone_type);
> +                return -1;
> +            }
>          } else {
>              VLOG_DBG_RL(&rl,
>                          "Unsupported nested action inside clone(), "
Allen Chen Feb. 8, 2025, 1:49 a.m. UTC | #2
Hi Kevin,

Do I need to change the code like this:
static int
parse_clone_actions(struct netdev *netdev,
                    struct flow_actions *actions,
                    const struct nlattr *clone_actions,
                    const size_t clone_actions_len)
{
    const struct nlattr *ca;
    unsigned int cleft;

    NL_ATTR_FOR_EACH_UNSAFE (ca, cleft, clone_actions, clone_actions_len) {
        int clone_type = nl_attr_type(ca);

        if (clone_type == OVS_ACTION_ATTR_TUNNEL_PUSH) {
            const struct ovs_action_push_tnl *tnl_push = nl_attr_get(ca);
            add_tunnel_push_action(actions, tnl_push);
        } else if (clone_type == OVS_ACTION_ATTR_OUTPUT) {
            if (add_output_action(netdev, actions, ca)) {
                return -1;
            }
        } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) {
            const struct ovs_action_push_vlan *vlan = nl_attr_get(ca);
            parse_vlan_push_action(actions, vlan);                     //here, do not check the return value
        } else {
            VLOG_DBG_RL(&rl,
                        "Unsupported nested action inside clone(), "
                        "action type: %d", clone_type);
            return -1;
        }
    }
    return 0;
}

and send a patch v2 ?

Thanks.
-----邮件原件-----
发件人: Kevin Traynor <ktraynor@redhat.com> 
发送时间: 2025年2月8日 1:18
收件人: Allen Chen <allen.chen@jaguarmicro.com>; ovs-dev@openvswitch.org
主题: Re: [ovs-dev] [PATCH v1] netdev_offload_dpdk: Support vlan insertion in vxlan header.

External Mail: This email originated from OUTSIDE of the organization!
Do not click links, open attachments or provide ANY information unless you recognize the sender and know the content is safe.


On 17/01/2025 03:17, Allen Chen via dev wrote:
> Support vlan insertion in vxlan header
>
> Signed-off-by: Allen Chen <allen.chen@jaguarmicro.com>
>
> ---
> After vxlan encapsulation,an underlay packet becomes vxlan packet.
> OVS will report an debug info if a vlan is inserted in vxlan header after vxlan encapsulation.
> We can find the debug info "unsupported nested action inside 
> clone(),action type:4" by "cat /var/log/openvswitch/ovs-vswitchd.log",so the ovs flow can not be offloaded successfully.
>
> For example,an underlay packet can be:Eth header/IP header/Payload, 
> after vxlan encapsulation,it can be:Outer Eth header/Outer IP 
> header/Outer UDP/Vxlan header/Inner Eth header/Inner IP 
> header/Payload, after vlan insertion,it can be:Outer Eth header/Vlan 
> header/Outer IP header/Outer UDP/Vxlan header/Inner Eth header/Inner 
> IP header/Payload.(the debug info occur at this point)
>
> This commit can fix the problem in this case.
>
> The ovs configuration is listed:
> ovs-vsctl add-br br-jmnd -- set bridge br-jmnd datapath_type=netdev -- 
> br-set-external-id br-jmnd bridge-id br-jmnd -- set bridge br-jmnd 
> fail-mode=standalone ovs-vsctl add-br br-ext -- set bridge br-ext 
> datapath_type=netdev -- br-set-external-id br-ext bridge-id br-ext -- 
> set bridge br-ext fail-mode=standalone ovs-vsctl add-port br-ext dpdk0 
> -- set Interface dpdk0 type=dpdk options:dpdk-devargs=0000:01:00.0 
> options:n_txq=8 options:n_rxq=8 options:n_rxq_desc=2048 
> options:n_txq_desc=2048 ofport_request=1 ovs-vsctl add-port br-jmnd 
> vxlan0 -- set interface vxlan0 type=vxlan 
> options:{remote_ip="192.188.2.222",local_ip="192.188.2.210",in_key=100
> ,out_key=100} ovs-vsctl add-port br-jmnd net0 -- set Interface net0 
> type=dpdk 
> options:{dpdk-devargs="net_jmnd0,iface=/tmp/sock0,client=1,queues=8",n
> _rxq="8",n_rxq_desc="256",n_txq_desc="256"}
> ovs-vsctl set Bridge br-ext other_config:hwaddr="02:02:03:04:05:06"
> ovs-appctl tnl/arp/set br-ext 192.188.2.222 0A:00:27:00:00:0C 
> ovs-ofctl del-flows br-jmnd ovs-ofctl add-flow br-jmnd 
> in_port=vxlan0,action=output:net0 ovs-ofctl add-flow br-jmnd 
> in_port=net0,ip,nw_src=172.0.1.2/32,nw_dst=172.0.1.1/32,action=output:
> vxlan0
> ifconfig br-ext 192.188.2.210
> ovs-vsctl set o . other_config:max-idle=5000 ifconfig br-ext up 
> ifconfig br-jmnd up ovs-ofctl add-flow br-ext 
> priority=1,ip,udp,nw_src=192.188.2.210,nw_dst=192.188.2.222,actions=mo
> d_vlan_vid:3001,output:dpdk0
> ---
>  lib/netdev-offload-dpdk.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c 
> index b1c848f4d..c9a927d7d 100644
> --- a/lib/netdev-offload-dpdk.c
> +++ b/lib/netdev-offload-dpdk.c
> @@ -2137,6 +2137,14 @@ parse_clone_actions(struct netdev *netdev,fire
>              if (add_output_action(netdev, actions, ca)) {
>                  return -1;
>              }
> +        } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) {
> +            const struct ovs_action_push_vlan *vlan = nl_attr_get(ca);
> +            if (parse_vlan_push_action(actions, vlan)) {

This does not return non-zero, so there is no need to check the return value or log here. I see the return value is also checked elsewhere, I will send a separate patch to change the return type to void and fix that.

> +                VLOG_DBG_RL(&rl,
> +                            "push vlan in vxlan header failed, "
> +                            "action type: %d", clone_type);
> +                return -1;
> +            }
>          } else {
>              VLOG_DBG_RL(&rl,
>                          "Unsupported nested action inside clone(), "
Kevin Traynor Feb. 11, 2025, 3:43 p.m. UTC | #3
On 08/02/2025 01:49, Allen Chen wrote:
> Hi Kevin,
> 

Hi Allen,

> Do I need to change the code like this:
> static int
> parse_clone_actions(struct netdev *netdev,
>                     struct flow_actions *actions,
>                     const struct nlattr *clone_actions,
>                     const size_t clone_actions_len)
> {
>     const struct nlattr *ca;
>     unsigned int cleft;
> 
>     NL_ATTR_FOR_EACH_UNSAFE (ca, cleft, clone_actions, clone_actions_len) {
>         int clone_type = nl_attr_type(ca);
> 
>         if (clone_type == OVS_ACTION_ATTR_TUNNEL_PUSH) {
>             const struct ovs_action_push_tnl *tnl_push = nl_attr_get(ca);
>             add_tunnel_push_action(actions, tnl_push);
>         } else if (clone_type == OVS_ACTION_ATTR_OUTPUT) {
>             if (add_output_action(netdev, actions, ca)) {
>                 return -1;
>             }
>         } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) {
>             const struct ovs_action_push_vlan *vlan = nl_attr_get(ca);
>             parse_vlan_push_action(actions, vlan);                     //here, do not check the return value
>         } else {
>             VLOG_DBG_RL(&rl,
>                         "Unsupported nested action inside clone(), "
>                         "action type: %d", clone_type);
>             return -1;
>         }
>     }
>     return 0;
> }
> 
> and send a patch v2 ?
> 

Yes, there is no need to check the return here (I will tidy up the other
instance later)

Did you test that flow is being offloaded correctly ? and did you try on
Mellanox NIC ? If so, then Documentation/howto/dpdk.rst should get a
small update too, see...
"- Clone/output (tnl_push and output) for encapsulating over a tunnel."

thanks,
Kevin.

> Thanks.
> -----邮件原件-----
> 发件人: Kevin Traynor <ktraynor@redhat.com> 
> 发送时间: 2025年2月8日 1:18
> 收件人: Allen Chen <allen.chen@jaguarmicro.com>; ovs-dev@openvswitch.org
> 主题: Re: [ovs-dev] [PATCH v1] netdev_offload_dpdk: Support vlan insertion in vxlan header.
> 
> External Mail: This email originated from OUTSIDE of the organization!
> Do not click links, open attachments or provide ANY information unless you recognize the sender and know the content is safe.
> 
> 
> On 17/01/2025 03:17, Allen Chen via dev wrote:
>> Support vlan insertion in vxlan header
>>
>> Signed-off-by: Allen Chen <allen.chen@jaguarmicro.com>
>>
>> ---
>> After vxlan encapsulation,an underlay packet becomes vxlan packet.
>> OVS will report an debug info if a vlan is inserted in vxlan header after vxlan encapsulation.
>> We can find the debug info "unsupported nested action inside 
>> clone(),action type:4" by "cat /var/log/openvswitch/ovs-vswitchd.log",so the ovs flow can not be offloaded successfully.
>>
>> For example,an underlay packet can be:Eth header/IP header/Payload, 
>> after vxlan encapsulation,it can be:Outer Eth header/Outer IP 
>> header/Outer UDP/Vxlan header/Inner Eth header/Inner IP 
>> header/Payload, after vlan insertion,it can be:Outer Eth header/Vlan 
>> header/Outer IP header/Outer UDP/Vxlan header/Inner Eth header/Inner 
>> IP header/Payload.(the debug info occur at this point)
>>
>> This commit can fix the problem in this case.
>>
>> The ovs configuration is listed:
>> ovs-vsctl add-br br-jmnd -- set bridge br-jmnd datapath_type=netdev -- 
>> br-set-external-id br-jmnd bridge-id br-jmnd -- set bridge br-jmnd 
>> fail-mode=standalone ovs-vsctl add-br br-ext -- set bridge br-ext 
>> datapath_type=netdev -- br-set-external-id br-ext bridge-id br-ext -- 
>> set bridge br-ext fail-mode=standalone ovs-vsctl add-port br-ext dpdk0 
>> -- set Interface dpdk0 type=dpdk options:dpdk-devargs=0000:01:00.0 
>> options:n_txq=8 options:n_rxq=8 options:n_rxq_desc=2048 
>> options:n_txq_desc=2048 ofport_request=1 ovs-vsctl add-port br-jmnd 
>> vxlan0 -- set interface vxlan0 type=vxlan 
>> options:{remote_ip="192.188.2.222",local_ip="192.188.2.210",in_key=100
>> ,out_key=100} ovs-vsctl add-port br-jmnd net0 -- set Interface net0 
>> type=dpdk 
>> options:{dpdk-devargs="net_jmnd0,iface=/tmp/sock0,client=1,queues=8",n
>> _rxq="8",n_rxq_desc="256",n_txq_desc="256"}
>> ovs-vsctl set Bridge br-ext other_config:hwaddr="02:02:03:04:05:06"
>> ovs-appctl tnl/arp/set br-ext 192.188.2.222 0A:00:27:00:00:0C 
>> ovs-ofctl del-flows br-jmnd ovs-ofctl add-flow br-jmnd 
>> in_port=vxlan0,action=output:net0 ovs-ofctl add-flow br-jmnd 
>> in_port=net0,ip,nw_src=172.0.1.2/32,nw_dst=172.0.1.1/32,action=output:
>> vxlan0
>> ifconfig br-ext 192.188.2.210
>> ovs-vsctl set o . other_config:max-idle=5000 ifconfig br-ext up 
>> ifconfig br-jmnd up ovs-ofctl add-flow br-ext 
>> priority=1,ip,udp,nw_src=192.188.2.210,nw_dst=192.188.2.222,actions=mo
>> d_vlan_vid:3001,output:dpdk0
>> ---
>>  lib/netdev-offload-dpdk.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c 
>> index b1c848f4d..c9a927d7d 100644
>> --- a/lib/netdev-offload-dpdk.c
>> +++ b/lib/netdev-offload-dpdk.c
>> @@ -2137,6 +2137,14 @@ parse_clone_actions(struct netdev *netdev,fire
>>              if (add_output_action(netdev, actions, ca)) {
>>                  return -1;
>>              }
>> +        } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) {
>> +            const struct ovs_action_push_vlan *vlan = nl_attr_get(ca);
>> +            if (parse_vlan_push_action(actions, vlan)) {
> 
> This does not return non-zero, so there is no need to check the return value or log here. I see the return value is also checked elsewhere, I will send a separate patch to change the return type to void and fix that.
> 
>> +                VLOG_DBG_RL(&rl,
>> +                            "push vlan in vxlan header failed, "
>> +                            "action type: %d", clone_type);
>> +                return -1;
>> +            }
>>          } else {
>>              VLOG_DBG_RL(&rl,
>>                          "Unsupported nested action inside clone(), "
>
Allen Chen Feb. 14, 2025, 3:07 a.m. UTC | #4
Hi Kevin,

I will modiy the code and send a patch v2 later.
I already tested this case and the flow table is offloaded correctly. You can see details in image-1.png and image-2.png.
I tried it on DPU card of company I work for,but I did not try on Mellanox NIC because I have no it currently.

Best wishes.

-----邮件原件-----
发件人: Kevin Traynor <ktraynor@redhat.com> 
发送时间: 2025年2月11日 23:44
收件人: Allen Chen <allen.chen@jaguarmicro.com>; ovs-dev@openvswitch.org
主题: Re: 答复: [ovs-dev] [PATCH v1] netdev_offload_dpdk: Support vlan insertion in vxlan header.

External Mail: This email originated from OUTSIDE of the organization!
Do not click links, open attachments or provide ANY information unless you recognize the sender and know the content is safe.


On 08/02/2025 01:49, Allen Chen wrote:
> Hi Kevin,
>

Hi Allen,

> Do I need to change the code like this:
> static int
> parse_clone_actions(struct netdev *netdev,
>                     struct flow_actions *actions,
>                     const struct nlattr *clone_actions,
>                     const size_t clone_actions_len) {
>     const struct nlattr *ca;
>     unsigned int cleft;
>
>     NL_ATTR_FOR_EACH_UNSAFE (ca, cleft, clone_actions, clone_actions_len) {
>         int clone_type = nl_attr_type(ca);
>
>         if (clone_type == OVS_ACTION_ATTR_TUNNEL_PUSH) {
>             const struct ovs_action_push_tnl *tnl_push = nl_attr_get(ca);
>             add_tunnel_push_action(actions, tnl_push);
>         } else if (clone_type == OVS_ACTION_ATTR_OUTPUT) {
>             if (add_output_action(netdev, actions, ca)) {
>                 return -1;
>             }
>         } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) {
>             const struct ovs_action_push_vlan *vlan = nl_attr_get(ca);
>             parse_vlan_push_action(actions, vlan);                     //here, do not check the return value
>         } else {
>             VLOG_DBG_RL(&rl,
>                         "Unsupported nested action inside clone(), "
>                         "action type: %d", clone_type);
>             return -1;
>         }
>     }
>     return 0;
> }
>
> and send a patch v2 ?
>

Yes, there is no need to check the return here (I will tidy up the other instance later)

Did you test that flow is being offloaded correctly ? and did you try on Mellanox NIC ? If so, then Documentation/howto/dpdk.rst should get a small update too, see...
"- Clone/output (tnl_push and output) for encapsulating over a tunnel."

thanks,
Kevin.

> Thanks.
> -----邮件原件-----
> 发件人: Kevin Traynor <ktraynor@redhat.com>
> 发送时间: 2025年2月8日 1:18
> 收件人: Allen Chen <allen.chen@jaguarmicro.com>; ovs-dev@openvswitch.org
> 主题: Re: [ovs-dev] [PATCH v1] netdev_offload_dpdk: Support vlan insertion in vxlan header.
>
> External Mail: This email originated from OUTSIDE of the organization!
> Do not click links, open attachments or provide ANY information unless you recognize the sender and know the content is safe.
>
>
> On 17/01/2025 03:17, Allen Chen via dev wrote:
>> Support vlan insertion in vxlan header
>>
>> Signed-off-by: Allen Chen <allen.chen@jaguarmicro.com>
>>
>> ---
>> After vxlan encapsulation,an underlay packet becomes vxlan packet.
>> OVS will report an debug info if a vlan is inserted in vxlan header after vxlan encapsulation.
>> We can find the debug info "unsupported nested action inside 
>> clone(),action type:4" by "cat /var/log/openvswitch/ovs-vswitchd.log",so the ovs flow can not be offloaded successfully.
>>
>> For example,an underlay packet can be:Eth header/IP header/Payload, 
>> after vxlan encapsulation,it can be:Outer Eth header/Outer IP 
>> header/Outer UDP/Vxlan header/Inner Eth header/Inner IP 
>> header/Payload, after vlan insertion,it can be:Outer Eth header/Vlan 
>> header/Outer IP header/Outer UDP/Vxlan header/Inner Eth header/Inner 
>> IP header/Payload.(the debug info occur at this point)
>>
>> This commit can fix the problem in this case.
>>
>> The ovs configuration is listed:
>> ovs-vsctl add-br br-jmnd -- set bridge br-jmnd datapath_type=netdev 
>> -- br-set-external-id br-jmnd bridge-id br-jmnd -- set bridge br-jmnd 
>> fail-mode=standalone ovs-vsctl add-br br-ext -- set bridge br-ext 
>> datapath_type=netdev -- br-set-external-id br-ext bridge-id br-ext -- 
>> set bridge br-ext fail-mode=standalone ovs-vsctl add-port br-ext 
>> dpdk0
>> -- set Interface dpdk0 type=dpdk options:dpdk-devargs=0000:01:00.0
>> options:n_txq=8 options:n_rxq=8 options:n_rxq_desc=2048
>> options:n_txq_desc=2048 ofport_request=1 ovs-vsctl add-port br-jmnd
>> vxlan0 -- set interface vxlan0 type=vxlan
>> options:{remote_ip="192.188.2.222",local_ip="192.188.2.210",in_key=10
>> 0 ,out_key=100} ovs-vsctl add-port br-jmnd net0 -- set Interface net0 
>> type=dpdk 
>> options:{dpdk-devargs="net_jmnd0,iface=/tmp/sock0,client=1,queues=8",
>> n _rxq="8",n_rxq_desc="256",n_txq_desc="256"}
>> ovs-vsctl set Bridge br-ext other_config:hwaddr="02:02:03:04:05:06"
>> ovs-appctl tnl/arp/set br-ext 192.188.2.222 0A:00:27:00:00:0C 
>> ovs-ofctl del-flows br-jmnd ovs-ofctl add-flow br-jmnd
>> in_port=vxlan0,action=output:net0 ovs-ofctl add-flow br-jmnd
>> in_port=net0,ip,nw_src=172.0.1.2/32,nw_dst=172.0.1.1/32,action=output:
>> vxlan0
>> ifconfig br-ext 192.188.2.210
>> ovs-vsctl set o . other_config:max-idle=5000 ifconfig br-ext up 
>> ifconfig br-jmnd up ovs-ofctl add-flow br-ext 
>> priority=1,ip,udp,nw_src=192.188.2.210,nw_dst=192.188.2.222,actions=m
>> o
>> d_vlan_vid:3001,output:dpdk0
>> ---
>>  lib/netdev-offload-dpdk.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c 
>> index b1c848f4d..c9a927d7d 100644
>> --- a/lib/netdev-offload-dpdk.c
>> +++ b/lib/netdev-offload-dpdk.c
>> @@ -2137,6 +2137,14 @@ parse_clone_actions(struct netdev *netdev,fire
>>              if (add_output_action(netdev, actions, ca)) {
>>                  return -1;
>>              }
>> +        } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) {
>> +            const struct ovs_action_push_vlan *vlan = nl_attr_get(ca);
>> +            if (parse_vlan_push_action(actions, vlan)) {
>
> This does not return non-zero, so there is no need to check the return value or log here. I see the return value is also checked elsewhere, I will send a separate patch to change the return type to void and fix that.
>
>> +                VLOG_DBG_RL(&rl,
>> +                            "push vlan in vxlan header failed, "
>> +                            "action type: %d", clone_type);
>> +                return -1;
>> +            }
>>          } else {
>>              VLOG_DBG_RL(&rl,
>>                          "Unsupported nested action inside clone(), "
>
diff mbox series

Patch

diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index b1c848f4d..c9a927d7d 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -2137,6 +2137,14 @@  parse_clone_actions(struct netdev *netdev,
             if (add_output_action(netdev, actions, ca)) {
                 return -1;
             }
+        } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) {
+            const struct ovs_action_push_vlan *vlan = nl_attr_get(ca);
+            if (parse_vlan_push_action(actions, vlan)) {
+                VLOG_DBG_RL(&rl,
+                            "push vlan in vxlan header failed, "
+                            "action type: %d", clone_type);
+                return -1;
+            }
         } else {
             VLOG_DBG_RL(&rl,
                         "Unsupported nested action inside clone(), "