patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 01/22] net/ena: switch memcpy to dpdk-optimized version
       [not found] <20210430125725.28796-1-mk@semihalf.com>
@ 2021-04-30 12:57 ` Michal Krawczyk
  2021-04-30 12:57 ` [dpdk-stable] [PATCH 12/22] net/ena: fix parsing of large_llq_hdr argument Michal Krawczyk
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-04-30 12:57 UTC (permalink / raw)
  To: dev; +Cc: ndagan, gtzalik, igorch, mw, stable, Michal Krawczyk, Artur Rojek

From: Igor Chauskin <igorch@amazon.com>

memcpy is now mapped to rte_memcpy macro.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")
Cc: stable@dpdk.org

Signed-off-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Artur Rojek <ar@semihalf.com>
---
 drivers/net/ena/base/ena_plat_dpdk.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index a1d749f83f..cc3fa2fe81 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -25,6 +25,7 @@
 #include <rte_spinlock.h>
 
 #include <sys/time.h>
+#include <rte_memcpy.h>
 
 typedef uint64_t u64;
 typedef uint32_t u32;
@@ -62,7 +63,8 @@ typedef uint64_t dma_addr_t;
 #define ENA_UDELAY(x) rte_delay_us_block(x)
 
 #define ENA_TOUCH(x) ((void)(x))
-#define memcpy_toio memcpy
+#undef memcpy
+#define memcpy rte_memcpy
 #define wmb rte_wmb
 #define rmb rte_rmb
 #define mb rte_mb
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH 12/22] net/ena: fix parsing of large_llq_hdr argument
       [not found] <20210430125725.28796-1-mk@semihalf.com>
  2021-04-30 12:57 ` [dpdk-stable] [PATCH 01/22] net/ena: switch memcpy to dpdk-optimized version Michal Krawczyk
@ 2021-04-30 12:57 ` Michal Krawczyk
  2021-04-30 12:57 ` [dpdk-stable] [PATCH 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-04-30 12:57 UTC (permalink / raw)
  To: dev; +Cc: ndagan, gtzalik, igorch, mw, stable, Shay Agroskin, Michal Krawczyk

From: Igor Chauskin <igorch@amazon.com>

The code incorrectly checked the return value of comparison when parsing
the argument key name. The return value of strcmp should be compared
to 0 to identify a match.

Fixes: 8a7a73f26cc9 ("net/ena: support large LLQ headers")
Cc: stable@dpdk.org

Signed-off-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
Reviewed-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 3c9102cd19..cb8ad5c3d0 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -2865,7 +2865,7 @@ 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))
+	if (strcmp(key, ENA_DEVARG_LARGE_LLQ_HDR) == 0)
 		adapter->use_large_llq_hdr = bool_value;
 
 	return 0;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH 13/22] net/ena: terminate devargs allowed keys with NULL
       [not found] <20210430125725.28796-1-mk@semihalf.com>
  2021-04-30 12:57 ` [dpdk-stable] [PATCH 01/22] net/ena: switch memcpy to dpdk-optimized version Michal Krawczyk
  2021-04-30 12:57 ` [dpdk-stable] [PATCH 12/22] net/ena: fix parsing of large_llq_hdr argument Michal Krawczyk
@ 2021-04-30 12:57 ` Michal Krawczyk
  2021-04-30 12:57 ` [dpdk-stable] [PATCH 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-04-30 12:57 UTC (permalink / raw)
  To: dev; +Cc: ndagan, gtzalik, igorch, mw, Michal Krawczyk, stable, Shay Agroskin

As the documentation of rte_kvargs_parse() states, the valid_keys
argument must be NULL terminated. Lack of this feature may cause
segmentation fault if the passed devarg will be different then the
supported value.

Fixes: 8a7a73f26cc9 ("net/ena: support large LLQ headers")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
---
 drivers/net/ena/ena_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index cb8ad5c3d0..6092288239 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -2876,6 +2876,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
 {
 	static const char * const allowed_args[] = {
 		ENA_DEVARG_LARGE_LLQ_HDR,
+		NULL,
 	};
 	struct rte_kvargs *kvlist;
 	int rc;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH 14/22] net/ena: indicate Rx RSS hash presence
       [not found] <20210430125725.28796-1-mk@semihalf.com>
                   ` (2 preceding siblings ...)
  2021-04-30 12:57 ` [dpdk-stable] [PATCH 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
@ 2021-04-30 12:57 ` Michal Krawczyk
  2021-04-30 12:57 ` [dpdk-stable] [PATCH 21/22] net/ena: report default ring size Michal Krawczyk
       [not found] ` <20210505073348.6394-1-mk@semihalf.com>
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-04-30 12:57 UTC (permalink / raw)
  To: dev; +Cc: ndagan, gtzalik, igorch, mw, Michal Krawczyk, stable, Amit Bernstein

