# \[PATCH net\] dpaa\_eth: fix the access method for the dpaa\_napi\_portal

- Subsystems: NETWORKING DRIVERS, THE REST
- Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
- Status: LANDED (433dfc99aa3e · 2021-02-23 01:54)
- Landed in mainline as 433dfc99aa3e on 2021-02-23.
- List: netdev
- 4 messages, 4 authors
- Page: https://ratatoskr.run/netdev/2021/02/11197060/t

## \[PATCH net\] dpaa\_eth: fix the access method for the dpaa\_napi\_portal

- From: Camelia Groza \<hidden\>
- Date: 2021-02-18 19:16:55 
- Message: https://ratatoskr.run/netdev/2021/02/11197060.md

```text
The current use of container_of is flawed and unnecessary. Obtain
the dpaa_napi_portal reference from the private percpu data instead.

Fixes: a1e031ffb422 ("dpaa_eth: add XDP_REDIRECT support")
Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Camelia Groza <redacted>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 6faa20bed488..9905caeaeee3 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2672,7 +2672,6 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct qman_portal *portal,
 	u32 hash;
 	u64 ns;
 
-	np = container_of(&portal, struct dpaa_napi_portal, p);
 	dpaa_fq = container_of(fq, struct dpaa_fq, fq_base);
 	fd_status = be32_to_cpu(fd->status);
 	fd_format = qm_fd_get_format(fd);
@@ -2687,6 +2686,7 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct qman_portal *portal,
 
 	percpu_priv = this_cpu_ptr(priv->percpu_priv);
 	percpu_stats = &percpu_priv->stats;
+	np = &percpu_priv->np;
 
 	if (unlikely(dpaa_eth_napi_schedule(percpu_priv, portal, sched_napi)))
 		return qman_cb_dqrr_stop;
-- 
2.17.1

```

## RE: \[PATCH net\] dpaa\_eth: fix the access method for the dpaa\_napi\_portal

- From: Madalin Bucur (OSS) \<hidden\>
- Date: 2021-02-19 10:16:58 
- Message: https://ratatoskr.run/netdev/2021/02/11197094.md

```text
> -----Original Message-----
> From: Camelia Alexandra Groza <redacted>
> Sent: 18 February 2021 20:21
> To: kuba@kernel.org; davem@davemloft.net; s.hauer@pengutronix.de
> Cc: <redacted>; Madalin Bucur (OSS) <redacted>;
> netdev@vger.kernel.org; Camelia Alexandra Groza [ref]
> Subject: [PATCH net] dpaa_eth: fix the access method for the
> dpaa_napi_portal
> 
> The current use of container_of is flawed and unnecessary. Obtain
> the dpaa_napi_portal reference from the private percpu data instead.
> 
> Fixes: a1e031ffb422 ("dpaa_eth: add XDP_REDIRECT support")
> Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Camelia Groza <redacted>
> ---
>  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> index 6faa20bed488..9905caeaeee3 100644
> --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> @@ -2672,7 +2672,6 @@ static enum qman_cb_dqrr_result
> rx_default_dqrr(struct qman_portal *portal,
>  	u32 hash;
>  	u64 ns;
> 
> -	np = container_of(&portal, struct dpaa_napi_portal, p);
>  	dpaa_fq = container_of(fq, struct dpaa_fq, fq_base);
>  	fd_status = be32_to_cpu(fd->status);
>  	fd_format = qm_fd_get_format(fd);
> @@ -2687,6 +2686,7 @@ static enum qman_cb_dqrr_result
> rx_default_dqrr(struct qman_portal *portal,
> 
>  	percpu_priv = this_cpu_ptr(priv->percpu_priv);
>  	percpu_stats = &percpu_priv->stats;
> +	np = &percpu_priv->np;
> 
>  	if (unlikely(dpaa_eth_napi_schedule(percpu_priv, portal,
> sched_napi)))
>  		return qman_cb_dqrr_stop;
> --
> 2.17.1

Acked-by: Madalin Bucur <redacted>
```

## Re: \[PATCH net\] dpaa\_eth: fix the access method for the dpaa\_napi\_portal

- From: Jesper Dangaard Brouer \<hidden\>
- Date: 2021-02-19 13:42:36 
- Message: https://ratatoskr.run/netdev/2021/02/11197098.md

```text
On Thu, 18 Feb 2021 20:21:06 +0200
Camelia Groza [ref] wrote:

> The current use of container_of is flawed and unnecessary. Obtain
> the dpaa_napi_portal reference from the private percpu data instead.
> 
> Fixes: a1e031ffb422 ("dpaa_eth: add XDP_REDIRECT support")
> Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Camelia Groza <redacted>
> ---
>  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

Acked-by: Jesper Dangaard Brouer <redacted>

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

```

## Re: \[PATCH net\] dpaa\_eth: fix the access method for the dpaa\_napi\_portal

- From: patchwork-bot+netdevbpf@kernel.org
- Date: 2021-02-23 02:51:26 
- Message: https://ratatoskr.run/netdev/2021/02/11197227.md

```text
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu, 18 Feb 2021 20:21:06 +0200 you wrote:
> The current use of container_of is flawed and unnecessary. Obtain
> the dpaa_napi_portal reference from the private percpu data instead.
> 
> Fixes: a1e031ffb422 ("dpaa_eth: add XDP_REDIRECT support")
> Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Camelia Groza <redacted>
> 
> [...]

Here is the summary with links:
  - [net] dpaa_eth: fix the access method for the dpaa_napi_portal
    https://git.kernel.org/netdev/net/c/433dfc99aa3e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html


```
