wifi: ath12k: add CE and ext IRQ flag to indicate irq_handler
authorKang Yang <quic_kangyang@quicinc.com>
Fri, 1 Dec 2023 16:09:47 +0000 (18:09 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Tue, 5 Dec 2023 15:04:18 +0000 (17:04 +0200)
Add two flags to indicate whether IRQ handler for CE and DP can be called.
This is because in one MSI vector case, interrupt is not disabled in
hif_stop and hif_irq_disable. So if interrupt is disabled, MHI interrupt
is disabled too.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20231121021304.12966-3-quic_kangyang@quicinc.com
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/pci.c

index 6dbe817d2ec78c5ab5086c666336dbf7aeb0a881..8458dc292821a3bdbfcfcd92365dab0f3ef734b9 100644 (file)
@@ -199,6 +199,8 @@ enum ath12k_dev_flags {
        ATH12K_FLAG_REGISTERED,
        ATH12K_FLAG_QMI_FAIL,
        ATH12K_FLAG_HTC_SUSPEND_COMPLETE,
+       ATH12K_FLAG_CE_IRQ_ENABLED,
+       ATH12K_FLAG_EXT_IRQ_ENABLED,
 };
 
 enum ath12k_monitor_flags {
index cab68540b6b1bc307eee1ed5c534d40eda2d17ee..b22859cec9bf72285d5a4e42ac53f5ba08e3784a 100644 (file)
@@ -373,6 +373,8 @@ static void ath12k_pci_ce_irqs_disable(struct ath12k_base *ab)
 {
        int i;
 
+       clear_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags);
+
        for (i = 0; i < ab->hw_params->ce_count; i++) {
                if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR)
                        continue;
@@ -406,6 +408,10 @@ static void ath12k_pci_ce_tasklet(struct tasklet_struct *t)
 static irqreturn_t ath12k_pci_ce_interrupt_handler(int irq, void *arg)
 {
        struct ath12k_ce_pipe *ce_pipe = arg;
+       struct ath12k_base *ab = ce_pipe->ab;
+
+       if (!test_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags))
+               return IRQ_HANDLED;
 
        /* last interrupt received for this CE */
        ce_pipe->timestamp = jiffies;
@@ -428,6 +434,8 @@ static void __ath12k_pci_ext_irq_disable(struct ath12k_base *ab)
 {
        int i;
 
+       clear_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags);
+
        for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) {
                struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i];
 
@@ -483,6 +491,10 @@ static int ath12k_pci_ext_grp_napi_poll(struct napi_struct *napi, int budget)
 static irqreturn_t ath12k_pci_ext_interrupt_handler(int irq, void *arg)
 {
        struct ath12k_ext_irq_grp *irq_grp = arg;
+       struct ath12k_base *ab = irq_grp->ab;
+
+       if (!test_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags))
+               return IRQ_HANDLED;
 
        ath12k_dbg(irq_grp->ab, ATH12K_DBG_PCI, "ext irq:%d\n", irq);
 
@@ -626,6 +638,8 @@ static void ath12k_pci_ce_irqs_enable(struct ath12k_base *ab)
 {
        int i;
 
+       set_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags);
+
        for (i = 0; i < ab->hw_params->ce_count; i++) {
                if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR)
                        continue;
@@ -975,6 +989,8 @@ void ath12k_pci_ext_irq_enable(struct ath12k_base *ab)
 {
        int i;
 
+       set_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags);
+
        for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) {
                struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i];