To make it possible to the app to determine if the hash was calculated
for the packet or not, the PKT_RX_RSS_HASH should be set in the mbuf's
ol_flags.

As the PMD wasn't setting that, the application couldn't check if there
is a hash in a proper way.

The hash is valid only if it's UDP or TCP and the IP packet wasn't
fragmented.

Fixes: e5df9f33db00 ("net/ena: fix passing RSS hash to mbuf")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
---
 drivers/net/ena/ena_ethdev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 6092288239..5d107775f4 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -51,6 +51,8 @@
 
 #define ENA_MIN_RING_DESC	128
 
+#define ENA_PTYPE_HAS_HASH	(RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP)
+
 enum ethtool_stringset {
 	ETH_SS_TEST             = 0,
 	ETH_SS_STATS,
@@ -314,6 +316,11 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
 		else
 			ol_flags |= PKT_RX_L4_CKSUM_GOOD;
 
+	if (likely((packet_type & ENA_PTYPE_HAS_HASH) && !ena_rx_ctx->frag)) {
+		ol_flags |= PKT_RX_RSS_HASH;
+		mbuf->hash.rss = ena_rx_ctx->hash;
+	}
+
 	mbuf->ol_flags = ol_flags;
 	mbuf->packet_type = packet_type;
 }
@@ -2245,8 +2252,6 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			++rx_ring->rx_stats.bad_csum;
 		}
 
-		mbuf->hash.rss = ena_rx_ctx.hash;
-
 		rx_pkts[completed] = mbuf;
 		rx_ring->rx_stats.bytes += mbuf->pkt_len;
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH 21/22] net/ena: report default ring size
       [not found] <20210430125725.28796-1-mk@semihalf.com>
                   ` (3 preceding siblings ...)
  2021-04-30 12:57 ` [dpdk-stable] [PATCH 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
@ 2021-04-30 12:57 ` Michal Krawczyk
       [not found] ` <20210505073348.6394-1-mk@semihalf.com>
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-04-30 12:57 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, mw, Stanislaw Kardach, stable,
	Michal Krawczyk, Shay Agroskin

From: Stanislaw Kardach <kda@semihalf.com>

Remove invalid ring size alignment logic and add default rx and tx port
ring sizes to the device info spec.

The logic in lines 1297 and 1371 is invalid. The
RTE_ETH_DEV_FALLBACK_RX_RINGSIZE (and the TX counterpart) is a value
that rte_eth_rx_queue_setup() will set if
dev_info.default_rxportconf.ring_size is 0 and user provided 0 in
nb_rx_desc argument. However the current code treats it as a hint for
the PMD to change the ring size to internal defaults.

Additionally since the ENA_DEFAULT_RING_SIZE is defined, report it in
the device capabilities so that both rte_ethdev code and the user can
utilize it for device configuration.

Fixes: ea93d37eb49d ("net/ena: add HW queues depth setup")
Cc: stable@dpdk.org

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Reviewed-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
---
 drivers/net/ena/ena_ethdev.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 73e99e956a..c5d8e7d43e 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1294,9 +1294,6 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
-	if (nb_desc == RTE_ETH_DEV_FALLBACK_TX_RINGSIZE)
-		nb_desc = adapter->max_tx_ring_size;
-
 	txq->port_id = dev->data->port_id;
 	txq->next_to_clean = 0;
 	txq->next_to_use = 0;
@@ -1368,9 +1365,6 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev,
 		return ENA_COM_FAULT;
 	}
 
