Skip to contentSkip to conversation

brcmfmac: use correct skb freeing helper when deleting flowring

PATCH Superseded Rafał Miłecki 3 participants 11 messages Sep 27, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 brcmfmac: use correct skb freeing helper when deleting flowring

From: Rafał Miłecki <[email protected]>

Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.

Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

---
Kalle: this isn't important enough for 4.8 as it's too late for that.

I'd like to get it for 4.9 however, as this fixes bug that could lead to WARNING on every add_key/del_key call. We was struggling with these WARNINGs for some time and this fixes one of two problems causing them.

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +8 -1
index b16b367..d0b738d 100644
@@ -234,13 +234,20 @@ static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
 
 void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
 {
+	struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
 	struct brcmf_flowring_ring *ring;
+	struct brcmf_if *ifp;
 	u16 hash_idx;
+	u8 ifidx;
 	struct sk_buff *skb;
 
 	ring = flow->rings[flowid];
 	if (!ring)
 		return;
+
+	ifidx = brcmf_flowring_ifidx_get(flow, flowid);
+	ifp = brcmf_get_ifp(bus_if->drvr, ifidx);
+
 	brcmf_flowring_block(flow, flowid, false);
 	hash_idx = ring->hash_id;
 	flow->hash[hash_idx].ifidx = BRCMF_FLOWRING_INVALID_IFIDX;
@@ -249,7 +256,7 @@ void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
 
 	skb = skb_dequeue(&ring->skblist);
 	while (skb) {
-		brcmu_pkt_buf_free_skb(skb);
+		brcmf_txfinalize(ifp, skb, false);
 		skb = skb_dequeue(&ring->skblist);
 	}
 
Signature · 1 line
2.9.3
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.

Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

Quoted 7 lines

---
Kalle: this isn't important enough for 4.8 as it's too late for that.

I'd like to get it for 4.9 however, as this fixes bug that could lead to WARNING on every add_key/del_key call. We was struggling with these WARNINGs for some time and this fixes one of two problems causing them.

Please mark it for stable as well.

Quoted 19 lines
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +3 -0
index b16b367..d0b738d 100644
@@ -234,13 +234,20 @@ static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
 
 void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
 {
+	struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
 	struct brcmf_flowring_ring *ring;
+	struct brcmf_if *ifp;
 	u16 hash_idx;
+	u8 ifidx;
 	struct sk_buff *skb;
 

drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid, · line 253

Quoted 10 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +4 -0
 	ring = flow->rings[flowid];
 	if (!ring)
 		return;
+
+	ifidx = brcmf_flowring_ifidx_get(flow, flowid);
+	ifp = brcmf_get_ifp(bus_if->drvr, ifidx);
+
 	brcmf_flowring_block(flow, flowid, false);
 	hash_idx = ring->hash_id;
 	flow->hash[hash_idx].ifidx = BRCMF_FLOWRING_INVALID_IFIDX;

I am not very familiar with flowring code, but I suppose this is just initializing the entry for later use, right?

Quoted 10 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +1 -1
@@ -249,7 +256,7 @@ void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
 
 	skb = skb_dequeue(&ring->skblist);
 	while (skb) {
-		brcmu_pkt_buf_free_skb(skb);
+		brcmf_txfinalize(ifp, skb, false);
 		skb = skb_dequeue(&ring->skblist);
 	}
 
#2 lore raw
Quoted 12 lines · Arend Van Spriel
Quoted 10 lines · On 27-9-2016 11:14, Rafa=C5=82 Mi=C5=82ecki wrote:

From: Rafa=C5=82 Mi=C5=82ecki <[email protected]>
=20
Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.
=20
Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

Quoted 8 lines
Quoted 7 lines

---
Kalle: this isn't important enough for 4.8 as it's too late for that. =20
I'd like to get it for 4.9 however, as this fixes bug that could lead to WARNING on every add_key/del_key call. We was struggling with these WARNINGs for some time and this fixes one of two problems causing them.

Ok, I'll queue this for 4.9.

Quoted 1 line

Please mark it for stable as well.

I can add that. Any ideas how old releases stable releases should this go to?

--=20
Kalle Valo

maintainer
#3 lore raw
Quoted 23 lines · Kalle Valo
Quoted 8 lines · Arend Van Spriel
Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.

Quoted 12 lines
Quoted 3 lines

Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

Quoted 7 lines

---
Kalle: this isn't important enough for 4.8 as it's too late for that.

I'd like to get it for 4.9 however, as this fixes bug that could lead to WARNING on every add_key/del_key call. We was struggling with these WARNINGs for some time and this fixes one of two problems causing them.

Quoted 6 lines

Ok, I'll queue this for 4.9.

Quoted 1 line

Please mark it for stable as well.

I can add that. Any ideas how old releases stable releases should this go to?

Not sure if the vendor directory move causes issues as stable can not fallback to three-way merge. I assumed it would so my last stable tag was only for 4.7 and I took care of older kernels at later time with backported patch. I can do that for this one as well.

Regards,
Arend

#4 lore raw
In reply to Kalle Valo
Quoted 23 lines · Kalle Valo
Quoted 8 lines · Arend Van Spriel
Quoted 7 lines · On 27-9-2016 11:14, Rafa=C5=82 Mi=C5=82ecki wrote:

From: Rafa=C5=82 Mi=C5=82ecki <[email protected]>

Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.

Quoted 12 lines
Quoted 3 lines

Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

Quoted 7 lines

---
Kalle: this isn't important enough for 4.8 as it's too late for that.

I'd like to get it for 4.9 however, as this fixes bug that could lead to WARNING on every add_key/del_key call. We was struggling with these WARNINGs for some time and this fixes one of two problems causing them.

Quoted 6 lines

Ok, I'll queue this for 4.9.

Quoted 1 line

Please mark it for stable as well.

I can add that. Any ideas how old releases stable releases should this go to?

I was analyzing this.
1) This patch uses brcmf_get_ifp which is available in 4.4+ only.
2) It applies cleanly to 4.5+ only due to 32f90caa7debd ("brcmfmac:
Increase nr of supported flowrings.")
3) 4.4 would also require applying to the patch without broadcom/ subdir

