From patchwork Thu Jan 16 04:10:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weihang Li X-Patchwork-Id: 11336001 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF9DF138D for ; Thu, 16 Jan 2020 04:14:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 986D222522 for ; Thu, 16 Jan 2020 04:14:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729285AbgAPEOn (ORCPT ); Wed, 15 Jan 2020 23:14:43 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:50774 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729551AbgAPEOm (ORCPT ); Wed, 15 Jan 2020 23:14:42 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 7B93B23ADE1E1A54A310; Thu, 16 Jan 2020 12:14:39 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 16 Jan 2020 12:14:33 +0800 From: Weihang Li To: , CC: , , , , , , Subject: [PATCH RFC for-next 1/6] RDMA/core: support deliver net device event Date: Thu, 16 Jan 2020 12:10:42 +0800 Message-ID: <1579147847-12158-2-git-send-email-liweihang@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1579147847-12158-1-git-send-email-liweihang@huawei.com> References: <1579147847-12158-1-git-send-email-liweihang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Lang Cheng For the process of handling the link event of the net device, the driver of each provider is similar, so it can be integrated into the ib_core for unified processing. Signed-off-by: Lang Cheng Signed-off-by: Weihang Li --- drivers/infiniband/core/cache.c | 21 ++++++- drivers/infiniband/core/device.c | 123 +++++++++++++++++++++++++++++++++++++++ include/rdma/ib_cache.h | 13 +++++ include/rdma/ib_verbs.h | 8 +++ 4 files changed, 164 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 17bfedd..791e965 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1174,6 +1174,23 @@ int ib_get_cached_port_state(struct ib_device *device, } EXPORT_SYMBOL(ib_get_cached_port_state); +int ib_get_cached_port_event_flags(struct ib_device *device, + u8 port_num, + enum ib_port_flags *event_flags) +{ + unsigned long flags; + + if (!rdma_is_port_valid(device, port_num)) + return -EINVAL; + + read_lock_irqsave(&device->cache_lock, flags); + *event_flags = device->port_data[port_num].cache.port_event_flags; + read_unlock_irqrestore(&device->cache_lock, flags); + + return 0; +} +EXPORT_SYMBOL(ib_get_cached_port_event_flags); + /** * rdma_get_gid_attr - Returns GID attributes for a port of a device * at a requested gid_index, if a valid GID entry exists. @@ -1391,7 +1408,7 @@ ib_cache_update(struct ib_device *device, u8 port, bool enforce_security) if (!rdma_is_port_valid(device, port)) return -EINVAL; - tprops = kmalloc(sizeof *tprops, GFP_KERNEL); + tprops = kzalloc(sizeof(*tprops), GFP_KERNEL); if (!tprops) return -ENOMEM; @@ -1435,6 +1452,8 @@ ib_cache_update(struct ib_device *device, u8 port, bool enforce_security) device->port_data[port].cache.pkey = pkey_cache; device->port_data[port].cache.lmc = tprops->lmc; device->port_data[port].cache.port_state = tprops->state; + device->port_data[port].cache.port_event_flags = + tprops->port_event_flags; device->port_data[port].cache.subnet_prefix = tprops->subnet_prefix; write_unlock_irq(&device->cache_lock); diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index f6c2552..f03d6ce 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -1325,6 +1325,77 @@ static int enable_device_and_get(struct ib_device *device) return ret; } +unsigned int ib_query_ndev_port_num(struct ib_device *device, + struct net_device *netdev) +{ + unsigned int port_num; + + rdma_for_each_port(device, port_num) + if (netdev == device->port_data[port_num].netdev) + break; + + return port_num; +} +EXPORT_SYMBOL(ib_query_ndev_port_num); + +static inline enum ib_port_state get_port_state(struct net_device *netdev) +{ + return (netif_running(netdev) && netif_carrier_ok(netdev)) ? + IB_PORT_ACTIVE : IB_PORT_DOWN; +} + +static int ib_netdev_event(struct notifier_block *this, + unsigned long event, void *ptr) +{ + struct ib_device *device = container_of(this, struct ib_device, nb); + struct net_device *netdev = netdev_notifier_info_to_dev(ptr); + + switch (event) { + case NETDEV_CHANGE: + case NETDEV_UP: + case NETDEV_DOWN: { + unsigned int port_num = ib_query_ndev_port_num(device, netdev); + enum ib_port_state last_state; + enum ib_port_state curr_state; + struct ib_event ibev; + enum ib_port_flags flags; + + if (ib_get_cached_port_event_flags(device, port_num, &flags)) + return NOTIFY_DONE; + + if (flags & IB_PORT_BONDING_SLAVE) + goto done; + + if (ib_get_cached_port_state(device, port_num, &last_state)) + return NOTIFY_DONE; + + curr_state = get_port_state(netdev); + + if (last_state == curr_state) + goto done; + + ibev.device = device; + if (curr_state == IB_PORT_DOWN) + ibev.event = IB_EVENT_PORT_ERR; + else if (curr_state == IB_PORT_ACTIVE) + ibev.event = IB_EVENT_PORT_ACTIVE; + else + goto done; + + ibev.element.port_num = port_num; + ib_dispatch_event(&ibev); + dev_dbg(&device->dev, + "core send %s\n", ib_event_msg(ibev.event)); + break; + } + + default: + break; + } +done: + return NOTIFY_DONE; +} + /** * ib_register_device - Register an IB device with IB core * @device: Device to register @@ -1342,6 +1413,7 @@ static int enable_device_and_get(struct ib_device *device) */ int ib_register_device(struct ib_device *device, const char *name) { + unsigned int port; int ret; ret = assign_name(device, name); @@ -1406,6 +1478,34 @@ int ib_register_device(struct ib_device *device, const char *name) } ib_device_put(device); + device->nb.notifier_call = ib_netdev_event; + ret = register_netdevice_notifier(&device->nb); + if (ret) { + device->nb.notifier_call = NULL; + return ret; + } + + rdma_for_each_port(device, port) { + struct ib_event event; + struct net_device *netdev = ib_device_get_netdev(device, port); + enum ib_port_flags flags; + + if (ib_get_cached_port_event_flags(device, port, &flags)) + continue; + + if (flags & IB_PORT_BONDING_SLAVE) + continue; + + if (get_port_state(netdev) == IB_PORT_ACTIVE) { + event.device = device; + event.event = IB_EVENT_PORT_ACTIVE; + event.element.port_num = port; + ib_dispatch_event(&event); + dev_dbg(&device->dev, "init event %s\n", + ib_event_msg(event.event)); + } + } + return 0; dev_cleanup: @@ -1470,6 +1570,29 @@ static void __ib_unregister_device(struct ib_device *ib_dev) */ void ib_unregister_device(struct ib_device *ib_dev) { + unsigned int port; + + unregister_netdevice_notifier(&ib_dev->nb); + + rdma_for_each_port(ib_dev, port) { + struct net_device *netdev = ib_device_get_netdev(ib_dev, port); + struct ib_event event; + u32 flags; + + if (ib_get_cached_port_event_flags(ib_dev, port, &flags)) + continue; + + if (flags) + continue; + + if (get_port_state(netdev) == IB_PORT_ACTIVE) { + event.device = ib_dev; + event.event = IB_EVENT_PORT_ERR; + event.element.port_num = port; + ib_dispatch_event(&event); + } + } + get_device(&ib_dev->dev); __ib_unregister_device(ib_dev); put_device(&ib_dev->dev); diff --git a/include/rdma/ib_cache.h b/include/rdma/ib_cache.h index 870b5e6..f37f667 100644 --- a/include/rdma/ib_cache.h +++ b/include/rdma/ib_cache.h @@ -131,6 +131,19 @@ int ib_get_cached_port_state(struct ib_device *device, u8 port_num, enum ib_port_state *port_active); +/** + * ib_get_cached_port_event_flags - Returns a cached port event flags + * @device: The device to query. + * @port_num: The port number of the device to query. + * @event_flags: port_state for the specified port for that device. + * + * ib_get_cached_port_event_flags() fetches the specified event flags stored in + * the local software cache. + */ +int ib_get_cached_port_event_flags(struct ib_device *device, + u8 port_num, + enum ib_port_flags *event_flags); + bool rdma_is_zero_gid(const union ib_gid *gid); const struct ib_gid_attr *rdma_get_gid_attr(struct ib_device *device, u8 port_num, int index); diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index d8031f6..ce88d0b 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -670,6 +670,7 @@ struct ib_port_attr { u8 active_speed; u8 phys_state; u16 port_cap_flags2; + u32 port_event_flags; }; enum ib_device_modify_flags { @@ -2149,12 +2150,18 @@ enum ib_mad_result { IB_MAD_RESULT_CONSUMED = 1 << 2 /* Packet consumed: stop processing */ }; +enum ib_port_flags { + IB_PORT_NORMAL = 0, /* normarl port */ + IB_PORT_BONDING_SLAVE = 1 << 0, /* rdma bonding slave port */ +}; + struct ib_port_cache { u64 subnet_prefix; struct ib_pkey_cache *pkey; struct ib_gid_table *gid; u8 lmc; enum ib_port_state port_state; + enum ib_port_flags port_event_flags; }; struct ib_port_immutable { @@ -2706,6 +2713,7 @@ struct ib_device { /* Used by iWarp CM */ char iw_ifname[IFNAMSIZ]; u32 iw_driver_flags; + struct notifier_block nb; }; struct ib_client_nl_info; From patchwork Thu Jan 16 04:10:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weihang Li X-Patchwork-Id: 11335997 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB1D814B7 for ; Thu, 16 Jan 2020 04:14:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9304420723 for ; Thu, 16 Jan 2020 04:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730061AbgAPEOl (ORCPT ); Wed, 15 Jan 2020 23:14:41 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:50776 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729293AbgAPEOl (ORCPT ); Wed, 15 Jan 2020 23:14:41 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 82D4A181944CDB1185D8; Thu, 16 Jan 2020 12:14:39 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 16 Jan 2020 12:14:33 +0800 From: Weihang Li To: , CC: , , , , , , Subject: [PATCH RFC for-next 2/6] RDMA/mlx5: remove deliver net device event Date: Thu, 16 Jan 2020 12:10:43 +0800 Message-ID: <1579147847-12158-3-git-send-email-liweihang@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1579147847-12158-1-git-send-email-liweihang@huawei.com> References: <1579147847-12158-1-git-send-email-liweihang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Lang Cheng The code that handles the link event of the net device has been moved into the core, and the related processing should been removed from the provider's driver. Signed-off-by: Lang Cheng Signed-off-by: Weihang Li --- drivers/infiniband/hw/mlx5/main.c | 95 ++++----------------------------------- 1 file changed, 9 insertions(+), 86 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 97bcf01..bb0dbfb 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -144,48 +144,6 @@ mlx5_ib_port_link_layer(struct ib_device *device, u8 port_num) return mlx5_port_type_cap_to_rdma_ll(port_type_cap); } -static int get_port_state(struct ib_device *ibdev, - u8 port_num, - enum ib_port_state *state) -{ - struct ib_port_attr attr; - int ret; - - memset(&attr, 0, sizeof(attr)); - ret = ibdev->ops.query_port(ibdev, port_num, &attr); - if (!ret) - *state = attr.state; - return ret; -} - -static struct mlx5_roce *mlx5_get_rep_roce(struct mlx5_ib_dev *dev, - struct net_device *ndev, - u8 *port_num) -{ - struct mlx5_eswitch *esw = dev->mdev->priv.eswitch; - struct net_device *rep_ndev; - struct mlx5_ib_port *port; - int i; - - for (i = 0; i < dev->num_ports; i++) { - port = &dev->port[i]; - if (!port->rep) - continue; - - read_lock(&port->roce.netdev_lock); - rep_ndev = mlx5_ib_get_rep_netdev(esw, - port->rep->vport); - if (rep_ndev == ndev) { - read_unlock(&port->roce.netdev_lock); - *port_num = i + 1; - return &port->roce; - } - read_unlock(&port->roce.netdev_lock); - } - - return NULL; -} - static int mlx5_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { @@ -219,52 +177,10 @@ static int mlx5_netdev_event(struct notifier_block *this, write_unlock(&roce->netdev_lock); break; - case NETDEV_CHANGE: - case NETDEV_UP: - case NETDEV_DOWN: { - struct net_device *lag_ndev = mlx5_lag_get_roce_netdev(mdev); - struct net_device *upper = NULL; - - if (lag_ndev) { - upper = netdev_master_upper_dev_get(lag_ndev); - dev_put(lag_ndev); - } - - if (ibdev->is_rep) - roce = mlx5_get_rep_roce(ibdev, ndev, &port_num); - if (!roce) - return NOTIFY_DONE; - if ((upper == ndev || (!upper && ndev == roce->netdev)) - && ibdev->ib_active) { - struct ib_event ibev = { }; - enum ib_port_state port_state; - - if (get_port_state(&ibdev->ib_dev, port_num, - &port_state)) - goto done; - - if (roce->last_port_state == port_state) - goto done; - - roce->last_port_state = port_state; - ibev.device = &ibdev->ib_dev; - if (port_state == IB_PORT_DOWN) - ibev.event = IB_EVENT_PORT_ERR; - else if (port_state == IB_PORT_ACTIVE) - ibev.event = IB_EVENT_PORT_ACTIVE; - else - goto done; - - ibev.element.port_num = port_num; - ib_dispatch_event(&ibev); - } - break; - } - default: break; } -done: + mlx5_ib_put_native_port_mdev(ibdev, port_num); return NOTIFY_DONE; } @@ -569,7 +485,14 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, dev_put(ndev); - props->active_mtu = min(props->max_mtu, ndev_ib_mtu); + props->active_mtu = min(props->max_mtu, ndev_ib_mtu); + + if ((dev->lag_active && ndev != mlx5_lag_get_roce_netdev(mdev)) || + (!dev->lag_active && port_num != mdev_port_num)) + props->port_event_flags = IB_PORT_BONDING_SLAVE; + else + props->port_event_flags &= ~IB_PORT_BONDING_SLAVE; + out: if (put_mdev) mlx5_ib_put_native_port_mdev(dev, port_num); From patchwork Thu Jan 16 04:10:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weihang Li X-Patchwork-Id: 11336009 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF243138D for ; Thu, 16 Jan 2020 04:14:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 975812077B for ; Thu, 16 Jan 2020 04:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729551AbgAPEOr (ORCPT ); Wed, 15 Jan 2020 23:14:47 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8734 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730434AbgAPEOr (ORCPT ); Wed, 15 Jan 2020 23:14:47 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id A0BE39CF337B353AFFFF; Thu, 16 Jan 2020 12:14:44 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 16 Jan 2020 12:14:34 +0800 From: Weihang Li To: , CC: , , , , , , Subject: [PATCH RFC for-next 3/6] RDMA/i40iw: remove deliver net device event Date: Thu, 16 Jan 2020 12:10:44 +0800 Message-ID: <1579147847-12158-4-git-send-email-liweihang@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1579147847-12158-1-git-send-email-liweihang@huawei.com> References: <1579147847-12158-1-git-send-email-liweihang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Lang Cheng The code that handles the link event of the net device has been moved into the core, and the related processing should been removed from the provider's driver. Signed-off-by: Lang Cheng Signed-off-by: Weihang Li --- drivers/infiniband/hw/i40iw/i40iw_main.c | 6 ----- drivers/infiniband/hw/i40iw/i40iw_utils.c | 44 ------------------------------- 2 files changed, 50 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c index 2386143..6c41458e 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_main.c +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c @@ -99,10 +99,6 @@ static struct notifier_block i40iw_net_notifier = { .notifier_call = i40iw_net_event }; -static struct notifier_block i40iw_netdevice_notifier = { - .notifier_call = i40iw_netdevice_event -}; - /** * i40iw_find_i40e_handler - find a handler given a client info * @ldev: pointer to a client info @@ -1401,7 +1397,6 @@ static void i40iw_register_notifiers(void) register_inetaddr_notifier(&i40iw_inetaddr_notifier); register_inet6addr_notifier(&i40iw_inetaddr6_notifier); register_netevent_notifier(&i40iw_net_notifier); - register_netdevice_notifier(&i40iw_netdevice_notifier); } /** @@ -1413,7 +1408,6 @@ static void i40iw_unregister_notifiers(void) unregister_netevent_notifier(&i40iw_net_notifier); unregister_inetaddr_notifier(&i40iw_inetaddr_notifier); unregister_inet6addr_notifier(&i40iw_inetaddr6_notifier); - unregister_netdevice_notifier(&i40iw_netdevice_notifier); } /** diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c index 0165246..09171e6 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c @@ -311,50 +311,6 @@ int i40iw_net_event(struct notifier_block *notifier, unsigned long event, void * } /** - * i40iw_netdevice_event - system notifier for netdev events - * @notfier: not used - * @event: event for notifier - * @ptr: netdev - */ -int i40iw_netdevice_event(struct notifier_block *notifier, - unsigned long event, - void *ptr) -{ - struct net_device *event_netdev; - struct net_device *netdev; - struct i40iw_device *iwdev; - struct i40iw_handler *hdl; - - event_netdev = netdev_notifier_info_to_dev(ptr); - - hdl = i40iw_find_netdev(event_netdev); - if (!hdl) - return NOTIFY_DONE; - - iwdev = &hdl->device; - if (iwdev->init_state < RDMA_DEV_REGISTERED || iwdev->closing) - return NOTIFY_DONE; - - netdev = iwdev->ldev->netdev; - if (netdev != event_netdev) - return NOTIFY_DONE; - - iwdev->iw_status = 1; - - switch (event) { - case NETDEV_DOWN: - iwdev->iw_status = 0; - /* Fall through */ - case NETDEV_UP: - i40iw_port_ibevent(iwdev); - break; - default: - break; - } - return NOTIFY_DONE; -} - -/** * i40iw_get_cqp_request - get cqp struct * @cqp: device cqp ptr * @wait: cqp to be used in wait mode From patchwork Thu Jan 16 04:10:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weihang Li X-Patchwork-Id: 11336007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C08541820 for ; Thu, 16 Jan 2020 04:14:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F8202077B for ; Thu, 16 Jan 2020 04:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730782AbgAPEOr (ORCPT ); Wed, 15 Jan 2020 23:14:47 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8733 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729551AbgAPEOq (ORCPT ); Wed, 15 Jan 2020 23:14:46 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9B4787985251908BAAE2; Thu, 16 Jan 2020 12:14:44 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 16 Jan 2020 12:14:34 +0800 From: Weihang Li To: , CC: , , , , , , Subject: [PATCH RFC for-next 4/6] RDMA/qedr: remove deliver net device event Date: Thu, 16 Jan 2020 12:10:45 +0800 Message-ID: <1579147847-12158-5-git-send-email-liweihang@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1579147847-12158-1-git-send-email-liweihang@huawei.com> References: <1579147847-12158-1-git-send-email-liweihang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Lang Cheng The code that handles the link event of the net device has been moved into the core, and the related processing should been removed from the provider's driver. Signed-off-by: Lang Cheng Signed-off-by: Weihang Li --- drivers/infiniband/hw/qedr/main.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c index dcdc85a..d85894b 100644 --- a/drivers/infiniband/hw/qedr/main.c +++ b/drivers/infiniband/hw/qedr/main.c @@ -957,24 +957,11 @@ static void qedr_remove(struct qedr_dev *dev) ib_dealloc_device(&dev->ibdev); } -static void qedr_close(struct qedr_dev *dev) -{ - if (test_and_clear_bit(QEDR_ENET_STATE_BIT, &dev->enet_state)) - qedr_ib_dispatch_event(dev, QEDR_PORT, IB_EVENT_PORT_ERR); -} - static void qedr_shutdown(struct qedr_dev *dev) { - qedr_close(dev); qedr_remove(dev); } -static void qedr_open(struct qedr_dev *dev) -{ - if (!test_and_set_bit(QEDR_ENET_STATE_BIT, &dev->enet_state)) - qedr_ib_dispatch_event(dev, QEDR_PORT, IB_EVENT_PORT_ACTIVE); -} - static void qedr_mac_address_change(struct qedr_dev *dev) { union ib_gid *sgid = &dev->sgid_tbl[0]; @@ -1014,12 +1001,6 @@ static void qedr_mac_address_change(struct qedr_dev *dev) static void qedr_notify(struct qedr_dev *dev, enum qede_rdma_event event) { switch (event) { - case QEDE_UP: - qedr_open(dev); - break; - case QEDE_DOWN: - qedr_close(dev); - break; case QEDE_CLOSE: qedr_shutdown(dev); break; From patchwork Thu Jan 16 04:10:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weihang Li X-Patchwork-Id: 11336003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2950138D for ; Thu, 16 Jan 2020 04:14:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C18CD24679 for ; Thu, 16 Jan 2020 04:14:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730853AbgAPEOq (ORCPT ); Wed, 15 Jan 2020 23:14:46 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8731 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730133AbgAPEOq (ORCPT ); Wed, 15 Jan 2020 23:14:46 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 904F2D13E9CA731AC38F; Thu, 16 Jan 2020 12:14:44 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 16 Jan 2020 12:14:34 +0800 From: Weihang Li To: , CC: , , , , , , Subject: [PATCH RFC for-next 5/6] RDMA/vmw_pvrdma: remove deliver net device event Date: Thu, 16 Jan 2020 12:10:46 +0800 Message-ID: <1579147847-12158-6-git-send-email-liweihang@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1579147847-12158-1-git-send-email-liweihang@huawei.com> References: <1579147847-12158-1-git-send-email-liweihang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Lang Cheng The code that handles the link event of the net device has been moved into the core, and the related processing should been removed from the provider's driver. Signed-off-by: Lang Cheng Signed-off-by: Weihang Li --- drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c index e580ae9..b3877c5 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c @@ -694,9 +694,6 @@ static void pvrdma_netdevice_event_handle(struct pvrdma_dev *dev, switch (event) { case NETDEV_REBOOT: - case NETDEV_DOWN: - pvrdma_dispatch_event(dev, 1, IB_EVENT_PORT_ERR); - break; case NETDEV_UP: pvrdma_write_reg(dev, PVRDMA_REG_CTL, PVRDMA_DEVICE_CTL_UNQUIESCE); @@ -706,8 +703,6 @@ static void pvrdma_netdevice_event_handle(struct pvrdma_dev *dev, if (pvrdma_read_reg(dev, PVRDMA_REG_ERR)) dev_err(&dev->pdev->dev, "failed to activate device during link up\n"); - else - pvrdma_dispatch_event(dev, 1, IB_EVENT_PORT_ACTIVE); break; case NETDEV_UNREGISTER: ib_device_set_netdev(&dev->ib_dev, NULL, 1); From patchwork Thu Jan 16 04:10:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weihang Li X-Patchwork-Id: 11336005 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8132314B7 for ; Thu, 16 Jan 2020 04:14:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 605E92077B for ; Thu, 16 Jan 2020 04:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730133AbgAPEOq (ORCPT ); Wed, 15 Jan 2020 23:14:46 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8732 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730782AbgAPEOq (ORCPT ); Wed, 15 Jan 2020 23:14:46 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 96124B73007A4B1015A4; Thu, 16 Jan 2020 12:14:44 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 16 Jan 2020 12:14:35 +0800 From: Weihang Li To: , CC: , , , , , , Subject: [PATCH RFC for-next 6/6] qede: remove invalid notify operation Date: Thu, 16 Jan 2020 12:10:47 +0800 Message-ID: <1579147847-12158-7-git-send-email-liweihang@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1579147847-12158-1-git-send-email-liweihang@huawei.com> References: <1579147847-12158-1-git-send-email-liweihang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Lang Cheng The qedr notify() has removed the processing of QEDE_UP and QEDE_DOWN, so qede no longer needs to notify rdma of these two events. Signed-off-by: Lang Cheng Signed-off-by: Weihang Li --- drivers/net/ethernet/qlogic/qede/qede_rdma.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_rdma.c b/drivers/net/ethernet/qlogic/qede/qede_rdma.c index ffabc2d..0493279 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_rdma.c +++ b/drivers/net/ethernet/qlogic/qede/qede_rdma.c @@ -145,8 +145,6 @@ void qede_rdma_dev_remove(struct qede_dev *edev, bool recovery) static void _qede_rdma_dev_open(struct qede_dev *edev) { - if (qedr_drv && edev->rdma_info.qedr_dev && qedr_drv->notify) - qedr_drv->notify(edev->rdma_info.qedr_dev, QEDE_UP); } static void qede_rdma_dev_open(struct qede_dev *edev) @@ -161,8 +159,6 @@ static void qede_rdma_dev_open(struct qede_dev *edev) static void _qede_rdma_dev_close(struct qede_dev *edev) { - if (qedr_drv && edev->rdma_info.qedr_dev && qedr_drv->notify) - qedr_drv->notify(edev->rdma_info.qedr_dev, QEDE_DOWN); } static void qede_rdma_dev_close(struct qede_dev *edev)