Message ID | 20201101232257.3028508-4-bigeasy@linutronix.de (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [v2,net-next,1/3] soc/fsl/qbman: Add an argument to signal if NAPI processing is required. | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (8cb17737940b156329cb5210669b9c9b23f4dd56) |
snowpatch_ozlabs/build-ppc64le | success | Build succeeded |
snowpatch_ozlabs/build-ppc64be | success | Build succeeded |
snowpatch_ozlabs/build-ppc64e | success | Build succeeded |
snowpatch_ozlabs/build-pmac32 | success | Build succeeded |
snowpatch_ozlabs/checkpatch | success | |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
On 11/2/2020 1:23 AM, Sebastian Andrzej Siewior wrote: > The driver uses in_irq() + in_serving_softirq() magic to decide if NAPI > scheduling is required or packet processing. > > The usage of in_*() in drivers is phased out and Linus clearly requested > that code which changes behaviour depending on context should either be > separated or the context be conveyed in an argument passed by the caller, > which usually knows the context. > > Use the `sched_napi' argument passed by the callback. It is set true if > called from the interrupt handler and NAPI should be scheduled. > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > Cc: "Horia Geantă" <horia.geanta@nxp.com> > Cc: Aymen Sghaier <aymen.sghaier@nxp.com> > Cc: Herbert Xu <herbert@gondor.apana.org.au> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Madalin Bucur <madalin.bucur@nxp.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Li Yang <leoyang.li@nxp.com> > Cc: linux-crypto@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Horia Geantă <horia.geanta@nxp.com> Thanks, Horia
diff --git a/drivers/crypto/caam/qi.c b/drivers/crypto/caam/qi.c index 57f6ab6bfb56a..8163f5df8ebf7 100644 --- a/drivers/crypto/caam/qi.c +++ b/drivers/crypto/caam/qi.c @@ -545,14 +545,10 @@ static void cgr_cb(struct qman_portal *qm, struct qman_cgr *cgr, int congested) } } -static int caam_qi_napi_schedule(struct qman_portal *p, struct caam_napi *np) +static int caam_qi_napi_schedule(struct qman_portal *p, struct caam_napi *np, + bool sched_napi) { - /* - * In case of threaded ISR, for RT kernels in_irq() does not return - * appropriate value, so use in_serving_softirq to distinguish between - * softirq and irq contexts. - */ - if (unlikely(in_irq() || !in_serving_softirq())) { + if (sched_napi) { /* Disable QMan IRQ source and invoke NAPI */ qman_p_irqsource_remove(p, QM_PIRQ_DQRI); np->p = p; @@ -574,7 +570,7 @@ static enum qman_cb_dqrr_result caam_rsp_fq_dqrr_cb(struct qman_portal *p, struct caam_drv_private *priv = dev_get_drvdata(qidev); u32 status; - if (caam_qi_napi_schedule(p, caam_napi)) + if (caam_qi_napi_schedule(p, caam_napi, sched_napi)) return qman_cb_dqrr_stop; fd = &dqrr->fd;
The driver uses in_irq() + in_serving_softirq() magic to decide if NAPI scheduling is required or packet processing. The usage of in_*() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated or the context be conveyed in an argument passed by the caller, which usually knows the context. Use the `sched_napi' argument passed by the callback. It is set true if called from the interrupt handler and NAPI should be scheduled. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: "Horia Geantă" <horia.geanta@nxp.com> Cc: Aymen Sghaier <aymen.sghaier@nxp.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: "David S. Miller" <davem@davemloft.net> Cc: Madalin Bucur <madalin.bucur@nxp.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Li Yang <leoyang.li@nxp.com> Cc: linux-crypto@vger.kernel.org Cc: netdev@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org --- drivers/crypto/caam/qi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)