Skip to contentSkip to conversation

brcmfmac: allocate msgbuf pktid from 1 to pktids array size

PATCH In review Wright Feng 2 participants 3 messages Apr 25, 2019 – Apr 29, 2019 Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 brcmfmac: allocate msgbuf pktid from 1 to pktids array size

Some PCIE firmwares drop txstatus if pktid is 0 and make packet held in host side and not be released. If that packet type is 802.1x, the pend_8021x_cnt value will be always greater than 0 and show "Timed out waiting for no pending 802.1x packets" error message when sending key to dongle.

To be compatible with all firmwares, host should allocate msgbuf pktid from 1 instead of from 0.

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +1 -1
index d3780ea..b2fab3c 100644
@@ -348,7 +348,7 @@ brcmf_msgbuf_alloc_pktid(struct device *dev,
 	do {
 		(*idx)++;
 		if (*idx == pktids->array_size)
-			*idx = 0;
+			*idx = 1;
 		if (array[*idx].allocated.counter == 0)
 			if (atomic_cmpxchg(&array[*idx].allocated, 0, 1) == 0)
 				break;
Signature · 1 line
2.1.0
maintainer
#1 lore raw
Quoted 8 lines · Wright Feng

Some PCIE firmwares drop txstatus if pktid is 0 and make packet held in host side and not be released. If that packet type is 802.1x, the pend_8021x_cnt value will be always greater than 0 and show "Timed out waiting for no pending 802.1x packets" error message when sending key to dongle.

To be compatible with all firmwares, host should allocate msgbuf pktid from 1 instead of from 0.

looking at it we are wasting entry 0 with this patch. Could we avoid that?

Regards,
Arend

Quoted 19 lines
---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +1 -1
index d3780ea..b2fab3c 100644
@@ -348,7 +348,7 @@ brcmf_msgbuf_alloc_pktid(struct device *dev,
  	do {
  		(*idx)++;
  		if (*idx == pktids->array_size)
-			*idx = 0;
+			*idx = 1;
  		if (array[*idx].allocated.counter == 0)
  			if (atomic_cmpxchg(&array[*idx].allocated, 0, 1) == 0)
  				break;
#2 lore raw
Quoted 7 lines · Arend Van Spriel
Quoted 6 lines · Wright Feng

Some PCIE firmwares drop txstatus if pktid is 0 and make packet held in host side and not be released. If that packet type is 802.1x, the pend_8021x_cnt value will be always greater than 0 and show "Timed out waiting for no pending 802.1x packets" error message when sending key to dongle.

Quoted 8 lines
Quoted 2 lines

To be compatible with all firmwares, host should allocate msgbuf pktid from 1 instead of from 0.

looking at it we are wasting entry 0 with this patch. Could we avoid that?

Regards,
Arend

Hi Arend,

Thanks for the suggestion.
To avoid wasting index zero entry, I just increase request ID in TXflow and decrease request ID when handling txstatus. I've posted patch v2.

Regards,
Wright

Quoted 20 lines
Quoted 20 lines

---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +1 -1
index d3780ea..b2fab3c 100644
@@ -348,7 +348,7 @@ brcmf_msgbuf_alloc_pktid(struct device *dev,
       do {
           (*idx)++;
           if (*idx == pktids->array_size)
-            *idx = 0;
+            *idx = 1;
           if (array[*idx].allocated.counter == 0)
               if (atomic_cmpxchg(&array[*idx].allocated, 0, 1) == 0)
                   break;