diff options
author | Or Gerlitz <ogerlitz@mellanox.com> | 2011-06-15 10:47:14 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2011-07-19 00:04:34 -0400 |
commit | f2a3f6a32cf64db1495b5ced8625b9a80bde44e5 (patch) | |
tree | 68508cf4a5f67e2380b6b6fa158bb776e3b69a91 /drivers/net/mlx4/fw.c | |
parent | 98a13e487a3bdac8508e4dcb98d63385fabe6767 (diff) |
mlx4_core: Add network flow counters
ConnectX devices support a set of flow counters that can be attached
to a set containing one or more QPs. Each such counter tracks receive
and transmit packets and bytes of these QPs. This patch queries the
device to check support for counters, handles initialization of the
HCA to enable counters, and initializes a bitmap allocator to control
counter allocations. Derived from patch by Eli Cohen <eli@mellanox.co.il>.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.co.il>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/net/mlx4/fw.c')
-rw-r--r-- | drivers/net/mlx4/fw.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c index 1d3fc6d7689b..7eb8ba822e97 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c | |||
@@ -104,7 +104,8 @@ static void dump_dev_cap_flags(struct mlx4_dev *dev, u64 flags) | |||
104 | [38] = "Wake On LAN support", | 104 | [38] = "Wake On LAN support", |
105 | [40] = "UDP RSS support", | 105 | [40] = "UDP RSS support", |
106 | [41] = "Unicast VEP steering support", | 106 | [41] = "Unicast VEP steering support", |
107 | [42] = "Multicast VEP steering support" | 107 | [42] = "Multicast VEP steering support", |
108 | [48] = "Counters support", | ||
108 | }; | 109 | }; |
109 | int i; | 110 | int i; |
110 | 111 | ||
@@ -203,6 +204,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
203 | #define QUERY_DEV_CAP_MAX_MCG_OFFSET 0x63 | 204 | #define QUERY_DEV_CAP_MAX_MCG_OFFSET 0x63 |
204 | #define QUERY_DEV_CAP_RSVD_PD_OFFSET 0x64 | 205 | #define QUERY_DEV_CAP_RSVD_PD_OFFSET 0x64 |
205 | #define QUERY_DEV_CAP_MAX_PD_OFFSET 0x65 | 206 | #define QUERY_DEV_CAP_MAX_PD_OFFSET 0x65 |
207 | #define QUERY_DEV_CAP_MAX_COUNTERS_OFFSET 0x68 | ||
206 | #define QUERY_DEV_CAP_RDMARC_ENTRY_SZ_OFFSET 0x80 | 208 | #define QUERY_DEV_CAP_RDMARC_ENTRY_SZ_OFFSET 0x80 |
207 | #define QUERY_DEV_CAP_QPC_ENTRY_SZ_OFFSET 0x82 | 209 | #define QUERY_DEV_CAP_QPC_ENTRY_SZ_OFFSET 0x82 |
208 | #define QUERY_DEV_CAP_AUX_ENTRY_SZ_OFFSET 0x84 | 210 | #define QUERY_DEV_CAP_AUX_ENTRY_SZ_OFFSET 0x84 |
@@ -355,6 +357,9 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
355 | QUERY_DEV_CAP_RSVD_LKEY_OFFSET); | 357 | QUERY_DEV_CAP_RSVD_LKEY_OFFSET); |
356 | MLX4_GET(dev_cap->max_icm_sz, outbox, | 358 | MLX4_GET(dev_cap->max_icm_sz, outbox, |
357 | QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET); | 359 | QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET); |
360 | if (dev_cap->flags & MLX4_DEV_CAP_FLAG_COUNTERS) | ||
361 | MLX4_GET(dev_cap->max_counters, outbox, | ||
362 | QUERY_DEV_CAP_MAX_COUNTERS_OFFSET); | ||
358 | 363 | ||
359 | if (dev->flags & MLX4_FLAG_OLD_PORT_CMDS) { | 364 | if (dev->flags & MLX4_FLAG_OLD_PORT_CMDS) { |
360 | for (i = 1; i <= dev_cap->num_ports; ++i) { | 365 | for (i = 1; i <= dev_cap->num_ports; ++i) { |
@@ -448,6 +453,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
448 | mlx4_dbg(dev, "Max RQ desc size: %d, max RQ S/G: %d\n", | 453 | mlx4_dbg(dev, "Max RQ desc size: %d, max RQ S/G: %d\n", |
449 | dev_cap->max_rq_desc_sz, dev_cap->max_rq_sg); | 454 | dev_cap->max_rq_desc_sz, dev_cap->max_rq_sg); |
450 | mlx4_dbg(dev, "Max GSO size: %d\n", dev_cap->max_gso_sz); | 455 | mlx4_dbg(dev, "Max GSO size: %d\n", dev_cap->max_gso_sz); |
456 | mlx4_dbg(dev, "Max counters: %d\n", dev_cap->max_counters); | ||
451 | 457 | ||
452 | dump_dev_cap_flags(dev, dev_cap->flags); | 458 | dump_dev_cap_flags(dev, dev_cap->flags); |
453 | 459 | ||
@@ -780,6 +786,10 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param) | |||
780 | if (enable_qos) | 786 | if (enable_qos) |
781 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) |= cpu_to_be32(1 << 2); | 787 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) |= cpu_to_be32(1 << 2); |
782 | 788 | ||
789 | /* enable counters */ | ||
790 | if (dev->caps.flags & MLX4_DEV_CAP_FLAG_COUNTERS) | ||
791 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) |= cpu_to_be32(1 << 4); | ||
792 | |||
783 | /* QPC/EEC/CQC/EQC/RDMARC attributes */ | 793 | /* QPC/EEC/CQC/EQC/RDMARC attributes */ |
784 | 794 | ||
785 | MLX4_PUT(inbox, param->qpc_base, INIT_HCA_QPC_BASE_OFFSET); | 795 | MLX4_PUT(inbox, param->qpc_base, INIT_HCA_QPC_BASE_OFFSET); |