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 1F298A0096 for ; Fri, 10 May 2019 23:24:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 105242082; Fri, 10 May 2019 23:24:58 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00055.outbound.protection.outlook.com [40.107.0.55]) by dpdk.org (Postfix) with ESMTP id A60EFA3 for ; Fri, 10 May 2019 23:24:56 +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=BGftlZgbMgUC517haudaiuZpYPsWBIwNG0vAwiaOBXI=; b=dMjRAGIYaWuOveJ73MeT4q0gGC8B/5P6/cg9newmxKMuJn8CBSID/qebDTnI7om4APYWMH0c4sH70s5Xwux0algadB7VXQvAxsq8wZTOnuApOdm42AhBKLVpV7FAtXROH8o4gnp1ow1iynsC5g3HQWD83/jSAN4/g+X2oW4RQdQ= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3948.eurprd05.prod.outlook.com (52.134.72.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1878.22; Fri, 10 May 2019 21:24:54 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::e8d5:4aff:902d:6e98]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::e8d5:4aff:902d:6e98%5]) with mapi id 15.20.1878.019; Fri, 10 May 2019 21:24:54 +0000 From: Yongseok Koh To: Slava Ovsiienko CC: dev , Shahaf Shuler Thread-Topic: [PATCH] net/mlx5: fix device removal handler for multiport device Thread-Index: AQHVBz31yA+gcue4IEyg9ulmzwGBHKZk3yGA Date: Fri, 10 May 2019 21:24:54 +0000 Message-ID: <19FAA938-F942-47DD-8A26-A5A56E828079@mellanox.com> References: <1557498982-27734-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1557498982-27734-1-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: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dda610af-4a38-4f19-e11e-08d6d58df1f0 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:DB3PR0502MB3948; x-ms-traffictypediagnostic: DB3PR0502MB3948: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3276; x-forefront-prvs: 0033AAD26D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(376002)(39860400002)(136003)(199004)(189003)(54906003)(37006003)(14454004)(316002)(6486002)(66556008)(71190400001)(71200400001)(36756003)(6636002)(8676002)(6512007)(83716004)(81166006)(81156014)(478600001)(6862004)(11346002)(8936002)(229853002)(33656002)(446003)(76176011)(64756008)(66446008)(6246003)(102836004)(2906002)(91956017)(486006)(3846002)(53546011)(6116002)(66476007)(107886003)(6506007)(4326008)(2616005)(25786009)(476003)(86362001)(53936002)(68736007)(186003)(6436002)(7736002)(66066001)(99286004)(76116006)(256004)(82746002)(14444005)(73956011)(66946007)(305945005)(26005)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3948; 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: ZMJQJ0Hx073Ly9mwa0SamCWFPJ7Cj2o4V64pdzNyBU6qoW+82vnwoEdK9T6c4tNvqqFvZ3tIfXdfmqBMBwEib8Dqwq+m8i1nYvHH9317jyvaiKHlMCutzfrJfVJ/DxdinuUs3GDkYpVy7hkiXLUkZ85+vyVTHRc5mAVi5R4omMg6yh4aFdaOno+9jc7unHFLGvcSVkL+eoaQJpGM0FeqC3oKZfLGtEOKpkCjO1Dsoclbm6ep/3NzyJ/VmuCiaTJryq0OV6KfZuz7Uugyc+GQnEikKU3O84tL0Bqt/te82Vusxxu84SHTw9sGnIC4u2/+0e27/4uVW3NR9xBwZTiIvo+OYNsiskaKbJ+N+MRA8Zb1ZRnsk7kpBp3ihAw3kXSWMPVJyeD1RUQpPEpDro3CpJTqFYHBfV1s/c/wm9GSGRU= Content-Type: text/plain; charset="UTF-8" Content-ID: <34B5BE5A07164D469340D7A7C2792FD4@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: dda610af-4a38-4f19-e11e-08d6d58df1f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2019 21:24:54.4143 (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: DB3PR0502MB3948 Subject: Re: [dpdk-dev] [PATCH] 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: <20190510212454._bf_MLvHjoBfxM135oZiU3-riTLjmiLQGikeqGRDrtg@z> > On May 10, 2019, at 7:36 AM, Viacheslav Ovsiienko wrote: >=20 > 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. >=20 > Fixes: 028b2a28c3cb ("net/mlx5: update event handler for multiport IB dev= ices") >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_ethdev.c | 43 +++++++++++++++++++++++++++++++++++++= ++++- > 1 file changed, 42 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethde= v.c > index 80ee98f..3962d41 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, c= har *fw_ver, size_t fw_size) > } >=20 > /** > + * 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,6 +1166,16 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, c= har *fw_ver, size_t fw_size) > break; > /* Retrieve and check IB port index. */ > tmp =3D (uint32_t)event.element.port_num; > + if (!tmp && event.event_type =3D=3D IBV_EVENT_DEVICE_FATAL) { > + /* > + * 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; > + } Then, you should clear the previous handle below, right? I mean this if-cla= use. if (event.event_type =3D=3D IBV_EVENT_DEVICE_FATAL && > assert(tmp && (tmp <=3D sh->max_port)); > if (!tmp || > tmp > sh->max_port || > @@ -1146,12 +1185,14 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, = char *fw_ver, size_t fw_size) > * installed for this port. > */ > mlx5_glue->ack_async_event(&event); > + DRV_LOG(DEBUG, > + "port %u event type %d on not handled", Needs to fix the sentence. Be more specific. For example, port %u cannot handle an event (type %d) due to invalid IB port index One more below. That should be something like=20 port %u cannot handle an unknown event (type %d) Thanks, Yongseok > + tmp, event.event_type); > 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) && > --=20 > 1.8.3.1 >=20