From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EB33CA034C; Tue, 30 Aug 2022 09:52:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D34A740F18; Tue, 30 Aug 2022 09:52:53 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 6959B40F17 for ; Tue, 30 Aug 2022 09:52:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661845972; x=1693381972; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=iJKXaBHrSUDuetcOkD2r+ZdiQDXpUn+e0vWoZG8UDeU=; b=koss7hkd2HAx2/AqTU1gkHFu8HRwIbgUhg1VQFAjTPE0wmKbxHibWNfR Jk+2OD9dbxbhuhNYDu5kI7GpN3PWuiGGw2L0ZC3sqsMxE8VI8FY19EZ9p BHdqlZWclqAk3VKBcvHEAwxAaWwkoM50Ekij4jFxVfjv+YrRynWbJ7Qiz 9WKPf7pdnLmaFx9VngX3124UoqpCbZRrkb2RSNBcNdD9Yi4PBV1pYcAV3 4MctLeZPwiB3c35sZyEPm8DoUn7l0XoZjk0rRHgOe1KJ0F8WmFk8myjj1 V8FVy8//j7ASisHUe+40PuD53TmrqtwxQpTopCx7O7/zuizPSgl/DFK7r Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="275511066" X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="275511066" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 00:52:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="644738627" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga001.jf.intel.com with ESMTP; 30 Aug 2022 00:52:50 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 30 Aug 2022 00:52:50 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 30 Aug 2022 00:52:50 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.48) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 30 Aug 2022 00:52:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BBnzZRrvID7uj0otrMh8xmp4P6AwUT5M4OTS4fOKR3S6WSmIMXTd+HDPi0Fj0DBRDVx1nHF38AyEUFWf0IimgHYK7Z2kXunCjxhu6IKPxLN4kmwkSMg5BrVgSiYPudKOzwBcIFnZs2L5z0QytV1DcK5GFvehy40M00LiFB7bsitPX7E2mybDW4hupcCNvNl1RGA82NIwWUduCRi5AVeeQzOHc3J1ZuMhJMwdQZE9JnJiSAHmEy/3cTlVdafOo2/1GSElCdhhtyD4bA/petf75eEfH8bab4lQKjd7PtKBDAJA9+61ChtfFMF5LOarQ8hJnVeJ0PZ/JC41KcOq2F+GWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zp12eaYdD1pToi8uAmzd7JG5QubQ0CAXbWJlIofdhYw=; b=IjvcGojKPltFVXEG0GxEpbFhrSyKUlVweSoY3IZYHlPrdSbCgPOeW/Sy5RDacSLkz8JTMPZq1fY3afNbuCLrBPQMpdDb2P3eHNyLw/C0mI2BpnFrYsJwH8H7dKBcx3fGXygQDX4TdAG/b8W4zw/1o3Kf1lj6G9GoQ67jtuzyPL5zVseFz0cyT+NB0CvEU79FIDkfCUVMI9/XiFdlZotzWKEL9U3Kp1AxGHqZvK6jiwgc/XsL7dT8ZTtGsJSD7qP8vkC6dHau4QefUNzGJ9gIlKGsXQl73cpx/CNTT/P28y+RUY6T0xqjs8l1B8gD9+ix88zLamhVMXkdHoBIte0OIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MWHPR11MB1886.namprd11.prod.outlook.com (2603:10b6:300:110::9) by MN2PR11MB4016.namprd11.prod.outlook.com (2603:10b6:208:155::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14; Tue, 30 Aug 2022 07:52:46 +0000 Received: from MWHPR11MB1886.namprd11.prod.outlook.com ([fe80::58f6:397c:5f5a:216f]) by MWHPR11MB1886.namprd11.prod.outlook.com ([fe80::58f6:397c:5f5a:216f%4]) with mapi id 15.20.5566.021; Tue, 30 Aug 2022 07:52:44 +0000 From: "Yang, Qiming" To: "Zhang, Peng1X" , "dev@dpdk.org" CC: "Xing, Beilei" , "Wu, Jingjing" , "Zhang, Peng1X" Subject: RE: [PATCH 1/2] net/iavf: enable TSO offloading for tunnel cases Thread-Topic: [PATCH 1/2] net/iavf: enable TSO offloading for tunnel cases Thread-Index: AQHYripo689yiHVbR0uJNmtBK27uBa3HIQYA Date: Tue, 30 Aug 2022 07:52:44 +0000 Message-ID: References: <20220812165223.470777-1-peng1x.zhang@intel.com> In-Reply-To: <20220812165223.470777-1-peng1x.zhang@intel.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.500.17 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b8ecc921-df17-4302-98de-08da8a5c9fbd x-ms-traffictypediagnostic: MN2PR11MB4016:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: X1NfRIxqx/h17wqMrCUw1FiWJzJkQ5T4UmAwxn3v+Nw+VVMCyUVdWeLwrhMv0Ylxm45Cu45jkgHezhyJr2v41h8bRLVDUFy9BbrLQwrXirXTxeEVYP58eJOWF1gbr44d8aSutNjJgJ5CKiKXFqP2YCC22F452gHCHo9CFOtFARhGSuGYaqwInDIU7b4i0+s8/gG8UTn7uN9lOzU42A0gDjSFiNaxzH5o94nzV1KTzCxAEjg7imTDVSHajtS4XufIM+Q6RzhtlaOWnnnWeo2zZtGZjfCa5SnL8KDqL0Mv0DSJdc+tzsrfNhF6v7K7+bF+xkvpDjSc7OBQJO3a2oy5fkeRF/Wlr7ZVUVxe4aBKVI6dsCL/nyNPdNxgZW5misBzaCpxI80WfOGqEgW3Rxa3V9p2kBfu6vtzmVheZ9P8N52ze5uP9O+UjnvbFjioX+SgLG/f6DBQqK2pZR3pfs+XOmk6zclDuj0SOcXRz5cpnwhHCJydgqU/0rZFTvA9DD4dvAJki/OkGKJTemY9zh/rbvilA/hQ2NkNvx7T4s/mVZsMX+Qc/hqOYOtzSPdjoczHzuiYO23lSZfjpIhhbVmWLShV6zaYyWbn6GIip/X+YZqobbcZcTJ8/4kjZy+5sriTMBCJGZXibjgwV43prEyYgSRl43naJY494GqAPe0A3Pm61AjrlsPtzXm1UmhU6TyE2h5+/ziMHnzM0CjbSD5eKd8i8c61ccTBU1T/EwxWD8EzsUtRk4mhyzBZYlJ49ay96g1v8UJE24XovoZ3n+e/2w== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1886.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(376002)(346002)(39860400002)(396003)(136003)(366004)(7696005)(64756008)(5660300002)(478600001)(6506007)(8676002)(4326008)(66556008)(66476007)(107886003)(66946007)(66446008)(52536014)(33656002)(8936002)(53546011)(76116006)(86362001)(41300700001)(122000001)(83380400001)(186003)(2906002)(38070700005)(82960400001)(9686003)(26005)(38100700002)(316002)(110136005)(55016003)(54906003)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?DNO0NY0SonmXI93iDl4S3uWKwYP6YlTqX9vmUs4M73kVVo0LpWDL/Qj2gZO4?= =?us-ascii?Q?JWQdvHA7glauRgAVnKqvjMI/mjJdhCzJv40oUKX2Yj/2+eFERBmINeRVzTBb?= =?us-ascii?Q?T9NdQZ6tqCqZB2lQzZ4ZkLTpd85tCl8kA95dkQhJXQdI9+9RIK95kZg6ZlyG?= =?us-ascii?Q?gqiLQWgo6ieVoBETwSajUQ0MGFEhvizOfe0gQwDlST8hUyJgKMHqwap8R1Ll?= =?us-ascii?Q?96sY8I8TrXI/2hLTlUgPVt3CKKEe4U7l6w39LBY6/8IAlbI6W95JTUdiq9ra?= =?us-ascii?Q?+oWL2XFBBkyd+y3UuI3uSV2+wDwoIS9vf/AJPB6YQII/5wyhQ1LsPtBZY6Ar?= =?us-ascii?Q?cJGWqcLTUOX8VBeuHBFKIOz8vHkCt4kIRd5NkRkS9yqLsKu9IGhgjA6ROB8e?= =?us-ascii?Q?ltn7pty6XCYBGngSZMUgB8ZTV/QluC3q5eqU/c9DD3NBq5gjPSSrvJSnrslr?= =?us-ascii?Q?z9PLziLj06O/vkfZSiYUHsw0jPOMKnR/kvVKZV8F8ReFdxYNnXGHqUciw3jL?= =?us-ascii?Q?uAQnxuQa9EcUJCLQxYArFTwf7b3ABFinhwXxXhxdVW97yPdarT6b+qx4RA8x?= =?us-ascii?Q?zrHv0Xxdpin5DzpFN7fw519V3SzByv8X1C5naPDv/bZLrg+aOWfGCzH7Jrgz?= =?us-ascii?Q?vGaBKOwCyHNCIDa1kpdUROcpctVt87fggCX4dSsbFC/MdP83xH7ZextWnKTH?= =?us-ascii?Q?+touK6F1jvMB7eD3/oHM/IPGE4Ang9GH4qy5oXKp6UyPBArMb86YZ/pclxlp?= =?us-ascii?Q?s6LOW/mykgcMHFb/SUD/34g3W11slfbC34H6puxHYDrGiPna+RK+SWVW2bU7?= =?us-ascii?Q?72QsKocjFanRBEgFO80IpT9+LqYqaJ/aRC7G8hsQFeLqh7x+K9XMuRIlxo5o?= =?us-ascii?Q?bhQ8AR3NBeXZV+CvjQKOe4PIr2Isb7H4JtN9M575HLImgs8sCHNQP9s702Hp?= =?us-ascii?Q?o+brY60YDOXTtBxhoIk1TSIKgKk/d7uI4tTYixgPTvZct0SENdutvPPvYNSR?= =?us-ascii?Q?7nik68kKXzZpSUfMaelcU9NnQyXObe+XW8NIpKiskig+CFuTeyMbueKAg695?= =?us-ascii?Q?V/dZW+JDJcy0eFp974r7H44SETH70oPgrV3pJRsb3dLcr7ZuXDpUzlGVQI0Z?= =?us-ascii?Q?vb+msyVc0Kj0qWCHWH8gFeNfjKWo1GP6s+ghQTIiHa0Uk/krX4a/6Lcnfc4i?= =?us-ascii?Q?F8o567CPvQaOKZyPZW1wejKfCRvOuTXqu3/ekhFUdTipzU+QiQux7g3YZH+3?= =?us-ascii?Q?ZXOb6HoaFVRIFSP9WNYt4QYobzBxR+c3iVVWMu+urDKB7x06yUOz8BJIZ598?= =?us-ascii?Q?h7nX56EwDCby/m20qnQxKbZMUn9yJAoPNLEqy95V+31xm2ycIwmqPz/xXlic?= =?us-ascii?Q?xSBBnlrrc57M26ZdmSm4eM+s8NuL9KtVJp4BlPsHqpJyxB+jKNK+k63E79wU?= =?us-ascii?Q?0oxFFU/y8L36n5g6q1QQNp8N2VcPMIMOJmYA1tvr8jSlPz3JXHat2G9ScGfT?= =?us-ascii?Q?39lnM6aDmH80FyZZG6qFU255GCuyQENn9zCoqpQlYmvkpW5ILgKUYnzFB51T?= =?us-ascii?Q?vZIpsuwzJHSfle02wqcwW3xfi9zRTnJwRnjOM1Ht?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1886.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8ecc921-df17-4302-98de-08da8a5c9fbd X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Aug 2022 07:52:44.7504 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: YVYRXEX6r/85VK2wnAgy12BY0a22Dsrn0zHxXEFzyB6p8kToaM+WMexl3F5s7F3LX8+3sLcVVcqu7muaDlPWIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4016 X-OriginatorOrg: intel.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 Please retest: TCP/UDP/tunnel-TCP/tunnel-UDP packet > -----Original Message----- > From: peng1x.zhang@intel.com > Sent: Saturday, August 13, 2022 12:52 AM > To: dev@dpdk.org > Cc: Xing, Beilei ; Wu, Jingjing ; > Zhang, Peng1X > Subject: [PATCH 1/2] net/iavf: enable TSO offloading for tunnel cases Should be a bug fix patch.=20 >=20 > From: Peng Zhang >=20 No need this line. > Hardware limits that max buffer size per Tx descriptor should be (16K-1)B= . > So when TSO enabled under unencrypt scenario, the mbuf data size may > exceed the limit and cause malicious behavior to the NIC. So this patch is fixing the tunnel TSO not enabling. >=20 > This patch supports Tx descriptors for this kind of large buffer. >=20 > Signed-off-by: Peng Zhang > --- > drivers/net/iavf/iavf_rxtx.c | 66 ++++++++++++++++++++++++++++++++---- > 1 file changed, 60 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c = index > dfd021889e..adec58e90a 100644 > --- a/drivers/net/iavf/iavf_rxtx.c > +++ b/drivers/net/iavf/iavf_rxtx.c > @@ -2642,6 +2642,47 @@ iavf_ipsec_crypto_get_pkt_metadata(const struct > iavf_tx_queue *txq, > return NULL; > } >=20 > +/* HW requires that TX buffer size ranges from 1B up to (16K-1)B. */ > +#define IAVF_MAX_DATA_PER_TXD \ > + (IAVF_TXD_QW1_TX_BUF_SZ_MASK >> > IAVF_TXD_QW1_TX_BUF_SZ_SHIFT) > + > +static inline void > +iavf_fill_unencrypt_desc(volatile struct iavf_tx_desc *txd, struct rte_m= buf > *m, > + volatile uint64_t desc_template, struct iavf_tx_entry > *txe, > + volatile struct iavf_tx_desc *txr, struct iavf_tx_entry > *txe_ring, > + int desc_idx_last) > +{ > + /* Setup TX Descriptor */ > + int desc_idx; > + uint16_t slen =3D m->data_len; > + uint64_t buf_dma_addr =3D rte_mbuf_data_iova(m); > + struct iavf_tx_entry *txn =3D &txe_ring[txe->next_id]; > + > + while ((m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) && ??? lack of UDP? > + unlikely(slen > IAVF_MAX_DATA_PER_TXD)) { > + txd->buffer_addr =3D > rte_cpu_to_le_64(buf_dma_addr); > + > + txd->cmd_type_offset_bsz =3D > + rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DATA | > + (uint64_t)IAVF_MAX_DATA_PER_TXD << > + IAVF_TXD_DATA_QW1_TX_BUF_SZ_SHIFT) | > desc_template; > + > + buf_dma_addr +=3D IAVF_MAX_DATA_PER_TXD; > + slen -=3D IAVF_MAX_DATA_PER_TXD; > + > + txe->last_id =3D desc_idx_last; > + desc_idx =3D txe->next_id; > + txe =3D txn; > + txd =3D &txr[desc_idx]; > + txn =3D &txe_ring[txe->next_id]; > + } > + > + txd->buffer_addr =3D rte_cpu_to_le_64(buf_dma_addr); > + txd->cmd_type_offset_bsz =3D > + rte_cpu_to_le_64((uint64_t)slen << > IAVF_TXD_DATA_QW1_TX_BUF_SZ_SHIFT) | > + desc_template; > +} > + > /* TX function */ > uint16_t > iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk= ts) > @@ -2650,6 +2691,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) > volatile struct iavf_tx_desc *txr =3D txq->tx_ring; > struct iavf_tx_entry *txe_ring =3D txq->sw_ring; > struct iavf_tx_entry *txe, *txn; > + volatile struct iavf_tx_desc *txd; > struct rte_mbuf *mb, *mb_seg; > uint16_t desc_idx, desc_idx_last; > uint16_t idx; > @@ -2781,6 +2823,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) > ddesc =3D (volatile struct iavf_tx_desc *) > &txr[desc_idx]; >=20 > + txd =3D &txr[desc_idx]; > txn =3D &txe_ring[txe->next_id]; > RTE_MBUF_PREFETCH_TO_FREE(txn->mbuf); >=20 > @@ -2788,10 +2831,16 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) > rte_pktmbuf_free_seg(txe->mbuf); >=20 > txe->mbuf =3D mb_seg; > - iavf_fill_data_desc(ddesc, mb_seg, > - ddesc_template, tlen, ipseclen); >=20 > - IAVF_DUMP_TX_DESC(txq, ddesc, desc_idx); > + if (nb_desc_ipsec) { > + iavf_fill_data_desc(ddesc, mb_seg, > + ddesc_template, tlen, ipseclen); > + IAVF_DUMP_TX_DESC(txq, ddesc, desc_idx); > + } else { > + iavf_fill_unencrypt_desc(txd, mb_seg, > + ddesc_template, txe, txr, txe_ring, > desc_idx_last); > + IAVF_DUMP_TX_DESC(txq, txd, desc_idx); > + } >=20 > txe->last_id =3D desc_idx_last; > desc_idx =3D txe->next_id; > @@ -2816,10 +2865,15 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) > txq->nb_used =3D 0; > } >=20 > - ddesc->cmd_type_offset_bsz |=3D > rte_cpu_to_le_64(ddesc_cmd << > + if (nb_desc_ipsec) { > + ddesc->cmd_type_offset_bsz |=3D > rte_cpu_to_le_64(ddesc_cmd << > IAVF_TXD_DATA_QW1_CMD_SHIFT); > - > - IAVF_DUMP_TX_DESC(txq, ddesc, desc_idx - 1); > + IAVF_DUMP_TX_DESC(txq, ddesc, desc_idx - 1); > + } else { > + txd->cmd_type_offset_bsz |=3D > rte_cpu_to_le_64(ddesc_cmd << > + IAVF_TXD_DATA_QW1_CMD_SHIFT); > + IAVF_DUMP_TX_DESC(txq, txd, desc_idx - 1); > + } > } >=20 > end_of_tx: > -- > 2.25.1