net/mlx5: introduce LRO

Add command-line argument to set LRO session timeout.
Add LRO settings struct in PMD configuration struct.
Add support of LRO offload in port configuration.
Add macros and function to check if LRO is supported and enabled.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
This commit is contained in:
Dekel Peled 2019-07-22 14:51:59 +00:00 committed by Ferruh Yigit
parent 970eb58c47
commit 21bb6c7e62
8 changed files with 57 additions and 3 deletions

View File

@ -13,6 +13,7 @@ Queue start/stop = Y
MTU update = Y
Jumbo frame = Y
Scattered Rx = Y
LRO = Y
TSO = Y
Promiscuous mode = Y
Allmulticast mode = Y

View File

@ -82,6 +82,7 @@ Features
increment/decrement, count, drop, mark. For details please see :ref:`Supported hardware offloads using rte_flow API`.
- Flow insertion rate of more then million flows per second, when using Direct Rules.
- Support for multiple rte_flow groups.
- Hardware LRO.
Limitations
-----------
@ -556,6 +557,14 @@ Run-time configuration
set to 128 by default.
- ``lro_timeout_usec`` parameter [int]
The maximum allowed duration of an LRO session, in micro-seconds.
PMD will set the nearest value supported by HW, which is not bigger than
the input ``lro_timeout_usec`` value.
If this parameter is not specified, by default PMD will set
the smallest value supported by HW.
Firmware configuration
~~~~~~~~~~~~~~~~~~~~~~

View File

@ -117,6 +117,7 @@ New Features
* Accelerate flows with count action creation and destroy.
* Accelerate flows counter query.
* Improved Tx datapath performance with enabled HW offloads.
* Added support for LRO.
* **Updated Solarflare network PMD.**

View File

@ -138,6 +138,9 @@
/* Device parameter to configure the maximum number of dump files per queue. */
#define MLX5_MAX_DUMP_FILES_NUM "max_dump_files_num"
/* Configure timeout of LRO session (in microseconds). */
#define MLX5_LRO_TIMEOUT_USEC "lro_timeout_usec"
#ifndef HAVE_IBV_MLX5_MOD_MPW
#define MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED (1 << 2)
#define MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW (1 << 3)
@ -1052,6 +1055,8 @@ mlx5_args_check(const char *key, const char *val, void *opaque)
config->mr_ext_memseg_en = !!tmp;
} else if (strcmp(MLX5_MAX_DUMP_FILES_NUM, key) == 0) {
config->max_dump_files_num = tmp;
} else if (strcmp(MLX5_LRO_TIMEOUT_USEC, key) == 0) {
config->lro.timeout = tmp;
} else {
DRV_LOG(WARNING, "%s: unknown parameter", key);
rte_errno = EINVAL;
@ -1100,6 +1105,7 @@ mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs)
MLX5_MR_EXT_MEMSEG_EN,
MLX5_REPRESENTOR,
MLX5_MAX_DUMP_FILES_NUM,
MLX5_LRO_TIMEOUT_USEC,
NULL,
};
struct rte_kvargs *kvlist;

View File

@ -183,6 +183,21 @@ TAILQ_HEAD(mlx5_flows, rte_flow);
/* Default PMD specific parameter value. */
#define MLX5_ARG_UNSET (-1)
#define MLX5_LRO_SUPPORTED(dev) \
(((struct mlx5_priv *)((dev)->data->dev_private))->config.lro.supported)
#define MLX5_LRO_ENABLED(dev) \
((dev)->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TCP_LRO)
#define MLX5_FLOW_IPV4_LRO (1 << 0)
#define MLX5_FLOW_IPV6_LRO (1 << 1)
/* LRO configurations structure. */
struct mlx5_lro_config {
uint32_t supported:1; /* Whether LRO is supported. */
uint32_t timeout; /* User configuration. */
};
/*
* Device configuration structure.
*
@ -233,6 +248,7 @@ struct mlx5_dev_config {
int txq_inline_max; /* Max packet size for inlining with SEND. */
int txq_inline_mpw; /* Max packet size for inlining with eMPW. */
struct mlx5_hca_attr hca_attr; /* HCA attributes. */
struct mlx5_lro_config lro; /* LRO configuration. */
};
/**

View File

@ -565,7 +565,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
info->max_tx_queues = max;
info->max_mac_addrs = MLX5_MAX_UC_MAC_ADDRESSES;
info->rx_queue_offload_capa = mlx5_get_rx_queue_offloads(dev);
info->rx_offload_capa = (mlx5_get_rx_port_offloads() |
info->rx_offload_capa = (mlx5_get_rx_port_offloads(dev) |
info->rx_queue_offload_capa);
info->tx_offload_capa = mlx5_get_tx_port_offloads(dev);
info->if_index = mlx5_ifindex(dev);

View File

@ -123,6 +123,21 @@ mlx5_mprq_enabled(struct rte_eth_dev *dev)
return n == priv->rxqs_n;
}
/**
* Check whether LRO is supported and enabled for the device.
*
* @param dev
* Pointer to Ethernet device.
*
* @return
* 0 if disabled, 1 if enabled.
*/
inline int
mlx5_lro_on(struct rte_eth_dev *dev)
{
return (MLX5_LRO_SUPPORTED(dev) && MLX5_LRO_ENABLED(dev));
}
/**
* Allocate RX queue elements for Multi-Packet RQ.
*
@ -386,14 +401,19 @@ mlx5_get_rx_queue_offloads(struct rte_eth_dev *dev)
/**
* Returns the per-port supported offloads.
*
* @param dev
* Pointer to Ethernet device.
*
* @return
* Supported Rx offloads.
*/
uint64_t
mlx5_get_rx_port_offloads(void)
mlx5_get_rx_port_offloads(struct rte_eth_dev *dev)
{
uint64_t offloads = DEV_RX_OFFLOAD_VLAN_FILTER;
if (MLX5_LRO_SUPPORTED(dev))
offloads |= DEV_RX_OFFLOAD_TCP_LRO;
return offloads;
}

View File

@ -323,8 +323,9 @@ int mlx5_hrxq_release(struct rte_eth_dev *dev, struct mlx5_hrxq *hxrq);
int mlx5_hrxq_ibv_verify(struct rte_eth_dev *dev);
struct mlx5_hrxq *mlx5_hrxq_drop_new(struct rte_eth_dev *dev);
void mlx5_hrxq_drop_release(struct rte_eth_dev *dev);
uint64_t mlx5_get_rx_port_offloads(void);
uint64_t mlx5_get_rx_port_offloads(struct rte_eth_dev *dev);
uint64_t mlx5_get_rx_queue_offloads(struct rte_eth_dev *dev);
int mlx5_lro_on(struct rte_eth_dev *dev);
/* mlx5_txq.c */