Skip to contentSkip to conversation

net/ena: driver release 2.10.0

PATCH Applied [email protected] 3 participants 24 messages Jul 2, 2024 – Jul 8, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/ena: driver release 2.10.0

From: Shai Brandes <[email protected]>

Hi all,
This release contains:
1. HAL upgrade to latest divided into separate patches.
2. three bug fixes.
3. restructuring of the Rx checksum code for readability
4. restructuring of the device uninit flow which is also needed for adding hot un/plug support later.
5. modification of logs on the datapath that leads to improved performance.

Will appreciate your feedbacks!
All the best and thanks in advance,
Shai

Shai Brandes (15):
net/ena/base: add descriptor dump capability
net/ena/base: remove unused param
net/ena/base: remove redundant assert checks
net/ena/base: update memory barrier comment
net/ena/base: add method to check used entries
net/ena/base: add an additional reset reason
net/ena/base: update copyrights comments
net/ena/base: add macro for bitfield access
net/ena: logger change to improve performance
net/ena: rework device uninit
net/ena: fix bad checksum handling
net/ena: fix invalid return value check
net/ena: fix wrong handling of checksum
net/ena: rework Rx checksum inspection
net/ena: upgrade driver version to 2.10.0

 doc/guides/rel_notes/release_24_07.rst        |  11 +
 drivers/net/ena/base/ena_com.c                | 167 +++++++------
 drivers/net/ena/base/ena_com.h                |  14 +-
 .../net/ena/base/ena_defs/ena_admin_defs.h    |   5 +-
 .../net/ena/base/ena_defs/ena_common_defs.h   |   4 +-
 .../net/ena/base/ena_defs/ena_eth_io_defs.h   |   5 +-
 drivers/net/ena/base/ena_defs/ena_includes.h  |   4 +-
 drivers/net/ena/base/ena_defs/ena_regs_defs.h |   5 +-
 drivers/net/ena/base/ena_eth_com.c            | 231 +++++++++++-------
 drivers/net/ena/base/ena_eth_com.h            |  33 ++-
 drivers/net/ena/base/ena_plat.h               |   4 +-
 drivers/net/ena/base/ena_plat_dpdk.h          |  24 +-
 drivers/net/ena/ena_ethdev.c                  | 134 +++++-----
 13 files changed, 374 insertions(+), 267 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/15 net/ena/base: add descriptor dump capability

From: Shai Brandes <[email protected]>

This patch adds the capability to print rx/tx descriptors. This patch introduces a new function ena_com_tx_cdesc_idx_to_ptr which is the equivalent of ena_com_rx_cdesc_idx_to_ptr but for tx cdesc.

Finally, this patch moves the io_cq header incrementation in ena_com_cdesc_rx_pkt_get() function to be after the possible if fail cases since it makes more sense to point into the next descriptor only if the last one is valid.

---
 drivers/net/ena/base/ena_eth_com.c | 56 +++++++++++++++++++++++++++---
 drivers/net/ena/base/ena_eth_com.h |  8 +++++
 2 files changed, 60 insertions(+), 4 deletions(-)
drivers/net/ena/base/ena_eth_com.c +52 -4
index 0de736fbe0..9ba0beb868 100644
@@ -5,8 +5,7 @@
 
 #include "ena_eth_com.h"
 
-static struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc(
-	struct ena_com_io_cq *io_cq)
+struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc(struct ena_com_io_cq *io_cq)
 {
 	struct ena_eth_io_rx_cdesc_base *cdesc;
 	u16 expected_phase, head_masked;
@@ -32,6 +31,55 @@ static struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc(
 	return cdesc;
 }
 
+void ena_com_dump_single_rx_cdesc(struct ena_com_io_cq *io_cq,
+				  struct ena_eth_io_rx_cdesc_base *desc)
+{
+	if (desc) {
+		uint32_t *desc_arr = (uint32_t *)desc;
+
+		ena_trc_err(ena_com_io_cq_to_ena_dev(io_cq),
+			    "RX descriptor value[0x%08x 0x%08x 0x%08x 0x%08x] phase[%u] first[%u] last[%u] MBZ7[%u] MZB17[%u]\n",
+			    desc_arr[0], desc_arr[1], desc_arr[2], desc_arr[3],
+			    ENA_FIELD_GET(desc->status, (uint32_t)ENA_ETH_IO_RX_DESC_PHASE_MASK,
+					  0),
+			    ENA_FIELD_GET(desc->status, (uint32_t)ENA_ETH_IO_RX_DESC_FIRST_MASK,
+					  ENA_ETH_IO_RX_DESC_FIRST_SHIFT),
+			    ENA_FIELD_GET(desc->status, (uint32_t)ENA_ETH_IO_RX_DESC_LAST_MASK,
+					  ENA_ETH_IO_RX_DESC_LAST_SHIFT),
+			    ENA_FIELD_GET(desc->status,
+					  (uint32_t)ENA_ETH_IO_RX_CDESC_BASE_MBZ7_MASK,
+					  ENA_ETH_IO_RX_CDESC_BASE_MBZ7_SHIFT),
+			    ENA_FIELD_GET(desc->status,
+					  (uint32_t)ENA_ETH_IO_RX_CDESC_BASE_MBZ17_MASK,
+					  ENA_ETH_IO_RX_CDESC_BASE_MBZ17_SHIFT));
+	}
+}
+
+void ena_com_dump_single_tx_cdesc(struct ena_com_io_cq *io_cq,
+				  struct ena_eth_io_tx_cdesc *desc)
+{
+	if (desc) {
+		uint32_t *desc_arr = (uint32_t *)desc;
+
+		ena_trc_err(ena_com_io_cq_to_ena_dev(io_cq),
+			    "TX descriptor value[0x%08x 0x%08x] phase[%u] MBZ6[%u]\n",
+			    desc_arr[0], desc_arr[1],
+			    ENA_FIELD_GET(desc->flags, (uint32_t)ENA_ETH_IO_TX_CDESC_PHASE_MASK,
+					  0),
+			    ENA_FIELD_GET(desc->flags, (uint32_t)ENA_ETH_IO_TX_CDESC_MBZ6_MASK,
+					  ENA_ETH_IO_TX_CDESC_MBZ6_SHIFT));
+	}
+}
+
+struct ena_eth_io_tx_cdesc *ena_com_tx_cdesc_idx_to_ptr(struct ena_com_io_cq *io_cq, u16 idx)
+{
+	idx &= (io_cq->q_depth - 1);
+
+	return (struct ena_eth_io_tx_cdesc *)
+		((uintptr_t)io_cq->cdesc_addr.virt_addr +
+		idx * io_cq->cdesc_entry_size_in_bytes);
+}
+
 static void *get_sq_desc_regular_queue(struct ena_com_io_sq *io_sq)
 {
 	u16 tail_masked;
@@ -228,7 +276,7 @@ static int ena_com_sq_update_tail(struct ena_com_io_sq *io_sq)
 	return ena_com_sq_update_reqular_queue_tail(io_sq);
 }
 
-static struct ena_eth_io_rx_cdesc_base *
+struct ena_eth_io_rx_cdesc_base *
 	ena_com_rx_cdesc_idx_to_ptr(struct ena_com_io_cq *io_cq, u16 idx)
 {
 	idx &= (io_cq->q_depth - 1);
@@ -254,7 +302,6 @@ static int ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq,
 			break;
 		status = READ_ONCE32(cdesc->status);
 
-		ena_com_cq_inc_head(io_cq);
 		if (unlikely((status & ENA_ETH_IO_RX_CDESC_BASE_FIRST_MASK) >>
 		    ENA_ETH_IO_RX_CDESC_BASE_FIRST_SHIFT && count != 0)) {
 			ena_trc_err(dev,
@@ -272,6 +319,7 @@ static int ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq,
 			return ENA_COM_FAULT;
 		}
 
+		ena_com_cq_inc_head(io_cq);
 		count++;
 		last = (status & ENA_ETH_IO_RX_CDESC_BASE_LAST_MASK) >>
 			ENA_ETH_IO_RX_CDESC_BASE_LAST_SHIFT;
drivers/net/ena/base/ena_eth_com.h +8 -0
index 2fac10e678..4e3d0fb6fd 100644
@@ -16,6 +16,14 @@ extern "C" {
 #define ENA_LLQ_HEADER		(128UL - ENA_LLQ_ENTRY_DESC_CHUNK_SIZE)
 #define ENA_LLQ_LARGE_HEADER	(256UL - ENA_LLQ_ENTRY_DESC_CHUNK_SIZE)
 
+void ena_com_dump_single_rx_cdesc(struct ena_com_io_cq *io_cq,
+				  struct ena_eth_io_rx_cdesc_base *desc);
+void ena_com_dump_single_tx_cdesc(struct ena_com_io_cq *io_cq,
+				  struct ena_eth_io_tx_cdesc *desc);
+struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc(struct ena_com_io_cq *io_cq);
+struct ena_eth_io_rx_cdesc_base *ena_com_rx_cdesc_idx_to_ptr(struct ena_com_io_cq *io_cq, u16 idx);
+struct ena_eth_io_tx_cdesc *ena_com_tx_cdesc_idx_to_ptr(struct ena_com_io_cq *io_cq, u16 idx);
+
 struct ena_com_tx_ctx {
 	struct ena_com_tx_meta ena_meta;
 	struct ena_com_buf *ena_bufs;
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/15 net/ena/base: remove unused param

In reply to [email protected]

From: Shai Brandes <[email protected]>

Remove an unused dev_node parameter when allocating DMA memory.

---
 drivers/net/ena/base/ena_com.c       |  9 ++-------
 drivers/net/ena/base/ena_plat_dpdk.h | 11 +++++------
 2 files changed, 7 insertions(+), 13 deletions(-)
drivers/net/ena/base/ena_com.c +2 -7
index 24756e5e76..9e1fa40c0c 100644
@@ -328,7 +328,6 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
 			      struct ena_com_io_sq *io_sq)
 {
 	size_t size;
-	int dev_node = 0;
 
 	memset(&io_sq->desc_addr, 0x0, sizeof(io_sq->desc_addr));
 
@@ -347,8 +346,7 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
 					    io_sq->desc_addr.virt_addr,
 					    io_sq->desc_addr.phys_addr,
 					    io_sq->desc_addr.mem_handle,
-					    ctx->numa_node,
-					    dev_node);
+					    ctx->numa_node);
 		if (!io_sq->desc_addr.virt_addr) {
 			ENA_MEM_ALLOC_COHERENT(ena_dev->dmadev,
 					       size,
@@ -377,8 +375,7 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
 		ENA_MEM_ALLOC_NODE(ena_dev->dmadev,
 				   size,
 				   io_sq->bounce_buf_ctrl.base_buffer,
-				   ctx->numa_node,
-				   dev_node);
+				   ctx->numa_node);
 		if (!io_sq->bounce_buf_ctrl.base_buffer)
 			io_sq->bounce_buf_ctrl.base_buffer = ENA_MEM_ALLOC(ena_dev->dmadev, size);
 
@@ -417,7 +414,6 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev,
 			      struct ena_com_io_cq *io_cq)
 {
 	size_t size;
-	int prev_node = 0;
 
 	memset(&io_cq->cdesc_addr, 0x0, sizeof(io_cq->cdesc_addr));
 
@@ -436,7 +432,6 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev,
 					    io_cq->cdesc_addr.phys_addr,
 					    io_cq->cdesc_addr.mem_handle,
 					    ctx->numa_node,
-					    prev_node,
 					    ENA_CDESC_RING_SIZE_ALIGNMENT);
 	if (!io_cq->cdesc_addr.virt_addr) {
 		ENA_MEM_ALLOC_COHERENT_ALIGNED(ena_dev->dmadev,
drivers/net/ena/base/ena_plat_dpdk.h +5 -6
index dffe60705d..eaa509bc2a 100644
@@ -240,23 +240,22 @@ ena_mem_alloc_coherent(struct rte_eth_dev_data *data, size_t size,
 		   rte_memzone_free(mem_handle); })
 
 #define ENA_MEM_ALLOC_COHERENT_NODE_ALIGNED(				       \
-	dmadev, size, virt, phys, mem_handle, node, dev_node, alignment)       \
+	dmadev, size, virt, phys, mem_handle, node, alignment)			\
 	do {								       \
 		void *virt_addr;					       \
 		dma_addr_t phys_addr;					       \
-		ENA_TOUCH(dev_node);					       \
 		(mem_handle) = ena_mem_alloc_coherent((dmadev), (size),	       \
 			(node), (alignment), &virt_addr, &phys_addr);      \
 		(virt) = virt_addr;					       \
 		(phys) = phys_addr;					       \
 	} while (0)
 #define ENA_MEM_ALLOC_COHERENT_NODE(					       \
-	dmadev, size, virt, phys, mem_handle, node, dev_node)		       \
+	dmadev, size, virt, phys, mem_handle, node)				\
 		ENA_MEM_ALLOC_COHERENT_NODE_ALIGNED(dmadev, size, virt,	phys,  \
-			mem_handle, node, dev_node, RTE_CACHE_LINE_SIZE)
-#define ENA_MEM_ALLOC_NODE(dmadev, size, virt, node, dev_node)		       \
+			mem_handle, node, RTE_CACHE_LINE_SIZE)
+#define ENA_MEM_ALLOC_NODE(dmadev, size, virt, node)				\
 	do {								       \
-		ENA_TOUCH(dmadev); ENA_TOUCH(dev_node);			       \
+		ENA_TOUCH(dmadev);						\
 		virt = rte_zmalloc_socket(NULL, size, 0, node);		       \
 	} while (0)
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/15 net/ena/base: remove redundant assert checks

