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 25EEFA10DA for ; Wed, 31 Jul 2019 09:36:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4DC3F1C0C3; Wed, 31 Jul 2019 09:36:45 +0200 (CEST) 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 81E701C0AE for ; Wed, 31 Jul 2019 09:36:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E5VbThtcJT9BqwnsqzYB0zfGQF4qtjtRZ+S79zSLBUfWUxTw5JOwuQ/QQbCGMlZIX7Sg35mM49+A1YUTABk+TM3Ptbh4NZgDp6nIHvKTCm0VH/9NLf4Nh3lABviSfNNCHnZZEbQkATzwpTeGzkdvreZXb8PUWukjLqoaC8bBA9ZdiHW0cKszusKAyuo0jwh3IxWl++po7l+6Ju5FMbhPFH/5Kenc8Cyutd503yCjLChxvKaORIfBxErcQ9RPOrykqakc0/gOJfGTDQF1Bt3dnbyn+bzDFhfY1Xp5WFOmEUMSbwZZbHCY/4peVSRko1i6jiHq5H3jTZYk42B9K93rKQ== 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=pamQRWn00xTVl+2vONmIsuNsHmA0QBWLkOTOhUWwNeQ=; b=MUyTs2j37ZQnGWhl7ZDFcKt678uH+RaaauIlMm9XH79o+Q4w/K/dGR6hhtY0/tLRfkCB6dw4ddy82l25/5yn6SucgG8q6wy4tu2EteqHAFlEYa133NSzEIU4UxXCLB6U2uJRLB++N9eXgWVPCWkuPSgzGKuIEpUzq7W6y5Jn2fWHn91zLih2AB8P9tfqwaJGxT6EvEeETQAGPhlxC96a/fCLu5Iws6TwZSfqWmg7VfiWvK5nORuBxR0IUYdwWP5vEZaLmpEe5xsDvoyvIEfL7cPzWlVsE/Fpw2326RucBmfJG9F37v7OIB4zAzsPFpF4t1LkoOmsVd3Q1MM3EyoZ6A== 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=pamQRWn00xTVl+2vONmIsuNsHmA0QBWLkOTOhUWwNeQ=; b=FfNOKaXB6z9DE7NO6UZWCuXiRKjANGVr5zDH2/f9t3NGICJxRFlaowsNx9LFxEL8fUgnLHDJvwcuVFA1dAjRJvhyzh9lQh7Xg2pQEIkBQicPuHP3gYq127hniraAypTi5ApL8k9W140XLtxgUBNa6it0YIAQiZuv44+YWg9A9Uk= Received: from DB3PR0502MB3964.eurprd05.prod.outlook.com (52.134.65.161) by DB3PR0502MB3945.eurprd05.prod.outlook.com (52.134.65.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.15; Wed, 31 Jul 2019 07:36:26 +0000 Received: from DB3PR0502MB3964.eurprd05.prod.outlook.com ([fe80::b4f2:f531:d3ff:b7e3]) by DB3PR0502MB3964.eurprd05.prod.outlook.com ([fe80::b4f2:f531:d3ff:b7e3%5]) with mapi id 15.20.2115.005; Wed, 31 Jul 2019 07:36:26 +0000 From: Raslan Darawsheh To: Stephen Hemminger , Matan Azrad , Shahaf Shuler , Yongseok Koh , Slava Ovsiienko CC: "dev@dpdk.org" , "sju@paloaltonetworks.com" Thread-Topic: [dpdk-dev] [PATCH 2/2] net/mlx5: fix crash in dev_info_get in secondary process Thread-Index: AQHVOP9j3Pduifa6s0ei2HcB6ngyPqbkcxug Date: Wed, 31 Jul 2019 07:36:26 +0000 Message-ID: References: <20190712205425.17781-1-stephen@networkplumber.org> <20190712205425.17781-3-stephen@networkplumber.org> In-Reply-To: <20190712205425.17781-3-stephen@networkplumber.org> 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=rasland@mellanox.com; x-originating-ip: [212.29.221.74] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 36097dcd-dfa3-4a23-67a5-08d71589cbaf 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:DB3PR0502MB3945; x-ms-traffictypediagnostic: DB3PR0502MB3945: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:285; x-forefront-prvs: 011579F31F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(199004)(189003)(13464003)(76116006)(7696005)(66946007)(66446008)(64756008)(66556008)(66476007)(76176011)(99286004)(53936002)(6636002)(9686003)(6436002)(5660300002)(4326008)(6246003)(66066001)(229853002)(25786009)(52536014)(14454004)(478600001)(7736002)(74316002)(305945005)(71190400001)(71200400001)(6116002)(3846002)(33656002)(68736007)(486006)(86362001)(14444005)(11346002)(446003)(256004)(476003)(186003)(26005)(102836004)(55016002)(81166006)(81156014)(8936002)(53546011)(6506007)(316002)(2906002)(54906003)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3945; H:DB3PR0502MB3964.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: Gfcb7E0GjI7dFhdNXDqpuO3eowNxh1BytyoxHFdcRVcyPycb75uP36U3K667QP8UDid/HP7BsNqbbI6pNG0PqjC9btMGIM4fPgK9s3+j618Yx4TMr0qgcse2KK4QnbRfFL+zkfsYBnkmmovpQs9uwC9t+5BcLwrb2v3rbLYSzCsWwElE1jAuLZXmeUCT/KyPiXFJ4eiykJ50DBhyPMmIQ2XAKUFr8dz1sPyztCa/Gwkm42LoFqQfy/1j/nZkt+Nzb9lL7E3PGcecPWjRTuX5AIIlMjDzS+lVc56cVAreP7N//bcZll34kjnNkuDAG0UoAhzw/fv/6/Dtwy5LszNusWaYN0/VlGWeVZxyRM5XdcpONo5ACXQZKmmTZyfxUR3uyCwztM99eizS+7ibf9KUu8N6aN9oTAAkJ+8G7oDIM+A= 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: 36097dcd-dfa3-4a23-67a5-08d71589cbaf X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jul 2019 07:36:26.6848 (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: rasland@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3945 Subject: Re: [dpdk-dev] [PATCH 2/2] net/mlx5: fix crash in dev_info_get in secondary process 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" Hi Stephen, Can you please confirm that Slava's patch fixed your issue and this patch i= s not needed anymore for MLX5? So that I can take mlx4 patch only from this series? Kindest regards, Raslan Darawsheh > -----Original Message----- > From: dev On Behalf Of Stephen Hemminger > Sent: Friday, July 12, 2019 11:54 PM > To: Matan Azrad ; Shahaf Shuler > ; Yongseok Koh ; Slava > Ovsiienko > Cc: dev@dpdk.org; sju@paloaltonetworks.com; Stephen Hemminger > > Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: fix crash in dev_info_get in > secondary process >=20 > mlx5_dev_info_get calls mlx5_get_ifname, but mlx5_get_ifname > uses priv->ctx which is not a valid pointer in a secondary > process. The fix is to cache the value in primary. >=20 > In the primary process, get and store the interface index of > the device so that secondary process can see it. >=20 > Fixes: e60fbd5b24fc ("mlx5: add device configure/start/stop") > Signed-off-by: Stephen Hemminger > --- > drivers/net/mlx5/mlx5.c | 17 ++++++++--------- > drivers/net/mlx5/mlx5.h | 1 + > drivers/net/mlx5/mlx5_ethdev.c | 4 +--- > 3 files changed, 10 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index d93f92db56b5..27c5ef9b1763 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -1105,6 +1105,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, > int own_domain_id =3D 0; > uint16_t port_id; > unsigned int i; > + char ifname[IF_NAMESIZE]; >=20 > /* Determine if this port representor is supposed to be spawned. */ > if (switch_info->representor && dpdk_dev->devargs) { > @@ -1479,18 +1480,16 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, > mac.addr_bytes[0], mac.addr_bytes[1], > mac.addr_bytes[2], mac.addr_bytes[3], > mac.addr_bytes[4], mac.addr_bytes[5]); > -#ifndef NDEBUG > - { > - char ifname[IF_NAMESIZE]; >=20 > - if (mlx5_get_ifname(eth_dev, &ifname) =3D=3D 0) > - DRV_LOG(DEBUG, "port %u ifname is \"%s\"", > + if (mlx5_get_ifname(eth_dev, &ifname) =3D=3D 0) { > + priv->if_index =3D if_nametoindex(ifname); > + DRV_LOG(DEBUG, "port %u ifname is \"%s\"", > eth_dev->data->port_id, ifname); > - else > - DRV_LOG(DEBUG, "port %u ifname is unknown", > - eth_dev->data->port_id); > + } else { > + DRV_LOG(DEBUG, "port %u ifname is unknown", > + eth_dev->data->port_id); > } > -#endif > + > /* Get actual MTU if possible. */ > err =3D mlx5_get_mtu(eth_dev, &priv->mtu); > if (err) { > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h > index 5af3f413cdcb..a06ffd444255 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -342,6 +342,7 @@ struct mlx5_priv { > uint16_t vlan_filter[MLX5_MAX_VLAN_IDS]; /* VLAN filters table. */ > unsigned int vlan_filter_n; /* Number of configured VLAN filters. */ > /* Device properties. */ > + unsigned int if_index; /* Associated kernel network device index. */ > uint16_t mtu; /* Configured MTU. */ > unsigned int isolated:1; /* Whether isolated mode is enabled. */ > unsigned int representor:1; /* Device is a port representor. */ > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > b/drivers/net/mlx5/mlx5_ethdev.c > index eeefe4df3cd4..41e58db5e573 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -605,7 +605,6 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct > rte_eth_dev_info *info) > struct mlx5_priv *priv =3D dev->data->dev_private; > struct mlx5_dev_config *config =3D &priv->config; > unsigned int max; > - char ifname[IF_NAMESIZE]; >=20 > /* FIXME: we should ask the device for these values. */ > info->min_rx_bufsize =3D 32; > @@ -626,8 +625,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct > rte_eth_dev_info *info) > info->rx_offload_capa =3D (mlx5_get_rx_port_offloads() | > info->rx_queue_offload_capa); > info->tx_offload_capa =3D mlx5_get_tx_port_offloads(dev); > - if (mlx5_get_ifname(dev, &ifname) =3D=3D 0) > - info->if_index =3D if_nametoindex(ifname); > + info->if_index =3D priv->if_index; > info->reta_size =3D priv->reta_idx_n ? > priv->reta_idx_n : config->ind_table_max_size; > info->hash_key_size =3D MLX5_RSS_HASH_KEY_LEN; > -- > 2.20.1