svn commit: r306250 - stable/10/sys/dev/mlx5/mlx5_en
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Sep 23 08:33:05 UTC 2016
Author: hselasky
Date: Fri Sep 23 08:33:03 2016
New Revision: 306250
URL: https://svnweb.freebsd.org/changeset/base/306250
Log:
MFC r305873:
mlx5en: Factor out common sendqueue code for use with rate limiting SQs.
Try to reuse code to setup sendqueues when possible by making some static
functions global. Further split the mlx5e_close_sq_wait() function to
separate out reusable parts.
Sponsored by: Mellanox Technologies
Modified:
stable/10/sys/dev/mlx5/mlx5_en/en.h
stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:32:18 2016 (r306249)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:33:03 2016 (r306250)
@@ -822,5 +822,11 @@ int mlx5e_refresh_channel_params(struct
int mlx5e_open_cq(struct mlx5e_priv *, struct mlx5e_cq_param *,
struct mlx5e_cq *, mlx5e_cq_comp_t *, int eq_ix);
void mlx5e_close_cq(struct mlx5e_cq *);
+void mlx5e_free_sq_db(struct mlx5e_sq *);
+int mlx5e_alloc_sq_db(struct mlx5e_sq *);
+int mlx5e_enable_sq(struct mlx5e_sq *, struct mlx5e_sq_param *, int tis_num);
+int mlx5e_modify_sq(struct mlx5e_sq *, int curr_state, int next_state);
+void mlx5e_disable_sq(struct mlx5e_sq *);
+void mlx5e_drain_sq(struct mlx5e_sq *);
#endif /* _MLX5_EN_H_ */
Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Sep 23 08:32:18 2016 (r306249)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Sep 23 08:33:03 2016 (r306250)
@@ -879,7 +879,7 @@ mlx5e_close_rq_wait(struct mlx5e_rq *rq)
mlx5e_destroy_rq(rq);
}
-static void
+void
mlx5e_free_sq_db(struct mlx5e_sq *sq)
{
int wq_sz = mlx5_wq_cyc_get_size(&sq->wq);
@@ -890,7 +890,7 @@ mlx5e_free_sq_db(struct mlx5e_sq *sq)
free(sq->mbuf, M_MLX5EN);
}
-static int
+int
mlx5e_alloc_sq_db(struct mlx5e_sq *sq)
{
int wq_sz = mlx5_wq_cyc_get_size(&sq->wq);
@@ -1039,8 +1039,9 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq)
buf_ring_free(sq->br, M_MLX5EN);
}
-static int
-mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param)
+int
+mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param,
+ int tis_num)
{
void *in;
void *sqc;
@@ -1059,7 +1060,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
memcpy(sqc, param->sqc, sizeof(param->sqc));
- MLX5_SET(sqc, sqc, tis_num_0, sq->priv->tisn[sq->tc]);
+ MLX5_SET(sqc, sqc, tis_num_0, tis_num);
MLX5_SET(sqc, sqc, cqn, sq->cq.mcq.cqn);
MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST);
MLX5_SET(sqc, sqc, tis_lst_sz, 1);
@@ -1081,7 +1082,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
return (err);
}
-static int
+int
mlx5e_modify_sq(struct mlx5e_sq *sq, int curr_state, int next_state)
{
void *in;
@@ -1107,7 +1108,7 @@ mlx5e_modify_sq(struct mlx5e_sq *sq, int
return (err);
}
-static void
+void
mlx5e_disable_sq(struct mlx5e_sq *sq)
{
@@ -1126,7 +1127,7 @@ mlx5e_open_sq(struct mlx5e_channel *c,
if (err)
return (err);
- err = mlx5e_enable_sq(sq, param);
+ err = mlx5e_enable_sq(sq, param, c->priv->tisn[tc]);
if (err)
goto err_destroy_sq;
@@ -1202,8 +1203,8 @@ mlx5e_sq_cev_timeout(void *arg)
callout_reset_curcpu(&sq->cev_callout, hz, mlx5e_sq_cev_timeout, sq);
}
-static void
-mlx5e_close_sq_wait(struct mlx5e_sq *sq)
+void
+mlx5e_drain_sq(struct mlx5e_sq *sq)
{
mtx_lock(&sq->lock);
@@ -1230,7 +1231,13 @@ mlx5e_close_sq_wait(struct mlx5e_sq *sq)
mtx_lock(&sq->lock);
}
mtx_unlock(&sq->lock);
+}
+
+static void
+mlx5e_close_sq_wait(struct mlx5e_sq *sq)
+{
+ mlx5e_drain_sq(sq);
mlx5e_disable_sq(sq);
mlx5e_destroy_sq(sq);
}
More information about the svn-src-all
mailing list