From: Greg Kroah-Hartman Date: Wed, 22 May 2024 15:14:11 +0000 (+0200) Subject: 6.1-stable patches X-Git-Tag: v4.19.315~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=93670ffae79e40493175f9fc8a5dd6e8e36382d9;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: ice-pass-vsi-pointer-into-ice_vc_isvalid_q_id.patch ice-remove-unnecessary-duplicate-checks-for-vf-vsi-id.patch net-ks8851-fix-another-tx-stall-caused-by-wrong-isr-flag-handling.patch --- diff --git a/queue-6.1/ice-pass-vsi-pointer-into-ice_vc_isvalid_q_id.patch b/queue-6.1/ice-pass-vsi-pointer-into-ice_vc_isvalid_q_id.patch new file mode 100644 index 00000000000..13f52df3a19 --- /dev/null +++ b/queue-6.1/ice-pass-vsi-pointer-into-ice_vc_isvalid_q_id.patch @@ -0,0 +1,127 @@ +From a21605993dd5dfd15edfa7f06705ede17b519026 Mon Sep 17 00:00:00 2001 +From: Jacob Keller +Date: Fri, 16 Feb 2024 14:06:35 -0800 +Subject: ice: pass VSI pointer into ice_vc_isvalid_q_id + +From: Jacob Keller + +commit a21605993dd5dfd15edfa7f06705ede17b519026 upstream. + +The ice_vc_isvalid_q_id() function takes a VSI index and a queue ID. It +looks up the VSI from its index, and then validates that the queue number +is valid for that VSI. + +The VSI ID passed is typically a VSI index from the VF. This VSI number is +validated by the PF to ensure that it matches the VSI associated with the +VF already. + +In every flow where ice_vc_isvalid_q_id() is called, the PF driver already +has a pointer to the VSI associated with the VF. This pointer is obtained +using ice_get_vf_vsi(), rather than looking up the VSI using the index sent +by the VF. + +Since we already know which VSI to operate on, we can modify +ice_vc_isvalid_q_id() to take a VSI pointer instead of a VSI index. Pass +the VSI we found from ice_get_vf_vsi() instead of re-doing the lookup. This +removes some unnecessary computation and scanning of the VSI list. + +It also removes the last place where the driver directly used the VSI +number from the VF. This will pave the way for refactoring to communicate +relative VSI numbers to the VF instead of absolute numbers from the PF +space. + +Signed-off-by: Jacob Keller +Reviewed-by: Przemek Kitszel +Tested-by: Rafal Romanowski +Signed-off-by: Tony Nguyen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/intel/ice/ice_virtchnl.c | 22 ++++++++++------------ + 1 file changed, 10 insertions(+), 12 deletions(-) + +--- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c ++++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c +@@ -544,17 +544,15 @@ bool ice_vc_isvalid_vsi_id(struct ice_vf + + /** + * ice_vc_isvalid_q_id +- * @vf: pointer to the VF info +- * @vsi_id: VSI ID ++ * @vsi: VSI to check queue ID against + * @qid: VSI relative queue ID + * + * check for the valid queue ID + */ +-static bool ice_vc_isvalid_q_id(struct ice_vf *vf, u16 vsi_id, u8 qid) ++static bool ice_vc_isvalid_q_id(struct ice_vsi *vsi, u8 qid) + { +- struct ice_vsi *vsi = ice_find_vsi(vf->pf, vsi_id); + /* allocated Tx and Rx queues should be always equal for VF VSI */ +- return (vsi && (qid < vsi->alloc_txq)); ++ return qid < vsi->alloc_txq; + } + + /** +@@ -1254,7 +1252,7 @@ static int ice_vc_ena_qs_msg(struct ice_ + */ + q_map = vqs->rx_queues; + for_each_set_bit(vf_q_id, &q_map, ICE_MAX_RSS_QS_PER_VF) { +- if (!ice_vc_isvalid_q_id(vf, vqs->vsi_id, vf_q_id)) { ++ if (!ice_vc_isvalid_q_id(vsi, vf_q_id)) { + v_ret = VIRTCHNL_STATUS_ERR_PARAM; + goto error_param; + } +@@ -1276,7 +1274,7 @@ static int ice_vc_ena_qs_msg(struct ice_ + + q_map = vqs->tx_queues; + for_each_set_bit(vf_q_id, &q_map, ICE_MAX_RSS_QS_PER_VF) { +- if (!ice_vc_isvalid_q_id(vf, vqs->vsi_id, vf_q_id)) { ++ if (!ice_vc_isvalid_q_id(vsi, vf_q_id)) { + v_ret = VIRTCHNL_STATUS_ERR_PARAM; + goto error_param; + } +@@ -1381,7 +1379,7 @@ static int ice_vc_dis_qs_msg(struct ice_ + q_map = vqs->tx_queues; + + for_each_set_bit(vf_q_id, &q_map, ICE_MAX_RSS_QS_PER_VF) { +- if (!ice_vc_isvalid_q_id(vf, vqs->vsi_id, vf_q_id)) { ++ if (!ice_vc_isvalid_q_id(vsi, vf_q_id)) { + v_ret = VIRTCHNL_STATUS_ERR_PARAM; + goto error_param; + } +@@ -1407,7 +1405,7 @@ static int ice_vc_dis_qs_msg(struct ice_ + bitmap_zero(vf->rxq_ena, ICE_MAX_RSS_QS_PER_VF); + } else if (q_map) { + for_each_set_bit(vf_q_id, &q_map, ICE_MAX_RSS_QS_PER_VF) { +- if (!ice_vc_isvalid_q_id(vf, vqs->vsi_id, vf_q_id)) { ++ if (!ice_vc_isvalid_q_id(vsi, vf_q_id)) { + v_ret = VIRTCHNL_STATUS_ERR_PARAM; + goto error_param; + } +@@ -1463,7 +1461,7 @@ ice_cfg_interrupt(struct ice_vf *vf, str + for_each_set_bit(vsi_q_id_idx, &qmap, ICE_MAX_RSS_QS_PER_VF) { + vsi_q_id = vsi_q_id_idx; + +- if (!ice_vc_isvalid_q_id(vf, vsi->vsi_num, vsi_q_id)) ++ if (!ice_vc_isvalid_q_id(vsi, vsi_q_id)) + return VIRTCHNL_STATUS_ERR_PARAM; + + q_vector->num_ring_rx++; +@@ -1477,7 +1475,7 @@ ice_cfg_interrupt(struct ice_vf *vf, str + for_each_set_bit(vsi_q_id_idx, &qmap, ICE_MAX_RSS_QS_PER_VF) { + vsi_q_id = vsi_q_id_idx; + +- if (!ice_vc_isvalid_q_id(vf, vsi->vsi_num, vsi_q_id)) ++ if (!ice_vc_isvalid_q_id(vsi, vsi_q_id)) + return VIRTCHNL_STATUS_ERR_PARAM; + + q_vector->num_ring_tx++; +@@ -1611,7 +1609,7 @@ static int ice_vc_cfg_qs_msg(struct ice_ + qpi->txq.headwb_enabled || + !ice_vc_isvalid_ring_len(qpi->txq.ring_len) || + !ice_vc_isvalid_ring_len(qpi->rxq.ring_len) || +- !ice_vc_isvalid_q_id(vf, qci->vsi_id, qpi->txq.queue_id)) { ++ !ice_vc_isvalid_q_id(vsi, qpi->txq.queue_id)) { + goto error_param; + } + diff --git a/queue-6.1/ice-remove-unnecessary-duplicate-checks-for-vf-vsi-id.patch b/queue-6.1/ice-remove-unnecessary-duplicate-checks-for-vf-vsi-id.patch new file mode 100644 index 00000000000..ea35e5afc89 --- /dev/null +++ b/queue-6.1/ice-remove-unnecessary-duplicate-checks-for-vf-vsi-id.patch @@ -0,0 +1,47 @@ +From 363f689600dd010703ce6391bcfc729a97d21840 Mon Sep 17 00:00:00 2001 +From: Jacob Keller +Date: Fri, 16 Feb 2024 14:06:36 -0800 +Subject: ice: remove unnecessary duplicate checks for VF VSI ID + +From: Jacob Keller + +commit 363f689600dd010703ce6391bcfc729a97d21840 upstream. + +The ice_vc_fdir_param_check() function validates that the VSI ID of the +virtchnl flow director command matches the VSI number of the VF. This is +already checked by the call to ice_vc_isvalid_vsi_id() immediately +following this. + +This check is unnecessary since ice_vc_isvalid_vsi_id() already confirms +this by checking that the VSI ID can locate the VSI associated with the VF +structure. + +Furthermore, a following change is going to refactor the ice driver to +report VSI IDs using a relative index for each VF instead of reporting the +PF VSI number. This additional check would break that logic since it +enforces that the VSI ID matches the VSI number. + +Since this check duplicates the logic in ice_vc_isvalid_vsi_id() and gets +in the way of refactoring that logic, remove it. + +Signed-off-by: Jacob Keller +Reviewed-by: Przemek Kitszel +Tested-by: Rafal Romanowski +Signed-off-by: Tony Nguyen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c ++++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +@@ -107,9 +107,6 @@ ice_vc_fdir_param_check(struct ice_vf *v + if (!(vf->driver_caps & VIRTCHNL_VF_OFFLOAD_FDIR_PF)) + return -EINVAL; + +- if (vsi_id != vf->lan_vsi_num) +- return -EINVAL; +- + if (!ice_vc_isvalid_vsi_id(vf, vsi_id)) + return -EINVAL; + diff --git a/queue-6.1/net-ks8851-fix-another-tx-stall-caused-by-wrong-isr-flag-handling.patch b/queue-6.1/net-ks8851-fix-another-tx-stall-caused-by-wrong-isr-flag-handling.patch new file mode 100644 index 00000000000..344d3d44ace --- /dev/null +++ b/queue-6.1/net-ks8851-fix-another-tx-stall-caused-by-wrong-isr-flag-handling.patch @@ -0,0 +1,108 @@ +From 317a215d493230da361028ea8a4675de334bfa1a Mon Sep 17 00:00:00 2001 +From: Ronald Wahl +Date: Mon, 13 May 2024 16:39:22 +0200 +Subject: net: ks8851: Fix another TX stall caused by wrong ISR flag handling + +From: Ronald Wahl + +commit 317a215d493230da361028ea8a4675de334bfa1a upstream. + +Under some circumstances it may happen that the ks8851 Ethernet driver +stops sending data. + +Currently the interrupt handler resets the interrupt status flags in the +hardware after handling TX. With this approach we may lose interrupts in +the time window between handling the TX interrupt and resetting the TX +interrupt status bit. + +When all of the three following conditions are true then transmitting +data stops: + + - TX queue is stopped to wait for room in the hardware TX buffer + - no queued SKBs in the driver (txq) that wait for being written to hw + - hardware TX buffer is empty and the last TX interrupt was lost + +This is because reenabling the TX queue happens when handling the TX +interrupt status but if the TX status bit has already been cleared then +this interrupt will never come. + +With this commit the interrupt status flags will be cleared before they +are handled. That way we stop losing interrupts. + +The wrong handling of the ISR flags was there from the beginning but +with commit 3dc5d4454545 ("net: ks8851: Fix TX stall caused by TX +buffer overrun") the issue becomes apparent. + +Fixes: 3dc5d4454545 ("net: ks8851: Fix TX stall caused by TX buffer overrun") +Cc: "David S. Miller" +Cc: Eric Dumazet +Cc: Jakub Kicinski +Cc: Paolo Abeni +Cc: Simon Horman +Cc: netdev@vger.kernel.org +Cc: stable@vger.kernel.org # 5.10+ +Signed-off-by: Ronald Wahl +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/micrel/ks8851_common.c | 18 +----------------- + 1 file changed, 1 insertion(+), 17 deletions(-) + +--- a/drivers/net/ethernet/micrel/ks8851_common.c ++++ b/drivers/net/ethernet/micrel/ks8851_common.c +@@ -328,7 +328,6 @@ static irqreturn_t ks8851_irq(int irq, v + { + struct ks8851_net *ks = _ks; + struct sk_buff_head rxq; +- unsigned handled = 0; + unsigned long flags; + unsigned int status; + struct sk_buff *skb; +@@ -336,24 +335,17 @@ static irqreturn_t ks8851_irq(int irq, v + ks8851_lock(ks, &flags); + + status = ks8851_rdreg16(ks, KS_ISR); ++ ks8851_wrreg16(ks, KS_ISR, status); + + netif_dbg(ks, intr, ks->netdev, + "%s: status 0x%04x\n", __func__, status); + +- if (status & IRQ_LCI) +- handled |= IRQ_LCI; +- + if (status & IRQ_LDI) { + u16 pmecr = ks8851_rdreg16(ks, KS_PMECR); + pmecr &= ~PMECR_WKEVT_MASK; + ks8851_wrreg16(ks, KS_PMECR, pmecr | PMECR_WKEVT_LINK); +- +- handled |= IRQ_LDI; + } + +- if (status & IRQ_RXPSI) +- handled |= IRQ_RXPSI; +- + if (status & IRQ_TXI) { + unsigned short tx_space = ks8851_rdreg16(ks, KS_TXMIR); + +@@ -365,20 +357,12 @@ static irqreturn_t ks8851_irq(int irq, v + if (netif_queue_stopped(ks->netdev)) + netif_wake_queue(ks->netdev); + spin_unlock(&ks->statelock); +- +- handled |= IRQ_TXI; + } + +- if (status & IRQ_RXI) +- handled |= IRQ_RXI; +- + if (status & IRQ_SPIBEI) { + netdev_err(ks->netdev, "%s: spi bus error\n", __func__); +- handled |= IRQ_SPIBEI; + } + +- ks8851_wrreg16(ks, KS_ISR, handled); +- + if (status & IRQ_RXI) { + /* the datasheet says to disable the rx interrupt during + * packet read-out, however we're masking the interrupt diff --git a/queue-6.1/series b/queue-6.1/series index d3d37cd2771..124fb1ef0b6 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -1 +1,4 @@ drm-amd-display-fix-division-by-zero-in-setup_dsc_config.patch +net-ks8851-fix-another-tx-stall-caused-by-wrong-isr-flag-handling.patch +ice-pass-vsi-pointer-into-ice_vc_isvalid_q_id.patch +ice-remove-unnecessary-duplicate-checks-for-vf-vsi-id.patch