* [PATCH net] soc: fsl: dpio: properly compute the consumer index
@ 2020-05-05 20:14 Ioana Ciornei
2020-05-05 20:28 ` Leo Li
2020-05-08 0:35 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Ioana Ciornei @ 2020-05-05 20:14 UTC (permalink / raw)
To: davem, netdev, linux-kernel; +Cc: youri.querry_1, leoyang.li, Ioana Ciornei
Mask the consumer index before using it. Without this, we would be
writing frame descriptors beyond the ring size supported by the QBMAN
block.
Fixes: 3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with ring mode enqueue")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
I am sending this fix through the net tree since the bug manifests
itself only on net-next and not the soc trees. This way it would be
easier to integrate this sooner rather than later.
drivers/soc/fsl/dpio/qbman-portal.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c
index 804b8ba9bf5c..23a1377971f4 100644
--- a/drivers/soc/fsl/dpio/qbman-portal.c
+++ b/drivers/soc/fsl/dpio/qbman-portal.c
@@ -669,6 +669,7 @@ int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
eqcr_ci = s->eqcr.ci;
p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI;
s->eqcr.ci = qbman_read_register(s, QBMAN_CINH_SWP_EQCR_CI);
+ s->eqcr.ci &= full_mask;
s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
eqcr_ci, s->eqcr.ci);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH net] soc: fsl: dpio: properly compute the consumer index
2020-05-05 20:14 [PATCH net] soc: fsl: dpio: properly compute the consumer index Ioana Ciornei
@ 2020-05-05 20:28 ` Leo Li
2020-05-05 20:30 ` Ioana Ciornei
2020-05-08 0:35 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Leo Li @ 2020-05-05 20:28 UTC (permalink / raw)
To: Ioana Ciornei, davem, netdev, linux-kernel; +Cc: Youri Querry
> -----Original Message-----
> From: Ioana Ciornei <ioana.ciornei@nxp.com>
> Sent: Tuesday, May 5, 2020 3:14 PM
> To: davem@davemloft.net; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Cc: Youri Querry <youri.querry_1@nxp.com>; Leo Li <leoyang.li@nxp.com>;
> Ioana Ciornei <ioana.ciornei@nxp.com>
> Subject: [PATCH net] soc: fsl: dpio: properly compute the consumer index
>
> Mask the consumer index before using it. Without this, we would be writing
> frame descriptors beyond the ring size supported by the QBMAN block.
>
> Fixes: 3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with ring
> mode enqueue")
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
If you would like it go through net tree.
Acked-by: Li Yang <leoyang.li@nxp.com>
> ---
>
> I am sending this fix through the net tree since the bug manifests itself only
> on net-next and not the soc trees. This way it would be easier to integrate
> this sooner rather than later.
Since the description of the patch says it fixes a patch included from soc tree, it is not very clear why this problem only exists on net-next.
>
> drivers/soc/fsl/dpio/qbman-portal.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/soc/fsl/dpio/qbman-portal.c
> b/drivers/soc/fsl/dpio/qbman-portal.c
> index 804b8ba9bf5c..23a1377971f4 100644
> --- a/drivers/soc/fsl/dpio/qbman-portal.c
> +++ b/drivers/soc/fsl/dpio/qbman-portal.c
> @@ -669,6 +669,7 @@ int qbman_swp_enqueue_multiple_direct(struct
> qbman_swp *s,
> eqcr_ci = s->eqcr.ci;
> p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI;
> s->eqcr.ci = qbman_read_register(s,
> QBMAN_CINH_SWP_EQCR_CI);
> + s->eqcr.ci &= full_mask;
>
> s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
> eqcr_ci, s->eqcr.ci);
> --
> 2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH net] soc: fsl: dpio: properly compute the consumer index
2020-05-05 20:28 ` Leo Li
@ 2020-05-05 20:30 ` Ioana Ciornei
0 siblings, 0 replies; 4+ messages in thread
From: Ioana Ciornei @ 2020-05-05 20:30 UTC (permalink / raw)
To: Leo Li, davem, netdev, linux-kernel; +Cc: Youri Querry
> Subject: RE: [PATCH net] soc: fsl: dpio: properly compute the consumer index
>
>
>
> > -----Original Message-----
> > From: Ioana Ciornei <ioana.ciornei@nxp.com>
> > Sent: Tuesday, May 5, 2020 3:14 PM
> > To: davem@davemloft.net; netdev@vger.kernel.org; linux-
> > kernel@vger.kernel.org
> > Cc: Youri Querry <youri.querry_1@nxp.com>; Leo Li
> > <leoyang.li@nxp.com>; Ioana Ciornei <ioana.ciornei@nxp.com>
> > Subject: [PATCH net] soc: fsl: dpio: properly compute the consumer
> > index
> >
> > Mask the consumer index before using it. Without this, we would be
> > writing frame descriptors beyond the ring size supported by the QBMAN block.
> >
> > Fixes: 3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with
> > ring mode enqueue")
> > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
>
> If you would like it go through net tree.
>
> Acked-by: Li Yang <leoyang.li@nxp.com>
>
> > ---
> >
> > I am sending this fix through the net tree since the bug manifests
> > itself only on net-next and not the soc trees. This way it would be
> > easier to integrate this sooner rather than later.
>
> Since the description of the patch says it fixes a patch included from soc tree, it
> is not very clear why this problem only exists on net-next.
>
The problem is only observed when we enqueue multiple frame descriptors at once, which is happening only with my latest patch set on net-next that adds this for the XDP_REDIRECT path.
> >
> > drivers/soc/fsl/dpio/qbman-portal.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/soc/fsl/dpio/qbman-portal.c
> > b/drivers/soc/fsl/dpio/qbman-portal.c
> > index 804b8ba9bf5c..23a1377971f4 100644
> > --- a/drivers/soc/fsl/dpio/qbman-portal.c
> > +++ b/drivers/soc/fsl/dpio/qbman-portal.c
> > @@ -669,6 +669,7 @@ int qbman_swp_enqueue_multiple_direct(struct
> > qbman_swp *s,
> > eqcr_ci = s->eqcr.ci;
> > p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI;
> > s->eqcr.ci = qbman_read_register(s,
> QBMAN_CINH_SWP_EQCR_CI);
> > + s->eqcr.ci &= full_mask;
> >
> > s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
> > eqcr_ci, s->eqcr.ci);
> > --
> > 2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] soc: fsl: dpio: properly compute the consumer index
2020-05-05 20:14 [PATCH net] soc: fsl: dpio: properly compute the consumer index Ioana Ciornei
2020-05-05 20:28 ` Leo Li
@ 2020-05-08 0:35 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2020-05-08 0:35 UTC (permalink / raw)
To: ioana.ciornei; +Cc: netdev, linux-kernel, youri.querry_1, leoyang.li
From: Ioana Ciornei <ioana.ciornei@nxp.com>
Date: Tue, 5 May 2020 23:14:29 +0300
> Mask the consumer index before using it. Without this, we would be
> writing frame descriptors beyond the ring size supported by the QBMAN
> block.
>
> Fixes: 3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with ring mode enqueue")
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Applied to net-next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-08 0:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 20:14 [PATCH net] soc: fsl: dpio: properly compute the consumer index Ioana Ciornei
2020-05-05 20:28 ` Leo Li
2020-05-05 20:30 ` Ioana Ciornei
2020-05-08 0:35 ` David Miller
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).