Commit c6cfc6cd authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2023-08-17 (ice)

This series contains updates to ice driver only.

Jan removes unused functions and refactors code to make, possible,
functions static.

Jake rearranges some functions to be logically grouped.

Marcin removes an unnecessary call to disable VLAN stripping.

Yang Yingliang utilizes list_for_each_entry() helper for a couple list
traversals.

Przemek removes some parameters from ice_aq_alloc_free_res() which were
always the same and reworks ice_aq_wait_for_event() to reduce chance of
race.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ice: split ice_aq_wait_for_event() func into two
  ice: embed &ice_rq_event_info event into struct ice_aq_task
  ice: ice_aq_check_events: fix off-by-one check when filling buffer
  ice: drop two params from ice_aq_alloc_free_res()
  ice: use list_for_each_entry() helper
  ice: Remove redundant VSI configuration in eswitch setup
  ice: move E810T functions to before device agnostic ones
  ice: refactor ice_vsi_is_vlan_pruning_ena
  ice: refactor ice_ptp_hw to make functions static
  ice: refactor ice_sched to make functions static
  ice: Utilize assign_bit() helper
  ice: refactor ice_vf_lib to make functions static
  ice: refactor ice_lib to make functions static
  ice: refactor ice_ddp to make functions static
  ice: remove unused methods
====================

