Skip to content

Commit b32add2

Browse files
committed
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-08-24 (igc, e1000e) This series contains updates to igc and e1000e drivers. Vinicius adds support for utilizing multiple PTP registers on igc. Sasha reduces interval time for PTM on igc and adds new device support on e1000e. * '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue: e1000e: Add support for the next LOM generation igc: Decrease PTM short interval from 10 us to 1 us igc: Add support for multiple in-flight TX timestamps ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 52d08fd + 1fe4f45 commit b32add2

File tree

11 files changed

+210
-64
lines changed

11 files changed

+210
-64
lines changed

drivers/net/ethernet/intel/e1000e/ethtool.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
917917
case e1000_pch_mtp:
918918
case e1000_pch_lnp:
919919
case e1000_pch_ptp:
920+
case e1000_pch_nvp:
920921
mask |= BIT(18);
921922
break;
922923
default:
@@ -1585,6 +1586,7 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
15851586
case e1000_pch_mtp:
15861587
case e1000_pch_lnp:
15871588
case e1000_pch_ptp:
1589+
case e1000_pch_nvp:
15881590
fext_nvm11 = er32(FEXTNVM11);
15891591
fext_nvm11 &= ~E1000_FEXTNVM11_DISABLE_MULR_FIX;
15901592
ew32(FEXTNVM11, fext_nvm11);

drivers/net/ethernet/intel/e1000e/hw.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ struct e1000_hw;
122122
#define E1000_DEV_ID_PCH_PTP_I219_V26 0x57B6
123123
#define E1000_DEV_ID_PCH_PTP_I219_LM27 0x57B7
124124
#define E1000_DEV_ID_PCH_PTP_I219_V27 0x57B8
125+
#define E1000_DEV_ID_PCH_NVL_I219_LM29 0x57B9
126+
#define E1000_DEV_ID_PCH_NVL_I219_V29 0x57BA
125127

126128
#define E1000_REVISION_4 4
127129

@@ -150,6 +152,7 @@ enum e1000_mac_type {
150152
e1000_pch_mtp,
151153
e1000_pch_lnp,
152154
e1000_pch_ptp,
155+
e1000_pch_nvp,
153156
};
154157

155158
enum e1000_media_type {

drivers/net/ethernet/intel/e1000e/ich8lan.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
323323
case e1000_pch_mtp:
324324
case e1000_pch_lnp:
325325
case e1000_pch_ptp:
326+
case e1000_pch_nvp:
326327
if (e1000_phy_is_accessible_pchlan(hw))
327328
break;
328329

@@ -470,6 +471,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
470471
case e1000_pch_mtp:
471472
case e1000_pch_lnp:
472473
case e1000_pch_ptp:
474+
case e1000_pch_nvp:
473475
/* In case the PHY needs to be in mdio slow mode,
474476
* set slow mode and try to get the PHY id again.
475477
*/
@@ -717,6 +719,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw)
717719
case e1000_pch_mtp:
718720
case e1000_pch_lnp:
719721
case e1000_pch_ptp:
722+
case e1000_pch_nvp:
720723
case e1000_pchlan:
721724
/* check management mode */
722725
mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan;
@@ -1685,6 +1688,7 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
16851688
case e1000_pch_mtp:
16861689
case e1000_pch_lnp:
16871690
case e1000_pch_ptp:
1691+
case e1000_pch_nvp:
16881692
rc = e1000_init_phy_params_pchlan(hw);
16891693
break;
16901694
default:
@@ -2142,6 +2146,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
21422146
case e1000_pch_mtp:
21432147
case e1000_pch_lnp:
21442148
case e1000_pch_ptp:
2149+
case e1000_pch_nvp:
21452150
sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
21462151
break;
21472152
default:
@@ -3188,6 +3193,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank)
31883193
case e1000_pch_mtp:
31893194
case e1000_pch_lnp:
31903195
case e1000_pch_ptp:
3196+
case e1000_pch_nvp:
31913197
bank1_offset = nvm->flash_bank_size;
31923198
act_offset = E1000_ICH_NVM_SIG_WORD;
31933199

@@ -4129,6 +4135,7 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
41294135
case e1000_pch_mtp:
41304136
case e1000_pch_lnp:
41314137
case e1000_pch_ptp:
4138+
case e1000_pch_nvp:
41324139
word = NVM_COMPAT;
41334140
valid_csum_mask = NVM_COMPAT_VALID_CSUM;
41344141
break;