-	if (nb_desc == RTE_ETH_DEV_FALLBACK_RX_RINGSIZE)
-		nb_desc = adapter->max_rx_ring_size;
-
 	if (!rte_is_power_of_2(nb_desc)) {
 		PMD_DRV_LOG(ERR,
 			"Unsupported size of RX queue: %d is not a power of 2.\n",
@@ -2130,6 +2124,9 @@ static int ena_infos_get(struct rte_eth_dev *dev,
 	dev_info->tx_desc_lim.nb_mtu_seg_max = RTE_MIN(ENA_PKT_MAX_BUFS,
 					adapter->max_tx_sgl_size);
 
+	dev_info->default_rxportconf.ring_size = ENA_DEFAULT_RING_SIZE;
+	dev_info->default_txportconf.ring_size = ENA_DEFAULT_RING_SIZE;
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v2 01/22] net/ena: switch memcpy to dpdk-optimized version
       [not found] ` <20210505073348.6394-1-mk@semihalf.com>
@ 2021-05-05  7:33   ` Michal Krawczyk
  2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 12/22] net/ena: fix parsing of large_llq_hdr argument Michal Krawczyk
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-05  7:33 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, stable, Michal Krawczyk, Artur Rojek

From: Igor Chauskin <igorch@amazon.com>

memcpy is now mapped to rte_memcpy macro on x86 architectures.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")
Cc: stable@dpdk.org

Signed-off-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Artur Rojek <ar@semihalf.com>
---
v2:
* Fix nested declaration of the rte_memcpy on arm64 architecture.

 drivers/net/ena/base/ena_plat_dpdk.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index a1d749f83f..ae68f860a5 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -25,6 +25,7 @@
 #include <rte_spinlock.h>
 
 #include <sys/time.h>
+#include <rte_memcpy.h>
 
 typedef uint64_t u64;
 typedef uint32_t u32;
@@ -62,7 +63,11 @@ typedef uint64_t dma_addr_t;
 #define ENA_UDELAY(x) rte_delay_us_block(x)
 
 #define ENA_TOUCH(x) ((void)(x))
-#define memcpy_toio memcpy
+/* Avoid nested declaration on arm64, as it may define rte_memcpy as memcpy. */
+#if defined(RTE_ARCH_X86)
+#undef memcpy
+#define memcpy rte_memcpy
+#endif
 #define wmb rte_wmb
 #define rmb rte_rmb
 #define mb rte_mb
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v2 12/22] net/ena: fix parsing of large_llq_hdr argument
       [not found] ` <20210505073348.6394-1-mk@semihalf.com>
  2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 01/22] net/ena: switch memcpy to dpdk-optimized version Michal Krawczyk
@ 2021-05-05  7:33   ` Michal Krawczyk
  2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-05  7:33 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, stable, Shay Agroskin,
	Michal Krawczyk

From: Igor Chauskin <igorch@amazon.com>

The code incorrectly checked the return value of comparison when parsing
the argument key name. The return value of strcmp should be compared
to 0 to identify a match.

Fixes: 8a7a73f26cc9 ("net/ena: support large LLQ headers")
Cc: stable@dpdk.org

Signed-off-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
Reviewed-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 3c9102cd19..cb8ad5c3d0 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -2865,7 +2865,7 @@ 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))
+	if (strcmp(key, ENA_DEVARG_LARGE_LLQ_HDR) == 0)
 		adapter->use_large_llq_hdr = bool_value;
 
 	return 0;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v2 13/22] net/ena: terminate devargs allowed keys with NULL
       [not found] ` <20210505073348.6394-1-mk@semihalf.com>
  2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 01/22] net/ena: switch memcpy to dpdk-optimized version Michal Krawczyk
  2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 12/22] net/ena: fix parsing of large_llq_hdr argument Michal Krawczyk
@ 2021-05-05  7:33   ` Michal Krawczyk
  2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-05  7:33 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, Michal Krawczyk, stable,
	Shay Agroskin

As the documentation of rte_kvargs_parse() states, the valid_keys
argument must be NULL terminated. Lack of this feature may cause
segmentation fault if the passed devarg will be different then the
supported value.

Fixes: 8a7a73f26cc9 ("net/ena: support large LLQ headers")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
---
 drivers/net/ena/ena_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index cb8ad5c3d0..6092288239 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -2876,6 +2876,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
 {
 	static const char * const allowed_args[] = {
 		ENA_DEVARG_LARGE_LLQ_HDR,
+		NULL,
 	};
 	struct rte_kvargs *kvlist;
 	int rc;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v2 14/22] net/ena: indicate Rx RSS hash presence
       [not found] ` <20210505073348.6394-1-mk@semihalf.com>
                     ` (2 preceding siblings ...)
  2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
@ 2021-05-05  7:33   ` Michal Krawczyk
  2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 21/22] net/ena: report default ring size Michal Krawczyk
       [not found]   ` <20210506142526.28245-1-mk@semihalf.com>
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-05  7:33 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, Michal Krawczyk, stable,
	Amit Bernstein

To make it possible to the app to determine if the hash was calculated
for the packet or not, the PKT_RX_RSS_HASH should be set in the mbuf's
ol_flags.

As the PMD wasn't setting that, the application couldn't check if there
is a hash in a proper way.

The hash is valid only if it's UDP or TCP and the IP packet wasn't
fragmented.

