Skip to contentSkip to conversation

mac80211-hwsim: Don't enqueue pkts that do not want txstatus.

PATCH In review [email protected] 2 participants 7 messages Feb 10, 2015 – Feb 24, 2015 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211-hwsim: Don't enqueue pkts that do not want txstatus.

From: Ben Greear <[email protected]>

Otherwise, skb is not cleaned up until there is some timeout and the tx-queue quickly becomes overly full.

---

This is against 3.17.8+ kernel...it looks like same problem is in the 3.19.0-rc7 kernel as well.

 drivers/net/wireless/mac80211_hwsim.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +6 -2
index 989a6ba..7ea8948 100644
@@ -928,10 +928,14 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
 	genlmsg_end(skb, msg_head);
 	genlmsg_unicast(&init_net, skb, dst_portid);
 
-	/* Enqueue the packet */
-	skb_queue_tail(&data->pending, my_skb);
 	data->tx_pkts++;
 	data->tx_bytes += my_skb->len;
+
+	/* Enqueue the packet if we are expecting a tx-status response */
+	if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)
+		skb_queue_tail(&data->pending, my_skb);
+	else
+		ieee80211_free_txskb(hw, my_skb);
 	return;
 
 nla_put_failure:
Signature · 1 line
1.7.11.7
maintainer
#1 lore raw
Quoted 10 lines · On Tue, 2015-02-10 at 10:25 -0800, [email protected] wrote:

From: Ben Greear <[email protected]>

Otherwise, skb is not cleaned up until there is some timeout and the tx-queue quickly becomes overly full.

+++ b/drivers/net/wireless/mac80211_hwsim.c

drivers/net/wireless/mac80211_hwsim.c +0 -0
@@ -928,10 +928,14 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
 	genlmsg_end(skb, msg_head);
 	genlmsg_unicast(&init_net, skb, dst_portid);
 

drivers/net/wireless/mac80211_hwsim.c static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, · line 938

Quoted 10 lines
drivers/net/wireless/mac80211_hwsim.c +6 -2
-	/* Enqueue the packet */
-	skb_queue_tail(&data->pending, my_skb);
 	data->tx_pkts++;
 	data->tx_bytes += my_skb->len;
+
+	/* Enqueue the packet if we are expecting a tx-status response */
+	if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)
+		skb_queue_tail(&data->pending, my_skb);
+	else
+		ieee80211_free_txskb(hw, my_skb);

This doesn't really seem right - essentially it means that whatever you just gave to userspace is now completely useless?

It seems skb_orphan() could/should be put here.

johannes

author
#2 lore raw
Quoted 25 lines · Johannes Berg
Quoted 10 lines · On Tue, 2015-02-10 at 10:25 -0800, [email protected] wrote:

From: Ben Greear <[email protected]>

Otherwise, skb is not cleaned up until there is some timeout and the tx-queue quickly becomes overly full.

+++ b/drivers/net/wireless/mac80211_hwsim.c

drivers/net/wireless/mac80211_hwsim.c +0 -0
@@ -928,10 +928,14 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
 	genlmsg_end(skb, msg_head);
 	genlmsg_unicast(&init_net, skb, dst_portid);
 

drivers/net/wireless/mac80211_hwsim.c static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, · line 938

Quoted 10 lines
drivers/net/wireless/mac80211_hwsim.c +6 -2
-	/* Enqueue the packet */
-	skb_queue_tail(&data->pending, my_skb);
 	data->tx_pkts++;
 	data->tx_bytes += my_skb->len;
+
+	/* Enqueue the packet if we are expecting a tx-status response */
+	if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)
+		skb_queue_tail(&data->pending, my_skb);
+	else
+		ieee80211_free_txskb(hw, my_skb);

This doesn't really seem right - essentially it means that whatever you just gave to userspace is now completely useless?

Quoted 1 line

It seems skb_orphan() could/should be put here.

I don't understand your complaint, why is what I gave to user-space useless?

If we just orphan them, does that clean up the skb memory properly?

If not, what eventually frees the skb?

Thanks,
Ben

Quoted 3 lines

johannes

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
maintainer
#3 lore raw
Quoted 6 lines · Ben Greear
Quoted 4 lines

This doesn't really seem right - essentially it means that whatever you just gave to userspace is now completely useless?

It seems skb_orphan() could/should be put here.

I don't understand your complaint, why is what I gave to user-space useless?

userspace is supposed to give back the SKB pointer as a cookie when it reports whether or not it was transmitted correctly, and then we will free the SKB afterwards.

Note that I also just merged a patch from Bob in this area.

Quoted 1 line

If we just orphan them, does that clean up the skb memory properly?

No, of course not, but it removes it from socket accounting. This may be what you want, although I'm not really sure it's the right thing to do since it would make this behave differently than other drivers which also don't orphan the SKB (and shouldn't - you can consider the SKB on this queue as being on the HW DMA queue where it should still be accounted for correctly)

I think perhaps you just want Bob's patch to fix the case of too slow userspace.

Quoted 1 line

If not, what eventually frees the skb?

The tx status path does.

johannes

author
#4 lore raw
Quoted 5 lines · Johannes Berg
Quoted 3 lines · Ben Greear
Quoted 3 lines

This doesn't really seem right - essentially it means that whatever you just gave to userspace is now completely useless?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

It seems skb_orphan() could/should be put here.

I don't understand your complaint, why is what I gave to user-space useless?

userspace is supposed to give back the SKB pointer as a cookie when it reports whether or not it was transmitted correctly, and then we will free the SKB afterwards.

If there is no status to return, then why would user-space call back at all?

Should user-space *always* return a status even when not requested to?

Thanks,
Ben

Quoted 20 lines

Note that I also just merged a patch from Bob in this area.

Quoted 1 line

If we just orphan them, does that clean up the skb memory properly?

No, of course not, but it removes it from socket accounting. This may be what you want, although I'm not really sure it's the right thing to do since it would make this behave differently than other drivers which also don't orphan the SKB (and shouldn't - you can consider the SKB on this queue as being on the HW DMA queue where it should still be accounted for correctly)

I think perhaps you just want Bob's patch to fix the case of too slow userspace.

Quoted 1 line

If not, what eventually frees the skb?

The tx status path does.

johannes

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
maintainer
#5 lore raw
Quoted 3 lines · Ben Greear

If there is no status to return, then why would user-space call back at all?

Should user-space *always* return a status even when not requested to?

I'd certainly expect so from hwsim.

johannes

author
#6 lore raw
Quoted 7 lines · Johannes Berg
Quoted 3 lines · Ben Greear

If there is no status to return, then why would user-space call back at all?

Should user-space *always* return a status even when not requested to?

I'd certainly expect so from hwsim.

I expected just the opposite. But, I can change my user-space code easily enough.

Thanks,
Ben

Quoted 3 lines

johannes

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com