[v2,4/4] net/ice: fix TSO with big segments

Message ID 20230927094148.1129330-4-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v2,1/4] net/iavf: remove log from Tx prepare datapath function |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

David Marchand Sept. 27, 2023, 9:41 a.m. UTC
  Packets to be segmented with TSO are usually larger than MTU.
Plus, a single segment for the whole packet may be used: in OVS case,
an external rte_malloc'd buffer is used for packets received
from vhost-user ports.

Before this fix, TSO packets were dropped by net/ice with the following
message:
2023-09-18T13:34:31.064Z|00020|dpdk(pmd-c31/id:22)|ERR|ice_prep_pkts():
	INVALID mbuf: bad data_len=[2962]

Remove the check on data_len.

Fixes: ccf33dccf7aa ("net/ice: check illegal packet sizes")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Note: I am still waiting for feedback and there may be some followup patch
later wrt ice_prep_pkts.
For context, see: http://inbox.dpdk.org/dev/CAJFAV8yOa3ShkVdEXHfnmOEmUTwV3e75Bu9U3OqpNc5usTt3Rw@mail.gmail.com/T/#u

Changes since v1:
- moved log removal in a separate patch,

---
 drivers/net/ice/ice_rxtx.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
  

Comments

Qi Zhang Sept. 27, 2023, 12:36 p.m. UTC | #1
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Wednesday, September 27, 2023 5:42 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Kevin Liu <kevinx.liu@intel.com>
> Subject: [PATCH v2 4/4] net/ice: fix TSO with big segments
> 
> Packets to be segmented with TSO are usually larger than MTU.
> Plus, a single segment for the whole packet may be used: in OVS case, an
> external rte_malloc'd buffer is used for packets received from vhost-user
> ports.
> 
> Before this fix, TSO packets were dropped by net/ice with the following
> message:
> 2023-09-18T13:34:31.064Z|00020|dpdk(pmd-
> c31/id:22)|ERR|ice_prep_pkts():
> 	INVALID mbuf: bad data_len=[2962]
> 
> Remove the check on data_len.
> 
> Fixes: ccf33dccf7aa ("net/ice: check illegal packet sizes")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> Note: I am still waiting for feedback and there may be some followup patch
> later wrt ice_prep_pkts.
> For context, see:
> http://inbox.dpdk.org/dev/CAJFAV8yOa3ShkVdEXHfnmOEmUTwV3e75Bu9U3
> OqpNc5usTt3Rw@mail.gmail.com/T/#u
> 
> Changes since v1:
> - moved log removal in a separate patch,
> 
> ---
>  drivers/net/ice/ice_rxtx.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index
> d5513e9e93..ee9cb7b955 100644
> --- a/drivers/net/ice/ice_rxtx.c
> +++ b/drivers/net/ice/ice_rxtx.c
> @@ -3685,9 +3685,6 @@ ice_prep_pkts(__rte_unused void *tx_queue,
> struct rte_mbuf **tx_pkts,
>  	int i, ret;
>  	uint64_t ol_flags;
>  	struct rte_mbuf *m;
> -	struct ice_tx_queue *txq = tx_queue;
> -	struct rte_eth_dev *dev = &rte_eth_devices[txq->port_id];
> -	uint16_t max_frame_size = dev->data->mtu + ICE_ETH_OVERHEAD;
> 
>  	for (i = 0; i < nb_pkts; i++) {
>  		m = tx_pkts[i];
> @@ -3704,9 +3701,7 @@ ice_prep_pkts(__rte_unused void *tx_queue,
> struct rte_mbuf **tx_pkts,
>  			return i;
>  		}
> 
> -		/* check the data_len in mbuf */
> -		if (m->data_len < ICE_TX_MIN_PKT_LEN ||
> -			m->data_len > max_frame_size) {
> +		if (m->pkt_len < ICE_TX_MIN_PKT_LEN) {
>  			rte_errno = EINVAL;
>  			return i;
>  		}
> --
> 2.41.0

Series Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index d5513e9e93..ee9cb7b955 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -3685,9 +3685,6 @@  ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 	int i, ret;
 	uint64_t ol_flags;
 	struct rte_mbuf *m;
-	struct ice_tx_queue *txq = tx_queue;
-	struct rte_eth_dev *dev = &rte_eth_devices[txq->port_id];
-	uint16_t max_frame_size = dev->data->mtu + ICE_ETH_OVERHEAD;
 
 	for (i = 0; i < nb_pkts; i++) {
 		m = tx_pkts[i];
@@ -3704,9 +3701,7 @@  ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 			return i;
 		}
 
-		/* check the data_len in mbuf */
-		if (m->data_len < ICE_TX_MIN_PKT_LEN ||
-			m->data_len > max_frame_size) {
+		if (m->pkt_len < ICE_TX_MIN_PKT_LEN) {
 			rte_errno = EINVAL;
 			return i;
 		}