From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20040.outbound.protection.outlook.com [40.107.2.40]) by dpdk.org (Postfix) with ESMTP id C55485F1C for ; Fri, 14 Sep 2018 18:43:01 +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=vn4S646nfy/ZAqXifYl/R4CGbXWnq/9iF2Dm1PH7gmo=; b=kK66ah/HFFZjAS3GpWyXt6pFO5F3V0vDEtP199a8vb+oTKUGbrkXHqOJmoMz94Sm9RFsvc9C2+y6I6qvyjGjFZeyVUItRIrHh1/oo8OrlqLKmCzMm10nKtZGdj2AftkFcJT4WGvctFNXdPYvTu53T0jT9wfjxtojontYP/cpGFs= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3947.eurprd05.prod.outlook.com (52.134.72.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.21; Fri, 14 Sep 2018 16:43:00 +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:43:00 +0000 From: Yongseok Koh To: "Xueming(Steven) Li" CC: Shahaf Shuler , "dev@dpdk.org" , Adrien Mazarguil Thread-Topic: [PATCH v2] net/mlx5: fix wrong representor port link status Thread-Index: AQHUS/REGaGkhxpyf0O/ycmHz7ULR6Tv/BSA Date: Fri, 14 Sep 2018 16:43:00 +0000 Message-ID: <2413B4CB-1001-4F58-9F08-CCA446378571@mellanox.com> References: <1536216636-15673-1-git-send-email-xuemingl@mellanox.com> <1536906477-118136-1-git-send-email-xuemingl@mellanox.com> In-Reply-To: <1536906477-118136-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; DB3PR0502MB3947; 6:V7uvKEEMeSiBMqu2hY/zxEKI8SCDfgkWLVjAWU+xLX7O69tVMpUMRZtLM0aFWKQVQLTOBLWTxO9kLpPGFq9IulClusEnC0QVD4ALTEsKr/grTiOCHBqpS5cmdyDBzF8T0cLLApVYHpTfRZsIac5mClYn75kxq109Nl9U2rxunPebkho/i3SwV8G3lSS2RHcWI/ht1eCASRlGyixdBTtT6giUhU5Tx4GNDBRm43FekRXtcLF4f0AELetl6xYUWEs/AiHz23MDJWG7M8DvCM6HnCzft+p/gkm1CpGeUGPvlgPwHHJmH1l3Dhj15/80Omhq9JvMo3l7CnKA7BFJExJLSYbXQAzgOE4nXg95CKiHuwO/9Uz2xt8zD3VZEi3dQAgNoEGIO51QmgIUaL7hcwLKIngMsQ7CKwqNQc/PVn7qw+3pJvx0cWrUoj8jkFWA93ofluJkR7wVS1X8ffixcZafPw==; 5:Cqwo0a6/g9C1SE9F5HDO3G5M+IcGA7qpbHKzHIlhwW+FOompKIcwwTtG/h4jdpDVIqHkRluYKQFRANrVYbs0R0w9ac/WuNRizZdusheJkJngMkF4JVOsR0XEmmNSymmVYsECX4td3jg3EnEgecoy+1hNc4uehxSRrfSiwBkyvL0=; 7:hDCKMzNHt40mPEWAwheIHNaKIihQOsuBW4GqaKyf1rQSynkoYBHkDk3Vkt/liMrnqdnL9+Rb5m3FqDEWAUpo12hG7iJMN8SPdcXvsJ0XO8gHtYOWdcDlLFh42JFRvjGzBsD+8bMkMZdxXGIzeYDMbgVWISvsKOrwZfaeQk+oRU5K7QrZjp+1+isW0NOtAbDjjzx/ZFjV7VIKI/3Y19/+dOsmUHk+Tq+GzdvOnvMLXNV3ifb6uuowTESxA2FYTm61 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 7a05807e-5e5a-402c-ec8e-08d61a612234 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3947; x-ms-traffictypediagnostic: DB3PR0502MB3947: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr 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)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699050); SRVR:DB3PR0502MB3947; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3947; x-forefront-prvs: 07954CC105 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(136003)(39860400002)(376002)(396003)(199004)(189003)(86362001)(83716003)(76176011)(102836004)(6246003)(14454004)(54906003)(82746002)(106356001)(6862004)(105586002)(53546011)(229853002)(37006003)(316002)(4326008)(99286004)(68736007)(33656002)(2906002)(7736002)(2900100001)(305945005)(81166006)(81156014)(97736004)(8676002)(6116002)(6636002)(3846002)(66066001)(6436002)(478600001)(486006)(6512007)(6486002)(5660300001)(8936002)(26005)(25786009)(36756003)(256004)(53936002)(14444005)(11346002)(446003)(5250100002)(2616005)(476003)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3947; H:DB3PR0502MB3980.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: iBLr1InKZhVyN201z9x/jYxFK9FNX8KeTthU5BvRwEAQ99tWdY5YMfsZpEfNprWPdgd/Nbj3nLGtK/zpThyYhvLv0iqZ7fkdd8QpjrgeK0VtoBJ2covAnkA4m3D48IsFgJk5Vkuc09eD9A8CHBxNvPQnF4wnCUSogVyI6E7lE2jWOWSRwgeNGMG9sZIG4PYVCInaQ/OGzpgfYRh+kr/Y76Rt2V7OcQSJHLM6K7Q+GXcOSqIo0ZbHq66HbtLZeOvRfRfdXSRlAUufXIa9U7co1mbiEzwZhJC1EsYZtxdz/YNXaNt9uq+bZrlSC6OgQK5ANO/wkg4skP7bhd3Fo0DZbd+jDAWq2vW5P6CSV74qGC0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <2B7055A728A8D74693250125EF5DD47C@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a05807e-5e5a-402c-ec8e-08d61a612234 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2018 16:43:00.6922 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3947 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix wrong representor port link status 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:43:02 -0000 > On Sep 13, 2018, at 11:27 PM, Xueming Li wrote: >=20 > Current code uses PF links status for representor port, not the represent= or > interface itself. This caused wrong representor port link status when > toggling linterface up or down. >=20 > Fixes: 5a4b8e2612c5 ("net/mlx5: probe all port representors") Wrong commit SHA. Please always check it by running=20 ./devtools/check-git-log.sh -$n ./devtools/checkpatches.sh -n$n > Cc: adrien.mazarguil@6wind.com >=20 > Signed-off-by: Xueming Li > --- > drivers/net/mlx5/mlx5_ethdev.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethde= v.c > index 34c5b95..7391ab8 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -627,7 +627,7 @@ struct ethtool_link_settings { > int link_speed =3D 0; > int ret; >=20 > - ret =3D mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 1); > + ret =3D mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 0); > if (ret) { > DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s", > dev->data->port_id, strerror(rte_errno)); > @@ -636,6 +636,7 @@ struct ethtool_link_settings { > memset(&dev_link, 0, sizeof(dev_link)); > dev_link.link_status =3D ((ifr.ifr_flags & IFF_UP) && > (ifr.ifr_flags & IFF_RUNNING)); > + memset(&ifr, 0, sizeof(ifr)); > ifr.ifr_data =3D (void *)&edata; It would be enough to be done like: ifr =3D { .ifr_data =3D (void *)&edata, }; And please do the same for dev_link even though it isn't relevant in the pa= tch. > ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); > if (ret) { > @@ -666,8 +667,9 @@ struct ethtool_link_settings { > ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX); > dev_link.link_autoneg =3D !(dev->data->dev_conf.link_speeds & > ETH_LINK_SPEED_FIXED); > - if ((dev_link.link_speed && !dev_link.link_status) || > - (!dev_link.link_speed && dev_link.link_status)) { > + if (!priv->representor && > + ((dev_link.link_speed && !dev_link.link_status) || > + (!dev_link.link_speed && dev_link.link_status))) { What does this change mean? Is it allowed for representors? > rte_errno =3D EAGAIN; > return -rte_errno; > } > @@ -698,7 +700,7 @@ struct ethtool_link_settings { > uint64_t sc; > int ret; >=20 > - ret =3D mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 1); > + ret =3D mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 0); > if (ret) { > DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s", > dev->data->port_id, strerror(rte_errno)); > @@ -707,6 +709,7 @@ struct ethtool_link_settings { > memset(&dev_link, 0, sizeof(dev_link)); > dev_link.link_status =3D ((ifr.ifr_flags & IFF_UP) && > (ifr.ifr_flags & IFF_RUNNING)); > + memset(&ifr, 0, sizeof(ifr)); Same here for dev_link and ifr. Thanks, Yongseok > ifr.ifr_data =3D (void *)&gcmd; > ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); > if (ret) { > @@ -775,8 +778,9 @@ struct ethtool_link_settings { > ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX); > dev_link.link_autoneg =3D !(dev->data->dev_conf.link_speeds & > ETH_LINK_SPEED_FIXED); > - if ((dev_link.link_speed && !dev_link.link_status) || > - (!dev_link.link_speed && dev_link.link_status)) { > + if (!priv->representor && > + ((dev_link.link_speed && !dev_link.link_status) || > + (!dev_link.link_speed && dev_link.link_status))) { > rte_errno =3D EAGAIN; > return -rte_errno; > } > --=20 > 1.8.3.1 >=20