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 5EF7AA0C44; Fri, 16 Apr 2021 10:46:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 43DA4141BE8; Fri, 16 Apr 2021 10:46:56 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2062.outbound.protection.outlook.com [40.107.94.62]) by mails.dpdk.org (Postfix) with ESMTP id 4C454141BDE for ; Fri, 16 Apr 2021 10:46:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WHzLWBNdLVOJwv6tK/18JOK36IwRWYxxCOMwP72JvSq6ysjdS2T4+bW0c/anX2kHK4nmK5JFRVPXhU8R/pWEhRsne4kkQs6OVE/y1P3nkECGBt4BHjVgEPwvt0irxNE81P4XH8ZA/aJsqCnWFhAmE1Fv73xGBxQEuUi6t41kr1cF0U2DbE9ACeBZ2s8Z9nYpGa9TmZFp+UVt9zNDCIgNFrDlCN1gcxZHWcBNg/NYCOmfl9DgIg2Idj3zUuawP+cNy7nJshrdiWj61jvr5rctGW1UeVi4GizvLI4RvT3dH+Jv6hXP4a0wXC+Id0aFuOv5kQmrJjD0wuVeI57/GVEF7Q== 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=Z7kzDY/eyr9tJix0uQ8xhiKQQWo8vPVEO3JFKW2o6qM=; b=D8diLQQDKNAAxk8NjrIs/KzpRzfX4CtxgiLoi54ugD0r2+Fyf5+yv2WzddtfzqH+Ybabry214kIUeenfieog1NUratN50LtXxaW4LgZhIV333HJITphzbtfokqVnIYs427QJfO61gsOqsHPT9r49ARoygVgfW93cgLeCwhTiDY2oqkgFCGuJFWYrnXmr0YfcVnTre4eliyfub5loLyFp+4YL29Ddmd1g1FNtlivlSuZsltGDksRF5B47blhqH+QLM4nl6smoG3ae6fjrz47j0kAdKrYJeq08ngPDXOZVWJsLWDGCp+oHyW+M4/yQSbwVmdzMwE1XQtdvqmkO/h2FLg== 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=Z7kzDY/eyr9tJix0uQ8xhiKQQWo8vPVEO3JFKW2o6qM=; b=HTaqmsUhBcC2PzTrIWui45xMIcWtijJA/jLGFRDeVnhSNSYl/dxzpH9AnXhKlnKBStBV4iyrZqjTBg5k5VaRc2h9BUPyByMOJK8ty/n9GybtbWqlGWDl+xLtNmDoqWOogDK1dYhiNCgONw6b9FzjZtlEEjvi0DcDL60SADMmXma+Hmuk5WqZjkI/UhHKABnUOb59357+CZ2ELEvgQXeHk5zEHdK0vI/7Bzis1nIOXUO75KwAaA4wWpHAXtBGsxDQk5gqsr5Xrax0fponVTd1GZev79GWee3kKpXtPNkqLHwF/rvUjsV5miaOGY4wY2pH5v8gi/jOnYJPfWcB6pVbXw== Received: from DM6PR12MB4987.namprd12.prod.outlook.com (2603:10b6:5:163::31) by DM6PR12MB2987.namprd12.prod.outlook.com (2603:10b6:5:3b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.18; Fri, 16 Apr 2021 08:46:52 +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 08:46:52 +0000 From: Ori Kam To: Bing Zhao , NBU-Contact-Thomas Monjalon , "ferruh.yigit@intel.com" , "andrew.rybchenko@oktetlabs.ru" CC: "dev@dpdk.org" , "ajit.khaparde@broadcom.com" Thread-Topic: [PATCH v2 2/2] app/testpmd: add CLI for conntrack Thread-Index: AQHXMhYwIl9anSRMzUm0wEAjPvX5sqq2yakA Date: Fri, 16 Apr 2021 08:46:51 +0000 Message-ID: References: <1618062393-205611-1-git-send-email-bingz@nvidia.com> <1618504877-95597-1-git-send-email-bingz@nvidia.com> <1618504877-95597-3-git-send-email-bingz@nvidia.com> In-Reply-To: <1618504877-95597-3-git-send-email-bingz@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; 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: e0707925-df7f-4c15-1d45-08d900b42eba x-ms-traffictypediagnostic: DM6PR12MB2987: 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:619; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: s6ACemPsmaJupoN0eiGfN09jAhpkPIrhFz5L0XVS9hMLFQ0OcVSGuNiM5fFRC3CqewqloCFMd0ISs/Qf1EryAmQGuMOI2uu3e/r4N6oVS2qIWnRJ8ycXzag0PllgPNBZeLnTDpP42tA4C8ga+jXnuhsNQj5ZoW1AmsLwMJZIOTFF9GgVQghTKVq99Vn0nmS7g3MUJ6bfSlJwyusfiq5kVAnYOlGIbXVY/VzuFLkvJ8m2vUshKI4LjiLrmZ7vOOplFGpcQJVHQcQGnWw/yF3JkvI0sfaJQYZmmcu1JUn1mi1JkG4pen8SZjrVdUHGDz++Q8FI7JKjsYKS1f3JKtOPuNvsBBDU7bOO8NvNowKlzBbJvDLNA+7St+B3NNbVou39ho/a5uPmDRMYLJDQFGolpo3FXIxxOc7cTtgq6k/pGVFDeZ57EYiZ6CkdxcuwAH1K9L7mEwiX6NE4JJUlZtifQO+r/HzFuximX9UL6+B7b7Vdv8hRM4k5qc2B88KEbzwUEOLMrA/rAIsVzBQR8dYjf+FQfsxuvcgSiiZlgZK0uxHH4PJ0yizvsuhezJM/5yL5rzr6a6KYuEkw6ftIXD1VFF6vHNIoed+sxSPpDUtWpIo= 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)(366004)(136003)(346002)(39860400002)(396003)(376002)(7696005)(76116006)(2906002)(64756008)(86362001)(6506007)(66556008)(4326008)(66446008)(66476007)(71200400001)(478600001)(53546011)(30864003)(66946007)(186003)(9686003)(52536014)(8936002)(5660300002)(26005)(316002)(110136005)(54906003)(8676002)(83380400001)(38100700002)(122000001)(33656002)(55016002)(579004)(559001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?Vjpf8v4Ebgcjg5wkcjju5Ow5hdVTGXnqoT0V4xtebWWHXV4Bq4ptxFK/dzzg?= =?us-ascii?Q?QoOBlymYfNds3bK7nJN82QVCKIkiMqDyEOk8JYZsJEjbOya2vzNQniRouI8C?= =?us-ascii?Q?47yCDl4RwOgabaRTcUzF5LPZ4kCRpIKlnfboCwZJzZ9LDxlycZB5wcYFSrnv?= =?us-ascii?Q?d9tvGCrw6pLKqRBES5FsakW05VW+TrzoNH4sT+1bBUsBFw4ZFN2Rcr1re46Y?= =?us-ascii?Q?kvgjQhiXMXcKg6+uTwgLbcm7A2ZVBOkuSKDHKAR0AjTfIallI7x8Zcd7Y1e/?= =?us-ascii?Q?17V2mkzI+9XPfckTrGlETDExFxwBWNyYdTTMSF3JwvvnKd+qPuw/Mfp/hpr7?= =?us-ascii?Q?wq5/qTpGNigpi+ckNv+ZgiTenhlTeMzpHA1KJFmcuZnjRFgFVtlxdkSxv+pW?= =?us-ascii?Q?PNGm0HOFynS+2uI7iLKqdGaMlBXG1cBwRWyH2rnVefgTs8FnEK1dUoNgTet+?= =?us-ascii?Q?yVlExuNI1PmoYCDT3s/tT6FuavVA6uzoka/fTpL3Ev4SGsbKAqi+DABMGhPS?= =?us-ascii?Q?m53gbFpXT+vroq3iD/TCXzaxNtlcYjqonFpJNW96YF2raRRyyr2FKrGbF5O/?= =?us-ascii?Q?3XqqkbdjyPS80MEhfVGDNhu1SsWZYqU8o+wu/d3xTkzfgAYJ43CdhWR5NycI?= =?us-ascii?Q?x3ns2V107GjrKY/Ao5gZG8gzfsj+G9moXZ2FctyX8ZmPgA/j7/GvrGE8BLut?= =?us-ascii?Q?4g4y3PFvxxTpU2iZn5FicDfCofam4mnPVA29P5yQv1kDYOiChId9xPV5bxhV?= =?us-ascii?Q?q//PQQWvGn40D/+ZvFtlvfsN5yVwBV7Us8aQ9m0BUVZQ65FjGjiJnI6cLVYg?= =?us-ascii?Q?3w1lji7cKPsybFuTr2IOBrRgjcDF7g5Cejs5czC4DLVKwRU64q+Q+6ZjOww4?= =?us-ascii?Q?mNweCI6jVj3fw24MzgH3xJtsWiH1Hl6CP0wS1ar8HHIcfxteHRZZMAxZxUt4?= =?us-ascii?Q?L1ZiDrNt0RTkCyCVjeXlf7RoSBU4DNiiXZX8cyZIuwuoyZdlCferuI7ORDaR?= =?us-ascii?Q?bDWC017dCK1N6uVBBhd4xRcR/4ja5mlRRHa0pfLYa9Eup0UU2iNkpMntRvED?= =?us-ascii?Q?8GXhyDuIR5G86VDh0oEYKVcal9S/pgaR7ioY+rCsB+iW5L+zkTTOPeCaWNfT?= =?us-ascii?Q?YvAkpYJbxDIbOmEZAYE3xQN1fmZFGNqedC143GvfisDFddv3y9ivBMNlVYML?= =?us-ascii?Q?QN51sBvCvPr9PDGJNuCo2vFrpEI/PU5d0eAjrFM3Q1j20zPeQxDRNgTLMxEN?= =?us-ascii?Q?Ae2ESHCKbg6vodMRRBVxc9TCjD2hGlwrWFXagVpW02XBQBZnDWrBDGKrwaCd?= =?us-ascii?Q?r5FvuynEhYGjr2gT5dNKQBrk?= 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: e0707925-df7f-4c15-1d45-08d900b42eba X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Apr 2021 08:46:52.7068 (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: C2ymuEamemoq5sOQyeZYEECgFy/my6/R7T+dSsCgrlKzUWLELtkadWcPguB8VF5RVg68xbG9iYsOSXZ1n8sDZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2987 Subject: Re: [dpdk-dev] [PATCH v2 2/2] app/testpmd: add CLI for conntrack 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 Bing, 1. you are missing the documentation patch. doc/guides/testpmd_app_ug/testpmd_funcs.rst please make sure that you add examples at the and of fil. you can see example in the integrity patch. > -----Original Message----- > From: Bing Zhao > Sent: Thursday, April 15, 2021 7:41 PM > Subject: [PATCH v2 2/2] app/testpmd: add CLI for conntrack >=20 > The command line for testing connection tracking is added. To create > a conntrack object, 3 parts are needed. > set conntrack com peer ... > set conntrack orig scale ... > set conntrack rply scale ... > This will create a full conntrack action structure for the indirect > action. After the indirect action handle of "conntrack" created, it > could be used in the flow creation. Before updating, the same > structure is also needed together with the update command > "conntrack_update" to update the "dir" or "ctx". >=20 > After the flow with conntrack action created, the packet should jump > to the next flow for the result checking with conntrack item. The > state is defined with bits and a valid combination could be > supported. >=20 Can you please add more detail examples? Also what is the command to update and use the connection tracking action a= nd item. > Signed-off-by: Bing Zhao > --- > app/test-pmd/cmdline.c | 354 ++++++++++++++++++++++++++++++++++++ > app/test-pmd/cmdline_flow.c | 92 ++++++++++ > app/test-pmd/config.c | 65 ++++++- > app/test-pmd/testpmd.h | 2 + > 4 files changed, 512 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index c28a3d2e5d..58ab7191d6 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -13618,6 +13618,358 @@ cmdline_parse_inst_t > cmd_set_mplsoudp_decap_with_vlan =3D { > }, > }; >=20 > +/** Set connection tracking object common details */ > +struct cmd_set_conntrack_common_result { > + cmdline_fixed_string_t set; > + cmdline_fixed_string_t conntrack; > + cmdline_fixed_string_t common; > + cmdline_fixed_string_t peer; > + cmdline_fixed_string_t is_orig; > + cmdline_fixed_string_t enable; > + cmdline_fixed_string_t live; > + cmdline_fixed_string_t sack; > + cmdline_fixed_string_t cack; > + cmdline_fixed_string_t last_dir; > + cmdline_fixed_string_t liberal; > + cmdline_fixed_string_t state; > + cmdline_fixed_string_t max_ack_win; > + cmdline_fixed_string_t retrans; > + cmdline_fixed_string_t last_win; > + cmdline_fixed_string_t last_seq; > + cmdline_fixed_string_t last_ack; > + cmdline_fixed_string_t last_end; > + cmdline_fixed_string_t last_index; > + uint8_t stat; > + uint8_t factor; > + uint16_t peer_port; > + uint32_t is_original; > + uint32_t en; > + uint32_t is_live; > + uint32_t s_ack; > + uint32_t c_ack; > + uint32_t ld; > + uint32_t lb; > + uint8_t re_num; > + uint8_t li; > + uint16_t lw; > + uint32_t ls; > + uint32_t la; > + uint32_t le; Why not use full names? > +}; > + > +cmdline_parse_token_string_t cmd_set_conntrack_set =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + set, "set"); > +cmdline_parse_token_string_t cmd_set_conntrack_conntrack =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + conntrack, "conntrack"); > +cmdline_parse_token_string_t cmd_set_conntrack_conntrack =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + common, "com"); > +cmdline_parse_token_string_t cmd_set_conntrack_common_peer =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + peer, "peer"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_peer_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + peer_port, RTE_UINT16); > +cmdline_parse_token_string_t cmd_set_conntrack_common_is_orig =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + is_orig, "is_orig"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_is_orig_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + is_original, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_enable =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + enable, "enable"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_enable_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + en, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_live =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + live, "live"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_live_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + is_live, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_sack =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + sack, "sack"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_sack_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + s_ack, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_cack =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + cack, "cack"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_cack_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + c_ack, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_last_dir =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + last_dir, "last_dir"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_last_dir_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + ld, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_liberal =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + liberal, "liberal"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_liberal_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + lb, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_state =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + state, "state"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_state_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + stat, RTE_UINT8); > +cmdline_parse_token_string_t cmd_set_conntrack_common_max_ackwin =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + max_ack_win, "max_ack_win"); > +cmdline_parse_token_num_t > cmd_set_conntrack_common_max_ackwin_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + factor, RTE_UINT8); > +cmdline_parse_token_string_t cmd_set_conntrack_common_retrans =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + retrans, "r_lim"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_retrans_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + re_num, RTE_UINT8); > +cmdline_parse_token_string_t cmd_set_conntrack_common_last_win =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + last_win, "last_win"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_last_win_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + lw, RTE_UINT16); > +cmdline_parse_token_string_t cmd_set_conntrack_common_last_seq =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + last_seq, "last_seq"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_last_seq_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + ls, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_last_ack =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + last_ack, "last_ack"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_last_ack_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + la, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_last_end =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + last_end, "last_end"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_last_end_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + le, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_common_last_index =3D > + TOKEN_STRING_INITIALIZER(struct > cmd_set_conntrack_common_result, > + last_index, "last_index"); > +cmdline_parse_token_num_t cmd_set_conntrack_common_last_index_value > =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result, > + li, RTE_UINT8); > + > +static void cmd_set_conntrack_common_parsed(void *parsed_result, > + __rte_unused struct cmdline *cl, > + __rte_unused void *data) > +{ > + struct cmd_set_conntrack_common_result *res =3D parsed_result; > + > + /* No need to swap to big endian. */ > + conntrack_context.peer_port =3D res->peer_port; > + conntrack_context.is_original_dir =3D res->is_original; > + conntrack_context.enable =3D res->en; > + conntrack_context.live_connection =3D res->is_live; > + conntrack_context.selective_ack =3D res->s_ack; > + conntrack_context.challenge_ack_passed =3D res->c_ack; > + conntrack_context.last_direction =3D res->ld; > + conntrack_context.liberal_mode =3D res->lb; > + conntrack_context.state =3D (enum rte_flow_conntrack_state)res->stat; > + conntrack_context.max_ack_window =3D res->factor; > + conntrack_context.retransmission_limit =3D res->re_num; > + conntrack_context.last_window =3D res->lw; > + conntrack_context.last_index =3D > + (enum rte_flow_conntrack_tcp_last_index)res->li; > + conntrack_context.last_seq =3D res->ls; > + conntrack_context.last_ack =3D res->la; > + conntrack_context.last_end =3D res->le; > +} > + > +cmdline_parse_inst_t cmd_set_conntrack_common =3D { > + .f =3D cmd_set_conntrack_common_parsed, > + .data =3D NULL, > + .help_str =3D "set conntrack com peer is_orig enable > " > + " live sack cack last_dir " > + " liberal state max_ack_win r_lim " > + " last_win last_seq last_ack last_end > " > + " last_index ", > + .tokens =3D { > + (void *)&cmd_set_conntrack_set, > + (void *)&cmd_set_conntrack_conntrack, > + (void *)&cmd_set_conntrack_common_peer, > + (void *)&cmd_set_conntrack_common_peer_value, > + (void *)&cmd_set_conntrack_common_is_orig, > + (void *)&cmd_set_conntrack_common_is_orig_value, > + (void *)&cmd_set_conntrack_common_enable, > + (void *)&cmd_set_conntrack_common_enable_value, > + (void *)&cmd_set_conntrack_common_live, > + (void *)&cmd_set_conntrack_common_live_value, > + (void *)&cmd_set_conntrack_common_sack, > + (void *)&cmd_set_conntrack_common_sack_value, > + (void *)&cmd_set_conntrack_common_cack, > + (void *)&cmd_set_conntrack_common_cack_value, > + (void *)&cmd_set_conntrack_common_last_dir, > + (void *)&cmd_set_conntrack_common_last_dir_value, > + (void *)&cmd_set_conntrack_common_liberal, > + (void *)&cmd_set_conntrack_common_liberal_value, > + (void *)&cmd_set_conntrack_common_state, > + (void *)&cmd_set_conntrack_common_state_value, > + (void *)&cmd_set_conntrack_common_max_ackwin, > + (void *)&cmd_set_conntrack_common_max_ackwin_value, > + (void *)&cmd_set_conntrack_common_retrans, > + (void *)&cmd_set_conntrack_common_retrans_value, > + (void *)&cmd_set_conntrack_common_last_win, > + (void *)&cmd_set_conntrack_common_last_win_value, > + (void *)&cmd_set_conntrack_common_last_seq, > + (void *)&cmd_set_conntrack_common_last_seq_value, > + (void *)&cmd_set_conntrack_common_last_ack, > + (void *)&cmd_set_conntrack_common_last_ack_value, > + (void *)&cmd_set_conntrack_common_last_end, > + (void *)&cmd_set_conntrack_common_last_end_value, > + (void *)&cmd_set_conntrack_common_last_index, > + (void *)&cmd_set_conntrack_common_last_index_value, > + NULL, > + }, > +}; > + > +/** Set connection tracking object both directions' details */ > +struct cmd_set_conntrack_dir_result { > + cmdline_fixed_string_t set; > + cmdline_fixed_string_t conntrack; > + cmdline_fixed_string_t dir; > + cmdline_fixed_string_t scale; > + cmdline_fixed_string_t fin; > + cmdline_fixed_string_t ack_seen; > + cmdline_fixed_string_t unack; > + cmdline_fixed_string_t sent_end; > + cmdline_fixed_string_t reply_end; > + cmdline_fixed_string_t max_win; > + cmdline_fixed_string_t max_ack; > + uint32_t factor; > + uint32_t f; > + uint32_t as; > + uint32_t un; > + uint32_t se; > + uint32_t re; > + uint32_t mw; > + uint32_t ma; > +}; > + > +cmdline_parse_token_string_t cmd_set_conntrack_dir_set =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + set, "set"); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_conntrack =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + conntrack, "conntrack"); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_dir =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + dir, "orig#rply"); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_scale =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + scale, "scale"); > +cmdline_parse_token_num_t cmd_set_conntrack_dir_scale_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result, > + factor, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_fin =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + fin, "fin"); > +cmdline_parse_token_num_t cmd_set_conntrack_dir_fin_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result, > + f, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_ack =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + ack_seen, "acked"); > +cmdline_parse_token_num_t cmd_set_conntrack_dir_ack_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result, > + as, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_unack_data =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + unack, "unack_data"); > +cmdline_parse_token_num_t cmd_set_conntrack_dir_unack_data_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result, > + un, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_sent_end =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + sent_end, "sent_end"); > +cmdline_parse_token_num_t cmd_set_conntrack_dir_sent_end_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result, > + se, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_reply_end =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + reply_end, "reply_end"); > +cmdline_parse_token_num_t cmd_set_conntrack_dir_reply_end_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result, > + re, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_max_win =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + max_win, "max_win"); > +cmdline_parse_token_num_t cmd_set_conntrack_dir_max_win_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result, > + mw, RTE_UINT32); > +cmdline_parse_token_string_t cmd_set_conntrack_dir_max_ack =3D > + TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result, > + max_ack, "max_ack"); > +cmdline_parse_token_num_t cmd_set_conntrack_dir_max_ack_value =3D > + TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result, > + ma, RTE_UINT32); > + > +static void cmd_set_conntrack_dir_parsed(void *parsed_result, > + __rte_unused struct cmdline *cl, > + __rte_unused void *data) > +{ > + struct cmd_set_conntrack_dir_result *res =3D parsed_result; > + struct rte_flow_tcp_dir_param *dir =3D NULL; > + > + if (strcmp(res->dir, "orig") =3D=3D 0) > + dir =3D &conntrack_context.original_dir; > + else if (strcmp(res->dir, "rply") =3D=3D 0) > + dir =3D &conntrack_context.reply_dir; > + else > + return; > + dir->scale =3D res->factor; > + dir->close_initiated =3D res->f; > + dir->last_ack_seen =3D res->as; > + dir->data_unacked =3D res->un; > + dir->sent_end =3D res->se; > + dir->reply_end =3D res->re; > + dir->max_ack =3D res->ma; > + dir->max_win =3D res->mw; > +} > + > +cmdline_parse_inst_t cmd_set_conntrack_dir =3D { > + .f =3D cmd_set_conntrack_dir_parsed, > + .data =3D NULL, > + .help_str =3D "set conntrack orig|rply scale fin " > + " acked unack_data sent_end " > + " reply_end max_win max_ack ", > + .tokens =3D { > + (void *)&cmd_set_conntrack_set, > + (void *)&cmd_set_conntrack_conntrack, > + (void *)&cmd_set_conntrack_dir_dir, > + (void *)&cmd_set_conntrack_dir_scale, > + (void *)&cmd_set_conntrack_dir_scale_value, > + (void *)&cmd_set_conntrack_dir_fin, > + (void *)&cmd_set_conntrack_dir_fin_value, > + (void *)&cmd_set_conntrack_dir_ack, > + (void *)&cmd_set_conntrack_dir_ack_value, > + (void *)&cmd_set_conntrack_dir_unack_data, > + (void *)&cmd_set_conntrack_dir_unack_data_value, > + (void *)&cmd_set_conntrack_dir_sent_end, > + (void *)&cmd_set_conntrack_dir_sent_end_value, > + (void *)&cmd_set_conntrack_dir_reply_end, > + (void *)&cmd_set_conntrack_dir_reply_end_value, > + (void *)&cmd_set_conntrack_dir_max_win, > + (void *)&cmd_set_conntrack_dir_max_win_value, > + (void *)&cmd_set_conntrack_dir_max_ack, > + (void *)&cmd_set_conntrack_dir_max_ack_value, > + NULL, > + }, > +}; > + > /* Strict link priority scheduling mode setting */ > static void > cmd_strict_link_prio_parsed( > @@ -17117,6 +17469,8 @@ cmdline_parse_ctx_t main_ctx[] =3D { > (cmdline_parse_inst_t *)&cmd_set_mplsoudp_encap_with_vlan, > (cmdline_parse_inst_t *)&cmd_set_mplsoudp_decap, > (cmdline_parse_inst_t *)&cmd_set_mplsoudp_decap_with_vlan, > + (cmdline_parse_inst_t *)&cmd_set_conntrack_common, > + (cmdline_parse_inst_t *)&cmd_set_conntrack_dir, > (cmdline_parse_inst_t *)&cmd_ddp_add, > (cmdline_parse_inst_t *)&cmd_ddp_del, > (cmdline_parse_inst_t *)&cmd_ddp_get_list, > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index d83dec942a..fc5e31be5e 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -289,6 +289,7 @@ enum index { > ITEM_GENEVE_OPT_TYPE, > ITEM_GENEVE_OPT_LENGTH, > ITEM_GENEVE_OPT_DATA, > + ITEM_CONNTRACK, >=20 > /* Validate/create actions. */ > ACTIONS, > @@ -427,6 +428,10 @@ enum index { > ACTION_MODIFY_FIELD_SRC_OFFSET, > ACTION_MODIFY_FIELD_SRC_VALUE, > ACTION_MODIFY_FIELD_WIDTH, > + ACTION_CONNTRACK, > + ACTION_CONNTRACK_UPDATE, > + ACTION_CONNTRACK_UPDATE_DIR, > + ACTION_CONNTRACK_UPDATE_CTX, > }; >=20 > /** Maximum size for pattern in struct rte_flow_item_raw. */ > @@ -565,6 +570,8 @@ struct mplsoudp_encap_conf mplsoudp_encap_conf; >=20 > struct mplsoudp_decap_conf mplsoudp_decap_conf; >=20 > +struct rte_flow_action_conntrack conntrack_context; > + > #define ACTION_SAMPLE_ACTIONS_NUM 10 > #define RAW_SAMPLE_CONFS_MAX_NUM 8 > /** Storage for struct rte_flow_action_sample including external data. *= / > @@ -956,6 +963,7 @@ static const enum index next_item[] =3D { > ITEM_PFCP, > ITEM_ECPRI, > ITEM_GENEVE_OPT, > + ITEM_CONNTRACK, > END_SET, > ZERO, > }; > @@ -1370,6 +1378,8 @@ static const enum index next_action[] =3D { > ACTION_SAMPLE, > ACTION_INDIRECT, > ACTION_MODIFY_FIELD, > + ACTION_CONNTRACK, > + ACTION_CONNTRACK_UPDATE, > ZERO, > }; >=20 > @@ -1638,6 +1648,13 @@ static const enum index action_modify_field_src[] = =3D > { > ZERO, > }; >=20 > +static const enum index action_update_conntrack[] =3D { > + ACTION_CONNTRACK_UPDATE_DIR, > + ACTION_CONNTRACK_UPDATE_CTX, > + ACTION_NEXT, > + ZERO, > +}; > + > static int parse_set_raw_encap_decap(struct context *, const struct toke= n *, > const char *, unsigned int, > void *, unsigned int); > @@ -1728,6 +1745,10 @@ static int > parse_vc_modify_field_id(struct context *ctx, const struct token *token, > const char *str, unsigned int len, void *buf, > unsigned int size); > +static int > +parse_vc_action_conntrack_update(struct context *ctx, const struct token > *token, > + const char *str, unsigned int len, void *buf, > + unsigned int size); > static int parse_destroy(struct context *, const struct token *, > const char *, unsigned int, > void *, unsigned int); > @@ -3373,6 +3394,13 @@ static const struct token token_list[] =3D { > (sizeof(struct rte_flow_item_geneve_opt), > ITEM_GENEVE_OPT_DATA_SIZE)), > }, > + [ITEM_CONNTRACK] =3D { > + .name =3D "conntrack", > + .help =3D "conntrack state", > + .next =3D NEXT(NEXT_ENTRY(ITEM_NEXT), > NEXT_ENTRY(UNSIGNED), > + item_param), > + .args =3D ARGS(ARGS_ENTRY(struct rte_flow_item_conntrack, > flags)), > + }, > /* Validate/create actions. */ > [ACTIONS] =3D { > .name =3D "actions", > @@ -4471,6 +4499,34 @@ static const struct token token_list[] =3D { > .call =3D parse_vc_action_sample_index, > .comp =3D comp_set_sample_index, > }, > + [ACTION_CONNTRACK] =3D { > + .name =3D "conntrack", > + .help =3D "create a conntrack object", > + .next =3D NEXT(NEXT_ENTRY(ACTION_NEXT)), > + .priv =3D PRIV_ACTION(CONNTRACK, > + sizeof(struct rte_flow_action_conntrack)), > + .call =3D parse_vc, > + }, > + [ACTION_CONNTRACK_UPDATE] =3D { > + .name =3D "conntrack_update", > + .help =3D "update a conntrack object", > + .next =3D NEXT(action_update_conntrack), > + .priv =3D PRIV_ACTION(CONNTRACK, > + sizeof(struct rte_flow_modify_conntrack)), > + .call =3D parse_vc, > + }, > + [ACTION_CONNTRACK_UPDATE_DIR] =3D { > + .name =3D "dir", > + .help =3D "update a conntrack object direction", > + .next =3D NEXT(action_update_conntrack), > + .call =3D parse_vc_action_conntrack_update, > + }, > + [ACTION_CONNTRACK_UPDATE_CTX] =3D { > + .name =3D "ctx", > + .help =3D "update a conntrack object context", > + .next =3D NEXT(action_update_conntrack), > + .call =3D parse_vc_action_conntrack_update, > + }, > /* Indirect action destroy arguments. */ > [INDIRECT_ACTION_DESTROY_ID] =3D { > .name =3D "action_id", > @@ -6277,6 +6333,42 @@ parse_vc_modify_field_id(struct context *ctx, cons= t > struct token *token, > return len; > } >=20 > +/** Parse the conntrack update, not a rte_flow_action. */ > +static int > +parse_vc_action_conntrack_update(struct context *ctx, const struct token > *token, > + const char *str, unsigned int len, void *buf, > + unsigned int size) > +{ > + struct buffer *out =3D buf; > + struct rte_flow_modify_conntrack *ct_modify =3D NULL; > + > + (void)size; > + if (ctx->curr !=3D ACTION_CONNTRACK_UPDATE_CTX && > + ctx->curr !=3D ACTION_CONNTRACK_UPDATE_DIR) > + return -1; > + /* Token name must match. */ > + if (parse_default(ctx, token, str, len, NULL, 0) < 0) > + return -1; > + ct_modify =3D (struct rte_flow_modify_conntrack *)out->args.vc.data; > + /* Nothing else to do if there is no buffer. */ > + if (!out) > + return len; > + if (ctx->curr =3D=3D ACTION_CONNTRACK_UPDATE_DIR) { > + ct_modify->new_ct.is_original_dir =3D > + conntrack_context.is_original_dir; > + ct_modify->direction =3D 1; > + } else { > + uint32_t old_dir; > + > + old_dir =3D ct_modify->new_ct.is_original_dir; > + memcpy(&ct_modify->new_ct, &conntrack_context, > + sizeof(conntrack_context)); > + ct_modify->new_ct.is_original_dir =3D old_dir; > + ct_modify->state =3D 1; > + } > + return len; > +} > + > /** Parse tokens for destroy command. */ > static int > parse_destroy(struct context *ctx, const struct token *token, > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 1eec0612a4..06143a7501 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -1483,6 +1483,11 @@ port_action_handle_create(portid_t port_id, > uint32_t id, >=20 > pia->age_type =3D > ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION; > age->context =3D &pia->age_type; > + } else if (action->type =3D=3D RTE_FLOW_ACTION_TYPE_CONNTRACK) { > + struct rte_flow_action_conntrack *ct =3D > + (struct rte_flow_action_conntrack *)(uintptr_t)(action->conf); > + > + memcpy(ct, &conntrack_context, sizeof(*ct)); > } > /* Poisoning to make sure PMDs update it in case of error. */ > memset(&error, 0x22, sizeof(error)); > @@ -1564,11 +1569,24 @@ port_action_handle_update(portid_t port_id, > uint32_t id, > { > struct rte_flow_error error; > struct rte_flow_action_handle *action_handle; > + struct port_indirect_action *pia; > + const void *update; >=20 > action_handle =3D port_action_handle_get_by_id(port_id, id); > if (!action_handle) > return -EINVAL; > - if (rte_flow_action_handle_update(port_id, action_handle, action, > + pia =3D action_get_by_id(port_id, id); > + if (!pia) > + return -EINVAL; > + switch (pia->type) { > + case RTE_FLOW_ACTION_TYPE_CONNTRACK: > + update =3D action->conf; > + break; > + default: > + update =3D action; > + break; > + } > + if (rte_flow_action_handle_update(port_id, action_handle, update, > &error)) { > return port_flow_complain(&error); > } > @@ -1621,6 +1639,51 @@ port_action_handle_query(portid_t port_id, > uint32_t id) > } > data =3D NULL; > break; > + case RTE_FLOW_ACTION_TYPE_CONNTRACK: > + if (!ret) { > + struct rte_flow_action_conntrack *ct =3D data; > + > + printf("Conntrack Context:\n" > + " Peer: %u, Flow dir: %s, Enable: %u\n" > + " Live: %u, SACK: %u, CACK: %u\n" > + " Packet dir: %s, Liberal: %u, State: %u\n" > + " Factor: %u, Retrans: %u, TCP flags: %u\n" > + " Last Seq: %u, Last ACK: %u\n" > + " Last Win: %u, Last End: %u\n", > + ct->peer_port, > + ct->is_original_dir ? "Original" : "Reply", > + ct->enable, ct->live_connection, > + ct->selective_ack, ct->challenge_ack_passed, > + ct->last_direction ? "Original" : "Reply", > + ct->liberal_mode, ct->state, > + ct->max_ack_window, ct->retransmission_limit, > + ct->last_index, ct->last_seq, ct->last_ack, > + ct->last_window, ct->last_end); > + printf(" Original Dir:\n" > + " scale: %u, fin: %u, ack seen: %u\n" > + " unacked data: %u\n Sent end: %u," > + " Reply end: %u, Max win: %u, Max ACK: %u\n", > + ct->original_dir.scale, > + ct->original_dir.close_initiated, > + ct->original_dir.last_ack_seen, > + ct->original_dir.data_unacked, > + ct->original_dir.sent_end, > + ct->original_dir.reply_end, > + ct->original_dir.max_win, > + ct->original_dir.max_ack); > + printf(" Reply Dir:\n" > + " scale: %u, fin: %u, ack seen: %u\n" > + " unacked data: %u\n Sent end: %u," > + " Reply end: %u, Max win: %u, Max ACK: %u\n", > + ct->reply_dir.scale, > + ct->reply_dir.close_initiated, > + ct->reply_dir.last_ack_seen, > + ct->reply_dir.data_unacked, > + ct->reply_dir.sent_end, ct->reply_dir.reply_end, > + ct->reply_dir.max_win, ct->reply_dir.max_ack); > + } > + data =3D NULL; > + break; > default: > printf("Indirect action %u (type: %d) on port %u doesn't" > " support query\n", id, pia->type, port_id); > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h > index d1eaaadb17..d7528f9cb5 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -630,6 +630,8 @@ extern struct mplsoudp_decap_conf > mplsoudp_decap_conf; >=20 > extern enum rte_eth_rx_mq_mode rx_mq_mode; >=20 > +extern struct rte_flow_action_conntrack conntrack_context; > + > static inline unsigned int > lcore_num(void) > { > -- > 2.19.0.windows.1