diff options
author | Julien Panis <jpanis@baylibre.com> | 2024-04-18 17:34:55 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-04-22 09:13:59 +0100 |
commit | 80b7aae9e3b8fc3f1678be61ccd81d5b6e6bd6be (patch) | |
tree | 3801b5bfb75bc4cf0f2962c8887b70334c0b01f2 | |
parent | bfa858f220ab8c950dd3e1310fee61950d0ecdae (diff) | |
download | linux-stable-80b7aae9e3b8fc3f1678be61ccd81d5b6e6bd6be.tar.gz linux-stable-80b7aae9e3b8fc3f1678be61ccd81d5b6e6bd6be.tar.bz2 linux-stable-80b7aae9e3b8fc3f1678be61ccd81d5b6e6bd6be.zip |
net: ethernet: ti: am65-cpsw: Fix xdp_rxq error for disabled port
When an ethX port is disabled in the device tree, an error is returned
by xdp_rxq_info_reg() function while transitioning the CPSW device to
the up state. The message 'Missing net_device from driver' is output.
This patch fixes the issue by registering xdp_rxq info only if ethX
port is enabled (i.e. ndev pointer is not NULL).
Fixes: 8acacc40f733 ("net: ethernet: ti: am65-cpsw: Add minimal XDP support")
Link: https://lore.kernel.org/all/260d258f-87a1-4aac-8883-aab4746b32d8@ti.com/
Reported-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Closes: https://gist.github.com/Siddharth-Vadapalli-at-TI/5ed0e436606001c247a7da664f75edee
Signed-off-by: Julien Panis <jpanis@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/ti/am65-cpsw-nuss.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 259d7cb13f6e..a7dbbbe3ff5d 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -391,6 +391,9 @@ static void am65_cpsw_destroy_xdp_rxqs(struct am65_cpsw_common *common) int i; for (i = 0; i < common->port_num; i++) { + if (!common->ports[i].ndev) + continue; + rxq = &common->ports[i].xdp_rxq; if (xdp_rxq_info_is_reg(rxq)) @@ -426,6 +429,9 @@ static int am65_cpsw_create_xdp_rxqs(struct am65_cpsw_common *common) rx_chn->page_pool = pool; for (i = 0; i < common->port_num; i++) { + if (!common->ports[i].ndev) + continue; + rxq = &common->ports[i].xdp_rxq; ret = xdp_rxq_info_reg(rxq, common->ports[i].ndev, i, 0); |