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 85308A0548; Thu, 4 Nov 2021 14:19:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 14283411C9; Thu, 4 Nov 2021 14:19:36 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 8F380411A4 for ; Thu, 4 Nov 2021 14:19:34 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10157"; a="231548516" X-IronPort-AV: E=Sophos;i="5.87,208,1631602800"; d="scan'208";a="231548516" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2021 06:19:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,208,1631602800"; d="scan'208";a="585788131" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga002.fm.intel.com with ESMTP; 04 Nov 2021 06:19:33 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 4 Nov 2021 06:19:32 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Thu, 4 Nov 2021 06:19:32 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.48) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Thu, 4 Nov 2021 06:19:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RKqKwHwYYtmVcidfDeo/E0ektEfltRx5tHnHOVF/eD/DKI0UefMlyp0fHV+rDQCm3CZup5/E/zQ2LEyW3O8pqGetSSG+meYQF0ZzLtdzKou/ihU3TjurzyKmuHJQyWMdQcM6QnYuJvrwIPOb/kgD33PMMjYjtQfePFGTKxNP81zHA9ImyL2kFRc1mohHiKzvND0xL3CRSmLpQz6XF0ruLwrW9mednlkT1LDf/6XFEp6YH2l+Rz8Xx+OvKoBO5pbhwBpnnU5efbio7GIL2ZIcTIFgfqWeMlREozsV47zOE/U6gUUz39voClCsNqNQ7vYxjZqtQ2kX9cT0//Ycry3eKg== 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=C3q54yVjICShZXyLWvkropX4TmtNzymSpFr63PcyhM8=; b=KB1nq9VJJ5Xfjzh3Z3VM8l1iFHHaIImZs37Wi6v6IXENF1BXwCdWb+Mc6zzBT3GT0wy1qTI5TEIUXjEwrI7XmbkU1kDX2pmKZFe3HH+BNfXALdGCIwUUj4+LjEo6h9y21KySd1/b16aI0B0xqWTACHmEtl0bqSB6cfcWBPrgOvF/kRoW38lC+0o0orZbV7JwyJUB/x4QsD9ele4O+1TP+1rEV481KXwi6wl/as+vvT6DhYMEpXJORr/LSUE7AeCAWDV2MHm3lfURa3P3Dcd6QUqmzkfNthG/xRWi2gG96FfLmpOPOQoJLVDlIIaihubFsFm4MlEhsSNewYKO1khgcw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C3q54yVjICShZXyLWvkropX4TmtNzymSpFr63PcyhM8=; b=uH00JTn0e1QRZDAyc3xtcbDS0jBP8Wu+lbxo1TlrUIrlxFbeZLAITzxdz9O545Zxv6omoPYvUtWuSF3+3PvdyxiG+0voOTTXZS7WBtZXOyGAA8cMMsijp86OrhQN+QtUxOLKs3EcJn/dl62sXNnbhO4klv3hPrFy56ssirah+VU= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM6PR11MB3468.namprd11.prod.outlook.com (2603:10b6:5:5c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.17; Thu, 4 Nov 2021 13:19:31 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::2c0c:5383:f814:3b4e]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::2c0c:5383:f814:3b4e%6]) with mapi id 15.20.4669.011; Thu, 4 Nov 2021 13:19:31 +0000 From: "Ananyev, Konstantin" To: Usama Nadeem , "thomas@monjalon.net" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4] examples/l3fwd: ipv4 and udp/tcp cksum verification through software Thread-Index: AQHXwSuNZ8bTY2OIO0KSTrUxGzi0iKvzbcxQ Date: Thu, 4 Nov 2021 13:19:31 +0000 Message-ID: References: <20211008155111.125786-1-usama.nadeem@emumba.com> <20211014184322.5148-1-usama.nadeem@emumba.com> In-Reply-To: <20211014184322.5148-1-usama.nadeem@emumba.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: emumba.com; dkim=none (message not signed) header.d=none;emumba.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2c559a1e-ff9d-4c1e-e4d4-08d99f95bcd1 x-ms-traffictypediagnostic: DM6PR11MB3468: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eDBTPZ5KrnnOTdgEw+oeyXVYe1OuS5xSOLZMHXZMMLDhDvBIKCeZCW0oPNKfNWjQ3t7VsTxj4jKvmI0WPbkyVNfohd5ml62p5CzZbY6wMQilWsscTr10DFdCtZDVG/w6mN1rvMWm3sZHTK1VkJLZecdv2REOg517dBk09O0rXSEbN1N8M+ICo32sDhJlCtCGjN9cpHmoHBvvGqcnEyrvxiCezZlJK2SuRSfhU0J+wjwFV0dW0vsGf68Q5p61NJAHIa9FPWG284DAuMkR4SbDN8inWRtPyMTqRzNyhG5XfZ82EAeAKnzLh/NMJaHvRJWrl0T8xZDFiBZL1J0963tx7hPrZm944x8DhNk1SAiQuRJce1dzumrKi+Cczys/pe8kyqQYOQSyy8rUlQI9rdD3NtwyItsxbrrdGMKpirWUv2GKhg4lM52UUpZ/K9k7333svcMLm7EAMrApI3oVI526KkcepOTjPbe62rj+zu2xnndJo6cWkxSk6TRGapYUeA14reJs2p/pbAPFqWcV1oTGT6BzOouOJ43KFwB2m3otYvebW6WIiHbLJWsdZbZRejSpSXmB+cq1WjBWztIS+mLFsFlaYrHm6mHddu3UWCRu3G0kOGlpCUsndUbwHa5TbgfTi1J1tqc4Fb3NcIWxJJPrKEAT7bEbZa6McjhpU+h/3ojZvgOo7c4QQLaYK6CJJgq0IuCadd9VojiOll3SCL6ntQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(38070700005)(6506007)(8676002)(26005)(7696005)(86362001)(71200400001)(83380400001)(186003)(82960400001)(38100700002)(122000001)(5660300002)(55236004)(508600001)(52536014)(9686003)(66476007)(316002)(64756008)(66556008)(76116006)(66946007)(66446008)(110136005)(33656002)(8936002)(2906002)(55016002)(4326008)(15650500001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?5hVRIDPJw1wK2bYp11dkHC6bbiGAMzLOEROP2DhQDYECADrMY7dLZPwKc3uF?= =?us-ascii?Q?Prdet9tdAJ28KNPtE3/eA0oypaMtmtzg/1d8zf+2WaPlmJMHlzZ8BBd/GTCl?= =?us-ascii?Q?w+0aoH32Rsn2QQoiph9oe8C1Zhug4SMgDZqI/9tcfqqQYfMAKVhaJ8msSb7U?= =?us-ascii?Q?2Mo9NMVzg8m3qJsfy2QO6TuQ8ylgy47vFUGVWHbVny+NeL1pwqnnxaDKzJAr?= =?us-ascii?Q?JFHgrE3EthCQkZ9aWv6fbPnjUAFDVb5+mdieL6ydXfghyDjupbrHHOxDOTVs?= =?us-ascii?Q?irPCzzKHdq13u6yynMyUQRAl9t3UgkpwoRzAYJJmPtwBUrvv+x4xuyGD9Vko?= =?us-ascii?Q?nKlKfifk7a06k1yFYcuU63sSvwo6G8EnQ+gMPudv+xDq5HfRbA0047Ss7eUa?= =?us-ascii?Q?Hew3ni6Yi6S4g03ogrbAFbS2nPKaNNk8SxTJCQBKJHiOOFYuvpuHHRPxsBzr?= =?us-ascii?Q?SYxTYdIhBN0M7zyCqRBajgSdOtqVuTQQ2/PkemPW8Sy8yt5bnqQuFe5z7p0U?= =?us-ascii?Q?UrqwC6D2b+fnSbMQ2XtY7zAdgxX1iXvNOfv8Of8O3AoYUUFCpbZ8g28JkC8E?= =?us-ascii?Q?vIHzfOlU1Bzs1fUyen7dlugE/9ObXWCyzlNY8KWiUFdTKtDarBJ3vnS6Vcat?= =?us-ascii?Q?mTJdbLlaoRSZ8t6MlsfQ1y5fLM9Gvl64jd0JfgnVky5kqhqT5V8r5/lS1MLS?= =?us-ascii?Q?EWtBO3hN+YyqLgQuHvGRDW39OLqSXwZzn4lppNn0gexMR6hVUHFoEOnHDw9+?= =?us-ascii?Q?3KgD8OwwRBbz/UM9x1r4Bqw8Gw6T+muCrtZZ0L/ShgLo21BcCGxyvblQ/NMh?= =?us-ascii?Q?40kkcIB7DEFAJSIjod6U+A4j3wuxQZ60K5cWWOEv8YZy1Dsi9fMWjAq9WZFi?= =?us-ascii?Q?7Uxg4mLWJDEpi1x+Qg8qfEIH/kDQLW/sSEMwJtWkEloQWWn7OXAy+9lJCywk?= =?us-ascii?Q?IHoqROs3VXVAGUxhZn+i41gFunNU0p+5IGUO7Udj5YBKt1+jO7h5z96yDacC?= =?us-ascii?Q?H8E0kBiyxW03+dpvNiMxnoBP1FqYe58X3WMGCzOH4ywILbXeTkEDVzYvOxEv?= =?us-ascii?Q?bhXaq5fbK1itsEz8RFOmXeoyTiBllO128yt1cnpfkxzOwQbKCPHKTAMf8Cj7?= =?us-ascii?Q?mhwXaY3ZUDW10Hk22tY2pxlr2ij8H5v1U3rn2YK3BCsPdr1btTN7GIcaksIY?= =?us-ascii?Q?ew+i04gexpRENfc/ZziVZRNWyVcel9lMwNOn895l82ZypXCWd2+7hfIVCjYQ?= =?us-ascii?Q?SFzVTHFL7V5w9XsEGWKFt+X5SK1aI7NT5gVzIJj214SuvDFg9yZDWm2lSR69?= =?us-ascii?Q?lenVCA2DdiAm7dzwdMmxwBFllQxMYzEuIWZnnJZA3FvyKMwh33XcpzszSdK2?= =?us-ascii?Q?nx/qLCHVk/KVT06y5x8/xiR3fWWtiIEi9lurg5Z7QvWw/fnH9VTPGpbF+6uY?= =?us-ascii?Q?8n+kILUC5bsR1Va6eksBzZT1+6LMoc1IYG7tmhZI09m70wXyEU431etDHp1A?= =?us-ascii?Q?7sHH2zjWAjtTZtK6ZQixSxirD1gMlgKo2Xe+YjI4ov3CYMTrN6VdJTO9wFDd?= =?us-ascii?Q?ANFkmMRF3saPX9c/6N6HUc0pjmBvHpjkbR+BnDeG8IRN/RWYsPS4E5IXIlT2?= =?us-ascii?Q?ak3ef1orwhRkBy3WehauP4R8Yp+IhzVgrjJ8/98tlOkj8vepthB9n0N3r3AR?= =?us-ascii?Q?qXuuhQ=3D=3D?= 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: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c559a1e-ff9d-4c1e-e4d4-08d99f95bcd1 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Nov 2021 13:19:31.5861 (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: z4nY+8+YtPqUUFegn1SzVecGY+e6G2Qz4M8ig2nuUCSoOe52c+Gfzj3xZhn76C8//2vRWrmg3AQ+Z5BvBOQtkyFRDvt7oX/ZDcuxPZ7VktQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3468 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v4] examples/l3fwd: ipv4 and udp/tcp cksum verification through software 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" > checks if ipv4 and udptcp cksum offload capability available > If not available, cksum is verified through software > If cksum is corrupt, packet is dropped, rest of the packets > are forwarded back. >From what I see right now l3fwd: a) enables HW RX cksum offload=20 b) simply ignores HW provided cksum status=20 Which came as a real surprise to me.=20 Feel free to correct me if I missed something obvious here. So, I think first we need to add missing check first, even though it might cause some perf drop.=20 Then make changes to actually check provided by HW status and when HW doesn't provide such offload do check in SW. Another alternative would be to remove request for HW offloads and document l3fwd that it doesn't check checksums at all, but I don't think it is a good way. > Bugzilla ID:545 > Signed-off-by: Usama Nadeem > --- > examples/l3fwd/l3fwd.h | 6 ++++ > examples/l3fwd/l3fwd_lpm.c | 72 ++++++++++++++++++++++++++++++++++++-- > examples/l3fwd/main.c | 33 +++++++++++++++-- > 3 files changed, 105 insertions(+), 6 deletions(-) >=20 > diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h > index a808d60247..c2c21a91fb 100644 > --- a/examples/l3fwd/l3fwd.h > +++ b/examples/l3fwd/l3fwd.h > @@ -55,6 +55,8 @@ > #define L3FWD_HASH_ENTRIES (1024*1024*1) > #endif > #define HASH_ENTRY_NUMBER_DEFAULT 4 > +extern bool l3_sft_cksum; > +extern bool l4_sft_cksum; About the approach itself. We have similar issue for HW PTYPE recognition - some HW doesn't support it= . So we check HW capabilities and if required we setup SW RX callbacks to do determine PTYPE in SW. Note that for EM/LPM we have different callbacks. I think for cksum checks we can do the same: check HW capabilities, if they are missing add a new callback that would calculate/check cksum and set RTE_MBUF_F_RX_*_CKSUM_* flags. That way it will HW/SW cksum will be transparent for the rest of l3fwd code= . =20 About cksums required: for LPM/FIB mode just IPv4 cksum seems enough. For EM we probably need L4 cksum too, though not sure is it really needed. Wonder what other people think here?=20 > struct mbuf_table { > uint16_t len; > @@ -210,6 +212,10 @@ em_main_loop(__rte_unused void *dummy); > int > lpm_main_loop(__rte_unused void *dummy); >=20 > +int > +check_software_cksum(struct rte_mbuf **pkts_burst, > +struct rte_mbuf **pkts_burst_to_send, int nb_rx); > + > int > fib_main_loop(__rte_unused void *dummy); >=20 > diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c > index 232b606b54..ecaf323943 100644 > --- a/examples/l3fwd/l3fwd_lpm.c > +++ b/examples/l3fwd/l3fwd_lpm.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include >=20 > #include "l3fwd.h" > #include "l3fwd_event.h" > @@ -139,16 +140,65 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf = *qconf, struct rte_mbuf *pkt, > #include "l3fwd_lpm.h" > #endif >=20 > + > +int check_software_cksum(struct rte_mbuf **pkts_burst, > +struct rte_mbuf **pkts_burst_to_send, int nb_rx) > +{ > + int j; > + int i =3D 0; > + struct rte_net_hdr_lens hdr_lens; > + struct rte_ipv4_hdr *ipv4_hdr; > + void *l3_hdr; > + void *l4_hdr; > + rte_be16_t prev_cksum; > + int dropped_pkts_udp_tcp =3D 0; > + int dropped_pkts_ipv4 =3D 0; > + bool dropped; > + for (j =3D 0; j < nb_rx; j++) { > + dropped =3D false; > + rte_net_get_ptype(pkts_burst[j], &hdr_lens, RTE_PTYPE_ALL_MASK); > + l3_hdr =3D rte_pktmbuf_mtod_offset(pkts_burst[j], > + void *, hdr_lens.l2_len); > + l4_hdr =3D rte_pktmbuf_mtod_offset(pkts_burst[j], > + void *, hdr_lens.l2_len + hdr_lens.l3_len); > + ipv4_hdr =3D l3_hdr; > + prev_cksum =3D ipv4_hdr->hdr_checksum; > + ipv4_hdr->hdr_checksum =3D 0; > + ipv4_hdr->hdr_checksum =3D rte_ipv4_cksum(ipv4_hdr); > + > + if (l3_sft_cksum && prev_cksum !=3D ipv4_hdr->hdr_checksum) { > + rte_pktmbuf_free(pkts_burst[j]); > + dropped_pkts_ipv4++; > + dropped =3D true; > + } else if (l4_sft_cksum && > + rte_ipv4_udptcp_cksum_verify > + (l3_hdr, l4_hdr) !=3D 0) { > + > + rte_pktmbuf_free(pkts_burst[j]); > + dropped_pkts_udp_tcp++; > + dropped =3D true; > + } > + if (dropped =3D=3D false) { > + pkts_burst_to_send[i] =3D pkts_burst[j]; > + i++; > + } > + > + } > + return dropped_pkts_udp_tcp+dropped_pkts_ipv4; > +} > + > /* main processing loop */ > int > lpm_main_loop(__rte_unused void *dummy) > { > struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; > + struct rte_mbuf *pkts_burst_to_send[MAX_PKT_BURST]; > unsigned lcore_id; > uint64_t prev_tsc, diff_tsc, cur_tsc; > int i, nb_rx; > uint16_t portid; > uint8_t queueid; > + int dropped; > struct lcore_conf *qconf; > const uint64_t drain_tsc =3D (rte_get_tsc_hz() + US_PER_S - 1) / > US_PER_S * BURST_TX_DRAIN_US; > @@ -209,19 +259,35 @@ lpm_main_loop(__rte_unused void *dummy) > if (nb_rx =3D=3D 0) > continue; >=20 > + if (l3_sft_cksum || l4_sft_cksum) { > + dropped =3D check_software_cksum(pkts_burst, > + pkts_burst_to_send, nb_rx); > + > + nb_rx =3D nb_rx-dropped; > + } > + > + > #if defined RTE_ARCH_X86 || defined __ARM_NEON \ > || defined RTE_ARCH_PPC_64 > + if (l3_sft_cksum =3D=3D false && l4_sft_cksum =3D=3D false) > l3fwd_lpm_send_packets(nb_rx, pkts_burst, > portid, qconf); > + else > + l3fwd_lpm_send_packets(nb_rx, pkts_burst_to_send, > + portid, qconf); > + > #else > - l3fwd_lpm_no_opt_send_packets(nb_rx, pkts_burst, > + if (l3_sft_cksum =3D=3D false && l4_sft_cksum =3D=3D false) > + l3fwd_lpm_no_opt_send_packets(nb_rx, pkts_burst, > portid, qconf); > + else > + l3fwd_lpm_no_opt_send_packets(nb_rx, > + pkts_burst_to_send, portid, qconf); > + > #endif /* X86 */ > } > - > cur_tsc =3D rte_rdtsc(); > } > - > return 0; > } >=20 > diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c > index 00ac267af1..a54aca070d 100644 > --- a/examples/l3fwd/main.c > +++ b/examples/l3fwd/main.c > @@ -61,6 +61,9 @@ static uint16_t nb_txd =3D RTE_TEST_TX_DESC_DEFAULT; > /**< Ports set in promiscuous mode off by default. */ > static int promiscuous_on; >=20 > +bool l3_sft_cksum; > +bool l4_sft_cksum; > + > /* Select Longest-Prefix, Exact match or Forwarding Information Base. */ > enum L3FWD_LOOKUP_MODE { > L3FWD_LOOKUP_DEFAULT, > @@ -123,7 +126,6 @@ static struct rte_eth_conf port_conf =3D { > .mq_mode =3D ETH_MQ_RX_RSS, > .max_rx_pkt_len =3D RTE_ETHER_MAX_LEN, > .split_hdr_size =3D 0, > - .offloads =3D DEV_RX_OFFLOAD_CHECKSUM, > }, > .rx_adv_conf =3D { > .rss_conf =3D { > @@ -981,6 +983,7 @@ prepare_ptype_parser(uint16_t portid, uint16_t queuei= d) > return 0; > } >=20 > + > static void > l3fwd_poll_resource_setup(void) > { > @@ -993,7 +996,8 @@ l3fwd_poll_resource_setup(void) > unsigned int nb_ports; > unsigned int lcore_id; > int ret; > - > + l3_sft_cksum =3D false; > + l4_sft_cksum =3D false; > if (check_lcore_params() < 0) > rte_exit(EXIT_FAILURE, "check_lcore_params failed\n"); >=20 > @@ -1034,11 +1038,34 @@ l3fwd_poll_resource_setup(void) > rte_exit(EXIT_FAILURE, > "Error during getting device (port %u) info: %s\n", > portid, strerror(-ret)); > - > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) > local_port_conf.txmode.offloads |=3D > DEV_TX_OFFLOAD_MBUF_FAST_FREE; >=20 > + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) > + local_port_conf.rxmode.offloads |=3D > + DEV_RX_OFFLOAD_IPV4_CKSUM; > + else { > + l3_sft_cksum =3D true; > + printf("WARNING: IPV4 checksum offload not available.\n"); > + } > + > + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) > + local_port_conf.rxmode.offloads |=3D > + DEV_RX_OFFLOAD_UDP_CKSUM; > + else { > + l4_sft_cksum =3D true; > + printf("WARNING: UDP checksum offload not available.\n"); > + } > + > + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) > + local_port_conf.rxmode.offloads |=3D > + DEV_RX_OFFLOAD_TCP_CKSUM; > + else { > + l4_sft_cksum =3D true; > + printf("WARNING: TCP checksum offload not available.\n"); > + } > + > local_port_conf.rx_adv_conf.rss_conf.rss_hf &=3D > dev_info.flow_type_rss_offloads; >=20 > -- > 2.25.1