net/iavf: add segment-length check to Tx prep
PATCH 1/1 net/iavf: add segment-length check to Tx prep
In the Tx prep function, the metadata checks were only checking the packet length and ignoring the data length. For single-buffer packets we can quickly check that the data length is the packet length.
--- drivers/net/iavf/iavf_rxtx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/iavf/iavf_rxtx.c +5 -1
@@ -3677,7 +3677,11 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,return i; } -if (m->pkt_len <IAVF_TX_MIN_PKT_LEN ) { +/* valid packets are greater than min size, and single-buffer pkts +* must have data_len == pkt_len +*/ +if (m->pkt_len <IAVF_TX_MIN_PKT_LEN || + (m->nb_segs ==1 && m->data_len != m->pkt_len)) { rte_errno =EINVAL ;return i; }
Signature · 1 line
2.43.0
Quoted 30 lines · Bruce Richardson
In the Tx prep function, the metadata checks were only checking the packet length and ignoring the data length. For single-buffer packets we can quickly check that the data length is the packet length.
Fixes 19ee91c6bd9a ("net/iavf: check illegal packet sizes")Reported-by Padraig Connolly <[email protected]>Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/iavf/iavf_rxtx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/net/iavf/iavf_rxtx.c +5
-1@@ -3677,7 +3677,11 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,return i; } -if (m->pkt_len <IAVF_TX_MIN_PKT_LEN ) { +/* valid packets are greater than min size, and single-buffer pkts +* must have data_len == pkt_len +*/ +if (m->pkt_len <IAVF_TX_MIN_PKT_LEN || + (m->nb_segs ==1 && m->data_len != m->pkt_len)) { rte_errno =EINVAL ;return i; }
Signature · 2 lines
Regards, Vladimir
________________________________
From: Medvedkin, Vladimir <[email protected]>
Sent: Monday 11 November 2024 5:46 pm
To: Richardson, Bruce <[email protected]>; [email protected] <[email protected]>
Cc: [email protected] <[email protected]>; Connolly, Padraig J <[email protected]>; Stokes, Ian <[email protected]>; Zhang, Qi Z <[email protected]>; Kevin Liu <[email protected]>
Subject: Re: [PATCH] net/iavf: add segment-length check to Tx prep
Quoted 20 lines · Bruce Richardson
In the Tx prep function, the metadata checks were only checking the packet length and ignoring the data length. For single-buffer packets we can quickly check that the data length is the packet length.
Fixes 19ee91c6bd9a ("net/iavf: check illegal packet sizes")Reported-by Padraig Connolly <[email protected]>Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/iavf/iavf_rxtx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/net/iavf/iavf_rxtx.c +0
-0@@ -3677,7 +3677,11 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,return i; }
drivers/net/iavf/iavf_rxtx.c iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, · line 3687
Quoted 10 lines
drivers/net/iavf/iavf_rxtx.c +5
-1-if (m->pkt_len <IAVF_TX_MIN_PKT_LEN ) { +/* valid packets are greater than min size, and single-buffer pkts +* must have data_len == pkt_len +*/ +if (m->pkt_len <IAVF_TX_MIN_PKT_LEN || + (m->nb_segs ==1 && m->data_len != m->pkt_len)) { rte_errno =EINVAL ;return i; }
--
Regards,
Vladimir
Quoted 24 lines
Quoted 21 lines · Bruce Richardson
In the Tx prep function, the metadata checks were only checking the packet length and ignoring the data length. For single-buffer packets we can quickly check that the data length is the packet length.
Fixes 19ee91c6bd9a ("net/iavf: check illegal packet sizes")Reported-by Padraig Connolly <[email protected]>Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/iavf/iavf_rxtx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/net/iavf/iavf_rxtx.c +0
-0@@ -3677,7 +3677,11 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,return i; }
Quoted 9 lines
drivers/net/iavf/iavf_rxtx.c iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, · line 3687
Quoted 9 lines
drivers/net/iavf/iavf_rxtx.c +5
-1-if (m->pkt_len <IAVF_TX_MIN_PKT_LEN ) { +/* valid packets are greater than min size, and single-buffer pkts +* must have data_len == pkt_len +*/ +if (m->pkt_len <IAVF_TX_MIN_PKT_LEN || + (m->nb_segs ==1 && m->data_len != m->pkt_len)) { rte_errno =EINVAL ;return i; }
--
Regards,
Vladimir
Bruce Richardson
AppliedQuoted 17 lines · Padraig J
__________________________________________________________________From: Medvedkin, Vladimir <[email protected]>
Sent: Monday 11 November 2024 5:46 pm
To: Richardson, Bruce <[email protected]>; [email protected] <[email protected]>
Cc: [email protected] <[email protected]>; Connolly, Padraig J <[email protected]>; Stokes, Ian <[email protected]>; Zhang, Qi Z <[email protected]>; Kevin Liu <[email protected]>
Subject: Re: [PATCH] net/iavf: add segment-length check to Tx prepQuoted 2 lines · Bruce Richardson
In the Tx prep function, the metadata checks were only checking the packet length and ignoring the data length. For single-buffer packets
we
Quoted 2 lines
can quickly check that the data length is the packet length.
Quoted 7 lines
Quoted 5 lines
Fixes 19ee91c6bd9a ("net/iavf: check illegal packet sizes")Reported-by Padraig Connolly <[email protected]>Signed-off-by Bruce Richardson <[email protected]>Tested-by Padraig Connolly <[email protected]>
Applied to dpdk-next-net-intel
/Bruce