aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx4
diff options
context:
space:
mode:
authorEran Ben Elisha <eranbe@mellanox.com>2015-06-15 10:59:05 -0400
committerDavid S. Miller <davem@davemloft.net>2015-06-15 20:23:02 -0400
commit9616982f3fcc9e6577d7f41009c4ef2df19a71ec (patch)
tree96f0e59cff49a2b82fe94cb08c0dc6c65ef0ca6c /include/linux/mlx4
parent7193a141eb74579ce7ff242c9f842a5c36c4bf69 (diff)
net/mlx4_core: Add helper to query counters
This is an infrastructure step for querying VF and PF counters. This code was in the IB driver, move it to the mlx4 core driver so it will be accessible for more use cases. Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com> Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mlx4')
-rw-r--r--include/linux/mlx4/cmd.h3
-rw-r--r--include/linux/mlx4/device.h8
2 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index f62e7cf227c6..5dffc869988b 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -35,6 +35,7 @@
35 35
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <linux/if_link.h> 37#include <linux/if_link.h>
38#include <linux/mlx4/device.h>
38 39
39enum { 40enum {
40 /* initialization and general commands */ 41 /* initialization and general commands */
@@ -300,6 +301,8 @@ static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_para
300struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev); 301struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev);
301void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); 302void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox);
302 303
304int mlx4_get_counter_stats(struct mlx4_dev *dev, int counter_index,
305 struct mlx4_counter *counter_stats, int reset);
303u32 mlx4_comm_get_version(void); 306u32 mlx4_comm_get_version(void);
304int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac); 307int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
305int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); 308int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 4820080ac394..efe80c754b2f 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -771,6 +771,14 @@ union mlx4_ext_av {
771 struct mlx4_eth_av eth; 771 struct mlx4_eth_av eth;
772}; 772};
773 773
774/* Counters should be saturate once they reach their maximum value */
775#define ASSIGN_32BIT_COUNTER(counter, value) do { \
776 if ((value) > U32_MAX) \
777 counter = cpu_to_be32(U32_MAX); \
778 else \
779 counter = cpu_to_be32(value); \
780} while (0)
781
774struct mlx4_counter { 782struct mlx4_counter {
775 u8 reserved1[3]; 783 u8 reserved1[3];
776 u8 counter_mode; 784 u8 counter_mode;