Lines Matching +full:data +full:- +full:out
1 /*-
2 * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved.
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 return mlx5_core_mad_ifc(dev->mdev, in_mad, response_mad, op_modifier, port); in mlx5_MAD_IFC()
64 slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE); in process_mad()
66 if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP && slid == 0) in process_mad()
69 if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED || in process_mad()
70 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) { in process_mad()
71 if (in_mad->mad_hdr.method != IB_MGMT_METHOD_GET && in process_mad()
72 in_mad->mad_hdr.method != IB_MGMT_METHOD_SET && in process_mad()
73 in_mad->mad_hdr.method != IB_MGMT_METHOD_TRAP_REPRESS) in process_mad()
76 /* Don't process SMInfo queries -- the SMA can't handle them. in process_mad()
78 if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO) in process_mad()
80 } else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT || in process_mad()
81 in_mad->mad_hdr.mgmt_class == MLX5_IB_VENDOR_CLASS1 || in process_mad()
82 in_mad->mad_hdr.mgmt_class == MLX5_IB_VENDOR_CLASS2 || in process_mad()
83 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_CONG_MGMT) { in process_mad()
84 if (in_mad->mad_hdr.method != IB_MGMT_METHOD_GET && in process_mad()
85 in_mad->mad_hdr.method != IB_MGMT_METHOD_SET) in process_mad()
99 if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) in process_mad()
100 out_mad->mad_hdr.status |= cpu_to_be16(1 << 15); in process_mad()
102 if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP_REPRESS) in process_mad()
110 void *out) in pma_cnt_ext_assign() argument
116 pma_cnt_ext->port_xmit_data = in pma_cnt_ext_assign()
117 cpu_to_be64(MLX5_SUM_CNT(out, transmitted_ib_unicast.octets, in pma_cnt_ext_assign()
119 pma_cnt_ext->port_rcv_data = in pma_cnt_ext_assign()
120 cpu_to_be64(MLX5_SUM_CNT(out, received_ib_unicast.octets, in pma_cnt_ext_assign()
122 pma_cnt_ext->port_xmit_packets = in pma_cnt_ext_assign()
123 cpu_to_be64(MLX5_SUM_CNT(out, transmitted_ib_unicast.packets, in pma_cnt_ext_assign()
125 pma_cnt_ext->port_rcv_packets = in pma_cnt_ext_assign()
126 cpu_to_be64(MLX5_SUM_CNT(out, received_ib_unicast.packets, in pma_cnt_ext_assign()
128 pma_cnt_ext->port_unicast_xmit_packets = in pma_cnt_ext_assign()
130 out, transmitted_ib_unicast.packets); in pma_cnt_ext_assign()
131 pma_cnt_ext->port_unicast_rcv_packets = in pma_cnt_ext_assign()
133 out, received_ib_unicast.packets); in pma_cnt_ext_assign()
134 pma_cnt_ext->port_multicast_xmit_packets = in pma_cnt_ext_assign()
136 out, transmitted_ib_multicast.packets); in pma_cnt_ext_assign()
137 pma_cnt_ext->port_multicast_rcv_packets = in pma_cnt_ext_assign()
139 out, received_ib_multicast.packets); in pma_cnt_ext_assign()
143 void *out) in pma_cnt_assign() argument
148 void *out_pma = MLX5_ADDR_OF(ppcnt_reg, out, in pma_cnt_assign()
157 MLX5_ASSIGN_PMA_CNTR(pma_cnt->symbol_error_counter, in pma_cnt_assign()
159 MLX5_ASSIGN_PMA_CNTR(pma_cnt->link_error_recovery_counter, in pma_cnt_assign()
161 MLX5_ASSIGN_PMA_CNTR(pma_cnt->link_downed_counter, in pma_cnt_assign()
163 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_errors, in pma_cnt_assign()
165 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_remphys_errors, in pma_cnt_assign()
167 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_switch_relay_errors, in pma_cnt_assign()
169 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_xmit_discards, in pma_cnt_assign()
171 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_xmit_constraint_errors, in pma_cnt_assign()
173 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_constraint_errors, in pma_cnt_assign()
175 MLX5_ASSIGN_PMA_CNTR(pma_cnt->link_overrun_errors, in pma_cnt_assign()
177 MLX5_ASSIGN_PMA_CNTR(pma_cnt->vl15_dropped, in pma_cnt_assign()
189 if (in_mad->mad_hdr.attr_id == IB_PMA_CLASS_PORT_INFO) { in process_pma_cmd()
193 memcpy((out_mad->data + 40), &cpi, sizeof(cpi)); in process_pma_cmd()
197 if (in_mad->mad_hdr.attr_id == IB_PMA_PORT_COUNTERS_EXT) { in process_pma_cmd()
199 (struct ib_pma_portcounters_ext *)(out_mad->data + 40); in process_pma_cmd()
206 err = mlx5_core_query_vport_counter(dev->mdev, 0, 0, in process_pma_cmd()
212 (struct ib_pma_portcounters *)(out_mad->data + 40); in process_pma_cmd()
219 err = mlx5_core_query_ib_ppcnt(dev->mdev, port_num, in process_pma_cmd()
235 struct ib_mad_hdr *out, size_t *out_mad_size, in mlx5_ib_process_mad() argument
239 struct mlx5_core_dev *mdev = dev->mdev; in mlx5_ib_process_mad()
241 struct ib_mad *out_mad = (struct ib_mad *)out; in mlx5_ib_process_mad()
247 memset(out_mad->data, 0, sizeof(out_mad->data)); in mlx5_ib_process_mad()
250 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT && in mlx5_ib_process_mad()
251 in_mad->mad_hdr.method == IB_MGMT_METHOD_GET) { in mlx5_ib_process_mad()
263 int err = -ENOMEM; in mlx5_query_ext_port_caps()
269 goto out; in mlx5_query_ext_port_caps()
272 in_mad->attr_id = MLX5_ATTR_EXTENDED_PORT_INFO; in mlx5_query_ext_port_caps()
273 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_ext_port_caps()
277 packet_error = be16_to_cpu(out_mad->status); in mlx5_query_ext_port_caps()
279 dev->mdev->port_caps[port - 1].ext_port_cap = (!err && !packet_error) ? in mlx5_query_ext_port_caps()
282 out: in mlx5_query_ext_port_caps()
292 int err = -ENOMEM; in mlx5_query_mad_ifc_smp_attr_node_info()
296 return -ENOMEM; in mlx5_query_mad_ifc_smp_attr_node_info()
299 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; in mlx5_query_mad_ifc_smp_attr_node_info()
312 int err = -ENOMEM; in mlx5_query_mad_ifc_system_image_guid()
316 return -ENOMEM; in mlx5_query_mad_ifc_system_image_guid()
320 goto out; in mlx5_query_mad_ifc_system_image_guid()
322 memcpy(sys_image_guid, out_mad->data + 4, 8); in mlx5_query_mad_ifc_system_image_guid()
324 out: in mlx5_query_mad_ifc_system_image_guid()
334 int err = -ENOMEM; in mlx5_query_mad_ifc_max_pkeys()
338 return -ENOMEM; in mlx5_query_mad_ifc_max_pkeys()
342 goto out; in mlx5_query_mad_ifc_max_pkeys()
344 *max_pkeys = be16_to_cpup((__be16 *)(out_mad->data + 28)); in mlx5_query_mad_ifc_max_pkeys()
346 out: in mlx5_query_mad_ifc_max_pkeys()
356 int err = -ENOMEM; in mlx5_query_mad_ifc_vendor_id()
360 return -ENOMEM; in mlx5_query_mad_ifc_vendor_id()
364 goto out; in mlx5_query_mad_ifc_vendor_id()
366 *vendor_id = be32_to_cpup((__be32 *)(out_mad->data + 36)) & 0xffff; in mlx5_query_mad_ifc_vendor_id()
368 out: in mlx5_query_mad_ifc_vendor_id()
378 int err = -ENOMEM; in mlx5_query_mad_ifc_node_desc()
383 goto out; in mlx5_query_mad_ifc_node_desc()
386 in_mad->attr_id = IB_SMP_ATTR_NODE_DESC; in mlx5_query_mad_ifc_node_desc()
390 goto out; in mlx5_query_mad_ifc_node_desc()
392 memcpy(node_desc, out_mad->data, IB_DEVICE_NODE_DESC_MAX); in mlx5_query_mad_ifc_node_desc()
393 out: in mlx5_query_mad_ifc_node_desc()
403 int err = -ENOMEM; in mlx5_query_mad_ifc_node_guid()
408 goto out; in mlx5_query_mad_ifc_node_guid()
411 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; in mlx5_query_mad_ifc_node_guid()
415 goto out; in mlx5_query_mad_ifc_node_guid()
417 memcpy(node_guid, out_mad->data + 12, 8); in mlx5_query_mad_ifc_node_guid()
418 out: in mlx5_query_mad_ifc_node_guid()
429 int err = -ENOMEM; in mlx5_query_mad_ifc_pkey()
434 goto out; in mlx5_query_mad_ifc_pkey()
437 in_mad->attr_id = IB_SMP_ATTR_PKEY_TABLE; in mlx5_query_mad_ifc_pkey()
438 in_mad->attr_mod = cpu_to_be32(index / 32); in mlx5_query_mad_ifc_pkey()
443 goto out; in mlx5_query_mad_ifc_pkey()
445 *pkey = be16_to_cpu(((__be16 *)out_mad->data)[index % 32]); in mlx5_query_mad_ifc_pkey()
447 out: in mlx5_query_mad_ifc_pkey()
458 int err = -ENOMEM; in mlx5_query_mad_ifc_gids()
463 goto out; in mlx5_query_mad_ifc_gids()
466 in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; in mlx5_query_mad_ifc_gids()
467 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_mad_ifc_gids()
472 goto out; in mlx5_query_mad_ifc_gids()
474 memcpy(gid->raw, out_mad->data + 8, 8); in mlx5_query_mad_ifc_gids()
477 in_mad->attr_id = IB_SMP_ATTR_GUID_INFO; in mlx5_query_mad_ifc_gids()
478 in_mad->attr_mod = cpu_to_be32(index / 8); in mlx5_query_mad_ifc_gids()
483 goto out; in mlx5_query_mad_ifc_gids()
485 memcpy(gid->raw + 8, out_mad->data + (index % 8) * 8, 8); in mlx5_query_mad_ifc_gids()
487 out: in mlx5_query_mad_ifc_gids()
497 struct mlx5_core_dev *mdev = dev->mdev; in mlx5_query_mad_ifc_port()
501 int err = -ENOMEM; in mlx5_query_mad_ifc_port()
505 return -EINVAL; in mlx5_query_mad_ifc_port()
511 goto out; in mlx5_query_mad_ifc_port()
516 in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; in mlx5_query_mad_ifc_port()
517 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_mad_ifc_port()
522 goto out; in mlx5_query_mad_ifc_port()
525 props->lid = be16_to_cpup((__be16 *)(out_mad->data + 16)); in mlx5_query_mad_ifc_port()
526 props->lmc = out_mad->data[34] & 0x7; in mlx5_query_mad_ifc_port()
527 props->sm_lid = be16_to_cpup((__be16 *)(out_mad->data + 18)); in mlx5_query_mad_ifc_port()
528 props->sm_sl = out_mad->data[36] & 0xf; in mlx5_query_mad_ifc_port()
529 props->state = out_mad->data[32] & 0xf; in mlx5_query_mad_ifc_port()
530 props->phys_state = out_mad->data[33] >> 4; in mlx5_query_mad_ifc_port()
531 props->port_cap_flags = be32_to_cpup((__be32 *)(out_mad->data + 20)); in mlx5_query_mad_ifc_port()
532 props->gid_tbl_len = out_mad->data[50]; in mlx5_query_mad_ifc_port()
533 props->max_msg_sz = 1 << MLX5_CAP_GEN(mdev, log_max_msg); in mlx5_query_mad_ifc_port()
534 props->pkey_tbl_len = mdev->port_caps[port - 1].pkey_table_len; in mlx5_query_mad_ifc_port()
535 props->bad_pkey_cntr = be16_to_cpup((__be16 *)(out_mad->data + 46)); in mlx5_query_mad_ifc_port()
536 props->qkey_viol_cntr = be16_to_cpup((__be16 *)(out_mad->data + 48)); in mlx5_query_mad_ifc_port()
537 props->active_width = out_mad->data[31] & 0xf; in mlx5_query_mad_ifc_port()
538 props->active_speed = out_mad->data[35] >> 4; in mlx5_query_mad_ifc_port()
539 props->max_mtu = out_mad->data[41] & 0xf; in mlx5_query_mad_ifc_port()
540 props->active_mtu = out_mad->data[36] >> 4; in mlx5_query_mad_ifc_port()
541 props->subnet_timeout = out_mad->data[51] & 0x1f; in mlx5_query_mad_ifc_port()
542 props->max_vl_num = out_mad->data[37] >> 4; in mlx5_query_mad_ifc_port()
543 props->init_type_reply = out_mad->data[41] >> 4; in mlx5_query_mad_ifc_port()
546 if (props->port_cap_flags & IB_PORT_EXTENDED_SPEEDS_SUP) { in mlx5_query_mad_ifc_port()
547 ext_active_speed = out_mad->data[62] >> 4; in mlx5_query_mad_ifc_port()
551 props->active_speed = 16; /* FDR */ in mlx5_query_mad_ifc_port()
554 props->active_speed = 32; /* EDR */ in mlx5_query_mad_ifc_port()
559 /* If reported active speed is QDR, check if is FDR-10 */ in mlx5_query_mad_ifc_port()
560 if (props->active_speed == 4) { in mlx5_query_mad_ifc_port()
561 if (mdev->port_caps[port - 1].ext_port_cap & in mlx5_query_mad_ifc_port()
564 in_mad->attr_id = MLX5_ATTR_EXTENDED_PORT_INFO; in mlx5_query_mad_ifc_port()
565 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_mad_ifc_port()
570 goto out; in mlx5_query_mad_ifc_port()
572 /* Checking LinkSpeedActive for FDR-10 */ in mlx5_query_mad_ifc_port()
573 if (out_mad->data[15] & 0x1) in mlx5_query_mad_ifc_port()
574 props->active_speed = 8; in mlx5_query_mad_ifc_port()
578 out: in mlx5_query_mad_ifc_port()