Fixes: e5df9f33db00 ("net/ena: fix passing RSS hash to mbuf")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
---
 drivers/net/ena/ena_ethdev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 6092288239..5d107775f4 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -51,6 +51,8 @@
 
 #define ENA_MIN_RING_DESC	128
 
+#define ENA_PTYPE_HAS_HASH	(RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP)
+
 enum ethtool_stringset {
 	ETH_SS_TEST             = 0,
 	ETH_SS_STATS,
@@ -314,6 +316,11 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
 		else
 			ol_flags |= PKT_RX_L4_CKSUM_GOOD;
 
+	if (likely((packet_type & ENA_PTYPE_HAS_HASH) && !ena_rx_ctx->frag)) {
+		ol_flags |= PKT_RX_RSS_HASH;
+		mbuf->hash.rss = ena_rx_ctx->hash;
+	}
+
 	mbuf->ol_flags = ol_flags;
 	mbuf->packet_type = packet_type;
 }
@@ -2245,8 +2252,6 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			++rx_ring->rx_stats.bad_csum;
 		}
 
-		mbuf->hash.rss = ena_rx_ctx.hash;
-
 		rx_pkts[completed] = mbuf;
 		rx_ring->rx_stats.bytes += mbuf->pkt_len;
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v2 21/22] net/ena: report default ring size
       [not found] ` <20210505073348.6394-1-mk@semihalf.com>
                     ` (3 preceding siblings ...)
  2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
@ 2021-05-05  7:33   ` Michal Krawczyk
       [not found]   ` <20210506142526.28245-1-mk@semihalf.com>
  5 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-05  7:33 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, Stanislaw Kardach, stable,
	Michal Krawczyk, Shay Agroskin

From: Stanislaw Kardach <kda@semihalf.com>

Remove invalid ring size alignment logic and add default rx and tx port
ring sizes to the device info spec.

The logic in lines 1297 and 1371 is invalid. The
RTE_ETH_DEV_FALLBACK_RX_RINGSIZE (and the TX counterpart) is a value
that rte_eth_rx_queue_setup() will set if
dev_info.default_rxportconf.ring_size is 0 and user provided 0 in
nb_rx_desc argument. However the current code treats it as a hint for
the PMD to change the ring size to internal defaults.

Additionally since the ENA_DEFAULT_RING_SIZE is defined, report it in
the device capabilities so that both rte_ethdev code and the user can
utilize it for device configuration.

Fixes: ea93d37eb49d ("net/ena: add HW queues depth setup")
Cc: stable@dpdk.org

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Reviewed-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
---
 drivers/net/ena/ena_ethdev.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 73e99e956a..c5d8e7d43e 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1294,9 +1294,6 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
-	if (nb_desc == RTE_ETH_DEV_FALLBACK_TX_RINGSIZE)
-		nb_desc = adapter->max_tx_ring_size;
-
 	txq->port_id = dev->data->port_id;
 	txq->next_to_clean = 0;
 	txq->next_to_use = 0;
@@ -1368,9 +1365,6 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev,
 		return ENA_COM_FAULT;
 	}
 
-	if (nb_desc == RTE_ETH_DEV_FALLBACK_RX_RINGSIZE)
-		nb_desc = adapter->max_rx_ring_size;
-
 	if (!rte_is_power_of_2(nb_desc)) {
 		PMD_DRV_LOG(ERR,
 			"Unsupported size of RX queue: %d is not a power of 2.\n",
@@ -2130,6 +2124,9 @@ static int ena_infos_get(struct rte_eth_dev *dev,
 	dev_info->tx_desc_lim.nb_mtu_seg_max = RTE_MIN(ENA_PKT_MAX_BUFS,
 					adapter->max_tx_sgl_size);
 
+	dev_info->default_rxportconf.ring_size = ENA_DEFAULT_RING_SIZE;
+	dev_info->default_txportconf.ring_size = ENA_DEFAULT_RING_SIZE;
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v3 01/22] net/ena: switch memcpy to dpdk-optimized version
       [not found]   ` <20210506142526.28245-1-mk@semihalf.com>
@ 2021-05-06 14:25     ` Michal Krawczyk
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 12/22] net/ena: fix parsing of large_llq_hdr argument Michal Krawczyk
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-06 14:25 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, stable, Michal Krawczyk, Artur Rojek

From: Igor Chauskin <igorch@amazon.com>

memcpy is now mapped to rte_memcpy macro on x86 architectures.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")
Cc: stable@dpdk.org

Signed-off-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Artur Rojek <ar@semihalf.com>
---
v2:
* Fix nested declaration of the rte_memcpy on arm64 architecture.

 drivers/net/ena/base/ena_plat_dpdk.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index a1d749f83f..ae68f860a5 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -25,6 +25,7 @@
 #include <rte_spinlock.h>
 
 #include <sys/time.h>
+#include <rte_memcpy.h>
 
 typedef uint64_t u64;
 typedef uint32_t u32;
@@ -62,7 +63,11 @@ typedef uint64_t dma_addr_t;
 #define ENA_UDELAY(x) rte_delay_us_block(x)
 
 #define ENA_TOUCH(x) ((void)(x))
-#define memcpy_toio memcpy
+/* Avoid nested declaration on arm64, as it may define rte_memcpy as memcpy. */
+#if defined(RTE_ARCH_X86)
+#undef memcpy
+#define memcpy rte_memcpy
+#endif
 #define wmb rte_wmb
 #define rmb rte_rmb
 #define mb rte_mb
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v3 12/22] net/ena: fix parsing of large_llq_hdr argument
       [not found]   ` <20210506142526.28245-1-mk@semihalf.com>
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 01/22] net/ena: switch memcpy to dpdk-optimized version Michal Krawczyk
@ 2021-05-06 14:25     ` Michal Krawczyk
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-06 14:25 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, stable, Shay Agroskin,
	Michal Krawczyk

