From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20079.outbound.protection.outlook.com [40.107.2.79]) by dpdk.org (Postfix) with ESMTP id 5439F2C52 for ; Sun, 21 Oct 2018 11:20:47 +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=uu9EZ2UjUErfEpYy51kse84LJgtNIaY2KHr5hc9B6L8=; b=OcS4ZEYNK2BM1EvY57dOmnhRA9rxfwxvm/nrzfXxttTNnvWOll96EY/SvNGRbY39u6MtzFKZdmBoM/TiQdJJTd0eAEp1KjhUagLnvWD7BLqD0vU++a9UCzpnuhvuuWVYmvI7KQVa8r+5e3G1OFtShPeI98hvlSm4kJjrQil8cOk= 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:46 +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:46 +0000 From: Shahaf Shuler To: Slava Ovsiienko , Yongseok Koh CC: "dev@dpdk.org" Thread-Topic: [PATCH v3 3/6] net/mlx5: flow counters simplifying runtime support check Thread-Index: AQHUZ79zVQQ1rAu060qtc+X76BPMaaUpZJZg Date: Sun, 21 Oct 2018 09:20:46 +0000 Message-ID: References: <1539784438-29242-1-git-send-email-viacheslavo@mellanox.com> <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com> <1539962470-10950-4-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1539962470-10950-4-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:dpu45ax3eBjitCRVKtXrv7eUEmZV1RBGLwzkGxRR/Wr8PDyVNhQS6V13OWo3yXBKGVDj1jE7FTLQj/bHuFPyBPn3ABXJ6f1KLbSNw1SGtFNgHJMSmR9l9RCUBwCY+cltiI3t2tfq/wHmHwdE95mH/7rRy+3Cg0ik+swcw2B7Gc8O/+f1iK+WzsmFddCgx01iT1dBzmw+NziTHKBEicO1xfOXJAaOEKOoZLadbFZrfQw07lPxTAhZ/EjDa2CPt06SK/gx7eujf2wvY6qIp2dwV7pqwZVn9qnsen0xq7jQ0tYK17imYasfXM8z3YJoj77PBbGpfVmDsFFD8ZAieTO4Clef9+I+lKveiSRHSyy3zGpmazRho+JK+Xl7UuRvj3waDsNtA3UgULs6GHe7rzpgcScQ+GUM9jqLbvBbFmw63FfCHfGAeZ4k49jFi2nsSE30ul9BNnlr1Nme7FsfUbPP0A==; 5:89NhgyVoC1HLgRSxj4Y7Mp9RL2uqLspziD8T5C5hQA3OiegnSYiGbY/nhc/NeX5X1SQXsSdkndakw98sSHEZP3lh6xzHleLTfoqpm7zriOLum/4INISF6zhf8JRQgPNl8Mph7m7ZzpmuzucdRanZGJahoyxczkIlD+PQrqShJyk=; 7:beN6Gfeiq9jMMGZ5k4c1lXUrsdxB8Y2zgbMOwwuBtloHDKVBVISQv4AvLU6Fhpf68LUzEF/XnreXLuKh9rD3i6hhijJWYF/Xr5nntSojNk9kTy6sBFZe1RuVZFHVEj0vOvuHVwD0DTxI6asQwn3E7Q2/YfKLQCu9t4ZCSsyDrVvtl+S8xChD7A6DJ5jUv6BspOHqU718bg+oI2kIgIMfQg547AlQWz8c+lejzGs7PiQrCT23mFhhSiI0/pdOe16m x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 7c9083ce-7084-428c-e958-08d637367bd5 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)(309714004); 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: HwPKcQTG/IODR94qhvWCneAKLVCm2bzJXKP5Yj7ORJRS4mEDsf8EfhF/MP0mDvKWERkFUznib3WUMDwM0RUbQUASilIIIn71X2d4N/ebI3PDh+eGidAt+ENWyIYoiG4GKFxVP31kcRM4l3glVDIWSG2FjZU0A49yuklSnXlWsGX1GrF5oTV2ivPiXOvHZOFrWyJKv5BMR1Hwt8S35+Y1RW945J6S60cuGspvfQ5bCWnot8pS26gw+Kx+fzQERpMNC1XVKS1rDVLGDR2mZN0PDM4mxIVJgQH0o56uO+c5X13PwYcqL1x4U2Ur21+IStXITyMW/AgQQfpPSfvaUWhlC1b5+avd10edk2Brx1zB8sA= 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: 7c9083ce-7084-428c-e958-08d637367bd5 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Oct 2018 09:20:46.3941 (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 3/6] net/mlx5: flow counters simplifying runtime support check 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:47 -0000 Friday, October 19, 2018 6:21 PM, Slava Ovsiienko: > Subject: [PATCH v3 3/6] net/mlx5: flow counters simplifying runtime suppo= rt > check How about "net/mlx5: simplify flow counters support check >=20 > This part of patchset removes the redundant check of counters support in > runtime. The flag flow_counter_en is eliminated from the code. The Verbs > create counter function just returns an error if no counter support prese= nted > in kernel. >=20 > Some log messages regarding the counter support type and presence are > added. >=20 > mlx5_flow_validate_action_count() is also updated due to flow_counter_en > flag removal. In continue to previous patch comments, this patch should only make the nee= ded preparation for the new counters.=20 The new counters macro along with implementation should be on a separate co= mmit.=20 >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5.c | 15 ++++++++++----- > drivers/net/mlx5/mlx5.h | 1 - > drivers/net/mlx5/mlx5_flow.c | 16 +++++++++------- > 3 files changed, 19 insertions(+), 13 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > bb19085..8a33639 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -1009,12 +1009,17 @@ > config.hw_csum =3D !!(attr.device_cap_flags_ex & > IBV_DEVICE_RAW_IP_CSUM); > DRV_LOG(DEBUG, "checksum offloading is %ssupported", > (config.hw_csum ? "" : "not ")); > -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42 > - config.flow_counter_en =3D !!attr.max_counter_sets; > +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) > mlx5_glue->describe_counter_set(ctx, 0, &cs_desc); > - DRV_LOG(DEBUG, "counter type =3D %d, num of cs =3D %ld, attributes =3D > %d", > - cs_desc.counter_type, cs_desc.num_of_cs, > - cs_desc.attributes); > + DRV_LOG(DEBUG, "Flow counters are supported (4.2), " > + "type =3D %d, num of cs =3D %ld, attr =3D %d", > + cs_desc.counter_type, > + cs_desc.num_of_cs, > + cs_desc.attributes); I would refine on saying the counters are supported (since you cannot be su= re).=20 I would recommend to have a message log only if the macro is not defined to= say "flow counters are not supported". This is the only thing we know for = sure.=20 > +#elif defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) > + DRV_LOG(DEBUG, "Flow counters are supported (4.5)"); #else > + DRV_LOG(DEBUG, "Flow counters are not supported"); > #endif > config.ind_table_max_size =3D > attr.rss_caps.max_rwq_indirection_table_size; > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > d14239c..74d87c0 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -114,7 +114,6 @@ struct mlx5_dev_config { > unsigned int tunnel_en:1; > /* Whether tunnel stateless offloads are supported. */ > unsigned int mpls_en:1; /* MPLS over GRE/UDP is enabled. */ > - unsigned int flow_counter_en:1; /* Whether flow counter is > supported. */ > unsigned int cqe_comp:1; /* CQE compression is enabled. */ > unsigned int tso:1; /* Whether TSO is supported. */ > unsigned int tx_vec_en:1; /* Tx vector is enabled. */ diff --git > a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index > fcabab0..c15722d 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -921,22 +921,24 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > * 0 on success, a negative errno value otherwise and rte_ernno is set= . > */ > int > -mlx5_flow_validate_action_count(struct rte_eth_dev *dev, > +mlx5_flow_validate_action_count(struct rte_eth_dev *dev __rte_unused, > const struct rte_flow_attr *attr, > struct rte_flow_error *error) > { > - struct priv *priv =3D dev->data->dev_private; > - > - if (!priv->config.flow_counter_en) > - return rte_flow_error_set(error, ENOTSUP, > - RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > - "flow counters are not supported."); > +#if !defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) && \ > + !defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) > + (void)attr; > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ACTION, NULL, > + "flow counters are not supported."); #else This ifdef addition is not needed. Just let It fall on the counter creation= (like you commit log says).=20 > if (attr->egress) > return rte_flow_error_set(error, ENOTSUP, >=20 > RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL, > "count action not supported for " > "egress"); > return 0; > +#endif > } >=20 > /** > -- > 1.8.3.1