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 495A6A0C3F; Fri, 9 Apr 2021 04:32:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA6BD4068E; Fri, 9 Apr 2021 04:32:08 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130044.outbound.protection.outlook.com [40.107.13.44]) by mails.dpdk.org (Postfix) with ESMTP id 111C74014D for ; Fri, 9 Apr 2021 04:32:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FWusK0MCrODsauNd39BQArMbCoKOh2sQj1aJsGdaTos=; b=xs5aqvk254mylerUz0neh/Zz77lwBLj6EE74IoHoNNItjM5scwZfPo061VfLDs2SvoRaaLpor7NRgH0/fF/7EbQJ60xpDtweCMHiqrkBL4GfDZbvWfE88dibBjkrrlRIoRHJC/krRnFeMNfdpsXXktCDOr7UMvIsAv/qGxVZhnQ= Received: from MR2P264CA0048.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500::36) by DB6PR0801MB1975.eurprd08.prod.outlook.com (2603:10a6:4:75::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16; Fri, 9 Apr 2021 02:32:03 +0000 Received: from VE1EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:0:cafe::9e) by MR2P264CA0048.outlook.office365.com (2603:10a6:500::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Fri, 9 Apr 2021 02:32:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT043.mail.protection.outlook.com (10.152.19.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Fri, 9 Apr 2021 02:32:02 +0000 Received: ("Tessian outbound 82c2d58b350b:v90"); Fri, 09 Apr 2021 02:32:02 +0000 X-CR-MTA-TID: 64aa7808 Received: from 033c23560a40.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4CBE9056-D8FB-40F7-B43C-7A8C1A60226E.1; Fri, 09 Apr 2021 02:31:56 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 033c23560a40.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 09 Apr 2021 02:31:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kjFY2dV6GMu9CNyFZLjw82uSn+6eOjemn84puFDcGmaBAqicF/iKgSSRPp7xn72KUdYKzbCIlK2oi5VsV3fni4TbdMMYFHqWBRGnJgjAluXaL8W+l6FOpYDdb/16nQLgjm8X66kOkVosNcBwXXbXcT+u9M6OHaPQgNNl8g+8f7Pfjh7b2+uDxz25Nv1z1w2YXIKtZNw8VHRp70Rma/eMDcE3JM0XyYxlkhF1RcF51sZBN56V0xXH9gGCCNl4lq9hnmgcvRki40/S/cgVVgb80L9CdonSjIeEAi+9G18B4/M2RJjAqeSOA5osXXu5Yt0Q705BYgIsZxvNfJfZ0L5yKA== 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-SenderADCheck; bh=FWusK0MCrODsauNd39BQArMbCoKOh2sQj1aJsGdaTos=; b=Y4Ce4ajGiCykD2IGLF7lMkdv3mCZjS60NZMA+l4ImmxXHznsikyjxaTrfo1he+IaXkOx8AWmu1jDnl0p7cUSdyDAjtJ4afSAZp2J7gO4nG/tCNM/gXh0jCpKao3e/aCd3XE3H7eRUcDeWlAkiRuwCQLqAxjF7OyMujKOh+UucaO4+PyrjU4Kzp12/7htiJFjYM2TWhs1S6o3VRLTC4Kaahc1XzSN+atsOajWkaG2IlRo4MvbYFsWj++uRTA5VU+NP5MlFNqkK4xywq0LgtJi1P69ZrZgn6iid0uYY+tCiw2yKs3NGwy872/cVT4PunrsH0p4rbYtt9OOEYhBzbBBWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FWusK0MCrODsauNd39BQArMbCoKOh2sQj1aJsGdaTos=; b=xs5aqvk254mylerUz0neh/Zz77lwBLj6EE74IoHoNNItjM5scwZfPo061VfLDs2SvoRaaLpor7NRgH0/fF/7EbQJ60xpDtweCMHiqrkBL4GfDZbvWfE88dibBjkrrlRIoRHJC/krRnFeMNfdpsXXktCDOr7UMvIsAv/qGxVZhnQ= Received: from AM5PR0802MB2465.eurprd08.prod.outlook.com (2603:10a6:203:9f::22) by AS8PR08MB5879.eurprd08.prod.outlook.com (2603:10a6:20b:293::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.18; Fri, 9 Apr 2021 02:31:53 +0000 Received: from AM5PR0802MB2465.eurprd08.prod.outlook.com ([fe80::e890:2ff8:8cdf:83b2]) by AM5PR0802MB2465.eurprd08.prod.outlook.com ([fe80::e890:2ff8:8cdf:83b2%4]) with mapi id 15.20.4020.017; Fri, 9 Apr 2021 02:31:53 +0000 From: Ruifeng Wang To: David Marchand , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "olivier.matz@6wind.com" , "fbl@sysclose.org" , "i.maximets@ovn.org" , Chenbo Xia , Bruce Richardson , Konstantin Ananyev , "jerinj@marvell.com" , nd Thread-Topic: [PATCH 4/5] net/virtio: refactor Tx offload helper Thread-Index: AQHXJtznoslXVBnG0EmmYJ/lmct5hqqrgx0Q Date: Fri, 9 Apr 2021 02:31:52 +0000 Message-ID: References: <20210401095243.18211-1-david.marchand@redhat.com> <20210401095243.18211-5-david.marchand@redhat.com> In-Reply-To: <20210401095243.18211-5-david.marchand@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: A05A4885EA8D9644911D417F3E861B09.0 x-checkrecipientchecked: true Authentication-Results-Original: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [203.126.0.112] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: d90c140f-0c99-4fd9-d6f2-08d8faffa8dc x-ms-traffictypediagnostic: AS8PR08MB5879:|DB6PR0801MB1975: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:3044;OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: JwI7EmM1HuK4EGlin85NS0ZyY8+ZrKXNOuJ6ZzkPTYv4NJ7p/povkcaskyYYn+Xtr3JA5t5XxHFtSmpseW2cgCg7odNJ2UWBpMWDUexZMiAR5eIT4SEsdewTAMjUJNqxQZD9pfR1jJ14aWjLwsoMrPvrTpK5rBkHnk69hrqQ3myUWOJfVEgDLAhQ5yGaMq+xMDxmBZ63jPxct/LlNel0O7VJuz2aWPasYU+FCNKtlj69KbEOMEA3Z815oPQIiPVVSMx2Iq/6l0OcMATLi5K8ZLB6a0J14Ha0P+yywidTKQsG+K07LMS2+RJ7rm58WBeofVTf8/r8kaUj1tLiTf4aOWF35dvqNNS8HCd8Eq1EWofukScLiEBZYl0PtyAo0KnxJBM6g6JL2we1QFarlNNfq7sZBiAhNydUXx9MlP4k0KzDY0i3mbUD3K894k//JWaio3fIUZg4O5kC/sEbKaTDi9IO7LYecZYG5Pg+2jG+S3LlLl4FkJP4rIzoWHavFQKCziKEjGj9oFy2P2QE+sCz5fvpEj7PbTin75NLq9BFxwjl1cJ+jvduRikVG/y5l+5z8tWZy/8gWZzzbXwkPLv7B37JLBlkhL1Lkcye8c0hMLYFW5g0wqLCjiQQy9YHxrHJcC/Vp1GocVo3vSCSj+GWJQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM5PR0802MB2465.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(39860400002)(136003)(376002)(366004)(396003)(66556008)(64756008)(66446008)(38100700001)(52536014)(71200400001)(5660300002)(26005)(186003)(86362001)(66946007)(66476007)(2906002)(7416002)(478600001)(83380400001)(316002)(54906003)(8936002)(33656002)(7696005)(8676002)(53546011)(110136005)(76116006)(55016002)(9686003)(4326008)(6506007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?AkVww9hcgy5gq/mpnY+BgE4tE5vij1UVLgsiU85VPg/yv2vLvP65FVWFAGss?= =?us-ascii?Q?tS2zbfXTeE+tzsmqNDSPFS2sh/KCnOfkP990v520+RpyvB0z49d6b5+NUKsp?= =?us-ascii?Q?MUESauxdn7TaVdmIdKt6vNm4xTg1GcUUi9MWvfg+TQCPLUoccgcxztaEDhKa?= =?us-ascii?Q?fSd18UT+ntBRqaFdShH03LIC/uZkYH4I+yMeXgEhuc0WC83puqsJl4QZkcwe?= =?us-ascii?Q?+mAQxTjIjhMC68NbYNFIuErwXEg5m59QBIvoe4zhp8bIt+Gl/d3fBVauc5Uj?= =?us-ascii?Q?pHaAmadbSOPH+QlqTRpf3QtkiM0euqTIPLPqF9KvNGpPV+LKrHz4Z+5aMXmz?= =?us-ascii?Q?gBtQLrOMtDodOslx4LPDml4bXbxqOdw+RWWFg0MtLVhK9wk1W8uXaqZEZ82o?= =?us-ascii?Q?gZLK8QbOssfcGlkWWu/MDVCtjLiNLkCDLokWgWxpT96VVpstOfR+W+2PP2ip?= =?us-ascii?Q?1n0NO5wGg/1yVPAzIe9Jy99yl4Lf5HMixjsPhJ17S5ExjToXDckKbhXszAyd?= =?us-ascii?Q?8x4HoIx+qX2DLWyryhzUuwm3BVNORG7w3vGcgQGcX62lW+fqaLHTEWHg0Sw/?= =?us-ascii?Q?Zn0KrTrkUdrA1t0cxn/phia6H4ICa4OV2iy4owRl8VN0BDGkVlYgH340HZxH?= =?us-ascii?Q?TEPyaBgd0uxl51ZSMRb/zrrP2ga/m8yIG6C69wiEp85n0KhO8v+1PjrB5tmm?= =?us-ascii?Q?6EIMk7jYyYBL5/ycj8ciWi7I/x8iQ9v8AN7AL3yL7M+xt37ystSMmQedXefu?= =?us-ascii?Q?pfMMx1TMMXwkU6UcIrF6ACCOUCjEF93qQwsw854fZuI2jUy1+g9bZKrdKlQ8?= =?us-ascii?Q?x24epEtSLLLc/r3kj3jIxXJ7LGq2GqGsRx+rTBGJqNYR9JPurSWPKs7LmxWY?= =?us-ascii?Q?V+EL4jWn9G1MFOG1BE2P6PcmirryESnuFxXWlBfbppToH+VMy7vWmmBg2Ygq?= =?us-ascii?Q?JI45BkRFsoElUdvOHjxb08L39F40/9ivwHZG1HSnE5Vk5ObUF5K4B07N4Odb?= =?us-ascii?Q?WzX3PXD/GJW9gk+xOTJVxyGH03L9awtBhtbwZX3DbFvtUo4jUCqYnd7i2gb9?= =?us-ascii?Q?6kof4o3Hs0wI8pXrEblm9nS0pDExYVe3Tp4DeA3pGNaztaDNA4o/KWA/d091?= =?us-ascii?Q?k8mngDfOT8jAuh8UkRG+wfFrLjP8I6c3vOor2i4xj9LHe94YBqBXh/hYU/cy?= =?us-ascii?Q?bLRA+/oNv2Mcd/u/1/7vPcqhzHObL9RM1DG67LojzHg+WRKXV7cU3XbVL3nK?= =?us-ascii?Q?QYwGMfrHLUeFoD5NLSMhG9Jk5SNadM8fLNpd9rJPbkEnB2c0rWr6tC6PFvMc?= =?us-ascii?Q?B8IKyveYOIqZDYnkcEBY4fax?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB5879 Original-Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: bc5819df-156c-4cb7-1254-08d8faffa301 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3l6BnvZJiwMZB53ae6K4lEdwC0aVGyCxckQPEQ7TvxhTPUsyrWevhGravjiXVrCzP8q7Td5PGkuPqn+2XddRPqlEUSQtW9rT7uyWznSPIz3+GRw8zvytRLomotSKz6izZauOccp7sPwV7HdtFhG2mcBCKXvr0W/54RCe9Xx2h2hkrScLcVqKwM5f6S2Cz1P3s+cuZyBjK7m7CZyUZwKEEWU+eBFvQrvwgvbTOPwKd7s62NO4pZAMUFBcXPts//IRKi5u2jKOBatUeDejz2OoEaLW82o0MBWmFpQ7qWgSsjLfyr3MESfDoODcgjLx/eXGPWud9zDdJ8yw8ese96ajnq9lW3gsy4+TrCUaC1S67qfwpIkjDqhvY184Xbp0zKSiIXKX/Y3CUOSeMhwih/JB5UjiZb4RNr6RYZsGWe21SeCxEHsWxkUzNGHXAnOb++3R6pmDpcrxEFdCF60f8f0aavni3wtFYXC7Ly6xxW8XnkaqZh8Fcc2NmP0sdrG2hkzssRybj2VJxxNcKEyMEtWF227vZo7/+pqoA8NNsn7dsyoyG3W5AnsCvCOjQSYiwkelpih5DdERC0XMDkxPWyeSd5QvDSGLzRlh4Cmfrw7G9F4xUGELtiSR7AUk2+D9WFjeNI79IIGxmAavKEFKGQf9VQ== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(346002)(136003)(396003)(39860400002)(376002)(36840700001)(46966006)(110136005)(7696005)(186003)(54906003)(55016002)(26005)(53546011)(5660300002)(36860700001)(316002)(86362001)(82310400003)(4326008)(478600001)(70586007)(2906002)(81166007)(82740400003)(9686003)(6506007)(33656002)(8676002)(70206006)(8936002)(52536014)(47076005)(83380400001)(336012)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2021 02:32:02.7905 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d90c140f-0c99-4fd9-d6f2-08d8faffa8dc X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1975 Subject: Re: [dpdk-dev] [PATCH 4/5] net/virtio: refactor Tx offload helper 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 Sender: "dev" > -----Original Message----- > From: David Marchand > Sent: Thursday, April 1, 2021 5:53 PM > To: dev@dpdk.org > Cc: maxime.coquelin@redhat.com; olivier.matz@6wind.com; > fbl@sysclose.org; i.maximets@ovn.org; Chenbo Xia ; > Bruce Richardson ; Konstantin Ananyev > ; jerinj@marvell.com; Ruifeng Wang > > Subject: [PATCH 4/5] net/virtio: refactor Tx offload helper >=20 > Purely cosmetic but it is rather odd to have an "offload" helper that che= cks if > it actually must do something. > We already have the same checks in most callers, so move this branch in > them. >=20 > Signed-off-by: David Marchand > --- > drivers/net/virtio/virtio_rxtx.c | 7 +- > drivers/net/virtio/virtio_rxtx_packed_avx.h | 2 +- > drivers/net/virtio/virtio_rxtx_packed_neon.h | 2 +- > drivers/net/virtio/virtqueue.h | 83 +++++++++----------- > 4 files changed, 44 insertions(+), 50 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio= _rxtx.c > index 40283001b0..a4e37ef379 100644 > --- a/drivers/net/virtio/virtio_rxtx.c > +++ b/drivers/net/virtio/virtio_rxtx.c > @@ -448,7 +448,7 @@ virtqueue_enqueue_xmit_inorder(struct virtnet_tx > *txvq, > if (!vq->hw->has_tx_offload) > virtqueue_clear_net_hdr(hdr); > else > - virtqueue_xmit_offload(hdr, cookies[i], true); > + virtqueue_xmit_offload(hdr, cookies[i]); >=20 > start_dp[idx].addr =3D rte_mbuf_data_iova(cookies[i]) - > head_size; > start_dp[idx].len =3D cookies[i]->data_len + head_size; > @@ -495,7 +495,7 @@ virtqueue_enqueue_xmit_packed_fast(struct > virtnet_tx *txvq, > if (!vq->hw->has_tx_offload) > virtqueue_clear_net_hdr(hdr); > else > - virtqueue_xmit_offload(hdr, cookie, true); > + virtqueue_xmit_offload(hdr, cookie); >=20 > dp->addr =3D rte_mbuf_data_iova(cookie) - head_size; > dp->len =3D cookie->data_len + head_size; @@ -581,7 +581,8 @@ > virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie, > idx =3D start_dp[idx].next; > } >=20 > - virtqueue_xmit_offload(hdr, cookie, vq->hw->has_tx_offload); > + if (vq->hw->has_tx_offload) > + virtqueue_xmit_offload(hdr, cookie); >=20 > do { > start_dp[idx].addr =3D rte_mbuf_data_iova(cookie); diff --git > a/drivers/net/virtio/virtio_rxtx_packed_avx.h > b/drivers/net/virtio/virtio_rxtx_packed_avx.h > index 49e845d02a..33cac3244f 100644 > --- a/drivers/net/virtio/virtio_rxtx_packed_avx.h > +++ b/drivers/net/virtio/virtio_rxtx_packed_avx.h > @@ -115,7 +115,7 @@ virtqueue_enqueue_batch_packed_vec(struct > virtnet_tx *txvq, > virtio_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { > hdr =3D rte_pktmbuf_mtod_offset(tx_pkts[i], > struct virtio_net_hdr *, -head_size); > - virtqueue_xmit_offload(hdr, tx_pkts[i], true); > + virtqueue_xmit_offload(hdr, tx_pkts[i]); > } > } >=20 > diff --git a/drivers/net/virtio/virtio_rxtx_packed_neon.h > b/drivers/net/virtio/virtio_rxtx_packed_neon.h > index 851c81f312..1a49caf8af 100644 > --- a/drivers/net/virtio/virtio_rxtx_packed_neon.h > +++ b/drivers/net/virtio/virtio_rxtx_packed_neon.h > @@ -134,7 +134,7 @@ virtqueue_enqueue_batch_packed_vec(struct > virtnet_tx *txvq, > virtio_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { > hdr =3D rte_pktmbuf_mtod_offset(tx_pkts[i], > struct virtio_net_hdr *, -head_size); > - virtqueue_xmit_offload(hdr, tx_pkts[i], true); > + virtqueue_xmit_offload(hdr, tx_pkts[i]); > } > } >=20 > diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueu= e.h > index 2e8826bc28..41a9b82a5f 100644 > --- a/drivers/net/virtio/virtqueue.h > +++ b/drivers/net/virtio/virtqueue.h > @@ -613,52 +613,44 @@ virtqueue_notify(struct virtqueue *vq) } while (0) >=20 > static inline void > -virtqueue_xmit_offload(struct virtio_net_hdr *hdr, > - struct rte_mbuf *cookie, > - uint8_t offload) > +virtqueue_xmit_offload(struct virtio_net_hdr *hdr, struct rte_mbuf > +*cookie) > { > - if (offload) { > - uint64_t csum_l4 =3D cookie->ol_flags & PKT_TX_L4_MASK; > - > - if (cookie->ol_flags & PKT_TX_TCP_SEG) > - csum_l4 |=3D PKT_TX_TCP_CKSUM; > - > - switch (csum_l4) { > - case PKT_TX_UDP_CKSUM: > - hdr->csum_start =3D cookie->l2_len + cookie->l3_len; > - hdr->csum_offset =3D offsetof(struct rte_udp_hdr, > - dgram_cksum); > - hdr->flags =3D VIRTIO_NET_HDR_F_NEEDS_CSUM; > - break; > - > - case PKT_TX_TCP_CKSUM: > - hdr->csum_start =3D cookie->l2_len + cookie->l3_len; > - hdr->csum_offset =3D offsetof(struct rte_tcp_hdr, > cksum); > - hdr->flags =3D VIRTIO_NET_HDR_F_NEEDS_CSUM; > - break; > - > - default: > - ASSIGN_UNLESS_EQUAL(hdr->csum_start, 0); > - ASSIGN_UNLESS_EQUAL(hdr->csum_offset, 0); > - ASSIGN_UNLESS_EQUAL(hdr->flags, 0); > - break; > - } > + uint64_t csum_l4 =3D cookie->ol_flags & PKT_TX_L4_MASK; > + > + if (cookie->ol_flags & PKT_TX_TCP_SEG) > + csum_l4 |=3D PKT_TX_TCP_CKSUM; > + > + switch (csum_l4) { > + case PKT_TX_UDP_CKSUM: > + hdr->csum_start =3D cookie->l2_len + cookie->l3_len; > + hdr->csum_offset =3D offsetof(struct rte_udp_hdr, > dgram_cksum); > + hdr->flags =3D VIRTIO_NET_HDR_F_NEEDS_CSUM; > + break; > + > + case PKT_TX_TCP_CKSUM: > + hdr->csum_start =3D cookie->l2_len + cookie->l3_len; > + hdr->csum_offset =3D offsetof(struct rte_tcp_hdr, cksum); > + hdr->flags =3D VIRTIO_NET_HDR_F_NEEDS_CSUM; > + break; > + > + default: > + ASSIGN_UNLESS_EQUAL(hdr->csum_start, 0); > + ASSIGN_UNLESS_EQUAL(hdr->csum_offset, 0); > + ASSIGN_UNLESS_EQUAL(hdr->flags, 0); > + break; > + } >=20 > - /* TCP Segmentation Offload */ > - if (cookie->ol_flags & PKT_TX_TCP_SEG) { > - hdr->gso_type =3D (cookie->ol_flags & PKT_TX_IPV6) ? > - VIRTIO_NET_HDR_GSO_TCPV6 : > - VIRTIO_NET_HDR_GSO_TCPV4; > - hdr->gso_size =3D cookie->tso_segsz; > - hdr->hdr_len =3D > - cookie->l2_len + > - cookie->l3_len + > - cookie->l4_len; > - } else { > - ASSIGN_UNLESS_EQUAL(hdr->gso_type, 0); > - ASSIGN_UNLESS_EQUAL(hdr->gso_size, 0); > - ASSIGN_UNLESS_EQUAL(hdr->hdr_len, 0); > - } > + /* TCP Segmentation Offload */ > + if (cookie->ol_flags & PKT_TX_TCP_SEG) { > + hdr->gso_type =3D (cookie->ol_flags & PKT_TX_IPV6) ? > + VIRTIO_NET_HDR_GSO_TCPV6 : > + VIRTIO_NET_HDR_GSO_TCPV4; > + hdr->gso_size =3D cookie->tso_segsz; > + hdr->hdr_len =3D cookie->l2_len + cookie->l3_len + cookie- > >l4_len; > + } else { > + ASSIGN_UNLESS_EQUAL(hdr->gso_type, 0); > + ASSIGN_UNLESS_EQUAL(hdr->gso_size, 0); > + ASSIGN_UNLESS_EQUAL(hdr->hdr_len, 0); > } > } >=20 > @@ -737,7 +729,8 @@ virtqueue_enqueue_xmit_packed(struct virtnet_tx > *txvq, struct rte_mbuf *cookie, > } > } >=20 > - virtqueue_xmit_offload(hdr, cookie, vq->hw->has_tx_offload); > + if (vq->hw->has_tx_offload) > + virtqueue_xmit_offload(hdr, cookie); >=20 > do { > uint16_t flags; > -- > 2.23.0 Reviewed-by: Ruifeng Wang