Commit 6af19103 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files
Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2024-01-29 (e1000e, ixgbe)

This series contains updates to e1000e and ixgbe drivers.

Jake corrects values used for maximum frequency adjustment for e1000e.

Christophe Jaillet adjusts error handling path so that semaphore is
released on ixgbe.

* '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
  ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
  e1000e: correct maximum frequency adjustment values
====================

Link: https://lore.kernel.org/r/20240129185240.787397-1-anthony.l.nguyen@intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 1a89e24f bbc404d2
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -360,23 +360,43 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);
 * As a result, a shift of INCVALUE_SHIFT_n is used to fit a value of
 * INCVALUE_n into the TIMINCA register allowing 32+8+(24-INCVALUE_SHIFT_n)
 * bits to count nanoseconds leaving the rest for fractional nonseconds.
 *
 * Any given INCVALUE also has an associated maximum adjustment value. This
 * maximum adjustment value is the largest increase (or decrease) which can be
 * safely applied without overflowing the INCVALUE. Since INCVALUE has
 * a maximum range of 24 bits, its largest value is 0xFFFFFF.
 *
 * To understand where the maximum value comes from, consider the following
 * equation:
 *
 *   new_incval = base_incval + (base_incval * adjustment) / 1billion
 *
 * To avoid overflow that means:
 *   max_incval = base_incval + (base_incval * max_adj) / billion
 *
 * Re-arranging:
 *   max_adj = floor(((max_incval - base_incval) * 1billion) / 1billion)
 */
#define INCVALUE_96MHZ		125
#define INCVALUE_SHIFT_96MHZ	17
#define INCPERIOD_SHIFT_96MHZ	2
#define INCPERIOD_96MHZ		(12 >> INCPERIOD_SHIFT_96MHZ)
#define MAX_PPB_96MHZ		23999900 /* 23,999,900 ppb */

#define INCVALUE_25MHZ		40
#define INCVALUE_SHIFT_25MHZ	18
#define INCPERIOD_25MHZ		1
#define MAX_PPB_25MHZ		599999900 /* 599,999,900 ppb */

#define INCVALUE_24MHZ		125
#define INCVALUE_SHIFT_24MHZ	14
#define INCPERIOD_24MHZ		3
#define MAX_PPB_24MHZ		999999999 /* 999,999,999 ppb */

#define INCVALUE_38400KHZ	26
#define INCVALUE_SHIFT_38400KHZ	19
#define INCPERIOD_38400KHZ	1
#define MAX_PPB_38400KHZ	230769100 /* 230,769,100 ppb */

/* Another drawback of scaling the incvalue by a large factor is the
 * 64-bit SYSTIM register overflows more quickly.  This is dealt with
+15 −7
Original line number Diff line number Diff line
@@ -280,8 +280,17 @@ void e1000e_ptp_init(struct e1000_adapter *adapter)

	switch (hw->mac.type) {
	case e1000_pch2lan:
		adapter->ptp_clock_info.max_adj = MAX_PPB_96MHZ;
		break;
	case e1000_pch_lpt:
		if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)
			adapter->ptp_clock_info.max_adj = MAX_PPB_96MHZ;
		else
			adapter->ptp_clock_info.max_adj = MAX_PPB_25MHZ;
		break;
	case e1000_pch_spt:
		adapter->ptp_clock_info.max_adj = MAX_PPB_24MHZ;
		break;
	case e1000_pch_cnp:
	case e1000_pch_tgp:
	case e1000_pch_adp:
@@ -289,15 +298,14 @@ void e1000e_ptp_init(struct e1000_adapter *adapter)
	case e1000_pch_lnp:
	case e1000_pch_ptp:
	case e1000_pch_nvp:
		if ((hw->mac.type < e1000_pch_lpt) ||
		    (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)) {
			adapter->ptp_clock_info.max_adj = 24000000 - 1;
		if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)
			adapter->ptp_clock_info.max_adj = MAX_PPB_24MHZ;
		else
			adapter->ptp_clock_info.max_adj = MAX_PPB_38400KHZ;
		break;
		}
		fallthrough;
	case e1000_82574:
	case e1000_82583:
		adapter->ptp_clock_info.max_adj = 600000000 - 1;
		adapter->ptp_clock_info.max_adj = MAX_PPB_25MHZ;
		break;
	default:
		break;
+2 −1
Original line number Diff line number Diff line
@@ -716,7 +716,8 @@ static s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
	if ((command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK) != 0) {
		error = FIELD_GET(IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK, command);
		hw_dbg(hw, "Failed to read, error %x\n", error);
		return -EIO;
		ret = -EIO;
		goto out;
	}

	if (!ret)