drivers/net/ethernet/intel/e1000e/netdev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3545,6 +3545,7 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)
35453545
case e1000_pch_mtp:
35463546
case e1000_pch_lnp:
35473547
case e1000_pch_ptp:
3548+
case e1000_pch_nvp:
35483549
if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI) {
35493550
/* Stable 24MHz frequency */
35503551
incperiod = INCPERIOD_24MHZ;
@@ -4061,6 +4062,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
40614062
case e1000_pch_mtp:
40624063
case e1000_pch_lnp:
40634064
case e1000_pch_ptp:
4065+
case e1000_pch_nvp:
40644066
fc->refresh_time = 0xFFFF;
40654067
fc->pause_time = 0xFFFF;
40664068

@@ -7913,6 +7915,8 @@ static const struct pci_device_id e1000_pci_tbl[] = {
79137915
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_PTP_I219_V26), board_pch_mtp },
79147916
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_PTP_I219_LM27), board_pch_mtp },
79157917
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_PTP_I219_V27), board_pch_mtp },
7918+
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_NVL_I219_LM29), board_pch_mtp },
7919+
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_NVL_I219_V29), board_pch_mtp },
79167920

79177921
{ 0, 0, 0, 0, 0, 0, 0 } /* terminate list */
79187922
};

drivers/net/ethernet/intel/e1000e/ptp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ void e1000e_ptp_init(struct e1000_adapter *adapter)
288288
case e1000_pch_mtp:
289289
case e1000_pch_lnp:
290290
case e1000_pch_ptp:
291+
case e1000_pch_nvp:
291292
if ((hw->mac.type < e1000_pch_lpt) ||
292293
(er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)) {
293294
adapter->ptp_clock_info.max_adj = 24000000 - 1;

drivers/net/ethernet/intel/igc/igc.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ void igc_ethtool_set_ops(struct net_device *);
3838

3939
#define MAX_FLEX_FILTER 32
4040

41+
#define IGC_MAX_TX_TSTAMP_REGS 4
42+
4143
enum igc_mac_filter_type {
4244
IGC_MAC_FILTER_TYPE_DST = 0,
4345
IGC_MAC_FILTER_TYPE_SRC
@@ -70,6 +72,15 @@ struct igc_rx_packet_stats {
7072
u64 other_packets;
7173
};
7274

75+
struct igc_tx_timestamp_request {
76+
struct sk_buff *skb; /* reference to the packet being timestamped */
77+
unsigned long start; /* when the tstamp request started (jiffies) */
78+
u32 mask; /* _TSYNCTXCTL_TXTT_{X} bit for this request */
79+
u32 regl; /* which TXSTMPL_{X} register should be used */
80+
u32 regh; /* which TXSTMPH_{X} register should be used */
81+
u32 flags; /* flags that should be added to the tx_buffer */
82+
};
83+
7384
struct igc_ring_container {
7485
struct igc_ring *ring; /* pointer to linked list of rings */
7586
unsigned int total_bytes; /* total bytes processed this int */
@@ -245,9 +256,8 @@ struct igc_adapter {
245256
* ptp_tx_lock.
246257
*/
247258
spinlock_t ptp_tx_lock;
248-
struct sk_buff *ptp_tx_skb;
259+
struct igc_tx_timestamp_request tx_tstamp[IGC_MAX_TX_TSTAMP_REGS];
249260
struct hwtstamp_config tstamp_config;
250-
unsigned long ptp_tx_start;
251261
unsigned int ptp_flags;
252262
/* System time value lock */
253263
spinlock_t tmreg_lock;
@@ -455,6 +465,10 @@ enum igc_tx_flags {
455465
/* olinfo flags */
456466
IGC_TX_FLAGS_IPV4 = 0x10,
457467
IGC_TX_FLAGS_CSUM = 0x20,
468+
469+
IGC_TX_FLAGS_TSTAMP_1 = 0x100,
470+
IGC_TX_FLAGS_TSTAMP_2 = 0x200,
471+
IGC_TX_FLAGS_TSTAMP_3 = 0x400,
458472
};
459473

460474
enum igc_boards {

drivers/net/ethernet/intel/igc/igc_base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ struct igc_adv_tx_context_desc {
3434

3535
/* Adv Transmit Descriptor Config Masks */
3636
#define IGC_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp packet */
37+
#define IGC_ADVTXD_TSTAMP_REG_1 0x00010000 /* Select register 1 for timestamp */
38+
#define IGC_ADVTXD_TSTAMP_REG_2 0x00020000 /* Select register 2 for timestamp */
39+
#define IGC_ADVTXD_TSTAMP_REG_3 0x00030000 /* Select register 3 for timestamp */
3740
#define IGC_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */
3841
#define IGC_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */
3942
#define IGC_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */

drivers/net/ethernet/intel/igc/igc_defines.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,13 +454,20 @@
454454

455455
/* Time Sync Transmit Control bit definitions */
456456
#define IGC_TSYNCTXCTL_TXTT_0 0x00000001 /* Tx timestamp reg 0 valid */
457+
#define IGC_TSYNCTXCTL_TXTT_1 0x00000002 /* Tx timestamp reg 1 valid */
458+
#define IGC_TSYNCTXCTL_TXTT_2 0x00000004 /* Tx timestamp reg 2 valid */
459+
#define IGC_TSYNCTXCTL_TXTT_3 0x00000008 /* Tx timestamp reg 3 valid */
457460
#define IGC_TSYNCTXCTL_ENABLED 0x00000010 /* enable Tx timestamping */
458461
#define IGC_TSYNCTXCTL_MAX_ALLOWED_DLY_MASK 0x0000F000 /* max delay */
459462
#define IGC_TSYNCTXCTL_SYNC_COMP_ERR 0x20000000 /* sync err */
460463
#define IGC_TSYNCTXCTL_SYNC_COMP 0x40000000 /* sync complete */
461464
#define IGC_TSYNCTXCTL_START_SYNC 0x80000000 /* initiate sync */
462465
#define IGC_TSYNCTXCTL_TXSYNSIG 0x00000020 /* Sample TX tstamp in PHY sop */
463466

467+
#define IGC_TSYNCTXCTL_TXTT_ANY ( \
468+
IGC_TSYNCTXCTL_TXTT_0 | IGC_TSYNCTXCTL_TXTT_1 | \
469+
IGC_TSYNCTXCTL_TXTT_2 | IGC_TSYNCTXCTL_TXTT_3)
470+
464471
/* Timer selection bits */
465472
#define IGC_AUX_IO_TIMER_SEL_SYSTIM0 (0u << 30) /* Select SYSTIM0 for auxiliary time stamp */
466473
#define IGC_AUX_IO_TIMER_SEL_SYSTIM1 (1u << 30) /* Select SYSTIM1 for auxiliary time stamp */
@@ -549,7 +556,7 @@
549556
#define IGC_PTM_CTRL_SHRT_CYC(usec) (((usec) & 0x3f) << 2)
550557
#define IGC_PTM_CTRL_PTM_TO(usec) (((usec) & 0xff) << 8)
551558

552-
#define IGC_PTM_SHORT_CYC_DEFAULT 10 /* Default Short/interrupted cycle interval */
559+
#define IGC_PTM_SHORT_CYC_DEFAULT 1 /* Default short cycle interval */
553560
#define IGC_PTM_CYC_TIME_DEFAULT 5 /* Default PTM cycle time */
554561
#define IGC_PTM_TIMEOUT_DEFAULT 255 /* Default timeout for PTM errors */
555562

drivers/net/ethernet/intel/igc/igc_main.c

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,10 +1271,21 @@ static u32 igc_tx_cmd_type(struct sk_buff *skb, u32 tx_flags)
12711271
cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSO,
12721272
(IGC_ADVTXD_DCMD_TSE));
12731273

1274-
/* set timestamp bit if present */
1274+
/* set timestamp bit if present, will select the register set
1275+
* based on the _TSTAMP(_X) bit.
1276+
*/
12751277
cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSTAMP,
12761278
(IGC_ADVTXD_MAC_TSTAMP));
12771279

1280+
cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSTAMP_1,
1281+
(IGC_ADVTXD_TSTAMP_REG_1));
1282+
1283+
cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSTAMP_2,
1284+
(IGC_ADVTXD_TSTAMP_REG_2));
1285+
1286+
cmd_type |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_TSTAMP_3,
1287+
(IGC_ADVTXD_TSTAMP_REG_3));
1288+
12781289
/* insert frame checksum */
12791290
cmd_type ^= IGC_SET_FLAG(skb->no_fcs, 1, IGC_ADVTXD_DCMD_IFCS);
12801291

