aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2018-06-04 10:48:11 -0400
committerJason Gunthorpe <jgg@mellanox.com>2018-06-04 10:48:11 -0400
commit0f45e69d625a423d225968c3b59da7f31c5d70b4 (patch)
treeb03055e4874a81e4f2276170ec22b188ecb982fe /drivers/net/ethernet
parent27d036e33237e49801780eb703ea38dad5449e12 (diff)
parent1a1e03dc15cfa94b7e878a32a979705df614d9c4 (diff)
Merge tag 'verbs_flow_counters' of git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git into for-next
Pull verbs counters series from Leon Romanovsky: ==================== Verbs flow counters support This series comes to allow user space applications to monitor real time traffic activity and events of the verbs objects it manages, e.g.: ibv_qp, ibv_wq, ibv_flow. The API enables generic counters creation and define mapping to association with a verbs object, the current mlx5 driver is using this API for flow counters. With this API, an application can monitor the entire life cycle of object activity, defined here as a static counters attachment. This API also allows dynamic counters monitoring of measurement points for a partial period in the verbs object life cycle. In addition it presents the implementation of the generic counters interface. This will be achieved by extending flow creation by adding a new flow count specification type which allows the user to associate a previously created flow counters using the generic verbs counters interface to the created flow, once associated the user could read statistics by using the read function of the generic counters interface. The API includes: 1. create and destroyed API of a new counters objects 2. read the counters values from HW Note: Attaching API to allow application to define the measurement points per objects is a user space only API and this data is passed to kernel when the counted object (e.g. flow) is created with the counters object. =================== * tag 'verbs_flow_counters': IB/mlx5: Add counters read support IB/mlx5: Add flow counters read support IB/mlx5: Add flow counters binding support IB/mlx5: Add counters create and destroy support IB/uverbs: Add support for flow counters IB/core: Add support for flow counters IB/core: Support passing uhw for create_flow IB/uverbs: Add read counters support IB/core: Introduce counters read verb IB/uverbs: Add create/destroy counters support IB/core: Introduce counters object and its create/destroy IB/uverbs: Add an ib_uobject getter to ioctl() infrastructure net/mlx5: Export flow counter related API net/mlx5: Use flow counter pointer as input to the query function
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch.c15
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fs_core.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c7
3 files changed, 11 insertions, 13 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 9a24314b817a..bb9665b7e8e7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -2104,21 +2104,18 @@ static int mlx5_eswitch_query_vport_drop_stats(struct mlx5_core_dev *dev,
2104 struct mlx5_vport *vport = &esw->vports[vport_idx]; 2104 struct mlx5_vport *vport = &esw->vports[vport_idx];
2105 u64 rx_discard_vport_down, tx_discard_vport_down; 2105 u64 rx_discard_vport_down, tx_discard_vport_down;
2106 u64 bytes = 0; 2106 u64 bytes = 0;
2107 u16 idx = 0;
2108 int err = 0; 2107 int err = 0;
2109 2108
2110 if (!vport->enabled || esw->mode != SRIOV_LEGACY) 2109 if (!vport->enabled || esw->mode != SRIOV_LEGACY)
2111 return 0; 2110 return 0;
2112 2111
2113 if (vport->egress.drop_counter) { 2112 if (vport->egress.drop_counter)
2114 idx = vport->egress.drop_counter->id; 2113 mlx5_fc_query(dev, vport->egress.drop_counter,
2115 mlx5_fc_query(dev, idx, &stats->rx_dropped, &bytes); 2114 &stats->rx_dropped, &bytes);
2116 }
2117 2115
2118 if (vport->ingress.drop_counter) { 2116 if (vport->ingress.drop_counter)
2119 idx = vport->ingress.drop_counter->id; 2117 mlx5_fc_query(dev, vport->ingress.drop_counter,
2120 mlx5_fc_query(dev, idx, &stats->tx_dropped, &bytes); 2118 &stats->tx_dropped, &bytes);
2121 }
2122 2119
2123 if (!MLX5_CAP_GEN(dev, receive_discard_vport_down) && 2120 if (!MLX5_CAP_GEN(dev, receive_discard_vport_down) &&
2124 !MLX5_CAP_GEN(dev, transmit_discard_vport_down)) 2121 !MLX5_CAP_GEN(dev, transmit_discard_vport_down))
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
index b6da322a8016..32070e5d993d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
@@ -233,8 +233,6 @@ void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev,
233 unsigned long delay); 233 unsigned long delay);
234void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev, 234void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev,
235 unsigned long interval); 235 unsigned long interval);
236int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id,
237 u64 *packets, u64 *bytes);
238 236
239int mlx5_init_fs(struct mlx5_core_dev *dev); 237int mlx5_init_fs(struct mlx5_core_dev *dev);
240void mlx5_cleanup_fs(struct mlx5_core_dev *dev); 238void mlx5_cleanup_fs(struct mlx5_core_dev *dev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
index b7ab929d5f8e..58af6be13dfa 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
@@ -243,6 +243,7 @@ err_out:
243 243
244 return ERR_PTR(err); 244 return ERR_PTR(err);
245} 245}
246EXPORT_SYMBOL(mlx5_fc_create);
246 247
247void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter) 248void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
248{ 249{
@@ -260,6 +261,7 @@ void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
260 mlx5_cmd_fc_free(dev, counter->id); 261 mlx5_cmd_fc_free(dev, counter->id);
261 kfree(counter); 262 kfree(counter);
262} 263}
264EXPORT_SYMBOL(mlx5_fc_destroy);
263 265
264int mlx5_init_fc_stats(struct mlx5_core_dev *dev) 266int mlx5_init_fc_stats(struct mlx5_core_dev *dev)
265{ 267{
@@ -312,11 +314,12 @@ void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev)
312 } 314 }
313} 315}
314 316
315int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id, 317int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
316 u64 *packets, u64 *bytes) 318 u64 *packets, u64 *bytes)
317{ 319{
318 return mlx5_cmd_fc_query(dev, id, packets, bytes); 320 return mlx5_cmd_fc_query(dev, counter->id, packets, bytes);
319} 321}
322EXPORT_SYMBOL(mlx5_fc_query);
320 323
321void mlx5_fc_query_cached(struct mlx5_fc *counter, 324void mlx5_fc_query_cached(struct mlx5_fc *counter,
322 u64 *bytes, u64 *packets, u64 *lastuse) 325 u64 *bytes, u64 *packets, u64 *lastuse)