Re: [PATCH net v1] lan743x: fix ethernet frame cutoff issue

From: Sven Van Asbroeck
Date: Wed Apr 14 2021 - 09:20:16 EST


Hi Julian,

On Wed, Apr 14, 2021 at 8:53 AM Julian Wiedmann <jwi@xxxxxxxxxxxxx> wrote:
>
> On a cursory glance, using __netdev_alloc_skb_ip_align() here should
> allow you to get rid of all the RX_HEAD_PADDING gymnastics.
>
> And also avoid the need for setting RX_CFG_B_RX_PAD_2_, as the
> NET_IP_ALIGN part would no longer get dma-mapped.

That's an excellent suggestion, and I'll definitely keep that in mind
for the future.

In this case, I'm not sure if it could work. This NIC has multi-buffer
frames. The dma-ed skbs represent frame fragments. A flag in the
descriptor ring indicates if an skb is "first". If first, we can
reserve the padding. Otherwise, we cannot. because that would corrupt
a fragment in the middle. At the time of skb allocation, we do not
know whether that skb will be "first".

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/microchip/lan743x_main.c?h=v5.12-rc7#n2125

Maybe I'm missing a trick here? Feel free to suggest improvements,
it's always much appreciated.

Sven