From: "Renyong Wan" <wanry@yunsilicon.com>
To: <dev@dpdk.org>
Cc: "Stephen Hemminger" <stephen@networkplumber.org>,
<nana@yunsilicon.com>, <qianr@yunsilicon.com>,
<zhangxx@yunsilicon.com>, <xudw@yunsilicon.com>
Subject: [PATCH v3 3/3] net/xsc: rename jumbo buffer fields
Date: Tue, 17 Nov 2026 14:45:14 +0800 [thread overview]
Message-ID: <1794897914.1170@yunsilicon.com> (raw)
In-Reply-To: <1794897914.9800@yunsilicon.com>
The names are the other way round: jumbo_buffer_pa holds the virtual
address and jumbo_buffer_va holds the IOVA, which is why the bug went
unnoticed.
Rename them to jumbo_buf and jumbo_iova with matching types, which also
removes the casts.
Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Renyong Wan <wanry@yunsilicon.com>
---
drivers/net/xsc/xsc_dev.c | 4 ++--
drivers/net/xsc/xsc_dev.h | 4 ++--
drivers/net/xsc/xsc_rx.c | 22 +++++++++++-----------
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/net/xsc/xsc_dev.c b/drivers/net/xsc/xsc_dev.c
index c0a03795..c369ad3a 100644
--- a/drivers/net/xsc/xsc_dev.c
+++ b/drivers/net/xsc/xsc_dev.c
@@ -149,8 +149,8 @@ xsc_dev_close(struct xsc_dev *xdev, int repr_id)
ret = xdev->dev_ops->dev_close(xdev);
/* Removal closes the device again, do not free it twice. */
- rte_free(xdev->jumbo_buffer_pa);
- xdev->jumbo_buffer_pa = NULL;
+ rte_free(xdev->jumbo_buf);
+ xdev->jumbo_buf = NULL;
return ret;
}
diff --git a/drivers/net/xsc/xsc_dev.h b/drivers/net/xsc/xsc_dev.h
index d4a7d90b..3473333c 100644
--- a/drivers/net/xsc/xsc_dev.h
+++ b/drivers/net/xsc/xsc_dev.h
@@ -189,8 +189,8 @@ struct xsc_dev {
void *dev_priv;
char name[PCI_PRI_STR_SIZE];
void *bar_addr;
- void *jumbo_buffer_pa;
- void *jumbo_buffer_va;
+ void *jumbo_buf;
+ rte_iova_t jumbo_iova;
uint64_t bar_len;
int ctrl_fd;
rte_intr_callback_fn intr_cb;
diff --git a/drivers/net/xsc/xsc_rx.c b/drivers/net/xsc/xsc_rx.c
index 30b40df3..f7529371 100644
--- a/drivers/net/xsc/xsc_rx.c
+++ b/drivers/net/xsc/xsc_rx.c
@@ -206,27 +206,27 @@ xsc_rxq_initialize(struct xsc_dev *xdev, struct xsc_rxq_data *rxq_data)
uint32_t log2ds = rte_log2_u32(rx_ds_num);
uintptr_t addr;
struct rte_mbuf *mbuf;
- void *jumbo_buffer_pa = xdev->jumbo_buffer_pa;
- void *jumbo_buffer_va = xdev->jumbo_buffer_va;
+ void *jumbo_buf = xdev->jumbo_buf;
+ rte_iova_t jumbo_iova = xdev->jumbo_iova;
volatile struct xsc_wqe_data_seg *seg;
volatile struct xsc_wqe_data_seg *seg_next;
- if (rx_ds_num != 1 && jumbo_buffer_pa == NULL) {
- jumbo_buffer_pa = rte_malloc(NULL, XSC_MAX_RECV_LEN, 0);
- if (jumbo_buffer_pa == NULL) {
+ if (rx_ds_num != 1 && jumbo_buf == NULL) {
+ jumbo_buf = rte_malloc(NULL, XSC_MAX_RECV_LEN, 0);
+ if (jumbo_buf == NULL) {
PMD_DRV_LOG(ERR, "Failed to malloc jumbo_buffer");
return -ENOMEM;
}
- jumbo_buffer_va = (void *)rte_malloc_virt2iova(jumbo_buffer_pa);
- if ((rte_iova_t)jumbo_buffer_va == RTE_BAD_IOVA) {
+ jumbo_iova = rte_malloc_virt2iova(jumbo_buf);
+ if (jumbo_iova == RTE_BAD_IOVA) {
PMD_DRV_LOG(ERR, "Failed to get IOVA of jumbo_buffer");
- rte_free(jumbo_buffer_pa);
+ rte_free(jumbo_buf);
return -EFAULT;
}
- xdev->jumbo_buffer_pa = jumbo_buffer_pa;
- xdev->jumbo_buffer_va = jumbo_buffer_va;
+ xdev->jumbo_buf = jumbo_buf;
+ xdev->jumbo_iova = jumbo_iova;
}
for (i = 0; (i != wqe_n); ++i) {
@@ -246,7 +246,7 @@ xsc_rxq_initialize(struct xsc_dev *xdev, struct xsc_rxq_data *rxq_data)
if (rx_ds_num != 1) {
seg_next = seg + 1;
*seg_next = (struct xsc_wqe_data_seg){
- .va = rte_cpu_to_le_64((uint64_t)jumbo_buffer_va),
+ .va = rte_cpu_to_le_64(jumbo_iova),
.seg_len = rte_cpu_to_le_32(XSC_MAX_RECV_LEN - seg_len),
.lkey = 0,
};
next prev parent reply other threads:[~2026-11-17 6:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 6:45 [PATCH v3 0/3] net/xsc: fix issues reported by GCC analyzer Renyong Wan
2026-11-17 6:45 ` Renyong Wan [this message]
2026-11-17 6:45 ` [PATCH v3 2/3] net/xsc: fix leak and missing null check Renyong Wan
2026-11-17 6:45 ` [PATCH v3 1/3] net/xsc: fix jumbo buffer allocation and leak Renyong Wan
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=1794897914.1170@yunsilicon.com \
--to=wanry@yunsilicon.com \
--cc=dev@dpdk.org \
--cc=nana@yunsilicon.com \
--cc=qianr@yunsilicon.com \
--cc=stephen@networkplumber.org \
--cc=xudw@yunsilicon.com \
--cc=zhangxx@yunsilicon.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.