ice: use static inline for dummy functions
Subsystems (2)
Tony Nguyen
maintainerPATCH 1/13 ice: use static inline for dummy functions
From: Jesse Brandeburg <[email protected]>
Trivial:
The driver had previously attempted to use #define macros to make functions that have no use in certain configs disappear. Using static inlines instead allows for certain static checkers to process the code better, and results in no functional change.
--- drivers/net/ethernet/intel/ice/ice_arfs.h | 12 +++++----- drivers/net/ethernet/intel/ice/ice_dcb_lib.h | 15 +++++++------ drivers/net/ethernet/intel/ice/ice_dcb_nl.h | 9 ++++---- .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 22 ++++++++++--------- drivers/net/ethernet/intel/ice/ice_xsk.h | 4 ++-- 5 files changed, 33 insertions(+), 29 deletions(-)
drivers/net/ethernet/intel/ice/ice_arfs.h +6 -6
@@ -52,12 +52,12 @@ bool ice_is_arfs_using_perfect_flow(struct ice_hw *hw, enum ice_fltr_ptype flow_type);#else -#define ice_sync_arfs_fltrs (pf) do {} while (0) -#define ice_init_arfs (vsi) do {} while (0) -#define ice_clear_arfs (vsi) do {} while (0) -#define ice_remove_arfs (pf) do {} while (0) -#define ice_free_cpu_rx_rmap (vsi) do {} while (0) -#define ice_rebuild_arfs (pf) do {} while (0) +static inline void ice_clear_arfs (struct ice_vsi *vsi) { } +static inline void ice_free_cpu_rx_rmap (struct ice_vsi *vsi) { } +static inline void ice_init_arfs (struct ice_vsi *vsi) { } +static inline void ice_sync_arfs_fltrs (struct ice_pf *pf) { } +static inline void ice_remove_arfs (struct ice_pf *pf) { } +static inline void ice_rebuild_arfs (struct ice_pf *pf) { }static inline int ice_set_cpu_rx_rmap (struct ice_vsi __always_unused *vsi) {
drivers/net/ethernet/intel/ice/ice_dcb_lib.h +8 -7
@@ -60,7 +60,7 @@ static inline bool ice_is_dcb_active(struct ice_pf *pf) test_bit(ICE_FLAG_DCB_ENA, pf->flags)); }#else -#define ice_dcb_rebuild (pf) do {} while (0) +static inline void ice_dcb_rebuild (struct ice_pf *pf) { }static inline u8 ice_dcb_get_ena_tc (struct ice_dcbx_cfg __always_unused *dcbcfg) {
@@ -113,11 +113,12 @@ ice_is_pfc_causing_hung_q(struct ice_pf __always_unused *pf,return false; } -#define ice_update_dcb_stats (pf) do {} while (0) -#define ice_pf_dcb_recfg (pf) do {} while (0) -#define ice_vsi_cfg_dcb_rings (vsi) do {} while (0) -#define ice_dcb_process_lldp_set_mib_change (pf, event) do {} while (0) -#define ice_set_cgd_num (tlan_ctx, ring) do {} while (0) -#define ice_vsi_cfg_netdev_tc (vsi, ena_tc) do {} while (0) +static inline void ice_pf_dcb_recfg (struct ice_pf *pf) { } +static inline void ice_vsi_cfg_dcb_rings (struct ice_vsi *vsi) { } +static inline void ice_update_dcb_stats (struct ice_pf *pf) { } +static inline void +ice_dcb_process_lldp_set_mib_change (struct ice_pf *pf,struct ice_rq_event_info *event) { } +static inline void ice_vsi_cfg_netdev_tc (struct ice_vsi *vsi,u8 ena_tc) { } +static inline void ice_set_cgd_num (struct ice_tlan_ctx *tlan_ctx,struct ice_ring *ring) { }#endif /* CONFIG_DCB */ #endif /* _ICE_DCB_LIB_H_ */
drivers/net/ethernet/intel/ice/ice_dcb_nl.h +5 -4
@@ -11,9 +11,10 @@ void ice_dcbnl_flush_apps(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg, struct ice_dcbx_cfg *new_cfg);#else -#define ice_dcbnl_setup (vsi) do {} while (0) -#define ice_dcbnl_set_all (vsi) do {} while (0) -#define ice_dcbnl_flush_apps (pf, old_cfg, new_cfg) do {} while (0) +static inline void ice_dcbnl_setup (struct ice_vsi *vsi) { } +static inline void ice_dcbnl_set_all (struct ice_vsi *vsi) { } +static inline void +ice_dcbnl_flush_apps (struct ice_pf *pf,struct ice_dcbx_cfg *old_cfg, +struct ice_dcbx_cfg *new_cfg) { }#endif /* CONFIG_DCB */ -#endif /* _ICE_DCB_NL_H_ */
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h +12 -10
@@ -158,16 +158,18 @@ ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode, enum virtchnl_status_code v_retval, u8 *msg, u16 msglen);bool ice_vc_isvalid_vsi_id (struct ice_vf *vf,u16 vsi_id);#else /* CONFIG_PCI_IOV */ -#define ice_process_vflr_event (pf) do {} while (0) -#define ice_free_vfs (pf) do {} while (0) -#define ice_vc_process_vf_msg (pf, event) do {} while (0) -#define ice_vc_notify_link_state (pf) do {} while (0) -#define ice_vc_notify_reset (pf) do {} while (0) -#define ice_set_vf_state_qs_dis (vf) do {} while (0) -#define ice_vf_lan_overflow_event (pf, event) do {} while (0) -#define ice_print_vfs_mdd_events (pf) do {} while (0) -#define ice_print_vf_rx_mdd_event (vf) do {} while (0) -#define ice_restore_all_vfs_msi_state (pdev) do {} while (0) +static inline void ice_process_vflr_event (struct ice_pf *pf) { } +static inline void ice_free_vfs (struct ice_pf *pf) { } +static inline +void ice_vc_process_vf_msg (struct ice_pf *pf,struct ice_rq_event_info *event) { } +static inline void ice_vc_notify_link_state (struct ice_pf *pf) { } +static inline void ice_vc_notify_reset (struct ice_pf *pf) { } +static inline void ice_set_vf_state_qs_dis (struct ice_vf *vf) { } +static inline +void ice_vf_lan_overflow_event (struct ice_pf *pf,struct ice_rq_event_info *event) { } +static inline void ice_print_vfs_mdd_events (struct ice_pf *pf) { } +static inline void ice_print_vf_rx_mdd_event (struct ice_vf *vf) { } +static inline void ice_restore_all_vfs_msi_state (struct pci_dev *pdev) { } static inline bool ice_is_malicious_vf(struct ice_pf __always_unused *pf,
drivers/net/ethernet/intel/ice/ice_xsk.h +2 -2
@@ -60,7 +60,7 @@ ice_xsk_wakeup(struct net_device __always_unused *netdev,return -EOPNOTSUPP ; } -#define ice_xsk_clean_rx_ring (rx_ring) do {} while (0) -#define ice_xsk_clean_xdp_ring (xdp_ring) do {} while (0) +static inline void ice_xsk_clean_rx_ring (struct ice_ring *rx_ring) { } +static inline void ice_xsk_clean_xdp_ring (struct ice_ring *xdp_ring) { }#endif /* CONFIG_XDP_SOCKETS */ #endif /* !_ICE_XSK_H_ */
Signature · 1 line
2.20.1
Tony Nguyen
maintainerPATCH 2/13 ice: add extack when unable to read device caps
From: Jacob Keller <[email protected]>
When filling out information for the DEVLINK_CMD_INFO_GET, the driver needs to read some device capabilities. Add an extack message to properly inform the caller of the failure, as we do for other failures in this function.
--- drivers/net/ethernet/intel/ice/ice_devlink.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/ice/ice_devlink.c +3 -0
@@ -283,6 +283,9 @@ static int ice_devlink_info_get(struct devlink *devlink,/* 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)); +NL_SET_ERR_MSG_MOD (extack,"Unable to discover device capabilities" ); err = -EIO ; goto out_free_ctx; }
Signature · 1 line
2.20.1
Brelinski
PATCH 2/13 ice: add extack when unable to read device caps
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 02/13] ice: add extack when unable to read device capsFrom: Jacob Keller <[email protected]>
Quoted 8 lines
When filling out information for the
DEVLINK_CMD_INFO_GET, the driver needs to read some device capabilities. Add an extack message to properly inform the caller of the failure, as we do for other failures in this function.Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_devlink.c | 3 +++ 1 file changed, 3 insertions(+)
Tony Nguyen
maintainerPATCH 3/13 ice: add error message when pldmfw_flash_image fails
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
When flashing a new firmware image onto the device, the pldmfw library parses the image contents looking for a matching record. If no record can be found, the function reports an error of -ENOENT. This can produce a very confusing error message and experience for the user:
$devlink dev flash pci/0000:ab:00.0 file image.bin devlink answers: No such file or directory
This is because the ENOENT error code is interpreted as a missing file or directory. The pldmfw library does not have direct access to the extack pointer as it is generic and non-netdevice specific. The only way that ENOENT is returned by the pldmfw library is when no record matches.
Catch this specific error and report a suitable extended ack message:
$devlink dev flash pci/0000:ab:00.0 file image.bin
Error: ice: Firmware image has no record matching this device devlink answers: No such file or directory
In addition, ensure that we log an error message to the console whenever this function fails. Because our driver specific PLDM operation functions potentially set the extended ACK message, avoid overwriting this with a generic message.
This change should result in an improved experience when attempting to flash an image that does not have a compatible record.
--- drivers/net/ethernet/intel/ice/ice_fw_update.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/intel/ice/ice_fw_update.c +10 -0
@@ -702,6 +702,16 @@ int ice_flash_pldm_image(struct ice_pf *pf, const struct firmware *fw, } err =pldmfw_flash_image (&priv.context, fw); +if (err == -ENOENT ) { +dev_err (dev,"Firmware image has no record matching this device\n" ); +NL_SET_ERR_MSG_MOD (extack,"Firmware image has no record matching this device" ); + }else if (err) { +/* Do not set a generic extended ACK message here. A more +* specific message may already have been set by one of our +* ops. +*/ +dev_err (dev,"Failed to flash PLDM image, err %d" , err); + }ice_release_nvm (hw);
Signature · 1 line
2.20.1
Brelinski
PATCH 3/13 ice: add error message when pldmfw_flash_image fails
Quoted 34 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 03/13] ice: add error message whenpldmfw_flash_imagefailsFrom: Jacob Keller <[email protected]>
When flashing a new firmware image onto the device, the pldmfw library parses the image contents looking for a matching record. If no record can be found, the function reports an error of
-ENOENT. This can produce a very confusing error message and experience for the user:$devlink dev flash pci/0000:ab:00.0 file image.bin devlink answers: No such file or directory
This is because the ENOENT error code is interpreted as a missing file or directory. The pldmfw library does not have direct access to the extack pointer as it is generic and non-netdevice specific. The only way that ENOENT is returned by the pldmfw library is when no record matches.
Catch this specific error and report a suitable extended ack message:
$devlink dev flash pci/0000:ab:00.0 file image.bin
Error: ice: Firmware image has no record matching this device devlink answers: No such file or directoryIn addition, ensure that we log an error message to the console whenever this function fails. Because our driver specific PLDM operation functions potentially set the extended ACK message, avoid overwriting this with a generic message.
Quoted 7 lines
This change should result in an improved experience when attempting to flash an image that does not have a compatible record.
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fw_update.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
Tony Nguyen
maintainerPATCH 4/13 ice: wait for reset before reporting devlink info
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
Requesting device firmware information while the device is busy cleaning up after a reset can result in an unexpected failure:
This occurs because the command is attempting to access the device AdminQ while it is down. Resolve this by having the command wait for a while until the reset is complete. To do this, introduce
a reset_wait_queue and associated helper function "ice_wait_for_reset".
This helper will use the wait queue to sleep until the driver is done rebuilding. Use of a wait queue is preferred because the potential sleep duration can be several seconds.
To ensure that the thread wakes up properly, a new wake_up call is added during all code paths which clear the reset state bits associated with the driver rebuild flow.
Using this ensures that tools can request device information without worrying about whether the driver is cleaning up from a reset. Specifically, it is expected that a flash update could result in a device reset, and it is better to delay the response for information until the reset is complete rather than exit with an immediate failure.
--- drivers/net/ethernet/intel/ice/ice.h | 2 ++ drivers/net/ethernet/intel/ice/ice_devlink.c | 6 +++++ drivers/net/ethernet/intel/ice/ice_lib.c | 28 ++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 5 ++++ 5 files changed, 42 insertions(+)
drivers/net/ethernet/intel/ice/ice.h +2 -0
@@ -443,6 +443,8 @@ struct ice_pf {struct hlist_head aq_wait_list;wait_queue_head_t aq_wait_queue; +wait_queue_head_t reset_wait_queue; +u32 hw_csum_rx_error;u16 oicr_idx;/* Other interrupt cause MSIX vector index */ u16 num_avail_sw_msix;/* remaining MSIX SW vectors left unclaimed */
drivers/net/ethernet/intel/ice/ice_devlink.c +6 -0
@@ -276,6 +276,12 @@ static int ice_devlink_info_get(struct devlink *devlink,size_t i;int err; + err =ice_wait_for_reset (pf,10 *HZ ); +if (err) { +NL_SET_ERR_MSG_MOD (extack,"Device is busy resetting" ); +return err; + } + ctx =kzalloc (sizeof (*ctx),GFP_KERNEL );if (!ctx)return -ENOMEM ;
drivers/net/ethernet/intel/ice/ice_lib.c +28 -0
@@ -3219,6 +3219,34 @@ bool ice_is_reset_in_progress(unsigned long *state)test_bit (ICE_GLOBR_REQ , state); } +/** +* ice_wait_for_reset - Wait for driver to finish reset and rebuild +* @pf: pointer to the PF structure +* @timeout: length of time to wait, in jiffies +* +* Wait (sleep) for a short time until the driver finishes cleaning up from +* a device reset. The caller must be able to sleep. Use this to delay +* operations that could fail while the driver is cleaning up after a device +* reset. +* +* Returns 0 on success, -EBUSY if the reset is not finished within the +* timeout, and -ERESTARTSYS if the thread was interrupted. +*/ +int ice_wait_for_reset (struct ice_pf *pf,unsigned long timeout) +{ +long ret; + + ret =wait_event_interruptible_timeout (pf->reset_wait_queue, + !ice_is_reset_in_progress (pf->state), + timeout); +if (ret <0 ) +return ret; +else if (!ret) +return -EBUSY ; +else +return 0 ; +} +#ifdef CONFIG_DCB /** * ice_vsi_update_q_map - update our copy of the VSI info with new queue map
drivers/net/ethernet/intel/ice/ice_lib.h +1 -0
@@ -77,6 +77,7 @@ ice_get_res(struct ice_pf *pf, struct ice_res_tracker *res, u16 needed, u16 id);int ice_vsi_rebuild (struct ice_vsi *vsi,bool init_vsi);bool ice_is_reset_in_progress (unsigned long *state); +int ice_wait_for_reset (struct ice_pf *pf,unsigned long timeout);void ice_write_qrxflxp_cntxt (struct ice_hw *hw,u16 pf_q,u32 rxdid,u32 prio);
drivers/net/ethernet/intel/ice/ice_main.c +5 -0
@@ -514,6 +514,7 @@ static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type)clear_bit (ICE_PFR_REQ , pf->state);clear_bit (ICE_CORER_REQ , pf->state);clear_bit (ICE_GLOBR_REQ , pf->state); +wake_up (&pf->reset_wait_queue);return ; }
@@ -526,6 +527,7 @@ static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type)ice_rebuild (pf, reset_type);clear_bit (ICE_PREPARED_FOR_RESET , pf->state);clear_bit (ICE_PFR_REQ , pf->state); +wake_up (&pf->reset_wait_queue);ice_reset_all_vfs (pf, true); } }
@@ -576,6 +578,7 @@ static void ice_reset_subtask(struct ice_pf *pf)clear_bit (ICE_PFR_REQ , pf->state);clear_bit (ICE_CORER_REQ , pf->state);clear_bit (ICE_GLOBR_REQ , pf->state); +wake_up (&pf->reset_wait_queue);ice_reset_all_vfs (pf, true); }
@@ -3340,6 +3343,8 @@ static int ice_init_pf(struct ice_pf *pf)spin_lock_init (&pf->aq_wait_lock);init_waitqueue_head (&pf->aq_wait_queue); +init_waitqueue_head (&pf->reset_wait_queue); +/* setup service timer and periodic service task */ timer_setup (&pf->serv_tmr, ice_service_timer,0 ); pf->serv_tmr_period =HZ ;
Signature · 1 line
2.20.1
Brelinski
PATCH 4/13 ice: wait for reset before reporting devlink info
Quoted 32 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 04/13] ice: wait for reset before reporting devlink infoFrom: Jacob Keller <[email protected]>
Requesting device firmware information while the device is busy cleaning up after a reset can result in an unexpected failure:
This occurs because the command is attempting to access the device AdminQ while it is down. Resolve this by having the command wait for a while until the reset is complete. To do this, introduce a
reset_wait_queueand associated helper function "ice_wait_for_reset".This helper will use the wait queue to sleep until the driver is done rebuilding. Use of a wait queue is preferred because the potential sleep duration can be several seconds.
To ensure that the thread wakes up properly, a new
wake_upcall is added during all code paths which clear the reset state bits associated with the driver rebuild flow.Using this ensures that tools can request device information without worrying about whether the driver is cleaning up from a reset. Specifically, it is expected that a flash update could result in a device reset, and it is better to delay the response for information until the reset is complete rather than exit with an immediate failure.
Quoted 8 lines
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 2 ++ drivers/net/ethernet/intel/ice/ice_devlink.c | 6 +++++ drivers/net/ethernet/intel/ice/ice_lib.c | 28 ++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 5 ++++ 5 files changed, 42 insertions(+)
Tony Nguyen
maintainerPATCH 5/13 ice: (re)initialize NVM fields when rebuilding
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
After performing a flash update, a device EMP reset may occur. This reset will cause the newly downloaded firmware to be initialized. When this happens, the driver still reports the previous NVM version information.
This is because the NVM versions are cached within the hw structure. This can be confusing, as the new firmware is in fact running in this case.
Handle this by calling ice_init_nvm when rebuilding the driver state. This will update the flash version information and ensures that the current values are displayed when reporting the NVM versions to the stack.
--- drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/ice/ice_main.c +6 -0
@@ -6151,6 +6151,12 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)ice_clear_pxe_mode (hw); + ret =ice_init_nvm (hw); +if (ret) { +dev_err (dev,"ice_init_nvm failed %s\n" ,ice_stat_str (ret)); + goto err_init_ctrlq; + } + ret =ice_get_caps (hw);if (ret) {dev_err (dev,"ice_get_caps failed %s\n" ,ice_stat_str (ret));
Signature · 1 line
2.20.1
Brelinski
PATCH 5/13 ice: (re)initialize NVM fields when rebuilding
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 05/13] ice: (re)initialize NVM fields when rebuildingFrom: Jacob Keller <[email protected]>
After performing a flash update, a device EMP reset may occur. This reset will cause the newly downloaded firmware to be initialized. When this happens, the driver still reports the previous NVM version information.
This is because the NVM versions are cached within the hw structure. This can be confusing, as the new firmware is in fact running in this case.
Quoted 8 lines
Handle this by calling
ice_init_nvmwhen rebuilding the driver state. This will update the flash version information and ensures that the current values are displayed when reporting the NVM versions to the stack.Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
Tony Nguyen
maintainerPATCH 6/13 ice: Detect and report unsupported module power levels
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
Determine whether an unsupported power configuration is preventing link establishment by storing and checking the link_cfg_err_byte. Print error messages when module power levels are unsupported. Also add a new flag bit to prevent spamming said error messages.
--- drivers/net/ethernet/intel/ice/ice.h | 1 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 6 ++- drivers/net/ethernet/intel/ice/ice_common.c | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 40 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_type.h | 1 + 5 files changed, 48 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -382,6 +382,7 @@ enum ice_pf_flags {ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA ,ICE_FLAG_NO_MEDIA ,ICE_FLAG_FW_LLDP_AGENT , +ICE_FLAG_MOD_POWER_UNSUPPORTED ,ICE_FLAG_ETHTOOL_CTXT ,/* set when ethtool holds RTNL lock */ ICE_FLAG_LEGACY_RX , ICE_FLAG_VF_TRUE_PROMISC_ENA,
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +4 -2
@@ -1122,7 +1122,9 @@ struct ice_aqc_get_link_status_data {#define ICE_AQ_LINK_TOPO_UNDRUTIL_PRT BIT(5)#define ICE_AQ_LINK_TOPO_UNDRUTIL_MEDIA BIT(6)#define ICE_AQ_LINK_TOPO_UNSUPP_MEDIA BIT(7) -u8 reserved1; +u8 link_cfg_err; +#define ICE_AQ_LINK_MODULE_POWER_UNSUPPORTED BIT(5) +#define ICE_AQ_LINK_INVAL_MAX_POWER_LIMIT BIT(7)u8 link_info;#define ICE_AQ_LINK_UP BIT(0)/* Link Status */ #define ICE_AQ_LINK_FAULT BIT(1)
@@ -1165,7 +1167,7 @@ struct ice_aqc_get_link_status_data {#define ICE_AQ_CFG_PACING_TYPE_FIXED ICE_AQ_CFG_PACING_TYPE_M/* External Device Power Ability */ u8 power_desc; -#define ICE_AQ_PWR_CLASS_M 0x3 +#define ICE_AQ_PWR_CLASS_M 0x3F#define ICE_AQ_LINK_PWR_BASET_LOW_HIGH 0#define ICE_AQ_LINK_PWR_BASET_HIGH 1#define ICE_AQ_LINK_PWR_QSFP_CLASS_1 0
drivers/net/ethernet/intel/ice/ice_common.c +2 -0
@@ -424,6 +424,7 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, li->phy_type_high =le64_to_cpu (link_data.phy_type_high); *hw_media_type =ice_get_media_type (pi); li->link_info = link_data.link_info; + li->link_cfg_err = link_data.link_cfg_err; li->an_info = link_data.an_info; li->ext_info = link_data.ext_info; li->max_frame_size =le16_to_cpu (link_data.max_frame_size);
@@ -454,6 +455,7 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, (unsigned long long)li->phy_type_high);ice_debug (hw,ICE_DBG_LINK ," media_type = 0x%x\n" , *hw_media_type);ice_debug (hw,ICE_DBG_LINK ," link_info = 0x%x\n" , li->link_info); +ice_debug (hw,ICE_DBG_LINK ," link_cfg_err = 0x%x\n" , li->link_cfg_err);ice_debug (hw,ICE_DBG_LINK ," an_info = 0x%x\n" , li->an_info);ice_debug (hw,ICE_DBG_LINK ," ext_info = 0x%x\n" , li->ext_info);ice_debug (hw,ICE_DBG_LINK ," fec_info = 0x%x\n" , li->fec_info);
drivers/net/ethernet/intel/ice/ice_main.c +40 -0
@@ -875,6 +875,38 @@ static void ice_set_dflt_mib(struct ice_pf *pf)kfree (lldpmib); } +/** +* ice_check_module_power +* @pf: pointer to PF struct +* @link_cfg_err: bitmap from the link info structure +* +* check module power level returned by a previous call to aq_get_link_info +* and print error messages if module power level is not supported +*/ +static void ice_check_module_power (struct ice_pf *pf,u8 link_cfg_err) +{ +/* if module power level is supported, clear the flag */ +if (!(link_cfg_err & (ICE_AQ_LINK_INVAL_MAX_POWER_LIMIT | +ICE_AQ_LINK_MODULE_POWER_UNSUPPORTED ))) { +clear_bit (ICE_FLAG_MOD_POWER_UNSUPPORTED , pf->flags); +return ; + } + +/* if ICE_FLAG_MOD_POWER_UNSUPPORTED was previously set and the +* above block didn't clear this bit, there's nothing to do +*/ +if (test_bit (ICE_FLAG_MOD_POWER_UNSUPPORTED , pf->flags)) +return ; + +if (link_cfg_err &ICE_AQ_LINK_INVAL_MAX_POWER_LIMIT ) { +dev_err (ice_pf_to_dev (pf),"The installed module is incompatible with the device's NVM image. Cannot start link\n" ); +set_bit (ICE_FLAG_MOD_POWER_UNSUPPORTED , pf->flags); + }else if (link_cfg_err &ICE_AQ_LINK_MODULE_POWER_UNSUPPORTED ) { +dev_err (ice_pf_to_dev (pf),"The module's power requirements exceed the device's power supply. Cannot start link\n" ); +set_bit (ICE_FLAG_MOD_POWER_UNSUPPORTED , pf->flags); + } +} +/** * ice_link_event - process the link event * @pf: PF that the link event is associated with
@@ -910,6 +942,8 @@ ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up, pi->lport,ice_stat_str (status), ice_aq_str(pi->hw->adminq.sq_last_status)); +ice_check_module_power (pf, pi->phy.link_info.link_cfg_err); +/* Check if the link state is up after updating link info, and treat * this event as an UP event since the link is actually UP now. */
@@ -2024,6 +2058,8 @@ static void ice_check_media_subtask(struct ice_pf *pf)if (err)return ; +ice_check_module_power (pf, pi->phy.link_info.link_cfg_err); +if (pi->phy.link_info.link_info &ICE_AQ_MEDIA_AVAILABLE ) {if (!test_bit (ICE_PHY_INIT_COMPLETE , pf->state))ice_init_phy_user_cfg (pi);
@@ -4225,6 +4261,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)ice_init_link_dflt_override (pf->hw.port_info); +ice_check_module_power (pf, pf->hw.port_info->phy.link_info.link_cfg_err); +/* if media available, initialize PHY settings */ if (pf->hw.port_info->phy.link_info.link_info &ICE_AQ_MEDIA_AVAILABLE ) {
@@ -6847,6 +6885,8 @@ int ice_open_internal(struct net_device *netdev)return -EIO ; } +ice_check_module_power (pf, pi->phy.link_info.link_cfg_err); +/* Set PHY if there is media, otherwise, turn off PHY */ if (pi->phy.link_info.link_info &ICE_AQ_MEDIA_AVAILABLE ) {clear_bit (ICE_FLAG_NO_MEDIA , pf->flags);
drivers/net/ethernet/intel/ice/ice_type.h +1 -0
@@ -146,6 +146,7 @@ struct ice_link_status {u16 max_frame_size;u16 link_speed;u16 req_speeds; +u8 link_cfg_err;u8 lse_ena;/* Link Status Event notification */ u8 link_info;u8 an_info;
Signature · 1 line
2.20.1
Brelinski
PATCH 6/13 ice: Detect and report unsupported module power levels
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 06/13] ice: Detect and report unsupported module power levelsFrom: Anirudh Venkataramanan <[email protected]>
Determine whether an unsupported power configuration is preventing link establishment by storing and checking the
link_cfg_err_byte. Print error messages when module power levels are unsupported. Also add a new flag bit to prevent spamming said error messages.Co-developed-by Jeb Cramer <[email protected]>Signed-off-by Jeb Cramer <[email protected]>Signed-off-by Anirudh Venkataramanan
Quoted 8 lines
Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 1 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 6 ++- drivers/net/ethernet/intel/ice/ice_common.c | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 40 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_type.h | 1 + 5 files changed, 48 insertions(+), 2 deletions(-)
Tony Nguyen
maintainerPATCH 7/13 ice: Remove boolean vlan_promisc flag from function
In reply to Tony NguyenFrom: Brett Creeley <[email protected]>
Currently, the vlan_promisc flag is used exclusively by VF VSI to determine whether or not to toggle VLAN pruning along with trusted/true-promiscuous mode. This is not needed for a couple of reasons. First, trusted/true-promiscuous mode is only supposed to allow all MAC filters within VLANs that a VF has added filters for, so VLAN pruning should not be disabled. Second, the boolean argument makes the function confusing and unintuitive. Remove this flag.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 7 ++----- drivers/net/ethernet/intel/ice/ice_lib.h | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++------ drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 9 ++++++--- 4 files changed, 15 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +2 -5
@@ -2102,11 +2102,10 @@ bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi)* ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI * @vsi: VSI to enable or disable VLAN pruning on * @ena: set to true to enable VLAN pruning and false to disable it -* @vlan_promisc: enable valid security flags if not in VLAN promiscuous mode * * returns 0 if VSI is updated, negative otherwise */ -int ice_cfg_vlan_pruning (struct ice_vsi *vsi,bool ena,bool vlan_promisc) +int ice_cfg_vlan_pruning (struct ice_vsi *vsi,bool ena) {struct ice_vsi_ctx *ctxt;struct ice_pf *pf;
@@ -2134,9 +2133,7 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc)else ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA ; -if (!vlan_promisc) - ctxt->info.valid_sections = -cpu_to_le16 (ICE_AQ_VSI_PROP_SW_VALID ); + ctxt->info.valid_sections =cpu_to_le16 (ICE_AQ_VSI_PROP_SW_VALID ); status =ice_update_vsi (&pf->hw, vsi->idx, ctxt,NULL );if (status) {
drivers/net/ethernet/intel/ice/ice_lib.h +1 -1
@@ -45,7 +45,7 @@ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi);bool ice_vsi_is_vlan_pruning_ena (struct ice_vsi *vsi); -int ice_cfg_vlan_pruning (struct ice_vsi *vsi,bool ena,bool vlan_promisc); +int ice_cfg_vlan_pruning (struct ice_vsi *vsi,bool ena);void ice_cfg_sw_lldp (struct ice_vsi *vsi,bool tx,bool create);
drivers/net/ethernet/intel/ice/ice_main.c +6 -6
@@ -378,7 +378,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) ~IFF_PROMISC ; goto out_promisc; } -ice_cfg_vlan_pruning (vsi, false, false); +ice_cfg_vlan_pruning (vsi, false); } }else {/* Clear Rx filter to remove traffic from wire */
@@ -392,7 +392,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) goto out_promisc; }if (vsi->num_vlan >1 ) -ice_cfg_vlan_pruning (vsi, true, false); +ice_cfg_vlan_pruning (vsi, true); } } }
@@ -3144,7 +3144,7 @@ ice_vlan_rx_add_vid(struct net_device *netdev, __always_unused __be16 proto,/* Enable VLAN pruning when a VLAN other than 0 is added */ if (!ice_vsi_is_vlan_pruning_ena (vsi)) { - ret =ice_cfg_vlan_pruning (vsi, true, false); + ret =ice_cfg_vlan_pruning (vsi, true);if (ret)return ret; }
@@ -3188,7 +3188,7 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto,/* Disable pruning when VLAN 0 is the only VLAN rule */ if (vsi->num_vlan ==1 &&ice_vsi_is_vlan_pruning_ena (vsi)) - ret =ice_cfg_vlan_pruning (vsi, false, false); + ret =ice_cfg_vlan_pruning (vsi, false);set_bit (ICE_VSI_VLAN_FLTR_CHANGED , vsi->state);return ret;
@@ -5199,10 +5199,10 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)if ((features &NETIF_F_HW_VLAN_CTAG_FILTER ) && !(netdev->features &NETIF_F_HW_VLAN_CTAG_FILTER )) - ret =ice_cfg_vlan_pruning (vsi, true, false); + ret =ice_cfg_vlan_pruning (vsi, true);else if (!(features &NETIF_F_HW_VLAN_CTAG_FILTER ) && (netdev->features &NETIF_F_HW_VLAN_CTAG_FILTER )) - ret =ice_cfg_vlan_pruning (vsi, false, false); + ret =ice_cfg_vlan_pruning (vsi, false);if ((features &NETIF_F_NTUPLE ) && !(netdev->features &NETIF_F_NTUPLE )) {
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +6 -3
@@ -2971,7 +2971,10 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg) rm_promisc = !allmulti && !alluni;if (vsi->num_vlan || vf->port_vlan_info) { - ret =ice_cfg_vlan_pruning (vsi, true, !rm_promisc); +if (rm_promisc) + ret =ice_cfg_vlan_pruning (vsi, true); +else + ret =ice_cfg_vlan_pruning (vsi, false);if (ret) {dev_err (dev,"Failed to configure VLAN pruning in promiscuous mode\n" ); v_ret =VIRTCHNL_STATUS_ERR_PARAM ;
@@ -4161,7 +4164,7 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)/* Enable VLAN pruning when non-zero VLAN is added */ if (!vlan_promisc && vid && !ice_vsi_is_vlan_pruning_ena (vsi)) { - status =ice_cfg_vlan_pruning (vsi, true, false); + status =ice_cfg_vlan_pruning (vsi, true);if (status) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; dev_err(dev, "Enable VLAN pruning on VLAN ID: %d failed error-%d\n",
@@ -4215,7 +4218,7 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)/* Disable VLAN pruning when only VLAN 0 is left */ if (vsi->num_vlan ==1 &&ice_vsi_is_vlan_pruning_ena (vsi)) -ice_cfg_vlan_pruning (vsi, false, false); +ice_cfg_vlan_pruning (vsi, false);/* Disable Unicast/Multicast VLAN promiscuous mode */ if (vlan_promisc) {
Signature · 1 line
2.20.1
Brelinski
PATCH 7/13 ice: Remove boolean vlan_promisc flag from function
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Nguyen, Anthony L
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 07/13] ice: Remove booleanvlan_promiscflag from functionFrom: Brett Creeley <[email protected]>
Currently, the
vlan_promiscflag is used exclusively by VF VSI to determine whether or not to toggle VLAN pruning along with trusted/true-promiscuous mode. This is not needed for a couple of reasons. First, trusted/true- promiscuous mode is only supposed to allow all MAC filters within VLANs that a VF has added filters for, so VLAN pruning should not be disabled. Second, the boolean argument makes the function confusing and unintuitive. Remove this flag.
Quoted 8 lines
Signed-off-by Brett Creeley <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 7 ++----- drivers/net/ethernet/intel/ice/ice_lib.h | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 12 ++++++------ drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 9 ++++++--- 4 files changed, 15 insertions(+), 15 deletions(-)
Tony Nguyen
maintainerPATCH 8/13 ice: Fix replacing VF hardware MAC to existing MAC filter
In reply to Tony NguyenFrom: Sylwester Dziedziuch <[email protected]>
VF was not able to change its hardware MAC address in case the new address was already present in the MAC filter list. Change the handling of VF add mac request to not return if requested MAC address is already present on the list and check if its hardware MAC needs to be updated in this case.
--- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +9 -5
@@ -3719,6 +3719,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 ;/* device MAC already added */ if (ether_addr_equal (mac_addr, vf->dev_lan_addr.addr))
@@ -3731,20 +3732,23 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi, status =ice_fltr_add_mac (vsi, mac_addr,ICE_FWD_TO_VSI );if (status ==ICE_ERR_ALREADY_EXISTS ) { -dev_err (dev,"MAC %pM already exists for VF %d\n" , mac_addr, +dev_dbg (dev,"MAC %pM already exists for VF %d\n" , mac_addr, vf->vf_id); -return -EEXIST ; +/* 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 { + vf->num_mac++; }ice_vfhw_mac_add (vf, vc_ether_addr); - vf->num_mac++; - -return 0 ; +return ret; }/**
Signature · 1 line
2.20.1
Brelinski
PATCH 8/13 ice: Fix replacing VF hardware MAC to existing MAC filter
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Nguyen, Anthony L
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 08/13] ice: Fix replacing VF hardware MAC to existing MAC filterFrom: Sylwester Dziedziuch <[email protected]>
VF was not able to change its hardware MAC address in case the new address was already present in the MAC filter list.
Change the handling of VF add mac request to not return if requested MAC address is already present on the list and check if its hardware MAC needs to be updated in this case.
Quoted 4 lines
Signed-off-by Sylwester Dziedziuch <[email protected]>--- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
Tony Nguyen
maintainerPATCH 9/13 ice: fix incorrect payload indicator on PTYPE
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
The entry for PTYPE 90 indicates that the payload is layer 3. This does not match the specification in the datasheet which indicates the packet is a MAC, IPv6, UDP packet, with a payload in layer 4.
Fix the lookup table to match the data sheet.
--- drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +1 -1
@@ -766,7 +766,7 @@ static const struct ice_rx_ptype_decoded ice_ptype_lkup[BIT(10)] = {/* Non Tunneled IPv6 */ ICE_PTT (88 ,IP ,IPV6 ,FRG ,NONE ,NONE ,NOF ,NONE ,PAY3 ),ICE_PTT (89 ,IP ,IPV6 ,NOF ,NONE ,NONE ,NOF ,NONE ,PAY3 ), -ICE_PTT (90 ,IP ,IPV6 ,NOF ,NONE ,NONE ,NOF ,UDP ,PAY3 ), +ICE_PTT (90 ,IP ,IPV6 ,NOF ,NONE ,NONE ,NOF ,UDP ,PAY4 ),ICE_PTT_UNUSED_ENTRY (91 ),ICE_PTT (92 ,IP ,IPV6 ,NOF ,NONE ,NONE ,NOF ,TCP ,PAY4 ), ICE_PTT(93, IP, IPV6, NOF, NONE, NONE, NOF, SCTP, PAY4),
Signature · 1 line
2.20.1
Brelinski
PATCH 9/13 ice: fix incorrect payload indicator on PTYPE
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 09/13] ice: fix incorrect payload indicator on PTYPEFrom: Jacob Keller <[email protected]>
The entry for PTYPE 90 indicates that the payload is layer 3. This does not match the specification in the datasheet which indicates the packet is a MAC, IPv6, UDP packet, with a payload in layer 4.
Quoted 6 lines
Fix the lookup table to match the data sheet.
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Tony Nguyen
maintainerPATCH 10/13 ice: mark PTYPE 2 as reserved
In reply to Tony NguyenFrom: Jacob Keller <[email protected]>
The entry for PTYPE 2 in the ice_ptype_lkup table incorrectly states that this is an L2 packet with no payload. According to the datasheet, this PTYPE is actually unused and reserved.
Fix the lookup entry to indicate this is an unused entry that is reserved.
--- drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +1 -1
@@ -652,7 +652,7 @@ static const struct ice_rx_ptype_decoded ice_ptype_lkup[BIT(10)] = {/* L2 Packet types */ ICE_PTT_UNUSED_ENTRY (0 ),ICE_PTT (1 ,L2 ,NONE ,NOF ,NONE ,NONE ,NOF ,NONE ,PAY2 ), -ICE_PTT (2 ,L2 ,NONE ,NOF ,NONE ,NONE ,NOF ,NONE ,NONE ), +ICE_PTT_UNUSED_ENTRY (2 ),ICE_PTT_UNUSED_ENTRY (3 ),ICE_PTT_UNUSED_ENTRY (4 ), ICE_PTT_UNUSED_ENTRY(5),
Signature · 1 line
2.20.1
Brelinski
PATCH 10/13 ice: mark PTYPE 2 as reserved
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 10/13] ice: mark PTYPE 2 as reservedFrom: Jacob Keller <[email protected]>
The entry for PTYPE 2 in the
ice_ptype_lkuptable incorrectly states that this is an L2 packet with no payload. According to the datasheet, this PTYPE is actually unused and reserved.
Quoted 6 lines
Fix the lookup entry to indicate this is an unused entry that is reserved.
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Tony Nguyen
maintainerPATCH 11/13 ice: downgrade error print to debug print
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
Failing to add or remove LLDP filter doesn't seem to be a fatal error, so downgrade the dev_err message to a dev_dbg message.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_lib.c +1 -1
@@ -2237,7 +2237,7 @@ void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create) }if (status) -dev_err (dev,"Fail %s %s LLDP rule on VSI %i error: %s\n" , +dev_dbg (dev,"Fail %s %s LLDP rule on VSI %i error: %s\n" , create ?"adding" :"removing" , tx ?"TX" :"RX" , vsi->vsi_num,ice_stat_str (status)); }
Signature · 1 line
2.20.1
Brelinski
PATCH 11/13 ice: downgrade error print to debug print
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 11/13] ice: downgrade error print to debug printFrom: Anirudh Venkataramanan <[email protected]>
Quoted 8 lines
Failing to add or remove LLDP filter doesn't seem to be a fatal error, so downgrade the
dev_errmessage to adev_dbgmessage.Signed-off-by: Anirudh Venkataramanan
<[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Tony Nguyen
maintainerPATCH 12/13 ice: reduce scope of variables
In reply to Tony NguyenFrom: Paul M Stillwell Jr <[email protected]>
There are some places where the scope of a variable can be reduced so do that.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 8 ++++---- drivers/net/ethernet/intel/ice/ice_main.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +4 -4
@@ -1194,11 +1194,11 @@ static int ice_vsi_setup_vector_base(struct ice_vsi *vsi) num_q_vectors = vsi->num_q_vectors;/* reserve slots from OS requested IRQs */ if (vsi->type ==ICE_VSI_CTRL && vsi->vf_id !=ICE_INVAL_VFID ) { -struct ice_vf *vf;int i;ice_for_each_vf (pf, i) { - vf = &pf->vf[i]; +struct ice_vf *vf = &pf->vf[i]; +if (i != vsi->vf_id && vf->ctrl_vsi_idx !=ICE_NO_VSI ) { base = pf->vsi[vf->ctrl_vsi_idx]->base_vector;break ;
@@ -2852,11 +2852,11 @@ int ice_vsi_release(struct ice_vsi *vsi)* cleared in the same manner. */ if (vsi->type ==ICE_VSI_CTRL && vsi->vf_id !=ICE_INVAL_VFID ) { -struct ice_vf *vf;int i;ice_for_each_vf (pf, i) { - vf = &pf->vf[i]; +struct ice_vf *vf = &pf->vf[i]; +if (i != vsi->vf_id && vf->ctrl_vsi_idx !=ICE_NO_VSI )break ; }
drivers/net/ethernet/intel/ice/ice_main.c +2 -2
@@ -5498,7 +5498,6 @@ ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi, struct ice_ring **rings,static void ice_update_vsi_ring_stats (struct ice_vsi *vsi) {struct rtnl_link_stats64 *vsi_stats = &vsi->net_stats; -struct ice_ring *ring;u64 pkts, bytes;int i;
@@ -5522,7 +5521,8 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)/* update Rx rings counters */ ice_for_each_rxq (vsi, i) { - ring =READ_ONCE (vsi->rx_rings[i]); +struct ice_ring *ring =READ_ONCE (vsi->rx_rings[i]); +ice_fetch_u64_stats_per_ring (ring, &pkts, &bytes); vsi_stats->rx_packets += pkts; vsi_stats->rx_bytes += bytes;
Signature · 1 line
2.20.1
Brelinski
PATCH 12/13 ice: reduce scope of variables
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 12/13] ice: reduce scope of variablesFrom: Paul M Stillwell Jr <[email protected]>
There are some places where the scope of a variable can be reduced so do that.
Quoted 6 lines
Signed-off-by Paul M Stillwell Jr <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 8 ++++---- drivers/net/ethernet/intel/ice/ice_main.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
Tony Nguyen
maintainerPATCH 13/13 ice: remove local variable
In reply to Tony NguyenFrom: Paul M Stillwell Jr <[email protected]>
Remove the local variable since it's only used once. Instead, use it directly.
--- drivers/net/ethernet/intel/ice/ice_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +1 -2
@@ -3026,7 +3026,6 @@ static void ice_set_netdev_features(struct net_device *netdev)*/ static int ice_cfg_netdev (struct ice_vsi *vsi) { -struct ice_pf *pf = vsi->back;struct ice_netdev_priv *np;struct net_device *netdev;u8 mac_addr[ETH_ALEN ];
@@ -3046,7 +3045,7 @@ static int ice_cfg_netdev(struct ice_vsi *vsi)ice_set_ops (netdev);if (vsi->type ==ICE_VSI_PF ) { -SET_NETDEV_DEV (netdev,ice_pf_to_dev (pf)); +SET_NETDEV_DEV (netdev,ice_pf_to_dev (vsi->back));ether_addr_copy (mac_addr, vsi->port_info->mac.perm_addr);ether_addr_copy (netdev->dev_addr, mac_addr);ether_addr_copy (netdev->perm_addr, mac_addr);
Signature · 1 line
2.20.1
Brelinski
PATCH 13/13 ice: remove local variable
Quoted 9 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 13/13] ice: remove local variableFrom: Paul M Stillwell Jr <[email protected]>
Quoted 7 lines
Remove the local variable since it's only used once. Instead, use it directly.
Signed-off-by Paul M Stillwell Jr <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Brelinski
PATCH 1/13 ice: use static inline for dummy functions
In reply to Tony NguyenQuoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Thursday, May 6, 2021 8:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S59 01/13] ice: use static inline for dummy functionsFrom: Jesse Brandeburg <[email protected]>
Trivial:
The driver had previously attempted to use #define macros to make functions that have no use in certain configs disappear. Using static inlines instead allows for certain static checkers to process the code better, and results in no functional change.Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Tony Nguyen <[email protected]>
Quoted 7 lines
--- drivers/net/ethernet/intel/ice/ice_arfs.h | 12 +++++----- drivers/net/ethernet/intel/ice/ice_dcb_lib.h | 15 +++++++------ drivers/net/ethernet/intel/ice/ice_dcb_nl.h | 9 ++++---- .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 22 ++++++++++--------- drivers/net/ethernet/intel/ice/ice_xsk.h | 4 ++-- 5 files changed, 33 insertions(+), 29 deletions(-)