From patchwork Wed Sep 27 09:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 131988 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5473642651; Wed, 27 Sep 2023 11:42:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71233402F0; Wed, 27 Sep 2023 11:42:07 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 78EF74026B for ; Wed, 27 Sep 2023 11:42:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695807726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fk7SuYHbU0JmzE0l6Sv1S4vd7afAaTZJBgudb96G0ew=; b=A1KE+3RmGYK3574+pop4gJlpqP6by4/fyc6ta3Xy0cZ2Zg7ns1YWCxaUqggaPYCqEvy3ac XDxMtWVzm2LdGJP/MH9GpAN9I2XzzZ/42BXR+YT2WQ5+gjEaHcAjcaGpt9KewT20wFEP6t N/qyvGURgwfeOaWsiDLRVUAeB1096ys= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-692--w39PrpQO5adjAPBkGYGjg-1; Wed, 27 Sep 2023 05:42:01 -0400 X-MC-Unique: -w39PrpQO5adjAPBkGYGjg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3DAD4101A58B; Wed, 27 Sep 2023 09:42:01 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16E04C158BA; Wed, 27 Sep 2023 09:41:59 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Jingjing Wu , Beilei Xing , Qi Zhang , Kevin Liu Subject: [PATCH v2 1/4] net/iavf: remove log from Tx prepare datapath function Date: Wed, 27 Sep 2023 11:41:45 +0200 Message-ID: <20230927094148.1129330-1-david.marchand@redhat.com> In-Reply-To: <20230919140430.3251493-1-david.marchand@redhat.com> References: <20230919140430.3251493-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org iavf_prep_pkts reports to the application that the packet is invalid (from the driver pov). Having a log message only in this branch is not consistent with all other checks in this function and it may slow down the application if such invalid packets are being sent continuously. Fixes: 19ee91c6bd9a ("net/iavf: check illegal packet sizes") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/iavf/iavf_rxtx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 0484988d13..21a06b8351 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -3669,7 +3669,6 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, if (m->data_len < IAVF_TX_MIN_PKT_LEN || m->data_len > max_frame_size) { rte_errno = EINVAL; - PMD_DRV_LOG(ERR, "INVALID mbuf: bad data_len=[%hu]", m->data_len); return i; } From patchwork Wed Sep 27 09:41:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 131989 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6EE442651; Wed, 27 Sep 2023 11:42:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9DCC940685; Wed, 27 Sep 2023 11:42:09 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id B780340685 for ; Wed, 27 Sep 2023 11:42:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695807728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A7TuYaYwI7I7uN/59m9YjrtxmoBUkQy9u6MwAIILfWU=; b=ITJFJGjBvYVsauHnPiXNmhzF2RXaW/4GhH6FFckauiA08BAr6GL/mfJXtEwMKZDgyDwAPv qstONnPgXJ7NusYJnsapQNjcqajbuZRyIm6vZQsVOZ5Y8edwVx7xxehzmk28TiFxuD3/PZ O/0VTTUn+okMaoeEq6cEzohgmgcoFl4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-599-XrHzwI7EMzavU5A-g7-Aww-1; Wed, 27 Sep 2023 05:42:04 -0400 X-MC-Unique: XrHzwI7EMzavU5A-g7-Aww-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43ABD185A78E; Wed, 27 Sep 2023 09:42:04 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 225D2C15BB8; Wed, 27 Sep 2023 09:42:03 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Jingjing Wu , Beilei Xing , Qi Zhang , Kevin Liu Subject: [PATCH v2 2/4] net/iavf: fix TSO with big segments Date: Wed, 27 Sep 2023 11:41:46 +0200 Message-ID: <20230927094148.1129330-2-david.marchand@redhat.com> In-Reply-To: <20230927094148.1129330-1-david.marchand@redhat.com> References: <20230919140430.3251493-1-david.marchand@redhat.com> <20230927094148.1129330-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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/iavf with the following message: 2023-09-18T14:08:52.739Z|00610|dpdk(pmd-c31/id:11)|ERR|iavf_prep_pkts(): INVALID mbuf: bad data_len=[2962] Remove the check on data_len. Fixes: 19ee91c6bd9a ("net/iavf: check illegal packet sizes") Cc: stable@dpdk.org Signed-off-by: David Marchand --- Changes since v1: - moved log removal in a separate patch, --- drivers/net/iavf/iavf_rxtx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 21a06b8351..c6ef6af1d8 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -3636,7 +3636,6 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, struct rte_mbuf *m; struct iavf_tx_queue *txq = tx_queue; struct rte_eth_dev *dev = &rte_eth_devices[txq->port_id]; - uint16_t max_frame_size = dev->data->mtu + IAVF_ETH_OVERHEAD; struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); @@ -3665,9 +3664,7 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, return i; } - /* check the data_len in mbuf */ - if (m->data_len < IAVF_TX_MIN_PKT_LEN || - m->data_len > max_frame_size) { + if (m->pkt_len < IAVF_TX_MIN_PKT_LEN) { rte_errno = EINVAL; return i; } From patchwork Wed Sep 27 09:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 131990 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7805342651; Wed, 27 Sep 2023 11:42:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 62E73406B4; Wed, 27 Sep 2023 11:42:14 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 17098402DC for ; Wed, 27 Sep 2023 11:42:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695807731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lmYWmdG7S6Ds1eVyYBI3dZsD7SSFE7hJCX6B4AyKM6g=; b=X3IxKK12Ic2TXmGdyG+8vErLx75clOhiL2LB1188kTce2P/ueqOurtZvpOWzuuxT3QIupX 00WQrRbnmiJlcvaJ6S8sADSrRw1mN2g5b8Y38OcO7/Dv8BfoabwbZW4kt7fttv/j5QmFvd NSJs6jmMwpvgZMYn999z7b8Y0zFJ2bQ= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-juEtYCXgP4eF57BMq507fw-1; Wed, 27 Sep 2023 05:42:08 -0400 X-MC-Unique: juEtYCXgP4eF57BMq507fw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B0D23821344; Wed, 27 Sep 2023 09:42:07 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59574492B16; Wed, 27 Sep 2023 09:42:06 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Qiming Yang , Qi Zhang , Kevin Liu , Mingjin Ye Subject: [PATCH v2 3/4] net/ice: remove log from Tx prepare datapath function Date: Wed, 27 Sep 2023 11:41:47 +0200 Message-ID: <20230927094148.1129330-3-david.marchand@redhat.com> In-Reply-To: <20230927094148.1129330-1-david.marchand@redhat.com> References: <20230919140430.3251493-1-david.marchand@redhat.com> <20230927094148.1129330-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org ice_prep_pkts reports to the application that the packet is invalid (from the driver pov). Having a log message in those branches is not consistent with all other checks in this function and it may slow down the application if such invalid packets are being sent continuously. Fixes: ccf33dccf7aa ("net/ice: check illegal packet sizes") Fixes: 688cb2f2c61e ("net/ice: fix scalar Tx path segment") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/ice/ice_rxtx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index e07c6d1f15..d5513e9e93 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -3708,7 +3708,6 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, if (m->data_len < ICE_TX_MIN_PKT_LEN || m->data_len > max_frame_size) { rte_errno = EINVAL; - PMD_DRV_LOG(ERR, "INVALID mbuf: bad data_len=[%hu]", m->data_len); return i; } @@ -3727,7 +3726,6 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, if (ice_check_empty_mbuf(m) != 0) { rte_errno = EINVAL; - PMD_DRV_LOG(ERR, "INVALID mbuf: last mbuf data_len=[0]"); return i; } } From patchwork Wed Sep 27 09:41:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 131991 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F76642651; Wed, 27 Sep 2023 11:42:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0A3840A6C; Wed, 27 Sep 2023 11:42:17 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 10535409FA for ; Wed, 27 Sep 2023 11:42:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695807736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wCyb1mvyfTmJgjIKiiU1V2o7tbE0uxsAYss4KcLKZK0=; b=AWkpiB8WBAO2bIuVh7KwvTV66qLdCuES3wDBuCjpQYF+Ll1hOVvbePVLYivPB4lW8emDoF D7X9MYc0TjCu+lH102qKkYFw2mCkGyjxWNno4aJVdu3bHJbaHld/M5A01ezKFhXXzccgt1 qmgOP29gJVcjEzVU8OHuOZUsrLiMxms= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-32-HR69K3gMM_CVode0CpUIfw-1; Wed, 27 Sep 2023 05:42:11 -0400 X-MC-Unique: HR69K3gMM_CVode0CpUIfw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 989A6185A797; Wed, 27 Sep 2023 09:42:10 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E1D514171B6; Wed, 27 Sep 2023 09:42:09 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Qiming Yang , Qi Zhang , Kevin Liu Subject: [PATCH v2 4/4] net/ice: fix TSO with big segments Date: Wed, 27 Sep 2023 11:41:48 +0200 Message-ID: <20230927094148.1129330-4-david.marchand@redhat.com> In-Reply-To: <20230927094148.1129330-1-david.marchand@redhat.com> References: <20230919140430.3251493-1-david.marchand@redhat.com> <20230927094148.1129330-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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(-) 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; }