From: Jun Yang <[email protected]> qman_shutdown_fq() took only an fqid and always drained the FQ through get_affine_portal(), the portal of the calling thread. A frame queue that belongs to a different portal cannot be drained that way.
Take the FQ descriptor instead and use fq->qp when the caller has one, falling back to the affine portal otherwise. dpaa_sec and the offline port pass their own queues, so they now drain on the right portal. Add a qman_shutdown_fq_by_fqid() wrapper for the one caller that only has an fqid: net/dpaa cleans up a frame queue left behind by a previous run before the queue is initialized, so no descriptor exists yet. Signed-off-by: Jun Yang <[email protected]> --- drivers/bus/dpaa/base/qbman/qman.c | 9 +++++---- drivers/bus/dpaa/include/fsl_qman.h | 11 ++++++++++- drivers/net/dpaa/dpaa_ethdev.c | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c index 931d487de4..2315b81065 100644 --- a/drivers/bus/dpaa/base/qbman/qman.c +++ b/drivers/bus/dpaa/base/qbman/qman.c @@ -2784,18 +2784,19 @@ qm_mc_result_timeout(struct qm_portal *portal, RTE_EXPORT_INTERNAL_SYMBOL(qman_shutdown_fq) int -qman_shutdown_fq(u32 fqid) +qman_shutdown_fq(struct qman_fq *fq) { - struct qman_portal *p; + struct qman_portal *p = fq->qp; struct qm_mc_command *mcc; struct qm_mc_result *mcr; int orl_empty, drain = 0, ret = 0; - u32 res; + u32 res, fqid = fq->fqid; u8 state; u32 channel, wq; DPAA_BUS_DEBUG("In shutdown for queue = %x", fqid); - p = get_affine_portal(); + if (!p) + p = get_affine_portal(); /* Determine the state of the FQID */ mcc = qm_mc_start(&p->p); mcc->queryfq_np.fqid = cpu_to_be32(fqid); diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h index 82269cdf99..673859ed2e 100644 --- a/drivers/bus/dpaa/include/fsl_qman.h +++ b/drivers/bus/dpaa/include/fsl_qman.h @@ -1896,7 +1896,16 @@ static inline void qman_release_fqid(u32 fqid) void qman_seed_fqid_range(u32 fqid, unsigned int count); __rte_internal -int qman_shutdown_fq(u32 fqid); +int qman_shutdown_fq(struct qman_fq *fq); + +static inline int qman_shutdown_fq_by_fqid(u32 fqid) +{ + struct qman_fq fq; + + memset(&fq, 0, sizeof(struct qman_fq)); + fq.fqid = fqid; + return qman_shutdown_fq(&fq); +} /** * qman_reserve_fqid_range - Reserve the specified range of frame queue IDs diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 95a328f90f..5cb9411327 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -2358,7 +2358,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) /* Clean up a frame queue left behind by a previous run * before it is initialized. */ - qman_shutdown_fq(fqid); + qman_shutdown_fq_by_fqid(fqid); if (dpaa_intf->cgr_rx) dpaa_intf->cgr_rx[loop].cgrid = cgrid[loop]; -- 2.25.1

