ath11k: Fix napi related hang

Similar to the same bug in ath10k, a napi disable w/out it being enabled
will hang forever.  I believe I saw this while trying rmmod after driver
had some failure on startup.  Fix it by keeping state on whether napi is
enabled or not.

And, remove un-used napi pointer in ath11k driver base struct.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20200903195254.29379-1-greearb@candelatech.com
This commit is contained in:
Ben Greear 2020-09-03 12:52:54 -07:00 committed by Kalle Valo
parent 9d364b828a
commit d943fdad75
3 changed files with 19 additions and 7 deletions

View File

@ -175,8 +175,11 @@ static void __ath11k_ahb_ext_irq_disable(struct ath11k_base *ab)
ath11k_ahb_ext_grp_disable(irq_grp); ath11k_ahb_ext_grp_disable(irq_grp);
napi_synchronize(&irq_grp->napi); if (irq_grp->napi_enabled) {
napi_disable(&irq_grp->napi); napi_synchronize(&irq_grp->napi);
napi_disable(&irq_grp->napi);
irq_grp->napi_enabled = false;
}
} }
} }
@ -300,7 +303,10 @@ static void ath11k_ahb_ext_irq_enable(struct ath11k_base *ab)
for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) {
struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i];
napi_enable(&irq_grp->napi); if (!irq_grp->napi_enabled) {
napi_enable(&irq_grp->napi);
irq_grp->napi_enabled = true;
}
ath11k_ahb_ext_grp_enable(irq_grp); ath11k_ahb_ext_grp_enable(irq_grp);
} }
} }

View File

@ -142,6 +142,7 @@ struct ath11k_ext_irq_grp {
u32 num_irq; u32 num_irq;
u32 grp_id; u32 grp_id;
u64 timestamp; u64 timestamp;
bool napi_enabled;
struct napi_struct napi; struct napi_struct napi;
struct net_device napi_ndev; struct net_device napi_ndev;
}; };
@ -743,7 +744,6 @@ struct ath11k_base {
u32 wlan_init_status; u32 wlan_init_status;
int irq_num[ATH11K_IRQ_NUM_MAX]; int irq_num[ATH11K_IRQ_NUM_MAX];
struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX]; struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX];
struct napi_struct *napi;
struct ath11k_targ_cap target_caps; struct ath11k_targ_cap target_caps;
u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE]; u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE];
bool pdevs_macaddr_valid; bool pdevs_macaddr_valid;

View File

@ -683,8 +683,11 @@ static void __ath11k_pci_ext_irq_disable(struct ath11k_base *sc)
ath11k_pci_ext_grp_disable(irq_grp); ath11k_pci_ext_grp_disable(irq_grp);
napi_synchronize(&irq_grp->napi); if (irq_grp->napi_enabled) {
napi_disable(&irq_grp->napi); napi_synchronize(&irq_grp->napi);
napi_disable(&irq_grp->napi);
irq_grp->napi_enabled = false;
}
} }
} }
@ -712,7 +715,10 @@ static void ath11k_pci_ext_irq_enable(struct ath11k_base *ab)
for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) {
struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i];
napi_enable(&irq_grp->napi); if (!irq_grp->napi_enabled) {
napi_enable(&irq_grp->napi);
irq_grp->napi_enabled = true;
}
ath11k_pci_ext_grp_enable(irq_grp); ath11k_pci_ext_grp_enable(irq_grp);
} }
} }