diff mbox series

[ovs-dev,v2,08/11] dp-packet: Strip tunnel info when unneeded.

Message ID 20251112170420.3155127-9-david.marchand@redhat.com
State Changes Requested
Headers show
Series Outer UDP checksum optimisations. | 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

David Marchand Nov. 12, 2025, 5:04 p.m. UTC
In case no inner checksum is requested, we can consider the inner data
as opaque since there is nothing to do and rely on simple HW UDP checksum
without considering support for HW outer UDP checksum.

Cleanup the DPDK helper accordingly.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/dp-packet.c   | 16 +++++++++++-----
 lib/netdev-dpdk.c |  5 +----
 2 files changed, 12 insertions(+), 9 deletions(-)

Comments

Mike Pattrick Dec. 1, 2025, 6:01 a.m. UTC | #1
On Wed, Nov 12, 2025 at 12:05 PM David Marchand <david.marchand@redhat.com>
wrote:

> In case no inner checksum is requested, we can consider the inner data
> as opaque since there is nothing to do and rely on simple HW UDP checksum
> without considering support for HW outer UDP checksum.
>
> Cleanup the DPDK helper accordingly.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>

 Looks good to me

Acked-by: Mike Pattrick <mkp@redhat.com>
Kevin Traynor Dec. 9, 2025, 6:53 p.m. UTC | #2
On 12/11/2025 17:04, David Marchand via dev wrote:
> In case no inner checksum is requested, we can consider the inner data
> as opaque since there is nothing to do and rely on simple HW UDP checksum
> without considering support for HW outer UDP checksum.
> 
> Cleanup the DPDK helper accordingly.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/dp-packet.c   | 16 +++++++++++-----
>  lib/netdev-dpdk.c |  5 +----
>  2 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/dp-packet.c b/lib/dp-packet.c
> index b34bcf26f3..3093bd2163 100644
> --- a/lib/dp-packet.c
> +++ b/lib/dp-packet.c
> @@ -553,12 +553,18 @@ dp_packet_compare_offsets(struct dp_packet *b1, struct dp_packet *b2,
>  void
>  dp_packet_ol_send_prepare(struct dp_packet *p, uint64_t flags)
>  {
> -    if (!dp_packet_ip_checksum_partial(p)
> -        && !dp_packet_l4_checksum_partial(p)
> -        && !dp_packet_inner_ip_checksum_partial(p)
> +    if (!dp_packet_inner_ip_checksum_partial(p)
>          && !dp_packet_inner_l4_checksum_partial(p)) {
> -        /* Only checksumming needs actions. */
> -        return;
> +
> +        if (!dp_packet_ip_checksum_partial(p)
> +            && !dp_packet_l4_checksum_partial(p)) {
> +            /* Only checksumming needs actions. */

nit: not added by this commit and the comment is true, but
"No checksumming needed." or similar would be better for the path this
comment is placed in.

> +            return;
> +        }
> +
> +        if (OVS_UNLIKELY(dp_packet_tunnel(p))) {
> +            p->offloads &= ~DP_PACKET_OL_TUNNEL_MASK;
> +        }
>      }
>  
>      if (!dp_packet_tunnel(p)) {
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index f6ae235af3..29b1b21d64 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2647,10 +2647,7 @@ netdev_dpdk_prep_hwol_packet(struct netdev_dpdk *dev, struct rte_mbuf *mbuf)
>          return true;
>      }
>  
> -    if (dp_packet_tunnel(pkt)
> -        && (dp_packet_inner_ip_checksum_partial(pkt)
> -            || dp_packet_inner_l4_checksum_partial(pkt)
> -            || mbuf->tso_segsz)) {

I'm a bit confused about why mbuf->tso_segsz is not considered anymore

> +    if (dp_packet_tunnel(pkt)) {
>          if (dp_packet_ip_checksum_partial(pkt)
>              || dp_packet_l4_checksum_partial(pkt)) {
>              mbuf->outer_l2_len = (char *) dp_packet_l3(pkt) -
diff mbox series

Patch

diff --git a/lib/dp-packet.c b/lib/dp-packet.c
index b34bcf26f3..3093bd2163 100644
--- a/lib/dp-packet.c
+++ b/lib/dp-packet.c
@@ -553,12 +553,18 @@  dp_packet_compare_offsets(struct dp_packet *b1, struct dp_packet *b2,
 void
 dp_packet_ol_send_prepare(struct dp_packet *p, uint64_t flags)
 {
-    if (!dp_packet_ip_checksum_partial(p)
-        && !dp_packet_l4_checksum_partial(p)
-        && !dp_packet_inner_ip_checksum_partial(p)
+    if (!dp_packet_inner_ip_checksum_partial(p)
         && !dp_packet_inner_l4_checksum_partial(p)) {
-        /* Only checksumming needs actions. */
-        return;
+
+        if (!dp_packet_ip_checksum_partial(p)
+            && !dp_packet_l4_checksum_partial(p)) {
+            /* Only checksumming needs actions. */
+            return;
+        }
+
+        if (OVS_UNLIKELY(dp_packet_tunnel(p))) {
+            p->offloads &= ~DP_PACKET_OL_TUNNEL_MASK;
+        }
     }
 
     if (!dp_packet_tunnel(p)) {
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index f6ae235af3..29b1b21d64 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2647,10 +2647,7 @@  netdev_dpdk_prep_hwol_packet(struct netdev_dpdk *dev, struct rte_mbuf *mbuf)
         return true;
     }
 
-    if (dp_packet_tunnel(pkt)
-        && (dp_packet_inner_ip_checksum_partial(pkt)
-            || dp_packet_inner_l4_checksum_partial(pkt)
-            || mbuf->tso_segsz)) {
+    if (dp_packet_tunnel(pkt)) {
         if (dp_packet_ip_checksum_partial(pkt)
             || dp_packet_l4_checksum_partial(pkt)) {
             mbuf->outer_l2_len = (char *) dp_packet_l3(pkt) -