IB: Query ports via the core instead of direct into the driver
authorOr Gerlitz <ogerlitz@mellanox.com>
Tue, 24 Jan 2017 11:02:39 +0000 (13:02 +0200)
committerDoug Ledford <dledford@redhat.com>
Tue, 14 Feb 2017 16:41:22 +0000 (11:41 -0500)
Change the drivers to call ib_query_port in their get port
immutable handler instead of their own query port handler.

Doing this required to set the core cap flags of this device
before the ib_query_port call is made, since the IB core might
need these caps to serve the port query.

Drivers are ensured by the IB core that the port attributes passed
to the port query verb implementation are zero, and hence we
removed the zeroing from the drivers.

This patch doesn't add any new functionality.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Acked-by: Adit Ranadive <aditr@vmware.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
22 files changed:
drivers/infiniband/hw/cxgb3/iwch_provider.c
drivers/infiniband/hw/cxgb4/provider.c
drivers/infiniband/hw/hfi1/verbs.c
drivers/infiniband/hw/hns/hns_roce_main.c
drivers/infiniband/hw/i40iw/i40iw_verbs.c
drivers/infiniband/hw/mlx4/alias_GUID.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx4/sysfs.c
drivers/infiniband/hw/mlx5/mad.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mthca/mthca_provider.c
drivers/infiniband/hw/nes/nes_verbs.c
drivers/infiniband/hw/ocrdma/ocrdma_main.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
drivers/infiniband/hw/qedr/verbs.c
drivers/infiniband/hw/qib/qib_verbs.c
drivers/infiniband/hw/usnic/usnic_ib_main.c
drivers/infiniband/hw/usnic/usnic_ib_verbs.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
drivers/infiniband/sw/rdmavt/vt.c
drivers/infiniband/sw/rxe/rxe_verbs.c

