Skip to content

Commit

Permalink
net/mlx5e: Add NVMEoTCP offload
Browse files Browse the repository at this point in the history
Add NVMEoTCP offload to mlx5.

This patch implements the NVME-TCP offload added by previous commits.
Similarly to other layer-5 offload, the offload is mapped to a TIR, and
updated using WQEs.

- Use 128B CQEs when NVME-TCP offload is enabled
- Implement asynchronous ddp invalidaation by completing the nvme-tcp
  request only when the invalidate UMR is done
- Use KLM UMRs to implement ddp
- Use a dedicated icosq for all NVME-TCP work. This SQ is unique in the
  sense that it is driven directly by the NVME-TCP layer to submit and
  invalidate ddp requests.
- Add statistics for offload packets/bytes, ddp setup/teardown, and
  queue init/teardown

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
Boris Pismenny authored and intel-lab-lkp committed Sep 30, 2020
1 parent d979776 commit 990254a
Show file tree
Hide file tree
Showing 19 changed files with 1,419 additions and 12 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 @@ -201,3 +201,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 @@ -84,3 +84,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
11 changes: 10 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,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 @@ -642,6 +645,9 @@ 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 mlx5e_icosq nvmeotcpsq; /* nvmeotcp umrs */
#endif
bool xdp;
struct napi_struct napi;
struct device *pdev;
Expand Down Expand Up @@ -815,6 +821,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
4 changes: 4 additions & 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 All @@ -38,6 +39,9 @@ struct mlx5e_channel_param {
struct mlx5e_sq_param xdp_sq;
struct mlx5e_sq_param icosq;
struct mlx5e_sq_param async_icosq;
#ifdef CONFIG_MLX5_EN_NVMEOTCP
struct mlx5e_sq_param nvmeotcpsq;
#endif
};

static inline bool mlx5e_qid_get_ch_if_in_group(struct mlx5e_params *params,
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 @@ -162,11 +163,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__ */
10 changes: 10 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum accel_fs_tcp_type {
struct mlx5e_accel_fs_tcp {
struct mlx5e_flow_table tables[ACCEL_FS_TCP_NUM_TYPES];
struct mlx5_flow_handle *default_rules[ACCEL_FS_TCP_NUM_TYPES];
refcount_t ref_count;
};

static enum mlx5e_traffic_types fs_accel2tt(enum accel_fs_tcp_type i)
Expand Down Expand Up @@ -335,6 +336,7 @@ static int accel_fs_tcp_enable(struct mlx5e_priv *priv)
return err;
}
}
refcount_set(&priv->fs.accel_tcp->ref_count, 1);
return 0;
}

Expand All @@ -358,6 +360,9 @@ void mlx5e_accel_fs_tcp_destroy(struct mlx5e_priv *priv)
if (!priv->fs.accel_tcp)
return;

if (!refcount_dec_and_test(&priv->fs.accel_tcp->ref_count))
return;

accel_fs_tcp_disable(priv);

for (i = 0; i < ACCEL_FS_TCP_NUM_TYPES; i++)
Expand All @@ -374,6 +379,11 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_priv *priv)
if (!MLX5_CAP_FLOWTABLE_NIC_RX(priv->mdev, ft_field_support.outer_ip_version))
return -EOPNOTSUPP;

if (priv->fs.accel_tcp) {
refcount_inc(&priv->fs.accel_tcp->ref_count);
return 0;
}

priv->fs.accel_tcp = kzalloc(sizeof(*priv->fs.accel_tcp), GFP_KERNEL);
if (!priv->fs.accel_tcp)
return -ENOMEM;
Expand Down
Loading

0 comments on commit 990254a

Please sign in to comment.