From: Igor Chauskin <igorch@amazon.com>

The code incorrectly checked the return value of comparison when parsing
the argument key name. The return value of strcmp should be compared
to 0 to identify a match.

Fixes: 8a7a73f26cc9 ("net/ena: support large LLQ headers")
Cc: stable@dpdk.org

Signed-off-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
Reviewed-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 3c9102cd19..cb8ad5c3d0 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -2865,7 +2865,7 @@ 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))
+	if (strcmp(key, ENA_DEVARG_LARGE_LLQ_HDR) == 0)
 		adapter->use_large_llq_hdr = bool_value;
 
 	return 0;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v3 13/22] net/ena: terminate devargs allowed keys with NULL
       [not found]   ` <20210506142526.28245-1-mk@semihalf.com>
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 01/22] net/ena: switch memcpy to dpdk-optimized version Michal Krawczyk
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 12/22] net/ena: fix parsing of large_llq_hdr argument Michal Krawczyk
@ 2021-05-06 14:25     ` Michal Krawczyk
  2021-05-07 16:47       ` Ferruh Yigit
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 21/22] net/ena: report default ring size Michal Krawczyk
  4 siblings, 1 reply; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-06 14:25 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, Michal Krawczyk, stable,
	Shay Agroskin

As the documentation of rte_kvargs_parse() states, the valid_keys
argument must be NULL terminated. Lack of this feature may cause
segmentation fault if the passed devarg will be different then the
supported value.

Fixes: 8a7a73f26cc9 ("net/ena: support large LLQ headers")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
---
 drivers/net/ena/ena_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index cb8ad5c3d0..6092288239 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -2876,6 +2876,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
 {
 	static const char * const allowed_args[] = {
 		ENA_DEVARG_LARGE_LLQ_HDR,
+		NULL,
 	};
 	struct rte_kvargs *kvlist;
 	int rc;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v3 14/22] net/ena: indicate Rx RSS hash presence
       [not found]   ` <20210506142526.28245-1-mk@semihalf.com>
                       ` (2 preceding siblings ...)
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
@ 2021-05-06 14:25     ` Michal Krawczyk
  2021-05-07 16:47       ` Ferruh Yigit
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 21/22] net/ena: report default ring size Michal Krawczyk
  4 siblings, 1 reply; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-06 14:25 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, Michal Krawczyk, stable,
	Amit Bernstein

To make it possible to the app to determine if the hash was calculated
for the packet or not, the PKT_RX_RSS_HASH should be set in the mbuf's
ol_flags.

As the PMD wasn't setting that, the application couldn't check if there
is a hash in a proper way.

The hash is valid only if it's UDP or TCP and the IP packet wasn't
fragmented.

Fixes: e5df9f33db00 ("net/ena: fix passing RSS hash to mbuf")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
---
 drivers/net/ena/ena_ethdev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 6092288239..5d107775f4 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -51,6 +51,8 @@
 
 #define ENA_MIN_RING_DESC	128
 
+#define ENA_PTYPE_HAS_HASH	(RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP)
+
 enum ethtool_stringset {
 	ETH_SS_TEST             = 0,
 	ETH_SS_STATS,
@@ -314,6 +316,11 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
 		else
 			ol_flags |= PKT_RX_L4_CKSUM_GOOD;
 
+	if (likely((packet_type & ENA_PTYPE_HAS_HASH) && !ena_rx_ctx->frag)) {
+		ol_flags |= PKT_RX_RSS_HASH;
+		mbuf->hash.rss = ena_rx_ctx->hash;
+	}
+
 	mbuf->ol_flags = ol_flags;
 	mbuf->packet_type = packet_type;
 }
@@ -2245,8 +2252,6 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			++rx_ring->rx_stats.bad_csum;
 		}
 
-		mbuf->hash.rss = ena_rx_ctx.hash;
-
 		rx_pkts[completed] = mbuf;
 		rx_ring->rx_stats.bytes += mbuf->pkt_len;
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-stable] [PATCH v3 21/22] net/ena: report default ring size
       [not found]   ` <20210506142526.28245-1-mk@semihalf.com>
                       ` (3 preceding siblings ...)
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
@ 2021-05-06 14:25     ` Michal Krawczyk
  4 siblings, 0 replies; 18+ messages in thread
