From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80047.outbound.protection.outlook.com [40.107.8.47]) by dpdk.org (Postfix) with ESMTP id 5FE8B5B12 for ; Fri, 14 Sep 2018 18:50: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=OT/JKaYSf7M+v8x7iTuyQIxFW+6XIOkCsU1I83K53DU=; b=nVhblaklOQv9/9ajImS9XyKe+KV3GhdpbtmL8NzPj4Pa9YB00qxLwgEBxjrvN6jzchoQfmjSV2f1E6IXOMmAPVe1fORFiLxzYtVlGvrPUCMElcshRCXn7nYuu1dCOU38uKDKA5FqK1enYuNnvFphCMgXXwei0yYAa+U/1M3B0HM= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3996.eurprd05.prod.outlook.com (52.134.72.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.17; Fri, 14 Sep 2018 16:50:43 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::452:cfe7:8363:61c1]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::452:cfe7:8363:61c1%2]) with mapi id 15.20.1122.021; Fri, 14 Sep 2018 16:50:43 +0000 From: Yongseok Koh To: "Xueming(Steven) Li" CC: Shahaf Shuler , "dev@dpdk.org" Thread-Topic: [PATCH v2] net/mlx5: fix representor port xstats Thread-Index: AQHUS/Tjjiv04v2+o0iRjdULRTJxhKTv/jsA Date: Fri, 14 Sep 2018 16:50:43 +0000 Message-ID: References: <1536229686-81003-1-git-send-email-xuemingl@mellanox.com> <1536906807-118827-1-git-send-email-xuemingl@mellanox.com> In-Reply-To: <1536906807-118827-1-git-send-email-xuemingl@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=yskoh@mellanox.com; x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3996; 6:ok+3tOcjlu/blZfWgkfRh19YrVjYiCLh2FgtTHWR3eomjpc7ipqr+lzguIsa9COZc3g4n2ODW/R+unQbjDID7vSdT2mOnfUKvNPww+4V/eMNlgkvqunqogxc0et5xrCZ/73lpImg6D9Q3XtQZhfP4k4DdFOFxpQ7wsdYZBQmkw7qxmwD+wTlnP1c1V9Bcf8/QoVaadppyCNix6W5xzIlIobi9npVJhYaB9EJujPBqBprUqLB24a8y+X5osPam7BzPYiaohUmo1rkMfjKCItEM9CdQCBuyvf2VqEoNiczIGAswMITwSz0k2y/dBp3ryg2vASiVUuc4e5Ioz5JerIKCL7tvOanbQkNgrBwHWR4f/kVubzCu+Dact9YQwfL4LgpBEFC+M+XzbpHJ+VX1DFAzVksUQRmP+8FEdZV3NA5R/qI71gsONrIAHty0JUVzQK2Lim1/SWzUOWPv6ghGESshQ==; 5:V4cfzjv8Hcu1TWavwfxupmVJVEEGZ4W7Fjh42Zc/dyz3iBHY0Nl75yuQiJ7GS/VgiFrEJOc9jXNtu8jL5oF2a9Z3Eu22XHeFKhKn6pPFYGeAVCsIBHAGhapqz55TJGX/BNx3NGwEa1/Jb3aQl968gWXyfqRHmq433wEBbDOT9NU=; 7:mjR1YZKYi9cNtyBovEC7n32+fYFgfO/2QlzyoZ3zObOdWqkehXe/uPU3AJKe7neg7HYMg0wtZWIJ/Ov7DAwfZmBn+z/VYZNYeHy5flmDxrsEgxTXe2Wq2h4VEcvSDwXg6MuInAibZQ7S2dus7IUjr1BJ4i0wgVN3rIAAJilD/A2Pqdtl0WUByETkfZyRwepy4iDUnMPYvezPJCfR/mxFIHwFJiNijIIZ5y7yaAvct4PzlrZEHLtZFWL6PV3yIqN5 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 5d9b7116-128d-453c-c746-08d61a623616 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3996; x-ms-traffictypediagnostic: DB3PR0502MB3996: 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)(8121501046)(5005006)(823301075)(93006095)(93001095)(10201501046)(3002001)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699050); SRVR:DB3PR0502MB3996; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3996; x-forefront-prvs: 07954CC105 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(39860400002)(346002)(396003)(366004)(189003)(199004)(102836004)(8936002)(66066001)(229853002)(25786009)(5660300001)(6486002)(6636002)(105586002)(26005)(6246003)(86362001)(106356001)(82746002)(68736007)(2900100001)(316002)(6862004)(37006003)(53546011)(99286004)(2906002)(83716003)(6506007)(54906003)(4326008)(33656002)(14444005)(5250100002)(256004)(36756003)(486006)(11346002)(3846002)(478600001)(14454004)(53936002)(446003)(476003)(6512007)(305945005)(7736002)(2616005)(6436002)(81156014)(97736004)(81166006)(8676002)(6116002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3996; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 1+ik/5vsv3xYIaF5Et5rTptCzMVdq56e6Rv7QFO08u9yFpCxcV95Jj4Ch/fkfR1Cs2wZALNHf20Nr4K+/TWrBiC7JSPmjniurQUps0DQHhKuvE3KlEcu9Cfa8E33BKX5figaduVjzfPwoTELTsnKUGJSgDPePtF3/smI22aDubERLF5OD8jdyVLrn+LHAwY4mtuLrm21HqWRLBHScNdPklUTLXtM8+eMeQvhDUsOZFShQ61iXFj6DGp/JpKjgAc+RzPhrT21C5792qPl5aGpln9rdQm56Fy60CK6CNnk0Av3U/37CQSC9HFsmAjXW1956MCYB9Sp0GBRptK0w8SQjvFa2EUw6Fhoa+MPp1YAfVg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <5B8431301BB1B24DBD36A7689B23ED68@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d9b7116-128d-453c-c746-08d61a623616 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2018 16:50:43.5614 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3996 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix representor port xstats 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: Fri, 14 Sep 2018 16:50:47 -0000 > On Sep 13, 2018, at 11:33 PM, Xueming Li wrote: >=20 > This patch fixes the issue that representor port shows xstats of PF. >=20 > Fixes: 5a4b8e2612c5 ("net/mlx5: probe all port representors") Wrong commit SHA. > Signed-off-by: Xueming Li > --- > drivers/net/mlx5/mlx5_stats.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.= c > index 91f3d47..ed5b51b 100644 > --- a/drivers/net/mlx5/mlx5_stats.c > +++ b/drivers/net/mlx5/mlx5_stats.c > @@ -146,7 +146,7 @@ struct mlx5_counter_ctrl { > et_stats->cmd =3D ETHTOOL_GSTATS; > et_stats->n_stats =3D xstats_ctrl->stats_n; > ifr.ifr_data =3D (caddr_t)et_stats; > - ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); > + ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 0); > if (ret) { > DRV_LOG(WARNING, > "port %u unable to read statistic values from device", > @@ -194,7 +194,7 @@ struct mlx5_counter_ctrl { >=20 > drvinfo.cmd =3D ETHTOOL_GDRVINFO; > ifr.ifr_data =3D (caddr_t)&drvinfo; > - ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); > + ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 0); > if (ret) { > DRV_LOG(WARNING, "port %u unable to query number of statistics", > dev->data->port_id); > @@ -229,7 +229,6 @@ struct mlx5_counter_ctrl { > return; > } > dev_stats_n =3D ret; > - xstats_ctrl->stats_n =3D dev_stats_n; > /* Allocate memory to grab stat names and values. */ > str_sz =3D dev_stats_n * ETH_GSTRING_LEN; > strings =3D (struct ethtool_gstrings *) > @@ -244,7 +243,7 @@ struct mlx5_counter_ctrl { > strings->string_set =3D ETH_SS_STATS; > strings->len =3D dev_stats_n; > ifr.ifr_data =3D (caddr_t)strings; > - ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); > + ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 0); > if (ret) { > DRV_LOG(WARNING, "port %u unable to get statistic names", > dev->data->port_id); > @@ -275,6 +274,7 @@ struct mlx5_counter_ctrl { > goto free; > } > } > + xstats_ctrl->stats_n =3D dev_stats_n; Any reason to move it? If it is done to group the code, I'm fine with that. Thanks, Yongseok > /* Copy to base at first time. */ > assert(xstats_n <=3D MLX5_MAX_XSTATS); > ret =3D mlx5_read_dev_counters(dev, xstats_ctrl->base); > @@ -307,6 +307,8 @@ struct mlx5_counter_ctrl { > unsigned int i; > uint64_t counters[n]; >=20 > + if (!priv->xstats_ctrl.stats_n) > + return 0; > if (n >=3D xstats_n && stats) { > struct mlx5_xstats_ctrl *xstats_ctrl =3D &priv->xstats_ctrl; > int stats_n; > @@ -480,8 +482,11 @@ struct mlx5_counter_ctrl { > mlx5_xstats_get_names(struct rte_eth_dev *dev __rte_unused, > struct rte_eth_xstat_name *xstats_names, unsigned int n) > { > + struct priv *priv =3D dev->data->dev_private; > unsigned int i; >=20 > + if (!priv->xstats_ctrl.stats_n) > + return 0; > if (n >=3D xstats_n && xstats_names) { > for (i =3D 0; i !=3D xstats_n; ++i) { > strncpy(xstats_names[i].name, > --=20 > 1.8.3.1 >=20