lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <TYCPR01MB11269682F2BDDC6A4F324A697867F2@TYCPR01MB11269.jpnprd01.prod.outlook.com>
Date: Sun, 28 Jan 2024 09:21:18 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Sergey Shtylyov <s.shtylyov@....ru>, "David S. Miller"
	<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
CC: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>, Yoshihiro Shimoda
	<yoshihiro.shimoda.uh@...esas.com>, Wolfram Sang
	<wsa+renesas@...g-engineering.com>, nikita.yoush
	<nikita.yoush@...entembedded.com>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "linux-renesas-soc@...r.kernel.org"
	<linux-renesas-soc@...r.kernel.org>, Geert Uytterhoeven
	<geert+renesas@...der.be>, Prabhakar Mahadev Lad
	<prabhakar.mahadev-lad.rj@...renesas.com>, biju.das.au
	<biju.das.au@...il.com>
Subject: RE: [PATCH net-next v2 2/2] ravb: Add Tx checksum offload support

Hi Sergey Shtylyov,

Thanks for the feedback.

> -----Original Message-----
> From: Sergey Shtylyov <s.shtylyov@....ru>
> Sent: Friday, January 26, 2024 9:00 PM
> Subject: Re: [PATCH net-next v2 2/2] ravb: Add Tx checksum offload support
> 
> On 1/24/24 1:21 PM, Biju Das wrote:
> 
> > TOE has hw support for calculating IP header and TCP/UDP/ICMP checksum
> > for
> 
>    s/hw/hardware/, please...

Agreed.

> 
> > both IPV4 and IPV6.
> >
> > Add Tx checksum offload supported by TOE for IPv4 and TCP/UDP.
> >
> > For Tx, the result of checksum calculation is set to the checksum
> > field of each IPv4 Header/TCP/UDP/ICMP of ethernet frames. For the
> > unsupported frames, those fields are not changed. If a transmission
> > frame is an UDP frame of IPv4 and its checksum value in the UDP header
> > field is H’0000, TOE does not calculate checksum for UDP part of this
> > frame as it is optional function as per standards.
> >
> > We can test this functionality by the below commands
> >
> > ethtool -K eth0 tx on --> to turn on Tx checksum offload ethtool -K
> > eth0 tx off --> to turn off Tx checksum offload
> >
> > Signed-off-by: Biju Das <biju.das.jz@...renesas.com>
> [...]
> 
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> > b/drivers/net/ethernet/renesas/ravb_main.c
> > index 59c7bedacef6..3c748a54fae0 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -29,6 +29,7 @@
> >  #include <linux/spinlock.h>
> >  #include <linux/reset.h>
> >  #include <linux/math64.h>
> > +#include <net/ip.h>
> 
>    What do you need from that header, BTW?

It is giving compilation error for ip_hdr() and udp_hdr().

> 
> [...]
> > @@ -1990,6 +2001,39 @@ static void ravb_tx_timeout_work(struct
> work_struct *work)
> >  	rtnl_unlock();
> >  }
> >
> > +static bool ravb_is_tx_checksum_offload_gbeth_possible(struct sk_buff
> > +*skb)
> 
>    I'd suggest s/th shorter and more consistent with the used naming, like
> ravb_tx_csum_possible_gbeth()...

OK.

> 
> > +{
> > +	struct iphdr *ip = ip_hdr(skb);
> > +
> > +	/* TODO: Need to add support for VLAN tag 802.1Q */
> > +	if (skb_vlan_tag_present(skb))
> > +		return false;
> > +
> > +	/* TODO: Need to add HW checksum for IPV6 */
> > +	if (skb->protocol != htons(ETH_P_IP))
> > +		return false;
> 
>    So maybe we need to report just NETIF_F_IP_CSUM, not NETIF_F_HW_CSUM
> ATM?

I agree, at the moment we are supporting only IPv4 Checksum offload.
Later when we can reintroduce NETIF_F_HW_CSUM when we add support for IPv6.

> 
> > +
> > +	switch (ip->protocol) {
> > +	case IPPROTO_TCP:
> > +		break;
> > +	case IPPROTO_UDP:
> > +		/* If the checksum value in the UDP header field is “H’0000”,
> 
>    Use 0x0000 or just 0, please. I don't know where Renesas found this
> weird hex notation...

OK.

> 
> [...]
> > @@ -2005,6 +2049,11 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff
> *skb, struct net_device *ndev)
> >  	u32 entry;
> >  	u32 len;
> >
> > +	if (skb->ip_summed == CHECKSUM_PARTIAL) {
> > +		if (!ravb_is_tx_checksum_offload_gbeth_possible(skb))
> 
>    I'd collapse those 2 *if* statements...

Agreed

Cheers,
Biju

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