2016-07-15 13:37:37

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 1/2] mwifiex: fix PCIe legacy interrupt problem

In corner case, we may end up processing same interrupt twice.
We have a logic to read pending interrupts at the end of interrupt
processing routine. It has a race with interrupts read in interrupt
handler. This patch solves the problem by ORing the interrupt bitmap
in this case.

The symptom for this bug is below messages in dmesg log.

[ 11.522123] mwifiex_pcie 0000:01:00.0: CMD_RESP: invalid cmd resp
[ 11.680412] mwifiex_pcie 0000:01:00.0: There is no command but got cmdrsp

Link: https://bugzilla.kernel.org/show_bug.cgi?id=109681
Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/pcie.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index d61d4ad..38bd62e 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -2300,6 +2300,12 @@ static int mwifiex_process_pcie_int(struct mwifiex_adapter *adapter)
}

}
+ if (!card->msi_enable) {
+ spin_lock_irqsave(&adapter->int_lock, flags);
+ pcie_ireg |= adapter->int_status;
+ adapter->int_status = 0;
+ spin_unlock_irqrestore(&adapter->int_lock, flags);
+ }
}
mwifiex_dbg(adapter, INTR,
"info: cmd_sent=%d data_sent=%d\n",
--
1.9.1



2016-07-15 13:37:44

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 2/2] mwifiex: update command response skb length correctly

Same skb is being reused for storing command response from firmware
in PCIe chipsets. There was a bug while updating the skb length.
This patch ensures skb length correctly gets updated based on rx_len.

Signed-off-by: Amitkumar Karwar <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/pcie.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 38bd62e..a6af85d 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -1616,6 +1616,7 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)

pkt_len = *((__le16 *)skb->data);
rx_len = le16_to_cpu(pkt_len);
+ skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len);
skb_trim(skb, rx_len);
skb_pull(skb, INTF_HEADER_LEN);

--
1.9.1


2016-07-18 19:43:14

by Kalle Valo

[permalink] [raw]
Subject: Re: [1/2] mwifiex: fix PCIe legacy interrupt problem

Amitkumar Karwar <[email protected]> wrote:
> In corner case, we may end up processing same interrupt twice.
> We have a logic to read pending interrupts at the end of interrupt
> processing routine. It has a race with interrupts read in interrupt
> handler. This patch solves the problem by ORing the interrupt bitmap
> in this case.
>
> The symptom for this bug is below messages in dmesg log.
>
> [ 11.522123] mwifiex_pcie 0000:01:00.0: CMD_RESP: invalid cmd resp
> [ 11.680412] mwifiex_pcie 0000:01:00.0: There is no command but got cmdrsp
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=109681
> Signed-off-by: Amitkumar Karwar <[email protected]>
> Signed-off-by: Cathy Luo <[email protected]>

Thanks, 2 patches applied to wireless-drivers-next.git:

514952889544 mwifiex: fix PCIe legacy interrupt problem
2fd40d2d349f mwifiex: update command response skb length correctly

--
Sent by pwcli
https://patchwork.kernel.org/patch/9232091/