ice: staticization refactor
Subsystems (2)
v2 cover ice: staticization refactor
ice: refactor methods to make them static
This series of patches refactor some ice driver files in order to make as many methods as possible static.
Also there's a minor cleanup of unused methods.
Jan Sokolowski (6):
ice: remove unused methods
ice: refactor ice_ddp to make functions static
ice: refactor ice_lib to make functions static
ice: refactor ice_vf_lib to make functions static
ice: refactor ice_sched to make functions static
ice: refactor ice_ptp_hw to make functions static
drivers/net/ethernet/intel/ice/ice_ddp.c | 117 ++--- drivers/net/ethernet/intel/ice/ice_ddp.h | 10 - drivers/net/ethernet/intel/ice/ice_lib.c | 85 ++-- drivers/net/ethernet/intel/ice/ice_lib.h | 5 - drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 25 +- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 4 - drivers/net/ethernet/intel/ice/ice_sched.c | 2 +- drivers/net/ethernet/intel/ice/ice_sched.h | 4 - drivers/net/ethernet/intel/ice/ice_switch.c | 48 -- drivers/net/ethernet/intel/ice/ice_switch.h | 1 - drivers/net/ethernet/intel/ice/ice_vf_lib.c | 468 +++++++++--------- .../ethernet/intel/ice/ice_vf_lib_private.h | 2 - 12 files changed, 332 insertions(+), 439 deletions(-)
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 1/6 ice: remove unused methods
Following methods were found to no longer be in use:ice_is_pca9575_presentice_mac_fltr_existice_napi_del
Remove them.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 15 ------- drivers/net/ethernet/intel/ice/ice_lib.h | 2 - drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 19 -------- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 1 - drivers/net/ethernet/intel/ice/ice_switch.c | 48 --------------------- drivers/net/ethernet/intel/ice/ice_switch.h | 1 - 6 files changed, 86 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +0 -15
@@ -2943,21 +2943,6 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi)synchronize_irq (vsi->q_vectors[i]->irq.virq); } -/** -* ice_napi_del - Remove NAPI handler for the VSI -* @vsi: VSI for which NAPI handler is to be removed -*/ -void ice_napi_del (struct ice_vsi *vsi) -{ -int v_idx; - -if (!vsi->netdev) -return ; - -ice_for_each_q_vector (vsi, v_idx) -netif_napi_del (&vsi->q_vectors[v_idx]->napi); -} -/** * ice_vsi_release - Delete a VSI and free its resources * @vsi: the VSI being removed
drivers/net/ethernet/intel/ice/ice_lib.h +0 -2
@@ -93,8 +93,6 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc);struct ice_vsi *ice_vsi_setup (struct ice_pf *pf,struct ice_vsi_cfg_params *params); -void ice_napi_del (struct ice_vsi *vsi); -int ice_vsi_release (struct ice_vsi *vsi);void ice_vsi_close (struct ice_vsi *vsi);
drivers/net/ethernet/intel/ice/ice_ptp_hw.c +0 -19
@@ -3113,25 +3113,6 @@ int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data)return ice_aq_read_i2c (hw, link_topo,0 , addr,1 , data,NULL ); } -/** -* ice_is_pca9575_present -* @hw: pointer to the hw struct -* -* Check if the SW IO expander is present in the netlist -*/ -bool ice_is_pca9575_present (struct ice_hw *hw) -{ -u16 handle =0 ; -int status; - -if (!ice_is_e810t (hw)) -return false; - - status =ice_get_pca9575_handle (hw, &handle); - -return !status && handle; -} -/* Device agnostic functions * * The following functions implement shared behavior common to both E822 and
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +0 -1
@@ -202,7 +202,6 @@ int ice_ptp_init_phy_e810(struct ice_hw *hw);int ice_read_sma_ctrl_e810t (struct ice_hw *hw,u8 *data);int ice_write_sma_ctrl_e810t (struct ice_hw *hw,u8 data);int ice_read_pca9575_reg_e810t (struct ice_hw *hw,u8 offset,u8 *data); -bool ice_is_pca9575_present (struct ice_hw *hw);void ice_ptp_init_phy_model (struct ice_hw *hw);
drivers/net/ethernet/intel/ice/ice_switch.c +0 -48
54 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_switch.h +0 -1
@@ -371,7 +371,6 @@ int ice_add_vlan(struct ice_hw *hw, struct list_head *m_list);int ice_remove_vlan (struct ice_hw *hw,struct list_head *v_list);int ice_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);
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 2/6 ice: refactor ice_ddp to make functions static
In reply to Jan SokolowskiRefactor ice_ddp.c/h in order to make as many methods as possible static.
--- drivers/net/ethernet/intel/ice/ice_ddp.c | 117 ++++++++++++----------- drivers/net/ethernet/intel/ice/ice_ddp.h | 10 -- 2 files changed, 59 insertions(+), 68 deletions(-)
drivers/net/ethernet/intel/ice/ice_ddp.c +59 -58
@@ -30,7 +30,7 @@ static const struct ice_tunnel_type_scan tnls[] = {* Verifies various attributes of the package file, including length, format * version, and the requirement of at least one segment. */ -enum ice_ddp_state ice_verify_pkg (struct ice_pkg_hdr *pkg,u32 len) +static enum ice_ddp_state ice_verify_pkg (struct ice_pkg_hdr *pkg,u32 len) {u32 seg_count;u32 i;
@@ -118,7 +118,7 @@ static enum ice_ddp_state ice_chk_pkg_version(struct ice_pkg_ver *pkg_ver)* * This helper function validates a buffer's header. */ -struct ice_buf_hdr *ice_pkg_val_buf (struct ice_buf *buf) +static struct ice_buf_hdr *ice_pkg_val_buf (struct ice_buf *buf) {struct ice_buf_hdr *hdr;u16 section_count;
@@ -1152,6 +1152,54 @@ static void ice_release_global_cfg_lock(struct ice_hw *hw)ice_release_res (hw,ICE_GLOBAL_CFG_LOCK_RES_ID ); } +/** +* ice_aq_download_pkg +* @hw: pointer to the hardware structure +* @pkg_buf: the package buffer to transfer +* @buf_size: the size of the package buffer +* @last_buf: last buffer indicator +* @error_offset: returns error offset +* @error_info: returns error information +* @cd: pointer to command details structure or NULL +* +* Download Package (0x0C40) +*/ +static int +ice_aq_download_pkg (struct ice_hw *hw,struct ice_buf_hdr *pkg_buf, +u16 buf_size,bool last_buf,u32 *error_offset, +u32 *error_info,struct ice_sq_cd *cd) +{ +struct ice_aqc_download_pkg *cmd; +struct ice_aq_desc desc; +int status; + +if (error_offset) + *error_offset =0 ; +if (error_info) + *error_info =0 ; + + cmd = &desc.params.download_pkg; +ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_download_pkg); + desc.flags |=cpu_to_le16 (ICE_AQ_FLAG_RD ); + +if (last_buf) + cmd->flags |=ICE_AQC_DOWNLOAD_PKG_LAST_BUF ; + + status =ice_aq_send_cmd (hw, &desc, pkg_buf, buf_size, cd); +if (status == -EIO ) { +/* Read error from buffer only when the FW returned an error */ +struct ice_aqc_download_pkg_resp *resp; + + resp = (struct ice_aqc_download_pkg_resp *)pkg_buf; +if (error_offset) + *error_offset =le32_to_cpu (resp->error_offset); +if (error_info) + *error_info =le32_to_cpu (resp->error_info); + } + +return status; +} +/** * ice_dwnld_cfg_bufs * @hw: pointer to the hardware structure
@@ -1294,20 +1342,20 @@ static enum ice_ddp_state ice_download_pkg(struct ice_hw *hw, }/** -* ice_aq_download_pkg +* ice_aq_update_pkg * @hw: pointer to the hardware structure -* @pkg_buf: the package buffer to transfer -* @buf_size: the size of the package buffer +* @pkg_buf: the package cmd buffer +* @buf_size: the size of the package cmd buffer * @last_buf: last buffer indicator * @error_offset: returns error offset * @error_info: returns error information * @cd: pointer to command details structure or NULL * -* Download Package (0x0C40) +* Update Package (0x0C42) */ -int ice_aq_download_pkg (struct ice_hw *hw,struct ice_buf_hdr *pkg_buf, -u16 buf_size,bool last_buf,u32 *error_offset, -u32 *error_info,struct ice_sq_cd *cd) +static int ice_aq_update_pkg (struct ice_hw *hw,struct ice_buf_hdr *pkg_buf, +u16 buf_size,bool last_buf,u32 *error_offset, +u32 *error_info,struct ice_sq_cd *cd) {struct ice_aqc_download_pkg *cmd;struct ice_aq_desc desc;
@@ -1319,7 +1367,7 @@ int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf, *error_info =0 ; cmd = &desc.params.download_pkg; -ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_download_pkg); +ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_update_pkg); desc.flags |=cpu_to_le16 (ICE_AQ_FLAG_RD );if (last_buf)
@@ -1360,53 +1408,6 @@ int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,return ice_aq_send_cmd (hw, &desc, pkg_buf, buf_size, cd); } -/** -* ice_aq_update_pkg -* @hw: pointer to the hardware structure -* @pkg_buf: the package cmd buffer -* @buf_size: the size of the package cmd buffer -* @last_buf: last buffer indicator -* @error_offset: returns error offset -* @error_info: returns error information -* @cd: pointer to command details structure or NULL -* -* Update Package (0x0C42) -*/ -static int ice_aq_update_pkg (struct ice_hw *hw,struct ice_buf_hdr *pkg_buf, -u16 buf_size,bool last_buf,u32 *error_offset, -u32 *error_info,struct ice_sq_cd *cd) -{ -struct ice_aqc_download_pkg *cmd; -struct ice_aq_desc desc; -int status; - -if (error_offset) - *error_offset =0 ; -if (error_info) - *error_info =0 ; - - cmd = &desc.params.download_pkg; -ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_update_pkg); - desc.flags |=cpu_to_le16 (ICE_AQ_FLAG_RD ); - -if (last_buf) - cmd->flags |=ICE_AQC_DOWNLOAD_PKG_LAST_BUF ; - - status =ice_aq_send_cmd (hw, &desc, pkg_buf, buf_size, cd); -if (status == -EIO ) { -/* Read error from buffer only when the FW returned an error */ -struct ice_aqc_download_pkg_resp *resp; - - resp = (struct ice_aqc_download_pkg_resp *)pkg_buf; -if (error_offset) - *error_offset =le32_to_cpu (resp->error_offset); -if (error_info) - *error_info =le32_to_cpu (resp->error_info); - } - -return status; -} -/** * ice_update_pkg_no_lock * @hw: pointer to the hardware structure
@@ -1460,7 +1461,7 @@ int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count)return status; } -/** +/* * ice_find_seg_in_pkg * @hw: pointer to the hardware structure * @seg_type: the segment type to search for (i.e., SEGMENT_TYPE_CPK)
drivers/net/ethernet/intel/ice/ice_ddp.h +0 -10
@@ -416,21 +416,13 @@ struct ice_pkg_enum {void *(*handler)(u32 sect_type,void *section,u32 index,u32 *offset); }; -int ice_aq_download_pkg (struct ice_hw *hw,struct ice_buf_hdr *pkg_buf, -u16 buf_size,bool last_buf,u32 *error_offset, -u32 *error_info,struct ice_sq_cd *cd);int ice_aq_upload_section (struct ice_hw *hw,struct ice_buf_hdr *pkg_buf,u16 buf_size,struct ice_sq_cd *cd);void *ice_pkg_buf_alloc_section (struct ice_buf_build *bld,u32 type,u16 size); -enum ice_ddp_state ice_verify_pkg (struct ice_pkg_hdr *pkg,u32 len); -struct ice_buf_build *ice_pkg_buf_alloc (struct ice_hw *hw); -struct ice_generic_seg_hdr *ice_find_seg_in_pkg (struct ice_hw *hw,u32 seg_type, -struct ice_pkg_hdr *pkg_hdr); -int ice_update_pkg_no_lock (struct ice_hw *hw,struct ice_buf *bufs,u32 count);int ice_update_pkg (struct ice_hw *hw,struct ice_buf *bufs,u32 count);
@@ -439,6 +431,4 @@ u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld);void *ice_pkg_enum_section (struct ice_seg *ice_seg,struct ice_pkg_enum *state,u32 sect_type); -struct ice_buf_hdr *ice_pkg_val_buf (struct ice_buf *buf); -#endif
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
kernel test robot
build botRe: [Intel-wired-lan] [PATCH iwl-next v2 2/6] ice: refactor ice_ddp to make functions static
kernel test robot noticed the following build warnings:
Hi Jan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tnguy-next-queue/dev-queue]
url: https://github.com/intel-lab-lkp/linux/commits/Jan-Sokolowski/ice-remove-unused-methods/20230801-195105 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20230801115309.697331-3-jan.sokolowski%40intel.com patch subject: [Intel-wired-lan] [PATCH iwl-next v2 2/6] ice: refactor ice_ddp to make functions static config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230801/[email protected]/config) compiler: alpha-linux-gcc (GCC) 12.3.0 reproduce: (https://download.01.org/0day-ci/archive/20230801/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/intel/ice/ice_ddp.c:1474:29: warning: no previous prototype for 'ice_find_seg_in_pkg' [-Wmissing-prototypes]
1474 | struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
| ^~~~~~~~~~~~~~~~~~~
vim +/ice_find_seg_in_pkg +1474 drivers/net/ethernet/intel/ice/ice_ddp.c
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1463
b1e9d9a5d80ff6 Jan Sokolowski 2023-08-01 1464 /*
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1465 * ice_find_seg_in_pkg
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1466 * @hw: pointer to the hardware structure
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1467 * @seg_type: the segment type to search for (i.e., SEGMENT_TYPE_CPK)
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1468 * @pkg_hdr: pointer to the package header to be searched
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1469 *
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1470 * This function searches a package file for a particular segment type. On
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1471 * success it returns a pointer to the segment header, otherwise it will
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1472 * return NULL.
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1473 */
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 @1474 struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1475 struct ice_pkg_hdr *pkg_hdr)
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1476 {
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1477 u32 i;
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1478
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1479 ice_debug(hw, ICE_DBG_PKG, "Package format version: %d.%d.%d.%d\n",
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1480 pkg_hdr->pkg_format_ver.major, pkg_hdr->pkg_format_ver.minor,
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1481 pkg_hdr->pkg_format_ver.update,
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1482 pkg_hdr->pkg_format_ver.draft);
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1483
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1484 /* Search all package segments for the requested segment type */
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1485 for (i = 0; i < le32_to_cpu(pkg_hdr->seg_count); i++) {
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1486 struct ice_generic_seg_hdr *seg;
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1487
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1488 seg = (struct ice_generic_seg_hdr
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1489 *)((u8 *)pkg_hdr +
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1490 le32_to_cpu(pkg_hdr->seg_offset[i]));
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1491
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1492 if (le32_to_cpu(seg->seg_type) == seg_type)
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1493 return seg;
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1494 }
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1495
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1496 return NULL;
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1497 }
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 1498 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v2 3/6 ice: refactor ice_lib to make functions static
In reply to Jan SokolowskiRefactor ice_lib.c/h in order to make as many methods as possible static.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 70 ++++++++++++------------ drivers/net/ethernet/intel/ice/ice_lib.h | 3 - 2 files changed, 35 insertions(+), 38 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +35 -35
@@ -1227,6 +1227,20 @@ ice_chnl_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) ctxt->info.q_mapping[1 ] =cpu_to_le16 (qcount); } +/** +* ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not +* @vsi: VSI to check whether or not VLAN pruning is enabled. +* +* returns true if Rx VLAN pruning is enabled and false otherwise. +*/ +static bool ice_vsi_is_vlan_pruning_ena (struct ice_vsi *vsi) +{ +if (!vsi) +return false; + +return (vsi->info.sw_flags2 &ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA ); +} +/** * ice_vsi_init - Create and initialize a VSI * @vsi: the VSI being configured
@@ -1684,6 +1698,27 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi) vsi_num, status); } +/** +* ice_vsi_cfg_frame_size - setup max frame size and Rx buffer length +* @vsi: VSI +*/ +static void ice_vsi_cfg_frame_size (struct ice_vsi *vsi) +{ +if (!vsi->netdev ||test_bit (ICE_FLAG_LEGACY_RX , vsi->back->flags)) { + vsi->max_frame =ICE_MAX_FRAME_LEGACY_RX ; + vsi->rx_buf_len =ICE_RXBUF_1664 ; +#if (PAGE_SIZE <8192 ) + } else if (!ICE_2K_TOO_SMALL_WITH_PADDING && + (vsi->netdev->mtu <=ETH_DATA_LEN )) { + vsi->max_frame =ICE_RXBUF_1536 -NET_IP_ALIGN ; + vsi->rx_buf_len =ICE_RXBUF_1536 -NET_IP_ALIGN ; +#endif + }else { + vsi->max_frame =ICE_AQ_SET_MAC_FRAME_SIZE_MAX ; + vsi->rx_buf_len =ICE_RXBUF_3072 ; + } +} +/** * ice_pf_state_is_nominal - checks the PF for nominal state * @pf: pointer to PF to check
@@ -1758,27 +1793,6 @@ void ice_update_eth_stats(struct ice_vsi *vsi) vsi->stat_offsets_loaded = true; } -/** -* ice_vsi_cfg_frame_size - setup max frame size and Rx buffer length -* @vsi: VSI -*/ -void ice_vsi_cfg_frame_size (struct ice_vsi *vsi) -{ -if (!vsi->netdev ||test_bit (ICE_FLAG_LEGACY_RX , vsi->back->flags)) { - vsi->max_frame =ICE_MAX_FRAME_LEGACY_RX ; - vsi->rx_buf_len =ICE_RXBUF_1664 ; -#if (PAGE_SIZE <8192 ) - } else if (!ICE_2K_TOO_SMALL_WITH_PADDING && - (vsi->netdev->mtu <=ETH_DATA_LEN )) { - vsi->max_frame =ICE_RXBUF_1536 -NET_IP_ALIGN ; - vsi->rx_buf_len =ICE_RXBUF_1536 -NET_IP_ALIGN ; -#endif - }else { - vsi->max_frame =ICE_AQ_SET_MAC_FRAME_SIZE_MAX ; - vsi->rx_buf_len =ICE_RXBUF_3072 ; - } -} -/** * ice_write_qrxflxp_cntxt - write/configure QRXFLXP_CNTXT register * @hw: HW pointer
@@ -2185,20 +2199,6 @@ bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi)return false; } -/** -* ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not -* @vsi: VSI to check whether or not VLAN pruning is enabled. -* -* returns true if Rx VLAN pruning is enabled and false otherwise. -*/ -bool ice_vsi_is_vlan_pruning_ena (struct ice_vsi *vsi) -{ -if (!vsi) -return false; - -return (vsi->info.sw_flags2 &ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA ); -} -static void ice_vsi_set_tc_cfg (struct ice_vsi *vsi) {if (!test_bit (ICE_FLAG_DCB_ENA , vsi->back->flags)) {
drivers/net/ethernet/intel/ice/ice_lib.h +0 -3
@@ -76,8 +76,6 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi);int ice_vsi_stop_xdp_tx_rings (struct ice_vsi *vsi); -bool ice_vsi_is_vlan_pruning_ena (struct ice_vsi *vsi); -void ice_cfg_sw_lldp (struct ice_vsi *vsi,bool tx,bool create);int ice_set_link (struct ice_vsi *vsi,bool ena);
@@ -128,7 +126,6 @@ void ice_update_tx_ring_stats(struct ice_tx_ring *ring, u64 pkts, u64 bytes);void ice_update_rx_ring_stats (struct ice_rx_ring *ring,u64 pkts,u64 bytes); -void ice_vsi_cfg_frame_size (struct ice_vsi *vsi);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);
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tony Nguyen
maintainerRe: [Intel-wired-lan] [PATCH iwl-next v2 3/6] ice: refactor ice_lib to make functions static
Quoted 2 lines · Jan Sokolowski
Refactor ice_lib.c/h in order to make as many methods as possible static.
Please word the commit titles and messages to reflect the changes you are making and not a generic one for every patch/file.
Quoted 14 lines
Signed-off-by Jan Sokolowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 70 ++++++++++++------------ drivers/net/ethernet/intel/ice/ice_lib.h | 3 - 2 files changed, 35 insertions(+), 38 deletions(-)drivers/net/ethernet/intel/ice/ice_lib.c +0
-0@@ -1227,6 +1227,20 @@ ice_chnl_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) ctxt->info.q_mapping[1 ] =cpu_to_le16 (qcount); }
drivers/net/ethernet/intel/ice/ice_lib.c ice_chnl_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) · line 1239
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_lib.c +10
-0+/** +* ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not +* @vsi: VSI to check whether or not VLAN pruning is enabled. +* +* returns true if Rx VLAN pruning is enabled and false otherwise. +*/ +static bool ice_vsi_is_vlan_pruning_ena (struct ice_vsi *vsi) +{ +if (!vsi) +return false;
Now that this is static, it looks like this is an unneeded defensive check. Can you add a new patch on the series to clean this up?
drivers/net/ethernet/intel/ice/ice_lib.c ice_chnl_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) · line 1241
Quoted 1 line
drivers/net/ethernet/intel/ice/ice_lib.c +1
-0+return (vsi->info.sw_flags2 &ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA );
Maybe remove these parentheses as well.
Quoted 96 lines
drivers/net/ethernet/intel/ice/ice_lib.c +23
-35+} +/** * ice_vsi_init - Create and initialize a VSI * @vsi: the VSI being configured @@ -1684,6 +1698,27 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi) vsi_num, status); } +/** +* ice_vsi_cfg_frame_size - setup max frame size and Rx buffer length +* @vsi: VSI +*/ +static void ice_vsi_cfg_frame_size (struct ice_vsi *vsi) +{ +if (!vsi->netdev ||test_bit (ICE_FLAG_LEGACY_RX , vsi->back->flags)) { + vsi->max_frame =ICE_MAX_FRAME_LEGACY_RX ; + vsi->rx_buf_len =ICE_RXBUF_1664 ; +#if (PAGE_SIZE <8192 ) + } else if (!ICE_2K_TOO_SMALL_WITH_PADDING && + (vsi->netdev->mtu <=ETH_DATA_LEN )) { + vsi->max_frame =ICE_RXBUF_1536 -NET_IP_ALIGN ; + vsi->rx_buf_len =ICE_RXBUF_1536 -NET_IP_ALIGN ; +#endif + }else { + vsi->max_frame =ICE_AQ_SET_MAC_FRAME_SIZE_MAX ; + vsi->rx_buf_len =ICE_RXBUF_3072 ; + } +} +/** * ice_pf_state_is_nominal - checks the PF for nominal state * @pf: pointer to PF to check @@ -1758,27 +1793,6 @@ void ice_update_eth_stats(struct ice_vsi *vsi) vsi->stat_offsets_loaded = true; } -/** -* ice_vsi_cfg_frame_size - setup max frame size and Rx buffer length -* @vsi: VSI -*/ -void ice_vsi_cfg_frame_size (struct ice_vsi *vsi) -{ -if (!vsi->netdev ||test_bit (ICE_FLAG_LEGACY_RX , vsi->back->flags)) { - vsi->max_frame =ICE_MAX_FRAME_LEGACY_RX ; - vsi->rx_buf_len =ICE_RXBUF_1664 ; -#if (PAGE_SIZE <8192 ) - } else if (!ICE_2K_TOO_SMALL_WITH_PADDING && - (vsi->netdev->mtu <=ETH_DATA_LEN )) { - vsi->max_frame =ICE_RXBUF_1536 -NET_IP_ALIGN ; - vsi->rx_buf_len =ICE_RXBUF_1536 -NET_IP_ALIGN ; -#endif - }else { - vsi->max_frame =ICE_AQ_SET_MAC_FRAME_SIZE_MAX ; - vsi->rx_buf_len =ICE_RXBUF_3072 ; - } -} -/** * ice_write_qrxflxp_cntxt - write/configure QRXFLXP_CNTXT register * @hw: HW pointer @@ -2185,20 +2199,6 @@ bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi)return false; } -/** -* ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not -* @vsi: VSI to check whether or not VLAN pruning is enabled. -* -* returns true if Rx VLAN pruning is enabled and false otherwise. -*/ -bool ice_vsi_is_vlan_pruning_ena (struct ice_vsi *vsi) -{ -if (!vsi) -return false; - -return (vsi->info.sw_flags2 &ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA ); -} -static void ice_vsi_set_tc_cfg (struct ice_vsi *vsi) {if (!test_bit (ICE_FLAG_DCB_ENA , vsi->back->flags)) {drivers/net/ethernet/intel/ice/ice_lib.h +0
-2@@ -76,8 +76,6 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi);int ice_vsi_stop_xdp_tx_rings (struct ice_vsi *vsi); -bool ice_vsi_is_vlan_pruning_ena (struct ice_vsi *vsi); -void ice_cfg_sw_lldp (struct ice_vsi *vsi,bool tx,bool create);int ice_set_link (struct ice_vsi *vsi,bool ena);
drivers/net/ethernet/intel/ice/ice_lib.h void ice_update_tx_ring_stats(struct ice_tx_ring *ring, u64 pkts, u64 bytes); · line 131
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_lib.h +0
-1@@ -128,7 +126,6 @@ void ice_update_tx_ring_stats(struct ice_tx_ring *ring, u64 pkts, u64 bytes);void ice_update_rx_ring_stats (struct ice_rx_ring *ring,u64 pkts,u64 bytes); -void ice_vsi_cfg_frame_size (struct ice_vsi *vsi);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);
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 4/6 ice: refactor ice_vf_lib to make functions static
In reply to Jan SokolowskiRefactor ice_vf_lib.c/_private.h in order to make as many methods as possible static.
--- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 468 +++++++++--------- .../ethernet/intel/ice/ice_vf_lib_private.h | 2 - 2 files changed, 234 insertions(+), 236 deletions(-)
drivers/net/ethernet/intel/ice/ice_vf_lib.c +234 -234
@@ -322,6 +322,240 @@ static int ice_vf_rebuild_vsi(struct ice_vf *vf)return 0 ; } +/** +* ice_vf_rebuild_host_vlan_cfg - add VLAN 0 filter or rebuild the Port VLAN +* @vf: VF to add MAC filters for +* @vsi: Pointer to VSI +* +* Called after a VF VSI has been re-added/rebuilt during reset. The PF driver +* always re-adds either a VLAN 0 or port VLAN based filter after reset. +*/ +static int ice_vf_rebuild_host_vlan_cfg (struct ice_vf *vf,struct ice_vsi *vsi) +{ +struct ice_vsi_vlan_ops *vlan_ops =ice_get_compat_vsi_vlan_ops (vsi); +struct device *dev =ice_pf_to_dev (vf->pf); +int err; + +if (ice_vf_is_port_vlan_ena (vf)) { + err = vlan_ops->set_port_vlan (vsi, &vf->port_vlan_info); +if (err) { +dev_err (dev,"failed to configure port VLAN via VSI parameters for VF %u, error %d\n" , + vf->vf_id, err); +return err; + } + + err = vlan_ops->add_vlan (vsi, &vf->port_vlan_info); + }else { + err =ice_vsi_add_vlan_zero (vsi); + } + +if (err) { +dev_err (dev,"failed to add VLAN %u filter for VF %u during VF rebuild, error %d\n" , +ice_vf_is_port_vlan_ena (vf) ? +ice_vf_get_port_vlan_id (vf) :0 , vf->vf_id, err); +return err; + } + + err = vlan_ops->ena_rx_filtering (vsi); +if (err) +dev_warn (dev,"failed to enable Rx VLAN filtering for VF %d VSI %d during VF rebuild, error %d\n" , + vf->vf_id, vsi->idx, err); + +return 0 ; +} + +/** +* ice_vf_rebuild_host_tx_rate_cfg - re-apply the Tx rate limiting configuration +* @vf: VF to re-apply the configuration for +* +* Called after a VF VSI has been re-added/rebuild during reset. The PF driver +* needs to re-apply the host configured Tx rate limiting configuration. +*/ +static int ice_vf_rebuild_host_tx_rate_cfg (struct ice_vf *vf) +{ +struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf); +int err; + +if (WARN_ON (!vsi)) +return -EINVAL ; + +if (vf->min_tx_rate) { + err =ice_set_min_bw_limit (vsi, (u64 )vf->min_tx_rate *1000 ); +if (err) { +dev_err (dev,"failed to set min Tx rate to %d Mbps for VF %u, error %d\n" , + vf->min_tx_rate, vf->vf_id, err); +return err; + } + } + +if (vf->max_tx_rate) { + err =ice_set_max_bw_limit (vsi, (u64 )vf->max_tx_rate *1000 ); +if (err) { +dev_err (dev,"failed to set max Tx rate to %d Mbps for VF %u, error %d\n" , + vf->max_tx_rate, vf->vf_id, err); +return err; + } + } + +return 0 ; +} + +/** +* ice_vf_set_host_trust_cfg - set trust setting based on pre-reset value +* @vf: VF to configure trust setting for +*/ +static void ice_vf_set_host_trust_cfg (struct ice_vf *vf) +{ +if (vf->trusted) +set_bit (ICE_VIRTCHNL_VF_CAP_PRIVILEGE , &vf->vf_caps); +else +clear_bit (ICE_VIRTCHNL_VF_CAP_PRIVILEGE , &vf->vf_caps); +} + +/** +* ice_vf_rebuild_host_mac_cfg - add broadcast and the VF's perm_addr/LAA +* @vf: VF to add MAC filters for +* +* Called after a VF VSI has been re-added/rebuilt during reset. The PF driver +* always re-adds a broadcast filter and the VF's perm_addr/LAA after reset. +*/ +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); +u8 broadcast[ETH_ALEN ]; +int status; + +if (WARN_ON (!vsi)) +return -EINVAL ; + +if (ice_is_eswitch_mode_switchdev (vf->pf)) +return 0 ; + +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 %d\n" , + vf->vf_id, status); +return status; + } + + vf->num_mac++; + +if (is_valid_ether_addr (vf->hw_lan_addr)) { + status =ice_fltr_add_mac (vsi, vf->hw_lan_addr, +ICE_FWD_TO_VSI ); +if (status) { +dev_err (dev,"failed to add default unicast MAC filter %pM for VF %u, error %d\n" , + &vf->hw_lan_addr[0 ], vf->vf_id, + status); +return status; + } + vf->num_mac++; + +ether_addr_copy (vf->dev_lan_addr, vf->hw_lan_addr); + } + +return 0 ; +} + +/** +* ice_vf_rebuild_aggregator_node_cfg - rebuild aggregator node config +* @vsi: Pointer to VSI +* +* This function moves VSI into corresponding scheduler aggregator node +* based on cached value of "aggregator node info" per VSI +*/ +static void ice_vf_rebuild_aggregator_node_cfg (struct ice_vsi *vsi) +{ +struct ice_pf *pf = vsi->back; +struct device *dev; +int status; + +if (!vsi->agg_node) +return ; + + dev =ice_pf_to_dev (pf); +if (vsi->agg_node->num_vsis ==ICE_MAX_VSIS_IN_AGG_NODE ) { +dev_dbg (dev, +"agg_id %u already has reached max_num_vsis %u\n" , + vsi->agg_node->agg_id, vsi->agg_node->num_vsis); +return ; + } + + status =ice_move_vsi_to_agg (pf->hw.port_info, vsi->agg_node->agg_id, + vsi->idx, vsi->tc_cfg.ena_tc); +if (status) +dev_dbg (dev,"unable to move VSI idx %u into aggregator %u node" , + vsi->idx, vsi->agg_node->agg_id); +else + vsi->agg_node->num_vsis++; +} + +/** +* ice_vf_rebuild_host_cfg - host admin configuration is persistent across reset +* @vf: VF to rebuild host configuration on +*/ +static void ice_vf_rebuild_host_cfg (struct ice_vf *vf) +{ +struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf); + +if (WARN_ON (!vsi)) +return ; + +ice_vf_set_host_trust_cfg (vf); + +if (ice_vf_rebuild_host_mac_cfg (vf)) +dev_err (dev,"failed to rebuild default MAC configuration for VF %d\n" , + vf->vf_id); + +if (ice_vf_rebuild_host_vlan_cfg (vf, vsi)) +dev_err (dev,"failed to rebuild VLAN configuration for VF %u\n" , + vf->vf_id); + +if (ice_vf_rebuild_host_tx_rate_cfg (vf)) +dev_err (dev,"failed to rebuild Tx rate limiting configuration for VF %u\n" , + vf->vf_id); + +if (ice_vsi_apply_spoofchk (vsi, vf->spoofchk)) +dev_err (dev,"failed to rebuild spoofchk configuration for VF %d\n" , + vf->vf_id); + +/* rebuild aggregator node config for main VF VSI */ +ice_vf_rebuild_aggregator_node_cfg (vsi); +} + +/** +* ice_set_vf_state_qs_dis - Set VF queues state to disabled +* @vf: pointer to the VF structure +*/ +static void ice_set_vf_state_qs_dis (struct ice_vf *vf) +{ +/* Clear Rx/Tx enabled queues flag */ +bitmap_zero (vf->txq_ena,ICE_MAX_RSS_QS_PER_VF ); +bitmap_zero (vf->rxq_ena,ICE_MAX_RSS_QS_PER_VF ); +clear_bit (ICE_VF_STATE_QS_ENA , vf->vf_states); +} + +/** +* ice_vf_set_initialized - VF is ready for VIRTCHNL communication +* @vf: VF to set in initialized state +* +* After this function the VF will be ready to receive/handle the +* VIRTCHNL_OP_GET_VF_RESOURCES message +*/ +static void ice_vf_set_initialized (struct ice_vf *vf) +{ +ice_set_vf_state_qs_dis (vf); +clear_bit (ICE_VF_STATE_MC_PROMISC , vf->vf_states); +clear_bit (ICE_VF_STATE_UC_PROMISC , vf->vf_states); +clear_bit (ICE_VF_STATE_DIS , vf->vf_states); +set_bit (ICE_VF_STATE_INIT , vf->vf_states); +memset (&vf->vlan_v2_caps,0 ,sizeof (vf->vlan_v2_caps)); +} +/** * ice_vf_post_vsi_rebuild - Reset tasks that occur after VSI rebuild * @vf: the VF being reset
@@ -725,18 +959,6 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)return err; } -/** -* ice_set_vf_state_qs_dis - Set VF queues state to disabled -* @vf: pointer to the VF structure -*/ -static void ice_set_vf_state_qs_dis (struct ice_vf *vf) -{ -/* Clear Rx/Tx enabled queues flag */ -bitmap_zero (vf->txq_ena,ICE_MAX_RSS_QS_PER_VF ); -bitmap_zero (vf->rxq_ena,ICE_MAX_RSS_QS_PER_VF ); -clear_bit (ICE_VF_STATE_QS_ENA , vf->vf_states); -} -/** * ice_set_vf_state_dis - Set VF state to disabled * @vf: pointer to the VF structure
@@ -977,211 +1199,6 @@ bool ice_is_vf_link_up(struct ice_vf *vf)ICE_AQ_LINK_UP ; } -/** -* ice_vf_set_host_trust_cfg - set trust setting based on pre-reset value -* @vf: VF to configure trust setting for -*/ -static void ice_vf_set_host_trust_cfg (struct ice_vf *vf) -{ -if (vf->trusted) -set_bit (ICE_VIRTCHNL_VF_CAP_PRIVILEGE , &vf->vf_caps); -else -clear_bit (ICE_VIRTCHNL_VF_CAP_PRIVILEGE , &vf->vf_caps); -} - -/** -* ice_vf_rebuild_host_mac_cfg - add broadcast and the VF's perm_addr/LAA -* @vf: VF to add MAC filters for -* -* Called after a VF VSI has been re-added/rebuilt during reset. The PF driver -* always re-adds a broadcast filter and the VF's perm_addr/LAA after reset. -*/ -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); -u8 broadcast[ETH_ALEN ]; -int status; - -if (WARN_ON (!vsi)) -return -EINVAL ; - -if (ice_is_eswitch_mode_switchdev (vf->pf)) -return 0 ; - -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 %d\n" , - vf->vf_id, status); -return status; - } - - vf->num_mac++; - -if (is_valid_ether_addr (vf->hw_lan_addr)) { - status =ice_fltr_add_mac (vsi, vf->hw_lan_addr, -ICE_FWD_TO_VSI ); -if (status) { -dev_err (dev,"failed to add default unicast MAC filter %pM for VF %u, error %d\n" , - &vf->hw_lan_addr[0 ], vf->vf_id, - status); -return status; - } - vf->num_mac++; - -ether_addr_copy (vf->dev_lan_addr, vf->hw_lan_addr); - } - -return 0 ; -} - -/** -* ice_vf_rebuild_host_vlan_cfg - add VLAN 0 filter or rebuild the Port VLAN -* @vf: VF to add MAC filters for -* @vsi: Pointer to VSI -* -* Called after a VF VSI has been re-added/rebuilt during reset. The PF driver -* always re-adds either a VLAN 0 or port VLAN based filter after reset. -*/ -static int ice_vf_rebuild_host_vlan_cfg (struct ice_vf *vf,struct ice_vsi *vsi) -{ -struct ice_vsi_vlan_ops *vlan_ops =ice_get_compat_vsi_vlan_ops (vsi); -struct device *dev =ice_pf_to_dev (vf->pf); -int err; - -if (ice_vf_is_port_vlan_ena (vf)) { - err = vlan_ops->set_port_vlan (vsi, &vf->port_vlan_info); -if (err) { -dev_err (dev,"failed to configure port VLAN via VSI parameters for VF %u, error %d\n" , - vf->vf_id, err); -return err; - } - - err = vlan_ops->add_vlan (vsi, &vf->port_vlan_info); - }else { - err =ice_vsi_add_vlan_zero (vsi); - } - -if (err) { -dev_err (dev,"failed to add VLAN %u filter for VF %u during VF rebuild, error %d\n" , -ice_vf_is_port_vlan_ena (vf) ? -ice_vf_get_port_vlan_id (vf) :0 , vf->vf_id, err); -return err; - } - - err = vlan_ops->ena_rx_filtering (vsi); -if (err) -dev_warn (dev,"failed to enable Rx VLAN filtering for VF %d VSI %d during VF rebuild, error %d\n" , - vf->vf_id, vsi->idx, err); - -return 0 ; -} - -/** -* ice_vf_rebuild_host_tx_rate_cfg - re-apply the Tx rate limiting configuration -* @vf: VF to re-apply the configuration for -* -* Called after a VF VSI has been re-added/rebuild during reset. The PF driver -* needs to re-apply the host configured Tx rate limiting configuration. -*/ -static int ice_vf_rebuild_host_tx_rate_cfg (struct ice_vf *vf) -{ -struct device *dev =ice_pf_to_dev (vf->pf); -struct ice_vsi *vsi =ice_get_vf_vsi (vf); -int err; - -if (WARN_ON (!vsi)) -return -EINVAL ; - -if (vf->min_tx_rate) { - err =ice_set_min_bw_limit (vsi, (u64 )vf->min_tx_rate *1000 ); -if (err) { -dev_err (dev,"failed to set min Tx rate to %d Mbps for VF %u, error %d\n" , - vf->min_tx_rate, vf->vf_id, err); -return err; - } - } - -if (vf->max_tx_rate) { - err =ice_set_max_bw_limit (vsi, (u64 )vf->max_tx_rate *1000 ); -if (err) { -dev_err (dev,"failed to set max Tx rate to %d Mbps for VF %u, error %d\n" , - vf->max_tx_rate, vf->vf_id, err); -return err; - } - } - -return 0 ; -} - -/** -* ice_vf_rebuild_aggregator_node_cfg - rebuild aggregator node config -* @vsi: Pointer to VSI -* -* This function moves VSI into corresponding scheduler aggregator node -* based on cached value of "aggregator node info" per VSI -*/ -static void ice_vf_rebuild_aggregator_node_cfg (struct ice_vsi *vsi) -{ -struct ice_pf *pf = vsi->back; -struct device *dev; -int status; - -if (!vsi->agg_node) -return ; - - dev =ice_pf_to_dev (pf); -if (vsi->agg_node->num_vsis ==ICE_MAX_VSIS_IN_AGG_NODE ) { -dev_dbg (dev, -"agg_id %u already has reached max_num_vsis %u\n" , - vsi->agg_node->agg_id, vsi->agg_node->num_vsis); -return ; - } - - status =ice_move_vsi_to_agg (pf->hw.port_info, vsi->agg_node->agg_id, - vsi->idx, vsi->tc_cfg.ena_tc); -if (status) -dev_dbg (dev,"unable to move VSI idx %u into aggregator %u node" , - vsi->idx, vsi->agg_node->agg_id); -else - vsi->agg_node->num_vsis++; -} - -/** -* ice_vf_rebuild_host_cfg - host admin configuration is persistent across reset -* @vf: VF to rebuild host configuration on -*/ -void ice_vf_rebuild_host_cfg (struct ice_vf *vf) -{ -struct device *dev =ice_pf_to_dev (vf->pf); -struct ice_vsi *vsi =ice_get_vf_vsi (vf); - -if (WARN_ON (!vsi)) -return ; - -ice_vf_set_host_trust_cfg (vf); - -if (ice_vf_rebuild_host_mac_cfg (vf)) -dev_err (dev,"failed to rebuild default MAC configuration for VF %d\n" , - vf->vf_id); - -if (ice_vf_rebuild_host_vlan_cfg (vf, vsi)) -dev_err (dev,"failed to rebuild VLAN configuration for VF %u\n" , - vf->vf_id); - -if (ice_vf_rebuild_host_tx_rate_cfg (vf)) -dev_err (dev,"failed to rebuild Tx rate limiting configuration for VF %u\n" , - vf->vf_id); - -if (ice_vsi_apply_spoofchk (vsi, vf->spoofchk)) -dev_err (dev,"failed to rebuild spoofchk configuration for VF %d\n" , - vf->vf_id); - -/* rebuild aggregator node config for main VF VSI */ -ice_vf_rebuild_aggregator_node_cfg (vsi); -} -/** * ice_vf_ctrl_invalidate_vsi - invalidate ctrl_vsi_idx to remove VSI access * @vf: VF that control VSI is being invalidated on
@@ -1310,23 +1327,6 @@ void ice_vf_vsi_release(struct ice_vf *vf)ice_vf_invalidate_vsi (vf); } -/** -* ice_vf_set_initialized - VF is ready for VIRTCHNL communication -* @vf: VF to set in initialized state -* -* After this function the VF will be ready to receive/handle the -* VIRTCHNL_OP_GET_VF_RESOURCES message -*/ -void ice_vf_set_initialized (struct ice_vf *vf) -{ -ice_set_vf_state_qs_dis (vf); -clear_bit (ICE_VF_STATE_MC_PROMISC , vf->vf_states); -clear_bit (ICE_VF_STATE_UC_PROMISC , vf->vf_states); -clear_bit (ICE_VF_STATE_DIS , vf->vf_states); -set_bit (ICE_VF_STATE_INIT , vf->vf_states); -memset (&vf->vlan_v2_caps,0 ,sizeof (vf->vlan_v2_caps)); -} -/** * ice_get_vf_ctrl_vsi - Get first VF control VSI pointer * @pf: the PF private structure
drivers/net/ethernet/intel/ice/ice_vf_lib_private.h +0 -2
@@ -32,13 +32,11 @@ int ice_vsi_apply_spoofchk(struct ice_vsi *vsi, bool enable);bool ice_is_vf_trusted (struct ice_vf *vf);bool ice_vf_has_no_qs_ena (struct ice_vf *vf);bool ice_is_vf_link_up (struct ice_vf *vf); -void ice_vf_rebuild_host_cfg (struct ice_vf *vf);void ice_vf_ctrl_invalidate_vsi (struct ice_vf *vf);void ice_vf_ctrl_vsi_release (struct ice_vf *vf);struct ice_vsi *ice_vf_ctrl_vsi_setup (struct ice_vf *vf);int ice_vf_init_host_cfg (struct ice_vf *vf,struct ice_vsi *vsi);void ice_vf_invalidate_vsi (struct ice_vf *vf);void ice_vf_vsi_release (struct ice_vf *vf); -void ice_vf_set_initialized (struct ice_vf *vf);#endif /* _ICE_VF_LIB_PRIVATE_H_ */
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Przemek Kitszel
maintainerRe: [Intel-wired-lan] [PATCH iwl-next v2 4/6] ice: refactor ice_vf_lib to make functions static
Quoted 8 lines · Jan Sokolowski
Refactor
ice_vf_lib.c/_private.hin order to make as many methods as possible static.Signed-off-by Jan Sokolowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 468 +++++++++--------- .../ethernet/intel/ice/ice_vf_lib_private.h | 2 - 2 files changed, 234 insertions(+), 236 deletions(-)
I don't like such big code movement to achieve something that two predeclarations would provide.
We could either just abandon idea of converting those two functions,
or move predeclarations, augmented by "static" keyword, to ice_vf.lib.c
That would slightly violate "the style", but you will achieve SAME THING.
I have tried locally to see the diff size:
drivers/net/ethernet/intel/ice/ice_vf_lib.c | 7 +++++-- drivers/net/ethernet/intel/ice/ice_vf_lib_private.h | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-)
-Przemek
[...half thousand lines snipped...]
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tony Nguyen
maintainerRe: [Intel-wired-lan] [PATCH iwl-next v2 4/6] ice: refactor ice_vf_lib to make functions static
Quoted 11 lines · Przemek Kitszel
Quoted 8 lines · Jan Sokolowski
Refactor
ice_vf_lib.c/_private.hin order to make as many methods as possible static.Signed-off-by Jan Sokolowski <[email protected]>---
drivers/net/ethernet/intel/ice/ice_vf_lib.c | 468 +++++++++--------- .../ethernet/intel/ice/ice_vf_lib_private.h | 2 -2 files changed, 234 insertions(+), 236 deletions(-)I don't like such big code movement to achieve something that two predeclarations would provide.
To me this is not different than the other patches/intent; this just happens to involve more lines. Seems arbitrary to allow the others but not this one. I'm ok with sending this on to see if netdev will accept. Based on comments, I believe v3 will include netdev so we'll get an idea if they are open to this change with the next revision.
Quoted 10 lines
We could either just abandon idea of converting those two functions, or move predeclarations, augmented by "static" keyword, to
ice_vf.lib.cThat would slightly violate "the style", but you will achieve SAME THING.
I have tried locally to see the diff size:
drivers/net/ethernet/intel/ice/ice_vf_lib.c | 7 +++++-- drivers/net/ethernet/intel/ice/ice_vf_lib_private.h | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-)
Quoted 7 lines
-Przemek
[...half thousand lines snipped...]
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 5/6 ice: refactor ice_sched to make functions static
In reply to Jan SokolowskiRefactor ice_ddp.c/h in order to make as many methods as possible static.
--- drivers/net/ethernet/intel/ice/ice_sched.c | 2 +- drivers/net/ethernet/intel/ice/ice_sched.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-)
drivers/net/ethernet/intel/ice/ice_sched.c +1 -1
@@ -3971,7 +3971,7 @@ ice_sched_get_node_by_id_type(struct ice_port_info *pi, u32 id,* This function sets BW limit of VSI or Aggregator scheduling node * based on TC information from passed in argument BW. */ -int +static int ice_sched_set_node_bw_lmt_per_tc (struct ice_port_info *pi,u32 id,enum ice_agg_type agg_type,u8 tc,enum ice_rl_type rl_type,u32 bw)
drivers/net/ethernet/intel/ice/ice_sched.h +0 -4
@@ -141,10 +141,6 @@ ice_cfg_vsi_bw_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,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); -int -ice_sched_set_node_bw_lmt_per_tc (struct ice_port_info *pi,u32 id, -enum ice_agg_type agg_type,u8 tc, -enum ice_rl_type rl_type,u32 bw);int ice_cfg_rl_burst_size (struct ice_hw *hw,u32 bytes); int ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids,
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 6/6 ice: refactor ice_ptp_hw to make functions static
In reply to Jan Sokolowskiefactor ice_ptp_hw.c/h in order to make as many methods as possible static.
--- drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 6 +++--- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_ptp_hw.c +3 -3
@@ -295,7 +295,7 @@ static bool ice_is_40b_phy_reg_e822(u16 low_addr, u16 *high_addr)* * Read a PHY register for the given port over the device sideband queue. */ -int +static int ice_read_phy_reg_e822 (struct ice_hw *hw,u8 port,u16 offset,u32 *val) {struct ice_sbq_msg_input msg = {0 };
@@ -372,7 +372,7 @@ ice_read_64b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)* * Write a PHY register for the given port over the device sideband queue. */ -int +static int ice_write_phy_reg_e822 (struct ice_hw *hw,u8 port,u16 offset,u32 val) {struct ice_sbq_msg_input msg = {0 };
@@ -1089,7 +1089,7 @@ ice_ptp_prep_phy_time_e822(struct ice_hw *hw, u32 time)* * Negative adjustments are supported using 2s complement arithmetic. */ -int +static int ice_ptp_prep_port_adj_e822 (struct ice_hw *hw,u8 port,s64 time) {u32 l_time, u_time;
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +0 -3
@@ -144,11 +144,8 @@ int ice_ptp_init_phc(struct ice_hw *hw);int ice_get_phy_tx_tstamp_ready (struct ice_hw *hw,u8 block,u64 *tstamp_ready);/* E822 family functions */ -int ice_read_phy_reg_e822 (struct ice_hw *hw,u8 port,u16 offset,u32 *val); -int ice_write_phy_reg_e822 (struct ice_hw *hw,u8 port,u16 offset,u32 val);int ice_read_quad_reg_e822 (struct ice_hw *hw,u8 quad,u16 offset,u32 *val);int ice_write_quad_reg_e822 (struct ice_hw *hw,u8 quad,u16 offset,u32 val); -int ice_ptp_prep_port_adj_e822 (struct ice_hw *hw,u8 port,s64 time);void ice_ptp_reset_ts_memory_quad_e822 (struct ice_hw *hw,u8 quad);/**
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Przemek Kitszel
maintainerRe: [Intel-wired-lan] [PATCH iwl-next v2 6/6] ice: refactor ice_ptp_hw to make functions static
Quoted 1 line · Jan Sokolowski
efactor ice_ptp_hw.c/h in order to make as many methods
"efactor" is a typo :)
anyway I would try to use different word (for whole series), as "refactor" suggests that there are possibly some changes other than just "+static" and "move function up".
For this particular patch I would suggest:
ice: mark some ice_ptp_hw functions static
?
Also, for whole series, you have to CC netdev ML when sending patches to IWL
Quoted 45 lines
as possible static.
Signed-off-by Jan Sokolowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 6 +++--- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-)drivers/net/ethernet/intel/ice/ice_ptp_hw.c +3
-3@@ -295,7 +295,7 @@ static bool ice_is_40b_phy_reg_e822(u16 low_addr, u16 *high_addr)* * Read a PHY register for the given port over the device sideband queue. */ -int +static int ice_read_phy_reg_e822 (struct ice_hw *hw,u8 port,u16 offset,u32 *val) {struct ice_sbq_msg_input msg = {0 };@@ -372,7 +372,7 @@ ice_read_64b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)* * Write a PHY register for the given port over the device sideband queue. */ -int +static int ice_write_phy_reg_e822 (struct ice_hw *hw,u8 port,u16 offset,u32 val) {struct ice_sbq_msg_input msg = {0 };@@ -1089,7 +1089,7 @@ ice_ptp_prep_phy_time_e822(struct ice_hw *hw, u32 time)* * Negative adjustments are supported using 2s complement arithmetic. */ -int +static int ice_ptp_prep_port_adj_e822 (struct ice_hw *hw,u8 port,s64 time) {u32 l_time, u_time;drivers/net/ethernet/intel/ice/ice_ptp_hw.h +0
-0@@ -144,11 +144,8 @@ int ice_ptp_init_phc(struct ice_hw *hw);int ice_get_phy_tx_tstamp_ready (struct ice_hw *hw,u8 block,u64 *tstamp_ready);
drivers/net/ethernet/intel/ice/ice_ptp_hw.h int ice_ptp_init_phc(struct ice_hw *hw); · line 151
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +0
-3/* E822 family functions */ -int ice_read_phy_reg_e822 (struct ice_hw *hw,u8 port,u16 offset,u32 *val); -int ice_write_phy_reg_e822 (struct ice_hw *hw,u8 port,u16 offset,u32 val);int ice_read_quad_reg_e822 (struct ice_hw *hw,u8 quad,u16 offset,u32 *val);int ice_write_quad_reg_e822 (struct ice_hw *hw,u8 quad,u16 offset,u32 val); -int ice_ptp_prep_port_adj_e822 (struct ice_hw *hw,u8 port,s64 time);void ice_ptp_reset_ts_memory_quad_e822 (struct ice_hw *hw,u8 quad);/**
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan