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 E73EDA0548; Tue, 17 Aug 2021 14:08:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A776B407FF; Tue, 17 Aug 2021 14:08:08 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id BDD9F4014E for ; Tue, 17 Aug 2021 14:08:06 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10078"; a="216060428" X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="216060428" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 05:08:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="572873702" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga004.jf.intel.com with ESMTP; 17 Aug 2021 05:08:05 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 17 Aug 2021 05:08:04 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 17 Aug 2021 05:08:04 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Tue, 17 Aug 2021 05:08:04 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.49) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Tue, 17 Aug 2021 05:08:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oZv2bklagz0WE8YxnXqyzQ+U5IGfYt+oKAARoAcNRDFx9oLytYG5pNkiouaIIjnZtYq6qq2tiJAqq0++hKf4HhRijyQWZpYGDjbg9jof7QZSZfUHjVFV4CPj4Al5EEhJNPytmkrIVW0hZYYvetYfJq0AnOZTUvWSwm2dFVGDtpIydiuy+C8VzhUX8XI/DQPoCHZ8n9VEib7DCzJjQ86XgxyWsGNFeZHMnXjmuYHjO2QYSzVLgyRwh+GWKq46AD7lKAPE73xn0GwXWG8p+1uJKt4pkzSBFHVvg01GfQbyv+U/LN8md0uljAY3Y9UUBOvH4GSUVkRLKP3p9eNU1zJXag== 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=Z2XZ4/W1kVBLsgqva6nclFjAW7iVOqCTTXQNfgsjefw=; b=RR0097pyWFZhG43tBdAdXYbK7a5K3QqDs9KHInZGIAwiPKHFXJQyvvKroCxagyIcRcyy83OONM26slhKUZUdFYamQsLuW/TKVbuNV0aMrkeAW7HyTfmknTdgu4N+xHkyq+0GLnSdg5+lKRp+ynXyWlzMfQtJ18sROt/dL1pWjffC19/gRknOS/IQ6In169E7Zcg0yldT02D3/i4YlJu4gi4FxHsRcsBxmIpoc+rTd+jAtECmT3CM9IkA3ODRc81kB4aO+msViio9M7ZqFeAv8y91pETn7149EoC7TVWqBh+b8CPu/1ygJ5Jk/lLFmXMO2GNtf+x4aROIO9E7x56mYQ== 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=Z2XZ4/W1kVBLsgqva6nclFjAW7iVOqCTTXQNfgsjefw=; b=j5C7wsyfYVK5BT33oRYQy8mwqFTqb6KMozTbdMxI6H61lWTJ+cH/VIlM1p65N725TcQ9tr7QwShFxo/OcXoIaWjjd1kpr7fTLDJlmT19ZCEVYGTClinIuuZx879MLkpvMjFcAvP6VOyaP/VxL2rpGiMzNmciXmuxLDaVge1P/Co= Received: from DM6PR11MB2890.namprd11.prod.outlook.com (2603:10b6:5:63::20) by DM6PR11MB3084.namprd11.prod.outlook.com (2603:10b6:5:6c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.19; Tue, 17 Aug 2021 12:08:01 +0000 Received: from DM6PR11MB2890.namprd11.prod.outlook.com ([fe80::867:8350:9cce:66e0]) by DM6PR11MB2890.namprd11.prod.outlook.com ([fe80::867:8350:9cce:66e0%7]) with mapi id 15.20.4415.024; Tue, 17 Aug 2021 12:08:01 +0000 From: "Iremonger, Bernard" To: Sowmini Varadhan , "sowmini05@gmail.com" , "dev@dpdk.org" , "sowmin05@gmail.com" CC: "thomas@monjalon.net" Thread-Topic: [PATCH 2/2] Allow the flow_classify example to add an ACL table for tcp. Thread-Index: AQHXj7c10IitCdclxEmkpcpMzgRri6t3mi9w Date: Tue, 17 Aug 2021 12:08:01 +0000 Message-ID: References: <33b007a3b0fa81fdd54c006cd5b481ff06648702.1628796991.git.sovaradh@linux.microsoft.com> In-Reply-To: <33b007a3b0fa81fdd54c006cd5b481ff06648702.1628796991.git.sovaradh@linux.microsoft.com> Accept-Language: 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.5.1.3 authentication-results: linux.microsoft.com; dkim=none (message not signed) header.d=none;linux.microsoft.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fb835060-fd6b-4ef4-c57b-08d96177a8e7 x-ms-traffictypediagnostic: DM6PR11MB3084: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bS86CSwfcRPqdmGQV5jX1FiMOx9yg6HldN6Jc3ms3dMmmIho127Mrv8eBTgYqBiOVygu4hafOfah+ewgvn4elEfWXReonsTIqJa3PT65+SSts6pKeg92JuyiddE01lKYUlcILHbSUzZFGLfxmCFWpq3iuwtN9BnkFJkZyp54T629GsHYc84Jl1WS9ZKf36rdPLLtkxbtplI6759KKAHxCISRgXGg+PFRs40Dq6+hqDjBgwkufRm3a/7B1W92RkO39z+w8jtI2Bdir+WUl36cpWvJXLZYs/zlayba74NLBx4DVBRxa2pk3XfTnPRg5Rz7Cf6En7qjDOJ3XzESTBQaPxgecX/N2AQDKZ0Uif6Xsu6NfrMf8SXDKi8WvB4nqe8quE3u+Wnk12f3cMvlhG1TWINv3KM8xfOdjNWllHgs0/9RFj8pBZtcEBKU6dH82HpRdAXKT0Mrg1XCyJF6Fio7FSPajA1ZLf6dhnKH2KPxR4Glzxie77+XwxFvIET1F9Y0UxnHMplOjVUmTPEU9KZkEjPJJWtsgowCxqi2Q1xAFQLSOU2UaQ3nVCPjIjBW56Wl63rHq4B0+Z/mwpzdHXhjQ4f82/zBqdD6KuaTZlRi9dEgvnmIxDFoyuJnmMWG4HLqNwaETLd3A0+xYu0hU2hPvxCa2VSqQWbc0FX4Yp5+irqObllBMx8MiDDctR6nDdLj8przvZ28A9k5zvxu2vmLy09H8RV5ER5YfD9sn1ndzow= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB2890.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(366004)(396003)(346002)(39860400002)(86362001)(2906002)(66946007)(66476007)(83380400001)(38070700005)(26005)(186003)(66446008)(71200400001)(64756008)(66556008)(76116006)(478600001)(33656002)(110136005)(9686003)(55016002)(5660300002)(8936002)(8676002)(316002)(38100700002)(122000001)(52536014)(4326008)(7696005)(30864003)(53546011)(6506007)(21314003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?MPb20BDWO5stO1AjJJvzMwTRWsT/Xctq6v640HmYgcgFiZ8MFANWpz889sBH?= =?us-ascii?Q?xp/ZSU71ATY6BevKVpTGvYy8EhWWiGl7UV5Inuu7Snkg9dW9A8eLBBhvgdkt?= =?us-ascii?Q?swhmvgwOqBDlTLWiMN4tg7WZD4GkoESz1RKdldrCcJxINWDUntU3/16Qiqxl?= =?us-ascii?Q?fc/tBX4y+JW5fLHKKfCY4b+OjzPRx1JEa76GgGRmpaOhrtNvGGfoaPjC0X4g?= =?us-ascii?Q?vDPVaC1/Q+gs/O2s8P2nGAlnTIu5eiGznnRG5xBcuGXEGMlF+U9UUZXwkK8G?= =?us-ascii?Q?Y7Sifc9h6wYs/6fjm1qW3DJ8/UkZA/GM6HrgVey8y+zCqstm+ATqpqS3Jcb6?= =?us-ascii?Q?sbMlzCJNzdj1In3YJRhL+wNIy1Y6Ja02U4ACnVHlCZrprrespuiI6jnFu+pZ?= =?us-ascii?Q?0mxDmbppwuzD2ljmVX5bVTWZo/7c9kx66cWWzXKqqhlIHljnHMcIDEE+vdK+?= =?us-ascii?Q?Kn4Zvl40NJF4/BoWmA90EgRtEABjrQ/AtkvkqVcGLvIhumEXbR6P9g/sI3j7?= =?us-ascii?Q?FMYqqP2Zpc2kBD2qH5nEpvWSMb2IcBNnQAyO4mApoXrhZcTED6zxkhK/i2C9?= =?us-ascii?Q?gA6hkIz/Ob5HWTbHEwmiuysiGl89Q4ATiQIV7wD2khdGUuJCyf/ShcPk6C/P?= =?us-ascii?Q?/BN+x7JEZfrmio5kwvmDdHwaGKsoQQnqmw3pgoduivjotJ4j4lzPLU4EyeB1?= =?us-ascii?Q?yUHmnHjFiQxJZaudMQu3dvnhHUV1fq4cQ5LpG2kTIqxxr3813E1WpN/DfgVw?= =?us-ascii?Q?WjFg/2lsg4WRpTIhAVWBl5gz2gUaL/+hKUg8bEhIMw247Ap0t8e2IcjggAda?= =?us-ascii?Q?Q+mqchgal7R0VuTWsBIcQmqsOThoTjgxzzEKXfZyWKwpKZzKmXO/tnytTHWE?= =?us-ascii?Q?AZm2dlXXZ2r5JBggEbN15q0IbebgVKVTVrYVHBSVOEoAwVltvh49H0CU9H1y?= =?us-ascii?Q?aPTQmG0tuasXzbPl1sRu5+pFwYPJDfr4k0k/gZyPAEwZWVzJ6bswcSpQAoxp?= =?us-ascii?Q?pt4HtTKkkIU2m+CodWa2/97FvJfEqCDmVye214HKaEl6YSAMSqmGsRsgHFy0?= =?us-ascii?Q?VOEdO1T3IHumr+sF3KcJdbUsX88bSNStdtTzYyzzJbN25Cvi3qc8MTmXxYrm?= =?us-ascii?Q?+NMgiF8YPj7xovHokVb5ihFWSUmBf9wi58sWaE5n7AfbEpftEB8TYSz/n20R?= =?us-ascii?Q?puj7LmRZ1AcgkftANM7p/yUgODYtIYpUn2otosVsHKUk+iF/U6DHuOrN3/p6?= =?us-ascii?Q?cjTi+CI2bXCXM+PRV5tZ+OuRs4V9yRUcwqfxj2JlNilBBwXzNdqy2lS7j5qt?= =?us-ascii?Q?lhMHVR4YFPg3QLykCJBAnac3?= 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-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB2890.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb835060-fd6b-4ef4-c57b-08d96177a8e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2021 12:08:01.1720 (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: /guO1oQMtKS6z2uSrAQWLuUSu8hMwNFJ/3hVxONnknOgwkqyTBfK7MahwtbpEMeoXRiSaipt2fJ1GqrQmDrpWZgDnlb6l7bzm88MMrTdESo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3084 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 2/2] Allow the flow_classify example to add an ACL table for tcp. 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 Sowmini, > -----Original Message----- > From: Sowmini Varadhan > Sent: Thursday, August 12, 2021 9:18 PM > To: sowmini05@gmail.com; Iremonger, Bernard > ; dev@dpdk.org; sowmin05@gmail.com; > sovaradh@linux.microsoft.com > Cc: thomas@monjalon.net > Subject: [PATCH 2/2] Allow the flow_classify example to add an ACL table = for > tcp. ./check-git-log.sh -1 Wrong headline format: Allow the flow_classify example to add an ACL table for tcp. The subject line should be prefixed with examples/flow_classify: flow_classify: Allow the flow_classify example to add an ACL table for tcp >=20 > The struct rte_flow_classifier can have upto > RTE_FLOW_CLASSIFY_TABLE_MAX > (32) classifier tables, but the existing flow_classify examples only adds= a > single table for the L4 5-tuple. >=20 > When dealing with tcp flows, we frequently want to add add ACLs and filte= rs > to filter based on the state of the TCP connection, e.g., by looking at t= he tcp > flags field. >=20 > So we enhance flow_classify to add an additional acl table for tcp 5-typl= es. If > the input-file-parser detects a filter for a tcp flow with a non-wildcard > argument for tcp_flags, the IP4_TCP_5TUPLE table is used by flow_classify= . >=20 > Signed-off-by: Sowmini Varadhan > --- > examples/flow_classify/flow_classify.c | 41 +++++++--- > lib/flow_classify/rte_flow_classify.c | 87 +++++++++++++++++++++ > lib/flow_classify/rte_flow_classify.h | 19 +++++ > lib/flow_classify/rte_flow_classify_parse.c | 8 +- > 4 files changed, 142 insertions(+), 13 deletions(-) >=20 > diff --git a/examples/flow_classify/flow_classify.c > b/examples/flow_classify/flow_classify.c > index 772b15adf2..b42d0df5c3 100644 > --- a/examples/flow_classify/flow_classify.c > +++ b/examples/flow_classify/flow_classify.c > @@ -723,11 +723,6 @@ add_classify_rule(struct rte_eth_ntuple_filter > *ntuple_filter, > return ret; > } >=20 > - /* XXX but this only adds table_type of > - * RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE > - * i.e., it only ever does allocate_acl_ipv4_5tuple_rule() > - * so the tcp_flags is ignored! > - */ > rule =3D rte_flow_classify_table_entry_add( > cls_app->cls, &attr, pattern_ipv4_5tuple, > actions, &key_found, &error); > @@ -856,7 +851,8 @@ main(int argc, char *argv[]) > int ret; > int socket_id; > struct rte_table_acl_params table_acl_params; > - struct rte_flow_classify_table_params cls_table_params; > + struct rte_table_acl_params table_acl_tcp_params; > + struct rte_flow_classify_table_params cls_table_params[2]; > struct flow_classifier *cls_app; > struct rte_flow_classifier_params cls_params; > uint32_t size; > @@ -923,21 +919,42 @@ main(int argc, char *argv[]) > memcpy(table_acl_params.field_format, ipv4_defs, > sizeof(ipv4_defs)); >=20 > /* initialise table create params */ > - cls_table_params.ops =3D &rte_table_acl_ops; > - cls_table_params.arg_create =3D &table_acl_params; > - cls_table_params.type =3D > RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE; > + cls_table_params[0].ops =3D &rte_table_acl_ops; > + cls_table_params[0].arg_create =3D &table_acl_params; > + cls_table_params[0].type =3D > RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE; > + > + /* initialise ACL table params */ > + table_acl_tcp_params.name =3D "table_acl_ipv4_tcp_5tuple"; > + table_acl_tcp_params.n_rules =3D FLOW_CLASSIFY_MAX_RULE_NUM; > + table_acl_tcp_params.n_rule_fields =3D RTE_DIM(ipv4_defs); > + memcpy(table_acl_tcp_params.field_format, ipv4_defs, > +sizeof(ipv4_defs)); > + > + /* initialise table create params */ > + cls_table_params[1].ops =3D &rte_table_acl_ops; > + cls_table_params[1].arg_create =3D &table_acl_tcp_params; > + cls_table_params[1].type =3D > RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_TCP_5TUPLE; >=20 > - ret =3D rte_flow_classify_table_create(cls_app->cls, > &cls_table_params); > + ret =3D rte_flow_classify_table_create(cls_app->cls, > + &cls_table_params[0]); > if (ret) { > rte_flow_classifier_free(cls_app->cls); > rte_free(cls_app); > rte_exit(EXIT_FAILURE, "Failed to create classifier table\n"); > } > + ret =3D rte_flow_classify_table_create(cls_app->cls, > + &cls_table_params[1]); > + if (ret) { > + rte_flow_classifier_free(cls_app->cls); > + rte_free(cls_app); > + rte_exit(EXIT_FAILURE, > + "Failed to create classifier table\n"); > + } > + > /* >8 End of initialization of table create params. */ >=20 > /* read file of IPv4 5 tuple rules and initialize parameters > - * for rte_flow_classify_validate and > rte_flow_classify_table_entry_add > - * API's. > + * for rte_flow_classify_validate and > + * rte_flow_classify_table_entry_add API's. > */ >=20 > /* Read file of IPv4 tuple rules. 8< */ diff --git > a/lib/flow_classify/rte_flow_classify.c b/lib/flow_classify/rte_flow_clas= sify.c > index d3ba2ed227..e960c3b140 100644 > --- a/lib/flow_classify/rte_flow_classify.c > +++ b/lib/flow_classify/rte_flow_classify.c > @@ -60,6 +60,7 @@ enum { > DST_FIELD_IPV4, > SRCP_FIELD_IPV4, > DSTP_FIELD_IPV4, > + TCP_FLAGS_FIELD, > NUM_FIELDS_IPV4 > }; >=20 > @@ -72,6 +73,7 @@ struct classify_rules { > enum rte_flow_classify_rule_type type; > union { > struct rte_flow_classify_ipv4_5tuple ipv4_5tuple; > + struct rte_flow_classify_ipv4_tcp_5tuple ipv4_tcp_5tuple; > } u; > }; >=20 > @@ -477,6 +479,84 @@ allocate_acl_ipv4_5tuple_rule(struct > rte_flow_classifier *cls) > return rule; > } >=20 > +static struct rte_flow_classify_rule * > +allocate_acl_ipv4_tcp_5tuple_rule(struct rte_flow_classifier *cls) { > + struct rte_flow_classify_rule *rule; > + int log_level; > + > + rule =3D malloc(sizeof(struct rte_flow_classify_rule)); > + if (!rule) > + return rule; > + > + memset(rule, 0, sizeof(struct rte_flow_classify_rule)); > + rule->id =3D unique_id++; > + rule->rules.type =3D > RTE_FLOW_CLASSIFY_RULE_TYPE_IPV4_TCP_5TUPLE; > + > + /* key add values */ > + rule->u.key.key_add.priority =3D cls->ntuple_filter.priority; > + rule- > >u.key.key_add.field_value[PROTO_FIELD_IPV4].mask_range.u8 =3D > + cls->ntuple_filter.proto_mask; > + rule->u.key.key_add.field_value[PROTO_FIELD_IPV4].value.u8 =3D > + cls->ntuple_filter.proto; > + rule->rules.u.ipv4_tcp_5tuple.proto =3D cls->ntuple_filter.proto; > + rule->rules.u.ipv4_tcp_5tuple.proto_mask =3D > + cls->ntuple_filter.proto_mask; > + > + rule->u.key.key_add.field_value[SRC_FIELD_IPV4].mask_range.u32 > =3D > + cls->ntuple_filter.src_ip_mask; > + rule->u.key.key_add.field_value[SRC_FIELD_IPV4].value.u32 =3D > + cls->ntuple_filter.src_ip; > + rule->rules.u.ipv4_tcp_5tuple.src_ip_mask =3D > + cls->ntuple_filter.src_ip_mask; > + rule->rules.u.ipv4_tcp_5tuple.src_ip =3D cls->ntuple_filter.src_ip; > + > + rule->u.key.key_add.field_value[DST_FIELD_IPV4].mask_range.u32 > =3D > + cls->ntuple_filter.dst_ip_mask; > + rule->u.key.key_add.field_value[DST_FIELD_IPV4].value.u32 =3D > + cls->ntuple_filter.dst_ip; > + rule->rules.u.ipv4_tcp_5tuple.dst_ip_mask =3D > + cls->ntuple_filter.dst_ip_mask; > + rule->rules.u.ipv4_tcp_5tuple.dst_ip =3D cls->ntuple_filter.dst_ip; > + > + rule- > >u.key.key_add.field_value[SRCP_FIELD_IPV4].mask_range.u16 =3D > + cls->ntuple_filter.src_port_mask; > + rule->u.key.key_add.field_value[SRCP_FIELD_IPV4].value.u16 =3D > + cls->ntuple_filter.src_port; > + rule->rules.u.ipv4_tcp_5tuple.src_port_mask =3D > + cls->ntuple_filter.src_port_mask; > + rule->rules.u.ipv4_tcp_5tuple.src_port =3D cls->ntuple_filter.src_port; > + > + rule- > >u.key.key_add.field_value[DSTP_FIELD_IPV4].mask_range.u16 =3D > + cls->ntuple_filter.dst_port_mask; > + rule->u.key.key_add.field_value[DSTP_FIELD_IPV4].value.u16 =3D > + cls->ntuple_filter.dst_port; > + rule->rules.u.ipv4_tcp_5tuple.dst_port_mask =3D > + cls->ntuple_filter.dst_port_mask; > + rule->rules.u.ipv4_tcp_5tuple.dst_port =3D cls->ntuple_filter.dst_port; > + > + rule- > >u.key.key_add.field_value[TCP_FLAGS_FIELD].mask_range.u32 =3D > + rte_be_to_cpu_32(0xff); > + rule->u.key.key_add.field_value[TCP_FLAGS_FIELD].value.u32 =3D > + rte_be_to_cpu_32(cls->ntuple_filter.tcp_flags); > + rule->rules.u.ipv4_tcp_5tuple.tcp_flags =3D > +cls->ntuple_filter.tcp_flags; > + > + log_level =3D rte_log_get_level(librte_flow_classify_logtype); > + > + if (log_level =3D=3D RTE_LOG_DEBUG) > + print_acl_ipv4_key_add(&rule->u.key.key_add); > + > + /* key delete values */ > + memcpy(&rule->u.key.key_del.field_value[PROTO_FIELD_IPV4], > + &rule->u.key.key_add.field_value[PROTO_FIELD_IPV4], > + NUM_FIELDS_IPV4 * sizeof(struct rte_acl_field)); > + > + if (log_level =3D=3D RTE_LOG_DEBUG) > + print_acl_ipv4_key_delete(&rule->u.key.key_del); > + > + return rule; > +} > + > struct rte_flow_classify_rule * > rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls, > const struct rte_flow_attr *attr, > @@ -514,6 +594,13 @@ rte_flow_classify_table_entry_add(struct > rte_flow_classifier *cls, > rule->tbl_type =3D table_type; > cls->table_mask |=3D table_type; > break; > + case RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_TCP_5TUPLE: > + rule =3D allocate_acl_ipv4_tcp_5tuple_rule(cls); > + if (!rule) > + return NULL; > + rule->tbl_type =3D table_type; > + cls->table_mask |=3D table_type; > + break; > default: > return NULL; > } > diff --git a/lib/flow_classify/rte_flow_classify.h > b/lib/flow_classify/rte_flow_classify.h > index 82ea92b6a6..65585d9f92 100644 > --- a/lib/flow_classify/rte_flow_classify.h > +++ b/lib/flow_classify/rte_flow_classify.h > @@ -80,6 +80,8 @@ enum rte_flow_classify_rule_type { > RTE_FLOW_CLASSIFY_RULE_TYPE_NONE, > /** IPv4 5tuple type */ > RTE_FLOW_CLASSIFY_RULE_TYPE_IPV4_5TUPLE, > + /** IPv4 TCP 5tuple type */ > + RTE_FLOW_CLASSIFY_RULE_TYPE_IPV4_TCP_5TUPLE, > }; >=20 > /** Flow classify table type */ > @@ -92,6 +94,8 @@ enum rte_flow_classify_table_type { > RTE_FLOW_CLASSIFY_TABLE_ACL_VLAN_IP4_5TUPLE =3D 1 << 2, > /** ACL QinQ IP4 5TUPLE */ > RTE_FLOW_CLASSIFY_TABLE_ACL_QINQ_IP4_5TUPLE =3D 1 << 3, > + /** ACL IP4 5TUPLE with tcp_flags */ > + RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_TCP_5TUPLE =3D 1 << 4, >=20 > }; >=20 > @@ -131,6 +135,21 @@ struct rte_flow_classify_ipv4_5tuple { > uint8_t proto_mask; /**< Mask of L4 protocol. */ > }; >=20 > +/** IPv4 5-tuple data with tcp flags*/ > +struct rte_flow_classify_ipv4_tcp_5tuple { > + uint32_t dst_ip; /**< Destination IP address in big endian. */ > + uint32_t dst_ip_mask; /**< Mask of destination IP address. */ > + uint32_t src_ip; /**< Source IP address in big endian. */ > + uint32_t src_ip_mask; /**< Mask of destination IP address. */ > + uint16_t dst_port; /**< Destination port in big endian. */ > + uint16_t dst_port_mask; /**< Mask of destination port. */ > + uint16_t src_port; /**< Source Port in big endian. */ > + uint16_t src_port_mask; /**< Mask of source port. */ > + uint8_t proto; /**< L4 protocol. */ > + uint8_t proto_mask; /**< Mask of L4 protocol. */ > + uint8_t tcp_flags; /**< Tcp only */ > +}; > + > /** > * Flow stats > * > diff --git a/lib/flow_classify/rte_flow_classify_parse.c > b/lib/flow_classify/rte_flow_classify_parse.c > index 465330291f..fe4ee05b6f 100644 > --- a/lib/flow_classify/rte_flow_classify_parse.c > +++ b/lib/flow_classify/rte_flow_classify_parse.c > @@ -216,6 +216,7 @@ classify_parse_ntuple_filter(const struct > rte_flow_attr *attr, > const struct rte_flow_action_count *count; > const struct rte_flow_action_mark *mark_spec; > uint32_t index; > + bool have_tcp =3D false; >=20 > /* parse pattern */ > index =3D 0; > @@ -375,6 +376,8 @@ classify_parse_ntuple_filter(const struct > rte_flow_attr *attr, > filter->dst_port =3D tcp_spec->hdr.dst_port; > filter->src_port =3D tcp_spec->hdr.src_port; > filter->tcp_flags =3D tcp_spec->hdr.tcp_flags; > + if (filter->tcp_flags !=3D 0) > + have_tcp =3D true; > } else if (item->type =3D=3D RTE_FLOW_ITEM_TYPE_UDP) { > udp_mask =3D item->mask; >=20 > @@ -434,7 +437,10 @@ classify_parse_ntuple_filter(const struct > rte_flow_attr *attr, > return -EINVAL; > } >=20 > - table_type =3D RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE; > + if (have_tcp) > + table_type =3D > RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_TCP_5TUPLE; > + else > + table_type =3D RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE; >=20 > /* parse attr */ > /* must be input direction */ > -- > 2.17.1 This patch for some reason has "..patch" instead of ".patch" Could you use ".patch" in the v2 . Regards, Bernard.