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 75A80A0C41; Fri, 16 Apr 2021 09:43:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D789F141A62; Fri, 16 Apr 2021 09:43:34 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2040.outbound.protection.outlook.com [40.107.220.40]) by mails.dpdk.org (Postfix) with ESMTP id B1D16141A61 for ; Fri, 16 Apr 2021 09:43:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UxtqVe8mbLhggpHF3cQqKbFZULGojBjoDg2LjNvPzIE09Z+tL0iDVCNz6p5C/PNDLOTWavoR/cAzIzJy2958GFfCpLjogtVo/3R3HaS4bgqlskP7QPIK5chSoCP798ShTod1GvOCoqYV2mzmGT5anZOa2fal77gcHpGDqK3Iwo1rVBuwkt1+fOUGVSu8ep8rMBB33S1A9ibfBbkFcPCOYx+Ru395Fh4o3wumCOa/ZLLrYwnzTnxE0BNB4HacswyvughTnndjXmci4VzZtgC4YqUbKKj1kWPS3VSqsZir+rjp5TB8pU0DBVerV9qNcuOGgjml+MO+QuoeWto1YazPBQ== 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=Y98gMDxkCWhcmBTOVVC/jOmME3VGUrnKaS1aAA8wrBI=; b=eyp0c+I5Bqy/S/tkjIx2humz6w1dEyhMKWpfSVTYoTlNMI+K4FMDB3bVwtOmQJ8x28R1SnqDBJy/ny1GpE2d4FU0yqXOj4S9HsitGi/TomHD/1mQMM4gUaWb+QWTieJk5JoD5YsbckxjwWQPlPNWBQj8X25XLU9P+nVA3K6clD4c86J1mSPzGmJVmmVUEIjQ+9LofzZ3obSsEJD3DA0Tb7mU8vKl/mx/0+CnGCzjLZWF5ETy4mDwNoidtJak2PrS5/OZP9bTCCltWiA54HaclU5r0dCYF8JEhviHxmiW8rNELb2uyhV062Nmu/cf3/D/DPfY6ZjFSXETTY0LlBgPoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y98gMDxkCWhcmBTOVVC/jOmME3VGUrnKaS1aAA8wrBI=; b=NB6hwjpo9Ff1IBSXusAL6HzO+IGA+6uyOg4P9Cv+pOmnLIkF1+jIxByxaKxFpoiifBSeTPMsGk4vZvy8UJQ9CNskhrrQf0KXtx2WO5/tfXRGqib4kk1do8aI59VsfiJ4m7Vxrj+mVrm7B/mRt8N41RUoufxvXqja3UO65OBzMDhlDBfT8EeXIYWzJm8lhUkfEByr+Q0zQJyIgzGDjYe5kPyHphM2QoK0wpPSmhuZTrDo0Q3TAL34OVzjYaxBGtUlII1m5QarxOKRzTfvI5XWtaksFSAztEdlxYxEESSVvKPK6N/Qz4NwAOnOtS1H3qwab2BJdXF5GBVwkCqCecgEnA== Received: from DM6PR12MB4987.namprd12.prod.outlook.com (2603:10b6:5:163::31) by DM6PR12MB4075.namprd12.prod.outlook.com (2603:10b6:5:21d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.19; Fri, 16 Apr 2021 07:43:31 +0000 Received: from DM6PR12MB4987.namprd12.prod.outlook.com ([fe80::f5ce:c5a8:6aec:e308]) by DM6PR12MB4987.namprd12.prod.outlook.com ([fe80::f5ce:c5a8:6aec:e308%7]) with mapi id 15.20.4020.022; Fri, 16 Apr 2021 07:43:31 +0000 From: Ori Kam To: NBU-Contact-Thomas Monjalon , Gregory Etelson CC: "dev@dpdk.org" , "ajit.khaparde@broadcom.com" , "andrew.rybchenko@oktetlabs.ru" , "dev@dpdk.org" , "ferruh.yigit@intel.com" , "jerinj@marvell.com" , "jerinjacobk@gmail.com" , "olivier.matz@6wind.com" , Slava Ovsiienko , Matan Azrad , Raslan Darawsheh Thread-Topic: [dpdk-dev] [PATCH v5 1/2] ethdev: add packet integrity checks Thread-Index: AQHXMUimdFjG5b8htUu0nL9RLkkYr6q1yy2AgAD3BUA= Date: Fri, 16 Apr 2021 07:43:31 +0000 Message-ID: References: <20210414160930.14928-1-getelson@nvidia.com> <20210414160930.14928-2-getelson@nvidia.com> <4965931.SumkqlMz0V@thomas> In-Reply-To: <4965931.SumkqlMz0V@thomas> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [147.236.145.126] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7f7d78b6-12b9-414f-52c5-08d900ab5531 x-ms-traffictypediagnostic: DM6PR12MB4075: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UPTG30qScJj3Yx+K8DBSgmjkjUuMC4RZvzBKNLadyJX953dIJeY3iDA07mr/L3oueDVB9osfoE4L/HFYcg2iaklw41JyQOvkKB3yPQ41ABK0mb7fFH0SkYaJuNQcA0CGwxcwYhfTYcUpoLI4jny/IU6MdYcJbFnyyM+x/ZDdtMS5cTAqydjk6ZsdwaxyKkUGdCpJnpVTEnH7CdFuRJfLeXeJFnEmfaEsTJABzeTAXqlpeRXzvZbg6BTbkkhuEqj2tMcGfb19o/PH7zTx9u2iEJkFyqVk5zg3m/3WQyXCcqaIxyVe+X0ANE3nWn2mP999seI6OxYLzajT8xi3G5Dx/88esN62R4SzFV3HXt/5Vi7SE80yrSEzx2lS21GfFV8Qb2z2nveGFpkyTR3jZ4gdSKmGzUX7ctq5UTTzELBOi1s9Bg/fFVvkOi0mErdsFz1Ne6L69q7i+j2Mnyd+kA7u7syzl7hEDjsiAwnXa8E2nWayxhx02VoodRTsHNjMJxru2nk9MxLDd0wwrr42kyhbZHaoNtTBrRXpabA//0YwdxeZix0A6mQfouM2nGgbFcz+LFntfxZYed8uzQ/qHJDn91KAi7DHHfvuosMep0+/vMQ= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB4987.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(39860400002)(136003)(366004)(396003)(346002)(5660300002)(2906002)(83380400001)(26005)(9686003)(6636002)(55016002)(316002)(8676002)(478600001)(52536014)(122000001)(53546011)(186003)(38100700002)(66946007)(64756008)(66476007)(71200400001)(110136005)(33656002)(8936002)(76116006)(6506007)(66556008)(107886003)(7696005)(86362001)(66446008)(54906003)(4326008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?+ipVc+Ai0B3v7CQs2p0LHk2XIgbHuZptvrIAFjY77qiPKqmZZ2YOHINAma5b?= =?us-ascii?Q?T0EO5LdAOixBz/pEoSdOhF7GtauRNmKDHTW5Ns2rNH1rM/hC0bQDQDjSIc16?= =?us-ascii?Q?KcbTY2LomlfPFBJzOm9QDmY0e61HuhW4zWyuv+QmVL5tRFABUXyYhsYIu0/i?= =?us-ascii?Q?KkI0GoEjK6GzeiFFJd6mjRozZ0cFG5RFUlbyRp7yBsm9Q5Sj5HhvaPdQ85Gz?= =?us-ascii?Q?Zz9v+GNwylTgDk8eUQNuhZklol62KfoV6NBV8DiQNtPT9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ascii?Q?yBqhvvod4yGKUYWsFKg+zckmEKsHEWS+yf9w9bhJMweqkF6pRkMXxNG2hGCy?= =?us-ascii?Q?lxBPOrRkF0O5OZG9CbIelfEceidNHNvWsxJun11KZctrjA5dE66oHe8IXmRr?= =?us-ascii?Q?wyGGx6rCPV4TZflW1/rZzQB457ocjecoQKoQ7BkdfuvisRoyZg1mAOd9XKl6?= =?us-ascii?Q?eXbjYNjU7m+9ZkxfXT0NVqFO?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4987.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f7d78b6-12b9-414f-52c5-08d900ab5531 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Apr 2021 07:43:31.7399 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: uiPcxHaXkTiQAT5LsWr49F2X8y5SuYUtVK5QY8YwSsAAIVXYdOy0+c9PQ/dyKl1lagxUIMz40s8E3MFLonUm8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4075 Subject: Re: [dpdk-dev] [PATCH v5 1/2] ethdev: add packet integrity checks 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" Hi Thomas, > -----Original Message----- > From: Thomas Monjalon > Sent: Thursday, April 15, 2021 7:46 PM > Subject: Re: [dpdk-dev] [PATCH v5 1/2] ethdev: add packet integrity check= s >=20 > 14/04/2021 18:09, Gregory Etelson: > > From: Ori Kam > > > > Currently, DPDK application can offload the checksum check, > > and report it in the mbuf. > > > > However, as more and more applications are offloading some or all > > logic and action to the HW, there is a need to check the packet > > integrity so the right decision can be taken. > > > > The application logic can be positive meaning if the packet is > > valid jump / do actions, or negative if packet is not valid > > jump to SW / do actions (like drop) a, and add default flow >=20 > There is a typo here. What should it be? >=20 Simply remove the a. > > (match all in low priority) that will direct the miss packet > > to the miss path. > > > > Since currently rte_flow works in positive way the assumption is > > that the positive way will be the common way in this case also. > > > > When thinking what is the best API to implement such feature, > > we need to considure the following (in no specific order): >=20 > s/considure/consider/ >=20 Will fix. > > 1. API breakage. > > 2. Simplicity. > > 3. Performance. > > 4. HW capabilities. > > 5. rte_flow limitation. > > 6. Flexibility. > > > > First option: Add integrity flags to each of the items. > > For example add checksum_ok to ipv4 item. > > > > Pros: > > 1. No new rte_flow item. > > 2. Simple in the way that on each item the app can see > > what checks are available. > > > > Cons: > > 1. API breakage. > > 2. increase number of flows, since app can't add global rule and > > must have dedicated flow for each of the flow combinations, for exam= ple > > matching on icmp traffic or UDP/TCP traffic with IPv4 / IPv6 will > > result in 5 flows. > > > > Second option: dedicated item > > > > Pros: > > 1. No API breakage, and there will be no for some time due to having > > extra space. (by using bits) > > 2. Just one flow to support the icmp or UDP/TCP traffic with IPv4 / > > IPv6. > > 3. Simplicity application can just look at one place to see all possibl= e > > checks. > > 4. Allow future support for more tests. > > > > Cons: > > 1. New item, that holds number of fields from different items. > > > > For starter the following bits are suggested: > > 1. packet_ok - means that all HW checks depending on packet layer have > > passed. This may mean that in some HW such flow should be splited to > > number of flows or fail. > > 2. l2_ok - all check for layer 2 have passed. > > 3. l3_ok - all check for layer 3 have passed. If packet doesn't have > > l3 layer this check should fail. > > 4. l4_ok - all check for layer 4 have passed. If packet doesn't > > have l4 layer this check should fail. > > 5. l2_crc_ok - the layer 2 crc is O.K. > > 6. ipv4_csum_ok - IPv4 checksum is O.K. it is possible that the > > IPv4 checksum will be O.K. but the l3_ok will be 0. it is not > > possible that checksum will be 0 and the l3_ok will be 1. > > 7. l4_csum_ok - layer 4 checksum is O.K. > > 8. l3_len_OK - check that the reported layer 3 len is smaller than the > > frame len. > > > > Example of usage: > > 1. check packets from all possible layers for integrity. > > flow create integrity spec packet_ok =3D 1 mask packet_ok =3D 1 ....= . > > > > 2. Check only packet with layer 4 (UDP / TCP) > > flow create integrity spec l3_ok =3D 1, l4_ok =3D 1 mask l3_ok =3D 1= l4_ok =3D 1 > > > > Signed-off-by: Ori Kam > > --- > > doc/guides/prog_guide/rte_flow.rst | 20 +++++++++++ > > doc/guides/rel_notes/release_21_05.rst | 5 +++ > > lib/librte_ethdev/rte_flow.h | 49 ++++++++++++++++++++++++++ > > 3 files changed, 74 insertions(+) > > > > diff --git a/doc/guides/prog_guide/rte_flow.rst > b/doc/guides/prog_guide/rte_flow.rst > > index e1b93ecedf..1dd2301a07 100644 > > --- a/doc/guides/prog_guide/rte_flow.rst > > +++ b/doc/guides/prog_guide/rte_flow.rst > > @@ -1398,6 +1398,26 @@ Matches a eCPRI header. > > - ``hdr``: eCPRI header definition (``rte_ecpri.h``). > > - Default ``mask`` matches nothing, for all eCPRI messages. > > > > +Item: ``PACKET_INTEGRITY_CHECKS`` > > +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > + > > +Matches packet integrity. > > +For some devices application needs to enable integration checks in HW > > +before using this item. > > + > > +- ``level``: the encapsulation level that should be checked. level 0 m= eans the > > + default PMD mode (Can be inner most / outermost). value of 1 means > outermost > > + and higher value means inner header. See also RSS level. > > +- ``packet_ok``: All HW packet integrity checks have passed based on t= he > max > > + layer of the packet. > > +- ``l2_ok``: all layer 2 HW integrity checks passed. > > +- ``l3_ok``: all layer 3 HW integrity checks passed. > > +- ``l4_ok``: all layer 4 HW integrity checks passed. > > +- ``l2_crc_ok``: layer 2 crc check passed. > > +- ``ipv4_csum_ok``: ipv4 checksum check passed. > > +- ``l4_csum_ok``: layer 4 checksum check passed. > > +- ``l3_len_ok``: the layer 3 len is smaller than the frame len. > > + > > Actions > > ~~~~~~~ > > > > diff --git a/doc/guides/rel_notes/release_21_05.rst > b/doc/guides/rel_notes/release_21_05.rst > > index a0b907994a..986f749384 100644 > > --- a/doc/guides/rel_notes/release_21_05.rst > > +++ b/doc/guides/rel_notes/release_21_05.rst > > @@ -168,6 +168,11 @@ New Features > > the events across multiple stages. > > * This also reduced the scheduling overhead on a event device. > > > > +* **Added packet integrity match to RTE flow rules.** >=20 > Please remove "RTE", it has no meaning. All in DPDK is "RTE". >=20 Sure. > > + > > + * Added ``PACKET_INTEGRITY_CHECKS`` flow item. >=20 > It is RTE_FLOW_ITEM_TYPE_INTEGRITY >=20 > > + * Added ``rte_flow_item_integrity`` data structure. > > + >=20 > This text should be sorted before drivers. >=20 Sure. > > --- a/lib/librte_ethdev/rte_flow.h > > +++ b/lib/librte_ethdev/rte_flow.h > > @@ -551,6 +551,17 @@ enum rte_flow_item_type { > > * See struct rte_flow_item_geneve_opt > > */ > > RTE_FLOW_ITEM_TYPE_GENEVE_OPT, > > + > > + /** > > + * [META] > > + * > > + * Matches on packet integrity. > > + * For some devices application needs to enable integration checks in > HW > > + * before using this item. >=20 > That's a bit fuzzy. > Do you mean some driver-specific API may be required? >=20 I know it is a bit fuzzy but it is really HW dependent, for example in case of some drivers there is nothing to be done. In other cases the application may need to enable the RX checksum offload, other drivers may need this cap be enabled by HW configuration. > > + * > > + * See struct rte_flow_item_integrity. > > + */ > > + RTE_FLOW_ITEM_TYPE_INTEGRITY, > > }; >=20 > > +__extension__ >=20 > Why extension here? > If this is because of the anonymous union, > it should be RTE_STD_C11 before the union. > Same for the struct. >=20 O.K > > +struct rte_flow_item_integrity { > > + uint32_t level; > > + /**< Packet encapsulation level the item should apply to. > > + * @see rte_flow_action_rss > > + */ >=20 > Please insert comments before the struct member. >=20 O.K. > Instead of "Packet encapsulation", isn't it better understood as > "Tunnel encapsulation"? Not sure, please advise. >=20 I have no strong feeling ether way, so I don't mind the change if you think= it=20 is clearer. > > + union { > > + struct { > > + uint64_t packet_ok:1; > > + /** The packet is valid after passing all HW checks. */ >=20 > The doxygen syntax is missing < but it will be fine when moved before. >=20 Sure. > > + uint64_t l2_ok:1; > > + /**< L2 layer is valid after passing all HW checks. */ > > + uint64_t l3_ok:1; > > + /**< L3 layer is valid after passing all HW checks. */ > > + uint64_t l4_ok:1; > > + /**< L4 layer is valid after passing all HW checks. */ > > + uint64_t l2_crc_ok:1; > > + /**< L2 layer crc is valid. */ >=20 > s/crc/CRC/ >=20 O.K. > > + uint64_t ipv4_csum_ok:1; > > + /**< IPv4 layer checksum is valid. */ > > + uint64_t l4_csum_ok:1; > > + /**< L4 layer checksum is valid. */ > > + uint64_t l3_len_ok:1; > > + /**< The l3 len is smaller than the frame len. */ >=20 > s/len/length/g >=20 O.K. > > + uint64_t reserved:56; > > + }; > > + uint64_t value; >=20 > double space >=20 Sure. > > + }; > > +}; > > + > > +#ifndef __cplusplus > > +static const struct rte_flow_item_integrity > > +rte_flow_item_integrity_mask =3D { > > + .level =3D 0, > > + .value =3D 0, > > +}; > > +#endif >=20 > I'm pretty sure it breaks with some C compilers. > Why not for C++? > I see we have it already in rte_flow.h so we can keep it, > but that's something to double check for a future fix. >=20 Just like you said this is the practice used already, >=20