Skip to content

Commit 7aaa0f3

Browse files
IoanaCiorneidavem330
authored andcommitted
dpaa2-switch: seed the buffer pool after allocating the swp
Any interraction with the buffer pool (seeding a buffer, acquire one) is made through a software portal (SWP, a DPIO object). There are circumstances where the dpaa2-switch driver probes on a DPSW before any DPIO devices have been probed. In this case, seeding of the buffer pool will lead to a panic since no SWPs are initialized. To fix this, seed the buffer pool after making sure that the software portals have been probed and are ready to be used. Fixes: 0b1b713 ("staging: dpaa2-switch: handle Rx path on control interface") Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9d85a6f commit 7aaa0f3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,32 +2770,32 @@ static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw)
27702770
if (err)
27712771
return err;
27722772

2773-
err = dpaa2_switch_seed_bp(ethsw);
2774-
if (err)
2775-
goto err_free_dpbp;
2776-
27772773
err = dpaa2_switch_alloc_rings(ethsw);
27782774
if (err)
2779-
goto err_drain_dpbp;
2775+
goto err_free_dpbp;
27802776

27812777
err = dpaa2_switch_setup_dpio(ethsw);
27822778
if (err)
27832779
goto err_destroy_rings;
27842780

2781+
err = dpaa2_switch_seed_bp(ethsw);
2782+
if (err)
2783+
goto err_deregister_dpio;
2784+
27852785
err = dpsw_ctrl_if_enable(ethsw->mc_io, 0, ethsw->dpsw_handle);
27862786
if (err) {
27872787
dev_err(ethsw->dev, "dpsw_ctrl_if_enable err %d\n", err);
2788-
goto err_deregister_dpio;
2788+
goto err_drain_dpbp;
27892789
}
27902790

27912791
return 0;
27922792

2793+
err_drain_dpbp:
2794+
dpaa2_switch_drain_bp(ethsw);
27932795
err_deregister_dpio:
27942796
dpaa2_switch_free_dpio(ethsw);
27952797
err_destroy_rings:
27962798
dpaa2_switch_destroy_rings(ethsw);
2797-
err_drain_dpbp:
2798-
dpaa2_switch_drain_bp(ethsw);
27992799
err_free_dpbp:
28002800
dpaa2_switch_free_dpbp(ethsw);
28012801

0 commit comments

Comments
 (0)