Skip to content

Commit

Permalink
net/mlx5e: NVMEoTCP DDP offload control path
Browse files Browse the repository at this point in the history
This commit introduces direct data placement offload to NVME
TCP. There is a context per queue, which is established after the
handshake
using the tcp_ddp_sk_add/del NDOs.

Additionally, a resynchronization routine is used to assist
hardware recovery from TCP OOO, and continue the offload.
Resynchronization operates as follows:
1. TCP OOO causes the NIC HW to stop the offload
2. NIC HW identifies a PDU header at some TCP sequence number,
and asks NVMe-TCP to confirm it.
This request is delivered from the NIC driver to NVMe-TCP by first
finding the socket for the packet that triggered the request, and
then fiding the nvme_tcp_queue that is used by this routine.
Finally, the request is recorded in the nvme_tcp_queue.
3. When NVMe-TCP observes the requested TCP sequence, it will compare
it with the PDU header TCP sequence, and report the result to the
NIC driver (tcp_ddp_resync), which will update the HW,
and resume offload when all is successful.

Furthermore, we let the offloading driver advertise what is the max hw
sectors/segments via tcp_ddp_limits.

A follow-up patch introduces the data-path changes required for this
offload.

Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Ben Ben-Ishay <benishay@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Yoray Zack <yorayz@mellanox.com>
  • Loading branch information
ben-ishay authored and dsahern committed Dec 8, 2020
1 parent 84328a7 commit cd0edfa
Show file tree
Hide file tree
Showing 13 changed files with 1,327 additions and 5 deletions.
11 changes: 11 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,14 @@ config MLX5_SW_STEERING
default y
help
Build support for software-managed steering in the NIC.

config MLX5_EN_NVMEOTCP
bool "NVMEoTCP accelaration"
depends on MLX5_CORE_EN
depends on TCP_DDP
depends on TCP_DDP_CRC
default y
help
Build support for NVMEoTCP accelaration in the NIC.
Note: Support for hardware with this capability needs to be selected
for this option to become available.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/dr_domain.o steering/dr_table.o
steering/dr_ste.o steering/dr_send.o \
steering/dr_cmd.o steering/dr_fw.o \
steering/dr_action.o steering/fs_dr.o

mlx5_core-$(CONFIG_MLX5_EN_NVMEOTCP) += en_accel/fs_tcp.o en_accel/nvmeotcp.o
30 changes: 29 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,24 @@ struct page_pool;
#define MLX5E_UMR_WQEBBS \
(DIV_ROUND_UP(MLX5E_UMR_WQE_INLINE_SZ, MLX5_SEND_WQE_BB))

#define KLM_ALIGNMENT 4
#define MLX5E_KLM_UMR_WQE_SZ(sgl_len)\
(sizeof(struct mlx5e_umr_wqe) +\
(sizeof(struct mlx5_klm) * (sgl_len)))

#define MLX5E_KLM_UMR_WQEBBS(sgl_len)\
(DIV_ROUND_UP(MLX5E_KLM_UMR_WQE_SZ(sgl_len), MLX5_SEND_WQE_BB))

#define MLX5E_KLM_UMR_DS_CNT(sgl_len)\
DIV_ROUND_UP(MLX5E_KLM_UMR_WQE_SZ(sgl_len), MLX5_SEND_WQE_DS)

#define MLX5E_MAX_KLM_ENTRIES_PER_WQE(wqe_size)\
(((wqe_size) - sizeof(struct mlx5e_umr_wqe)) / sizeof(struct mlx5_klm))

#define MLX5E_KLM_ENTRIES_PER_WQE(wqe_size)\
(MLX5E_MAX_KLM_ENTRIES_PER_WQE(wqe_size) -\
(MLX5E_MAX_KLM_ENTRIES_PER_WQE(wqe_size) % KLM_ALIGNMENT))

#define MLX5E_MSG_LEVEL NETIF_MSG_LINK

