RE: [PATCH net-next v2 2/2] ravb: Add Tx checksum offload support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sergey Shtylyov,

Thanks for the feedback.

> -----Original Message-----
> From: Sergey Shtylyov <s.shtylyov@xxxxxx>
> 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@xxxxxxxxxxxxxx>
> [...]
> 
> > 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




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux