From patchwork Wed Jul 31 11:15:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11067517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6251E13AC for ; Wed, 31 Jul 2019 11:15:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50BAE2880A for ; Wed, 31 Jul 2019 11:15:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4554428905; Wed, 31 Jul 2019 11:15:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 780402880A for ; Wed, 31 Jul 2019 11:15:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387464AbfGaLPg (ORCPT ); Wed, 31 Jul 2019 07:15:36 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37651 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725921AbfGaLPb (ORCPT ); Wed, 31 Jul 2019 07:15:31 -0400 Received: by mail-wr1-f68.google.com with SMTP id n9so44154473wrr.4 for ; Wed, 31 Jul 2019 04:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z2G2wvEO5h20eVaJQbYCrFuXvI27p8M9SgVVqQQH3Fg=; b=gVlykGoN3NoixZeoEGkSLmo1jPZnznuVJrAtIMJmvZGgMUnx2oAVRbwal6uKLUXmA1 IK8En/HLggK/aFXryw17wynDUQeJn1ITtDlI5Bz1h2K9DwOkOkHiWRoaYPBL7TEAcjs8 1Usn0iNWnb44Z3eZtvtr4OL1UN79LUOMT3LMofkdEYbf5rkgS4Ir4H2m2/BAR/6Urj3i U4rexzyvU9ezj5ez9a/o8tA5sNZgFH7dl0ArIMNH60awBVlCag/cG+VGVP3OZPzBpygQ qNXVAsqssJ9x7VMUGz3UTSh4nQ8OznvgWqbqG/5/rIWXhQ41iNY+dicu0ArIAA2yXlbU wOig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z2G2wvEO5h20eVaJQbYCrFuXvI27p8M9SgVVqQQH3Fg=; b=NTPsMG4pKsHmmkHHzVrceKbE4lvi6vzG3xXDzs0sESBV86BbQ4aKDBGW2jdnBlgfdA pNrPCEdwU7s8e1j5greXJZLmWrTfZUO0Rtpi8h0zcgg7LBJgjk8DYRk2GY2xrg6t1phY w8LltzyKxpi4RknX4rSsvZuidGcoy2Jt1yKcX9yq5/NbrpAOZqIfzr0uepfVUk8XngJD GpWJqPmYkQ6MrmYwCc9WrKat9gTyGrsZ3jAsiPnHVvg2+Lfbei5mdHG8OYRqNSWTddts t0rC4q3xuDn3vGNbzE2232KsP/x8/UFXa0qVb49vzg/B1FPlQBp623oGyCyp78+WVdIM /lcw== X-Gm-Message-State: APjAAAXGAzDu9gnho+TqonCR6GBOHyIgNI7a2gArwmu8Dobl25ezUOnq Rxp44wUqBnoHh6BRjad3nVyglh9O X-Google-Smtp-Source: APXvYqxw9EiHlXgDvPTYL8jNM52Yy3sY3OenvmOwQh87xsS7wEvXn2qfQsBlyIsCMml+aF1UWNMHaw== X-Received: by 2002:adf:f40b:: with SMTP id g11mr65627541wro.81.1564571728061; Wed, 31 Jul 2019 04:15:28 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-109-65-15-211.red.bezeqint.net. [109.65.15.211]) by smtp.gmail.com with ESMTPSA id h133sm73133732wme.28.2019.07.31.04.15.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 04:15:27 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Doug Ledford , Potnuri Bharat Teja , Selvin Xavier , Gal Pressman , Leon Romanovsky , Michal Kalderon , Christian Benvenuti , Moni Shoua , Bernard Metzler , Shiraz Saleem , Kamal Heib Subject: [PATCH for-next 1/4] RDMA: Introduce ib_port_phys_state enum Date: Wed, 31 Jul 2019 14:15:00 +0300 Message-Id: <20190731111503.8872-2-kamalheib1@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731111503.8872-1-kamalheib1@gmail.com> References: <20190731111503.8872-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to improve readability, add ib_port_phys_state enum to replace the use of magic numbers. Signed-off-by: Kamal Heib --- drivers/infiniband/core/sysfs.c | 24 +++++++++++++------- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++-- drivers/infiniband/hw/efa/efa_verbs.c | 2 +- drivers/infiniband/hw/mlx5/main.c | 4 ++-- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 ++-- drivers/infiniband/hw/qedr/verbs.c | 4 ++-- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 7 +++--- drivers/infiniband/sw/rxe/rxe.h | 4 ---- drivers/infiniband/sw/rxe/rxe_param.h | 2 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 6 ++--- drivers/infiniband/sw/siw/siw_verbs.c | 3 ++- include/rdma/ib_verbs.h | 10 ++++++++ 12 files changed, 45 insertions(+), 29 deletions(-) diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index b477295a96c2..46722e04f6e1 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -301,14 +301,22 @@ static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused, return ret; switch (attr.phys_state) { - case 1: return sprintf(buf, "1: Sleep\n"); - case 2: return sprintf(buf, "2: Polling\n"); - case 3: return sprintf(buf, "3: Disabled\n"); - case 4: return sprintf(buf, "4: PortConfigurationTraining\n"); - case 5: return sprintf(buf, "5: LinkUp\n"); - case 6: return sprintf(buf, "6: LinkErrorRecovery\n"); - case 7: return sprintf(buf, "7: Phy Test\n"); - default: return sprintf(buf, "%d: \n", attr.phys_state); + case IB_PORT_PHYS_STATE_SLEEP: + return sprintf(buf, "1: Sleep\n"); + case IB_PORT_PHYS_STATE_POLLING: + return sprintf(buf, "2: Polling\n"); + case IB_PORT_PHYS_STATE_DISABLED: + return sprintf(buf, "3: Disabled\n"); + case IB_PORT_PHYS_STATE_PORT_CONFIGURATION_TRAINING: + return sprintf(buf, "4: PortConfigurationTraining\n"); + case IB_PORT_PHYS_STATE_LINK_UP: + return sprintf(buf, "5: LinkUp\n"); + case IB_PORT_PHYS_STATE_LINK_ERROR_RECOVERY: + return sprintf(buf, "6: LinkErrorRecovery\n"); + case IB_PORT_PHYS_STATE_PHY_TEST: + return sprintf(buf, "7: Phy Test\n"); + default: + return sprintf(buf, "%d: \n", attr.phys_state); } } diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index a91653aabf38..ca6306c24881 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -220,10 +220,10 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num, if (netif_running(rdev->netdev) && netif_carrier_ok(rdev->netdev)) { port_attr->state = IB_PORT_ACTIVE; - port_attr->phys_state = 5; + port_attr->phys_state = IB_PORT_PHYS_STATE_LINK_UP; } else { port_attr->state = IB_PORT_DOWN; - port_attr->phys_state = 3; + port_attr->phys_state = IB_PORT_PHYS_STATE_DISABLED; } port_attr->max_mtu = IB_MTU_4096; port_attr->active_mtu = iboe_get_mtu(rdev->netdev->mtu); diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c index df77bc312a25..f36071a92f97 100644 --- a/drivers/infiniband/hw/efa/efa_verbs.c +++ b/drivers/infiniband/hw/efa/efa_verbs.c @@ -306,7 +306,7 @@ int efa_query_port(struct ib_device *ibdev, u8 port, props->lmc = 1; props->state = IB_PORT_ACTIVE; - props->phys_state = 5; + props->phys_state = IB_PORT_PHYS_STATE_LINK_UP; props->gid_tbl_len = 1; props->pkey_tbl_len = 1; props->active_speed = IB_SPEED_EDR; diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index c2a5780cb394..bc4d7dca170f 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -535,7 +535,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg); props->pkey_tbl_len = 1; props->state = IB_PORT_DOWN; - props->phys_state = 3; + props->phys_state = IB_PORT_PHYS_STATE_DISABLED; mlx5_query_nic_vport_qkey_viol_cntr(mdev, &qkey_viol_cntr); props->qkey_viol_cntr = qkey_viol_cntr; @@ -561,7 +561,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, if (netif_running(ndev) && netif_carrier_ok(ndev)) { props->state = IB_PORT_ACTIVE; - props->phys_state = 5; + props->phys_state = IB_PORT_PHYS_STATE_LINK_UP; } ndev_ib_mtu = iboe_get_mtu(ndev->mtu); diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index bccc11378109..e8267e590772 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -163,10 +163,10 @@ int ocrdma_query_port(struct ib_device *ibdev, netdev = dev->nic_info.netdev; if (netif_running(netdev) && netif_oper_up(netdev)) { port_state = IB_PORT_ACTIVE; - props->phys_state = 5; + props->phys_state = IB_PORT_PHYS_STATE_LINK_UP; } else { port_state = IB_PORT_DOWN; - props->phys_state = 3; + props->phys_state = IB_PORT_PHYS_STATE_DISABLED; } props->max_mtu = IB_MTU_4096; props->active_mtu = iboe_get_mtu(netdev->mtu); diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c index 27d90a84ea01..1373312aec58 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -221,10 +221,10 @@ int qedr_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *attr) /* *attr being zeroed by the caller, avoid zeroing it here */ if (rdma_port->port_state == QED_RDMA_PORT_UP) { attr->state = IB_PORT_ACTIVE; - attr->phys_state = 5; + attr->phys_state = IB_PORT_PHYS_STATE_LINK_UP; } else { attr->state = IB_PORT_DOWN; - attr->phys_state = 3; + attr->phys_state = IB_PORT_PHYS_STATE_DISABLED; } attr->max_mtu = IB_MTU_4096; attr->active_mtu = iboe_get_mtu(dev->ndev->mtu); diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c index eeb07b245ef9..4f8f1d3eb559 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c @@ -356,13 +356,14 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port, if (!us_ibdev->ufdev->link_up) { props->state = IB_PORT_DOWN; - props->phys_state = 3; + props->phys_state = IB_PORT_PHYS_STATE_DISABLED; } else if (!us_ibdev->ufdev->inaddr) { props->state = IB_PORT_INIT; - props->phys_state = 4; + props->phys_state = + IB_PORT_PHYS_STATE_PORT_CONFIGURATION_TRAINING; } else { props->state = IB_PORT_ACTIVE; - props->phys_state = 5; + props->phys_state = IB_PORT_PHYS_STATE_LINK_UP; } props->port_cap_flags = 0; diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h index ecf6e659c0da..fb07eed9e402 100644 --- a/drivers/infiniband/sw/rxe/rxe.h +++ b/drivers/infiniband/sw/rxe/rxe.h @@ -65,10 +65,6 @@ */ #define RXE_UVERBS_ABI_VERSION 2 -#define RDMA_LINK_PHYS_STATE_LINK_UP (5) -#define RDMA_LINK_PHYS_STATE_DISABLED (3) -#define RDMA_LINK_PHYS_STATE_POLLING (2) - #define RXE_ROCE_V2_SPORT (0xc000) static inline u32 rxe_crc32(struct rxe_dev *rxe, diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h index 1abed47ca221..fe5207386700 100644 --- a/drivers/infiniband/sw/rxe/rxe_param.h +++ b/drivers/infiniband/sw/rxe/rxe_param.h @@ -154,7 +154,7 @@ enum rxe_port_param { RXE_PORT_ACTIVE_WIDTH = IB_WIDTH_1X, RXE_PORT_ACTIVE_SPEED = 1, RXE_PORT_PKEY_TBL_LEN = 64, - RXE_PORT_PHYS_STATE = 2, + RXE_PORT_PHYS_STATE = IB_PORT_PHYS_STATE_POLLING, RXE_PORT_SUBNET_PREFIX = 0xfe80000000000000ULL, }; diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 4ebdfcf4d33e..623129f27f5a 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -69,11 +69,11 @@ static int rxe_query_port(struct ib_device *dev, &attr->active_width); if (attr->state == IB_PORT_ACTIVE) - attr->phys_state = RDMA_LINK_PHYS_STATE_LINK_UP; + attr->phys_state = IB_PORT_PHYS_STATE_LINK_UP; else if (dev_get_flags(rxe->ndev) & IFF_UP) - attr->phys_state = RDMA_LINK_PHYS_STATE_POLLING; + attr->phys_state = IB_PORT_PHYS_STATE_POLLING; else - attr->phys_state = RDMA_LINK_PHYS_STATE_DISABLED; + attr->phys_state = IB_PORT_PHYS_STATE_DISABLED; mutex_unlock(&rxe->usdev_lock); diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c index 32dc79d0e898..404e7ca4b30c 100644 --- a/drivers/infiniband/sw/siw/siw_verbs.c +++ b/drivers/infiniband/sw/siw/siw_verbs.c @@ -206,7 +206,8 @@ int siw_query_port(struct ib_device *base_dev, u8 port, attr->gid_tbl_len = 1; attr->max_msg_sz = -1; attr->max_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu); - attr->phys_state = sdev->state == IB_PORT_ACTIVE ? 5 : 3; + attr->phys_state = sdev->state == IB_PORT_ACTIVE ? + IB_PORT_PHYS_STATE_LINK_UP : IB_PORT_PHYS_STATE_DISABLED; attr->pkey_tbl_len = 1; attr->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_DEVICE_MGMT_SUP; attr->state = sdev->state; diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index c5f8a9f17063..27fe844cff42 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -451,6 +451,16 @@ enum ib_port_state { IB_PORT_ACTIVE_DEFER = 5 }; +enum ib_port_phys_state { + IB_PORT_PHYS_STATE_SLEEP = 1, + IB_PORT_PHYS_STATE_POLLING = 2, + IB_PORT_PHYS_STATE_DISABLED = 3, + IB_PORT_PHYS_STATE_PORT_CONFIGURATION_TRAINING = 4, + IB_PORT_PHYS_STATE_LINK_UP = 5, + IB_PORT_PHYS_STATE_LINK_ERROR_RECOVERY = 6, + IB_PORT_PHYS_STATE_PHY_TEST = 7, +}; + enum ib_port_width { IB_WIDTH_1X = 1, IB_WIDTH_2X = 16, From patchwork Wed Jul 31 11:15:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11067513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E13EA1398 for ; Wed, 31 Jul 2019 11:15:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D09222880A for ; Wed, 31 Jul 2019 11:15:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C449B28906; Wed, 31 Jul 2019 11:15:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EF962880A for ; Wed, 31 Jul 2019 11:15:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728725AbfGaLPd (ORCPT ); Wed, 31 Jul 2019 07:15:33 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:46685 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726763AbfGaLPc (ORCPT ); Wed, 31 Jul 2019 07:15:32 -0400 Received: by mail-wr1-f65.google.com with SMTP id z1so69198986wru.13 for ; Wed, 31 Jul 2019 04:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nJ8lWXhH5FN5zVWUDgS/ZjpIZ9jEHMtpHfW5T1E6xr0=; b=ITf9kC4WRfh52jGugLEKyqC83N+7rMF53Ii44Ka3qTrLmRgJBrfwQZ6E1TeQWUpkJF k4kTpGdZ/d3DKiV/Xt9W/w5URUEHgluLjNWJwLsRKKg4llHBxGa3pgEccmRNMjFIwAAb KQrR41l23fRLRmDrCyXpAucxMLUh/K6rNKEoh/mYEK6JyY2t/7OmJii7oHM5wfDncUJ6 kKS6Au5FllSqeX3vs5vfendUKXHk26GNIlOfs1i6jJ9swpxXpm+qKNTy0dYEWEbU8CrG XSmPBxl2g8q1QxanQHZ31eS4Adah3lP7Tn+TCP8Scf2yQsFuUqA4xgRLLOhnGsuHsJja sZVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nJ8lWXhH5FN5zVWUDgS/ZjpIZ9jEHMtpHfW5T1E6xr0=; b=JWWtvJTx3JOmRhnpCOVlpnJb/CmG79fmrhBaeUwZcuN73mjlAl6ftjcfecZcezwhrS 61oQuXauG/+huNSrERN4HXDvPEkbYadiH4zuJzKqI5USoMYNHPv4ucbYLwG4N4bfXxaQ X6IJZhkETl716Os0erqTSwMHq2D8MrN+GKZig8hQ1IsTgJMc2p5QIaeE69FLjj9uMnWQ SXpupNJMofmCr11dVhGvEchSVEVlb48imkxqe4nikKiQxP9ug28pQmSjSd3a4uW0Y3lb y91LUwEr4iuNFh7K0U6a39Rj3/izyJM+q/xqtyQKKcrWs3r+wSeC3+rlMfp6mpoduAuL Fo2Q== X-Gm-Message-State: APjAAAXowkm/l0u4epJBgl7C9dsoSGwKc18c9iJiDZqdKM6lclacZxbA fmJsKxXtJF7kzGLdIZLYGl4uT2E5 X-Google-Smtp-Source: APXvYqyrjRfC1vjPICJ2/cyr57kHegdB31YAN196FbY+U6+ri3ERTmBeJJqVOQnSK53kQipetEROtg== X-Received: by 2002:adf:e50b:: with SMTP id j11mr97061429wrm.351.1564571730074; Wed, 31 Jul 2019 04:15:30 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-109-65-15-211.red.bezeqint.net. [109.65.15.211]) by smtp.gmail.com with ESMTPSA id h133sm73133732wme.28.2019.07.31.04.15.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 04:15:29 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Doug Ledford , Potnuri Bharat Teja , Selvin Xavier , Gal Pressman , Leon Romanovsky , Michal Kalderon , Christian Benvenuti , Moni Shoua , Bernard Metzler , Shiraz Saleem , Kamal Heib Subject: [PATCH for-next 2/4] RDMA/cxgb3: Use ib_device_set_netdev() Date: Wed, 31 Jul 2019 14:15:01 +0300 Message-Id: <20190731111503.8872-3-kamalheib1@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731111503.8872-1-kamalheib1@gmail.com> References: <20190731111503.8872-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This change is required to associate the cxgb3 ib_dev with the underlying net_device, so in the upcoming patch we can call ib_device_get_netdev(). Signed-off-by: Kamal Heib --- drivers/infiniband/hw/cxgb3/iwch_provider.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index e775c1a1a450..5848e4727b2e 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c @@ -1273,8 +1273,24 @@ static const struct ib_device_ops iwch_dev_ops = { INIT_RDMA_OBJ_SIZE(ib_ucontext, iwch_ucontext, ibucontext), }; +static int set_netdevs(struct ib_device *ib_dev, struct cxio_rdev *rdev) +{ + int ret; + int i; + + for (i = 0; i < rdev->port_info.nports; i++) { + ret = ib_device_set_netdev(ib_dev, rdev->port_info.lldevs[i], + i + 1); + if (ret) + return ret; + } + return 0; +} + int iwch_register_device(struct iwch_dev *dev) { + int err; + pr_debug("%s iwch_dev %p\n", __func__, dev); memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid)); memcpy(&dev->ibdev.node_guid, dev->rdev.t3cdev_p->lldev->dev_addr, 6); @@ -1315,6 +1331,10 @@ int iwch_register_device(struct iwch_dev *dev) rdma_set_device_sysfs_group(&dev->ibdev, &iwch_attr_group); ib_set_device_ops(&dev->ibdev, &iwch_dev_ops); + err = set_netdevs(&dev->ibdev, &dev->rdev); + if (err) + return err; + return ib_register_device(&dev->ibdev, "cxgb3_%d"); } From patchwork Wed Jul 31 11:15:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11067515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4070213AC for ; Wed, 31 Jul 2019 11:15:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AD522880A for ; Wed, 31 Jul 2019 11:15:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A76B28905; Wed, 31 Jul 2019 11:15:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A08D22880A for ; Wed, 31 Jul 2019 11:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387458AbfGaLPf (ORCPT ); Wed, 31 Jul 2019 07:15:35 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45620 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728723AbfGaLPe (ORCPT ); Wed, 31 Jul 2019 07:15:34 -0400 Received: by mail-wr1-f65.google.com with SMTP id f9so69204568wre.12 for ; Wed, 31 Jul 2019 04:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zXWhmCPImLcIeD1MD1tDqsnxPDathHoCivPw/kx+LN0=; b=AVYK+CyvRjiyB+5+uZ5mZY3JoM75r2GlXNBRNFikUVAmdYLFSYv1gIBYtozBQFiq3j j5znK8q0atxnVPc11Y6BvMMrkQykRcitF97apUbCuLxJHsXt3+NweFJ9NH7VODRjodIt NAfl4g82mF/A90FmxbauGP57W55ktqUO6SnzyrzhLawilJzeSIbPxO+51WMw057TjMXU F5rvDJUcBzQ6BsK+kETqAgRY1HHhE3TyhQlvtObT7z0LquL9fzfdgAx1IDhy697F9YCO 47DOAmQn+uuU5wwMAdcDD9NltXtgwVruE3FINN1mvO9TwSlwscCap2ZYpbjYnQ9IQO9h SuFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zXWhmCPImLcIeD1MD1tDqsnxPDathHoCivPw/kx+LN0=; b=cuJC7smk461VDhB74KGFXvGnSk7W12rZUCUlbsja709HlH7vFa56ICsxME/P5+kwDn h6JZ+xmaD9BBRoL4+czHlADoGkHGTJdFQ7RypErL+G0Xx4E964yJNrjci008lEw+js6M nt0gN/tB5hYuNPHuG1NCPXFplHKyxbcNJPM7VS8+traRCQB2qyW/xeiiK5Dey1w7DuQm h7gWClV84Z85xdQl08fojFowVswdE84o1R9o8sJyEdTKDeELhuxh40YSUBR0w6AgNKvr Sa2AHDwmSUiAdSUGb5zp4Ypx6GejGRcqLFENBi5Lp/Njc1jgW6WQuqVe7xe9nYht4Ziz Dkbg== X-Gm-Message-State: APjAAAW1naMz8O6OwJqRSRXGA90viiJEwekARL+QF+jTXP7+DahxxDdi CgZF/UhbYx07a+fvtN/Hp3nxtWYe X-Google-Smtp-Source: APXvYqyxrFWPcPMs2yiZw9R0qBL2ScbpHNagJ8hXF6+fdogLNEtW+Pe34G2CC7/UGfCnkmPBW91V+Q== X-Received: by 2002:adf:f6d2:: with SMTP id y18mr58169020wrp.102.1564571731986; Wed, 31 Jul 2019 04:15:31 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-109-65-15-211.red.bezeqint.net. [109.65.15.211]) by smtp.gmail.com with ESMTPSA id h133sm73133732wme.28.2019.07.31.04.15.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 04:15:31 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Doug Ledford , Potnuri Bharat Teja , Selvin Xavier , Gal Pressman , Leon Romanovsky , Michal Kalderon , Christian Benvenuti , Moni Shoua , Bernard Metzler , Shiraz Saleem , Kamal Heib Subject: [PATCH for-next 3/4] RDMA/core: Add common iWARP query port Date: Wed, 31 Jul 2019 14:15:02 +0300 Message-Id: <20190731111503.8872-4-kamalheib1@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731111503.8872-1-kamalheib1@gmail.com> References: <20190731111503.8872-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for a common iWARP query port function, the new function includes a common code that is used by the iWARP devices to update the port attributes like max_mtu, active_mtu, state, and phys_state, the function also includes a call for the driver-specific query_port callback to query the device-specific port attributes. Signed-off-by: Kamal Heib --- drivers/infiniband/core/device.c | 85 ++++++++++++++++++++++++++------ 1 file changed, 71 insertions(+), 14 deletions(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 9773145dee09..8db632a35a30 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -1940,6 +1940,72 @@ void ib_dispatch_event(struct ib_event *event) } EXPORT_SYMBOL(ib_dispatch_event); +static int __iw_query_port(struct ib_device *device, + u8 port_num, + struct ib_port_attr *port_attr) +{ + struct in_device *inetdev; + struct net_device *netdev; + int err; + + memset(port_attr, 0, sizeof(*port_attr)); + + netdev = ib_device_get_netdev(device, port_num); + if (!netdev) + return -ENODEV; + + port_attr->max_mtu = IB_MTU_4096; + port_attr->active_mtu = ib_mtu_int_to_enum(netdev->mtu); + + if (!netif_carrier_ok(netdev)) { + port_attr->state = IB_PORT_DOWN; + port_attr->phys_state = IB_PORT_PHYS_STATE_DISABLED; + } else { + inetdev = in_dev_get(netdev); + + if (inetdev && inetdev->ifa_list) { + port_attr->state = IB_PORT_ACTIVE; + port_attr->phys_state = IB_PORT_PHYS_STATE_LINK_UP; + in_dev_put(inetdev); + } else { + port_attr->state = IB_PORT_INIT; + port_attr->phys_state = + IB_PORT_PHYS_STATE_PORT_CONFIGURATION_TRAINING; + } + } + + err = device->ops.query_port(device, port_num, port_attr); + if (err) + return err; + + return 0; +} + +static int __ib_query_port(struct ib_device *device, + u8 port_num, + struct ib_port_attr *port_attr) +{ + union ib_gid gid; + int err; + + memset(port_attr, 0, sizeof(*port_attr)); + + err = device->ops.query_port(device, port_num, port_attr); + if (err || port_attr->subnet_prefix) + return err; + + if (rdma_port_get_link_layer(device, port_num) != + IB_LINK_LAYER_INFINIBAND) + return 0; + + err = device->ops.query_gid(device, port_num, 0, &gid); + if (err) + return err; + + port_attr->subnet_prefix = be64_to_cpu(gid.global.subnet_prefix); + return 0; +} + /** * ib_query_port - Query IB port attributes * @device:Device to query @@ -1953,26 +2019,17 @@ int ib_query_port(struct ib_device *device, u8 port_num, struct ib_port_attr *port_attr) { - union ib_gid gid; int err; if (!rdma_is_port_valid(device, port_num)) return -EINVAL; - memset(port_attr, 0, sizeof(*port_attr)); - err = device->ops.query_port(device, port_num, port_attr); - if (err || port_attr->subnet_prefix) - return err; - - if (rdma_port_get_link_layer(device, port_num) != IB_LINK_LAYER_INFINIBAND) - return 0; - - err = device->ops.query_gid(device, port_num, 0, &gid); - if (err) - return err; + if (rdma_node_get_transport(device->node_type) == RDMA_TRANSPORT_IWARP) + err = __iw_query_port(device, port_num, port_attr); + else + err = __ib_query_port(device, port_num, port_attr); - port_attr->subnet_prefix = be64_to_cpu(gid.global.subnet_prefix); - return 0; + return err; } EXPORT_SYMBOL(ib_query_port); From patchwork Wed Jul 31 11:15:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11067519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A1B5D1398 for ; Wed, 31 Jul 2019 11:15:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9073F2880A for ; Wed, 31 Jul 2019 11:15:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84B94288F4; Wed, 31 Jul 2019 11:15:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1891E28861 for ; Wed, 31 Jul 2019 11:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387461AbfGaLPh (ORCPT ); Wed, 31 Jul 2019 07:15:37 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46693 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726607AbfGaLPh (ORCPT ); Wed, 31 Jul 2019 07:15:37 -0400 Received: by mail-wr1-f68.google.com with SMTP id z1so69199197wru.13 for ; Wed, 31 Jul 2019 04:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E9BPmTE+kOCXIh8/c7E+/PPwTMY3AF0O7t/3VOscjHQ=; b=jNdMd136Pr5K+mwt+bzNANR2cPQ3UzzCGpy96OHNQ+S23tVSs/d8CPo5S26Ozt7mn4 ZHQcSpj1YbK30ceerW1EMR13oOxwuk2BjvOfnmLt/7Jl3wyyu3+X25Ic8SOioTPWavzQ DdlcpSANgoIoia88btWTswF82tLs/ouSRFJEBTdVdJdMkpN353Bw31OyenbMZYh4ELGa bMBUkVutVZDS44KQA4wtDig8ZnGHWZJyPDKUmRlGW7YFp0aWVQrKcghYEfeIskmhSzVV KbKf2aTSOcTeNWZ2gNFnyP80pZgi7OF1CZOs0ilwxQOlmMOMrIa9vVk85jyYnaNGsezk +2xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E9BPmTE+kOCXIh8/c7E+/PPwTMY3AF0O7t/3VOscjHQ=; b=hIusCPCfeRK+8DadtoRjFHGr+DA2SkfRdxC6QXc9c6hJKeDbpLaEj6Zaqr+63xbca/ mxzfYDm0EX16q8xqp1izrwKmZhPwFAuegYYo/cPyxVdKiQxBuc6ZoqEjECzmJjQjapY/ zIkgrzSJVMcr8msAHuMp8TEiSJ6DmFguyiCofLcXASnw2MfuwVg+fkV5qHXmpR+/V+9e j+Lzj7IIOfb4EAvHQ/hwnKg710g9AZEq1t7qkYJFte6vIy3A3hvezI/FCElu521YebL3 ANawgwwhomWhY3cfD3VtR/7Ixm2NwUDFlImGDCpY2FbImx9GdTwB04lk2VScbhRrGv0i Ln9A== X-Gm-Message-State: APjAAAXFsz8zfZOvacDh2/T+Z+QLTV125fhodrguWONcTVK4ydsVXH5+ G+Rxj+fGsWM+iONuVj3DSTD6Fw8t X-Google-Smtp-Source: APXvYqyULjOGIDlKjT2Igvziin51MdqPJH/zUxo5MscHP5RTrie6g3q2UlLPHVOCbkKpjThg1FVaQg== X-Received: by 2002:adf:80e1:: with SMTP id 88mr46880851wrl.127.1564571734020; Wed, 31 Jul 2019 04:15:34 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-109-65-15-211.red.bezeqint.net. [109.65.15.211]) by smtp.gmail.com with ESMTPSA id h133sm73133732wme.28.2019.07.31.04.15.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 04:15:33 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Doug Ledford , Potnuri Bharat Teja , Selvin Xavier , Gal Pressman , Leon Romanovsky , Michal Kalderon , Christian Benvenuti , Moni Shoua , Bernard Metzler , Shiraz Saleem , Kamal Heib Subject: [PATCH for-next 4/4] RDMA/{cxgb3, cxgb4, i40iw}: Remove common code Date: Wed, 31 Jul 2019 14:15:03 +0300 Message-Id: <20190731111503.8872-5-kamalheib1@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731111503.8872-1-kamalheib1@gmail.com> References: <20190731111503.8872-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we have a common iWARP query port function we can remove the common code from the iWARP drivers. Signed-off-by: Kamal Heib --- drivers/infiniband/hw/cxgb3/iwch_provider.c | 25 --------------------- drivers/infiniband/hw/cxgb4/provider.c | 24 -------------------- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 11 --------- 3 files changed, 60 deletions(-) diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index 5848e4727b2e..dcf02ec02810 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c @@ -991,33 +991,8 @@ static int iwch_query_device(struct ib_device *ibdev, struct ib_device_attr *pro static int iwch_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *props) { - struct iwch_dev *dev; - struct net_device *netdev; - struct in_device *inetdev; - pr_debug("%s ibdev %p\n", __func__, ibdev); - dev = to_iwch_dev(ibdev); - netdev = dev->rdev.port_info.lldevs[port-1]; - - /* props being zeroed by the caller, avoid zeroing it here */ - props->max_mtu = IB_MTU_4096; - props->active_mtu = ib_mtu_int_to_enum(netdev->mtu); - - if (!netif_carrier_ok(netdev)) - props->state = IB_PORT_DOWN; - else { - inetdev = in_dev_get(netdev); - if (inetdev) { - if (inetdev->ifa_list) - props->state = IB_PORT_ACTIVE; - else - props->state = IB_PORT_INIT; - in_dev_put(inetdev); - } else - props->state = IB_PORT_INIT; - } - props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_SNMP_TUNNEL_SUP | diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index 5e59c5708729..d373ac0fe2cb 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c @@ -305,32 +305,8 @@ static int c4iw_query_device(struct ib_device *ibdev, struct ib_device_attr *pro static int c4iw_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *props) { - struct c4iw_dev *dev; - struct net_device *netdev; - struct in_device *inetdev; - pr_debug("ibdev %p\n", ibdev); - dev = to_c4iw_dev(ibdev); - netdev = dev->rdev.lldi.ports[port-1]; - /* props being zeroed by the caller, avoid zeroing it here */ - props->max_mtu = IB_MTU_4096; - props->active_mtu = ib_mtu_int_to_enum(netdev->mtu); - - if (!netif_carrier_ok(netdev)) - props->state = IB_PORT_DOWN; - else { - inetdev = in_dev_get(netdev); - if (inetdev) { - if (inetdev->ifa_list) - props->state = IB_PORT_ACTIVE; - else - props->state = IB_PORT_INIT; - in_dev_put(inetdev); - } else - props->state = IB_PORT_INIT; - } - props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_SNMP_TUNNEL_SUP | diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c index d169a8031375..8056930bbe2c 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c @@ -97,18 +97,7 @@ static int i40iw_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *props) { - struct i40iw_device *iwdev = to_iwdev(ibdev); - struct net_device *netdev = iwdev->netdev; - - /* props being zeroed by the caller, avoid zeroing it here */ - props->max_mtu = IB_MTU_4096; - props->active_mtu = ib_mtu_int_to_enum(netdev->mtu); - props->lid = 1; - if (netif_carrier_ok(iwdev->netdev)) - props->state = IB_PORT_ACTIVE; - else - props->state = IB_PORT_DOWN; props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_REINIT_SUP | IB_PORT_VENDOR_CLASS_SUP | IB_PORT_BOOT_MGMT_SUP; props->gid_tbl_len = 1;