ice: Schedule service task in IRQ top half
Subsystems (3)
PATCH v2 1/2 ice: Schedule service task in IRQ top half
Schedule service task and EXTTS in the top half to avoid bottom half scheduling if possible, which significantly reduces timestamping delay.
---
V1 -> V2: Added missing opening curly brace
drivers/net/ethernet/intel/ice/ice.h | 1 - drivers/net/ethernet/intel/ice/ice_main.c | 20 +++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +0 -1
@@ -517,7 +517,6 @@ enum ice_pf_flags { };enum ice_misc_thread_tasks { -ICE_MISC_THREAD_EXTTS_EVENT ,ICE_MISC_THREAD_TX_TSTAMP ,ICE_MISC_THREAD_NBITS /* must be last */ };
drivers/net/ethernet/intel/ice/ice_main.c +11 -9
@@ -3066,6 +3066,7 @@ static void ice_ena_misc_vector(struct ice_pf *pf)static irqreturn_t ice_misc_intr (int __always_unused irq,void *data) {struct ice_pf *pf = (struct ice_pf *)data; +irqreturn_t ret =IRQ_HANDLED ;struct ice_hw *hw = &pf->hw;struct device *dev;u32 oicr, ena_mask;
@@ -3147,8 +3148,10 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)if (oicr &PFINT_OICR_TSYN_TX_M ) { ena_mask &= ~PFINT_OICR_TSYN_TX_M ; -if (ice_ptp_pf_handles_tx_interrupt (pf)) +if (ice_ptp_pf_handles_tx_interrupt (pf)) {set_bit (ICE_MISC_THREAD_TX_TSTAMP , pf->misc_thread); + ret =IRQ_WAKE_THREAD ; + } }if (oicr &PFINT_OICR_TSYN_EVNT_M ) {
@@ -3164,7 +3167,7 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)GLTSYN_STAT_EVENT1_M | GLTSYN_STAT_EVENT2_M); -set_bit (ICE_MISC_THREAD_EXTTS_EVENT , pf->misc_thread); +ice_ptp_extts_event (pf); } }
@@ -3187,8 +3190,11 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)set_bit (ICE_PFR_REQ , pf->state); } } +ice_service_task_schedule (pf); +if (ret ==IRQ_HANDLED ) +ice_irq_dynamic_ena (hw,NULL ,NULL ); -return IRQ_WAKE_THREAD ; +return ret; }/**
@@ -3204,12 +3210,7 @@ static irqreturn_t ice_misc_intr_thread_fn(int __always_unused irq, void *data) hw = &pf->hw;if (ice_is_reset_in_progress (pf->state)) -return IRQ_HANDLED ; - -ice_service_task_schedule (pf); - -if (test_and_clear_bit (ICE_MISC_THREAD_EXTTS_EVENT , pf->misc_thread)) -ice_ptp_extts_event (pf); + goto skip_irq;if (test_and_clear_bit (ICE_MISC_THREAD_TX_TSTAMP , pf->misc_thread)) {/* Process outstanding Tx timestamps. If there is more work,
@@ -3221,6 +3222,7 @@ static irqreturn_t ice_misc_intr_thread_fn(int __always_unused irq, void *data) } } +skip_irq:ice_irq_dynamic_ena (hw,NULL ,NULL );return IRQ_HANDLED ;
base-commit: a1c79fa9e5cd3288ecb4019692a4d3ccbf7d2370
Signature · 1 line
2.40.1
PATCH v2 2/2 ice: Enable SW interrupt from FW for LL TS
Introduce new capability - Low Latency Timestamping with Interrupt. On supported devices, driver can request a single timestamp from FW without polling the register afterwards. Instead, FW can issue a dedicated interrupt when the timestamp was read from the PHY register and its value is available to read from the register.
This eliminates the need of bottom half scheduling, which results in minimal delay for timestamping.
For this mode, allocate TS indices sequentially, so that timestamps are always completed in FIFO manner.
--- drivers/net/ethernet/intel/ice/ice.h | 2 + drivers/net/ethernet/intel/ice/ice_common.c | 3 + .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 120 +++++++++++-- drivers/net/ethernet/intel/ice/ice_ptp.c | 163 ++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_ptp.h | 9 + drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 1 + drivers/net/ethernet/intel/ice/ice_type.h | 2 + 8 files changed, 274 insertions(+), 28 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +2 -0
@@ -603,6 +603,7 @@ struct ice_pf {u32 hw_csum_rx_error;u32 oicr_err_reg;struct msi_map oicr_irq;/* Other interrupt cause MSIX vector */ +struct msi_map ll_ts_irq;/* LL_TS interrupt MSIX vector */ u16 max_pf_txqs;/* Total Tx queues PF wide */ u16 max_pf_rxqs;/* Total Rx queues PF wide */ u16 num_lan_msix;/* Total MSIX vectors for base driver */
@@ -627,6 +628,7 @@ struct ice_pf {unsigned long tx_timeout_last_recovery;u32 tx_timeout_recovery_level;char int_name[ICE_INT_NAME_STR_LEN ]; +char int_name_ll_ts[ICE_INT_NAME_STR_LEN ];struct auxiliary_device *adev;int aux_idx;u32 sw_int_count;
drivers/net/ethernet/intel/ice/ice_common.c +3 -0
@@ -2664,6 +2664,7 @@ ice_parse_1588_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p, info->tmr1_ena = ((number &ICE_TS_TMR1_ENA_M ) !=0 ); info->ts_ll_read = ((number &ICE_TS_LL_TX_TS_READ_M ) !=0 ); + info->ts_ll_int_read = ((number &ICE_TS_LL_TX_TS_INT_READ_M ) !=0 ); info->ena_ports = logical_id; info->tmr_own_map = phys_id;
@@ -2684,6 +2685,8 @@ ice_parse_1588_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p, info->tmr1_ena);ice_debug (hw,ICE_DBG_INIT ,"dev caps: ts_ll_read = %u\n" , info->ts_ll_read); +ice_debug (hw,ICE_DBG_INIT ,"dev caps: ts_ll_int_read = %u\n" , + info->ts_ll_int_read);ice_debug (hw,ICE_DBG_INIT ,"dev caps: ieee_1588 ena_ports = %u\n" , info->ena_ports); ice_debug(hw, ICE_DBG_INIT, "dev caps: tmr_own_map = %u\n",
drivers/net/ethernet/intel/ice/ice_hw_autogen.h +2 -0
@@ -200,6 +200,8 @@#define GLINT_VECT2FUNC_PF_NUM_M ICE_M(0x7, 12)#define GLINT_VECT2FUNC_IS_PF_S 16#define GLINT_VECT2FUNC_IS_PF_M BIT(16) +#define PFINT_ALLOC 0x001D2600 +#define PFINT_ALLOC_FIRST ICE_M(0x7FF, 0)#define PFINT_FW_CTL 0x0016C800#define PFINT_FW_CTL_MSIX_INDX_M ICE_M(0x7FF, 0)#define PFINT_FW_CTL_ITR_INDX_S 11
drivers/net/ethernet/intel/ice/ice_main.c +110 -10
185 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_ptp.c +145 -18
277 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_ptp.h +9 -0
@@ -131,6 +131,7 @@ enum ice_tx_tstamp_work {* @calibrating: if true, the PHY is calibrating the Tx offset. During this * window, timestamps are temporarily disabled. * @verify_cached: if true, verify new timestamp differs from last read value +* @last_ll_ts_idx_read: index of the last LL TS read by the FW */ struct ice_ptp_tx {spinlock_t lock;/* lock protecting in_use bitmap */
@@ -143,6 +144,7 @@ struct ice_ptp_tx { u8 init : 1; u8 calibrating : 1; u8 verify_cached : 1; +s8 last_ll_ts_idx_read; };/* Quad and port information for initializing timestamp blocks */
@@ -296,6 +298,8 @@ void ice_ptp_restore_timestamp_mode(struct ice_pf *pf);void ice_ptp_extts_event (struct ice_pf *pf);s8 ice_ptp_request_ts (struct ice_ptp_tx *tx,struct sk_buff *skb); +void ice_ptp_req_tx_single_tstamp (struct ice_ptp_tx *tx,u8 idx); +void ice_ptp_complete_tx_single_tstamp (struct ice_ptp_tx *tx);enum ice_tx_tstamp_work ice_ptp_process_ts (struct ice_pf *pf);void
@@ -325,6 +329,11 @@ ice_ptp_request_ts(struct ice_ptp_tx *tx, struct sk_buff *skb)return -1 ; } +static inline void ice_ptp_req_tx_single_tstamp (struct ice_ptp_tx *tx,u8 idx) +{ } + +static inline void ice_ptp_complete_tx_single_tstamp (struct ice_ptp_tx *tx) { } +static inline bool ice_ptp_process_ts (struct ice_pf *pf) {return true;
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +1 -0
@@ -509,6 +509,7 @@ int ice_cgu_get_output_pin_state_caps(struct ice_hw *hw, u8 pin_id,#define TS_LL_READ_RETRIES 200#define TS_LL_READ_TS_HIGH GENMASK(23, 16)#define TS_LL_READ_TS_IDX GENMASK(29, 24) +#define TS_LL_READ_TS_INTR BIT(30)#define TS_LL_READ_TS BIT(31)/* Internal PHY timestamp address */
drivers/net/ethernet/intel/ice/ice_type.h +2 -0
@@ -351,6 +351,7 @@ struct ice_ts_func_info {#define ICE_TS_TMR0_ENA_M BIT(25)#define ICE_TS_TMR1_ENA_M BIT(26)#define ICE_TS_LL_TX_TS_READ_M BIT(28) +#define ICE_TS_LL_TX_TS_INT_READ_M BIT(29)struct ice_ts_dev_info {/* Device specific info */
@@ -364,6 +365,7 @@ struct ice_ts_dev_info {u8 tmr0_ena;u8 tmr1_ena;u8 ts_ll_read; +u8 ts_ll_int_read; };/* Function specific capabilities */
Signature · 1 line
2.40.1
RE: [Intel-wired-lan] [PATCH v2 iwl-next 2/2] ice: Enable SW interrupt from FW for LL TS
Quoted 23 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Karol Kolacinski
Sent: Wednesday, November 29, 2023 6:10 PM
To: [email protected]
Cc: Kitszel, Przemyslaw <[email protected]>; Brandeburg, Jesse <[email protected]>; Kolacinski, Karol <[email protected]>; Nguyen, Anthony L <[email protected]>; Hagvi, Yochai <[email protected]>; [email protected]
Subject: [Intel-wired-lan] [PATCH v2 iwl-next 2/2] ice: Enable SW interrupt from FW for LL TSIntroduce new capability - Low Latency Timestamping with Interrupt. On supported devices, driver can request a single timestamp from FW without polling the register afterwards. Instead, FW can issue a dedicated interrupt when the timestamp was read from the PHY register and its value is available to read from the register.
This eliminates the need of bottom half scheduling, which results in minimal delay for timestamping.For this mode, allocate TS indices sequentially, so that timestamps are always completed in FIFO manner.
Co-developed-by Yochai Hagvi <[email protected]>Signed-off-by Yochai Hagvi <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Signed-off-by Karol Kolacinski <[email protected]>
Quoted 11 lines
--- drivers/net/ethernet/intel/ice/ice.h | 2 + drivers/net/ethernet/intel/ice/ice_common.c | 3 + .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 120 +++++++++++-- drivers/net/ethernet/intel/ice/ice_ptp.c | 163 ++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_ptp.h | 9 + drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 1 + drivers/net/ethernet/intel/ice/ice_type.h | 2 + 8 files changed, 274 insertions(+), 28 deletions(-)
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Karol Kolacinski
Sent: Wednesday, November 29, 2023 6:10 PM
To: [email protected]
Cc: Michalik, Michal <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kolacinski, Karol <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH v2 iwl-next 1/2] ice: Schedule service task in IRQ top halfSchedule service task and EXTTS in the top half to avoid bottom half scheduling if possible, which significantly reduces timestamping delay.
Co-developed-by Michal Michalik <[email protected]>Signed-off-by Michal Michalik <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Signed-off-by Karol Kolacinski <[email protected]>
Quoted 7 lines
---
V1 -> V2: Added missing opening curly bracedrivers/net/ethernet/intel/ice/ice.h | 1 - drivers/net/ethernet/intel/ice/ice_main.c | 20 +++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-)