#define mlx5e_dbg(mlevel, priv, format, ...) \
Expand Down Expand Up @@ -214,7 +232,10 @@ struct mlx5e_umr_wqe {
struct mlx5_wqe_ctrl_seg ctrl;
struct mlx5_wqe_umr_ctrl_seg uctrl;
struct mlx5_mkey_seg mkc;
struct mlx5_mtt inline_mtts[0];
union {
struct mlx5_mtt inline_mtts[0];
struct mlx5_klm inline_klms[0];
};
};

extern const char mlx5e_self_tests[][ETH_GSTRING_LEN];
Expand Down Expand Up @@ -648,6 +669,10 @@ struct mlx5e_channel {
struct mlx5e_xdpsq rq_xdpsq;
struct mlx5e_txqsq sq[MLX5E_MAX_NUM_TC];
struct mlx5e_icosq icosq; /* internal control operations */
#ifdef CONFIG_MLX5_EN_NVMEOTCP
struct list_head list_nvmeotcpsq; /* nvmeotcp umrs */
spinlock_t nvmeotcp_icosq_lock;
#endif
bool xdp;
struct napi_struct napi;
struct device *pdev;
Expand Down Expand Up @@ -821,6 +846,9 @@ struct mlx5e_priv {
#endif
#ifdef CONFIG_MLX5_EN_TLS
struct mlx5e_tls *tls;
#endif
#ifdef CONFIG_MLX5_EN_NVMEOTCP
struct mlx5e_nvmeotcp *nvmeotcp;
#endif
struct devlink_health_reporter *tx_reporter;
struct devlink_health_reporter *rx_reporter;
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct mlx5e_cq_param {
struct mlx5_wq_param wq;
u16 eq_ix;
u8 cq_period_mode;
bool force_cqe128;
};

struct mlx5e_rq_param {
Expand Down
13 changes: 13 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ enum mlx5e_icosq_wqe_type {
MLX5E_ICOSQ_WQE_SET_PSV_TLS,
MLX5E_ICOSQ_WQE_GET_PSV_TLS,
#endif
#ifdef CONFIG_MLX5_EN_NVMEOTCP
MLX5E_ICOSQ_WQE_UMR_NVME_TCP,
MLX5E_ICOSQ_WQE_UMR_NVME_TCP_INVALIDATE,
MLX5E_ICOSQ_WQE_SET_PSV_NVME_TCP,
#endif
};

/* General */
Expand Down Expand Up @@ -173,6 +178,14 @@ struct mlx5e_icosq_wqe_info {
struct {
struct mlx5e_ktls_rx_resync_buf *buf;
} tls_get_params;
#endif
#ifdef CONFIG_MLX5_EN_NVMEOTCP
struct {
struct mlx5e_nvmeotcp_queue *queue;
} nvmeotcp_q;
struct {
struct nvmeotcp_queue_entry *entry;
} nvmeotcp_qe;
#endif
};
};
Expand Down
9 changes: 8 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "en_accel/ipsec_rxtx.h"
#include "en_accel/tls.h"
#include "en_accel/tls_rxtx.h"
#include "en_accel/nvmeotcp.h"
#include "en.h"
#include "en/txrx.h"

Expand Down Expand Up @@ -196,11 +197,17 @@ static inline void mlx5e_accel_tx_finish(struct mlx5e_txqsq *sq,

static inline int mlx5e_accel_init_rx(struct mlx5e_priv *priv)
{
return mlx5e_ktls_init_rx(priv);
int tls, nvmeotcp;

tls = mlx5e_ktls_init_rx(priv);
nvmeotcp = mlx5e_nvmeotcp_init_rx(priv);

return tls && nvmeotcp;
}

static inline void mlx5e_accel_cleanup_rx(struct mlx5e_priv *priv)
{
mlx5e_nvmeotcp_cleanup_rx(priv);
mlx5e_ktls_cleanup_rx(priv);
}
#endif /* __MLX5E_EN_ACCEL_H__ */

0 comments on commit cd0edfa

Please sign in to comment.