]> git.droids-corp.org - dpdk.git/commitdiff
net/mlx5: introduce LRO
authorDekel Peled <dekelp@mellanox.com>
Mon, 22 Jul 2019 14:51:59 +0000 (14:51 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 23 Jul 2019 12:31:36 +0000 (14:31 +0200)
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>
doc/guides/nics/features/mlx5.ini
doc/guides/nics/mlx5.rst
doc/guides/rel_notes/release_19_08.rst
drivers/net/mlx5/mlx5.c
drivers/net/mlx5/mlx5.h
drivers/net/mlx5/mlx5_ethdev.c
drivers/net/mlx5/mlx5_rxq.c
drivers/net/mlx5/mlx5_rxtx.h

index f7e73587b7c64e049210c82baffa737a88a33f14..c0ebdbd5d1cd26f7a68a0210b730f666af48fa3c 100644 (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
index 7e873449310d5c9d8319b94e83d80d3d4eae57ee..1ea2c434458b0439aa534d66002270e6dab1714c 100644 (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
 ~~~~~~~~~~~~~~~~~~~~~~
 
index 2edc04c376a98606e317ee2b7d0ceeeb6ceee31a..c9bd3ce18f75655baab536d95cc046adf830ea90 100644 (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.**
 
index 5538f925893fae2180577f8b919338860e5fca95..a84349973d471be455c0509245a78b92a442a190 100644 (file)
 /* 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;
index 2f2ed572e95c4d55ed471db61d781bccff905f2f..e494572f352a1b1b64a39d1fd094e29af13dd9b6 100644 (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. */
 };
 
 /**
index 9629cfb333b3ab8cec612817efc4a1182e940e55..cf50e6e84a0fd32c647b2228ec895c42db83b756 100644 (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);
index 0535ce347e1ec378c33f98a01b5a21dabecc65f4..e68de50156e68af8e0303c4cfd67d095a8d27e4b 100644 (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;
 }
 
index bc8a61a5cb67d399effd463d31c0dc443a382ded..2f688ac384571182fbf5be9b459bc4c79e3685d8 100644 (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 */