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 EB3E1A00E6 for ; Sun, 12 May 2019 14:15:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B2DAA493D; Sun, 12 May 2019 14:15:17 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150074.outbound.protection.outlook.com [40.107.15.74]) by dpdk.org (Postfix) with ESMTP id 87ED210BD for ; Sun, 12 May 2019 14:15:16 +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=14SYto6WEPkx4vTzn1dI4VA1qSZ/PqU0YshmwS3oB+w=; b=L26WKCGM5aq+yUF6iYYDjtXXo1Vs/WvXDD20Crl3P3HNMvJtjdETlrH2NPmXqL56Z35QxpLjIQp+EC5QXAsR344n8FEnRFFoOjeNHWnKXuzKZT4uB7eO2nYzwejCvvEHJ9MLcBcI2K4M3Ti0tDWnptWL34VHs68uWxmR5kgS/H0= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB3986.eurprd05.prod.outlook.com (52.133.40.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1878.22; Sun, 12 May 2019 12:15:15 +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 12:15:15 +0000 From: Shahaf Shuler To: 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: AQHVCJ1BhqkulZl16kGq3fkd5CLif6ZnZwgw Date: Sun, 12 May 2019 12:15:15 +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: <1557649949-16370-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=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4b9014fb-73b6-4d0e-84b1-08d6d6d37db8 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:AM0PR0502MB3986; x-ms-traffictypediagnostic: AM0PR0502MB3986: 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)(366004)(376002)(136003)(396003)(346002)(39860400002)(189003)(199004)(71190400001)(2906002)(71200400001)(7696005)(66556008)(76176011)(14454004)(102836004)(66446008)(64756008)(66476007)(52536014)(81156014)(316002)(86362001)(6306002)(81166006)(229853002)(6436002)(9686003)(55016002)(7736002)(11346002)(446003)(25786009)(8936002)(26005)(305945005)(486006)(186003)(478600001)(476003)(966005)(33656002)(5660300002)(14444005)(76116006)(6506007)(256004)(66946007)(99286004)(66066001)(73956011)(45080400002)(6246003)(110136005)(74316002)(2501003)(53936002)(3846002)(68736007)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3986; 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: qgnlrZ6s3VI1YJat6C0lcHOxQFo0fu5Oll57RduSeN6IBEBz7JyC0BVakN/kw7+uPhBVVaiccaGXx54zA3Pbyv2un6jjSKTq1mRg1Io1T/Z1LWFOJGO/cDof3TfGAob5ANQ7T7DHHPhfEjENHnqAIfqIABr6ioT3F3i1j05gmVlHnl2tnYrXxhJz5A/k74CMpNdjqce+tL0gSxKNDidXxpUNG39QuU0EMkx7fwcJKEm9/iC65BCWMBht51Zwzxi+fwd1XcamhTYKlcJVAusWmnJvrnhBqcYRs7DsdAURGTfvwCxtBE5KTBVOGARHH6eg+uYCXwmyowLCXOXFlMeyNTdNhiBCnfKoC9LDy+LuUa7RkI+uDe2VY+aPLLSMe3CDOy2rtNjWJO7sNcol0hdH5hkDVJXYq/J9HoZ2J1pIldg= 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: 4b9014fb-73b6-4d0e-84b1-08d6d6d37db8 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 May 2019 12:15:15.4452 (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: AM0PR0502MB3986 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: <20190512121515.BiImAtYVkUuye3qiFj0NBA6JWsQF63ydiiyo1KjdGxY@z> Sunday, May 12, 2019 11:32 AM, Viacheslav Ovsiienko: > Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix device removal handler for > multiport device >=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. W= e > 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 > devices") >=20 > Signed-off-by: Viacheslav Ovsiienko Acked-by: Shahaf Shuler Thomas, Ferruh, This one is a critical fix for mlx5. w/o it will break the support for fail= safe at azure.=20 Can you consider to integrate it? > --- > v2: - address comments > - more detailed debug messages in the event handler > - removed port specific IBV_EVENT_DEVICE_FATAL handling code >=20 > 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 >=20 > drivers/net/mlx5/mlx5_ethdev.c | 77 > ++++++++++++++++++++++++++++++++++-------- > 1 file changed, 62 insertions(+), 15 deletions(-) >=20 > 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) } >=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,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