diff options
22 files changed, 73 insertions, 54 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index 9d5fe1853da4..9e39252a570a 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
| @@ -1133,7 +1133,7 @@ static int iwch_query_port(struct ib_device *ibdev, | |||
| 1133 | dev = to_iwch_dev(ibdev); | 1133 | dev = to_iwch_dev(ibdev); |
| 1134 | netdev = dev->rdev.port_info.lldevs[port-1]; | 1134 | netdev = dev->rdev.port_info.lldevs[port-1]; |
| 1135 | 1135 | ||
| 1136 | memset(props, 0, sizeof(struct ib_port_attr)); | 1136 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 1137 | props->max_mtu = IB_MTU_4096; | 1137 | props->max_mtu = IB_MTU_4096; |
| 1138 | if (netdev->mtu >= 4096) | 1138 | if (netdev->mtu >= 4096) |
| 1139 | props->active_mtu = IB_MTU_4096; | 1139 | props->active_mtu = IB_MTU_4096; |
| @@ -1338,13 +1338,14 @@ static int iwch_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 1338 | struct ib_port_attr attr; | 1338 | struct ib_port_attr attr; |
| 1339 | int err; | 1339 | int err; |
| 1340 | 1340 | ||
| 1341 | err = iwch_query_port(ibdev, port_num, &attr); | 1341 | immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; |
| 1342 | |||
| 1343 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 1342 | if (err) | 1344 | if (err) |
| 1343 | return err; | 1345 | return err; |
| 1344 | 1346 | ||
| 1345 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 1347 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 1346 | immutable->gid_tbl_len = attr.gid_tbl_len; | 1348 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 1347 | immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; | ||
| 1348 | 1349 | ||
| 1349 | return 0; | 1350 | return 0; |
| 1350 | } | 1351 | } |
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index 49b51b7e0fd7..5b00b50a484f 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c | |||
| @@ -358,8 +358,7 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port, | |||
| 358 | 358 | ||
| 359 | dev = to_c4iw_dev(ibdev); | 359 | dev = to_c4iw_dev(ibdev); |
| 360 | netdev = dev->rdev.lldi.ports[port-1]; | 360 | netdev = dev->rdev.lldi.ports[port-1]; |
| 361 | 361 | /* props being zeroed by the caller, avoid zeroing it here */ | |
| 362 | memset(props, 0, sizeof(struct ib_port_attr)); | ||
| 363 | props->max_mtu = IB_MTU_4096; | 362 | props->max_mtu = IB_MTU_4096; |
| 364 | if (netdev->mtu >= 4096) | 363 | if (netdev->mtu >= 4096) |
| 365 | props->active_mtu = IB_MTU_4096; | 364 | props->active_mtu = IB_MTU_4096; |
| @@ -505,13 +504,14 @@ static int c4iw_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 505 | struct ib_port_attr attr; | 504 | struct ib_port_attr attr; |
| 506 | int err; | 505 | int err; |
| 507 | 506 | ||
| 508 | err = c4iw_query_port(ibdev, port_num, &attr); | 507 | immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; |
| 508 | |||
| 509 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 509 | if (err) | 510 | if (err) |
| 510 | return err; | 511 | return err; |
| 511 | 512 | ||
| 512 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 513 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 513 | immutable->gid_tbl_len = attr.gid_tbl_len; | 514 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 514 | immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; | ||
| 515 | 515 | ||
| 516 | return 0; | 516 | return 0; |
| 517 | } | 517 | } |
diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c index 95ed4d6da510..f2d4e0428725 100644 --- a/drivers/infiniband/hw/hfi1/verbs.c +++ b/drivers/infiniband/hw/hfi1/verbs.c | |||
| @@ -1384,6 +1384,7 @@ static int query_port(struct rvt_dev_info *rdi, u8 port_num, | |||
| 1384 | struct hfi1_pportdata *ppd = &dd->pport[port_num - 1]; | 1384 | struct hfi1_pportdata *ppd = &dd->pport[port_num - 1]; |
| 1385 | u16 lid = ppd->lid; | 1385 | u16 lid = ppd->lid; |
| 1386 | 1386 | ||
| 1387 | /* props being zeroed by the caller, avoid zeroing it here */ | ||
| 1387 | props->lid = lid ? lid : 0; | 1388 | props->lid = lid ? lid : 0; |
| 1388 | props->lmc = ppd->lmc; | 1389 | props->lmc = ppd->lmc; |
| 1389 | /* OPA logical states match IB logical states */ | 1390 | /* OPA logical states match IB logical states */ |
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 4953d9cb83a7..7be8158f15ee 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c | |||
| @@ -249,7 +249,7 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u8 port_num, | |||
| 249 | assert(port_num > 0); | 249 | assert(port_num > 0); |
| 250 | port = port_num - 1; | 250 | port = port_num - 1; |
| 251 | 251 | ||
| 252 | memset(props, 0, sizeof(*props)); | 252 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 253 | 253 | ||
| 254 | props->max_mtu = hr_dev->caps.max_mtu; | 254 | props->max_mtu = hr_dev->caps.max_mtu; |
| 255 | props->gid_tbl_len = hr_dev->caps.gid_table_len[port]; | 255 | 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, | |||
| 400 | struct ib_port_attr attr; | 400 | struct ib_port_attr attr; |
| 401 | int ret; | 401 | int ret; |
| 402 | 402 | ||
| 403 | ret = hns_roce_query_port(ib_dev, port_num, &attr); | 403 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; |
| 404 | |||
| 405 | ret = ib_query_port(ib_dev, port_num, &attr); | ||
| 404 | if (ret) | 406 | if (ret) |
| 405 | return ret; | 407 | return ret; |
| 406 | 408 | ||
| 407 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 409 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 408 | immutable->gid_tbl_len = attr.gid_tbl_len; | 410 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 409 | 411 | ||
| 410 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; | ||
| 411 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; | 412 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; |
| 412 | 413 | ||
| 413 | return 0; | 414 | return 0; |
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c index 29e97df9e1a7..3e830486417b 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c | |||
| @@ -97,8 +97,7 @@ static int i40iw_query_port(struct ib_device *ibdev, | |||
| 97 | struct i40iw_device *iwdev = to_iwdev(ibdev); | 97 | struct i40iw_device *iwdev = to_iwdev(ibdev); |
| 98 | struct net_device *netdev = iwdev->netdev; | 98 | struct net_device *netdev = iwdev->netdev; |
| 99 | 99 | ||
| 100 | memset(props, 0, sizeof(*props)); | 100 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 101 | |||
| 102 | props->max_mtu = IB_MTU_4096; | 101 | props->max_mtu = IB_MTU_4096; |
| 103 | if (netdev->mtu >= 4096) | 102 | if (netdev->mtu >= 4096) |
| 104 | props->active_mtu = IB_MTU_4096; | 103 | props->active_mtu = IB_MTU_4096; |
| @@ -2506,14 +2505,15 @@ static int i40iw_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 2506 | struct ib_port_attr attr; | 2505 | struct ib_port_attr attr; |
| 2507 | int err; | 2506 | int err; |
| 2508 | 2507 | ||
| 2509 | err = i40iw_query_port(ibdev, port_num, &attr); | 2508 | immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; |
| 2509 | |||
| 2510 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 2510 | 2511 | ||
| 2511 | if (err) | 2512 | if (err) |
| 2512 | return err; | 2513 | return err; |
| 2513 | 2514 | ||
| 2514 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 2515 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 2515 | immutable->gid_tbl_len = attr.gid_tbl_len; | 2516 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 2516 | immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; | ||
| 2517 | 2517 | ||
| 2518 | return 0; | 2518 | return 0; |
| 2519 | } | 2519 | } |
diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c index 06020c54db20..ea24230ea0d4 100644 --- a/drivers/infiniband/hw/mlx4/alias_GUID.c +++ b/drivers/infiniband/hw/mlx4/alias_GUID.c | |||
| @@ -499,6 +499,7 @@ static int set_guid_rec(struct ib_device *ibdev, | |||
| 499 | struct list_head *head = | 499 | struct list_head *head = |
| 500 | &dev->sriov.alias_guid.ports_guid[port - 1].cb_list; | 500 | &dev->sriov.alias_guid.ports_guid[port - 1].cb_list; |
| 501 | 501 | ||
| 502 | memset(&attr, 0, sizeof(attr)); | ||
| 502 | err = __mlx4_ib_query_port(ibdev, port, &attr, 1); | 503 | err = __mlx4_ib_query_port(ibdev, port, &attr, 1); |
| 503 | if (err) { | 504 | if (err) { |
| 504 | pr_debug("mlx4_ib_query_port failed (err: %d), port: %d\n", | 505 | pr_debug("mlx4_ib_query_port failed (err: %d), port: %d\n", |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index e0c1ef7696e8..ba6af84cc236 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
| @@ -741,7 +741,7 @@ int __mlx4_ib_query_port(struct ib_device *ibdev, u8 port, | |||
| 741 | { | 741 | { |
| 742 | int err; | 742 | int err; |
| 743 | 743 | ||
| 744 | memset(props, 0, sizeof *props); | 744 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 745 | 745 | ||
| 746 | err = mlx4_ib_port_link_layer(ibdev, port) == IB_LINK_LAYER_INFINIBAND ? | 746 | err = mlx4_ib_port_link_layer(ibdev, port) == IB_LINK_LAYER_INFINIBAND ? |
| 747 | ib_link_query_port(ibdev, port, props, netw_view) : | 747 | 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, | |||
| 1014 | 1014 | ||
| 1015 | mutex_lock(&mdev->cap_mask_mutex); | 1015 | mutex_lock(&mdev->cap_mask_mutex); |
| 1016 | 1016 | ||
| 1017 | err = mlx4_ib_query_port(ibdev, port, &attr); | 1017 | err = ib_query_port(ibdev, port, &attr); |
| 1018 | if (err) | 1018 | if (err) |
| 1019 | goto out; | 1019 | goto out; |
| 1020 | 1020 | ||
| @@ -2537,13 +2537,6 @@ static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 2537 | struct mlx4_ib_dev *mdev = to_mdev(ibdev); | 2537 | struct mlx4_ib_dev *mdev = to_mdev(ibdev); |
| 2538 | int err; | 2538 | int err; |
| 2539 | 2539 | ||
| 2540 | err = mlx4_ib_query_port(ibdev, port_num, &attr); | ||
| 2541 | if (err) | ||
| 2542 | return err; | ||
| 2543 | |||
| 2544 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | ||
| 2545 | immutable->gid_tbl_len = attr.gid_tbl_len; | ||
| 2546 | |||
| 2547 | if (mlx4_ib_port_link_layer(ibdev, port_num) == IB_LINK_LAYER_INFINIBAND) { | 2540 | if (mlx4_ib_port_link_layer(ibdev, port_num) == IB_LINK_LAYER_INFINIBAND) { |
| 2548 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB; | 2541 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB; |
| 2549 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; | 2542 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; |
| @@ -2559,6 +2552,13 @@ static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 2559 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; | 2552 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; |
| 2560 | } | 2553 | } |
| 2561 | 2554 | ||
| 2555 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 2556 | if (err) | ||
| 2557 | return err; | ||
| 2558 | |||
| 2559 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | ||
| 2560 | immutable->gid_tbl_len = attr.gid_tbl_len; | ||
| 2561 | |||
| 2562 | return 0; | 2562 | return 0; |
| 2563 | } | 2563 | } |
| 2564 | 2564 | ||
diff --git a/drivers/infiniband/hw/mlx4/sysfs.c b/drivers/infiniband/hw/mlx4/sysfs.c index 69fb5ba94d0f..0ba5ba7540c8 100644 --- a/drivers/infiniband/hw/mlx4/sysfs.c +++ b/drivers/infiniband/hw/mlx4/sysfs.c | |||
| @@ -226,6 +226,7 @@ static int add_port_entries(struct mlx4_ib_dev *device, int port_num) | |||
| 226 | int ret = 0 ; | 226 | int ret = 0 ; |
| 227 | struct ib_port_attr attr; | 227 | struct ib_port_attr attr; |
| 228 | 228 | ||
| 229 | memset(&attr, 0, sizeof(attr)); | ||
| 229 | /* get the physical gid and pkey table sizes.*/ | 230 | /* get the physical gid and pkey table sizes.*/ |
| 230 | ret = __mlx4_ib_query_port(&device->ib_dev, port_num, &attr, 1); | 231 | ret = __mlx4_ib_query_port(&device->ib_dev, port_num, &attr, 1); |
| 231 | if (ret) | 232 | if (ret) |
diff --git a/drivers/infiniband/hw/mlx5/mad.c b/drivers/infiniband/hw/mlx5/mad.c index af962e7fdc3a..8dacb49eabd9 100644 --- a/drivers/infiniband/hw/mlx5/mad.c +++ b/drivers/infiniband/hw/mlx5/mad.c | |||
| @@ -527,7 +527,7 @@ int mlx5_query_mad_ifc_port(struct ib_device *ibdev, u8 port, | |||
| 527 | if (!in_mad || !out_mad) | 527 | if (!in_mad || !out_mad) |
| 528 | goto out; | 528 | goto out; |
| 529 | 529 | ||
| 530 | memset(props, 0, sizeof(*props)); | 530 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 531 | 531 | ||
| 532 | init_query_mad(in_mad); | 532 | init_query_mad(in_mad); |
| 533 | in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; | 533 | in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index c79a5c9f1f9a..8fd35ebb13e3 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
| @@ -170,7 +170,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, | |||
| 170 | enum ib_mtu ndev_ib_mtu; | 170 | enum ib_mtu ndev_ib_mtu; |
| 171 | u16 qkey_viol_cntr; | 171 | u16 qkey_viol_cntr; |
| 172 | 172 | ||
| 173 | memset(props, 0, sizeof(*props)); | 173 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 174 | 174 | ||
| 175 | props->port_cap_flags |= IB_PORT_CM_SUP; | 175 | props->port_cap_flags |= IB_PORT_CM_SUP; |
| 176 | props->port_cap_flags |= IB_PORT_IP_BASED_GIDS; | 176 | 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, | |||
| 857 | goto out; | 857 | goto out; |
| 858 | } | 858 | } |
| 859 | 859 | ||
| 860 | memset(props, 0, sizeof(*props)); | 860 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 861 | 861 | ||
| 862 | err = mlx5_query_hca_vport_context(mdev, 0, port, 0, rep); | 862 | err = mlx5_query_hca_vport_context(mdev, 0, port, 0, rep); |
| 863 | if (err) | 863 | if (err) |
| @@ -1005,7 +1005,7 @@ static int mlx5_ib_modify_port(struct ib_device *ibdev, u8 port, int mask, | |||
| 1005 | 1005 | ||
| 1006 | mutex_lock(&dev->cap_mask_mutex); | 1006 | mutex_lock(&dev->cap_mask_mutex); |
| 1007 | 1007 | ||
| 1008 | err = mlx5_ib_query_port(ibdev, port, &attr); | 1008 | err = ib_query_port(ibdev, port, &attr); |
| 1009 | if (err) | 1009 | if (err) |
| 1010 | goto out; | 1010 | goto out; |
| 1011 | 1011 | ||
| @@ -2644,6 +2644,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev) | |||
| 2644 | } | 2644 | } |
| 2645 | 2645 | ||
| 2646 | for (port = 1; port <= MLX5_CAP_GEN(dev->mdev, num_ports); port++) { | 2646 | for (port = 1; port <= MLX5_CAP_GEN(dev->mdev, num_ports); port++) { |
| 2647 | memset(pprops, 0, sizeof(*pprops)); | ||
| 2647 | err = mlx5_ib_query_port(&dev->ib_dev, port, pprops); | 2648 | err = mlx5_ib_query_port(&dev->ib_dev, port, pprops); |
| 2648 | if (err) { | 2649 | if (err) { |
| 2649 | mlx5_ib_warn(dev, "query_port %d failed %d\n", | 2650 | 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, | |||
| 2963 | enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num); | 2964 | enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num); |
| 2964 | int err; | 2965 | int err; |
| 2965 | 2966 | ||
| 2966 | err = mlx5_ib_query_port(ibdev, port_num, &attr); | 2967 | immutable->core_cap_flags = get_core_cap_flags(ibdev); |
| 2968 | |||
| 2969 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 2967 | if (err) | 2970 | if (err) |
| 2968 | return err; | 2971 | return err; |
| 2969 | 2972 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index d31708742ba5..ce163184e742 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
| @@ -146,7 +146,7 @@ static int mthca_query_port(struct ib_device *ibdev, | |||
| 146 | if (!in_mad || !out_mad) | 146 | if (!in_mad || !out_mad) |
| 147 | goto out; | 147 | goto out; |
| 148 | 148 | ||
| 149 | memset(props, 0, sizeof *props); | 149 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 150 | 150 | ||
| 151 | init_query_mad(in_mad); | 151 | init_query_mad(in_mad); |
| 152 | in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; | 152 | in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; |
| @@ -212,7 +212,7 @@ static int mthca_modify_port(struct ib_device *ibdev, | |||
| 212 | if (mutex_lock_interruptible(&to_mdev(ibdev)->cap_mask_mutex)) | 212 | if (mutex_lock_interruptible(&to_mdev(ibdev)->cap_mask_mutex)) |
| 213 | return -ERESTARTSYS; | 213 | return -ERESTARTSYS; |
| 214 | 214 | ||
| 215 | err = mthca_query_port(ibdev, port, &attr); | 215 | err = ib_query_port(ibdev, port, &attr); |
| 216 | if (err) | 216 | if (err) |
| 217 | goto out; | 217 | goto out; |
| 218 | 218 | ||
| @@ -1166,13 +1166,14 @@ static int mthca_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 1166 | struct ib_port_attr attr; | 1166 | struct ib_port_attr attr; |
| 1167 | int err; | 1167 | int err; |
| 1168 | 1168 | ||
| 1169 | err = mthca_query_port(ibdev, port_num, &attr); | 1169 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB; |
| 1170 | |||
| 1171 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 1170 | if (err) | 1172 | if (err) |
| 1171 | return err; | 1173 | return err; |
| 1172 | 1174 | ||
| 1173 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 1175 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 1174 | immutable->gid_tbl_len = attr.gid_tbl_len; | 1176 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 1175 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB; | ||
| 1176 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; | 1177 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; |
| 1177 | 1178 | ||
| 1178 | return 0; | 1179 | return 0; |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index aff9fb14768b..b7179f4ac3a6 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
| @@ -475,7 +475,7 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr | |||
| 475 | struct nes_vnic *nesvnic = to_nesvnic(ibdev); | 475 | struct nes_vnic *nesvnic = to_nesvnic(ibdev); |
| 476 | struct net_device *netdev = nesvnic->netdev; | 476 | struct net_device *netdev = nesvnic->netdev; |
| 477 | 477 | ||
| 478 | memset(props, 0, sizeof(*props)); | 478 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 479 | 479 | ||
| 480 | props->max_mtu = IB_MTU_4096; | 480 | props->max_mtu = IB_MTU_4096; |
| 481 | 481 | ||
| @@ -3670,13 +3670,14 @@ static int nes_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 3670 | struct ib_port_attr attr; | 3670 | struct ib_port_attr attr; |
| 3671 | int err; | 3671 | int err; |
| 3672 | 3672 | ||
| 3673 | immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; | ||
| 3674 | |||
| 3673 | err = nes_query_port(ibdev, port_num, &attr); | 3675 | err = nes_query_port(ibdev, port_num, &attr); |
| 3674 | if (err) | 3676 | if (err) |
| 3675 | return err; | 3677 | return err; |
| 3676 | 3678 | ||
| 3677 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 3679 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 3678 | immutable->gid_tbl_len = attr.gid_tbl_len; | 3680 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 3679 | immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; | ||
| 3680 | 3681 | ||
| 3681 | return 0; | 3682 | return 0; |
| 3682 | } | 3683 | } |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index 896071502739..3e43bdc81e7a 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c | |||
| @@ -93,15 +93,16 @@ static int ocrdma_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 93 | int err; | 93 | int err; |
| 94 | 94 | ||
| 95 | dev = get_ocrdma_dev(ibdev); | 95 | dev = get_ocrdma_dev(ibdev); |
| 96 | err = ocrdma_query_port(ibdev, port_num, &attr); | 96 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; |
| 97 | if (ocrdma_is_udp_encap_supported(dev)) | ||
| 98 | immutable->core_cap_flags |= RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP; | ||
| 99 | |||
| 100 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 97 | if (err) | 101 | if (err) |
| 98 | return err; | 102 | return err; |
| 99 | 103 | ||
| 100 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 104 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 101 | immutable->gid_tbl_len = attr.gid_tbl_len; | 105 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 102 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; | ||
| 103 | if (ocrdma_is_udp_encap_supported(dev)) | ||
| 104 | immutable->core_cap_flags |= RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP; | ||
| 105 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; | 106 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; |
| 106 | 107 | ||
| 107 | return 0; | 108 | return 0; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 6af44f8db3d5..013d15c7e593 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
| @@ -210,6 +210,7 @@ int ocrdma_query_port(struct ib_device *ibdev, | |||
| 210 | struct ocrdma_dev *dev; | 210 | struct ocrdma_dev *dev; |
| 211 | struct net_device *netdev; | 211 | struct net_device *netdev; |
| 212 | 212 | ||
| 213 | /* props being zeroed by the caller, avoid zeroing it here */ | ||
| 213 | dev = get_ocrdma_dev(ibdev); | 214 | dev = get_ocrdma_dev(ibdev); |
| 214 | if (port > 1) { | 215 | if (port > 1) { |
| 215 | pr_err("%s(%d) invalid_port=0x%x\n", __func__, | 216 | pr_err("%s(%d) invalid_port=0x%x\n", __func__, |
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c index 57c8de208077..91a16d38d1fc 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c | |||
| @@ -238,8 +238,8 @@ int qedr_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *attr) | |||
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | rdma_port = dev->ops->rdma_query_port(dev->rdma_ctx); | 240 | rdma_port = dev->ops->rdma_query_port(dev->rdma_ctx); |
| 241 | memset(attr, 0, sizeof(*attr)); | ||
| 242 | 241 | ||
| 242 | /* *attr being zeroed by the caller, avoid zeroing it here */ | ||
| 243 | if (rdma_port->port_state == QED_RDMA_PORT_UP) { | 243 | if (rdma_port->port_state == QED_RDMA_PORT_UP) { |
| 244 | attr->state = IB_PORT_ACTIVE; | 244 | attr->state = IB_PORT_ACTIVE; |
| 245 | attr->phys_state = 5; | 245 | attr->phys_state = 5; |
| @@ -3549,14 +3549,15 @@ int qedr_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 3549 | struct ib_port_attr attr; | 3549 | struct ib_port_attr attr; |
| 3550 | int err; | 3550 | int err; |
| 3551 | 3551 | ||
| 3552 | err = qedr_query_port(ibdev, port_num, &attr); | 3552 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE | |
| 3553 | RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP; | ||
| 3554 | |||
| 3555 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 3553 | if (err) | 3556 | if (err) |
| 3554 | return err; | 3557 | return err; |
| 3555 | 3558 | ||
| 3556 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 3559 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 3557 | immutable->gid_tbl_len = attr.gid_tbl_len; | 3560 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 3558 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE | | ||
| 3559 | RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP; | ||
| 3560 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; | 3561 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; |
| 3561 | 3562 | ||
| 3562 | return 0; | 3563 | return 0; |
diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c index 4b54c0ddd08a..9161574601f6 100644 --- a/drivers/infiniband/hw/qib/qib_verbs.c +++ b/drivers/infiniband/hw/qib/qib_verbs.c | |||
| @@ -1303,6 +1303,7 @@ static int qib_query_port(struct rvt_dev_info *rdi, u8 port_num, | |||
| 1303 | enum ib_mtu mtu; | 1303 | enum ib_mtu mtu; |
| 1304 | u16 lid = ppd->lid; | 1304 | u16 lid = ppd->lid; |
| 1305 | 1305 | ||
| 1306 | /* props being zeroed by the caller, avoid zeroing it here */ | ||
| 1306 | props->lid = lid ? lid : be16_to_cpu(IB_LID_PERMISSIVE); | 1307 | props->lid = lid ? lid : be16_to_cpu(IB_LID_PERMISSIVE); |
| 1307 | props->lmc = ppd->lmc; | 1308 | props->lmc = ppd->lmc; |
| 1308 | props->state = dd->f_iblink_state(ppd->lastibcstat); | 1309 | props->state = dd->f_iblink_state(ppd->lastibcstat); |
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c index dde0b23f6559..4f5a45db08e1 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c | |||
| @@ -321,11 +321,12 @@ static int usnic_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 321 | struct ib_port_attr attr; | 321 | struct ib_port_attr attr; |
| 322 | int err; | 322 | int err; |
| 323 | 323 | ||
| 324 | err = usnic_ib_query_port(ibdev, port_num, &attr); | 324 | immutable->core_cap_flags = RDMA_CORE_PORT_USNIC; |
| 325 | |||
| 326 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 325 | if (err) | 327 | if (err) |
| 326 | return err; | 328 | return err; |
| 327 | 329 | ||
| 328 | immutable->core_cap_flags = RDMA_CORE_PORT_USNIC; | ||
| 329 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 330 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 330 | immutable->gid_tbl_len = attr.gid_tbl_len; | 331 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 331 | 332 | ||
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c index 74819a7951e2..0ba274ff7be6 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c | |||
| @@ -330,7 +330,7 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port, | |||
| 330 | 330 | ||
| 331 | mutex_lock(&us_ibdev->usdev_lock); | 331 | mutex_lock(&us_ibdev->usdev_lock); |
| 332 | __ethtool_get_link_ksettings(us_ibdev->netdev, &cmd); | 332 | __ethtool_get_link_ksettings(us_ibdev->netdev, &cmd); |
| 333 | memset(props, 0, sizeof(*props)); | 333 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 334 | 334 | ||
| 335 | props->lid = 0; | 335 | props->lid = 0; |
| 336 | props->lmc = 1; | 336 | props->lmc = 1; |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c index 231a1ce1f4be..b8b0081de478 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | |||
| @@ -132,13 +132,14 @@ static int pvrdma_port_immutable(struct ib_device *ibdev, u8 port_num, | |||
| 132 | struct ib_port_attr attr; | 132 | struct ib_port_attr attr; |
| 133 | int err; | 133 | int err; |
| 134 | 134 | ||
| 135 | err = pvrdma_query_port(ibdev, port_num, &attr); | 135 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; |
| 136 | |||
| 137 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 136 | if (err) | 138 | if (err) |
| 137 | return err; | 139 | return err; |
| 138 | 140 | ||
| 139 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 141 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 140 | immutable->gid_tbl_len = attr.gid_tbl_len; | 142 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 141 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; | ||
| 142 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; | 143 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; |
| 143 | return 0; | 144 | return 0; |
| 144 | } | 145 | } |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c index 54891370d18a..b3a982be8006 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c | |||
| @@ -135,7 +135,7 @@ int pvrdma_query_port(struct ib_device *ibdev, u8 port, | |||
| 135 | return err; | 135 | return err; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | memset(props, 0, sizeof(*props)); | 138 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 139 | 139 | ||
| 140 | props->state = pvrdma_port_state_to_ib(resp->attrs.state); | 140 | props->state = pvrdma_port_state_to_ib(resp->attrs.state); |
| 141 | props->max_mtu = pvrdma_mtu_to_ib(resp->attrs.max_mtu); | 141 | 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, | |||
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | mutex_lock(&vdev->port_mutex); | 277 | mutex_lock(&vdev->port_mutex); |
| 278 | ret = pvrdma_query_port(ibdev, port, &attr); | 278 | ret = ib_query_port(ibdev, port, &attr); |
| 279 | if (ret) | 279 | if (ret) |
| 280 | goto out; | 280 | goto out; |
| 281 | 281 | ||
diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c index d430c2f7cec4..1165639a914b 100644 --- a/drivers/infiniband/sw/rdmavt/vt.c +++ b/drivers/infiniband/sw/rdmavt/vt.c | |||
| @@ -165,7 +165,7 @@ static int rvt_query_port(struct ib_device *ibdev, u8 port_num, | |||
| 165 | return -EINVAL; | 165 | return -EINVAL; |
| 166 | 166 | ||
| 167 | rvp = rdi->ports[port_index]; | 167 | rvp = rdi->ports[port_index]; |
| 168 | memset(props, 0, sizeof(*props)); | 168 | /* props being zeroed by the caller, avoid zeroing it here */ |
| 169 | props->sm_lid = rvp->sm_lid; | 169 | props->sm_lid = rvp->sm_lid; |
| 170 | props->sm_sl = rvp->sm_sl; | 170 | props->sm_sl = rvp->sm_sl; |
| 171 | props->port_cap_flags = rvp->port_cap_flags; | 171 | 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, | |||
| 326 | if (port_index < 0) | 326 | if (port_index < 0) |
| 327 | return -EINVAL; | 327 | return -EINVAL; |
| 328 | 328 | ||
| 329 | err = rvt_query_port(ibdev, port_num, &attr); | 329 | immutable->core_cap_flags = rdi->dparms.core_cap_flags; |
| 330 | |||
| 331 | err = ib_query_port(ibdev, port_num, &attr); | ||
| 330 | if (err) | 332 | if (err) |
| 331 | return err; | 333 | return err; |
| 332 | 334 | ||
| 333 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 335 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 334 | immutable->gid_tbl_len = attr.gid_tbl_len; | 336 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 335 | immutable->core_cap_flags = rdi->dparms.core_cap_flags; | ||
| 336 | immutable->max_mad_size = rdi->dparms.max_mad_size; | 337 | immutable->max_mad_size = rdi->dparms.max_mad_size; |
| 337 | 338 | ||
| 338 | return 0; | 339 | return 0; |
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index beb7021ff18a..371ef3bac8d4 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c | |||
| @@ -86,6 +86,7 @@ static int rxe_query_port(struct ib_device *dev, | |||
| 86 | 86 | ||
| 87 | port = &rxe->port; | 87 | port = &rxe->port; |
| 88 | 88 | ||
| 89 | /* *attr being zeroed by the caller, avoid zeroing it here */ | ||
| 89 | *attr = port->attr; | 90 | *attr = port->attr; |
| 90 | 91 | ||
| 91 | mutex_lock(&rxe->usdev_lock); | 92 | mutex_lock(&rxe->usdev_lock); |
| @@ -261,13 +262,14 @@ static int rxe_port_immutable(struct ib_device *dev, u8 port_num, | |||
| 261 | int err; | 262 | int err; |
| 262 | struct ib_port_attr attr; | 263 | struct ib_port_attr attr; |
| 263 | 264 | ||
| 264 | err = rxe_query_port(dev, port_num, &attr); | 265 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP; |
| 266 | |||
| 267 | err = ib_query_port(dev, port_num, &attr); | ||
| 265 | if (err) | 268 | if (err) |
| 266 | return err; | 269 | return err; |
| 267 | 270 | ||
| 268 | immutable->pkey_tbl_len = attr.pkey_tbl_len; | 271 | immutable->pkey_tbl_len = attr.pkey_tbl_len; |
| 269 | immutable->gid_tbl_len = attr.gid_tbl_len; | 272 | immutable->gid_tbl_len = attr.gid_tbl_len; |
| 270 | immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP; | ||
| 271 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; | 273 | immutable->max_mad_size = IB_MGMT_MAD_SIZE; |
| 272 | 274 | ||
| 273 | return 0; | 275 | return 0; |
