Skip to contentSkip to conversation

b43: rename TX header formats

PATCH New Rafał Miłecki 2 participants 4 messages Aug 11, 2011 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 b43: rename TX header formats

Replace "old" and "new" with number of the first firmware known to use the given format.

---
 drivers/net/wireless/b43/xmit.c |   24 ++++++++++++------------
 drivers/net/wireless/b43/xmit.h |    8 ++++----
 2 files changed, 16 insertions(+), 16 deletions(-)
drivers/net/wireless/b43/xmit.c +12 -12
index b74f25e..36c7243 100644
@@ -338,10 +338,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 		}
 	}
 	if (b43_is_old_txhdr_format(dev)) {
-		b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->old_format.plcp),
+		b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->format_351.plcp),
 				      plcp_fragment_len, rate);
 	} else {
-		b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->new_format.plcp),
+		b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->format_410.plcp),
 				      plcp_fragment_len, rate);
 	}
 	b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->plcp_fb),
@@ -433,10 +433,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 
 			if (b43_is_old_txhdr_format(dev)) {
 				cts = (struct ieee80211_cts *)
-					(txhdr->old_format.rts_frame);
+					(txhdr->format_351.rts_frame);
 			} else {
 				cts = (struct ieee80211_cts *)
-					(txhdr->new_format.rts_frame);
+					(txhdr->format_410.rts_frame);
 			}
 			ieee80211_ctstoself_get(dev->wl->hw, info->control.vif,
 						fragment_data, fragment_len,
@@ -448,10 +448,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 
 			if (b43_is_old_txhdr_format(dev)) {
 				rts = (struct ieee80211_rts *)
-					(txhdr->old_format.rts_frame);
+					(txhdr->format_351.rts_frame);
 			} else {
 				rts = (struct ieee80211_rts *)
-					(txhdr->new_format.rts_frame);
+					(txhdr->format_410.rts_frame);
 			}
 			ieee80211_rts_get(dev->wl->hw, info->control.vif,
 					  fragment_data, fragment_len,
@@ -463,9 +463,9 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 
 		/* Generate the PLCP headers for the RTS/CTS frame */
 		if (b43_is_old_txhdr_format(dev))
-			plcp = &txhdr->old_format.rts_plcp;
+			plcp = &txhdr->format_351.rts_plcp;
 		else
-			plcp = &txhdr->new_format.rts_plcp;
+			plcp = &txhdr->format_410.rts_plcp;
 		b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)plcp,
 				      len, rts_rate);
 		plcp = &txhdr->rts_plcp_fb;
@@ -474,10 +474,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 
 		if (b43_is_old_txhdr_format(dev)) {
 			hdr = (struct ieee80211_hdr *)
-				(&txhdr->old_format.rts_frame);
+				(&txhdr->format_351.rts_frame);
 		} else {
 			hdr = (struct ieee80211_hdr *)
-				(&txhdr->new_format.rts_frame);
+				(&txhdr->format_410.rts_frame);
 		}
 		txhdr->rts_dur_fb = hdr->duration_id;
 
@@ -506,9 +506,9 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 
 	/* Magic cookie */
 	if (b43_is_old_txhdr_format(dev))
-		txhdr->old_format.cookie = cpu_to_le16(cookie);
+		txhdr->format_351.cookie = cpu_to_le16(cookie);
 	else