From: Michal Krawczyk @ 2021-05-06 14:25 UTC (permalink / raw)
  To: dev
  Cc: ndagan, gtzalik, igorch, upstream, Stanislaw Kardach, stable,
	Michal Krawczyk, Shay Agroskin

From: Stanislaw Kardach <kda@semihalf.com>

Remove invalid ring size alignment logic and add default rx and tx port
ring sizes to the device info spec.

The logic in lines 1297 and 1371 is invalid. The
RTE_ETH_DEV_FALLBACK_RX_RINGSIZE (and the TX counterpart) is a value
that rte_eth_rx_queue_setup() will set if
dev_info.default_rxportconf.ring_size is 0 and user provided 0 in
nb_rx_desc argument. However the current code treats it as a hint for
the PMD to change the ring size to internal defaults.

Additionally since the ENA_DEFAULT_RING_SIZE is defined, report it in
the device capabilities so that both rte_ethdev code and the user can
utilize it for device configuration.

Fixes: ea93d37eb49d ("net/ena: add HW queues depth setup")
Cc: stable@dpdk.org

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Reviewed-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
---
 drivers/net/ena/ena_ethdev.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 73e99e956a..c5d8e7d43e 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1294,9 +1294,6 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
-	if (nb_desc == RTE_ETH_DEV_FALLBACK_TX_RINGSIZE)
-		nb_desc = adapter->max_tx_ring_size;
-
 	txq->port_id = dev->data->port_id;
 	txq->next_to_clean = 0;
 	txq->next_to_use = 0;
@@ -1368,9 +1365,6 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev,
 		return ENA_COM_FAULT;
 	}
 