In reply to [email protected]

From: Shai Brandes <[email protected]>

Remove ENA_WARN checks from ena_com_wait_and_process_admin_cq_polling since once the execution flow reaches the check, it must be ENA_CMD_COMPLETED because it can't be either of the other options:
1. ENA_CMD_ABORTED - in such case it will perform "goto err" in the "if" block above, thus skipping the ENA_WARN check.
2. ENA_CMD_SUBMITTED - in such case it will timeout inside the while(1) loop above and perform "goto err", thus skipping the ENA_WARN check.

Remove ENA_WARN check from ena_com_wait_and_process_admin_cq_interrupts since once the execution flow reaches the check, it must be ENA_CMD_COMPLETED because it can't be either of the other options:
1. ENA_CMD_ABORTED - same as above, i will perform "goto err" in the "if" block above, thus skipping the ENA_WARN check.
2. ENA_CMD_SUBMITTED - in such case it will perform "goto err" in the nested if block above, since "admin_queue->polling" is false (because of the interrupt mode execution of admin commands)

---
 drivers/net/ena/base/ena_com.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/net/ena/base/ena_com.c +0 -8
index 9e1fa40c0c..f9dd086484 100644
@@ -598,10 +598,6 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c
 		goto err;
 	}
 
-	ENA_WARN(comp_ctx->status != ENA_CMD_COMPLETED,
-		 admin_queue->ena_dev, "Invalid comp status %d\n",
-		 comp_ctx->status);
-
 	ret = ena_com_comp_status_to_errno(admin_queue, comp_ctx->comp_status);
 err:
 	comp_ctxt_release(admin_queue, comp_ctx);
@@ -828,10 +824,6 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *com
 		goto err;
 	}
 
-	ENA_WARN(comp_ctx->status != ENA_CMD_COMPLETED,
-		 admin_queue->ena_dev, "Invalid comp status %d\n",
-		 comp_ctx->status);
-
 	ret = ena_com_comp_status_to_errno(admin_queue, comp_ctx->comp_status);
 err:
 	comp_ctxt_release(admin_queue, comp_ctx);
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/15 net/ena/base: update memory barrier comment

In reply to [email protected]

From: Shai Brandes <[email protected]>

Update the comment above the phase bit descriptor
read in AENQ processing.

---
 drivers/net/ena/base/ena_com.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/ena/base/ena_com.c +12 -4
