[PATCH 7/7] staging: rtl8192u: Fix line length and strings
Cristina Moraru
cristina.moraru09 at gmail.com
Mon Oct 12 08:46:11 EEST 2015
Fix lines over 80 characters, quoted strings splitting across lines
and indentation problems found with checkpatch
Signed-off-by: Cristina Moraru <cristina.moraru09 at gmail.com>
---
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 892 +++++++++++++---------
1 file changed, 527 insertions(+), 365 deletions(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 445dd5f..e889a64 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -47,7 +47,8 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct rtl_80211_hdr_4addr *hdr = (struct rtl_80211_hdr_4addr *)skb->data;
+ struct rtl_80211_hdr_4addr *hdr =
+ (struct rtl_80211_hdr_4addr *)skb->data;
u16 fc = le16_to_cpu(hdr->frame_ctl);
skb->dev = ieee->dev;
@@ -74,8 +75,7 @@ ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
if (entry->skb != NULL &&
time_after(jiffies, entry->first_frag_time + 2 * HZ)) {
IEEE80211_DEBUG_FRAG(
- "expiring fragment cache entry "
- "seq=%u last_frag=%u\n",
+ "expiring fragment cache entry seq=%u last_frag=%u\n",
entry->seq, entry->last_frag);
dev_kfree_skb_any(entry->skb);
entry->skb = NULL;
@@ -106,29 +106,35 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee,
struct rtl_80211_hdr_4addrqos *hdr_4addrqos;
u8 tid;
- if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) {
- hdr_4addrqos = (struct rtl_80211_hdr_4addrqos *)hdr;
- tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID;
- tid = UP2AC(tid);
- tid++;
+ if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) &&
+ IEEE80211_QOS_HAS_SEQ(fc)) {
+ hdr_4addrqos = (struct rtl_80211_hdr_4addrqos *)hdr;
+ tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID;
+ tid = UP2AC(tid);
+ tid++;
} else if (IEEE80211_QOS_HAS_SEQ(fc)) {
- hdr_3addrqos = (struct rtl_80211_hdr_3addrqos *)hdr;
- tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID;
- tid = UP2AC(tid);
- tid++;
+ hdr_3addrqos = (struct rtl_80211_hdr_3addrqos *)hdr;
+ tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID;
+ tid = UP2AC(tid);
+ tid++;
} else {
- tid = 0;
+ tid = 0;
}
if (frag == 0) {
/* Reserve enough space to fit maximum frame length */
skb = dev_alloc_skb(ieee->dev->mtu +
sizeof(struct rtl_80211_hdr_4addr) +
- 8 /* LLC */ +
- 2 /* alignment */ +
- 8 /* WEP */ +
- ETH_ALEN /* WDS */ +
- (IEEE80211_QOS_HAS_SEQ(fc)?2:0) /* QOS Control */);
+ /* LLC */
+ 8 +
+ /* alignment */
+ 2 +
+ /* WEP */
+ 8 +
+ /* WDS */
+ ETH_ALEN +
+ /* QOS Control */
+ (IEEE80211_QOS_HAS_SEQ(fc) ? 2 : 0));
if (skb == NULL)
return NULL;
@@ -150,8 +156,8 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee,
/* Received a fragment of a frame for which the head fragment
* should have already been received
*/
- entry = ieee80211_frag_cache_find(ieee, seq, frag, tid, hdr->addr2,
- hdr->addr1);
+ entry = ieee80211_frag_cache_find(ieee, seq, frag, tid,
+ hdr->addr2, hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
skb = entry->skb;
@@ -174,18 +180,19 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
struct rtl_80211_hdr_4addrqos *hdr_4addrqos;
u8 tid;
- if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) {
- hdr_4addrqos = (struct rtl_80211_hdr_4addrqos *)hdr;
- tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID;
- tid = UP2AC(tid);
- tid++;
+ if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) &&
+ IEEE80211_QOS_HAS_SEQ(fc)) {
+ hdr_4addrqos = (struct rtl_80211_hdr_4addrqos *)hdr;
+ tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID;
+ tid = UP2AC(tid);
+ tid++;
} else if (IEEE80211_QOS_HAS_SEQ(fc)) {
- hdr_3addrqos = (struct rtl_80211_hdr_3addrqos *)hdr;
- tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID;
- tid = UP2AC(tid);
- tid++;
+ hdr_3addrqos = (struct rtl_80211_hdr_3addrqos *)hdr;
+ tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID;
+ tid = UP2AC(tid);
+ tid++;
} else {
- tid = 0;
+ tid = 0;
}
entry = ieee80211_frag_cache_find(ieee, seq, -1, tid, hdr->addr2,
@@ -193,8 +200,8 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
if (entry == NULL) {
IEEE80211_DEBUG_FRAG(
- "could not invalidate fragment cache "
- "entry (seq=%u)\n", seq);
+ "could not invalidate fragment cache entry (seq=%u)\n",
+ seq);
return -1;
}
@@ -219,11 +226,15 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
* this is not mandatory.... but seems that the probe
* response parser uses it
*/
- struct rtl_80211_hdr_3addr *hdr = (struct rtl_80211_hdr_3addr *)skb->data;
+ struct rtl_80211_hdr_3addr *hdr =
+ (struct rtl_80211_hdr_3addr *)skb->data;
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee, (struct rtl_80211_hdr_4addr *)skb->data, rx_stats);
- if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN))) { /* use ADDR1 to perform address matching for Management frames */
+ ieee80211_rx_mgt(ieee,
+ (struct rtl_80211_hdr_4addr *)skb->data,
+ rx_stats);
+ /* Use ADDR1 to perform address matching for Management frames */
+ if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN))) {
dev_kfree_skb_any(skb);
return 0;
}
@@ -253,7 +264,9 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
hostap_rx(skb2->dev, skb2, rx_stats);
}
- /* Send management frames to the user space daemon for processing */
+ /* Send management frames to the user space daemon
+ * for processing
+ */
ieee->apdevstats.rx_packets++;
ieee->apdevstats.rx_bytes += skb->len;
prism2_rx_80211(ieee->apdev, skb, rx_stats, PRISM2_RX_MGMT);
@@ -262,9 +275,9 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
if (ieee->iw_mode == IW_MODE_MASTER) {
if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) {
- printk(KERN_DEBUG "%s: unknown management frame "
- "(type=0x%02x, stype=0x%02x) dropped\n",
- skb->dev->name, type, stype);
+ printk(KERN_DEBUG
+ "%s: unknown management frame (type=0x%02x, stype=0x%02x) dropped\n",
+ skb->dev->name, type, stype);
return -1;
}
@@ -272,8 +285,9 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
return 0;
}
- printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: management frame "
- "received in non-Host AP mode\n", skb->dev->name);
+ printk(KERN_DEBUG
+ "%s: hostap_rx_frame_mgmt: management frame received in non-Host AP mode\n",
+ skb->dev->name);
return -1;
#endif
}
@@ -282,11 +296,11 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
-static unsigned char rfc1042_header[] =
-{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
+static unsigned char rfc1042_header[] = { 0xaa, 0xaa, 0x03,
+ 0x00, 0x00, 0x00 };
/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
-static unsigned char bridge_tunnel_header[] =
-{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
+static unsigned char bridge_tunnel_header[] = { 0xaa, 0xaa, 0x03,
+ 0x00, 0x00, 0xf8 };
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
@@ -350,9 +364,9 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
if (ieee->tkip_countermeasures &&
strcmp(crypt->ops->name, "TKIP") == 0) {
if (net_ratelimit()) {
- printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
- "received packet from %pM\n",
- ieee->dev->name, hdr->addr2);
+ printk(KERN_DEBUG
+ "%s: TKIP countermeasures: dropped received packet from %pM\n",
+ ieee->dev->name, hdr->addr2);
}
return -1;
}
@@ -362,12 +376,12 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
atomic_dec(&crypt->refcnt);
if (res < 0) {
IEEE80211_DEBUG_DROP(
- "decryption failed (SA=%pM"
- ") res=%d\n", hdr->addr2, res);
+ "decryption failed (SA=%pM) res=%d\n",
+ hdr->addr2, res);
if (res == -2)
- IEEE80211_DEBUG_DROP("Decryption failed ICV "
- "mismatch (key %d)\n",
- skb->data[hdrlen + 3] >> 6);
+ IEEE80211_DEBUG_DROP(
+ "Decryption failed ICV mismatch (key %d)\n",
+ skb->data[hdrlen + 3] >> 6);
ieee->ieee_stats.rx_discards_undecryptable++;
return -1;
}
@@ -378,8 +392,9 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *skb,
- int keyidx, struct ieee80211_crypt_data *crypt)
+ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee,
+ struct sk_buff *skb, int keyidx,
+ struct ieee80211_crypt_data *crypt)
{
struct rtl_80211_hdr_4addr *hdr;
int res, hdrlen;
@@ -399,8 +414,8 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *s
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
atomic_dec(&crypt->refcnt);
if (res < 0) {
- printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
- " (SA=%pM keyidx=%d)\n",
+ printk(KERN_DEBUG
+ "%s: MSDU decryption/MIC verification failed (SA=%pM keyidx=%d)\n",
ieee->dev->name, hdr->addr2, keyidx);
return -1;
}
@@ -412,7 +427,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *s
/* This function is stolen from ipw2200 driver */
#define IEEE_PACKET_RETRY_TIME (5*HZ)
static int is_duplicate_packet(struct ieee80211_device *ieee,
- struct rtl_80211_hdr_4addr *header)
+ struct rtl_80211_hdr_4addr *header)
{
u16 fc = le16_to_cpu(header->frame_ctl);
u16 sc = le16_to_cpu(header->seq_ctl);
@@ -426,18 +441,19 @@ static int is_duplicate_packet(struct ieee80211_device *ieee,
/* TO2DS and QoS */
- if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) {
- hdr_4addrqos = (struct rtl_80211_hdr_4addrqos *)header;
- tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID;
- tid = UP2AC(tid);
- tid++;
+ if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) &&
+ IEEE80211_QOS_HAS_SEQ(fc)) {
+ hdr_4addrqos = (struct rtl_80211_hdr_4addrqos *)header;
+ tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID;
+ tid = UP2AC(tid);
+ tid++;
} else if (IEEE80211_QOS_HAS_SEQ(fc)) { /* QoS */
- hdr_3addrqos = (struct rtl_80211_hdr_3addrqos *)header;
- tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID;
- tid = UP2AC(tid);
- tid++;
+ hdr_3addrqos = (struct rtl_80211_hdr_3addrqos *)header;
+ tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID;
+ tid = UP2AC(tid);
+ tid++;
} else { /* no QoS */
- tid = 0;
+ tid = 0;
}
switch (ieee->iw_mode) {
@@ -454,9 +470,11 @@ static int is_duplicate_packet(struct ieee80211_device *ieee,
break;
}
if (p == &ieee->ibss_mac_hash[index]) {
- entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC);
+ entry = kmalloc(sizeof(struct ieee_ibss_seq),
+ GFP_ATOMIC);
if (!entry) {
- printk(KERN_WARNING "Cannot malloc new mac entry\n");
+ printk(KERN_WARNING
+ "Cannot malloc new mac entry\n");
return 0;
}
memcpy(entry->mac, mac, ETH_ALEN);
@@ -484,10 +502,9 @@ static int is_duplicate_packet(struct ieee80211_device *ieee,
if ((*last_seq == seq) &&
time_after(*last_time + IEEE_PACKET_RETRY_TIME, jiffies)) {
- if (*last_frag == frag) {
+ if (*last_frag == frag)
goto drop;
- }
if (*last_frag + 1 != frag)
/* Out-of-order fragment */
goto drop;
@@ -507,9 +524,13 @@ static bool AddReorderEntry(PRX_TS_RECORD pTS, PRX_REORDER_ENTRY pReorderEntry)
struct list_head *pList = &pTS->RxPendingPktList;
while (pList->next != &pTS->RxPendingPktList) {
- if (SN_LESS(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next, RX_REORDER_ENTRY, List))->SeqNum))
+ if (SN_LESS(pReorderEntry->SeqNum,
+ ((PRX_REORDER_ENTRY)list_entry(pList->next,
+ RX_REORDER_ENTRY, List))->SeqNum))
pList = pList->next;
- else if (SN_EQUAL(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next, RX_REORDER_ENTRY, List))->SeqNum))
+ else if (SN_EQUAL(pReorderEntry->SeqNum,
+ ((PRX_REORDER_ENTRY)list_entry(pList->next,
+ RX_REORDER_ENTRY, List))->SeqNum))
return false;
else
break;
@@ -522,10 +543,13 @@ static bool AddReorderEntry(PRX_TS_RECORD pTS, PRX_REORDER_ENTRY pReorderEntry)
return true;
}
-void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_rxb **prxbIndicateArray, u8 index)
+void ieee80211_indicate_packets(struct ieee80211_device *ieee,
+ struct ieee80211_rxb **prxbIndicateArray,
+ u8 index)
{
u8 i = 0, j = 0;
u16 ethertype;
+
for (j = 0; j < index; j++) {
/* Added by amy for reorder */
struct ieee80211_rxb *prxb = prxbIndicateArray[j];
@@ -533,33 +557,46 @@ void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_
for (i = 0; i < prxb->nr_subframes; i++) {
struct sk_buff *sub_skb = prxb->subframes[i];
- /* Convert hdr + possible LLC headers into Ethernet header */
+ /* Convert hdr + possible LLC headers
+ * into Ethernet header
+ */
ethertype = (sub_skb->data[6] << 8) | sub_skb->data[7];
if (sub_skb->len >= 8 &&
- ((memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) == 0 &&
- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
- memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) {
- /* Remove RFC1042 or Bridge-Tunnel encapsulation and
- * replace EtherType
- */
+ ((memcmp(sub_skb->data,
+ rfc1042_header, SNAP_SIZE) == 0 &&
+ ethertype != ETH_P_AARP &&
+ ethertype != ETH_P_IPX) ||
+ memcmp(sub_skb->data,
+ bridge_tunnel_header, SNAP_SIZE) == 0)) {
+ /* Remove RFC1042 or Bridge-Tunnel
+ * encapsulation and replace EtherType
+ */
skb_pull(sub_skb, SNAP_SIZE);
- memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
- memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
+ memcpy(skb_push(sub_skb, ETH_ALEN),
+ prxb->src, ETH_ALEN);
+ memcpy(skb_push(sub_skb, ETH_ALEN),
+ prxb->dst, ETH_ALEN);
} else {
u16 len;
- /* Leave Ethernet header part of hdr and full payload */
+ /* Leave Ethernet header part of hdr
+ * and full payload
+ */
len = htons(sub_skb->len);
memcpy(skb_push(sub_skb, 2), &len, 2);
- memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
- memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
+ memcpy(skb_push(sub_skb, ETH_ALEN),
+ prxb->src, ETH_ALEN);
+ memcpy(skb_push(sub_skb, ETH_ALEN),
+ prxb->dst, ETH_ALEN);
}
/* Indicate the packets to upper layer */
if (sub_skb) {
- sub_skb->protocol = eth_type_trans(sub_skb, ieee->dev);
+ sub_skb->protocol = eth_type_trans(sub_skb,
+ ieee->dev);
memset(sub_skb->cb, 0, sizeof(sub_skb->cb));
sub_skb->dev = ieee->dev;
- sub_skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */
+ /* 802.11 crc not sufficient */
+ sub_skb->ip_summed = CHECKSUM_NONE;
ieee->last_rx_ps_time = jiffies;
netif_rx(sub_skb);
}
@@ -576,20 +613,24 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
{
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
PRX_REORDER_ENTRY pReorderEntry = NULL;
- struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
+ struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
u8 WinSize = pHTInfo->RxReorderWinSize;
- u16 WinEnd = (pTS->RxIndicateSeq + WinSize - 1)%4096;
+ u16 WinEnd =
+ (pTS->RxIndicateSeq + WinSize - 1) % 4096;
u8 index = 0;
bool bMatchWinStart = false, bPktInBuf = false;
- IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): Seq is %d, pTS->RxIndicateSeq is %d, WinSize is %d\n", __func__, SeqNum, pTS->RxIndicateSeq, WinSize);
+ IEEE80211_DEBUG(IEEE80211_DL_REORDER,
+ "%s(): Seq is %d, pTS->RxIndicateSeq is %d, WinSize is %d\n",
+ __func__, SeqNum, pTS->RxIndicateSeq, WinSize);
/* Rx Reorder initialize condition.*/
if (pTS->RxIndicateSeq == 0xffff)
pTS->RxIndicateSeq = SeqNum;
/* Drop out the packet which SeqNum is smaller than WinStart */
if (SN_LESS(SeqNum, pTS->RxIndicateSeq)) {
- IEEE80211_DEBUG(IEEE80211_DL_REORDER, "Packet Drop! IndicateSeq: %d, NewSeq: %d\n",
+ IEEE80211_DEBUG(IEEE80211_DL_REORDER,
+ "Packet Drop! IndicateSeq: %d, NewSeq: %d\n",
pTS->RxIndicateSeq, SeqNum);
pHTInfo->RxReorderDropCounter++;
{
@@ -615,39 +656,53 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
if (SeqNum >= (WinSize - 1))
pTS->RxIndicateSeq = SeqNum + 1 - WinSize;
else
- pTS->RxIndicateSeq = 4095 - (WinSize - (SeqNum + 1)) + 1;
- IEEE80211_DEBUG(IEEE80211_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum);
+ pTS->RxIndicateSeq = 4095 -
+ (WinSize - (SeqNum + 1)) + 1;
+ IEEE80211_DEBUG(IEEE80211_DL_REORDER,
+ "Window Shift! IndicateSeq: %d, NewSeq: %d\n",
+ pTS->RxIndicateSeq, SeqNum);
}
/*
* Indication process.
- * After Packet dropping and Sliding Window shifting as above, we can now just indicate the packets
- * with the SeqNum smaller than latest WinStart and buffer other packets.
+ * After Packet dropping and Sliding Window shifting as above,
+ * we can now just indicate the packets with the SeqNum smaller
+ * than latest WinStart and buffer other packets.
*/
/* For Rx Reorder condition:
* 1. All packets with SeqNum smaller than WinStart => Indicate
- * 2. All packets with SeqNum larger than or equal to WinStart => Buffer it.
+ * 2. All packets with SeqNum larger than
+ * or equal to WinStart => Buffer it.
*/
if (bMatchWinStart) {
/* Current packet is going to be indicated.*/
- IEEE80211_DEBUG(IEEE80211_DL_REORDER, "Packets indication!! IndicateSeq: %d, NewSeq: %d\n",\
+ IEEE80211_DEBUG(IEEE80211_DL_REORDER,
+ "Packets indication!! IndicateSeq: %d, NewSeq: %d\n",
pTS->RxIndicateSeq, SeqNum);
prxbIndicateArray[0] = prxb;
index = 1;
} else {
/* Current packet is going to be inserted into pending list.*/
if (!list_empty(&ieee->RxReorder_Unused_List)) {
- pReorderEntry = (PRX_REORDER_ENTRY)list_entry(ieee->RxReorder_Unused_List.next, RX_REORDER_ENTRY, List);
+ pReorderEntry =
+ (PRX_REORDER_ENTRY)list_entry(
+ ieee->RxReorder_Unused_List.next,
+ RX_REORDER_ENTRY,
+ List);
list_del_init(&pReorderEntry->List);
- /* Make a reorder entry and insert into a the packet list.*/
+ /* Make a reorder entry and insert
+ * into a the packet list.
+ */
pReorderEntry->SeqNum = SeqNum;
pReorderEntry->prxb = prxb;
if (!AddReorderEntry(pTS, pReorderEntry)) {
- IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n",
+ IEEE80211_DEBUG(IEEE80211_DL_REORDER,
+ "%s(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n",
__func__, pTS->RxIndicateSeq, SeqNum);
- list_add_tail(&pReorderEntry->List, &ieee->RxReorder_Unused_List);
+ list_add_tail(&pReorderEntry->List,
+ &ieee->RxReorder_Unused_List);
{
int i;
@@ -658,15 +713,19 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
}
} else {
IEEE80211_DEBUG(IEEE80211_DL_REORDER,
- "Pkt insert into buffer!! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum);
+ "Pkt insert into buffer!! IndicateSeq: %d, NewSeq: %d\n",
+ pTS->RxIndicateSeq, SeqNum);
}
} else {
/*
- * Packets are dropped if there is not enough reorder entries.
- * This part shall be modified!! We can just indicate all the
- * packets in buffer and get reorder entries.
+ * Packets are dropped if there is not enough
+ * reorder entries.
+ * This part shall be modified!!
+ * We can just indicate all the packets in buffer
+ * and get reorder entries.
*/
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): There is no reorder entry!! Packet is dropped!!\n");
+ IEEE80211_DEBUG(IEEE80211_DL_ERR,
+ "RxReorderIndicatePacket(): There is no reorder entry!! Packet is dropped!!\n");
{
int i;
@@ -680,13 +739,17 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
/* Check if there is any packet need indicate.*/
while (!list_empty(&pTS->RxPendingPktList)) {
- IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): start RREORDER indicate\n", __func__);
- pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pTS->RxPendingPktList.prev, RX_REORDER_ENTRY, List);
+ IEEE80211_DEBUG(IEEE80211_DL_REORDER,
+ "%s(): start RREORDER indicate\n", __func__);
+ pReorderEntry = (PRX_REORDER_ENTRY)list_entry(
+ pTS->RxPendingPktList.prev,
+ RX_REORDER_ENTRY, List);
if (SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) ||
SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) {
/* This protect buffer from overflow. */
if (index >= REORDER_WIN_SIZE) {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Buffer overflow!!\n");
+ IEEE80211_DEBUG(IEEE80211_DL_ERR,
+ "RxReorderIndicatePacket(): Buffer overflow!!\n");
bPktInBuf = true;
break;
}
@@ -694,27 +757,34 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
list_del_init(&pReorderEntry->List);
if (SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq))
- pTS->RxIndicateSeq = (pTS->RxIndicateSeq + 1) % 4096;
+ pTS->RxIndicateSeq =
+ (pTS->RxIndicateSeq + 1) % 4096;
- IEEE80211_DEBUG(IEEE80211_DL_REORDER, "Packets indication!! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum);
+ IEEE80211_DEBUG(IEEE80211_DL_REORDER,
+ "Packets indication!! IndicateSeq: %d, NewSeq: %d\n",
+ pTS->RxIndicateSeq, SeqNum);
prxbIndicateArray[index] = pReorderEntry->prxb;
index++;
- list_add_tail(&pReorderEntry->List, &ieee->RxReorder_Unused_List);
+ list_add_tail(&pReorderEntry->List,
+ &ieee->RxReorder_Unused_List);
} else {
bPktInBuf = true;
break;
}
}
- /* Handling pending timer. Set this timer to prevent from long time Rx buffering.*/
+ /* Handling pending timer.
+ * Set this timer to prevent from long time Rx buffering.
+ */
if (index > 0) {
/* Cancel previous pending timer. */
pTS->RxTimeoutIndicateSeq = 0xffff;
/* Indicate packets */
if (index > REORDER_WIN_SIZE) {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorer buffer full!!\n");
+ IEEE80211_DEBUG(IEEE80211_DL_ERR,
+ "RxReorderIndicatePacket(): Rx Reorer buffer full!!\n");
return;
}
ieee80211_indicate_packets(ieee, prxbIndicateArray, index);
@@ -722,11 +792,13 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
if (bPktInBuf && pTS->RxTimeoutIndicateSeq == 0xffff) {
/* Set new pending timer. */
- IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): SET rx timeout timer\n", __func__);
+ IEEE80211_DEBUG(IEEE80211_DL_REORDER,
+ "%s(): SET rx timeout timer\n", __func__);
pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq;
if (timer_pending(&pTS->RxPktPendingTimer))
del_timer_sync(&pTS->RxPktPendingTimer);
- pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime);
+ pTS->RxPktPendingTimer.expires =
+ jiffies + MSECS(pHTInfo->RxReorderPendingTime);
add_timer(&pTS->RxPktPendingTimer);
}
}
@@ -735,7 +807,8 @@ static u8 parse_subframe(struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats,
struct ieee80211_rxb *rxb, u8 *src, u8 *dst)
{
- struct rtl_80211_hdr_3addr *hdr = (struct rtl_80211_hdr_3addr *)skb->data;
+ struct rtl_80211_hdr_3addr *hdr =
+ (struct rtl_80211_hdr_3addr *)skb->data;
u16 fc = le16_to_cpu(hdr->frame_ctl);
u16 LLCOffset = sizeof(struct rtl_80211_hdr_3addr);
@@ -750,10 +823,9 @@ static u8 parse_subframe(struct sk_buff *skb,
/* just for debug purpose */
SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl));
- if ((IEEE80211_QOS_HAS_SEQ(fc)) && \
- (((frameqos *)(skb->data + IEEE80211_3ADDR_LEN))->field.reserved)) {
+ if ((IEEE80211_QOS_HAS_SEQ(fc)) &&
+ (((frameqos *)(skb->data + IEEE80211_3ADDR_LEN))->field.reserved))
bIsAggregateFrame = true;
- }
if (IEEE80211_QOS_HAS_SEQ(fc))
LLCOffset += 2;
@@ -787,13 +859,17 @@ static u8 parse_subframe(struct sk_buff *skb,
/* Offset 12 denote 2 mac address */
nSubframe_Length = *((u16 *)(skb->data + 12));
/* ==m==>change the length order */
- nSubframe_Length = (nSubframe_Length>>8) + (nSubframe_Length<<8);
+ nSubframe_Length = (nSubframe_Length >> 8) +
+ (nSubframe_Length << 8);
- if (skb->len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) {
- printk("%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\
+ if (skb->len <
+ (ETHERNET_HEADER_SIZE + nSubframe_Length)) {
+ printk("%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",
__func__, rxb->nr_subframes);
- printk("%s: A-MSDU parse error!! Subframe Length: %d\n", __func__, nSubframe_Length);
- printk("nRemain_Length is %d and nSubframe_Length is : %d\n", skb->len, nSubframe_Length);
+ printk("%s: A-MSDU parse error!! Subframe Length: %d\n",
+ __func__, nSubframe_Length);
+ printk("nRemain_Length is %d and nSubframe_Length is : %d\n",
+ skb->len, nSubframe_Length);
printk("The Packet SeqNum is %d\n", SeqNum);
return 0;
}
@@ -822,7 +898,8 @@ static u8 parse_subframe(struct sk_buff *skb,
skb_pull(skb, nSubframe_Length);
if (skb->len != 0) {
- nPadding_Length = 4 - ((nSubframe_Length + ETHERNET_HEADER_SIZE) % 4);
+ nPadding_Length = 4 - ((nSubframe_Length +
+ ETHERNET_HEADER_SIZE) % 4);
if (nPadding_Length == 4)
nPadding_Length = 0;
@@ -945,8 +1022,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
*/
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
- &sta);
+ (void) hostap_handle_sta_crypto(local, hdr,
+ &crypt, &sta);
#endif
/* Allow NULL decrypt to indicate an station specific override
@@ -962,8 +1039,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
* frames silently instead of filling system log with
* these reports.
*/
- IEEE80211_DEBUG_DROP("Decryption failed (not set)"
- " (SA=%pM)\n",
+ IEEE80211_DEBUG_DROP("Decryption failed (not set) (SA=%pM)\n",
hdr->addr2);
ieee->ieee_stats.rx_discards_undecryptable++;
goto rx_dropped;
@@ -974,19 +1050,19 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
goto rx_dropped;
/* If QoS enabled, should check the sequence for each of the AC */
- if ((!ieee->pHTInfo->bCurRxReorderEnable) || !ieee->current_network.qos_data.active || !IsDataFrame(skb->data) || IsLegacyDataFrame(skb->data)) {
+ if ((!ieee->pHTInfo->bCurRxReorderEnable) ||
+ !ieee->current_network.qos_data.active ||
+ !IsDataFrame(skb->data) ||
+ IsLegacyDataFrame(skb->data)) {
if (is_duplicate_packet(ieee, hdr))
- goto rx_dropped;
+ goto rx_dropped;
} else {
PRX_TS_RECORD pRxTS = NULL;
- if (GetTs(
- ieee,
- (PTS_COMMON_INFO *) &pRxTS,
- hdr->addr2,
- (u8)Frame_QoSTID((u8 *)(skb->data)),
- RX_DIR,
- true)) {
+
+ if (GetTs(ieee, (PTS_COMMON_INFO *) &pRxTS,
+ hdr->addr2, (u8)Frame_QoSTID((u8 *)(skb->data)),
+ RX_DIR, true)) {
if ((fc & (1<<11)) &&
(frag == pRxTS->RxLastFragNum) &&
@@ -997,7 +1073,9 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
pRxTS->RxLastSeqNum = WLAN_GET_SEQ_SEQ(sc);
}
} else {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s(): No TS!! Skip the check!!\n", __func__);
+ IEEE80211_DEBUG(IEEE80211_DL_ERR,
+ "%s(): No TS!! Skip the check!!\n",
+ __func__);
goto rx_dropped;
}
}
@@ -1043,7 +1121,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
}
if (ieee->iw_mode == IW_MODE_MASTER && !wds &&
- (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS &&
+ (fc & (IEEE80211_FCTL_TODS |
+ IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS &&
ieee->stadev &&
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
@@ -1085,9 +1164,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
stype != IEEE80211_STYPE_QOS_DATA) {
if (stype != IEEE80211_STYPE_NULLFUNC)
IEEE80211_DEBUG_DROP(
- "RX: dropped data frame "
- "with no data (type=0x%02x, "
- "subtype=0x%02x, len=%d)\n",
+ "RX: dropped data frame with no data (type=0x%02x, subtype=0x%02x, len=%d)\n",
type, stype, skb->len);
goto rx_dropped;
}
@@ -1111,8 +1188,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
if (!frag_skb) {
IEEE80211_DEBUG(IEEE80211_DL_RX | IEEE80211_DL_FRAG,
- "Rx cannot get skb from fragment "
- "cache (morefrag=%d seq=%u frag=%u)\n",
+ "Rx cannot get skb from fragment cache (morefrag=%d seq=%u frag=%u)\n",
(fc & IEEE80211_FCTL_MOREFRAGS) != 0,
WLAN_GET_SEQ_SEQ(sc), frag);
goto rx_dropped;
@@ -1122,9 +1198,9 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
flen -= hdrlen;
if (frag_skb->tail + flen > frag_skb->end) {
- printk(KERN_WARNING "%s: host decrypted and "
- "reassembled frame did not fit skb\n",
- dev->name);
+ printk(KERN_WARNING
+ "%s: host decrypted and reassembled frame did not fit skb\n",
+ dev->name);
ieee80211_frag_cache_invalidate(ieee, hdr);
goto rx_dropped;
}
@@ -1188,8 +1264,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
#endif
} else {
IEEE80211_DEBUG_DROP(
- "encryption configured, but RX "
- "frame not encrypted (SA=%pM)\n",
+ "encryption configured, but RX frame not encrypted (SA=%pM)\n",
hdr->addr2);
goto rx_dropped;
}
@@ -1198,19 +1273,17 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
#ifdef CONFIG_IEEE80211_DEBUG
if (crypt && !(fc & IEEE80211_FCTL_WEP) &&
ieee80211_is_eapol_frame(ieee, skb, hdrlen)) {
- struct eapol *eap = (struct eapol *)(skb->data +
- 24);
- IEEE80211_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n",
- eap_get_type(eap->type));
+ struct eapol *eap = (struct eapol *)(skb->data + 24);
+
+ IEEE80211_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n",
+ eap_get_type(eap->type));
}
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
!ieee80211_is_eapol_frame(ieee, skb, hdrlen)) {
IEEE80211_DEBUG_DROP(
- "dropped unencrypted RX data "
- "frame from %pM"
- " (drop_unencrypted=1)\n",
+ "dropped unencrypted RX data frame from %pM (drop_unencrypted=1)\n",
hdr->addr2);
goto rx_dropped;
}
@@ -1219,7 +1292,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
&& !is_multicast_ether_addr(hdr->addr1)) {
TID = Frame_QoSTID(skb->data);
SeqNum = WLAN_GET_SEQ_SEQ(sc);
- GetTs(ieee, (PTS_COMMON_INFO *) &pTS, hdr->addr2, TID, RX_DIR, true);
+ GetTs(ieee, (PTS_COMMON_INFO *) &pTS,
+ hdr->addr2, TID, RX_DIR, true);
if (TID != 0 && TID != 3)
ieee->bis_any_nonbepkts = true;
}
@@ -1227,13 +1301,16 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
payload = skb->data + hdrlen;
rxb = kmalloc(sizeof(struct ieee80211_rxb), GFP_ATOMIC);
if (rxb == NULL) {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s(): kmalloc rxb error\n", __func__);
+ IEEE80211_DEBUG(IEEE80211_DL_ERR,
+ "%s(): kmalloc rxb error\n", __func__);
goto rx_dropped;
}
/* To parse amsdu packets */
/* qos data packets & reserved bit is 1 */
if (parse_subframe(skb, rx_stats, rxb, src, dst) == 0) {
- /* Only to free rxb, and not submit the packets to upper layer */
+ /* Only to free rxb, and not submit the
+ * packets to upper layer
+ */
for (i = 0; i < rxb->nr_subframes; i++)
dev_kfree_skb(rxb->subframes[i]);
kfree(rxb);
@@ -1248,25 +1325,37 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
struct sk_buff *sub_skb = rxb->subframes[i];
if (sub_skb) {
- /* Convert hdr + possible LLC headers into Ethernet header */
- ethertype = (sub_skb->data[6] << 8) | sub_skb->data[7];
+ /* Convert hdr + possible LLC headers
+ * into Ethernet header
+ */
+ ethertype = (sub_skb->data[6] << 8) |
+ sub_skb->data[7];
if (sub_skb->len >= 8 &&
- ((memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) == 0 &&
- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
- memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) {
- /* Remove RFC1042 or Bridge-Tunnel encapsulation and
- * replace EtherType
+ ((memcmp(sub_skb->data, rfc1042_header,
+ SNAP_SIZE) == 0 &&
+ ethertype != ETH_P_AARP &&
+ ethertype != ETH_P_IPX) ||
+ memcmp(sub_skb->data, bridge_tunnel_header,
+ SNAP_SIZE) == 0)) {
+ /* Remove RFC1042 or Bridge-Tunnel
+ * encapsulation and replace EtherType
*/
skb_pull(sub_skb, SNAP_SIZE);
- memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN);
- memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN);
+ memcpy(skb_push(sub_skb, ETH_ALEN),
+ src, ETH_ALEN);
+ memcpy(skb_push(sub_skb, ETH_ALEN),
+ dst, ETH_ALEN);
} else {
u16 len;
- /* Leave Ethernet header part of hdr and full payload */
+ /* Leave Ethernet header part of hdr
+ * and full payload
+ */
len = htons(sub_skb->len);
memcpy(skb_push(sub_skb, 2), &len, 2);
- memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN);
- memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN);
+ memcpy(skb_push(sub_skb, ETH_ALEN),
+ src, ETH_ALEN);
+ memcpy(skb_push(sub_skb, ETH_ALEN),
+ dst, ETH_ALEN);
}
stats->rx_packets++;
@@ -1275,7 +1364,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
stats->multicast++;
/* Indicate the packets to upper layer */
- sub_skb->protocol = eth_type_trans(sub_skb, dev);
+ sub_skb->protocol =
+ eth_type_trans(sub_skb, dev);
memset(sub_skb->cb, 0, sizeof(sub_skb->cb));
sub_skb->dev = dev;
/* 802.11 crc not sufficient */
@@ -1288,7 +1378,9 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
rxb = NULL;
} else {
- IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): REORDER ENABLE AND PTS not NULL, and we will enter RxReorderIndicatePacket()\n", __func__);
+ IEEE80211_DEBUG(IEEE80211_DL_REORDER,
+ "%s(): REORDER ENABLE AND PTS not NULL, and we will enter RxReorderIndicatePacket()\n",
+ __func__);
RxReorderIndicatePacket(ieee, rxb, pTS, SeqNum);
}
#ifndef JOHN_NOCPY
@@ -1323,8 +1415,9 @@ static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 };
* Make the structure we read from the beacon packet to have
* the right values
*/
-static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element
- *info_element, int sub_type)
+static int ieee80211_verify_qos_info(
+ struct ieee80211_qos_information_element *info_element,
+ int sub_type)
{
if (info_element->qui_subtype != sub_type)
@@ -1343,9 +1436,9 @@ static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element
/*
* Parse a QoS parameter element
*/
-static int ieee80211_read_qos_param_element(struct ieee80211_qos_parameter_info
- *element_param, struct ieee80211_info_element
- *info_element)
+static int ieee80211_read_qos_param_element(
+ struct ieee80211_qos_parameter_info *element_param,
+ struct ieee80211_info_element *info_element)
{
int ret = 0;
u16 size = sizeof(struct ieee80211_qos_parameter_info) - 2;
@@ -1369,10 +1462,9 @@ static int ieee80211_read_qos_param_element(struct ieee80211_qos_parameter_info
/*
* Parse a QoS information element
*/
-static int ieee80211_read_qos_info_element(struct
- ieee80211_qos_information_element
- *element_info, struct ieee80211_info_element
- *info_element)
+static int ieee80211_read_qos_info_element(
+ struct ieee80211_qos_information_element *element_info,
+ struct ieee80211_info_element *info_element)
{
int ret = 0;
u16 size = sizeof(struct ieee80211_qos_information_element) - 2;
@@ -1382,9 +1474,11 @@ static int ieee80211_read_qos_info_element(struct
if (info_element == NULL)
return -1;
- if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) {
- memcpy(element_info->qui, info_element->data,
- info_element->len);
+ if ((info_element->id == QOS_ELEMENT_ID) &&
+ (info_element->len == size)) {
+ memcpy(element_info->qui,
+ info_element->data,
+ info_element->len);
element_info->elementID = info_element->id;
element_info->length = info_element->len;
} else
@@ -1420,15 +1514,17 @@ static int ieee80211_qos_convert_ac_to_parameters(struct
qos_param->aifs[aci] = (ac_params->aci_aifsn) & 0x0f;
/* WMM spec P.11: The minimum value for AIFSN shall be 2 */
- qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 2:qos_param->aifs[aci];
+ qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ?
+ 2 : qos_param->aifs[aci];
qos_param->cw_min[aci] = ac_params->ecw_min_max & 0x0F;
qos_param->cw_max[aci] = (ac_params->ecw_min_max & 0xF0) >> 4;
qos_param->flag[aci] =
- (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00;
- qos_param->tx_op_limit[aci] = le16_to_cpu(ac_params->tx_op_limit);
+ (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00;
+ qos_param->tx_op_limit[aci] =
+ le16_to_cpu(ac_params->tx_op_limit);
}
return 0;
}
@@ -1449,7 +1545,8 @@ static int ieee80211_parse_qos_info_param_IE(struct ieee80211_info_element
rc = ieee80211_read_qos_info_element(&qos_info_element, info_element);
if (rc == 0) {
- network->qos_data.param_count = qos_info_element.ac_info & 0x0F;
+ network->qos_data.param_count =
+ qos_info_element.ac_info & 0x0F;
network->flags |= NETWORK_HAS_QOS_INFORMATION;
} else {
struct ieee80211_qos_parameter_info param_element;
@@ -1520,11 +1617,15 @@ static inline void ieee80211_extract_country_ie(
{
if (IS_DOT11D_ENABLE(ieee)) {
if (info_element->len != 0) {
- memcpy(network->CountryIeBuf, info_element->data, info_element->len);
+ memcpy(network->CountryIeBuf,
+ info_element->data,
+ info_element->len);
network->CountryIeLen = info_element->len;
if (!IS_COUNTRY_IE_VALID(ieee))
- Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data);
+ Dot11d_UpdateCountryIe(ieee, addr2,
+ info_element->len,
+ info_element->data);
}
/* 070305, rcnjko: I update country IE watch dog here because
@@ -1556,12 +1657,10 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
while (length >= sizeof(*info_element)) {
if (sizeof(*info_element) + info_element->len > length) {
- IEEE80211_DEBUG_MGMT("Info elem: parse failed: "
- "info_element->len + 2 > left : "
- "info_element->len+2=%zd left=%d, id=%d.\n",
- info_element->len +
- sizeof(*info_element),
- length, info_element->id);
+ IEEE80211_DEBUG_MGMT(
+ "Info elem: parse failed: info_element->len + 2 > left : info_element->len+2=%zd left=%d, id=%d.\n",
+ info_element->len + sizeof(*info_element),
+ length, info_element->id);
/* We stop processing but don't return an error here
* because some misbehaviour APs break this rule. ie.
* Orinoco AP1000.
@@ -1579,7 +1678,9 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
network->ssid_len = min(info_element->len,
(u8) IW_ESSID_MAX_SIZE);
- memcpy(network->ssid, info_element->data, network->ssid_len);
+ memcpy(network->ssid,
+ info_element->data,
+ network->ssid_len);
if (network->ssid_len < IW_ESSID_MAX_SIZE)
memset(network->ssid + network->ssid_len, 0,
IW_ESSID_MAX_SIZE - network->ssid_len);
@@ -1681,13 +1782,13 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
offset = (info_element->data[2] >> 1)*2;
if (ieee->assoc_id < 8*offset ||
- ieee->assoc_id > 8*(offset + info_element->len - 3))
-
+ ieee->assoc_id > 8*(offset + info_element->len - 3))
break;
offset = (ieee->assoc_id / 8) - offset;
- if (info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
+ if (info_element->data[3+offset] &
+ (1<<(ieee->assoc_id%8)))
network->dtim_data |= IEEE80211_DTIM_UCAST;
break;
@@ -1720,9 +1821,11 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
info_element->data[1] == 0x50 &&
info_element->data[2] == 0xf2 &&
info_element->data[3] == 0x01) {
- network->wpa_ie_len = min(info_element->len + 2,
- MAX_WPA_IE_LEN);
- memcpy(network->wpa_ie, info_element,
+ network->wpa_ie_len =
+ min(info_element->len + 2,
+ MAX_WPA_IE_LEN);
+ memcpy(network->wpa_ie,
+ info_element,
network->wpa_ie_len);
break;
}
@@ -1741,18 +1844,22 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
/* For HTcap and HTinfo parameters */
if (tmp_htcap_len == 0) {
if (info_element->len >= 4 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x90 &&
- info_element->data[2] == 0x4c &&
- info_element->data[3] == 0x033) {
-
- tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN);
- if (tmp_htcap_len != 0) {
- network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
- network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ? \
- sizeof(network->bssht.bdHTCapBuf):tmp_htcap_len;
- memcpy(network->bssht.bdHTCapBuf, info_element->data, network->bssht.bdHTCapLen);
- }
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x90 &&
+ info_element->data[2] == 0x4c &&
+ info_element->data[3] == 0x033) {
+ tmp_htcap_len = min(info_element->len,
+ (u8)MAX_IE_LEN);
+ if (tmp_htcap_len != 0) {
+ network->bssht.bdHTSpecVer =
+ HT_SPEC_VER_EWC;
+ network->bssht.bdHTCapLen =
+ tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ?
+ sizeof(network->bssht.bdHTCapBuf):tmp_htcap_len;
+ memcpy(network->bssht.bdHTCapBuf,
+ info_element->data,
+ network->bssht.bdHTCapLen);
+ }
}
if (tmp_htcap_len != 0)
network->bssht.bdSupportHT = true;
@@ -1763,21 +1870,24 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
if (tmp_htinfo_len == 0) {
if (info_element->len >= 4 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x90 &&
- info_element->data[2] == 0x4c &&
- info_element->data[3] == 0x034) {
-
- tmp_htinfo_len = min(info_element->len, (u8)MAX_IE_LEN);
- if (tmp_htinfo_len != 0) {
- network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
- if (tmp_htinfo_len) {
- network->bssht.bdHTInfoLen = tmp_htinfo_len > sizeof(network->bssht.bdHTInfoBuf) ? \
- sizeof(network->bssht.bdHTInfoBuf):tmp_htinfo_len;
- memcpy(network->bssht.bdHTInfoBuf, info_element->data, network->bssht.bdHTInfoLen);
- }
-
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x90 &&
+ info_element->data[2] == 0x4c &&
+ info_element->data[3] == 0x034) {
+ tmp_htinfo_len = min(info_element->len,
+ (u8)MAX_IE_LEN);
+ if (tmp_htinfo_len != 0) {
+ network->bssht.bdHTSpecVer =
+ HT_SPEC_VER_EWC;
+ if (tmp_htinfo_len) {
+ network->bssht.bdHTInfoLen =
+ tmp_htinfo_len > sizeof(network->bssht.bdHTInfoBuf) ?
+ sizeof(network->bssht.bdHTInfoBuf):tmp_htinfo_len;
+ memcpy(network->bssht.bdHTInfoBuf,
+ info_element->data,
+ network->bssht.bdHTInfoLen);
}
+ }
}
}
@@ -1785,20 +1895,24 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
if (ieee->aggregation) {
if (network->bssht.bdSupportHT) {
if (info_element->len >= 4 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0xe0 &&
- info_element->data[2] == 0x4c &&
- info_element->data[3] == 0x02) {
-
- ht_realtek_agg_len = min(info_element->len, (u8)MAX_IE_LEN);
- memcpy(ht_realtek_agg_buf, info_element->data, info_element->len);
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0xe0 &&
+ info_element->data[2] == 0x4c &&
+ info_element->data[3] == 0x02) {
+ ht_realtek_agg_len =
+ min(info_element->len,
+ (u8)MAX_IE_LEN);
+ memcpy(ht_realtek_agg_buf,
+ info_element->data,
+ info_element->len);
}
if (ht_realtek_agg_len >= 5) {
network->bssht.bdRT2RTAggregation = true;
- if ((ht_realtek_agg_buf[4] == 1) && (ht_realtek_agg_buf[5] & 0x02))
- network->bssht.bdRT2RTLongSlotTime = true;
+ if ((ht_realtek_agg_buf[4] == 1) &&
+ (ht_realtek_agg_buf[5] & 0x02))
+ network->bssht.bdRT2RTLongSlotTime = true;
}
}
@@ -1806,58 +1920,58 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
{
if ((info_element->len >= 3 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x05 &&
- info_element->data[2] == 0xb5) ||
- (info_element->len >= 3 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x0a &&
- info_element->data[2] == 0xf7) ||
- (info_element->len >= 3 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x10 &&
- info_element->data[2] == 0x18)) {
-
- network->broadcom_cap_exist = true;
-
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x05 &&
+ info_element->data[2] == 0xb5) ||
+ (info_element->len >= 3 &&
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x0a &&
+ info_element->data[2] == 0xf7) ||
+ (info_element->len >= 3 &&
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x10 &&
+ info_element->data[2] == 0x18)) {
+ network->broadcom_cap_exist = true;
}
}
if (info_element->len >= 3 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x0c &&
- info_element->data[2] == 0x43) {
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x0c &&
+ info_element->data[2] == 0x43) {
network->ralink_cap_exist = true;
} else
network->ralink_cap_exist = false;
/* Added by amy for atheros AP */
if ((info_element->len >= 3 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x03 &&
- info_element->data[2] == 0x7f) ||
- (info_element->len >= 3 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x13 &&
- info_element->data[2] == 0x74)) {
- printk("========>%s(): athros AP is exist\n", __func__);
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x03 &&
+ info_element->data[2] == 0x7f) ||
+ (info_element->len >= 3 &&
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x13 &&
+ info_element->data[2] == 0x74)) {
+ printk("========>%s(): athros AP is exist\n",
+ __func__);
network->atheros_cap_exist = true;
} else
network->atheros_cap_exist = false;
if (info_element->len >= 3 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x40 &&
- info_element->data[2] == 0x96) {
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x40 &&
+ info_element->data[2] == 0x96) {
network->cisco_cap_exist = true;
} else
network->cisco_cap_exist = false;
/* Added by amy for LEAP of cisco */
if (info_element->len > 4 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x40 &&
- info_element->data[2] == 0x96 &&
- info_element->data[3] == 0x01) {
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x40 &&
+ info_element->data[2] == 0x96 &&
+ info_element->data[3] == 0x01) {
if (info_element->len == 6) {
- memcpy(network->CcxRmState, &info_element[4], 2);
+ memcpy(network->CcxRmState,
+ &info_element[4], 2);
if (network->CcxRmState[0] != 0)
network->bCcxRmEnable = true;
else
@@ -1865,12 +1979,16 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
/*
* CCXv4 Table 59-1 MBSSID Masks.
*/
- network->MBssidMask = network->CcxRmState[1] & 0x07;
+ network->MBssidMask =
+ network->CcxRmState[1] & 0x07;
if (network->MBssidMask != 0) {
network->bMBssidValid = true;
- network->MBssidMask = 0xff << (network->MBssidMask);
- cpMacAddr(network->MBssid, network->bssid);
- network->MBssid[5] &= network->MBssidMask;
+ network->MBssidMask =
+ 0xff << (network->MBssidMask);
+ cpMacAddr(network->MBssid,
+ network->bssid);
+ network->MBssid[5] &=
+ network->MBssidMask;
} else {
network->bMBssidValid = false;
}
@@ -1879,13 +1997,14 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
}
}
if (info_element->len > 4 &&
- info_element->data[0] == 0x00 &&
- info_element->data[1] == 0x40 &&
- info_element->data[2] == 0x96 &&
- info_element->data[3] == 0x03) {
+ info_element->data[0] == 0x00 &&
+ info_element->data[1] == 0x40 &&
+ info_element->data[2] == 0x96 &&
+ info_element->data[3] == 0x03) {
if (info_element->len == 5) {
network->bWithCcxVerNum = true;
- network->BssCcxVerNumber = info_element->data[4];
+ network->BssCcxVerNumber =
+ info_element->data[4];
} else {
network->bWithCcxVerNum = false;
network->BssCcxVerNumber = 0;
@@ -1909,12 +2028,17 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN);
if (tmp_htcap_len != 0) {
network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
- network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ? \
+ network->bssht.bdHTCapLen =
+ tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ?
sizeof(network->bssht.bdHTCapBuf):tmp_htcap_len;
- memcpy(network->bssht.bdHTCapBuf, info_element->data, network->bssht.bdHTCapLen);
-
- /* If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT()
- * windows driver will update WMM parameters each beacon received once connected
+ memcpy(network->bssht.bdHTCapBuf,
+ info_element->data,
+ network->bssht.bdHTCapLen);
+
+ /* If peer is HT, but not WMM,
+ * call QosSetLegacyWMMParamWithHT()
+ * windows driver will update WMM parameters
+ * each beacon received once connected
* Linux driver is a bit different.
*/
network->bssht.bdSupportHT = true;
@@ -1926,12 +2050,16 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
case MFIE_TYPE_HT_INFO:
IEEE80211_DEBUG_SCAN("MFIE_TYPE_HT_INFO: %d bytes\n",
info_element->len);
- tmp_htinfo_len = min(info_element->len, (u8)MAX_IE_LEN);
+ tmp_htinfo_len = min(info_element->len,
+ (u8)MAX_IE_LEN);
if (tmp_htinfo_len) {
network->bssht.bdHTSpecVer = HT_SPEC_VER_IEEE;
- network->bssht.bdHTInfoLen = tmp_htinfo_len > sizeof(network->bssht.bdHTInfoBuf) ? \
+ network->bssht.bdHTInfoLen =
+ tmp_htinfo_len > sizeof(network->bssht.bdHTInfoBuf) ?
sizeof(network->bssht.bdHTInfoBuf):tmp_htinfo_len;
- memcpy(network->bssht.bdHTInfoBuf, info_element->data, network->bssht.bdHTInfoLen);
+ memcpy(network->bssht.bdHTInfoBuf,
+ info_element->data,
+ network->bssht.bdHTInfoLen);
}
break;
@@ -1941,12 +2069,17 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
if (info_element->len > IE_CISCO_FLAG_POSITION) {
network->bWithAironetIE = true;
- /* CCX 1 spec v1.13, A01.1 CKIP Negotiation (page23):
- * "A Cisco access point advertises support for CKIP in beacon and probe response packets,
- * by adding an Aironet element and setting one or both of the CKIP negotiation bits."
+ /* CCX 1 spec v1.13, A01.1 CKIP Negotiation
+ * (page23):
+ * "A Cisco access point advertises support for
+ * CKIP in beacon and probe response packets,
+ * by adding an Aironet element and setting
+ * one or both of the CKIP negotiation bits."
*/
- if ((info_element->data[IE_CISCO_FLAG_POSITION] & SUPPORT_CKIP_MIC) ||
- (info_element->data[IE_CISCO_FLAG_POSITION] & SUPPORT_CKIP_PK)) {
+ if ((info_element->data[IE_CISCO_FLAG_POSITION] &
+ SUPPORT_CKIP_MIC) ||
+ (info_element->data[IE_CISCO_FLAG_POSITION] &
+ SUPPORT_CKIP_PK)) {
network->bCkipSupported = true;
} else {
network->bCkipSupported = false;
@@ -1965,7 +2098,8 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
IEEE80211_DEBUG_SCAN("MFIE_TYPE_COUNTRY: %d bytes\n",
info_element->len);
/* addr2 is same as addr3 when from an AP */
- ieee80211_extract_country_ie(ieee, info_element, network, network->bssid);
+ ieee80211_extract_country_ie(ieee, info_element,
+ network, network->bssid);
break;
/* TODO */
default:
@@ -1983,7 +2117,8 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
}
if (!network->atheros_cap_exist && !network->broadcom_cap_exist &&
- !network->cisco_cap_exist && !network->ralink_cap_exist && !network->bssht.bdRT2RTAggregation) {
+ !network->cisco_cap_exist && !network->ralink_cap_exist &&
+ !network->bssht.bdRT2RTAggregation) {
network->unknown_cap_exist = true;
} else {
network->unknown_cap_exist = false;
@@ -2086,8 +2221,9 @@ static inline int ieee80211_network_init(
network->wpa_ie_len = 0;
network->rsn_ie_len = 0;
- if (ieee80211_parse_info_param
- (ieee, beacon->info_element, stats->len - sizeof(*beacon), network, stats))
+ if (ieee80211_parse_info_param(ieee, beacon->info_element,
+ stats->len - sizeof(*beacon),
+ network, stats))
return 1;
network->mode = 0;
@@ -2101,8 +2237,7 @@ static inline int ieee80211_network_init(
}
if (network->mode == 0) {
- IEEE80211_DEBUG_SCAN("Filtered out '%s (%pM)' "
- "network.\n",
+ IEEE80211_DEBUG_SCAN("Filtered out '%s (%pM)' network.\n",
escape_essid(network->ssid,
network->ssid_len),
network->bssid);
@@ -2119,7 +2254,8 @@ static inline int ieee80211_network_init(
network->flags |= NETWORK_EMPTY_ESSID;
stats->signal = 30 + (stats->SignalStrength * 70) / 100;
- stats->noise = ieee80211_translate_todbm((u8)(100 - stats->signal)) - 25;
+ stats->noise = ieee80211_translate_todbm((u8)(100 - stats->signal)) -
+ 25;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -2127,7 +2263,8 @@ static inline int ieee80211_network_init(
}
static inline int is_same_network(struct ieee80211_network *src,
- struct ieee80211_network *dst, struct ieee80211_device *ieee)
+ struct ieee80211_network *dst,
+ struct ieee80211_device *ieee)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
* and the capability field (in particular IBSS and BSS) all match.
@@ -2135,10 +2272,12 @@ static inline int is_same_network(struct ieee80211_network *src,
* as one network
*/
return
- (((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) &&
+ (((src->ssid_len == dst->ssid_len) ||
+ (ieee->iw_mode == IW_MODE_INFRA)) &&
(src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
- (!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) &&
+ (!memcmp(src->ssid, dst->ssid, src->ssid_len) ||
+ (ieee->iw_mode == IW_MODE_INFRA)) &&
((src->capability & WLAN_CAPABILITY_IBSS) ==
(dst->capability & WLAN_CAPABILITY_IBSS)) &&
((src->capability & WLAN_CAPABILITY_BSS) ==
@@ -2182,9 +2321,11 @@ static inline void update_network(struct ieee80211_network *dst,
dst->bssht.bdSupportHT = src->bssht.bdSupportHT;
dst->bssht.bdRT2RTAggregation = src->bssht.bdRT2RTAggregation;
dst->bssht.bdHTCapLen = src->bssht.bdHTCapLen;
- memcpy(dst->bssht.bdHTCapBuf, src->bssht.bdHTCapBuf, src->bssht.bdHTCapLen);
+ memcpy(dst->bssht.bdHTCapBuf, src->bssht.bdHTCapBuf,
+ src->bssht.bdHTCapLen);
dst->bssht.bdHTInfoLen = src->bssht.bdHTInfoLen;
- memcpy(dst->bssht.bdHTInfoBuf, src->bssht.bdHTInfoBuf, src->bssht.bdHTInfoLen);
+ memcpy(dst->bssht.bdHTInfoBuf, src->bssht.bdHTInfoBuf,
+ src->bssht.bdHTInfoLen);
dst->bssht.bdHTSpecVer = src->bssht.bdHTSpecVer;
dst->bssht.bdRT2RTLongSlotTime = src->bssht.bdRT2RTLongSlotTime;
dst->broadcom_cap_exist = src->broadcom_cap_exist;
@@ -2225,11 +2366,11 @@ static inline void update_network(struct ieee80211_network *dst,
/* dst->last_associate is not overwritten */
/* Sure to exist in beacon or probe response frame. */
dst->wmm_info = src->wmm_info;
- if (src->wmm_param[0].aci_aifsn || \
- src->wmm_param[1].aci_aifsn || \
- src->wmm_param[2].aci_aifsn || \
- src->wmm_param[3].aci_aifsn) {
- memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
+ if (src->wmm_param[0].aci_aifsn ||
+ src->wmm_param[1].aci_aifsn ||
+ src->wmm_param[2].aci_aifsn ||
+ src->wmm_param[3].aci_aifsn) {
+ memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
}
#ifdef THOMAS_TURBO
dst->Turbo_Enable = src->Turbo_Enable;
@@ -2294,18 +2435,18 @@ static inline void ieee80211_process_probe_response(
if (ieee80211_network_init(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n",
- escape_essid(info_element->data,
- info_element->len),
- beacon->header.addr3,
- WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
- IEEE80211_STYPE_PROBE_RESP ?
- "PROBE RESPONSE" : "BEACON");
+ escape_essid(info_element->data,
+ info_element->len),
+ beacon->header.addr3,
+ WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
+ IEEE80211_STYPE_PROBE_RESP ?
+ "PROBE RESPONSE" : "BEACON");
return;
}
/* For Asus EeePc request,
- * (1) if wireless adapter receive get any 802.11d country code in AP beacon,
- * wireless adapter should follow the country code.
+ * (1) if wireless adapter receive get any 802.11d country code
+ * in AP beacon, wireless adapter should follow the country code.
* (2) If there is no any country code in beacon,
* then wireless adapter should do active scan from ch1~11 and
* passive scan from ch12~14
@@ -2314,11 +2455,13 @@ static inline void ieee80211_process_probe_response(
if (!IsLegalChannel(ieee, network.channel))
return;
if (ieee->bGlobalDomain) {
- if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) {
+ if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
+ IEEE80211_STYPE_PROBE_RESP) {
/* Case 1: Country code */
if (IS_COUNTRY_IE_VALID(ieee)) {
if (!IsLegalChannel(ieee, network.channel)) {
- printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n", network.channel);
+ printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n",
+ network.channel);
return;
}
}
@@ -2326,7 +2469,8 @@ static inline void ieee80211_process_probe_response(
else {
/* Filter over channel ch12~14 */
if (network.channel > 11) {
- printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel);
+ printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n",
+ network.channel);
return;
}
}
@@ -2334,7 +2478,8 @@ static inline void ieee80211_process_probe_response(
/* Case 1: Country code */
if (IS_COUNTRY_IE_VALID(ieee)) {
if (!IsLegalChannel(ieee, network.channel)) {
- printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n", network.channel);
+ printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n",
+ network.channel);
return;
}
}
@@ -2342,7 +2487,8 @@ static inline void ieee80211_process_probe_response(
else {
/* Filter over channel ch12~14 */
if (network.channel > 14) {
- printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n", network.channel);
+ printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n",
+ network.channel);
return;
}
}
@@ -2365,19 +2511,23 @@ static inline void ieee80211_process_probe_response(
if (is_same_network(&ieee->current_network, &network, ieee)) {
update_network(&ieee->current_network, &network);
- if ((ieee->current_network.mode == IEEE_N_24G || ieee->current_network.mode == IEEE_G)
- && ieee->current_network.berp_info_valid) {
- if (ieee->current_network.erp_value & ERP_UseProtection)
- ieee->current_network.buseprotection = true;
- else
- ieee->current_network.buseprotection = false;
+ if ((ieee->current_network.mode == IEEE_N_24G ||
+ ieee->current_network.mode == IEEE_G) &&
+ ieee->current_network.berp_info_valid) {
+ if (ieee->current_network.erp_value &
+ ERP_UseProtection)
+ ieee->current_network.buseprotection = true;
+ else
+ ieee->current_network.buseprotection = false;
}
if (is_beacon(beacon->header.frame_ctl)) {
if (ieee->state == IEEE80211_LINKED)
ieee->LinkDetectInfo.NumRecvBcnInPeriod++;
} else
/* Hidden AP */
- network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags);
+ network.flags = (~NETWORK_EMPTY_ESSID & network.flags) |
+ (NETWORK_EMPTY_ESSID &
+ ieee->current_network.flags);
}
list_for_each_entry(target, &ieee->network_list, list) {
@@ -2396,8 +2546,7 @@ static inline void ieee80211_process_probe_response(
/* If there are no more slots, expire the oldest */
list_del(&oldest->list);
target = oldest;
- IEEE80211_DEBUG_SCAN("Expired '%s' (%pM) from "
- "network list.\n",
+ IEEE80211_DEBUG_SCAN("Expired '%s' (%pM) from network list.\n",
escape_essid(target->ssid,
target->ssid_len),
target->bssid);
@@ -2411,12 +2560,11 @@ static inline void ieee80211_process_probe_response(
#ifdef CONFIG_IEEE80211_DEBUG
IEEE80211_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n",
- escape_essid(network.ssid,
- network.ssid_len),
- network.bssid,
- WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
- IEEE80211_STYPE_PROBE_RESP ?
- "PROBE RESPONSE" : "BEACON");
+ escape_essid(network.ssid, network.ssid_len),
+ network.bssid,
+ WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
+ IEEE80211_STYPE_PROBE_RESP ?
+ "PROBE RESPONSE" : "BEACON");
#endif
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
@@ -2424,24 +2572,35 @@ static inline void ieee80211_process_probe_response(
ieee80211_softmac_new_net(ieee, &network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n",
- escape_essid(target->ssid,
- target->ssid_len),
- target->bssid,
- WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
- IEEE80211_STYPE_PROBE_RESP ?
- "PROBE RESPONSE" : "BEACON");
-
- /* We have an entry and we are going to update it. But this entry may
- * be already expired. In this case we do the same as we found a new
- * net and call the new_net handler
+ escape_essid(target->ssid, target->ssid_len),
+ target->bssid,
+ WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
+ IEEE80211_STYPE_PROBE_RESP ?
+ "PROBE RESPONSE" : "BEACON");
+
+ /* We have an entry and we are going to update it.
+ * But this entry may be already expired. In this case
+ * we do the same as we found a new net and call
+ * the new_net handler
*/
- renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
+ renew = !time_after(target->last_scanned + ieee->scan_age,
+ jiffies);
/* YJ,add,080819,for hidden ap */
if (is_beacon(beacon->header.frame_ctl) == 0)
- network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & target->flags);
- if (((network.flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \
- && (((network.ssid_len > 0) && (strncmp(target->ssid, network.ssid, network.ssid_len)))\
- || ((ieee->current_network.ssid_len == network.ssid_len) && (strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0) && (ieee->state == IEEE80211_NOLINK))))
+ network.flags =
+ (~NETWORK_EMPTY_ESSID & network.flags) |
+ (NETWORK_EMPTY_ESSID & target->flags);
+ if (((network.flags & NETWORK_EMPTY_ESSID) ==
+ NETWORK_EMPTY_ESSID) &&
+ (((network.ssid_len > 0) &&
+ (strncmp(target->ssid,
+ network.ssid,
+ network.ssid_len))) ||
+ ((ieee->current_network.ssid_len == network.ssid_len) &&
+ (strncmp(ieee->current_network.ssid,
+ network.ssid,
+ network.ssid_len) == 0) &&
+ (ieee->state == IEEE80211_NOLINK))))
renew = 1;
/* YJ,add,080819,for hidden ap,end */
@@ -2451,10 +2610,13 @@ static inline void ieee80211_process_probe_response(
}
spin_unlock_irqrestore(&ieee->lock, flags);
- if (is_beacon(beacon->header.frame_ctl) && is_same_network(&ieee->current_network, &network, ieee) && \
- (ieee->state == IEEE80211_LINKED)) {
+ if (is_beacon(beacon->header.frame_ctl) &&
+ is_same_network(&ieee->current_network, &network, ieee) &&
+ (ieee->state == IEEE80211_LINKED)) {
if (ieee->handle_beacon != NULL)
- ieee->handle_beacon(ieee->dev, beacon, &ieee->current_network);
+ ieee->handle_beacon(ieee->dev,
+ beacon,
+ &ieee->current_network);
}
}
@@ -2468,16 +2630,16 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee,
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
- ieee, (struct ieee80211_probe_response *)header, stats);
+ ieee80211_process_probe_response(ieee,
+ (struct ieee80211_probe_response *)header, stats);
break;
case IEEE80211_STYPE_PROBE_RESP:
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
- ieee, (struct ieee80211_probe_response *)header, stats);
+ ieee80211_process_probe_response(ieee,
+ (struct ieee80211_probe_response *)header, stats);
break;
}
--
1.9.1
More information about the firefly
mailing list