Skip to content

Commit

Permalink
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…tnguy/net-queue

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/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
kuba-moo committed Jan 31, 2024
2 parents 1a89e24 + bbc404d commit 6af1910
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
20 changes: 20 additions & 0 deletions drivers/net/ethernet/intel/e1000e/e1000.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 15 additions & 7 deletions drivers/net/ethernet/intel/e1000e/ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,24 +280,32 @@ 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:
case e1000_pch_mtp:
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;
break;
}
fallthrough;
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;
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;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6af1910

Please sign in to comment.