From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28D33A046B for ; Mon, 22 Jul 2019 07:53:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA5A21B955; Mon, 22 Jul 2019 07:53:09 +0200 (CEST) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30048.outbound.protection.outlook.com [40.107.3.48]) by dpdk.org (Postfix) with ESMTP id DECDE1B955 for ; Mon, 22 Jul 2019 07:53:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SoBR8RwPU8W2kY7Eed684LZhCi7qyrMPzCD+zNftfkkMjOYHTItaCqMPmB8fK79Zy9BGUynJbhV94WFhsDjVNJfesXLu76Y36HQpOYwCZLCt07kX/q9pP8TugoqBFMUqvJu4fs1yw07KclGAKSc6mqdf8JKiE5QUPjxr7f/mBk/njri1WGTrTRDA+HUDIe7dcTV7XaqtI2qIiGppBIb0MEJsQwx0QsOnOyMS5LOuO6AgsgIxXAdEwlqcrsZgleent9KOZrru2cA5jTp6azSgOrufNSHh12kreISuWIG/SYEtGKO2dZ/J9U1eAbN8brCda58g1fyIHljdE9JaNkvoZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bb9TGXIrV3anFGT0am8BqEAj1uXw3ygJNo/hbmTbD5Q=; b=ksE1ez1dmWN1aCJi8AhqVSTgma6HKdnwysXXzjcpSpRZWtS4UJTgJMrXJAVW1lfZbSdwmee/6PFulUq5uLsJ9n7UmfF6ceBWDM0f1hkTRH332Edgt4vj3712s7g0L/0aBCrHOGr5jpvyiDoAGGXRx3kTQkanPNsNnJ3MqRD2lShIKvVVTHNrXkXr4s0wnMFUbhmc4rQnylO/nHAd+JJYYPPeecbhxBCwCBrNN1YEuPYAz/mk/k9tJr/9udU5OlD3UWKJTotWK1CakeP6nvn31gQYdWN0GD1OckaNz2SL6PAJzE0V+ybmKkNF9Vqap+C/XgfEsNEXbECWHTZ+yfDa9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bb9TGXIrV3anFGT0am8BqEAj1uXw3ygJNo/hbmTbD5Q=; b=E0o9L2AuoKNZurIN3DvDp4Cd0Y7G5yU5lSzrTYifUJhbQPoL7uIh6IsCmd8WUE1mVlxxv+gpXgG4gmRLaxZz4keXUVDTK3pAWF8CP8fYO5kiqfmBlSe+5e+bEWzhHnshP1h699OZKGhdJIVy/EEdgz0NqN4SyIEijipjXdhzQuQ= 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.2094.15; Mon, 22 Jul 2019 05:53:04 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::69c1:c0d7:1fa1:f89f]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::69c1:c0d7:1fa1:f89f%6]) with mapi id 15.20.2094.013; Mon, 22 Jul 2019 05:53:04 +0000 From: Yongseok Koh To: Slava Ovsiienko CC: "dev@dpdk.org" , Shahaf Shuler , "stephen@networkplumber.org" Thread-Topic: [PATCH v2 2/2] Revert "net/mlx5: fix master device Netlink socket sharing" Thread-Index: AQHVP9STSeHZbZsyVU+LAJoY1SCIXqbWI8qA Date: Mon, 22 Jul 2019 05:53:04 +0000 Message-ID: References: <1563514305-27405-1-git-send-email-viacheslavo@mellanox.com> <1563721001-3730-1-git-send-email-viacheslavo@mellanox.com> <1563721001-3730-3-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1563721001-3730-3-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=yskoh@mellanox.com; x-originating-ip: [69.181.245.183] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9e3f23d0-ac2c-4bb6-2656-08d70e68dd43 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB3PR0502MB3946; x-ms-traffictypediagnostic: DB3PR0502MB3946: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:134; x-forefront-prvs: 01068D0A20 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(376002)(366004)(346002)(39860400002)(199004)(189003)(81166006)(81156014)(99286004)(8936002)(66066001)(64756008)(316002)(66446008)(54906003)(37006003)(68736007)(53546011)(76176011)(102836004)(6506007)(3846002)(6116002)(2906002)(4326008)(86362001)(36756003)(5660300002)(486006)(71190400001)(6486002)(14454004)(256004)(6436002)(6512007)(14444005)(6636002)(229853002)(305945005)(7736002)(33656002)(6862004)(8676002)(6246003)(53936002)(25786009)(91956017)(478600001)(476003)(76116006)(66946007)(66556008)(66476007)(26005)(2616005)(11346002)(71200400001)(186003)(446003); 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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: CGapdDQEq8Rd4hcsIOwb2DAqx4Az8oynCLFdmiE4suGbjJ2Rl+uz4+WG+fDH5ttVAgyGubZTwfT7Mi0bnijjshg2fQotSVod8pgZsIgNSMdSkUVxOHzA5vR+mjyW1myfF+RbOxNmlIBmc4of8rFFPvY+Yf5f6hgvqp6zwmEI8raJajYCQ3B8DndHb83E1hipSALTD6+MF2MYcKLWzXdGQrC60C/L4Lhk4V1QyEeqJksB5erTT/Ku19ENtXExMHBBvgXniY3fNawCZRFERmAnuM4OWxCOmtLVIXUHHSv3LAPtdvq6Kj4VcU5PHP6w/BBhO8i3WCdVomRB1GWccUYe1gpwPAlmwvvObwZ8OxywRz0JOUGnW9JtUelLhFcSW8P1naJU6DqqN+03i5paC+/6TZ4Oy5Sb5AtQiTvWmLNiTAo= Content-Type: text/plain; charset="us-ascii" Content-ID: <625CC96BF42E984693F6A2806BEB659D@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e3f23d0-ac2c-4bb6-2656-08d70e68dd43 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jul 2019 05:53:04.6178 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: yskoh@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3946 Subject: Re: [dpdk-dev] [PATCH v2 2/2] Revert "net/mlx5: fix master device Netlink socket sharing" 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > On Jul 21, 2019, at 7:56 AM, Viacheslav Ovsiienko wrote: >=20 > This reverts commit e28111ac9864af09e826241a915dfff87a9c00ad. > The netlink requests are replaced by ifindex caching and > not needed anymore. >=20 > Signed-off-by: Viacheslav Ovsiienko > Fixes: e28111ac9864 ("net/mlx5: fix master device Netlink socket sharing"= ) > --- Acked-by: Yongseok Koh > drivers/net/mlx5/mlx5.h | 6 --- > drivers/net/mlx5/mlx5_ethdev.c | 109 ++----------------------------------= ----- > 2 files changed, 3 insertions(+), 112 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h > index 1011dcc..3e75961 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -518,15 +518,9 @@ struct mlx5_priv { > /* mlx5_ethdev.c */ >=20 > int mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAME= SIZE]); > -int mlx5_get_ifname_base(const struct rte_eth_dev *base, > - const struct rte_eth_dev *dev, > - char (*ifname)[IF_NAMESIZE]); > int mlx5_get_master_ifname(const char *ibdev_path, char (*ifname)[IF_NAME= SIZE]); > unsigned int mlx5_ifindex(const struct rte_eth_dev *dev); > int mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr)= ; > -int mlx5_ifreq_base(const struct rte_eth_dev *base, > - const struct rte_eth_dev *dev, > - int req, struct ifreq *ifr); > int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu); > int mlx5_set_flags(struct rte_eth_dev *dev, unsigned int keep, > unsigned int flags); > diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethde= v.c > index dfd9e97..9629cfb 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -240,51 +240,6 @@ struct ethtool_link_settings { > } >=20 > /** > - * Get interface name for the specified device, uses the extra base > - * device resources to perform Netlink requests. > - * > - * This is a port representor-aware version of mlx5_get_master_ifname(). > - * > - * @param[in] base > - * Pointer to Ethernet device to use Netlink socket from > - * to perfrom requests. > - * @param[in] dev > - * Pointer to Ethernet device. > - * @param[out] ifname > - * Interface name output buffer. > - * > - * @return > - * 0 on success, a negative errno value otherwise and rte_errno is set= . > - */ > -int > -mlx5_get_ifname_base(const struct rte_eth_dev *base, > - const struct rte_eth_dev *dev, > - char (*ifname)[IF_NAMESIZE]) > -{ > - struct mlx5_priv *priv =3D dev->data->dev_private; > - struct mlx5_priv *priv_base =3D base->data->dev_private; > - unsigned int ifindex; > - > - assert(priv); > - assert(priv->sh); > - assert(priv_base); > - ifindex =3D priv_base->nl_socket_rdma >=3D 0 ? > - mlx5_nl_ifindex(priv_base->nl_socket_rdma, > - priv->sh->ibdev_name, > - priv->ibv_port) : 0; > - if (!ifindex) { > - if (!priv->representor) > - return mlx5_get_master_ifname(priv->sh->ibdev_path, > - ifname); > - rte_errno =3D ENXIO; > - return -rte_errno; > - } > - if (if_indextoname(ifindex, &(*ifname)[0])) > - return 0; > - rte_errno =3D errno; > - return -rte_errno; > -} > -/** > * Get the interface index from device name. > * > * @param[in] dev > @@ -346,51 +301,6 @@ struct ethtool_link_settings { > } >=20 > /** > - * Perform ifreq ioctl() on specified Ethernet device, > - * ifindex, name and other attributes are requested > - * on the base device to avoid specified device Netlink > - * socket sharing (this is not thread-safe). > - * > - * @param[in] base > - * Pointer to Ethernet device to get dev attributes. > - * @param[in] dev > - * Pointer to Ethernet device to perform ioctl. > - * @param req > - * Request number to pass to ioctl(). > - * @param[out] ifr > - * Interface request structure output buffer. > - * > - * @return > - * 0 on success, a negative errno value otherwise and rte_errno is set= . > - */ > -int > -mlx5_ifreq_base(const struct rte_eth_dev *base, > - const struct rte_eth_dev *dev, > - int req, struct ifreq *ifr) > -{ > - int sock =3D socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); > - int ret =3D 0; > - > - if (sock =3D=3D -1) { > - rte_errno =3D errno; > - return -rte_errno; > - } > - ret =3D mlx5_get_ifname_base(base, dev, &ifr->ifr_name); > - if (ret) > - goto error; > - ret =3D ioctl(sock, req, ifr); > - if (ret =3D=3D -1) { > - rte_errno =3D errno; > - goto error; > - } > - close(sock); > - return 0; > -error: > - close(sock); > - return -rte_errno; > -} > - > -/** > * Get device MTU. > * > * @param dev > @@ -872,15 +782,7 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, cha= r *fw_ver, size_t fw_size) > ifr =3D (struct ifreq) { > .ifr_data =3D (void *)&edata, > }; > - /* > - * Use special version of mlx5_ifreq() > - * to get master device name with local > - * device Netlink socket. Using master > - * device Netlink socket is not thread > - * safe. > - */ > - ret =3D mlx5_ifreq_base(dev, master, > - SIOCETHTOOL, &ifr); > + ret =3D mlx5_ifreq(master, SIOCETHTOOL, &ifr); > } > } > if (ret) { > @@ -977,12 +879,7 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, cha= r *fw_ver, size_t fw_size) > ifr =3D (struct ifreq) { > .ifr_data =3D (void *)&gcmd, > }; > - /* > - * Avoid using master Netlink socket. > - * This is not thread-safe. > - */ > - ret =3D mlx5_ifreq_base(dev, master, > - SIOCETHTOOL, &ifr); > + ret =3D mlx5_ifreq(master, SIOCETHTOOL, &ifr); > } > } > if (ret) { > @@ -1003,7 +900,7 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, cha= r *fw_ver, size_t fw_size) >=20 > *ecmd =3D gcmd; > ifr.ifr_data =3D (void *)ecmd; > - ret =3D mlx5_ifreq_base(dev, master ? master : dev, SIOCETHTOOL, &ifr); > + ret =3D mlx5_ifreq(master ? master : dev, SIOCETHTOOL, &ifr); > if (ret) { > DRV_LOG(DEBUG, > "port %u ioctl(SIOCETHTOOL," > --=20 > 1.8.3.1 >=20