@@ -1533,6 +1544,26 @@ static int igc_tso(struct igc_ring *tx_ring,
15331544
return 1;
15341545
}
15351546

1547+
static bool igc_request_tx_tstamp(struct igc_adapter *adapter, struct sk_buff *skb, u32 *flags)
1548+
{
1549+
int i;
1550+
1551+
for (i = 0; i < IGC_MAX_TX_TSTAMP_REGS; i++) {
1552+
struct igc_tx_timestamp_request *tstamp = &adapter->tx_tstamp[i];
1553+
1554+
if (tstamp->skb)
1555+
continue;
1556+
1557+
tstamp->skb = skb_get(skb);
1558+
tstamp->start = jiffies;
1559+
*flags = tstamp->flags;
1560+
1561+
return true;
1562+
}
1563+
1564+
return false;
1565+
}
1566+
15361567
static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb,
15371568
struct igc_ring *tx_ring)
15381569
{
@@ -1614,14 +1645,12 @@ static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb,
16141645
* timestamping request.
16151646
*/
16161647
unsigned long flags;
1648+
u32 tstamp_flags;
16171649

16181650
spin_lock_irqsave(&adapter->ptp_tx_lock, flags);
1619-
if (!adapter->ptp_tx_skb) {
1651+
if (igc_request_tx_tstamp(adapter, skb, &tstamp_flags)) {
16201652
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
1621-
tx_flags |= IGC_TX_FLAGS_TSTAMP;
1622-
1623-
adapter->ptp_tx_skb = skb_get(skb);
1624-
adapter->ptp_tx_start = jiffies;
1653+
tx_flags |= IGC_TX_FLAGS_TSTAMP | tstamp_flags;
16251654
} else {
16261655
adapter->tx_hwtstamp_skipped++;
16271656
}

0 commit comments

Comments
 (0)