From: <Bryan.Whitehead@microchip.com>
To: <thesven73@gmail.com>, <UNGLinuxDriver@microchip.com>,
<davem@davemloft.net>, <kuba@kernel.org>
Cc: <andrew@lunn.ch>, <rtgbnm@gmail.com>, <sbauer@blackbox.su>,
<tharvey@gateworks.com>, <anders@ronningen.priv.no>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH net-next v1 2/6] lan743x: support rx multi-buffer packets
Date: Sun, 31 Jan 2021 07:06:53 +0000 [thread overview]
Message-ID: <MN2PR11MB3662C081B6CDB8BC1143380FFAB79@MN2PR11MB3662.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210129195240.31871-3-TheSven73@gmail.com>
Hi Sven,
Looks good.
see comments below.
> static int lan743x_rx_process_packet(struct lan743x_rx *rx) {
It looks like this function no longer processes a packet, but rather only processes a single buffer.
So perhaps it should be renamed to lan743x_rx_process_buffer, so it is not misleading.
...
> + /* unmap from dma */
> + if (buffer_info->dma_ptr) {
> + dma_unmap_single(&rx->adapter->pdev->dev,
> + buffer_info->dma_ptr,
> + buffer_info->buffer_length,
> + DMA_FROM_DEVICE);
> + buffer_info->dma_ptr = 0;
> + buffer_info->buffer_length = 0;
> + }
> + skb = buffer_info->skb;
>
> -process_extension:
> - if (extension_index >= 0) {
> - descriptor = &rx->ring_cpu_ptr[extension_index];
> - buffer_info = &rx->buffer_info[extension_index];
> -
> - ts_sec = le32_to_cpu(descriptor->data1);
> - ts_nsec = (le32_to_cpu(descriptor->data2) &
> - RX_DESC_DATA2_TS_NS_MASK_);
> - lan743x_rx_reuse_ring_element(rx, extension_index);
> - real_last_index = extension_index;
> - }
> + /* allocate new skb and map to dma */
> + if (lan743x_rx_init_ring_element(rx, rx->last_head)) {
If lan743x_rx_init_ring_element fails to allocate an skb,
Then lan743x_rx_reuse_ring_element will be called.
But that function expects the skb is already allocated and dma mapped.
But the dma was unmapped above.
Also if lan743x_rx_init_ring_element fails to allocate an skb.
Then control will jump to process_extension and therefor
the currently received skb will not be added to the skb list.
I assume that would corrupt the packet? Or am I missing something?
...
> - if (!skb) {
> - result = RX_PROCESS_RESULT_PACKET_DROPPED;
It looks like this return value is no longer used.
If there is no longer a case where a packet will be dropped
then maybe this return value should be deleted from the header file.
...
> move_forward:
> - /* push tail and head forward */
> - rx->last_tail = real_last_index;
> - rx->last_head = lan743x_rx_next_index(rx, real_last_index);
> - }
> + /* push tail and head forward */
> + rx->last_tail = rx->last_head;
> + rx->last_head = lan743x_rx_next_index(rx, rx->last_head);
> + result = RX_PROCESS_RESULT_PACKET_RECEIVED;
Since this function handles one buffer at a time,
The return value RX_PROCESS_RESULT_PACKET_RECEIVED is now misleading.
Can you change it to RX_PROCESS_RESULT_BUFFER_RECEIVED.
next prev parent reply other threads:[~2021-01-31 7:09 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 19:52 [PATCH net-next v1 0/6] lan743x speed boost Sven Van Asbroeck
2021-01-29 19:52 ` [PATCH net-next v1 1/6] lan743x: boost performance on cpu archs w/o dma cache snooping Sven Van Asbroeck
2021-01-29 20:36 ` Andrew Lunn
2021-01-29 22:49 ` Sven Van Asbroeck
2021-01-29 22:01 ` Jakub Kicinski
2021-01-29 22:46 ` Sven Van Asbroeck
2021-01-30 22:10 ` Bryan.Whitehead
2021-01-30 23:59 ` Sven Van Asbroeck
2021-01-31 0:14 ` Sven Van Asbroeck
[not found] ` <20210204060210.2362-1-hdanton@sina.com>
2021-02-05 9:31 ` Christoph Hellwig
2021-02-05 14:01 ` Sven Van Asbroeck
2021-02-05 12:44 ` Sergej Bauer
2021-02-05 14:07 ` Sven Van Asbroeck
2021-02-05 15:09 ` Sergej Bauer
2021-02-05 16:39 ` Sven Van Asbroeck
2021-02-05 16:59 ` Sergej Bauer
2021-01-29 19:52 ` [PATCH net-next v1 2/6] lan743x: support rx multi-buffer packets Sven Van Asbroeck
2021-01-29 22:11 ` Willem de Bruijn
2021-01-29 23:02 ` Sven Van Asbroeck
2021-01-29 23:08 ` Willem de Bruijn
2021-01-29 23:10 ` Sven Van Asbroeck
2021-01-31 7:06 ` Bryan.Whitehead [this message]
2021-01-31 15:25 ` Sven Van Asbroeck
2021-02-01 18:04 ` Bryan.Whitehead
2021-02-03 18:53 ` Sven Van Asbroeck
2021-02-03 20:14 ` Bryan.Whitehead
2021-02-03 20:25 ` Sven Van Asbroeck
2021-02-03 20:41 ` Bryan.Whitehead
2021-01-29 19:52 ` [PATCH net-next v1 3/6] lan743x: allow mtu change while network interface is up Sven Van Asbroeck
2021-01-29 19:52 ` [PATCH net-next v1 4/6] TEST ONLY: lan743x: limit rx ring buffer size to 500 bytes Sven Van Asbroeck
2021-01-29 19:52 ` [PATCH net-next v1 5/6] TEST ONLY: lan743x: skb_alloc failure test Sven Van Asbroeck
2021-01-29 19:52 ` [PATCH net-next v1 6/6] TEST ONLY: lan743x: skb_trim " Sven Van Asbroeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN2PR11MB3662C081B6CDB8BC1143380FFAB79@MN2PR11MB3662.namprd11.prod.outlook.com \
--to=bryan.whitehead@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=anders@ronningen.priv.no \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rtgbnm@gmail.com \
--cc=sbauer@blackbox.su \
--cc=tharvey@gateworks.com \
--cc=thesven73@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).