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 E6A96A04A8; Tue, 25 Jan 2022 05:04:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D7304121E; Tue, 25 Jan 2022 05:04:50 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2053.outbound.protection.outlook.com [40.107.223.53]) by mails.dpdk.org (Postfix) with ESMTP id 8E0C44013F for ; Tue, 25 Jan 2022 05:04:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BdCKSH2zECYq7Fhfn2vAo9713tMndCufyHfS8f7iR1b+lDC6pgDaf+ZrY7nVm+wj3Kti7T4V6s13MXoIwqQHM81G32+/OB1yXOVic2fwvFiHTzSvqyjC6M4VabPKzYdOjy0T/NbLnUjIj4BXAmX1wfUccdAi13oXxZbwjFLGL8kMkjKuyoTRk2J2NFq+ebrjUnZ3sKrukMjy84p58R7n9+BmWhxPteW2Gb6Y42wUyPYLPHANahENyyrVkI3GGOipHFMtm2/Vkm4TqZ5QIi9HQSFLDdZ2RUngBLL/uFB/a64LAk05Om3jZvtZExkW1GvjjBP0YEY4JWCV37II8se4OA== 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=XAaDpuz9aE4nLb9MLicPV3Nq1pv4VntYZbpzvgLgLNk=; b=mVT/s+Gep79crr0TXG4iTnyotoBBSz0uCffTJDy1SCfYFp5jE6xsb+JEQMNi+cwP7LdAT4+oYVvTB6A9xYefYPjpLRrM3nDEVpU5d2cCDzNX/CQ+UiyFv34jVcfWc3BrnSNyqk14FnEXxRDxCxjS00RnPIRlrBeG81rGPE+t3tXxQ53s68L14NLI2Fpc6fY3+ZzvCCX3bOeNAlVETzyIpYzDcg7omlKVDM0chvhmo4deCGDmEEiULIx5xc6Ez4HJdnp7E4AKowNoeiSM+i5654Gc4aJWOKP/7pWD8yeg+fKaTaGv6PWxyfPoaVPJn4Ce0pYm0b84b5IPa+knZtvviw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=XAaDpuz9aE4nLb9MLicPV3Nq1pv4VntYZbpzvgLgLNk=; b=VHX6f4ZNkFo8EOPfLbAlnUyPGW6U/geS4N3YrJYsoLe9q1899ByPKBB5VhCrZ0EWGEalBqFRrZnYN3bSe2ojs49J6vXou0sFVeFPwVX0/OO1h0wJLsCUshs3DVOxa1B3pTBMPAkQ1i9TXXqcWLXd+vhv7sFlUMUM3g8d4x1T4W6DdBQOJbdLwqkYk9ZuUb2ZTbApgme5xmMA+1qu9otn9yiCg2y5uD/Se2Qsqqfv1xopbGS9vm0DeglqID9pppoxzAV0p/gb410vEQx0cSQ3gNPlwZz9rlhhMbNiFX9NkANAlhbH8kp97W12aOUAY8LtgSsNtO7/x2xBq/X4czgnvQ== Received: from MW2PR12MB2572.namprd12.prod.outlook.com (2603:10b6:907:6::27) by DM6PR12MB2874.namprd12.prod.outlook.com (2603:10b6:5:15e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.13; Tue, 25 Jan 2022 04:04:47 +0000 Received: from DM5PR12MB2405.namprd12.prod.outlook.com (2603:10b6:4:b2::20) by MW2PR12MB2572.namprd12.prod.outlook.com (2603:10b6:907:6::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Tue, 25 Jan 2022 04:04:46 +0000 Received: from DM5PR12MB2405.namprd12.prod.outlook.com ([fe80::cd5b:cd8d:cd38:8c31]) by DM5PR12MB2405.namprd12.prod.outlook.com ([fe80::cd5b:cd8d:cd38:8c31%6]) with mapi id 15.20.4909.017; Tue, 25 Jan 2022 04:04:46 +0000 From: Alexander Kozyrev To: Ivan Malov , "dev@dpdk.org" CC: Ori Kam , "NBU-Contact-Thomas Monjalon (EXTERNAL)" , Ajit Khaparde , Andrew Rybchenko , Ferruh Yigit , "mohammad.abdul.awal@intel.com" , Qi Zhang , Jerin Jacob Subject: RE: [PATCH v2 02/10] ethdev: add flow item/action templates Thread-Topic: [PATCH v2 02/10] ethdev: add flow item/action templates Thread-Index: AQHYDUd95HtYB9N7gE6YZqxqDkcVjqxy+3Aw Date: Tue, 25 Jan 2022 04:04:46 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2b0237f8-08d4-4100-62ba-08d9dfb7d31f x-ms-traffictypediagnostic: MW2PR12MB2572:EE_|DM6PR12MB2874:EE_ x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: HLw+X7QUqa1eRaFK8qVCqmDrjXFQADSIWbHA+vw3Ni74Cu9n0mDbzJdBvaeeT+Vk6Dw6faBQrQYg3nDZqohtmIM0ShOeWkLp7cPM0R6MY/0m0uALET5vCCKS43h1+JYqeEIFFIoSEsHtudyx/XwfEBBVo5f8i6O004l6ILEu9dxo0uuW1XqOnVvGlJqPIa5Y6G0mf3px8saaY6JM3OnZ2/Zp1RMSOAoclVGsG7Uqz5LPqAmuOCAwYElKAic6PLt10uXWfZCuGo9gM5p4pYmzh/f21+fIk2HSJeCDFsVb+ha1JOEv1ss4itXm4EIBXxA1HwbjKnsjPpI3evj5xAomOkj18HqB/sR1fuJpA8K/QdXGHAsRu4xok5x47Yh4lSgFVzsBN6q6JxJ3i6YZcc/vJlmhp2fCkZk7B8yM5MuGSuxkyC0lyDZwS/DKvkamZS7TNKoAX3f9rrEFd154HFDxIVSGLdEmGNcN1d3Fgq8fh+53cyP5KkuW1YpiQnKbI440m+SYPiKimsB640OPIVXlgPU/OeH1bKyKi4kRhTyrklnCQq+uhYNpZNk1GWnsdQfkzgbFdw/Aa1wJrj3LLaAk/SJef48ewZZI/632S+g671SL9WSn52Lyeal6lwe/UPzE92g0k+SBHBr8YCz2ylEDwvwE0r17Scd/ISLK2V1ySwv3Zov/uYItnn+PvFNu+wZ5B8JZo0apsLZZPwpj9R8oqA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR12MB2572.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66476007)(508600001)(52536014)(66556008)(7696005)(8936002)(316002)(9686003)(5660300002)(55016003)(66946007)(86362001)(71200400001)(2906002)(4326008)(8676002)(53546011)(110136005)(33656002)(64756008)(66446008)(122000001)(38100700002)(54906003)(186003)(76116006)(38070700005)(6506007)(83380400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?6g5TcbaZEjcFGzHm92IONnthsS7MoIylPXs6K/oo6KqHJzQQKybi3oPte+mG?= =?us-ascii?Q?uiOn8PXw4YLa2mdHKCwDJvD6kiTl3x3hIcQtxj1Wn97Zgltfjd2dae9Udl93?= =?us-ascii?Q?QAOstKOl87uI2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-ascii?Q?WntggD+5DOQwMULHcMcNn0IjJO+4Zne8y4oAEx4id4Plq5SEQgtYiWdwi0Lj?= =?us-ascii?Q?vXXyWs7DxeafxBm98x0/sXM/tDfjbZxhhWisLuF/W3+3Kl2dLX/qjibUyg4h?= =?us-ascii?Q?QHPxycExexryXhJtrQrDqFOALyDaUX/Ohbzfwa4ys7So1ViLpJ33uhuBvUmZ?= =?us-ascii?Q?YnXppUspwxug2LK0CrZ5iPYdMYitLN4bBuPkU8vkAQYLtH/ncC7DXrZDEUPb?= =?us-ascii?Q?z6kpn00f43BEKkWUvUaTGsjAE1mt/3W8FOA2odz1NII52A/T4guh4FHNx93c?= =?us-ascii?Q?UrzBcO1hkUchfULpi959fbLi9g0ps6CrFJh2G8QdlnOaHqyuPQ0VYeDOrwng?= =?us-ascii?Q?Q9eOYFGQJJTOngTiUDKReM4GZfH6qelvSVVAmD2Og18x96cILmjcXLUehDO5?= =?us-ascii?Q?sufs8EX0zVOiExuoNDCqpGKgtdS5PV2neSkSf7JqPzjywci77BPuwvDzKMLO?= =?us-ascii?Q?M/M6OBG/q7ZHH0RoTTn+P9llroVFewLH1aHMD9VvZ7oxcS0jqSPK0Yj7QQB0?= =?us-ascii?Q?Z5cgc8SflWf82g9TrIVKpcrqhDcgIuAT9E+sSWZYdb88hpIl7WNLTyA5m8EL?= =?us-ascii?Q?CKlQv7X+UvphTteSVcByJ7k72XxBfEhSwD/RZAKgcqJLAZqcbdj31/RlPlJz?= =?us-ascii?Q?QZgqeQ=3D=3D?= 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: DM5PR12MB2405.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b0237f8-08d4-4100-62ba-08d9dfb7d31f X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jan 2022 04:04:46.2444 (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: l+eVCXUrXgk04ZOvag+bxpB4S/ReiL3xapKPq09vUYzg4SJn83LeV6p+xoNp5NwQuAtvUlCj43Fy9nh8kfMtEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2874 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 On Wednesday, January 19, 2022 10:16 Ivan Malov w= rote: > > +Oftentimes in an application, many flow rules share a common structure > > +(the same pattern and/or action list) so they can be grouped and > classified > > +together. This knowledge may be used as a source of optimization by a > PMD/HW. > > +The flow rule creation is done by selecting a table, an item template > > +and an action template (which are bound to the table), and setting > unique > > +values for the items and actions. This API is not thread-safe. >=20 > Consider: >=20 > +Typically, flow rules generated by a given application conform to a smal= l > +group of "shapes". What defines a "shape" is a set of specific item mask= s > +and action types. This knowledge facilitates optimisations in PMDs / HW. > + > +With such "shapes" (templates) being grouped in tables, a flow rule can > +be created by selecting a template (pattern, action list) within a given > +table and filling out specific match / action properties. I don't like the idea of introducing the new term here. Shaping is associated with bandwidth throttling in the network. But I like your wording better, let me adopt this style. > > + struct rte_flow_item_template * > > + rte_flow_item_template_create(uint16_t port_id, > > + const struct rte_flow_item_template_attr > *it_attr, > > + const struct rte_flow_item items[], > > + struct rte_flow_error *error); >=20 > I'm afraid "it_attr" is hardly readable. Also, the API name can > trick users into thinking that it's all about creating a single > item template rather than a flow pattern template. > Perhaps rename to "rte_flow_pattern_template_create()"? > Use "tmpl" instead of "template"? Or "shape" maybe? Maybe rte_flow_pattern_template_create() is better. Will rename. > For sure, "const struct rte_flow_item items[]" would look better > when renamed to "const struct rte_flow_item pattern[]". Agree, will rename to pattern as in the rte_flow_create() function. > The same goes for "rte_flow_action_template_create()" and "at_attr". Ok, will rename it_attr and at_attr to {pattern/actions}_template_attr. > Perhaps, "rte_flow_action_list_shape_create()" then? Definitely not shape, let's stick to what we already have in the rte_flow_c= reate(). Will keep actions[] to match the existing API. actions_list is something di= fferent. > > +A table combines a number of item and action templates along with > shared flow > > +rule attributes (group ID, priority and traffic direction). This way a > PMD/HW >=20 > Please consider: >=20 > +A template table consists of multiple pattern templates and action list > +templates associated with a single set of rule attributes (group ID, > +priority, etc). Good wording, thanks. > Perhaps rename "item_templates[]" and "action_templates[]" > to "pattern_templates[]" and "action_list_templates[]". > Maybe make use of the term "shape" here as well... Will use "pattern_templates[]" and "action_templates[]". > > + /** > > + * Relaxed matching policy, PMD may match only on items > > + * with mask member set and skip matching on protocol > > + * layers specified without any masks. > > + * If not set, PMD will match on protocol layers > > + * specified without any masks as well. > > + * Packet data must be stacked in the same order as the > > + * protocol layers to match inside packets, > > + * starting from the lowest. > > + */ > > + uint32_t relaxed_matching:1; >=20 > Consider rewording this to a bullet-formatted set of statements. > For brevity. For improved clarity. Ok. > > + * Flow attributes that will be used in the table. >=20 > Perhaps: "Flow attributes to be used in each rule generated from this > table". Something like that. No problem. >=20 > > + struct rte_flow_item_template *item_templates[], > Perhaps, "const struct"? The name could be "pattern_templates". Cannot make them constant because we modify reference counter for them insi= de. That allows us to track which templates are still in use by tables. > > + uint8_t nb_item_templates, > Why not "unsigned int"? The name could be "nb_pattern_templates". The reason for using only 256 is that we can use an array. It is to wasteful to allocate larger array for very few templates. If you have more templates you should consider creating different tables. > > + struct rte_flow_action_template *action_templates[]= , > > + uint8_t nb_action_templates, > Same questions here. Same answers as above.