diff options
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r-- | drivers/infiniband/hw/mlx4/mad.c | 20 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 6 |
2 files changed, 21 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index c7619716c31d..59040265e361 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -64,6 +64,14 @@ enum { | |||
64 | #define GUID_TBL_BLK_NUM_ENTRIES 8 | 64 | #define GUID_TBL_BLK_NUM_ENTRIES 8 |
65 | #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES) | 65 | #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES) |
66 | 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 | |||
67 | struct mlx4_mad_rcv_buf { | 75 | struct mlx4_mad_rcv_buf { |
68 | struct ib_grh grh; | 76 | struct ib_grh grh; |
69 | u8 payload[256]; | 77 | u8 payload[256]; |
@@ -806,10 +814,14 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | |||
806 | static void edit_counter(struct mlx4_counter *cnt, | 814 | static void edit_counter(struct mlx4_counter *cnt, |
807 | struct ib_pma_portcounters *pma_cnt) | 815 | struct ib_pma_portcounters *pma_cnt) |
808 | { | 816 | { |
809 | pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2)); | 817 | ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_data, |
810 | pma_cnt->port_rcv_data = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2)); | 818 | (be64_to_cpu(cnt->tx_bytes) >> 2)); |
811 | pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames)); | 819 | ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_data, |
812 | pma_cnt->port_rcv_packets = cpu_to_be32(be64_to_cpu(cnt->rx_frames)); | 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 | } | 825 | } |
814 | 826 | ||
815 | static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | 827 | static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index ac6e2b710ea6..b972c0b41799 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -2697,8 +2697,12 @@ static void handle_bonded_port_state_event(struct work_struct *work) | |||
2697 | spin_lock_bh(&ibdev->iboe.lock); | 2697 | spin_lock_bh(&ibdev->iboe.lock); |
2698 | for (i = 0; i < MLX4_MAX_PORTS; ++i) { | 2698 | for (i = 0; i < MLX4_MAX_PORTS; ++i) { |
2699 | struct net_device *curr_netdev = ibdev->iboe.netdevs[i]; | 2699 | struct net_device *curr_netdev = ibdev->iboe.netdevs[i]; |
2700 | enum ib_port_state curr_port_state; | ||
2700 | 2701 | ||
2701 | enum ib_port_state curr_port_state = | 2702 | if (!curr_netdev) |
2703 | continue; | ||
2704 | |||
2705 | curr_port_state = | ||
2702 | (netif_running(curr_netdev) && | 2706 | (netif_running(curr_netdev) && |
2703 | netif_carrier_ok(curr_netdev)) ? | 2707 | netif_carrier_ok(curr_netdev)) ? |
2704 | IB_PORT_ACTIVE : IB_PORT_DOWN; | 2708 | IB_PORT_ACTIVE : IB_PORT_DOWN; |