RE: [PATCH net-next 1/2] ravb: Add Rx checksum offload support

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

 



Hi Jakub Kicinski,

Thanks for the feedback.

> -----Original Message-----
> From: Jakub Kicinski <kuba@xxxxxxxxxx>
> Sent: Wednesday, January 24, 2024 1:09 AM
> Subject: Re: [PATCH net-next 1/2] ravb: Add Rx checksum offload support
> 
> On Tue, 23 Jan 2024 15:19:23 +0000 Biju Das wrote:
> > +static void ravb_rx_csum_gbeth(struct sk_buff *skb) {
> > +	__sum16 csum_ip_hdr, csum_proto;
> > +	u8 *hw_csum;
> > +
> > +	/* The hardware checksum status is contained in sizeof(__sum16) * 2
> = 4
> > +	 * bytes appended to packet data. First 2 bytes is ip header csum
> and
> > +	 * last 2 bytes is protocol csum.
> > +	 */
> > +	if (unlikely(skb->len < sizeof(__sum16) * 2))
> > +		return;
> > +
> > +	hw_csum = skb_tail_pointer(skb) - sizeof(__sum16);
> > +	csum_proto = csum_unfold((__force
> > +__sum16)get_unaligned_le16(hw_csum));
> > +
> > +	hw_csum -= sizeof(__sum16);
> > +	csum_ip_hdr = csum_unfold((__force
> __sum16)get_unaligned_le16(hw_csum));
> > +	skb_trim(skb, skb->len - 2 * sizeof(__sum16));
> > +
> > +	/* TODO: IPV6 Rx csum */
> > +	if (skb->protocol == htons(ETH_P_IP) && csum_ip_hdr ==
> TOE_RX_CSUM_OK &&
> > +	    csum_proto == TOE_RX_CSUM_OK)
> > +		/* Hardware validated our checksum */
> > +		skb->ip_summed = CHECKSUM_UNNECESSARY; }
> 
> sparse does not seem to be onboard:
> 
> drivers/net/ethernet/renesas/ravb_main.c:771:20: warning: incorrect type
> in assignment (different base types)
> drivers/net/ethernet/renesas/ravb_main.c:771:20:    expected restricted
> __sum16 [usertype] csum_proto
> drivers/net/ethernet/renesas/ravb_main.c:771:20:    got restricted __wsum
> drivers/net/ethernet/renesas/ravb_main.c:774:21: warning: incorrect type
> in assignment (different base types)
> drivers/net/ethernet/renesas/ravb_main.c:774:21:    expected restricted
> __sum16 [usertype] csum_ip_hdr
> drivers/net/ethernet/renesas/ravb_main.c:774:21:    got restricted __wsum

I have reproduced this issue and the warning is fixed by replacing
__sum16->__wsum.

I will send v2 with this fix.

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