Commit 613c0a58 authored by Ioana Ciornei's avatar Ioana Ciornei Committed by David S. Miller

staging: dpaa2-switch: enable the control interface

Enable the CTRL_IF of the switch object, now that all the pieces are in
place (buffer and queue management, interrupts, NAPI instances etc).
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7fd94d86
...@@ -78,6 +78,8 @@ ...@@ -78,6 +78,8 @@
#define DPSW_CMDID_CTRL_IF_GET_ATTR DPSW_CMD_ID(0x0A0) #define DPSW_CMDID_CTRL_IF_GET_ATTR DPSW_CMD_ID(0x0A0)
#define DPSW_CMDID_CTRL_IF_SET_POOLS DPSW_CMD_ID(0x0A1) #define DPSW_CMDID_CTRL_IF_SET_POOLS DPSW_CMD_ID(0x0A1)
#define DPSW_CMDID_CTRL_IF_ENABLE DPSW_CMD_ID(0x0A2)
#define DPSW_CMDID_CTRL_IF_DISABLE DPSW_CMD_ID(0x0A3)
#define DPSW_CMDID_CTRL_IF_SET_QUEUE DPSW_CMD_ID(0x0A6) #define DPSW_CMDID_CTRL_IF_SET_QUEUE DPSW_CMD_ID(0x0A6)
/* Macros for accessing command fields smaller than 1byte */ /* Macros for accessing command fields smaller than 1byte */
......
...@@ -1363,3 +1363,40 @@ int dpsw_if_set_primary_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags, ...@@ -1363,3 +1363,40 @@ int dpsw_if_set_primary_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags,
/* send command to mc*/ /* send command to mc*/
return mc_send_command(mc_io, &cmd); return mc_send_command(mc_io, &cmd);
} }
/**
* dpsw_ctrl_if_enable() - Enable control interface
* @mc_io: Pointer to MC portal's I/O object
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
* @token: Token of DPSW object
*
* Return: '0' on Success; Error code otherwise.
*/
int dpsw_ctrl_if_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
{
struct fsl_mc_command cmd = { 0 };
cmd.header = mc_encode_cmd_header(DPSW_CMDID_CTRL_IF_ENABLE, cmd_flags,
token);
return mc_send_command(mc_io, &cmd);
}
/**
* dpsw_ctrl_if_disable() - Function disables control interface
* @mc_io: Pointer to MC portal's I/O object
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
* @token: Token of DPSW object
*
* Return: '0' on Success; Error code otherwise.
*/
int dpsw_ctrl_if_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
{
struct fsl_mc_command cmd = { 0 };
cmd.header = mc_encode_cmd_header(DPSW_CMDID_CTRL_IF_DISABLE,
cmd_flags,
token);
return mc_send_command(mc_io, &cmd);
}
...@@ -245,6 +245,11 @@ struct dpsw_ctrl_if_queue_cfg { ...@@ -245,6 +245,11 @@ struct dpsw_ctrl_if_queue_cfg {
int dpsw_ctrl_if_set_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int dpsw_ctrl_if_set_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
enum dpsw_queue_type qtype, enum dpsw_queue_type qtype,
const struct dpsw_ctrl_if_queue_cfg *cfg); const struct dpsw_ctrl_if_queue_cfg *cfg);
int dpsw_ctrl_if_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
int dpsw_ctrl_if_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
/** /**
* enum dpsw_action - Action selection for special/control frames * enum dpsw_action - Action selection for special/control frames
* @DPSW_ACTION_DROP: Drop frame * @DPSW_ACTION_DROP: Drop frame
......
...@@ -2066,8 +2066,16 @@ static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw) ...@@ -2066,8 +2066,16 @@ static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw)
if (err) if (err)
goto err_destroy_rings; goto err_destroy_rings;
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;
}
return 0; return 0;
err_deregister_dpio:
dpaa2_switch_free_dpio(ethsw);
err_destroy_rings: err_destroy_rings:
dpaa2_switch_destroy_rings(ethsw); dpaa2_switch_destroy_rings(ethsw);
err_drain_dpbp: err_drain_dpbp:
...@@ -2283,6 +2291,7 @@ static void dpaa2_switch_takedown(struct fsl_mc_device *sw_dev) ...@@ -2283,6 +2291,7 @@ static void dpaa2_switch_takedown(struct fsl_mc_device *sw_dev)
static void dpaa2_switch_ctrl_if_teardown(struct ethsw_core *ethsw) static void dpaa2_switch_ctrl_if_teardown(struct ethsw_core *ethsw)
{ {
dpsw_ctrl_if_disable(ethsw->mc_io, 0, ethsw->dpsw_handle);
dpaa2_switch_free_dpio(ethsw); dpaa2_switch_free_dpio(ethsw);
dpaa2_switch_destroy_rings(ethsw); dpaa2_switch_destroy_rings(ethsw);
dpaa2_switch_drain_bp(ethsw); dpaa2_switch_drain_bp(ethsw);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment