* [PATCH 1/4] net/ena: add fast mbuf free support
2022-06-07 16:43 [PATCH 0/4] net/ena: v2.7.0 driver release Michal Krawczyk
@ 2022-06-07 16:43 ` Michal Krawczyk
2022-06-07 16:43 ` [PATCH 2/4] net/ena: skip MTU verification Michal Krawczyk
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Michal Krawczyk @ 2022-06-07 16:43 UTC (permalink / raw)
To: ferruh.yigit
Cc: shaibran, upstream, mw, dev, Dawid Gorecki, Michal Krawczyk,
Amit Bernstein
From: Dawid Gorecki <dgr@semihalf.com>
Add support for RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload. It can be
enabled if all the mbufs for a given queue belong to the same mempool
and their reference count is equal to 1.
Signed-off-by: Dawid Gorecki <dgr@semihalf.com>
Reviewed-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
---
doc/guides/nics/features/ena.ini | 1 +
doc/guides/rel_notes/release_22_07.rst | 7 ++++
drivers/net/ena/ena_ethdev.c | 49 ++++++++++++++++++++++++--
3 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/doc/guides/nics/features/ena.ini b/doc/guides/nics/features/ena.ini
index 59c1ae85fa..1fe7a71e3d 100644
--- a/doc/guides/nics/features/ena.ini
+++ b/doc/guides/nics/features/ena.ini
@@ -7,6 +7,7 @@
Link status = Y
Link status event = Y
Rx interrupt = Y
+Fast mbuf free = Y
Free Tx mbuf on demand = Y
MTU update = Y
Scattered Rx = Y
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index d46f773df0..73f566e5fc 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -87,6 +87,13 @@ New Features
Added an API which can get the device type of vDPA device.
+
+* **Updated Amazon ena driver.**
+
+ The new driver version (v2.7.0) includes:
+
+ * Added fast mbuf free feature support.
+
* **Updated Intel iavf driver.**
* Added Tx QoS queue rate limitation support.
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 68768cab70..68a4478410 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -36,6 +36,12 @@
#define ENA_MIN_RING_DESC 128
+/*
+ * We should try to keep ENA_CLEANUP_BUF_SIZE lower than
+ * RTE_MEMPOOL_CACHE_MAX_SIZE, so we can fit this in mempool local cache.
+ */
+#define ENA_CLEANUP_BUF_SIZE 256
+
#define ENA_PTYPE_HAS_HASH (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP)
struct ena_stats {
@@ -2402,6 +2408,8 @@ static uint64_t ena_get_tx_port_offloads(struct ena_adapter *adapter)
port_offloads |= RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+ port_offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+
return port_offloads;
}
@@ -2414,9 +2422,12 @@ static uint64_t ena_get_rx_queue_offloads(struct ena_adapter *adapter)
static uint64_t ena_get_tx_queue_offloads(struct ena_adapter *adapter)
{
+ uint64_t queue_offloads = 0;
RTE_SET_USED(adapter);
- return 0;
+ queue_offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+
+ return queue_offloads;
}
static int ena_infos_get(struct rte_eth_dev *dev,
@@ -3001,13 +3012,38 @@ static int ena_xmit_mbuf(struct ena_ring *tx_ring, struct rte_mbuf *mbuf)
return 0;
}
+static __rte_always_inline size_t
+ena_tx_cleanup_mbuf_fast(struct rte_mbuf **mbufs_to_clean,
+ struct rte_mbuf *mbuf,
+ size_t mbuf_cnt,
+ size_t buf_size)
+{
+ struct rte_mbuf *m_next;
+
+ while (mbuf != NULL) {
+ m_next = mbuf->next;
+ mbufs_to_clean[mbuf_cnt++] = mbuf;
+ if (mbuf_cnt == buf_size) {
+ rte_mempool_put_bulk(mbufs_to_clean[0]->pool, (void **)mbufs_to_clean,
+ (unsigned int)mbuf_cnt);
+ mbuf_cnt = 0;
+ }
+ mbuf = m_next;
+ }
+
+ return mbuf_cnt;
+}
+
static int ena_tx_cleanup(void *txp, uint32_t free_pkt_cnt)
{
+ struct rte_mbuf *mbufs_to_clean[ENA_CLEANUP_BUF_SIZE];
struct ena_ring *tx_ring = (struct ena_ring *)txp;
+ size_t mbuf_cnt = 0;
unsigned int total_tx_descs = 0;
unsigned int total_tx_pkts = 0;
uint16_t cleanup_budget;
uint16_t next_to_clean = tx_ring->next_to_clean;
+ bool fast_free = tx_ring->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
/*
* If free_pkt_cnt is equal to 0, it means that the user requested
@@ -3032,7 +3068,12 @@ static int ena_tx_cleanup(void *txp, uint32_t free_pkt_cnt)
tx_info->timestamp = 0;
mbuf = tx_info->mbuf;
- rte_pktmbuf_free(mbuf);
+ if (fast_free) {
+ mbuf_cnt = ena_tx_cleanup_mbuf_fast(mbufs_to_clean, mbuf, mbuf_cnt,
+ ENA_CLEANUP_BUF_SIZE);
+ } else {
+ rte_pktmbuf_free(mbuf);
+ }
tx_info->mbuf = NULL;
tx_ring->empty_tx_reqs[next_to_clean] = req_id;
@@ -3052,6 +3093,10 @@ static int ena_tx_cleanup(void *txp, uint32_t free_pkt_cnt)
ena_com_update_dev_comp_head(tx_ring->ena_com_io_cq);
}
+ if (mbuf_cnt != 0)
+ rte_mempool_put_bulk(mbufs_to_clean[0]->pool,
+ (void **)mbufs_to_clean, mbuf_cnt);
+
/* Notify completion handler that full cleanup was performed */
if (free_pkt_cnt == 0 || total_tx_pkts < cleanup_budget)
tx_ring->last_cleanup_ticks = rte_get_timer_cycles();
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] net/ena: skip MTU verification
2022-06-07 16:43 [PATCH 0/4] net/ena: v2.7.0 driver release Michal Krawczyk
2022-06-07 16:43 ` [PATCH 1/4] net/ena: add fast mbuf free support Michal Krawczyk
@ 2022-06-07 16:43 ` Michal Krawczyk
2022-06-07 16:43 ` [PATCH 3/4] net/ena: add an option to disable LLQ Michal Krawczyk
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Michal Krawczyk @ 2022-06-07 16:43 UTC (permalink / raw)
To: ferruh.yigit
Cc: shaibran, upstream, mw, dev, Dawid Gorecki, Michal Krawczyk,
Amit Bernstein
From: Dawid Gorecki <dgr@semihalf.com>
Remove MTU verification from ena_mtu_set() and ena_start(). It is done
by rte_ethdev already, so there is no reason to repeat it inside the ENA
driver.
Signed-off-by: Dawid Gorecki <dgr@semihalf.com>
Reviewed-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
---
drivers/net/ena/ena_ethdev.c | 25 -------------------------
1 file changed, 25 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 68a4478410..efd6dea4c2 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -987,20 +987,6 @@ static int ena_queue_start_all(struct rte_eth_dev *dev,
return rc;
}
-static int ena_check_valid_conf(struct ena_adapter *adapter)
-{
- uint32_t mtu = adapter->edev_data->mtu;
-
- if (mtu > adapter->max_mtu || mtu < ENA_MIN_MTU) {
- PMD_INIT_LOG(ERR,
- "Unsupported MTU of %d. Max MTU: %d, min MTU: %d\n",
- mtu, adapter->max_mtu, ENA_MIN_MTU);
- return ENA_COM_UNSUPPORTED;
- }
-
- return 0;
-}
-
static int
ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx,
bool use_large_llq_hdr)
@@ -1165,13 +1151,6 @@ static int ena_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
ena_dev = &adapter->ena_dev;
ena_assert_msg(ena_dev != NULL, "Uninitialized device\n");
- if (mtu > adapter->max_mtu || mtu < ENA_MIN_MTU) {
- PMD_DRV_LOG(ERR,
- "Invalid MTU setting. New MTU: %d, max MTU: %d, min MTU: %d\n",
- mtu, adapter->max_mtu, ENA_MIN_MTU);
- return -EINVAL;
- }
-
rc = ENA_PROXY(adapter, ena_com_set_dev_mtu, ena_dev, mtu);
if (rc)
PMD_DRV_LOG(ERR, "Could not set MTU: %d\n", mtu);
@@ -1193,10 +1172,6 @@ static int ena_start(struct rte_eth_dev *dev)
return -EPERM;
}
- rc = ena_check_valid_conf(adapter);
- if (rc)
- return rc;
-
rc = ena_setup_rx_intr(dev);
if (rc)
return rc;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] net/ena: add an option to disable LLQ
2022-06-07 16:43 [PATCH 0/4] net/ena: v2.7.0 driver release Michal Krawczyk
2022-06-07 16:43 ` [PATCH 1/4] net/ena: add fast mbuf free support Michal Krawczyk
2022-06-07 16:43 ` [PATCH 2/4] net/ena: skip MTU verification Michal Krawczyk
@ 2022-06-07 16:43 ` Michal Krawczyk
2022-06-07 16:43 ` [PATCH 4/4] net/ena: update version to 2.7.0 Michal Krawczyk
2022-06-07 19:02 ` [PATCH 0/4] net/ena: v2.7.0 driver release Ferruh Yigit
4 siblings, 0 replies; 6+ messages in thread
From: Michal Krawczyk @ 2022-06-07 16:43 UTC (permalink / raw)
To: ferruh.yigit
Cc: shaibran, upstream, mw, dev, Michal Krawczyk, Dawid Gorecki,
Amit Bernstein
The PMD attempts to enable the LLQ (Low Latency Queue) whenever it's
possible. The LLQ requires the user to enable the Write Combining for
the supported igb_uio/vfio-pci modules.
The vfio-pci module officially doesn't support the WC. Moreover, in some
Linux distributions, it can be built into the kernel, so any
modifications to the vfio-pci module require a full rebuild of the
kernel. This can make the configuration process much harder and for some
users, that are not interested in the great network performance for
their setups, it may be redundant. These users requested to be able to
turn off LLQ to avoid the hassle of such a setup.
It's generally not recommended to disable the LLQ, as it won't result in
the performance improvement and on the 6th generation AWS instances the
lack of LLQ can have a huge negative impact on hardware performance.
The device argument which controls the LLQ is called 'enable_llq` and by
default, it's set to 1 (which means that the LLQ is enabled). Setting
it to 0 disables the LLQ.
This commit also adds the explicit initialization of the devarg for the
'use_large_llq_hdr'. The PMD_REGISTER_PARAM_STRING() call for the ENA
was updated with all the available devargs (including
ENA_DEVARG_MISS_TXC_TO, which wasn't added previously).
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Dawid Gorecki <dgr@semihalf.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
---
doc/guides/nics/ena.rst | 9 ++++++++
doc/guides/rel_notes/release_22_07.rst | 2 ++
drivers/net/ena/ena_ethdev.c | 29 +++++++++++++++++++++++++-
drivers/net/ena/ena_ethdev.h | 1 +
4 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/doc/guides/nics/ena.rst b/doc/guides/nics/ena.rst
index 3d780acac9..df5343e4ae 100644
--- a/doc/guides/nics/ena.rst
+++ b/doc/guides/nics/ena.rst
@@ -96,6 +96,15 @@ Configuration information
timer service. Setting this parameter to 0 disables this feature. Maximum
allowed value is 60 seconds.
+ * **enable_llq** (default 1)
+
+ Determines whenever the driver should use the LLQ (if it's available) or
+ not.
+
+ **NOTE: On the 6th generation AWS instances disabling LLQ may lead to a
+ huge performance degradation. In general disabling LLQ is highly not
+ recommended!**
+
**ENA Configuration Parameters**
* **Number of Queues**
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index 73f566e5fc..45d0012f2d 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -93,6 +93,8 @@ New Features
The new driver version (v2.7.0) includes:
* Added fast mbuf free feature support.
+ * Added ``enable_llq`` device argument for controlling the PMD LLQ
+ (Low Latency Queue) mode.
* **Updated Intel iavf driver.**
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index efd6dea4c2..d748b33e51 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -72,6 +72,12 @@ struct ena_stats {
* considered as a missing.
*/
#define ENA_DEVARG_MISS_TXC_TO "miss_txc_to"
+/*
+ * Controls whether LLQ should be used (if available). Enabled by default.
+ * NOTE: It's highly not recommended to disable the LLQ, as it may lead to a
+ * huge performance degradation on 6th generation AWS instances.
+ */
+#define ENA_DEVARG_ENABLE_LLQ "enable_llq"
/*
* Each rte_memzone should have unique name.
@@ -1932,6 +1938,14 @@ ena_set_queues_placement_policy(struct ena_adapter *adapter,
int rc;
u32 llq_feature_mask;
+ if (!adapter->enable_llq) {
+ PMD_DRV_LOG(WARNING,
+ "NOTE: LLQ has been disabled as per user's request. "
+ "This may lead to a huge performance degradation!\n");
+ ena_dev->tx_mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST;
+ return 0;
+ }
+
llq_feature_mask = 1 << ENA_ADMIN_LLQ;
if (!(ena_dev->supported_features & llq_feature_mask)) {
PMD_DRV_LOG(INFO,
@@ -2127,7 +2141,10 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
snprintf(adapter->name, ENA_NAME_MAX_LEN, "ena_%d",
adapter->id_number);
+ /* Assign default devargs values */
adapter->missing_tx_completion_to = ENA_TX_TIMEOUT;
+ adapter->enable_llq = true;
+ adapter->use_large_llq_hdr = false;
rc = ena_parse_devargs(adapter, pci_dev->device.devargs);
if (rc != 0) {
@@ -3478,6 +3495,8 @@ static int ena_process_bool_devarg(const char *key,
/* Now, assign it to the proper adapter field. */
if (strcmp(key, ENA_DEVARG_LARGE_LLQ_HDR) == 0)
adapter->use_large_llq_hdr = bool_value;
+ else if (strcmp(key, ENA_DEVARG_ENABLE_LLQ) == 0)
+ adapter->enable_llq = bool_value;
return 0;
}
@@ -3488,6 +3507,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
static const char * const allowed_args[] = {
ENA_DEVARG_LARGE_LLQ_HDR,
ENA_DEVARG_MISS_TXC_TO,
+ ENA_DEVARG_ENABLE_LLQ,
NULL,
};
struct rte_kvargs *kvlist;
@@ -3509,6 +3529,10 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
goto exit;
rc = rte_kvargs_process(kvlist, ENA_DEVARG_MISS_TXC_TO,
ena_process_uint_devarg, adapter);
+ if (rc != 0)
+ goto exit;
+ rc = rte_kvargs_process(kvlist, ENA_DEVARG_ENABLE_LLQ,
+ ena_process_bool_devarg, adapter);
exit:
rte_kvargs_free(kvlist);
@@ -3727,7 +3751,10 @@ static struct rte_pci_driver rte_ena_pmd = {
RTE_PMD_REGISTER_PCI(net_ena, rte_ena_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_ena, pci_id_ena_map);
RTE_PMD_REGISTER_KMOD_DEP(net_ena, "* igb_uio | uio_pci_generic | vfio-pci");
-RTE_PMD_REGISTER_PARAM_STRING(net_ena, ENA_DEVARG_LARGE_LLQ_HDR "=<0|1>");
+RTE_PMD_REGISTER_PARAM_STRING(net_ena,
+ ENA_DEVARG_LARGE_LLQ_HDR "=<0|1> "
+ ENA_DEVARG_ENABLE_LLQ "=<0|1> "
+ ENA_DEVARG_MISS_TXC_TO "=<uint>");
RTE_LOG_REGISTER_SUFFIX(ena_logtype_init, init, NOTICE);
RTE_LOG_REGISTER_SUFFIX(ena_logtype_driver, driver, NOTICE);
#ifdef RTE_ETHDEV_DEBUG_RX
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index c0094b03ee..0db0918b43 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -303,6 +303,7 @@ struct ena_adapter {
bool trigger_reset;
+ bool enable_llq;
bool use_large_llq_hdr;
uint32_t last_tx_comp_qid;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] net/ena: update version to 2.7.0
2022-06-07 16:43 [PATCH 0/4] net/ena: v2.7.0 driver release Michal Krawczyk
` (2 preceding siblings ...)
2022-06-07 16:43 ` [PATCH 3/4] net/ena: add an option to disable LLQ Michal Krawczyk
@ 2022-06-07 16:43 ` Michal Krawczyk
2022-06-07 19:02 ` [PATCH 0/4] net/ena: v2.7.0 driver release Ferruh Yigit
4 siblings, 0 replies; 6+ messages in thread
From: Michal Krawczyk @ 2022-06-07 16:43 UTC (permalink / raw)
To: ferruh.yigit; +Cc: shaibran, upstream, mw, dev, Michal Krawczyk
This release contains changes listed below.
- Fast mbuf free feature support.
- Device argument to disable the LLQ.
- Simplification of the MTU verification.
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
---
drivers/net/ena/ena_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index d748b33e51..3e88bcda6c 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -21,7 +21,7 @@
#include <ena_eth_io_defs.h>
#define DRV_MODULE_VER_MAJOR 2
-#define DRV_MODULE_VER_MINOR 6
+#define DRV_MODULE_VER_MINOR 7
#define DRV_MODULE_VER_SUBMINOR 0
#define __MERGE_64B_H_L(h, l) (((uint64_t)h << 32) | l)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] net/ena: v2.7.0 driver release
2022-06-07 16:43 [PATCH 0/4] net/ena: v2.7.0 driver release Michal Krawczyk
` (3 preceding siblings ...)
2022-06-07 16:43 ` [PATCH 4/4] net/ena: update version to 2.7.0 Michal Krawczyk
@ 2022-06-07 19:02 ` Ferruh Yigit
4 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2022-06-07 19:02 UTC (permalink / raw)
To: Michal Krawczyk; +Cc: shaibran, upstream, mw, dev
On 6/7/2022 5:43 PM, Michal Krawczyk wrote:
> Hi,
>
> this patchset contains 1 generic feature support (fast mbuf free), one
> improvement (simplification of the MTU verification), and 1 new device
> argument which enhances the ENA user's experience by allowing them to
> disable the LLQ (Low Latency Queue) mode.
>
> Thanks,
> Michal
>
> Dawid Gorecki (2):
> net/ena: add fast mbuf free support
> net/ena: skip MTU verification
>
> Michal Krawczyk (2):
> net/ena: add an option to disable LLQ
> net/ena: update version to 2.7.0
>
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread