Lines Matching +full:data +full:- +full:out
2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
14 * - Redistributions of source code must retain the above
18 * - Redistributions in binary form must reproduce the above
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
48 if (in_mad->mad_hdr.mgmt_class != IB_MGMT_CLASS_SUBN_LID_ROUTED && in can_do_mad_ifc()
49 in_mad->mad_hdr.mgmt_class != IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) in can_do_mad_ifc()
51 return dev->mdev->port_caps[port_num - 1].has_smi; in can_do_mad_ifc()
61 return -EPERM; in mlx5_MAD_IFC()
71 return mlx5_core_mad_ifc(dev->mdev, in_mad, response_mad, op_modifier, port); in mlx5_MAD_IFC()
81 slid = in_wc ? ib_lid_cpu16(in_wc->slid) : be16_to_cpu(IB_LID_PERMISSIVE); in process_mad()
83 if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP && slid == 0) in process_mad()
86 if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED || in process_mad()
87 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) { in process_mad()
88 if (in_mad->mad_hdr.method != IB_MGMT_METHOD_GET && in process_mad()
89 in_mad->mad_hdr.method != IB_MGMT_METHOD_SET && in process_mad()
90 in_mad->mad_hdr.method != IB_MGMT_METHOD_TRAP_REPRESS) in process_mad()
93 /* Don't process SMInfo queries -- the SMA can't handle them. in process_mad()
95 if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO) in process_mad()
97 } else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT || in process_mad()
98 in_mad->mad_hdr.mgmt_class == MLX5_IB_VENDOR_CLASS1 || in process_mad()
99 in_mad->mad_hdr.mgmt_class == MLX5_IB_VENDOR_CLASS2 || in process_mad()
100 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_CONG_MGMT) { in process_mad()
101 if (in_mad->mad_hdr.method != IB_MGMT_METHOD_GET && in process_mad()
102 in_mad->mad_hdr.method != IB_MGMT_METHOD_SET) in process_mad()
116 if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) in process_mad()
117 out_mad->mad_hdr.status |= cpu_to_be16(1 << 15); in process_mad()
119 if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP_REPRESS) in process_mad()
127 void *out) in pma_cnt_ext_assign() argument
133 pma_cnt_ext->port_xmit_data = in pma_cnt_ext_assign()
134 cpu_to_be64(MLX5_SUM_CNT(out, transmitted_ib_unicast.octets, in pma_cnt_ext_assign()
136 pma_cnt_ext->port_rcv_data = in pma_cnt_ext_assign()
137 cpu_to_be64(MLX5_SUM_CNT(out, received_ib_unicast.octets, in pma_cnt_ext_assign()
139 pma_cnt_ext->port_xmit_packets = in pma_cnt_ext_assign()
140 cpu_to_be64(MLX5_SUM_CNT(out, transmitted_ib_unicast.packets, in pma_cnt_ext_assign()
142 pma_cnt_ext->port_rcv_packets = in pma_cnt_ext_assign()
143 cpu_to_be64(MLX5_SUM_CNT(out, received_ib_unicast.packets, in pma_cnt_ext_assign()
145 pma_cnt_ext->port_unicast_xmit_packets = in pma_cnt_ext_assign()
147 out, transmitted_ib_unicast.packets); in pma_cnt_ext_assign()
148 pma_cnt_ext->port_unicast_rcv_packets = in pma_cnt_ext_assign()
150 out, received_ib_unicast.packets); in pma_cnt_ext_assign()
151 pma_cnt_ext->port_multicast_xmit_packets = in pma_cnt_ext_assign()
153 out, transmitted_ib_multicast.packets); in pma_cnt_ext_assign()
154 pma_cnt_ext->port_multicast_rcv_packets = in pma_cnt_ext_assign()
156 out, received_ib_multicast.packets); in pma_cnt_ext_assign()
160 void *out) in pma_cnt_assign() argument
165 void *out_pma = MLX5_ADDR_OF(ppcnt_reg, out, in pma_cnt_assign()
174 MLX5_ASSIGN_PMA_CNTR(pma_cnt->symbol_error_counter, in pma_cnt_assign()
176 MLX5_ASSIGN_PMA_CNTR(pma_cnt->link_error_recovery_counter, in pma_cnt_assign()
178 MLX5_ASSIGN_PMA_CNTR(pma_cnt->link_downed_counter, in pma_cnt_assign()
180 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_errors, in pma_cnt_assign()
182 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_remphys_errors, in pma_cnt_assign()
184 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_switch_relay_errors, in pma_cnt_assign()
186 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_xmit_discards, in pma_cnt_assign()
188 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_xmit_constraint_errors, in pma_cnt_assign()
190 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_xmit_wait, in pma_cnt_assign()
192 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_constraint_errors, in pma_cnt_assign()
194 MLX5_ASSIGN_PMA_CNTR(pma_cnt->link_overrun_errors, in pma_cnt_assign()
196 MLX5_ASSIGN_PMA_CNTR(pma_cnt->vl15_dropped, in pma_cnt_assign()
216 mdev = dev->mdev; in process_pma_cmd()
220 if (in_mad->mad_hdr.attr_id == IB_PMA_CLASS_PORT_INFO) { in process_pma_cmd()
224 memcpy((out_mad->data + 40), &cpi, sizeof(cpi)); in process_pma_cmd()
229 if (in_mad->mad_hdr.attr_id == IB_PMA_PORT_COUNTERS_EXT) { in process_pma_cmd()
231 (struct ib_pma_portcounters_ext *)(out_mad->data + 40); in process_pma_cmd()
246 (struct ib_pma_portcounters *)(out_mad->data + 40); in process_pma_cmd()
272 struct ib_mad_hdr *out, size_t *out_mad_size, in mlx5_ib_process_mad() argument
277 struct ib_mad *out_mad = (struct ib_mad *)out; in mlx5_ib_process_mad()
284 memset(out_mad->data, 0, sizeof(out_mad->data)); in mlx5_ib_process_mad()
286 if (MLX5_CAP_GEN(dev->mdev, vport_counters) && in mlx5_ib_process_mad()
287 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT && in mlx5_ib_process_mad()
288 in_mad->mad_hdr.method == IB_MGMT_METHOD_GET) { in mlx5_ib_process_mad()
301 int err = -ENOMEM; in mlx5_query_ext_port_caps()
307 goto out; in mlx5_query_ext_port_caps()
310 in_mad->attr_id = MLX5_ATTR_EXTENDED_PORT_INFO; in mlx5_query_ext_port_caps()
311 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_ext_port_caps()
315 packet_error = be16_to_cpu(out_mad->status); in mlx5_query_ext_port_caps()
317 dev->mdev->port_caps[port - 1].ext_port_cap = (!err && !packet_error) ? in mlx5_query_ext_port_caps()
320 out: in mlx5_query_ext_port_caps()
330 int err = -ENOMEM; in mlx5_query_mad_ifc_smp_attr_node_info()
334 return -ENOMEM; in mlx5_query_mad_ifc_smp_attr_node_info()
337 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; in mlx5_query_mad_ifc_smp_attr_node_info()
350 int err = -ENOMEM; in mlx5_query_mad_ifc_system_image_guid()
354 return -ENOMEM; in mlx5_query_mad_ifc_system_image_guid()
358 goto out; in mlx5_query_mad_ifc_system_image_guid()
360 memcpy(sys_image_guid, out_mad->data + 4, 8); in mlx5_query_mad_ifc_system_image_guid()
362 out: in mlx5_query_mad_ifc_system_image_guid()
372 int err = -ENOMEM; in mlx5_query_mad_ifc_max_pkeys()
376 return -ENOMEM; in mlx5_query_mad_ifc_max_pkeys()
380 goto out; in mlx5_query_mad_ifc_max_pkeys()
382 *max_pkeys = be16_to_cpup((__be16 *)(out_mad->data + 28)); in mlx5_query_mad_ifc_max_pkeys()
384 out: in mlx5_query_mad_ifc_max_pkeys()
394 int err = -ENOMEM; in mlx5_query_mad_ifc_vendor_id()
398 return -ENOMEM; in mlx5_query_mad_ifc_vendor_id()
402 goto out; in mlx5_query_mad_ifc_vendor_id()
404 *vendor_id = be32_to_cpup((__be32 *)(out_mad->data + 36)) & 0xffff; in mlx5_query_mad_ifc_vendor_id()
406 out: in mlx5_query_mad_ifc_vendor_id()
416 int err = -ENOMEM; in mlx5_query_mad_ifc_node_desc()
421 goto out; in mlx5_query_mad_ifc_node_desc()
424 in_mad->attr_id = IB_SMP_ATTR_NODE_DESC; in mlx5_query_mad_ifc_node_desc()
428 goto out; in mlx5_query_mad_ifc_node_desc()
430 memcpy(node_desc, out_mad->data, IB_DEVICE_NODE_DESC_MAX); in mlx5_query_mad_ifc_node_desc()
431 out: in mlx5_query_mad_ifc_node_desc()
441 int err = -ENOMEM; in mlx5_query_mad_ifc_node_guid()
446 goto out; in mlx5_query_mad_ifc_node_guid()
449 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; in mlx5_query_mad_ifc_node_guid()
453 goto out; in mlx5_query_mad_ifc_node_guid()
455 memcpy(node_guid, out_mad->data + 12, 8); in mlx5_query_mad_ifc_node_guid()
456 out: in mlx5_query_mad_ifc_node_guid()
467 int err = -ENOMEM; in mlx5_query_mad_ifc_pkey()
472 goto out; in mlx5_query_mad_ifc_pkey()
475 in_mad->attr_id = IB_SMP_ATTR_PKEY_TABLE; in mlx5_query_mad_ifc_pkey()
476 in_mad->attr_mod = cpu_to_be32(index / 32); in mlx5_query_mad_ifc_pkey()
481 goto out; in mlx5_query_mad_ifc_pkey()
483 *pkey = be16_to_cpu(((__be16 *)out_mad->data)[index % 32]); in mlx5_query_mad_ifc_pkey()
485 out: in mlx5_query_mad_ifc_pkey()
496 int err = -ENOMEM; in mlx5_query_mad_ifc_gids()
501 goto out; in mlx5_query_mad_ifc_gids()
504 in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; in mlx5_query_mad_ifc_gids()
505 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_mad_ifc_gids()
510 goto out; in mlx5_query_mad_ifc_gids()
512 memcpy(gid->raw, out_mad->data + 8, 8); in mlx5_query_mad_ifc_gids()
515 in_mad->attr_id = IB_SMP_ATTR_GUID_INFO; in mlx5_query_mad_ifc_gids()
516 in_mad->attr_mod = cpu_to_be32(index / 8); in mlx5_query_mad_ifc_gids()
521 goto out; in mlx5_query_mad_ifc_gids()
523 memcpy(gid->raw + 8, out_mad->data + (index % 8) * 8, 8); in mlx5_query_mad_ifc_gids()
525 out: in mlx5_query_mad_ifc_gids()
535 struct mlx5_core_dev *mdev = dev->mdev; in mlx5_query_mad_ifc_port()
539 int err = -ENOMEM; in mlx5_query_mad_ifc_port()
541 if (port < 1 || port > dev->num_ports) { in mlx5_query_mad_ifc_port()
543 return -EINVAL; in mlx5_query_mad_ifc_port()
549 goto out; in mlx5_query_mad_ifc_port()
554 in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; in mlx5_query_mad_ifc_port()
555 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_mad_ifc_port()
560 goto out; in mlx5_query_mad_ifc_port()
563 props->lid = be16_to_cpup((__be16 *)(out_mad->data + 16)); in mlx5_query_mad_ifc_port()
564 props->lmc = out_mad->data[34] & 0x7; in mlx5_query_mad_ifc_port()
565 props->sm_lid = be16_to_cpup((__be16 *)(out_mad->data + 18)); in mlx5_query_mad_ifc_port()
566 props->sm_sl = out_mad->data[36] & 0xf; in mlx5_query_mad_ifc_port()
567 props->state = out_mad->data[32] & 0xf; in mlx5_query_mad_ifc_port()
568 props->phys_state = out_mad->data[33] >> 4; in mlx5_query_mad_ifc_port()
569 props->port_cap_flags = be32_to_cpup((__be32 *)(out_mad->data + 20)); in mlx5_query_mad_ifc_port()
570 props->gid_tbl_len = out_mad->data[50]; in mlx5_query_mad_ifc_port()
571 props->max_msg_sz = 1 << MLX5_CAP_GEN(mdev, log_max_msg); in mlx5_query_mad_ifc_port()
572 props->pkey_tbl_len = mdev->port_caps[port - 1].pkey_table_len; in mlx5_query_mad_ifc_port()
573 props->bad_pkey_cntr = be16_to_cpup((__be16 *)(out_mad->data + 46)); in mlx5_query_mad_ifc_port()
574 props->qkey_viol_cntr = be16_to_cpup((__be16 *)(out_mad->data + 48)); in mlx5_query_mad_ifc_port()
575 props->active_width = out_mad->data[31] & 0xf; in mlx5_query_mad_ifc_port()
576 props->active_speed = out_mad->data[35] >> 4; in mlx5_query_mad_ifc_port()
577 props->max_mtu = out_mad->data[41] & 0xf; in mlx5_query_mad_ifc_port()
578 props->active_mtu = out_mad->data[36] >> 4; in mlx5_query_mad_ifc_port()
579 props->subnet_timeout = out_mad->data[51] & 0x1f; in mlx5_query_mad_ifc_port()
580 props->max_vl_num = out_mad->data[37] >> 4; in mlx5_query_mad_ifc_port()
581 props->init_type_reply = out_mad->data[41] >> 4; in mlx5_query_mad_ifc_port()
584 if (props->port_cap_flags & IB_PORT_EXTENDED_SPEEDS_SUP) { in mlx5_query_mad_ifc_port()
585 ext_active_speed = out_mad->data[62] >> 4; in mlx5_query_mad_ifc_port()
589 props->active_speed = 16; /* FDR */ in mlx5_query_mad_ifc_port()
592 props->active_speed = 32; /* EDR */ in mlx5_query_mad_ifc_port()
597 /* If reported active speed is QDR, check if is FDR-10 */ in mlx5_query_mad_ifc_port()
598 if (props->active_speed == 4) { in mlx5_query_mad_ifc_port()
599 if (mdev->port_caps[port - 1].ext_port_cap & in mlx5_query_mad_ifc_port()
602 in_mad->attr_id = MLX5_ATTR_EXTENDED_PORT_INFO; in mlx5_query_mad_ifc_port()
603 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_mad_ifc_port()
608 goto out; in mlx5_query_mad_ifc_port()
610 /* Checking LinkSpeedActive for FDR-10 */ in mlx5_query_mad_ifc_port()
611 if (out_mad->data[15] & 0x1) in mlx5_query_mad_ifc_port()
612 props->active_speed = 8; in mlx5_query_mad_ifc_port()
616 out: in mlx5_query_mad_ifc_port()