All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag
@ 2022-03-23  4:28 longli
  2022-03-23  8:39 ` David Marchand
  2022-03-23 14:57 ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: longli @ 2022-03-23  4:28 UTC (permalink / raw)
  To: dev, Stephen Hemminger; +Cc: Long Li

From: Long Li <longli@microsoft.com>

The netvsc should use RTE_MBUF_F_TX_L4_MASK and check the value to decide
the correct way to calculate checksums.

Signed-off-by: Long Li <longli@microsoft.com>
---
 drivers/net/netvsc/hn_rxtx.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 028f176c7e..34f40be5b8 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -1348,8 +1348,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
 			*pi_data = NDIS_LSO2_INFO_MAKEIPV4(hlen,
 							   m->tso_segsz);
 		}
-	} else if (m->ol_flags &
-		   (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM)) {
+	} else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
+			RTE_MBUF_F_TX_TCP_CKSUM ||
+		   (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
+			RTE_MBUF_F_TX_UDP_CKSUM ||
+		   (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM)) {
 		pi_data = hn_rndis_pktinfo_append(pkt, NDIS_TXCSUM_INFO_SIZE,
 						  NDIS_PKTINFO_TYPE_CSUM);
 		*pi_data = 0;
@@ -1363,9 +1366,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
 				*pi_data |= NDIS_TXCSUM_INFO_IPCS;
 		}
 
-		if (m->ol_flags & RTE_MBUF_F_TX_TCP_CKSUM)
+		if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
+				RTE_MBUF_F_TX_TCP_CKSUM)
 			*pi_data |= NDIS_TXCSUM_INFO_MKTCPCS(hlen);
-		else if (m->ol_flags & RTE_MBUF_F_TX_UDP_CKSUM)
+		else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
+				RTE_MBUF_F_TX_UDP_CKSUM)
 			*pi_data |= NDIS_TXCSUM_INFO_MKUDPCS(hlen);
 	}
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag
  2022-03-23  4:28 [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag longli
@ 2022-03-23  8:39 ` David Marchand
  2022-03-23 21:31   ` Long Li
  2022-03-23 14:57 ` Stephen Hemminger
  1 sibling, 1 reply; 4+ messages in thread
From: David Marchand @ 2022-03-23  8:39 UTC (permalink / raw)
  To: longli; +Cc: dev, Stephen Hemminger, Long Li

On Wed, Mar 23, 2022 at 5:28 AM <longli@linuxonhyperv.com> wrote:
>
> From: Long Li <longli@microsoft.com>
>
> The netvsc should use RTE_MBUF_F_TX_L4_MASK and check the value to decide
> the correct way to calculate checksums.

It's better to describe what the impact for an application is.
Do I understand correctly that UDP checksum offloading was broken?


I guess you want this backported.
Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org


