[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MN2PR11MB36628F31F7478FED5885FB92FA8B9@MN2PR11MB3662.namprd11.prod.outlook.com>
Date: Fri, 12 Feb 2021 20:45:14 +0000
From: <Bryan.Whitehead@...rochip.com>
To: <thesven73@...il.com>, <UNGLinuxDriver@...rochip.com>,
<davem@...emloft.net>, <kuba@...nel.org>
CC: <andrew@...n.ch>, <rtgbnm@...il.com>, <sbauer@...ckbox.su>,
<tharvey@...eworks.com>, <anders@...ningen.priv.no>,
<hdanton@...a.com>, <hch@....de>,
<willemdebruijn.kernel@...il.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net-next v2 2/5] lan743x: sync only the received area of
an rx ring buffer
Hi Sven, see below.
> + if (buffer_info->dma_ptr) {
> + /* unmap from dma */
> + packet_length = RX_DESC_DATA0_FRAME_LENGTH_GET_
> + (le32_to_cpu(descriptor->data0));
> + if (packet_length == 0 ||
> + packet_length > buffer_info->buffer_length)
> + /* buffer is part of multi-buffer packet: fully used */
> + packet_length = buffer_info->buffer_length;
According to the document I have, FRAME_LENGTH is only valid when LS bit is set, and reserved otherwise.
Therefore, I'm not sure you can rely on it being zero when LS is not set, even if your experiments say it is.
Future chip revisions might use those bits differently.
Can you change this so the LS bit is checked.
If set you can use the smaller of FRAME_LENGTH or buffer length.
If clear you can just use buffer length.
> + /* sync used part of buffer only */
> + dma_sync_single_for_cpu(dev, buffer_info->dma_ptr,
> + packet_length,
> + DMA_FROM_DEVICE);
> + dma_unmap_single_attrs(dev, buffer_info->dma_ptr,
> + buffer_info->buffer_length,
> + DMA_FROM_DEVICE,
> + DMA_ATTR_SKIP_CPU_SYNC);
> + }
Powered by blists - more mailing lists