Link: https://lore.kernel.org/r/20230817212239.2601543-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 829b3357 fb9840c4
...@@ -917,8 +917,25 @@ void ice_fdir_release_flows(struct ice_hw *hw); ...@@ -917,8 +917,25 @@ void ice_fdir_release_flows(struct ice_hw *hw);
void ice_fdir_replay_flows(struct ice_hw *hw); void ice_fdir_replay_flows(struct ice_hw *hw);
void ice_fdir_replay_fltrs(struct ice_pf *pf); void ice_fdir_replay_fltrs(struct ice_pf *pf);
int ice_fdir_create_dflt_rules(struct ice_pf *pf); int ice_fdir_create_dflt_rules(struct ice_pf *pf);
int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
struct ice_rq_event_info *event); enum ice_aq_task_state {
ICE_AQ_TASK_NOT_PREPARED,
ICE_AQ_TASK_WAITING,
ICE_AQ_TASK_COMPLETE,
ICE_AQ_TASK_CANCELED,
};
struct ice_aq_task {
struct hlist_node entry;
struct ice_rq_event_info event;
enum ice_aq_task_state state;
u16 opcode;
};
void ice_aq_prep_for_event(struct ice_pf *pf, struct ice_aq_task *task,
u16 opcode);
int ice_aq_wait_for_event(struct ice_pf *pf, struct ice_aq_task *task,
unsigned long timeout);
int ice_open(struct net_device *netdev); int ice_open(struct net_device *netdev);
int ice_open_internal(struct net_device *netdev); int ice_open_internal(struct net_device *netdev);
int ice_stop(struct net_device *netdev); int ice_stop(struct net_device *netdev);
......
...@@ -2000,37 +2000,31 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res) ...@@ -2000,37 +2000,31 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res)
/** /**
* ice_aq_alloc_free_res - command to allocate/free resources * ice_aq_alloc_free_res - command to allocate/free resources
* @hw: pointer to the HW struct * @hw: pointer to the HW struct
* @num_entries: number of resource entries in buffer
* @buf: Indirect buffer to hold data parameters and response * @buf: Indirect buffer to hold data parameters and response
* @buf_size: size of buffer for indirect commands * @buf_size: size of buffer for indirect commands
* @opc: pass in the command opcode * @opc: pass in the command opcode
* @cd: pointer to command details structure or NULL
* *
* Helper function to allocate/free resources using the admin queue commands * Helper function to allocate/free resources using the admin queue commands
*/ */
int int ice_aq_alloc_free_res(struct ice_hw *hw,
ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries, struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size, enum ice_adminq_opc opc)
enum ice_adminq_opc opc, struct ice_sq_cd *cd)
{ {
struct ice_aqc_alloc_free_res_cmd *cmd; struct ice_aqc_alloc_free_res_cmd *cmd;
struct ice_aq_desc desc; struct ice_aq_desc desc;
cmd = &desc.params.sw_res_ctrl; cmd = &desc.params.sw_res_ctrl;
if (!buf) if (!buf || buf_size < flex_array_size(buf, elem, 1))
return -EINVAL;
if (buf_size < flex_array_size(buf, elem, num_entries))
return -EINVAL; return -EINVAL;
ice_fill_dflt_direct_cmd_desc(&desc, opc); ice_fill_dflt_direct_cmd_desc(&desc, opc);
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD); desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
cmd->num_entries = cpu_to_le16(num_entries); cmd->num_entries = cpu_to_le16(1);
return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd); return ice_aq_send_cmd(hw, &desc, buf, buf_size, NULL);
} }
/** /**
...@@ -2060,8 +2054,7 @@ ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res) ...@@ -2060,8 +2054,7 @@ ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res)
if (btm) if (btm)
buf->res_type |= cpu_to_le16(ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM); buf->res_type |= cpu_to_le16(ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM);
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_alloc_res);
ice_aqc_opc_alloc_res, NULL);
if (status) if (status)
goto ice_alloc_res_exit; goto ice_alloc_res_exit;
...@@ -2095,8 +2088,7 @@ int ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res) ...@@ -2095,8 +2088,7 @@ int ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res)
buf->res_type = cpu_to_le16(type); buf->res_type = cpu_to_le16(type);
memcpy(buf->elem, res, sizeof(*buf->elem) * num); memcpy(buf->elem, res, sizeof(*buf->elem) * num);
status = ice_aq_alloc_free_res(hw, num, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_free_res);
ice_aqc_opc_free_res, NULL);
if (status) if (status)
ice_debug(hw, ICE_DBG_SW, "CQ CMD Buffer:\n"); ice_debug(hw, ICE_DBG_SW, "CQ CMD Buffer:\n");
......
...@@ -38,10 +38,9 @@ int ...@@ -38,10 +38,9 @@ int
ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res); ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res);
int int
ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res); ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res);
int int ice_aq_alloc_free_res(struct ice_hw *hw,
ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries, struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size, enum ice_adminq_opc opc);
enum ice_adminq_opc opc, struct ice_sq_cd *cd);
bool ice_is_sbq_supported(struct ice_hw *hw); bool ice_is_sbq_supported(struct ice_hw *hw);
struct ice_ctl_q_info *ice_get_sbq(struct ice_hw *hw); struct ice_ctl_q_info *ice_get_sbq(struct ice_hw *hw);
int int
......
...@@ -30,7 +30,7 @@ static const struct ice_tunnel_type_scan tnls[] = { ...@@ -30,7 +30,7 @@ static const struct ice_tunnel_type_scan tnls[] = {
* Verifies various attributes of the package file, including length, format * Verifies various attributes of the package file, including length, format
* version, and the requirement of at least one segment. * version, and the requirement of at least one segment.
*/ */
enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len) static enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)
{ {
u32 seg_count; u32 seg_count;
u32 i; u32 i;
...@@ -118,7 +118,7 @@ static enum ice_ddp_state ice_chk_pkg_version(struct ice_pkg_ver *pkg_ver) ...@@ -118,7 +118,7 @@ static enum ice_ddp_state ice_chk_pkg_version(struct ice_pkg_ver *pkg_ver)
* *
* This helper function validates a buffer's header. * This helper function validates a buffer's header.
*/ */
struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf) static struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf)
{ {
struct ice_buf_hdr *hdr; struct ice_buf_hdr *hdr;
u16 section_count; u16 section_count;
...@@ -1152,6 +1152,54 @@ static void ice_release_global_cfg_lock(struct ice_hw *hw) ...@@ -1152,6 +1152,54 @@ static void ice_release_global_cfg_lock(struct ice_hw *hw)
ice_release_res(hw, ICE_GLOBAL_CFG_LOCK_RES_ID); ice_release_res(hw, ICE_GLOBAL_CFG_LOCK_RES_ID);
} }
/**
* ice_aq_download_pkg
* @hw: pointer to the hardware structure
* @pkg_buf: the package buffer to transfer
* @buf_size: the size of the package buffer
* @last_buf: last buffer indicator
* @error_offset: returns error offset
* @error_info: returns error information
* @cd: pointer to command details structure or NULL
*
* Download Package (0x0C40)
*/
static int
ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
u16 buf_size, bool last_buf, u32 *error_offset,
u32 *error_info, struct ice_sq_cd *cd)
{
struct ice_aqc_download_pkg *cmd;
struct ice_aq_desc desc;
int status;
if (error_offset)
*error_offset = 0;
if (error_info)
*error_info = 0;
cmd = &desc.params.download_pkg;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_download_pkg);
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
if (last_buf)
cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
status = ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
if (status == -EIO) {
/* Read error from buffer only when the FW returned an error */
struct ice_aqc_download_pkg_resp *resp;
resp = (struct ice_aqc_download_pkg_resp *)pkg_buf;
if (error_offset)
*error_offset = le32_to_cpu(resp->error_offset);
if (error_info)
*error_info = le32_to_cpu(resp->error_info);
}
return status;
}
/** /**
* ice_dwnld_cfg_bufs * ice_dwnld_cfg_bufs
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
...@@ -1294,20 +1342,20 @@ static enum ice_ddp_state ice_download_pkg(struct ice_hw *hw, ...@@ -1294,20 +1342,20 @@ static enum ice_ddp_state ice_download_pkg(struct ice_hw *hw,
} }
/** /**
* ice_aq_download_pkg * ice_aq_update_pkg
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
* @pkg_buf: the package buffer to transfer * @pkg_buf: the package cmd buffer
* @buf_size: the size of the package buffer * @buf_size: the size of the package cmd buffer
* @last_buf: last buffer indicator * @last_buf: last buffer indicator
* @error_offset: returns error offset * @error_offset: returns error offset
* @error_info: returns error information * @error_info: returns error information
* @cd: pointer to command details structure or NULL * @cd: pointer to command details structure or NULL
* *
* Download Package (0x0C40) * Update Package (0x0C42)
*/ */
int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf, static int ice_aq_update_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
u16 buf_size, bool last_buf, u32 *error_offset, u16 buf_size, bool last_buf, u32 *error_offset,
u32 *error_info, struct ice_sq_cd *cd) u32 *error_info, struct ice_sq_cd *cd)
{ {
struct ice_aqc_download_pkg *cmd; struct ice_aqc_download_pkg *cmd;
struct ice_aq_desc desc; struct ice_aq_desc desc;
...@@ -1319,7 +1367,7 @@ int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf, ...@@ -1319,7 +1367,7 @@ int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
*error_info = 0; *error_info = 0;
cmd = &desc.params.download_pkg; cmd = &desc.params.download_pkg;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_download_pkg); ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_update_pkg);
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD); desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
if (last_buf) if (last_buf)
...@@ -1360,53 +1408,6 @@ int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf, ...@@ -1360,53 +1408,6 @@ int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
return ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd); return ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
} }
/**
* ice_aq_update_pkg
* @hw: pointer to the hardware structure
* @pkg_buf: the package cmd buffer
* @buf_size: the size of the package cmd buffer
* @last_buf: last buffer indicator
* @error_offset: returns error offset
* @error_info: returns error information
* @cd: pointer to command details structure or NULL
*
* Update Package (0x0C42)
*/
static int ice_aq_update_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
u16 buf_size, bool last_buf, u32 *error_offset,
u32 *error_info, struct ice_sq_cd *cd)
{
struct ice_aqc_download_pkg *cmd;
struct ice_aq_desc desc;
int status;
if (error_offset)
*error_offset = 0;
if (error_info)
*error_info = 0;
cmd = &desc.params.download_pkg;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_update_pkg);
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
if (last_buf)
cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
status = ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
if (status == -EIO) {
/* Read error from buffer only when the FW returned an error */
struct ice_aqc_download_pkg_resp *resp;
resp = (struct ice_aqc_download_pkg_resp *)pkg_buf;
if (error_offset)
*error_offset = le32_to_cpu(resp->error_offset);
if (error_info)
*error_info = le32_to_cpu(resp->error_info);
}
return status;
}
/** /**
* ice_update_pkg_no_lock * ice_update_pkg_no_lock
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
...@@ -1470,8 +1471,9 @@ int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count) ...@@ -1470,8 +1471,9 @@ int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count)
* success it returns a pointer to the segment header, otherwise it will * success it returns a pointer to the segment header, otherwise it will
* return NULL. * return NULL.
*/ */
struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type, static struct ice_generic_seg_hdr *
struct ice_pkg_hdr *pkg_hdr) ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
struct ice_pkg_hdr *pkg_hdr)
{ {
u32 i; u32 i;
......
...@@ -416,21 +416,13 @@ struct ice_pkg_enum { ...@@ -416,21 +416,13 @@ struct ice_pkg_enum {
void *(*handler)(u32 sect_type, void *section, u32 index, u32 *offset); void *(*handler)(u32 sect_type, void *section, u32 index, u32 *offset);
}; };
int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
u16 buf_size, bool last_buf, u32 *error_offset,
u32 *error_info, struct ice_sq_cd *cd);
int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf, int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
u16 buf_size, struct ice_sq_cd *cd); u16 buf_size, struct ice_sq_cd *cd);
void *ice_pkg_buf_alloc_section(struct ice_buf_build *bld, u32 type, u16 size); void *ice_pkg_buf_alloc_section(struct ice_buf_build *bld, u32 type, u16 size);
enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len);
struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw); struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw);
struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
struct ice_pkg_hdr *pkg_hdr);
int ice_update_pkg_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 count); int ice_update_pkg_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count); int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
...@@ -439,6 +431,4 @@ u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld); ...@@ -439,6 +431,4 @@ u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld);
void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state, void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state,
u32 sect_type); u32 sect_type);
struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf);
#endif #endif
...@@ -84,10 +84,6 @@ static int ice_eswitch_setup_env(struct ice_pf *pf) ...@@ -84,10 +84,6 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
struct ice_vsi_vlan_ops *vlan_ops; struct ice_vsi_vlan_ops *vlan_ops;
bool rule_added = false; bool rule_added = false;
vlan_ops = ice_get_compat_vsi_vlan_ops(ctrl_vsi);
if (vlan_ops->dis_stripping(ctrl_vsi))
return -ENODEV;
ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx); ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx);
netif_addr_lock_bh(uplink_netdev); netif_addr_lock_bh(uplink_netdev);
......
...@@ -293,16 +293,17 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset, ...@@ -293,16 +293,17 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
{ {
u16 completion_module, completion_retval; u16 completion_module, completion_retval;
struct device *dev = ice_pf_to_dev(pf); struct device *dev = ice_pf_to_dev(pf);
struct ice_rq_event_info event; struct ice_aq_task task = {};
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
struct ice_aq_desc *desc;
u32 completion_offset; u32 completion_offset;
int err; int err;
memset(&event, 0, sizeof(event));
dev_dbg(dev, "Writing block of %u bytes for module 0x%02x at offset %u\n", dev_dbg(dev, "Writing block of %u bytes for module 0x%02x at offset %u\n",
block_size, module, offset); block_size, module, offset);
ice_aq_prep_for_event(pf, &task, ice_aqc_opc_nvm_write);
err = ice_aq_update_nvm(hw, module, offset, block_size, block, err = ice_aq_update_nvm(hw, module, offset, block_size, block,
last_cmd, 0, NULL); last_cmd, 0, NULL);
if (err) { if (err) {
...@@ -319,7 +320,7 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset, ...@@ -319,7 +320,7 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
* is conservative and is intended to prevent failure to update when * is conservative and is intended to prevent failure to update when
* firmware is slow to respond. * firmware is slow to respond.
*/ */
err = ice_aq_wait_for_event(pf, ice_aqc_opc_nvm_write, 15 * HZ, &event); err = ice_aq_wait_for_event(pf, &task, 15 * HZ);
if (err) { if (err) {
dev_err(dev, "Timed out while trying to flash module 0x%02x with block of size %u at offset %u, err %d\n", dev_err(dev, "Timed out while trying to flash module 0x%02x with block of size %u at offset %u, err %d\n",
module, block_size, offset, err); module, block_size, offset, err);
...@@ -327,11 +328,12 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset, ...@@ -327,11 +328,12 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
return -EIO; return -EIO;
} }
completion_module = le16_to_cpu(event.desc.params.nvm.module_typeid); desc = &task.event.desc;
completion_retval = le16_to_cpu(event.desc.retval); completion_module = le16_to_cpu(desc->params.nvm.module_typeid);
completion_retval = le16_to_cpu(desc->retval);
completion_offset = le16_to_cpu(event.desc.params.nvm.offset_low); completion_offset = le16_to_cpu(desc->params.nvm.offset_low);
completion_offset |= event.desc.params.nvm.offset_high << 16; completion_offset |= desc->params.nvm.offset_high << 16;
if (completion_module != module) { if (completion_module != module) {
dev_err(dev, "Unexpected module_typeid in write completion: got 0x%x, expected 0x%x\n", dev_err(dev, "Unexpected module_typeid in write completion: got 0x%x, expected 0x%x\n",
...@@ -363,8 +365,8 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset, ...@@ -363,8 +365,8 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
*/ */
if (reset_level && last_cmd && module == ICE_SR_1ST_NVM_BANK_PTR) { if (reset_level && last_cmd && module == ICE_SR_1ST_NVM_BANK_PTR) {
if (hw->dev_caps.common_cap.pcie_reset_avoidance) { if (hw->dev_caps.common_cap.pcie_reset_avoidance) {
*reset_level = (event.desc.params.nvm.cmd_flags & *reset_level = desc->params.nvm.cmd_flags &
ICE_AQC_NVM_RESET_LVL_M); ICE_AQC_NVM_RESET_LVL_M;
dev_dbg(dev, "Firmware reported required reset level as %u\n", dev_dbg(dev, "Firmware reported required reset level as %u\n",
*reset_level); *reset_level);
} else { } else {
...@@ -479,19 +481,20 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component, ...@@ -479,19 +481,20 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component,
{ {
u16 completion_module, completion_retval; u16 completion_module, completion_retval;
struct device *dev = ice_pf_to_dev(pf); struct device *dev = ice_pf_to_dev(pf);
struct ice_rq_event_info event; struct ice_aq_task task = {};
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
struct ice_aq_desc *desc;
struct devlink *devlink; struct devlink *devlink;
int err; int err;
dev_dbg(dev, "Beginning erase of flash component '%s', module 0x%02x\n", component, module); dev_dbg(dev, "Beginning erase of flash component '%s', module 0x%02x\n", component, module);
memset(&event, 0, sizeof(event));
devlink = priv_to_devlink(pf); devlink = priv_to_devlink(pf);
devlink_flash_update_timeout_notify(devlink, "Erasing", component, ICE_FW_ERASE_TIMEOUT); devlink_flash_update_timeout_notify(devlink, "Erasing", component, ICE_FW_ERASE_TIMEOUT);
ice_aq_prep_for_event(pf, &task, ice_aqc_opc_nvm_erase);
err = ice_aq_erase_nvm(hw, module, NULL); err = ice_aq_erase_nvm(hw, module, NULL);
if (err) { if (err) {
dev_err(dev, "Failed to erase %s (module 0x%02x), err %d aq_err %s\n", dev_err(dev, "Failed to erase %s (module 0x%02x), err %d aq_err %s\n",
...@@ -502,7 +505,7 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component, ...@@ -502,7 +505,7 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component,
goto out_notify_devlink; goto out_notify_devlink;
} }
err = ice_aq_wait_for_event(pf, ice_aqc_opc_nvm_erase, ICE_FW_ERASE_TIMEOUT * HZ, &event); err = ice_aq_wait_for_event(pf, &task, ICE_FW_ERASE_TIMEOUT * HZ);
if (err) { if (err) {
dev_err(dev, "Timed out waiting for firmware to respond with erase completion for %s (module 0x%02x), err %d\n", dev_err(dev, "Timed out waiting for firmware to respond with erase completion for %s (module 0x%02x), err %d\n",
component, module, err); component, module, err);
...@@ -510,8 +513,9 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component, ...@@ -510,8 +513,9 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component,
goto out_notify_devlink; goto out_notify_devlink;
} }
completion_module = le16_to_cpu(event.desc.params.nvm.module_typeid); desc = &task.event.desc;
completion_retval = le16_to_cpu(event.desc.retval); completion_module = le16_to_cpu(desc->params.nvm.module_typeid);
completion_retval = le16_to_cpu(desc->retval);
if (completion_module != module) { if (completion_module != module) {
dev_err(dev, "Unexpected module_typeid in erase completion for %s: got 0x%x, expected 0x%x\n", dev_err(dev, "Unexpected module_typeid in erase completion for %s: got 0x%x, expected 0x%x\n",
...@@ -560,13 +564,13 @@ ice_switch_flash_banks(struct ice_pf *pf, u8 activate_flags, ...@@ -560,13 +564,13 @@ ice_switch_flash_banks(struct ice_pf *pf, u8 activate_flags,
u8 *emp_reset_available, struct netlink_ext_ack *extack) u8 *emp_reset_available, struct netlink_ext_ack *extack)
{ {
struct device *dev = ice_pf_to_dev(pf); struct device *dev = ice_pf_to_dev(pf);
struct ice_rq_event_info event; struct ice_aq_task task = {};
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
u16 completion_retval; u16 completion_retval;
u8 response_flags; u8 response_flags;
int err; int err;
memset(&event, 0, sizeof(event)); ice_aq_prep_for_event(pf, &task, ice_aqc_opc_nvm_write_activate);
err = ice_nvm_write_activate(hw, activate_flags, &response_flags); err = ice_nvm_write_activate(hw, activate_flags, &response_flags);
if (err) { if (err) {
...@@ -592,8 +596,7 @@ ice_switch_flash_banks(struct ice_pf *pf, u8 activate_flags, ...@@ -592,8 +596,7 @@ ice_switch_flash_banks(struct ice_pf *pf, u8 activate_flags,
} }
} }
err = ice_aq_wait_for_event(pf, ice_aqc_opc_nvm_write_activate, 30 * HZ, err = ice_aq_wait_for_event(pf, &task, 30 * HZ);
&event);
if (err) { if (err) {
dev_err(dev, "Timed out waiting for firmware to switch active flash banks, err %d\n", dev_err(dev, "Timed out waiting for firmware to switch active flash banks, err %d\n",
err); err);
...@@ -601,7 +604,7 @@ ice_switch_flash_banks(struct ice_pf *pf, u8 activate_flags, ...@@ -601,7 +604,7 @@ ice_switch_flash_banks(struct ice_pf *pf, u8 activate_flags,
return err; return err;
} }
completion_retval = le16_to_cpu(event.desc.retval); completion_retval = le16_to_cpu(task.event.desc.retval);
if (completion_retval) { if (completion_retval) {
dev_err(dev, "Firmware failed to switch active flash banks aq_err %s\n", dev_err(dev, "Firmware failed to switch active flash banks aq_err %s\n",
ice_aq_str((enum ice_aq_err)completion_retval)); ice_aq_str((enum ice_aq_err)completion_retval));
......
...@@ -129,11 +129,9 @@ ice_lag_find_hw_by_lport(struct ice_lag *lag, u8 lport) ...@@ -129,11 +129,9 @@ ice_lag_find_hw_by_lport(struct ice_lag *lag, u8 lport)
struct ice_lag_netdev_list *entry; struct ice_lag_netdev_list *entry;
struct net_device *tmp_netdev; struct net_device *tmp_netdev;
struct ice_netdev_priv *np; struct ice_netdev_priv *np;
struct list_head *tmp;
struct ice_hw *hw; struct ice_hw *hw;
list_for_each(tmp, lag->netdev_head) { list_for_each_entry(entry, lag->netdev_head, node) {
entry = list_entry(tmp, struct ice_lag_netdev_list, node);
tmp_netdev = entry->netdev; tmp_netdev = entry->netdev;
if (!tmp_netdev || !netif_is_ice(tmp_netdev)) if (!tmp_netdev || !netif_is_ice(tmp_netdev))
continue; continue;
...@@ -985,9 +983,8 @@ ice_lag_set_swid(u16 primary_swid, struct ice_lag *local_lag, ...@@ -985,9 +983,8 @@ ice_lag_set_swid(u16 primary_swid, struct ice_lag *local_lag,
/* if unlinnking need to free the shared resource */ /* if unlinnking need to free the shared resource */
if (!link && local_lag->bond_swid) { if (!link && local_lag->bond_swid) {
buf->elem[0].e.sw_resp = cpu_to_le16(local_lag->bond_swid); buf->elem[0].e.sw_resp = cpu_to_le16(local_lag->bond_swid);
status = ice_aq_alloc_free_res(&local_lag->pf->hw, 1, buf, status = ice_aq_alloc_free_res(&local_lag->pf->hw, buf,
buf_len, ice_aqc_opc_free_res, buf_len, ice_aqc_opc_free_res);
NULL);
if (status) if (status)
dev_err(ice_pf_to_dev(local_lag->pf), "Error freeing SWID during LAG unlink\n"); dev_err(ice_pf_to_dev(local_lag->pf), "Error freeing SWID during LAG unlink\n");
local_lag->bond_swid = 0; local_lag->bond_swid = 0;
...@@ -1004,8 +1001,8 @@ ice_lag_set_swid(u16 primary_swid, struct ice_lag *local_lag, ...@@ -1004,8 +1001,8 @@ ice_lag_set_swid(u16 primary_swid, struct ice_lag *local_lag,
cpu_to_le16(local_lag->pf->hw.port_info->sw_id); cpu_to_le16(local_lag->pf->hw.port_info->sw_id);
} }
status = ice_aq_alloc_free_res(&local_lag->pf->hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(&local_lag->pf->hw, buf, buf_len,
ice_aqc_opc_alloc_res, NULL); ice_aqc_opc_alloc_res);
if (status) if (status)
dev_err(ice_pf_to_dev(local_lag->pf), "Error subscribing to SWID 0x%04X\n", dev_err(ice_pf_to_dev(local_lag->pf), "Error subscribing to SWID 0x%04X\n",
local_lag->bond_swid); local_lag->bond_swid);
...@@ -1535,11 +1532,9 @@ static void ice_lag_disable_sriov_bond(struct ice_lag *lag) ...@@ -1535,11 +1532,9 @@ static void ice_lag_disable_sriov_bond(struct ice_lag *lag)
struct ice_lag_netdev_list *entry; struct ice_lag_netdev_list *entry;
struct ice_netdev_priv *np; struct ice_netdev_priv *np;
struct net_device *netdev; struct net_device *netdev;
struct list_head *tmp;
struct ice_pf *pf; struct ice_pf *pf;
list_for_each(tmp, lag->netdev_head) { list_for_each_entry(entry, lag->netdev_head, node) {
entry = list_entry(tmp, struct ice_lag_netdev_list, node);
netdev = entry->netdev; netdev = entry->netdev;
np = netdev_priv(netdev); np = netdev_priv(netdev);
pf = np->vsi->back; pf = np->vsi->back;
......
...@@ -1227,6 +1227,17 @@ ice_chnl_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) ...@@ -1227,6 +1227,17 @@ ice_chnl_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
ctxt->info.q_mapping[1] = cpu_to_le16(qcount); ctxt->info.q_mapping[1] = cpu_to_le16(qcount);
} }
/**
* ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not
* @vsi: VSI to check whether or not VLAN pruning is enabled.
*
* returns true if Rx VLAN pruning is enabled and false otherwise.
*/
static bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi)
{
return vsi->info.sw_flags2 & ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
}
/** /**
* ice_vsi_init - Create and initialize a VSI * ice_vsi_init - Create and initialize a VSI
* @vsi: the VSI being configured * @vsi: the VSI being configured
...@@ -1684,6 +1695,27 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi) ...@@ -1684,6 +1695,27 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi)
vsi_num, status); vsi_num, status);
} }
/**
* ice_vsi_cfg_frame_size - setup max frame size and Rx buffer length
* @vsi: VSI
*/
static void ice_vsi_cfg_frame_size(struct ice_vsi *vsi)
{
if (!vsi->netdev || test_bit(ICE_FLAG_LEGACY_RX, vsi->back->flags)) {
vsi->max_frame = ICE_MAX_FRAME_LEGACY_RX;
vsi->rx_buf_len = ICE_RXBUF_1664;
#if (PAGE_SIZE < 8192)
} else if (!ICE_2K_TOO_SMALL_WITH_PADDING &&
(vsi->netdev->mtu <= ETH_DATA_LEN)) {
vsi->max_frame = ICE_RXBUF_1536 - NET_IP_ALIGN;
vsi->rx_buf_len = ICE_RXBUF_1536 - NET_IP_ALIGN;
#endif
} else {
vsi->max_frame = ICE_AQ_SET_MAC_FRAME_SIZE_MAX;
vsi->rx_buf_len = ICE_RXBUF_3072;
}
}
/** /**
* ice_pf_state_is_nominal - checks the PF for nominal state * ice_pf_state_is_nominal - checks the PF for nominal state
* @pf: pointer to PF to check * @pf: pointer to PF to check
...@@ -1758,27 +1790,6 @@ void ice_update_eth_stats(struct ice_vsi *vsi) ...@@ -1758,27 +1790,6 @@ void ice_update_eth_stats(struct ice_vsi *vsi)
vsi->stat_offsets_loaded = true; vsi->stat_offsets_loaded = true;
} }
/**
* ice_vsi_cfg_frame_size - setup max frame size and Rx buffer length
* @vsi: VSI
*/
void ice_vsi_cfg_frame_size(struct ice_vsi *vsi)
{
if (!vsi->netdev || test_bit(ICE_FLAG_LEGACY_RX, vsi->back->flags)) {
vsi->max_frame = ICE_MAX_FRAME_LEGACY_RX;
vsi->rx_buf_len = ICE_RXBUF_1664;
#if (PAGE_SIZE < 8192)
} else if (!ICE_2K_TOO_SMALL_WITH_PADDING &&
(vsi->netdev->mtu <= ETH_DATA_LEN)) {
vsi->max_frame = ICE_RXBUF_1536 - NET_IP_ALIGN;
vsi->rx_buf_len = ICE_RXBUF_1536 - NET_IP_ALIGN;
#endif
} else {
vsi->max_frame = ICE_AQ_SET_MAC_FRAME_SIZE_MAX;
vsi->rx_buf_len = ICE_RXBUF_3072;
}
}
/** /**
* ice_write_qrxflxp_cntxt - write/configure QRXFLXP_CNTXT register * ice_write_qrxflxp_cntxt - write/configure QRXFLXP_CNTXT register
* @hw: HW pointer * @hw: HW pointer
...@@ -2185,20 +2196,6 @@ bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi) ...@@ -2185,20 +2196,6 @@ bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi)
return false; return false;
} }
/**
* ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not
* @vsi: VSI to check whether or not VLAN pruning is enabled.
*
* returns true if Rx VLAN pruning is enabled and false otherwise.
*/
bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi)
{
if (!vsi)
return false;
return (vsi->info.sw_flags2 & ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA);
}
static void ice_vsi_set_tc_cfg(struct ice_vsi *vsi) static void ice_vsi_set_tc_cfg(struct ice_vsi *vsi)
{ {
if (!test_bit(ICE_FLAG_DCB_ENA, vsi->back->flags)) { if (!test_bit(ICE_FLAG_DCB_ENA, vsi->back->flags)) {
...@@ -2943,21 +2940,6 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi) ...@@ -2943,21 +2940,6 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi)
synchronize_irq(vsi->q_vectors[i]->irq.virq); synchronize_irq(vsi->q_vectors[i]->irq.virq);
} }
/**
* ice_napi_del - Remove NAPI handler for the VSI
* @vsi: VSI for which NAPI handler is to be removed
*/
void ice_napi_del(struct ice_vsi *vsi)
{
int v_idx;
if (!vsi->netdev)
return;
ice_for_each_q_vector(vsi, v_idx)
netif_napi_del(&vsi->q_vectors[v_idx]->napi);
}
/** /**
* ice_vsi_release - Delete a VSI and free its resources * ice_vsi_release - Delete a VSI and free its resources
* @vsi: the VSI being removed * @vsi: the VSI being removed
......
...@@ -76,8 +76,6 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi); ...@@ -76,8 +76,6 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi);
int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi); int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi);
bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi);
void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create); void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create);
int ice_set_link(struct ice_vsi *vsi, bool ena); int ice_set_link(struct ice_vsi *vsi, bool ena);
...@@ -93,8 +91,6 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc); ...@@ -93,8 +91,6 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc);
struct ice_vsi * struct ice_vsi *
ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params); ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params);
void ice_napi_del(struct ice_vsi *vsi);
int ice_vsi_release(struct ice_vsi *vsi); int ice_vsi_release(struct ice_vsi *vsi);
void ice_vsi_close(struct ice_vsi *vsi); void ice_vsi_close(struct ice_vsi *vsi);
...@@ -130,7 +126,6 @@ void ice_update_tx_ring_stats(struct ice_tx_ring *ring, u64 pkts, u64 bytes); ...@@ -130,7 +126,6 @@ void ice_update_tx_ring_stats(struct ice_tx_ring *ring, u64 pkts, u64 bytes);
void ice_update_rx_ring_stats(struct ice_rx_ring *ring, u64 pkts, u64 bytes); void ice_update_rx_ring_stats(struct ice_rx_ring *ring, u64 pkts, u64 bytes);
void ice_vsi_cfg_frame_size(struct ice_vsi *vsi);
void ice_write_intrl(struct ice_q_vector *q_vector, u8 intrl); void ice_write_intrl(struct ice_q_vector *q_vector, u8 intrl);
void ice_write_itr(struct ice_ring_container *rc, u16 itr); void ice_write_itr(struct ice_ring_container *rc, u16 itr);
void ice_set_q_vector_intrl(struct ice_q_vector *q_vector); void ice_set_q_vector_intrl(struct ice_q_vector *q_vector);
......
...@@ -1250,64 +1250,63 @@ ice_handle_link_event(struct ice_pf *pf, struct ice_rq_event_info *event) ...@@ -1250,64 +1250,63 @@ ice_handle_link_event(struct ice_pf *pf, struct ice_rq_event_info *event)
return status; return status;
} }
enum ice_aq_task_state { /**
ICE_AQ_TASK_WAITING = 0, * ice_aq_prep_for_event - Prepare to wait for an AdminQ event from firmware
ICE_AQ_TASK_COMPLETE, * @pf: pointer to the PF private structure
ICE_AQ_TASK_CANCELED, * @task: intermediate helper storage and identifier for waiting
}; * @opcode: the opcode to wait for
*
struct ice_aq_task { * Prepares to wait for a specific AdminQ completion event on the ARQ for
struct hlist_node entry; * a given PF. Actual wait would be done by a call to ice_aq_wait_for_event().
*
* Calls are separated to allow caller registering for event before sending
* the command, which mitigates a race between registering and FW responding.
*
* To obtain only the descriptor contents, pass an task->event with null
* msg_buf. If the complete data buffer is desired, allocate the
* task->event.msg_buf with enough space ahead of time.
*/
void ice_aq_prep_for_event(struct ice_pf *pf, struct ice_aq_task *task,
u16 opcode)
{
INIT_HLIST_NODE(&task->entry);
task->opcode = opcode;
task->state = ICE_AQ_TASK_WAITING;
u16 opcode; spin_lock_bh(&pf->aq_wait_lock);
struct ice_rq_event_info *event; hlist_add_head(&task->entry, &pf->aq_wait_list);
enum ice_aq_task_state state; spin_unlock_bh(&pf->aq_wait_lock);
}; }
/** /**
* ice_aq_wait_for_event - Wait for an AdminQ event from firmware * ice_aq_wait_for_event - Wait for an AdminQ event from firmware
* @pf: pointer to the PF private structure * @pf: pointer to the PF private structure
* @opcode: the opcode to wait for * @task: ptr prepared by ice_aq_prep_for_event()
* @timeout: how long to wait, in jiffies * @timeout: how long to wait, in jiffies
* @event: storage for the event info
* *
* Waits for a specific AdminQ completion event on the ARQ for a given PF. The * Waits for a specific AdminQ completion event on the ARQ for a given PF. The
* current thread will be put to sleep until the specified event occurs or * current thread will be put to sleep until the specified event occurs or
* until the given timeout is reached. * until the given timeout is reached.
* *
* To obtain only the descriptor contents, pass an event without an allocated
* msg_buf. If the complete data buffer is desired, allocate the
* event->msg_buf with enough space ahead of time.
*
* Returns: zero on success, or a negative error code on failure. * Returns: zero on success, or a negative error code on failure.
*/ */
int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, int ice_aq_wait_for_event(struct ice_pf *pf, struct ice_aq_task *task,
struct ice_rq_event_info *event) unsigned long timeout)
{ {
enum ice_aq_task_state *state = &task->state;
struct device *dev = ice_pf_to_dev(pf); struct device *dev = ice_pf_to_dev(pf);
struct ice_aq_task *task; unsigned long start = jiffies;
unsigned long start;
long ret; long ret;
int err; int err;
task = kzalloc(sizeof(*task), GFP_KERNEL); ret = wait_event_interruptible_timeout(pf->aq_wait_queue,
if (!task) *state != ICE_AQ_TASK_WAITING,
return -ENOMEM;
INIT_HLIST_NODE(&task->entry);
task->opcode = opcode;
task->event = event;
task->state = ICE_AQ_TASK_WAITING;
spin_lock_bh(&pf->aq_wait_lock);
hlist_add_head(&task->entry, &pf->aq_wait_list);
spin_unlock_bh(&pf->aq_wait_lock);
start = jiffies;
ret = wait_event_interruptible_timeout(pf->aq_wait_queue, task->state,
timeout); timeout);
switch (task->state) { switch (*state) {
case ICE_AQ_TASK_NOT_PREPARED:
WARN(1, "call to %s without ice_aq_prep_for_event()", __func__);
err = -EINVAL;
break;
case ICE_AQ_TASK_WAITING: case ICE_AQ_TASK_WAITING:
err = ret < 0 ? ret : -ETIMEDOUT; err = ret < 0 ? ret : -ETIMEDOUT;
break; break;
...@@ -1318,7 +1317,7 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, ...@@ -1318,7 +1317,7 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
err = ret < 0 ? ret : 0; err = ret < 0 ? ret : 0;
break; break;
default: default:
WARN(1, "Unexpected AdminQ wait task state %u", task->state); WARN(1, "Unexpected AdminQ wait task state %u", *state);
err = -EINVAL; err = -EINVAL;
break; break;
} }
...@@ -1326,12 +1325,11 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, ...@@ -1326,12 +1325,11 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
dev_dbg(dev, "Waited %u msecs (max %u msecs) for firmware response to op 0x%04x\n", dev_dbg(dev, "Waited %u msecs (max %u msecs) for firmware response to op 0x%04x\n",
jiffies_to_msecs(jiffies - start), jiffies_to_msecs(jiffies - start),
jiffies_to_msecs(timeout), jiffies_to_msecs(timeout),
opcode); task->opcode);
spin_lock_bh(&pf->aq_wait_lock); spin_lock_bh(&pf->aq_wait_lock);
hlist_del(&task->entry); hlist_del(&task->entry);
spin_unlock_bh(&pf->aq_wait_lock); spin_unlock_bh(&pf->aq_wait_lock);
kfree(task);
return err; return err;
} }
...@@ -1357,23 +1355,26 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, ...@@ -1357,23 +1355,26 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
static void ice_aq_check_events(struct ice_pf *pf, u16 opcode, static void ice_aq_check_events(struct ice_pf *pf, u16 opcode,
struct ice_rq_event_info *event) struct ice_rq_event_info *event)
{ {
struct ice_rq_event_info *task_ev;
struct ice_aq_task *task; struct ice_aq_task *task;
bool found = false; bool found = false;
spin_lock_bh(&pf->aq_wait_lock); spin_lock_bh(&pf->aq_wait_lock);
hlist_for_each_entry(task, &pf->aq_wait_list, entry) { hlist_for_each_entry(task, &pf->aq_wait_list, entry) {
if (task->state || task->opcode != opcode) if (task->state != ICE_AQ_TASK_WAITING)
continue;
if (task->opcode != opcode)
continue; continue;
memcpy(&task->event->desc, &event->desc, sizeof(event->desc)); task_ev = &task->event;
task->event->msg_len = event->msg_len; memcpy(&task_ev->desc, &event->desc, sizeof(event->desc));
task_ev->msg_len = event->msg_len;
/* Only copy the data buffer if a destination was set */ /* Only copy the data buffer if a destination was set */
if (task->event->msg_buf && if (task_ev->msg_buf && task_ev->buf_len >= event->buf_len) {
task->event->buf_len > event->buf_len) { memcpy(task_ev->msg_buf, event->msg_buf,
memcpy(task->event->msg_buf, event->msg_buf,
event->buf_len); event->buf_len);
task->event->buf_len = event->buf_len; task_ev->buf_len = event->buf_len;
} }
task->state = ICE_AQ_TASK_COMPLETE; task->state = ICE_AQ_TASK_COMPLETE;
......
This diff is collapsed.
...@@ -141,11 +141,8 @@ int ice_ptp_init_phc(struct ice_hw *hw); ...@@ -141,11 +141,8 @@ int ice_ptp_init_phc(struct ice_hw *hw);
int ice_get_phy_tx_tstamp_ready(struct ice_hw *hw, u8 block, u64 *tstamp_ready); int ice_get_phy_tx_tstamp_ready(struct ice_hw *hw, u8 block, u64 *tstamp_ready);
/* E822 family functions */ /* E822 family functions */
int ice_read_phy_reg_e822(struct ice_hw *hw, u8 port, u16 offset, u32 *val);
int ice_write_phy_reg_e822(struct ice_hw *hw, u8 port, u16 offset, u32 val);
int ice_read_quad_reg_e822(struct ice_hw *hw, u8 quad, u16 offset, u32 *val); int ice_read_quad_reg_e822(struct ice_hw *hw, u8 quad, u16 offset, u32 *val);
int ice_write_quad_reg_e822(struct ice_hw *hw, u8 quad, u16 offset, u32 val); int ice_write_quad_reg_e822(struct ice_hw *hw, u8 quad, u16 offset, u32 val);
int ice_ptp_prep_port_adj_e822(struct ice_hw *hw, u8 port, s64 time);
void ice_ptp_reset_ts_memory_quad_e822(struct ice_hw *hw, u8 quad); void ice_ptp_reset_ts_memory_quad_e822(struct ice_hw *hw, u8 quad);
/** /**
...@@ -199,7 +196,6 @@ int ice_ptp_init_phy_e810(struct ice_hw *hw); ...@@ -199,7 +196,6 @@ int ice_ptp_init_phy_e810(struct ice_hw *hw);
int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data); int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data);
int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data); int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data);
int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data); int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data);
bool ice_is_pca9575_present(struct ice_hw *hw);
#define PFTSYN_SEM_BYTES 4 #define PFTSYN_SEM_BYTES 4
......
...@@ -3971,7 +3971,7 @@ ice_sched_get_node_by_id_type(struct ice_port_info *pi, u32 id, ...@@ -3971,7 +3971,7 @@ ice_sched_get_node_by_id_type(struct ice_port_info *pi, u32 id,
* This function sets BW limit of VSI or Aggregator scheduling node * This function sets BW limit of VSI or Aggregator scheduling node
* based on TC information from passed in argument BW. * based on TC information from passed in argument BW.
*/ */
int static int
ice_sched_set_node_bw_lmt_per_tc(struct ice_port_info *pi, u32 id, ice_sched_set_node_bw_lmt_per_tc(struct ice_port_info *pi, u32 id,
enum ice_agg_type agg_type, u8 tc, enum ice_agg_type agg_type, u8 tc,
enum ice_rl_type rl_type, u32 bw) enum ice_rl_type rl_type, u32 bw)
......
...@@ -141,10 +141,6 @@ ice_cfg_vsi_bw_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc, ...@@ -141,10 +141,6 @@ ice_cfg_vsi_bw_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
int int
ice_cfg_vsi_bw_dflt_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc, ice_cfg_vsi_bw_dflt_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
enum ice_rl_type rl_type); enum ice_rl_type rl_type);
int
ice_sched_set_node_bw_lmt_per_tc(struct ice_port_info *pi, u32 id,
enum ice_agg_type agg_type, u8 tc,
enum ice_rl_type rl_type, u32 bw);
int ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes); int ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes);
int int
ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids, ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids,
......
...@@ -1847,7 +1847,7 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id, ...@@ -1847,7 +1847,7 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id,
if (opc == ice_aqc_opc_free_res) if (opc == ice_aqc_opc_free_res)
sw_buf->elem[0].e.sw_resp = cpu_to_le16(*vsi_list_id); sw_buf->elem[0].e.sw_resp = cpu_to_le16(*vsi_list_id);
status = ice_aq_alloc_free_res(hw, 1, sw_buf, buf_len, opc, NULL); status = ice_aq_alloc_free_res(hw, sw_buf, buf_len, opc);
if (status) if (status)
goto ice_aq_alloc_free_vsi_list_exit; goto ice_aq_alloc_free_vsi_list_exit;
...@@ -2101,8 +2101,8 @@ int ice_alloc_recipe(struct ice_hw *hw, u16 *rid) ...@@ -2101,8 +2101,8 @@ int ice_alloc_recipe(struct ice_hw *hw, u16 *rid)
sw_buf->res_type = cpu_to_le16((ICE_AQC_RES_TYPE_RECIPE << sw_buf->res_type = cpu_to_le16((ICE_AQC_RES_TYPE_RECIPE <<
ICE_AQC_RES_TYPE_S) | ICE_AQC_RES_TYPE_S) |
ICE_AQC_RES_TYPE_FLAG_SHARED); ICE_AQC_RES_TYPE_FLAG_SHARED);
status = ice_aq_alloc_free_res(hw, 1, sw_buf, buf_len, status = ice_aq_alloc_free_res(hw, sw_buf, buf_len,
ice_aqc_opc_alloc_res, NULL); ice_aqc_opc_alloc_res);
if (!status) if (!status)
*rid = le16_to_cpu(sw_buf->elem[0].e.sw_resp); *rid = le16_to_cpu(sw_buf->elem[0].e.sw_resp);
kfree(sw_buf); kfree(sw_buf);
...@@ -3408,54 +3408,6 @@ ice_remove_rule_internal(struct ice_hw *hw, u8 recp_id, ...@@ -3408,54 +3408,6 @@ ice_remove_rule_internal(struct ice_hw *hw, u8 recp_id,
return status; return status;
} }
/**
* ice_mac_fltr_exist - does this MAC filter exist for given VSI
* @hw: pointer to the hardware structure
* @mac: MAC address to be checked (for MAC filter)
* @vsi_handle: check MAC filter for this VSI
*/
bool ice_mac_fltr_exist(struct ice_hw *hw, u8 *mac, u16 vsi_handle)
{
struct ice_fltr_mgmt_list_entry *entry;
struct list_head *rule_head;
struct ice_switch_info *sw;
struct mutex *rule_lock; /* Lock to protect filter rule list */
u16 hw_vsi_id;
if (!ice_is_vsi_valid(hw, vsi_handle))
return false;
hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
sw = hw->switch_info;
rule_head = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rules;
if (!rule_head)
return false;
rule_lock = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rule_lock;
mutex_lock(rule_lock);
list_for_each_entry(entry, rule_head, list_entry) {
struct ice_fltr_info *f_info = &entry->fltr_info;
u8 *mac_addr = &f_info->l_data.mac.mac_addr[0];
if (is_zero_ether_addr(mac_addr))
continue;
if (f_info->flag != ICE_FLTR_TX ||
f_info->src_id != ICE_SRC_ID_VSI ||
f_info->lkup_type != ICE_SW_LKUP_MAC ||
f_info->fltr_act != ICE_FWD_TO_VSI ||
hw_vsi_id != f_info->fwd_id.hw_vsi_id)
continue;
if (ether_addr_equal(mac, mac_addr)) {
mutex_unlock(rule_lock);
return true;
}
}
mutex_unlock(rule_lock);
return false;
}
/** /**
* ice_vlan_fltr_exist - does this VLAN filter exist for given VSI * ice_vlan_fltr_exist - does this VLAN filter exist for given VSI
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
...@@ -4496,8 +4448,7 @@ ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, ...@@ -4496,8 +4448,7 @@ ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,
buf->res_type = cpu_to_le16(((type << ICE_AQC_RES_TYPE_S) & buf->res_type = cpu_to_le16(((type << ICE_AQC_RES_TYPE_S) &
ICE_AQC_RES_TYPE_M) | alloc_shared); ICE_AQC_RES_TYPE_M) | alloc_shared);
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_alloc_res);
ice_aqc_opc_alloc_res, NULL);
if (status) if (status)
goto exit; goto exit;
...@@ -4535,8 +4486,7 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, ...@@ -4535,8 +4486,7 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,
ICE_AQC_RES_TYPE_M) | alloc_shared); ICE_AQC_RES_TYPE_M) | alloc_shared);
buf->elem[0].e.sw_resp = cpu_to_le16(counter_id); buf->elem[0].e.sw_resp = cpu_to_le16(counter_id);
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_free_res);
ice_aqc_opc_free_res, NULL);
if (status) if (status)
ice_debug(hw, ICE_DBG_SW, "counter resource could not be freed\n"); ice_debug(hw, ICE_DBG_SW, "counter resource could not be freed\n");
...@@ -4578,8 +4528,8 @@ int ice_share_res(struct ice_hw *hw, u16 type, u8 shared, u16 res_id) ...@@ -4578,8 +4528,8 @@ int ice_share_res(struct ice_hw *hw, u16 type, u8 shared, u16 res_id)
~ICE_AQC_RES_TYPE_FLAG_SHARED); ~ICE_AQC_RES_TYPE_FLAG_SHARED);
buf->elem[0].e.sw_resp = cpu_to_le16(res_id); buf->elem[0].e.sw_resp = cpu_to_le16(res_id);
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len,
ice_aqc_opc_share_res, NULL); ice_aqc_opc_share_res);
if (status) if (status)
ice_debug(hw, ICE_DBG_SW, "Could not set resource type %u id %u to %s\n", ice_debug(hw, ICE_DBG_SW, "Could not set resource type %u id %u to %s\n",
type, res_id, shared ? "SHARED" : "DEDICATED"); type, res_id, shared ? "SHARED" : "DEDICATED");
......
...@@ -371,7 +371,6 @@ int ice_add_vlan(struct ice_hw *hw, struct list_head *m_list); ...@@ -371,7 +371,6 @@ int ice_add_vlan(struct ice_hw *hw, struct list_head *m_list);
int ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); int ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list);
int ice_add_mac(struct ice_hw *hw, struct list_head *m_lst); int ice_add_mac(struct ice_hw *hw, struct list_head *m_lst);
int ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst); int ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst);
bool ice_mac_fltr_exist(struct ice_hw *hw, u8 *mac, u16 vsi_handle);
bool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle); bool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle);
int ice_add_eth_mac(struct ice_hw *hw, struct list_head *em_list); int ice_add_eth_mac(struct ice_hw *hw, struct list_head *em_list);
int ice_remove_eth_mac(struct ice_hw *hw, struct list_head *em_list); int ice_remove_eth_mac(struct ice_hw *hw, struct list_head *em_list);
......
This diff is collapsed.
...@@ -32,13 +32,11 @@ int ice_vsi_apply_spoofchk(struct ice_vsi *vsi, bool enable); ...@@ -32,13 +32,11 @@ int ice_vsi_apply_spoofchk(struct ice_vsi *vsi, bool enable);
bool ice_is_vf_trusted(struct ice_vf *vf); bool ice_is_vf_trusted(struct ice_vf *vf);
bool ice_vf_has_no_qs_ena(struct ice_vf *vf); bool ice_vf_has_no_qs_ena(struct ice_vf *vf);
bool ice_is_vf_link_up(struct ice_vf *vf); bool ice_is_vf_link_up(struct ice_vf *vf);
void ice_vf_rebuild_host_cfg(struct ice_vf *vf);
void ice_vf_ctrl_invalidate_vsi(struct ice_vf *vf); void ice_vf_ctrl_invalidate_vsi(struct ice_vf *vf);
void ice_vf_ctrl_vsi_release(struct ice_vf *vf); void ice_vf_ctrl_vsi_release(struct ice_vf *vf);
struct ice_vsi *ice_vf_ctrl_vsi_setup(struct ice_vf *vf); struct ice_vsi *ice_vf_ctrl_vsi_setup(struct ice_vf *vf);
int ice_vf_init_host_cfg(struct ice_vf *vf, struct ice_vsi *vsi); int ice_vf_init_host_cfg(struct ice_vf *vf, struct ice_vsi *vsi);
void ice_vf_invalidate_vsi(struct ice_vf *vf); void ice_vf_invalidate_vsi(struct ice_vf *vf);
void ice_vf_vsi_release(struct ice_vf *vf); void ice_vf_vsi_release(struct ice_vf *vf);
void ice_vf_set_initialized(struct ice_vf *vf);
#endif /* _ICE_VF_LIB_PRIVATE_H_ */ #endif /* _ICE_VF_LIB_PRIVATE_H_ */
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