Skip to contentSkip to conversation

d80211: remove bitfields from ieee80211_tx_control

PATCH New David Kimdon 1 participant 5 messages Nov 12, 2006 1 message not in the archive

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

PATCH 1/5 d80211: remove bitfields from ieee80211_tx_control

In reply to a message not in the archive

All one-bit bitfields have been subsumed into the new 'flags' structure member and the new IEEE80211_TXCTL_* definitions. The multiple bit members were converted to u8, s8 or u16 as appropriate.

include/net/d80211.h +32 -30
Index: wireless-dev/include/net/d80211.h
===================================================================
@@ -141,36 +141,38 @@ struct ieee80211_tx_control {
 	int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw
 			   * specific value for the rate (from
 			   * struct ieee80211_rate) */
-	/* 1 = only first attempt, 2 = one retry, .. */
-	unsigned int retry_limit:8;
-	/* duration field for RTS/CTS frame */
-	unsigned int rts_cts_duration:16;
-	unsigned int req_tx_status:1; /* request TX status callback for this
-				       * frame */
-	unsigned int do_not_encrypt:1; /* send this frame without encryption;
-			       * e.g., for EAPOL frames */
-	unsigned int use_rts_cts:1; /* Use RTS-CTS before sending frame. */
-	unsigned int use_cts_protect:1; /* Use CTS protection for the frame
-					 * (e.g., for combined 802.11g /
-					 * 802.11b networks) */
-        unsigned int no_ack:1; /* Tell the low level not to wait for an ack */
-	unsigned int rate_ctrl_probe:1;
-	unsigned int clear_dst_mask:1;
-	unsigned int requeue:1;
-	unsigned int first_fragment:1;	/* This is a first fragment of the
-					 * frame */
-        unsigned int power_level:8; /* per-packet transmit power level, in dBm
-				     */
-	unsigned int antenna_sel:4; /* 0 = default/diversity,
-				     * 1 = Ant0, 2 = Ant1 */
-	int key_idx:8; /* -1 = do not encrypt, >= 0 keyidx from hw->set_key()
-			*/
-	int icv_len:8; /* Length of the ICV/MIC field in octets */
-	int iv_len:8; /* Length of the IV field in octets */
-	unsigned int queue:4; /* hardware queue to use for this frame;
-		      * 0 = highest, hw->queues-1 = lowest */
-	unsigned int sw_retry_attempt:4; /* no. of times hw has tried to
-		      * transmit frame (not incl. hw retries) */
+
+#define IEEE80211_TXCTL_REQ_TX_STATUS	(1<<0)/* request TX status callback for
+						* this frame */
+#define IEEE80211_TXCTL_DO_NOT_ENCRYPT	(1<<1) /* send this frame without
+						* encryption; e.g., for EAPOL
+						* frames */
+#define IEEE80211_TXCTL_USE_RTS_CTS	(1<<2) /* use RTS-CTS before sending
+						* frame */
+#define IEEE80211_TXCTL_USE_CTS_PROTECT	(1<<3) /* use CTS protection for the
+						* frame (e.g., for combined
+						* 802.11g / 802.11b networks) */
+#define IEEE80211_TXCTL_NO_ACK		(1<<4) /* tell the low level not to
+						* wait for an ack */
+#define IEEE80211_TXCTL_RATE_CTRL_PROBE	(1<<5)
+#define IEEE80211_TXCTL_CLEAR_DST_MASK	(1<<6)
+#define IEEE80211_TXCTL_REQUEUE		(1<<7)
+#define IEEE80211_TXCTL_FIRST_FRAGMENT	(1<<8) /* this is a first fragment of
+						* the frame */
+	u32 flags;			       /* tx control flags defined
+						* above */
+	u16 rts_cts_duration;	/* duration field for RTS/CTS frame */
+	u8 retry_limit;		/* 1 = only first attempt, 2 = one retry, .. */
+	u8 power_level;		/* per-packet transmit power level, in dBm */
+	u8 antenna_sel; 	/* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */
+	s8 key_idx;		/* -1 = do not encrypt, >= 0 keyidx from
+				 * hw->set_key() */
+	u8 icv_len;		/* length of the ICV/MIC field in octets */
+	u8 iv_len;		/* length of the IV field in octets */
+	u8 queue;		/* hardware queue to use for this frame;
+				 * 0 = highest, hw->queues-1 = lowest */
+	u8 sw_retry_attempt;	/* number of times hw has tried to
+				 * transmit frame (not incl. hw retries) */
 
 	int rateidx; /* internal 80211.o rateidx */
 	int alt_retry_rate; /* retry rate for the last retries, given as the
net/d80211/ieee80211.c +43 -32

196 lines not on this page · raw message

net/d80211/ieee80211_scan.c +2 -2
Index: wireless-dev/net/d80211/ieee80211_scan.c
===================================================================
@@ -329,12 +329,12 @@ void ieee80211_init_scan(struct net_devi
 
 	memset(&local->scan.tx_control, 0, sizeof(local->scan.tx_control));
 	local->scan.tx_control.key_idx = HW_KEY_IDX_INVALID;
-	local->scan.tx_control.do_not_encrypt = 1;
+	local->scan.tx_control.flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
 	memset(&extra, 0, sizeof(extra));
 	extra.endidx = local->num_curr_rates;
 	local->scan.tx_control.tx_rate =
 		rate_control_get_rate(local, dev, local->scan.skb, &extra)->val;
-	local->scan.tx_control.no_ack = 1;
+	local->scan.tx_control.flags |= IEEE80211_TXCTL_NO_ACK;
 }
 
 
net/d80211/ieee80211_sta.c +1 -1
Index: wireless-dev/net/d80211/ieee80211_sta.c
===================================================================
@@ -2064,7 +2064,7 @@ static int ieee80211_sta_join_ibss(struc
 			rate->val2 : rate->val;
 		control.antenna_sel = local->conf.antenna_sel;
 		control.power_level = local->conf.power_level;
-		control.no_ack = 1;
+		control.flags |= IEEE80211_TXCTL_NO_ACK;
 		control.retry_limit = 1;
 		control.rts_cts_duration = 0;
 
drivers/net/wireless/d80211/adm8211/adm8211.c +3 -2
Index: wireless-dev/drivers/net/wireless/d80211/adm8211/adm8211.c
===================================================================
@@ -438,7 +438,8 @@ static void adm8211_interrupt_tci(struct
 		pci_unmap_single(priv->pdev, priv->tx_buffers[entry].mapping,
 				 priv->tx_buffers[entry].skb->len, PCI_DMA_TODEVICE);
 
-		if (priv->tx_buffers[entry].tx_status.control.req_tx_status ||
+		if ((priv->tx_buffers[entry].tx_status.control.flags &
+		     IEEE80211_TXCTL_REQ_TX_STATUS) ||
 		    !is_multicast_ether_addr(ieee80211_get_DA(&priv->tx_buffers[entry].hdr))) {
 			struct ieee80211_hdr *hdr;
 			size_t hdrlen = ieee80211_get_hdrlen(le16_to_cpu(priv->tx_buffers[entry].hdr.frame_control));
@@ -1870,7 +1871,7 @@ static int adm8211_tx(struct net_device 
 	if (short_preamble)
 		txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_SHORT_PREAMBLE);
 
-	if (control->use_rts_cts)
+	if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS)
 		txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_RTS);
 
 	if (fc & IEEE80211_FCTL_PROTECTED)
drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c +9 -8
Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
===================================================================
@@ -294,7 +294,7 @@ static void generate_txhdr_fw3(struct bc
 	u16 wsec_rate = 0;
 
 	/* No support for HW encryption with v3 firmware. */
-	assert(txctl->do_not_encrypt || txctl->key_idx < 0);
+	assert((txctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT) || txctl->key_idx < 0);
 
 	/* Now construct the TX header. */
 	memset(txhdr, 0, sizeof(*txhdr));
@@ -331,14 +331,14 @@ static void generate_txhdr_fw3(struct bc
 		   & BCM43xx_TXHDRCTL_ANTENNADIV_MASK;
 
 	/* Set the FLAGS field */
-	if (!txctl->no_ack)
+	if (!(txctl->flags & IEEE80211_TXCTL_NO_ACK))
 		flags |= BCM43xx_TXHDRFLAG_EXPECTACK;
 	if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
 	      ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
 		flags |= 0x10;
 	if (fallback_ofdm_modulation)
 		flags |= BCM43xx_TXHDRFLAG_FALLBACKOFDM;
-	if (txctl->first_fragment)
+	if (txctl->flags & IEEE80211_TXCTL_FIRST_FRAGMENT)
 		flags |= BCM43xx_TXHDRFLAG_FIRSTFRAGMENT;
 
 	/* Set WSEC/RATE field */
@@ -350,7 +350,7 @@ static void generate_txhdr_fw3(struct bc
 	 *        if we are on 80211g. If we get too many
 	 *        failures (hidden nodes), we should switch back to RTS/CTS.
 	 */
-	if (txctl->use_rts_cts) {
+	if (txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) {
 		bcm43xx_generate_rts(phy, txhdr, &flags,
 				     txctl->rts_cts_rate,
 				     wireless_header);
@@ -371,7 +371,8 @@ static void generate_txhdr_fw4(struct bc
 	const struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
 	const struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
 	const struct ieee80211_hdr *wlhdr = (const struct ieee80211_hdr *)fragment_data;
-	int use_encryption = ((!txctl->do_not_encrypt) && (txctl->key_idx >= 0));
+	int use_encryption = ((!(txctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) &&
+			      (txctl->key_idx >= 0));
 	u16 fctl = le16_to_cpu(wlhdr->frame_control);
 	u8 rate, rate_fb;
 	int rate_ofdm, rate_fb_ofdm;
@@ -461,17 +462,17 @@ static void generate_txhdr_fw4(struct bc
 	}
 
 	/* MAC control */
-	if (!txctl->no_ack)
+	if (!(txctl->flags & IEEE80211_TXCTL_NO_ACK))
 		mac_ctl |= BCM43xx_TX4_MAC_ACK;
 	if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
 	      ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
 		mac_ctl |= BCM43xx_TX4_MAC_HWSEQ;
-	if (txctl->first_fragment)
+	if (txctl->flags & IEEE80211_TXCTL_FIRST_FRAGMENT)
 		mac_ctl |= BCM43xx_TX4_MAC_STMSDU;
 	if (phy->type == BCM43xx_PHYTYPE_A)
 		mac_ctl |= BCM43xx_TX4_MAC_5GHZ;
 
-	if (txctl->use_rts_cts) {
+	if (txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) {
 		//TODO
 	}
 
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +4 -3
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
===================================================================
@@ -1556,14 +1556,15 @@ static void rt2400pci_write_tx_desc(stru
 		tx_rate = control->tx_rate;
 
 	rt2x00_set_field32(&txd->word0, TXD_W0_VALID, 1);
-	rt2x00_set_field32(&txd->word0, TXD_W0_ACK, !control->no_ack);
+	rt2x00_set_field32(&txd->word0, TXD_W0_ACK,
+			   !(control->flags & IEEE80211_TXCTL_NO_ACK));
 
 	/*
 	 * Set IFS to IFS_SIFS when the this is not the first fragment,
 	 * or this fragment came after RTS/CTS.
 	 */
 	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
-	    control->use_rts_cts)
+	    (control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_BACKOFF);
@@ -1914,7 +1915,7 @@ static int rt2400pci_tx(struct net_devic
 	 * create and queue that frame first.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (control->use_rts_cts &&
+	if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) &&
 	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt2400pci_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +4 -3
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
===================================================================
@@ -1681,7 +1681,8 @@ static void rt2500pci_write_tx_desc(stru
 		tx_rate = control->tx_rate;
 
 	rt2x00_set_field32(&txd->word0, TXD_W0_VALID, 1);
-	rt2x00_set_field32(&txd->word0, TXD_W0_ACK, !control->no_ack);
+	rt2x00_set_field32(&txd->word0, TXD_W0_ACK,
+			   !(control->flags & IEEE80211_TXCTL_NO_ACK));
 
 	ring = rt2x00_get_ring(rt2x00dev, control->queue);
 	if (unlikely(!ring))
@@ -1697,7 +1698,7 @@ static void rt2500pci_write_tx_desc(stru
 	 * or this fragment came after RTS/CTS.
 	 */
 	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
-	    control->use_rts_cts)
+	    (control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_BACKOFF);
@@ -2063,7 +2064,7 @@ static int rt2500pci_tx(struct net_devic
 	 * create and queue that frame first.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (control->use_rts_cts &&
+	if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) &&
 	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt2500pci_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
drivers/net/wireless/d80211/rt2x00/rt61pci.c +4 -3
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt61pci.c
===================================================================
@@ -2111,7 +2111,8 @@ static void rt61pci_write_tx_desc(struct
 		tx_rate = control->tx_rate;
 
 	rt2x00_set_field32(&txd->word0, TXD_W0_VALID, 1);
-	rt2x00_set_field32(&txd->word0, TXD_W0_ACK, !control->no_ack);
+	rt2x00_set_field32(&txd->word0, TXD_W0_ACK,
+		       	   !(control->flags & IEEE80211_TXCTL_NO_ACK));
 
 	ring = rt2x00_get_ring(rt2x00dev, control->queue);
 	if (unlikely(!ring))
@@ -2127,7 +2128,7 @@ static void rt61pci_write_tx_desc(struct
 	 * or this fragment came after RTS/CTS.
 	 */
 	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
-	    control->use_rts_cts)
+	    (control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_BACKOFF);
@@ -2539,7 +2540,7 @@ static int rt61pci_tx(struct net_device 
 	 * create and queue that frame first.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (control->use_rts_cts &&
+	if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) &&
 	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt61pci_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +4 -3
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
===================================================================
@@ -1459,7 +1459,8 @@ static void rt2500usb_write_tx_desc(stru
 	else
 		tx_rate = control->tx_rate;
 
-	rt2x00_set_field32(&txd->word0, TXD_W0_ACK, !control->no_ack);
+	rt2x00_set_field32(&txd->word0, TXD_W0_ACK,
+			   !(control->flags & IEEE80211_TXCTL_NO_ACK));
 
 	ring = rt2x00_get_ring(rt2x00dev, control->queue);
 	if (unlikely(!ring))
@@ -1475,7 +1476,7 @@ static void rt2500usb_write_tx_desc(stru
 	 * or this fragment came after RTS/CTS.
 	 */
 	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
-	    control->use_rts_cts)
+	    (control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_BACKOFF);
@@ -1800,7 +1801,7 @@ static int rt2500usb_tx(struct net_devic
 	 * create and queue that frame first.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (control->use_rts_cts &&
+	if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) &&
 	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt2500usb_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
drivers/net/wireless/d80211/rt2x00/rt73usb.c +4 -3
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt73usb.c
===================================================================
@@ -1732,7 +1732,8 @@ static void rt73usb_write_tx_desc(struct
 		tx_rate = control->tx_rate;
 
 	rt2x00_set_field32(&txd->word0, TXD_W0_VALID, 1);
-	rt2x00_set_field32(&txd->word0, TXD_W0_ACK, !control->no_ack);
+	rt2x00_set_field32(&txd->word0, TXD_W0_ACK,
+			   !(control->flags & IEEE80211_TXCTL_NO_ACK));
 
 	ring = rt2x00_get_ring(rt2x00dev, control->queue);
 	if (unlikely(!ring))
@@ -1748,7 +1749,7 @@ static void rt73usb_write_tx_desc(struct
 	 * or this fragment came after RTS/CTS.
 	 */
 	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
-	    control->use_rts_cts)
+	    (control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_BACKOFF);
@@ -2089,7 +2090,7 @@ static int rt73usb_tx(struct net_device 
 	 * create and queue that frame first.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (control->use_rts_cts &&
+	if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) &&
 	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt73usb_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
drivers/net/wireless/d80211/p54/prism54common.c +5 -3
Index: wireless-dev/drivers/net/wireless/d80211/p54/prism54common.c
===================================================================
@@ -396,7 +396,7 @@ static int p54_tx(struct net_device *dev
 
 	hdr->magic1 = __constant_cpu_to_le16(0x0010);
 	hdr->len = skb->len - sizeof(*hdr);
-	hdr->type = control->no_ack ? 0 : 1;
+	hdr->type = (control->flags & IEEE80211_TXCTL_NO_ACK) ? 0 : 1;
 	hdr->retry1 = hdr->retry2 = control->retry_limit;
 	p54_assign_address(dev, skb, hdr, skb->len, control_copy);
 
@@ -405,8 +405,10 @@ static int p54_tx(struct net_device *dev
 	txhdr->wep_key_present = 0;
 	txhdr->wep_key_len = 0;
 	txhdr->frame_type = __constant_cpu_to_le32(0x4);
-	txhdr->magic4 = control->no_ack ? 0 : __constant_cpu_to_le32(0x7f020000);
-	txhdr->magic5 = control->no_ack ? 0 : __constant_cpu_to_le32(0x23);
+	txhdr->magic4 = (control->flags & IEEE80211_TXCTL_NO_ACK) ?
+			 0 : __constant_cpu_to_le32(0x7f020000);
+	txhdr->magic5 = (control->flags & IEEE80211_TXCTL_NO_ACK) ?
+			 0 : __constant_cpu_to_le32(0x23);
 
 	priv->tx(dev, hdr, skb->len, 0);
 	return 0;

--

#2 lore raw

PATCH 2/5 d80211: remove bitfields from ieee80211_tx_status

In reply to a message not in the archive

Both one-bit bitfields have been subsumed into the new 'flags' structure member and the new IEEE80211_TX_STATUS_* definitions.

include/net/d80211.h +4 -2
Index: wireless-dev/include/net/d80211.h
===================================================================
@@ -211,8 +211,10 @@ struct ieee80211_tx_status {
 	/* copied ieee80211_tx_control structure */
 	struct ieee80211_tx_control control;
 
-	unsigned int tx_filtered:1;
-	unsigned int ack:1; /* whether the TX frame was ACKed */
+#define IEEE80211_TX_STATUS_TX_FILTERED	(1<<0)
+#define IEEE80211_TX_STATUS_ACK		(1<<1) /* whether the TX frame was ACKed */
+	u32 flags;		/* tx staus flags defined above */
+
 	int ack_signal; /* measured signal strength of the ACK frame */
 	int excessive_retries;
 	int retry_count;
drivers/net/wireless/d80211/adm8211/adm8211.c +4 -2
Index: wireless-dev/drivers/net/wireless/d80211/adm8211/adm8211.c
===================================================================
@@ -428,12 +428,14 @@ static void adm8211_interrupt_tci(struct
 
 		if (status & TDES0_STATUS_ES) {
 			stats->tx_errors++;
-			priv->tx_buffers[entry].tx_status.ack = 0;
+			priv->tx_buffers[entry].tx_status.flags &=
+						~IEEE80211_TX_STATUS_ACK;
 
 			if (status & (TDES0_STATUS_TUF | TDES0_STATUS_TRO))
 				stats->tx_fifo_errors++;
 		} else
-			priv->tx_buffers[entry].tx_status.ack = 1;
+			priv->tx_buffers[entry].tx_status.flags |=
+						IEEE80211_TX_STATUS_ACK;
 
 		pci_unmap_single(priv->pdev, priv->tx_buffers[entry].mapping,
 				 priv->tx_buffers[entry].skb->len, PCI_DMA_TODEVICE);
drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c +2 -1
Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c
===================================================================
@@ -1127,7 +1127,8 @@ void bcm43xx_dma_handle_txstatus(struct 
 			 * status of the transmission.
 			 * Some fields of txstat are already filled in dma_tx().
 			 */
-			meta->txstat.ack = status->acked;
+			if (status->acked)
+				meta->txstat.flags |= IEEE80211_TX_STATUS_ACK;
 			meta->txstat.retry_count = status->frame_count - 1;
 			ieee80211_tx_status_irqsafe(bcm->net_dev, meta->skb, &(meta->txstat));
 			/* skb is freed by ieee80211_tx_status_irqsafe() */
drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c +2 -1
Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c
===================================================================
@@ -500,7 +500,8 @@ void bcm43xx_pio_handle_txstatus(struct 
 	queue->tx_devq_packets--;
 	queue->tx_devq_used -= (packet->skb->len + phy->txhdr_size);
 
-	packet->txstat.ack = status->acked;
+	if (status->acked)
+		packet->txstat.flags |= IEEE80211_TX_STATUS_ACK;
 	packet->txstat.retry_count = status->frame_count - 1;
 	ieee80211_tx_status_irqsafe(bcm->net_dev, packet->skb,
 				    &(packet->txstat));
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +4 -4
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
===================================================================
@@ -1749,10 +1749,11 @@ static void rt2400pci_txdone(void *data)
 
 		ack = rt2x00_get_field32(txd->word0, TXD_W0_ACK);
 
+		entry->tx_status.flags  = 0;
 		/*
-		 * TODO: How can te below field be set correctly?
+		 * TODO: How can bit IEEE80211_TX_STATUS_TX_FILTERED of
+		 * entry->tx_status.flags be set correctly?
 		 */
-		entry->tx_status.tx_filtered = 0;
 
 		entry->tx_status.queue_length = ring->stats.limit;
 		entry->tx_status.queue_number = entry->tx_status.control.queue;
@@ -1764,11 +1765,10 @@ static void rt2400pci_txdone(void *data)
 		 * was succesfull.
 		 */
 		tx_status = rt2x00_get_field32(txd->word0, TXD_W0_RESULT);
-		entry->tx_status.ack = 0;
 		entry->tx_status.excessive_retries = 0;
 		if (ack && (tx_status == TX_SUCCESS ||
 		    tx_status == TX_SUCCESS_RETRY))
-			entry->tx_status.ack = 1;
+			entry->tx_status.flags |= IEEE80211_TX_STATUS_ACK;
 		else if (ack && tx_status == TX_FAIL_RETRY) {
 			rt2x00dev->low_level_stats.dot11ACKFailureCount++;
 			entry->tx_status.excessive_retries = 1;
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +4 -4
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
===================================================================
@@ -1898,10 +1898,11 @@ static void rt2500pci_txdone(void *data)
 
 		ack = rt2x00_get_field32(txd->word0, TXD_W0_ACK);
 
+		entry->tx_status.flags = 0;
 		/*
-		 * TODO: How can te below field be set correctly?
+		 * TODO: How can the IEEE80211_TX_STATUS_TX_FILTERED bit of
+		 * entry->tx_status.flags be set correctly?
 		 */
-		entry->tx_status.tx_filtered = 0;
 
 		entry->tx_status.queue_length = ring->stats.limit;
 		entry->tx_status.queue_number = entry->tx_status.control.queue;
@@ -1913,11 +1914,10 @@ static void rt2500pci_txdone(void *data)
 		 * was succesfull.
 		 */
 		tx_status = rt2x00_get_field32(txd->word0, TXD_W0_RESULT);
-		entry->tx_status.ack = 0;
 		entry->tx_status.excessive_retries = 0;
 		if (ack && (tx_status == TX_SUCCESS ||
 		    tx_status == TX_SUCCESS_RETRY))
-			entry->tx_status.ack = 1;
+			entry->tx_status.flags |= IEEE80211_TX_STATUS_ACK;
 		else if (ack && tx_status == TX_FAIL_RETRY) {
 			rt2x00dev->low_level_stats.dot11ACKFailureCount++;
 			entry->tx_status.excessive_retries = 1;
net/d80211/ieee80211.c +5 -5
Index: wireless-dev/net/d80211/ieee80211.c
===================================================================
@@ -4047,13 +4047,13 @@ void ieee80211_tx_status(struct net_devi
 				 * that this TX packet failed because of that.
 				 */
 				status->excessive_retries = 0;
-				status->tx_filtered = 1;
+				status->flags |= IEEE80211_TX_STATUS_TX_FILTERED;
 			}
 			sta_info_put(sta);
 		}
 	}
 
-	if (status->tx_filtered) {
+	if (status->flags & IEEE80211_TX_STATUS_TX_FILTERED) {
 		struct sta_info *sta;
 		sta = sta_info_get(local, hdr->addr1);
 		if (sta) {
@@ -4115,7 +4115,7 @@ void ieee80211_tx_status(struct net_devi
 	frag = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG;
 	type = le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE;
 
-        if (status->ack) {
+        if (status->flags & IEEE80211_TX_STATUS_ACK) {
 		if (frag == 0) {
 			local->dot11TransmittedFrameCount++;
 			if (is_multicast_ether_addr(hdr->addr1))
@@ -4144,8 +4144,8 @@ void ieee80211_tx_status(struct net_devi
 		return;
 	}
 
-	msg_type = status->ack ? ieee80211_msg_tx_callback_ack :
-		ieee80211_msg_tx_callback_fail;
+	msg_type = (status->flags & IEEE80211_TX_STATUS_ACK) ?
+	       	ieee80211_msg_tx_callback_ack : ieee80211_msg_tx_callback_fail;
 
 	/* skb was the original skb used for TX. Clone it and give the clone
 	 * to netif_rx(). Free original skb. */
drivers/net/wireless/d80211/rt2x00/rt61pci.c +4 -4
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt61pci.c
===================================================================
@@ -2334,10 +2334,11 @@ static void rt61pci_txdone_entry(struct 
 
 	ack = rt2x00_get_field32(txd->word0, TXD_W0_ACK);
 
+	entry->tx_status.flags = 0;
 	/*
-	 * TODO: How can te below field be set correctly?
+	 * TODO: How can the IEEE80211_TX_STATUS_TX_FILTERED bit of
+	 * entry->tx_status.flags be set correctly?
 	 */
-	entry->tx_status.tx_filtered = 0;
 
 	entry->tx_status.queue_length = entry->ring->stats.limit;
 	entry->tx_status.queue_number = entry->tx_status.control.queue;
@@ -2349,11 +2350,10 @@ static void rt61pci_txdone_entry(struct 
 	 * was succesfull.
 	 */
 	tx_status = rt2x00_get_field32(sta_csr4, STA_CSR4_TX_RESULT);
-	entry->tx_status.ack = 0;
 	entry->tx_status.excessive_retries = 0;
 	if (ack && (tx_status == TX_SUCCESS ||
 	    tx_status == TX_SUCCESS_RETRY))
-		entry->tx_status.ack = 1;
+		entry->tx_status.flags |= IEEE80211_TX_STATUS_ACK;
 	else if (ack && tx_status == TX_FAIL_RETRY) {
 		rt2x00dev->low_level_stats.dot11ACKFailureCount++;
 		entry->tx_status.excessive_retries = 1;
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +4 -4
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
===================================================================
@@ -1686,10 +1686,11 @@ static void rt2500usb_txdone(void *data)
 
 		ack = rt2x00_get_field32(txd->word0, TXD_W0_ACK);
 
+		entry->tx_status.flags = 0;
 		/*
-		 * TODO: How can te below field be set correctly?
+		 * TODO: How can bit IEEE80211_TX_STATUS_TX_FILTERED of
+		 * entry->tx_status.flags be set correctly?
 		 */
-		entry->tx_status.tx_filtered = 0;
 
 		entry->tx_status.queue_length = entry->ring->stats.limit;
 		entry->tx_status.queue_number = entry->tx_status.control.queue;
@@ -1699,10 +1700,9 @@ static void rt2500usb_txdone(void *data)
 		 * ACK response when ACK was requested and status
 		 * was succesfull.
 		 */
-		entry->tx_status.ack = 0;
 		entry->tx_status.excessive_retries = 0;
 		if (ack && (urb->status == TX_SUCCESS))
-			entry->tx_status.ack = 1;
+			entry->tx_status.flags |= IEEE80211_TX_STATUS_ACK;
 		else if (ack && urb->status == TX_FAIL_OTHER) {
 			rt2x00dev->low_level_stats.dot11ACKFailureCount++;
 			entry->tx_status.excessive_retries = 1;
drivers/net/wireless/d80211/rt2x00/rt73usb.c +4 -4
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt73usb.c
===================================================================
@@ -1976,10 +1976,11 @@ static void rt73usb_txdone(void *data)
 
 		ack = rt2x00_get_field32(txd->word0, TXD_W0_ACK);
 
+		entry->tx_status.flags = 0;
 		/*
-		 * TODO: How can te below field be set correctly?
+		 * TODO: How can bit IEEE80211_TX_STATUS_TX_FILTERED of
+		 * entry->tx_status.flags be set correctly?
 		 */
-		entry->tx_status.tx_filtered = 0;
 
 		entry->tx_status.queue_length = entry->ring->stats.limit;
 		entry->tx_status.queue_number = entry->tx_status.control.queue;
@@ -1989,10 +1990,9 @@ static void rt73usb_txdone(void *data)
 		 * ACK response when ACK was requested and status
 		 * was succesfull.
 		 */
-		entry->tx_status.ack = 0;
 		entry->tx_status.excessive_retries = 0;
 		if (ack && (urb->status == TX_SUCCESS))
-			entry->tx_status.ack = 1;
+			entry->tx_status.flags |= IEEE80211_TX_STATUS_ACK;
 		else {
 			rt2x00dev->low_level_stats.dot11ACKFailureCount++;
 			entry->tx_status.excessive_retries = 1;
drivers/net/wireless/d80211/p54/prism54common.c +2 -1
Index: wireless-dev/drivers/net/wireless/d80211/p54/prism54common.c
===================================================================
@@ -250,7 +250,8 @@ static void p54_rx_frame_sent(struct net
 			memcpy(&status.control, range->control,
 			       sizeof(status.control));
 			kfree(range->control);
-			status.ack = (payload->status >> 8) & 1;
+			if ((payload->status >> 8) & 1)
+				status.flags |= IEEE80211_TX_STATUS_ACK;
 			status.ack_signal = le16_to_cpu(payload->ack_rssi);
 			skb_pull(entry, sizeof(*hdr) + sizeof(struct p54_tx_control_allocdata));
 			ieee80211_tx_status_irqsafe(dev, entry, &status);

--

#3 lore raw

PATCH 3/5 d80211: remove bitfields from ieee80211_key_conf

In reply to a message not in the archive

All three one-bit bitfields have been subsumed into the new 'flags' structure member and the new IEEE80211_KEY_* definitions. The 8 bit keyidx bitfield is converted to type s8.

drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +5 -4
Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
===================================================================
@@ -3667,7 +3667,7 @@ static int bcm43xx_net_set_key(struct ne
 	}
 	if (bcm43xx_current_phy(bcm)->fw == BCM43xx_FW_3) {
 		/* No support for HW-crypto with v3 firmware. */
-		key->force_sw_encrypt = 1;
+		key->flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
 		err = 0;
 		goto out_unlock;
 	}
@@ -3678,7 +3678,7 @@ static int bcm43xx_net_set_key(struct ne
 		if (algorithm == BCM43xx_SEC_ALGO_TKIP) {
 			/* FIXME: No TKIP hardware encryption for now. */
 			err = 0;
-			key->force_sw_encrypt = 1;
+			key->flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
 			goto out_unlock;
 		}
 
@@ -3702,7 +3702,7 @@ static int bcm43xx_net_set_key(struct ne
 					 bcm43xx_hf_read(bcm) &
 					 ~BCM43xx_HF_USEDEFKEYS);
 		}
-		key->force_sw_encrypt = 0;
+		key->flags &= ~IEEE80211_KEY_FORCE_SW_ENCRYPT;
 		break;
 	case DISABLE_KEY:
 		if (is_broadcast_ether_addr(addr)) {
@@ -3735,7 +3735,8 @@ out:
 	if (!err) {
 		dprintk(KERN_DEBUG PFX "Using %s based encryption for keyidx: %d, "
 			"mac: " MAC_FMT "\n",
-			(key->force_sw_encrypt) ? "software" : "hardware",
+			(key->flags & IEEE80211_KEY_FORCE_SW_ENCRYPT) ?
+			"software" : "hardware",
 			key->keyidx, MAC_ARG(addr));
 	}
 	return err;
include/net/d80211.h +13 -7
Index: wireless-dev/include/net/d80211.h
===================================================================
@@ -368,13 +368,19 @@ struct ieee80211_key_conf {
 	ieee80211_key_alg alg;
 	int keylen;
 
-	unsigned int force_sw_encrypt:1;/* to be cleared by low-level driver */
-	int keyidx:8;			/* WEP key index */
-	unsigned int default_tx_key:1;	/* This key is the new default TX key
-			       		 * (used only for broadcast keys). */
-	unsigned int default_wep_only:1;/* static WEP is the only configured security
-					 * policy; this allows some low-level drivers
-					 * to determine when hwaccel can be used */
+#define IEEE80211_KEY_FORCE_SW_ENCRYPT (1<<0) /* to be cleared by low-level
+						 driver */
+#define IEEE80211_KEY_DEFAULT_TX_KEY   (1<<1) /* This key is the new default TX
+						 key (used only for broadcast
+						 keys). */
+#define IEEE80211_KEY_DEFAULT_WEP_ONLY (1<<2) /* static WEP is the only
+						 configured security policy;
+						 this allows some low-level
+						 drivers to determine when
+						 hwaccel can be used */
+	u32 flags; /* key configuration flags defined above */
+
+	s8 keyidx;			/* WEP key index */
         u8 key[0];
 };
 
net/d80211/ieee80211.c +7 -3
Index: wireless-dev/net/d80211/ieee80211.c
===================================================================
@@ -64,10 +64,14 @@ ieee80211_key_data2conf(struct ieee80211
 	conf->hw_key_idx = data->hw_key_idx;
 	conf->alg = data->alg;
 	conf->keylen = data->keylen;
-	conf->force_sw_encrypt = data->force_sw_encrypt;
+	conf->flags = 0;
+       if (data->force_sw_encrypt)
+		conf->flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
 	conf->keyidx = data->keyidx;
-	conf->default_tx_key = data->default_tx_key;
-	conf->default_wep_only = local->default_wep_only;
+	if (data->default_tx_key)
+		conf->flags |= IEEE80211_KEY_DEFAULT_TX_KEY;
+	if (local->default_wep_only)
+		conf->flags |= IEEE80211_KEY_DEFAULT_WEP_ONLY;
 	memcpy(conf->key, data->key, data->keylen);
 
 	return conf;
net/d80211/ieee80211_ioctl.c +4 -3
Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
@@ -331,7 +331,7 @@ static int ieee80211_ioctl_add_sta(struc
 		memset(&conf, 0, sizeof(conf));
 		conf.hw_key_idx = HW_KEY_IDX_INVALID;
 		conf.alg = ALG_NULL;
-		conf.force_sw_encrypt = 1;
+		conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
 		if (local->hw->set_key(dev, SET_KEY, sta->addr, &conf,
 				       sta->aid)) {
 			sta->key_idx_compression = HW_KEY_IDX_INVALID;
@@ -501,7 +501,7 @@ int ieee80211_set_hw_encryption(struct n
 			key->hw_key_idx = HW_KEY_IDX_INVALID;
 		} else {
 			key->force_sw_encrypt =
-				keyconf->force_sw_encrypt;
+				!!(keyconf->flags & IEEE80211_KEY_FORCE_SW_ENCRYPT);
 			key->hw_key_idx =
 				keyconf->hw_key_idx;
 
@@ -2304,7 +2304,8 @@ static void ieee80211_key_enable_hwaccel
 	keyconf = ieee80211_key_data2conf(local, key);
 	if (keyconf && local->hw->set_key &&
 	    local->hw->set_key(local->mdev, SET_KEY, addr, keyconf, 0) == 0) {
-		key->force_sw_encrypt = keyconf->force_sw_encrypt;
+		key->force_sw_encrypt =
+			!!(keyconf->flags & IEEE80211_KEY_FORCE_SW_ENCRYPT);
 		key->hw_key_idx = keyconf->hw_key_idx;
 	}
 	kfree(keyconf);
net/d80211/sta_info.c +1 -1
Index: wireless-dev/net/d80211/sta_info.c
===================================================================
@@ -255,7 +255,7 @@ void sta_info_free(struct sta_info *sta,
 		memset(&conf, 0, sizeof(conf));
 		conf.hw_key_idx = sta->key_idx_compression;
 		conf.alg = ALG_NULL;
-		conf.force_sw_encrypt = 1;
+		conf.flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
 		local->hw->set_key(local->mdev, DISABLE_KEY, sta->addr, &conf,
 				   sta->aid);
 		sta->key_idx_compression = HW_KEY_IDX_INVALID;

--

#4 lore raw

PATCH 4/5 d80211: remove bitfields from ieee80211_hw

In reply to a message not in the archive

All twelve one-bit bitfields have been subsumed into the new 'flags' structure member and the new IEEE80211_HW_* definitions.

drivers/net/wireless/d80211/adm8211/adm8211.c +3 -10
Index: wireless-dev/drivers/net/wireless/d80211/adm8211/adm8211.c
===================================================================
@@ -2025,17 +2025,10 @@ static int __devinit adm8211_probe(struc
 
 	hw->version = 2;
 	hw->name = "adm8211";
-	hw->host_gen_beacon = 0;
-	hw->device_hides_wep = 0;
-	hw->rx_includes_fcs = 0;	// however, FCS is kept in promisc mode
-	hw->host_broadcast_ps_buffering = 0;
-	hw->wep_include_iv = 1;
-	hw->data_nullfunc_ack = 0;
-	hw->no_tkip_wmm_hwaccel = 1;
 	hw->extra_tx_headroom = 0;
-	hw->device_strips_mic = 0;
-	hw->monitor_during_oper = 0;
-	hw->fraglist = 0;
+	hw->flags = IEEE80211_HW_WEP_INCLUDE_IV | IEEE80211_HW_NO_TKIP_WMM_HWACCEL;
+	// however, IEEE80211_HW_RX_INCLUDES_FCS in promisc mode
+
 	hw->channel_change_time = 1000;
 
 	hw->num_modes = 1;
include/net/d80211.h +15 -12
Index: wireless-dev/include/net/d80211.h
===================================================================
@@ -439,19 +439,19 @@ struct ieee80211_hw {
 	 * configure the upper layer IEEE 802.11 module to generate beacons.
 	 * The low-level driver can use ieee80211_beacon_get() to fetch the
 	 * next beacon frame. */
-	unsigned int host_gen_beacon:1;
+#define IEEE80211_HW_HOST_GEN_BEACON (1<<0)
 
 	/* The device needs to be supplied with a beacon template only. */
-	unsigned int host_gen_beacon_template:1;
+#define IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE (1<<1)
 
 	/* Some devices handle decryption internally and do not
 	 * indicate whether the frame was encrypted (unencrypted frames
 	 * will be dropped by the hardware, unless specifically allowed
 	 * through) */
-	unsigned int device_hides_wep:1;
+#define IEEE80211_HW_DEVICE_HIDES_WEP (1<<2)
 
 	/* Whether RX frames passed to ieee80211_rx() include FCS in the end */
-	unsigned int rx_includes_fcs:1;
+#define IEEE80211_HW_RX_INCLUDES_FCS (1<<3)
 
 	/* Some wireless LAN chipsets buffer broadcast/multicast frames for
 	 * power saving stations in the hardware/firmware and others rely on
@@ -459,14 +459,15 @@ struct ieee80211_hw {
 	 * configure the IEEE 802.11 upper layer to buffer broadcast/multicast
 	 * frames when there are power saving stations so that low-level driver
 	 * can fetch them with ieee80211_get_buffered_bc(). */
-	unsigned int host_broadcast_ps_buffering:1;
+#define IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING (1<<4)
 
-	unsigned int wep_include_iv:1;
-	unsigned int data_nullfunc_ack:1; /* will data nullfunc frames get proper
-					   * TX status callback */
+#define IEEE80211_HW_WEP_INCLUDE_IV (1<<5)
+
+	/* will data nullfunc frames get proper TX status callback */
+#define IEEE80211_HW_DATA_NULLFUNC_ACK (1<<6)
 
 	/* Force software encryption for TKIP packets if WMM is enabled. */
-	unsigned int no_tkip_wmm_hwaccel:1;
+#define IEEE80211_HW_NO_TKIP_WMM_HWACCEL (1<<7)
 
 	/* Some devices handle Michael MIC internally and do not include MIC in
 	 * the received packets passed up. device_strips_mic must be set
@@ -474,15 +475,17 @@ struct ieee80211_hw {
 	 * be still set in the IEEE 802.11 header with this option unlike with
 	 * the device_hides_wep configuration option.
 	 */
-	unsigned int device_strips_mic:1;
+#define IEEE80211_HW_DEVICE_STRIPS_MIC (1<<8)
 
 	/* Device is capable of performing full monitor mode even during
 	 * normal operation. */
-	unsigned int monitor_during_oper:1;
+#define IEEE80211_HW_MONITOR_DURING_OPER (1<<9)
 
 	/* Set if the low-level driver supports skb fraglist (NETIF_F_FRAGLIST),
 	 * i.e. more than one skb per frame */
-	unsigned int fraglist:1;
+#define IEEE80211_HW_FRAGLIST (1<<10)
+
+	u32 flags;			/* hardware flags defined above */
 
 	/* Set to the size of a needed device specific skb headroom for TX skbs. */
 	unsigned int extra_tx_headroom;
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +4 -5
Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
===================================================================
@@ -3971,9 +3971,10 @@ static int __devinit bcm43xx_init_one(st
 		goto out;
 	ieee->version = IEEE80211_VERSION;
 	ieee->name = KBUILD_MODNAME;
-	ieee->host_gen_beacon_template = 1;
-	ieee->rx_includes_fcs = 0;
-	ieee->monitor_during_oper = 1;
+	ieee->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
+		      IEEE80211_HW_MONITOR_DURING_OPER |
+		      IEEE80211_HW_DEVICE_HIDES_WEP |
+		      IEEE80211_HW_WEP_INCLUDE_IV;
 	ieee->maxssi = BCM43xx_RX_MAX_SSI;
 	ieee->tx = bcm43xx_net_hard_start_xmit;
 	ieee->open = bcm43xx_net_open;
@@ -3985,12 +3986,10 @@ static int __devinit bcm43xx_init_one(st
 	ieee->config_interface = bcm43xx_config_interface;
 	ieee->set_multicast_list = bcm43xx_set_multicast_list;
 	ieee->set_key = bcm43xx_net_set_key;
-	ieee->device_hides_wep = 1;
 	ieee->get_stats = bcm43xx_net_get_stats;
 	ieee->queues = 1;
 	ieee->get_tx_stats = bcm43xx_net_get_tx_stats;
 	ieee->conf_tx = bcm43xx_net_conf_tx;
-	ieee->wep_include_iv = 1;
 
 	net_dev = ieee80211_alloc_hw(sizeof(*bcm), bcm43xx_netdev_setup);
 	if (!net_dev) {
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +6 -11
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
===================================================================
@@ -2578,18 +2578,13 @@ static int rt2400pci_init_hw(struct rt2x
 	 */
 	hw->version = IEEE80211_VERSION;
 	hw->name = DRV_NAME;
-	hw->host_gen_beacon = 1;
-	hw->host_gen_beacon_template = 0;
-	hw->device_hides_wep = 0;
-	hw->rx_includes_fcs = 0;
-	hw->host_broadcast_ps_buffering = 1;
-	hw->wep_include_iv = 1;
-	hw->data_nullfunc_ack = 1;
-	hw->no_tkip_wmm_hwaccel = 1;
 	hw->extra_tx_headroom = 0;
-	hw->device_strips_mic = 0;
-	hw->monitor_during_oper = 1;
-	hw->fraglist = 0;
+ 	hw->flags = IEEE80211_HW_HOST_GEN_BEACON |
+		    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
+		    IEEE80211_HW_WEP_INCLUDE_IV |
+		    IEEE80211_HW_DATA_NULLFUNC_ACK |
+		    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
+		    IEEE80211_HW_MONITOR_DURING_OPER;
 	hw->maxssi = RT2X00_RX_MAX_SSI;
 
 	/*
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +6 -11
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
===================================================================
@@ -2732,18 +2732,13 @@ static int rt2500pci_init_hw(struct rt2x
 	 */
 	hw->version = IEEE80211_VERSION;
 	hw->name = DRV_NAME;
-	hw->host_gen_beacon = 1;
-	hw->host_gen_beacon_template = 0;
-	hw->device_hides_wep = 0;
-	hw->rx_includes_fcs = 0;
-	hw->host_broadcast_ps_buffering = 1;
-	hw->wep_include_iv = 1;
-	hw->data_nullfunc_ack = 1;
-	hw->no_tkip_wmm_hwaccel = 1;
+	hw->flags = IEEE80211_HW_HOST_GEN_BEACON |
+		    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
+		    IEEE80211_HW_WEP_INCLUDE_IV |
+		    IEEE80211_HW_DATA_NULLFUNC_ACK |
+		    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
+		    IEEE80211_HW_MONITOR_DURING_OPER;
 	hw->extra_tx_headroom = 0;
-	hw->device_strips_mic = 0;
-	hw->monitor_during_oper = 1;
-	hw->fraglist = 0;
 	hw->maxssi = RT2X00_RX_MAX_SSI;
 
 	/*
drivers/net/wireless/d80211/rt2x00/rt61pci.c +6 -11
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt61pci.c
===================================================================
@@ -3252,18 +3252,13 @@ static int rt61pci_init_hw(struct rt2x00
 	 */
 	hw->version = IEEE80211_VERSION;
 	hw->name = DRV_NAME;
-	hw->host_gen_beacon = 1;
-	hw->host_gen_beacon_template = 0;
-	hw->device_hides_wep = 0;
-	hw->rx_includes_fcs = 0;
-	hw->host_broadcast_ps_buffering = 1;
-	hw->wep_include_iv = 1;
-	hw->data_nullfunc_ack = 1;
-	hw->no_tkip_wmm_hwaccel = 1;
+	hw->flags = IEEE80211_HW_HOST_GEN_BEACON |
+		    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
+		    IEEE80211_HW_WEP_INCLUDE_IV |
+		    IEEE80211_HW_DATA_NULLFUNC_ACK |
+		    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
+		    IEEE80211_HW_MONITOR_DURING_OPER;
 	hw->extra_tx_headroom = 0;
-	hw->device_strips_mic = 0;
-	hw->monitor_during_oper = 1;
-	hw->fraglist = 0;
 	hw->maxssi = RT2X00_RX_MAX_SSI;
 
 	/*
net/d80211/ieee80211.c +20 -16
Index: wireless-dev/net/d80211/ieee80211.c
===================================================================
@@ -515,7 +515,7 @@ static int wep_encrypt_skb(struct ieee80
 			return -1;
 	} else {
 		tx->u.tx.control->key_idx = tx->key->hw_key_idx;
-		if (tx->local->hw->wep_include_iv) {
+		if (tx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) {
 			if (ieee80211_wep_add_iv(tx->local, skb, tx->key) ==
 			    NULL)
 				return -1;
@@ -951,7 +951,7 @@ ieee80211_tx_h_multicast_ps_buf(struct i
 	/* broadcast/multicast frame */
 	/* If any of the associated stations is in power save mode,
 	 * the frame is buffered to be sent after DTIM beacon frame */
-	if (tx->local->hw->host_broadcast_ps_buffering &&
+	if ((tx->local->hw->flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING) &&
 	    tx->sdata->type != IEEE80211_IF_TYPE_WDS &&
 	    tx->sdata->bss && atomic_read(&tx->sdata->bss->num_sta_ps) &&
 	    !(tx->fc & IEEE80211_FCTL_ORDER)) {
@@ -1896,7 +1896,7 @@ int ieee80211_if_config_beacon(struct ne
 	struct ieee80211_local *local = dev->ieee80211_ptr;
 	struct sk_buff *skb;
 
-	if (!local->hw->host_gen_beacon_template)
+	if (!(local->hw->flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE))
 		return 0;
 	skb = ieee80211_beacon_get(local->mdev, dev->ifindex, NULL);
 	if (!skb)
@@ -2170,7 +2170,8 @@ static inline void ieee80211_start_soft_
 	struct ieee80211_if_init_conf conf;
 
 	if (local->open_count && local->open_count == local->monitors &&
-	    !local->hw->monitor_during_oper && local->hw->remove_interface) {
+	    !(local->hw->flags & IEEE80211_HW_MONITOR_DURING_OPER) &&
+	    local->hw->remove_interface) {
 		conf.if_id = -1;
 		conf.type = IEEE80211_IF_TYPE_MNTR;
 		conf.mac_addr = NULL;
@@ -2185,7 +2186,8 @@ static void ieee80211_start_hard_monitor
 	struct ieee80211_if_init_conf conf;
 
 	if (local->open_count && local->open_count == local->monitors &&
-	    !local->hw->monitor_during_oper && local->hw->add_interface) {
+	    !(local->hw->flags & IEEE80211_HW_MONITOR_DURING_OPER) &&
+	    local->hw->add_interface) {
 		conf.if_id = -1;
 		conf.type = IEEE80211_IF_TYPE_MNTR;
 		conf.mac_addr = NULL;
@@ -2216,7 +2218,7 @@ static int ieee80211_open(struct net_dev
 		return -ENOLINK;
 
 	if (sdata->type == IEEE80211_IF_TYPE_MNTR && local->open_count &&
-	    !local->hw->monitor_during_oper) {
+	    !(local->hw->flags & IEEE80211_HW_MONITOR_DURING_OPER)) {
 		/* run the interface in a "soft monitor" mode */
 		local->monitors++;
 		local->open_count++;
@@ -2280,7 +2282,8 @@ static int ieee80211_stop(struct net_dev
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
 	if (sdata->type == IEEE80211_IF_TYPE_MNTR &&
-	    local->open_count > 1 && !local->hw->monitor_during_oper) {
+	    local->open_count > 1 &&
+	    !(local->hw->flags & IEEE80211_HW_MONITOR_DURING_OPER)) {
 		/* remove "soft monitor" interface */
 		local->open_count--;
 		local->monitors--;
@@ -3035,7 +3038,8 @@ ieee80211_rx_h_check(struct ieee80211_tx
 			rx->sta->last_seq_ctrl[rx->u.rx.queue] = hdr->seq_ctrl;
 	}
 
-	if (rx->local->hw->rx_includes_fcs && rx->skb->len > FCS_LEN)
+	if ((rx->local->hw->flags & IEEE80211_HW_RX_INCLUDES_FCS) &&
+	    rx->skb->len > FCS_LEN)
 		skb_trim(rx->skb, rx->skb->len - FCS_LEN);
 
 	if (unlikely(rx->skb->len < 16)) {
@@ -3095,7 +3099,7 @@ ieee80211_rx_h_check(struct ieee80211_tx
 		else
 			rx->key = rx->sdata->default_key;
 
-		if (rx->local->hw->wep_include_iv &&
+		if ((rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) &&
 		    rx->fc & IEEE80211_FCTL_PROTECTED) {
 			int keyidx = ieee80211_wep_get_keyidx(rx->skb);
 
@@ -3206,7 +3210,7 @@ ieee80211_rx_h_wep_weak_iv_detection(str
 		return TXRX_CONTINUE;
 
 	/* Check for weak IVs, if hwaccel did not remove IV from the frame */
-	if (rx->local->hw->wep_include_iv ||
+	if ((rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) ||
 	    rx->key->force_sw_encrypt || rx->local->conf.sw_decrypt) {
 		u8 *iv = ieee80211_wep_is_weak_iv(rx->skb, rx->key);
 		if (iv) {
@@ -3222,7 +3226,7 @@ static ieee80211_txrx_result
 ieee80211_rx_h_wep_decrypt(struct ieee80211_txrx_data *rx)
 {
 	/* If the device handles decryption totally, skip this test */
-	if (rx->local->hw->device_hides_wep)
+	if (rx->local->hw->flags & IEEE80211_HW_DEVICE_HIDES_WEP)
 		return TXRX_CONTINUE;
 
 	if ((rx->key && rx->key->alg != ALG_WEP) ||
@@ -3245,7 +3249,7 @@ ieee80211_rx_h_wep_decrypt(struct ieee80
 			       "failed\n", rx->dev->name);
 			return TXRX_DROP;
 		}
-	} else if (rx->local->hw->wep_include_iv) {
+	} else if (rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) {
 		ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
 		/* remove ICV */
 		skb_trim(rx->skb, rx->skb->len - 4);
@@ -3290,7 +3294,7 @@ static ieee80211_txrx_result
 ieee80211_rx_h_drop_unencrypted(struct ieee80211_txrx_data *rx)
 {
 	/*  If the device handles decryption totally, skip this test */
-	if (rx->local->hw->device_hides_wep)
+	if (rx->local->hw->flags & IEEE80211_HW_DEVICE_HIDES_WEP)
 		return TXRX_CONTINUE;
 
 	/* Drop unencrypted frames if key is set. */
@@ -3359,7 +3363,7 @@ ieee80211_rx_h_passive_scan(struct ieee8
 			local->scan.rx_beacon++;
 			/* Need to trim FCS here because it is normally
 			 * removed only after this passive scan handler. */
-			if (rx->local->hw->rx_includes_fcs &&
+			if ((rx->local->hw->flags & IEEE80211_HW_RX_INCLUDES_FCS) &&
 			    rx->skb->len > FCS_LEN)
 				skb_trim(rx->skb, rx->skb->len - FCS_LEN);
 
@@ -3452,7 +3456,7 @@ static void ieee80211_rx_michael_mic_rep
 		goto ignore;
 	}
 
-	if (rx->local->hw->wep_include_iv &&
+	if ((rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) &&
 	    rx->sdata->type == IEEE80211_IF_TYPE_AP) {
 		int keyidx = ieee80211_wep_get_keyidx(rx->skb);
 		/* AP with Pairwise keys support should never receive Michael
@@ -4499,7 +4503,7 @@ int ieee80211_register_hw(struct net_dev
 	if (result < 0)
 		goto fail_sta_info;
 
-	if (hw->fraglist)
+	if (hw->flags & IEEE80211_HW_FRAGLIST)
 		dev->features |= NETIF_F_FRAGLIST;
 	rtnl_lock();
 	result = dev_alloc_name(dev, dev->name);
net/d80211/ieee80211_ioctl.c +6 -5
Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
@@ -126,7 +126,7 @@ static int ieee80211_ioctl_get_hw_featur
 	struct ieee80211_channel_data *chan;
 
 	param->u.hw_features.flags = 0;
-	if (local->hw->data_nullfunc_ack)
+	if (local->hw->flags & IEEE80211_HW_DATA_NULLFUNC_ACK)
 		param->u.hw_features.flags |= HOSTAP_HW_FLAG_NULLFUNC_OK;
 
 	param->u.hw_features.num_modes = local->hw->num_modes;
@@ -594,14 +594,15 @@ static int ieee80211_set_encryption(stru
 		try_hwaccel = 0;
 	}
 
-	if (local->hw->device_hides_wep) {
+	if (local->hw->flags & IEEE80211_HW_DEVICE_HIDES_WEP) {
 		/* Software encryption cannot be used with devices that hide
 		 * encryption from the host system, so always try to use
 		 * hardware acceleration with such devices. */
 		try_hwaccel = 1;
 	}
 
-	if (local->hw->no_tkip_wmm_hwaccel && alg == ALG_TKIP) {
+	if ((local->hw->flags & IEEE80211_HW_NO_TKIP_WMM_HWACCEL) &&
+	    alg == ALG_TKIP) {
 		if (sta && (sta->flags & WLAN_STA_WME)) {
 		/* Hardware does not support hwaccel with TKIP when using WMM.
 		 */
@@ -2297,7 +2298,7 @@ static void ieee80211_key_enable_hwaccel
 	u8 addr[ETH_ALEN];
 
 	if (!key || key->alg != ALG_WEP || !key->force_sw_encrypt ||
-	    local->hw->device_hides_wep)
+	    (local->hw->flags & IEEE80211_HW_DEVICE_HIDES_WEP))
 		return;
 
 	memset(addr, 0xff, ETH_ALEN);
@@ -2319,7 +2320,7 @@ static void ieee80211_key_disable_hwacce
 	u8 addr[ETH_ALEN];
 
 	if (!key || key->alg != ALG_WEP || key->force_sw_encrypt ||
-	    local->hw->device_hides_wep)
+	    (local->hw->flags & IEEE80211_HW_DEVICE_HIDES_WEP))
 		return;
 
 	memset(addr, 0xff, ETH_ALEN);
net/d80211/wpa.c +8 -7
Index: wireless-dev/net/d80211/wpa.c
===================================================================
@@ -168,8 +168,8 @@ ieee80211_rx_h_michael_mic_verify(struct
 	fc = rx->fc;
 
 	/* If device handles decryption totally, skip this check */
-	if (rx->local->hw->device_hides_wep ||
-	    rx->local->hw->device_strips_mic)
+	if ((rx->local->hw->flags & IEEE80211_HW_DEVICE_HIDES_WEP) ||
+	    (rx->local->hw->flags & IEEE80211_HW_DEVICE_STRIPS_MIC))
 		return TXRX_CONTINUE;
 
 	if (!rx->key || rx->key->alg != ALG_TKIP ||
@@ -184,7 +184,7 @@ ieee80211_rx_h_michael_mic_verify(struct
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
 	    !rx->key->force_sw_encrypt && !rx->local->conf.sw_decrypt) {
-		if (rx->local->hw->wep_include_iv) {
+		if (rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) {
 			if (skb->len < MICHAEL_MIC_LEN)
 				return TXRX_DROP;
 		}
@@ -400,7 +400,8 @@ ieee80211_tx_h_tkip_encrypt(struct ieee8
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
 	if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt &&
-	    !tx->local->hw->wep_include_iv && !wpa_test) {
+	    !(tx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) &&
+	    !wpa_test) {
 		/* hwaccel - with no need for preallocated room for IV/ICV */
 		tx->u.tx.control->key_idx = tx->key->hw_key_idx;
 		return TXRX_CONTINUE;
@@ -478,7 +479,7 @@ ieee80211_rx_h_tkip_decrypt(struct ieee8
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
 	    !rx->key->force_sw_encrypt && !rx->local->conf.sw_decrypt) {
-		if (!rx->local->hw->wep_include_iv) {
+		if (!(rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV)) {
 			/* Hardware takes care of all processing, including
 			 * replay protection, so no need to continue here. */
 			return TXRX_CONTINUE;
@@ -717,7 +718,7 @@ ieee80211_tx_h_ccmp_encrypt(struct ieee8
 	ieee80211_tx_set_iswep(tx);
 
 	if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt &&
-	    !tx->local->hw->wep_include_iv) {
+	    !(tx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV)) {
 		/* hwaccel - with no need for preallocated room for CCMP "
 		 * header or MIC fields */
 		tx->u.tx.control->key_idx = tx->key->hw_key_idx;
@@ -769,7 +770,7 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
 	    !key->force_sw_encrypt && !rx->local->conf.sw_decrypt &&
-	    !rx->local->hw->wep_include_iv)
+	    !(rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV))
 		return TXRX_CONTINUE;
 
 	(void) ccmp_hdr2pn(pn, skb->data + hdrlen);
net/d80211/ieee80211_sysfs.c +4 -3
Index: wireless-dev/net/d80211/ieee80211_sysfs.c
===================================================================
@@ -530,9 +530,10 @@ static ssize_t ieee80211_if_fmt_mode(con
 {
 	struct ieee80211_local *local = sdata->local;
 
-	return sprintf(buf, "%s\n", (local->hw->monitor_during_oper ||
-				     local->open_count == local->monitors) ?
-				    "hard" : "soft");
+	return sprintf(buf, "%s\n",
+		       ((local->hw->flags & IEEE80211_HW_MONITOR_DURING_OPER) ||
+			local->open_count == local->monitors) ?
+		       "hard" : "soft");
 }
 __IEEE80211_IF_SHOW(mode);
 
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +6 -10
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
===================================================================
@@ -2420,18 +2420,14 @@ static int rt2500usb_init_hw(struct rt2x
 	 */
 	hw->version = IEEE80211_VERSION;
 	hw->name = DRV_NAME;
-	hw->host_gen_beacon = 1;
+	hw->flags = IEEE80211_HW_HOST_GEN_BEACON |
+		    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
+		    IEEE80211_HW_WEP_INCLUDE_IV |
+		    IEEE80211_HW_DATA_NULLFUNC_ACK |
+		    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
+		    IEEE80211_HW_MONITOR_DURING_OPER;
 	hw->host_gen_beacon_template = 0;
-	hw->device_hides_wep = 0;
-	hw->rx_includes_fcs = 0;
-	hw->host_broadcast_ps_buffering = 1;
-	hw->wep_include_iv = 1;
-	hw->data_nullfunc_ack = 1;
-	hw->no_tkip_wmm_hwaccel = 1;
 	hw->extra_tx_headroom = 0;
-	hw->device_strips_mic = 0;
-	hw->monitor_during_oper = 1;
-	hw->fraglist = 0;
 	hw->maxssi = RT2X00_RX_MAX_SSI;
 
 	/*
drivers/net/wireless/d80211/rt2x00/rt73usb.c +6 -11
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt73usb.c
===================================================================
@@ -2793,18 +2793,13 @@ static int rt73usb_init_hw(struct rt2x00
 	 */
 	hw->version = IEEE80211_VERSION;
 	hw->name = DRV_NAME;
-	hw->host_gen_beacon = 1;
-	hw->host_gen_beacon_template = 0;
-	hw->device_hides_wep = 0;
-	hw->rx_includes_fcs = 0;
-	hw->host_broadcast_ps_buffering = 1;
-	hw->wep_include_iv = 1;
-	hw->data_nullfunc_ack = 1;
-	hw->no_tkip_wmm_hwaccel = 1;
+	hw->flags = IEEE80211_HW_HOST_GEN_BEACON |
+		    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
+		    IEEE80211_HW_WEP_INCLUDE_IV |
+		    IEEE80211_HW_DATA_NULLFUNC_ACK |
+		    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
+		    IEEE80211_HW_MONITOR_DURING_OPER;
 	hw->extra_tx_headroom = 0;
-	hw->device_strips_mic = 0;
-	hw->monitor_during_oper = 1;
-	hw->fraglist = 0;
 	hw->maxssi = RT2X00_RX_MAX_SSI;
 
 	/*
drivers/net/wireless/d80211/p54/prism54common.c +6 -11
Index: wireless-dev/drivers/net/wireless/d80211/p54/prism54common.c
===================================================================
@@ -633,17 +633,12 @@ void p54_init_common(struct net_device *
 	priv->modes[0].num_channels = ARRAY_SIZE(p54_channels);
 	priv->modes[0].channels = priv->channels;
 	hw->version = 2;
-	hw->host_gen_beacon = 0;
-	hw->host_gen_beacon_template = 1;
-	hw->device_hides_wep = 0;
-	hw->rx_includes_fcs = 1;
-	hw->host_broadcast_ps_buffering = 1; /* not sure */
-	hw->wep_include_iv = 1;
-	hw->data_nullfunc_ack = 1; /* TODO: check */
-	hw->no_tkip_wmm_hwaccel = 0;
-	hw->device_strips_mic = 0;
-	hw->monitor_during_oper = 0; /* FIXME: check */
-	hw->fraglist = 0;
+	hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
+		    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | /* not sure */
+		    IEEE80211_HW_RX_INCLUDES_FCS |
+		    IEEE80211_HW_WEP_INCLUDE_IV |
+		    IEEE80211_HW_DATA_NULLFUNC_ACK; /* TODO: check */
+		    /* IEEE80211_HW_MONITOR_DURING_OPER FIXME: check */
 	hw->channel_change_time = 1000;	/* TODO: find actual value */
 
 	hw->num_modes = 2;

--

#5 lore raw

PATCH 5/5 d80211: remove bitfields from ieee80211_conf

In reply to a message not in the archive

All four one-bit bitfields have been subsumed into the new 'flags' structure member and the new IEEE80211_CONF_* definitions.

include/net/d80211.h +6 -6
Index: wireless-dev/include/net/d80211.h
===================================================================
@@ -242,12 +242,12 @@ struct ieee80211_conf {
 
         int beacon_int;
 
-	/* Bitfields, grouped together */
-
-	unsigned int sw_encrypt:1;
-	unsigned int sw_decrypt:1;
-	unsigned int short_slot_time:1;	/* use IEEE 802.11g Short Slot Time */
-	unsigned int ssid_hidden:1;	/* do not broadcast the ssid */
+#define IEEE80211_CONF_SW_ENCRYPT	(1<<0)
+#define IEEE80211_CONF_SW_DECRYPT	(1<<1)
+#define IEEE80211_CONF_SHORT_SLOT_TIME	(1<<2) /* use IEEE 802.11g Short Slot
+						* Time */
+#define IEEE80211_CONF_SSID_HIDDEN	(1<<3) /* do not broadcast the ssid */
+	u32 flags;			/* configuration flags defined above */
 
         u8 power_level;			/* transmit power limit for current
 					 * regulatory domain; in dBm */
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +3 -3
Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
===================================================================
@@ -3562,9 +3562,9 @@ static int bcm43xx_net_config(struct net
 		bcm43xx_radio_selectchannel(bcm, conf->channel_val, 0);
 
 	/* Enable/Disable ShortSlot timing. */
-	if (conf->short_slot_time != bcm->short_slot) {
+	if (!!(conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME) != bcm->short_slot) {
 		assert(phy->type == BCM43xx_PHYTYPE_G);
-		if (conf->short_slot_time)
+		if (conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME)
 			bcm43xx_short_slot_timing_enable(bcm);
 		else
 			bcm43xx_short_slot_timing_disable(bcm);
@@ -3577,7 +3577,7 @@ static int bcm43xx_net_config(struct net
 	}
 
 	/* Hide/Show the SSID (AP mode only). */
-	if (conf->ssid_hidden) {
+	if (conf->flags & IEEE80211_CONF_SSID_HIDDEN) {
 		bcm43xx_write32(bcm->wlcore, BCM43xx_MMIO_STATUS_BITFIELD,
 				bcm43xx_read32(bcm->wlcore, BCM43xx_MMIO_STATUS_BITFIELD)
 				| BCM43xx_SBF_NO_SSID_BCAST);
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +4 -2
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
===================================================================
@@ -742,7 +742,8 @@ static void rt2400pci_config_rate(struct
 
 	rt2x00_register_read(rt2x00dev, TXCSR1, &reg[0]);
 	value = SIFS + PLCP
-		+ (2 * (conf->short_slot_time ? SHORT_SLOT_TIME : SLOT_TIME))
+		+ (2 * ((conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME) ?
+			SHORT_SLOT_TIME : SLOT_TIME))
 		+ preamble
 		+ get_duration(ACK_SIZE, 10);
 	rt2x00_set_field32(&reg[0], TXCSR1_ACK_TIMEOUT, value);
@@ -2088,7 +2089,8 @@ static int rt2400pci_config(struct net_d
 		conf->channel_val, conf->channel, conf->freq);
 	rt2400pci_config_txpower(rt2x00dev, conf->power_level);
 	rt2400pci_config_antenna(rt2x00dev, conf->antenna_sel);
-	rt2400pci_config_duration(rt2x00dev, conf->short_slot_time);
+	rt2400pci_config_duration(rt2x00dev,
+				  conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME);
 	rt2400pci_config_phymode(rt2x00dev, conf->phymode);
 
 	/*
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +4 -2
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
===================================================================
@@ -808,7 +808,8 @@ static void rt2500pci_config_rate(struct
 
 	rt2x00_register_read(rt2x00dev, TXCSR1, &reg[0]);
 	value = SIFS + PLCP
-		+ (2 * (conf->short_slot_time ? SHORT_SLOT_TIME : SLOT_TIME))
+		+ (2 * ((conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME) ?
+			SHORT_SLOT_TIME : SLOT_TIME))
 		+ preamble
 		+ get_duration(ACK_SIZE, 10);
 	rt2x00_set_field32(&reg[0], TXCSR1_ACK_TIMEOUT, value);
@@ -2238,7 +2239,8 @@ static int rt2500pci_config(struct net_d
 		conf->power_level);
 	rt2500pci_config_txpower(rt2x00dev, conf->power_level);
 	rt2500pci_config_antenna(rt2x00dev, conf->antenna_sel);
-	rt2500pci_config_duration(rt2x00dev, conf->short_slot_time);
+	rt2500pci_config_duration(rt2x00dev,
+				  conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME);
 	rt2500pci_config_phymode(rt2x00dev, conf->phymode);
 
 	/*
drivers/net/wireless/d80211/rt2x00/rt61pci.c +4 -2
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt61pci.c
===================================================================
@@ -1033,7 +1033,8 @@ static void rt61pci_config_rate(struct r
 
 	rt2x00_register_read(rt2x00dev, TXRX_CSR0, &reg);
 	value = SIFS + PLCP
-		+ (2 * (conf->short_slot_time ? SHORT_SLOT_TIME : SLOT_TIME))
+		+ (2 * ((conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME) ?
+			SHORT_SLOT_TIME : SLOT_TIME))
 		+ preamble
 		+ get_duration(ACK_SIZE, 10);
 	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, value);
@@ -2713,7 +2714,8 @@ static int rt61pci_config(struct net_dev
 		conf->power_level);
 	rt61pci_config_txpower(rt2x00dev, conf->power_level);
 	rt61pci_config_antenna(rt2x00dev, conf->antenna_sel, conf->phymode);
-	rt61pci_config_duration(rt2x00dev, conf->short_slot_time);
+	rt61pci_config_duration(rt2x00dev,
+				conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME);
 	rt61pci_config_phymode(rt2x00dev, conf->phymode);
 
 	/*
net/d80211/ieee80211.c +6 -3
Index: wireless-dev/net/d80211/ieee80211.c
===================================================================
@@ -510,7 +510,8 @@ ieee80211_tx_h_fragment(struct ieee80211
 
 static int wep_encrypt_skb(struct ieee80211_txrx_data *tx, struct sk_buff *skb)
 {
-	if (tx->key->force_sw_encrypt || tx->local->conf.sw_encrypt) {
+	if (tx->key->force_sw_encrypt ||
+	    (tx->local->conf.flags & IEEE80211_CONF_SW_ENCRYPT)) {
 		if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
 			return -1;
 	} else {
@@ -3211,7 +3212,8 @@ ieee80211_rx_h_wep_weak_iv_detection(str
 
 	/* Check for weak IVs, if hwaccel did not remove IV from the frame */
 	if ((rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) ||
-	    rx->key->force_sw_encrypt || rx->local->conf.sw_decrypt) {
+	    rx->key->force_sw_encrypt ||
+	    (rx->local->conf.flags & IEEE80211_CONF_SW_ENCRYPT)) {
 		u8 *iv = ieee80211_wep_is_weak_iv(rx->skb, rx->key);
 		if (iv) {
 			rx->sta->wep_weak_iv_count++;
@@ -3243,7 +3245,8 @@ ieee80211_rx_h_wep_decrypt(struct ieee80
 	}
 
 	if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED) ||
-	    rx->key->force_sw_encrypt || rx->local->conf.sw_decrypt) {
+	    rx->key->force_sw_encrypt ||
+	    (rx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
 		if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) {
 			printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
 			       "failed\n", rx->dev->name);
net/d80211/ieee80211_ioctl.c +11 -5
Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
@@ -492,7 +492,8 @@ int ieee80211_set_hw_encryption(struct n
 		key->force_sw_encrypt = 1;
 
 	if (key && local->hw->set_key &&
-	    (!local->conf.sw_encrypt || !local->conf.sw_decrypt) &&
+	    (!(local->conf.flags & IEEE80211_CONF_SW_ENCRYPT) ||
+	     !(local->conf.flags & IEEE80211_CONF_SW_DECRYPT)) &&
 	    (keyconf = ieee80211_key_data2conf(local, key)) != NULL) {
 		if (local->hw->set_key(dev, SET_KEY, addr,
 				       keyconf, sta ? sta->aid : 0)) {
@@ -2432,7 +2433,10 @@ static int ieee80211_ioctl_prism2_param(
                 local->stat_time = value;
                 break;
 	case PRISM2_PARAM_SHORT_SLOT_TIME:
-		local->conf.short_slot_time = value;
+		if (value)
+			local->conf.flags |= IEEE80211_CONF_SHORT_SLOT_TIME;
+		else
+			local->conf.flags &= ~IEEE80211_CONF_SHORT_SLOT_TIME;
 		if (ieee80211_hw_config(dev))
 			ret = -EINVAL;
 		break;
@@ -2479,8 +2483,10 @@ static int ieee80211_ioctl_prism2_param(
 	case PRISM2_PARAM_BROADCAST_SSID:
 		if ((value < 0) || (value > 1))
 			ret = -EINVAL;
+		else if (value)
+			local->conf.flags |= IEEE80211_CONF_SSID_HIDDEN;
 		else
-			local->conf.ssid_hidden = value;
+			local->conf.flags &= ~IEEE80211_CONF_SSID_HIDDEN;
 		break;
 
 	case PRISM2_PARAM_STA_ANTENNA_SEL:
@@ -2658,7 +2664,7 @@ static int ieee80211_ioctl_get_prism2_pa
                 *param = local->stat_time;
                 break;
 	case PRISM2_PARAM_SHORT_SLOT_TIME:
-		*param = local->conf.short_slot_time;
+		*param = !!(local->conf.flags & IEEE80211_CONF_SHORT_SLOT_TIME);
 		break;
 
 	case PRISM2_PARAM_NEXT_MODE:
@@ -2678,7 +2684,7 @@ static int ieee80211_ioctl_get_prism2_pa
 		break;
 
 	case PRISM2_PARAM_BROADCAST_SSID:
-		*param = local->conf.ssid_hidden;
+		*param = !!(local->conf.flags & IEEE80211_CONF_SSID_HIDDEN);
 		break;
 
 	case PRISM2_PARAM_STA_ANTENNA_SEL:
net/d80211/wpa.c +22 -11
Index: wireless-dev/net/d80211/wpa.c
===================================================================
@@ -103,7 +103,8 @@ ieee80211_tx_h_michael_mic_add(struct ie
 	}
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
-	if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt &&
+	if (!tx->key->force_sw_encrypt &&
+	    !(tx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT) &&
 	    !tx->fragmented && !wpa_test) {
 		/* hwaccel - with no need for preallocated room for Michael MIC
 		 */
@@ -183,7 +184,8 @@ ieee80211_rx_h_michael_mic_verify(struct
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
-	    !rx->key->force_sw_encrypt && !rx->local->conf.sw_decrypt) {
+	    !rx->key->force_sw_encrypt &&
+	    !(rx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
 		if (rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) {
 			if (skb->len < MICHAEL_MIC_LEN)
 				return TXRX_DROP;
@@ -290,7 +292,8 @@ static int tkip_encrypt_skb(struct ieee8
 	hdrlen = ieee80211_get_hdrlen(fc);
 	len = skb->len - hdrlen;
 
-	tailneed = (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt)
+	tailneed = (!tx->key->force_sw_encrypt &&
+		    !(tx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT))
 		? 0 : TKIP_ICV_LEN;
 	if ((skb_headroom(skb) < TKIP_IV_LEN ||
 	     skb_tailroom(skb) < tailneed)) {
@@ -323,7 +326,8 @@ iv_inc:
 skip_iv_inc:
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
-	if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt
+	if (!tx->key->force_sw_encrypt &&
+	    !(tx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT)
 #ifdef CONFIG_HOSTAPD_WPA_TESTING
 	    && !tx->wpa_test
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
@@ -399,7 +403,8 @@ ieee80211_tx_h_tkip_encrypt(struct ieee8
 	}
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
-	if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt &&
+	if (!tx->key->force_sw_encrypt &&
+	    !(tx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT) &&
 	    !(tx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV) &&
 	    !wpa_test) {
 		/* hwaccel - with no need for preallocated room for IV/ICV */
@@ -478,7 +483,8 @@ ieee80211_rx_h_tkip_decrypt(struct ieee8
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
-	    !rx->key->force_sw_encrypt && !rx->local->conf.sw_decrypt) {
+	    !rx->key->force_sw_encrypt &&
+	    !(rx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
 		if (!(rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV)) {
 			/* Hardware takes care of all processing, including
 			 * replay protection, so no need to continue here. */
@@ -622,7 +628,8 @@ static int ccmp_encrypt_skb(struct ieee8
 	hdrlen = ieee80211_get_hdrlen(fc);
 	len = skb->len - hdrlen;
 
-	tailneed = (!key->force_sw_encrypt && !tx->local->conf.sw_decrypt)
+	tailneed = (!key->force_sw_encrypt &&
+		    !(tx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT))
 		? 0 : CCMP_MIC_LEN;
 
 	if ((skb_headroom(skb) < CCMP_HDR_LEN ||
@@ -663,7 +670,8 @@ skip_pn_inc:
 
 	ccmp_pn2hdr(pos, pn, key->keyidx);
 
-	if (!key->force_sw_encrypt && !tx->local->conf.sw_decrypt) {
+	if (!key->force_sw_encrypt &&
+	    !(tx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
 		/* hwaccel - with preallocated room for CCMP header */
 		tx->u.tx.control->key_idx = key->hw_key_idx;
 		return 0;
@@ -717,7 +725,8 @@ ieee80211_tx_h_ccmp_encrypt(struct ieee8
 	tx->u.tx.control->iv_len = CCMP_HDR_LEN;
 	ieee80211_tx_set_iswep(tx);
 
-	if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt &&
+	if (!tx->key->force_sw_encrypt &&
+	    !(tx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT) &&
 	    !(tx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV)) {
 		/* hwaccel - with no need for preallocated room for CCMP "
 		 * header or MIC fields */
@@ -769,7 +778,8 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8
 		return TXRX_DROP;
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
-	    !key->force_sw_encrypt && !rx->local->conf.sw_decrypt &&
+	    !key->force_sw_encrypt &&
+	    !(rx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT) &&
 	    !(rx->local->hw->flags & IEEE80211_HW_WEP_INCLUDE_IV))
 		return TXRX_CONTINUE;
 
@@ -790,7 +800,8 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8
 	}
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
-	    !key->force_sw_encrypt && !rx->local->conf.sw_decrypt) {
+	    !key->force_sw_encrypt &&
+	    !(rx->local->conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
 		/* hwaccel has already decrypted frame and verified MIC */
 	} else {
 		u8 *scratch, *b_0, *aad;
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +4 -2
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
===================================================================
@@ -657,7 +657,8 @@ static void rt2500usb_config_rate(struct
 
 	rt2x00_register_read(rt2x00dev, TXRX_CSR1, &reg);
 	value = SIFS + PLCP
-		+ (2 * (conf->short_slot_time ? SHORT_SLOT_TIME : SLOT_TIME))
+		+ (2 * ((conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME) ?
+			SHORT_SLOT_TIME : SLOT_TIME))
 		+ preamble
 		+ get_duration(ACK_SIZE, 10);
 	rt2x00_set_field16_nb(&reg, TXRX_CSR1_ACK_TIMEOUT, value);
@@ -1971,7 +1972,8 @@ static int rt2500usb_config(struct net_d
 		conf->power_level);
 	rt2500usb_config_txpower(rt2x00dev, conf->power_level);
 	rt2500usb_config_antenna(rt2x00dev, conf->antenna_sel);
-	rt2500usb_config_duration(rt2x00dev, conf->short_slot_time);
+	rt2500usb_config_duration(rt2x00dev,
+				  conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME);
 	rt2500usb_config_phymode(rt2x00dev, conf->phymode);
 
 	/*
drivers/net/wireless/d80211/rt2x00/rt73usb.c +4 -2
Index: wireless-dev/drivers/net/wireless/d80211/rt2x00/rt73usb.c
===================================================================
@@ -771,7 +771,8 @@ static void rt73usb_config_rate(struct r
 
 	rt2x00_register_read(rt2x00dev, TXRX_CSR0, &reg);
 	value = SIFS + PLCP
-		+ (2 * (conf->short_slot_time ? SHORT_SLOT_TIME : SLOT_TIME))
+		+ (2 * ((conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME) ?
+			SHORT_SLOT_TIME : SLOT_TIME))
 		+ preamble
 		+ get_duration(ACK_SIZE, 10);
 	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, value);
@@ -2260,7 +2261,8 @@ static int rt73usb_config(struct net_dev
 		conf->power_level);
 	rt73usb_config_txpower(rt2x00dev, conf->power_level);
 	rt73usb_config_antenna(rt2x00dev, conf->antenna_sel, conf->phymode);
-	rt73usb_config_duration(rt2x00dev, conf->short_slot_time);
+	rt73usb_config_duration(rt2x00dev,
+				conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME);
 	rt73usb_config_phymode(rt2x00dev, conf->phymode);
 
 	/*

--