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 F2900A0559; Mon, 16 Mar 2020 14:34:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C64BD1BF30; Mon, 16 Mar 2020 14:34:19 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140048.outbound.protection.outlook.com [40.107.14.48]) by dpdk.org (Postfix) with ESMTP id 866CE2BF9 for ; Mon, 16 Mar 2020 14:34:18 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DF3LyRCNj2G5qFW/Dq2gmUcfHEmk+vC4A/ul0ymoOCGSX/0rTxlK6ppBfleX7SumlKPCO3l4kARzPzkP2jrnTYGudk+HCclqr4wv2XOMa0gA1UesBSeZL5L6qpEz/gjSvQ28ROAjfNuGnNkhc6H+PWSk2l8Pfs3RLKUmlOSTWO0fWUz3oO7ZmSO63ZVSahJyKfoveS4CJP4HeskkHoOFu4uT8hWwOiCmACOBhD5fz+gnZ2ucZxocaWlY5Z9Zb9Gq5M+F+MLom/AyWKXrLMchJUibg4f2vsjG6iXABLkj23yU3ubkWe7305PXkBYepUA7W9pIH1xWl/m/zQaa6hvgRw== 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=vXynMaqFjq9X99UlSKFtSih6hq03DlLXQtVltzxgzUw=; b=F7xR0pcQuX7KTpnsY6GBbc/B63Kn/Wor201v6Jx7s3zOs1vvF+xkCSvsYj84/FOgvT1QtqqE79KDmmPp9/tKATK2XEhGKGSnHw4mMTjcyoG2HEQWVNWE1tpA/JzhyyCFbDqnDqONn8nYjVcAA9eF//2J6n6+E1RHw5TVQFHjs0N6q3XfnhQr8skL50WuOCSF4fBAqlrtdli9A+9CVODauqCjGve50cCTO9olCjNx/qD6QHToU7nMIi2DxXQY6O+eawOIH6N8Bd+GXXOrRl2HcRRjR8TI9b84PybPMwJnBBtSIelNc2TaGGZxIkP5vfNUImqm2BQTmLRmRUWjl9/jFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vXynMaqFjq9X99UlSKFtSih6hq03DlLXQtVltzxgzUw=; b=VOIiGZkH8ZFkdR6dmHLI1lYdVWibiK5tZGZst1n5b6GK6dOfKJ/qqog2rvvEQLEYZ4div2AxeyPnQPMcnSpu3LOYNE4reuS+2AoLWvWb4ePcifhZn+CNGsxPHwPN1t/RjHtpSfWcdO3GESRqP+XjbuaFTMElu2i6GYNMbIhLqxM= Received: from AM6PR05MB5176.eurprd05.prod.outlook.com (20.177.196.158) by AM6PR05MB5781.eurprd05.prod.outlook.com (20.178.93.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.19; Mon, 16 Mar 2020 13:34:16 +0000 Received: from AM6PR05MB5176.eurprd05.prod.outlook.com ([fe80::80e9:7eb9:e770:941d]) by AM6PR05MB5176.eurprd05.prod.outlook.com ([fe80::80e9:7eb9:e770:941d%7]) with mapi id 15.20.2814.021; Mon, 16 Mar 2020 13:34:16 +0000 From: Ori Kam To: "kirankumark@marvell.com" , 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: AQHV9vXnqSlblhMn+0CfUs8xj74etKhK/nbA Date: Mon, 16 Mar 2020 13:34:16 +0000 Message-ID: References: <20200310160609.7434-1-kirankumark@marvell.com> In-Reply-To: <20200310160609.7434-1-kirankumark@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; x-originating-ip: [185.175.35.255] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b4fbfb67-bd56-4a91-676c-08d7c9aeb970 x-ms-traffictypediagnostic: AM6PR05MB5781: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 03449D5DD1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(199004)(316002)(86362001)(66946007)(66446008)(64756008)(66556008)(66476007)(52536014)(76116006)(110136005)(7416002)(8676002)(53546011)(71200400001)(81166006)(8936002)(6506007)(81156014)(2906002)(9686003)(4326008)(55016002)(33656002)(186003)(26005)(478600001)(7696005)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5781; H:AM6PR05MB5176.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5THY1JhbDzxib51oWB9wIJr7UGI+gZpw3YXTBSGq8HJqFydaCfha07l3FMq7psZyIk13TRUQwtEX8C9j0QfnmuyccBo0H8XNCE+CLCQzgV4ZvIGbVILkIbVrUpmpN28fOxsH6g0T0uLNYVY6KcHsv4LuH8RQ/nuh7wafEj6dew/8czK25m59AVcJ/1Uba0SfN72oGQCnXNwo5H0BmV9Rs1P7rcGsGfSXnSA1k1dslWUkzOqmcHc8C3nyryOyYv6+xKKa8pvhpxZPUiOE9lOBUcN4FQfM12BCEix+e7BAPKHMvqD6xCeY7wMBcxH/IL1VYaEYAeKEcyjYKKb6neJDJsVckrHRqc4yNuBOUHtSIPAA/RGcnrDoRmCghqDWenRVACL7V577wLPL/6qBiGKTHRwa1FWfXw8kgCCRasW5rILp/0fuTtJkJfFbK/gWybfZ x-ms-exchange-antispam-messagedata: tL5sUKLZ6XAi37TySm8QD+LjCZnnM3p2yHX0jUmqIR5uHkmalZ3oXRt+Ud8cV7wkJjL23AYK7JrpH75jryJJAoqGg30L5W5AAnT943/n52FaR1gMWZ05E1ZOxmVBPlGkl4lbdmkg9jMEbfiHReo/XA== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4fbfb67-bd56-4a91-676c-08d7c9aeb970 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Mar 2020 13:34:16.8404 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lNYm7JzvWws8GEBmqvOe7LWhjJ8KyhAq+jcENvPjVY+u9WTmoXEXGKrcuWU2RmgWViYOquOmIzrvlf6Gw1hXFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5781 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 Kiran, > -----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 >=20 > From: Kiran Kumar K >=20 > 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. >=20 I would like to see more detail use case, for example to which device / dev= ice type=20 will the traffic be routed to? > 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(+) >=20 > 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, > }; >=20 > +#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 >=20 > @@ -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, > }; >=20 > @@ -1369,6 +1379,11 @@ static const enum index action_set_ipv6_dscp[] =3D= { > ZERO, > }; >=20 > +static const enum index action_dbdf[] =3D { > + ACTION_NEXT, > + ZERO, > +}; > + > static int parse_set_raw_encap_decap(struct context *, const struct toke= n *, > 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, > + }, > }; >=20 > /** 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; > } >=20 > +static int > +parse_vc_action_dbdf_value(struct context *ctx, const struct token *toke= n, > + 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; I think you are missing the setting of the len value in the conf. > + return ret; > +} > + > static int > parse_vc_action_raw_encap(struct context *ctx, const struct token *token= , > 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 | > +-----------+---------------------------------+ >=20 > +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 > ~~~~~~~~~~~~~~ >=20 > 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)), > }; >=20 > 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; > }; >=20 > /** > -- > 2.17.1 Thanks, Ori