diff mbox series

[ovs-dev,v2] netdev-dpdk: Clear IP packet type when no offload is requested.

Message ID 20230828160753.970829-1-david.marchand@redhat.com
State Accepted
Commit 9b7e1a75378f806fcf782e0286d529028e6d62bf
Headers show
Series [ovs-dev,v2] netdev-dpdk: Clear IP packet type when no offload is requested. | expand

Checks

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

Commit Message

David Marchand Aug. 28, 2023, 4:07 p.m. UTC
OVS current sets RTE_MBUF_F_TX_IPV[46] flags in early stages of the
packet reception and keeps track of the IP packet type as the packet
goes through OVS pipeline.
When a packet leaves OVS and hits a DPDK driver, OVS may not request IP
checksum offloading but leaves one of this packet type flag in ol_flags.

The DPDK api describes that RTE_MBUF_F_TX_IPV4 must be set when
requesting some Tx offloads (like RTE_MBUF_F_TX_IPSUM,
RTE_MBUF_F_TX_TCP_CKSUM, .., RTE_MBUF_F_TX_TCP_SEG).
Even though setting RTE_MBUF_F_TX_IPV4 without requesting a Tx offload is
undefined, this can confuse some drivers (like net/iavf) which then reads
zero'd l2_len and l3_len and ends up dropping the packet.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2231081
Fixes: 5d11c47d3ebe ("userspace: Enable IP checksum offloading by default.")
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Mike Pattrick <mkp@redhat.com>
---
 lib/netdev-dpdk.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ilya Maximets Aug. 28, 2023, 7:03 p.m. UTC | #1
On 8/28/23 18:07, David Marchand wrote:
> OVS current sets RTE_MBUF_F_TX_IPV[46] flags in early stages of the
> packet reception and keeps track of the IP packet type as the packet
> goes through OVS pipeline.
> When a packet leaves OVS and hits a DPDK driver, OVS may not request IP
> checksum offloading but leaves one of this packet type flag in ol_flags.
> 
> The DPDK api describes that RTE_MBUF_F_TX_IPV4 must be set when
> requesting some Tx offloads (like RTE_MBUF_F_TX_IPSUM,
> RTE_MBUF_F_TX_TCP_CKSUM, .., RTE_MBUF_F_TX_TCP_SEG).
> Even though setting RTE_MBUF_F_TX_IPV4 without requesting a Tx offload is
> undefined, this can confuse some drivers (like net/iavf) which then reads
> zero'd l2_len and l3_len and ends up dropping the packet.
> 
> Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2231081
> Fixes: 5d11c47d3ebe ("userspace: Enable IP checksum offloading by default.")
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Mike Pattrick <mkp@redhat.com>
> ---
>  lib/netdev-dpdk.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 8f1361e21f..2f5a133184 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2431,6 +2431,7 @@ netdev_dpdk_prep_hwol_packet(struct netdev_dpdk *dev, struct rte_mbuf *mbuf)
>  
>      if (!(mbuf->ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK
>                              | RTE_MBUF_F_TX_TCP_SEG))) {
> +        mbuf->ol_flags &= ~(RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IPV6);
>          return true;
>      }
>  

Thanks!  Applied and backported to 3.2.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 8f1361e21f..2f5a133184 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2431,6 +2431,7 @@  netdev_dpdk_prep_hwol_packet(struct netdev_dpdk *dev, struct rte_mbuf *mbuf)
 
     if (!(mbuf->ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK
                             | RTE_MBUF_F_TX_TCP_SEG))) {
+        mbuf->ol_flags &= ~(RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IPV6);
         return true;
     }