提交 30b5cb60 编写于 作者: P Pranavi Somisetty 提交者: Michal Simek

net: xilinx: Change the name of cam add/del function

Change the function return type,scope and name of switch cam
add/delete function from static void add_delete_cam_entry
to int tsn_switch_cam_set. Update timeout implementation and
handle error reporting in the same function.
Signed-off-by: NPranavi Somisetty <pranavi.somisetty@xilinx.com>
Signed-off-by: NSaurabh Sengar <saurabh.singh@xilinx.com>
Signed-off-by: NSyed Syed <syed.syed@xilinx.com>
Signed-off-by: NPriyadarshini Babu <priyadarshini.babu@xilinx.com>
Signed-off-by: NRavali Potineni <ravali.potineni@xilinx.com>
Signed-off-by: NHarini Katakam <harini.katakam@xilinx.com>
Reviewed-by: NRadhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
上级 528f1761
......@@ -443,19 +443,20 @@ static void get_memory_static_counter(struct switch_data *data)
XAS_MEM_STCNTR_ERR_BE_MAC1_MAC2 + 0x4);
}
static void add_delete_cam_entry(struct cam_struct data, u8 add)
int tsn_switch_cam_set(struct cam_struct data, u8 add)
{
u32 port_action = 0;
u32 tv2 = 0;
u32 timeout = 20000;
u32 reg, err;
/* wait for cam init done */
while (!(axienet_ior(&lp, XAS_SDL_CAM_STATUS_OFFSET) &
SDL_CAM_WR_ENABLE) && timeout)
timeout--;
err = readl_poll_timeout(lp.regs + XAS_SDL_CAM_STATUS_OFFSET, reg,
(reg & SDL_CAM_WR_ENABLE), 10,
DELAY_OF_FIVE_MILLISEC);
if (err) {
pr_err("CAM init timed out\n");
return -ETIMEDOUT;
}
if (!timeout)
pr_warn("CAM init took longer time!!");
/* mac and vlan */
axienet_iow(&lp, XAS_SDL_CAM_KEY1_OFFSET,
(data.dest_addr[0] << 24) | (data.dest_addr[1] << 16) |
......@@ -501,14 +502,16 @@ static void add_delete_cam_entry(struct cam_struct data, u8 add)
else
axienet_iow(&lp, XAS_SDL_CAM_CTRL_OFFSET, SDL_CAM_DELETE_ENTRY);
timeout = 20000;
/* wait for write to complete */
while ((axienet_ior(&lp, XAS_SDL_CAM_CTRL_OFFSET) &
SDL_CAM_WR_ENABLE) && timeout)
timeout--;
err = readl_poll_timeout(lp.regs + XAS_SDL_CAM_CTRL_OFFSET, reg,
(!(reg & SDL_CAM_WR_ENABLE)), 10,
DELAY_OF_FIVE_MILLISEC);
if (err) {
pr_err("CAM write timed out\n");
return -ETIMEDOUT;
}
if (!timeout)
pr_warn("CAM write took longer time!!");
return 0;
}
static void port_vlan_mem_ctrl(u32 port_vlan_mem)
......@@ -1118,7 +1121,10 @@ static long switch_ioctl(struct file *file, unsigned int cmd,
retval = -EINVAL;
goto end;
}
add_delete_cam_entry(data.cam_data, ADD);
if (tsn_switch_cam_set(data.cam_data, ADD)) {
retval = -EINVAL;
goto end;
}
break;
case DELETE_CAM_ENTRY:
......@@ -1127,7 +1133,10 @@ static long switch_ioctl(struct file *file, unsigned int cmd,
retval = -EINVAL;
goto end;
}
add_delete_cam_entry(data.cam_data, DELETE);
if (tsn_switch_cam_set(data.cam_data, DELETE)) {
retval = -EINVAL;
goto end;
}
break;
case PORT_VLAN_MEM_CTRL:
......
......@@ -442,6 +442,7 @@ void config_ingress_filter(struct in_fltr data);
void get_member_reg(struct frer_memb_config *data);
void program_member_reg(struct frer_memb_config data);
void get_frer_static_counter(struct frer_static_counter *data);
int tsn_switch_cam_set(struct cam_struct data, u8 add);
int tsn_switch_set_stp_state(struct port_status *port);
int tsn_switch_vlan_add(struct port_vlan *port, int add);
int tsn_switch_pvid_get(struct native_vlan *port);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册