-		txhdr->new_format.cookie = cpu_to_le16(cookie);
+		txhdr->format_410.cookie = cpu_to_le16(cookie);
 
 	if (phy->type == B43_PHYTYPE_N) {
 		txhdr->phy_ctl1 =
drivers/net/wireless/b43/xmit.h +4 -4
index 42debb5..79fc162 100644
@@ -46,7 +46,7 @@ struct b43_txhdr {
 	__le32 timeout;			/* Timeout */
 
 	union {
-		/* The new r410 format. */
+		/* Tested with 410.2160, 478.104 and 508.* */
 		struct {
 			__le16 mimo_antenna;		/* MIMO antenna select */
 			__le16 preload_size;		/* Preload size */
@@ -57,9 +57,9 @@ struct b43_txhdr {
 			__u8 rts_frame[16];		/* The RTS frame (if used) */
 			PAD_BYTES(2);
 			struct b43_plcp_hdr6 plcp;	/* Main PLCP header */
-		} new_format __packed;
+		} format_410 __packed;
 
-		/* The old r351 format. */
+		/* Tested with 351.126 */
 		struct {
 			PAD_BYTES(2);
 			__le16 cookie;			/* TX frame cookie */
@@ -68,7 +68,7 @@ struct b43_txhdr {
 			__u8 rts_frame[16];		/* The RTS frame (if used) */
 			PAD_BYTES(2);
 			struct b43_plcp_hdr6 plcp;	/* Main PLCP header */
-		} old_format __packed;
+		} format_351 __packed;
 
 	} __packed;
 } __packed;
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 2/3 b43: use enum for firmware header format

---
 drivers/net/wireless/b43/b43.h  |    8 ++++++
 drivers/net/wireless/b43/main.c |    6 +++-
 drivers/net/wireless/b43/xmit.c |   52 +++++++++++++++++++++++++++------------
 drivers/net/wireless/b43/xmit.h |   15 ++++------
 4 files changed, 55 insertions(+), 26 deletions(-)
drivers/net/wireless/b43/b43.h +8 -0
index 3aee322..e9f04ae 100644
@@ -695,6 +695,11 @@ struct b43_firmware_file {
 	enum b43_firmware_file_type type;
 };
 
+enum b43_firmware_hdr_format {
+	B43_FW_HDR_410,
+	B43_FW_HDR_351,
+};
+
 /* Pointers to the firmware data and meta information about it. */
 struct b43_firmware {
 	/* Microcode */
@@ -711,6 +716,9 @@ struct b43_firmware {
 	/* Firmware patchlevel */
 	u16 patch;
 
+	/* Format of header used by firmware */
+	enum b43_firmware_hdr_format hdr_format;
+
 	/* Set to true, if we are using an opensource firmware.
 	 * Use this to check for proprietary vs opensource. */
 	bool opensource;
drivers/net/wireless/b43/main.c +5 -1
index d2661aa..fa05f00 100644
@@ -2510,6 +2510,10 @@ static int b43_upload_microcode(struct b43_wldev *dev)
 	}
 	dev->fw.rev = fwrev;
 	dev->fw.patch = fwpatch;
+	if (dev->fw.rev >= 410)
+		dev->fw.hdr_format = B43_FW_HDR_410;
+	else
+		dev->fw.hdr_format = B43_FW_HDR_351;
 	dev->fw.opensource = (fwdate == 0xFFFF);
 
 	/* Default to use-all-queues. */
@@ -2557,7 +2561,7 @@ static int b43_upload_microcode(struct b43_wldev *dev)
 			dev->fw.rev, dev->fw.patch);
 	wiphy->hw_version = dev->dev->core_id;
 
-	if (b43_is_old_txhdr_format(dev)) {
+	if (dev->fw.hdr_format == B43_FW_HDR_351) {
 		/* We're over the deadline, but we keep support for old fw
 		 * until it turns out to be in major conflict with something new. */
 		b43warn(dev->wl, "You are using an old firmware image. "
drivers/net/wireless/b43/xmit.c +36 -16

118 lines not on this page · raw message

drivers/net/wireless/b43/xmit.h +6 -9
index 79fc162..a3ff727 100644
@@ -166,19 +166,16 @@ struct b43_tx_legacy_rate_phy_ctl_entry {
 #define  B43_TXH_PHY1_MODUL_QAM256	0x2000 /* QAM256 */
 
 
-/* r351 firmware compatibility stuff. */
-static inline
-bool b43_is_old_txhdr_format(struct b43_wldev *dev)
-{
-	return (dev->fw.rev <= 351);
-}
-
 static inline
 size_t b43_txhdr_size(struct b43_wldev *dev)
 {
-	if (b43_is_old_txhdr_format(dev))
+	switch (dev->fw.hdr_format) {
+	case B43_FW_HDR_410:
+		return 104 + sizeof(struct b43_plcp_hdr6);
+	case B43_FW_HDR_351:
 		return 100 + sizeof(struct b43_plcp_hdr6);
-	return 104 + sizeof(struct b43_plcp_hdr6);
+	}
+	return 0;
 }
 
 
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 3/3 b43: support new TX header, noticed to be used by 598.314+ fw

In reply to Rafał Miłecki
---
 drivers/net/wireless/b43/b43.h  |    3 ++-
 drivers/net/wireless/b43/main.c |    4 +++-
 drivers/net/wireless/b43/xmit.c |   22 ++++++++++++++++++++++
 drivers/net/wireless/b43/xmit.h |   19 +++++++++++++++++++
 4 files changed, 46 insertions(+), 2 deletions(-)
drivers/net/wireless/b43/b43.h +2 -1
index e9f04ae..9e5974b 100644
@@ -696,6 +696,7 @@ struct b43_firmware_file {
 };
 
 enum b43_firmware_hdr_format {
+	B43_FW_HDR_598,
 	B43_FW_HDR_410,
 	B43_FW_HDR_351,
 };
@@ -884,7 +885,7 @@ struct b43_wl {
 	struct b43_leds leds;
 
 	/* Kmalloc'ed scratch space for PIO TX/RX. Protected by wl->mutex. */
-	u8 pio_scratchspace[110] __attribute__((__aligned__(8)));
+	u8 pio_scratchspace[118] __attribute__((__aligned__(8)));
 	u8 pio_tailspace[4] __attribute__((__aligned__(8)));
 };
 
drivers/net/wireless/b43/main.c +3 -1
index fa05f00..654c21e 100644
@@ -2510,7 +2510,9 @@ static int b43_upload_microcode(struct b43_wldev *dev)
 	}
 	dev->fw.rev = fwrev;
 	dev->fw.patch = fwpatch;
-	if (dev->fw.rev >= 410)
+	if (dev->fw.rev >= 598)
+		dev->fw.hdr_format = B43_FW_HDR_598;
+	else if (dev->fw.rev >= 410)
 		dev->fw.hdr_format = B43_FW_HDR_410;
 	else
 		dev->fw.hdr_format = B43_FW_HDR_351;
drivers/net/wireless/b43/xmit.c +22 -0
index 5ce17d5..b02170d 100644
@@ -338,6 +338,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 		}
 	}
 	switch (dev->fw.hdr_format) {
+	case B43_FW_HDR_598:
+		b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->format_598.plcp),
+				      plcp_fragment_len, rate);
+		break;
 	case B43_FW_HDR_351:
 		b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->format_351.plcp),
 				      plcp_fragment_len, rate);
