Skip to content

Commit 80b7aae

Browse files
jpanisbldavem330
authored andcommitted
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: 8acacc4 ("net: ethernet: ti: am65-cpsw: Add minimal XDP support") Link: https://lore.kernel.org/all/[email protected]/ Reported-by: Siddharth Vadapalli <[email protected]> Closes: https://gist.github.com/Siddharth-Vadapalli-at-TI/5ed0e436606001c247a7da664f75edee Signed-off-by: Julien Panis <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bfa858f commit 80b7aae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/ethernet/ti/am65-cpsw-nuss.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ static void am65_cpsw_destroy_xdp_rxqs(struct am65_cpsw_common *common)
391391
int i;
392392

393393
for (i = 0; i < common->port_num; i++) {
394+
if (!common->ports[i].ndev)
395+
continue;
396+
394397
rxq = &common->ports[i].xdp_rxq;
395398

396399
if (xdp_rxq_info_is_reg(rxq))
@@ -426,6 +429,9 @@ static int am65_cpsw_create_xdp_rxqs(struct am65_cpsw_common *common)
426429
rx_chn->page_pool = pool;
427430

428431
for (i = 0; i < common->port_num; i++) {
432+
if (!common->ports[i].ndev)
433+
continue;
434+
429435
rxq = &common->ports[i].xdp_rxq;
430436

431437
ret = xdp_rxq_info_reg(rxq, common->ports[i].ndev, i, 0);

0 commit comments

Comments
 (0)