diff options
author | hselasky <hselasky@FreeBSD.org> | 2015-12-30 15:01:47 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2015-12-30 15:01:47 +0000 |
commit | a34806ae5e52827216675ac0a1e0a89722756f73 (patch) | |
tree | 1107c617e23757ac527d790dcf3c3872c313ef4f /sys/dev/mlx5/mlx5_en/mlx5_en_main.c | |
parent | 3e461a3c0e58d75b4e1c3937831ed0e65f36ddc2 (diff) | |
download | FreeBSD-src-a34806ae5e52827216675ac0a1e0a89722756f73.zip FreeBSD-src-a34806ae5e52827216675ac0a1e0a89722756f73.tar.gz |
Add support for modifying coalescing parameters runtime.
MFC after: 1 week
Sponsored by: Mellanox Technologies
Diffstat (limited to 'sys/dev/mlx5/mlx5_en/mlx5_en_main.c')
-rw-r--r-- | sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 28b3054..82ea69d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1712,6 +1712,62 @@ mlx5e_close_channels(struct mlx5e_priv *priv) } static int +mlx5e_refresh_sq_params(struct mlx5e_priv *priv, struct mlx5e_sq *sq) +{ + return (mlx5_core_modify_cq_moderation(priv->mdev, &sq->cq.mcq, + priv->params.tx_cq_moderation_usec, + priv->params.tx_cq_moderation_pkts)); +} + +static int +mlx5e_refresh_rq_params(struct mlx5e_priv *priv, struct mlx5e_rq *rq) +{ + return (mlx5_core_modify_cq_moderation(priv->mdev, &rq->cq.mcq, + priv->params.rx_cq_moderation_usec, + priv->params.rx_cq_moderation_pkts)); +} + +static int +mlx5e_refresh_channel_params_sub(struct mlx5e_priv *priv, struct mlx5e_channel *c) +{ + int err; + int i; + + if (c == NULL) + return (EINVAL); + + err = mlx5e_refresh_rq_params(priv, &c->rq); + if (err) + goto done; + + for (i = 0; i != c->num_tc; i++) { + err = mlx5e_refresh_sq_params(priv, &c->sq[i]); + if (err) + goto done; + } +done: + return (err); +} + +int +mlx5e_refresh_channel_params(struct mlx5e_priv *priv) +{ + int i; + + if (priv->channel == NULL) + return (EINVAL); + + for (i = 0; i < priv->params.num_channels; i++) { + int err; + + err = mlx5e_refresh_channel_params_sub(priv, priv->channel[i]); + if (err) + return (err); + } + return (0); +} + +static int mlx5e_open_tis(struct mlx5e_priv *priv, int tc) { struct mlx5_core_dev *mdev = priv->mdev; |