* [PATCH v1 0/1] net/nbl: fix Leonis Tx VLAN fallback header overlap @ 2026-12-02 2:50 Dimon Zhao 2026-12-02 2:50 ` [PATCH v1 1/1] net/nbl: fix " Dimon Zhao 0 siblings, 1 reply; 4+ messages in thread From: Dimon Zhao @ 2026-12-02 2:50 UTC (permalink / raw) To: dev; +Cc: Dimon Zhao This patch fixes a Tx VLAN fallback bug on Leonis. Headers for two consecutive fallback packets can overlap, corrupting the EtherType and VLAN fields of the first packet. Dimon Zhao (1): net/nbl: fix Tx VLAN fallback header overlap drivers/net/nbl/nbl_hw/nbl_txrx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.53.0 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 1/1] net/nbl: fix Tx VLAN fallback header overlap 2026-12-02 2:50 [PATCH v1 0/1] net/nbl: fix Leonis Tx VLAN fallback header overlap Dimon Zhao @ 2026-12-02 2:50 ` Dimon Zhao 2026-12-03 20:25 ` Stephen Hemminger 2026-12-03 20:33 ` Stephen Hemminger 0 siblings, 2 replies; 4+ messages in thread From: Dimon Zhao @ 2026-12-02 2:50 UTC (permalink / raw) To: dev; +Cc: Dimon Zhao, stable, Leon Yu, Sam Chen The Tx fallback uses the extended header size as the slot stride. On Leonis this is 12 bytes, but the VLAN fallback writes a 30-byte header. A single-segment fallback packet consumes two descriptors, so consecutive headers start 24 bytes apart. The second header overwrites the first packet's EtherType and VLAN fields. Use the reserved 32-byte NBL_TX_HEADER_LEN stride for both the software header pointer and the descriptor DMA address. Fixes: 9d7757dce874 ("net/nbl: simulate VLAN offload") Cc: stable@dpdk.org Signed-off-by: Dimon Zhao <dimon.zhao@nebula-matrix.com> --- drivers/net/nbl/nbl_hw/nbl_txrx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/nbl/nbl_hw/nbl_txrx.c b/drivers/net/nbl/nbl_hw/nbl_txrx.c index 7beae85..34e62fb 100644 --- a/drivers/net/nbl/nbl_hw/nbl_txrx.c +++ b/drivers/net/nbl/nbl_hw/nbl_txrx.c @@ -512,7 +512,7 @@ static u16 nbl_res_txrx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, u16 nb_pkts, u16 extend_set) { struct nbl_res_tx_ring *txq; - union nbl_tx_extend_head *tx_region; + void *tx_region; volatile struct nbl_packed_desc *tx_ring; struct nbl_tx_entry *sw_ring; volatile struct nbl_packed_desc *tx_desc, *head_desc; @@ -542,6 +542,8 @@ nbl_res_txrx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, u16 nb_pkts, u nbl_tx_free_bufs(txq); for (nb_xmit_pkts = 0; nb_xmit_pkts < nb_pkts; nb_xmit_pkts++) { + size_t hdr_offset = (size_t)desc_index * NBL_TX_HEADER_LEN; + required_headroom = txq->exthdr_len; tx_extend_len = txq->exthdr_len; addr_offset = 0; @@ -563,14 +565,14 @@ nbl_res_txrx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, u16 nb_pkts, u -required_headroom); } else { can_push = 0; - u = (union nbl_tx_extend_head *)(&tx_region[desc_index]); + u = RTE_PTR_ADD(tx_region, hdr_offset); } if (tx_pkt->ol_flags & RTE_MBUF_F_TX_VLAN) { if (likely(can_push)) { if (rte_vlan_insert(&tx_pkt)) { can_push = 0; - u = (union nbl_tx_extend_head *)(&tx_region[desc_index]); + u = RTE_PTR_ADD(tx_region, hdr_offset); } } if (unlikely(!can_push)) { @@ -607,8 +609,7 @@ nbl_res_txrx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, u16 nb_pkts, u head_flags |= NBL_VRING_DESC_F_NEXT; txe->mbuf = NULL; /* padding */ - head_desc->addr = net_hdr_mem + - RTE_PTR_DIFF(&tx_region[desc_index], tx_region); + head_desc->addr = net_hdr_mem + hdr_offset; head_desc->len = tx_extend_len; txe->first_id = head_index; desc_index++; -- 2.53.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] net/nbl: fix Tx VLAN fallback header overlap 2026-12-02 2:50 ` [PATCH v1 1/1] net/nbl: fix " Dimon Zhao @ 2026-12-03 20:25 ` Stephen Hemminger 2026-12-03 20:33 ` Stephen Hemminger 1 sibling, 0 replies; 4+ messages in thread From: Stephen Hemminger @ 2026-12-03 20:25 UTC (permalink / raw) To: Dimon Zhao; +Cc: dev, stable, Leon Yu, Sam Chen On Wed, 2 Dec 2026 10:50:50 +0800 Dimon Zhao <dimon.zhao@nebula-matrix.com> wrote: > The Tx fallback uses the extended header size as the slot stride. > On Leonis this is 12 bytes, but the VLAN fallback writes a 30-byte > header. A single-segment fallback packet consumes two descriptors, > so consecutive headers start 24 bytes apart. The second header > overwrites the first packet's EtherType and VLAN fields. > > Use the reserved 32-byte NBL_TX_HEADER_LEN stride for both the > software header pointer and the descriptor DMA address. > > Fixes: 9d7757dce874 ("net/nbl: simulate VLAN offload") > Cc: stable@dpdk.org > Signed-off-by: Dimon Zhao <dimon.zhao@nebula-matrix.com> > --- Reviewed clean, applied to next-net ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] net/nbl: fix Tx VLAN fallback header overlap 2026-12-02 2:50 ` [PATCH v1 1/1] net/nbl: fix " Dimon Zhao 2026-12-03 20:25 ` Stephen Hemminger @ 2026-12-03 20:33 ` Stephen Hemminger 1 sibling, 0 replies; 4+ messages in thread From: Stephen Hemminger @ 2026-12-03 20:33 UTC (permalink / raw) To: Dimon Zhao; +Cc: dev, stable, Leon Yu, Sam Chen On Wed, 2 Dec 2026 10:50:50 +0800 Dimon Zhao <dimon.zhao@nebula-matrix.com> wrote: > The Tx fallback uses the extended header size as the slot stride. > On Leonis this is 12 bytes, but the VLAN fallback writes a 30-byte > header. A single-segment fallback packet consumes two descriptors, > so consecutive headers start 24 bytes apart. The second header > overwrites the first packet's EtherType and VLAN fields. > > Use the reserved 32-byte NBL_TX_HEADER_LEN stride for both the > software header pointer and the descriptor DMA address. > > Fixes: 9d7757dce874 ("net/nbl: simulate VLAN offload") > Cc: stable@dpdk.org > Signed-off-by: Dimon Zhao <dimon.zhao@nebula-matrix.com> > --- One result from AI review Info ---- net/nbl: fix Tx VLAN fallback header overlap Nothing enforces at compile time that NBL_TX_HEADER_LEN is large enough for the fallback header the VLAN path writes. The margin is two bytes (12 + 14 + 4 = 30 of 32), and the absence of a check is how the original overlap went unnoticed. Add to nbl_txrx.c: static_assert(sizeof(union nbl_tx_extend_head) + sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr) <= NBL_TX_HEADER_LEN, "NBL_TX_HEADER_LEN too small for VLAN fallback"); ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-03 20:33 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-02 2:50 [PATCH v1 0/1] net/nbl: fix Leonis Tx VLAN fallback header overlap Dimon Zhao 2026-12-02 2:50 ` [PATCH v1 1/1] net/nbl: fix " Dimon Zhao 2026-12-03 20:25 ` Stephen Hemminger 2026-12-03 20:33 ` Stephen Hemminger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox