Skip to content

Commit

Permalink
dpaa2-switch: seed the buffer pool after allocating the swp
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ioana Ciornei authored and David S. Miller committed Jul 22, 2021
1 parent 9d85a6f commit 7aaa0f3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2770,32 +2770,32 @@ static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw)
if (err)
return err;

err = dpaa2_switch_seed_bp(ethsw);
if (err)
goto err_free_dpbp;

err = dpaa2_switch_alloc_rings(ethsw);
if (err)
goto err_drain_dpbp;
goto err_free_dpbp;

err = dpaa2_switch_setup_dpio(ethsw);
if (err)
goto err_destroy_rings;

err = dpaa2_switch_seed_bp(ethsw);
if (err)
goto err_deregister_dpio;

err = dpsw_ctrl_if_enable(ethsw->mc_io, 0, ethsw->dpsw_handle);
if (err) {
dev_err(ethsw->dev, "dpsw_ctrl_if_enable err %d\n", err);
goto err_deregister_dpio;
goto err_drain_dpbp;
}

return 0;

err_drain_dpbp:
dpaa2_switch_drain_bp(ethsw);
err_deregister_dpio:
dpaa2_switch_free_dpio(ethsw);
err_destroy_rings:
dpaa2_switch_destroy_rings(ethsw);
err_drain_dpbp:
dpaa2_switch_drain_bp(ethsw);
err_free_dpbp:
dpaa2_switch_free_dpbp(ethsw);

Expand Down

0 comments on commit 7aaa0f3

Please sign in to comment.