[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220621215220.78f86712@kernel.org>
Date: Tue, 21 Jun 2022 21:52:20 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jose Alonso <joalonsof@...il.com>
Cc: Paolo Abeni <pabeni@...hat.com>,
David Laight <David.Laight@...LAB.COM>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH v3] net: usb: ax88179_178a: ax88179_rx_fixup corrections
On Wed, 22 Jun 2022 00:59:46 -0300 Jose Alonso wrote:
> This patch corrects the receiving of packets in ax88179_rx_fixup.
>
> corrections:
> - the size check of the bounds of the metadata array.
> - the handling of the metadata array.
> The current code is allways exiting with return 0
> while trying to access pkt_hdr out of metadata array and
> generating RX Errors.
> - avoid changing the skb->data content (swap bytes) in case
> of big-endian. le32_to_cpus(pkt_hdr)
>
> Tested with: 0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet
Whenever you have to write a list like this chances are the change
should be split into multiple patches. Please try to perform the fixes
first and code refactoring afterwards, so that the fixes can be
backported to older releases easily.
> static void
> -ax88179_rx_checksum(struct sk_buff *skb, u32 *pkt_hdr)
> +ax88179_rx_checksum(struct sk_buff *skb, u32 pkt_hdr_val)
> {
> skb->ip_summed = CHECKSUM_NONE;
>
> /* checksum error bit is set */
> - if ((*pkt_hdr & AX_RXHDR_L3CSUM_ERR) ||
> - (*pkt_hdr & AX_RXHDR_L4CSUM_ERR))
> + if ((pkt_hdr_val & AX_RXHDR_L3CSUM_ERR) ||
> + (pkt_hdr_val & AX_RXHDR_L4CSUM_ERR))
> return;
>
> /* It must be a TCP or UDP packet with a valid checksum */
> - if (((*pkt_hdr & AX_RXHDR_L4_TYPE_MASK) == AX_RXHDR_L4_TYPE_TCP) ||
> - ((*pkt_hdr & AX_RXHDR_L4_TYPE_MASK) == AX_RXHDR_L4_TYPE_UDP))
> + if (((pkt_hdr_val & AX_RXHDR_L4_TYPE_MASK) == AX_RXHDR_L4_TYPE_TCP) ||
> + ((pkt_hdr_val & AX_RXHDR_L4_TYPE_MASK) == AX_RXHDR_L4_TYPE_UDP))
> skb->ip_summed = CHECKSUM_UNNECESSARY;
> }
This for example looks like pure refactoring which can be done
separately.
> + * <dummy-header> contains 4 bytes:
> + * pkt_len=0 and AX_RXHDR_DROP_ERR
> + * <rx-hdr> contains 4 bytes:
> + * pkt_cnt and hdr_off (offset of
There's trailing whitespace on this line.
Powered by blists - more mailing lists