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 CDD44A0C4C; Thu, 19 Aug 2021 17:07:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4AD7E4013F; Thu, 19 Aug 2021 17:07:42 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id C11374003D for ; Thu, 19 Aug 2021 17:07:39 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10081"; a="196154689" X-IronPort-AV: E=Sophos;i="5.84,335,1620716400"; d="scan'208";a="196154689" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2021 08:07:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,335,1620716400"; d="scan'208";a="424077944" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga006.jf.intel.com with ESMTP; 19 Aug 2021 08:07:21 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 19 Aug 2021 08:07:18 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) 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.10; Thu, 19 Aug 2021 08:07:11 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.10 via Frontend Transport; Thu, 19 Aug 2021 08:07:11 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.44) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Thu, 19 Aug 2021 08:06:57 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FJNP5ulAywM4NW+wWAd8JrqkgnWBSnqGME/V6ij+tZ6kpCyzoC89FQL7T8AEum3etwXrhvJRxVaoCxF8kTYMIUPMSCUyNBR4ybwF4+OYj0ZgX3p7sTZcYUL0gnrUOKTkGmZfoiBf0wCX9DnlhDqGOvfnC4tacCWXTRpuffrr7T0VyONHuY61iohe9/OebtbaVq6DhOenzS6SJ5YHp3BaBSsl/i0aw/ldbAMXHf0EjOO0BEcOqspRjh+SSH+8ppAgj5fNPJRATRoJRwJaQeP36ldNUEfdMXNkamOhOI3i9X1utdz85bwKAUxg/jZm5RNRNwdf3dW3unyQScRNbIEkPA== 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=DAdZI6dhFBfwWOBkYMvZ1EKHYA8OQBx8gUYs1xI8a+s=; b=hCkTsK95RYt7B8rbP1RwBxuutPrwGrMLNA2CfvWjw8NlrKqqyl5HXxxw77V7Dks6g9uGbJW0bNOxPUjshvD4bwq8en9vSdFK25kSeagiaIgWUrOCfQyBqn4i65tAybhzhgdv7hi6Wmjjog/Qbr1kyKQgZvbGGq8QUqHTHFTRgzVKemqon0C3drMjqXiZG6K4boR2IajSbSBt+uvZblzpfZQMkcovUy8fmFtI+6QkXW4ogIl3M+7a2lpCNMI0xQyBZCtZJf66klupwyIRxPOPV4oxZBAXYX4o6ODtVqXIP2LDvykNBJUtofgoOuWmviwNpqR3PX9s4PHcnGW+qRYY5w== 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=DAdZI6dhFBfwWOBkYMvZ1EKHYA8OQBx8gUYs1xI8a+s=; b=UgQzw4K4EBmEAs9noEwV8UqtIUSZU3TxH5NnYQOcZhXwETrE3yKIjOl/SwcSf63LGLjU1sTcqdDcCllPtrJ/KwVCV4m2rr3hJ6mVQb5F7AMhDFSgTkg2J/JRlBzr105ZBRpGo4Pd/4NuV7LBI3/bHxphEWqnwq0Hnk/JkJ874M8= Received: from DM6PR11MB2890.namprd11.prod.outlook.com (2603:10b6:5:63::20) by DM5PR11MB1467.namprd11.prod.outlook.com (2603:10b6:4:a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.18; Thu, 19 Aug 2021 15:06:55 +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; Thu, 19 Aug 2021 15:06:55 +0000 From: "Iremonger, Bernard" To: Sowmini Varadhan , "sowmini05@gmail.com" , "dev@dpdk.org" CC: "thomas@monjalon.net" Thread-Topic: [PATCH v2 2/2] examples/flow_classify: add an ACL table for tcp Thread-Index: AQHXlEH3AmyHCiVG10m3os21jenGiat66OkQ Date: Thu, 19 Aug 2021 15:06:55 +0000 Message-ID: References: <9085a3881fabec43eeeb5b3227c569cf559648a2.1629287046.git.sovaradh@linux.microsoft.com> In-Reply-To: <9085a3881fabec43eeeb5b3227c569cf559648a2.1629287046.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: f3bbdaa2-5867-4055-19ec-08d96322fc19 x-ms-traffictypediagnostic: DM5PR11MB1467: 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: DXdV2FyGPXXSZv7pESX2UhFBa9uuav0igpBLGjOUoR52yqN5mHUf/pfAJGtJyJ6y1/L6EZAY7XYHdjsxyLgDBpJMxyrhOAO1uOQMV6TYeAV8S97jFRRlb3AMscVUO6TpK2UjwAghBSonppBtQ6e7NtKnySDIrOxha+EGu2yR9FhCpmc5X8tHGCsY407WVYN/nHanKBk3nB+udocMYiliHCACsC3s3t74Rb4w3XYSYaXMDExSQwPU19GYPC3YfbaIBlFKRYJ52hKtD3Wng7dqGgQV2nF0ZjakTwMiNY4NH0OifCh8N6ftCygsJFe5Hr/b2oy0Qq6p5tkQ2nQ4UxS83us24FU+V7usMXnsqc651H385DJDSVaVsrX0a259EsN84J0SIrlCFNUQuSq4uMLXP/PMZ4ODB2Fo1IKszS+dahITCicFpx8VHXYpZIi+ljOR2jKvBUS4p0ZRnpSE0PW+Vv/0jul4zbuLvDpfr5D226Iy00BJum/bJAT5mhvaHwTyadaybnZ+C+keMFbbN06n6302r0DqgL770YchwYmxzyVfXr0u1bEatJP+hpr8KeDz28aJsUxl2N0Ncnbhljdr7+NDqo7cQdVlxlEqDoYxhOp8IIGbTvBk4Fl0n8NYXII2GZguyoTAGtykocvaNrrcKdVKK7c7M9tDM3kOKX7bABKozT4ie0+Ip1aiUMJS0DqKBYT7ExGltR/OItVyrrSfmesAcDOXczR/Sg0k75vpQGc= 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)(346002)(39860400002)(396003)(26005)(33656002)(316002)(53546011)(86362001)(122000001)(52536014)(186003)(6506007)(30864003)(38100700002)(478600001)(64756008)(71200400001)(7696005)(110136005)(2906002)(9686003)(83380400001)(76116006)(66946007)(5660300002)(55016002)(66476007)(8676002)(8936002)(4326008)(38070700005)(66556008)(66446008)(21314003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?CU8VWpl4t5NYy4VuHk8nMR2lGaXMVjSdx1PsS4b0Cd2MKDfnEnyF7HAZxuEq?= =?us-ascii?Q?5fF0iX/aDSsmiUriC3+B3tuXX8y8Ow819Xom/8uhx8EeKexCh+2AY85GHiv3?= =?us-ascii?Q?wW7EAjVY36JRaAvrMC7NsebD7hX6caxtJqK3uxC2vA7XmOZKQFghb+Ua6pQh?= =?us-ascii?Q?ol69GClnVzFnpL9esA7fJUIjwfAmeXNb3mNny4qOKqV/9Z313514Y9JHqT1P?= =?us-ascii?Q?N78Z/hbDZ95meCnnVv+iRdt0Rko9VMFR5n18crriHQdbbAJXjeLYV7AnMsZC?= =?us-ascii?Q?JJQ9/0oBTqtHykuklZSVx+09HbdncvCgT/OuEEHOqemcvIGPR3zxyvUIaOPH?= =?us-ascii?Q?Z6MGgPTue3jA+CfOmK5KKl5JXbMa9nb2SDGZYd3gUCM/NPl2OGV1SdEVfg26?= =?us-ascii?Q?yrXHTSMijcVNLFp9zSPivtnKbnK0LIsvV9PJ7RIWK8OpH40RgtddGJTNmbXN?= =?us-ascii?Q?EYOacKnYKuXknv7UwymFzH1jxL7lxpqG3FqmbfvgwSoSGdvpw+GyMNuTm58t?= =?us-ascii?Q?2SD5GhyTRS7m+8m1dIIRFM1ZV4nEOTWffoLDYIeKGigHdGQCPWISEvCMW5On?= =?us-ascii?Q?Tq+HFPmRcmsvYHi2RQN4mZLDfaYRxSCBMLvFI1uPr68x/pbq9GM3lDlKHMkO?= =?us-ascii?Q?MhtB+jGvvFROGWRZlclL7Uthtxv2SfS3UphHMu1MA5UQBfRVzYn90ynUEPUo?= =?us-ascii?Q?nBWrFqybniV8OtccZPCzbQFS48JcGFMJlnpyAul5uxNPKj7gZ7q8nP3rFpNI?= =?us-ascii?Q?pjuT+FRP9ukbCpcTHH5RPVaCAkl8VUtSWfnHVr8YatOzBbks/d1WYvD5DShu?= =?us-ascii?Q?DVvX8lyx9PXhTL9XA7H+WQtFOomJtB+W05P7WAd3tfUUcIxBh+kEfTks10rY?= =?us-ascii?Q?WyIk7YAbLXfacaoXGpMvi2mfEDrPYS92C0L5s08o8HQu0jtVlJEcAiaaHN6X?= =?us-ascii?Q?f99ICNpcIk6eWwhf/X7skvgnlczLSEwU5XQfF2BGeJlO68kW1gRPHJgxkmv2?= =?us-ascii?Q?kqZwUXYqjmTRDt/x9frHi+jjXSlH6orrSe1pir9OJaASOKqRqq7UItd3BmMq?= =?us-ascii?Q?Jt4jz7Cy3Ng8zXZWgpwsUvGrewBoI8iwkNuazlc3H9Fl1gRTByL6QbI3+1tU?= =?us-ascii?Q?WIlS7UqkVEjqsnSWF+27KwJJMy3yKG50ifYmrMGDrDTK4iapGe4a3d2JWAA9?= =?us-ascii?Q?n9OhlNy4LaQnAakUBuOwNXcMlbPZuZbr18ty/762KP+ESO732m7FgefS1JUm?= =?us-ascii?Q?gsx5UVB5DDs5dahk6M0yu+tROQTb53Noz4U4c5CP53sgNEm5H886jwfuqhLe?= =?us-ascii?Q?uR7+nukNlTTRyhCDVeZO9+dk?= 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: f3bbdaa2-5867-4055-19ec-08d96322fc19 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Aug 2021 15:06:55.8447 (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: 5GS5NvIivqyjrQuawUFLMciDbodZWkZBAK3/exr6X1QB7G+iMTaT8HLEuYjzE5jBibRhFQXIK6w4xKqtanmPP9Cy46diikjj2kszVx8JJzU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1467 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 2/2] examples/flow_classify: 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: Wednesday, August 18, 2021 4:01 PM > To: sowmini05@gmail.com; Iremonger, Bernard > ; dev@dpdk.org; > sovaradh@linux.microsoft.com > Cc: thomas@monjalon.net > Subject: [PATCH v2 2/2] examples/flow_classify: add an ACL table for tcp >=20 > v2 updates: typo fixes for checkpatch, bernard.iremonger comments The above line should not be added to the commit message. ~/dpdk/devtools/check-git-log.sh -1 Wrong tag: v2 fixes: typo fixes, get_tcp_flags returns -EINVAL The check-git-log.sh script is in your dpdk checkout, best to run this scr= ipt before sending patches >=20 > The struct rte_flow_classifier can have up to > 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 ACLs and filters t= o > filter based on the state of the TCP connection, e.g., by looking at the = tcp > flags field. >=20 > So we enhance flow_classify to add an additional acl table for tcp 5-tupl= 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 > --- If you want comment on the patch updates (optional), it can be added here a= fter the --- line > 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(-) This patch contains changes to the flow_classify example and the flow_class= ify library. It needs to be split in two, a patch for the flow_classify example and a pa= tch for the flow classify library. >=20 > diff --git a/examples/flow_classify/flow_classify.c > b/examples/flow_classify/flow_classify.c > index ff4c8bc2f5..8f6aacae03 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, I think it would be better to rename TCP_FLAGS_FIELD to FLAGS_FIELD_TCP in = line with the other values. > 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 Regards, Bernard.