From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10040.outbound.protection.outlook.com [40.107.1.40]) by dpdk.org (Postfix) with ESMTP id 632303237 for ; Fri, 28 Sep 2018 02:13:39 +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=XlR9mizcu07U+ivNMs9sQqhEOhC6HHYaJlJ6FVYe7XI=; b=KD/dYCKP/E5v0aNZON0kGSXVXOntutXkSkH33ydWR5wHNeRvIkugVXcw/PMFrTcHnGgboWD73aBnuHA3eoZ5N/74XrthIX3cgNnQnwXTl+JWQZaeMo9V8Kuy6KtFY6MCFutA4scfzg5beapFMRNXOHfA2QmVSHFhGjpDVyDsctk= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3946.eurprd05.prod.outlook.com (52.134.71.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Fri, 28 Sep 2018 00:13:38 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1164.024; Fri, 28 Sep 2018 00:13:38 +0000 From: Yongseok Koh To: "Xueming(Steven) Li" CC: Shahaf Shuler , "dev@dpdk.org" , Adrien Mazarguil Thread-Topic: [PATCH v3] net/mlx5: fix wrong representor port link status Thread-Index: AQHUT/KpaeUfB8pJzEmbnWS4vse5QaUE4E0A Date: Fri, 28 Sep 2018 00:13:38 +0000 Message-ID: <569C2065-BD59-43F9-96C0-4BE7C1F40779@mellanox.com> References: <1536906477-118136-1-git-send-email-xuemingl@mellanox.com> <1537345657-171431-1-git-send-email-xuemingl@mellanox.com> In-Reply-To: <1537345657-171431-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: [69.181.245.183] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3946; 6:b7uFOyUX3CvEelsa+ZRKbQnv4cYqOesA68FQthzfEvPJvwnFBrC7/ZqEiCxVPiQFTrHqh5eNngFUSx5XbLityG+nWoVehQK+hJUDEkz/8dNMPfNSr9AMjNJgFNoxTBhz+pjuIhrvbK0p/FKVzEkdDcfFDUr7FrdGsXaIlR3W90yYdw+wPCpWZyzYv6tGBXT4gU8MHKfVJMYwmWPykvIKc67Bi9AWcAw+Jj+34fH1PAGzAZg6+bZrNSuWE2o/QRYU4KWjXOcLQ4cSYtHwP5tgFCmSDY1E1EEg/nUWK8l3LxNL515olCVoEVxIUl03OlkBEnRRqS9maxWcRaCXjOx0zB7qXhDmF3ILpU24v4Z14oSND0CBWA/5Kbntg0oUAcaS67VOkM187fVvplyL+GB1deeaEkRvm2Baauj4bXpY4aSDI12MUNDQpWuSw5ieB19Ay6WLb9Jex2x3xoOd28rdMQ==; 5:uYtetbM5h3QdruOmbxlnRDYyH5AT4b4JuhuTGfDJQnkLoGZxr7YdMyieX6ziQv9I9UNMYJSv8F8hYARqT6uHbn3o3VzYvyAzKCtYzmpjY5WuPh/DKwISsCF6E6TwnTTFdC7VgVT5oXU9aGYZ7Td7uftbJsZfp2ymbdG3lgzZLD8=; 7:L+hQ1jc8SNtusJAXEQZhDfGQlgvXC36SAKZddyiLkuIRALwR7XyWmODDR31fH8kC8E5cLt9+MlvVZRC6cx9BiBj3Uh6NfwBCW/zPM43rZa1NTdnN3uGfiGusqyFlciq2THFB+rBNbuf8OE9F3DuJMbuplntc2hNZW9n40qm9dPA7CK+i6aJObIvbLczw9/M3iU3Q97UUkiJWDZH1Xt7WZWPMwmcElVKKZmJsdbh0fYTTbUv/7Q6eoDDx3iO7NydN x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: ef4c72de-b6b6-405f-ac55-08d624d73d24 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3946; x-ms-traffictypediagnostic: DB3PR0502MB3946: 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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051); SRVR:DB3PR0502MB3946; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3946; x-forefront-prvs: 0809C12563 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39860400002)(346002)(396003)(136003)(199004)(189003)(2906002)(305945005)(102836004)(6506007)(6862004)(99286004)(14444005)(2616005)(256004)(7736002)(71190400001)(76176011)(229853002)(66066001)(71200400001)(4326008)(97736004)(53546011)(86362001)(6246003)(83716004)(5250100002)(2900100001)(26005)(68736007)(6636002)(8936002)(105586002)(486006)(36756003)(37006003)(6116002)(446003)(25786009)(6486002)(34290500001)(3846002)(82746002)(8676002)(478600001)(53936002)(106356001)(33656002)(476003)(14454004)(316002)(6512007)(11346002)(5660300001)(54906003)(6436002)(81156014)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3946; 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: yHQbqY9Ew2US1S6cUYXKWGwPou7QGyw43sBUb3L/Scd7L4weic0goLoM7Ty/jfJj09nEH6coj2QPvboDAkI8mtkjlqXfvlW7YFXQzXB5h63IQOB1C/chx5fdl434ZphNmRT3zyutHsqQ3CPA808IHA35gOGx5V9tjC98rGjVxNLIhDTLcUSJWUCAhR2pG7Ruh0aGsmm5nIRp/azwHhDQYPiXf3zZ8TJXFZOD5xF16mNVGSGzhuDhMRXiQl1wtcZShIZP57ENHi+tSc1IeM0h92N083SblmhbRyLFUQIq/O+4IPvxPpkaqbGjjJ2i6bf0yJmrDx4ARtgDL1oavvaZ/JYqPpmboxt1W+kDyZVgYwA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef4c72de-b6b6-405f-ac55-08d624d73d24 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2018 00:13:38.1104 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3946 Subject: Re: [dpdk-dev] [PATCH v3] 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, 28 Sep 2018 00:13:39 -0000 > On Sep 19, 2018, at 1:27 AM, Xueming Li wrote: >=20 > Current code uses PF links status for representor port, not the > representor > interface itself. This caused wrong representor port link status when > toggling linterface up or down. >=20 > Fixes: 2b7302638898 ("net/mlx5: probe all port representors") > Cc: adrien.mazarguil@6wind.com >=20 > Signed-off-by: Xueming Li > --- Acked-by: Yongseok Koh =20 Thanks > drivers/net/mlx5/mlx5_ethdev.c | 36 ++++++++++++++++++++++-------------- > 1 file changed, 22 insertions(+), 14 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethde= v.c > index 34c5b95..5515fdb 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -627,16 +627,19 @@ 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)); > return ret; > } > - memset(&dev_link, 0, sizeof(dev_link)); > - dev_link.link_status =3D ((ifr.ifr_flags & IFF_UP) && > - (ifr.ifr_flags & IFF_RUNNING)); > - ifr.ifr_data =3D (void *)&edata; > + dev_link =3D (struct rte_eth_link) { > + .link_status =3D ((ifr.ifr_flags & IFF_UP) && > + (ifr.ifr_flags & IFF_RUNNING)), > + }; > + ifr =3D (struct ifreq) { > + .ifr_data =3D (void *)&edata, > + }; > ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); > if (ret) { > DRV_LOG(WARNING, > @@ -666,8 +669,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; > } > @@ -698,16 +702,19 @@ 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)); > return ret; > } > - memset(&dev_link, 0, sizeof(dev_link)); > - dev_link.link_status =3D ((ifr.ifr_flags & IFF_UP) && > - (ifr.ifr_flags & IFF_RUNNING)); > - ifr.ifr_data =3D (void *)&gcmd; > + dev_link =3D (struct rte_eth_link) { > + .link_status =3D ((ifr.ifr_flags & IFF_UP) && > + (ifr.ifr_flags & IFF_RUNNING)), > + }; > + ifr =3D (struct ifreq) { > + .ifr_data =3D (void *)&gcmd, > + }; > ret =3D mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); > if (ret) { > DRV_LOG(DEBUG, > @@ -775,8 +782,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