-	if (nb_desc == RTE_ETH_DEV_FALLBACK_RX_RINGSIZE)
-		nb_desc = adapter->max_rx_ring_size;
-
 	if (!rte_is_power_of_2(nb_desc)) {
 		PMD_DRV_LOG(ERR,
 			"Unsupported size of RX queue: %d is not a power of 2.\n",
@@ -2130,6 +2124,9 @@ static int ena_infos_get(struct rte_eth_dev *dev,
 	dev_info->tx_desc_lim.nb_mtu_seg_max = RTE_MIN(ENA_PKT_MAX_BUFS,
 					adapter->max_tx_sgl_size);
 
+	dev_info->default_rxportconf.ring_size = ENA_DEFAULT_RING_SIZE;
+	dev_info->default_txportconf.ring_size = ENA_DEFAULT_RING_SIZE;
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-stable] [PATCH v3 13/22] net/ena: terminate devargs allowed keys with NULL
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
@ 2021-05-07 16:47       ` Ferruh Yigit
  0 siblings, 0 replies; 18+ messages in thread
From: Ferruh Yigit @ 2021-05-07 16:47 UTC (permalink / raw)
  To: Michal Krawczyk, dev
  Cc: ndagan, gtzalik, igorch, upstream, stable, Shay Agroskin

On 5/6/2021 3:25 PM, Michal Krawczyk wrote:
> As the documentation of rte_kvargs_parse() states, the valid_keys
> argument must be NULL terminated. Lack of this feature may cause
> segmentation fault if the passed devarg will be different then the
> supported value.
> 
> Fixes: 8a7a73f26cc9 ("net/ena: support large LLQ headers")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Michal Krawczyk <mk@semihalf.com>
> Reviewed-by: Igor Chauskin <igorch@amazon.com>
> Reviewed-by: Shay Agroskin <shayagr@amazon.com>
> ---
>  drivers/net/ena/ena_ethdev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
> index cb8ad5c3d0..6092288239 100644
> --- a/drivers/net/ena/ena_ethdev.c
> +++ b/drivers/net/ena/ena_ethdev.c
> @@ -2876,6 +2876,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
>  {
>  	static const char * const allowed_args[] = {
>  		ENA_DEVARG_LARGE_LLQ_HDR,
> +		NULL,
>  	};
>  	struct rte_kvargs *kvlist;
>  	int rc;
> 

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>make sen

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-stable] [PATCH v3 14/22] net/ena: indicate Rx RSS hash presence
  2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
@ 2021-05-07 16:47       ` Ferruh Yigit
  2021-05-09 14:20         ` Michał Krawczyk
  0 siblings, 1 reply; 18+ messages in thread
From: Ferruh Yigit @ 2021-05-07 16:47 UTC (permalink / raw)
  To: Michal Krawczyk, dev
  Cc: ndagan, gtzalik, igorch, upstream, stable, Amit Bernstein

On 5/6/2021 3:25 PM, Michal Krawczyk wrote:
> To make it possible to the app to determine if the hash was calculated
> for the packet or not, the PKT_RX_RSS_HASH should be set in the mbuf's
> ol_flags.
> 
> As the PMD wasn't setting that, the application couldn't check if there
> is a hash in a proper way.
> 
> The hash is valid only if it's UDP or TCP and the IP packet wasn't
> fragmented.
> 
> Fixes: e5df9f33db00 ("net/ena: fix passing RSS hash to mbuf")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Michal Krawczyk <mk@semihalf.com>
> Reviewed-by: Igor Chauskin <igorch@amazon.com>
> Reviewed-by: Amit Bernstein <amitbern@amazon.com>
> ---
>  drivers/net/ena/ena_ethdev.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
> index 6092288239..5d107775f4 100644
> --- a/drivers/net/ena/ena_ethdev.c
> +++ b/drivers/net/ena/ena_ethdev.c
> @@ -51,6 +51,8 @@
>  
>  #define ENA_MIN_RING_DESC	128
>  
> +#define ENA_PTYPE_HAS_HASH	(RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP)
> +
>  enum ethtool_stringset {
>  	ETH_SS_TEST             = 0,
>  	ETH_SS_STATS,
> @@ -314,6 +316,11 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
>  		else
>  			ol_flags |= PKT_RX_L4_CKSUM_GOOD;
>  
> +	if (likely((packet_type & ENA_PTYPE_HAS_HASH) && !ena_rx_ctx->frag)) {
> +		ol_flags |= PKT_RX_RSS_HASH;
> +		mbuf->hash.rss = ena_rx_ctx->hash;
> +	}

The driver should announce the 'DEV_RX_OFFLOAD_RSS_HASH' offload capability
first, and should set 'PKT_RX_RSS_HASH' only if application requests the
'DEV_RX_OFFLOAD_RSS_HASH'.


Normally this is an optimization to not always update the 'mbuf->hash.rss' but
wait for explicit request from application for it.

But there is no practical performance gain for some PMDs and they enable it even
user does not ask for it [1] (of course if RSS is enabled), if this is same for
'ena' you can do the same.

[1]
https://git.dpdk.org/dpdk/tree/drivers/net/ixgbe/ixgbe_ethdev.c?h=v21.05-rc2#n2384

> +
>  	mbuf->ol_flags = ol_flags;
>  	mbuf->packet_type = packet_type;
>  }
> @@ -2245,8 +2252,6 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
>  			++rx_ring->rx_stats.bad_csum;
>  		}
>  
> -		mbuf->hash.rss = ena_rx_ctx.hash;
> -
>  		rx_pkts[completed] = mbuf;
>  		rx_ring->rx_stats.bytes += mbuf->pkt_len;
>  	}
> 


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-stable] [PATCH v3 14/22] net/ena: indicate Rx RSS hash presence
  2021-05-07 16:47       ` Ferruh Yigit
@ 2021-05-09 14:20         ` Michał Krawczyk
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Krawczyk @ 2021-05-09 14:20 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: dev, Dagan, Noam, Tzalik, Guy, Chauskin, Igor, upstream, stable,
	Amit Bernstein

pt., 7 maj 2021 o 18:47 Ferruh Yigit <ferruh.yigit@intel.com> napisał(a):
>
> On 5/6/2021 3:25 PM, Michal Krawczyk wrote:
> > To make it possible to the app to determine if the hash was calculated
> > for the packet or not, the PKT_RX_RSS_HASH should be set in the mbuf's
> > ol_flags.
> >
> > As the PMD wasn't setting that, the application couldn't check if there
> > is a hash in a proper way.
> >
> > The hash is valid only if it's UDP or TCP and the IP packet wasn't
> > fragmented.
> >
> > Fixes: e5df9f33db00 ("net/ena: fix passing RSS hash to mbuf")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Michal Krawczyk <mk@semihalf.com>
> > Reviewed-by: Igor Chauskin <igorch@amazon.com>
> > Reviewed-by: Amit Bernstein <amitbern@amazon.com>
> > ---
> >  drivers/net/ena/ena_ethdev.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
> > index 6092288239..5d107775f4 100644
> > --- a/drivers/net/ena/ena_ethdev.c
> > +++ b/drivers/net/ena/ena_ethdev.c
> > @@ -51,6 +51,8 @@
> >
> >  #define ENA_MIN_RING_DESC    128
> >
> > +#define ENA_PTYPE_HAS_HASH   (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP)
> > +
> >  enum ethtool_stringset {
> >       ETH_SS_TEST             = 0,
> >       ETH_SS_STATS,
> > @@ -314,6 +316,11 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
> >               else
> >                       ol_flags |= PKT_RX_L4_CKSUM_GOOD;
> >
> > +     if (likely((packet_type & ENA_PTYPE_HAS_HASH) && !ena_rx_ctx->frag)) {
> > +             ol_flags |= PKT_RX_RSS_HASH;
> > +             mbuf->hash.rss = ena_rx_ctx->hash;
> > +     }
>
> The driver should announce the 'DEV_RX_OFFLOAD_RSS_HASH' offload capability
> first, and should set 'PKT_RX_RSS_HASH' only if application requests the
> 'DEV_RX_OFFLOAD_RSS_HASH'.
>
>
> Normally this is an optimization to not always update the 'mbuf->hash.rss' but
> wait for explicit request from application for it.
>
> But there is no practical performance gain for some PMDs and they enable it even
> user does not ask for it [1] (of course if RSS is enabled), if this is same for
> 'ena' you can do the same.
>

Thanks for the reference - ENA should do the same, I will change that in v4.

> [1]
> https://git.dpdk.org/dpdk/tree/drivers/net/ixgbe/ixgbe_ethdev.c?h=v21.05-rc2#n2384
>
> > +
> >       mbuf->ol_flags = ol_flags;
> >       mbuf->packet_type = packet_type;
> >  }
> > @@ -2245,8 +2252,6 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
> >                       ++rx_ring->rx_stats.bad_csum;
> >               }
> >
> > -             mbuf->hash.rss = ena_rx_ctx.hash;
> > -
> >               rx_pkts[completed] = mbuf;
> >               rx_ring->rx_stats.bytes += mbuf->pkt_len;
> >       }
> >
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-05-09 14:20 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210430125725.28796-1-mk@semihalf.com>
2021-04-30 12:57 ` [dpdk-stable] [PATCH 01/22] net/ena: switch memcpy to dpdk-optimized version Michal Krawczyk
2021-04-30 12:57 ` [dpdk-stable] [PATCH 12/22] net/ena: fix parsing of large_llq_hdr argument Michal Krawczyk
2021-04-30 12:57 ` [dpdk-stable] [PATCH 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
2021-04-30 12:57 ` [dpdk-stable] [PATCH 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
2021-04-30 12:57 ` [dpdk-stable] [PATCH 21/22] net/ena: report default ring size Michal Krawczyk
     [not found] ` <20210505073348.6394-1-mk@semihalf.com>
2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 01/22] net/ena: switch memcpy to dpdk-optimized version Michal Krawczyk
2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 12/22] net/ena: fix parsing of large_llq_hdr argument Michal Krawczyk
2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
2021-05-05  7:33   ` [dpdk-stable] [PATCH v2 21/22] net/ena: report default ring size Michal Krawczyk
     [not found]   ` <20210506142526.28245-1-mk@semihalf.com>
2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 01/22] net/ena: switch memcpy to dpdk-optimized version Michal Krawczyk
2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 12/22] net/ena: fix parsing of large_llq_hdr argument Michal Krawczyk
2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 13/22] net/ena: terminate devargs allowed keys with NULL Michal Krawczyk
2021-05-07 16:47       ` Ferruh Yigit
2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 14/22] net/ena: indicate Rx RSS hash presence Michal Krawczyk
2021-05-07 16:47       ` Ferruh Yigit
2021-05-09 14:20         ` Michał Krawczyk
2021-05-06 14:25     ` [dpdk-stable] [PATCH v3 21/22] net/ena: report default ring size Michal Krawczyk

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git