>
> Signed-off-by: Long Li <longli@microsoft.com>
> ---
>  drivers/net/netvsc/hn_rxtx.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
> index 028f176c7e..34f40be5b8 100644
> --- a/drivers/net/netvsc/hn_rxtx.c
> +++ b/drivers/net/netvsc/hn_rxtx.c
> @@ -1348,8 +1348,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
>                         *pi_data = NDIS_LSO2_INFO_MAKEIPV4(hlen,
>                                                            m->tso_segsz);
>                 }
> -       } else if (m->ol_flags &
> -                  (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM)) {
> +       } else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
> +                       RTE_MBUF_F_TX_TCP_CKSUM ||
> +                  (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
> +                       RTE_MBUF_F_TX_UDP_CKSUM ||
> +                  (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM)) {
>                 pi_data = hn_rndis_pktinfo_append(pkt, NDIS_TXCSUM_INFO_SIZE,
>                                                   NDIS_PKTINFO_TYPE_CSUM);
>                 *pi_data = 0;
> @@ -1363,9 +1366,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
>                                 *pi_data |= NDIS_TXCSUM_INFO_IPCS;
>                 }
>
> -               if (m->ol_flags & RTE_MBUF_F_TX_TCP_CKSUM)
> +               if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
> +                               RTE_MBUF_F_TX_TCP_CKSUM)
>                         *pi_data |= NDIS_TXCSUM_INFO_MKTCPCS(hlen);
> -               else if (m->ol_flags & RTE_MBUF_F_TX_UDP_CKSUM)
> +               else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
> +                               RTE_MBUF_F_TX_UDP_CKSUM)
>                         *pi_data |= NDIS_TXCSUM_INFO_MKUDPCS(hlen);
>         }
>
> --
> 2.32.0
>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag
  2022-03-23  4:28 [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag longli
  2022-03-23  8:39 ` David Marchand
@ 2022-03-23 14:57 ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2022-03-23 14:57 UTC (permalink / raw)
  To: longli; +Cc: dev, Stephen Hemminger, Long Li

On Tue, 22 Mar 2022 21:28:07 -0700
longli@linuxonhyperv.com wrote:

> From: Long Li <longli@microsoft.com>
> 
> The netvsc should use RTE_MBUF_F_TX_L4_MASK and check the value to decide
> the correct way to calculate checksums.
> 
> Signed-off-by: Long Li <longli@microsoft.com>


Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag
  2022-03-23  8:39 ` David Marchand
@ 2022-03-23 21:31   ` Long Li
  0 siblings, 0 replies; 4+ messages in thread
From: Long Li @ 2022-03-23 21:31 UTC (permalink / raw)
  To: David Marchand, longli; +Cc: dev, Stephen Hemminger

> Subject: Re: [PATCH] net/netvsc: fix the calculation of checksums based on
> mbuf flag
> 
> On Wed, Mar 23, 2022 at 5:28 AM <longli@linuxonhyperv.com> wrote:
> >
> > From: Long Li <longli@microsoft.com>
> >
> > The netvsc should use RTE_MBUF_F_TX_L4_MASK and check the value to
> > decide the correct way to calculate checksums.
> 
> It's better to describe what the impact for an application is.
> Do I understand correctly that UDP checksum offloading was broken?
> 
> 
> I guess you want this backported.
> Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
> Cc: stable@dpdk.org

I'm sending V2 with the Fixes tag. 

Thanks,
Long

> 
> 
> >
> > Signed-off-by: Long Li <longli@microsoft.com>
> > ---
> >  drivers/net/netvsc/hn_rxtx.c | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/netvsc/hn_rxtx.c
> > b/drivers/net/netvsc/hn_rxtx.c index 028f176c7e..34f40be5b8 100644
> > --- a/drivers/net/netvsc/hn_rxtx.c
> > +++ b/drivers/net/netvsc/hn_rxtx.c
> > @@ -1348,8 +1348,11 @@ static void hn_encap(struct rndis_packet_msg
> *pkt,
> >                         *pi_data = NDIS_LSO2_INFO_MAKEIPV4(hlen,
> >                                                            m->tso_segsz);
> >                 }
> > -       } else if (m->ol_flags &
> > -                  (RTE_MBUF_F_TX_TCP_CKSUM |
> RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM)) {
> > +       } else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
> > +                       RTE_MBUF_F_TX_TCP_CKSUM ||
> > +                  (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
> > +                       RTE_MBUF_F_TX_UDP_CKSUM ||
> > +                  (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM)) {
> >                 pi_data = hn_rndis_pktinfo_append(pkt,
> NDIS_TXCSUM_INFO_SIZE,
> >                                                   NDIS_PKTINFO_TYPE_CSUM);
> >                 *pi_data = 0;
> > @@ -1363,9 +1366,11 @@ static void hn_encap(struct rndis_packet_msg
> *pkt,
> >                                 *pi_data |= NDIS_TXCSUM_INFO_IPCS;
> >                 }
> >
> > -               if (m->ol_flags & RTE_MBUF_F_TX_TCP_CKSUM)
> > +               if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
> > +                               RTE_MBUF_F_TX_TCP_CKSUM)
> >                         *pi_data |= NDIS_TXCSUM_INFO_MKTCPCS(hlen);
> > -               else if (m->ol_flags & RTE_MBUF_F_TX_UDP_CKSUM)
> > +               else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
> > +                               RTE_MBUF_F_TX_UDP_CKSUM)
> >                         *pi_data |= NDIS_TXCSUM_INFO_MKUDPCS(hlen);
> >         }
> >
> > --
> > 2.32.0
> >
> 
> 
> --
> David Marchand


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-23 21:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23  4:28 [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag longli
2022-03-23  8:39 ` David Marchand
2022-03-23 21:31   ` Long Li
2022-03-23 14:57 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.