index f9dd086484..ad4f3f9431 100644
@@ -2409,8 +2409,12 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *ena_dev, void *data)
 	/* Go over all the events */
 	while ((READ_ONCE8(aenq_common->flags) &
 		ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) == phase) {
-		/* Make sure the device finished writing the rest of the descriptor
-		 * before reading it.
+		/* When the phase bit of the AENQ descriptor aligns with the driver's phase bit,
+		 * it signifies the readiness of the entire AENQ descriptor.
+		 * The driver should proceed to read the descriptor's data only after confirming
+		 * and synchronizing the phase bit.
+		 * This memory fence guarantees the correct sequence of accesses to the
+		 * descriptor's memory.
 		 */
 		dma_rmb();
 
@@ -2468,8 +2472,12 @@ bool ena_com_aenq_has_keep_alive(struct ena_com_dev *ena_dev)
 	/* Go over all the events */
 	while ((READ_ONCE8(aenq_common->flags) &
 		ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) == phase) {
-		/* Make sure the device finished writing the rest of the descriptor
-		 * before reading it.
+		/* When the phase bit of the AENQ descriptor aligns with the driver's phase bit,
+		 * it signifies the readiness of the entire AENQ descriptor.
+		 * The driver should proceed to read the descriptor's data only after confirming
+		 * and synchronizing the phase bit.
+		 * This memory fence guarantees the correct sequence of accesses to the
+		 * descriptor's memory.
 		 */
 		dma_rmb();
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/15 net/ena/base: add method to check used entries

In reply to [email protected]

From: Shai Brandes <[email protected]>

Provide a method to check the number of used entries in the send queue

---
 drivers/net/ena/base/ena_eth_com.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/ena/base/ena_eth_com.h +6 -7
index 4e3d0fb6fd..877668612c 100644
@@ -82,15 +82,14 @@ static inline void ena_com_unmask_intr(struct ena_com_io_cq *io_cq,
 	ENA_REG_WRITE32(io_cq->bus, intr_reg->intr_control, io_cq->unmask_reg);
 }
 
-static inline int ena_com_free_q_entries(struct ena_com_io_sq *io_sq)
+static inline u16 ena_com_used_q_entries(struct ena_com_io_sq *io_sq)
 {
-	u16 tail, next_to_comp, cnt;
-
-	next_to_comp = io_sq->next_to_comp;
-	tail = io_sq->tail;
-	cnt = tail - next_to_comp;
+	return io_sq->tail - io_sq->next_to_comp;
+}
 
-	return io_sq->q_depth - 1 - cnt;
+static inline int ena_com_free_q_entries(struct ena_com_io_sq *io_sq)
+{
+	return io_sq->q_depth - 1 - ena_com_used_q_entries(io_sq);
 }
 
 /* Check if the submission queue has enough space to hold required_buffers */
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/15 net/ena/base: add an additional reset reason

In reply to [email protected]

From: Shai Brandes <[email protected]>

This commit adds the support for a new reset reason for MISS_FIRST_INTERRUPT in order to distinguish between resets where no interrupts have been received and sporadic missed interrupts.

---
 drivers/net/ena/base/ena_defs/ena_regs_defs.h | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ena/base/ena_defs/ena_regs_defs.h +1 -0
index dd9b629f10..e12a578fac 100644
@@ -26,6 +26,7 @@ enum ena_regs_reset_reason_types {
 	ENA_REGS_RESET_TX_DESCRIPTOR_MALFORMED	    = 17,
 	ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT      = 18,
 	ENA_REGS_RESET_DEVICE_REQUEST               = 19,
+	ENA_REGS_RESET_MISS_FIRST_INTERRUPT         = 20,
 	ENA_REGS_RESET_LAST,
 };
 
Signature · 1 line
2.17.1
#7 lore raw

PATCH 7/15 net/ena/base: update copyrights comments

In reply to [email protected]

From: Shai Brandes <[email protected]>

copyright dates are not mandatory to be maintained, therefore the range of years was removed. In addition, the copyrights lines were separated into two comments.

---
 drivers/net/ena/base/ena_com.c                  | 4 ++--
 drivers/net/ena/base/ena_com.h                  | 4 ++--
 drivers/net/ena/base/ena_defs/ena_admin_defs.h  | 5 +++--
 drivers/net/ena/base/ena_defs/ena_common_defs.h | 4 ++--
 drivers/net/ena/base/ena_defs/ena_eth_io_defs.h | 5 +++--
 drivers/net/ena/base/ena_defs/ena_includes.h    | 4 ++--
 drivers/net/ena/base/ena_defs/ena_regs_defs.h   | 4 ++--
 drivers/net/ena/base/ena_eth_com.c              | 4 ++--
 drivers/net/ena/base/ena_eth_com.h              | 4 ++--
 drivers/net/ena/base/ena_plat.h                 | 4 ++--
 drivers/net/ena/base/ena_plat_dpdk.h            | 4 ++--
 11 files changed, 24 insertions(+), 22 deletions(-)
drivers/net/ena/base/ena_com.c +2 -2
index ad4f3f9431..5f46e692b3 100644
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 
drivers/net/ena/base/ena_com.h +2 -2
index 737747f64b..5d38b69c0f 100644
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 
drivers/net/ena/base/ena_defs/ena_admin_defs.h +3 -2
index cff6451c96..8a1bb0bb76 100644
@@ -1,7 +1,8 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
+
 #ifndef _ENA_ADMIN_H_
 #define _ENA_ADMIN_H_
 
drivers/net/ena/base/ena_defs/ena_common_defs.h +2 -2
index d1ee40de32..ed5359cb99 100644
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 
drivers/net/ena/base/ena_defs/ena_eth_io_defs.h +3 -2
index f811dd261e..c93cd85632 100644
@@ -1,7 +1,8 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
+
 #ifndef _ENA_ETH_IO_H_
 #define _ENA_ETH_IO_H_
 
drivers/net/ena/base/ena_defs/ena_includes.h +2 -2
index 20dba04d52..4bcb1e3a4a 100644
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 
drivers/net/ena/base/ena_defs/ena_regs_defs.h +2 -2
index e12a578fac..823dccd841 100644
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 #ifndef _ENA_REGS_H_
drivers/net/ena/base/ena_eth_com.c +2 -2
index 9ba0beb868..e26678827c 100644
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 
drivers/net/ena/base/ena_eth_com.h +2 -2
index 877668612c..f91cf67c09 100644
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 
drivers/net/ena/base/ena_plat.h +2 -2
index abd2d8b6c4..52104f3029 100644
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 
drivers/net/ena/base/ena_plat_dpdk.h +2 -2
index eaa509bc2a..87f7083ce9 100644
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 
Signature · 1 line
2.17.1
#8 lore raw

Re: [PATCH 07/15] net/ena/base: update copyrights comments

Quoted 27 lines · On 7/2/2024 3:46 PM, [email protected] wrote:

From: Shai Brandes <[email protected]>

copyright dates are not mandatory to be maintained, therefore the range of years was removed. In addition, the copyrights lines were separated into two comments.

---
 drivers/net/ena/base/ena_com.c                  | 4 ++--
 drivers/net/ena/base/ena_com.h                  | 4 ++--
 drivers/net/ena/base/ena_defs/ena_admin_defs.h  | 5 +++--
 drivers/net/ena/base/ena_defs/ena_common_defs.h | 4 ++--
 drivers/net/ena/base/ena_defs/ena_eth_io_defs.h | 5 +++--
 drivers/net/ena/base/ena_defs/ena_includes.h    | 4 ++--
 drivers/net/ena/base/ena_defs/ena_regs_defs.h   | 4 ++--
 drivers/net/ena/base/ena_eth_com.c              | 4 ++--
 drivers/net/ena/base/ena_eth_com.h              | 4 ++--
 drivers/net/ena/base/ena_plat.h                 | 4 ++--
 drivers/net/ena/base/ena_plat_dpdk.h            | 4 ++--
 11 files changed, 24 insertions(+), 22 deletions(-)
drivers/net/ena/base/ena_com.c +0 -0
index ad4f3f9431..5f46e692b3 100644

drivers/net/ena/base/ena_com.c line 5

Quoted 7 lines
drivers/net/ena/base/ena_com.c +2 -2
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  */
 

Hi Shai,

I don't know about implication of dropping the copyright year altogether, we need to ask to an expert.

What I know is, a copyright expires after some year, so to hold the copyright, there needs to be a starting point. And people use ranges to extend this copyright year.

Instead of removing the year altogether, it make sense to me to just keep the initial year and don't add range later as code updated, this also will be more consistent with rest of the code.
Let me drop this patch from the set, and learn more from the experts. It can be included later, I don't think this is something urgent.

Another aspect is, the history of a source file can be acquired from the pubic git repository, so when it is first merged, when updated, all these information is available.
So this feels like no need to record these days in the source code files but I don't know if these git repository metadata information is legally
valid and accepted.

And I am not quite sure if it has really any value to worry about copyright for a publicly available device driver code anyway, but this is not my domain.

#9 lore raw

Re: [PATCH 07/15] net/ena/base: update copyrights comments

Quoted 60 lines · Ferruh Yigit
Quoted 27 lines · On 7/2/2024 3:46 PM, [email protected] wrote:

From: Shai Brandes <[email protected]>

copyright dates are not mandatory to be maintained, therefore the range of years was removed. In addition, the copyrights lines were separated into two comments.

---
  drivers/net/ena/base/ena_com.c                  | 4 ++--
  drivers/net/ena/base/ena_com.h                  | 4 ++--
  drivers/net/ena/base/ena_defs/ena_admin_defs.h  | 5 +++--
  drivers/net/ena/base/ena_defs/ena_common_defs.h | 4 ++--
  drivers/net/ena/base/ena_defs/ena_eth_io_defs.h | 5 +++--
  drivers/net/ena/base/ena_defs/ena_includes.h    | 4 ++--
  drivers/net/ena/base/ena_defs/ena_regs_defs.h   | 4 ++--
  drivers/net/ena/base/ena_eth_com.c              | 4 ++--
  drivers/net/ena/base/ena_eth_com.h              | 4 ++--
  drivers/net/ena/base/ena_plat.h                 | 4 ++--
  drivers/net/ena/base/ena_plat_dpdk.h            | 4 ++--
  11 files changed, 24 insertions(+), 22 deletions(-)
drivers/net/ena/base/ena_com.c +0 -0
index ad4f3f9431..5f46e692b3 100644

drivers/net/ena/base/ena_com.c line 5

Quoted 7 lines
drivers/net/ena/base/ena_com.c +2 -2
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
   * All rights reserved.
   */
 

Hi Shai,

I don't know about implication of dropping the copyright year altogether, we need to ask to an expert.

What I know is, a copyright expires after some year, so to hold the copyright, there needs to be a starting point. And people use ranges to extend this copyright year.

Instead of removing the year altogether, it make sense to me to just keep the initial year and don't add range later as code updated, this also will be more consistent with rest of the code.
Let me drop this patch from the set, and learn more from the experts. It can be included later, I don't think this is something urgent.

Another aspect is, the history of a source file can be acquired from the pubic git repository, so when it is first merged, when updated, all these information is available.
So this feels like no need to record these days in the source code files but I don't know if these git repository metadata information is legally
valid and accepted.

Quoted 3 lines

And I am not quite sure if it has really any value to worry about copyright for a publicly available device driver code anyway, but this is not my domain.

Hi Shai,

    Will you please just update the copyright year instead of removing the year completely?  e.g. 2015-2020, 2024 or 2015-2024

-Hemant

#10 lore raw

RE: [PATCH 07/15] net/ena/base: update copyrights comments

Quoted 81 lines

-----Original Message-----
From: Hemant Agrawal <[email protected]>
Sent: Monday, July 8, 2024 7:09 AM
To: Ferruh Yigit <[email protected]>; Brandes, Shai <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: RE: [EXTERNAL] [PATCH 07/15] net/ena/base: update copyrights comments

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 59 lines · Ferruh Yigit
Quoted 26 lines · On 7/2/2024 3:46 PM, [email protected] wrote:

From: Shai Brandes <[email protected]>

copyright dates are not mandatory to be maintained, therefore the range of years was removed.
In addition, the copyrights lines were separated into two comments.

---
  drivers/net/ena/base/ena_com.c                  | 4 ++--
  drivers/net/ena/base/ena_com.h                  | 4 ++--
  drivers/net/ena/base/ena_defs/ena_admin_defs.h  | 5 +++--
  drivers/net/ena/base/ena_defs/ena_common_defs.h | 4 ++--
  drivers/net/ena/base/ena_defs/ena_eth_io_defs.h | 5 +++--
  drivers/net/ena/base/ena_defs/ena_includes.h    | 4 ++--
  drivers/net/ena/base/ena_defs/ena_regs_defs.h   | 4 ++--
  drivers/net/ena/base/ena_eth_com.c              | 4 ++--
  drivers/net/ena/base/ena_eth_com.h              | 4 ++--
  drivers/net/ena/base/ena_plat.h                 | 4 ++--
  drivers/net/ena/base/ena_plat_dpdk.h            | 4 ++--
  11 files changed, 24 insertions(+), 22 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ena/base/ena_com.c index ad4f3f9431..5f46e692b3 100644

drivers/net/ena/base/ena_com.c line 5

Quoted 7 lines
drivers/net/ena/base/ena_com.c +2 -2
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
   * All rights reserved.
   */
 

Hi Shai,

I don't know about implication of dropping the copyright year altogether, we need to ask to an expert.

What I know is, a copyright expires after some year, so to hold the copyright, there needs to be a starting point. And people use ranges to extend this copyright year.

Instead of removing the year altogether, it make sense to me to just keep the initial year and don't add range later as code updated, this also will be more consistent with rest of the code.
Let me drop this patch from the set, and learn more from the experts. It can be included later, I don't think this is something urgent.

Another aspect is, the history of a source file can be acquired from the pubic git repository, so when it is first merged, when updated, all these information is available.
So this feels like no need to record these days in the source code files but I don't know if these git repository metadata information is legally
valid and accepted.

Quoted 3 lines

And I am not quite sure if it has really any value to worry about copyright for a publicly available device driver code anyway, but this is not my domain.

Quoted 6 lines

Hi Shai,

Will you please just update the copyright year instead of removing the
year completely? e.g. 2015-2020, 2024 or 2015-2024

-Hemant

[Brandes, Shai]
Hi Ferruh and Hemant, aws removed the copyrights' years range completely for all our open source drivers based on our legal team and the open source article that states that there is no need to provide years or ranges of years for copyright notices in an OSS project.
https://www.linuxfoundation.org/blog/blog/copyright-notices-in-open-source-software-projects
leaving this patch out or using a different years range will create code difference between the dpdk driver and the HAL code it consumes, which is common to all ENA drivers (which is less maintainable.)
Thanks,
Shai

#11 lore raw

Re: [PATCH 07/15] net/ena/base: update copyrights comments

Quoted 83 lines · Shai
Quoted 83 lines

-----Original Message-----
From: Hemant Agrawal <[email protected]>
Sent: Monday, July 8, 2024 7:09 AM
To: Ferruh Yigit <[email protected]>; Brandes, Shai <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: RE: [EXTERNAL] [PATCH 07/15] net/ena/base: update copyrights comments

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 59 lines · Ferruh Yigit
Quoted 26 lines · On 7/2/2024 3:46 PM, [email protected] wrote:

From: Shai Brandes <[email protected]>

copyright dates are not mandatory to be maintained, therefore the range of years was removed.
In addition, the copyrights lines were separated into two comments.

---
  drivers/net/ena/base/ena_com.c                  | 4 ++--
  drivers/net/ena/base/ena_com.h                  | 4 ++--
  drivers/net/ena/base/ena_defs/ena_admin_defs.h  | 5 +++--
  drivers/net/ena/base/ena_defs/ena_common_defs.h | 4 ++--
  drivers/net/ena/base/ena_defs/ena_eth_io_defs.h | 5 +++--
  drivers/net/ena/base/ena_defs/ena_includes.h    | 4 ++--
  drivers/net/ena/base/ena_defs/ena_regs_defs.h   | 4 ++--
  drivers/net/ena/base/ena_eth_com.c              | 4 ++--
  drivers/net/ena/base/ena_eth_com.h              | 4 ++--
  drivers/net/ena/base/ena_plat.h                 | 4 ++--
  drivers/net/ena/base/ena_plat_dpdk.h            | 4 ++--
  11 files changed, 24 insertions(+), 22 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ena/base/ena_com.c index ad4f3f9431..5f46e692b3 100644

drivers/net/ena/base/ena_com.c line 5

Quoted 7 lines
drivers/net/ena/base/ena_com.c +2 -2
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
   * All rights reserved.
   */
 

Hi Shai,

I don't know about implication of dropping the copyright year altogether, we need to ask to an expert.

What I know is, a copyright expires after some year, so to hold the copyright, there needs to be a starting point. And people use ranges to extend this copyright year.

Instead of removing the year altogether, it make sense to me to just keep the initial year and don't add range later as code updated, this also will be more consistent with rest of the code.
Let me drop this patch from the set, and learn more from the experts. It can be included later, I don't think this is something urgent.

Another aspect is, the history of a source file can be acquired from the pubic git repository, so when it is first merged, when updated, all these information is available.
So this feels like no need to record these days in the source code files but I don't know if these git repository metadata information is legally
valid and accepted.

Quoted 3 lines

And I am not quite sure if it has really any value to worry about copyright for a publicly available device driver code anyway, but this is not my domain.

Hi Shai,

Quoted 9 lines
Quoted 4 lines

Will you please just update the copyright year instead of removing the
year completely? e.g. 2015-2020, 2024 or 2015-2024

-Hemant

[Brandes, Shai]
Hi Ferruh and Hemant, aws removed the copyrights' years range completely for all our open source drivers based on our legal team and the open source article that states that there is no need to provide years or ranges of years for copyright notices in an OSS project.
https://www.linuxfoundation.org/blog/blog/copyright-notices-in-open-source-software-projects
leaving this patch out or using a different years range will create code difference between the dpdk driver and the HAL code it consumes, which is common to all ENA drivers (which is less maintainable.)

Hi Shai,

I made the comment to make sure you are protected, but if this is the request coming from your legal team I think you already know what you are doing and I am OK to continue with the patch.

By the way, thanks for the blog, it can be reference for future discussions.

#12 lore raw

RE: [PATCH 07/15] net/ena/base: update copyrights comments

Quoted 120 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, July 8, 2024 11:38 AM
To: Brandes, Shai <[email protected]>; Hemant Agrawal <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>; [email protected]
Subject: RE: [EXTERNAL] [PATCH 07/15] net/ena/base: update copyrights comments

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 70 lines · Shai
Quoted 70 lines

-----Original Message-----
From: Hemant Agrawal <[email protected]>
Sent: Monday, July 8, 2024 7:09 AM
To: Ferruh Yigit <[email protected]>; Brandes, Shai <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: RE: [EXTERNAL] [PATCH 07/15] net/ena/base: update copyrights comments

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 52 lines · Ferruh Yigit
Quoted 27 lines · On 7/2/2024 3:46 PM, [email protected] wrote:

From: Shai Brandes <[email protected]>

copyright dates are not mandatory to be maintained, therefore the range of years was removed.
In addition, the copyrights lines were separated into two comments.

---
  drivers/net/ena/base/ena_com.c                  | 4 ++--
  drivers/net/ena/base/ena_com.h                  | 4 ++--
  drivers/net/ena/base/ena_defs/ena_admin_defs.h  | 5 +++--
  drivers/net/ena/base/ena_defs/ena_common_defs.h | 4 ++--
  drivers/net/ena/base/ena_defs/ena_eth_io_defs.h | 5 +++--
  drivers/net/ena/base/ena_defs/ena_includes.h    | 4 ++--
  drivers/net/ena/base/ena_defs/ena_regs_defs.h   | 4 ++--
  drivers/net/ena/base/ena_eth_com.c              | 4 ++--
  drivers/net/ena/base/ena_eth_com.h              | 4 ++--
  drivers/net/ena/base/ena_plat.h                 | 4 ++--
  drivers/net/ena/base/ena_plat_dpdk.h            | 4 ++--
  11 files changed, 24 insertions(+), 22 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ena/base/ena_com.c index ad4f3f9431..5f46e692b3 100644

drivers/net/ena/base/ena_com.c line 5

Quoted 7 lines
drivers/net/ena/base/ena_com.c +2 -2
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) Amazon.com, Inc. or its affiliates.
   * All rights reserved.
   */
 

Hi Shai,

I don't know about implication of dropping the copyright year altogether, we need to ask to an expert.

What I know is, a copyright expires after some year, so to hold the copyright, there needs to be a starting point. And people use ranges to extend this copyright year.

Instead of removing the year altogether, it make sense to me to just keep the initial year and don't add range later as code updated, this also will be more consistent with rest of the code. Let me drop this patch from the set, and learn more from the experts. It can be included later, I don't think this is something urgent.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Another aspect is, the history of a source file can be acquired from the pubic git repository, so when it is first merged, when updated, all these information is available.
So this feels like no need to record these days in the source code files but I don't know if these git repository metadata information is

legally

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

valid and accepted.

And I am not quite sure if it has really any value to worry about copyright for a publicly available device driver code anyway, but this is not my domain.

Quoted 8 lines
Quoted 6 lines

Hi Shai,

Will you please just update the copyright year instead of
removing the year completely? e.g. 2015-2020, 2024 or 2015-2024

-Hemant

[Brandes, Shai]
Hi Ferruh and Hemant, aws removed the copyrights' years range

completely for all our open source drivers based on our legal team and the open source article that states that there is no need to provide years or ranges of years for copyright notices in an OSS project.

Quoted 6 lines

https://www.linuxfoundation.org/blog/blog/copyright-notices-in-open-so
urce-software-projects leaving this patch out or using a different years range will create code difference between the dpdk driver and the HAL code it consumes, which is common to all ENA drivers (which is less maintainable.)

Quoted 9 lines

Hi Shai,

I made the comment to make sure you are protected, but if this is the request coming from your legal team I think you already know what you are doing and I am OK to continue with the patch.

By the way, thanks for the blog, it can be reference for future discussions.

[Brandes, Shai] sure thing. And thank you! I appreciate the time you invested for reviewing the patchset.

#14 lore raw

PATCH 8/15 net/ena/base: add macro for bitfield access

In reply to [email protected]

From: Shai Brandes <[email protected]>

Add ENA_FIELD_GET and ENA_FIELD_PREP macro to make access to fields more readable.

---
 drivers/net/ena/base/ena_com.c       | 111 ++++++++++++--------
 drivers/net/ena/base/ena_com.h       |  10 +-
 drivers/net/ena/base/ena_eth_com.c   | 146 +++++++++++++++------------
 drivers/net/ena/base/ena_eth_com.h   |   8 +-
 drivers/net/ena/base/ena_plat_dpdk.h |   3 +
 5 files changed, 165 insertions(+), 113 deletions(-)
drivers/net/ena/base/ena_com.c +68 -43
index 5f46e692b3..e5f1a31c9e 100644
@@ -162,10 +162,13 @@ static int ena_com_admin_init_aenq(struct ena_com_dev *ena_dev,
 	ENA_REG_WRITE32(ena_dev->bus, addr_high, ena_dev->reg_bar + ENA_REGS_AENQ_BASE_HI_OFF);
 
 	aenq_caps = 0;
-	aenq_caps |= ena_dev->aenq.q_depth & ENA_REGS_AENQ_CAPS_AENQ_DEPTH_MASK;
-	aenq_caps |= (sizeof(struct ena_admin_aenq_entry) <<
-		ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_SHIFT) &
-		ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_MASK;
+	aenq_caps |= ENA_FIELD_PREP(ena_dev->aenq.q_depth,
+				    ENA_REGS_AENQ_CAPS_AENQ_DEPTH_MASK,
+				    ENA_ZERO_SHIFT);
+
+	aenq_caps |= ENA_FIELD_PREP(sizeof(struct ena_admin_aenq_entry),
+				    ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_MASK,
+				    ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_SHIFT);
 	ENA_REG_WRITE32(ena_dev->bus, aenq_caps, ena_dev->reg_bar + ENA_REGS_AENQ_CAPS_OFF);
 
 	if (unlikely(!aenq_handlers)) {
@@ -856,8 +859,9 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
 	mmio_read->seq_num++;
 
 	read_resp->req_id = mmio_read->seq_num + 0xDEAD;
-	mmio_read_reg = (offset << ENA_REGS_MMIO_REG_READ_REG_OFF_SHIFT) &
-			ENA_REGS_MMIO_REG_READ_REG_OFF_MASK;
+	mmio_read_reg = ENA_FIELD_PREP(offset,
+				       ENA_REGS_MMIO_REG_READ_REG_OFF_MASK,
+				       ENA_REGS_MMIO_REG_READ_REG_OFF_SHIFT);
 	mmio_read_reg |= mmio_read->seq_num &
 			ENA_REGS_MMIO_REG_READ_REQ_ID_MASK;
 
@@ -927,9 +931,10 @@ static int ena_com_destroy_io_sq(struct ena_com_dev *ena_dev,
 	else
 		direction = ENA_ADMIN_SQ_DIRECTION_RX;
 
-	destroy_cmd.sq.sq_identity |= (direction <<
-		ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT) &
-		ENA_ADMIN_SQ_SQ_DIRECTION_MASK;
+	destroy_cmd.sq.sq_identity |=
+		ENA_FIELD_PREP(direction,
+			       ENA_ADMIN_SQ_SQ_DIRECTION_MASK,
+			       ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT);
 
 	destroy_cmd.sq.sq_idx = io_sq->idx;
 	destroy_cmd.aq_common_descriptor.opcode = ENA_ADMIN_DESTROY_SQ;
@@ -1267,16 +1272,18 @@ static int ena_com_create_io_sq(struct ena_com_dev *ena_dev,
 	else
 		direction = ENA_ADMIN_SQ_DIRECTION_RX;
 
-	create_cmd.sq_identity |= (direction <<
-		ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT) &
-		ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK;
+	create_cmd.sq_identity |=
+		ENA_FIELD_PREP(direction,
+			       ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK,
+			       ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT);
 
 	create_cmd.sq_caps_2 |= io_sq->mem_queue_type &
 		ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK;
 
-	create_cmd.sq_caps_2 |= (ENA_ADMIN_COMPLETION_POLICY_DESC <<
-		ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT) &
-		ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK;
+	create_cmd.sq_caps_2 |=
+		ENA_FIELD_PREP(ENA_ADMIN_COMPLETION_POLICY_DESC,
+			       ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK,
+			       ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT);
 
 	create_cmd.sq_caps_3 |=
 		ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK;
@@ -1616,8 +1623,9 @@ int ena_com_get_dma_width(struct ena_com_dev *ena_dev)
 		return ENA_COM_TIMER_EXPIRED;
 	}
 
-	width = (caps & ENA_REGS_CAPS_DMA_ADDR_WIDTH_MASK) >>
-		ENA_REGS_CAPS_DMA_ADDR_WIDTH_SHIFT;
+	width = ENA_FIELD_GET(caps,
+			      ENA_REGS_CAPS_DMA_ADDR_WIDTH_MASK,
+			      ENA_REGS_CAPS_DMA_ADDR_WIDTH_SHIFT);
 
 	ena_trc_dbg(ena_dev, "ENA dma width: %d\n", width);
 
@@ -1651,18 +1659,26 @@ int ena_com_validate_version(struct ena_com_dev *ena_dev)
 	}
 
 	ena_trc_info(ena_dev, "ENA device version: %d.%d\n",
-		     (ver & ENA_REGS_VERSION_MAJOR_VERSION_MASK) >>
-		     ENA_REGS_VERSION_MAJOR_VERSION_SHIFT,
-		     ver & ENA_REGS_VERSION_MINOR_VERSION_MASK);
+		     ENA_FIELD_GET(ver,
+				   ENA_REGS_VERSION_MAJOR_VERSION_MASK,
+				   ENA_REGS_VERSION_MAJOR_VERSION_SHIFT),
+		     ENA_FIELD_GET(ver,
+				   ENA_REGS_VERSION_MINOR_VERSION_MASK,
+				   ENA_ZERO_SHIFT));
 
 	ena_trc_info(ena_dev, "ENA controller version: %d.%d.%d implementation version %d\n",
-		     (ctrl_ver & ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK)
-		     >> ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_SHIFT,
-		     (ctrl_ver & ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_MASK)
-		     >> ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_SHIFT,
-		     (ctrl_ver & ENA_REGS_CONTROLLER_VERSION_SUBMINOR_VERSION_MASK),
-		     (ctrl_ver & ENA_REGS_CONTROLLER_VERSION_IMPL_ID_MASK) >>
-		     ENA_REGS_CONTROLLER_VERSION_IMPL_ID_SHIFT);
+		     ENA_FIELD_GET(ctrl_ver,
+				   ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK,
+				   ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_SHIFT),
+		     ENA_FIELD_GET(ctrl_ver,
+				   ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_MASK,
+				   ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_SHIFT),
+		     ENA_FIELD_GET(ctrl_ver,
+				   ENA_REGS_CONTROLLER_VERSION_SUBMINOR_VERSION_MASK,
+				   ENA_ZERO_SHIFT),
+		     ENA_FIELD_GET(ctrl_ver,
+				   ENA_REGS_CONTROLLER_VERSION_IMPL_ID_MASK,
+				   ENA_REGS_CONTROLLER_VERSION_IMPL_ID_SHIFT));
 
 	ctrl_ver_masked =
 		(ctrl_ver & ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK) |
@@ -2117,16 +2133,20 @@ int ena_com_admin_init(struct ena_com_dev *ena_dev,
 	ENA_REG_WRITE32(ena_dev->bus, addr_high, ena_dev->reg_bar + ENA_REGS_ACQ_BASE_HI_OFF);
 
 	aq_caps = 0;
-	aq_caps |= admin_queue->q_depth & ENA_REGS_AQ_CAPS_AQ_DEPTH_MASK;
-	aq_caps |= (sizeof(struct ena_admin_aq_entry) <<
-			ENA_REGS_AQ_CAPS_AQ_ENTRY_SIZE_SHIFT) &
-			ENA_REGS_AQ_CAPS_AQ_ENTRY_SIZE_MASK;
+	aq_caps |= ENA_FIELD_PREP(admin_queue->q_depth,
+				  ENA_REGS_AQ_CAPS_AQ_DEPTH_MASK,
+				  ENA_ZERO_SHIFT);
+	aq_caps |= ENA_FIELD_PREP(sizeof(struct ena_admin_aq_entry),
+				 ENA_REGS_AQ_CAPS_AQ_ENTRY_SIZE_MASK,
+				 ENA_REGS_AQ_CAPS_AQ_ENTRY_SIZE_SHIFT);
 
 	acq_caps = 0;
-	acq_caps |= admin_queue->q_depth & ENA_REGS_ACQ_CAPS_ACQ_DEPTH_MASK;
-	acq_caps |= (sizeof(struct ena_admin_acq_entry) <<
-		ENA_REGS_ACQ_CAPS_ACQ_ENTRY_SIZE_SHIFT) &
-		ENA_REGS_ACQ_CAPS_ACQ_ENTRY_SIZE_MASK;
+	acq_caps |= ENA_FIELD_PREP(admin_queue->q_depth,
+				   ENA_REGS_ACQ_CAPS_ACQ_DEPTH_MASK,
+				   ENA_ZERO_SHIFT);
+	acq_caps |= ENA_FIELD_PREP(sizeof(struct ena_admin_acq_entry),
+				   ENA_REGS_ACQ_CAPS_ACQ_ENTRY_SIZE_MASK,
+				   ENA_REGS_ACQ_CAPS_ACQ_ENTRY_SIZE_SHIFT);
 
 	ENA_REG_WRITE32(ena_dev->bus, aq_caps, ena_dev->reg_bar + ENA_REGS_AQ_CAPS_OFF);
 	ENA_REG_WRITE32(ena_dev->bus, acq_caps, ena_dev->reg_bar + ENA_REGS_ACQ_CAPS_OFF);
@@ -2521,8 +2541,9 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
 		return ENA_COM_INVAL;
 	}
 
-	timeout = (cap & ENA_REGS_CAPS_RESET_TIMEOUT_MASK) >>
-			ENA_REGS_CAPS_RESET_TIMEOUT_SHIFT;
+	timeout = ENA_FIELD_GET(cap,
+				ENA_REGS_CAPS_RESET_TIMEOUT_MASK,
+				ENA_REGS_CAPS_RESET_TIMEOUT_SHIFT);
 	if (timeout == 0) {
 		ena_trc_err(ena_dev, "Invalid timeout value\n");
 		return ENA_COM_INVAL;
@@ -2534,10 +2555,12 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
 	/* For backward compatibility, device will interpret
 	 * bits 24-27 as MSB, bits 28-31 as LSB
 	 */
-	reset_reason_lsb = ENA_FIELD_GET(reset_reason, ENA_RESET_REASON_LSB_MASK,
+	reset_reason_lsb = ENA_FIELD_GET(reset_reason,
+					 ENA_RESET_REASON_LSB_MASK,
 					 ENA_RESET_REASON_LSB_OFFSET);
 
-	reset_reason_msb = ENA_FIELD_GET(reset_reason, ENA_RESET_REASON_MSB_MASK,
+	reset_reason_msb = ENA_FIELD_GET(reset_reason,
+					 ENA_RESET_REASON_MSB_MASK,
 					 ENA_RESET_REASON_MSB_OFFSET);
 
 	reset_val |= reset_reason_lsb << ENA_REGS_DEV_CTL_RESET_REASON_SHIFT;
@@ -2549,8 +2572,9 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
 		 * extended reset reason fallback to generic
 		 */
 		reset_val = ENA_REGS_DEV_CTL_DEV_RESET_MASK;
-		reset_val |= (ENA_REGS_RESET_GENERIC << ENA_REGS_DEV_CTL_RESET_REASON_SHIFT) &
-			      ENA_REGS_DEV_CTL_RESET_REASON_MASK;
+		reset_val |= ENA_FIELD_PREP(ENA_REGS_RESET_GENERIC,
+					    ENA_REGS_DEV_CTL_RESET_REASON_MASK,
+					    ENA_REGS_DEV_CTL_RESET_REASON_SHIFT);
 	}
 	ENA_REG_WRITE32(ena_dev->bus, reset_val, ena_dev->reg_bar + ENA_REGS_DEV_CTL_OFF);
 
@@ -2572,8 +2596,9 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
 		return rc;
 	}
 
-	timeout = (cap & ENA_REGS_CAPS_ADMIN_CMD_TO_MASK) >>
-		ENA_REGS_CAPS_ADMIN_CMD_TO_SHIFT;
+	timeout = ENA_FIELD_GET(cap,
+				ENA_REGS_CAPS_ADMIN_CMD_TO_MASK,
+				ENA_REGS_CAPS_ADMIN_CMD_TO_SHIFT);
 	if (timeout)
 		/* the resolution of timeout reg is 100ms */
 		ena_dev->admin_queue.completion_timeout = timeout * 100000;
drivers/net/ena/base/ena_com.h +6 -4
index 5d38b69c0f..fbb0ea39ec 100644
@@ -1201,15 +1201,17 @@ static inline void ena_com_update_intr_reg(struct ena_eth_io_intr_reg *intr_reg,
 		ENA_ETH_IO_INTR_REG_RX_INTR_DELAY_MASK;
 
 	intr_reg->intr_control |=
-		(tx_delay_interval << ENA_ETH_IO_INTR_REG_TX_INTR_DELAY_SHIFT)
-		& ENA_ETH_IO_INTR_REG_TX_INTR_DELAY_MASK;
+		ENA_FIELD_PREP(tx_delay_interval,
+			       ENA_ETH_IO_INTR_REG_TX_INTR_DELAY_MASK,
+			       ENA_ETH_IO_INTR_REG_TX_INTR_DELAY_SHIFT);
 
 	if (unmask)
 		intr_reg->intr_control |= ENA_ETH_IO_INTR_REG_INTR_UNMASK_MASK;
 
 	intr_reg->intr_control |=
-		(((u32)no_moderation_update) << ENA_ETH_IO_INTR_REG_NO_MODERATION_UPDATE_SHIFT) &
-			ENA_ETH_IO_INTR_REG_NO_MODERATION_UPDATE_MASK;
+		ENA_FIELD_PREP(((u32)no_moderation_update),
+			       ENA_ETH_IO_INTR_REG_NO_MODERATION_UPDATE_MASK,
+			       ENA_ETH_IO_INTR_REG_NO_MODERATION_UPDATE_SHIFT);
 }
 
 static inline u8 *ena_com_get_next_bounce_buffer(struct ena_com_io_bounce_buffer_control *bounce_buf_ctrl)
drivers/net/ena/base/ena_eth_com.c +82 -64

221 lines not on this page · raw message

drivers/net/ena/base/ena_eth_com.h +6 -2
index f91cf67c09..8a12ed5fba 100644
@@ -188,7 +188,9 @@ static inline void ena_com_update_numa_node(struct ena_com_io_cq *io_cq,
 	if (!io_cq->numa_node_cfg_reg)
 		return;
 
-	numa_cfg.numa_cfg = (numa_node & ENA_ETH_IO_NUMA_NODE_CFG_REG_NUMA_MASK)
+	numa_cfg.numa_cfg = (ENA_FIELD_GET(numa_node,
+					   ENA_ETH_IO_NUMA_NODE_CFG_REG_NUMA_MASK,
+					   ENA_ZERO_SHIFT))
 		| ENA_ETH_IO_NUMA_NODE_CFG_REG_ENABLED_MASK;
 
 	ENA_REG_WRITE32(io_cq->bus, numa_cfg.numa_cfg, io_cq->numa_node_cfg_reg);
@@ -230,7 +232,9 @@ static inline int ena_com_tx_comp_req_id_get(struct ena_com_io_cq *io_cq,
 	 * expected, it mean that the device still didn't update
 	 * this completion.
 	 */
-	cdesc_phase = flags & ENA_ETH_IO_TX_CDESC_PHASE_MASK;
+	cdesc_phase = ENA_FIELD_GET(flags,
+				    ENA_ETH_IO_TX_CDESC_PHASE_MASK,
+				    ENA_ZERO_SHIFT);
 	if (cdesc_phase != expected_phase)
 		return ENA_COM_TRY_AGAIN;
 
drivers/net/ena/base/ena_plat_dpdk.h +3 -0
index 87f7083ce9..03f29a2f1d 100644
@@ -325,6 +325,9 @@ void ena_rss_key_fill(void *key, size_t size);
 #define ENA_BITS_PER_U64(bitmap) (ena_bits_per_u64(bitmap))
 
 #define ENA_FIELD_GET(value, mask, offset) (((value) & (mask)) >> (offset))
+#define ENA_FIELD_PREP(value, mask, offset) (((value) << (offset)) & (mask))
+
+#define ENA_ZERO_SHIFT 0
 
 static __rte_always_inline int ena_bits_per_u64(uint64_t bitmap)
 {
Signature · 1 line
2.17.1
#15 lore raw

PATCH 9/15 net/ena: logger change to improve performance

In reply to [email protected]

From: Shai Brandes <[email protected]>

Current implementation of ena_trc_dbg on every TX packet has a major performance impact on DPDK TX flow.
Profiling revealed that these calls, which trigger rte_log usage, consume a significant amount of CPU resources.

Change details:
1. Several warning prints that incorrectly used ena_trc_dbg will now be compiled out. They have been changed to ena_trc_warn to avoid compiler warnings, such as empty if/else body or unused parameter.
2. Removed variables which is used only inside prints and thus may be unreferenced.
3. calls for ena_trc_dbg will be enabled only if RTE_ETHDEV_DEBUG_TX or RTE_ETHDEV_DEBUG_RX defined

---
 doc/guides/rel_notes/release_24_07.rst |  4 ++++
 drivers/net/ena/base/ena_com.c         | 19 +++++--------------
 drivers/net/ena/base/ena_eth_com.c     | 25 ++++++++++++-------------
 drivers/net/ena/base/ena_plat_dpdk.h   |  6 +++++-
 drivers/net/ena/ena_ethdev.c           |  2 +-
 5 files changed, 27 insertions(+), 29 deletions(-)
doc/guides/rel_notes/release_24_07.rst +4 -0
index e68a53d757..1e46a4b7c7 100644
@@ -73,6 +73,10 @@ New Features
   ``bpf_obj_get()`` for an xskmap pinned (by the AF_XDP DP) inside the
   container.
 
+* **Updated Amazon ena (Elastic Network Adapter) net driver.**
+
+  * Reworked the driver logger usage in order to improve Tx performance.
+
 * **Update Tap PMD driver.**
 
   * Updated to support up to 8 queues when used by secondary process.
drivers/net/ena/base/ena_com.c +5 -14
index e5f1a31c9e..24bad19848 100644
@@ -1392,11 +1392,7 @@ int ena_com_execute_admin_command(struct ena_com_admin_queue *admin_queue,
 					    comp, comp_size);
 	if (IS_ERR(comp_ctx)) {
 		ret = PTR_ERR(comp_ctx);
-		if (ret == ENA_COM_NO_DEVICE)
-			ena_trc_dbg(admin_queue->ena_dev,
-				    "Failed to submit command [%d]\n",
-				    ret);
-		else
+		if (ret != ENA_COM_NO_DEVICE)
 			ena_trc_err(admin_queue->ena_dev,
 				    "Failed to submit command [%d]\n",
 				    ret);
@@ -1408,10 +1404,8 @@ int ena_com_execute_admin_command(struct ena_com_admin_queue *admin_queue,
 	if (unlikely(ret)) {
 		if (admin_queue->running_state)
 			ena_trc_err(admin_queue->ena_dev,
-				    "Failed to process command. ret = %d\n", ret);
-		else
-			ena_trc_dbg(admin_queue->ena_dev,
-				    "Failed to process command. ret = %d\n", ret);
+				    "Failed to process command [%d]\n",
+				    ret);
 	}
 	return ret;
 }
@@ -2416,7 +2410,6 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *ena_dev, void *data)
 	struct ena_admin_aenq_entry *aenq_e;
 	struct ena_admin_aenq_common_desc *aenq_common;
 	struct ena_com_aenq *aenq  = &ena_dev->aenq;
-	u64 timestamp;
 	ena_aenq_handler handler_cb;
 	u16 masked_head, processed = 0;
 	u8 phase;
@@ -2438,13 +2431,11 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *ena_dev, void *data)
 		 */
 		dma_rmb();
 
-		timestamp = (u64)aenq_common->timestamp_low |
-			((u64)aenq_common->timestamp_high << 32);
-
 		ena_trc_dbg(ena_dev, "AENQ! Group[%x] Syndrome[%x] timestamp: [%" ENA_PRIu64 "s]\n",
 			    aenq_common->group,
 			    aenq_common->syndrome,
-			    timestamp);
+			    ((u64)aenq_common->timestamp_low |
+			    ((u64)aenq_common->timestamp_high << 32)));
 
 		/* Handle specific event*/
 		handler_cb = ena_com_get_specific_aenq_cb(ena_dev,
drivers/net/ena/base/ena_eth_com.c +12 -13
index 29cc331b1b..90dd85c7ff 100644
@@ -426,8 +426,7 @@ static int ena_com_create_and_store_tx_meta_desc(struct ena_com_io_sq *io_sq,
 	return ENA_COM_OK;
 }
 
-static void ena_com_rx_set_flags(struct ena_com_io_cq *io_cq,
-				 struct ena_com_rx_ctx *ena_rx_ctx,
+static void ena_com_rx_set_flags(struct ena_com_rx_ctx *ena_rx_ctx,
 				 struct ena_eth_io_rx_cdesc_base *cdesc)
 {
 	ena_rx_ctx->l3_proto = cdesc->status &
@@ -453,16 +452,6 @@ static void ena_com_rx_set_flags(struct ena_com_io_cq *io_cq,
 		ENA_FIELD_GET(cdesc->status,
 			      ENA_ETH_IO_RX_CDESC_BASE_IPV4_FRAG_MASK,
 			      ENA_ETH_IO_RX_CDESC_BASE_IPV4_FRAG_SHIFT);
-
-	ena_trc_dbg(ena_com_io_cq_to_ena_dev(io_cq),
-		    "l3_proto %d l4_proto %d l3_csum_err %d l4_csum_err %d hash %u frag %d cdesc_status %x\n",
-		    ena_rx_ctx->l3_proto,
-		    ena_rx_ctx->l4_proto,
-		    ena_rx_ctx->l3_csum_err,
-		    ena_rx_ctx->l4_csum_err,
-		    ena_rx_ctx->hash,
-		    ena_rx_ctx->frag,
-		    cdesc->status);
 }
 
 /*****************************************************************************/
@@ -689,7 +678,17 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq,
 		    io_sq->qid, io_sq->next_to_comp);
 
 	/* Get rx flags from the last pkt */
-	ena_com_rx_set_flags(io_cq, ena_rx_ctx, cdesc);
+	ena_com_rx_set_flags(ena_rx_ctx, cdesc);
+
+	ena_trc_dbg(ena_com_io_cq_to_ena_dev(io_cq),
+		    "l3_proto %d l4_proto %d l3_csum_err %d l4_csum_err %d hash %d frag %d cdesc_status %x\n",
+		    ena_rx_ctx->l3_proto,
+		    ena_rx_ctx->l4_proto,
+		    ena_rx_ctx->l3_csum_err,
+		    ena_rx_ctx->l4_csum_err,
+		    ena_rx_ctx->hash,
+		    ena_rx_ctx->frag,
+		    cdesc->status);
 
 	ena_rx_ctx->descs = nb_hw_desc;
 
drivers/net/ena/base/ena_plat_dpdk.h +5 -1
index 03f29a2f1d..21b96113c7 100644
@@ -122,7 +122,11 @@ extern int ena_logtype_com;
 			"[ENA_COM: %s]" fmt, __func__, ##arg)		       \
 	)
 
-#define ena_trc_dbg(dev, format, arg...) ena_trc_log(dev, DEBUG, format, ##arg)
+#if (defined RTE_ETHDEV_DEBUG_TX) || (defined RTE_ETHDEV_DEBUG_RX)
+#define ena_trc_dbg(dev, format, ...) ena_trc_log(dev, DEBUG, format, ##__VA_ARGS__)
+#else
+#define ena_trc_dbg(dev, format, ...)
+#endif
 #define ena_trc_info(dev, format, arg...) ena_trc_log(dev, INFO, format, ##arg)
 #define ena_trc_warn(dev, format, arg...) ena_trc_log(dev, WARNING, format, ##arg)
 #define ena_trc_err(dev, format, arg...) ena_trc_log(dev, ERR, format, ##arg)
drivers/net/ena/ena_ethdev.c +1 -1
index 66fc287faf..56dbe3b9cd 100644
@@ -3124,7 +3124,7 @@ static int ena_xmit_mbuf(struct ena_ring *tx_ring, struct rte_mbuf *mbuf)
 	 */
 	if (!ena_com_sq_have_enough_space(tx_ring->ena_com_io_sq,
 					  mbuf->nb_segs + 2)) {
-		PMD_DRV_LOG(DEBUG, "Not enough space in the tx queue\n");
+		PMD_TX_LOG(DEBUG, "Not enough space in the tx queue\n");
 		return ENA_COM_NO_MEM;
 	}
 
Signature · 1 line
2.17.1
#16 lore raw

PATCH 10/15 net/ena: rework device uninit

In reply to [email protected]

From: Shai Brandes <[email protected]>

Rework device uninitialization flow to ensure complete resource cleanup, and lay the groundwork for hot-unplug support. With this change, ena_destroy_device() is removed, its functionality now incorporated into ena_close().

---
 doc/guides/rel_notes/release_24_07.rst |  2 +
 drivers/net/ena/ena_ethdev.c           | 55 ++++++++++++--------------
 2 files changed, 27 insertions(+), 30 deletions(-)
doc/guides/rel_notes/release_24_07.rst +2 -0
index 1e46a4b7c7..a59fb2a21f 100644
@@ -76,6 +76,8 @@ New Features
 * **Updated Amazon ena (Elastic Network Adapter) net driver.**
 
   * Reworked the driver logger usage in order to improve Tx performance.
+  * Reworked the device uninitialization flow to ensure complete resource
+    cleanup and lay the groundwork for hot-unplug support.
 
 * **Update Tap PMD driver.**
 
drivers/net/ena/ena_ethdev.c +25 -30

97 lines not on this page · raw message

Signature · 1 line
2.17.1
#17 lore raw

PATCH 11/15 net/ena: fix bad checksum handling

In reply to [email protected]

From: Shai Brandes <[email protected]>

Removed a workaround for a false L4 bad Rx csum indication from the device. The workaround was to set it as unknown so the application would check it instead. The issue was fixed in the device, thus the driver bad csum handling should be fixed in the PMD.

Fixes b2d2f1cf89a6 ("net/ena: fix checksum flag for L4")
---
 doc/guides/rel_notes/release_24_07.rst | 1 +
 drivers/net/ena/ena_ethdev.c           | 8 +-------
 2 files changed, 2 insertions(+), 7 deletions(-)
doc/guides/rel_notes/release_24_07.rst +1 -0
index a59fb2a21f..f000dec54b 100644
@@ -78,6 +78,7 @@ New Features
   * Reworked the driver logger usage in order to improve Tx performance.
   * Reworked the device uninitialization flow to ensure complete resource
     cleanup and lay the groundwork for hot-unplug support.
+  * Removed an obsolete workaround for a false L4 bad Rx checksum indication.
 
 * **Update Tap PMD driver.**
 
drivers/net/ena/ena_ethdev.c +1 -7
index 4e7171e629..b43b913903 100644
@@ -674,13 +674,7 @@ static inline void ena_rx_mbuf_prepare(struct ena_ring *rx_ring,
 	} else {
 		if (unlikely(ena_rx_ctx->l4_csum_err)) {
 			++rx_stats->l4_csum_bad;
-			/*
-			 * For the L4 Rx checksum offload the HW may indicate
-			 * bad checksum although it's valid. Because of that,
-			 * we're setting the UNKNOWN flag to let the app
-			 * re-verify the checksum.
-			 */
-			ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN;
+			ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD;
 		} else {
 			++rx_stats->l4_csum_good;
 			ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD;
Signature · 1 line
2.17.1
#18 lore raw

PATCH 12/15 net/ena: fix invalid return value check

In reply to [email protected]

From: Shai Brandes <[email protected]>

Removed the sign inversion for when checking if ena_com_set_host_attributes returns ENA_COM_UNSUPPORTED. ENA_COM_UNSUPPORTED is defined as -EOPNOTSUPP, so the extra sign inversion is wrong.

Fixes 3adcba9a8987 ("net/ena: update HAL to the newer version")
---
 doc/guides/rel_notes/release_24_07.rst | 1 +
 drivers/net/ena/ena_ethdev.c           | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_07.rst +1 -0
index f000dec54b..24bb91ad46 100644
@@ -79,6 +79,7 @@ New Features
   * Reworked the device uninitialization flow to ensure complete resource
     cleanup and lay the groundwork for hot-unplug support.
   * Removed an obsolete workaround for a false L4 bad Rx checksum indication.
+  * Fixed an invalid return value check.
 
 * **Update Tap PMD driver.**
 
drivers/net/ena/ena_ethdev.c +2 -2
index b43b913903..67a1d86f9a 100644
@@ -812,7 +812,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev)
 
 	rc = ena_com_set_host_attributes(ena_dev);
 	if (rc) {
-		if (rc == -ENA_COM_UNSUPPORTED)
+		if (rc == ENA_COM_UNSUPPORTED)
 			PMD_DRV_LOG(WARNING, "Cannot set host attributes\n");
 		else
 			PMD_DRV_LOG(ERR, "Cannot set host attributes\n");
@@ -856,7 +856,7 @@ static void ena_config_debug_area(struct ena_adapter *adapter)
 
 	rc = ena_com_set_host_attributes(&adapter->ena_dev);
 	if (rc) {
-		if (rc == -ENA_COM_UNSUPPORTED)
+		if (rc == ENA_COM_UNSUPPORTED)
 			PMD_DRV_LOG(WARNING, "Cannot set host attributes\n");
 		else
 			PMD_DRV_LOG(ERR, "Cannot set host attributes\n");
Signature · 1 line
2.17.1
#19 lore raw

Re: [PATCH 12/15] net/ena: fix invalid return value check

Quoted 21 lines · On 7/2/2024 3:46 PM, [email protected] wrote:

From: Shai Brandes <[email protected]>

Removed the sign inversion for when checking if ena_com_set_host_attributes returns ENA_COM_UNSUPPORTED. ENA_COM_UNSUPPORTED is defined as -EOPNOTSUPP, so the extra sign inversion is wrong.

Fixes 3adcba9a8987 ("net/ena: update HAL to the newer version")
---
 doc/guides/rel_notes/release_24_07.rst | 1 +
 drivers/net/ena/ena_ethdev.c           | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_07.rst +0 -0
index f000dec54b..24bb91ad46 100644

doc/guides/rel_notes/release_24_07.rst New Features · line 83

Quoted 5 lines
doc/guides/rel_notes/release_24_07.rst +1 -0
@@ -79,6 +79,7 @@ New Features
   * Reworked the device uninitialization flow to ensure complete resource
     cleanup and lay the groundwork for hot-unplug support.
   * Removed an obsolete workaround for a false L4 bad Rx checksum indication.
+  * Fixed an invalid return value check.
 

Dropped this release notes update while merging, as it looks not significant enough for the release notes.

#20 lore raw

PATCH 13/15 net/ena: fix wrong handling of checksum

In reply to [email protected]

From: Shai Brandes <[email protected]>

This change fixes an issue where a non tcp/udp packet can be indicated to have an invalid csum. If the device erroneously tries to verify the csum on a non tcp/udp packet it will result in false indication that there is a csum error. This change make the driver ignore the indication for csum error on such packets.

Fixes 84daba9962b5 ("net/ena: add extra Rx checksum related xstats")
---
 doc/guides/rel_notes/release_24_07.rst | 1 +
 drivers/net/ena/ena_ethdev.c           | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_24_07.rst +1 -0
index 24bb91ad46..ec960d93cc 100644
@@ -80,6 +80,7 @@ New Features
     cleanup and lay the groundwork for hot-unplug support.
   * Removed an obsolete workaround for a false L4 bad Rx checksum indication.
   * Fixed an invalid return value check.
+  * Fixed Rx chcecksum inspection to check only TCP/UDP packets.
 
 * **Update Tap PMD driver.**
 
drivers/net/ena/ena_ethdev.c +2 -1
index 67a1d86f9a..a18c94df28 100644
@@ -669,7 +669,8 @@ static inline void ena_rx_mbuf_prepare(struct ena_ring *rx_ring,
 		packet_type |= RTE_PTYPE_L3_IPV6;
 	}
 
-	if (!ena_rx_ctx->l4_csum_checked || ena_rx_ctx->frag) {
+	if (!ena_rx_ctx->l4_csum_checked || ena_rx_ctx->frag ||
+		!(packet_type & (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP))) {
 		ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN;
 	} else {
 		if (unlikely(ena_rx_ctx->l4_csum_err)) {
Signature · 1 line
2.17.1
#21 lore raw

PATCH 14/15 net/ena: rework Rx checksum inspection

In reply to [email protected]

From: Shai Brandes <[email protected]>

This restructure is a simplification of the
Rx checksum inspection logic in ena_rx_mbuf_prepare. Its purpose is to improve readability and maintainability by consolidating conditions.

---
 doc/guides/rel_notes/release_24_07.rst |  2 +
 drivers/net/ena/ena_ethdev.c           | 66 +++++++++++++++-----------
 2 files changed, 39 insertions(+), 29 deletions(-)
doc/guides/rel_notes/release_24_07.rst +2 -0
index ec960d93cc..d2253999fa 100644
@@ -81,6 +81,8 @@ New Features
   * Removed an obsolete workaround for a false L4 bad Rx checksum indication.
   * Fixed an invalid return value check.
   * Fixed Rx chcecksum inspection to check only TCP/UDP packets.
+  * Reworked the Rx checksum inspection routine to improve
+    readability and maintainability.
 
 * **Update Tap PMD driver.**
 
drivers/net/ena/ena_ethdev.c +37 -29

113 lines not on this page · raw message

Signature · 1 line
2.17.1
#22 lore raw

PATCH 15/15 net/ena: upgrade driver version to 2.10.0

In reply to [email protected]

From: Shai Brandes <[email protected]>

upgrade driver version to 2.10.0.

---
 drivers/net/ena/ena_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ena/ena_ethdev.c +1 -1
index feb229c5ec..e0c239e88f 100644
@@ -22,7 +22,7 @@
 #include <ena_eth_io_defs.h>
 
 #define DRV_MODULE_VER_MAJOR	2
-#define DRV_MODULE_VER_MINOR	9
+#define DRV_MODULE_VER_MINOR	10
 #define DRV_MODULE_VER_SUBMINOR	0
 
 #define __MERGE_64B_H_L(h, l) (((uint64_t)h << 32) | l)
Signature · 1 line
2.17.1
#23 lore raw
In reply to [email protected]
Quoted 15 lines · On 7/2/2024 3:46 PM, [email protected] wrote:

From: Shai Brandes <[email protected]>

Hi all,
This release contains:
1. HAL upgrade to latest divided into separate patches.
2. three bug fixes.
3. restructuring of the Rx checksum code for readability
4. restructuring of the device uninit flow which is also needed for adding hot un/plug support later.
5. modification of logs on the datapath that leads to improved performance.

Will appreciate your feedbacks!
All the best and thanks in advance,
Shai

Quoted 17 lines

Shai Brandes (15):
net/ena/base: add descriptor dump capability
net/ena/base: remove unused param
net/ena/base: remove redundant assert checks
net/ena/base: update memory barrier comment
net/ena/base: add method to check used entries
net/ena/base: add an additional reset reason
net/ena/base: update copyrights comments
net/ena/base: add macro for bitfield access
net/ena: logger change to improve performance
net/ena: rework device uninit
net/ena: fix bad checksum handling
net/ena: fix invalid return value check
net/ena: fix wrong handling of checksum
net/ena: rework Rx checksum inspection
net/ena: upgrade driver version to 2.10.0

Except from 7/15 (copyright one),

Series applied to dpdk-next-net/main, thanks.