From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 16002A0559; Tue, 17 Mar 2020 11:34:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF3E52B9E; Tue, 17 Mar 2020 11:34:27 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 165B3292D for ; Tue, 17 Mar 2020 11:34:25 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02HAUfL6009944; Tue, 17 Mar 2020 03:34:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=CBO/pUx1wWfx9hnk2Zd8IKDQxspWMs5FWVbxz1A8YpU=; b=Wq4zZLjeg6qNdq/ms7iwW23Kkt0wq8GSh0+4ee8fKBoLYNrwc7vlqizgnucSxjP37bGi QLQ/3/37bj83nYCIlGPcqcoxoMavXLBmWqqi4i2Su4LmlcBFbHQCqjtEgTUcJvmTQsOa o0t1M60tRb1ilUJNI7cSgYd+QUXJGOc+yXunOLLSZFFM8g3aeSCKV4uvpN82CPDHH7Sh SKppF9VD9wmdsC+ii9uuABZFFzmdVQ7r5x5ENGyW/U5k1ODUSx/x5MZTVgilohLl5gxn 2GRJQr0wHRZ4uo11z5fPKtYuXDhA+Jrcn03uwtKi/4pHjvBmQCTgyeGGByLJkLsor8Ho rw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2yrxsmkds0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 17 Mar 2020 03:34:25 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 17 Mar 2020 03:34:23 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 17 Mar 2020 03:34:22 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Tue, 17 Mar 2020 03:34:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jjavu/c5vEdtB4pLw5h1+mhCTVzS8bK6RmgnawfMEdrewXaXtkaWrncbmxJgnZ4Yyj7ftL8UAzJWo0bplwPk7XPJ/3CuI0KJqHfnft+JnhKbHtKvMYsnDrNIMpb3SJurF3awH/ux8IvXaomnEAHU/bohWXdSvLW0o9nlE5MzrQ/HhjVk92BaoqvbCMI3BPGbCqailS4Ne9cnvXCG27jzymp0GHXeBo5yQPuu9fioR1dx51JhXQx9pZIJujnhyBrSRszXfJDeOX90/PgXMwbEpB5Yzi19I383q6SCZWB9ZNi2v6sJA0dk2HvsfQSwXn+MwojqssDSyG4GoJFgc8bWcA== 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=CBO/pUx1wWfx9hnk2Zd8IKDQxspWMs5FWVbxz1A8YpU=; b=D72EocshkP7MM/GJr+xqiJfkfBjDRqVBzCFLSu566f67DQpvNRKNCqNRbin9UACgS8d9XNnxdSmPHUtcbOFo1Fqf57fPpeZO3GI27N6LvwEPEET1REwj8bhjNBj0ePwo9QfHhck4JXHggiRdL0t6P3DrIVr4rj33BjS2QTiv9hUz1lfwHCSisbb5bMx426CPyHMrGalQ5lilObB7cZopB5B0+fmP7l0If/Jj6sf1bYpsTO3uSwjhUtnukxpxzSeOAQIsS3RkFAzzcC3PCaP6/5jCTFLRhBUjrohpy2lH+OYLmOcmg1YftVcpVg3xjUxWQECApai9jUknaoXSz/KMXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CBO/pUx1wWfx9hnk2Zd8IKDQxspWMs5FWVbxz1A8YpU=; b=dYxOshsmkczWJgWIhXcJItpMnTdLMJr0pL8YVz81zfldJSxI1DLrlS4NG+p7IwSsC61Mqn5jG6V1S42YcledE0Ygxtj3w2kCqYuPeMd5d1roburCshFO+VTC8Z9rVZHLhGa/wz3XOA7/zPGTvlBdWzFO1czLFgLZDEr7DgJKO8M= Received: from CH2PR18MB3272.namprd18.prod.outlook.com (2603:10b6:610:21::17) by CH2PR18MB3349.namprd18.prod.outlook.com (2603:10b6:610:28::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.18; Tue, 17 Mar 2020 10:34:20 +0000 Received: from CH2PR18MB3272.namprd18.prod.outlook.com ([fe80::7970:4f47:f9ce:f0e8]) by CH2PR18MB3272.namprd18.prod.outlook.com ([fe80::7970:4f47:f9ce:f0e8%4]) with mapi id 15.20.2814.021; Tue, 17 Mar 2020 10:34:20 +0000 From: Kiran Kumar Kokkilagadda To: Ori Kam , Wenzhuo Lu , "Jingjing Wu" , Bernard Iremonger , John McNamara , Marko Kovacevic , Thomas Monjalon , "Ferruh Yigit" , Andrew Rybchenko CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] ethdev: add DBDF action to RTE Flow Thread-Index: AQHV9vXlMCX5AOU+U0Sp++l44HU0zahLQUEAgAFfPBA= Date: Tue, 17 Mar 2020 10:34:20 +0000 Message-ID: References: <20200310160609.7434-1-kirankumark@marvell.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [183.82.20.88] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0f880a65-7d83-419a-2cdc-08d7ca5ec0dd x-ms-traffictypediagnostic: CH2PR18MB3349: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0345CFD558 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(136003)(366004)(396003)(39850400004)(376002)(199004)(76116006)(66946007)(66556008)(66446008)(64756008)(8676002)(6506007)(53546011)(2906002)(5660300002)(52536014)(66476007)(86362001)(478600001)(4326008)(7696005)(316002)(7416002)(110136005)(81156014)(8936002)(81166006)(9686003)(55016002)(71200400001)(186003)(26005)(33656002); DIR:OUT; SFP:1101; SCL:1; SRVR:CH2PR18MB3349; H:CH2PR18MB3272.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NvKo/ImOvv8PvQqyXgaSqMfV6iOQkNJpNzATFjjzZ+M4WH/epaZH+OY6F2/UrLcHv5PG91aBXx3HLBO8mQ448KqcB9tF2mDqRGPwF308mUJn4rvl+hYWACluV1Ay5CmQBFs9QSoNMMxfHZAFzhStXSHxREnHLO93ztC9wyA7Smh80uAu0YfvbI/kaz5cpy1npX2BpEv1PrY8Rx39Xy3le2ifG+NtcgxO0I1kzYjlwrem7Wecr+STr1zk8apH5v7fi/FUINfWSjxPmO21vBiCORla3H6AAeLFN9cbrHX2kN9kc77rpAP2k/zws8KAZbN9aMtNRfatftXGVmDkqr7kJdIAIIGRlRDMzkg6LzTpRg8PWqPd01jsEQMgx0N7pw7CtnUk4wClyU2aM7uMWkUHX5QcoCLAgnYQrBvQOx0blES0mtliYKfwil+Z/4c2o2Mj x-ms-exchange-antispam-messagedata: 0C/8PdllNLbBjueXlcsvyN9VCTSaTfOYj+qdyE0eoWHZ/FNEF5F0OqzvAIVQXGkZRu53NGymMyE5VnBo50dJID+5VO9Keh1fgTUO6CeOfJdxRN8hbQORfPs48gPqnnnGZWajMgUAxOE4aplnmuNtJg== 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-Network-Message-Id: 0f880a65-7d83-419a-2cdc-08d7ca5ec0dd X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Mar 2020 10:34:20.6592 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qxSqFo6abts6bqpUC8lm9e8x0aQt6LJ2qU6iITlYYbcM226vU6ZeBNOOKH9Ww/6NpkyEUz0MLiC57vhj/3L/OA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR18MB3349 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-17_03:2020-03-12, 2020-03-17 signatures=0 Subject: Re: [dpdk-dev] [PATCH] ethdev: add DBDF action to RTE Flow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 Ori, > -----Original Message----- > From: Ori Kam > Sent: Monday, March 16, 2020 7:04 PM > To: Kiran Kumar Kokkilagadda ; Wenzhuo Lu > ; Jingjing Wu ; Bernard > Iremonger ; John McNamara > ; Marko Kovacevic ; > Thomas Monjalon ; Ferruh Yigit > ; Andrew Rybchenko > Cc: dev@dpdk.org > Subject: [EXT] RE: [dpdk-dev] [PATCH] ethdev: add DBDF action to RTE Flow >=20 > External Email >=20 > ---------------------------------------------------------------------- > Hi Kiran, >=20 >=20 > > -----Original Message----- > > From: kirankumark@marvell.com > > Sent: Tuesday, March 10, 2020 6:06 PM > > To: Ori Kam ; Wenzhuo Lu ; > > Jingjing Wu ; Bernard Iremonger > > ; John McNamara > > ; Marko Kovacevic > > ; Thomas Monjalon ; > > Ferruh Yigit ; Andrew Rybchenko > > > > Cc: dev@dpdk.org; Kiran Kumar K > > Subject: [dpdk-dev] [PATCH] ethdev: add DBDF action to RTE Flow > > > > From: Kiran Kumar K > > > > Adding suuport to DBDF action in the RTE Flow. > > Application can specify the dbdf value using rte_flow_action_dbdf. > > Matched traffic will be sent to specified PCI DBDF device. > > > I would like to see more detail use case, for example to which device / d= evice > type will the traffic be routed to? >=20 We have the following use case. We have 2 PF's pf0, pf1 and corresponding VF's pf0_vf0 , pf1_vf0. And we ha= ve 3 applications running. 1st application on pf0 and pf1 2nd application on pf0_vf0 3rd application on pf1_vf0. We want to direct the traffic matching condition1 from application 1 (traff= ic from both pf0 & pf1) needs to send to application 2 (pf0_vf0) And matching condition2 from application 1 (traffic from both pf0 & pf1) ne= eds to send to application 3 (pf1_vf0). To summarize, we need to send traffic from pf0 to pf1_vf0 and traffic from = pf1 to pf0_vf0. In this case This DBDF action will be useful. > > Signed-off-by: Kiran Kumar K > > --- > > app/test-pmd/cmdline_flow.c | 64 ++++++++++++++++++++++++++++++ > > doc/guides/prog_guide/rte_flow.rst | 19 +++++++++ > > lib/librte_ethdev/rte_flow.c | 1 + > > lib/librte_ethdev/rte_flow.h | 16 ++++++++ > > 4 files changed, 100 insertions(+) > > > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > > index a78154502..c318b4a27 100644 > > --- a/app/test-pmd/cmdline_flow.c > > +++ b/app/test-pmd/cmdline_flow.c > > @@ -342,8 +342,17 @@ enum index { > > ACTION_SET_IPV4_DSCP_VALUE, > > ACTION_SET_IPV6_DSCP, > > ACTION_SET_IPV6_DSCP_VALUE, > > + ACTION_DBDF, > > }; > > > > +#define DBDF_KEY_LENGTH 20 > > + > > +struct action_dbdf_data { > > + struct rte_flow_action_dbdf conf; > > + uint8_t dbdf_value[DBDF_KEY_LENGTH]; }; > > + > > + > > /** Maximum size for pattern in struct rte_flow_item_raw. */ #define > > ITEM_RAW_PATTERN_SIZE 40 > > > > @@ -1144,6 +1153,7 @@ static const enum index next_action[] =3D { > > ACTION_SET_META, > > ACTION_SET_IPV4_DSCP, > > ACTION_SET_IPV6_DSCP, > > + ACTION_DBDF, > > ZERO, > > }; > > > > @@ -1369,6 +1379,11 @@ static const enum index action_set_ipv6_dscp[] = =3D { > > ZERO, > > }; > > > > +static const enum index action_dbdf[] =3D { > > + ACTION_NEXT, > > + ZERO, > > +}; > > + > > static int parse_set_raw_encap_decap(struct context *, const struct to= ken *, > > const char *, unsigned int, > > void *, unsigned int); > > @@ -1421,6 +1436,9 @@ static int parse_vc_action_mplsoudp_encap(struct > > context *, > > static int parse_vc_action_mplsoudp_decap(struct context *, > > const struct token *, const char *, > > unsigned int, void *, unsigned int); > > +static int parse_vc_action_dbdf_value(struct context *, > > + const struct token *, const char *, > > + unsigned int, void *, unsigned int); > > static int parse_vc_action_raw_encap(struct context *, > > const struct token *, const char *, > > unsigned int, void *, unsigned int); @@ - > 3684,6 +3702,18 @@ > > static const struct token token_list[] =3D { > > (struct rte_flow_action_set_dscp, dscp)), > > .call =3D parse_vc_conf, > > }, > > + [ACTION_DBDF] =3D { > > + .name =3D "dbdf", > > + .help =3D "set DBDF value", > > + .next =3D NEXT(action_dbdf, NEXT_ENTRY(STRING)), > > + .priv =3D PRIV_ACTION(DBDF, sizeof(struct action_dbdf_data)), > > + .args =3D ARGS(ARGS_ENTRY_ARB(0, 0), > > + ARGS_ENTRY_ARB(0, sizeof(uint8_t)), > > + ARGS_ENTRY_ARB( > > + offsetof(struct action_dbdf_data, dbdf_value), > > + DBDF_KEY_LENGTH)), > > + .call =3D parse_vc_action_dbdf_value, > > + }, > > }; > > > > /** Remove and return last entry from argument stack. */ @@ -5064,6 > > +5094,40 @@ parse_vc_action_raw_encap_index(struct context *ctx, const > > struct token *token, > > return len; > > } > > > > +static int > > +parse_vc_action_dbdf_value(struct context *ctx, const struct token *to= ken, > > + const char *str, unsigned int len, void *buf, > > + unsigned int size) > > +{ > > + struct buffer *out =3D buf; > > + struct rte_flow_action *action; > > + struct action_dbdf_data *action_dbdf_data =3D NULL; > > + int ret; > > + > > + ret =3D parse_vc(ctx, token, str, len, buf, size); > > + if (ret < 0) > > + return ret; > > + /* Nothing else to do if there is no buffer. */ > > + if (!out) > > + return ret; > > + if (!out->args.vc.actions_n) > > + return -1; > > + action =3D &out->args.vc.actions[out->args.vc.actions_n - 1]; > > + /* Point to selected object. */ > > + ctx->object =3D out->args.vc.data; > > + ctx->objmask =3D NULL; > > + /* Copy the headers to the buffer. */ > > + action_dbdf_data =3D ctx->object; > > + *action_dbdf_data =3D (struct action_dbdf_data) { > > + .conf =3D (struct rte_flow_action_dbdf){ > > + .dbdf_value =3D action_dbdf_data->dbdf_value, > > + }, > > + .dbdf_value =3D {}, > > + }; > > + action->conf =3D &action_dbdf_data->conf; >=20 > I think you are missing the setting of the len value in the conf. Length will be update while parsing the string (parse_string). >=20 > > + return ret; > > +} > > + > > static int > > parse_vc_action_raw_encap(struct context *ctx, const struct token *tok= en, > > const char *str, unsigned int len, void *buf, diff --git > > a/doc/guides/prog_guide/rte_flow.rst > > b/doc/guides/prog_guide/rte_flow.rst > > index 41c147913..b900e283c 100644 > > --- a/doc/guides/prog_guide/rte_flow.rst > > +++ b/doc/guides/prog_guide/rte_flow.rst > > @@ -2616,6 +2616,25 @@ Otherwise, RTE_FLOW_ERROR_TYPE_ACTION > error > > will be returned. > > | ``dscp`` | DSCP in low 6 bits, rest ignore | > > +-----------+---------------------------------+ > > > > +Action: ``DBDF`` > > +^^^^^^^^^^^^^^^^^^^^^^^^^ > > + > > +Set DBDF value. > > + > > +Send traffic to specified PCI DBDF device. > > + > > +.. _table_rte_flow_action_dbdf: > > + > > +.. table:: DBDF > > + > > + +-----------------+----------------------------+ > > + | Field | Value | > > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > > + | ``length`` | DBDF length | > > + +-----------------+----------------------------+ > > + | ``dbdf_value`` | DBDF value | > > + +-----------------+----------------------------+ > > + > > Negative types > > ~~~~~~~~~~~~~~ > > > > diff --git a/lib/librte_ethdev/rte_flow.c > > b/lib/librte_ethdev/rte_flow.c index a5ac1c7fb..6eada7785 100644 > > --- a/lib/librte_ethdev/rte_flow.c > > +++ b/lib/librte_ethdev/rte_flow.c > > @@ -172,6 +172,7 @@ static const struct rte_flow_desc_data > > rte_flow_desc_action[] =3D { > > MK_FLOW_ACTION(SET_META, sizeof(struct > rte_flow_action_set_meta)), > > MK_FLOW_ACTION(SET_IPV4_DSCP, sizeof(struct > > rte_flow_action_set_dscp)), > > MK_FLOW_ACTION(SET_IPV6_DSCP, sizeof(struct > > rte_flow_action_set_dscp)), > > + MK_FLOW_ACTION(DBDF, sizeof(struct rte_flow_action_dbdf)), > > }; > > > > int > > diff --git a/lib/librte_ethdev/rte_flow.h > > b/lib/librte_ethdev/rte_flow.h index b43238b45..b6029c282 100644 > > --- a/lib/librte_ethdev/rte_flow.h > > +++ b/lib/librte_ethdev/rte_flow.h > > @@ -2082,6 +2082,22 @@ enum rte_flow_action_type { > > * See struct rte_flow_action_set_dscp. > > */ > > RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP, > > + > > + /** > > + * Send packet to specified PCIe device > > + */ > > + RTE_FLOW_ACTION_TYPE_DBDF, > > +}; > > + > > + > > +/** > > + * RTE_FLOW_ACTION_TYPE_DBDF > > + * > > + * Send the packet to specified PCI DBDF device */ struct > > +rte_flow_action_dbdf { > > + uint8_t length; > > + const uint8_t *dbdf_value; > > }; > > > > /** > > -- > > 2.17.1 >=20 > Thanks, > Ori