Skip to content

Commit

Permalink
net/mlx5: fix multi-segment Tx inline data length
Browse files Browse the repository at this point in the history
[ upstream commit e3c7bb5 ]

If packet data length exceeds the configured limit for packet
to be inlined in the queue descriptor the driver checks if hardware
requires to do minimal data inline or the VLAN insertion offload is
requested and not supported in hardware (that means we have to do VLAN
insertion in software with inline data). Then driver scans the mbuf
chain to find the minimal segment amount to satisfy the data needed
for minimal inline.

There was incorrect first segment inline data length calculation
with missing VLAN header being inserted, that could lead to the
segmentation fault in the mbuf chain scanning, for example for
the packets:

  packet:
    mbuf0 pkt_len = 288, data_len = 156
    mbuf1 pkt_len = 132, data_len = 132

  txq->inlen_send = 290

The driver was trying to reach the inlen_send inline data length
with missing VLAN header length added and was running out of the
mbuf chain (there were just not enough data in the packet to satisfy
the criteria).

Fixes: 18a1c20 ("net/mlx5: implement Tx burst template")
Fixes: ec837ad ("net/mlx5: fix multi-segment inline for the first segments")

Signed-off-by: Viacheslav Ovsiienko <[email protected]>
Acked-by: Suanming Mou <[email protected]>
  • Loading branch information
viacheslavo authored and bluca committed Nov 15, 2023
1 parent 9f2170b commit 9c21619
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/mlx5/mlx5_rxtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3548,7 +3548,7 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *__rte_restrict txq,
uintptr_t start;

mbuf = loc->mbuf;
nxlen = rte_pktmbuf_data_len(mbuf);
nxlen = rte_pktmbuf_data_len(mbuf) + vlan;
/*
* Packet length exceeds the allowed inline
* data length, check whether the minimal
Expand Down

0 comments on commit 9c21619

Please sign in to comment.