diff options
author | Joachim Fenkes <fenkes@de.ibm.com> | 2007-07-09 09:21:45 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-07-09 23:12:27 -0400 |
commit | 91f13aa3fc22e357b494c5b8270e94543870928d (patch) | |
tree | e8f78c2549945f5e3bc42e33ce81a18a9292f746 /drivers/infiniband/hw/ehca/ehca_hca.c | |
parent | b8a3ba551369982180917a999d32fcedbba34115 (diff) |
IB/ehca: HW level, HW caps and MTU autodetection
In preparation for support of new eHCA2 features, change adapter probing:
- Hardware level is changed to encode major and minor chip version
- Hardware capabilities are queried from the firmware
- The maximum MTU is queried from the firmware instead of assuming a
fixed value
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ehca/ehca_hca.c')
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_hca.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c index 32b55a4f0e5b..b310de5c94ae 100644 --- a/drivers/infiniband/hw/ehca/ehca_hca.c +++ b/drivers/infiniband/hw/ehca/ehca_hca.c | |||
@@ -45,11 +45,25 @@ | |||
45 | 45 | ||
46 | int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props) | 46 | int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props) |
47 | { | 47 | { |
48 | int ret = 0; | 48 | int i, ret = 0; |
49 | struct ehca_shca *shca = container_of(ibdev, struct ehca_shca, | 49 | struct ehca_shca *shca = container_of(ibdev, struct ehca_shca, |
50 | ib_device); | 50 | ib_device); |
51 | struct hipz_query_hca *rblock; | 51 | struct hipz_query_hca *rblock; |
52 | 52 | ||
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 | |||
53 | rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); | 67 | rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); |
54 | if (!rblock) { | 68 | if (!rblock) { |
55 | ehca_err(&shca->ib_device, "Can't allocate rblock memory."); | 69 | ehca_err(&shca->ib_device, "Can't allocate rblock memory."); |
@@ -96,6 +110,13 @@ int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props) | |||
96 | props->max_total_mcast_qp_attach | 110 | props->max_total_mcast_qp_attach |
97 | = min_t(int, rblock->max_total_mcast_qp_attach, INT_MAX); | 111 | = min_t(int, rblock->max_total_mcast_qp_attach, INT_MAX); |
98 | 112 | ||
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 | |||
99 | query_device1: | 120 | query_device1: |
100 | ehca_free_fw_ctrlblock(rblock); | 121 | ehca_free_fw_ctrlblock(rblock); |
101 | 122 | ||
@@ -261,7 +282,7 @@ int ehca_modify_port(struct ib_device *ibdev, | |||
261 | } | 282 | } |
262 | 283 | ||
263 | if (mutex_lock_interruptible(&shca->modify_mutex)) | 284 | if (mutex_lock_interruptible(&shca->modify_mutex)) |
264 | return -ERESTARTSYS; | 285 | return -ERESTARTSYS; |
265 | 286 | ||
266 | rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); | 287 | rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); |
267 | if (!rblock) { | 288 | if (!rblock) { |
@@ -290,7 +311,7 @@ modify_port2: | |||
290 | ehca_free_fw_ctrlblock(rblock); | 311 | ehca_free_fw_ctrlblock(rblock); |
291 | 312 | ||
292 | modify_port1: | 313 | modify_port1: |
293 | mutex_unlock(&shca->modify_mutex); | 314 | mutex_unlock(&shca->modify_mutex); |
294 | 315 | ||
295 | return ret; | 316 | return ret; |
296 | } | 317 | } |