That said I suggest 4.5+. Any objections?

--=20
Rafa=C5=82

#5 lore raw
Quoted 31 lines · Rafał Miłecki
Quoted 23 lines · Kalle Valo
Quoted 8 lines · Arend Van Spriel
Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.

Quoted 12 lines
Quoted 3 lines

Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

Quoted 7 lines

---
Kalle: this isn't important enough for 4.8 as it's too late for that.

I'd like to get it for 4.9 however, as this fixes bug that could lead to WARNING on every add_key/del_key call. We was struggling with these WARNINGs for some time and this fixes one of two problems causing them.

Quoted 6 lines

Ok, I'll queue this for 4.9.

Quoted 1 line

Please mark it for stable as well.

I can add that. Any ideas how old releases stable releases should this go to?

Quoted 7 lines

I was analyzing this.
1) This patch uses brcmf_get_ifp which is available in 4.4+ only.
2) It applies cleanly to 4.5+ only due to 32f90caa7debd ("brcmfmac:
Increase nr of supported flowrings.")
3) 4.4 would also require applying to the patch without broadcom/ subdir

That said I suggest 4.5+. Any objections?

Let me see if patchwork with pick Cc tag as it does for others.

This may be worth backporting to 4.4 as well (as it's longterm), but I'll do it separately due to patch not applying cleanly.

Signature · 1 line
Rafał
maintainer
#6 lore raw
Quoted 32 lines · Rafał Miłecki
Quoted 31 lines · Rafał Miłecki
Quoted 29 lines · Kalle Valo
Quoted 8 lines · Arend Van Spriel
Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.

Quoted 12 lines
Quoted 3 lines

Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

Quoted 7 lines

---
Kalle: this isn't important enough for 4.8 as it's too late for that.

I'd like to get it for 4.9 however, as this fixes bug that could lead to WARNING on every add_key/del_key call. We was struggling with these WARNINGs for some time and this fixes one of two problems causing them.

Ok, I'll queue this for 4.9.

Quoted 1 line

Please mark it for stable as well.

I can add that. Any ideas how old releases stable releases should this go to?

Quoted 7 lines
Quoted 7 lines

I was analyzing this.
1) This patch uses brcmf_get_ifp which is available in 4.4+ only.
2) It applies cleanly to 4.5+ only due to 32f90caa7debd ("brcmfmac:
Increase nr of supported flowrings.")
3) 4.4 would also require applying to the patch without broadcom/ subdir

That said I suggest 4.5+. Any objections?

No objections. Just a tip. I tend to look at kernel.org main page to see the stable and long-term kernel listed. So 4.7+ and 4.5+ have same meaning as 4.5 and 4.6 are not stable/long-term kernels.

Regards,
Arend

Quoted 6 lines

Let me see if patchwork with pick Cc tag as it does for others.

