* [PATCH] net/mana: rename mana_find_pmd_mr() to mana_alloc_pmd_mr()
@ 2024-01-20 0:55 longli
2024-01-22 12:18 ` Ferruh Yigit
0 siblings, 1 reply; 2+ messages in thread
From: longli @ 2024-01-20 0:55 UTC (permalink / raw)
To: Ferruh Yigit, Andrew Rybchenko; +Cc: dev, Long Li
From: Long Li <longli@microsoft.com>
The function name mana_find_pmd_mr() is misleading as there might be
allocations to get a MR. Change function name to mana_alloc_pmd_mr().
Signed-off-by: Long Li <longli@microsoft.com>
---
drivers/net/mana/mana.h | 6 +++---
drivers/net/mana/mr.c | 7 ++++---
drivers/net/mana/rx.c | 2 +-
drivers/net/mana/tx.c | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/mana/mana.h b/drivers/net/mana/mana.h
index 6836872dc2..eadcd01858 100644
--- a/drivers/net/mana/mana.h
+++ b/drivers/net/mana/mana.h
@@ -511,9 +511,9 @@ int mana_start_tx_queues(struct rte_eth_dev *dev);
int mana_stop_rx_queues(struct rte_eth_dev *dev);
int mana_stop_tx_queues(struct rte_eth_dev *dev);
-struct mana_mr_cache *mana_find_pmd_mr(struct mana_mr_btree *local_tree,
- struct mana_priv *priv,
- struct rte_mbuf *mbuf);
+struct mana_mr_cache *mana_alloc_pmd_mr(struct mana_mr_btree *local_tree,
+ struct mana_priv *priv,
+ struct rte_mbuf *mbuf);
int mana_new_pmd_mr(struct mana_mr_btree *local_tree, struct mana_priv *priv,
struct rte_mempool *pool);
void mana_remove_all_mr(struct mana_priv *priv);
diff --git a/drivers/net/mana/mr.c b/drivers/net/mana/mr.c
index b8e6ea0bbf..d6a5ad1460 100644
--- a/drivers/net/mana/mr.c
+++ b/drivers/net/mana/mr.c
@@ -122,11 +122,12 @@ mana_del_pmd_mr(struct mana_mr_cache *mr)
}
/*
- * Find a MR from cache. If not found, register a new MR.
+ * Alloc a MR.
+ * Try to find a MR in the cache. If not found, register a new MR.
*/
struct mana_mr_cache *
-mana_find_pmd_mr(struct mana_mr_btree *local_mr_btree, struct mana_priv *priv,
- struct rte_mbuf *mbuf)
+mana_alloc_pmd_mr(struct mana_mr_btree *local_mr_btree, struct mana_priv *priv,
+ struct rte_mbuf *mbuf)
{
struct rte_mempool *pool = mbuf->pool;
int ret, second_try = 0;
diff --git a/drivers/net/mana/rx.c b/drivers/net/mana/rx.c
index 63042fe9b9..acad5e26cd 100644
--- a/drivers/net/mana/rx.c
+++ b/drivers/net/mana/rx.c
@@ -75,7 +75,7 @@ mana_alloc_and_post_rx_wqe(struct mana_rxq *rxq)
return -ENOMEM;
}
- mr = mana_find_pmd_mr(&rxq->mr_btree, priv, mbuf);
+ mr = mana_alloc_pmd_mr(&rxq->mr_btree, priv, mbuf);
if (!mr) {
DP_LOG(ERR, "failed to register RX MR");
rte_pktmbuf_free(mbuf);
diff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c
index c50385d9fe..58c4a1d976 100644
--- a/drivers/net/mana/tx.c
+++ b/drivers/net/mana/tx.c
@@ -365,7 +365,7 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
/* Create SGL for packet data buffers */
for (seg_idx = 0; seg_idx < m_pkt->nb_segs; seg_idx++) {
struct mana_mr_cache *mr =
- mana_find_pmd_mr(&txq->mr_btree, priv, m_seg);
+ mana_alloc_pmd_mr(&txq->mr_btree, priv, m_seg);
if (!mr) {
DP_LOG(ERR, "failed to get MR, pkt_idx %u",
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-22 12:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-20 0:55 [PATCH] net/mana: rename mana_find_pmd_mr() to mana_alloc_pmd_mr() longli
2024-01-22 12:18 ` Ferruh Yigit
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).