From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 96AE7A00E6 for ; Sun, 12 May 2019 19:17:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7FAD44C96; Sun, 12 May 2019 19:17:33 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80080.outbound.protection.outlook.com [40.107.8.80]) by dpdk.org (Postfix) with ESMTP id 65AE54C95 for ; Sun, 12 May 2019 19:17:32 +0200 (CEST) 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=h6q5zSqLTIJSbHONcYWofM8n17F+SC52ZoL2K/lK8I4=; b=Ats7o9maomab1zbnzezEzIc6I2qJeiWbeYS82/mDNfzQT87pPeYDQI1V/CDDi3OW4vAweNCUkOrDhBYvZaWCwBZlqycEQTmqWfjzHP3YNnw3RXqGYsg/Mlfk2aUutg7EWx77fKgw299BtxzGTpulvmr1RVnH1YIbSkcnVO0CJOA= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB3971.eurprd05.prod.outlook.com (52.133.40.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1878.25; Sun, 12 May 2019 17:17:31 +0000 Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::8c0:a6ef:6abc:334d]) by AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::8c0:a6ef:6abc:334d%7]) with mapi id 15.20.1878.024; Sun, 12 May 2019 17:17:31 +0000 From: Shahaf Shuler To: Shahaf Shuler , Slava Ovsiienko , "dev@dpdk.org" , Yongseok Koh , Thomas Monjalon , "ferruh.yigit@intel.com" Thread-Topic: [dpdk-dev] [PATCH v2] net/mlx5: fix device removal handler for multiport device Thread-Index: AQHVCOaU7iZjlWpTI02BvocOmhIjdQ== Date: Sun, 12 May 2019 17:17:31 +0000 Message-ID: References: <1557498982-27734-1-git-send-email-viacheslavo@mellanox.com> <1557649949-16370-1-git-send-email-viacheslavo@mellanox.com> 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=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3e5a7911-de13-4ba8-fa63-08d6d6fdb771 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR0502MB3971; x-ms-traffictypediagnostic: AM0PR0502MB3971: x-ms-exchange-purlcount: 1 x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2150; x-forefront-prvs: 0035B15214 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(396003)(366004)(376002)(346002)(136003)(39860400002)(189003)(199004)(81166006)(966005)(256004)(81156014)(316002)(14444005)(53936002)(2501003)(6246003)(5660300002)(86362001)(25786009)(478600001)(33656002)(68736007)(71200400001)(71190400001)(8936002)(66556008)(229853002)(66446008)(64756008)(66476007)(99286004)(11346002)(7696005)(446003)(186003)(66066001)(45080400002)(52536014)(305945005)(14454004)(76116006)(73956011)(66946007)(2940100002)(7736002)(74316002)(486006)(6506007)(9686003)(6306002)(6116002)(26005)(55016002)(3846002)(102836004)(6436002)(110136005)(76176011)(476003)(2906002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3971; H:AM0PR0502MB3795.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: ouFO70mtMAd87nBbWO/wWC0H0gqNxUytmGD3BrZH+QJ6Wbdxu2wuOKKAUDLDtDoJijxcKGlgD9a66u4uvsjKIGTdT3xePuhfhZiMwZRpgJEEEiQZkCMoJXGKSTH2aLqVZYMsofOUo0vx3HQLaqmeURLi1EjmmnHFXMwbgpLfidoMDVzLz8Sbo8X1WUoIET6yjOmIvqtispXK0lbSDxAdG7e63gLn04xF2aON5238JP2bF2l7ss7/UD7GHrkAXNm3FXWGkPV2QWlsHy8GMNJNlcW2F0IfHZ5y6hWw2+b+STHYfrLKc+vcoCulmQrjj7kO94FNlHupmKAZ/36liI13OjxXdgrdtFI1Px0XSBbBlpkXz+ZWRy32km1GHiyglnQDnLf7Hxnh0sp3ksy855QKkC3AOSIhfotCRSMvlz52ulc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e5a7911-de13-4ba8-fa63-08d6d6fdb771 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 May 2019 17:17:31.0964 (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-Transport-CrossTenantHeadersStamped: AM0PR0502MB3971 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix device removal handler for multiport device 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" Message-ID: <20190512171731.gl_0_ucTj023r8BmHtJyUIg9O-Iqx5_-h5Pgj-eOrvI@z> Sunday, May 12, 2019 3:15 PM, Shahaf Shuler: > Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix device removal handler f= or > multiport device >=20 > Sunday, May 12, 2019 11:32 AM, Viacheslav Ovsiienko: > > Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix device removal handler > > for multiport device > > > > IBV_EVENT_DEVICE_FATAL event is generated by the driver once for the > > entire multiport Infiniband device, not for each existing ports. > > The port index is zero and it causes dropping the device removal > > event. We should invoke the removal event processing routine for each > > port we have installed handler for. > > > > Fixes: 028b2a28c3cb ("net/mlx5: update event handler for multiport IB > > devices") > > > > Signed-off-by: Viacheslav Ovsiienko >=20 > Acked-by: Shahaf Shuler >=20 > Thomas, Ferruh, > This one is a critical fix for mlx5. w/o it will break the support for fa= ilsafe at > azure. >=20 > Can you consider to integrate it? Applied it also to next-net-mlx, thanks.=20 >=20 > > --- > > v2: - address comments > > - more detailed debug messages in the event handler > > - removed port specific IBV_EVENT_DEVICE_FATAL handling code > > > > v1: > > > https://eur03.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fpatch > > > es.dpdk.org%2Fpatch%2F53371%2F&data=3D02%7C01%7Cshahafs%40mel > > > lanox.com%7C46fcede947654c45106e08d6d6b462e5%7Ca652971c7d2e4d9ba > > > 6a4d149256f461b%7C0%7C0%7C636932467570850420&sdata=3D%2FN%2B > > D0OWf5y0hgtlvWj7om9qZrQPPIbmGXDIfsgqeUtY%3D&reserved=3D0 > > > > drivers/net/mlx5/mlx5_ethdev.c | 77 > > ++++++++++++++++++++++++++++++++++-------- > > 1 file changed, 62 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > > b/drivers/net/mlx5/mlx5_ethdev.c index 80ee98f..a8a7ece 100644 > > --- a/drivers/net/mlx5/mlx5_ethdev.c > > +++ b/drivers/net/mlx5/mlx5_ethdev.c > > @@ -1116,6 +1116,35 @@ int mlx5_fw_version_get(struct rte_eth_dev > > *dev, char *fw_ver, size_t fw_size) } > > > > /** > > + * Handle asynchronous removal event for entire multiport device. > > + * > > + * @param sh > > + * Infiniband device shared context. > > + */ > > +static void > > +mlx5_dev_interrupt_device_fatal(struct mlx5_ibv_shared *sh) { > > + uint32_t i; > > + > > + for (i =3D 0; i < sh->max_port; ++i) { > > + struct rte_eth_dev *dev; > > + > > + if (sh->port[i].ih_port_id >=3D RTE_MAX_ETHPORTS) { > > + /* > > + * Or not existing port either no > > + * handler installed for this port. > > + */ > > + continue; > > + } > > + dev =3D &rte_eth_devices[sh->port[i].ih_port_id]; > > + assert(dev); > > + if (dev->data->dev_conf.intr_conf.rmv) > > + _rte_eth_dev_callback_process > > + (dev, RTE_ETH_EVENT_INTR_RMV, NULL); > > + } > > +} > > + > > +/** > > * Handle shared asynchronous events the NIC (removal event > > * and link status change). Supports multiport IB device. > > * > > @@ -1137,21 +1166,46 @@ int mlx5_fw_version_get(struct rte_eth_dev > > *dev, char *fw_ver, size_t fw_size) > > break; > > /* Retrieve and check IB port index. */ > > tmp =3D (uint32_t)event.element.port_num; > > - assert(tmp && (tmp <=3D sh->max_port)); > > - if (!tmp || > > - tmp > sh->max_port || > > - sh->port[tmp - 1].ih_port_id >=3D RTE_MAX_ETHPORTS) { > > + if (!tmp && event.event_type =3D=3D > > IBV_EVENT_DEVICE_FATAL) { > > /* > > - * Invalid IB port index or no handler > > - * installed for this port. > > + * The DEVICE_FATAL event is called once for > > + * entire device without port specifying. > > + * We should notify all existing ports. > > */ > > mlx5_glue->ack_async_event(&event); > > + mlx5_dev_interrupt_device_fatal(sh); > > + continue; > > + } > > + assert(tmp && (tmp <=3D sh->max_port)); > > + if (!tmp) { > > + /* Unsupported devive level event. */ > > + mlx5_glue->ack_async_event(&event); > > + DRV_LOG(DEBUG, > > + "unsupported common event (type %d)", > > + event.event_type); > > + continue; > > + } > > + if (tmp > sh->max_port) { > > + /* Invalid IB port index. */ > > + mlx5_glue->ack_async_event(&event); > > + DRV_LOG(DEBUG, > > + "cannot handle an event (type %d)" > > + "due to invalid IB port index (%u)", > > + event.event_type, tmp); > > + continue; > > + } > > + if (sh->port[tmp - 1].ih_port_id >=3D RTE_MAX_ETHPORTS) { > > + /* No handler installed. */ > > + mlx5_glue->ack_async_event(&event); > > + DRV_LOG(DEBUG, > > + "cannot handle an event (type %d)" > > + "due to no handler installed for port %u", > > + event.event_type, tmp); > > continue; > > } > > /* Retrieve ethernet device descriptor. */ > > tmp =3D sh->port[tmp - 1].ih_port_id; > > dev =3D &rte_eth_devices[tmp]; > > - tmp =3D 0; > > assert(dev); > > if ((event.event_type =3D=3D IBV_EVENT_PORT_ACTIVE || > > event.event_type =3D=3D IBV_EVENT_PORT_ERR) && @@ - > > 1165,15 +1219,8 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, > > char *fw_ver, size_t fw_size) > > (dev, RTE_ETH_EVENT_INTR_LSC, NULL); > > continue; > > } > > - if (event.event_type =3D=3D IBV_EVENT_DEVICE_FATAL && > > - dev->data->dev_conf.intr_conf.rmv) { > > - mlx5_glue->ack_async_event(&event); > > - _rte_eth_dev_callback_process > > - (dev, RTE_ETH_EVENT_INTR_RMV, NULL); > > - continue; > > - } > > DRV_LOG(DEBUG, > > - "port %u event type %d on not handled", > > + "port %u cannot handle an unknown event (type > > %d)", > > dev->data->port_id, event.event_type); > > mlx5_glue->ack_async_event(&event); > > } > > -- > > 1.8.3.1