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 3BC35A00E6 for ; Mon, 5 Aug 2019 09:42:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F04991BE33; Mon, 5 Aug 2019 09:42:10 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20063.outbound.protection.outlook.com [40.107.2.63]) by dpdk.org (Postfix) with ESMTP id 79B371BE26; Mon, 5 Aug 2019 09:42:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SBMcDLfj7wTVGAiYKz5vBZQ5cnkdzEzXDcMriSINE6+hUFUmq4QLdHopNCE2zb9b8qlK/BQBOEXEP8msPNFkGu2LHs+DoBLcMUSgDhw4f5ia/5BF9gaXzMB5fHPpLV/ulA5fV/G5Ed0Fieo0fE67N6Pb61eI27U7o6w3uk9JxxNWeR8zvjO9RovoTjKt4lZEFYj6e3/FE3g4YhMDEYFJaCSrL7Sx4ad8RJQ6r36qSmlb/ycT836oP+0IBgcWwo2XhJkyKjVdrbmrfwSwkZU69JEHmIWAgADzjHWUqwYgz/w18r6+uPu79LzQOewtcg4R0H3p+2obFi9bHHXa/hKouw== 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=2w5D/b94t+GcWf1NWmXwO6XuLeLVNZpCkm2iLpYGhB8=; b=kcIsOwoumIx4rYpdRQyYe85uVjIPD4jnlk3LUdqfKiFRW3setjaPSFG1pJnTmLEpnxz47xP786S0OP3ofqumy7tm66v/d0uSWsNT9LSVuKodNaGhOH2nseqH6lSb9KCWbqNbvNNAIoAA5lVTxvxRoc9FU1g6awyLP8KGkwkPBDLe89gpjTFFjk5em6ifG6c4jM15MV2lyl1uvEHuKh9P3WJya3txwLApYPvTmcNCEz7bvSl7S/MCKQdyAZiTPYtOiqUs23Eo+VDZQJcWIUXMpjVmVpbVP3a6VjD7LyH7hdYz8W6VWg4Lldb81wVOQsVu4JKBbOS8MOjK2g4/r2QMdw== 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=2w5D/b94t+GcWf1NWmXwO6XuLeLVNZpCkm2iLpYGhB8=; b=qjgSBtIHl6zMqYaDlu92fv9lwaFfk0mXzbTcXQ7HzCG0yLtdMG5QYIP3d+26oEUpaM9UjHwOPc49KUS5uaIm3RpMR/dC0qB2ms9N6vdS6W+nIli0WrTEVShrN5hl9/pp4BI+j4LO1R1SOxEOVAPb6nSMe8dvNcwUT60BDRMkTDo= Received: from DB3PR0502MB3964.eurprd05.prod.outlook.com (52.134.65.161) 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.2136.17; Mon, 5 Aug 2019 07:42:08 +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.2136.018; Mon, 5 Aug 2019 07:42:08 +0000 From: Raslan Darawsheh To: Stephen Hemminger , Matan Azrad , Shahaf Shuler , Yongseok Koh , Slava Ovsiienko CC: "dev@dpdk.org" , "sju@paloaltonetworks.com" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/2] net/mlx4: fix crash in dev_info_get in secondary process Thread-Index: AQHVOP9daI4y/GQiwEezDOc34D8sdqbqsYEggAGe8jA= Date: Mon, 5 Aug 2019 07:42:08 +0000 Message-ID: References: <20190712205425.17781-1-stephen@networkplumber.org> <20190712205425.17781-2-stephen@networkplumber.org> In-Reply-To: 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: 93b547a4-f2f9-4457-f6f1-08d719786b5d 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:144; x-forefront-prvs: 01208B1E18 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(136003)(376002)(346002)(396003)(39860400002)(189003)(199004)(13464003)(86362001)(5660300002)(76176011)(66066001)(71190400001)(71200400001)(74316002)(2906002)(26005)(229853002)(186003)(7696005)(81166006)(81156014)(110136005)(256004)(102836004)(33656002)(305945005)(316002)(99286004)(6506007)(53546011)(7736002)(6246003)(14454004)(52536014)(486006)(9686003)(478600001)(25786009)(8936002)(54906003)(6116002)(3846002)(76116006)(476003)(66476007)(66556008)(64756008)(53936002)(6436002)(4326008)(11346002)(446003)(66946007)(55016002)(6636002)(68736007)(66446008); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3946; H:DB3PR0502MB3964.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 8q9OWyvuN5Ys7Ej1YUilvEcl1Dd44Y6pwAFYIWvTZPbJlQOyFV/Pb3d7BKGh0Stt5dH83P28AkpIzY39MSTgHgmZcT1h56BHfXGaE80D5X36f73y3rUXd8SbSBTcFwCmr0VSiezSTQKXXvZuIv8f5+S/oJ5OkHiZmumTMf/GQMkv466/YqeZyT6DB+PeE4bcZ2J5x829IiZ3xpiKMxTHK8LjG47ykSVaDqZdLOd6io5od7I8vNyzjVh0CZ1mPfDmp7mpAKiG47nhJi9OTjj5DqZE19QmA45uAanJkINd3okccPrJzbCzjR7wkZQmJR5lHg+rDpDu77gyaQcPtlcMzKNnLNGUtv2pga/J1leNiMDHZWLBkr3mjZRPkAD+o2skVD4LBpli9md9gYMLNHWhluNg4yLCwFYASbXGjHePKBc= 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: 93b547a4-f2f9-4457-f6f1-08d719786b5d X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Aug 2019 07:42:08.3455 (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: DB3PR0502MB3946 Subject: Re: [dpdk-dev] [PATCH 1/2] net/mlx4: 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, > -----Original Message----- > From: Raslan Darawsheh > Sent: Sunday, August 4, 2019 9:58 AM > To: Stephen Hemminger ; Matan Azrad > ; Shahaf Shuler ; > Yongseok Koh ; Slava Ovsiienko > > Cc: dev@dpdk.org; sju@paloaltonetworks.com; stable@dpdk.org > Subject: RE: [dpdk-dev] [PATCH 1/2] net/mlx4: fix crash in dev_info_get i= n > secondary process >=20 > Hi Stephen, >=20 > Wrong headline format: > net/mlx4: fix crash in dev_info_get in secondary process can you = please > fix it? You shouldn't use the _ in the title format >=20 > Kindest regards, > Raslan Darawsheh >=20 > > -----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 > > ; stable@dpdk.org > > Subject: [dpdk-dev] [PATCH 1/2] net/mlx4: fix crash in dev_info_get in > > secondary process > > > > mlx4_dev_info_get calls mlx4_get_ifname, but mlx4_get_ifname uses > > priv->ctx which is not a valid pointer in a secondary process. The fix > > is to cache the value in primary. > > > > In the primary process, get and store the interface index of the > > device so that secondary process can see it. > > > > Bugzilla ID:320 > > Fixes: 61cbdd419478 ("net/mlx4: separate device control functions") > > Cc: stable@dpdk.org > > Reported-by: Suyang Ju > > Signed-off-by: Stephen Hemminger > > --- > > drivers/net/mlx4/mlx4.c | 19 +++++++++---------- > > drivers/net/mlx4/mlx4.h | 1 + > > drivers/net/mlx4/mlx4_ethdev.c | 4 +--- > > 3 files changed, 11 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index > > 2e169b0887a7..bab2cadbe519 100644 > > --- a/drivers/net/mlx4/mlx4.c > > +++ b/drivers/net/mlx4/mlx4.c > > @@ -763,6 +763,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, > > struct rte_pci_device *pci_dev) > > }; > > unsigned int vf; > > int i; > > + char ifname[IF_NAMESIZE]; > > > > (void)pci_drv; > > err =3D mlx4_init_once(); > > @@ -1002,17 +1003,15 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, > > struct rte_pci_device *pci_dev) > > mac.addr_bytes[4], mac.addr_bytes[5]); > > /* Register MAC address. */ > > priv->mac[0] =3D mac; > > -#ifndef NDEBUG > > - { > > - char ifname[IF_NAMESIZE]; > > - > > - if (mlx4_get_ifname(priv, &ifname) =3D=3D 0) > > - DEBUG("port %u ifname is \"%s\"", > > - priv->port, ifname); > > - else > > - DEBUG("port %u ifname is unknown", priv- > > >port); > > + > > + if (mlx4_get_ifname(priv, &ifname) =3D=3D 0) { > > + DEBUG("port %u ifname is \"%s\"", > > + priv->port, ifname); > > + priv->if_index =3D if_nametoindex(ifname); > > + } else { > > + DEBUG("port %u ifname is unknown", priv->port); > > } > > -#endif > > + > > /* Get actual MTU if possible. */ > > mlx4_mtu_get(priv, &priv->mtu); > > DEBUG("port %u MTU is %u", priv->port, priv->mtu); diff --git > > a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index > > cd0d637ac2bf..81b529ee8030 100644 > > --- a/drivers/net/mlx4/mlx4.h > > +++ b/drivers/net/mlx4/mlx4.h > > @@ -159,6 +159,7 @@ struct mlx4_priv { > > struct ibv_device_attr device_attr; /**< Device properties. */ > > struct ibv_pd *pd; /**< Protection Domain. */ > > /* Device properties. */ > > + unsigned int if_index; /**< Associated network device index */ > > uint16_t mtu; /**< Configured MTU. */ > > uint8_t port; /**< Physical port number. */ > > uint32_t started:1; /**< Device started, flows enabled. */ diff > > --git a/drivers/net/mlx4/mlx4_ethdev.c > > b/drivers/net/mlx4/mlx4_ethdev.c index ceef921620a8..5d28c0116d21 > > 100644 > > --- a/drivers/net/mlx4/mlx4_ethdev.c > > +++ b/drivers/net/mlx4/mlx4_ethdev.c > > @@ -616,7 +616,6 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, > struct > > rte_eth_dev_info *info) { > > struct mlx4_priv *priv =3D dev->data->dev_private; > > unsigned int max; > > - char ifname[IF_NAMESIZE]; > > > > /* FIXME: we should ask the device for these values. */ > > info->min_rx_bufsize =3D 32; > > @@ -637,8 +636,7 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, > struct > > rte_eth_dev_info *info) > > info->rx_queue_offload_capa =3D mlx4_get_rx_queue_offloads(priv); > > info->rx_offload_capa =3D (mlx4_get_rx_port_offloads(priv) | > > info->rx_queue_offload_capa); > > - if (mlx4_get_ifname(priv, &ifname) =3D=3D 0) > > - info->if_index =3D if_nametoindex(ifname); > > + info->if_index =3D priv->if_index; > > info->hash_key_size =3D MLX4_RSS_HASH_KEY_SIZE; > > info->speed_capa =3D > > ETH_LINK_SPEED_1G | > > -- > > 2.20.1 Patch applied to next-net-mlx after fixing wrong headline format, Kindest regards, Raslan Darawsheh