From: vanshika.shukla@nxp.com
To: dev@dpdk.org, Hemant Agrawal <hemant.agrawal@nxp.com>,
Sachin Saxena <sachin.saxena@nxp.com>
Cc: Jun Yang <jun.yang@nxp.com>
Subject: [v1 10/10] bus/dpaa: optimize qman enqueue check
Date: Wed, 28 May 2025 16:09:34 +0530 [thread overview]
Message-ID: <20250528103934.1001747-11-vanshika.shukla@nxp.com> (raw)
In-Reply-To: <20250528103934.1001747-1-vanshika.shukla@nxp.com>
From: Hemant Agrawal <hemant.agrawal@nxp.com>
This patch improves data access during qman enequeue ring check.
Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
drivers/bus/dpaa/base/qbman/qman.c | 41 ++++++++++++++++-------------
drivers/bus/dpaa/include/fsl_qman.h | 2 +-
2 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index fbce0638b7..60087c55a1 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -1466,7 +1466,7 @@ int qman_create_fq(u32 fqid, u32 flags, struct qman_fq *fq)
}
spin_lock_init(&fq->fqlock);
fq->fqid = fqid;
- fq->fqid_le = cpu_to_be32(fqid);
+ fq->fqid_be = cpu_to_be32(fqid);
fq->flags = flags;
fq->state = qman_fq_state_oos;
fq->cgr_groupid = 0;
@@ -2291,7 +2291,7 @@ int qman_enqueue_multi(struct qman_fq *fq,
struct qm_portal *portal = &p->p;
register struct qm_eqcr *eqcr = &portal->eqcr;
- struct qm_eqcr_entry *eq = eqcr->cursor, *prev_eq;
+ struct qm_eqcr_entry *eq = eqcr->cursor;
u8 i = 0, diff, old_ci, sent = 0;
@@ -2307,7 +2307,7 @@ int qman_enqueue_multi(struct qman_fq *fq,
/* try to send as many frames as possible */
while (eqcr->available && frames_to_send--) {
- eq->fqid = fq->fqid_le;
+ eq->fqid = fq->fqid_be;
eq->fd.opaque_addr = fd->opaque_addr;
eq->fd.addr = cpu_to_be40(fd->addr);
eq->fd.status = cpu_to_be32(fd->status);
@@ -2317,8 +2317,9 @@ int qman_enqueue_multi(struct qman_fq *fq,
((flags[i] >> 8) & QM_EQCR_DCA_IDXMASK);
}
i++;
- eq = (void *)((unsigned long)(eq + 1) &
- (~(unsigned long)(QM_EQCR_SIZE << 6)));
+ eq++;
+ if (unlikely(eq >= (eqcr->ring + QM_EQCR_SIZE)))
+ eq = eqcr->ring;
eqcr->available--;
sent++;
fd++;
@@ -2332,11 +2333,11 @@ int qman_enqueue_multi(struct qman_fq *fq,
for (i = 0; i < sent; i++) {
eq->__dont_write_directly__verb =
QM_EQCR_VERB_CMD_ENQUEUE | eqcr->vbit;
- prev_eq = eq;
- eq = (void *)((unsigned long)(eq + 1) &
- (~(unsigned long)(QM_EQCR_SIZE << 6)));
- if (unlikely((prev_eq + 1) != eq))
+ eq++;
+ if (unlikely(eq >= (eqcr->ring + QM_EQCR_SIZE))) {
eqcr->vbit ^= QM_EQCR_VERB_VBIT;
+ eq = eqcr->ring;
+ }
}
/* We need to flush all the lines but without load/store operations
@@ -2361,7 +2362,7 @@ qman_enqueue_multi_fq(struct qman_fq *fq[], const struct qm_fd *fd,
struct qm_portal *portal = &p->p;
register struct qm_eqcr *eqcr = &portal->eqcr;
- struct qm_eqcr_entry *eq = eqcr->cursor, *prev_eq;
+ struct qm_eqcr_entry *eq = eqcr->cursor;
u8 i = 0, diff, old_ci, sent = 0;
@@ -2377,7 +2378,7 @@ qman_enqueue_multi_fq(struct qman_fq *fq[], const struct qm_fd *fd,
/* try to send as many frames as possible */
while (eqcr->available && frames_to_send--) {
- eq->fqid = fq[sent]->fqid_le;
+ eq->fqid = fq[sent]->fqid_be;
eq->fd.opaque_addr = fd->opaque_addr;
eq->fd.addr = cpu_to_be40(fd->addr);
eq->fd.status = cpu_to_be32(fd->status);
@@ -2388,8 +2389,9 @@ qman_enqueue_multi_fq(struct qman_fq *fq[], const struct qm_fd *fd,
}
i++;
- eq = (void *)((unsigned long)(eq + 1) &
- (~(unsigned long)(QM_EQCR_SIZE << 6)));
+ eq++;
+ if (unlikely(eq >= (eqcr->ring + QM_EQCR_SIZE)))
+ eq = eqcr->ring;
eqcr->available--;
sent++;
fd++;
@@ -2403,11 +2405,11 @@ qman_enqueue_multi_fq(struct qman_fq *fq[], const struct qm_fd *fd,
for (i = 0; i < sent; i++) {
eq->__dont_write_directly__verb =
QM_EQCR_VERB_CMD_ENQUEUE | eqcr->vbit;
- prev_eq = eq;
- eq = (void *)((unsigned long)(eq + 1) &
- (~(unsigned long)(QM_EQCR_SIZE << 6)));
- if (unlikely((prev_eq + 1) != eq))
+ eq++;
+ if (unlikely(eq >= (eqcr->ring + QM_EQCR_SIZE))) {
eqcr->vbit ^= QM_EQCR_VERB_VBIT;
+ eq = eqcr->ring;
+ }
}
/* We need to flush all the lines but without load/store operations
@@ -2416,8 +2418,9 @@ qman_enqueue_multi_fq(struct qman_fq *fq[], const struct qm_fd *fd,
eq = eqcr->cursor;
for (i = 0; i < sent; i++) {
dcbf(eq);
- eq = (void *)((unsigned long)(eq + 1) &
- (~(unsigned long)(QM_EQCR_SIZE << 6)));
+ eq++;
+ if (unlikely(eq >= (eqcr->ring + QM_EQCR_SIZE)))
+ eq = eqcr->ring;
}
/* Update cursor for the next call */
eqcr->cursor = eq;
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index b949f2c893..71d5b16878 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1225,7 +1225,7 @@ struct qman_fq {
/* Caller of qman_create_fq() provides these demux callbacks */
struct qman_fq_cb cb;
- u32 fqid_le;
+ rte_be32_t fqid_be;
u32 fqid;
int q_fd;
--
2.25.1
prev parent reply other threads:[~2025-05-28 10:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 10:39 [v1 00/10] DPAA specific fixes vanshika.shukla
2025-05-28 10:39 ` [v1 01/10] bus/dpaa: avoid using same structure and variable name vanshika.shukla
2025-05-28 10:39 ` [v1 02/10] bus/dpaa: add FMan node vanshika.shukla
2025-05-28 10:39 ` [v1 03/10] bus/dpaa: enhance DPAA SoC version vanshika.shukla
2025-05-28 14:28 ` Stephen Hemminger
2025-05-28 10:39 ` [v1 04/10] bus/dpaa: optimize bman acquire/release vanshika.shukla
2025-05-28 14:30 ` Stephen Hemminger
2025-05-28 14:50 ` [EXT] " Jun Yang
2025-05-28 10:39 ` [v1 05/10] mempool/dpaa: fast acquire and release vanshika.shukla
2025-05-28 10:39 ` [v1 06/10] mempool/dpaa: adjust pool element for LS1043A errata vanshika.shukla
2025-05-28 10:39 ` [v1 07/10] net/dpaa: add Tx rate limiting DPAA PMD API vanshika.shukla
2025-05-28 10:39 ` [v1 08/10] net/dpaa: add devargs for enabling err packets on main queue vanshika.shukla
2025-05-28 10:39 ` [v1 09/10] bus/dpaa: improve DPAA cleanup vanshika.shukla
2025-05-28 10:39 ` vanshika.shukla [this message]
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=20250528103934.1001747-11-vanshika.shukla@nxp.com \
--to=vanshika.shukla@nxp.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=jun.yang@nxp.com \
--cc=sachin.saxena@nxp.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).