Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * IBM eServer eHCA Infiniband device driver for Linux on POWER |
| 3 | * |
| 4 | * HCA query functions |
| 5 | * |
| 6 | * Authors: Heiko J Schick <schickhj@de.ibm.com> |
| 7 | * Christoph Raisch <raisch@de.ibm.com> |
| 8 | * |
| 9 | * Copyright (c) 2005 IBM Corporation |
| 10 | * |
| 11 | * All rights reserved. |
| 12 | * |
| 13 | * This source code is distributed under a dual license of GPL v2.0 and OpenIB |
| 14 | * BSD. |
| 15 | * |
| 16 | * OpenIB BSD License |
| 17 | * |
| 18 | * Redistribution and use in source and binary forms, with or without |
| 19 | * modification, are permitted provided that the following conditions are met: |
| 20 | * |
| 21 | * Redistributions of source code must retain the above copyright notice, this |
| 22 | * list of conditions and the following disclaimer. |
| 23 | * |
| 24 | * Redistributions in binary form must reproduce the above copyright notice, |
| 25 | * this list of conditions and the following disclaimer in the documentation |
| 26 | * and/or other materials |
| 27 | * provided with the distribution. |
| 28 | * |
| 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 30 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 31 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 32 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 33 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 34 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 35 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 36 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 37 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 38 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 39 | * POSSIBILITY OF SUCH DAMAGE. |
| 40 | */ |
| 41 | |
| 42 | #include "ehca_tools.h" |
Hoang-Nam Nguyen | 7e28db5 | 2006-11-07 00:56:39 +0100 | [diff] [blame] | 43 | #include "ehca_iverbs.h" |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 44 | #include "hcp_if.h" |
| 45 | |
| 46 | int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props) |
| 47 | { |
Joachim Fenkes | 91f13aa | 2007-07-09 15:21:45 +0200 | [diff] [blame] | 48 | int i, ret = 0; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 49 | struct ehca_shca *shca = container_of(ibdev, struct ehca_shca, |
| 50 | ib_device); |
| 51 | struct hipz_query_hca *rblock; |
| 52 | |
Joachim Fenkes | 91f13aa | 2007-07-09 15:21:45 +0200 | [diff] [blame] | 53 | static const u32 cap_mapping[] = { |
| 54 | IB_DEVICE_RESIZE_MAX_WR, HCA_CAP_WQE_RESIZE, |
| 55 | IB_DEVICE_BAD_PKEY_CNTR, HCA_CAP_BAD_P_KEY_CTR, |
| 56 | IB_DEVICE_BAD_QKEY_CNTR, HCA_CAP_Q_KEY_VIOL_CTR, |
| 57 | IB_DEVICE_RAW_MULTI, HCA_CAP_RAW_PACKET_MCAST, |
| 58 | IB_DEVICE_AUTO_PATH_MIG, HCA_CAP_AUTO_PATH_MIG, |
| 59 | IB_DEVICE_CHANGE_PHY_PORT, HCA_CAP_SQD_RTS_PORT_CHANGE, |
| 60 | IB_DEVICE_UD_AV_PORT_ENFORCE, HCA_CAP_AH_PORT_NR_CHECK, |
| 61 | IB_DEVICE_CURR_QP_STATE_MOD, HCA_CAP_CUR_QP_STATE_MOD, |
| 62 | IB_DEVICE_SHUTDOWN_PORT, HCA_CAP_SHUTDOWN_PORT, |
| 63 | IB_DEVICE_INIT_TYPE, HCA_CAP_INIT_TYPE, |
| 64 | IB_DEVICE_PORT_ACTIVE_EVENT, HCA_CAP_PORT_ACTIVE_EVENT, |
| 65 | }; |
| 66 | |
Hoang-Nam Nguyen | f2d9136 | 2007-01-09 18:04:14 +0100 | [diff] [blame] | 67 | rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 68 | if (!rblock) { |
| 69 | ehca_err(&shca->ib_device, "Can't allocate rblock memory."); |
| 70 | return -ENOMEM; |
| 71 | } |
| 72 | |
| 73 | if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) { |
| 74 | ehca_err(&shca->ib_device, "Can't query device properties"); |
| 75 | ret = -EINVAL; |
| 76 | goto query_device1; |
| 77 | } |
| 78 | |
| 79 | memset(props, 0, sizeof(struct ib_device_attr)); |
| 80 | props->fw_ver = rblock->hw_ver; |
| 81 | props->max_mr_size = rblock->max_mr_size; |
| 82 | props->vendor_id = rblock->vendor_id >> 8; |
| 83 | props->vendor_part_id = rblock->vendor_part_id >> 16; |
| 84 | props->hw_ver = rblock->hw_ver; |
| 85 | props->max_qp = min_t(int, rblock->max_qp, INT_MAX); |
| 86 | props->max_qp_wr = min_t(int, rblock->max_wqes_wq, INT_MAX); |
| 87 | props->max_sge = min_t(int, rblock->max_sge, INT_MAX); |
| 88 | props->max_sge_rd = min_t(int, rblock->max_sge_rd, INT_MAX); |
| 89 | props->max_cq = min_t(int, rblock->max_cq, INT_MAX); |
| 90 | props->max_cqe = min_t(int, rblock->max_cqe, INT_MAX); |
| 91 | props->max_mr = min_t(int, rblock->max_mr, INT_MAX); |
| 92 | props->max_mw = min_t(int, rblock->max_mw, INT_MAX); |
| 93 | props->max_pd = min_t(int, rblock->max_pd, INT_MAX); |
| 94 | props->max_ah = min_t(int, rblock->max_ah, INT_MAX); |
| 95 | props->max_fmr = min_t(int, rblock->max_mr, INT_MAX); |
| 96 | props->max_srq = 0; |
| 97 | props->max_srq_wr = 0; |
| 98 | props->max_srq_sge = 0; |
| 99 | props->max_pkeys = 16; |
| 100 | props->local_ca_ack_delay |
| 101 | = rblock->local_ca_ack_delay; |
| 102 | props->max_raw_ipv6_qp |
| 103 | = min_t(int, rblock->max_raw_ipv6_qp, INT_MAX); |
| 104 | props->max_raw_ethy_qp |
| 105 | = min_t(int, rblock->max_raw_ethy_qp, INT_MAX); |
| 106 | props->max_mcast_grp |
| 107 | = min_t(int, rblock->max_mcast_grp, INT_MAX); |
| 108 | props->max_mcast_qp_attach |
| 109 | = min_t(int, rblock->max_mcast_qp_attach, INT_MAX); |
| 110 | props->max_total_mcast_qp_attach |
| 111 | = min_t(int, rblock->max_total_mcast_qp_attach, INT_MAX); |
| 112 | |
Joachim Fenkes | 91f13aa | 2007-07-09 15:21:45 +0200 | [diff] [blame] | 113 | /* translate device capabilities */ |
| 114 | props->device_cap_flags = IB_DEVICE_SYS_IMAGE_GUID | |
| 115 | IB_DEVICE_RC_RNR_NAK_GEN | IB_DEVICE_N_NOTIFY_CQ; |
| 116 | for (i = 0; i < ARRAY_SIZE(cap_mapping); i += 2) |
| 117 | if (rblock->hca_cap_indicators & cap_mapping[i + 1]) |
| 118 | props->device_cap_flags |= cap_mapping[i]; |
| 119 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 120 | query_device1: |
Hoang-Nam Nguyen | 7e28db5 | 2006-11-07 00:56:39 +0100 | [diff] [blame] | 121 | ehca_free_fw_ctrlblock(rblock); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 122 | |
| 123 | return ret; |
| 124 | } |
| 125 | |
| 126 | int ehca_query_port(struct ib_device *ibdev, |
| 127 | u8 port, struct ib_port_attr *props) |
| 128 | { |
| 129 | int ret = 0; |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 130 | u64 h_ret; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 131 | struct ehca_shca *shca = container_of(ibdev, struct ehca_shca, |
| 132 | ib_device); |
| 133 | struct hipz_query_port *rblock; |
| 134 | |
Hoang-Nam Nguyen | f2d9136 | 2007-01-09 18:04:14 +0100 | [diff] [blame] | 135 | rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 136 | if (!rblock) { |
| 137 | ehca_err(&shca->ib_device, "Can't allocate rblock memory."); |
| 138 | return -ENOMEM; |
| 139 | } |
| 140 | |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 141 | h_ret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock); |
| 142 | if (h_ret != H_SUCCESS) { |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 143 | ehca_err(&shca->ib_device, "Can't query port properties"); |
| 144 | ret = -EINVAL; |
| 145 | goto query_port1; |
| 146 | } |
| 147 | |
| 148 | memset(props, 0, sizeof(struct ib_port_attr)); |
| 149 | props->state = rblock->state; |
| 150 | |
| 151 | switch (rblock->max_mtu) { |
| 152 | case 0x1: |
| 153 | props->active_mtu = props->max_mtu = IB_MTU_256; |
| 154 | break; |
| 155 | case 0x2: |
| 156 | props->active_mtu = props->max_mtu = IB_MTU_512; |
| 157 | break; |
| 158 | case 0x3: |
| 159 | props->active_mtu = props->max_mtu = IB_MTU_1024; |
| 160 | break; |
| 161 | case 0x4: |
| 162 | props->active_mtu = props->max_mtu = IB_MTU_2048; |
| 163 | break; |
| 164 | case 0x5: |
| 165 | props->active_mtu = props->max_mtu = IB_MTU_4096; |
| 166 | break; |
| 167 | default: |
| 168 | ehca_err(&shca->ib_device, "Unknown MTU size: %x.", |
| 169 | rblock->max_mtu); |
| 170 | break; |
| 171 | } |
| 172 | |
Joachim Fenkes | c4ed790 | 2007-04-24 17:44:31 +0200 | [diff] [blame] | 173 | props->port_cap_flags = rblock->capability_mask; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 174 | props->gid_tbl_len = rblock->gid_tbl_len; |
| 175 | props->max_msg_sz = rblock->max_msg_sz; |
| 176 | props->bad_pkey_cntr = rblock->bad_pkey_cntr; |
| 177 | props->qkey_viol_cntr = rblock->qkey_viol_cntr; |
| 178 | props->pkey_tbl_len = rblock->pkey_tbl_len; |
| 179 | props->lid = rblock->lid; |
| 180 | props->sm_lid = rblock->sm_lid; |
| 181 | props->lmc = rblock->lmc; |
| 182 | props->sm_sl = rblock->sm_sl; |
| 183 | props->subnet_timeout = rblock->subnet_timeout; |
| 184 | props->init_type_reply = rblock->init_type_reply; |
| 185 | |
| 186 | props->active_width = IB_WIDTH_12X; |
| 187 | props->active_speed = 0x1; |
| 188 | |
Hoang-Nam Nguyen | 6bbcea0 | 2007-02-15 17:10:06 +0100 | [diff] [blame] | 189 | /* at the moment (logical) link state is always LINK_UP */ |
| 190 | props->phys_state = 0x5; |
| 191 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 192 | query_port1: |
Hoang-Nam Nguyen | 7e28db5 | 2006-11-07 00:56:39 +0100 | [diff] [blame] | 193 | ehca_free_fw_ctrlblock(rblock); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 194 | |
| 195 | return ret; |
| 196 | } |
| 197 | |
Joachim Fenkes | 8705ce5 | 2007-07-09 15:32:22 +0200 | [diff] [blame] | 198 | int ehca_query_sma_attr(struct ehca_shca *shca, |
| 199 | u8 port, struct ehca_sma_attr *attr) |
| 200 | { |
| 201 | int ret = 0; |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 202 | u64 h_ret; |
Joachim Fenkes | 8705ce5 | 2007-07-09 15:32:22 +0200 | [diff] [blame] | 203 | struct hipz_query_port *rblock; |
| 204 | |
| 205 | rblock = ehca_alloc_fw_ctrlblock(GFP_ATOMIC); |
| 206 | if (!rblock) { |
| 207 | ehca_err(&shca->ib_device, "Can't allocate rblock memory."); |
| 208 | return -ENOMEM; |
| 209 | } |
| 210 | |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 211 | h_ret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock); |
| 212 | if (h_ret != H_SUCCESS) { |
Joachim Fenkes | 8705ce5 | 2007-07-09 15:32:22 +0200 | [diff] [blame] | 213 | ehca_err(&shca->ib_device, "Can't query port properties"); |
| 214 | ret = -EINVAL; |
| 215 | goto query_sma_attr1; |
| 216 | } |
| 217 | |
| 218 | memset(attr, 0, sizeof(struct ehca_sma_attr)); |
| 219 | |
| 220 | attr->lid = rblock->lid; |
| 221 | attr->lmc = rblock->lmc; |
| 222 | attr->sm_sl = rblock->sm_sl; |
| 223 | attr->sm_lid = rblock->sm_lid; |
| 224 | |
| 225 | attr->pkey_tbl_len = rblock->pkey_tbl_len; |
| 226 | memcpy(attr->pkeys, rblock->pkey_entries, sizeof(attr->pkeys)); |
| 227 | |
| 228 | query_sma_attr1: |
| 229 | ehca_free_fw_ctrlblock(rblock); |
| 230 | |
| 231 | return ret; |
| 232 | } |
| 233 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 234 | int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) |
| 235 | { |
| 236 | int ret = 0; |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 237 | u64 h_ret; |
| 238 | struct ehca_shca *shca; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 239 | struct hipz_query_port *rblock; |
| 240 | |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 241 | shca = container_of(ibdev, struct ehca_shca, ib_device); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 242 | if (index > 16) { |
| 243 | ehca_err(&shca->ib_device, "Invalid index: %x.", index); |
| 244 | return -EINVAL; |
| 245 | } |
| 246 | |
Hoang-Nam Nguyen | f2d9136 | 2007-01-09 18:04:14 +0100 | [diff] [blame] | 247 | rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 248 | if (!rblock) { |
| 249 | ehca_err(&shca->ib_device, "Can't allocate rblock memory."); |
| 250 | return -ENOMEM; |
| 251 | } |
| 252 | |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 253 | h_ret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock); |
| 254 | if (h_ret != H_SUCCESS) { |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 255 | ehca_err(&shca->ib_device, "Can't query port properties"); |
| 256 | ret = -EINVAL; |
| 257 | goto query_pkey1; |
| 258 | } |
| 259 | |
| 260 | memcpy(pkey, &rblock->pkey_entries + index, sizeof(u16)); |
| 261 | |
| 262 | query_pkey1: |
Hoang-Nam Nguyen | 7e28db5 | 2006-11-07 00:56:39 +0100 | [diff] [blame] | 263 | ehca_free_fw_ctrlblock(rblock); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 264 | |
| 265 | return ret; |
| 266 | } |
| 267 | |
| 268 | int ehca_query_gid(struct ib_device *ibdev, u8 port, |
| 269 | int index, union ib_gid *gid) |
| 270 | { |
| 271 | int ret = 0; |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 272 | u64 h_ret; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 273 | struct ehca_shca *shca = container_of(ibdev, struct ehca_shca, |
| 274 | ib_device); |
| 275 | struct hipz_query_port *rblock; |
| 276 | |
| 277 | if (index > 255) { |
| 278 | ehca_err(&shca->ib_device, "Invalid index: %x.", index); |
| 279 | return -EINVAL; |
| 280 | } |
| 281 | |
Hoang-Nam Nguyen | f2d9136 | 2007-01-09 18:04:14 +0100 | [diff] [blame] | 282 | rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 283 | if (!rblock) { |
| 284 | ehca_err(&shca->ib_device, "Can't allocate rblock memory."); |
| 285 | return -ENOMEM; |
| 286 | } |
| 287 | |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 288 | h_ret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock); |
| 289 | if (h_ret != H_SUCCESS) { |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 290 | ehca_err(&shca->ib_device, "Can't query port properties"); |
| 291 | ret = -EINVAL; |
| 292 | goto query_gid1; |
| 293 | } |
| 294 | |
| 295 | memcpy(&gid->raw[0], &rblock->gid_prefix, sizeof(u64)); |
| 296 | memcpy(&gid->raw[8], &rblock->guid_entries[index], sizeof(u64)); |
| 297 | |
| 298 | query_gid1: |
Hoang-Nam Nguyen | 7e28db5 | 2006-11-07 00:56:39 +0100 | [diff] [blame] | 299 | ehca_free_fw_ctrlblock(rblock); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 300 | |
| 301 | return ret; |
| 302 | } |
| 303 | |
Joachim Fenkes | c4ed790 | 2007-04-24 17:44:31 +0200 | [diff] [blame] | 304 | const u32 allowed_port_caps = ( |
| 305 | IB_PORT_SM | IB_PORT_LED_INFO_SUP | IB_PORT_CM_SUP | |
| 306 | IB_PORT_SNMP_TUNNEL_SUP | IB_PORT_DEVICE_MGMT_SUP | |
| 307 | IB_PORT_VENDOR_CLASS_SUP); |
| 308 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 309 | int ehca_modify_port(struct ib_device *ibdev, |
| 310 | u8 port, int port_modify_mask, |
| 311 | struct ib_port_modify *props) |
| 312 | { |
Joachim Fenkes | c4ed790 | 2007-04-24 17:44:31 +0200 | [diff] [blame] | 313 | int ret = 0; |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 314 | struct ehca_shca *shca; |
Joachim Fenkes | c4ed790 | 2007-04-24 17:44:31 +0200 | [diff] [blame] | 315 | struct hipz_query_port *rblock; |
| 316 | u32 cap; |
| 317 | u64 hret; |
| 318 | |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 319 | shca = container_of(ibdev, struct ehca_shca, ib_device); |
Joachim Fenkes | c4ed790 | 2007-04-24 17:44:31 +0200 | [diff] [blame] | 320 | if ((props->set_port_cap_mask | props->clr_port_cap_mask) |
| 321 | & ~allowed_port_caps) { |
| 322 | ehca_err(&shca->ib_device, "Non-changeable bits set in masks " |
| 323 | "set=%x clr=%x allowed=%x", props->set_port_cap_mask, |
| 324 | props->clr_port_cap_mask, allowed_port_caps); |
| 325 | return -EINVAL; |
| 326 | } |
| 327 | |
| 328 | if (mutex_lock_interruptible(&shca->modify_mutex)) |
Joachim Fenkes | 91f13aa | 2007-07-09 15:21:45 +0200 | [diff] [blame] | 329 | return -ERESTARTSYS; |
Joachim Fenkes | c4ed790 | 2007-04-24 17:44:31 +0200 | [diff] [blame] | 330 | |
| 331 | rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); |
| 332 | if (!rblock) { |
| 333 | ehca_err(&shca->ib_device, "Can't allocate rblock memory."); |
| 334 | ret = -ENOMEM; |
| 335 | goto modify_port1; |
| 336 | } |
| 337 | |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 338 | hret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock); |
| 339 | if (hret != H_SUCCESS) { |
Joachim Fenkes | c4ed790 | 2007-04-24 17:44:31 +0200 | [diff] [blame] | 340 | ehca_err(&shca->ib_device, "Can't query port properties"); |
| 341 | ret = -EINVAL; |
| 342 | goto modify_port2; |
| 343 | } |
| 344 | |
| 345 | cap = (rblock->capability_mask | props->set_port_cap_mask) |
| 346 | & ~props->clr_port_cap_mask; |
| 347 | |
| 348 | hret = hipz_h_modify_port(shca->ipz_hca_handle, port, |
| 349 | cap, props->init_type, port_modify_mask); |
| 350 | if (hret != H_SUCCESS) { |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame^] | 351 | ehca_err(&shca->ib_device, "Modify port failed hret=%lx", |
| 352 | hret); |
Joachim Fenkes | c4ed790 | 2007-04-24 17:44:31 +0200 | [diff] [blame] | 353 | ret = -EINVAL; |
| 354 | } |
| 355 | |
| 356 | modify_port2: |
| 357 | ehca_free_fw_ctrlblock(rblock); |
| 358 | |
| 359 | modify_port1: |
Joachim Fenkes | 91f13aa | 2007-07-09 15:21:45 +0200 | [diff] [blame] | 360 | mutex_unlock(&shca->modify_mutex); |
Joachim Fenkes | c4ed790 | 2007-04-24 17:44:31 +0200 | [diff] [blame] | 361 | |
| 362 | return ret; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 363 | } |