index 9d5fe1853da46e54e9d635c5d101b688f4a8119a..9e39252a570a3c0380a0491b7c395bc2fd28a45b 100644 (file)
@@ -1133,7 +1133,7 @@ static int iwch_query_port(struct ib_device *ibdev,
        dev = to_iwch_dev(ibdev);
        netdev = dev->rdev.port_info.lldevs[port-1];
 
-       memset(props, 0, sizeof(struct ib_port_attr));
+       /* props being zeroed by the caller, avoid zeroing it here */
        props->max_mtu = IB_MTU_4096;
        if (netdev->mtu >= 4096)
                props->active_mtu = IB_MTU_4096;
@@ -1338,13 +1338,14 @@ static int iwch_port_immutable(struct ib_device *ibdev, u8 port_num,
        struct ib_port_attr attr;
        int err;
 
-       err = iwch_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
+
+       err = ib_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
 
        return 0;
 }
index 49b51b7e0fd786bf49dc2187e6c661f14087f3ae..5b00b50a484fa57cfbbc546954a2c63caed5e35f 100644 (file)
@@ -358,8 +358,7 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,
 
        dev = to_c4iw_dev(ibdev);
        netdev = dev->rdev.lldi.ports[port-1];
-
-       memset(props, 0, sizeof(struct ib_port_attr));
+       /* props being zeroed by the caller, avoid zeroing it here */
        props->max_mtu = IB_MTU_4096;
        if (netdev->mtu >= 4096)
                props->active_mtu = IB_MTU_4096;
@@ -505,13 +504,14 @@ static int c4iw_port_immutable(struct ib_device *ibdev, u8 port_num,
        struct ib_port_attr attr;
        int err;
 
-       err = c4iw_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
+
+       err = ib_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
 
        return 0;
 }
index 95ed4d6da510c474fce19f92fcdda8098fd926b1..f2d4e042872599f8e17fa4156e79a332b7be7e48 100644 (file)
@@ -1384,6 +1384,7 @@ static int query_port(struct rvt_dev_info *rdi, u8 port_num,
        struct hfi1_pportdata *ppd = &dd->pport[port_num - 1];
        u16 lid = ppd->lid;
 
+       /* props being zeroed by the caller, avoid zeroing it here */
        props->lid = lid ? lid : 0;
        props->lmc = ppd->lmc;
        /* OPA logical states match IB logical states */
index 4953d9cb83a7ff1e1fc5d8f11667bfadd16926b9..7be8158f15eed70a6e56ecdcd98f49935d054519 100644 (file)
@@ -249,7 +249,7 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u8 port_num,
        assert(port_num > 0);
        port = port_num - 1;
 
-       memset(props, 0, sizeof(*props));
+       /* props being zeroed by the caller, avoid zeroing it here */
 
        props->max_mtu = hr_dev->caps.max_mtu;
        props->gid_tbl_len = hr_dev->caps.gid_table_len[port];
@@ -400,14 +400,15 @@ static int hns_roce_port_immutable(struct ib_device *ib_dev, u8 port_num,
        struct ib_port_attr attr;
        int ret;
 
-       ret = hns_roce_query_port(ib_dev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE;
+
+       ret = ib_query_port(ib_dev, port_num, &attr);
        if (ret)
                return ret;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
 
-       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE;
        immutable->max_mad_size = IB_MGMT_MAD_SIZE;
 
        return 0;
index 29e97df9e1a7f87c784ebf33f4ebccfae217f433..3e830486417b02b515b3a36fb014d89c62b25db2 100644 (file)
@@ -97,8 +97,7 @@ static int i40iw_query_port(struct ib_device *ibdev,
        struct i40iw_device *iwdev = to_iwdev(ibdev);
        struct net_device *netdev = iwdev->netdev;
 
-       memset(props, 0, sizeof(*props));
-
+       /* props being zeroed by the caller, avoid zeroing it here */
        props->max_mtu = IB_MTU_4096;
        if (netdev->mtu >= 4096)
                props->active_mtu = IB_MTU_4096;
@@ -2506,14 +2505,15 @@ static int i40iw_port_immutable(struct ib_device *ibdev, u8 port_num,
        struct ib_port_attr attr;
        int err;
 
-       err = i40iw_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
+
+       err = ib_query_port(ibdev, port_num, &attr);
 
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
 
        return 0;
 }
index 06020c54db203110a13dc849031ba21e23c7359d..ea24230ea0d49956ff8311e6c310dd46dbdfc7ec 100644 (file)
@@ -499,6 +499,7 @@ static int set_guid_rec(struct ib_device *ibdev,
        struct list_head *head =
                &dev->sriov.alias_guid.ports_guid[port - 1].cb_list;
 
+       memset(&attr, 0, sizeof(attr));
        err = __mlx4_ib_query_port(ibdev, port, &attr, 1);
        if (err) {
                pr_debug("mlx4_ib_query_port failed (err: %d), port: %d\n",
index e0c1ef7696e88ccdeb78a6ac98f7440a778e014c..ba6af84cc23660cfcf3f4a3e057b1ee1b3c188dc 100644 (file)
@@ -741,7 +741,7 @@ int __mlx4_ib_query_port(struct ib_device *ibdev, u8 port,
 {
        int err;
 
-       memset(props, 0, sizeof *props);
+       /* props being zeroed by the caller, avoid zeroing it here */
 
        err = mlx4_ib_port_link_layer(ibdev, port) == IB_LINK_LAYER_INFINIBAND ?
                ib_link_query_port(ibdev, port, props, netw_view) :
@@ -1014,7 +1014,7 @@ static int mlx4_ib_modify_port(struct ib_device *ibdev, u8 port, int mask,
 
        mutex_lock(&mdev->cap_mask_mutex);
 
-       err = mlx4_ib_query_port(ibdev, port, &attr);
+       err = ib_query_port(ibdev, port, &attr);
        if (err)
                goto out;
 
@@ -2537,13 +2537,6 @@ static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num,
        struct mlx4_ib_dev *mdev = to_mdev(ibdev);
        int err;
 
-       err = mlx4_ib_query_port(ibdev, port_num, &attr);
-       if (err)
-               return err;
-
-       immutable->pkey_tbl_len = attr.pkey_tbl_len;
-       immutable->gid_tbl_len = attr.gid_tbl_len;
-
        if (mlx4_ib_port_link_layer(ibdev, port_num) == IB_LINK_LAYER_INFINIBAND) {
                immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB;
                immutable->max_mad_size = IB_MGMT_MAD_SIZE;
@@ -2559,6 +2552,13 @@ static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num,
                        immutable->max_mad_size = IB_MGMT_MAD_SIZE;
        }
 
+       err = ib_query_port(ibdev, port_num, &attr);
+       if (err)
+               return err;
+
+       immutable->pkey_tbl_len = attr.pkey_tbl_len;
+       immutable->gid_tbl_len = attr.gid_tbl_len;
+
        return 0;
 }
 
index 69fb5ba94d0f226c11a8614b29be4c33df329040..0ba5ba7540c87e32bbcf795a7b581f1b4b7a49aa 100644 (file)
@@ -226,6 +226,7 @@ static int add_port_entries(struct mlx4_ib_dev *device, int port_num)
        int ret = 0 ;
        struct ib_port_attr attr;
 
+       memset(&attr, 0, sizeof(attr));
        /* get the physical gid and pkey table sizes.*/
        ret = __mlx4_ib_query_port(&device->ib_dev, port_num, &attr, 1);
        if (ret)
index af962e7fdc3a10e9db4351e063596f59e444da57..8dacb49eabd98c92339b9d83e8f45166b8f33f2a 100644 (file)
@@ -527,7 +527,7 @@ int mlx5_query_mad_ifc_port(struct ib_device *ibdev, u8 port,
        if (!in_mad || !out_mad)
                goto out;
 
-       memset(props, 0, sizeof(*props));
+       /* props being zeroed by the caller, avoid zeroing it here */
 
        init_query_mad(in_mad);
        in_mad->attr_id  = IB_SMP_ATTR_PORT_INFO;
index c79a5c9f1f9af821d0477fa388737163fd064ba6..8fd35ebb13e394e3ce01d077ce1fd166b27a1848 100644 (file)
@@ -170,7 +170,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
        enum ib_mtu ndev_ib_mtu;
        u16 qkey_viol_cntr;
 
-       memset(props, 0, sizeof(*props));
+       /* props being zeroed by the caller, avoid zeroing it here */
 
        props->port_cap_flags  |= IB_PORT_CM_SUP;
        props->port_cap_flags  |= IB_PORT_IP_BASED_GIDS;
@@ -857,7 +857,7 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port,
                goto out;
        }
 
-       memset(props, 0, sizeof(*props));
+       /* props being zeroed by the caller, avoid zeroing it here */
 
        err = mlx5_query_hca_vport_context(mdev, 0, port, 0, rep);
        if (err)
@@ -1005,7 +1005,7 @@ static int mlx5_ib_modify_port(struct ib_device *ibdev, u8 port, int mask,
 
        mutex_lock(&dev->cap_mask_mutex);
 
-       err = mlx5_ib_query_port(ibdev, port, &attr);
+       err = ib_query_port(ibdev, port, &attr);
        if (err)
                goto out;
 
@@ -2644,6 +2644,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
        }
 
        for (port = 1; port <= MLX5_CAP_GEN(dev->mdev, num_ports); port++) {
+               memset(pprops, 0, sizeof(*pprops));
                err = mlx5_ib_query_port(&dev->ib_dev, port, pprops);
                if (err) {
                        mlx5_ib_warn(dev, "query_port %d failed %d\n",
@@ -2963,7 +2964,9 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num,
        enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num);
        int err;
 
-       err = mlx5_ib_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = get_core_cap_flags(ibdev);
+
+       err = ib_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
index d31708742ba5b1814d28135e4e41b273b6e651ba..ce163184e7422450044f271348b1fba67871d001 100644 (file)
@@ -146,7 +146,7 @@ static int mthca_query_port(struct ib_device *ibdev,
        if (!in_mad || !out_mad)
                goto out;
 
-       memset(props, 0, sizeof *props);
+       /* props being zeroed by the caller, avoid zeroing it here */
 
        init_query_mad(in_mad);
        in_mad->attr_id  = IB_SMP_ATTR_PORT_INFO;
@@ -212,7 +212,7 @@ static int mthca_modify_port(struct ib_device *ibdev,
        if (mutex_lock_interruptible(&to_mdev(ibdev)->cap_mask_mutex))
                return -ERESTARTSYS;
 
-       err = mthca_query_port(ibdev, port, &attr);
+       err = ib_query_port(ibdev, port, &attr);
        if (err)
                goto out;
 
@@ -1166,13 +1166,14 @@ static int mthca_port_immutable(struct ib_device *ibdev, u8 port_num,
        struct ib_port_attr attr;
        int err;
 
-       err = mthca_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB;
+
+       err = ib_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB;
        immutable->max_mad_size = IB_MGMT_MAD_SIZE;
 
        return 0;
index aff9fb14768be9006e05145b2bdd7b6f7dbee8ff..b7179f4ac3a6312d9436503122cc8202495db70f 100644 (file)
@@ -475,7 +475,7 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr
        struct nes_vnic *nesvnic = to_nesvnic(ibdev);
        struct net_device *netdev = nesvnic->netdev;
 
-       memset(props, 0, sizeof(*props));
+       /* props being zeroed by the caller, avoid zeroing it here */
 
        props->max_mtu = IB_MTU_4096;
 
@@ -3670,13 +3670,14 @@ static int nes_port_immutable(struct ib_device *ibdev, u8 port_num,
        struct ib_port_attr attr;
        int err;
 
+       immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
+
        err = nes_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
 
        return 0;
 }
index 896071502739a8b48042948badbfc3d6aeae5b24..3e43bdc81e7a5b49574c5b5460e0f7a38636e199 100644 (file)
@@ -93,15 +93,16 @@ static int ocrdma_port_immutable(struct ib_device *ibdev, u8 port_num,
        int err;
 
        dev = get_ocrdma_dev(ibdev);
-       err = ocrdma_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE;
+       if (ocrdma_is_udp_encap_supported(dev))
+               immutable->core_cap_flags |= RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP;
+
+       err = ib_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE;
-       if (ocrdma_is_udp_encap_supported(dev))
-               immutable->core_cap_flags |= RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP;
        immutable->max_mad_size = IB_MGMT_MAD_SIZE;
 
        return 0;
index 6af44f8db3d5499d46c584ac7fb386c1263f033d..013d15c7e59393a6990908931574af17891f8a39 100644 (file)
@@ -210,6 +210,7 @@ int ocrdma_query_port(struct ib_device *ibdev,
        struct ocrdma_dev *dev;
        struct net_device *netdev;
 
+       /* props being zeroed by the caller, avoid zeroing it here */
        dev = get_ocrdma_dev(ibdev);
        if (port > 1) {
                pr_err("%s(%d) invalid_port=0x%x\n", __func__,
index 57c8de2080773b161272774a69eaebf02cc411ed..91a16d38d1fc2afcbde05ef8659720744e0dee96 100644 (file)
@@ -238,8 +238,8 @@ int qedr_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *attr)
        }
 
        rdma_port = dev->ops->rdma_query_port(dev->rdma_ctx);
-       memset(attr, 0, sizeof(*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;
@@ -3549,14 +3549,15 @@ int qedr_port_immutable(struct ib_device *ibdev, u8 port_num,
        struct ib_port_attr attr;
        int err;
 
-       err = qedr_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE |
+                                   RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP;
+
+       err = ib_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE |
-                                   RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP;
        immutable->max_mad_size = IB_MGMT_MAD_SIZE;
 
        return 0;
index 4b54c0ddd08ae7c431a5c0f32aeb46d225004204..9161574601f69496e4cbc87fa05cb2431235d899 100644 (file)
@@ -1303,6 +1303,7 @@ static int qib_query_port(struct rvt_dev_info *rdi, u8 port_num,
        enum ib_mtu mtu;
        u16 lid = ppd->lid;
 
+       /* props being zeroed by the caller, avoid zeroing it here */
        props->lid = lid ? lid : be16_to_cpu(IB_LID_PERMISSIVE);
        props->lmc = ppd->lmc;
        props->state = dd->f_iblink_state(ppd->lastibcstat);
index dde0b23f65594d0844c7cc0c770f3cdfac65b012..4f5a45db08e1889e7f4b072b7a92dfa5a5bacb6a 100644 (file)
@@ -321,11 +321,12 @@ static int usnic_port_immutable(struct ib_device *ibdev, u8 port_num,
        struct ib_port_attr attr;
        int err;
 
-       err = usnic_ib_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_USNIC;
+
+       err = ib_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
-       immutable->core_cap_flags = RDMA_CORE_PORT_USNIC;
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
 
index 74819a7951e28f64f41655cf8967adb950db6c47..0ba274ff7be671affa1a63d6ef418d4e8e0e10c8 100644 (file)
@@ -330,7 +330,7 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,
 
        mutex_lock(&us_ibdev->usdev_lock);
        __ethtool_get_link_ksettings(us_ibdev->netdev, &cmd);
-       memset(props, 0, sizeof(*props));
+       /* props being zeroed by the caller, avoid zeroing it here */
 
        props->lid = 0;
        props->lmc = 1;
index 231a1ce1f4bec845d6ecfc58f53cd0d4ea5762a1..b8b0081de4789c8430b34b77876573121d9953f4 100644 (file)
@@ -132,13 +132,14 @@ static int pvrdma_port_immutable(struct ib_device *ibdev, u8 port_num,
        struct ib_port_attr attr;
        int err;
 
-       err = pvrdma_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE;
+
+       err = ib_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE;
        immutable->max_mad_size = IB_MGMT_MAD_SIZE;
        return 0;
 }
index 54891370d18a5beef151816c882b40fb705a9ec5..b3a982be8006f6fc63343e4a07e750dc2e13ab09 100644 (file)
@@ -135,7 +135,7 @@ int pvrdma_query_port(struct ib_device *ibdev, u8 port,
                return err;
        }
 
-       memset(props, 0, sizeof(*props));
+       /* props being zeroed by the caller, avoid zeroing it here */
 
        props->state = pvrdma_port_state_to_ib(resp->attrs.state);
        props->max_mtu = pvrdma_mtu_to_ib(resp->attrs.max_mtu);
@@ -275,7 +275,7 @@ int pvrdma_modify_port(struct ib_device *ibdev, u8 port, int mask,
        }
 
        mutex_lock(&vdev->port_mutex);
-       ret = pvrdma_query_port(ibdev, port, &attr);
+       ret = ib_query_port(ibdev, port, &attr);
        if (ret)
                goto out;
 
index d430c2f7cec4cea4fc24f465dedd0b30e27f29ce..1165639a914bf52518eee2b3f48b7a061bd9608c 100644 (file)
@@ -165,7 +165,7 @@ static int rvt_query_port(struct ib_device *ibdev, u8 port_num,
                return -EINVAL;
 
        rvp = rdi->ports[port_index];
-       memset(props, 0, sizeof(*props));
+       /* props being zeroed by the caller, avoid zeroing it here */
        props->sm_lid = rvp->sm_lid;
        props->sm_sl = rvp->sm_sl;
        props->port_cap_flags = rvp->port_cap_flags;
@@ -326,13 +326,14 @@ static int rvt_get_port_immutable(struct ib_device *ibdev, u8 port_num,
        if (port_index < 0)
                return -EINVAL;
 
-       err = rvt_query_port(ibdev, port_num, &attr);
+       immutable->core_cap_flags = rdi->dparms.core_cap_flags;
+
+       err = ib_query_port(ibdev, port_num, &attr);
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = rdi->dparms.core_cap_flags;
        immutable->max_mad_size = rdi->dparms.max_mad_size;
 
        return 0;
index beb7021ff18a2bdafb73475307f7cd8d3ea16359..371ef3bac8d4c2b26b03d31d0072e76a3ba81ac5 100644 (file)
@@ -86,6 +86,7 @@ static int rxe_query_port(struct ib_device *dev,
 
        port = &rxe->port;
 
+       /* *attr being zeroed by the caller, avoid zeroing it here */
        *attr = port->attr;
 
        mutex_lock(&rxe->usdev_lock);
@@ -261,13 +262,14 @@ static int rxe_port_immutable(struct ib_device *dev, u8 port_num,
        int err;
        struct ib_port_attr attr;
 
-       err = rxe_query_port(dev, port_num, &attr);
+       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP;
+
+       err = ib_query_port(dev, port_num, &attr);
        if (err)
                return err;
 
        immutable->pkey_tbl_len = attr.pkey_tbl_len;
        immutable->gid_tbl_len = attr.gid_tbl_len;
-       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP;
        immutable->max_mad_size = IB_MGMT_MAD_SIZE;
 
        return 0;