Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Selvamani Rajagopal via B4 Relay
Fri, 13 Nov 2026 16:59
[PATCH net-next v11 08/14] net: ethernet: oa_tc6: Drop frames if footer has FD bit set
Author: Selvamani Rajagopal via B4 Relay
Date: Fri, 13 Nov 2026 16:59
Date: Fri, 13 Nov 2026 16:59
62 lines
12754 bytes
12754 bytes
From: Selvamani Rajagopal <Selvamani.Rajagopal@onsemi.com>
Drop a receive frame when the data footer of its last chunk has
the Frame Drop (FD) bit set. Dropping the frame with FD bit set
is in OPEN Alliance specification.
Here is one scenario when FD bit will be set. With RX cut-through
enabled, the MAC-PHY can start forwarding a frame before it knows
the frame is bad, and uses FD to tell the host to discard it.
Signed-off-by: Selvamani Rajagopal <Selvamani.Rajagopal@onsemi.com>
---
changes in v11
- Act on FD bit on the footer in the received data chunk.
- New patch in v11
---
drivers/net/ethernet/oa_tc6/oa_tc6_main.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c
index 2b31370da2d2..5d01ef5a13ad 100644
--- a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c
+++ b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c
@@ -1150,6 +1150,7 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data,
footer);
bool start_valid = FIELD_GET(OA_TC6_DATA_FOOTER_START_VALID, footer);
bool end_valid = FIELD_GET(OA_TC6_DATA_FOOTER_END_VALID, footer);
+ bool frame_drop = FIELD_GET(OA_TC6_DATA_FOOTER_FRAME_DROP, footer);
u16 size;
/* Restart the new rx frame after receiving rx buffer overflow error */
@@ -1159,6 +1160,25 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data,
if (tc6->wait_until_start_valid)
return 0;
+ /* Drop the frame, if footer sets FD bit. Checking FD bit
+ * becomes important, when cut-through operation is enabled.
+ */
+ if (end_valid && frame_drop) {
+ oa_tc6_cleanup_ongoing_rx_skb(tc6);
+
+ /* Full frame in this chunk. Nothing to free. Move on to
+ * next chunk.
+ */
+ if (start_valid && start_byte_offset < end_byte_offset) {
+ tc6->netdev->stats.rx_dropped++;
+ return 0;
+ }
+
+ /* The chunk carries only the end of the dropped frame. */
+ if (!start_valid)
+ return 0;
+ }
+
/* Process the chunk with complete rx frame */
if (start_valid && end_valid && start_byte_offset < end_byte_offset) {
size = end_byte_offset + 1 - start_byte_offset;
--
2.43.0
Re: [PATCH net-next v11 08/14] net: ethernet: oa_tc6: Drop frames if footer has FD bit set
Author: netdev-bot+sashiko
Date: Tue, 17 Nov 2026 19:53
Date: Tue, 17 Nov 2026 19:53
117 lines
12426 bytes
12426 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In oa_tc6_prcs_rx_chunk_payload()
(drivers/net/ethernet/oa_tc6/oa_tc6_main.c), frames the MAC-PHY marks…
- [Low] This concern is retained only because it requires validation.
--
net: ethernet: oa_tc6: Drop frames if footer has FD bit set
This patch adds handling for the Frame Drop (FD) bit in the receive data
chunk footer in oa_tc6_prcs_rx_chunk_payload(). When the last chunk of a
frame has FD set, any partially assembled rx_skb is freed and the dropped
frame's data is skipped. If the same chunk also carries the start of a
new frame, that new frame is still processed.
> diff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c
> index 2b31370da2d2b..5d01ef5a13ad0 100644
> --- a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c
> +++ b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c
[ ... ]
> @@ -1159,6 +1160,25 @@ static int oa_tc6_prcs_rx_chunk_payload(struct oa_tc6 *tc6, u8 *data,
> if (tc6->wait_until_start_valid)
> return 0;
>
> + /* Drop the frame, if footer sets FD bit. Checking FD bit
> + * becomes important, when cut-through operation is enabled.
> + */
[Severity: Low]
The only scenario the commit message gives for FD being set is RX
cut-through:
With RX cut-through enabled, the MAC-PHY can start forwarding a frame
before it knows the frame is bad, and uses FD to tell the host to
discard it.
At this commit nothing enables cut-through. struct oa_tc6 has no
cut-through state yet, and nothing writes OA_TC6_CONFIG0_RXCTE.
The later S2500 patch in this series adds ctc_capable,
oa_tc6_rx_cut_through_enable() and the OA_TC6_CONFIG_RX_CUT_THROUGH
quirk. That makes this patch groundwork for that change, and the ordering
looks fine.
Can the existing MAC-PHYs (LAN865x and others) also set FD in their
default store-and-forward mode? If so, frames marked FD would currently
reach the stack through oa_tc6_submit_rx_skb()->netif_rx(). Should this
then carry a Fixes: tag? If not, could the commit message say that
cut-through is enabled by a later patch in the series?
> + if (end_valid && frame_drop) {
> + oa_tc6_cleanup_ongoing_rx_skb(tc6);
> +
> + /* Full frame in this chunk. Nothing to free. Move on to
> + * next chunk.
> + */
> + if (start_valid && start_byte_offset < end_byte_offset) {
> + tc6->netdev->stats.rx_dropped++;
> + return 0;
> + }
[Severity: Medium]
Should frames with FD set be counted in rx_errors rather than only in
rx_dropped?
For a frame that fits in one chunk, this block increments only
rx_dropped. For a frame that spans several chunks, the
oa_tc6_cleanup_ongoing_rx_skb() call above also increments only
rx_dropped:
static void oa_tc6_cleanup_ongoing_rx_skb(struct oa_tc6 *tc6)
{
if (tc6->rx_skb) {
tc6->netdev->stats.rx_dropped++;
kfree_skb(tc6->rx_skb);
tc6->rx_skb = NULL;
}
}
The kernel-doc for struct rtnl_link_stats64 in
include/uapi/linux/if_link.h defines these counters as follows:
@rx_errors: Total number of bad packets received on this network device.
@rx_dropped: Number of packets received but not processed,
e.g. due to lack of resources or unsupported protocol.
The commit message describes FD frames as frames the MAC-PHY "knows the
frame is bad". These are bad frames from the wire, not host-side drops.
With cut-through enabled on S2500 later in the series, would every
corrupted frame on the segment show up as rx_dropped in ip -s link while
rx_errors stays at 0?
> +
> + /* The chunk carries only the end of the dropped frame. */
> + if (!start_valid)
> + return 0;
> + }
> +
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-s2500-mac-phy-support-v11-0-7a186141952c%40onsemi.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads