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 2B7B6A0613 for ; Sun, 4 Aug 2019 08:57:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 988BF1BEF2; Sun, 4 Aug 2019 08:57:36 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60080.outbound.protection.outlook.com [40.107.6.80]) by dpdk.org (Postfix) with ESMTP id 002F91BEE8; Sun, 4 Aug 2019 08:57:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n0T7S3xP/Gg9WFyD1TRlIlWcjFPfs7WOI+mTcRWTTS6JagTk8DVBUMK+ChhPqdKubIRF9CV+/u4O8fHojBNNpl2fevNXGOOEZAbwp0fCan5dtUYgm/P9DSwbFIGWGmFFbecsP+s25SE1NWz9kzEcBxp/GfGg2uSHqPOZuuq+IwPmYmr9K7f/zOwaDxiqyc40oGJTHv4GoySh3MnQ2AiMYlB/f16D0b6Gywlqn01Xi+91VKWXtqv5EAlxeS6+8BxPLMn9lZaR3zBIlnszx4vBomihcVNnmbI4uKH6KwAW57tWYJqfn3gjeRGuCQMZ7ahFVw29PM8fE/fhrCC94sYtCA== 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=HhzBkXB0JN83roAQxsT6XpTAKJOZnxSjJqbFFa8Ulks=; b=EcwFL6V8HzRHcbZBMHbr25nZ3rfy/rUp9A85xhMR2zPEhnk+/9dJiYgx33AlK9oZDUa4aGyLuqZbVDusKxNJ74MVVv/NbsDhCNCtmZUHyUaLTiR2EiuVGpHqA8T9fPAHeIsD4QwDiVc5CZcB9nwrribyZ0GaXYTPxD5tTTzY/UuzAy7TwDXtjZOUWPd8GMIaVapn/S1zGq0GIZVRGGF9hsXlEuI5w0IGg2WDDTpQYKwMGcSS6OR6H/Evttdi334YBZNiu53Jf1aQ9ekQPqInDMMsUcjLoSSRm+Lb9JFQ4QcAjWl6RCslCvkHz/TWrbA+TN5ElUG6xcRv32vsZmJD6A== 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=HhzBkXB0JN83roAQxsT6XpTAKJOZnxSjJqbFFa8Ulks=; b=Avr+M78vKOJ+ke1YrjK6UCSr1OmyN4JqXHREMFRaueeNQpClowlc6MTjZCpGgValpH5WDAUDN1ETO7IgB+HRsW0S8ZAQe1nYXPYXgWLXawWyWn4t3b0lThvEwi9klmBSsvr4ZKbCVf1OduOoyiUWEVmb8Wr9Dy7Vc+wkvfRzOAc= Received: from DB3PR0502MB3964.eurprd05.prod.outlook.com (52.134.65.161) by DB3PR0502MB3961.eurprd05.prod.outlook.com (52.134.70.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.17; Sun, 4 Aug 2019 06:57:34 +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; Sun, 4 Aug 2019 06:57:34 +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/GQiwEezDOc34D8sdqbqsYEg Date: Sun, 4 Aug 2019 06:57:34 +0000 Message-ID: References: <20190712205425.17781-1-stephen@networkplumber.org> <20190712205425.17781-2-stephen@networkplumber.org> In-Reply-To: <20190712205425.17781-2-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: 9fabfa37-a2f1-43ef-87d0-08d718a90726 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:DB3PR0502MB3961; x-ms-traffictypediagnostic: DB3PR0502MB3961: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:255; x-forefront-prvs: 0119DC3B5E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(366004)(136003)(396003)(376002)(346002)(189003)(199004)(13464003)(25786009)(71200400001)(71190400001)(256004)(9686003)(4326008)(55016002)(2906002)(229853002)(6436002)(81156014)(81166006)(76116006)(66946007)(11346002)(446003)(66446008)(64756008)(66556008)(66476007)(476003)(486006)(52536014)(5660300002)(26005)(6636002)(3846002)(6116002)(305945005)(316002)(7736002)(6246003)(14454004)(186003)(86362001)(33656002)(74316002)(99286004)(102836004)(66066001)(478600001)(8936002)(54906003)(110136005)(7696005)(53936002)(68736007)(6506007)(53546011)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3961; 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: Mn0PWChOkdsE7ojz5gwSR5LgTHfFnDgFSJNij20Mphlr6Onx1SZ2odE3EdrBQhy7zgfwSv7l8UOh4wXcPuMensjMTfx2iwCQfaJbPgysOCHgJTBWc7OEIcJVLEH/C6fu7ahGrKKS/92/zT1uMVMbELRDbwLnhfZ2ACuHLxY896XS/RD2mAuNfsty2JQmeU2wyW/qUB1xVbhTN1gg8IRD9BJJSNra1kKzXVo3kcC8oecM/Zol+Qq+Ob1BvjNmBYDhRgteP1XCDsXT39u1Vc8zXXwcTmnWV142GS0Oj7YvtZ3pvaxAJbSW6ut9WpvtKT6QO0dLTjmTQ9+dPphL05J8zymd5QyjiiYFDlJ3eYoUxXmKqyeS8/rlNDthwFHsLnglXmPjZFQGW4rTOV90wSwijwDIgHP9cSUMV73m4f7T79Y= 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: 9fabfa37-a2f1-43ef-87d0-08d718a90726 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Aug 2019 06:57:34.3140 (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: DB3PR0502MB3961 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 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 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 > ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH 1/2] net/mlx4: fix crash in dev_info_get in > secondary process >=20 > 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. >=20 > In the primary process, get and store the interface index of > the device so that secondary process can see it. >=20 > 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(-) >=20 > 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]; >=20 > (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]; >=20 > /* 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