svn commit: r365036 - head/sys/dev/mlx5/mlx5_en
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Sep 1 12:21:17 UTC 2020
Author: hselasky
Date: Tue Sep 1 12:21:17 2020
New Revision: 365036
URL: https://svnweb.freebsd.org/changeset/base/365036
Log:
Make hardware TLS send tag allocation synchronous in mlx5en(4).
Previously the send tag was setup in the background, and all packets for
the given send tag were dropped until ready. Change this to be blocking
behaviour so that once the setsocketopt() for enabling TLS completes,
the socket is ready to send packets. Do this by simply flushing the
work request which does the needed firmware programming during send
tag allocation.
MFC after: 1 week
Sponsored by: Mellanox Technologies // Nvidia
Modified:
head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Tue Sep 1 12:11:59 2020 (r365035)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Tue Sep 1 12:21:17 2020 (r365036)
@@ -188,7 +188,7 @@ mlx5e_tls_work(struct work_struct *work)
priv = container_of(ptag->tls, struct mlx5e_priv, tls);
switch (ptag->state) {
- case MLX5E_TLS_ST_SETUP:
+ case MLX5E_TLS_ST_INIT:
/* try to open TIS, if not present */
if (ptag->tisn == 0) {
err = mlx5_tls_open_tis(priv->mdev, 0, priv->tdn,
@@ -215,8 +215,8 @@ mlx5e_tls_work(struct work_struct *work)
ptag->dek_index_ok = 1;
MLX5E_TLS_TAG_LOCK(ptag);
- if (ptag->state == MLX5E_TLS_ST_SETUP)
- ptag->state = MLX5E_TLS_ST_TXRDY;
+ if (ptag->state == MLX5E_TLS_ST_INIT)
+ ptag->state = MLX5E_TLS_ST_SETUP;
MLX5E_TLS_TAG_UNLOCK(ptag);
break;
@@ -413,6 +413,10 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp,
MPASS(ptag->tag.m_snd_tag.refcount == 0);
m_snd_tag_init(&ptag->tag.m_snd_tag, ifp);
*ppmt = &ptag->tag.m_snd_tag;
+
+ queue_work(priv->tls.wq, &ptag->work);
+ flush_work(&ptag->work);
+
return (0);
failure:
@@ -736,16 +740,11 @@ mlx5e_sq_tls_xmit(struct mlx5e_sq *sq, struct mlx5e_xm
MLX5E_TLS_TAG_LOCK(ptls_tag);
switch (ptls_tag->state) {
case MLX5E_TLS_ST_INIT:
- queue_work(sq->priv->tls.wq, &ptls_tag->work);
- ptls_tag->state = MLX5E_TLS_ST_SETUP;
- ptls_tag->expected_seq = ~mb_seq; /* force setup */
MLX5E_TLS_TAG_UNLOCK(ptls_tag);
return (MLX5E_TLS_FAILURE);
-
case MLX5E_TLS_ST_SETUP:
- MLX5E_TLS_TAG_UNLOCK(ptls_tag);
- return (MLX5E_TLS_FAILURE);
-
+ ptls_tag->state = MLX5E_TLS_ST_TXRDY;
+ ptls_tag->expected_seq = ~mb_seq; /* force setup */
default:
MLX5E_TLS_TAG_UNLOCK(ptls_tag);
break;
More information about the svn-src-head
mailing list