Skip to contentSkip to conversation

wl12xx: use 2 spare TX blocks for GEM cipher

PATCH Superseded Guy Eilam 2 participants 3 messages Aug 9, 2011 – Aug 16, 2011 Networking drivers (wireless)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Guy Eilam

author
#0 lore raw

PATCH v2 1/1 wl12xx: use 2 spare TX blocks for GEM cipher

Add tx_spare_blocks member to the wl1271 struct for more generic configuration of the amount of spare TX blocks that should be used. The default value is 1.
In case GEM cipher is used by the STA, we need 2 spare TX blocks instead of just 1.

---
 drivers/net/wireless/wl12xx/main.c   |   12 ++++++++++++
 drivers/net/wireless/wl12xx/tx.c     |    4 +---
 drivers/net/wireless/wl12xx/tx.h     |    1 +
 drivers/net/wireless/wl12xx/wl12xx.h |    3 +++
 4 files changed, 17 insertions(+), 3 deletions(-)
drivers/net/wireless/wl12xx/main.c +12 -0
index 1c56137..1d2b3e9 100644
@@ -2736,6 +2736,17 @@ static int wl1271_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
 			0xff, 0xff, 0xff, 0xff, 0xff, 0xff
 		};
 
+		/*
+		 * A STA set to GEM cipher requires 2 tx spare blocks.
+		 * Return to default value when GEM cipher key is removed
+		 */
+		if (key_type == KEY_GEM) {
+			if (action == KEY_ADD_OR_REPLACE)
+				wl->tx_spare_blocks = 2;
+			else if (action == KEY_REMOVE)
+				wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
+		}
+
 		addr = sta ? sta->addr : bcast_addr;
 
 		if (is_zero_ether_addr(addr)) {
@@ -4916,6 +4927,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
 	wl->tx_security_seq = 0;
 	wl->tx_security_last_seq_lsb = 0;
 	wl->active_sta_count = 0;
+	wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
 
 	setup_timer(&wl->rx_streaming_timer, wl1271_rx_streaming_timer,
 		    (unsigned long) wl);
drivers/net/wireless/wl12xx/tx.c +1 -3
index 367809e..47ca361 100644
@@ -200,9 +200,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
 	u32 len;
 	u32 total_blocks;
 	int id, ret = -EBUSY, ac;
-
-	/* we use 1 spare block */
-	u32 spare_blocks = 1;
+	u32 spare_blocks = wl->tx_spare_blocks;
 
 	if (buf_offset + total_len > WL1271_AGGR_BUFFER_SIZE)
 		return -EAGAIN;
drivers/net/wireless/wl12xx/tx.h +1 -0
index e2f9150..bdbae8d 100644
@@ -25,6 +25,7 @@
 #ifndef __TX_H__
 #define __TX_H__
 
+#define TX_HW_BLOCK_SPARE_DEFAULT        1
 #define TX_HW_BLOCK_SIZE                 252
 
 #define TX_HW_MGMT_PKT_LIFETIME_TU       2000
drivers/net/wireless/wl12xx/wl12xx.h +3 -0
index f528f61..3d847b5 100644
@@ -459,6 +459,9 @@ struct wl1271 {
 	u32 tx_allocated_blocks;
 	u32 tx_results_count;
 
+	/* amount of spare TX blocks to use */
+	u32 tx_spare_blocks;
+
 	/* Accounting for allocated / available Tx packets in HW */
 	u32 tx_pkts_freed[NUM_TX_QUEUES];
 	u32 tx_allocated_pkts[NUM_TX_QUEUES];
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 23 lines · Guy Eilam

Add tx_spare_blocks member to the wl1271 struct for more generic configuration of the amount of spare TX blocks that should be used. The default value is 1.
In case GEM cipher is used by the STA, we need 2 spare TX blocks instead of just 1.

---
 drivers/net/wireless/wl12xx/main.c   |   12 ++++++++++++ drivers/net/wireless/wl12xx/tx.c     |    4 +--- drivers/net/wireless/wl12xx/tx.h     |    1 + drivers/net/wireless/wl12xx/wl12xx.h |    3 +++

 4 files changed, 17 insertions(+), 3 deletions(-)
drivers/net/wireless/wl12xx/main.c +0 -0
index 1c56137..1d2b3e9 100644
@@ -2736,6 +2736,17 @@ static int wl1271_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,

                       0xff, 0xff, 0xff, 0xff, 0xff, 0xff };

Quoted 11 lines

+               /*
+                * A STA set to GEM cipher requires 2 tx spare blocks.
+                * Return to default value when GEM cipher key is removed
+                */
+               if (key_type == KEY_GEM) {
+                       if (action == KEY_ADD_OR_REPLACE)
+                               wl->tx_spare_blocks = 2;
+                       else if (action == KEY_REMOVE)
+                               wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
+               }
+

What about recovery? Note this code won't be reached in case wl1271_op_set_key() is called when wl->state == OFF.
We should probably always revert to 1 blocks on unjoin or remove_interface.

drivers/net/wireless/wl12xx/tx.c static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, · line 203

Quoted 10 lines
drivers/net/wireless/wl12xx/tx.c +1 -3
@@ -200,9 +200,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
        u32 len;
        u32 total_blocks;
        int id, ret = -EBUSY, ac;
-
-       /* we use 1 spare block */
-       u32 spare_blocks = 1;
+       u32 spare_blocks = wl->tx_spare_blocks;

What about dummy packets? Perhaps we should still use 1 block for them?

Arik

author
#2 lore raw
Quoted 24 lines · Arik Nemtsov
Quoted 23 lines · Guy Eilam

Add tx_spare_blocks member to the wl1271 struct for more generic configuration of the amount of spare TX blocks that should be used. The default value is 1.
In case GEM cipher is used by the STA, we need 2 spare TX blocks instead of just 1.

---
 drivers/net/wireless/wl12xx/main.c   |   12 ++++++++++++ drivers/net/wireless/wl12xx/tx.c     |    4 +--- drivers/net/wireless/wl12xx/tx.h     |    1 + drivers/net/wireless/wl12xx/wl12xx.h |    3 +++

 4 files changed, 17 insertions(+), 3 deletions(-)
drivers/net/wireless/wl12xx/main.c +0 -0
index 1c56137..1d2b3e9 100644
@@ -2736,6 +2736,17 @@ static int wl1271_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,

                       0xff, 0xff, 0xff, 0xff, 0xff, 0xff };

Quoted 15 lines
Quoted 11 lines

+               /*
+                * A STA set to GEM cipher requires 2 tx spare blocks.
+                * Return to default value when GEM cipher key is removed
+                */
+               if (key_type == KEY_GEM) {
+                       if (action == KEY_ADD_OR_REPLACE)
+                               wl->tx_spare_blocks = 2;
+                       else if (action == KEY_REMOVE)
+                               wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
+               }
+

What about recovery? Note this code won't be reached in case wl1271_op_set_key() is called when wl->state == OFF.
We should probably always revert to 1 blocks on unjoin or remove_interface.

You are correct - this is fixed in a newer version of the patch.

Quoted 13 lines

drivers/net/wireless/wl12xx/tx.c static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, · line 203

Quoted 11 lines
drivers/net/wireless/wl12xx/tx.c +1 -3
@@ -200,9 +200,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
        u32 len;
        u32 total_blocks;
        int id, ret = -EBUSY, ac;
-
-       /* we use 1 spare block */
-       u32 spare_blocks = 1;
+       u32 spare_blocks = wl->tx_spare_blocks;

What about dummy packets? Perhaps we should still use 1 block for them?

Again, fixed in a newer version of the patch.

Quoted 3 lines

Arik

Guy.