d80211: remove bitfields from ieee80211_tx_control
Subsystems (3)
PATCH 1/5 d80211: remove bitfields from ieee80211_tx_control
In reply to a message not in the archiveAll 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 +33 -28
@@ -143,23 +143,30 @@ struct ieee80211_tx_control {* specific value for the rate (from * struct ieee80211_rate) */ /* 1 = only first attempt, 2 = one retry, .. */ - unsigned int retry_limit:8; +u8 retry_limit;/* 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 */ +u16 rts_cts_duration; + +#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 */ +/* following three flags are only used with Atheros Super A/G */ unsigned int compress:1; unsigned int turbo_prime_notify:1; /* notify HostAPd after frame
@@ -168,18 +175,16 @@ struct ieee80211_tx_control { unsigned int atheros_xr:1; /* only used with Atheros XR */ - 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) */ +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
@@ -329,12 +329,12 @@ void ieee80211_init_scan(struct net_devimemset (&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 (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
@@ -2062,7 +2062,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
@@ -437,7 +437,8 @@ static void adm8211_interrupt_tci(structpci_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));
@@ -1859,7 +1860,7 @@ static int adm8211_tx(struct net_deviceif (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 +5 -4
@@ -280,7 +280,8 @@ void bcm43xx_generate_txhdr(struct bcm43 {const struct bcm43xx_phyinfo *phy =bcm43xx_current_phy (bcm);const struct ieee80211_hdr *wireless_header = (const struct ieee80211_hdr *)fragment_data; -const int use_encryption = (!txctl->do_not_encrypt && txctl->key_idx >=0 ); +const int use_encryption = (!(txctl->flags &IEEE80211_TXCTL_DO_NOT_ENCRYPT ) && + txctl->key_idx >=0 );u8 bitrate;u8 fallback_bitrate;int ofdm_modulation;
@@ -340,13 +341,13 @@ void bcm43xx_generate_txhdr(struct bcm43 & BCM43xx_TXHDRCTL_ANTENNADIV_MASK;/* Set the FLAGS field */ -if (!txctl->no_ack) +if (!(txctl->flags &IEEE80211_TXCTL_NO_ACK )) flags |= BCM43xx_TXHDRFLAG_EXPECTACK;if (1 /* FIXME: PS poll?? */ ) flags |=0x10 ;// FIXME: unknown meaning. 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 */
@@ -358,7 +359,7 @@ void bcm43xx_generate_txhdr(struct bcm43* 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);
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +4 -3
@@ -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 );
@@ -1907,7 +1908,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
@@ -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 );
@@ -2056,7 +2057,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
@@ -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 );
@@ -2532,7 +2533,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);
--
PATCH 2/5 d80211: remove bitfields from ieee80211_tx_status
In reply to a message not in the archiveBoth 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
@@ -222,8 +222,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
@@ -427,12 +427,14 @@ static void adm8211_interrupt_tci(structif (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 +4 -1
@@ -1079,7 +1079,10 @@ void bcm43xx_dma_handle_xmitstatus(struc* status of the transmission. * Some fields of txstat are already filled in dma_tx(). */ - meta->txstat.ack = !!(status->flags & BCM43xx_TXSTAT_FLAG_ACK); +if (status->flags & BCM43xx_TXSTAT_FLAG_ACK) + meta->txstat.flags |=IEEE80211_TX_STATUS_ACK ; +else + meta->txstat.flags &= ~IEEE80211_TX_STATUS_ACK ; meta->txstat.retry_count = status->cnt2 -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 +4 -1
@@ -477,7 +477,10 @@ void bcm43xx_pio_handle_xmitstatus(struc queue->tx_devq_packets--; queue->tx_devq_used -= (packet->skb->len +sizeof (struct bcm43xx_txhdr )); - packet->txstat.ack = !!(status->flags & BCM43xx_TXSTAT_FLAG_ACK); +if (status->flags & BCM43xx_TXSTAT_FLAG_ACK) + packet->txstat.flags |=IEEE80211_TX_STATUS_ACK ; +else + packet->txstat.flags &= ~IEEE80211_TX_STATUS_ACK ; packet->txstat.retry_count = status->cnt2 -1 ;ieee80211_tx_status_irqsafe (bcm->net_dev, packet->skb, &(packet->txstat));
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +4 -4
@@ -1741,10 +1741,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;
@@ -1756,11 +1757,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
@@ -1890,10 +1890,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;
@@ -1905,11 +1906,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
@@ -4043,13 +4043,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) {
@@ -4111,7 +4111,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))
@@ -4140,8 +4140,8 @@ void ieee80211_tx_status(struct net_devireturn ; } - 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
@@ -2326,10 +2326,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;
@@ -2341,11 +2342,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 ;
--
PATCH 3/5 d80211: remove bitfields from ieee80211_key_conf
In reply to a message not in the archiveAll 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 +2 -2
@@ -3634,8 +3634,8 @@ static int bcm43xx_net_set_key(struct neif (err) goto out_unlock; key->hw_key_idx = index; - key->force_sw_encrypt =0 ; -if (key->default_tx_key) + key->flags &= ~IEEE80211_KEY_FORCE_SW_ENCRYPT ; +if (key->flags &IEEE80211_KEY_DEFAULT_TX_KEY ) bcm->default_key_idx = index; bcm->key[index].enabled =1 ;break ;
include/net/d80211.h +13 -7
@@ -389,13 +389,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
@@ -74,10 +74,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
@@ -326,7 +326,7 @@ static int ieee80211_ioctl_add_sta(strucmemset (&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 ;
@@ -496,7 +496,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;
@@ -2289,7 +2289,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
@@ -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 ;
--
PATCH 4/5 d80211: remove bitfields from ieee80211_hw
In reply to a message not in the archiveAll 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 -11
@@ -2014,17 +2014,9 @@ 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_hdr_room =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 +16 -13
@@ -460,19 +460,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
@@ -480,18 +480,19 @@ 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)/* set if the payload needs to be padded at even boundaries after the * header */ - unsigned int extra_hdr_room:1; +#define IEEE80211_HW_EXTRA_HDR_ROOM (1<<8)/* Some devices handle Michael MIC internally and do not include MIC in * the received packets passed up. device_strips_mic must be set
@@ -499,15 +500,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<<9)/* 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<<10)/* 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<<11) + +u32 flags;/* hardware flags defined above */ /* This is the time in us to change channels */
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +4 -4
@@ -3910,9 +3910,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 =1 ; - ieee->monitor_during_oper =1 ; + ieee->flags =IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | +IEEE80211_HW_RX_INCLUDES_FCS | +IEEE80211_HW_MONITOR_DURING_OPER | +IEEE80211_HW_WEP_INCLUDE_IV ; ieee->tx = bcm43xx_net_hard_start_xmit; ieee->open = bcm43xx_net_open; ieee->stop = bcm43xx_net_stop;
@@ -3927,7 +3928,6 @@ static int __devinit bcm43xx_init_one(st 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 -12
@@ -2571,18 +2571,12 @@ 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_hdr_room =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 ;/* * We have 2 TX queues: TX and PRIO.
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +6 -12
@@ -2725,18 +2725,12 @@ 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->extra_hdr_room =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 ;/* * We have 2 TX queues: TX and PRIO.
drivers/net/wireless/d80211/rt2x00/rt61pci.c +6 -12
@@ -3245,18 +3245,12 @@ 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->extra_hdr_room =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 ;/* * We have full WMM capabilities.
net/d80211/ieee80211.c +22 -17
@@ -524,7 +524,7 @@ static int wep_encrypt_skb(struct ieee80return -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 ;
@@ -992,7 +992,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 )) {
@@ -1566,7 +1566,8 @@ static int ieee80211_subif_start_xmit(st* build in headroom in __dev_alloc_skb() (linux/skbuff.h) and * alloc_skb() (net/core/skbuff.c) */ - head_need = hdrlen + encaps_len + (local->hw->extra_hdr_room ?2 :0 ); + head_need = hdrlen + encaps_len + + (local->hw->flags &IEEE80211_HW_EXTRA_HDR_ROOM ?2 :0 ); head_need -=skb_headroom (skb);/* We are going to modify skb data, so make a copy of it if happens to
@@ -1936,7 +1937,7 @@ int ieee80211_if_config_beacon(struct nestruct 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)
@@ -2181,7 +2182,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 ;
@@ -2196,7 +2198,8 @@ static void ieee80211_start_hard_monitorstruct 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 ;
@@ -2227,7 +2230,7 @@ static int ieee80211_open(struct net_devreturn -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++;
@@ -2291,7 +2294,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--;
@@ -3045,7 +3049,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 )) {
@@ -3105,7 +3110,7 @@ ieee80211_rx_h_check(struct ieee80211_txelse 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);
@@ -3214,7 +3219,7 @@ ieee80211_rx_h_wep_weak_iv_detection(strreturn 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) {
@@ -3230,7 +3235,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) ||
@@ -3253,7 +3258,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 );
@@ -3298,7 +3303,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. */
@@ -3367,7 +3372,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 );
@@ -3460,7 +3465,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
@@ -4447,7 +4452,7 @@ int ieee80211_register_hw(struct net_devif (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
@@ -126,7 +126,7 @@ static int ieee80211_ioctl_get_hw_featurstruct 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;
@@ -589,14 +589,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. */
@@ -2282,7 +2283,7 @@ static void ieee80211_key_enable_hwaccelu8 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 );
@@ -2304,7 +2305,7 @@ static void ieee80211_key_disable_hwacceu8 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
@@ -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(structif ((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 ; }
@@ -399,7 +399,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 ;
@@ -477,7 +478,7 @@ ieee80211_rx_h_tkip_decrypt(struct ieee8if ((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 ;
@@ -715,7 +716,7 @@ ieee80211_tx_h_ccmp_encrypt(struct ieee8ieee80211_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;
@@ -767,7 +768,7 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8if ((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
@@ -515,9 +515,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);
--
PATCH 5/5 d80211: remove bitfields from ieee80211_conf
In reply to a message not in the archiveAll 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
@@ -254,12 +254,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
@@ -3531,9 +3531,9 @@ static int bcm43xx_net_config(struct netbcm43xx_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);
@@ -3546,7 +3546,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, BCM43xx_MMIO_STATUS_BITFIELD,bcm43xx_read32 (bcm, BCM43xx_MMIO_STATUS_BITFIELD) | BCM43xx_SBF_NO_SSID_BCAST);
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +4 -2
@@ -742,7 +742,8 @@ static void rt2400pci_config_rate(structrt2x00_register_read (rt2x00dev,TXCSR1 , ®[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 (®[0 ],TXCSR1_ACK_TIMEOUT , value);
@@ -2081,7 +2082,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
@@ -808,7 +808,8 @@ static void rt2500pci_config_rate(structrt2x00_register_read (rt2x00dev,TXCSR1 , ®[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 (®[0 ],TXCSR1_ACK_TIMEOUT , value);
@@ -2231,7 +2232,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
@@ -1033,7 +1033,8 @@ static void rt61pci_config_rate(struct rrt2x00_register_read (rt2x00dev,TXRX_CSR0 , ®); 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 (®,TXRX_CSR0_RX_ACK_TIMEOUT , value);
@@ -2706,7 +2707,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
@@ -519,7 +519,8 @@ ieee80211_tx_h_fragment(struct ieee80211static 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 {
@@ -3220,7 +3221,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++;
@@ -3252,7 +3254,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
@@ -487,7 +487,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 )) {
@@ -2436,7 +2437,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 ;
@@ -2483,8 +2487,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 :
@@ -2670,7 +2676,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 :
@@ -2690,7 +2696,7 @@ static int ieee80211_ioctl_get_prism2_pabreak ;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
@@ -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 */
@@ -398,7 +402,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 */
@@ -477,7 +482,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. */
@@ -620,7 +626,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 ||
@@ -661,7 +668,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 ;
@@ -715,7 +723,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 */
@@ -767,7 +776,8 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8return 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 ;
@@ -788,7 +798,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;
--
Quoted 3 lines · David Kimdon
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.
And, eh, did this increase or decrease the struct size? Does this generate better or worse code?
Signature · 1 line
Greetings Michael.
Removing the bitfields makes the code much harder to read and maintain. Here we are working around a problem with the compiler by making the code ugly - rather than fixing the compiler. The compilers are getting better and better (GCC 4 has much better handling of this type of optimization) but the code will remain ugly for ever.
Simon
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Michael Buesch
Sent: Monday, October 16, 2006 9:07 AM
To: David Kimdon
Cc: [email protected]; John W. Linville; Jiri Benc
Subject: Re: [patch 1/5] d80211: remove bitfields from ieee80211_tx_control
Quoted 3 lines · David Kimdon
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.
And, eh, did this increase or decrease the struct size? Does this generate better or worse code?
--
Greetings Michael.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Simon Barber
Removing the bitfields makes the code much harder to read and maintain. Here we are working around a problem with the compiler by making the code ugly - rather than fixing the compiler. The compilers are getting better and better (GCC 4 has much better handling of this type of optimization) but the code will remain ugly for ever.
Yeah, that's my opinion on this, too.
But I still like the unsigned int foo:16; => u16 foo; type of conversions.
Signature · 1 line
Greetings Michael.
Quoted 4 lines · Michael Buesch
Quoted 3 lines · David Kimdon
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.
I'll answer based on take1, which I just sent to the list.
Quoted 2 lines
And, eh, did this increase or decrease the struct size?
structure sizes did not change.
Quoted 1 line
Does this generate better or worse code?
It generates slightly smaller code with gcc 4.1.2.
-David
I am not particularily attached to bitfields or no bitfields. I am interested in getting d80211 merged. Bitfields have been discussed as an important TODO. Perhaps this can serve as a starting point for discussion of the tasks to complete before d80211 is merged?
Quoted 1 line · Simon Barber
Removing the bitfields makes the code much harder to read and maintain.
I agree that we end up with more characters in the file, the bitfield syntax is more concise. However, I don't find it 'much' harder to read or maintain, it is a matter of taste.
Quoted 4 lines
Here we are working around a problem with the compiler by making the code ugly - rather than fixing the compiler. The compilers are getting better and better (GCC 4 has much better handling of this type of optimization) but the code will remain ugly for ever.
Well at least as far as code size goes gcc 4.1.2 still produces slightly larger code with the bitfields.
-David