From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10073.outbound.protection.outlook.com [40.107.1.73]) by dpdk.org (Postfix) with ESMTP id E8C80239 for ; Sun, 14 Oct 2018 07:32:28 +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=aZ3+kBvxRJ7x3jMLKfSsx2c/YufqVjBAqFuYQKhvOEg=; b=AlMvJPD17bl0OaqCjgnvdVAmSSi6VfN+m2fhTJbuLJMIlDQCqadks3PTm1X1vT6faB4BhnhFi+FYAgKFKrnVdutdH841vsQtC105JD+SqeboeLzM9BgUkBikcgubCTk1Obb7T9NrI7KizuppdtDB6z2ARwHF5ppchzQd9i9Cn64= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB5354.eurprd05.prod.outlook.com (20.178.42.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Sun, 14 Oct 2018 05:32:26 +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.1228.020; Sun, 14 Oct 2018 05:32:26 +0000 From: Shahaf Shuler To: Slava Ovsiienko , Yongseok Koh CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/mlx5: flow counters support on the Linux-rdma v19 base Thread-Index: AQHUWy3WSyEABNWoG0uRjf7PlVeGG6UOMMIAgAv8zoCABBoF0A== Date: Sun, 14 Oct 2018 05:32:26 +0000 Message-ID: References: <1534772079-6514-1-git-send-email-viacheslavo@mellanox.com> <1538580540-2224-1-git-send-email-viacheslavo@mellanox.com> <20181003234810.GH26206@mtidpdk.mti.labs.mlnx> In-Reply-To: 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; DB7PR05MB5354; 6:/tTiczFn5sIXvatB6STlKmRV/Sqcyk5c51VlWMIdHRW57iNPdA3JsdWR0p2jGb1InityHj6o9ZZj2bqGcHSaKQuJoFcyhR2CLXZYWmEgx/gwkFY4rOmNjdGnyhBt+LGZGHn1lCB4rZQsJp68RfAEQdKNv6U/NsBDISy3fi041Smn54j3lbO999eI0fMdSI2oy6GMsd5dwNKYeLpVRaYHmzQ+WzYG0a5MgfymjebVP2n1PcZYUmff9qB8iuhd3vwp3gTtdLmdEhU/CJOEcg1gpRZOs+9b8bp+Gs6bOv4J0gCKYOZr/OIw9d+7bnMqOZ55HxKcPe8FNAtO6Fz6Jc7VcZ/IyEwcNt9n8CudcxRVNI2VHztSxB9MIL4tjVV4qv+zDQ8EFXHnB+Rdwe7TjdYdZ2mFQDTGbGKkcSbjVzAbnwEcAh85kreEygt8VIpChuEYAZBPZuukDM2VWUjmJtiS6Q==; 5:Hc8sMSm3w4mEABaIz1Ad/qfY0i1L8OvNw2Ao6+mHfaZHbXDbWFwAXLdMjWShQb+UszLov438AfFxwOlPamPC1Y4beGKXFnJdKX2WuBdV3BwptFhICkRaNWZxeWBBj5zcaMaI0CYI+XvAkLnl8fXkDPiBcDMeva4Nwk2Pw6fFKyk=; 7:souNI0JH5bSToDODvBRre66InlWH+4OSYdR2r3ZDklx7cY2EY55r4vCvQJHGZSbYOTiBBGweUvDyy1DcTEYpLsBOhu/r38100sWSjcX93ZCCSjQiR2yCZF1UMhMEypUHSA/7k9WNxkg3sENGWEnpYCbixLyQl4dCX4b9vrkhPpmZjwE6T3agieNXCpLYmoTdiQ76lnYN0OyB454sLYlqI1nm3aOx6TJKIJ6bSejjEmy7cNvzvgAm/FiKc0g1VjME x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 05637a41-fdbc-4446-c966-08d631966d46 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:DB7PR05MB5354; x-ms-traffictypediagnostic: DB7PR05MB5354: 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)(10201501046)(3231355)(944501410)(52105095)(3002001)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051)(76991067); SRVR:DB7PR05MB5354; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB5354; x-forefront-prvs: 08252193F3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(346002)(376002)(39860400002)(199004)(189003)(13464003)(33656002)(74316002)(5250100002)(476003)(97736004)(11346002)(486006)(14444005)(256004)(446003)(53936002)(186003)(55016002)(26005)(478600001)(9686003)(305945005)(229853002)(2900100001)(102836004)(8936002)(4326008)(25786009)(81156014)(8676002)(81166006)(6436002)(7736002)(71200400001)(6246003)(68736007)(71190400001)(6636002)(99286004)(2906002)(93886005)(7696005)(86362001)(106356001)(105586002)(5660300001)(6506007)(76176011)(53546011)(14454004)(66066001)(3846002)(6116002)(316002)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB5354; 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: iAPXDo48E8w9skHyHPYziMyD4XGyST/2NxZcAPDhorOumA37Z0U6xMvkTAg0PnXFMTzxG05E4h5Otu3fQ3wxZPTQdcARAoQB0HSOrQOSo6QtQHgRfbUj3KAkCNg9MnLTck+q0EXOvY8J6JRg7Wx7GwueqbDid+yXjj2XdEJ4gJ4PXnpIgqYTYCysbV3NsczBJVhg9PbmpFBwiuZZp825JpuPYf2wj9M6o+WjG6kUGTv0Wpaq2JnGzJ9JafiFepU1KrfrFB/pEwFsE3/xFfGP7gUytx5awyBKMzV4FQqBFXIL8wEbOugn+v6TkC80sZbbiRiANMhiLi/se+iCCejSfopSj0S5RRjFz1w+VbzKCJI= 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: 05637a41-fdbc-4446-c966-08d631966d46 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2018 05:32:26.6308 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5354 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: flow counters support on the Linux-rdma v19 base 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, 14 Oct 2018 05:32:29 -0000 Thursday, October 11, 2018 5:52 PM, Slava Ovsiienko: > Subject: RE: [dpdk-dev] [PATCH] net/mlx5: flow counters support on the > Linux-rdma v19 base >=20 > > -----Original Message----- > > From: Yongseok Koh > > Sent: Thursday, October 4, 2018 2:48 > > To: Slava Ovsiienko > > Cc: dev@dpdk.org; Shahaf Shuler > > Subject: Re: [dpdk-dev] [PATCH] net/mlx5: flow counters support on the > > Linux-rdma v19 base > > > > On Wed, Oct 03, 2018 at 03:29:12PM +0000, Slava Ovsiienko wrote: > > > Mellanox mlx5 PMD supports Flow Counters via Verbs library. > > > The current implementation is based on the Mellanox proprietary > > > Verbs library included in MLNX OFED packages. The Flow Counter > > > support is recently added into linux-rdma release (v19), so the mlx5 > > > PMD update is needed to provide Counter feature on the base of linux- > rdma. > > > > > > mlx5 PMD can be compiled with MLNX OFED or linux-rdma v19+ and > > provide > > > flow counters for both. > > > > > > Signed-off-by: Viacheslav Ovsiienko > > > --- > > > drivers/net/mlx5/Makefile | 10 ++++++++ > > > drivers/net/mlx5/mlx5.c | 6 +++++ > > > drivers/net/mlx5/mlx5_flow.c | 9 ++++++- > > > drivers/net/mlx5/mlx5_flow.h | 4 +++ > > > drivers/net/mlx5/mlx5_flow_verbs.c | 52 > > ++++++++++++++++++++++++++++++-------- > > > drivers/net/mlx5/mlx5_glue.c | 41 > > ++++++++++++++++++++++++++++++ > > > drivers/net/mlx5/mlx5_glue.h | 16 ++++++++++++ > > > 7 files changed, 127 insertions(+), 11 deletions(-) > > > > > > diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile > > > index ca1de9f..e3d2156 100644 > > > --- a/drivers/net/mlx5/Makefile > > > +++ b/drivers/net/mlx5/Makefile > > > @@ -162,6 +162,16 @@ mlx5_autoconf.h.new: > > $(RTE_SDK)/buildtools/auto-config-h.sh > > > type 'struct ibv_counter_set_init_attr' \ > > > $(AUTOCONF_OUTPUT) > > > $Q sh -- '$<' '$@' \ > > > + HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT \ > > > + infiniband/verbs.h \ > > > + type 'struct ibv_counters_init_attr' \ > > > + $(AUTOCONF_OUTPUT) > > > + $Q sh -- '$<' '$@' \ > > > + HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT_V45 \ > > > + infiniband/verbs.h \ > > > + type 'struct ibv_counters_init_attr' \ > > > + $(AUTOCONF_OUTPUT) > > > + $Q sh -- '$<' '$@' \ > > > > I still don't understand what is different between the two. These are > > exactly same checking, then why do you need to have two different > > macros? From this script, HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT is > same > > as HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT_V45, isn't it? >=20 > We have three options: > - no counter support in kernel at all > - "old" counter support (ibv_counter_set_init_attr is defined in verbs.h) > - "new" counter support (ibv_counters_init_attr is defined in verbs.h) >=20 > Three options require at least two compilations flags. The meanings are > chosen: > HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT means there is counter > support (of any type) > HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT_V45 differentiates the > support type >=20 > This approach allows to avoid clumsy constructions in code like this: > #if __defined(HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT \ > || __defined(HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT_V45) This is not needed anyway.=20 The "old counters" exists only in MLNX_OFED not upstream.=20 Once the "new counters" were implemented upstream the next OFED completely = replaced the old implementation.=20 Meaning, there is no driver having them both.=20 Hence, we can avoid this complex construction and just hold a single macro = flag for the new counters.=20