mad.c (56544d29c3a0e383c0d819fefc9570b2803db193) | mad.c (61a3855bb726cbb062ef02a31a832dea455456e0) |
---|---|
1/* 2 * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: --- 50 unchanged lines hidden (view full) --- 59 60#define GET_BLK_PTR_FROM_EQE(eqe) be32_to_cpu(eqe->event.port_mgmt_change.params.tbl_change_info.block_ptr) 61#define GET_MASK_FROM_EQE(eqe) be32_to_cpu(eqe->event.port_mgmt_change.params.tbl_change_info.tbl_entries_mask) 62#define NUM_IDX_IN_PKEY_TBL_BLK 32 63#define GUID_TBL_ENTRY_SIZE 8 /* size in bytes */ 64#define GUID_TBL_BLK_NUM_ENTRIES 8 65#define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES) 66 | 1/* 2 * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: --- 50 unchanged lines hidden (view full) --- 59 60#define GET_BLK_PTR_FROM_EQE(eqe) be32_to_cpu(eqe->event.port_mgmt_change.params.tbl_change_info.block_ptr) 61#define GET_MASK_FROM_EQE(eqe) be32_to_cpu(eqe->event.port_mgmt_change.params.tbl_change_info.tbl_entries_mask) 62#define NUM_IDX_IN_PKEY_TBL_BLK 32 63#define GUID_TBL_ENTRY_SIZE 8 /* size in bytes */ 64#define GUID_TBL_BLK_NUM_ENTRIES 8 65#define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES) 66 |
67/* Counters should be saturate once they reach their maximum value */ 68#define ASSIGN_32BIT_COUNTER(counter, value) do {\ 69 if ((value) > U32_MAX) \ 70 counter = cpu_to_be32(U32_MAX); \ 71 else \ 72 counter = cpu_to_be32(value); \ 73} while (0) 74 |
|
67struct mlx4_mad_rcv_buf { 68 struct ib_grh grh; 69 u8 payload[256]; 70} __packed; 71 72struct mlx4_mad_snd_buf { 73 u8 payload[256]; 74} __packed; --- 726 unchanged lines hidden (view full) --- 801 return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED; 802 803 return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY; 804} 805 806static void edit_counter(struct mlx4_counter *cnt, 807 struct ib_pma_portcounters *pma_cnt) 808{ | 75struct mlx4_mad_rcv_buf { 76 struct ib_grh grh; 77 u8 payload[256]; 78} __packed; 79 80struct mlx4_mad_snd_buf { 81 u8 payload[256]; 82} __packed; --- 726 unchanged lines hidden (view full) --- 809 return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED; 810 811 return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY; 812} 813 814static void edit_counter(struct mlx4_counter *cnt, 815 struct ib_pma_portcounters *pma_cnt) 816{ |
809 pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2)); 810 pma_cnt->port_rcv_data = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2)); 811 pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames)); 812 pma_cnt->port_rcv_packets = cpu_to_be32(be64_to_cpu(cnt->rx_frames)); | 817 ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_data, 818 (be64_to_cpu(cnt->tx_bytes) >> 2)); 819 ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_data, 820 (be64_to_cpu(cnt->rx_bytes) >> 2)); 821 ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_packets, 822 be64_to_cpu(cnt->tx_frames)); 823 ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_packets, 824 be64_to_cpu(cnt->rx_frames)); |
813} 814 815static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 816 struct ib_wc *in_wc, struct ib_grh *in_grh, 817 struct ib_mad *in_mad, struct ib_mad *out_mad) 818{ 819 struct mlx4_cmd_mailbox *mailbox; 820 struct mlx4_ib_dev *dev = to_mdev(ibdev); --- 1344 unchanged lines hidden --- | 825} 826 827static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 828 struct ib_wc *in_wc, struct ib_grh *in_grh, 829 struct ib_mad *in_mad, struct ib_mad *out_mad) 830{ 831 struct mlx4_cmd_mailbox *mailbox; 832 struct mlx4_ib_dev *dev = to_mdev(ibdev); --- 1344 unchanged lines hidden --- |