Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== 100GbE Intel Wired LAN Driver Updates 2021-12-14 This series contains updates to ice driver only. Haiyue adds support to query hardware for supported PTYPEs. Jeff changes PTYPE validation to utilize the capabilities queried from the hardware instead of maintaining a per DDP support list. Brett refactors promiscuous functions to provide common and clear interfaces to call for configuration. Wojciech modifies DDP package load to simplify determining the final state of the load. Tony removes the use of ice_status from the driver. This involves removing string conversion functions, converting variables and values to standard errors, and clean up. He also removes an unused define. Dan Carpenter removes unneeded casts. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
5a21bf5bb4
@ -848,7 +848,6 @@ void ice_print_link_msg(struct ice_vsi *vsi, bool isup);
|
||||
int ice_plug_aux_dev(struct ice_pf *pf);
|
||||
void ice_unplug_aux_dev(struct ice_pf *pf);
|
||||
int ice_init_rdma(struct ice_pf *pf);
|
||||
const char *ice_stat_str(enum ice_status stat_err);
|
||||
const char *ice_aq_str(enum ice_aq_err aq_err);
|
||||
bool ice_is_wol_supported(struct ice_hw *hw);
|
||||
int
|
||||
|
@ -759,7 +759,7 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_tx_ring *ring,
|
||||
struct ice_channel *ch = ring->ch;
|
||||
struct ice_pf *pf = vsi->back;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
u16 pf_q;
|
||||
u8 tc;
|
||||
|
||||
@ -804,9 +804,9 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_tx_ring *ring,
|
||||
ring->q_handle, 1, qg_buf, buf_len,
|
||||
NULL);
|
||||
if (status) {
|
||||
dev_err(ice_pf_to_dev(pf), "Failed to set LAN Tx queue context, error: %s\n",
|
||||
ice_stat_str(status));
|
||||
return -ENODEV;
|
||||
dev_err(ice_pf_to_dev(pf), "Failed to set LAN Tx queue context, error: %d\n",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Add Tx Queue TEID into the VSI Tx ring from the
|
||||
@ -929,7 +929,7 @@ ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
|
||||
struct ice_pf *pf = vsi->back;
|
||||
struct ice_q_vector *q_vector;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
u32 val;
|
||||
|
||||
/* clear cause_ena bit for disabled queues */
|
||||
@ -953,18 +953,18 @@ ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
|
||||
rel_vmvf_num, NULL);
|
||||
|
||||
/* if the disable queue command was exercised during an
|
||||
* active reset flow, ICE_ERR_RESET_ONGOING is returned.
|
||||
* active reset flow, -EBUSY is returned.
|
||||
* This is not an error as the reset operation disables
|
||||
* queues at the hardware level anyway.
|
||||
*/
|
||||
if (status == ICE_ERR_RESET_ONGOING) {
|
||||
if (status == -EBUSY) {
|
||||
dev_dbg(ice_pf_to_dev(vsi->back), "Reset in progress. LAN Tx queues already disabled\n");
|
||||
} else if (status == ICE_ERR_DOES_NOT_EXIST) {
|
||||
} else if (status == -ENOENT) {
|
||||
dev_dbg(ice_pf_to_dev(vsi->back), "LAN Tx queues do not exist, nothing to disable\n");
|
||||
} else if (status) {
|
||||
dev_dbg(ice_pf_to_dev(vsi->back), "Failed to disable LAN Tx queues, error: %s\n",
|
||||
ice_stat_str(status));
|
||||
return -ENODEV;
|
||||
dev_dbg(ice_pf_to_dev(vsi->back), "Failed to disable LAN Tx queues, error: %d\n",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,108 +14,108 @@
|
||||
#define ICE_SQ_SEND_DELAY_TIME_MS 10
|
||||
#define ICE_SQ_SEND_MAX_EXECUTE 3
|
||||
|
||||
enum ice_status ice_init_hw(struct ice_hw *hw);
|
||||
int ice_init_hw(struct ice_hw *hw);
|
||||
void ice_deinit_hw(struct ice_hw *hw);
|
||||
enum ice_status ice_check_reset(struct ice_hw *hw);
|
||||
enum ice_status ice_reset(struct ice_hw *hw, enum ice_reset_req req);
|
||||
enum ice_status ice_create_all_ctrlq(struct ice_hw *hw);
|
||||
enum ice_status ice_init_all_ctrlq(struct ice_hw *hw);
|
||||
int ice_check_reset(struct ice_hw *hw);
|
||||
int ice_reset(struct ice_hw *hw, enum ice_reset_req req);
|
||||
int ice_create_all_ctrlq(struct ice_hw *hw);
|
||||
int ice_init_all_ctrlq(struct ice_hw *hw);
|
||||
void ice_shutdown_all_ctrlq(struct ice_hw *hw);
|
||||
void ice_destroy_all_ctrlq(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
struct ice_rq_event_info *e, u16 *pending);
|
||||
enum ice_status
|
||||
int
|
||||
ice_get_link_status(struct ice_port_info *pi, bool *link_up);
|
||||
enum ice_status ice_update_link_info(struct ice_port_info *pi);
|
||||
enum ice_status
|
||||
int ice_update_link_info(struct ice_port_info *pi);
|
||||
int
|
||||
ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res,
|
||||
enum ice_aq_res_access_type access, u32 timeout);
|
||||
void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res);
|
||||
enum ice_status
|
||||
int
|
||||
ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res);
|
||||
enum ice_status
|
||||
int
|
||||
ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries,
|
||||
struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
|
||||
enum ice_adminq_opc opc, struct ice_sq_cd *cd);
|
||||
bool ice_is_sbq_supported(struct ice_hw *hw);
|
||||
struct ice_ctl_q_info *ice_get_sbq(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
struct ice_aq_desc *desc, void *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd);
|
||||
void ice_clear_pxe_mode(struct ice_hw *hw);
|
||||
enum ice_status ice_get_caps(struct ice_hw *hw);
|
||||
int ice_get_caps(struct ice_hw *hw);
|
||||
|
||||
void ice_set_safe_mode_caps(struct ice_hw *hw);
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
|
||||
u32 rxq_index);
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_handle,
|
||||
struct ice_aqc_get_set_rss_keys *keys);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_set_rss_key(struct ice_hw *hw, u16 vsi_handle,
|
||||
struct ice_aqc_get_set_rss_keys *keys);
|
||||
|
||||
bool ice_check_sq_alive(struct ice_hw *hw, struct ice_ctl_q_info *cq);
|
||||
enum ice_status ice_aq_q_shutdown(struct ice_hw *hw, bool unloading);
|
||||
int ice_aq_q_shutdown(struct ice_hw *hw, bool unloading);
|
||||
void ice_fill_dflt_direct_cmd_desc(struct ice_aq_desc *desc, u16 opcode);
|
||||
extern const struct ice_ctx_ele ice_tlan_ctx_info[];
|
||||
enum ice_status
|
||||
int
|
||||
ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
|
||||
const struct ice_ctx_ele *ce_info);
|
||||
|
||||
extern struct mutex ice_global_cfg_lock_sw;
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc,
|
||||
void *buf, u16 buf_size, struct ice_sq_cd *cd);
|
||||
enum ice_status ice_aq_get_fw_ver(struct ice_hw *hw, struct ice_sq_cd *cd);
|
||||
int ice_aq_get_fw_ver(struct ice_hw *hw, struct ice_sq_cd *cd);
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_send_driver_ver(struct ice_hw *hw, struct ice_driver_ver *dv,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,
|
||||
struct ice_aqc_get_phy_caps_data *caps,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_list_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count,
|
||||
enum ice_adminq_opc opc, struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_discover_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_caps);
|
||||
void
|
||||
ice_update_phy_type(u64 *phy_type_low, u64 *phy_type_high,
|
||||
u16 link_speeds_bitmap);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags,
|
||||
struct ice_sq_cd *cd);
|
||||
bool ice_is_e810(struct ice_hw *hw);
|
||||
enum ice_status ice_clear_pf_cfg(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int ice_clear_pf_cfg(struct ice_hw *hw);
|
||||
int
|
||||
ice_aq_set_phy_cfg(struct ice_hw *hw, struct ice_port_info *pi,
|
||||
struct ice_aqc_set_phy_cfg_data *cfg, struct ice_sq_cd *cd);
|
||||
bool ice_fw_supports_link_override(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_get_link_default_override(struct ice_link_default_override_tlv *ldo,
|
||||
struct ice_port_info *pi);
|
||||
bool ice_is_phy_caps_an_enabled(struct ice_aqc_get_phy_caps_data *caps);
|
||||
|
||||
enum ice_fc_mode ice_caps_to_fc_mode(u8 caps);
|
||||
enum ice_fec_mode ice_caps_to_fec_mode(u8 caps, u8 fec_options);
|
||||
enum ice_status
|
||||
int
|
||||
ice_set_fc(struct ice_port_info *pi, u8 *aq_failures,
|
||||
bool ena_auto_link_update);
|
||||
enum ice_status
|
||||
int
|
||||
ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
|
||||
enum ice_fc_mode fc);
|
||||
bool
|
||||
@ -125,27 +125,27 @@ void
|
||||
ice_copy_phy_caps_to_cfg(struct ice_port_info *pi,
|
||||
struct ice_aqc_get_phy_caps_data *caps,
|
||||
struct ice_aqc_set_phy_cfg_data *cfg);
|
||||
enum ice_status
|
||||
int
|
||||
ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
|
||||
enum ice_fec_mode fec);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_set_mac_cfg(struct ice_hw *hw, u16 max_frame_size, struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
|
||||
struct ice_link_status *link, struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_set_event_mask(struct ice_hw *hw, u8 port_num, u16 mask,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_set_mac_loopback(struct ice_hw *hw, bool ena_lpbk, struct ice_sq_cd *cd);
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_set_port_id_led(struct ice_port_info *pi, bool is_orig_mode,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,
|
||||
u16 mem_addr, u8 page, u8 set_page, u8 *data, u8 length,
|
||||
bool write, struct ice_sq_cd *cd);
|
||||
@ -159,19 +159,19 @@ ice_ena_vsi_rdma_qset(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
int
|
||||
ice_dis_vsi_rdma_qset(struct ice_port_info *pi, u16 count, u32 *qset_teid,
|
||||
u16 *q_id);
|
||||
enum ice_status
|
||||
int
|
||||
ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
|
||||
u16 *q_handle, u16 *q_ids, u32 *q_teids,
|
||||
enum ice_disq_rst_src rst_src, u16 vmvf_num,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_handle, u8 tc_bitmap,
|
||||
u16 *max_lanqs);
|
||||
enum ice_status
|
||||
int
|
||||
ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,
|
||||
u8 num_qgrps, struct ice_aqc_add_tx_qgrp *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle);
|
||||
int ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle);
|
||||
void ice_replay_post(struct ice_hw *hw);
|
||||
void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf);
|
||||
struct ice_q_ctx *
|
||||
@ -184,7 +184,7 @@ void
|
||||
ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
|
||||
u64 *prev_stat, u64 *cur_stat);
|
||||
bool ice_is_e810t(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
|
||||
struct ice_aqc_txsched_elem_data *buf);
|
||||
int
|
||||
@ -199,11 +199,11 @@ ice_aq_set_gpio(struct ice_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx, bool value,
|
||||
int
|
||||
ice_aq_get_gpio(struct ice_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx,
|
||||
bool *value, struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd);
|
||||
bool ice_fw_supports_lldp_fltr_ctrl(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_lldp_fltr_add_remove(struct ice_hw *hw, u16 vsi_num, bool add);
|
||||
bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw);
|
||||
#endif /* _ICE_COMMON_H_ */
|
||||
|
@ -87,7 +87,7 @@ bool ice_check_sq_alive(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
* @hw: pointer to the hardware structure
|
||||
* @cq: pointer to the specific Control queue
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_alloc_ctrlq_sq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
size_t size = cq->num_sq_entries * sizeof(struct ice_aq_desc);
|
||||
@ -96,7 +96,7 @@ ice_alloc_ctrlq_sq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
&cq->sq.desc_buf.pa,
|
||||
GFP_KERNEL | __GFP_ZERO);
|
||||
if (!cq->sq.desc_buf.va)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
cq->sq.desc_buf.size = size;
|
||||
|
||||
cq->sq.cmd_buf = devm_kcalloc(ice_hw_to_dev(hw), cq->num_sq_entries,
|
||||
@ -107,7 +107,7 @@ ice_alloc_ctrlq_sq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
cq->sq.desc_buf.va = NULL;
|
||||
cq->sq.desc_buf.pa = 0;
|
||||
cq->sq.desc_buf.size = 0;
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -118,7 +118,7 @@ ice_alloc_ctrlq_sq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
* @hw: pointer to the hardware structure
|
||||
* @cq: pointer to the specific Control queue
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_alloc_ctrlq_rq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
size_t size = cq->num_rq_entries * sizeof(struct ice_aq_desc);
|
||||
@ -127,7 +127,7 @@ ice_alloc_ctrlq_rq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
&cq->rq.desc_buf.pa,
|
||||
GFP_KERNEL | __GFP_ZERO);
|
||||
if (!cq->rq.desc_buf.va)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
cq->rq.desc_buf.size = size;
|
||||
return 0;
|
||||
}
|
||||
@ -154,7 +154,7 @@ static void ice_free_cq_ring(struct ice_hw *hw, struct ice_ctl_q_ring *ring)
|
||||
* @hw: pointer to the hardware structure
|
||||
* @cq: pointer to the specific Control queue
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
int i;
|
||||
@ -165,7 +165,7 @@ ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
cq->rq.dma_head = devm_kcalloc(ice_hw_to_dev(hw), cq->num_rq_entries,
|
||||
sizeof(cq->rq.desc_buf), GFP_KERNEL);
|
||||
if (!cq->rq.dma_head)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
cq->rq.r.rq_bi = (struct ice_dma_mem *)cq->rq.dma_head;
|
||||
|
||||
/* allocate the mapped buffers */
|
||||
@ -218,7 +218,7 @@ unwind_alloc_rq_bufs:
|
||||
devm_kfree(ice_hw_to_dev(hw), cq->rq.dma_head);
|
||||
cq->rq.dma_head = NULL;
|
||||
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -226,7 +226,7 @@ unwind_alloc_rq_bufs:
|
||||
* @hw: pointer to the hardware structure
|
||||
* @cq: pointer to the specific Control queue
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_alloc_sq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
int i;
|
||||
@ -235,7 +235,7 @@ ice_alloc_sq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
cq->sq.dma_head = devm_kcalloc(ice_hw_to_dev(hw), cq->num_sq_entries,
|
||||
sizeof(cq->sq.desc_buf), GFP_KERNEL);
|
||||
if (!cq->sq.dma_head)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
cq->sq.r.sq_bi = (struct ice_dma_mem *)cq->sq.dma_head;
|
||||
|
||||
/* allocate the mapped buffers */
|
||||
@ -266,10 +266,10 @@ unwind_alloc_sq_bufs:
|
||||
devm_kfree(ice_hw_to_dev(hw), cq->sq.dma_head);
|
||||
cq->sq.dma_head = NULL;
|
||||
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_cfg_cq_regs(struct ice_hw *hw, struct ice_ctl_q_ring *ring, u16 num_entries)
|
||||
{
|
||||
/* Clear Head and Tail */
|
||||
@ -283,7 +283,7 @@ ice_cfg_cq_regs(struct ice_hw *hw, struct ice_ctl_q_ring *ring, u16 num_entries)
|
||||
|
||||
/* Check one register to verify that config was applied */
|
||||
if (rd32(hw, ring->bal) != lower_32_bits(ring->desc_buf.pa))
|
||||
return ICE_ERR_AQ_ERROR;
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -295,8 +295,7 @@ ice_cfg_cq_regs(struct ice_hw *hw, struct ice_ctl_q_ring *ring, u16 num_entries)
|
||||
*
|
||||
* Configure base address and length registers for the transmit queue
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_cfg_sq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
static int ice_cfg_sq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
return ice_cfg_cq_regs(hw, &cq->sq, cq->num_sq_entries);
|
||||
}
|
||||
@ -308,10 +307,9 @@ ice_cfg_sq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
*
|
||||
* Configure base address and length registers for the receive (event queue)
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
static int ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
status = ice_cfg_cq_regs(hw, &cq->rq, cq->num_rq_entries);
|
||||
if (status)
|
||||
@ -361,19 +359,19 @@ do { \
|
||||
* Do *NOT* hold the lock when calling this as the memory allocation routines
|
||||
* called are not going to be atomic context safe
|
||||
*/
|
||||
static enum ice_status ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
static int ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
enum ice_status ret_code;
|
||||
int ret_code;
|
||||
|
||||
if (cq->sq.count > 0) {
|
||||
/* queue already initialized */
|
||||
ret_code = ICE_ERR_NOT_READY;
|
||||
ret_code = -EBUSY;
|
||||
goto init_ctrlq_exit;
|
||||
}
|
||||
|
||||
/* verify input for valid configuration */
|
||||
if (!cq->num_sq_entries || !cq->sq_buf_size) {
|
||||
ret_code = ICE_ERR_CFG;
|
||||
ret_code = -EIO;
|
||||
goto init_ctrlq_exit;
|
||||
}
|
||||
|
||||
@ -421,19 +419,19 @@ init_ctrlq_exit:
|
||||
* Do *NOT* hold the lock when calling this as the memory allocation routines
|
||||
* called are not going to be atomic context safe
|
||||
*/
|
||||
static enum ice_status ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
static int ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
enum ice_status ret_code;
|
||||
int ret_code;
|
||||
|
||||
if (cq->rq.count > 0) {
|
||||
/* queue already initialized */
|
||||
ret_code = ICE_ERR_NOT_READY;
|
||||
ret_code = -EBUSY;
|
||||
goto init_ctrlq_exit;
|
||||
}
|
||||
|
||||
/* verify input for valid configuration */
|
||||
if (!cq->num_rq_entries || !cq->rq_buf_size) {
|
||||
ret_code = ICE_ERR_CFG;
|
||||
ret_code = -EIO;
|
||||
goto init_ctrlq_exit;
|
||||
}
|
||||
|
||||
@ -474,15 +472,14 @@ init_ctrlq_exit:
|
||||
*
|
||||
* The main shutdown routine for the Control Transmit Queue
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_shutdown_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
static int ice_shutdown_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
enum ice_status ret_code = 0;
|
||||
int ret_code = 0;
|
||||
|
||||
mutex_lock(&cq->sq_lock);
|
||||
|
||||
if (!cq->sq.count) {
|
||||
ret_code = ICE_ERR_NOT_READY;
|
||||
ret_code = -EBUSY;
|
||||
goto shutdown_sq_out;
|
||||
}
|
||||
|
||||
@ -541,15 +538,14 @@ static bool ice_aq_ver_check(struct ice_hw *hw)
|
||||
*
|
||||
* The main shutdown routine for the Control Receive Queue
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_shutdown_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
static int ice_shutdown_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
{
|
||||
enum ice_status ret_code = 0;
|
||||
int ret_code = 0;
|
||||
|
||||
mutex_lock(&cq->rq_lock);
|
||||
|
||||
if (!cq->rq.count) {
|
||||
ret_code = ICE_ERR_NOT_READY;
|
||||
ret_code = -EBUSY;
|
||||
goto shutdown_rq_out;
|
||||
}
|
||||
|
||||
@ -576,17 +572,17 @@ shutdown_rq_out:
|
||||
* ice_init_check_adminq - Check version for Admin Queue to know if its alive
|
||||
* @hw: pointer to the hardware structure
|
||||
*/
|
||||
static enum ice_status ice_init_check_adminq(struct ice_hw *hw)
|
||||
static int ice_init_check_adminq(struct ice_hw *hw)
|
||||
{
|
||||
struct ice_ctl_q_info *cq = &hw->adminq;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
status = ice_aq_get_fw_ver(hw, NULL);
|
||||
if (status)
|
||||
goto init_ctrlq_free_rq;
|
||||
|
||||
if (!ice_aq_ver_check(hw)) {
|
||||
status = ICE_ERR_FW_API_VER;
|
||||
status = -EIO;
|
||||
goto init_ctrlq_free_rq;
|
||||
}
|
||||
|
||||
@ -612,10 +608,10 @@ init_ctrlq_free_rq:
|
||||
*
|
||||
* NOTE: this function does not initialize the controlq locks
|
||||
*/
|
||||
static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
|
||||
static int ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
|
||||
{
|
||||
struct ice_ctl_q_info *cq;
|
||||
enum ice_status ret_code;
|
||||
int ret_code;
|
||||
|
||||
switch (q_type) {
|
||||
case ICE_CTL_Q_ADMIN:
|
||||
@ -631,14 +627,14 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
|
||||
cq = &hw->mailboxq;
|
||||
break;
|
||||
default:
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
}
|
||||
cq->qtype = q_type;
|
||||
|
||||
/* verify input for valid configuration */
|
||||
if (!cq->num_rq_entries || !cq->num_sq_entries ||
|
||||
!cq->rq_buf_size || !cq->sq_buf_size) {
|
||||
return ICE_ERR_CFG;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* setup SQ command write back timeout */
|
||||
@ -751,10 +747,10 @@ void ice_shutdown_all_ctrlq(struct ice_hw *hw)
|
||||
*
|
||||
* NOTE: this function does not initialize the controlq locks.
|
||||
*/
|
||||
enum ice_status ice_init_all_ctrlq(struct ice_hw *hw)
|
||||
int ice_init_all_ctrlq(struct ice_hw *hw)
|
||||
{
|
||||
enum ice_status status;
|
||||
u32 retry = 0;
|
||||
int status;
|
||||
|
||||
/* Init FW admin queue */
|
||||
do {
|
||||
@ -763,7 +759,7 @@ enum ice_status ice_init_all_ctrlq(struct ice_hw *hw)
|
||||
return status;
|
||||
|
||||
status = ice_init_check_adminq(hw);
|
||||
if (status != ICE_ERR_AQ_FW_CRITICAL)
|
||||
if (status != -EIO)
|
||||
break;
|
||||
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "Retry Admin Queue init due to FW critical error\n");
|
||||
@ -814,7 +810,7 @@ static void ice_init_ctrlq_locks(struct ice_ctl_q_info *cq)
|
||||
* driver needs to re-initialize control queues at run time it should call
|
||||
* ice_init_all_ctrlq instead.
|
||||
*/
|
||||
enum ice_status ice_create_all_ctrlq(struct ice_hw *hw)
|
||||
int ice_create_all_ctrlq(struct ice_hw *hw)
|
||||
{
|
||||
ice_init_ctrlq_locks(&hw->adminq);
|
||||
if (ice_is_sbq_supported(hw))
|
||||
@ -962,7 +958,7 @@ static bool ice_sq_done(struct ice_hw *hw, struct ice_ctl_q_info *cq)
|
||||
* This is the main send command routine for the ATQ. It runs the queue,
|
||||
* cleans the queue, etc.
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
struct ice_aq_desc *desc, void *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd)
|
||||
@ -970,27 +966,27 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
struct ice_dma_mem *dma_buf = NULL;
|
||||
struct ice_aq_desc *desc_on_ring;
|
||||
bool cmd_completed = false;
|
||||
enum ice_status status = 0;
|
||||
struct ice_sq_cd *details;
|
||||
u32 total_delay = 0;
|
||||
int status = 0;
|
||||
u16 retval = 0;
|
||||
u32 val = 0;
|
||||
|
||||
/* if reset is in progress return a soft error */
|
||||
if (hw->reset_ongoing)
|
||||
return ICE_ERR_RESET_ONGOING;
|
||||
return -EBUSY;
|
||||
mutex_lock(&cq->sq_lock);
|
||||
|
||||
cq->sq_last_status = ICE_AQ_RC_OK;
|
||||
|
||||
if (!cq->sq.count) {
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "Control Send queue not initialized.\n");
|
||||
status = ICE_ERR_AQ_EMPTY;
|
||||
status = -EIO;
|
||||
goto sq_send_command_error;
|
||||
}
|
||||
|
||||
if ((buf && !buf_size) || (!buf && buf_size)) {
|
||||
status = ICE_ERR_PARAM;
|
||||
status = -EINVAL;
|
||||
goto sq_send_command_error;
|
||||
}
|
||||
|
||||
@ -998,7 +994,7 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
if (buf_size > cq->sq_buf_size) {
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "Invalid buffer size for Control Send queue: %d.\n",
|
||||
buf_size);
|
||||
status = ICE_ERR_INVAL_SIZE;
|
||||
status = -EINVAL;
|
||||
goto sq_send_command_error;
|
||||
}
|
||||
|
||||
@ -1011,7 +1007,7 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
if (val >= cq->num_sq_entries) {
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "head overrun at %d in the Control Send Queue ring\n",
|
||||
val);
|
||||
status = ICE_ERR_AQ_EMPTY;
|
||||
status = -EIO;
|
||||
goto sq_send_command_error;
|
||||
}
|
||||
|
||||
@ -1028,7 +1024,7 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
*/
|
||||
if (ice_clean_sq(hw, cq) == 0) {
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "Error: Control Send Queue is full.\n");
|
||||
status = ICE_ERR_AQ_FULL;
|
||||
status = -ENOSPC;
|
||||
goto sq_send_command_error;
|
||||
}
|
||||
|
||||
@ -1082,7 +1078,7 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
if (copy_size > buf_size) {
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "Return len %d > than buf len %d\n",
|
||||
copy_size, buf_size);
|
||||
status = ICE_ERR_AQ_ERROR;
|
||||
status = -EIO;
|
||||
} else {
|
||||
memcpy(buf, dma_buf->va, copy_size);
|
||||
}
|
||||
@ -1098,7 +1094,7 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
}
|
||||
cmd_completed = true;
|
||||
if (!status && retval != ICE_AQ_RC_OK)
|
||||
status = ICE_ERR_AQ_ERROR;
|
||||
status = -EIO;
|
||||
cq->sq_last_status = (enum ice_aq_err)retval;
|
||||
}
|
||||
|
||||
@ -1116,10 +1112,10 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
if (rd32(hw, cq->rq.len) & cq->rq.len_crit_mask ||
|
||||
rd32(hw, cq->sq.len) & cq->sq.len_crit_mask) {
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "Critical FW error.\n");
|
||||
status = ICE_ERR_AQ_FW_CRITICAL;
|
||||
status = -EIO;
|
||||
} else {
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "Control Send Queue Writeback timeout.\n");
|
||||
status = ICE_ERR_AQ_TIMEOUT;
|
||||
status = -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1154,15 +1150,15 @@ void ice_fill_dflt_direct_cmd_desc(struct ice_aq_desc *desc, u16 opcode)
|
||||
* the contents through e. It can also return how many events are
|
||||
* left to process through 'pending'.
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
struct ice_rq_event_info *e, u16 *pending)
|
||||
{
|
||||
u16 ntc = cq->rq.next_to_clean;
|
||||
enum ice_aq_err rq_last_status;
|
||||
enum ice_status ret_code = 0;
|
||||
struct ice_aq_desc *desc;
|
||||
struct ice_dma_mem *bi;
|
||||
int ret_code = 0;
|
||||
u16 desc_idx;
|
||||
u16 datalen;
|
||||
u16 flags;
|
||||
@ -1176,7 +1172,7 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
|
||||
if (!cq->rq.count) {
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "Control Receive queue not initialized.\n");
|
||||
ret_code = ICE_ERR_AQ_EMPTY;
|
||||
ret_code = -EIO;
|
||||
goto clean_rq_elem_err;
|
||||
}
|
||||
|
||||
@ -1185,7 +1181,7 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
|
||||
if (ntu == ntc) {
|
||||
/* nothing to do - shouldn't need to update ring's values */
|
||||
ret_code = ICE_ERR_AQ_NO_WORK;
|
||||
ret_code = -EALREADY;
|
||||
goto clean_rq_elem_out;
|
||||
}
|
||||
|
||||
@ -1196,7 +1192,7 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
rq_last_status = (enum ice_aq_err)le16_to_cpu(desc->retval);
|
||||
flags = le16_to_cpu(desc->flags);
|
||||
if (flags & ICE_AQ_FLAG_ERR) {
|
||||
ret_code = ICE_ERR_AQ_ERROR;
|
||||
ret_code = -EIO;
|
||||
ice_debug(hw, ICE_DBG_AQ_MSG, "Control Receive Queue Event 0x%04X received with error 0x%X\n",
|
||||
le16_to_cpu(desc->opcode), rq_last_status);
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
/* Copyright (c) 2019, Intel Corporation. */
|
||||
|
||||
#include "ice_common.h"
|
||||
#include "ice_lib.h"
|
||||
#include "ice_sched.h"
|
||||
#include "ice_dcb.h"
|
||||
|
||||
@ -19,19 +18,19 @@
|
||||
*
|
||||
* Requests the complete LLDP MIB (entire packet). (0x0A00)
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_aq_get_lldp_mib(struct ice_hw *hw, u8 bridge_type, u8 mib_type, void *buf,
|
||||
u16 buf_size, u16 *local_len, u16 *remote_len,
|
||||
struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_lldp_get_mib *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
cmd = &desc.params.lldp_get_mib;
|
||||
|
||||
if (buf_size == 0 || !buf)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_lldp_get_mib);
|
||||
|
||||
@ -61,7 +60,7 @@ ice_aq_get_lldp_mib(struct ice_hw *hw, u8 bridge_type, u8 mib_type, void *buf,
|
||||
* Enable or Disable posting of an event on ARQ when LLDP MIB
|
||||
* associated with the interface changes (0x0A01)
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_aq_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_update,
|
||||
struct ice_sq_cd *cd)
|
||||
{
|
||||
@ -89,7 +88,7 @@ ice_aq_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_update,
|
||||
*
|
||||
* Stop or Shutdown the embedded LLDP Agent (0x0A05)
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent, bool persist,
|
||||
struct ice_sq_cd *cd)
|
||||
{
|
||||
@ -117,8 +116,7 @@ ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent, bool persist,
|
||||
*
|
||||
* Start the embedded LLDP Agent on all ports. (0x0A06)
|
||||
*/
|
||||
enum ice_status
|
||||
ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd)
|
||||
int ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_lldp_start *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
@ -598,18 +596,17 @@ ice_parse_org_tlv(struct ice_lldp_org_tlv *tlv, struct ice_dcbx_cfg *dcbcfg)
|
||||
*
|
||||
* Parse DCB configuration from the LLDPDU
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg)
|
||||
static int ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg)
|
||||
{
|
||||
struct ice_lldp_org_tlv *tlv;
|
||||
enum ice_status ret = 0;
|
||||
u16 offset = 0;
|
||||
int ret = 0;
|
||||
u16 typelen;
|
||||
u16 type;
|
||||
u16 len;
|
||||
|
||||
if (!lldpmib || !dcbcfg)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
/* set to the start of LLDPDU */
|
||||
lldpmib += ETH_HLEN;
|
||||
@ -649,17 +646,17 @@ ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg)
|
||||
*
|
||||
* Query DCB configuration from the firmware
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
|
||||
struct ice_dcbx_cfg *dcbcfg)
|
||||
{
|
||||
enum ice_status ret;
|
||||
u8 *lldpmib;
|
||||
int ret;
|
||||
|
||||
/* Allocate the LLDPDU */
|
||||
lldpmib = devm_kzalloc(ice_hw_to_dev(hw), ICE_LLDPDU_SIZE, GFP_KERNEL);
|
||||
if (!lldpmib)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
ret = ice_aq_get_lldp_mib(hw, bridgetype, mib_type, (void *)lldpmib,
|
||||
ICE_LLDPDU_SIZE, NULL, NULL, NULL);
|
||||
@ -684,17 +681,17 @@ ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
|
||||
* @cd: pointer to command details structure or NULL
|
||||
*
|
||||
* Start/Stop the embedded dcbx Agent. In case that this wrapper function
|
||||
* returns ICE_SUCCESS, caller will need to check if FW returns back the same
|
||||
* returns 0, caller will need to check if FW returns back the same
|
||||
* value as stated in dcbx_agent_status, and react accordingly. (0x0A09)
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
|
||||
bool *dcbx_agent_status, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_lldp_stop_start_specific_agent *cmd;
|
||||
enum ice_status status;
|
||||
struct ice_aq_desc desc;
|
||||
u16 opcode;
|
||||
int status;
|
||||
|
||||
cmd = &desc.params.lldp_agent_ctrl;
|
||||
|
||||
@ -724,7 +721,7 @@ ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
|
||||
*
|
||||
* Get CEE DCBX mode operational configuration from firmware (0x0A07)
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_aq_get_cee_dcb_cfg(struct ice_hw *hw,
|
||||
struct ice_aqc_get_cee_dcb_cfg_resp *buff,
|
||||
struct ice_sq_cd *cd)
|
||||
@ -749,7 +746,7 @@ int ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_set_query_pfc_mode *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (pfc_mode > ICE_AQC_PFC_DSCP_BASED_PFC)
|
||||
return -EINVAL;
|
||||
@ -762,7 +759,7 @@ int ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd)
|
||||
|
||||
status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
|
||||
if (status)
|
||||
return ice_status_to_errno(status);
|
||||
return status;
|
||||
|
||||
/* FW will write the PFC mode set back into cmd->pfc_mode, but if DCB is
|
||||
* disabled, FW will write back 0 to cmd->pfc_mode. After the AQ has
|
||||
@ -903,14 +900,13 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg,
|
||||
*
|
||||
* Get IEEE or CEE mode DCB configuration from the Firmware
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode)
|
||||
static int ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode)
|
||||
{
|
||||
struct ice_dcbx_cfg *dcbx_cfg = NULL;
|
||||
enum ice_status ret;
|
||||
int ret;
|
||||
|
||||
if (!pi)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
if (dcbx_mode == ICE_DCBX_MODE_IEEE)
|
||||
dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg;
|
||||
@ -943,14 +939,14 @@ out:
|
||||
*
|
||||
* Get DCB configuration from the Firmware
|
||||
*/
|
||||
enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi)
|
||||
int ice_get_dcb_cfg(struct ice_port_info *pi)
|
||||
{
|
||||
struct ice_aqc_get_cee_dcb_cfg_resp cee_cfg;
|
||||
struct ice_dcbx_cfg *dcbx_cfg;
|
||||
enum ice_status ret;
|
||||
int ret;
|
||||
|
||||
if (!pi)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL);
|
||||
if (!ret) {
|
||||
@ -974,13 +970,13 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi)
|
||||
*
|
||||
* Update DCB configuration from the Firmware
|
||||
*/
|
||||
enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)
|
||||
int ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)
|
||||
{
|
||||
struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg;
|
||||
enum ice_status ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (!hw->func_caps.common_cap.dcb)
|
||||
return ICE_ERR_NOT_SUPPORTED;
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
qos_cfg->is_sw_lldp = true;
|
||||
|
||||
@ -996,7 +992,7 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)
|
||||
return ret;
|
||||
qos_cfg->is_sw_lldp = false;
|
||||
} else if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) {
|
||||
return ICE_ERR_NOT_READY;
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/* Configure the LLDP MIB change event */
|
||||
@ -1016,19 +1012,19 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)
|
||||
*
|
||||
* Configure (disable/enable) MIB
|
||||
*/
|
||||
enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib)
|
||||
int ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib)
|
||||
{
|
||||
struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg;
|
||||
enum ice_status ret;
|
||||
int ret;
|
||||
|
||||
if (!hw->func_caps.common_cap.dcb)
|
||||
return ICE_ERR_NOT_SUPPORTED;
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
/* Get DCBX status */
|
||||
qos_cfg->dcbx_status = ice_get_dcbx_status(hw);
|
||||
|
||||
if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS)
|
||||
return ICE_ERR_NOT_READY;
|
||||
return -EBUSY;
|
||||
|
||||
ret = ice_aq_cfg_lldp_mib_change(hw, ena_mib, NULL);
|
||||
if (!ret)
|
||||
@ -1469,16 +1465,16 @@ ice_dcb_cfg_to_lldp(u8 *lldpmib, u16 *miblen, struct ice_dcbx_cfg *dcbcfg)
|
||||
*
|
||||
* Set DCB configuration to the Firmware
|
||||
*/
|
||||
enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi)
|
||||
int ice_set_dcb_cfg(struct ice_port_info *pi)
|
||||
{
|
||||
u8 mib_type, *lldpmib = NULL;
|
||||
struct ice_dcbx_cfg *dcbcfg;
|
||||
enum ice_status ret;
|
||||
struct ice_hw *hw;
|
||||
u16 miblen;
|
||||
int ret;
|
||||
|
||||
if (!pi)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
hw = pi->hw;
|
||||
|
||||
@ -1487,7 +1483,7 @@ enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi)
|
||||
/* Allocate the LLDPDU */
|
||||
lldpmib = devm_kzalloc(ice_hw_to_dev(hw), ICE_LLDPDU_SIZE, GFP_KERNEL);
|
||||
if (!lldpmib)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
mib_type = SET_LOCAL_MIB_TYPE_LOCAL_MIB;
|
||||
if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING)
|
||||
@ -1511,17 +1507,17 @@ enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi)
|
||||
*
|
||||
* query current port ETS configuration
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_aq_query_port_ets(struct ice_port_info *pi,
|
||||
struct ice_aqc_port_ets_elem *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_query_port_ets *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (!pi)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
cmd = &desc.params.port_ets;
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_query_port_ets);
|
||||
cmd->port_teid = pi->root->info.node_teid;
|
||||
@ -1537,18 +1533,18 @@ ice_aq_query_port_ets(struct ice_port_info *pi,
|
||||
*
|
||||
* update the SW DB with the new TC changes
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
|
||||
struct ice_aqc_port_ets_elem *buf)
|
||||
{
|
||||
struct ice_sched_node *node, *tc_node;
|
||||
struct ice_aqc_txsched_elem_data elem;
|
||||
enum ice_status status = 0;
|
||||
u32 teid1, teid2;
|
||||
int status = 0;
|
||||
u8 i, j;
|
||||
|
||||
if (!pi)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
/* suspend the missing TC nodes */
|
||||
for (i = 0; i < pi->root->num_children; i++) {
|
||||
teid1 = le32_to_cpu(pi->root->children[i]->info.node_teid);
|
||||
@ -1605,12 +1601,12 @@ ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
|
||||
* query current port ETS configuration and update the
|
||||
* SW DB with the TC changes
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_query_port_ets(struct ice_port_info *pi,
|
||||
struct ice_aqc_port_ets_elem *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
mutex_lock(&pi->sched_lock);
|
||||
status = ice_aq_query_port_ets(pi, buf, buf_size, cd);
|
||||
|
@ -138,28 +138,27 @@ struct ice_cee_app_prio {
|
||||
} __packed;
|
||||
|
||||
int ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
|
||||
struct ice_dcbx_cfg *dcbcfg);
|
||||
enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi);
|
||||
enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi);
|
||||
enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change);
|
||||
enum ice_status
|
||||
int ice_get_dcb_cfg(struct ice_port_info *pi);
|
||||
int ice_set_dcb_cfg(struct ice_port_info *pi);
|
||||
int ice_init_dcb(struct ice_hw *hw, bool enable_mib_change);
|
||||
int
|
||||
ice_query_port_ets(struct ice_port_info *pi,
|
||||
struct ice_aqc_port_ets_elem *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cmd_details);
|
||||
#ifdef CONFIG_DCB
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent, bool persist,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd);
|
||||
int
|
||||
ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
|
||||
bool *dcbx_agent_status, struct ice_sq_cd *cd);
|
||||
enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib);
|
||||
int ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib);
|
||||
#else /* CONFIG_DCB */
|
||||
static inline enum ice_status
|
||||
static inline int
|
||||
ice_aq_stop_lldp(struct ice_hw __always_unused *hw,
|
||||
bool __always_unused shutdown_lldp_agent,
|
||||
bool __always_unused persist,
|
||||
@ -168,7 +167,7 @@ ice_aq_stop_lldp(struct ice_hw __always_unused *hw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline enum ice_status
|
||||
static inline int
|
||||
ice_aq_start_lldp(struct ice_hw __always_unused *hw,
|
||||
bool __always_unused persist,
|
||||
struct ice_sq_cd __always_unused *cd)
|
||||
@ -176,7 +175,7 @@ ice_aq_start_lldp(struct ice_hw __always_unused *hw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline enum ice_status
|
||||
static inline int
|
||||
ice_aq_start_stop_dcbx(struct ice_hw __always_unused *hw,
|
||||
bool __always_unused start_dcbx_agent,
|
||||
bool *dcbx_agent_status,
|
||||
@ -187,7 +186,7 @@ ice_aq_start_stop_dcbx(struct ice_hw __always_unused *hw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline enum ice_status
|
||||
static inline int
|
||||
ice_cfg_lldp_mib_change(struct ice_hw __always_unused *hw,
|
||||
bool __always_unused ena_mib)
|
||||
{
|
||||
|
@ -528,7 +528,7 @@ void ice_dcb_rebuild(struct ice_pf *pf)
|
||||
struct ice_aqc_port_ets_elem buf = { 0 };
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_dcbx_cfg *err_cfg;
|
||||
enum ice_status ret;
|
||||
int ret;
|
||||
|
||||
ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL);
|
||||
if (ret) {
|
||||
|
@ -39,13 +39,13 @@ static void ice_info_get_dsn(struct ice_pf *pf, struct ice_info_ctx *ctx)
|
||||
static void ice_info_pba(struct ice_pf *pf, struct ice_info_ctx *ctx)
|
||||
{
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
status = ice_read_pba_string(hw, (u8 *)ctx->buf, sizeof(ctx->buf));
|
||||
if (status)
|
||||
/* We failed to locate the PBA, so just skip this entry */
|
||||
dev_dbg(ice_pf_to_dev(pf), "Failed to read Product Board Assembly string, status %s\n",
|
||||
ice_stat_str(status));
|
||||
dev_dbg(ice_pf_to_dev(pf), "Failed to read Product Board Assembly string, status %d\n",
|
||||
status);
|
||||
}
|
||||
|
||||
static void ice_info_fw_mgmt(struct ice_pf *pf, struct ice_info_ctx *ctx)
|
||||
@ -251,7 +251,6 @@ static int ice_devlink_info_get(struct devlink *devlink,
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
struct ice_info_ctx *ctx;
|
||||
enum ice_status status;
|
||||
size_t i;
|
||||
int err;
|
||||
|
||||
@ -266,20 +265,19 @@ static int ice_devlink_info_get(struct devlink *devlink,
|
||||
return -ENOMEM;
|
||||
|
||||
/* discover capabilities first */
|
||||
status = ice_discover_dev_caps(hw, &ctx->dev_caps);
|
||||
if (status) {
|
||||
dev_dbg(dev, "Failed to discover device capabilities, status %s aq_err %s\n",
|
||||
ice_stat_str(status), ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = ice_discover_dev_caps(hw, &ctx->dev_caps);
|
||||
if (err) {
|
||||
dev_dbg(dev, "Failed to discover device capabilities, status %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
NL_SET_ERR_MSG_MOD(extack, "Unable to discover device capabilities");
|
||||
err = -EIO;
|
||||
goto out_free_ctx;
|
||||
}
|
||||
|
||||
if (ctx->dev_caps.common_cap.nvm_update_pending_orom) {
|
||||
status = ice_get_inactive_orom_ver(hw, &ctx->pending_orom);
|
||||
if (status) {
|
||||
dev_dbg(dev, "Unable to read inactive Option ROM version data, status %s aq_err %s\n",
|
||||
ice_stat_str(status), ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = ice_get_inactive_orom_ver(hw, &ctx->pending_orom);
|
||||
if (err) {
|
||||
dev_dbg(dev, "Unable to read inactive Option ROM version data, status %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
|
||||
/* disable display of pending Option ROM */
|
||||
ctx->dev_caps.common_cap.nvm_update_pending_orom = false;
|
||||
@ -287,10 +285,10 @@ static int ice_devlink_info_get(struct devlink *devlink,
|
||||
}
|
||||
|
||||
if (ctx->dev_caps.common_cap.nvm_update_pending_nvm) {
|
||||
status = ice_get_inactive_nvm_ver(hw, &ctx->pending_nvm);
|
||||
if (status) {
|
||||
dev_dbg(dev, "Unable to read inactive NVM version data, status %s aq_err %s\n",
|
||||
ice_stat_str(status), ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = ice_get_inactive_nvm_ver(hw, &ctx->pending_nvm);
|
||||
if (err) {
|
||||
dev_dbg(dev, "Unable to read inactive NVM version data, status %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
|
||||
/* disable display of pending Option ROM */
|
||||
ctx->dev_caps.common_cap.nvm_update_pending_nvm = false;
|
||||
@ -298,10 +296,10 @@ static int ice_devlink_info_get(struct devlink *devlink,
|
||||
}
|
||||
|
||||
if (ctx->dev_caps.common_cap.nvm_update_pending_netlist) {
|
||||
status = ice_get_inactive_netlist_ver(hw, &ctx->pending_netlist);
|
||||
if (status) {
|
||||
dev_dbg(dev, "Unable to read inactive Netlist version data, status %s aq_err %s\n",
|
||||
ice_stat_str(status), ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = ice_get_inactive_netlist_ver(hw, &ctx->pending_netlist);
|
||||
if (err) {
|
||||
dev_dbg(dev, "Unable to read inactive Netlist version data, status %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
|
||||
/* disable display of pending Option ROM */
|
||||
ctx->dev_caps.common_cap.nvm_update_pending_netlist = false;
|
||||
@ -762,9 +760,9 @@ static int ice_devlink_nvm_snapshot(struct devlink *devlink,
|
||||
struct ice_pf *pf = devlink_priv(devlink);
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
void *nvm_data;
|
||||
u32 nvm_size;
|
||||
int status;
|
||||
|
||||
nvm_size = hw->flash.flash_size;
|
||||
nvm_data = vzalloc(nvm_size);
|
||||
@ -777,7 +775,7 @@ static int ice_devlink_nvm_snapshot(struct devlink *devlink,
|
||||
status, hw->adminq.sq_last_status);
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to acquire NVM semaphore");
|
||||
vfree(nvm_data);
|
||||
return -EIO;
|
||||
return status;
|
||||
}
|
||||
|
||||
status = ice_read_flat_nvm(hw, 0, &nvm_size, nvm_data, false);
|
||||
@ -787,7 +785,7 @@ static int ice_devlink_nvm_snapshot(struct devlink *devlink,
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to read NVM contents");
|
||||
ice_release_nvm(hw);
|
||||
vfree(nvm_data);
|
||||
return -EIO;
|
||||
return status;
|
||||
}
|
||||
|
||||
ice_release_nvm(hw);
|
||||
@ -819,8 +817,8 @@ ice_devlink_devcaps_snapshot(struct devlink *devlink,
|
||||
struct ice_pf *pf = devlink_priv(devlink);
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
void *devcaps;
|
||||
int status;
|
||||
|
||||
devcaps = vzalloc(ICE_AQ_MAX_BUF_LEN);
|
||||
if (!devcaps)
|
||||
@ -833,7 +831,7 @@ ice_devlink_devcaps_snapshot(struct devlink *devlink,
|
||||
status, hw->adminq.sq_last_status);
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to read device capabilities");
|
||||
vfree(devcaps);
|
||||
return -EIO;
|
||||
return status;
|
||||
}
|
||||
|
||||
*data = (u8 *)devcaps;
|
||||
|
@ -270,9 +270,8 @@ ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
|
||||
struct ice_vsi *vsi = np->vsi;
|
||||
struct ice_pf *pf = vsi->back;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u8 *buf;
|
||||
|
||||
dev = ice_pf_to_dev(pf);
|
||||
@ -285,22 +284,18 @@ ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
status = ice_acquire_nvm(hw, ICE_RES_READ);
|
||||
if (status) {
|
||||
dev_err(dev, "ice_acquire_nvm failed, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
ret = -EIO;
|
||||
ret = ice_acquire_nvm(hw, ICE_RES_READ);
|
||||
if (ret) {
|
||||
dev_err(dev, "ice_acquire_nvm failed, err %d aq_err %s\n",
|
||||
ret, ice_aq_str(hw->adminq.sq_last_status));
|
||||
goto out;
|
||||
}
|
||||
|
||||
status = ice_read_flat_nvm(hw, eeprom->offset, &eeprom->len, buf,
|
||||
false);
|
||||
if (status) {
|
||||
dev_err(dev, "ice_read_flat_nvm failed, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
ret = -EIO;
|
||||
ret = ice_read_flat_nvm(hw, eeprom->offset, &eeprom->len, buf,
|
||||
false);
|
||||
if (ret) {
|
||||
dev_err(dev, "ice_read_flat_nvm failed, err %d aq_err %s\n",
|
||||
ret, ice_aq_str(hw->adminq.sq_last_status));
|
||||
goto release;
|
||||
}
|
||||
|
||||
@ -342,14 +337,14 @@ static bool ice_active_vfs(struct ice_pf *pf)
|
||||
static u64 ice_link_test(struct net_device *netdev)
|
||||
{
|
||||
struct ice_netdev_priv *np = netdev_priv(netdev);
|
||||
enum ice_status status;
|
||||
bool link_up = false;
|
||||
int status;
|
||||
|
||||
netdev_info(netdev, "link test\n");
|
||||
status = ice_get_link_status(np->vsi->port_info, &link_up);
|
||||
if (status) {
|
||||
netdev_err(netdev, "link query error, status = %s\n",
|
||||
ice_stat_str(status));
|
||||
netdev_err(netdev, "link query error, status = %d\n",
|
||||
status);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1052,8 +1047,7 @@ ice_get_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam)
|
||||
struct ice_link_status *link_info;
|
||||
struct ice_vsi *vsi = np->vsi;
|
||||
struct ice_port_info *pi;
|
||||
enum ice_status status;
|
||||
int err = 0;
|
||||
int err;
|
||||
|
||||
pi = vsi->port_info;
|
||||
|
||||
@ -1079,12 +1073,10 @@ ice_get_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam)
|
||||
if (!caps)
|
||||
return -ENOMEM;
|
||||
|
||||
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
|
||||
caps, NULL);
|
||||
if (status) {
|
||||
err = -EAGAIN;
|
||||
err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
|
||||
caps, NULL);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Set supported/configured FEC modes based on PHY capability */
|
||||
if (caps->caps & ICE_AQC_PHY_EN_AUTO_FEC)
|
||||
@ -1203,7 +1195,7 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags)
|
||||
|
||||
if (test_bit(ICE_FLAG_FW_LLDP_AGENT, change_flags)) {
|
||||
if (!test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) {
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
/* Disable FW LLDP engine */
|
||||
status = ice_cfg_lldp_mib_change(&pf->hw, false);
|
||||
@ -1232,8 +1224,8 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags)
|
||||
pf->dcbx_cap &= ~DCB_CAP_DCBX_LLD_MANAGED;
|
||||
pf->dcbx_cap |= DCB_CAP_DCBX_HOST;
|
||||
} else {
|
||||
enum ice_status status;
|
||||
bool dcbx_agent_status;
|
||||
int status;
|
||||
|
||||
if (ice_get_pfc_mode(pf) == ICE_QOS_MODE_DSCP) {
|
||||
clear_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags);
|
||||
@ -1938,8 +1930,7 @@ ice_get_link_ksettings(struct net_device *netdev,
|
||||
struct ice_aqc_get_phy_caps_data *caps;
|
||||
struct ice_link_status *hw_link_info;
|
||||
struct ice_vsi *vsi = np->vsi;
|
||||
enum ice_status status;
|
||||
int err = 0;
|
||||
int err;
|
||||
|
||||
ethtool_link_ksettings_zero_link_mode(ks, supported);
|
||||
ethtool_link_ksettings_zero_link_mode(ks, advertising);
|
||||
@ -1990,12 +1981,10 @@ ice_get_link_ksettings(struct net_device *netdev,
|
||||
if (!caps)
|
||||
return -ENOMEM;
|
||||
|
||||
status = ice_aq_get_phy_caps(vsi->port_info, false,
|
||||
ICE_AQC_REPORT_ACTIVE_CFG, caps, NULL);
|
||||
if (status) {
|
||||
err = -EIO;
|
||||
err = ice_aq_get_phy_caps(vsi->port_info, false,
|
||||
ICE_AQC_REPORT_ACTIVE_CFG, caps, NULL);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Set the advertised flow control based on the PHY capability */
|
||||
if ((caps->caps & ICE_AQC_PHY_EN_TX_LINK_PAUSE) &&
|
||||
@ -2027,12 +2016,10 @@ ice_get_link_ksettings(struct net_device *netdev,
|
||||
caps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_544_REQ)
|
||||
ethtool_link_ksettings_add_link_mode(ks, advertising, FEC_RS);
|
||||
|
||||
status = ice_aq_get_phy_caps(vsi->port_info, false,
|
||||
ICE_AQC_REPORT_TOPO_CAP_MEDIA, caps, NULL);
|
||||
if (status) {
|
||||
err = -EIO;
|
||||
err = ice_aq_get_phy_caps(vsi->port_info, false,
|
||||
ICE_AQC_REPORT_TOPO_CAP_MEDIA, caps, NULL);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Set supported FEC modes based on PHY capability */
|
||||
ethtool_link_ksettings_add_link_mode(ks, supported, FEC_NONE);
|
||||
@ -2210,11 +2197,10 @@ ice_set_link_ksettings(struct net_device *netdev,
|
||||
struct ice_pf *pf = np->vsi->back;
|
||||
struct ice_port_info *pi;
|
||||
u8 autoneg_changed = 0;
|
||||
enum ice_status status;
|
||||
u64 phy_type_high = 0;
|
||||
u64 phy_type_low = 0;
|
||||
int err = 0;
|
||||
bool linkup;
|
||||
int err;
|
||||
|
||||
pi = np->vsi->port_info;
|
||||
|
||||
@ -2234,15 +2220,13 @@ ice_set_link_ksettings(struct net_device *netdev,
|
||||
|
||||
/* Get the PHY capabilities based on media */
|
||||
if (ice_fw_supports_report_dflt_cfg(pi->hw))
|
||||
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_DFLT_CFG,
|
||||
phy_caps, NULL);
|
||||
err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_DFLT_CFG,
|
||||
phy_caps, NULL);
|
||||
else
|
||||
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
|
||||
phy_caps, NULL);
|
||||
if (status) {
|
||||
err = -EIO;
|
||||
err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
|
||||
phy_caps, NULL);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* save autoneg out of ksettings */
|
||||
autoneg = copy_ks.base.autoneg;
|
||||
@ -2308,11 +2292,9 @@ ice_set_link_ksettings(struct net_device *netdev,
|
||||
|
||||
/* Call to get the current link speed */
|
||||
pi->phy.get_link_info = true;
|
||||
status = ice_get_link_status(pi, &linkup);
|
||||
if (status) {
|
||||
err = -EIO;
|
||||
err = ice_get_link_status(pi, &linkup);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
|
||||
curr_link_speed = pi->phy.link_info.link_speed;
|
||||
adv_link_speed = ice_ksettings_find_adv_link_speed(ks);
|
||||
@ -2381,10 +2363,9 @@ ice_set_link_ksettings(struct net_device *netdev,
|
||||
}
|
||||
|
||||
/* make the aq call */
|
||||
status = ice_aq_set_phy_cfg(&pf->hw, pi, &config, NULL);
|
||||
if (status) {
|
||||
err = ice_aq_set_phy_cfg(&pf->hw, pi, &config, NULL);
|
||||
if (err) {
|
||||
netdev_info(netdev, "Set phy config failed,\n");
|
||||
err = -EIO;
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -2522,9 +2503,9 @@ static int
|
||||
ice_set_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
|
||||
{
|
||||
struct ice_pf *pf = vsi->back;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
u64 hashed_flds;
|
||||
int status;
|
||||
u32 hdrs;
|
||||
|
||||
dev = ice_pf_to_dev(pf);
|
||||
@ -2550,9 +2531,9 @@ ice_set_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
|
||||
|
||||
status = ice_add_rss_cfg(&pf->hw, vsi->idx, hashed_flds, hdrs);
|
||||
if (status) {
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed, vsi num = %d, error = %s\n",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
return -EINVAL;
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed, vsi num = %d, error = %d\n",
|
||||
vsi->vsi_num, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -2953,7 +2934,7 @@ ice_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
|
||||
struct ice_port_info *pi = np->vsi->port_info;
|
||||
struct ice_aqc_get_phy_caps_data *pcaps;
|
||||
struct ice_dcbx_cfg *dcbx_cfg;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
/* Initialize pause params */
|
||||
pause->rx_pause = 0;
|
||||
@ -3003,11 +2984,10 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
|
||||
struct ice_vsi *vsi = np->vsi;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
struct ice_port_info *pi;
|
||||
enum ice_status status;
|
||||
u8 aq_failures;
|
||||
bool link_up;
|
||||
int err = 0;
|
||||
u32 is_an;
|
||||
int err;
|
||||
|
||||
pi = vsi->port_info;
|
||||
hw_link_info = &pi->phy.link_info;
|
||||
@ -3033,11 +3013,11 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Get current PHY config */
|
||||
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_ACTIVE_CFG, pcaps,
|
||||
NULL);
|
||||
if (status) {
|
||||
err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_ACTIVE_CFG, pcaps,
|
||||
NULL);
|
||||
if (err) {
|
||||
kfree(pcaps);
|
||||
return -EIO;
|
||||
return err;
|
||||
}
|
||||
|
||||
is_an = ice_is_phy_caps_an_enabled(pcaps) ? AUTONEG_ENABLE :
|
||||
@ -3073,22 +3053,19 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
|
||||
return -EINVAL;
|
||||
|
||||
/* Set the FC mode and only restart AN if link is up */
|
||||
status = ice_set_fc(pi, &aq_failures, link_up);
|
||||
err = ice_set_fc(pi, &aq_failures, link_up);
|
||||
|
||||
if (aq_failures & ICE_SET_FC_AQ_FAIL_GET) {
|
||||
netdev_info(netdev, "Set fc failed on the get_phy_capabilities call with err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
netdev_info(netdev, "Set fc failed on the get_phy_capabilities call with err %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = -EAGAIN;
|
||||
} else if (aq_failures & ICE_SET_FC_AQ_FAIL_SET) {
|
||||
netdev_info(netdev, "Set fc failed on the set_phy_config call with err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
netdev_info(netdev, "Set fc failed on the set_phy_config call with err %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = -EAGAIN;
|
||||
} else if (aq_failures & ICE_SET_FC_AQ_FAIL_UPDATE) {
|
||||
netdev_info(netdev, "Set fc failed on the get_link_info call with err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
netdev_info(netdev, "Set fc failed on the get_link_info call with err %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = -EAGAIN;
|
||||
}
|
||||
|
||||
@ -3928,16 +3905,16 @@ ice_get_module_info(struct net_device *netdev,
|
||||
struct ice_vsi *vsi = np->vsi;
|
||||
struct ice_pf *pf = vsi->back;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
u8 sff8472_comp = 0;
|
||||
u8 sff8472_swap = 0;
|
||||
u8 sff8636_rev = 0;
|
||||
u8 value = 0;
|
||||
int status;
|
||||
|
||||
status = ice_aq_sff_eeprom(hw, 0, ICE_I2C_EEPROM_DEV_ADDR, 0x00, 0x00,
|
||||
0, &value, 1, 0, NULL);
|
||||
if (status)
|
||||
return -EIO;
|
||||
return status;
|
||||
|
||||
switch (value) {
|
||||
case ICE_MODULE_TYPE_SFP:
|
||||
@ -3945,12 +3922,12 @@ ice_get_module_info(struct net_device *netdev,
|
||||
ICE_MODULE_SFF_8472_COMP, 0x00, 0,
|
||||
&sff8472_comp, 1, 0, NULL);
|
||||
if (status)
|
||||
return -EIO;
|
||||
return status;
|
||||
status = ice_aq_sff_eeprom(hw, 0, ICE_I2C_EEPROM_DEV_ADDR,
|
||||
ICE_MODULE_SFF_8472_SWAP, 0x00, 0,
|
||||
&sff8472_swap, 1, 0, NULL);
|
||||
if (status)
|
||||
return -EIO;
|
||||
return status;
|
||||
|
||||
if (sff8472_swap & ICE_MODULE_SFF_ADDR_MODE) {
|
||||
modinfo->type = ETH_MODULE_SFF_8079;
|
||||
@ -3970,7 +3947,7 @@ ice_get_module_info(struct net_device *netdev,
|
||||
ICE_MODULE_REVISION_ADDR, 0x00, 0,
|
||||
&sff8636_rev, 1, 0, NULL);
|
||||
if (status)
|
||||
return -EIO;
|
||||
return status;
|
||||
/* Check revision compliance */
|
||||
if (sff8636_rev > 0x02) {
|
||||
/* Module is SFF-8636 compliant */
|
||||
@ -4005,11 +3982,11 @@ ice_get_module_eeprom(struct net_device *netdev,
|
||||
struct ice_vsi *vsi = np->vsi;
|
||||
struct ice_pf *pf = vsi->back;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
bool is_sfp = false;
|
||||
unsigned int i, j;
|
||||
u16 offset = 0;
|
||||
u8 page = 0;
|
||||
int status;
|
||||
|
||||
if (!ee || !ee->len || !data)
|
||||
return -EINVAL;
|
||||
@ -4017,7 +3994,7 @@ ice_get_module_eeprom(struct net_device *netdev,
|
||||
status = ice_aq_sff_eeprom(hw, 0, addr, offset, page, 0, value, 1, 0,
|
||||
NULL);
|
||||
if (status)
|
||||
return -EIO;
|
||||
return status;
|
||||
|
||||
if (value[0] == ICE_MODULE_TYPE_SFP)
|
||||
is_sfp = true;
|
||||
|
@ -530,7 +530,6 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
|
||||
struct ice_flow_prof *prof = NULL;
|
||||
struct ice_fd_hw_prof *hw_prof;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
u64 entry1_h = 0;
|
||||
u64 entry2_h = 0;
|
||||
u64 prof_id;
|
||||
@ -581,24 +580,20 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
|
||||
* actions (NULL) and zero actions 0.
|
||||
*/
|
||||
prof_id = flow + tun * ICE_FLTR_PTYPE_MAX;
|
||||
status = ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, prof_id, seg,
|
||||
TNL_SEG_CNT(tun), &prof);
|
||||
if (status)
|
||||
return ice_status_to_errno(status);
|
||||
status = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
|
||||
main_vsi->idx, ICE_FLOW_PRIO_NORMAL,
|
||||
seg, &entry1_h);
|
||||
if (status) {
|
||||
err = ice_status_to_errno(status);
|
||||
err = ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, prof_id, seg,
|
||||
TNL_SEG_CNT(tun), &prof);
|
||||
if (err)
|
||||
return err;
|
||||
err = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
|
||||
main_vsi->idx, ICE_FLOW_PRIO_NORMAL,
|
||||
seg, &entry1_h);
|
||||
if (err)
|
||||
goto err_prof;
|
||||
}
|
||||
status = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
|
||||
ctrl_vsi->idx, ICE_FLOW_PRIO_NORMAL,
|
||||
seg, &entry2_h);
|
||||
if (status) {
|
||||
err = ice_status_to_errno(status);
|
||||
err = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
|
||||
ctrl_vsi->idx, ICE_FLOW_PRIO_NORMAL,
|
||||
seg, &entry2_h);
|
||||
if (err)
|
||||
goto err_entry;
|
||||
}
|
||||
|
||||
hw_prof->fdir_seg[tun] = seg;
|
||||
hw_prof->entry_h[0][tun] = entry1_h;
|
||||
@ -1190,7 +1185,6 @@ ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add,
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
struct ice_fltr_desc desc;
|
||||
struct ice_vsi *ctrl_vsi;
|
||||
enum ice_status status;
|
||||
u8 *pkt, *frag_pkt;
|
||||
bool has_frag;
|
||||
int err;
|
||||
@ -1209,11 +1203,9 @@ ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add,
|
||||
}
|
||||
|
||||
ice_fdir_get_prgm_desc(hw, input, &desc, add);
|
||||
status = ice_fdir_get_gen_prgm_pkt(hw, input, pkt, false, is_tun);
|
||||
if (status) {
|
||||
err = ice_status_to_errno(status);
|
||||
err = ice_fdir_get_gen_prgm_pkt(hw, input, pkt, false, is_tun);
|
||||
if (err)
|
||||
goto err_free_all;
|
||||
}
|
||||
err = ice_prgm_fdir_fltr(ctrl_vsi, &desc, pkt);
|
||||
if (err)
|
||||
goto err_free_all;
|
||||
@ -1223,12 +1215,10 @@ ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add,
|
||||
if (has_frag) {
|
||||
/* does not return error */
|
||||
ice_fdir_get_prgm_desc(hw, input, &desc, add);
|
||||
status = ice_fdir_get_gen_prgm_pkt(hw, input, frag_pkt, true,
|
||||
is_tun);
|
||||
if (status) {
|
||||
err = ice_status_to_errno(status);
|
||||
err = ice_fdir_get_gen_prgm_pkt(hw, input, frag_pkt, true,
|
||||
is_tun);
|
||||
if (err)
|
||||
goto err_frag;
|
||||
}
|
||||
err = ice_prgm_fdir_fltr(ctrl_vsi, &desc, frag_pkt);
|
||||
if (err)
|
||||
goto err_frag;
|
||||
|
@ -712,7 +712,7 @@ ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,
|
||||
* @hw: pointer to the hardware structure
|
||||
* @cntr_id: returns counter index
|
||||
*/
|
||||
enum ice_status ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id)
|
||||
int ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id)
|
||||
{
|
||||
return ice_alloc_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK,
|
||||
ICE_AQC_RES_TYPE_FLAG_DEDICATED, 1, cntr_id);
|
||||
@ -723,7 +723,7 @@ enum ice_status ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id)
|
||||
* @hw: pointer to the hardware structure
|
||||
* @cntr_id: counter index to be freed
|
||||
*/
|
||||
enum ice_status ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id)
|
||||
int ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id)
|
||||
{
|
||||
return ice_free_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK,
|
||||
ICE_AQC_RES_TYPE_FLAG_DEDICATED, 1, cntr_id);
|
||||
@ -735,8 +735,7 @@ enum ice_status ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id)
|
||||
* @cntr_id: returns counter index
|
||||
* @num_fltr: number of filter entries to be allocated
|
||||
*/
|
||||
enum ice_status
|
||||
ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
|
||||
int ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
|
||||
{
|
||||
return ice_alloc_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES,
|
||||
ICE_AQC_RES_TYPE_FLAG_DEDICATED, num_fltr,
|
||||
@ -749,8 +748,7 @@ ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
|
||||
* @cntr_id: returns counter index
|
||||
* @num_fltr: number of filter entries to be allocated
|
||||
*/
|
||||
enum ice_status
|
||||
ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
|
||||
int ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
|
||||
{
|
||||
return ice_alloc_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES,
|
||||
ICE_AQC_RES_TYPE_FLAG_DEDICATED, num_fltr,
|
||||
@ -872,7 +870,7 @@ static void ice_pkt_insert_mac_addr(u8 *pkt, u8 *addr)
|
||||
* @frag: generate a fragment packet
|
||||
* @tun: true implies generate a tunnel packet
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
|
||||
u8 *pkt, bool frag, bool tun)
|
||||
{
|
||||
@ -919,15 +917,15 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
|
||||
if (ice_fdir_pkt[idx].flow == flow)
|
||||
break;
|
||||
if (idx == ICE_FDIR_NUM_PKT)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
if (!tun) {
|
||||
memcpy(pkt, ice_fdir_pkt[idx].pkt, ice_fdir_pkt[idx].pkt_len);
|
||||
loc = pkt;
|
||||
} else {
|
||||
if (!ice_get_open_tunnel_port(hw, &tnl_port, TNL_ALL))
|
||||
return ICE_ERR_DOES_NOT_EXIST;
|
||||
return -ENOENT;
|
||||
if (!ice_fdir_pkt[idx].tun_pkt)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
memcpy(pkt, ice_fdir_pkt[idx].tun_pkt,
|
||||
ice_fdir_pkt[idx].tun_pkt_len);
|
||||
ice_pkt_insert_u16(pkt, ICE_IPV4_UDP_DST_PORT_OFFSET,
|
||||
@ -1111,7 +1109,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
|
||||
ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
|
||||
break;
|
||||
default:
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (input->flex_fltr)
|
||||
|
@ -201,16 +201,14 @@ struct ice_fdir_base_pkt {
|
||||
const u8 *tun_pkt;
|
||||
};
|
||||
|
||||
enum ice_status ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id);
|
||||
enum ice_status ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);
|
||||
enum ice_status
|
||||
ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
|
||||
enum ice_status
|
||||
ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
|
||||
int ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id);
|
||||
int ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);
|
||||
int ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
|
||||
int ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
|
||||
void
|
||||
ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,
|
||||
struct ice_fltr_desc *fdesc, bool add);
|
||||
enum ice_status
|
||||
int
|
||||
ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
|
||||
u8 *pkt, bool frag, bool tun);
|
||||
int ice_get_fdir_cnt_all(struct ice_hw *hw);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,10 +18,67 @@
|
||||
|
||||
#define ICE_PKG_CNT 4
|
||||
|
||||
enum ice_status
|
||||
enum ice_ddp_state {
|
||||
/* Indicates that this call to ice_init_pkg
|
||||
* successfully loaded the requested DDP package
|
||||
*/
|
||||
ICE_DDP_PKG_SUCCESS = 0,
|
||||
|
||||
/* Generic error for already loaded errors, it is mapped later to
|
||||
* the more specific one (one of the next 3)
|
||||
*/
|
||||
ICE_DDP_PKG_ALREADY_LOADED = -1,
|
||||
|
||||
/* Indicates that a DDP package of the same version has already been
|
||||
* loaded onto the device by a previous call or by another PF
|
||||
*/
|
||||
ICE_DDP_PKG_SAME_VERSION_ALREADY_LOADED = -2,
|
||||
|
||||
/* The device has a DDP package that is not supported by the driver */
|
||||
ICE_DDP_PKG_ALREADY_LOADED_NOT_SUPPORTED = -3,
|
||||
|
||||
/* The device has a compatible package
|
||||
* (but different from the request) already loaded
|
||||
*/
|
||||
ICE_DDP_PKG_COMPATIBLE_ALREADY_LOADED = -4,
|
||||
|
||||
/* The firmware loaded on the device is not compatible with
|
||||
* the DDP package loaded
|
||||
*/
|
||||
ICE_DDP_PKG_FW_MISMATCH = -5,
|
||||
|
||||
/* The DDP package file is invalid */
|
||||
ICE_DDP_PKG_INVALID_FILE = -6,
|
||||
|
||||
/* The version of the DDP package provided is higher than
|
||||
* the driver supports
|
||||
*/
|
||||
ICE_DDP_PKG_FILE_VERSION_TOO_HIGH = -7,
|
||||
|
||||
/* The version of the DDP package provided is lower than the
|
||||
* driver supports
|
||||
*/
|
||||
ICE_DDP_PKG_FILE_VERSION_TOO_LOW = -8,
|
||||
|
||||
/* The signature of the DDP package file provided is invalid */
|
||||
ICE_DDP_PKG_FILE_SIGNATURE_INVALID = -9,
|
||||
|
||||
/* The DDP package file security revision is too low and not
|
||||
* supported by firmware
|
||||
*/
|
||||
ICE_DDP_PKG_FILE_REVISION_TOO_LOW = -10,
|
||||
|
||||
/* An error occurred in firmware while loading the DDP package */
|
||||
ICE_DDP_PKG_LOAD_ERROR = -11,
|
||||
|
||||
/* Other errors */
|
||||
ICE_DDP_PKG_ERR = -12
|
||||
};
|
||||
|
||||
int
|
||||
ice_acquire_change_lock(struct ice_hw *hw, enum ice_aq_res_access_type access);
|
||||
void ice_release_change_lock(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx,
|
||||
u8 *prot, u16 *off);
|
||||
void
|
||||
@ -29,7 +86,7 @@ ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type type,
|
||||
unsigned long *bm);
|
||||
void
|
||||
ice_init_prof_result_bm(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_get_sw_fv_list(struct ice_hw *hw, u8 *prot_ids, u16 ids_cnt,
|
||||
unsigned long *bm, struct list_head *fv_list);
|
||||
bool
|
||||
@ -40,22 +97,26 @@ int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table,
|
||||
int ice_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table,
|
||||
unsigned int idx, struct udp_tunnel_info *ti);
|
||||
|
||||
enum ice_status
|
||||
/* Rx parser PTYPE functions */
|
||||
bool ice_hw_ptype_ena(struct ice_hw *hw, u16 ptype);
|
||||
|
||||
/* XLT2/VSI group functions */
|
||||
int
|
||||
ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
|
||||
const struct ice_ptype_attributes *attr, u16 attr_cnt,
|
||||
struct ice_fv_word *es, u16 *masks);
|
||||
enum ice_status
|
||||
int
|
||||
ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
|
||||
enum ice_status
|
||||
int
|
||||
ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
|
||||
enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buff, u32 len);
|
||||
enum ice_status
|
||||
enum ice_ddp_state ice_init_pkg(struct ice_hw *hw, u8 *buff, u32 len);
|
||||
enum ice_ddp_state
|
||||
ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf, u32 len);
|
||||
enum ice_status ice_init_hw_tbls(struct ice_hw *hw);
|
||||
bool ice_is_init_pkg_successful(enum ice_ddp_state state);
|
||||
int ice_init_hw_tbls(struct ice_hw *hw);
|
||||
void ice_free_seg(struct ice_hw *hw);
|
||||
void ice_fill_blk_tbls(struct ice_hw *hw);
|
||||
void ice_clear_hw_tbls(struct ice_hw *hw);
|
||||
void ice_free_hw_tbls(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id);
|
||||
int ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id);
|
||||
#endif /* _ICE_FLEX_PIPE_H_ */
|
||||
|
@ -160,6 +160,7 @@ struct ice_meta_sect {
|
||||
#define ICE_SID_CDID_KEY_BUILDER_RSS 47
|
||||
#define ICE_SID_CDID_REDIR_RSS 48
|
||||
|
||||
#define ICE_SID_RXPARSER_MARKER_PTYPE 55
|
||||
#define ICE_SID_RXPARSER_BOOST_TCAM 56
|
||||
#define ICE_SID_TXPARSER_BOOST_TCAM 66
|
||||
|
||||
@ -201,6 +202,24 @@ enum ice_sect {
|
||||
ICE_SECT_COUNT
|
||||
};
|
||||
|
||||
/* Packet Type (PTYPE) values */
|
||||
#define ICE_PTYPE_MAC_PAY 1
|
||||
#define ICE_PTYPE_IPV4_PAY 23
|
||||
#define ICE_PTYPE_IPV4_UDP_PAY 24
|
||||
#define ICE_PTYPE_IPV4_TCP_PAY 26
|
||||
#define ICE_PTYPE_IPV4_SCTP_PAY 27
|
||||
#define ICE_PTYPE_IPV6_PAY 89
|
||||
#define ICE_PTYPE_IPV6_UDP_PAY 90
|
||||
#define ICE_PTYPE_IPV6_TCP_PAY 92
|
||||
#define ICE_PTYPE_IPV6_SCTP_PAY 93
|
||||
#define ICE_MAC_IPV4_ESP 160
|
||||
#define ICE_MAC_IPV6_ESP 161
|
||||
#define ICE_MAC_IPV4_AH 162
|
||||
#define ICE_MAC_IPV6_AH 163
|
||||
#define ICE_MAC_IPV4_NAT_T_ESP 164
|
||||
#define ICE_MAC_IPV6_NAT_T_ESP 165
|
||||
#define ICE_MAC_IPV4_GTPU 329
|
||||
#define ICE_MAC_IPV6_GTPU 330
|
||||
#define ICE_MAC_IPV4_GTPU_IPV4_FRAG 331
|
||||
#define ICE_MAC_IPV4_GTPU_IPV4_PAY 332
|
||||
#define ICE_MAC_IPV4_GTPU_IPV4_UDP_PAY 333
|
||||
@ -221,6 +240,10 @@ enum ice_sect {
|
||||
#define ICE_MAC_IPV6_GTPU_IPV6_UDP_PAY 348
|
||||
#define ICE_MAC_IPV6_GTPU_IPV6_TCP 349
|
||||
#define ICE_MAC_IPV6_GTPU_IPV6_ICMPV6 350
|
||||
#define ICE_MAC_IPV4_PFCP_SESSION 352
|
||||
#define ICE_MAC_IPV6_PFCP_SESSION 354
|
||||
#define ICE_MAC_IPV4_L2TPV3 360
|
||||
#define ICE_MAC_IPV6_L2TPV3 361
|
||||
|
||||
/* Attributes that can modify PTYPE definitions.
|
||||
*
|
||||
@ -329,6 +352,25 @@ struct ice_boost_tcam_section {
|
||||
sizeof(struct ice_boost_tcam_entry), \
|
||||
sizeof(struct ice_boost_tcam_entry))
|
||||
|
||||
/* package Marker Ptype TCAM entry */
|
||||
struct ice_marker_ptype_tcam_entry {
|
||||
#define ICE_MARKER_PTYPE_TCAM_ADDR_MAX 1024
|
||||
__le16 addr;
|
||||
__le16 ptype;
|
||||
u8 keys[20];
|
||||
};
|
||||
|
||||
struct ice_marker_ptype_tcam_section {
|
||||
__le16 count;
|
||||
__le16 reserved;
|
||||
struct ice_marker_ptype_tcam_entry tcam[];
|
||||
};
|
||||
|
||||
#define ICE_MAX_MARKER_PTYPE_TCAMS_IN_BUF \
|
||||
ICE_MAX_ENTRIES_IN_BUF(struct_size((struct ice_marker_ptype_tcam_section *)0, tcam, 1) - \
|
||||
sizeof(struct ice_marker_ptype_tcam_entry), \
|
||||
sizeof(struct ice_marker_ptype_tcam_entry))
|
||||
|
||||
struct ice_xlt1_section {
|
||||
__le16 count;
|
||||
__le16 offset;
|
||||
|
@ -609,8 +609,6 @@ struct ice_flow_prof_params {
|
||||
ICE_FLOW_SEG_HDR_ESP | ICE_FLOW_SEG_HDR_AH | \
|
||||
ICE_FLOW_SEG_HDR_NAT_T_ESP)
|
||||
|
||||
#define ICE_FLOW_SEG_HDRS_L2_MASK \
|
||||
(ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN)
|
||||
#define ICE_FLOW_SEG_HDRS_L3_MASK \
|
||||
(ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_ARP)
|
||||
#define ICE_FLOW_SEG_HDRS_L4_MASK \
|
||||
@ -625,8 +623,7 @@ struct ice_flow_prof_params {
|
||||
* @segs: array of one or more packet segments that describe the flow
|
||||
* @segs_cnt: number of packet segments provided
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)
|
||||
static int ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
@ -634,12 +631,12 @@ ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)
|
||||
/* Multiple L3 headers */
|
||||
if (segs[i].hdrs & ICE_FLOW_SEG_HDRS_L3_MASK &&
|
||||
!is_power_of_2(segs[i].hdrs & ICE_FLOW_SEG_HDRS_L3_MASK))
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
/* Multiple L4 headers */
|
||||
if (segs[i].hdrs & ICE_FLOW_SEG_HDRS_L4_MASK &&
|
||||
!is_power_of_2(segs[i].hdrs & ICE_FLOW_SEG_HDRS_L4_MASK))
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -700,8 +697,7 @@ static u16 ice_flow_calc_seg_sz(struct ice_flow_prof_params *params, u8 seg)
|
||||
* This function identifies the packet types associated with the protocol
|
||||
* headers being present in packet segments of the specified flow profile.
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
|
||||
static int ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
|
||||
{
|
||||
struct ice_flow_prof *prof;
|
||||
u8 i;
|
||||
@ -898,7 +894,7 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
|
||||
* field. It then allocates one or more extraction sequence entries for the
|
||||
* given field, and fill the entries with protocol ID and offset information.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
|
||||
u8 seg, enum ice_flow_field fld, u64 match)
|
||||
{
|
||||
@ -1035,7 +1031,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
|
||||
prot_id = ICE_PROT_GRE_OF;
|
||||
break;
|
||||
default:
|
||||
return ICE_ERR_NOT_IMPL;
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
/* Each extraction sequence entry is a word in size, and extracts a
|
||||
@ -1073,7 +1069,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
|
||||
* does not exceed the block's capability
|
||||
*/
|
||||
if (params->es_cnt >= fv_words)
|
||||
return ICE_ERR_MAX_LIMIT;
|
||||
return -ENOSPC;
|
||||
|
||||
/* some blocks require a reversed field vector layout */
|
||||
if (hw->blk[params->blk].es.reverse)
|
||||
@ -1099,7 +1095,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
|
||||
* @params: information about the flow to be processed
|
||||
* @seg: index of packet segment whose raw fields are to be extracted
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
|
||||
u8 seg)
|
||||
{
|
||||
@ -1112,12 +1108,12 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
|
||||
|
||||
if (params->prof->segs[seg].raws_cnt >
|
||||
ARRAY_SIZE(params->prof->segs[seg].raws))
|
||||
return ICE_ERR_MAX_LIMIT;
|
||||
return -ENOSPC;
|
||||
|
||||
/* Offsets within the segment headers are not supported */
|
||||
hdrs_sz = ice_flow_calc_seg_sz(params, seg);
|
||||
if (!hdrs_sz)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
fv_words = hw->blk[params->blk].es.fvw;
|
||||
|
||||
@ -1150,7 +1146,7 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
|
||||
*/
|
||||
if (params->es_cnt >= hw->blk[params->blk].es.count ||
|
||||
params->es_cnt >= ICE_MAX_FV_WORDS)
|
||||
return ICE_ERR_MAX_LIMIT;
|
||||
return -ENOSPC;
|
||||
|
||||
/* some blocks require a reversed field vector layout */
|
||||
if (hw->blk[params->blk].es.reverse)
|
||||
@ -1176,12 +1172,12 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
|
||||
* This function iterates through all matched fields in the given segments, and
|
||||
* creates an extraction sequence for the fields.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_create_xtrct_seq(struct ice_hw *hw,
|
||||
struct ice_flow_prof_params *params)
|
||||
{
|
||||
struct ice_flow_prof *prof = params->prof;
|
||||
enum ice_status status = 0;
|
||||
int status = 0;
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < prof->segs_cnt; i++) {
|
||||
@ -1210,10 +1206,10 @@ ice_flow_create_xtrct_seq(struct ice_hw *hw,
|
||||
* @hw: pointer to the HW struct
|
||||
* @params: information about the flow to be processed
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_proc_segs(struct ice_hw *hw, struct ice_flow_prof_params *params)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
status = ice_flow_proc_seg_hdrs(params);
|
||||
if (status)
|
||||
@ -1229,7 +1225,7 @@ ice_flow_proc_segs(struct ice_hw *hw, struct ice_flow_prof_params *params)
|
||||
status = 0;
|
||||
break;
|
||||
default:
|
||||
return ICE_ERR_NOT_IMPL;
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -1329,12 +1325,12 @@ ice_dealloc_flow_entry(struct ice_hw *hw, struct ice_flow_entry *entry)
|
||||
* @blk: classification stage
|
||||
* @entry: flow entry to be removed
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_rem_entry_sync(struct ice_hw *hw, enum ice_block __always_unused blk,
|
||||
struct ice_flow_entry *entry)
|
||||
{
|
||||
if (!entry)
|
||||
return ICE_ERR_BAD_PTR;
|
||||
return -EINVAL;
|
||||
|
||||
list_del(&entry->l_entry);
|
||||
|
||||
@ -1355,27 +1351,27 @@ ice_flow_rem_entry_sync(struct ice_hw *hw, enum ice_block __always_unused blk,
|
||||
*
|
||||
* Assumption: the caller has acquired the lock to the profile list
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk,
|
||||
enum ice_flow_dir dir, u64 prof_id,
|
||||
struct ice_flow_seg_info *segs, u8 segs_cnt,
|
||||
struct ice_flow_prof **prof)
|
||||
{
|
||||
struct ice_flow_prof_params *params;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
u8 i;
|
||||
|
||||
if (!prof)
|
||||
return ICE_ERR_BAD_PTR;
|
||||
return -EINVAL;
|
||||
|
||||
params = kzalloc(sizeof(*params), GFP_KERNEL);
|
||||
if (!params)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
params->prof = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*params->prof),
|
||||
GFP_KERNEL);
|
||||
if (!params->prof) {
|
||||
status = ICE_ERR_NO_MEMORY;
|
||||
status = -ENOMEM;
|
||||
goto free_params;
|
||||
}
|
||||
|
||||
@ -1432,11 +1428,11 @@ free_params:
|
||||
*
|
||||
* Assumption: the caller has acquired the lock to the profile list
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_rem_prof_sync(struct ice_hw *hw, enum ice_block blk,
|
||||
struct ice_flow_prof *prof)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
/* Remove all remaining flow entries before removing the flow profile */
|
||||
if (!list_empty(&prof->entries)) {
|
||||
@ -1474,11 +1470,11 @@ ice_flow_rem_prof_sync(struct ice_hw *hw, enum ice_block blk,
|
||||
* Assumption: the caller has acquired the lock to the profile list
|
||||
* and the software VSI handle has been validated
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_assoc_prof(struct ice_hw *hw, enum ice_block blk,
|
||||
struct ice_flow_prof *prof, u16 vsi_handle)
|
||||
{
|
||||
enum ice_status status = 0;
|
||||
int status = 0;
|
||||
|
||||
if (!test_bit(vsi_handle, prof->vsis)) {
|
||||
status = ice_add_prof_id_flow(hw, blk,
|
||||
@ -1505,11 +1501,11 @@ ice_flow_assoc_prof(struct ice_hw *hw, enum ice_block blk,
|
||||
* Assumption: the caller has acquired the lock to the profile list
|
||||
* and the software VSI handle has been validated
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_disassoc_prof(struct ice_hw *hw, enum ice_block blk,
|
||||
struct ice_flow_prof *prof, u16 vsi_handle)
|
||||
{
|
||||
enum ice_status status = 0;
|
||||
int status = 0;
|
||||
|
||||
if (test_bit(vsi_handle, prof->vsis)) {
|
||||
status = ice_rem_prof_id_flow(hw, blk,
|
||||
@ -1536,21 +1532,21 @@ ice_flow_disassoc_prof(struct ice_hw *hw, enum ice_block blk,
|
||||
* @segs_cnt: number of packet segments provided
|
||||
* @prof: stores the returned flow profile added
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir,
|
||||
u64 prof_id, struct ice_flow_seg_info *segs, u8 segs_cnt,
|
||||
struct ice_flow_prof **prof)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (segs_cnt > ICE_FLOW_SEG_MAX)
|
||||
return ICE_ERR_MAX_LIMIT;
|
||||
return -ENOSPC;
|
||||
|
||||
if (!segs_cnt)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
if (!segs)
|
||||
return ICE_ERR_BAD_PTR;
|
||||
return -EINVAL;
|
||||
|
||||
status = ice_flow_val_hdrs(segs, segs_cnt);
|
||||
if (status)
|
||||
@ -1574,17 +1570,16 @@ ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir,
|
||||
* @blk: the block for which the flow profile is to be removed
|
||||
* @prof_id: unique ID of the flow profile to be removed
|
||||
*/
|
||||
enum ice_status
|
||||
ice_flow_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id)
|
||||
int ice_flow_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id)
|
||||
{
|
||||
struct ice_flow_prof *prof;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
mutex_lock(&hw->fl_profs_locks[blk]);
|
||||
|
||||
prof = ice_flow_find_prof_id(hw, blk, prof_id);
|
||||
if (!prof) {
|
||||
status = ICE_ERR_DOES_NOT_EXIST;
|
||||
status = -ENOENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1608,34 +1603,34 @@ out:
|
||||
* @data: pointer to a data buffer containing flow entry's match values/masks
|
||||
* @entry_h: pointer to buffer that receives the new flow entry's handle
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id,
|
||||
u64 entry_id, u16 vsi_handle, enum ice_flow_priority prio,
|
||||
void *data, u64 *entry_h)
|
||||
{
|
||||
struct ice_flow_entry *e = NULL;
|
||||
struct ice_flow_prof *prof;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
/* No flow entry data is expected for RSS */
|
||||
if (!entry_h || (!data && blk != ICE_BLK_RSS))
|
||||
return ICE_ERR_BAD_PTR;
|
||||
return -EINVAL;
|
||||
|
||||
if (!ice_is_vsi_valid(hw, vsi_handle))
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&hw->fl_profs_locks[blk]);
|
||||
|
||||
prof = ice_flow_find_prof_id(hw, blk, prof_id);
|
||||
if (!prof) {
|
||||
status = ICE_ERR_DOES_NOT_EXIST;
|
||||
status = -ENOENT;
|
||||
} else {
|
||||
/* Allocate memory for the entry being added and associate
|
||||
* the VSI to the found flow profile
|
||||
*/
|
||||
e = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*e), GFP_KERNEL);
|
||||
if (!e)
|
||||
status = ICE_ERR_NO_MEMORY;
|
||||
status = -ENOMEM;
|
||||
else
|
||||
status = ice_flow_assoc_prof(hw, blk, prof, vsi_handle);
|
||||
}
|
||||
@ -1654,7 +1649,7 @@ ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id,
|
||||
case ICE_BLK_RSS:
|
||||
break;
|
||||
default:
|
||||
status = ICE_ERR_NOT_IMPL;
|
||||
status = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1680,15 +1675,14 @@ out:
|
||||
* @blk: classification stage
|
||||
* @entry_h: handle to the flow entry to be removed
|
||||
*/
|
||||
enum ice_status ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk,
|
||||
u64 entry_h)
|
||||
int ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk, u64 entry_h)
|
||||
{
|
||||
struct ice_flow_entry *entry;
|
||||
struct ice_flow_prof *prof;
|
||||
enum ice_status status = 0;
|
||||
int status = 0;
|
||||
|
||||
if (entry_h == ICE_FLOW_ENTRY_HANDLE_INVAL)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
entry = ICE_FLOW_ENTRY_PTR(entry_h);
|
||||
|
||||
@ -1836,7 +1830,7 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info *seg, u16 off, u8 len,
|
||||
* header value to set flow field segment for further use in flow
|
||||
* profile entry or removal.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_flow_set_rss_seg_info(struct ice_flow_seg_info *segs, u64 hash_fields,
|
||||
u32 flow_hdr)
|
||||
{
|
||||
@ -1853,15 +1847,15 @@ ice_flow_set_rss_seg_info(struct ice_flow_seg_info *segs, u64 hash_fields,
|
||||
|
||||
if (segs->hdrs & ~ICE_FLOW_RSS_SEG_HDR_VAL_MASKS &
|
||||
~ICE_FLOW_RSS_HDRS_INNER_MASK & ~ICE_FLOW_SEG_HDR_IPV_OTHER)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
val = (u64)(segs->hdrs & ICE_FLOW_RSS_SEG_HDR_L3_MASKS);
|
||||
if (val && !is_power_of_2(val))
|
||||
return ICE_ERR_CFG;
|
||||
return -EIO;
|
||||
|
||||
val = (u64)(segs->hdrs & ICE_FLOW_RSS_SEG_HDR_L4_MASKS);
|
||||
if (val && !is_power_of_2(val))
|
||||
return ICE_ERR_CFG;
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1899,14 +1893,14 @@ void ice_rem_vsi_rss_list(struct ice_hw *hw, u16 vsi_handle)
|
||||
* the VSI from that profile. If the flow profile has no VSIs it will
|
||||
* be removed.
|
||||
*/
|
||||
enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
|
||||
int ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
|
||||
{
|
||||
const enum ice_block blk = ICE_BLK_RSS;
|
||||
struct ice_flow_prof *p, *t;
|
||||
enum ice_status status = 0;
|
||||
int status = 0;
|
||||
|
||||
if (!ice_is_vsi_valid(hw, vsi_handle))
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
if (list_empty(&hw->fl_profs[blk]))
|
||||
return 0;
|
||||
@ -1966,7 +1960,7 @@ ice_rem_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
|
||||
*
|
||||
* Assumption: lock has already been acquired for RSS list
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
|
||||
{
|
||||
struct ice_rss_cfg *r, *rss_cfg;
|
||||
@ -1981,7 +1975,7 @@ ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
|
||||
rss_cfg = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*rss_cfg),
|
||||
GFP_KERNEL);
|
||||
if (!rss_cfg)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
rss_cfg->hashed_flds = prof->segs[prof->segs_cnt - 1].match;
|
||||
rss_cfg->packet_hdr = prof->segs[prof->segs_cnt - 1].hdrs;
|
||||
@ -2022,21 +2016,21 @@ ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
|
||||
*
|
||||
* Assumption: lock has already been acquired for RSS list
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_add_rss_cfg_sync(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
|
||||
u32 addl_hdrs, u8 segs_cnt)
|
||||
{
|
||||
const enum ice_block blk = ICE_BLK_RSS;
|
||||
struct ice_flow_prof *prof = NULL;
|
||||
struct ice_flow_seg_info *segs;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (!segs_cnt || segs_cnt > ICE_FLOW_SEG_MAX)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
segs = kcalloc(segs_cnt, sizeof(*segs), GFP_KERNEL);
|
||||
if (!segs)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
/* Construct the packet segment info from the hashed fields */
|
||||
status = ice_flow_set_rss_seg_info(&segs[segs_cnt - 1], hashed_flds,
|
||||
@ -2128,15 +2122,15 @@ exit:
|
||||
* the input fields to hash on, the flow type and use the VSI number to add
|
||||
* a flow entry to the profile.
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
|
||||
u32 addl_hdrs)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (hashed_flds == ICE_HASH_INVALID ||
|
||||
!ice_is_vsi_valid(hw, vsi_handle))
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&hw->rss_locks);
|
||||
status = ice_add_rss_cfg_sync(hw, vsi_handle, hashed_flds, addl_hdrs,
|
||||
@ -2159,18 +2153,18 @@ ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
|
||||
*
|
||||
* Assumption: lock has already been acquired for RSS list
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_rem_rss_cfg_sync(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
|
||||
u32 addl_hdrs, u8 segs_cnt)
|
||||
{
|
||||
const enum ice_block blk = ICE_BLK_RSS;
|
||||
struct ice_flow_seg_info *segs;
|
||||
struct ice_flow_prof *prof;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
segs = kcalloc(segs_cnt, sizeof(*segs), GFP_KERNEL);
|
||||
if (!segs)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
/* Construct the packet segment info from the hashed fields */
|
||||
status = ice_flow_set_rss_seg_info(&segs[segs_cnt - 1], hashed_flds,
|
||||
@ -2182,7 +2176,7 @@ ice_rem_rss_cfg_sync(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
|
||||
vsi_handle,
|
||||
ICE_FLOW_FIND_PROF_CHK_FLDS);
|
||||
if (!prof) {
|
||||
status = ICE_ERR_DOES_NOT_EXIST;
|
||||
status = -ENOENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2216,15 +2210,15 @@ out:
|
||||
* removed. Calls are made to underlying flow s which will APIs
|
||||
* turn build or update buffers for RSS XLT1 section.
|
||||
*/
|
||||
enum ice_status __maybe_unused
|
||||
int __maybe_unused
|
||||
ice_rem_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
|
||||
u32 addl_hdrs)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (hashed_flds == ICE_HASH_INVALID ||
|
||||
!ice_is_vsi_valid(hw, vsi_handle))
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&hw->rss_locks);
|
||||
status = ice_rem_rss_cfg_sync(hw, vsi_handle, hashed_flds, addl_hdrs,
|
||||
@ -2279,20 +2273,19 @@ ice_rem_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
|
||||
* message, convert it to ICE-compatible values, and configure RSS flow
|
||||
* profiles.
|
||||
*/
|
||||
enum ice_status
|
||||
ice_add_avf_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 avf_hash)
|
||||
int ice_add_avf_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 avf_hash)
|
||||
{
|
||||
enum ice_status status = 0;
|
||||
int status = 0;
|
||||
u64 hash_flds;
|
||||
|
||||
if (avf_hash == ICE_AVF_FLOW_FIELD_INVALID ||
|
||||
!ice_is_vsi_valid(hw, vsi_handle))
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
/* Make sure no unsupported bits are specified */
|
||||
if (avf_hash & ~(ICE_FLOW_AVF_RSS_ALL_IPV4_MASKS |
|
||||
ICE_FLOW_AVF_RSS_ALL_IPV6_MASKS))
|
||||
return ICE_ERR_CFG;
|
||||
return -EIO;
|
||||
|
||||
hash_flds = avf_hash;
|
||||
|
||||
@ -2352,7 +2345,7 @@ ice_add_avf_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 avf_hash)
|
||||
}
|
||||
|
||||
if (rss_hash == ICE_HASH_INVALID)
|
||||
return ICE_ERR_OUT_OF_RANGE;
|
||||
return -EIO;
|
||||
|
||||
status = ice_add_rss_cfg(hw, vsi_handle, rss_hash,
|
||||
ICE_FLOW_SEG_HDR_NONE);
|
||||
@ -2368,13 +2361,13 @@ ice_add_avf_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 avf_hash)
|
||||
* @hw: pointer to the hardware structure
|
||||
* @vsi_handle: software VSI handle
|
||||
*/
|
||||
enum ice_status ice_replay_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
|
||||
int ice_replay_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
|
||||
{
|
||||
enum ice_status status = 0;
|
||||
struct ice_rss_cfg *r;
|
||||
int status = 0;
|
||||
|
||||
if (!ice_is_vsi_valid(hw, vsi_handle))
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&hw->rss_locks);
|
||||
list_for_each_entry(r, &hw->rss_list_head, l_entry) {
|
||||
|
@ -383,18 +383,16 @@ struct ice_rss_cfg {
|
||||
u32 packet_hdr;
|
||||
};
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir,
|
||||
u64 prof_id, struct ice_flow_seg_info *segs, u8 segs_cnt,
|
||||
struct ice_flow_prof **prof);
|
||||
enum ice_status
|
||||
ice_flow_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id);
|
||||
enum ice_status
|
||||
int ice_flow_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id);
|
||||
int
|
||||
ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id,
|
||||
u64 entry_id, u16 vsi, enum ice_flow_priority prio,
|
||||
void *data, u64 *entry_h);
|
||||
enum ice_status
|
||||
ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk, u64 entry_h);
|
||||
int ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk, u64 entry_h);
|
||||
void
|
||||
ice_flow_set_fld(struct ice_flow_seg_info *seg, enum ice_flow_field fld,
|
||||
u16 val_loc, u16 mask_loc, u16 last_loc, bool range);
|
||||
@ -402,14 +400,13 @@ void
|
||||
ice_flow_add_fld_raw(struct ice_flow_seg_info *seg, u16 off, u8 len,
|
||||
u16 val_loc, u16 mask_loc);
|
||||
void ice_rem_vsi_rss_list(struct ice_hw *hw, u16 vsi_handle);
|
||||
enum ice_status ice_replay_rss_cfg(struct ice_hw *hw, u16 vsi_handle);
|
||||
enum ice_status
|
||||
ice_add_avf_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds);
|
||||
enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle);
|
||||
enum ice_status
|
||||
int ice_replay_rss_cfg(struct ice_hw *hw, u16 vsi_handle);
|
||||
int ice_add_avf_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds);
|
||||
int ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle);
|
||||
int
|
||||
ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
|
||||
u32 addl_hdrs);
|
||||
enum ice_status
|
||||
int
|
||||
ice_rem_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,
|
||||
u32 addl_hdrs);
|
||||
u64 ice_get_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u32 hdrs);
|
||||
|
@ -46,13 +46,70 @@ ice_fltr_add_entry_to_list(struct device *dev, struct ice_fltr_info *info,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_fltr_set_vlan_vsi_promisc
|
||||
* @hw: pointer to the hardware structure
|
||||
* @vsi: the VSI being configured
|
||||
* @promisc_mask: mask of promiscuous config bits
|
||||
*
|
||||
* Set VSI with all associated VLANs to given promiscuous mode(s)
|
||||
*/
|
||||
int
|
||||
ice_fltr_set_vlan_vsi_promisc(struct ice_hw *hw, struct ice_vsi *vsi,
|
||||
u8 promisc_mask)
|
||||
{
|
||||
return ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_mask, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_fltr_clear_vlan_vsi_promisc
|
||||
* @hw: pointer to the hardware structure
|
||||
* @vsi: the VSI being configured
|
||||
* @promisc_mask: mask of promiscuous config bits
|
||||
*
|
||||
* Clear VSI with all associated VLANs to given promiscuous mode(s)
|
||||
*/
|
||||
int
|
||||
ice_fltr_clear_vlan_vsi_promisc(struct ice_hw *hw, struct ice_vsi *vsi,
|
||||
u8 promisc_mask)
|
||||
{
|
||||
return ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_mask, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_fltr_clear_vsi_promisc - clear specified promiscuous mode(s)
|
||||
* @hw: pointer to the hardware structure
|
||||
* @vsi_handle: VSI handle to clear mode
|
||||
* @promisc_mask: mask of promiscuous config bits to clear
|
||||
* @vid: VLAN ID to clear VLAN promiscuous
|
||||
*/
|
||||
int
|
||||
ice_fltr_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
|
||||
u16 vid)
|
||||
{
|
||||
return ice_clear_vsi_promisc(hw, vsi_handle, promisc_mask, vid);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_fltr_set_vsi_promisc - set given VSI to given promiscuous mode(s)
|
||||
* @hw: pointer to the hardware structure
|
||||
* @vsi_handle: VSI handle to configure
|
||||
* @promisc_mask: mask of promiscuous config bits
|
||||
* @vid: VLAN ID to set VLAN promiscuous
|
||||
*/
|
||||
int
|
||||
ice_fltr_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
|
||||
u16 vid)
|
||||
{
|
||||
return ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vid);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_fltr_add_mac_list - add list of MAC filters
|
||||
* @vsi: pointer to VSI struct
|
||||
* @list: list of filters
|
||||
*/
|
||||
enum ice_status
|
||||
ice_fltr_add_mac_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
int ice_fltr_add_mac_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
{
|
||||
return ice_add_mac(&vsi->back->hw, list);
|
||||
}
|
||||
@ -62,8 +119,7 @@ ice_fltr_add_mac_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
* @vsi: pointer to VSI struct
|
||||
* @list: list of filters
|
||||
*/
|
||||
enum ice_status
|
||||
ice_fltr_remove_mac_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
int ice_fltr_remove_mac_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
{
|
||||
return ice_remove_mac(&vsi->back->hw, list);
|
||||
}
|
||||
@ -73,8 +129,7 @@ ice_fltr_remove_mac_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
* @vsi: pointer to VSI struct
|
||||
* @list: list of filters
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_fltr_add_vlan_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
static int ice_fltr_add_vlan_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
{
|
||||
return ice_add_vlan(&vsi->back->hw, list);
|
||||
}
|
||||
@ -84,7 +139,7 @@ ice_fltr_add_vlan_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
* @vsi: pointer to VSI struct
|
||||
* @list: list of filters
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_fltr_remove_vlan_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
{
|
||||
return ice_remove_vlan(&vsi->back->hw, list);
|
||||
@ -95,8 +150,7 @@ ice_fltr_remove_vlan_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
* @vsi: pointer to VSI struct
|
||||
* @list: list of filters
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_fltr_add_eth_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
static int ice_fltr_add_eth_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
{
|
||||
return ice_add_eth_mac(&vsi->back->hw, list);
|
||||
}
|
||||
@ -106,8 +160,7 @@ ice_fltr_add_eth_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
* @vsi: pointer to VSI struct
|
||||
* @list: list of filters
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_fltr_remove_eth_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
static int ice_fltr_remove_eth_list(struct ice_vsi *vsi, struct list_head *list)
|
||||
{
|
||||
return ice_remove_eth_mac(&vsi->back->hw, list);
|
||||
}
|
||||
@ -207,18 +260,17 @@ ice_fltr_add_eth_to_list(struct ice_vsi *vsi, struct list_head *list,
|
||||
* @action: action to be performed on filter match
|
||||
* @mac_action: pointer to add or remove MAC function
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_fltr_prepare_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action,
|
||||
enum ice_status (*mac_action)(struct ice_vsi *,
|
||||
struct list_head *))
|
||||
int (*mac_action)(struct ice_vsi *, struct list_head *))
|
||||
{
|
||||
enum ice_status result;
|
||||
LIST_HEAD(tmp_list);
|
||||
int result;
|
||||
|
||||
if (ice_fltr_add_mac_to_list(vsi, &tmp_list, mac, action)) {
|
||||
ice_fltr_free_list(ice_pf_to_dev(vsi->back), &tmp_list);
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
result = mac_action(vsi, &tmp_list);
|
||||
@ -233,21 +285,21 @@ ice_fltr_prepare_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
* @action: action to be performed on filter match
|
||||
* @mac_action: pointer to add or remove MAC function
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_fltr_prepare_mac_and_broadcast(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action,
|
||||
enum ice_status(*mac_action)
|
||||
int(*mac_action)
|
||||
(struct ice_vsi *, struct list_head *))
|
||||
{
|
||||
u8 broadcast[ETH_ALEN];
|
||||
enum ice_status result;
|
||||
LIST_HEAD(tmp_list);
|
||||
int result;
|
||||
|
||||
eth_broadcast_addr(broadcast);
|
||||
if (ice_fltr_add_mac_to_list(vsi, &tmp_list, mac, action) ||
|
||||
ice_fltr_add_mac_to_list(vsi, &tmp_list, broadcast, action)) {
|
||||
ice_fltr_free_list(ice_pf_to_dev(vsi->back), &tmp_list);
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
result = mac_action(vsi, &tmp_list);
|
||||
@ -262,17 +314,16 @@ ice_fltr_prepare_mac_and_broadcast(struct ice_vsi *vsi, const u8 *mac,
|
||||
* @action: action to be performed on filter match
|
||||
* @vlan_action: pointer to add or remove VLAN function
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_fltr_prepare_vlan(struct ice_vsi *vsi, u16 vlan_id,
|
||||
enum ice_sw_fwd_act_type action,
|
||||
enum ice_status (*vlan_action)(struct ice_vsi *,
|
||||
struct list_head *))
|
||||
int (*vlan_action)(struct ice_vsi *, struct list_head *))
|
||||
{
|
||||
enum ice_status result;
|
||||
LIST_HEAD(tmp_list);
|
||||
int result;
|
||||
|
||||
if (ice_fltr_add_vlan_to_list(vsi, &tmp_list, vlan_id, action))
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
result = vlan_action(vsi, &tmp_list);
|
||||
ice_fltr_free_list(ice_pf_to_dev(vsi->back), &tmp_list);
|
||||
@ -287,17 +338,16 @@ ice_fltr_prepare_vlan(struct ice_vsi *vsi, u16 vlan_id,
|
||||
* @action: action to be performed on filter match
|
||||
* @eth_action: pointer to add or remove ethertype function
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_fltr_prepare_eth(struct ice_vsi *vsi, u16 ethertype, u16 flag,
|
||||
enum ice_sw_fwd_act_type action,
|
||||
enum ice_status (*eth_action)(struct ice_vsi *,
|
||||
struct list_head *))
|
||||
int (*eth_action)(struct ice_vsi *, struct list_head *))
|
||||
{
|
||||
enum ice_status result;
|
||||
LIST_HEAD(tmp_list);
|
||||
int result;
|
||||
|
||||
if (ice_fltr_add_eth_to_list(vsi, &tmp_list, ethertype, flag, action))
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
result = eth_action(vsi, &tmp_list);
|
||||
ice_fltr_free_list(ice_pf_to_dev(vsi->back), &tmp_list);
|
||||
@ -310,8 +360,8 @@ ice_fltr_prepare_eth(struct ice_vsi *vsi, u16 ethertype, u16 flag,
|
||||
* @mac: MAC to add
|
||||
* @action: action to be performed on filter match
|
||||
*/
|
||||
enum ice_status ice_fltr_add_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
int ice_fltr_add_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
{
|
||||
return ice_fltr_prepare_mac(vsi, mac, action, ice_fltr_add_mac_list);
|
||||
}
|
||||
@ -322,7 +372,7 @@ enum ice_status ice_fltr_add_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
* @mac: MAC to add
|
||||
* @action: action to be performed on filter match
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_fltr_add_mac_and_broadcast(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
{
|
||||
@ -336,8 +386,8 @@ ice_fltr_add_mac_and_broadcast(struct ice_vsi *vsi, const u8 *mac,
|
||||
* @mac: filter MAC to remove
|
||||
* @action: action to remove
|
||||
*/
|
||||
enum ice_status ice_fltr_remove_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
int ice_fltr_remove_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
{
|
||||
return ice_fltr_prepare_mac(vsi, mac, action, ice_fltr_remove_mac_list);
|
||||
}
|
||||
@ -348,8 +398,8 @@ enum ice_status ice_fltr_remove_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
* @vlan_id: VLAN ID to add
|
||||
* @action: action to be performed on filter match
|
||||
*/
|
||||
enum ice_status ice_fltr_add_vlan(struct ice_vsi *vsi, u16 vlan_id,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
int ice_fltr_add_vlan(struct ice_vsi *vsi, u16 vlan_id,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
{
|
||||
return ice_fltr_prepare_vlan(vsi, vlan_id, action,
|
||||
ice_fltr_add_vlan_list);
|
||||
@ -361,8 +411,8 @@ enum ice_status ice_fltr_add_vlan(struct ice_vsi *vsi, u16 vlan_id,
|
||||
* @vlan_id: filter VLAN to remove
|
||||
* @action: action to remove
|
||||
*/
|
||||
enum ice_status ice_fltr_remove_vlan(struct ice_vsi *vsi, u16 vlan_id,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
int ice_fltr_remove_vlan(struct ice_vsi *vsi, u16 vlan_id,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
{
|
||||
return ice_fltr_prepare_vlan(vsi, vlan_id, action,
|
||||
ice_fltr_remove_vlan_list);
|
||||
@ -375,8 +425,8 @@ enum ice_status ice_fltr_remove_vlan(struct ice_vsi *vsi, u16 vlan_id,
|
||||
* @flag: direction of packet to be filtered, Tx or Rx
|
||||
* @action: action to be performed on filter match
|
||||
*/
|
||||
enum ice_status ice_fltr_add_eth(struct ice_vsi *vsi, u16 ethertype, u16 flag,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
int ice_fltr_add_eth(struct ice_vsi *vsi, u16 ethertype, u16 flag,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
{
|
||||
return ice_fltr_prepare_eth(vsi, ethertype, flag, action,
|
||||
ice_fltr_add_eth_list);
|
||||
@ -389,8 +439,8 @@ enum ice_status ice_fltr_add_eth(struct ice_vsi *vsi, u16 ethertype, u16 flag,
|
||||
* @flag: direction of filter
|
||||
* @action: action to remove
|
||||
*/
|
||||
enum ice_status ice_fltr_remove_eth(struct ice_vsi *vsi, u16 ethertype,
|
||||
u16 flag, enum ice_sw_fwd_act_type action)
|
||||
int ice_fltr_remove_eth(struct ice_vsi *vsi, u16 ethertype, u16 flag,
|
||||
enum ice_sw_fwd_act_type action)
|
||||
{
|
||||
return ice_fltr_prepare_eth(vsi, ethertype, flag, action,
|
||||
ice_fltr_remove_eth_list);
|
||||
@ -406,17 +456,17 @@ enum ice_status ice_fltr_remove_eth(struct ice_vsi *vsi, u16 ethertype,
|
||||
* @src: source VSI
|
||||
* @new_flags: combinations of lb_en and lan_en
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_fltr_update_rule_flags(struct ice_hw *hw, u16 rule_id, u16 recipe_id,
|
||||
u32 act, u16 type, u16 src, u32 new_flags)
|
||||
{
|
||||
struct ice_aqc_sw_rules_elem *s_rule;
|
||||
enum ice_status err;
|
||||
u32 flags_mask;
|
||||
int err;
|
||||
|
||||
s_rule = kzalloc(ICE_SW_RULE_RX_TX_NO_HDR_SIZE, GFP_KERNEL);
|
||||
if (!s_rule)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
flags_mask = ICE_SINGLE_ACT_LB_ENABLE | ICE_SINGLE_ACT_LAN_ENABLE;
|
||||
act &= ~flags_mask;
|
||||
@ -465,7 +515,7 @@ static u32 ice_fltr_build_action(u16 vsi_id)
|
||||
* Flags should be a combination of ICE_SINGLE_ACT_LB_ENABLE and
|
||||
* ICE_SINGLE_ACT_LAN_ENABLE.
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_fltr_update_flags_dflt_rule(struct ice_vsi *vsi, u16 rule_id, u8 direction,
|
||||
u32 new_flags)
|
||||
{
|
||||
|
@ -5,38 +5,52 @@
|
||||
#define _ICE_FLTR_H_
|
||||
|
||||
void ice_fltr_free_list(struct device *dev, struct list_head *h);
|
||||
enum ice_status
|
||||
int
|
||||
ice_fltr_set_vlan_vsi_promisc(struct ice_hw *hw, struct ice_vsi *vsi,
|
||||
u8 promisc_mask);
|
||||
int
|
||||
ice_fltr_clear_vlan_vsi_promisc(struct ice_hw *hw, struct ice_vsi *vsi,
|
||||
u8 promisc_mask);
|
||||
int
|
||||
ice_fltr_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
|
||||
u16 vid);
|
||||
int
|
||||
ice_fltr_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
|
||||
u16 vid);
|
||||
int
|
||||
ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list,
|
||||
const u8 *mac, enum ice_sw_fwd_act_type action);
|
||||
enum ice_status
|
||||
int
|
||||
ice_fltr_add_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action);
|
||||
enum ice_status
|
||||
int
|
||||
ice_fltr_add_mac_and_broadcast(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action);
|
||||
enum ice_status
|
||||
ice_fltr_add_mac_list(struct ice_vsi *vsi, struct list_head *list);
|
||||
enum ice_status
|
||||
int ice_fltr_add_mac_list(struct ice_vsi *vsi, struct list_head *list);
|
||||
int
|
||||
ice_fltr_remove_mac(struct ice_vsi *vsi, const u8 *mac,
|
||||
enum ice_sw_fwd_act_type action);
|
||||
enum ice_status
|
||||
ice_fltr_remove_mac_list(struct ice_vsi *vsi, struct list_head *list);
|
||||
int ice_fltr_remove_mac_list(struct ice_vsi *vsi, struct list_head *list);
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_fltr_add_vlan(struct ice_vsi *vsi, u16 vid,
|
||||
enum ice_sw_fwd_act_type action);
|
||||
enum ice_status
|
||||
int
|
||||
ice_fltr_remove_vlan(struct ice_vsi *vsi, u16 vid,
|
||||
enum ice_sw_fwd_act_type action);
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_fltr_add_eth(struct ice_vsi *vsi, u16 ethertype, u16 flag,
|
||||
enum ice_sw_fwd_act_type action);
|
||||
enum ice_status
|
||||
int
|
||||
ice_fltr_remove_eth(struct ice_vsi *vsi, u16 ethertype, u16 flag,
|
||||
enum ice_sw_fwd_act_type action);
|
||||
void ice_fltr_remove_all(struct ice_vsi *vsi);
|
||||
enum ice_status
|
||||
|
||||
int
|
||||
ice_fltr_update_flags(struct ice_vsi *vsi, u16 rule_id, u16 recipe_id,
|
||||
u32 new_flags);
|
||||
int
|
||||
ice_fltr_update_flags_dflt_rule(struct ice_vsi *vsi, u16 rule_id, u8 direction,
|
||||
u32 new_flags);
|
||||
#endif
|
||||
|
@ -40,8 +40,8 @@ ice_send_package_data(struct pldmfw *context, const u8 *data, u16 length)
|
||||
struct device *dev = context->dev;
|
||||
struct ice_pf *pf = priv->pf;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
u8 *package_data;
|
||||
int status;
|
||||
|
||||
dev_dbg(dev, "Sending PLDM record package data to firmware\n");
|
||||
|
||||
@ -54,9 +54,8 @@ ice_send_package_data(struct pldmfw *context, const u8 *data, u16 length)
|
||||
kfree(package_data);
|
||||
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to send record package data to firmware, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
dev_err(dev, "Failed to send record package data to firmware, err %d aq_err %s\n",
|
||||
status, ice_aq_str(hw->adminq.sq_last_status));
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to record package data to firmware");
|
||||
return -EIO;
|
||||
}
|
||||
@ -203,8 +202,8 @@ ice_send_component_table(struct pldmfw *context, struct pldmfw_component *compon
|
||||
struct device *dev = context->dev;
|
||||
struct ice_pf *pf = priv->pf;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
size_t length;
|
||||
int status;
|
||||
|
||||
switch (component->identifier) {
|
||||
case NVM_COMP_ID_OROM:
|
||||
@ -240,9 +239,8 @@ ice_send_component_table(struct pldmfw *context, struct pldmfw_component *compon
|
||||
kfree(comp_tbl);
|
||||
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to transfer component table to firmware, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
dev_err(dev, "Failed to transfer component table to firmware, err %d aq_err %s\n",
|
||||
status, ice_aq_str(hw->adminq.sq_last_status));
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to transfer component table to firmware");
|
||||
return -EIO;
|
||||
}
|
||||
@ -277,7 +275,6 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_rq_event_info event;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
u32 completion_offset;
|
||||
int err;
|
||||
|
||||
@ -286,11 +283,11 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
|
||||
dev_dbg(dev, "Writing block of %u bytes for module 0x%02x at offset %u\n",
|
||||
block_size, module, offset);
|
||||
|
||||
status = ice_aq_update_nvm(hw, module, offset, block_size, block,
|
||||
last_cmd, 0, NULL);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to flash module 0x%02x with block of size %u at offset %u, err %s aq_err %s\n",
|
||||
module, block_size, offset, ice_stat_str(status),
|
||||
err = ice_aq_update_nvm(hw, module, offset, block_size, block,
|
||||
last_cmd, 0, NULL);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to flash module 0x%02x with block of size %u at offset %u, err %d aq_err %s\n",
|
||||
module, block_size, offset, err,
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to program flash module");
|
||||
return -EIO;
|
||||
@ -445,7 +442,6 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component,
|
||||
struct ice_rq_event_info event;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
struct devlink *devlink;
|
||||
enum ice_status status;
|
||||
int err;
|
||||
|
||||
dev_dbg(dev, "Beginning erase of flash component '%s', module 0x%02x\n", component, module);
|
||||
@ -456,10 +452,10 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component,
|
||||
|
||||
devlink_flash_update_timeout_notify(devlink, "Erasing", component, ICE_FW_ERASE_TIMEOUT);
|
||||
|
||||
status = ice_aq_erase_nvm(hw, module, NULL);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to erase %s (module 0x%02x), err %s aq_err %s\n",
|
||||
component, module, ice_stat_str(status),
|
||||
err = ice_aq_erase_nvm(hw, module, NULL);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to erase %s (module 0x%02x), err %d aq_err %s\n",
|
||||
component, module, err,
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to erase flash module");
|
||||
err = -EIO;
|
||||
@ -524,17 +520,15 @@ static int ice_switch_flash_banks(struct ice_pf *pf, u8 activate_flags,
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_rq_event_info event;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
u16 completion_retval;
|
||||
int err;
|
||||
|
||||
memset(&event, 0, sizeof(event));
|
||||
|
||||
status = ice_nvm_write_activate(hw, activate_flags);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to switch active flash banks, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = ice_nvm_write_activate(hw, activate_flags);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to switch active flash banks, err %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to switch active flash banks");
|
||||
return -EIO;
|
||||
}
|
||||
@ -670,7 +664,6 @@ int ice_flash_pldm_image(struct ice_pf *pf, const struct firmware *fw,
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
struct ice_fwu_priv priv;
|
||||
enum ice_status status;
|
||||
int err;
|
||||
|
||||
switch (preservation) {
|
||||
@ -692,13 +685,12 @@ int ice_flash_pldm_image(struct ice_pf *pf, const struct firmware *fw,
|
||||
priv.pf = pf;
|
||||
priv.activate_flags = preservation;
|
||||
|
||||
status = ice_acquire_nvm(hw, ICE_RES_WRITE);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to acquire device flash lock, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = ice_acquire_nvm(hw, ICE_RES_WRITE);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to acquire device flash lock, err %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to acquire device flash lock");
|
||||
return -EIO;
|
||||
return err;
|
||||
}
|
||||
|
||||
err = pldmfw_flash_image(&priv.context, fw);
|
||||
@ -736,7 +728,6 @@ int ice_check_for_pending_update(struct ice_pf *pf, const char *component,
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_hw_dev_caps *dev_caps;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
u8 pending = 0;
|
||||
int err;
|
||||
|
||||
@ -749,11 +740,11 @@ int ice_check_for_pending_update(struct ice_pf *pf, const char *component,
|
||||
* may have changed, e.g. if an update was previously completed and
|
||||
* the system has not yet rebooted.
|
||||
*/
|
||||
status = ice_discover_dev_caps(hw, dev_caps);
|
||||
if (status) {
|
||||
err = ice_discover_dev_caps(hw, dev_caps);
|
||||
if (err) {
|
||||
NL_SET_ERR_MSG_MOD(extack, "Unable to read device capabilities");
|
||||
kfree(dev_caps);
|
||||
return -EIO;
|
||||
return err;
|
||||
}
|
||||
|
||||
if (dev_caps->common_cap.nvm_update_pending_nvm) {
|
||||
@ -798,13 +789,12 @@ int ice_check_for_pending_update(struct ice_pf *pf, const char *component,
|
||||
"Canceling previous pending update",
|
||||
component, 0, 0);
|
||||
|
||||
status = ice_acquire_nvm(hw, ICE_RES_WRITE);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to acquire device flash lock, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
err = ice_acquire_nvm(hw, ICE_RES_WRITE);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to acquire device flash lock, err %d aq_err %s\n",
|
||||
err, ice_aq_str(hw->adminq.sq_last_status));
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to acquire device flash lock");
|
||||
return -EIO;
|
||||
return err;
|
||||
}
|
||||
|
||||
pending |= ICE_AQC_NVM_REVERT_LAST_ACTIV;
|
||||
|
@ -291,7 +291,7 @@ void ice_vsi_delete(struct ice_vsi *vsi)
|
||||
{
|
||||
struct ice_pf *pf = vsi->back;
|
||||
struct ice_vsi_ctx *ctxt;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
|
||||
if (!ctxt)
|
||||
@ -305,8 +305,8 @@ void ice_vsi_delete(struct ice_vsi *vsi)
|
||||
|
||||
status = ice_free_vsi(&pf->hw, vsi->idx, ctxt, false, NULL);
|
||||
if (status)
|
||||
dev_err(ice_pf_to_dev(pf), "Failed to delete VSI %i in FW - error: %s\n",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
dev_err(ice_pf_to_dev(pf), "Failed to delete VSI %i in FW - error: %d\n",
|
||||
vsi->vsi_num, status);
|
||||
|
||||
kfree(ctxt);
|
||||
}
|
||||
@ -709,15 +709,15 @@ bool ice_is_aux_ena(struct ice_pf *pf)
|
||||
static void ice_vsi_clean_rss_flow_fld(struct ice_vsi *vsi)
|
||||
{
|
||||
struct ice_pf *pf = vsi->back;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (ice_is_safe_mode(pf))
|
||||
return;
|
||||
|
||||
status = ice_rem_vsi_rss_cfg(&pf->hw, vsi->idx);
|
||||
if (status)
|
||||
dev_dbg(ice_pf_to_dev(pf), "ice_rem_vsi_rss_cfg failed for vsi = %d, error = %s\n",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
dev_dbg(ice_pf_to_dev(pf), "ice_rem_vsi_rss_cfg failed for vsi = %d, error = %d\n",
|
||||
vsi->vsi_num, status);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1545,8 +1545,8 @@ ice_vsi_cfg_rss_exit:
|
||||
static void ice_vsi_set_vf_rss_flow_fld(struct ice_vsi *vsi)
|
||||
{
|
||||
struct ice_pf *pf = vsi->back;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int status;
|
||||
|
||||
dev = ice_pf_to_dev(pf);
|
||||
if (ice_is_safe_mode(pf)) {
|
||||
@ -1557,8 +1557,8 @@ static void ice_vsi_set_vf_rss_flow_fld(struct ice_vsi *vsi)
|
||||
|
||||
status = ice_add_avf_rss_cfg(&pf->hw, vsi->idx, ICE_DEFAULT_RSS_HENA);
|
||||
if (status)
|
||||
dev_dbg(dev, "ice_add_avf_rss_cfg failed for vsi = %d, error = %s\n",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
dev_dbg(dev, "ice_add_avf_rss_cfg failed for vsi = %d, error = %d\n",
|
||||
vsi->vsi_num, status);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1577,8 +1577,8 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi)
|
||||
u16 vsi_handle = vsi->idx, vsi_num = vsi->vsi_num;
|
||||
struct ice_pf *pf = vsi->back;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int status;
|
||||
|
||||
dev = ice_pf_to_dev(pf);
|
||||
if (ice_is_safe_mode(pf)) {
|
||||
@ -1590,57 +1590,57 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi)
|
||||
status = ice_add_rss_cfg(hw, vsi_handle, ICE_FLOW_HASH_IPV4,
|
||||
ICE_FLOW_SEG_HDR_IPV4);
|
||||
if (status)
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for ipv4 flow, vsi = %d, error = %s\n",
|
||||
vsi_num, ice_stat_str(status));
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for ipv4 flow, vsi = %d, error = %d\n",
|
||||
vsi_num, status);
|
||||
|
||||
/* configure RSS for IPv6 with input set IPv6 src/dst */
|
||||
status = ice_add_rss_cfg(hw, vsi_handle, ICE_FLOW_HASH_IPV6,
|
||||
ICE_FLOW_SEG_HDR_IPV6);
|
||||
if (status)
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for ipv6 flow, vsi = %d, error = %s\n",
|
||||
vsi_num, ice_stat_str(status));
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for ipv6 flow, vsi = %d, error = %d\n",
|
||||
vsi_num, status);
|
||||
|
||||
/* configure RSS for tcp4 with input set IP src/dst, TCP src/dst */
|
||||
status = ice_add_rss_cfg(hw, vsi_handle, ICE_HASH_TCP_IPV4,
|
||||
ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4);
|
||||
if (status)
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for tcp4 flow, vsi = %d, error = %s\n",
|
||||
vsi_num, ice_stat_str(status));
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for tcp4 flow, vsi = %d, error = %d\n",
|
||||
vsi_num, status);
|
||||
|
||||
/* configure RSS for udp4 with input set IP src/dst, UDP src/dst */
|
||||
status = ice_add_rss_cfg(hw, vsi_handle, ICE_HASH_UDP_IPV4,
|
||||
ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4);
|
||||
if (status)
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for udp4 flow, vsi = %d, error = %s\n",
|
||||
vsi_num, ice_stat_str(status));
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for udp4 flow, vsi = %d, error = %d\n",
|
||||
vsi_num, status);
|
||||
|
||||
/* configure RSS for sctp4 with input set IP src/dst */
|
||||
status = ice_add_rss_cfg(hw, vsi_handle, ICE_FLOW_HASH_IPV4,
|
||||
ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4);
|
||||
if (status)
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for sctp4 flow, vsi = %d, error = %s\n",
|
||||
vsi_num, ice_stat_str(status));
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for sctp4 flow, vsi = %d, error = %d\n",
|
||||
vsi_num, status);
|
||||
|
||||
/* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */
|
||||
status = ice_add_rss_cfg(hw, vsi_handle, ICE_HASH_TCP_IPV6,
|
||||
ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6);
|
||||
if (status)
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for tcp6 flow, vsi = %d, error = %s\n",
|
||||
vsi_num, ice_stat_str(status));
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for tcp6 flow, vsi = %d, error = %d\n",
|
||||
vsi_num, status);
|
||||
|
||||
/* configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst */
|
||||
status = ice_add_rss_cfg(hw, vsi_handle, ICE_HASH_UDP_IPV6,
|
||||
ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6);
|
||||
if (status)
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for udp6 flow, vsi = %d, error = %s\n",
|
||||
vsi_num, ice_stat_str(status));
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for udp6 flow, vsi = %d, error = %d\n",
|
||||
vsi_num, status);
|
||||
|
||||
/* configure RSS for sctp6 with input set IPv6 src/dst */
|
||||
status = ice_add_rss_cfg(hw, vsi_handle, ICE_FLOW_HASH_IPV6,
|
||||
ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6);
|
||||
if (status)
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for sctp6 flow, vsi = %d, error = %s\n",
|
||||
vsi_num, ice_stat_str(status));
|
||||
dev_dbg(dev, "ice_add_rss_cfg failed for sctp6 flow, vsi = %d, error = %d\n",
|
||||
vsi_num, status);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1749,22 +1749,21 @@ ice_vsi_add_vlan(struct ice_vsi *vsi, u16 vid, enum ice_sw_fwd_act_type action)
|
||||
int ice_vsi_kill_vlan(struct ice_vsi *vsi, u16 vid)
|
||||
{
|
||||
struct ice_pf *pf = vsi->back;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int err = 0;
|
||||
int err;
|
||||
|
||||
dev = ice_pf_to_dev(pf);
|
||||
|
||||
status = ice_fltr_remove_vlan(vsi, vid, ICE_FWD_TO_VSI);
|
||||
if (!status) {
|
||||
err = ice_fltr_remove_vlan(vsi, vid, ICE_FWD_TO_VSI);
|
||||
if (!err) {
|
||||
vsi->num_vlan--;
|
||||
} else if (status == ICE_ERR_DOES_NOT_EXIST) {
|
||||
dev_dbg(dev, "Failed to remove VLAN %d on VSI %i, it does not exist, status: %s\n",
|
||||
vid, vsi->vsi_num, ice_stat_str(status));
|
||||
} else if (err == -ENOENT) {
|
||||
dev_dbg(dev, "Failed to remove VLAN %d on VSI %i, it does not exist, error: %d\n",
|
||||
vid, vsi->vsi_num, err);
|
||||
err = 0;
|
||||
} else {
|
||||
dev_err(dev, "Error removing VLAN %d on vsi %i error: %s\n",
|
||||
vid, vsi->vsi_num, ice_stat_str(status));
|
||||
err = -EIO;
|
||||
dev_err(dev, "Error removing VLAN %d on vsi %i error: %d\n",
|
||||
vid, vsi->vsi_num, err);
|
||||
}
|
||||
|
||||
return err;
|
||||
@ -2105,8 +2104,7 @@ int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi)
|
||||
{
|
||||
struct ice_hw *hw = &vsi->back->hw;
|
||||
struct ice_vsi_ctx *ctxt;
|
||||
enum ice_status status;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
|
||||
if (!ctxt)
|
||||
@ -2124,12 +2122,10 @@ int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi)
|
||||
|
||||
ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);
|
||||
|
||||
status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
|
||||
if (status) {
|
||||
dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN insert failed, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
ret = -EIO;
|
||||
ret = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
|
||||
if (ret) {
|
||||
dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN insert failed, err %d aq_err %s\n",
|
||||
ret, ice_aq_str(hw->adminq.sq_last_status));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2148,8 +2144,7 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
|
||||
{
|
||||
struct ice_hw *hw = &vsi->back->hw;
|
||||
struct ice_vsi_ctx *ctxt;
|
||||
enum ice_status status;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
/* do not allow modifying VLAN stripping when a port VLAN is configured
|
||||
* on this VSI
|
||||
@ -2177,12 +2172,10 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
|
||||
|
||||
ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);
|
||||
|
||||
status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
|
||||
if (status) {
|
||||
dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN strip failed, ena = %d err %s aq_err %s\n",
|
||||
ena, ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
ret = -EIO;
|
||||
ret = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
|
||||
if (ret) {
|
||||
dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN strip failed, ena = %d err %d aq_err %s\n",
|
||||
ena, ret, ice_aq_str(hw->adminq.sq_last_status));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2324,10 +2317,9 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena)
|
||||
|
||||
status = ice_update_vsi(&pf->hw, vsi->idx, ctxt, NULL);
|
||||
if (status) {
|
||||
netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %s, aq_err = %s\n",
|
||||
netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %d, aq_err = %s\n",
|
||||
ena ? "En" : "Dis", vsi->idx, vsi->vsi_num,
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(pf->hw.adminq.sq_last_status));
|
||||
status, ice_aq_str(pf->hw.adminq.sq_last_status));
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
@ -2405,11 +2397,11 @@ clear_reg_idx:
|
||||
*/
|
||||
void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create)
|
||||
{
|
||||
enum ice_status (*eth_fltr)(struct ice_vsi *v, u16 type, u16 flag,
|
||||
enum ice_sw_fwd_act_type act);
|
||||
int (*eth_fltr)(struct ice_vsi *v, u16 type, u16 flag,
|
||||
enum ice_sw_fwd_act_type act);
|
||||
struct ice_pf *pf = vsi->back;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int status;
|
||||
|
||||
dev = ice_pf_to_dev(pf);
|
||||
eth_fltr = create ? ice_fltr_add_eth : ice_fltr_remove_eth;
|
||||
@ -2428,9 +2420,9 @@ void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create)
|
||||
}
|
||||
|
||||
if (status)
|
||||
dev_dbg(dev, "Fail %s %s LLDP rule on VSI %i error: %s\n",
|
||||
dev_dbg(dev, "Fail %s %s LLDP rule on VSI %i error: %d\n",
|
||||
create ? "adding" : "removing", tx ? "TX" : "RX",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
vsi->vsi_num, status);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2450,7 +2442,7 @@ static void ice_set_agg_vsi(struct ice_vsi *vsi)
|
||||
struct ice_port_info *port_info;
|
||||
struct ice_pf *pf = vsi->back;
|
||||
u32 agg_node_id_start = 0;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
/* create (as needed) scheduler aggregator node and move VSI into
|
||||
* corresponding aggregator node
|
||||
@ -2576,7 +2568,6 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
|
||||
{
|
||||
u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
enum ice_status status;
|
||||
struct ice_vsi *vsi;
|
||||
int ret, i;
|
||||
|
||||
@ -2725,11 +2716,11 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
|
||||
}
|
||||
|
||||
dev_dbg(dev, "vsi->tc_cfg.ena_tc = %d\n", vsi->tc_cfg.ena_tc);
|
||||
status = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, vsi->tc_cfg.ena_tc,
|
||||
max_txqs);
|
||||
if (status) {
|
||||
dev_err(dev, "VSI %d failed lan queue config, error %s\n",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, vsi->tc_cfg.ena_tc,
|
||||
max_txqs);
|
||||
if (ret) {
|
||||
dev_err(dev, "VSI %d failed lan queue config, error %d\n",
|
||||
vsi->vsi_num, ret);
|
||||
goto unroll_clear_rings;
|
||||
}
|
||||
|
||||
@ -3036,8 +3027,8 @@ void ice_napi_del(struct ice_vsi *vsi)
|
||||
*/
|
||||
int ice_vsi_release(struct ice_vsi *vsi)
|
||||
{
|
||||
enum ice_status err;
|
||||
struct ice_pf *pf;
|
||||
int err;
|
||||
|
||||
if (!vsi->back)
|
||||
return -ENODEV;
|
||||
@ -3273,7 +3264,6 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
|
||||
int prev_num_q_vectors = 0;
|
||||
struct ice_vf *vf = NULL;
|
||||
enum ice_vsi_type vtype;
|
||||
enum ice_status status;
|
||||
struct ice_pf *pf;
|
||||
int ret, i;
|
||||
|
||||
@ -3421,14 +3411,14 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
|
||||
/* If MQPRIO is set, means channel code path, hence for main
|
||||
* VSI's, use TC as 1
|
||||
*/
|
||||
status = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, 1, max_txqs);
|
||||
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, 1, max_txqs);
|
||||
else
|
||||
status = ice_cfg_vsi_lan(vsi->port_info, vsi->idx,
|
||||
vsi->tc_cfg.ena_tc, max_txqs);
|
||||
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx,
|
||||
vsi->tc_cfg.ena_tc, max_txqs);
|
||||
|
||||
if (status) {
|
||||
dev_err(ice_pf_to_dev(pf), "VSI %d failed lan queue config, error %s\n",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
if (ret) {
|
||||
dev_err(ice_pf_to_dev(pf), "VSI %d failed lan queue config, error %d\n",
|
||||
vsi->vsi_num, ret);
|
||||
if (init_vsi) {
|
||||
ret = -EIO;
|
||||
goto err_vectors;
|
||||
@ -3663,7 +3653,6 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
|
||||
u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
|
||||
struct ice_pf *pf = vsi->back;
|
||||
struct ice_vsi_ctx *ctx;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int i, ret = 0;
|
||||
u8 num_tc = 0;
|
||||
@ -3705,25 +3694,22 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
|
||||
|
||||
/* must to indicate which section of VSI context are being modified */
|
||||
ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);
|
||||
status = ice_update_vsi(&pf->hw, vsi->idx, ctx, NULL);
|
||||
if (status) {
|
||||
ret = ice_update_vsi(&pf->hw, vsi->idx, ctx, NULL);
|
||||
if (ret) {
|
||||
dev_info(dev, "Failed VSI Update\n");
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (vsi->type == ICE_VSI_PF &&
|
||||
test_bit(ICE_FLAG_TC_MQPRIO, pf->flags))
|
||||
status = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, 1,
|
||||
max_txqs);
|
||||
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, 1, max_txqs);
|
||||
else
|
||||
status = ice_cfg_vsi_lan(vsi->port_info, vsi->idx,
|
||||
vsi->tc_cfg.ena_tc, max_txqs);
|
||||
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx,
|
||||
vsi->tc_cfg.ena_tc, max_txqs);
|
||||
|
||||
if (status) {
|
||||
dev_err(dev, "VSI %d failed TC config, error %s\n",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
ret = -EIO;
|
||||
if (ret) {
|
||||
dev_err(dev, "VSI %d failed TC config, error %d\n",
|
||||
vsi->vsi_num, ret);
|
||||
goto out;
|
||||
}
|
||||
ice_vsi_update_q_map(vsi, ctx);
|
||||
@ -3775,39 +3761,6 @@ void ice_update_rx_ring_stats(struct ice_rx_ring *rx_ring, u64 pkts, u64 bytes)
|
||||
u64_stats_update_end(&rx_ring->syncp);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_status_to_errno - convert from enum ice_status to Linux errno
|
||||
* @err: ice_status value to convert
|
||||
*/
|
||||
int ice_status_to_errno(enum ice_status err)
|
||||
{
|
||||
switch (err) {
|
||||
case ICE_SUCCESS:
|
||||
return 0;
|
||||
case ICE_ERR_DOES_NOT_EXIST:
|
||||
return -ENOENT;
|
||||
case ICE_ERR_OUT_OF_RANGE:
|
||||
case ICE_ERR_AQ_ERROR:
|
||||
case ICE_ERR_AQ_TIMEOUT:
|
||||
case ICE_ERR_AQ_EMPTY:
|
||||
case ICE_ERR_AQ_FW_CRITICAL:
|
||||
return -EIO;
|
||||
case ICE_ERR_PARAM:
|
||||
case ICE_ERR_INVAL_SIZE:
|
||||
return -EINVAL;
|
||||
case ICE_ERR_NO_MEMORY:
|
||||
return -ENOMEM;
|
||||
case ICE_ERR_MAX_LIMIT:
|
||||
return -EAGAIN;
|
||||
case ICE_ERR_RESET_ONGOING:
|
||||
return -EBUSY;
|
||||
case ICE_ERR_AQ_FULL:
|
||||
return -ENOSPC;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_is_dflt_vsi_in_use - check if the default forwarding VSI is being used
|
||||
* @sw: switch to check if its default forwarding VSI is free
|
||||
@ -3849,8 +3802,8 @@ bool ice_is_vsi_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi)
|
||||
*/
|
||||
int ice_set_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi)
|
||||
{
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int status;
|
||||
|
||||
if (!sw || !vsi)
|
||||
return -EINVAL;
|
||||
@ -3873,9 +3826,9 @@ int ice_set_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi)
|
||||
|
||||
status = ice_cfg_dflt_vsi(&vsi->back->hw, vsi->idx, true, ICE_FLTR_RX);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to set VSI %d as the default forwarding VSI, error %s\n",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
return -EIO;
|
||||
dev_err(dev, "Failed to set VSI %d as the default forwarding VSI, error %d\n",
|
||||
vsi->vsi_num, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
sw->dflt_vsi = vsi;
|
||||
@ -3895,8 +3848,8 @@ int ice_set_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi)
|
||||
int ice_clear_dflt_vsi(struct ice_sw *sw)
|
||||
{
|
||||
struct ice_vsi *dflt_vsi;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int status;
|
||||
|
||||
if (!sw)
|
||||
return -EINVAL;
|
||||
@ -3912,8 +3865,8 @@ int ice_clear_dflt_vsi(struct ice_sw *sw)
|
||||
status = ice_cfg_dflt_vsi(&dflt_vsi->back->hw, dflt_vsi->idx, false,
|
||||
ICE_FLTR_RX);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to clear the default forwarding VSI %d, error %s\n",
|
||||
dflt_vsi->vsi_num, ice_stat_str(status));
|
||||
dev_err(dev, "Failed to clear the default forwarding VSI %d, error %d\n",
|
||||
dflt_vsi->vsi_num, status);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@ -3987,8 +3940,8 @@ int ice_get_link_speed_kbps(struct ice_vsi *vsi)
|
||||
int ice_set_min_bw_limit(struct ice_vsi *vsi, u64 min_tx_rate)
|
||||
{
|
||||
struct ice_pf *pf = vsi->back;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int status;
|
||||
int speed;
|
||||
|
||||
dev = ice_pf_to_dev(pf);
|
||||
@ -4014,7 +3967,7 @@ int ice_set_min_bw_limit(struct ice_vsi *vsi, u64 min_tx_rate)
|
||||
dev_err(dev, "failed to set min Tx rate(%llu Kbps) for %s %d\n",
|
||||
min_tx_rate, ice_vsi_type_str(vsi->type),
|
||||
vsi->idx);
|
||||
return -EIO;
|
||||
return status;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "set min Tx rate(%llu Kbps) for %s\n",
|
||||
@ -4026,7 +3979,7 @@ int ice_set_min_bw_limit(struct ice_vsi *vsi, u64 min_tx_rate)
|
||||
if (status) {
|
||||
dev_err(dev, "failed to clear min Tx rate configuration for %s %d\n",
|
||||
ice_vsi_type_str(vsi->type), vsi->idx);
|
||||
return -EIO;
|
||||
return status;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "cleared min Tx rate configuration for %s %d\n",
|
||||
@ -4048,8 +4001,8 @@ int ice_set_min_bw_limit(struct ice_vsi *vsi, u64 min_tx_rate)
|
||||
int ice_set_max_bw_limit(struct ice_vsi *vsi, u64 max_tx_rate)
|
||||
{
|
||||
struct ice_pf *pf = vsi->back;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int status;
|
||||
int speed;
|
||||
|
||||
dev = ice_pf_to_dev(pf);
|
||||
@ -4075,7 +4028,7 @@ int ice_set_max_bw_limit(struct ice_vsi *vsi, u64 max_tx_rate)
|
||||
dev_err(dev, "failed setting max Tx rate(%llu Kbps) for %s %d\n",
|
||||
max_tx_rate, ice_vsi_type_str(vsi->type),
|
||||
vsi->idx);
|
||||
return -EIO;
|
||||
return status;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "set max Tx rate(%llu Kbps) for %s %d\n",
|
||||
@ -4087,7 +4040,7 @@ int ice_set_max_bw_limit(struct ice_vsi *vsi, u64 max_tx_rate)
|
||||
if (status) {
|
||||
dev_err(dev, "failed clearing max Tx rate configuration for %s %d\n",
|
||||
ice_vsi_type_str(vsi->type), vsi->idx);
|
||||
return -EIO;
|
||||
return status;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "cleared max Tx rate configuration for %s %d\n",
|
||||
@ -4107,7 +4060,7 @@ int ice_set_link(struct ice_vsi *vsi, bool ena)
|
||||
struct device *dev = ice_pf_to_dev(vsi->back);
|
||||
struct ice_port_info *pi = vsi->port_info;
|
||||
struct ice_hw *hw = pi->hw;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (vsi->type != ICE_VSI_PF)
|
||||
return -EINVAL;
|
||||
@ -4119,16 +4072,16 @@ int ice_set_link(struct ice_vsi *vsi, bool ena)
|
||||
* a success code. Return an error if FW returns an error code other
|
||||
* than ICE_AQ_RC_EMODE
|
||||
*/
|
||||
if (status == ICE_ERR_AQ_ERROR) {
|
||||
if (status == -EIO) {
|
||||
if (hw->adminq.sq_last_status == ICE_AQ_RC_EMODE)
|
||||
dev_warn(dev, "can't set link to %s, err %s aq_err %s. not fatal, continuing\n",
|
||||
(ena ? "ON" : "OFF"), ice_stat_str(status),
|
||||
dev_warn(dev, "can't set link to %s, err %d aq_err %s. not fatal, continuing\n",
|
||||
(ena ? "ON" : "OFF"), status,
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
} else if (status) {
|
||||
dev_err(dev, "can't set link to %s, err %s aq_err %s\n",
|
||||
(ena ? "ON" : "OFF"), ice_stat_str(status),
|
||||
dev_err(dev, "can't set link to %s, err %d aq_err %s\n",
|
||||
(ena ? "ON" : "OFF"), status,
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
return -EIO;
|
||||
return status;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -103,15 +103,11 @@ 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_vsi_cfg_frame_size(struct ice_vsi *vsi);
|
||||
|
||||
int ice_status_to_errno(enum ice_status err);
|
||||
|
||||
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_set_q_vector_intrl(struct ice_q_vector *q_vector);
|
||||
|
||||
enum ice_status
|
||||
ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set);
|
||||
int ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set);
|
||||
|
||||
bool ice_is_safe_mode(struct ice_pf *pf);
|
||||
bool ice_is_aux_ena(struct ice_pf *pf);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@
|
||||
*
|
||||
* Read the NVM using the admin queue commands (0x0701)
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length,
|
||||
void *data, bool last_command, bool read_shadow_ram,
|
||||
struct ice_sq_cd *cd)
|
||||
@ -27,7 +27,7 @@ ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length,
|
||||
cmd = &desc.params.nvm;
|
||||
|
||||
if (offset > ICE_AQC_NVM_MAX_OFFSET)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_nvm_read);
|
||||
|
||||
@ -60,21 +60,21 @@ ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length,
|
||||
* Returns a status code on failure. Note that the data pointer may be
|
||||
* partially updated if some reads succeed before a failure.
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,
|
||||
bool read_shadow_ram)
|
||||
{
|
||||
enum ice_status status;
|
||||
u32 inlen = *length;
|
||||
u32 bytes_read = 0;
|
||||
bool last_cmd;
|
||||
int status;
|
||||
|
||||
*length = 0;
|
||||
|
||||
/* Verify the length of the read if this is for the Shadow RAM */
|
||||
if (read_shadow_ram && ((offset + inlen) > (hw->flash.sr_words * 2u))) {
|
||||
ice_debug(hw, ICE_DBG_NVM, "NVM error: requested offset is beyond Shadow RAM limit\n");
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
do {
|
||||
@ -119,7 +119,7 @@ ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,
|
||||
*
|
||||
* Update the NVM using the admin queue commands (0x0703)
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_update_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset,
|
||||
u16 length, void *data, bool last_command, u8 command_flags,
|
||||
struct ice_sq_cd *cd)
|
||||
@ -131,7 +131,7 @@ ice_aq_update_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset,
|
||||
|
||||
/* In offset the highest byte must be zeroed. */
|
||||
if (offset & 0xFF000000)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_nvm_write);
|
||||
|
||||
@ -158,8 +158,7 @@ ice_aq_update_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset,
|
||||
*
|
||||
* Erase the NVM sector using the admin queue commands (0x0702)
|
||||
*/
|
||||
enum ice_status
|
||||
ice_aq_erase_nvm(struct ice_hw *hw, u16 module_typeid, struct ice_sq_cd *cd)
|
||||
int ice_aq_erase_nvm(struct ice_hw *hw, u16 module_typeid, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aq_desc desc;
|
||||
struct ice_aqc_nvm *cmd;
|
||||
@ -184,12 +183,11 @@ ice_aq_erase_nvm(struct ice_hw *hw, u16 module_typeid, struct ice_sq_cd *cd)
|
||||
*
|
||||
* Reads one 16 bit word from the Shadow RAM using ice_read_flat_nvm.
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data)
|
||||
static int ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data)
|
||||
{
|
||||
u32 bytes = sizeof(u16);
|
||||
enum ice_status status;
|
||||
__le16 data_local;
|
||||
int status;
|
||||
|
||||
/* Note that ice_read_flat_nvm takes into account the 4Kb AdminQ and
|
||||
* Shadow RAM sector restrictions necessary when reading from the NVM.
|
||||
@ -210,8 +208,7 @@ ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data)
|
||||
*
|
||||
* This function will request NVM ownership.
|
||||
*/
|
||||
enum ice_status
|
||||
ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access)
|
||||
int ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access)
|
||||
{
|
||||
if (hw->flash.blank_nvm_mode)
|
||||
return 0;
|
||||
@ -318,18 +315,18 @@ static u32 ice_get_flash_bank_offset(struct ice_hw *hw, enum ice_bank_select ban
|
||||
* hw->flash.banks data being setup by ice_determine_active_flash_banks()
|
||||
* during initialization.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_read_flash_module(struct ice_hw *hw, enum ice_bank_select bank, u16 module,
|
||||
u32 offset, u8 *data, u32 length)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
u32 start;
|
||||
|
||||
start = ice_get_flash_bank_offset(hw, bank, module);
|
||||
if (!start) {
|
||||
ice_debug(hw, ICE_DBG_NVM, "Unable to calculate flash bank offset for module 0x%04x\n",
|
||||
module);
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
status = ice_acquire_nvm(hw, ICE_RES_READ);
|
||||
@ -353,11 +350,11 @@ ice_read_flash_module(struct ice_hw *hw, enum ice_bank_select bank, u16 module,
|
||||
* Read the specified word from the active NVM module. This includes the CSS
|
||||
* header at the start of the NVM module.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_read_nvm_module(struct ice_hw *hw, enum ice_bank_select bank, u32 offset, u16 *data)
|
||||
{
|
||||
enum ice_status status;
|
||||
__le16 data_local;
|
||||
int status;
|
||||
|
||||
status = ice_read_flash_module(hw, bank, ICE_SR_1ST_NVM_BANK_PTR, offset * sizeof(u16),
|
||||
(__force u8 *)&data_local, sizeof(u16));
|
||||
@ -377,7 +374,7 @@ ice_read_nvm_module(struct ice_hw *hw, enum ice_bank_select bank, u32 offset, u1
|
||||
* Read the specified word from the copy of the Shadow RAM found in the
|
||||
* specified NVM module.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_read_nvm_sr_copy(struct ice_hw *hw, enum ice_bank_select bank, u32 offset, u16 *data)
|
||||
{
|
||||
return ice_read_nvm_module(hw, bank, ICE_NVM_SR_COPY_WORD_OFFSET + offset, data);
|
||||
@ -392,11 +389,11 @@ ice_read_nvm_sr_copy(struct ice_hw *hw, enum ice_bank_select bank, u32 offset, u
|
||||
*
|
||||
* Read a word from the specified netlist bank.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_read_netlist_module(struct ice_hw *hw, enum ice_bank_select bank, u32 offset, u16 *data)
|
||||
{
|
||||
enum ice_status status;
|
||||
__le16 data_local;
|
||||
int status;
|
||||
|
||||
status = ice_read_flash_module(hw, bank, ICE_SR_NETLIST_BANK_PTR, offset * sizeof(u16),
|
||||
(__force u8 *)&data_local, sizeof(u16));
|
||||
@ -414,9 +411,9 @@ ice_read_netlist_module(struct ice_hw *hw, enum ice_bank_select bank, u32 offset
|
||||
*
|
||||
* Reads one 16 bit word from the Shadow RAM using the ice_read_sr_word_aq.
|
||||
*/
|
||||
enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)
|
||||
int ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
status = ice_acquire_nvm(hw, ICE_RES_READ);
|
||||
if (!status) {
|
||||
@ -438,13 +435,13 @@ enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)
|
||||
* Area (PFA) and returns the TLV pointer and length. The caller can
|
||||
* use these to read the variable length TLV value.
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
|
||||
u16 module_type)
|
||||
{
|
||||
enum ice_status status;
|
||||
u16 pfa_len, pfa_ptr;
|
||||
u16 next_tlv;
|
||||
int status;
|
||||
|
||||
status = ice_read_sr_word(hw, ICE_SR_PFA_PTR, &pfa_ptr);
|
||||
if (status) {
|
||||
@ -482,7 +479,7 @@ ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
|
||||
*module_tlv_len = tlv_len;
|
||||
return 0;
|
||||
}
|
||||
return ICE_ERR_INVAL_SIZE;
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Check next TLV, i.e. current TLV pointer + length + 2 words
|
||||
* (for current TLV's type and length)
|
||||
@ -490,7 +487,7 @@ ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
|
||||
next_tlv = next_tlv + tlv_len + 2;
|
||||
}
|
||||
/* Module does not exist */
|
||||
return ICE_ERR_DOES_NOT_EXIST;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -501,12 +498,11 @@ ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
|
||||
*
|
||||
* Reads the part number string from the NVM.
|
||||
*/
|
||||
enum ice_status
|
||||
ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size)
|
||||
int ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size)
|
||||
{
|
||||
u16 pba_tlv, pba_tlv_len;
|
||||
enum ice_status status;
|
||||
u16 pba_word, pba_size;
|
||||
int status;
|
||||
u16 i;
|
||||
|
||||
status = ice_get_pfa_module_tlv(hw, &pba_tlv, &pba_tlv_len,
|
||||
@ -525,7 +521,7 @@ ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size)
|
||||
|
||||
if (pba_tlv_len < pba_size) {
|
||||
ice_debug(hw, ICE_DBG_INIT, "Invalid PBA Block TLV size.\n");
|
||||
return ICE_ERR_INVAL_SIZE;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Subtract one to get PBA word count (PBA Size word is included in
|
||||
@ -534,7 +530,7 @@ ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size)
|
||||
pba_size--;
|
||||
if (pba_num_size < (((u32)pba_size * 2) + 1)) {
|
||||
ice_debug(hw, ICE_DBG_INIT, "Buffer too small for PBA data.\n");
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < pba_size; i++) {
|
||||
@ -561,11 +557,11 @@ ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size)
|
||||
* Read the NVM EETRACK ID and map version of the main NVM image bank, filling
|
||||
* in the NVM info structure.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_get_nvm_ver_info(struct ice_hw *hw, enum ice_bank_select bank, struct ice_nvm_info *nvm)
|
||||
{
|
||||
u16 eetrack_lo, eetrack_hi, ver;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
status = ice_read_nvm_sr_copy(hw, bank, ICE_SR_NVM_DEV_STARTER_VER, &ver);
|
||||
if (status) {
|
||||
@ -601,7 +597,7 @@ ice_get_nvm_ver_info(struct ice_hw *hw, enum ice_bank_select bank, struct ice_nv
|
||||
* inactive NVM bank. Used to access version data for a pending update that
|
||||
* has not yet been activated.
|
||||
*/
|
||||
enum ice_status ice_get_inactive_nvm_ver(struct ice_hw *hw, struct ice_nvm_info *nvm)
|
||||
int ice_get_inactive_nvm_ver(struct ice_hw *hw, struct ice_nvm_info *nvm)
|
||||
{
|
||||
return ice_get_nvm_ver_info(hw, ICE_INACTIVE_FLASH_BANK, nvm);
|
||||
}
|
||||
@ -615,12 +611,12 @@ enum ice_status ice_get_inactive_nvm_ver(struct ice_hw *hw, struct ice_nvm_info
|
||||
* Searches through the Option ROM flash contents to locate the CIVD data for
|
||||
* the image.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
|
||||
struct ice_orom_civd_info *civd)
|
||||
{
|
||||
struct ice_orom_civd_info tmp;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
u32 offset;
|
||||
|
||||
/* The CIVD section is located in the Option ROM aligned to 512 bytes.
|
||||
@ -650,14 +646,14 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
|
||||
if (sum) {
|
||||
ice_debug(hw, ICE_DBG_NVM, "Found CIVD data with invalid checksum of %u\n",
|
||||
sum);
|
||||
return ICE_ERR_NVM;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
*civd = tmp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ICE_ERR_NVM;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -669,12 +665,12 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
|
||||
* Read Option ROM version and security revision from the Option ROM flash
|
||||
* section.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_get_orom_ver_info(struct ice_hw *hw, enum ice_bank_select bank, struct ice_orom_info *orom)
|
||||
{
|
||||
struct ice_orom_civd_info civd;
|
||||
enum ice_status status;
|
||||
u32 combo_ver;
|
||||
int status;
|
||||
|
||||
status = ice_get_orom_civd_data(hw, bank, &civd);
|
||||
if (status) {
|
||||
@ -700,7 +696,7 @@ ice_get_orom_ver_info(struct ice_hw *hw, enum ice_bank_select bank, struct ice_o
|
||||
* section of flash. Used to access version data for a pending update that has
|
||||
* not yet been activated.
|
||||
*/
|
||||
enum ice_status ice_get_inactive_orom_ver(struct ice_hw *hw, struct ice_orom_info *orom)
|
||||
int ice_get_inactive_orom_ver(struct ice_hw *hw, struct ice_orom_info *orom)
|
||||
{
|
||||
return ice_get_orom_ver_info(hw, ICE_INACTIVE_FLASH_BANK, orom);
|
||||
}
|
||||
@ -715,13 +711,13 @@ enum ice_status ice_get_inactive_orom_ver(struct ice_hw *hw, struct ice_orom_inf
|
||||
* Topology section to find the Netlist ID block and extract the relevant
|
||||
* information into the netlist version structure.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_get_netlist_info(struct ice_hw *hw, enum ice_bank_select bank,
|
||||
struct ice_netlist_info *netlist)
|
||||
{
|
||||
u16 module_id, length, node_count, i;
|
||||
enum ice_status status;
|
||||
u16 *id_blk;
|
||||
int status;
|
||||
|
||||
status = ice_read_netlist_module(hw, bank, ICE_NETLIST_TYPE_OFFSET, &module_id);
|
||||
if (status)
|
||||
@ -730,7 +726,7 @@ ice_get_netlist_info(struct ice_hw *hw, enum ice_bank_select bank,
|
||||
if (module_id != ICE_NETLIST_LINK_TOPO_MOD_ID) {
|
||||
ice_debug(hw, ICE_DBG_NVM, "Expected netlist module_id ID of 0x%04x, but got 0x%04x\n",
|
||||
ICE_NETLIST_LINK_TOPO_MOD_ID, module_id);
|
||||
return ICE_ERR_NVM;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
status = ice_read_netlist_module(hw, bank, ICE_LINK_TOPO_MODULE_LEN, &length);
|
||||
@ -741,7 +737,7 @@ ice_get_netlist_info(struct ice_hw *hw, enum ice_bank_select bank,
|
||||
if (length < ICE_NETLIST_ID_BLK_SIZE) {
|
||||
ice_debug(hw, ICE_DBG_NVM, "Netlist Link Topology module too small. Expected at least %u words, but got %u words.\n",
|
||||
ICE_NETLIST_ID_BLK_SIZE, length);
|
||||
return ICE_ERR_NVM;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
status = ice_read_netlist_module(hw, bank, ICE_LINK_TOPO_NODE_COUNT, &node_count);
|
||||
@ -751,7 +747,7 @@ ice_get_netlist_info(struct ice_hw *hw, enum ice_bank_select bank,
|
||||
|
||||
id_blk = kcalloc(ICE_NETLIST_ID_BLK_SIZE, sizeof(*id_blk), GFP_KERNEL);
|
||||
if (!id_blk)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
/* Read out the entire Netlist ID Block at once. */
|
||||
status = ice_read_flash_module(hw, bank, ICE_SR_NETLIST_BANK_PTR,
|
||||
@ -791,7 +787,7 @@ exit_error:
|
||||
* extract version data of a pending flash update in order to display the
|
||||
* version data.
|
||||
*/
|
||||
enum ice_status ice_get_inactive_netlist_ver(struct ice_hw *hw, struct ice_netlist_info *netlist)
|
||||
int ice_get_inactive_netlist_ver(struct ice_hw *hw, struct ice_netlist_info *netlist)
|
||||
{
|
||||
return ice_get_netlist_info(hw, ICE_INACTIVE_FLASH_BANK, netlist);
|
||||
}
|
||||
@ -804,10 +800,10 @@ enum ice_status ice_get_inactive_netlist_ver(struct ice_hw *hw, struct ice_netli
|
||||
* the actual size is smaller. Use bisection to determine the accessible size
|
||||
* of flash memory.
|
||||
*/
|
||||
static enum ice_status ice_discover_flash_size(struct ice_hw *hw)
|
||||
static int ice_discover_flash_size(struct ice_hw *hw)
|
||||
{
|
||||
u32 min_size = 0, max_size = ICE_AQC_NVM_MAX_OFFSET + 1;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
status = ice_acquire_nvm(hw, ICE_RES_READ);
|
||||
if (status)
|
||||
@ -819,7 +815,7 @@ static enum ice_status ice_discover_flash_size(struct ice_hw *hw)
|
||||
u8 data;
|
||||
|
||||
status = ice_read_flat_nvm(hw, offset, &len, &data, false);
|
||||
if (status == ICE_ERR_AQ_ERROR &&
|
||||
if (status == -EIO &&
|
||||
hw->adminq.sq_last_status == ICE_AQ_RC_EINVAL) {
|
||||
ice_debug(hw, ICE_DBG_NVM, "%s: New upper bound of %u bytes\n",
|
||||
__func__, offset);
|
||||
@ -859,10 +855,9 @@ err_read_flat_nvm:
|
||||
* sector size by using the highest bit. The reported pointer value will be in
|
||||
* bytes, intended for flat NVM reads.
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_read_sr_pointer(struct ice_hw *hw, u16 offset, u32 *pointer)
|
||||
static int ice_read_sr_pointer(struct ice_hw *hw, u16 offset, u32 *pointer)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
u16 value;
|
||||
|
||||
status = ice_read_sr_word(hw, offset, &value);
|
||||
@ -891,10 +886,9 @@ ice_read_sr_pointer(struct ice_hw *hw, u16 offset, u32 *pointer)
|
||||
* Each area size word is specified in 4KB sector units. This function reports
|
||||
* the size in bytes, intended for flat NVM reads.
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_read_sr_area_size(struct ice_hw *hw, u16 offset, u32 *size)
|
||||
static int ice_read_sr_area_size(struct ice_hw *hw, u16 offset, u32 *size)
|
||||
{
|
||||
enum ice_status status;
|
||||
int status;
|
||||
u16 value;
|
||||
|
||||
status = ice_read_sr_word(hw, offset, &value);
|
||||
@ -917,12 +911,11 @@ ice_read_sr_area_size(struct ice_hw *hw, u16 offset, u32 *size)
|
||||
* structure for later use in order to calculate the correct offset to read
|
||||
* from the active module.
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_determine_active_flash_banks(struct ice_hw *hw)
|
||||
static int ice_determine_active_flash_banks(struct ice_hw *hw)
|
||||
{
|
||||
struct ice_bank_info *banks = &hw->flash.banks;
|
||||
enum ice_status status;
|
||||
u16 ctrl_word;
|
||||
int status;
|
||||
|
||||
status = ice_read_sr_word(hw, ICE_SR_NVM_CTRL_WORD, &ctrl_word);
|
||||
if (status) {
|
||||
@ -933,7 +926,7 @@ ice_determine_active_flash_banks(struct ice_hw *hw)
|
||||
/* Check that the control word indicates validity */
|
||||
if ((ctrl_word & ICE_SR_CTRL_WORD_1_M) >> ICE_SR_CTRL_WORD_1_S != ICE_SR_CTRL_WORD_VALID) {
|
||||
ice_debug(hw, ICE_DBG_NVM, "Shadow RAM control word is invalid\n");
|
||||
return ICE_ERR_CFG;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (!(ctrl_word & ICE_SR_CTRL_WORD_NVM_BANK))
|
||||
@ -997,12 +990,12 @@ ice_determine_active_flash_banks(struct ice_hw *hw)
|
||||
* This function reads and populates NVM settings such as Shadow RAM size,
|
||||
* max_timeout, and blank_nvm_mode
|
||||
*/
|
||||
enum ice_status ice_init_nvm(struct ice_hw *hw)
|
||||
int ice_init_nvm(struct ice_hw *hw)
|
||||
{
|
||||
struct ice_flash_info *flash = &hw->flash;
|
||||
enum ice_status status;
|
||||
u32 fla, gens_stat;
|
||||
u8 sr_size;
|
||||
int status;
|
||||
|
||||
/* The SR size is stored regardless of the NVM programming mode
|
||||
* as the blank mode may be used in the factory line.
|
||||
@ -1021,7 +1014,7 @@ enum ice_status ice_init_nvm(struct ice_hw *hw)
|
||||
/* Blank programming mode */
|
||||
flash->blank_nvm_mode = true;
|
||||
ice_debug(hw, ICE_DBG_NVM, "NVM init error: unsupported blank mode.\n");
|
||||
return ICE_ERR_NVM_BLANK_MODE;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
status = ice_discover_flash_size(hw);
|
||||
@ -1060,11 +1053,11 @@ enum ice_status ice_init_nvm(struct ice_hw *hw)
|
||||
*
|
||||
* Verify NVM PFA checksum validity (0x0706)
|
||||
*/
|
||||
enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw)
|
||||
int ice_nvm_validate_checksum(struct ice_hw *hw)
|
||||
{
|
||||
struct ice_aqc_nvm_checksum *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
status = ice_acquire_nvm(hw, ICE_RES_READ);
|
||||
if (status)
|
||||
@ -1080,7 +1073,7 @@ enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw)
|
||||
|
||||
if (!status)
|
||||
if (le16_to_cpu(cmd->checksum) != ICE_AQC_NVM_CHECKSUM_CORRECT)
|
||||
status = ICE_ERR_NVM_CHECKSUM;
|
||||
status = -EIO;
|
||||
|
||||
return status;
|
||||
}
|
||||
@ -1093,7 +1086,7 @@ enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw)
|
||||
* Update the control word with the required banks' validity bits
|
||||
* and dumps the Shadow RAM to flash (0x0707)
|
||||
*/
|
||||
enum ice_status ice_nvm_write_activate(struct ice_hw *hw, u8 cmd_flags)
|
||||
int ice_nvm_write_activate(struct ice_hw *hw, u8 cmd_flags)
|
||||
{
|
||||
struct ice_aqc_nvm *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
@ -1113,7 +1106,7 @@ enum ice_status ice_nvm_write_activate(struct ice_hw *hw, u8 cmd_flags)
|
||||
* Update empr (0x0709). This command allows SW to
|
||||
* request an EMPR to activate new FW.
|
||||
*/
|
||||
enum ice_status ice_aq_nvm_update_empr(struct ice_hw *hw)
|
||||
int ice_aq_nvm_update_empr(struct ice_hw *hw)
|
||||
{
|
||||
struct ice_aq_desc desc;
|
||||
|
||||
@ -1136,7 +1129,7 @@ enum ice_status ice_aq_nvm_update_empr(struct ice_hw *hw)
|
||||
* as part of the NVM update as the first cmd in the flow.
|
||||
*/
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_nvm_set_pkg_data(struct ice_hw *hw, bool del_pkg_data_flag, u8 *data,
|
||||
u16 length, struct ice_sq_cd *cd)
|
||||
{
|
||||
@ -1144,7 +1137,7 @@ ice_nvm_set_pkg_data(struct ice_hw *hw, bool del_pkg_data_flag, u8 *data,
|
||||
struct ice_aq_desc desc;
|
||||
|
||||
if (length != 0 && !data)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
cmd = &desc.params.pkg_data;
|
||||
|
||||
@ -1173,17 +1166,17 @@ ice_nvm_set_pkg_data(struct ice_hw *hw, bool del_pkg_data_flag, u8 *data,
|
||||
* the TransferFlag is set to End or StartAndEnd.
|
||||
*/
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_nvm_pass_component_tbl(struct ice_hw *hw, u8 *data, u16 length,
|
||||
u8 transfer_flag, u8 *comp_response,
|
||||
u8 *comp_response_code, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_nvm_pass_comp_tbl *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (!data || !comp_response || !comp_response_code)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
cmd = &desc.params.pass_comp_tbl;
|
||||
|
||||
|
@ -12,38 +12,34 @@ struct ice_orom_civd_info {
|
||||
__le16 combo_name[32]; /* Unicode string representing the Combo Image version */
|
||||
} __packed;
|
||||
|
||||
enum ice_status
|
||||
ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access);
|
||||
int ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access);
|
||||
void ice_release_nvm(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,
|
||||
bool read_shadow_ram);
|
||||
enum ice_status
|
||||
int
|
||||
ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
|
||||
u16 module_type);
|
||||
enum ice_status
|
||||
ice_get_inactive_orom_ver(struct ice_hw *hw, struct ice_orom_info *orom);
|
||||
enum ice_status
|
||||
ice_get_inactive_nvm_ver(struct ice_hw *hw, struct ice_nvm_info *nvm);
|
||||
enum ice_status
|
||||
int ice_get_inactive_orom_ver(struct ice_hw *hw, struct ice_orom_info *orom);
|
||||
int ice_get_inactive_nvm_ver(struct ice_hw *hw, struct ice_nvm_info *nvm);
|
||||
int
|
||||
ice_get_inactive_netlist_ver(struct ice_hw *hw, struct ice_netlist_info *netlist);
|
||||
enum ice_status
|
||||
ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size);
|
||||
enum ice_status ice_init_nvm(struct ice_hw *hw);
|
||||
enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data);
|
||||
enum ice_status
|
||||
int ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size);
|
||||
int ice_init_nvm(struct ice_hw *hw);
|
||||
int ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data);
|
||||
int
|
||||
ice_aq_update_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset,
|
||||
u16 length, void *data, bool last_command, u8 command_flags,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_erase_nvm(struct ice_hw *hw, u16 module_typeid, struct ice_sq_cd *cd);
|
||||
enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw);
|
||||
enum ice_status ice_nvm_write_activate(struct ice_hw *hw, u8 cmd_flags);
|
||||
enum ice_status ice_aq_nvm_update_empr(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int ice_nvm_validate_checksum(struct ice_hw *hw);
|
||||
int ice_nvm_write_activate(struct ice_hw *hw, u8 cmd_flags);
|
||||
int ice_aq_nvm_update_empr(struct ice_hw *hw);
|
||||
int
|
||||
ice_nvm_set_pkg_data(struct ice_hw *hw, bool del_pkg_data_flag, u8 *data,
|
||||
u16 length, struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_nvm_pass_component_tbl(struct ice_hw *hw, u8 *data, u16 length,
|
||||
u8 transfer_flag, u8 *comp_response,
|
||||
u8 *comp_response_code, struct ice_sq_cd *cd);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -65,12 +65,12 @@ struct ice_sched_agg_info {
|
||||
};
|
||||
|
||||
/* FW AQ command calls */
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_txsched_elem_data *buf, u16 buf_size,
|
||||
u16 *elems_ret, struct ice_sq_cd *cd);
|
||||
enum ice_status ice_sched_init_port(struct ice_port_info *pi);
|
||||
enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw);
|
||||
int ice_sched_init_port(struct ice_port_info *pi);
|
||||
int ice_sched_query_res_alloc(struct ice_hw *hw);
|
||||
void ice_sched_get_psm_clk_freq(struct ice_hw *hw);
|
||||
|
||||
void ice_sched_clear_port(struct ice_port_info *pi);
|
||||
@ -79,7 +79,7 @@ void ice_sched_clear_agg(struct ice_hw *hw);
|
||||
|
||||
struct ice_sched_node *
|
||||
ice_sched_find_node_by_teid(struct ice_sched_node *start_node, u32 teid);
|
||||
enum ice_status
|
||||
int
|
||||
ice_sched_add_node(struct ice_port_info *pi, u8 layer,
|
||||
struct ice_aqc_txsched_elem_data *info);
|
||||
void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node);
|
||||
@ -87,35 +87,38 @@ struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc);
|
||||
struct ice_sched_node *
|
||||
ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
u8 owner);
|
||||
enum ice_status
|
||||
int
|
||||
ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,
|
||||
u8 owner, bool enable);
|
||||
enum ice_status ice_rm_vsi_lan_cfg(struct ice_port_info *pi, u16 vsi_handle);
|
||||
enum ice_status ice_rm_vsi_rdma_cfg(struct ice_port_info *pi, u16 vsi_handle);
|
||||
int ice_rm_vsi_lan_cfg(struct ice_port_info *pi, u16 vsi_handle);
|
||||
int ice_rm_vsi_rdma_cfg(struct ice_port_info *pi, u16 vsi_handle);
|
||||
|
||||
/* Tx scheduler rate limiter functions */
|
||||
enum ice_status
|
||||
int
|
||||
ice_cfg_agg(struct ice_port_info *pi, u32 agg_id,
|
||||
enum ice_agg_type agg_type, u8 tc_bitmap);
|
||||
enum ice_status
|
||||
int
|
||||
ice_move_vsi_to_agg(struct ice_port_info *pi, u32 agg_id, u16 vsi_handle,
|
||||
u8 tc_bitmap);
|
||||
enum ice_status
|
||||
int
|
||||
ice_cfg_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
u16 q_handle, enum ice_rl_type rl_type, u32 bw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_cfg_q_bw_dflt_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
u16 q_handle, enum ice_rl_type rl_type);
|
||||
enum ice_status
|
||||
int
|
||||
ice_cfg_vsi_bw_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
|
||||
enum ice_rl_type rl_type, u32 bw);
|
||||
enum ice_status
|
||||
int
|
||||
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_status ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes);
|
||||
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);
|
||||
void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw);
|
||||
void ice_sched_replay_agg(struct ice_hw *hw);
|
||||
enum ice_status ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle);
|
||||
enum ice_status
|
||||
ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx);
|
||||
int ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle);
|
||||
int ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx);
|
||||
#endif /* _ICE_SCHED_H_ */
|
||||
|
@ -18,7 +18,7 @@
|
||||
* queue and asynchronously sending message via
|
||||
* ice_sq_send_cmd() function
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32 v_retval,
|
||||
u8 *msg, u16 msglen, struct ice_sq_cd *cd)
|
||||
{
|
||||
@ -228,7 +228,7 @@ ice_mbx_traverse(struct ice_hw *hw,
|
||||
* sent per VF and marks the VF as malicious if it exceeds
|
||||
* the permissible number of messages to send.
|
||||
*/
|
||||
static enum ice_status
|
||||
static int
|
||||
ice_mbx_detect_malvf(struct ice_hw *hw, u16 vf_id,
|
||||
enum ice_mbx_snapshot_state *new_state,
|
||||
bool *is_malvf)
|
||||
@ -236,7 +236,7 @@ ice_mbx_detect_malvf(struct ice_hw *hw, u16 vf_id,
|
||||
struct ice_mbx_snapshot *snap = &hw->mbx_snapshot;
|
||||
|
||||
if (vf_id >= snap->mbx_vf.vfcntr_len)
|
||||
return ICE_ERR_OUT_OF_RANGE;
|
||||
return -EIO;
|
||||
|
||||
/* increment the message count in the VF array */
|
||||
snap->mbx_vf.vf_cntr[vf_id]++;
|
||||
@ -297,7 +297,7 @@ static void ice_mbx_reset_snapshot(struct ice_mbx_snapshot *snap)
|
||||
* Detect: If pending message count exceeds watermark traverse
|
||||
* the static snapshot and look for a malicious VF.
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_mbx_vf_state_handler(struct ice_hw *hw,
|
||||
struct ice_mbx_data *mbx_data, u16 vf_id,
|
||||
bool *is_malvf)
|
||||
@ -306,10 +306,10 @@ ice_mbx_vf_state_handler(struct ice_hw *hw,
|
||||
struct ice_mbx_snap_buffer_data *snap_buf;
|
||||
struct ice_ctl_q_info *cq = &hw->mailboxq;
|
||||
enum ice_mbx_snapshot_state new_state;
|
||||
enum ice_status status = 0;
|
||||
int status = 0;
|
||||
|
||||
if (!is_malvf || !mbx_data)
|
||||
return ICE_ERR_BAD_PTR;
|
||||
return -EINVAL;
|
||||
|
||||
/* When entering the mailbox state machine assume that the VF
|
||||
* is not malicious until detected.
|
||||
@ -320,7 +320,7 @@ ice_mbx_vf_state_handler(struct ice_hw *hw,
|
||||
* interrupt is not less than the defined AVF message threshold.
|
||||
*/
|
||||
if (mbx_data->max_num_msgs_mbx <= ICE_ASYNC_VF_MSG_THRESHOLD)
|
||||
return ICE_ERR_INVAL_SIZE;
|
||||
return -EINVAL;
|
||||
|
||||
/* The watermark value should not be lesser than the threshold limit
|
||||
* set for the number of asynchronous messages a VF can send to mailbox
|
||||
@ -329,7 +329,7 @@ ice_mbx_vf_state_handler(struct ice_hw *hw,
|
||||
*/
|
||||
if (mbx_data->async_watermark_val < ICE_ASYNC_VF_MSG_THRESHOLD ||
|
||||
mbx_data->async_watermark_val > mbx_data->max_num_msgs_mbx)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
new_state = ICE_MAL_VF_DETECT_STATE_INVALID;
|
||||
snap_buf = &snap->mbx_buf;
|
||||
@ -383,7 +383,7 @@ ice_mbx_vf_state_handler(struct ice_hw *hw,
|
||||
|
||||
default:
|
||||
new_state = ICE_MAL_VF_DETECT_STATE_INVALID;
|
||||
status = ICE_ERR_CFG;
|
||||
status = -EIO;
|
||||
}
|
||||
|
||||
snap_buf->state = new_state;
|
||||
@ -405,20 +405,20 @@ ice_mbx_vf_state_handler(struct ice_hw *hw,
|
||||
* the input vf_id against the bitmap to verify if the VF has been
|
||||
* detected in any previous mailbox iterations.
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_mbx_report_malvf(struct ice_hw *hw, unsigned long *all_malvfs,
|
||||
u16 bitmap_len, u16 vf_id, bool *report_malvf)
|
||||
{
|
||||
if (!all_malvfs || !report_malvf)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
*report_malvf = false;
|
||||
|
||||
if (bitmap_len < hw->mbx_snapshot.mbx_vf.vfcntr_len)
|
||||
return ICE_ERR_INVAL_SIZE;
|
||||
return -EINVAL;
|
||||
|
||||
if (vf_id >= bitmap_len)
|
||||
return ICE_ERR_OUT_OF_RANGE;
|
||||
return -EIO;
|
||||
|
||||
/* If the vf_id is found in the bitmap set bit and boolean to true */
|
||||
if (!test_and_set_bit(vf_id, all_malvfs))
|
||||
@ -441,19 +441,19 @@ ice_mbx_report_malvf(struct ice_hw *hw, unsigned long *all_malvfs,
|
||||
* that the new VF loaded is not considered malicious before going
|
||||
* through the overflow detection algorithm.
|
||||
*/
|
||||
enum ice_status
|
||||
int
|
||||
ice_mbx_clear_malvf(struct ice_mbx_snapshot *snap, unsigned long *all_malvfs,
|
||||
u16 bitmap_len, u16 vf_id)
|
||||
{
|
||||
if (!snap || !all_malvfs)
|
||||
return ICE_ERR_PARAM;
|
||||
return -EINVAL;
|
||||
|
||||
if (bitmap_len < snap->mbx_vf.vfcntr_len)
|
||||
return ICE_ERR_INVAL_SIZE;
|
||||
return -EINVAL;
|
||||
|
||||
/* Ensure VF ID value is not larger than bitmap or VF counter length */
|
||||
if (vf_id >= bitmap_len || vf_id >= snap->mbx_vf.vfcntr_len)
|
||||
return ICE_ERR_OUT_OF_RANGE;
|
||||
return -EIO;
|
||||
|
||||
/* Clear VF ID bit in the bitmap tracking malicious VFs attached to PF */
|
||||
clear_bit(vf_id, all_malvfs);
|
||||
@ -482,7 +482,7 @@ ice_mbx_clear_malvf(struct ice_mbx_snapshot *snap, unsigned long *all_malvfs,
|
||||
* called to ensure that the vf_count can be compared against the number
|
||||
* of VFs supported as defined in the functional capabilities of the device.
|
||||
*/
|
||||
enum ice_status ice_mbx_init_snapshot(struct ice_hw *hw, u16 vf_count)
|
||||
int ice_mbx_init_snapshot(struct ice_hw *hw, u16 vf_count)
|
||||
{
|
||||
struct ice_mbx_snapshot *snap = &hw->mbx_snapshot;
|
||||
|
||||
@ -491,13 +491,13 @@ enum ice_status ice_mbx_init_snapshot(struct ice_hw *hw, u16 vf_count)
|
||||
* the functional capabilities of the PF.
|
||||
*/
|
||||
if (!vf_count || vf_count > hw->func_caps.num_allocd_vfs)
|
||||
return ICE_ERR_INVAL_SIZE;
|
||||
return -EINVAL;
|
||||
|
||||
snap->mbx_vf.vf_cntr = devm_kcalloc(ice_hw_to_dev(hw), vf_count,
|
||||
sizeof(*snap->mbx_vf.vf_cntr),
|
||||
GFP_KERNEL);
|
||||
if (!snap->mbx_vf.vf_cntr)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
return -ENOMEM;
|
||||
|
||||
/* Setting the VF counter length to the number of allocated
|
||||
* VFs for given PF's functional capabilities.
|
||||
|
@ -14,24 +14,24 @@
|
||||
#define ICE_ASYNC_VF_MSG_THRESHOLD 63
|
||||
|
||||
#ifdef CONFIG_PCI_IOV
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32 v_retval,
|
||||
u8 *msg, u16 msglen, struct ice_sq_cd *cd);
|
||||
|
||||
u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed);
|
||||
enum ice_status
|
||||
int
|
||||
ice_mbx_vf_state_handler(struct ice_hw *hw, struct ice_mbx_data *mbx_data,
|
||||
u16 vf_id, bool *is_mal_vf);
|
||||
enum ice_status
|
||||
int
|
||||
ice_mbx_clear_malvf(struct ice_mbx_snapshot *snap, unsigned long *all_malvfs,
|
||||
u16 bitmap_len, u16 vf_id);
|
||||
enum ice_status ice_mbx_init_snapshot(struct ice_hw *hw, u16 vf_count);
|
||||
int ice_mbx_init_snapshot(struct ice_hw *hw, u16 vf_count);
|
||||
void ice_mbx_deinit_snapshot(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
int
|
||||
ice_mbx_report_malvf(struct ice_hw *hw, unsigned long *all_malvfs,
|
||||
u16 bitmap_len, u16 vf_id, bool *report_malvf);
|
||||
#else /* CONFIG_PCI_IOV */
|
||||
static inline enum ice_status
|
||||
static inline int
|
||||
ice_aq_send_msg_to_vf(struct ice_hw __always_unused *hw,
|
||||
u16 __always_unused vfid, u32 __always_unused v_opcode,
|
||||
u32 __always_unused v_retval, u8 __always_unused *msg,
|
||||
|
@ -1,44 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright (c) 2018, Intel Corporation. */
|
||||
|
||||
#ifndef _ICE_STATUS_H_
|
||||
#define _ICE_STATUS_H_
|
||||
|
||||
/* Error Codes */
|
||||
enum ice_status {
|
||||
ICE_SUCCESS = 0,
|
||||
|
||||
/* Generic codes : Range -1..-49 */
|
||||
ICE_ERR_PARAM = -1,
|
||||
ICE_ERR_NOT_IMPL = -2,
|
||||
ICE_ERR_NOT_READY = -3,
|
||||
ICE_ERR_NOT_SUPPORTED = -4,
|
||||
ICE_ERR_BAD_PTR = -5,
|
||||
ICE_ERR_INVAL_SIZE = -6,
|
||||
ICE_ERR_DEVICE_NOT_SUPPORTED = -8,
|
||||
ICE_ERR_RESET_FAILED = -9,
|
||||
ICE_ERR_FW_API_VER = -10,
|
||||
ICE_ERR_NO_MEMORY = -11,
|
||||
ICE_ERR_CFG = -12,
|
||||
ICE_ERR_OUT_OF_RANGE = -13,
|
||||
ICE_ERR_ALREADY_EXISTS = -14,
|
||||
ICE_ERR_DOES_NOT_EXIST = -15,
|
||||
ICE_ERR_IN_USE = -16,
|
||||
ICE_ERR_MAX_LIMIT = -17,
|
||||
ICE_ERR_RESET_ONGOING = -18,
|
||||
ICE_ERR_HW_TABLE = -19,
|
||||
ICE_ERR_FW_DDP_MISMATCH = -20,
|
||||
|
||||
ICE_ERR_NVM = -50,
|
||||
ICE_ERR_NVM_CHECKSUM = -51,
|
||||
ICE_ERR_BUF_TOO_SHORT = -52,
|
||||
ICE_ERR_NVM_BLANK_MODE = -53,
|
||||
ICE_ERR_AQ_ERROR = -100,
|
||||
ICE_ERR_AQ_TIMEOUT = -101,
|
||||
ICE_ERR_AQ_FULL = -102,
|
||||
ICE_ERR_AQ_NO_WORK = -103,
|
||||
ICE_ERR_AQ_EMPTY = -104,
|
||||
ICE_ERR_AQ_FW_CRITICAL = -105,
|
||||
};
|
||||
|
||||
#endif /* _ICE_STATUS_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -256,7 +256,7 @@ struct ice_vsi_list_map_info {
|
||||
|
||||
struct ice_fltr_list_entry {
|
||||
struct list_head list_entry;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
struct ice_fltr_info fltr_info;
|
||||
};
|
||||
|
||||
@ -302,75 +302,69 @@ enum ice_promisc_flags {
|
||||
};
|
||||
|
||||
/* VSI related commands */
|
||||
enum ice_status
|
||||
int
|
||||
ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
|
||||
bool keep_vsi_alloc, struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
int
|
||||
ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
|
||||
struct ice_sq_cd *cd);
|
||||
bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle);
|
||||
struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle);
|
||||
void ice_clear_all_vsi_ctx(struct ice_hw *hw);
|
||||
/* Switch config */
|
||||
enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);
|
||||
int ice_get_initial_sw_cfg(struct ice_hw *hw);
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,
|
||||
u16 *counter_id);
|
||||
enum ice_status
|
||||
int
|
||||
ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,
|
||||
u16 counter_id);
|
||||
|
||||
/* Switch/bridge related commands */
|
||||
enum ice_status
|
||||
int
|
||||
ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
|
||||
u16 lkups_cnt, struct ice_adv_rule_info *rinfo,
|
||||
struct ice_rule_query_data *added_entry);
|
||||
enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw);
|
||||
enum ice_status ice_add_mac(struct ice_hw *hw, struct list_head *m_lst);
|
||||
enum ice_status ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst);
|
||||
enum ice_status
|
||||
ice_add_eth_mac(struct ice_hw *hw, struct list_head *em_list);
|
||||
enum ice_status
|
||||
ice_remove_eth_mac(struct ice_hw *hw, struct list_head *em_list);
|
||||
int
|
||||
ice_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable);
|
||||
int ice_update_sw_rule_bridge_mode(struct ice_hw *hw);
|
||||
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_add_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);
|
||||
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_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable);
|
||||
void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle);
|
||||
enum ice_status
|
||||
ice_add_vlan(struct ice_hw *hw, struct list_head *m_list);
|
||||
enum ice_status ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list);
|
||||
|
||||
/* Promisc/defport setup for VSIs */
|
||||
enum ice_status
|
||||
ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction);
|
||||
enum ice_status
|
||||
int ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction);
|
||||
int
|
||||
ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
|
||||
u16 vid);
|
||||
enum ice_status
|
||||
int
|
||||
ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
|
||||
u16 vid);
|
||||
enum ice_status
|
||||
int
|
||||
ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
|
||||
bool rm_vlan_promisc);
|
||||
|
||||
enum ice_status
|
||||
ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle);
|
||||
enum ice_status
|
||||
int ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle);
|
||||
int
|
||||
ice_rem_adv_rule_by_id(struct ice_hw *hw,
|
||||
struct ice_rule_query_data *remove_entry);
|
||||
|
||||
enum ice_status ice_init_def_sw_recp(struct ice_hw *hw);
|
||||
int ice_init_def_sw_recp(struct ice_hw *hw);
|
||||
u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle);
|
||||
|
||||
enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle);
|
||||
int ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle);
|
||||
void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw);
|
||||
|
||||
enum ice_status
|
||||
int
|
||||
ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz,
|
||||
u8 num_rules, enum ice_adminq_opc opc, struct ice_sq_cd *cd);
|
||||
#endif /* _ICE_SWITCH_H_ */
|
||||
|
@ -398,9 +398,8 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr)
|
||||
struct ice_hw *hw = &vsi->back->hw;
|
||||
struct ice_adv_lkup_elem *list;
|
||||
u32 flags = fltr->flags;
|
||||
enum ice_status status;
|
||||
int lkups_cnt;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
if (!flags || (flags & ICE_TC_FLWR_FIELD_ENC_SRC_L4_PORT)) {
|
||||
@ -449,14 +448,13 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr)
|
||||
/* specify the cookie as filter_rule_id */
|
||||
rule_info.fltr_rule_id = fltr->cookie;
|
||||
|
||||
status = ice_add_adv_rule(hw, list, lkups_cnt, &rule_info, &rule_added);
|
||||
if (status == ICE_ERR_ALREADY_EXISTS) {
|
||||
ret = ice_add_adv_rule(hw, list, lkups_cnt, &rule_info, &rule_added);
|
||||
if (ret == -EEXIST) {
|
||||
NL_SET_ERR_MSG_MOD(fltr->extack, "Unable to add filter because it already exist");
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
} else if (status) {
|
||||
} else if (ret) {
|
||||
NL_SET_ERR_MSG_MOD(fltr->extack, "Unable to add filter due to error");
|
||||
ret = -EIO;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -1162,7 +1160,7 @@ static int ice_del_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr)
|
||||
rule_rem.vsi_handle = fltr->dest_id;
|
||||
err = ice_rem_adv_rule_by_id(&pf->hw, &rule_rem);
|
||||
if (err) {
|
||||
if (err == ICE_ERR_DOES_NOT_EXIST) {
|
||||
if (err == -ENOENT) {
|
||||
NL_SET_ERR_MSG_MOD(fltr->extack, "Filter does not exist");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define ICE_BYTES_PER_WORD 2
|
||||
#define ICE_BYTES_PER_DWORD 4
|
||||
|
||||
#include "ice_status.h"
|
||||
#include "ice_hw_autogen.h"
|
||||
#include "ice_osdep.h"
|
||||
#include "ice_controlq.h"
|
||||
@ -873,8 +872,6 @@ struct ice_hw {
|
||||
u8 active_pkg_name[ICE_PKG_NAME_SIZE];
|
||||
u8 active_pkg_in_nvm;
|
||||
|
||||
enum ice_aq_err pkg_dwnld_status;
|
||||
|
||||
/* Driver's package ver - (from the Ice Metadata section) */
|
||||
struct ice_pkg_ver pkg_ver;
|
||||
u8 pkg_name[ICE_PKG_NAME_SIZE];
|
||||
@ -919,6 +916,7 @@ struct ice_hw {
|
||||
struct mutex rss_locks; /* protect RSS configuration */
|
||||
struct list_head rss_list_head;
|
||||
struct ice_mbx_snapshot mbx_snapshot;
|
||||
DECLARE_BITMAP(hw_ptype, ICE_FLOW_PTYPE_MAX);
|
||||
u16 io_expander_handle;
|
||||
};
|
||||
|
||||
|
@ -47,197 +47,6 @@ struct virtchnl_fdir_fltr_conf {
|
||||
u32 flow_id;
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ether[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_tcp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_TCP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_udp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_UDP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_sctp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_SCTP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv6[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV6,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv6_tcp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV6,
|
||||
VIRTCHNL_PROTO_HDR_TCP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv6_udp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV6,
|
||||
VIRTCHNL_PROTO_HDR_UDP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv6_sctp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV6,
|
||||
VIRTCHNL_PROTO_HDR_SCTP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_gtpu[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_UDP,
|
||||
VIRTCHNL_PROTO_HDR_GTPU_IP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_gtpu_eh[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_UDP,
|
||||
VIRTCHNL_PROTO_HDR_GTPU_IP,
|
||||
VIRTCHNL_PROTO_HDR_GTPU_EH,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_l2tpv3[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_L2TPV3,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv6_l2tpv3[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV6,
|
||||
VIRTCHNL_PROTO_HDR_L2TPV3,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_esp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_ESP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv6_esp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV6,
|
||||
VIRTCHNL_PROTO_HDR_ESP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_ah[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_AH,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv6_ah[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV6,
|
||||
VIRTCHNL_PROTO_HDR_AH,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_nat_t_esp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_UDP,
|
||||
VIRTCHNL_PROTO_HDR_ESP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv6_nat_t_esp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV6,
|
||||
VIRTCHNL_PROTO_HDR_UDP,
|
||||
VIRTCHNL_PROTO_HDR_ESP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv4_pfcp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV4,
|
||||
VIRTCHNL_PROTO_HDR_UDP,
|
||||
VIRTCHNL_PROTO_HDR_PFCP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
static enum virtchnl_proto_hdr_type vc_pattern_ipv6_pfcp[] = {
|
||||
VIRTCHNL_PROTO_HDR_ETH,
|
||||
VIRTCHNL_PROTO_HDR_IPV6,
|
||||
VIRTCHNL_PROTO_HDR_UDP,
|
||||
VIRTCHNL_PROTO_HDR_PFCP,
|
||||
VIRTCHNL_PROTO_HDR_NONE,
|
||||
};
|
||||
|
||||
struct virtchnl_fdir_pattern_match_item {
|
||||
enum virtchnl_proto_hdr_type *list;
|
||||
u64 input_set;
|
||||
u64 *meta;
|
||||
};
|
||||
|
||||
static const struct virtchnl_fdir_pattern_match_item vc_fdir_pattern_os[] = {
|
||||
{vc_pattern_ipv4, 0, NULL},
|
||||
{vc_pattern_ipv4_tcp, 0, NULL},
|
||||
{vc_pattern_ipv4_udp, 0, NULL},
|
||||
{vc_pattern_ipv4_sctp, 0, NULL},
|
||||
{vc_pattern_ipv6, 0, NULL},
|
||||
{vc_pattern_ipv6_tcp, 0, NULL},
|
||||
{vc_pattern_ipv6_udp, 0, NULL},
|
||||
{vc_pattern_ipv6_sctp, 0, NULL},
|
||||
};
|
||||
|
||||
static const struct virtchnl_fdir_pattern_match_item vc_fdir_pattern_comms[] = {
|
||||
{vc_pattern_ipv4, 0, NULL},
|
||||
{vc_pattern_ipv4_tcp, 0, NULL},
|
||||
{vc_pattern_ipv4_udp, 0, NULL},
|
||||
{vc_pattern_ipv4_sctp, 0, NULL},
|
||||
{vc_pattern_ipv6, 0, NULL},
|
||||
{vc_pattern_ipv6_tcp, 0, NULL},
|
||||
{vc_pattern_ipv6_udp, 0, NULL},
|
||||
{vc_pattern_ipv6_sctp, 0, NULL},
|
||||
{vc_pattern_ether, 0, NULL},
|
||||
{vc_pattern_ipv4_gtpu, 0, NULL},
|
||||
{vc_pattern_ipv4_gtpu_eh, 0, NULL},
|
||||
{vc_pattern_ipv4_l2tpv3, 0, NULL},
|
||||
{vc_pattern_ipv6_l2tpv3, 0, NULL},
|
||||
{vc_pattern_ipv4_esp, 0, NULL},
|
||||
{vc_pattern_ipv6_esp, 0, NULL},
|
||||
{vc_pattern_ipv4_ah, 0, NULL},
|
||||
{vc_pattern_ipv6_ah, 0, NULL},
|
||||
{vc_pattern_ipv4_nat_t_esp, 0, NULL},
|
||||
{vc_pattern_ipv6_nat_t_esp, 0, NULL},
|
||||
{vc_pattern_ipv4_pfcp, 0, NULL},
|
||||
{vc_pattern_ipv6_pfcp, 0, NULL},
|
||||
};
|
||||
|
||||
struct virtchnl_fdir_inset_map {
|
||||
enum virtchnl_proto_hdr_field field;
|
||||
enum ice_flow_field fld;
|
||||
@ -751,7 +560,6 @@ ice_vc_fdir_write_flow_prof(struct ice_vf *vf, enum ice_fltr_ptype flow,
|
||||
struct ice_flow_seg_info *old_seg;
|
||||
struct ice_flow_prof *prof = NULL;
|
||||
struct ice_fd_hw_prof *vf_prof;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
struct ice_pf *pf;
|
||||
struct ice_hw *hw;
|
||||
@ -794,29 +602,26 @@ ice_vc_fdir_write_flow_prof(struct ice_vf *vf, enum ice_fltr_ptype flow,
|
||||
prof_id = ICE_FLOW_PROF_FD(vf_vsi->vsi_num, flow,
|
||||
tun ? ICE_FLTR_PTYPE_MAX : 0);
|
||||
|
||||
status = ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, prof_id, seg,
|
||||
tun + 1, &prof);
|
||||
ret = ice_status_to_errno(status);
|
||||
ret = ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, prof_id, seg,
|
||||
tun + 1, &prof);
|
||||
if (ret) {
|
||||
dev_dbg(dev, "Could not add VSI flow 0x%x for VF %d\n",
|
||||
flow, vf->vf_id);
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
status = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, vf_vsi->idx,
|
||||
vf_vsi->idx, ICE_FLOW_PRIO_NORMAL,
|
||||
seg, &entry1_h);
|
||||
ret = ice_status_to_errno(status);
|
||||
ret = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, vf_vsi->idx,
|
||||
vf_vsi->idx, ICE_FLOW_PRIO_NORMAL,
|
||||
seg, &entry1_h);
|
||||
if (ret) {
|
||||
dev_dbg(dev, "Could not add flow 0x%x VSI entry for VF %d\n",
|
||||
flow, vf->vf_id);
|
||||
goto err_prof;
|
||||
}
|
||||
|
||||
status = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, vf_vsi->idx,
|
||||
ctrl_vsi->idx, ICE_FLOW_PRIO_NORMAL,
|
||||
seg, &entry2_h);
|
||||
ret = ice_status_to_errno(status);
|
||||
ret = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, vf_vsi->idx,
|
||||
ctrl_vsi->idx, ICE_FLOW_PRIO_NORMAL,
|
||||
seg, &entry2_h);
|
||||
if (ret) {
|
||||
dev_dbg(dev,
|
||||
"Could not add flow 0x%x Ctrl VSI entry for VF %d\n",
|
||||
@ -910,83 +715,6 @@ err_exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_vc_fdir_match_pattern
|
||||
* @fltr: virtual channel add cmd buffer
|
||||
* @type: virtual channel protocol filter header type
|
||||
*
|
||||
* Matching the header type by comparing fltr and type's value.
|
||||
*
|
||||
* Return: true on success, and false on error.
|
||||
*/
|
||||
static bool
|
||||
ice_vc_fdir_match_pattern(struct virtchnl_fdir_add *fltr,
|
||||
enum virtchnl_proto_hdr_type *type)
|
||||
{
|
||||
struct virtchnl_proto_hdrs *proto = &fltr->rule_cfg.proto_hdrs;
|
||||
int i = 0;
|
||||
|
||||
while ((i < proto->count) &&
|
||||
(*type == proto->proto_hdr[i].type) &&
|
||||
(*type != VIRTCHNL_PROTO_HDR_NONE)) {
|
||||
type++;
|
||||
i++;
|
||||
}
|
||||
|
||||
return ((i == proto->count) && (*type == VIRTCHNL_PROTO_HDR_NONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_vc_fdir_get_pattern - get while list pattern
|
||||
* @vf: pointer to the VF info
|
||||
* @len: filter list length
|
||||
*
|
||||
* Return: pointer to allowed filter list
|
||||
*/
|
||||
static const struct virtchnl_fdir_pattern_match_item *
|
||||
ice_vc_fdir_get_pattern(struct ice_vf *vf, int *len)
|
||||
{
|
||||
const struct virtchnl_fdir_pattern_match_item *item;
|
||||
struct ice_pf *pf = vf->pf;
|
||||
struct ice_hw *hw;
|
||||
|
||||
hw = &pf->hw;
|
||||
if (!strncmp(hw->active_pkg_name, "ICE COMMS Package",
|
||||
sizeof(hw->active_pkg_name))) {
|
||||
item = vc_fdir_pattern_comms;
|
||||
*len = ARRAY_SIZE(vc_fdir_pattern_comms);
|
||||
} else {
|
||||
item = vc_fdir_pattern_os;
|
||||
*len = ARRAY_SIZE(vc_fdir_pattern_os);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_vc_fdir_search_pattern
|
||||
* @vf: pointer to the VF info
|
||||
* @fltr: virtual channel add cmd buffer
|
||||
*
|
||||
* Search for matched pattern from supported pattern list
|
||||
*
|
||||
* Return: 0 on success, and other on error.
|
||||
*/
|
||||
static int
|
||||
ice_vc_fdir_search_pattern(struct ice_vf *vf, struct virtchnl_fdir_add *fltr)
|
||||
{
|
||||
const struct virtchnl_fdir_pattern_match_item *pattern;
|
||||
int len, i;
|
||||
|
||||
pattern = ice_vc_fdir_get_pattern(vf, &len);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
if (ice_vc_fdir_match_pattern(fltr, pattern[i].list))
|
||||
return 0;
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_vc_fdir_parse_pattern
|
||||
* @vf: pointer to the VF info
|
||||
@ -1299,11 +1027,11 @@ static int
|
||||
ice_vc_validate_fdir_fltr(struct ice_vf *vf, struct virtchnl_fdir_add *fltr,
|
||||
struct virtchnl_fdir_fltr_conf *conf)
|
||||
{
|
||||
struct virtchnl_proto_hdrs *proto = &fltr->rule_cfg.proto_hdrs;
|
||||
int ret;
|
||||
|
||||
ret = ice_vc_fdir_search_pattern(vf, fltr);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!ice_vc_validate_pattern(vf, proto))
|
||||
return -EINVAL;
|
||||
|
||||
ret = ice_vc_fdir_parse_pattern(vf, fltr, conf);
|
||||
if (ret)
|
||||
@ -1467,7 +1195,6 @@ static int ice_vc_fdir_write_fltr(struct ice_vf *vf,
|
||||
struct ice_fdir_fltr *input = &conf->input;
|
||||
struct ice_vsi *vsi, *ctrl_vsi;
|
||||
struct ice_fltr_desc desc;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
struct ice_pf *pf;
|
||||
struct ice_hw *hw;
|
||||
@ -1497,8 +1224,7 @@ static int ice_vc_fdir_write_fltr(struct ice_vf *vf,
|
||||
return -ENOMEM;
|
||||
|
||||
ice_fdir_get_prgm_desc(hw, input, &desc, add);
|
||||
status = ice_fdir_get_gen_prgm_pkt(hw, input, pkt, false, is_tun);
|
||||
ret = ice_status_to_errno(status);
|
||||
ret = ice_fdir_get_gen_prgm_pkt(hw, input, pkt, false, is_tun);
|
||||
if (ret) {
|
||||
dev_dbg(dev, "Gen training pkt for VF %d ptype %d failed\n",
|
||||
vf->vf_id, input->flow_type);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "ice_flow.h"
|
||||
#include "ice_eswitch.h"
|
||||
#include "ice_virtchnl_allowlist.h"
|
||||
#include "ice_flex_pipe.h"
|
||||
|
||||
#define FIELD_SELECTOR(proto_hdr_field) \
|
||||
BIT((proto_hdr_field) & PROTO_HDR_FIELD_MASK)
|
||||
@ -18,18 +19,7 @@ struct ice_vc_hdr_match_type {
|
||||
u32 ice_hdr; /* ice headers (ICE_FLOW_SEG_HDR_XXX) */
|
||||
};
|
||||
|
||||
static const struct ice_vc_hdr_match_type ice_vc_hdr_list_os[] = {
|
||||
{VIRTCHNL_PROTO_HDR_NONE, ICE_FLOW_SEG_HDR_NONE},
|
||||
{VIRTCHNL_PROTO_HDR_IPV4, ICE_FLOW_SEG_HDR_IPV4 |
|
||||
ICE_FLOW_SEG_HDR_IPV_OTHER},
|
||||
{VIRTCHNL_PROTO_HDR_IPV6, ICE_FLOW_SEG_HDR_IPV6 |
|
||||
ICE_FLOW_SEG_HDR_IPV_OTHER},
|
||||
{VIRTCHNL_PROTO_HDR_TCP, ICE_FLOW_SEG_HDR_TCP},
|
||||
{VIRTCHNL_PROTO_HDR_UDP, ICE_FLOW_SEG_HDR_UDP},
|
||||
{VIRTCHNL_PROTO_HDR_SCTP, ICE_FLOW_SEG_HDR_SCTP},
|
||||
};
|
||||
|
||||
static const struct ice_vc_hdr_match_type ice_vc_hdr_list_comms[] = {
|
||||
static const struct ice_vc_hdr_match_type ice_vc_hdr_list[] = {
|
||||
{VIRTCHNL_PROTO_HDR_NONE, ICE_FLOW_SEG_HDR_NONE},
|
||||
{VIRTCHNL_PROTO_HDR_ETH, ICE_FLOW_SEG_HDR_ETH},
|
||||
{VIRTCHNL_PROTO_HDR_S_VLAN, ICE_FLOW_SEG_HDR_VLAN},
|
||||
@ -67,83 +57,7 @@ struct ice_vc_hash_field_match_type {
|
||||
};
|
||||
|
||||
static const struct
|
||||
ice_vc_hash_field_match_type ice_vc_hash_field_list_os[] = {
|
||||
{VIRTCHNL_PROTO_HDR_IPV4, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_SRC),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_SA)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV4, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_DST),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_DA)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV4, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_SRC) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_DST),
|
||||
ICE_FLOW_HASH_IPV4},
|
||||
{VIRTCHNL_PROTO_HDR_IPV4, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_SRC) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_PROT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_SA) |
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_PROT)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV4, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_DST) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_PROT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_DA) |
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_PROT)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV4, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_SRC) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_DST) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_PROT),
|
||||
ICE_FLOW_HASH_IPV4 | BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_PROT)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV4, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_PROT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_PROT)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV6, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_SRC),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_SA)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV6, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_DA)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV6, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_SRC) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST),
|
||||
ICE_FLOW_HASH_IPV6},
|
||||
{VIRTCHNL_PROTO_HDR_IPV6, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_SRC) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_SA) |
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_PROT)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV6, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_DA) |
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_PROT)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV6, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_SRC) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT),
|
||||
ICE_FLOW_HASH_IPV6 | BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_PROT)},
|
||||
{VIRTCHNL_PROTO_HDR_IPV6, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_PROT)},
|
||||
{VIRTCHNL_PROTO_HDR_TCP,
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_SRC_PORT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT)},
|
||||
{VIRTCHNL_PROTO_HDR_TCP,
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_DST_PORT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT)},
|
||||
{VIRTCHNL_PROTO_HDR_TCP,
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_SRC_PORT) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_DST_PORT),
|
||||
ICE_FLOW_HASH_TCP_PORT},
|
||||
{VIRTCHNL_PROTO_HDR_UDP,
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_SRC_PORT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT)},
|
||||
{VIRTCHNL_PROTO_HDR_UDP,
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_DST_PORT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT)},
|
||||
{VIRTCHNL_PROTO_HDR_UDP,
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_SRC_PORT) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_DST_PORT),
|
||||
ICE_FLOW_HASH_UDP_PORT},
|
||||
{VIRTCHNL_PROTO_HDR_SCTP,
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT)},
|
||||
{VIRTCHNL_PROTO_HDR_SCTP,
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_DST_PORT),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT)},
|
||||
{VIRTCHNL_PROTO_HDR_SCTP,
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT) |
|
||||
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_DST_PORT),
|
||||
ICE_FLOW_HASH_SCTP_PORT},
|
||||
};
|
||||
|
||||
static const struct
|
||||
ice_vc_hash_field_match_type ice_vc_hash_field_list_comms[] = {
|
||||
ice_vc_hash_field_match_type ice_vc_hash_field_list[] = {
|
||||
{VIRTCHNL_PROTO_HDR_ETH, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ETH_SRC),
|
||||
BIT_ULL(ICE_FLOW_FIELD_IDX_ETH_SA)},
|
||||
{VIRTCHNL_PROTO_HDR_ETH, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ETH_DST),
|
||||
@ -288,37 +202,6 @@ static int ice_check_vf_init(struct ice_pf *pf, struct ice_vf *vf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_err_to_virt_err - translate errors for VF return code
|
||||
* @ice_err: error return code
|
||||
*/
|
||||
static enum virtchnl_status_code ice_err_to_virt_err(enum ice_status ice_err)
|
||||
{
|
||||
switch (ice_err) {
|
||||
case ICE_SUCCESS:
|
||||
return VIRTCHNL_STATUS_SUCCESS;
|
||||
case ICE_ERR_BAD_PTR:
|
||||
case ICE_ERR_INVAL_SIZE:
|
||||
case ICE_ERR_DEVICE_NOT_SUPPORTED:
|
||||
case ICE_ERR_PARAM:
|
||||
case ICE_ERR_CFG:
|
||||
return VIRTCHNL_STATUS_ERR_PARAM;
|
||||
case ICE_ERR_NO_MEMORY:
|
||||
return VIRTCHNL_STATUS_ERR_NO_MEMORY;
|
||||
case ICE_ERR_NOT_READY:
|
||||
case ICE_ERR_RESET_FAILED:
|
||||
case ICE_ERR_FW_API_VER:
|
||||
case ICE_ERR_AQ_ERROR:
|
||||
case ICE_ERR_AQ_TIMEOUT:
|
||||
case ICE_ERR_AQ_FULL:
|
||||
case ICE_ERR_AQ_NO_WORK:
|
||||
case ICE_ERR_AQ_EMPTY:
|
||||
return VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR;
|
||||
default:
|
||||
return VIRTCHNL_STATUS_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_vc_vf_broadcast - Broadcast a message to all VFs on PF
|
||||
* @pf: pointer to the PF structure
|
||||
@ -770,8 +653,7 @@ static int ice_vsi_manage_pvid(struct ice_vsi *vsi, u16 pvid_info, bool enable)
|
||||
struct ice_hw *hw = &vsi->back->hw;
|
||||
struct ice_aqc_vsi_props *info;
|
||||
struct ice_vsi_ctx *ctxt;
|
||||
enum ice_status status;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
|
||||
if (!ctxt)
|
||||
@ -794,12 +676,10 @@ static int ice_vsi_manage_pvid(struct ice_vsi *vsi, u16 pvid_info, bool enable)
|
||||
info->valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID |
|
||||
ICE_AQ_VSI_PROP_SW_VALID);
|
||||
|
||||
status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
|
||||
if (status) {
|
||||
dev_info(ice_hw_to_dev(hw), "update VSI for port VLAN failed, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
ret = -EIO;
|
||||
ret = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
|
||||
if (ret) {
|
||||
dev_info(ice_hw_to_dev(hw), "update VSI for port VLAN failed, err %d aq_err %s\n",
|
||||
ret, ice_aq_str(hw->adminq.sq_last_status));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -968,8 +848,8 @@ static int ice_vf_rebuild_host_mac_cfg(struct ice_vf *vf)
|
||||
{
|
||||
struct device *dev = ice_pf_to_dev(vf->pf);
|
||||
struct ice_vsi *vsi = ice_get_vf_vsi(vf);
|
||||
enum ice_status status;
|
||||
u8 broadcast[ETH_ALEN];
|
||||
int status;
|
||||
|
||||
if (ice_is_eswitch_mode_switchdev(vf->pf))
|
||||
return 0;
|
||||
@ -977,9 +857,9 @@ static int ice_vf_rebuild_host_mac_cfg(struct ice_vf *vf)
|
||||
eth_broadcast_addr(broadcast);
|
||||
status = ice_fltr_add_mac(vsi, broadcast, ICE_FWD_TO_VSI);
|
||||
if (status) {
|
||||
dev_err(dev, "failed to add broadcast MAC filter for VF %u, error %s\n",
|
||||
vf->vf_id, ice_stat_str(status));
|
||||
return ice_status_to_errno(status);
|
||||
dev_err(dev, "failed to add broadcast MAC filter for VF %u, error %d\n",
|
||||
vf->vf_id, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
vf->num_mac++;
|
||||
@ -988,10 +868,10 @@ static int ice_vf_rebuild_host_mac_cfg(struct ice_vf *vf)
|
||||
status = ice_fltr_add_mac(vsi, vf->hw_lan_addr.addr,
|
||||
ICE_FWD_TO_VSI);
|
||||
if (status) {
|
||||
dev_err(dev, "failed to add default unicast MAC filter %pM for VF %u, error %s\n",
|
||||
dev_err(dev, "failed to add default unicast MAC filter %pM for VF %u, error %d\n",
|
||||
&vf->hw_lan_addr.addr[0], vf->vf_id,
|
||||
ice_stat_str(status));
|
||||
return ice_status_to_errno(status);
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
vf->num_mac++;
|
||||
|
||||
@ -1341,45 +1221,50 @@ static void ice_clear_vf_reset_trigger(struct ice_vf *vf)
|
||||
ice_flush(hw);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_vf_set_vsi_promisc - set given VF VSI to given promiscuous mode(s)
|
||||
* @vf: pointer to the VF info
|
||||
* @vsi: the VSI being configured
|
||||
* @promisc_m: mask of promiscuous config bits
|
||||
* @rm_promisc: promisc flag request from the VF to remove or add filter
|
||||
*
|
||||
* This function configures VF VSI promiscuous mode, based on the VF requests,
|
||||
* for Unicast, Multicast and VLAN
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_vf_set_vsi_promisc(struct ice_vf *vf, struct ice_vsi *vsi, u8 promisc_m,
|
||||
bool rm_promisc)
|
||||
static int
|
||||
ice_vf_set_vsi_promisc(struct ice_vf *vf, struct ice_vsi *vsi, u8 promisc_m)
|
||||
{
|
||||
struct ice_pf *pf = vf->pf;
|
||||
enum ice_status status = 0;
|
||||
struct ice_hw *hw;
|
||||
struct ice_hw *hw = &vsi->back->hw;
|
||||
int status;
|
||||
|
||||
hw = &pf->hw;
|
||||
if (vsi->num_vlan) {
|
||||
status = ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_m,
|
||||
rm_promisc);
|
||||
} else if (vf->port_vlan_info) {
|
||||
if (rm_promisc)
|
||||
status = ice_clear_vsi_promisc(hw, vsi->idx, promisc_m,
|
||||
vf->port_vlan_info);
|
||||
else
|
||||
status = ice_set_vsi_promisc(hw, vsi->idx, promisc_m,
|
||||
vf->port_vlan_info);
|
||||
} else {
|
||||
if (rm_promisc)
|
||||
status = ice_clear_vsi_promisc(hw, vsi->idx, promisc_m,
|
||||
0);
|
||||
else
|
||||
status = ice_set_vsi_promisc(hw, vsi->idx, promisc_m,
|
||||
0);
|
||||
if (vf->port_vlan_info)
|
||||
status = ice_fltr_set_vsi_promisc(hw, vsi->idx, promisc_m,
|
||||
vf->port_vlan_info & VLAN_VID_MASK);
|
||||
else if (vsi->num_vlan > 1)
|
||||
status = ice_fltr_set_vlan_vsi_promisc(hw, vsi, promisc_m);
|
||||
else
|
||||
status = ice_fltr_set_vsi_promisc(hw, vsi->idx, promisc_m, 0);
|
||||
|
||||
if (status && status != -EEXIST) {
|
||||
dev_err(ice_pf_to_dev(vsi->back), "enable Tx/Rx filter promiscuous mode on VF-%u failed, error: %d\n",
|
||||
vf->vf_id, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ice_vf_clear_vsi_promisc(struct ice_vf *vf, struct ice_vsi *vsi, u8 promisc_m)
|
||||
{
|
||||
struct ice_hw *hw = &vsi->back->hw;
|
||||
int status;
|
||||
|
||||
if (vf->port_vlan_info)
|
||||
status = ice_fltr_clear_vsi_promisc(hw, vsi->idx, promisc_m,
|
||||
vf->port_vlan_info & VLAN_VID_MASK);
|
||||
else if (vsi->num_vlan > 1)
|
||||
status = ice_fltr_clear_vlan_vsi_promisc(hw, vsi, promisc_m);
|
||||
else
|
||||
status = ice_fltr_clear_vsi_promisc(hw, vsi->idx, promisc_m, 0);
|
||||
|
||||
if (status && status != -ENOENT) {
|
||||
dev_err(ice_pf_to_dev(vsi->back), "disable Tx/Rx filter promiscuous mode on VF-%u failed, error: %d\n",
|
||||
vf->vf_id, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ice_vf_clear_counters(struct ice_vf *vf)
|
||||
@ -1415,8 +1300,8 @@ static void ice_vf_pre_vsi_rebuild(struct ice_vf *vf)
|
||||
static void ice_vf_rebuild_aggregator_node_cfg(struct ice_vsi *vsi)
|
||||
{
|
||||
struct ice_pf *pf = vsi->back;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
int status;
|
||||
|
||||
if (!vsi->agg_node)
|
||||
return;
|
||||
@ -1743,7 +1628,7 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)
|
||||
else
|
||||
promisc_m = ICE_UCAST_PROMISC_BITS;
|
||||
|
||||
if (ice_vf_set_vsi_promisc(vf, vsi, promisc_m, true))
|
||||
if (ice_vf_clear_vsi_promisc(vf, vsi, promisc_m))
|
||||
dev_err(dev, "disabling promiscuous mode failed\n");
|
||||
}
|
||||
|
||||
@ -1846,7 +1731,6 @@ static int ice_init_vf_vsi_res(struct ice_vf *vf)
|
||||
{
|
||||
struct ice_pf *pf = vf->pf;
|
||||
u8 broadcast[ETH_ALEN];
|
||||
enum ice_status status;
|
||||
struct ice_vsi *vsi;
|
||||
struct device *dev;
|
||||
int err;
|
||||
@ -1866,11 +1750,10 @@ static int ice_init_vf_vsi_res(struct ice_vf *vf)
|
||||
}
|
||||
|
||||
eth_broadcast_addr(broadcast);
|
||||
status = ice_fltr_add_mac(vsi, broadcast, ICE_FWD_TO_VSI);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to add broadcast MAC filter for VF %d, status %s\n",
|
||||
vf->vf_id, ice_stat_str(status));
|
||||
err = ice_status_to_errno(status);
|
||||
err = ice_fltr_add_mac(vsi, broadcast, ICE_FWD_TO_VSI);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to add broadcast MAC filter for VF %d, error %d\n",
|
||||
vf->vf_id, err);
|
||||
goto release_vsi;
|
||||
}
|
||||
|
||||
@ -2116,7 +1999,6 @@ int ice_sriov_configure(struct pci_dev *pdev, int num_vfs)
|
||||
{
|
||||
struct ice_pf *pf = pci_get_drvdata(pdev);
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
enum ice_status status;
|
||||
int err;
|
||||
|
||||
err = ice_check_sriov_allowed(pf);
|
||||
@ -2136,9 +2018,9 @@ int ice_sriov_configure(struct pci_dev *pdev, int num_vfs)
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
status = ice_mbx_init_snapshot(&pf->hw, num_vfs);
|
||||
if (status)
|
||||
return ice_status_to_errno(status);
|
||||
err = ice_mbx_init_snapshot(&pf->hw, num_vfs);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = ice_pci_sriov_ena(pf, num_vfs);
|
||||
if (err) {
|
||||
@ -2272,9 +2154,9 @@ int
|
||||
ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,
|
||||
enum virtchnl_status_code v_retval, u8 *msg, u16 msglen)
|
||||
{
|
||||
enum ice_status aq_ret;
|
||||
struct device *dev;
|
||||
struct ice_pf *pf;
|
||||
int aq_ret;
|
||||
|
||||
if (!vf)
|
||||
return -EINVAL;
|
||||
@ -2306,8 +2188,8 @@ ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,
|
||||
aq_ret = ice_aq_send_msg_to_vf(&pf->hw, vf->vf_id, v_opcode, v_retval,
|
||||
msg, msglen, NULL);
|
||||
if (aq_ret && pf->hw.mailboxq.sq_last_status != ICE_AQ_RC_ENOSYS) {
|
||||
dev_info(dev, "Unable to send the message to VF %d ret %s aq_err %s\n",
|
||||
vf->vf_id, ice_stat_str(aq_ret),
|
||||
dev_info(dev, "Unable to send the message to VF %d ret %d aq_err %s\n",
|
||||
vf->vf_id, aq_ret,
|
||||
ice_aq_str(pf->hw.mailboxq.sq_last_status));
|
||||
return -EIO;
|
||||
}
|
||||
@ -2555,6 +2437,100 @@ static bool ice_vc_isvalid_ring_len(u16 ring_len)
|
||||
!(ring_len % ICE_REQ_DESC_MULTIPLE));
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_vc_validate_pattern
|
||||
* @vf: pointer to the VF info
|
||||
* @proto: virtchnl protocol headers
|
||||
*
|
||||
* validate the pattern is supported or not.
|
||||
*
|
||||
* Return: true on success, false on error.
|
||||
*/
|
||||
bool
|
||||
ice_vc_validate_pattern(struct ice_vf *vf, struct virtchnl_proto_hdrs *proto)
|
||||
{
|
||||
bool is_ipv4 = false;
|
||||
bool is_ipv6 = false;
|
||||
bool is_udp = false;
|
||||
u16 ptype = -1;
|
||||
int i = 0;
|
||||
|
||||
while (i < proto->count &&
|
||||
proto->proto_hdr[i].type != VIRTCHNL_PROTO_HDR_NONE) {
|
||||
switch (proto->proto_hdr[i].type) {
|
||||
case VIRTCHNL_PROTO_HDR_ETH:
|
||||
ptype = ICE_PTYPE_MAC_PAY;
|
||||
break;
|
||||
case VIRTCHNL_PROTO_HDR_IPV4:
|
||||
ptype = ICE_PTYPE_IPV4_PAY;
|
||||
is_ipv4 = true;
|
||||
break;
|
||||
case VIRTCHNL_PROTO_HDR_IPV6:
|
||||
ptype = ICE_PTYPE_IPV6_PAY;
|
||||
is_ipv6 = true;
|
||||
break;
|
||||
case VIRTCHNL_PROTO_HDR_UDP:
|
||||
if (is_ipv4)
|
||||
ptype = ICE_PTYPE_IPV4_UDP_PAY;
|
||||
else if (is_ipv6)
|
||||
ptype = ICE_PTYPE_IPV6_UDP_PAY;
|
||||
is_udp = true;
|
||||
break;
|
||||
case VIRTCHNL_PROTO_HDR_TCP:
|
||||
if (is_ipv4)
|
||||
ptype = ICE_PTYPE_IPV4_TCP_PAY;
|
||||
else if (is_ipv6)
|
||||
ptype = ICE_PTYPE_IPV6_TCP_PAY;
|
||||
break;
|
||||
case VIRTCHNL_PROTO_HDR_SCTP:
|
||||
if (is_ipv4)
|
||||
ptype = ICE_PTYPE_IPV4_SCTP_PAY;
|
||||
else if (is_ipv6)
|
||||
ptype = ICE_PTYPE_IPV6_SCTP_PAY;
|
||||
break;
|
||||
case VIRTCHNL_PROTO_HDR_GTPU_IP:
|
||||
case VIRTCHNL_PROTO_HDR_GTPU_EH:
|
||||
if (is_ipv4)
|
||||
ptype = ICE_MAC_IPV4_GTPU;
|
||||
else if (is_ipv6)
|
||||
ptype = ICE_MAC_IPV6_GTPU;
|
||||
goto out;
|
||||
case VIRTCHNL_PROTO_HDR_L2TPV3:
|
||||
if (is_ipv4)
|
||||
ptype = ICE_MAC_IPV4_L2TPV3;
|
||||
else if (is_ipv6)
|
||||
ptype = ICE_MAC_IPV6_L2TPV3;
|
||||
goto out;
|
||||
case VIRTCHNL_PROTO_HDR_ESP:
|
||||
if (is_ipv4)
|
||||
ptype = is_udp ? ICE_MAC_IPV4_NAT_T_ESP :
|
||||
ICE_MAC_IPV4_ESP;
|
||||
else if (is_ipv6)
|
||||
ptype = is_udp ? ICE_MAC_IPV6_NAT_T_ESP :
|
||||
ICE_MAC_IPV6_ESP;
|
||||
goto out;
|
||||
case VIRTCHNL_PROTO_HDR_AH:
|
||||
if (is_ipv4)
|
||||
ptype = ICE_MAC_IPV4_AH;
|
||||
else if (is_ipv6)
|
||||
ptype = ICE_MAC_IPV6_AH;
|
||||
goto out;
|
||||
case VIRTCHNL_PROTO_HDR_PFCP:
|
||||
if (is_ipv4)
|
||||
ptype = ICE_MAC_IPV4_PFCP_SESSION;
|
||||
else if (is_ipv6)
|
||||
ptype = ICE_MAC_IPV6_PFCP_SESSION;
|
||||
goto out;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
out:
|
||||
return ice_hw_ptype_ena(&vf->pf->hw, ptype);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_vc_parse_rss_cfg - parses hash fields and headers from
|
||||
* a specific virtchnl RSS cfg
|
||||
@ -2578,18 +2554,10 @@ ice_vc_parse_rss_cfg(struct ice_hw *hw, struct virtchnl_rss_cfg *rss_cfg,
|
||||
const struct ice_vc_hdr_match_type *hdr_list;
|
||||
int i, hf_list_len, hdr_list_len;
|
||||
|
||||
if (!strncmp(hw->active_pkg_name, "ICE COMMS Package",
|
||||
sizeof(hw->active_pkg_name))) {
|
||||
hf_list = ice_vc_hash_field_list_comms;
|
||||
hf_list_len = ARRAY_SIZE(ice_vc_hash_field_list_comms);
|
||||
hdr_list = ice_vc_hdr_list_comms;
|
||||
hdr_list_len = ARRAY_SIZE(ice_vc_hdr_list_comms);
|
||||
} else {
|
||||
hf_list = ice_vc_hash_field_list_os;
|
||||
hf_list_len = ARRAY_SIZE(ice_vc_hash_field_list_os);
|
||||
hdr_list = ice_vc_hdr_list_os;
|
||||
hdr_list_len = ARRAY_SIZE(ice_vc_hdr_list_os);
|
||||
}
|
||||
hf_list = ice_vc_hash_field_list;
|
||||
hf_list_len = ARRAY_SIZE(ice_vc_hash_field_list);
|
||||
hdr_list = ice_vc_hdr_list;
|
||||
hdr_list_len = ARRAY_SIZE(ice_vc_hdr_list);
|
||||
|
||||
for (i = 0; i < rss_cfg->proto_hdrs.count; i++) {
|
||||
struct virtchnl_proto_hdr *proto_hdr =
|
||||
@ -2691,10 +2659,15 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add)
|
||||
goto error_param;
|
||||
}
|
||||
|
||||
if (!ice_vc_validate_pattern(vf, &rss_cfg->proto_hdrs)) {
|
||||
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
|
||||
goto error_param;
|
||||
}
|
||||
|
||||
if (rss_cfg->rss_algorithm == VIRTCHNL_RSS_ALG_R_ASYMMETRIC) {
|
||||
struct ice_vsi_ctx *ctx;
|
||||
enum ice_status status;
|
||||
u8 lut_type, hash_type;
|
||||
int status;
|
||||
|
||||
lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI;
|
||||
hash_type = add ? ICE_AQ_VSI_Q_OPT_RSS_XOR :
|
||||
@ -2723,9 +2696,8 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add)
|
||||
|
||||
status = ice_update_vsi(hw, vsi->idx, ctx, NULL);
|
||||
if (status) {
|
||||
dev_err(dev, "update VSI for RSS failed, err %s aq_err %s\n",
|
||||
ice_stat_str(status),
|
||||
ice_aq_str(hw->adminq.sq_last_status));
|
||||
dev_err(dev, "update VSI for RSS failed, err %d aq_err %s\n",
|
||||
status, ice_aq_str(hw->adminq.sq_last_status));
|
||||
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
|
||||
} else {
|
||||
vsi->info.q_opt_rss = ctx->info.q_opt_rss;
|
||||
@ -2750,19 +2722,18 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add)
|
||||
vsi->vsi_num, v_ret);
|
||||
}
|
||||
} else {
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
status = ice_rem_rss_cfg(hw, vsi->idx, hash_flds,
|
||||
addl_hdrs);
|
||||
/* We just ignore ICE_ERR_DOES_NOT_EXIST, because
|
||||
* if two configurations share the same profile remove
|
||||
* one of them actually removes both, since the
|
||||
* profile is deleted.
|
||||
/* We just ignore -ENOENT, because if two configurations
|
||||
* share the same profile remove one of them actually
|
||||
* removes both, since the profile is deleted.
|
||||
*/
|
||||
if (status && status != ICE_ERR_DOES_NOT_EXIST) {
|
||||
if (status && status != -ENOENT) {
|
||||
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
|
||||
dev_err(dev, "ice_rem_rss_cfg failed for VF ID:%d, error:%s\n",
|
||||
vf->vf_id, ice_stat_str(status));
|
||||
dev_err(dev, "ice_rem_rss_cfg failed for VF ID:%d, error:%d\n",
|
||||
vf->vf_id, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2920,7 +2891,6 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)
|
||||
struct ice_pf *pf = np->vsi->back;
|
||||
struct ice_vsi_ctx *ctx;
|
||||
struct ice_vsi *vf_vsi;
|
||||
enum ice_status status;
|
||||
struct device *dev;
|
||||
struct ice_vf *vf;
|
||||
int ret;
|
||||
@ -2970,12 +2940,10 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)
|
||||
ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S));
|
||||
}
|
||||
|
||||
status = ice_update_vsi(&pf->hw, vf_vsi->idx, ctx, NULL);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to %sable spoofchk on VF %d VSI %d\n error %s\n",
|
||||
ena ? "en" : "dis", vf->vf_id, vf_vsi->vsi_num,
|
||||
ice_stat_str(status));
|
||||
ret = -EIO;
|
||||
ret = ice_update_vsi(&pf->hw, vf_vsi->idx, ctx, NULL);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to %sable spoofchk on VF %d VSI %d\n error %d\n",
|
||||
ena ? "en" : "dis", vf->vf_id, vf_vsi->vsi_num, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -3021,10 +2989,10 @@ bool ice_is_any_vf_in_promisc(struct ice_pf *pf)
|
||||
static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
|
||||
{
|
||||
enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;
|
||||
enum ice_status mcast_status = 0, ucast_status = 0;
|
||||
bool rm_promisc, alluni = false, allmulti = false;
|
||||
struct virtchnl_promisc_info *info =
|
||||
(struct virtchnl_promisc_info *)msg;
|
||||
int mcast_err = 0, ucast_err = 0;
|
||||
struct ice_pf *pf = vf->pf;
|
||||
struct ice_vsi *vsi;
|
||||
struct device *dev;
|
||||
@ -3106,24 +3074,21 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
|
||||
ucast_m = ICE_UCAST_PROMISC_BITS;
|
||||
}
|
||||
|
||||
ucast_status = ice_vf_set_vsi_promisc(vf, vsi, ucast_m,
|
||||
!alluni);
|
||||
if (ucast_status) {
|
||||
dev_err(dev, "%sable Tx/Rx filter promiscuous mode on VF-%d failed\n",
|
||||
alluni ? "en" : "dis", vf->vf_id);
|
||||
v_ret = ice_err_to_virt_err(ucast_status);
|
||||
}
|
||||
if (alluni)
|
||||
ucast_err = ice_vf_set_vsi_promisc(vf, vsi, ucast_m);
|
||||
else
|
||||
ucast_err = ice_vf_clear_vsi_promisc(vf, vsi, ucast_m);
|
||||
|
||||
mcast_status = ice_vf_set_vsi_promisc(vf, vsi, mcast_m,
|
||||
!allmulti);
|
||||
if (mcast_status) {
|
||||
dev_err(dev, "%sable Tx/Rx filter promiscuous mode on VF-%d failed\n",
|
||||
allmulti ? "en" : "dis", vf->vf_id);
|
||||
v_ret = ice_err_to_virt_err(mcast_status);
|
||||
}
|
||||
if (allmulti)
|
||||
mcast_err = ice_vf_set_vsi_promisc(vf, vsi, mcast_m);
|
||||
else
|
||||
mcast_err = ice_vf_clear_vsi_promisc(vf, vsi, mcast_m);
|
||||
|
||||
if (ucast_err || mcast_err)
|
||||
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
|
||||
}
|
||||
|
||||
if (!mcast_status) {
|
||||
if (!mcast_err) {
|
||||
if (allmulti &&
|
||||
!test_and_set_bit(ICE_VF_STATE_MC_PROMISC, vf->vf_states))
|
||||
dev_info(dev, "VF %u successfully set multicast promiscuous mode\n",
|
||||
@ -3133,7 +3098,7 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
|
||||
vf->vf_id);
|
||||
}
|
||||
|
||||
if (!ucast_status) {
|
||||
if (!ucast_err) {
|
||||
if (alluni && !test_and_set_bit(ICE_VF_STATE_UC_PROMISC, vf->vf_states))
|
||||
dev_info(dev, "VF %u successfully set unicast promiscuous mode\n",
|
||||
vf->vf_id);
|
||||
@ -3813,8 +3778,7 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,
|
||||
{
|
||||
struct device *dev = ice_pf_to_dev(vf->pf);
|
||||
u8 *mac_addr = vc_ether_addr->addr;
|
||||
enum ice_status status;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
/* device MAC already added */
|
||||
if (ether_addr_equal(mac_addr, vf->dev_lan_addr.addr))
|
||||
@ -3825,18 +3789,17 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
status = ice_fltr_add_mac(vsi, mac_addr, ICE_FWD_TO_VSI);
|
||||
if (status == ICE_ERR_ALREADY_EXISTS) {
|
||||
ret = ice_fltr_add_mac(vsi, mac_addr, ICE_FWD_TO_VSI);
|
||||
if (ret == -EEXIST) {
|
||||
dev_dbg(dev, "MAC %pM already exists for VF %d\n", mac_addr,
|
||||
vf->vf_id);
|
||||
/* don't return since we might need to update
|
||||
* the primary MAC in ice_vfhw_mac_add() below
|
||||
*/
|
||||
ret = -EEXIST;
|
||||
} else if (status) {
|
||||
dev_err(dev, "Failed to add MAC %pM for VF %d\n, error %s\n",
|
||||
mac_addr, vf->vf_id, ice_stat_str(status));
|
||||
return -EIO;
|
||||
} else if (ret) {
|
||||
dev_err(dev, "Failed to add MAC %pM for VF %d\n, error %d\n",
|
||||
mac_addr, vf->vf_id, ret);
|
||||
return ret;
|
||||
} else {
|
||||
vf->num_mac++;
|
||||
}
|
||||
@ -3913,20 +3876,20 @@ ice_vc_del_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,
|
||||
{
|
||||
struct device *dev = ice_pf_to_dev(vf->pf);
|
||||
u8 *mac_addr = vc_ether_addr->addr;
|
||||
enum ice_status status;
|
||||
int status;
|
||||
|
||||
if (!ice_can_vf_change_mac(vf) &&
|
||||
ether_addr_equal(vf->dev_lan_addr.addr, mac_addr))
|
||||
return 0;
|
||||
|
||||
status = ice_fltr_remove_mac(vsi, mac_addr, ICE_FWD_TO_VSI);
|
||||
if (status == ICE_ERR_DOES_NOT_EXIST) {
|
||||
if (status == -ENOENT) {
|
||||
dev_err(dev, "MAC %pM does not exist for VF %d\n", mac_addr,
|
||||
vf->vf_id);
|
||||
return -ENOENT;
|
||||
} else if (status) {
|
||||
dev_err(dev, "Failed to delete MAC %pM for VF %d, error %s\n",
|
||||
mac_addr, vf->vf_id, ice_stat_str(status));
|
||||
dev_err(dev, "Failed to delete MAC %pM for VF %d, error %d\n",
|
||||
mac_addr, vf->vf_id, status);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@ -5289,9 +5252,9 @@ ice_is_malicious_vf(struct ice_pf *pf, struct ice_rq_event_info *event,
|
||||
s16 vf_id = le16_to_cpu(event->desc.retval);
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_mbx_data mbxdata;
|
||||
enum ice_status status;
|
||||
bool malvf = false;
|
||||
struct ice_vf *vf;
|
||||
int status;
|
||||
|
||||
if (ice_validate_vf_id(pf, vf_id))
|
||||
return false;
|
||||
|
@ -203,6 +203,8 @@ void
|
||||
ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);
|
||||
void ice_print_vfs_mdd_events(struct ice_pf *pf);
|
||||
void ice_print_vf_rx_mdd_event(struct ice_vf *vf);
|
||||
bool
|
||||
ice_vc_validate_pattern(struct ice_vf *vf, struct virtchnl_proto_hdrs *proto);
|
||||
struct ice_vsi *ice_vf_ctrl_vsi_setup(struct ice_vf *vf);
|
||||
int
|
||||
ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,
|
||||
|
Loading…
x
Reference in New Issue
Block a user