From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0047.outbound.protection.outlook.com [104.47.0.47]) by dpdk.org (Postfix) with ESMTP id 5D1A22C52 for ; Sun, 21 Oct 2018 11:20:53 +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:X-MS-Exchange-SenderADCheck; bh=vaebt6oa3IQH8M3AotTA5/U+C916/l0eB2BnNEgqlMY=; b=C7c4fYCYqfKWBcEFnhkMiQmMzO3x4VDMJaHyXHnBX6wX3O/up9806Z11XXjMo7YHPY8lpIrpaKMpC4frY2TEJrJJXQ4IYgS8jfzisqeHcTXM2MAeBORSj9zaOL4mn6liguZdPeaWC2rb2PSWiP1jlRWjtRw4ifgjjrsqjedr3+0= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4891.eurprd05.prod.outlook.com (20.176.235.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.25; Sun, 21 Oct 2018 09:20:52 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::80e:e6b:baf2:d973]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::80e:e6b:baf2:d973%3]) with mapi id 15.20.1250.028; Sun, 21 Oct 2018 09:20:52 +0000 From: Shahaf Shuler To: Slava Ovsiienko , Yongseok Koh CC: "dev@dpdk.org" Thread-Topic: [PATCH v3 5/6] net/mlx5: flow counters query function move and rename Thread-Index: AQHUZ7908Q+Cau/mAkiYuPR9DpTE7aUpaGNw Date: Sun, 21 Oct 2018 09:20:52 +0000 Message-ID: References: <1539784438-29242-1-git-send-email-viacheslavo@mellanox.com> <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com> <1539962470-10950-6-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1539962470-10950-6-git-send-email-viacheslavo@mellanox.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=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4891; 6:myuHzi/BYOLBezXLm3wWRU4uG4q8JVcx7q7JTIovmkm+EeOuAwERn0xm5dqIOlzENORDnc2Wr/tTLCApj25t2gIkouarTYxm/LwyEvrLhUDyDUQRw8KUwy3iKguLhAVaslQ0XfNZ7mjWTVsVkEDLvZX9VJ3ViGDP/P/Ok0x1awHHNi7zFgXI5ZEUGohYSSCvjDzzrEskVv+UkunVeK3CWfGz/uho606atfON5+nGS5rkLefJfdP85J+C2gPRtcNv0wXwyYDTgLvX6A4Ka9J4+ybP38bRbZF69FogBAKVfDbexOWpKhcly9+P1O1BAbFaPwJEcqtG/KxybOv0AMfJySMynV+Imr8SxWo0lJRhCXnGNV7l3/QB/H60f+QRXo9joWj5RoJF/lqN9PYe+49WLlxNUKi6Xe/9ZNHnI542hnBOru4k5plRgDg/tXsa4Z9pvqBNlaUUsAr/CMlC9Zf2TQ==; 5:/xylSDH/28USV2WKvgkXNIlSShSDb/WlgBWK4uCLZrsLmwQO0pOzwPJuk1EtuclZUw27Zd6asBBliFuV/T2sztqADe1EtpHuuRZxBZXsBZttjn4cpeeqiqFW1VqY/WILjjKHICsW+WTIZa7BMpAgxZ2PSQSRe51QvqHwcI78nzs=; 7:gNBz4+BXK3LfmCMGx65pSBTmJuTA95gfbVLKDBnEWkAjNbhnNe8P3tWFNSp2qNi3eAhmSh09uuPUy64NJ0Ld4139n+enS3SJE1KKxcUJOK3ZrsnefCN/KX2S6F2qVTlTKbobZEqb2exZR+xaxANUSRUg6950n1Czr3WvRptJGpXI+7f+CuUh53yPB6b+ECjEfQ5G2Pu5rOmjoMxtngtHH5SvDU9XtDUo+rFsD8Rm8zAqYtbfjUxmBSv1kByOXhUy x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 56ccd35c-74a8-401b-aed4-08d637367f6a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4891; x-ms-traffictypediagnostic: DB7PR05MB4891: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:DB7PR05MB4891; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4891; x-forefront-prvs: 083289FD26 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(396003)(376002)(39860400002)(346002)(199004)(189003)(33656002)(68736007)(74316002)(476003)(305945005)(81166006)(486006)(81156014)(2906002)(316002)(7736002)(97736004)(71200400001)(71190400001)(14454004)(6246003)(478600001)(6116002)(3846002)(5250100002)(2900100001)(14444005)(7696005)(5660300001)(26005)(9686003)(76176011)(66066001)(86362001)(186003)(25786009)(102836004)(55016002)(256004)(53936002)(4326008)(6636002)(99286004)(446003)(110136005)(106356001)(229853002)(8936002)(6506007)(8676002)(11346002)(6436002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4891; H:DB7PR05MB4426.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: g7VmpmsUllSa0mGELFpxYwGDOxPynZiqY3aZRaaNTbwxqO+/5Th/uHvgVBoUjppW+rHmD63bkW9/32iUmkvxSx+UCh3i6Lftu1VVULv66ezszPPi2xXYjKveN1TvGGK5mHIbjddmAfqmIu+2RaJXbL3XjbdNJdYXFsZVoz7retaz6MTMRvYbsXUVZ8qG5tqmXdqf+/nFlBHNB8Xu8f7M8lkdc287H8HmyEcZZ8RQWmHak7kqkQkq4hoadGOsKgsFSS8Qxed9vKQgcbWhdNgcSOt54iXKKfoUwXyDKwKZfdjm7KZhAW4Z9bnbXf1Ncyq22eTbcb+bMCvtwLkBrggw6mdro7ghaHU41IWuoukLjIA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: 56ccd35c-74a8-401b-aed4-08d637367f6a X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Oct 2018 09:20:52.3622 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4891 Subject: Re: [dpdk-dev] [PATCH v3 5/6] net/mlx5: flow counters query function move and rename 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: Sun, 21 Oct 2018 09:20:53 -0000 Friday, October 19, 2018 6:21 PM, Slava Ovsiienko: > Subject: [PATCH v3 5/6] net/mlx5: flow counters query function move and > rename How about: "net/mlx5: relocate flow counter query function"=20 This patch should come before the glue library update >=20 > The flow_verbs_query_count() is moved into the the group of counter > managing functions and renamed to flow_verbs_counter_query() in order to > be in unified fashion with others. The tcf engine has the same naming. However since you add new ones on the n= ext commit it is OK.=20 Will think if we want to rename tcf one later.=20 >=20 > Also minor function modification is made to avoid unreachable code warnin= gs > if there is no counter support at compile time. >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_flow_verbs.c | 111 +++++++++++++++++++---------- > -------- > 1 file changed, 56 insertions(+), 55 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c > b/drivers/net/mlx5/mlx5_flow_verbs.c > index 3d6fedb..f720c35 100644 > --- a/drivers/net/mlx5/mlx5_flow_verbs.c > +++ b/drivers/net/mlx5/mlx5_flow_verbs.c > @@ -110,6 +110,61 @@ > } >=20 > /** > + * Query a flow counter via Verbs library call. > + * > + * @see rte_flow_query() > + * @see rte_flow_ops > + */ > +static int > +flow_verbs_counter_query(struct rte_eth_dev *dev __rte_unused, > + struct rte_flow *flow __rte_unused, > + void *data __rte_unused, > + struct rte_flow_error *error) > +{ > +#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42 > + if (flow->actions & MLX5_FLOW_ACTION_COUNT) { > + struct rte_flow_query_count *qc =3D data; > + uint64_t counters[2] =3D {0, 0}; > + struct ibv_query_counter_set_attr query_cs_attr =3D { > + .cs =3D flow->counter->cs, > + .query_flags =3D IBV_COUNTER_SET_FORCE_UPDATE, > + }; > + struct ibv_counter_set_data query_out =3D { > + .out =3D counters, > + .outlen =3D 2 * sizeof(uint64_t), > + }; > + int err =3D mlx5_glue->query_counter_set(&query_cs_attr, > + &query_out); > + > + if (err) > + return rte_flow_error_set > + (error, err, > + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "cannot read counter"); > + qc->hits_set =3D 1; > + qc->bytes_set =3D 1; > + qc->hits =3D counters[0] - flow->counter->hits; > + qc->bytes =3D counters[1] - flow->counter->bytes; > + if (qc->reset) { > + flow->counter->hits =3D counters[0]; > + flow->counter->bytes =3D counters[1]; > + } > + return 0; > + } > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "flow does not have counter"); > +#else > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "counters are not available"); > +#endif > +} > + > +/** > * Add a verbs item specification into @p flow. > * > * @param[in, out] flow > @@ -1654,60 +1709,6 @@ > } >=20 > /** > - * Query a flows. > - * > - * @see rte_flow_query() > - * @see rte_flow_ops > - */ > -static int > -flow_verbs_query_count(struct rte_eth_dev *dev __rte_unused, > - struct rte_flow *flow __rte_unused, > - void *data __rte_unused, > - struct rte_flow_error *error) > -{ > -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42 > - if (flow->actions & MLX5_FLOW_ACTION_COUNT) { > - struct rte_flow_query_count *qc =3D data; > - uint64_t counters[2] =3D {0, 0}; > - struct ibv_query_counter_set_attr query_cs_attr =3D { > - .cs =3D flow->counter->cs, > - .query_flags =3D IBV_COUNTER_SET_FORCE_UPDATE, > - }; > - struct ibv_counter_set_data query_out =3D { > - .out =3D counters, > - .outlen =3D 2 * sizeof(uint64_t), > - }; > - int err =3D mlx5_glue->query_counter_set(&query_cs_attr, > - &query_out); > - > - if (err) > - return rte_flow_error_set > - (error, err, > - RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > - NULL, > - "cannot read counter"); > - qc->hits_set =3D 1; > - qc->bytes_set =3D 1; > - qc->hits =3D counters[0] - flow->counter->hits; > - qc->bytes =3D counters[1] - flow->counter->bytes; > - if (qc->reset) { > - flow->counter->hits =3D counters[0]; > - flow->counter->bytes =3D counters[1]; > - } > - return 0; > - } > - return rte_flow_error_set(error, EINVAL, > - RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > - NULL, > - "flow does not have counter"); > -#endif > - return rte_flow_error_set(error, ENOTSUP, > - RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > - NULL, > - "counters are not available"); > -} > - > -/** > * Query a flow. > * > * @see rte_flow_query() > @@ -1727,7 +1728,7 @@ > case RTE_FLOW_ACTION_TYPE_VOID: > break; > case RTE_FLOW_ACTION_TYPE_COUNT: > - ret =3D flow_verbs_query_count(dev, flow, data, > error); > + ret =3D flow_verbs_counter_query(dev, flow, data, > error); > break; > default: > return rte_flow_error_set(error, ENOTSUP, > -- > 1.8.3.1