From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20059.outbound.protection.outlook.com [40.107.2.59]) by dpdk.org (Postfix) with ESMTP id E82925F16 for ; Thu, 26 Apr 2018 16:06:29 +0200 (CEST) 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; bh=PCrNYWpRlr07fvEfGCKc71o3tIg5/W51xX0f0CIA/Ys=; b=V3NqXKZNdzzsoZo6Njs8OBKeztVNfqXkGrs7sF+a8cSKFrSwF+gh+p1E87yaUmc+3K4fWCHK7+oHOAw8zDhN5a1dLqsxZlm5fhPrL3ovTcnrxR26ppL0jVLYjL5H7Z05z0AwTcAwNocLiLwgLSDYt4CKXvYGt5q4LNAEw88wFH8= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.187.142) by AM4PR05MB3345.eurprd05.prod.outlook.com (10.171.187.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.715.18; Thu, 26 Apr 2018 14:06:28 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::ac8f:2b8c:c0dd:379e]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::ac8f:2b8c:c0dd:379e%4]) with mapi id 15.20.0715.018; Thu, 26 Apr 2018 14:06:28 +0000 From: Ori Kam To: Declan Doherty , "dev@dpdk.org" , Ori Kam , Matan Azrad CC: Ferruh Yigit Thread-Topic: [dpdk-dev] [PATCH v6 4/4] ethdev: add shared counter support to rte_flow Thread-Index: AQHT3ViLvn9sbrzOFkuOM9l7ogRfVKQTEcsA Date: Thu, 26 Apr 2018 14:06:28 +0000 Message-ID: References: <20180426120817.6612-1-declan.doherty@intel.com> <20180426120817.6612-5-declan.doherty@intel.com> In-Reply-To: <20180426120817.6612-5-declan.doherty@intel.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: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3345; 7:Y1o2CVk3++FMrmk0vCWjscYflROSyzrLNHWgo2VBP8os9XnbliivTj1PWwLN62xggZdZ8X/dSFR3Cf8rvh/CzukoGlqDFkkD3yzmad841TRl0Li2BHeQTNHwpC3j0h+4+gZql2ji2AbDsfPFm1iw1u1h7O9w7raAIfQMorZTwykeUmB7UqNTYLRV5VBTsQhpzaxMdkV1DQYImbU4ipEFmDxPn7jtijAi//KDZWC2fHksK8v6LB5Hjb5Z8xPgQt/3 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3345; x-ms-traffictypediagnostic: AM4PR05MB3345: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(211171220733660)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231232)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM4PR05MB3345; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3345; x-forefront-prvs: 0654257CF5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(39380400002)(376002)(396003)(39860400002)(13464003)(199004)(189003)(9686003)(3280700002)(6636002)(3660700001)(478600001)(446003)(25786009)(2501003)(68736007)(2906002)(186003)(6246003)(5250100002)(97736004)(4326008)(86362001)(8936002)(305945005)(66066001)(11346002)(81156014)(3846002)(6116002)(7736002)(81166006)(575784001)(229853002)(5660300001)(76176011)(110136005)(105586002)(7696005)(102836004)(55016002)(14454004)(74316002)(33656002)(2900100001)(6506007)(53546011)(316002)(6436002)(53946003)(53936002)(26005)(486006)(59450400001)(476003)(106356001)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3345; H:AM4PR05MB3425.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: S31Ys7ufMkT/zVGl1QgHuAUQc6vcGTPN9csAD47FysRcT4Ydsc7tKxVr3IA7oUVQ8BlPmcUhfF+mNR08P43Szk7m8G7WX9npuDCZYA9k/wramzEcy1tTM+NHH5JxP3kp363fxFNX//31DFhd8ufxUuf8cdk1wIrPlNI/lWj4xK1JUcSX/CjWPb/sG4SFJCd/ spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 002de482-ed8e-412e-51bd-08d5ab7ee7a9 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 002de482-ed8e-412e-51bd-08d5ab7ee7a9 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2018 14:06:28.2254 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3345 Subject: Re: [dpdk-dev] [PATCH v6 4/4] ethdev: add shared counter support 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: , X-List-Received-Date: Thu, 26 Apr 2018 14:06:30 -0000 Hi Declan, You are changing API (port_flow_query) which is in use in both MLX5 and MLX4 this results in breaking the build. Best, Ori > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty > Sent: Thursday, April 26, 2018 3:08 PM > To: dev@dpdk.org > Cc: Ferruh Yigit ; Declan Doherty > > Subject: [dpdk-dev] [PATCH v6 4/4] ethdev: add shared counter support to > rte_flow >=20 > Add rte_flow_action_count action data structure to enable shared > counters across multiple flows on a single port or across multiple > flows on multiple ports within the same switch domain. Also this enables > multiple count actions to be specified in a single flow action. >=20 > This patch also modifies the existing rte_flow_query API to take the > rte_flow_action structure as an input parameter instead of the > rte_flow_action_type enumeration to allow querying a specific action > from a flow rule when multiple actions of the same type are specified. >=20 > This patch also contains updates for the bonding and failsafe PMDs and > testpmd application which are affected by this API change. >=20 > Signed-off-by: Declan Doherty > --- > app/test-pmd/cmdline_flow.c | 6 ++-- > app/test-pmd/config.c | 15 +++++---- > app/test-pmd/testpmd.h | 2 +- > doc/guides/prog_guide/rte_flow.rst | 59 +++++++++++++++++++++------ > ------ > drivers/net/bonding/rte_eth_bond_flow.c | 9 ++--- > drivers/net/failsafe/failsafe_flow.c | 4 +-- > lib/librte_ether/rte_flow.c | 2 +- > lib/librte_ether/rte_flow.h | 38 +++++++++++++++++++-- > lib/librte_ether/rte_flow_driver.h | 2 +- > 9 files changed, 93 insertions(+), 44 deletions(-) >=20 > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 1ac04a0ab..5754e7858 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -420,7 +420,7 @@ struct buffer { > } destroy; /**< Destroy arguments. */ > struct { > uint32_t rule; > - enum rte_flow_action_type action; > + struct rte_flow_action action; > } query; /**< Query arguments. */ > struct { > uint32_t *group; > @@ -1101,7 +1101,7 @@ static const struct token token_list[] =3D { > .next =3D NEXT(NEXT_ENTRY(QUERY_ACTION), > NEXT_ENTRY(RULE_ID), > NEXT_ENTRY(PORT_ID)), > - .args =3D ARGS(ARGS_ENTRY(struct buffer, args.query.action), > + .args =3D ARGS(ARGS_ENTRY(struct buffer, > args.query.action.type), > ARGS_ENTRY(struct buffer, args.query.rule), > ARGS_ENTRY(struct buffer, port)), > .call =3D parse_query, > @@ -3842,7 +3842,7 @@ cmd_flow_parsed(const struct buffer *in) > break; > case QUERY: > port_flow_query(in->port, in->args.query.rule, > - in->args.query.action); > + &in->args.query.action); > break; > case LIST: > port_flow_list(in->port, in->args.list.group_n, > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 0f2425229..cd6102dfc 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -1452,7 +1452,7 @@ port_flow_flush(portid_t port_id) > /** Query a flow rule. */ > int > port_flow_query(portid_t port_id, uint32_t rule, > - enum rte_flow_action_type action) > + const struct rte_flow_action *action) > { > struct rte_flow_error error; > struct rte_port *port; > @@ -1474,15 +1474,16 @@ port_flow_query(portid_t port_id, uint32_t rule, > return -ENOENT; > } > if ((unsigned int)action >=3D RTE_DIM(flow_action) || > - !flow_action[action].name) > + !flow_action[action->type].name) > name =3D "unknown"; > else > - name =3D flow_action[action].name; > - switch (action) { > + name =3D flow_action[action->type].name; > + switch (action->type) { > case RTE_FLOW_ACTION_TYPE_COUNT: > break; > default: > - printf("Cannot query action type %d (%s)\n", action, name); > + printf("Cannot query action type %d (%s)\n", > + action->type, name); > return -ENOTSUP; > } > /* Poisoning to make sure PMDs update it in case of error. */ > @@ -1490,7 +1491,7 @@ port_flow_query(portid_t port_id, uint32_t rule, > memset(&query, 0, sizeof(query)); > if (rte_flow_query(port_id, pf->flow, action, &query, &error)) > return port_flow_complain(&error); > - switch (action) { > + switch (action->type) { > case RTE_FLOW_ACTION_TYPE_COUNT: > printf("%s:\n" > " hits_set: %u\n" > @@ -1505,7 +1506,7 @@ port_flow_query(portid_t port_id, uint32_t rule, > break; > default: > printf("Cannot display result for action type %d (%s)\n", > - action, name); > + action->type, name); > break; > } > return 0; > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h > index a33b525e2..1af87b8f4 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -620,7 +620,7 @@ int port_flow_create(portid_t port_id, > int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule= ); > int port_flow_flush(portid_t port_id); > int port_flow_query(portid_t port_id, uint32_t rule, > - enum rte_flow_action_type action); > + const struct rte_flow_action *action); > void port_flow_list(portid_t port_id, uint32_t n, const uint32_t *group)= ; > int port_flow_isolate(portid_t port_id, int set); >=20 > diff --git a/doc/guides/prog_guide/rte_flow.rst > b/doc/guides/prog_guide/rte_flow.rst > index 301f8762e..88bfc87eb 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -1277,17 +1277,19 @@ Actions are performed in list order: >=20 > .. table:: Mark, count then redirect >=20 > - +-------+--------+-----------+-------+ > - | Index | Action | 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+ > - | 0 | MARK | ``mark`` | 0x2a | > - +-------+--------+-----------+-------+ > - | 1 | COUNT | > - +-------+--------+-----------+-------+ > - | 2 | QUEUE | ``queue`` | 10 | > - +-------+--------+-----------+-------+ > - | 3 | END | > - +-------+----------------------------+ > + +-------+--------+------------+-------+ > + | Index | Action | 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+ > + | 0 | MARK | ``mark`` | 0x2a | > + +-------+--------+------------+-------+ > + | 1 | COUNT | ``shared`` | 0 | > + | | +------------+-------+ > + | | | ``id`` | 0 | > + +-------+--------+------------+-------+ > + | 2 | QUEUE | ``queue`` | 10 | > + +-------+--------+------------+-------+ > + | 3 | END | > + +-------+-----------------------------+ >=20 > | >=20 > @@ -1516,23 +1518,36 @@ Drop packets. > Action: ``COUNT`` > ^^^^^^^^^^^^^^^^^ >=20 > -Enables counters for this rule. > +Adds a counter action to a matched flow. > + > +If more than one count action is specified in a single flow rule, then e= ach > +action must specify a unique id. >=20 > -These counters can be retrieved and reset through ``rte_flow_query()``, = see > +Counters can be retrieved and reset through ``rte_flow_query()``, see > ``struct rte_flow_query_count``. >=20 > -- Counters can be retrieved with ``rte_flow_query()``. > -- No configurable properties. > +The shared flag indicates whether the counter is unique to the flow rule= the > +action is specified with, or whether it is a shared counter. > + > +For a count action with the shared flag set, then then a global device > +namespace is assumed for the counter id, so that any matched flow rules > using > +a count action with the same counter id on the same port will contribute= to > +that counter. > + > +For ports within the same switch domain then the counter id namespace > extends > +to all ports within that switch domain. >=20 > .. _table_rte_flow_action_count: >=20 > .. table:: COUNT >=20 > - +---------------+ > - | Field | > - +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > - | no properties | > - +---------------+ > + +------------+---------------------+ > + | 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+ > + | ``shared`` | shared counter flag | > + +------------+---------------------+ > + | ``id`` | counter id | > + +------------+---------------------+ >=20 > Query structure to retrieve and reset flow rule counters: >=20 > @@ -2282,7 +2297,7 @@ definition. > int > rte_flow_query(uint16_t port_id, > struct rte_flow *flow, > - enum rte_flow_action_type action, > + const struct rte_flow_action *action, > void *data, > struct rte_flow_error *error); >=20 > @@ -2290,7 +2305,7 @@ Arguments: >=20 > - ``port_id``: port identifier of Ethernet device. > - ``flow``: flow rule handle to query. > -- ``action``: action type to query. > +- ``action``: action to query, this must match prototype from flow rule. > - ``data``: pointer to storage for the associated query data type. > - ``error``: perform verbose error reporting if not NULL. PMDs initializ= e > this structure in case of error only. > diff --git a/drivers/net/bonding/rte_eth_bond_flow.c > b/drivers/net/bonding/rte_eth_bond_flow.c > index 8093c04f5..31e4bcaeb 100644 > --- a/drivers/net/bonding/rte_eth_bond_flow.c > +++ b/drivers/net/bonding/rte_eth_bond_flow.c > @@ -152,6 +152,7 @@ bond_flow_flush(struct rte_eth_dev *dev, struct > rte_flow_error *err) >=20 > static int > bond_flow_query_count(struct rte_eth_dev *dev, struct rte_flow *flow, > + const struct rte_flow_action *action, > struct rte_flow_query_count *count, > struct rte_flow_error *err) > { > @@ -165,7 +166,7 @@ bond_flow_query_count(struct rte_eth_dev *dev, > struct rte_flow *flow, > rte_memcpy(&slave_count, count, sizeof(slave_count)); > for (i =3D 0; i < internals->slave_count; i++) { > ret =3D rte_flow_query(internals->slaves[i].port_id, > - flow->flows[i], > RTE_FLOW_ACTION_TYPE_COUNT, > + flow->flows[i], action, > &slave_count, err); > if (unlikely(ret !=3D 0)) { > RTE_BOND_LOG(ERR, "Failed to query flow on" > @@ -182,12 +183,12 @@ bond_flow_query_count(struct rte_eth_dev *dev, > struct rte_flow *flow, >=20 > static int > bond_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow, > - enum rte_flow_action_type type, void *arg, > + const struct rte_flow_action *action, void *arg, > struct rte_flow_error *err) > { > - switch (type) { > + switch (action->type) { > case RTE_FLOW_ACTION_TYPE_COUNT: > - return bond_flow_query_count(dev, flow, arg, err); > + return bond_flow_query_count(dev, flow, action, arg, err); > default: > return rte_flow_error_set(err, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ACTION, > arg, > diff --git a/drivers/net/failsafe/failsafe_flow.c > b/drivers/net/failsafe/failsafe_flow.c > index a97f4075d..bfe42fcee 100644 > --- a/drivers/net/failsafe/failsafe_flow.c > +++ b/drivers/net/failsafe/failsafe_flow.c > @@ -174,7 +174,7 @@ fs_flow_flush(struct rte_eth_dev *dev, > static int > fs_flow_query(struct rte_eth_dev *dev, > struct rte_flow *flow, > - enum rte_flow_action_type type, > + const struct rte_flow_action *action, > void *arg, > struct rte_flow_error *error) > { > @@ -185,7 +185,7 @@ fs_flow_query(struct rte_eth_dev *dev, > if (sdev !=3D NULL) { > int ret =3D rte_flow_query(PORT_ID(sdev), > flow->flows[SUB_ID(sdev)], > - type, arg, error); > + action, arg, error); >=20 > if ((ret =3D fs_err(sdev, ret))) { > fs_unlock(dev, 0); > diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c > index 4f94ac9b5..7947529da 100644 > --- a/lib/librte_ether/rte_flow.c > +++ b/lib/librte_ether/rte_flow.c > @@ -233,7 +233,7 @@ rte_flow_flush(uint16_t port_id, > int > rte_flow_query(uint16_t port_id, > struct rte_flow *flow, > - enum rte_flow_action_type action, > + const struct rte_flow_action *action, > void *data, > struct rte_flow_error *error) > { > diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h > index d390bbf5a..f8ba71cdb 100644 > --- a/lib/librte_ether/rte_flow.h > +++ b/lib/librte_ether/rte_flow.h > @@ -1314,7 +1314,7 @@ enum rte_flow_action_type { > * These counters can be retrieved and reset through > rte_flow_query(), > * see struct rte_flow_query_count. > * > - * No associated configuration structure. > + * See struct rte_flow_action_count. > */ > RTE_FLOW_ACTION_TYPE_COUNT, >=20 > @@ -1546,6 +1546,38 @@ struct rte_flow_action_queue { > uint16_t index; /**< Queue index to use. */ > }; >=20 > + > +/** > + * @warning > + * @b EXPERIMENTAL: this structure may change without prior notice > + * > + * RTE_FLOW_ACTION_TYPE_COUNT > + * > + * Adds a counter action to a matched flow. > + * > + * If more than one count action is specified in a single flow rule, the= n each > + * action must specify a unique id. > + * > + * Counters can be retrieved and reset through ``rte_flow_query()``, see > + * ``struct rte_flow_query_count``. > + * > + * The shared flag indicates whether the counter is unique to the flow r= ule > the > + * action is specified with, or whether it is a shared counter. > + * > + * For a count action with the shared flag set, then then a global devic= e > + * namespace is assumed for the counter id, so that any matched flow rul= es > using > + * a count action with the same counter id on the same port will contrib= ute > to > + * that counter. > + * > + * For ports within the same switch domain then the counter id namespace > extends > + * to all ports within that switch domain. > + */ > +struct rte_flow_action_count { > + uint32_t shared:1; /**< Share counter ID with other flow rules. */ > + uint32_t reserved:31; /**< Reserved, must be zero. */ > + uint32_t id; /**< Counter ID. */ > +}; > + > /** > * RTE_FLOW_ACTION_TYPE_COUNT (query) > * > @@ -2044,7 +2076,7 @@ rte_flow_flush(uint16_t port_id, > * @param flow > * Flow rule handle to query. > * @param action > - * Action type to query. > + * Action definition as defined in original flow rule. > * @param[in, out] data > * Pointer to storage for the associated query data type. > * @param[out] error > @@ -2057,7 +2089,7 @@ rte_flow_flush(uint16_t port_id, > int > rte_flow_query(uint16_t port_id, > struct rte_flow *flow, > - enum rte_flow_action_type action, > + const struct rte_flow_action *action, > void *data, > struct rte_flow_error *error); >=20 > diff --git a/lib/librte_ether/rte_flow_driver.h > b/lib/librte_ether/rte_flow_driver.h > index 3800310ba..1c90c600d 100644 > --- a/lib/librte_ether/rte_flow_driver.h > +++ b/lib/librte_ether/rte_flow_driver.h > @@ -88,7 +88,7 @@ struct rte_flow_ops { > int (*query) > (struct rte_eth_dev *, > struct rte_flow *, > - enum rte_flow_action_type, > + const struct rte_flow_action *, > void *, > struct rte_flow_error *); > /** See rte_flow_isolate(). */ > -- > 2.14.3