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 BAF94A00E6 for ; Thu, 21 Mar 2019 13:16:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4BAEB1B508; Thu, 21 Mar 2019 13:15:16 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140070.outbound.protection.outlook.com [40.107.14.70]) by dpdk.org (Postfix) with ESMTP id 99D0E1B507 for ; Thu, 21 Mar 2019 13:15:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XQQFovdayMknZ4V5V4ITdDEvof+hJT4GkYkFYFof/BY=; b=VccxIxcZfwvRJS+Ow9yLsAr3IfkEiEkUL3We7MhZKBlvKFvawXbT1uRLATY4w7whx3nRB4ZczLTxwGWBGUuiwQSRPfJcF/Kidn7hb3fxBHmNr571ivtkwkjC7tgVJrV8DiHJ/Q0BA10QkKi370kU78SbLxKb/p8D3WQtVqvSSnU= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB3827.eurprd05.prod.outlook.com (52.133.47.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.15; Thu, 21 Mar 2019 12:15:14 +0000 Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::84f3:7e92:7a51:1003]) by AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::84f3:7e92:7a51:1003%2]) with mapi id 15.20.1730.013; Thu, 21 Mar 2019 12:15:14 +0000 From: Shahaf Shuler To: Slava Ovsiienko , "dev@dpdk.org" Thread-Topic: [PATCH 13/14] net/mlx5: update event handler for multiport IB devices Thread-Index: AQHU373ZjarI5/vvSU2IgeXWbndlfaYV/NEw Date: Thu, 21 Mar 2019 12:15:14 +0000 Message-ID: References: <1551376985-11096-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-1-git-send-email-viacheslavo@mellanox.com> <1553155888-27498-14-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1553155888-27498-14-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: [31.154.10.105] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 37a40d1a-8c20-4328-e26e-08d6adf6dfaf x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR0502MB3827; x-ms-traffictypediagnostic: AM0PR0502MB3827: x-microsoft-antispam-prvs: x-forefront-prvs: 0983EAD6B2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(39860400002)(136003)(376002)(189003)(199004)(81166006)(97736004)(33656002)(68736007)(74316002)(25786009)(7736002)(305945005)(110136005)(316002)(14454004)(2906002)(446003)(2501003)(14444005)(52536014)(11346002)(476003)(71190400001)(256004)(86362001)(486006)(99286004)(186003)(5660300002)(66066001)(26005)(7696005)(53936002)(76176011)(102836004)(55016002)(9686003)(6436002)(71200400001)(229853002)(3846002)(8676002)(8936002)(81156014)(15650500001)(478600001)(6246003)(106356001)(6506007)(6116002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3827; 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: AaLMUD2E//8sy5SlTYNKt2NM7URa6NO/NJqJuK9ikYYjamDeWVuFMTHCcf9/ZhHHgwCkgLHrHhJJ71ikrzkv/AFI0isAp9qy1Q+ASoGs96UR9adYjNTJFCIE99B2Z8DV55y8V5fcggTf9rUmdMKv+i7ge819vULJdIrq6TeiF03Ldp5qzGMUmStVdrTLBLh/yOcczDDUyG/p66as0yVndTbl+hLv+I6gvC7+liaV88ntu3Sefc7qJklhrzEWnFjJuTXq303To35A4jLgKlthFpFdJ/6TV0oI7R5hBjcndRgNIJLfJnlqEMjP34ysKh4XBu/wDnALNiyL0o4MllUyjMY72At8/2VP7qqUFR+fI4zAFkWRWNJh1HKJlphbXyox2ItebwD/Ii0tKKKNzKIk4f4iE7y/GqsrbhzAlGmrsBQ= 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: 37a40d1a-8c20-4328-e26e-08d6adf6dfaf X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2019 12:15:14.4508 (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: AM0PR0502MB3827 Subject: Re: [dpdk-dev] [PATCH 13/14] net/mlx5: update event handler for multiport IB devices 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: <20190321121514.chdzOR6XmAcDfdqYKCNYWsuegOBf17xo5JISV_6cHIA@z> Thursday, March 21, 2019 10:11 AM, Viacheslav Ovsiienko: > Subject: [PATCH 13/14] net/mlx5: update event handler for multiport IB > devices >=20 > This patch modifies asynchronous event handler to support multiport > Infiniband devices. Handler queries the event parameters, including event > source port index, and invokes the handler for specific devices with > appropriate port_id. This commit should be along w/ the previous one, since interrupts will not = work after commit #12 in this series.=20 >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_ethdev.c | 101 +++++++++++++++++++++------------ > -------- > 1 file changed, 51 insertions(+), 50 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > b/drivers/net/mlx5/mlx5_ethdev.c index 8358cd2..710e6b5 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -1032,66 +1032,67 @@ int mlx5_fw_version_get(struct rte_eth_dev > *dev, char *fw_ver, size_t fw_size) } >=20 > /** > - * Device status handler. > + * Handle shared asynchronous events the NIC (removal event > + * and link status change). Supports multiport IB device. > * > - * @param dev > - * Pointer to Ethernet device. > - * @param events > - * Pointer to event flags holder. > - * > - * @return > - * Events bitmap of callback process which can be called immediately. > + * @param cb_arg > + * Callback argument. > */ > -static uint32_t > -mlx5_dev_status_handler(struct rte_eth_dev *dev) > +void > +mlx5_dev_interrupt_handler(void *cb_arg) > { > - struct mlx5_priv *priv =3D dev->data->dev_private; > + struct mlx5_ibv_shared *sh =3D cb_arg; > struct ibv_async_event event; > - uint32_t ret =3D 0; >=20 > - if (mlx5_link_update(dev, 0) =3D=3D -EAGAIN) { > - usleep(0); > - return 0; > - } > - /* Read all message and acknowledge them. */ > + /* Read all message from the IB device and acknowledge them. */ > for (;;) { > - if (mlx5_glue->get_async_event(priv->sh->ctx, &event)) > + struct rte_eth_dev *dev; > + uint32_t tmp; > + > + if (mlx5_glue->get_async_event(sh->ctx, &event)) > 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].port_id >=3D RTE_MAX_ETHPORTS) { > + /* > + * Invalid IB port index or no handler > + * installed for this port. > + */ > + mlx5_glue->ack_async_event(&event); > + continue; > + } > + /* Retrieve ethernet device descriptor. */ > + tmp =3D sh->port[tmp - 1].port_id; > + dev =3D &rte_eth_devices[tmp]; Is there a guarantee that the representors ethedev indexes will be contiguo= us? =20 I think we need a mapping between ibdev port and ethedv index.=20 > + tmp =3D 0; > + assert(dev); > if ((event.event_type =3D=3D IBV_EVENT_PORT_ACTIVE || > - event.event_type =3D=3D IBV_EVENT_PORT_ERR) && > - (dev->data->dev_conf.intr_conf.lsc =3D=3D 1)) > - ret |=3D (1 << RTE_ETH_EVENT_INTR_LSC); > - else if (event.event_type =3D=3D IBV_EVENT_DEVICE_FATAL && > - dev->data->dev_conf.intr_conf.rmv =3D=3D 1) > - ret |=3D (1 << RTE_ETH_EVENT_INTR_RMV); > - else > - DRV_LOG(DEBUG, > - "port %u event type %d on not handled", > - dev->data->port_id, event.event_type); > + event.event_type =3D=3D IBV_EVENT_PORT_ERR) && > + dev->data->dev_conf.intr_conf.lsc) { > + mlx5_glue->ack_async_event(&event); > + if (mlx5_link_update(dev, 0) =3D=3D -EAGAIN) { > + usleep(0); > + continue; > + } > + _rte_eth_dev_callback_process > + (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", > + dev->data->port_id, event.event_type); > mlx5_glue->ack_async_event(&event); > } > - return ret; > -} > - > -/** > - * Handle interrupts from the NIC. > - * > - * @param[in] intr_handle > - * Interrupt handler. > - * @param cb_arg > - * Callback argument. > - */ > -void > -mlx5_dev_interrupt_handler(void *cb_arg) -{ > - struct rte_eth_dev *dev =3D cb_arg; > - uint32_t events; > - > - events =3D mlx5_dev_status_handler(dev); > - if (events & (1 << RTE_ETH_EVENT_INTR_LSC)) > - _rte_eth_dev_callback_process(dev, > RTE_ETH_EVENT_INTR_LSC, NULL); > - if (events & (1 << RTE_ETH_EVENT_INTR_RMV)) > - _rte_eth_dev_callback_process(dev, > RTE_ETH_EVENT_INTR_RMV, NULL); > } >=20 > /** > -- > 1.8.3.1