@@ -435,6 +439,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 			struct ieee80211_cts *uninitialized_var(cts);
 
 			switch (dev->fw.hdr_format) {
+			case B43_FW_HDR_598:
+				cts = (struct ieee80211_cts *)
+					(txhdr->format_598.rts_frame);
+				break;
 			case B43_FW_HDR_351:
 				cts = (struct ieee80211_cts *)
 					(txhdr->format_351.rts_frame);
@@ -453,6 +461,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 			struct ieee80211_rts *uninitialized_var(rts);
 
 			switch (dev->fw.hdr_format) {
+			case B43_FW_HDR_598:
+				rts = (struct ieee80211_rts *)
+					(txhdr->format_598.rts_frame);
+				break;
 			case B43_FW_HDR_351:
 				rts = (struct ieee80211_rts *)
 					(txhdr->format_351.rts_frame);
@@ -472,6 +484,9 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 
 		/* Generate the PLCP headers for the RTS/CTS frame */
 		switch (dev->fw.hdr_format) {
+		case B43_FW_HDR_598:
+			plcp = &txhdr->format_598.rts_plcp;
+			break;
 		case B43_FW_HDR_351:
 			plcp = &txhdr->format_351.rts_plcp;
 			break;
@@ -486,6 +501,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 				      len, rts_rate_fb);
 
 		switch (dev->fw.hdr_format) {
+		case B43_FW_HDR_598:
+			hdr = (struct ieee80211_hdr *)
+				(&txhdr->format_598.rts_frame);
+			break;
 		case B43_FW_HDR_351:
 			hdr = (struct ieee80211_hdr *)
 				(&txhdr->format_351.rts_frame);
@@ -522,6 +541,9 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 
 	/* Magic cookie */
 	switch (dev->fw.hdr_format) {
+	case B43_FW_HDR_598:
+		txhdr->format_598.cookie = cpu_to_le16(cookie);
+		break;
 	case B43_FW_HDR_351:
 		txhdr->format_351.cookie = cpu_to_le16(cookie);
 		break;
drivers/net/wireless/b43/xmit.h +19 -0
index a3ff727..dccf7c1 100644
@@ -46,6 +46,23 @@ struct b43_txhdr {
 	__le32 timeout;			/* Timeout */
 
 	union {
+		/* Tested with 598.314, 644.1001 and 666.2 */
+		struct {
+			__le16 mimo_antenna;            /* MIMO antenna select */
+			__le16 preload_size;            /* Preload size */
+			PAD_BYTES(2);
+			__le16 cookie;                  /* TX frame cookie */
+			__le16 tx_status;               /* TX status */
+			__le16 max_n_mpdus;
+			__le16 max_a_bytes_mrt;
+			__le16 max_a_bytes_fbr;
+			__le16 min_m_bytes;
+			struct b43_plcp_hdr6 rts_plcp;  /* RTS PLCP header */
+			__u8 rts_frame[16];             /* The RTS frame (if used) */
+			PAD_BYTES(2);
+			struct b43_plcp_hdr6 plcp;      /* Main PLCP header */
+		} format_598 __packed;
+
 		/* Tested with 410.2160, 478.104 and 508.* */
 		struct {
 			__le16 mimo_antenna;		/* MIMO antenna select */
@@ -170,6 +187,8 @@ static inline
 size_t b43_txhdr_size(struct b43_wldev *dev)
 {
 	switch (dev->fw.hdr_format) {
+	case B43_FW_HDR_598:
+		return 112 + sizeof(struct b43_plcp_hdr6);
 	case B43_FW_HDR_410:
 		return 104 + sizeof(struct b43_plcp_hdr6);
 	case B43_FW_HDR_351:
Signature · 1 line
1.7.3.4
#3 lore raw

PATCH 3/3 b43: support new TX header, noticed to be used by 598.314+ fw

Quoted 8 lines · Rafa? Mi?ecki
---
  drivers/net/wireless/b43/b43.h  |    3 ++-
  drivers/net/wireless/b43/main.c |    4 +++-
  drivers/net/wireless/b43/xmit.c |   22 ++++++++++++++++++++++
  drivers/net/wireless/b43/xmit.h |   19 +++++++++++++++++++
  4 files changed, 46 insertions(+), 2 deletions(-)

These 3 patches tested with 14e4:4311 and 508.184 firmware.

Larry