Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
Show All 32 Lines | |||||
static void mlx5e_rl_close_workers(struct mlx5e_priv *); | static void mlx5e_rl_close_workers(struct mlx5e_priv *); | ||||
static int mlx5e_rl_sysctl_show_rate_table(SYSCTL_HANDLER_ARGS); | static int mlx5e_rl_sysctl_show_rate_table(SYSCTL_HANDLER_ARGS); | ||||
static void mlx5e_rl_sysctl_add_u64_oid(struct mlx5e_rl_priv_data *, unsigned x, | static void mlx5e_rl_sysctl_add_u64_oid(struct mlx5e_rl_priv_data *, unsigned x, | ||||
struct sysctl_oid *, const char *name, const char *desc); | struct sysctl_oid *, const char *name, const char *desc); | ||||
static void mlx5e_rl_sysctl_add_stats_u64_oid(struct mlx5e_rl_priv_data *rl, unsigned x, | static void mlx5e_rl_sysctl_add_stats_u64_oid(struct mlx5e_rl_priv_data *rl, unsigned x, | ||||
struct sysctl_oid *node, const char *name, const char *desc); | struct sysctl_oid *node, const char *name, const char *desc); | ||||
static int mlx5e_rl_tx_limit_add(struct mlx5e_rl_priv_data *, uint64_t value); | static int mlx5e_rl_tx_limit_add(struct mlx5e_rl_priv_data *, uint64_t value); | ||||
static int mlx5e_rl_tx_limit_clr(struct mlx5e_rl_priv_data *, uint64_t value); | static int mlx5e_rl_tx_limit_clr(struct mlx5e_rl_priv_data *, uint64_t value); | ||||
static if_snd_tag_modify_t mlx5e_rl_snd_tag_modify; | |||||
static if_snd_tag_query_t mlx5e_rl_snd_tag_query; | |||||
static if_snd_tag_free_t mlx5e_rl_snd_tag_free; | |||||
static const struct if_snd_tag_sw mlx5e_rl_snd_tag_sw = { | |||||
.snd_tag_modify = mlx5e_rl_snd_tag_modify, | |||||
.snd_tag_query = mlx5e_rl_snd_tag_query, | |||||
.snd_tag_free = mlx5e_rl_snd_tag_free | |||||
}; | |||||
static void | static void | ||||
mlx5e_rl_build_sq_param(struct mlx5e_rl_priv_data *rl, | mlx5e_rl_build_sq_param(struct mlx5e_rl_priv_data *rl, | ||||
struct mlx5e_sq_param *param) | struct mlx5e_sq_param *param) | ||||
{ | { | ||||
void *sqc = param->sqc; | void *sqc = param->sqc; | ||||
void *wq = MLX5_ADDR_OF(sqc, sqc, wq); | void *wq = MLX5_ADDR_OF(sqc, sqc, wq); | ||||
uint8_t log_sq_size = order_base_2(rl->param.tx_queue_size); | uint8_t log_sq_size = order_base_2(rl->param.tx_queue_size); | ||||
▲ Show 20 Lines • Show All 1,055 Lines • ▼ Show 20 Lines | mlx5e_rl_snd_tag_alloc(struct ifnet *ifp, | ||||
error = mlx5e_rl_modify(rlw, channel, params->rate_limit.max_rate); | error = mlx5e_rl_modify(rlw, channel, params->rate_limit.max_rate); | ||||
if (error != 0) { | if (error != 0) { | ||||
mlx5e_rl_free(rlw, channel); | mlx5e_rl_free(rlw, channel); | ||||
goto done; | goto done; | ||||
} | } | ||||
/* store pointer to mbuf tag */ | /* store pointer to mbuf tag */ | ||||
MPASS(channel->tag.refcount == 0); | MPASS(channel->tag.refcount == 0); | ||||
m_snd_tag_init(&channel->tag, ifp, IF_SND_TAG_TYPE_RATE_LIMIT); | m_snd_tag_init(&channel->tag, ifp, IF_SND_TAG_TYPE_RATE_LIMIT, | ||||
&mlx5e_rl_snd_tag_sw); | |||||
*ppmt = &channel->tag; | *ppmt = &channel->tag; | ||||
done: | done: | ||||
return (error); | return (error); | ||||
} | } | ||||
int | static int | ||||
mlx5e_rl_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) | mlx5e_rl_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) | ||||
{ | { | ||||
struct mlx5e_rl_channel *channel = | struct mlx5e_rl_channel *channel = | ||||
container_of(pmt, struct mlx5e_rl_channel, tag); | container_of(pmt, struct mlx5e_rl_channel, tag); | ||||
return (mlx5e_rl_modify(channel->worker, channel, params->rate_limit.max_rate)); | return (mlx5e_rl_modify(channel->worker, channel, params->rate_limit.max_rate)); | ||||
} | } | ||||
int | static int | ||||
mlx5e_rl_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) | mlx5e_rl_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) | ||||
{ | { | ||||
struct mlx5e_rl_channel *channel = | struct mlx5e_rl_channel *channel = | ||||
container_of(pmt, struct mlx5e_rl_channel, tag); | container_of(pmt, struct mlx5e_rl_channel, tag); | ||||
return (mlx5e_rl_query(channel->worker, channel, params)); | return (mlx5e_rl_query(channel->worker, channel, params)); | ||||
} | } | ||||
void | static void | ||||
mlx5e_rl_snd_tag_free(struct m_snd_tag *pmt) | mlx5e_rl_snd_tag_free(struct m_snd_tag *pmt) | ||||
{ | { | ||||
struct mlx5e_rl_channel *channel = | struct mlx5e_rl_channel *channel = | ||||
container_of(pmt, struct mlx5e_rl_channel, tag); | container_of(pmt, struct mlx5e_rl_channel, tag); | ||||
mlx5e_rl_free(channel->worker, channel); | mlx5e_rl_free(channel->worker, channel); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 426 Lines • Show Last 20 Lines |