提交 6b1ff5d3 编写于 作者: J Jacob Keller 提交者: Tony Nguyen

ice: always call ice_ptp_link_change and make it void

The ice_ptp_link_change function is currently only called for E822 based
hardware. Future changes are going to extend this function to perform
additional tasks on link change.

Always call this function, moving the E810 check from the callers down to
just before we call the E822-specific function required to restart the PHY.

This function also returns an error value, but none of the callers actually
check it. In general, the errors it produces are more likely systemic
problems such as invalid or corrupt port numbers. No caller checks these,
and so no warning is logged.

Re-order the flag checks so that ICE_FLAG_PTP is checked first. Drop the
unnecessary check for ICE_FLAG_PTP_SUPPORTED, as ICE_FLAG_PTP will not be
set except when ICE_FLAG_PTP_SUPPORTED is set.

Convert the port checks to WARN_ON_ONCE, in order to generate a kernel
stack trace when they are hit.

Convert the function to void since no caller actually checks these return
values.
Co-developed-by: NDave Ertman <david.m.ertman@intel.com>
Signed-off-by: NDave Ertman <david.m.ertman@intel.com>
Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
上级 11722c39
...@@ -1111,7 +1111,6 @@ ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up, ...@@ -1111,7 +1111,6 @@ ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up,
if (link_up == old_link && link_speed == old_link_speed) if (link_up == old_link && link_speed == old_link_speed)
return 0; return 0;
if (!ice_is_e810(&pf->hw))
ice_ptp_link_change(pf, pf->hw.pf_id, link_up); ice_ptp_link_change(pf, pf->hw.pf_id, link_up);
if (ice_is_dcb_active(pf)) { if (ice_is_dcb_active(pf)) {
...@@ -6340,7 +6339,6 @@ static int ice_up_complete(struct ice_vsi *vsi) ...@@ -6340,7 +6339,6 @@ static int ice_up_complete(struct ice_vsi *vsi)
ice_print_link_msg(vsi, true); ice_print_link_msg(vsi, true);
netif_tx_start_all_queues(vsi->netdev); netif_tx_start_all_queues(vsi->netdev);
netif_carrier_on(vsi->netdev); netif_carrier_on(vsi->netdev);
if (!ice_is_e810(&pf->hw))
ice_ptp_link_change(pf, pf->hw.pf_id, true); ice_ptp_link_change(pf, pf->hw.pf_id, true);
} }
...@@ -6773,7 +6771,6 @@ int ice_down(struct ice_vsi *vsi) ...@@ -6773,7 +6771,6 @@ int ice_down(struct ice_vsi *vsi)
if (vsi->netdev && vsi->type == ICE_VSI_PF) { if (vsi->netdev && vsi->type == ICE_VSI_PF) {
vlan_err = ice_vsi_del_vlan_zero(vsi); vlan_err = ice_vsi_del_vlan_zero(vsi);
if (!ice_is_e810(&vsi->back->hw))
ice_ptp_link_change(vsi->back, vsi->back->hw.pf_id, false); ice_ptp_link_change(vsi->back, vsi->back->hw.pf_id, false);
netif_carrier_off(vsi->netdev); netif_carrier_off(vsi->netdev);
netif_tx_disable(vsi->netdev); netif_tx_disable(vsi->netdev);
......
...@@ -1328,33 +1328,33 @@ ice_ptp_port_phy_restart(struct ice_ptp_port *ptp_port) ...@@ -1328,33 +1328,33 @@ ice_ptp_port_phy_restart(struct ice_ptp_port *ptp_port)
} }
/** /**
* ice_ptp_link_change - Set or clear port registers for timestamping * ice_ptp_link_change - Reconfigure PTP after link status change
* @pf: Board private structure * @pf: Board private structure
* @port: Port for which the PHY start is set * @port: Port for which the PHY start is set
* @linkup: Link is up or down * @linkup: Link is up or down
*/ */
int ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup) void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
{ {
struct ice_ptp_port *ptp_port; struct ice_ptp_port *ptp_port;
if (!test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) if (!test_bit(ICE_FLAG_PTP, pf->flags))
return 0; return;
if (port >= ICE_NUM_EXTERNAL_PORTS) if (WARN_ON_ONCE(port >= ICE_NUM_EXTERNAL_PORTS))
return -EINVAL; return;
ptp_port = &pf->ptp.port; ptp_port = &pf->ptp.port;
if (ptp_port->port_num != port) if (WARN_ON_ONCE(ptp_port->port_num != port))
return -EINVAL; return;
/* Update cached link status for this port immediately */ /* Update cached link status for this port immediately */
ptp_port->link_up = linkup; ptp_port->link_up = linkup;
if (!test_bit(ICE_FLAG_PTP, pf->flags)) /* E810 devices do not need to reconfigure the PHY */
/* PTP is not setup */ if (ice_is_e810(&pf->hw))
return -EAGAIN; return;
return ice_ptp_port_phy_restart(ptp_port); ice_ptp_port_phy_restart(ptp_port);
} }
/** /**
......
...@@ -257,7 +257,7 @@ void ice_ptp_reset(struct ice_pf *pf); ...@@ -257,7 +257,7 @@ void ice_ptp_reset(struct ice_pf *pf);
void ice_ptp_prepare_for_reset(struct ice_pf *pf); void ice_ptp_prepare_for_reset(struct ice_pf *pf);
void ice_ptp_init(struct ice_pf *pf); void ice_ptp_init(struct ice_pf *pf);
void ice_ptp_release(struct ice_pf *pf); void ice_ptp_release(struct ice_pf *pf);
int ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup); void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup);
#else /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */ #else /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
static inline int ice_ptp_set_ts_config(struct ice_pf *pf, struct ifreq *ifr) static inline int ice_ptp_set_ts_config(struct ice_pf *pf, struct ifreq *ifr)
{ {
...@@ -292,7 +292,8 @@ static inline void ice_ptp_reset(struct ice_pf *pf) { } ...@@ -292,7 +292,8 @@ static inline void ice_ptp_reset(struct ice_pf *pf) { }
static inline void ice_ptp_prepare_for_reset(struct ice_pf *pf) { } static inline void ice_ptp_prepare_for_reset(struct ice_pf *pf) { }
static inline void ice_ptp_init(struct ice_pf *pf) { } static inline void ice_ptp_init(struct ice_pf *pf) { }
static inline void ice_ptp_release(struct ice_pf *pf) { } static inline void ice_ptp_release(struct ice_pf *pf) { }
static inline int ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup) static inline void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
{ return 0; } {
}
#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */ #endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
#endif /* _ICE_PTP_H_ */ #endif /* _ICE_PTP_H_ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册