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 6F023A0548; Thu, 4 Nov 2021 12:11:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CBDB41C27; Thu, 4 Nov 2021 12:11:13 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id BA1AA411A4 for ; Thu, 4 Nov 2021 12:11:11 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10157"; a="255322874" X-IronPort-AV: E=Sophos;i="5.87,208,1631602800"; d="scan'208";a="255322874" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2021 04:11:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,208,1631602800"; d="scan'208";a="501504549" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga008.jf.intel.com with ESMTP; 04 Nov 2021 04:11:10 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx605.amr.corp.intel.com (10.18.126.85) 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 04:11:09 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx611.amr.corp.intel.com (10.18.126.91) 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 04:11:09 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx611.amr.corp.intel.com (10.18.126.91) 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 04:11:09 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.175) 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.2242.12; Thu, 4 Nov 2021 04:11:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UXkcSt8FVJC4QMpz3KTV43mpTIRi1+YiCym6sEsqpN7IrJ5L7T4TtvXGQ5VnsSeH0B9MkJOB9eTHZQN9RtGDmOnSvL710Vlt1kr2LhCuHRC5QMxz6lQBklU6fXzAPva+9oFRlTLc4Xyn+8APVHmRdlppim+mzOM4tyCPJwD2cWAUIhBK0PhjzqYDrI0IqBAYhym6Ax0zJH9N72RHaIrrbvxvMNuc+HT9ATjrHNaGWqtf8v/JcdLMdhdoa51fisJ7aEjsPPVBJk8GEFArHsnzbf8xhTTFqlpVvqgVChlaLnrT1sgcB1UkDkcf6d7hxftVoCx+D/l9hKvTCC2dyKCNrw== 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=nt92Oc8hE+GwUD9VShvWMaeNurRvVp2gt/c9xlhAoOc=; b=nnitgjpqNjLXRDcO3ZLdoX6Q31ML8DWwBVmsxZtWkvutGaZHtMhX24JmuS6V3yomyHPEtiHmOBqc9u/UdOOlFr3sjxmtl98wXDbUr1b7dwo2ku1b+M9Zb4L2kC6cRwUaVTJrG3YAcryYN52jroaAFva/K5t9iuhOLGUwcG48Jv54ZYsd9BQhO7Vf1/XDvFwlGWIjvmY0rqO5Swr9CHdV2UW6y/UvB6RHqyzWxqI6/edft3wsfR4ExuEFsnGGQgZJxTPMUefZuYyieZWJfs/caCjE/9n0qIb7qUHwYRhkYBUAx9giwjAwH2l+jJk3vPe0WbPEabwhP7/enu3b4WQxUA== 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=nt92Oc8hE+GwUD9VShvWMaeNurRvVp2gt/c9xlhAoOc=; b=kzf0/xXvmPixuLS9IQzLzWzgXFet1uVIDttGeN6oIJnkOU8BdccsyevJt67mab4U0kFxTsb401Vf3uZv3u5C3Q2NjKPJ+KRlz5SPFxJl0dc9iehQpCXVOLbVR5OdGvC/m1DDAYCcDOYIrqPZ3AOyT5pj0sajiz190ez6bNIPfeQ= Received: from PH0PR11MB5207.namprd11.prod.outlook.com (2603:10b6:510:32::15) by PH0PR11MB4902.namprd11.prod.outlook.com (2603:10b6:510:37::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Thu, 4 Nov 2021 11:11:03 +0000 Received: from PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::f076:f51c:9101:b0ff]) by PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::f076:f51c:9101:b0ff%8]) with mapi id 15.20.4669.013; Thu, 4 Nov 2021 11:11:03 +0000 From: "Walsh, Conor" To: Usama Nadeem , "thomas@monjalon.net" CC: "dev@dpdk.org" , "Medvedkin, Vladimir" Thread-Topic: [dpdk-dev] [PATCH v4] examples/l3fwd: ipv4 and udp/tcp cksum verification through software Thread-Index: AQHXwSuNzV6EFRAim0Crw7X3zbV7oavzULyg Date: Thu, 4 Nov 2021 11:11:02 +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-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows 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: 3c89a855-4ee8-4ee9-b4dc-08d99f83ca20 x-ms-traffictypediagnostic: PH0PR11MB4902: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: SheSx8C4rEetTen5dPDQFgQGMbZfzeLF6Sy6A/wgkCtBJ12PKCGfZk3QR61BYJ5RQk1+PzY5ClixC5gnxyXpWhq73zT/uYMIN30/avN0gHA78eBWWjRx3lgQW6SY1KdzaN7UFPLSgeNVmkRfCQkWtFMa+zd6dn+3hbhJmGV+4KzYwLvHfBmsu3MQ+hPgMbptRUmQkbvIAZuU0756ZCec6BNgZUS+okovc8RMnFj7ZLQWVxDeRysVAh6aNFfipSNZJXQdLGtrDcuiAW0V9gnJKHt5n7RDWn83zLpI9NaU3h8lRwLWFjyUsOykquRBwgHXXRla1ykyBfXOxrAH8nNR+QhruePwFpLPCA3L60lSYq9P3GdHO6z2dmRgi6Zwd+RoSzaSAA8luke+Hfjg6IS1TRh01Cubu/xMy79MwxSRXZDt/zRn7OGe5seM7x6uorub7Mi1ZZCva3xixS/YJQ5ryCeXLwwY5frqPcy6uEZbMuDC8x+IFJQMswgMWbtlt//NFbkztTMEV1yhZozS5hXpppKGAgscVHp+vG0P5jFGpsgll791/OKBRbEbDfe2hhiHQvAWodeVbdxd9fEHNwq/qicLdfCHEW6zMPvf4IkAmuFAr4MFZkPvuQ9iF4NqAYhcXL119LJWVtSoFtt1cIVneofQeffpk7qTYmwaQAocYcWiozZan0WcAu2RzNcb7VTUonetibkcYE8B9el1YweErg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5207.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(71200400001)(66946007)(9686003)(15650500001)(508600001)(38070700005)(122000001)(7696005)(38100700002)(86362001)(8936002)(66476007)(6506007)(53546011)(26005)(55016002)(8676002)(66556008)(82960400001)(52536014)(83380400001)(76116006)(33656002)(186003)(66446008)(2906002)(110136005)(54906003)(107886003)(4326008)(316002)(5660300002)(64756008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?zWHt1gfzuRoarXmqT8rjMPmiLAoQrMBOpRbhPQcOKOA5A+fX6yeXzJule/24?= =?us-ascii?Q?s4r2Zpp1lxJN3XwwIHm7kj4Ftd0NYWxBz/Jt4M+J9l9TqpkUWLMMd/fEqFUe?= =?us-ascii?Q?riWPlh2QXuVCF3Gl3dVMWK86Y/GRSaaioiSprIj9SF3wcbyQkLSNgKv458cB?= =?us-ascii?Q?zfFciBpNK4XvpWar5dOo85QBbPx+QyEwbPACM9cwiuEVpMULFE9kHYw8HTCb?= =?us-ascii?Q?V0dsUdMu54JZA5GmE6BbYUY8TNMjNExy4ZDYJFyZZ7yx4xorZ+StjgWJoP6k?= =?us-ascii?Q?hFdQiTVZCiyeCWveH7cCufYrGOcGNPV7QWY4GK69RGK3fg1TsOW9djs95E1t?= =?us-ascii?Q?mu1GvBVbnYVCeDcYxEQ4DeULRHncu37xePc32sIPpyHhTukEr1tHFWKIL1Mu?= =?us-ascii?Q?31FW08Ia1CmXdkHTmu1zhG8dKr9lZA1gqDFaGHhWjgDw6DlRfaM7D0oWjC7b?= =?us-ascii?Q?yheqI96pkSbtiQAbbUlFnrd9GqMqlU/qLKd56y+uvNteQhlSockImLNey/EC?= =?us-ascii?Q?lIl3DyHBqGADvbEjIywxT6LMGQeT7tGTLspMEA7Dp6JVo42EoIC9eCXKaA5A?= =?us-ascii?Q?2fcSuLZP+26iY3BnWnBxaIuHe5i3Va1peGprTEfx4ZfKaG6OlfO+McdyuoY3?= =?us-ascii?Q?CaMMwH5u+OKtM13vaLswm0h5CCEW71NTbsZ7Guh71qSA3DyZeITBGmsJgbjr?= =?us-ascii?Q?XIO96rVWYgLVaT1LlAyQStwxwzeLAQNt9UT1IT1afTIgE36ITRSc5sEcSjy0?= =?us-ascii?Q?x2KDm1qYU1PzIMR2vJSH6mpr8NGLPOMtVIQPGJazUXQPR4kKfmc4go7Dauil?= =?us-ascii?Q?U8ds4NtUPPmKglKteBF2lEXFv5j1YpyCk6QxRemAnjKKIsiHpp9EGNDVywHK?= =?us-ascii?Q?pAgq+/MOYjnCkNBEf66H4SRwUvDD0ok/oVoT/3rOsEvS9llU5w8xfw0/zwjq?= =?us-ascii?Q?IFYiipTTr76zL8e7wgg5LVotzl7iNILa1uInNkB7cMb+9WLHaWe52AnQGljG?= =?us-ascii?Q?hX0uYFC1I1IxkQkwsjBml1sQwRTaapUmfQBCA+6rGueTNAQhal25MGyTOtyZ?= =?us-ascii?Q?HuOGwvDDW4kyCxnaZgB14Ovgs2EyZp4SaJLHrKsWKRbqig6wPjlRnuWPVoMD?= =?us-ascii?Q?lNTqUY3tSkmyKWdZ5bqBQNLIwmstMZuM3cMo0NnUmeFGzx4DFj5PAXInVo5c?= =?us-ascii?Q?4Z3aPLXHRzip6WZi2QaCmnsO5z0dsR+41E4DZ5MEfGLzMARQB5Bj/7Q7h+aj?= =?us-ascii?Q?5WzhB7twl/j42VBuopE7mMfikQeAgsnC8v3J1hzl1XzkBPNnQgUWKMeO/sbE?= =?us-ascii?Q?URlL9dye5h1Sz2aGTSiIJwbCBoLj6g1ynm9hXHVWZr6yHheivGc19nfNOHUx?= =?us-ascii?Q?oxMzN7IKKfgM3y7uu07ZxWQPTqZuBCRiMXTj21kCvAdH63OQtDa34pSDTGNo?= =?us-ascii?Q?OTqWPNIbHXOVVsefO2WCQ+EASzRE4i/oRLsc8hop1CjnGdMaWDLS6P3TU9Lm?= =?us-ascii?Q?59cF6gU3XV0wWsXd1bUKOSJ2s8wgoFlCVhNQsHWizFp27y8bw5Jerjc8CIy9?= =?us-ascii?Q?Z/UxGog1K5tmYOT9s9XPB6REikN4KLP2ydLj/PEeR4j1Tku8xLlV4WcUVR1y?= =?us-ascii?Q?vx1Tmh5/fuChCp1GfCVPExo=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: PH0PR11MB5207.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c89a855-4ee8-4ee9-b4dc-08d99f83ca20 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Nov 2021 11:11:02.8935 (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: muiAAKydkZoblVNse9IQHDVm9YUWf92NYVMwzJ8820yY/T1IbPyt2izUjF7y9Clm8BmCoLPk7aNsgHOJt0vc2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4902 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" > From: dev On Behalf Of Usama Nadeem > Sent: Thursday 14 October 2021 19:43 > To: thomas@monjalon.net > Cc: dev@dpdk.org; Usama Nadeem > Subject: [dpdk-dev] [PATCH v4] examples/l3fwd: ipv4 and udp/tcp cksum > verification through software >=20 > 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. >=20 > Bugzilla ID:545 > Signed-off-by: Usama Nadeem > --- Hi Usama, This should be done in a generic way that allows all the lookup methods to = support it not just LPM. check_software_cksum should go in a common file and be called from LPM, FIB= and possibly EM. Thanks, Conor. > 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; >=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 > queueid) > 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