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->port_caps[port_num - 1].has_smi; in can_do_mad_ifc()
62 return -EPERM; in mlx5_MAD_IFC()
72 return mlx5_cmd_mad_ifc(dev->mdev, in_mad, response_mad, op_modifier, in mlx5_MAD_IFC()
77 void *out) in pma_cnt_ext_assign() argument
83 pma_cnt_ext->port_xmit_data = in pma_cnt_ext_assign()
84 cpu_to_be64(MLX5_SUM_CNT(out, transmitted_ib_unicast.octets, in pma_cnt_ext_assign()
86 pma_cnt_ext->port_rcv_data = in pma_cnt_ext_assign()
87 cpu_to_be64(MLX5_SUM_CNT(out, received_ib_unicast.octets, in pma_cnt_ext_assign()
89 pma_cnt_ext->port_xmit_packets = in pma_cnt_ext_assign()
90 cpu_to_be64(MLX5_SUM_CNT(out, transmitted_ib_unicast.packets, in pma_cnt_ext_assign()
92 pma_cnt_ext->port_rcv_packets = in pma_cnt_ext_assign()
93 cpu_to_be64(MLX5_SUM_CNT(out, received_ib_unicast.packets, in pma_cnt_ext_assign()
95 pma_cnt_ext->port_unicast_xmit_packets = in pma_cnt_ext_assign()
97 out, transmitted_ib_unicast.packets); in pma_cnt_ext_assign()
98 pma_cnt_ext->port_unicast_rcv_packets = in pma_cnt_ext_assign()
100 out, received_ib_unicast.packets); in pma_cnt_ext_assign()
101 pma_cnt_ext->port_multicast_xmit_packets = in pma_cnt_ext_assign()
103 out, transmitted_ib_multicast.packets); in pma_cnt_ext_assign()
104 pma_cnt_ext->port_multicast_rcv_packets = in pma_cnt_ext_assign()
106 out, received_ib_multicast.packets); in pma_cnt_ext_assign()
110 void *out) in pma_cnt_assign() argument
115 void *out_pma = MLX5_ADDR_OF(ppcnt_reg, out, in pma_cnt_assign()
124 MLX5_ASSIGN_PMA_CNTR(pma_cnt->symbol_error_counter, in pma_cnt_assign()
126 MLX5_ASSIGN_PMA_CNTR(pma_cnt->link_error_recovery_counter, in pma_cnt_assign()
128 MLX5_ASSIGN_PMA_CNTR(pma_cnt->link_downed_counter, in pma_cnt_assign()
130 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_errors, in pma_cnt_assign()
132 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_remphys_errors, in pma_cnt_assign()
134 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_switch_relay_errors, in pma_cnt_assign()
136 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_xmit_discards, in pma_cnt_assign()
138 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_xmit_constraint_errors, in pma_cnt_assign()
140 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_xmit_wait, in pma_cnt_assign()
142 MLX5_ASSIGN_PMA_CNTR(pma_cnt->port_rcv_constraint_errors, in pma_cnt_assign()
144 MLX5_ASSIGN_PMA_CNTR(pma_cnt->link_overrun_errors, in pma_cnt_assign()
146 MLX5_ASSIGN_PMA_CNTR(pma_cnt->vl15_dropped, in pma_cnt_assign()
150 static int query_ib_ppcnt(struct mlx5_core_dev *dev, u8 port_num, void *out, in query_ib_ppcnt() argument
158 err = -ENOMEM; in query_ib_ppcnt()
165 err = mlx5_core_access_reg(dev, in, sz, out, in query_ib_ppcnt()
188 mdev = dev->mdev; in process_pma_cmd()
191 if (MLX5_CAP_GEN(dev->mdev, num_ports) == 1) { in process_pma_cmd()
192 /* set local port to one for Function-Per-Port HCA. */ in process_pma_cmd()
193 mdev = dev->mdev; in process_pma_cmd()
198 if (in_mad->mad_hdr.attr_id == IB_PMA_CLASS_PORT_INFO) { in process_pma_cmd()
202 memcpy((out_mad->data + 40), &cpi, sizeof(cpi)); in process_pma_cmd()
207 if (in_mad->mad_hdr.attr_id == IB_PMA_PORT_COUNTERS_EXT) { in process_pma_cmd()
209 (struct ib_pma_portcounters_ext *)(out_mad->data + 40); in process_pma_cmd()
224 (struct ib_pma_portcounters *)(out_mad->data + 40); in process_pma_cmd()
248 const struct ib_mad *in, struct ib_mad *out, in mlx5_ib_process_mad() argument
252 u8 mgmt_class = in->mad_hdr.mgmt_class; in mlx5_ib_process_mad()
253 u8 method = in->mad_hdr.method; in mlx5_ib_process_mad()
257 slid = in_wc ? ib_lid_cpu16(in_wc->slid) : in mlx5_ib_process_mad()
271 /* Don't process SMInfo queries -- the SMA can't handle them. in mlx5_ib_process_mad()
273 if (in->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO) in mlx5_ib_process_mad()
277 if (MLX5_CAP_GEN(dev->mdev, vport_counters) && in mlx5_ib_process_mad()
279 return process_pma_cmd(dev, port_num, in, out); in mlx5_ib_process_mad()
294 in_grh, in, out); in mlx5_ib_process_mad()
300 out->mad_hdr.status |= cpu_to_be16(1 << 15); in mlx5_ib_process_mad()
313 int err = -ENOMEM; in mlx5_query_ext_port_caps()
319 goto out; in mlx5_query_ext_port_caps()
322 in_mad->attr_id = MLX5_ATTR_EXTENDED_PORT_INFO; in mlx5_query_ext_port_caps()
323 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_ext_port_caps()
327 packet_error = be16_to_cpu(out_mad->status); in mlx5_query_ext_port_caps()
329 dev->port_caps[port - 1].ext_port_cap = (!err && !packet_error) ? in mlx5_query_ext_port_caps()
332 out: in mlx5_query_ext_port_caps()
346 return -ENOMEM; in mlx5_query_mad_ifc_smp_attr_node_info()
349 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; in mlx5_query_mad_ifc_smp_attr_node_info()
366 return -ENOMEM; in mlx5_query_mad_ifc_system_image_guid()
370 goto out; in mlx5_query_mad_ifc_system_image_guid()
372 memcpy(sys_image_guid, out_mad->data + 4, 8); in mlx5_query_mad_ifc_system_image_guid()
374 out: in mlx5_query_mad_ifc_system_image_guid()
388 return -ENOMEM; in mlx5_query_mad_ifc_max_pkeys()
392 goto out; in mlx5_query_mad_ifc_max_pkeys()
394 *max_pkeys = be16_to_cpup((__be16 *)(out_mad->data + 28)); in mlx5_query_mad_ifc_max_pkeys()
396 out: in mlx5_query_mad_ifc_max_pkeys()
410 return -ENOMEM; in mlx5_query_mad_ifc_vendor_id()
414 goto out; in mlx5_query_mad_ifc_vendor_id()
416 *vendor_id = be32_to_cpup((__be32 *)(out_mad->data + 36)) & 0xffff; in mlx5_query_mad_ifc_vendor_id()
418 out: in mlx5_query_mad_ifc_vendor_id()
428 int err = -ENOMEM; in mlx5_query_mad_ifc_node_desc()
433 goto out; in mlx5_query_mad_ifc_node_desc()
436 in_mad->attr_id = IB_SMP_ATTR_NODE_DESC; in mlx5_query_mad_ifc_node_desc()
440 goto out; in mlx5_query_mad_ifc_node_desc()
442 memcpy(node_desc, out_mad->data, IB_DEVICE_NODE_DESC_MAX); in mlx5_query_mad_ifc_node_desc()
443 out: in mlx5_query_mad_ifc_node_desc()
453 int err = -ENOMEM; in mlx5_query_mad_ifc_node_guid()
458 goto out; in mlx5_query_mad_ifc_node_guid()
461 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; in mlx5_query_mad_ifc_node_guid()
465 goto out; in mlx5_query_mad_ifc_node_guid()
467 memcpy(node_guid, out_mad->data + 12, 8); in mlx5_query_mad_ifc_node_guid()
468 out: in mlx5_query_mad_ifc_node_guid()
479 int err = -ENOMEM; in mlx5_query_mad_ifc_pkey()
484 goto out; in mlx5_query_mad_ifc_pkey()
487 in_mad->attr_id = IB_SMP_ATTR_PKEY_TABLE; in mlx5_query_mad_ifc_pkey()
488 in_mad->attr_mod = cpu_to_be32(index / 32); in mlx5_query_mad_ifc_pkey()
493 goto out; in mlx5_query_mad_ifc_pkey()
495 *pkey = be16_to_cpu(((__be16 *)out_mad->data)[index % 32]); in mlx5_query_mad_ifc_pkey()
497 out: in mlx5_query_mad_ifc_pkey()
508 int err = -ENOMEM; in mlx5_query_mad_ifc_gids()
513 goto out; in mlx5_query_mad_ifc_gids()
516 in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; in mlx5_query_mad_ifc_gids()
517 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_mad_ifc_gids()
522 goto out; in mlx5_query_mad_ifc_gids()
524 memcpy(gid->raw, out_mad->data + 8, 8); in mlx5_query_mad_ifc_gids()
527 in_mad->attr_id = IB_SMP_ATTR_GUID_INFO; in mlx5_query_mad_ifc_gids()
528 in_mad->attr_mod = cpu_to_be32(index / 8); in mlx5_query_mad_ifc_gids()
533 goto out; in mlx5_query_mad_ifc_gids()
535 memcpy(gid->raw + 8, out_mad->data + (index % 8) * 8, 8); in mlx5_query_mad_ifc_gids()
537 out: in mlx5_query_mad_ifc_gids()
547 struct mlx5_core_dev *mdev = dev->mdev; in mlx5_query_mad_ifc_port()
551 int err = -ENOMEM; in mlx5_query_mad_ifc_port()
556 goto out; in mlx5_query_mad_ifc_port()
561 in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; in mlx5_query_mad_ifc_port()
562 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_mad_ifc_port()
567 goto out; in mlx5_query_mad_ifc_port()
570 props->lid = be16_to_cpup((__be16 *)(out_mad->data + 16)); in mlx5_query_mad_ifc_port()
571 props->lmc = out_mad->data[34] & 0x7; in mlx5_query_mad_ifc_port()
572 props->sm_lid = be16_to_cpup((__be16 *)(out_mad->data + 18)); in mlx5_query_mad_ifc_port()
573 props->sm_sl = out_mad->data[36] & 0xf; in mlx5_query_mad_ifc_port()
574 props->state = out_mad->data[32] & 0xf; in mlx5_query_mad_ifc_port()
575 props->phys_state = out_mad->data[33] >> 4; in mlx5_query_mad_ifc_port()
576 props->port_cap_flags = be32_to_cpup((__be32 *)(out_mad->data + 20)); in mlx5_query_mad_ifc_port()
577 props->gid_tbl_len = out_mad->data[50]; in mlx5_query_mad_ifc_port()
578 props->max_msg_sz = 1 << MLX5_CAP_GEN(mdev, log_max_msg); in mlx5_query_mad_ifc_port()
579 props->pkey_tbl_len = dev->pkey_table_len; in mlx5_query_mad_ifc_port()
580 props->bad_pkey_cntr = be16_to_cpup((__be16 *)(out_mad->data + 46)); in mlx5_query_mad_ifc_port()
581 props->qkey_viol_cntr = be16_to_cpup((__be16 *)(out_mad->data + 48)); in mlx5_query_mad_ifc_port()
582 props->active_width = out_mad->data[31] & 0xf; in mlx5_query_mad_ifc_port()
583 props->active_speed = out_mad->data[35] >> 4; in mlx5_query_mad_ifc_port()
584 props->max_mtu = out_mad->data[41] & 0xf; in mlx5_query_mad_ifc_port()
585 props->active_mtu = out_mad->data[36] >> 4; in mlx5_query_mad_ifc_port()
586 props->subnet_timeout = out_mad->data[51] & 0x1f; in mlx5_query_mad_ifc_port()
587 props->max_vl_num = out_mad->data[37] >> 4; in mlx5_query_mad_ifc_port()
588 props->init_type_reply = out_mad->data[41] >> 4; in mlx5_query_mad_ifc_port()
590 if (props->port_cap_flags & IB_PORT_CAP_MASK2_SUP) { in mlx5_query_mad_ifc_port()
591 props->port_cap_flags2 = in mlx5_query_mad_ifc_port()
592 be16_to_cpup((__be16 *)(out_mad->data + 60)); in mlx5_query_mad_ifc_port()
594 if (props->port_cap_flags2 & IB_PORT_LINK_WIDTH_2X_SUP) in mlx5_query_mad_ifc_port()
595 props->active_width = out_mad->data[31] & 0x1f; in mlx5_query_mad_ifc_port()
599 if (props->port_cap_flags & IB_PORT_EXTENDED_SPEEDS_SUP) { in mlx5_query_mad_ifc_port()
600 ext_active_speed = out_mad->data[62] >> 4; in mlx5_query_mad_ifc_port()
604 props->active_speed = 16; /* FDR */ in mlx5_query_mad_ifc_port()
607 props->active_speed = 32; /* EDR */ in mlx5_query_mad_ifc_port()
610 if (props->port_cap_flags & IB_PORT_CAP_MASK2_SUP && in mlx5_query_mad_ifc_port()
611 props->port_cap_flags2 & IB_PORT_LINK_SPEED_HDR_SUP) in mlx5_query_mad_ifc_port()
612 props->active_speed = IB_SPEED_HDR; in mlx5_query_mad_ifc_port()
615 if (props->port_cap_flags & IB_PORT_CAP_MASK2_SUP && in mlx5_query_mad_ifc_port()
616 props->port_cap_flags2 & IB_PORT_LINK_SPEED_NDR_SUP) in mlx5_query_mad_ifc_port()
617 props->active_speed = IB_SPEED_NDR; in mlx5_query_mad_ifc_port()
622 /* If reported active speed is QDR, check if is FDR-10 */ in mlx5_query_mad_ifc_port()
623 if (props->active_speed == 4) { in mlx5_query_mad_ifc_port()
624 if (dev->port_caps[port - 1].ext_port_cap & in mlx5_query_mad_ifc_port()
627 in_mad->attr_id = MLX5_ATTR_EXTENDED_PORT_INFO; in mlx5_query_mad_ifc_port()
628 in_mad->attr_mod = cpu_to_be32(port); in mlx5_query_mad_ifc_port()
633 goto out; in mlx5_query_mad_ifc_port()
635 /* Checking LinkSpeedActive for FDR-10 */ in mlx5_query_mad_ifc_port()
636 if (out_mad->data[15] & 0x1) in mlx5_query_mad_ifc_port()
637 props->active_speed = 8; in mlx5_query_mad_ifc_port()
641 out: in mlx5_query_mad_ifc_port()