Page MenuHomeFreeBSD

D26996.diff
No OneTemporary

D26996.diff

Index: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
===================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
@@ -280,7 +280,7 @@
union if_snd_tag_alloc_params *params,
struct m_snd_tag **ppmt)
{
- struct if_snd_tag_alloc_rate_limit rl_params;
+ union if_snd_tag_alloc_params rl_params;
struct mlx5e_priv *priv;
struct mlx5e_tls_tag *ptag;
const struct tls_session_params *en;
@@ -377,29 +377,17 @@
goto failure;
}
+ memset(&rl_params, 0, sizeof(rl_params));
+ rl_params.hdr = params->hdr;
switch (params->hdr.type) {
#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT)
case IF_SND_TAG_TYPE_TLS_RATE_LIMIT:
- memset(&rl_params, 0, sizeof(rl_params));
- rl_params.hdr = params->tls_rate_limit.hdr;
rl_params.hdr.type = IF_SND_TAG_TYPE_RATE_LIMIT;
rl_params.max_rate = params->tls_rate_limit.max_rate;
-
- error = mlx5e_rl_snd_tag_alloc(ifp,
- container_of(&rl_params, union if_snd_tag_alloc_params, rate_limit),
- &ptag->rl_tag);
- if (error)
- goto failure;
break;
#endif
case IF_SND_TAG_TYPE_TLS:
- memset(&rl_params, 0, sizeof(rl_params));
- rl_params.hdr = params->tls.hdr;
rl_params.hdr.type = IF_SND_TAG_TYPE_UNLIMITED;
-
- error = mlx5e_ul_snd_tag_alloc(ifp,
- container_of(&rl_params, union if_snd_tag_alloc_params, unlimited),
- &ptag->rl_tag);
if (error)
goto failure;
break;
@@ -408,6 +396,10 @@
goto failure;
}
+ error = ifp->if_snd_tag_alloc(ifp, &rl_params, &ptag->rl_tag);
+ if (error)
+ goto failure;
+
/* store pointer to mbuf tag */
MPASS(ptag->tag.refcount == 0);
m_snd_tag_init(&ptag->tag, ifp, params->hdr.type);
@@ -427,7 +419,7 @@
mlx5e_tls_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params)
{
#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT)
- struct if_snd_tag_rate_limit_params rl_params;
+ union if_snd_tag_modify_params rl_params;
struct mlx5e_tls_tag *ptag =
container_of(pmt, struct mlx5e_tls_tag, tag);
int error;
@@ -437,9 +429,9 @@
#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT)
case IF_SND_TAG_TYPE_TLS_RATE_LIMIT:
memset(&rl_params, 0, sizeof(rl_params));
- rl_params.max_rate = params->tls_rate_limit.max_rate;
- error = mlx5e_rl_snd_tag_modify(ptag->rl_tag,
- container_of(&rl_params, union if_snd_tag_modify_params, rate_limit));
+ rl_params.rate_limit.max_rate = params->tls_rate_limit.max_rate;
+ error = ptag->rl_tag->ifp->if_snd_tag_modify(ptag->rl_tag,
+ &rl_params);
return (error);
#endif
default:
@@ -457,11 +449,10 @@
switch (pmt->type) {
#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT)
case IF_SND_TAG_TYPE_TLS_RATE_LIMIT:
- error = mlx5e_rl_snd_tag_query(ptag->rl_tag, params);
- break;
#endif
case IF_SND_TAG_TYPE_TLS:
- error = mlx5e_ul_snd_tag_query(ptag->rl_tag, params);
+ error = ptag->rl_tag->ifp->if_snd_tag_query(ptag->rl_tag,
+ params);
break;
default:
error = EOPNOTSUPP;
@@ -477,18 +468,8 @@
container_of(pmt, struct mlx5e_tls_tag, tag);
struct mlx5e_priv *priv;
- switch (pmt->type) {
-#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT)
- case IF_SND_TAG_TYPE_TLS_RATE_LIMIT:
- mlx5e_rl_snd_tag_free(ptag->rl_tag);
- break;
-#endif
- case IF_SND_TAG_TYPE_TLS:
- mlx5e_ul_snd_tag_free(ptag->rl_tag);
- break;
- default:
- break;
- }
+ MPASS(ptag->rl_tag->refcount == 1);
+ m_snd_tag_rele(ptag->rl_tag);
MLX5E_TLS_TAG_LOCK(ptag);
ptag->state = MLX5E_TLS_ST_FREED;

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 21, 6:25 PM (5 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30085356
Default Alt Text
D26996.diff (3 KB)

Event Timeline