This may be worth backporting to 4.4 as well (as it's longterm), but I'll do it separately due to patch not applying cleanly.

#7 lore raw
Quoted 39 lines · Arend Van Spriel
Quoted 38 lines · Rafał Miłecki
Quoted 37 lines · Rafał Miłecki
Quoted 23 lines · Kalle Valo
Quoted 8 lines · Arend Van Spriel
Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.

Quoted 12 lines
Quoted 3 lines

Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

Quoted 7 lines

---
Kalle: this isn't important enough for 4.8 as it's too late for that.

I'd like to get it for 4.9 however, as this fixes bug that could lead to WARNING on every add_key/del_key call. We was struggling with these WARNINGs for some time and this fixes one of two problems causing them.

Quoted 6 lines

Ok, I'll queue this for 4.9.

Quoted 1 line

Please mark it for stable as well.

I can add that. Any ideas how old releases stable releases should this go to?

I was analyzing this.
1) This patch uses brcmf_get_ifp which is available in 4.4+ only.
2) It applies cleanly to 4.5+ only due to 32f90caa7debd ("brcmfmac:
Increase nr of supported flowrings.")
3) 4.4 would also require applying to the patch without broadcom/ subdir

Quoted 5 lines
Quoted 1 line
Quoted 1 line

That said I suggest 4.5+. Any objections?

No objections. Just a tip. I tend to look at kernel.org main page to see the stable and long-term kernel listed. So 4.7+ and 4.5+ have same meaning as 4.5 and 4.6 are not stable/long-term kernels.

Some projects may work on their own stable kernels, e.g. Ubuntu, see:
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

That's why I don't always look strictly at upstream stable releases only.

Signature · 1 line
Rafał
Acked-by Arend van Spriel
#8 lore raw
In reply to Rafał Miłecki
Quoted 19 lines · Rafał Miłecki
Quoted 19 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

Kalle: this isn't important enough for 4.8 as it's too late for that.

I'd like to get it for 4.9 however, as this fixes bug that could lead to WARNING on every add_key/del_key call. We was struggling with these WARNINGs for some time and this fixes one of two problems causing them.

Quoted 6 lines

Ok, I'll queue this for 4.9.

Quoted 1 line

Please mark it for stable as well.

I can add that. Any ideas how old releases stable releases should this go to?

I was analyzing this.
1) This patch uses brcmf_get_ifp which is available in 4.4+ only.
2) It applies cleanly to 4.5+ only due to 32f90caa7debd ("brcmfmac:
Increase nr of supported flowrings.")
3) 4.4 would also require applying to the patch without broadcom/ subdir

Quoted 5 lines
Quoted 1 line

That said I suggest 4.5+. Any objections?

Let me see if patchwork with pick Cc tag as it does for others.

An excellent idea but no luck:

I'll add this to my patchwork wishlist though, I think it would be a really useful feature to have.

(The question marks are because of my buggy copy paste, ignore those)

Signature · 1 line
Kalle Valo
#9 lore raw

PATCH v2 1/1 brcmfmac: use correct skb freeing helper when deleting flowring

In reply to Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.

Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

---
V2: Add Cc for stable 4.5+. It doesn't apply cleanly to 4.4 and is not
possible for 4.3- due to missing brcmf_get_ifp.

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +8 -1
index b16b367..d0b738d 100644
@@ -234,13 +234,20 @@ static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
 
 void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
 {
+	struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
 	struct brcmf_flowring_ring *ring;
+	struct brcmf_if *ifp;
 	u16 hash_idx;
+	u8 ifidx;
 	struct sk_buff *skb;
 
 	ring = flow->rings[flowid];
 	if (!ring)
 		return;
+
+	ifidx = brcmf_flowring_ifidx_get(flow, flowid);
+	ifp = brcmf_get_ifp(bus_if->drvr, ifidx);
+
 	brcmf_flowring_block(flow, flowid, false);
 	hash_idx = ring->hash_id;
 	flow->hash[hash_idx].ifidx = BRCMF_FLOWRING_INVALID_IFIDX;
@@ -249,7 +256,7 @@ void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
 
 	skb = skb_dequeue(&ring->skblist);
 	while (skb) {
-		brcmu_pkt_buf_free_skb(skb);
+		brcmf_txfinalize(ifp, skb, false);
 		skb = skb_dequeue(&ring->skblist);
 	}
 
Signature · 1 line
2.9.3
#10 lore raw
Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Flowrings contain skbs waiting for transmission that were passed to us by netif. It means we checked every one of them looking for 802.1x Ethernet type. When deleting flowring we have to use freeing function that will check for 802.1x type as well.

Quoted 7 lines

Freeing skbs without a proper check was leading to counter not being properly decreased. This was triggering a WARNING every time brcmf_netdev_wait_pend8021x was called.

Patch applied to wireless-drivers-next.git, thanks.

7f00ee2bbc63 brcmfmac: use correct skb freeing helper when deleting flowring

Signature · 6 lines
https://patchwork.kernel.org/patch/9351797/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches