From: <shaibran@amazon.com>
To: <ferruh.yigit@amd.com>
Cc: <dev@dpdk.org>, Shai Brandes <shaibran@amazon.com>
Subject: [PATCH 09/15] net/ena: logger change to improve performance
Date: Tue, 2 Jul 2024 17:46:20 +0300 [thread overview]
Message-ID: <20240702144626.14545-10-shaibran@amazon.com> (raw)
In-Reply-To: <20240702144626.14545-1-shaibran@amazon.com>
From: Shai Brandes <shaibran@amazon.com>
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
Signed-off-by: Shai Brandes <shaibran@amazon.com>
---
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(-)
diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst
index e68a53d757..1e46a4b7c7 100644
--- a/doc/guides/rel_notes/release_24_07.rst
+++ b/doc/guides/rel_notes/release_24_07.rst
@@ -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.
diff --git a/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c
index e5f1a31c9e..24bad19848 100644
--- a/drivers/net/ena/base/ena_com.c
+++ b/drivers/net/ena/base/ena_com.c
@@ -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,
diff --git a/drivers/net/ena/base/ena_eth_com.c b/drivers/net/ena/base/ena_eth_com.c
index 29cc331b1b..90dd85c7ff 100644
--- a/drivers/net/ena/base/ena_eth_com.c
+++ b/drivers/net/ena/base/ena_eth_com.c
@@ -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;
diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 03f29a2f1d..21b96113c7 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -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)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 66fc287faf..56dbe3b9cd 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -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;
}
--
2.17.1
next prev parent reply other threads:[~2024-07-02 14:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 14:46 [PATCH 00/15] net/ena: driver release 2.10.0 shaibran
2024-07-02 14:46 ` [PATCH 01/15] net/ena/base: add descriptor dump capability shaibran
2024-07-02 14:46 ` [PATCH 02/15] net/ena/base: remove unused param shaibran
2024-07-02 14:46 ` [PATCH 03/15] net/ena/base: remove redundant assert checks shaibran
2024-07-02 14:46 ` [PATCH 04/15] net/ena/base: update memory barrier comment shaibran
2024-07-02 14:46 ` [PATCH 05/15] net/ena/base: add method to check used entries shaibran
2024-07-02 14:46 ` [PATCH 06/15] net/ena/base: add an additional reset reason shaibran
2024-07-02 14:46 ` [PATCH 07/15] net/ena/base: update copyrights comments shaibran
2024-07-07 18:57 ` Ferruh Yigit
2024-07-08 4:08 ` Hemant Agrawal
2024-07-08 7:02 ` Brandes, Shai
2024-07-08 8:38 ` Ferruh Yigit
2024-07-08 8:48 ` Brandes, Shai
2024-07-08 11:45 ` Ferruh Yigit
2024-07-02 14:46 ` [PATCH 08/15] net/ena/base: add macro for bitfield access shaibran
2024-07-02 14:46 ` shaibran [this message]
2024-07-02 14:46 ` [PATCH 10/15] net/ena: rework device uninit shaibran
2024-07-02 14:46 ` [PATCH 11/15] net/ena: fix bad checksum handling shaibran
2024-07-02 14:46 ` [PATCH 12/15] net/ena: fix invalid return value check shaibran
2024-07-07 18:57 ` Ferruh Yigit
2024-07-02 14:46 ` [PATCH 13/15] net/ena: fix wrong handling of checksum shaibran
2024-07-02 14:46 ` [PATCH 14/15] net/ena: rework Rx checksum inspection shaibran
2024-07-02 14:46 ` [PATCH 15/15] net/ena: upgrade driver version to 2.10.0 shaibran
2024-07-07 19:11 ` [PATCH 00/15] net/ena: driver release 2.10.0 Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240702144626.14545-10-shaibran@amazon.com \
--to=shaibran@amazon.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).