diff options
Diffstat (limited to 'drivers/staging/rtl8192e/rtllib_rx.c')
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_rx.c | 305 |
1 files changed, 159 insertions, 146 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 1664040efdab..fe3e7e1273ff 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -143,7 +143,8 @@ rtllib_frag_cache_get(struct rtllib_device *ieee, memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); } else { /* received a fragment of a frame for which the head fragment - * should have already been received */ + * should have already been received + */ entry = rtllib_frag_cache_find(ieee, seq, frag, tid, hdr->addr2, hdr->addr1); if (entry != NULL) { @@ -199,7 +200,8 @@ static int rtllib_frag_cache_invalidate(struct rtllib_device *ieee, * * Responsible for handling management control frames * - * Called by rtllib_rx */ + * Called by rtllib_rx + */ static inline int rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats, u16 type, @@ -224,8 +226,9 @@ rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb, return 0; } -/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ -/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ +/* 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 }; @@ -394,10 +397,9 @@ static int is_duplicate_packet(struct rtllib_device *ieee, } if (p == &ieee->ibss_mac_hash[index]) { entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); - if (!entry) { - printk(KERN_WARNING "Cannot malloc new mac entry\n"); + if (!entry) return 0; - } + memcpy(entry->mac, mac, ETH_ALEN); entry->seq_num[tid] = seq; entry->frag_num[tid] = frag; @@ -483,7 +485,8 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx 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 */ + * 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); @@ -524,7 +527,9 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, struct rx_ts_record del_timer_sync(&pTS->RxPktPendingTimer); while (!list_empty(&pTS->RxPendingPktList)) { if (RfdCnt >= REORDER_WIN_SIZE) { - printk(KERN_INFO "-------------->%s() error! RfdCnt >= REORDER_WIN_SIZE\n", __func__); + netdev_info(ieee->dev, + "-------------->%s() error! RfdCnt >= REORDER_WIN_SIZE\n", + __func__); break; } @@ -581,8 +586,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, return; } - /* - * Sliding window manipulation. Conditions includes: + /* Sliding window manipulation. Conditions includes: * 1. Incoming SeqNum is equal to WinStart =>Window shift 1 * 2. Incoming SeqNum is larger than the WinEnd => Window shift N */ @@ -597,13 +601,12 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, RTLLIB_DEBUG(RTLLIB_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum); } - /* - * Indication process. + /* 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 struct buffer other packets. - */ - /* For Rx Reorder condition: + * + * 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. @@ -646,8 +649,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, pTS->RxIndicateSeq, SeqNum); } } else { - /* - * Packets are dropped if there are not enough reorder + /* Packets are dropped if there are not enough reorder * entries. This part should be modified!! We can just * indicate all the packets in struct buffer and get * reorder entries. @@ -697,7 +699,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, } /* Handling pending timer. Set this timer to prevent from long time - * Rx buffering.*/ + * Rx buffering. + */ if (index > 0) { if (timer_pending(&pTS->RxPktPendingTimer)) del_timer_sync(&pTS->RxPktPendingTimer); @@ -718,7 +721,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, __func__); pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq; mod_timer(&pTS->RxPktPendingTimer, jiffies + - MSECS(pHTInfo->RxReorderPendingTime)); + msecs_to_jiffies(pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); } @@ -782,69 +785,74 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, memcpy(rxb->dst, dst, ETH_ALEN); rxb->subframes[0]->dev = ieee->dev; return 1; - } else { - rxb->nr_subframes = 0; - memcpy(rxb->src, src, ETH_ALEN); - memcpy(rxb->dst, dst, ETH_ALEN); - while (skb->len > ETHERNET_HEADER_SIZE) { - /* Offset 12 denote 2 mac address */ - nSubframe_Length = *((u16 *)(skb->data + 12)); - nSubframe_Length = (nSubframe_Length >> 8) + - (nSubframe_Length << 8); - - if (skb->len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { - printk(KERN_INFO "%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\ - __func__, rxb->nr_subframes); - printk(KERN_INFO "%s: A-MSDU parse error!! Subframe Length: %d\n", __func__, - nSubframe_Length); - printk(KERN_INFO "nRemain_Length is %d and nSubframe_Length is : %d\n", skb->len, - nSubframe_Length); - printk(KERN_INFO "The Packet SeqNum is %d\n", SeqNum); - return 0; - } + } - /* move the data point to data content */ - skb_pull(skb, ETHERNET_HEADER_SIZE); + rxb->nr_subframes = 0; + memcpy(rxb->src, src, ETH_ALEN); + memcpy(rxb->dst, dst, ETH_ALEN); + while (skb->len > ETHERNET_HEADER_SIZE) { + /* Offset 12 denote 2 mac address */ + nSubframe_Length = *((u16 *)(skb->data + 12)); + nSubframe_Length = (nSubframe_Length >> 8) + + (nSubframe_Length << 8); + + if (skb->len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { + netdev_info(ieee->dev, + "%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n", + __func__, rxb->nr_subframes); + netdev_info(ieee->dev, + "%s: A-MSDU parse error!! Subframe Length: %d\n", + __func__, nSubframe_Length); + netdev_info(ieee->dev, + "nRemain_Length is %d and nSubframe_Length is : %d\n", + skb->len, nSubframe_Length); + netdev_info(ieee->dev, + "The Packet SeqNum is %d\n", + SeqNum); + return 0; + } - /* altered by clark 3/30/2010 - * The struct buffer size of the skb indicated to upper layer - * must be less than 5000, or the defraged IP datagram - * in the IP layer will exceed "ipfrag_high_tresh" and be - * discarded. so there must not use the function - * "skb_copy" and "skb_clone" for "skb". - */ + /* move the data point to data content */ + skb_pull(skb, ETHERNET_HEADER_SIZE); - /* Allocate new skb for releasing to upper layer */ - sub_skb = dev_alloc_skb(nSubframe_Length + 12); - if (!sub_skb) - return 0; - skb_reserve(sub_skb, 12); - data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); - memcpy(data_ptr, skb->data, nSubframe_Length); - - sub_skb->dev = ieee->dev; - rxb->subframes[rxb->nr_subframes++] = sub_skb; - if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { - RTLLIB_DEBUG_RX("ParseSubframe(): Too many Subframes! Packets dropped!\n"); - break; - } - skb_pull(skb, nSubframe_Length); - - if (skb->len != 0) { - nPadding_Length = 4 - ((nSubframe_Length + - ETHERNET_HEADER_SIZE) % 4); - if (nPadding_Length == 4) - nPadding_Length = 0; + /* altered by clark 3/30/2010 + * The struct buffer size of the skb indicated to upper layer + * must be less than 5000, or the defraged IP datagram + * in the IP layer will exceed "ipfrag_high_tresh" and be + * discarded. so there must not use the function + * "skb_copy" and "skb_clone" for "skb". + */ - if (skb->len < nPadding_Length) - return 0; + /* Allocate new skb for releasing to upper layer */ + sub_skb = dev_alloc_skb(nSubframe_Length + 12); + if (!sub_skb) + return 0; + skb_reserve(sub_skb, 12); + data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); + memcpy(data_ptr, skb->data, nSubframe_Length); - skb_pull(skb, nPadding_Length); - } + sub_skb->dev = ieee->dev; + rxb->subframes[rxb->nr_subframes++] = sub_skb; + if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { + RTLLIB_DEBUG_RX("ParseSubframe(): Too many Subframes! Packets dropped!\n"); + break; } + skb_pull(skb, nSubframe_Length); - return rxb->nr_subframes; + if (skb->len != 0) { + nPadding_Length = 4 - ((nSubframe_Length + + ETHERNET_HEADER_SIZE) % 4); + if (nPadding_Length == 4) + nPadding_Length = 0; + + if (skb->len < nPadding_Length) + return 0; + + skb_pull(skb, nPadding_Length); + } } + + return rxb->nr_subframes; } @@ -859,7 +867,8 @@ static size_t rtllib_rx_get_hdrlen(struct rtllib_device *ieee, hdrlen = rtllib_get_hdrlen(fc); if (HTCCheck(ieee, skb->data)) { if (net_ratelimit()) - printk(KERN_INFO "%s: find HTCControl!\n", __func__); + netdev_info(ieee->dev, "%s: find HTCControl!\n", + __func__); hdrlen += 4; rx_stats->bContainHTC = true; } @@ -966,7 +975,8 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc, } /* Nullfunc frames may have PS-bit set, so they must be passed to - * hostap_handle_sta_rx() before being dropped here. */ + * hostap_handle_sta_rx() before being dropped here. + */ if (!ieee->IntelPromiscuousModeInfo.bPromiscuousOn) { if (stype != RTLLIB_STYPE_DATA && stype != RTLLIB_STYPE_DATA_CFACK && @@ -1008,7 +1018,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, *crypt = ieee->crypt_info.crypt[idx]; /* allow NULL decrypt to indicate an station specific override - * for default encryption */ + * for default encryption + */ if (*crypt && ((*crypt)->ops == NULL || (*crypt)->ops->decrypt_mpdu == NULL)) *crypt = NULL; @@ -1017,7 +1028,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, /* This seems to be triggered by some (multicast?) * frames from other than current BSS, so just drop the * frames silently instead of filling system log with - * these reports. */ + * these reports. + */ RTLLIB_DEBUG_DROP("Decryption failed (not set) (SA= %pM)\n", hdr->addr2); ieee->ieee_stats.rx_discards_undecryptable++; @@ -1049,7 +1061,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, keyidx = rtllib_rx_frame_decrypt(ieee, skb, crypt); if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && (keyidx < 0)) { - printk(KERN_INFO "%s: decrypt frame error\n", __func__); + netdev_info(ieee->dev, "%s: decrypt frame error\n", __func__); return -1; } @@ -1072,19 +1084,22 @@ static int rtllib_rx_decrypt(struct rtllib_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", - __func__); + netdev_warn(ieee->dev, + "%s: host decrypted and reassembled frame did not fit skb\n", + __func__); rtllib_frag_cache_invalidate(ieee, hdr); return -1; } if (frag == 0) { /* copy first fragment (including full headers) into - * beginning of the fragment cache skb */ + * beginning of the fragment cache skb + */ memcpy(skb_put(frag_skb, flen), skb->data, flen); } else { /* append frame payload to the end of the fragment - * cache skb */ + * cache skb + */ memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, flen); } @@ -1094,22 +1109,25 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, if (fc & RTLLIB_FCTL_MOREFRAGS) { /* more fragments expected - leave the skb in fragment * cache for now; it will be delivered to upper layers - * after all fragments have been received */ + * after all fragments have been received + */ return -2; } /* this was the last fragment and the frame will be - * delivered, so remove skb from fragment cache */ + * delivered, so remove skb from fragment cache + */ skb = frag_skb; hdr = (struct rtllib_hdr_4addr *) skb->data; rtllib_frag_cache_invalidate(ieee, hdr); } /* skb: hdr + (possible reassembled) full MSDU payload; possibly still - * encrypted/authenticated */ + * encrypted/authenticated + */ if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) { - printk(KERN_INFO "%s: ==>decrypt msdu error\n", __func__); + netdev_info(ieee->dev, "%s: ==>decrypt msdu error\n", __func__); return -1; } @@ -1119,7 +1137,8 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, rtllib_is_eapol_frame(ieee, skb, hdrlen)) { /* pass unencrypted EAPOL frames even if encryption is - * configured */ + * configured + */ struct eapol *eap = (struct eapol *)(skb->data + 24); RTLLIB_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", @@ -1149,7 +1168,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, } if (rtllib_is_eapol_frame(ieee, skb, hdrlen)) - printk(KERN_WARNING "RX: IEEE802.1X EAPOL frame!\n"); + netdev_warn(ieee->dev, "RX: IEEE802.1X EAPOL frame!\n"); return 0; } @@ -1158,7 +1177,7 @@ static void rtllib_rx_check_leave_lps(struct rtllib_device *ieee, u8 unicast, u8 { if (unicast) { - if ((ieee->state == RTLLIB_LINKED)) { + if (ieee->state == RTLLIB_LINKED) { if (((ieee->LinkDetectInfo.NumRxUnicastOkInPeriod + ieee->LinkDetectInfo.NumTxOkInPeriod) > 8) || (ieee->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) { @@ -1181,8 +1200,8 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, int i = 0; if (rxb == NULL) { - printk(KERN_INFO "%s: rxb is NULL!!\n", __func__); - return ; + netdev_info(dev, "%s: rxb is NULL!!\n", __func__); + return; } for (i = 0; i < rxb->nr_subframes; i++) { @@ -1196,7 +1215,8 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, 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 */ + * 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); @@ -1226,7 +1246,6 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, } } kfree(rxb); - rxb = NULL; } static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, @@ -1263,7 +1282,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /*Filter pkt has too small length */ hdrlen = rtllib_rx_get_hdrlen(ieee, skb, rx_stats); if (skb->len < hdrlen) { - printk(KERN_INFO "%s():ERR!!! skb->len is smaller than hdrlen\n", __func__); + netdev_info(dev, "%s():ERR!!! skb->len is smaller than hdrlen\n", + __func__); goto rx_dropped; } @@ -1345,11 +1365,9 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /* skb: hdr + (possible reassembled) full plaintext payload */ payload = skb->data + hdrlen; rxb = kmalloc(sizeof(struct rtllib_rxb), GFP_ATOMIC); - if (rxb == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, - "%s(): kmalloc rxb error\n", __func__); + if (rxb == NULL) goto rx_dropped; - } + /* to parse amsdu packets */ /* qos data packets & reserved bit is 1 */ if (parse_subframe(ieee, skb, rx_stats, rxb, src, dst) == 0) { @@ -1390,7 +1408,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /* Returning 0 indicates to caller that we have not handled the SKB-- * so it is still allocated and can be used again by underlying - * hardware as a DMA target */ + * hardware as a DMA target + */ return 0; } @@ -1408,13 +1427,16 @@ static int rtllib_rx_Monitor(struct rtllib_device *ieee, struct sk_buff *skb, size_t hdrlen = rtllib_get_hdrlen(fc); if (skb->len < hdrlen) { - printk(KERN_INFO "%s():ERR!!! skb->len is smaller than hdrlen\n", __func__); + netdev_info(ieee->dev, + "%s():ERR!!! skb->len is smaller than hdrlen\n", + __func__); return 0; } if (HTCCheck(ieee, skb->data)) { if (net_ratelimit()) - printk(KERN_INFO "%s: Find HTCControl!\n", __func__); + netdev_info(ieee->dev, "%s: Find HTCControl!\n", + __func__); hdrlen += 4; } @@ -1433,18 +1455,19 @@ static int rtllib_rx_Mesh(struct rtllib_device *ieee, struct sk_buff *skb, /* All received frames are sent to this function. @skb contains the frame in * IEEE 802.11 format, i.e., in the format it was sent over air. - * This function is called only as a tasklet (software IRQ). */ + * This function is called only as a tasklet (software IRQ). + */ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats) { int ret = 0; if ((NULL == ieee) || (NULL == skb) || (NULL == rx_stats)) { - printk(KERN_INFO "%s: Input parameters NULL!\n", __func__); + pr_info("%s: Input parameters NULL!\n", __func__); goto rx_dropped; } if (skb->len < 10) { - printk(KERN_INFO "%s: SKB length < 10\n", __func__); + netdev_info(ieee->dev, "%s: SKB length < 10\n", __func__); goto rx_dropped; } @@ -1464,7 +1487,7 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, ret = rtllib_rx_Mesh(ieee, skb, rx_stats); break; default: - printk(KERN_INFO"%s: ERR iw mode!!!\n", __func__); + netdev_info(ieee->dev, "%s: ERR iw mode!!!\n", __func__); break; } @@ -1479,10 +1502,7 @@ EXPORT_SYMBOL(rtllib_rx); static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; -/* -* Make ther structure we read from the beacon packet has -* the right values -*/ +/* Make ther structure we read from the beacon packet has the right values */ static int rtllib_verify_qos_info(struct rtllib_qos_information_element *info_element, int sub_type) { @@ -1500,9 +1520,7 @@ static int rtllib_verify_qos_info(struct rtllib_qos_information_element } -/* - * Parse a QoS parameter element - */ +/* Parse a QoS parameter element */ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info *element_param, struct rtllib_info_element *info_element) @@ -1526,9 +1544,7 @@ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info return ret; } -/* - * Parse a QoS information element - */ +/* Parse a QoS information element */ static int rtllib_read_qos_info_element(struct rtllib_qos_information_element *element_info, struct rtllib_info_element @@ -1557,9 +1573,7 @@ static int rtllib_read_qos_info_element(struct } -/* - * Write QoS parameters from the ac parameters. - */ +/* Write QoS parameters from the ac parameters. */ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info *param_elm, struct rtllib_qos_data *qos_data) { @@ -1618,8 +1632,7 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info return 0; } -/* - * we have a generic data element which it may contain QoS information or +/* we have a generic data element which it may contain QoS information or * parameters element. check the information element length to decide * which type to read */ @@ -1705,7 +1718,9 @@ static inline void rtllib_extract_country_ie( if (!IS_COUNTRY_IE_VALID(ieee)) { if (rtllib_act_scanning(ieee, false) && ieee->FirstIe_InScan) - printk(KERN_INFO "Received beacon ContryIE, SSID: <%s>\n", network->ssid); + netdev_info(ieee->dev, + "Received beacon ContryIE, SSID: <%s>\n", + network->ssid); Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); } } @@ -1739,7 +1754,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, length, info_element->id); /* We stop processing but don't return an error here * because some misbehaviour APs break this rule. ie. - * Orinoco AP1000. */ + * Orinoco AP1000. + */ break; } @@ -1908,7 +1924,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, info_element->data[2] == 0x4c && info_element->data[3] == 0x033) { - tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htcap_len = min_t(u8, info_element->len, 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) ? @@ -1932,7 +1948,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, 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); + tmp_htinfo_len = min_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htinfo_len != 0) { network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; if (tmp_htinfo_len) { @@ -1953,7 +1969,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, 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); + ht_realtek_agg_len = min_t(u8, info_element->len, MAX_IE_LEN); memcpy(ht_realtek_agg_buf, info_element->data, info_element->len); } if (ht_realtek_agg_len >= 5) { @@ -2083,7 +2099,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, case MFIE_TYPE_HT_CAP: RTLLIB_DEBUG_SCAN("MFIE_TYPE_HT_CAP: %d bytes\n", info_element->len); - tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htcap_len = min_t(u8, info_element->len, 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) ? @@ -2110,7 +2126,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, case MFIE_TYPE_HT_INFO: RTLLIB_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_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htinfo_len) { network->bssht.bdHTSpecVer = HT_SPEC_VER_IEEE; network->bssht.bdHTInfoLen = tmp_htinfo_len > @@ -2142,8 +2158,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, } break; case MFIE_TYPE_QOS_PARAMETER: - printk(KERN_ERR - "QoS Error need to parse QOS_PARAMETER IE\n"); + netdev_err(ieee->dev, + "QoS Error need to parse QOS_PARAMETER IE\n"); break; case MFIE_TYPE_COUNTRY: @@ -2192,13 +2208,6 @@ static inline int rtllib_network_init( struct rtllib_network *network, struct rtllib_rx_stats *stats) { - - /* - network->qos_data.active = 0; - network->qos_data.supported = 0; - network->qos_data.param_count = 0; - network->qos_data.old_param_count = 0; - */ memset(&network->qos_data, 0, sizeof(struct rtllib_qos_data)); /* Pull out fixed field data */ @@ -2291,7 +2300,8 @@ static inline int is_same_network(struct rtllib_network *src, /* A network is only a duplicate if the channel, BSSID, ESSID * and the capability field (in particular IBSS and BSS) all match. * We treat all <hidden> with the same BSSID and channel - * as one network */ + * as one network + */ return (((src->ssid_len == dst->ssid_len) || (!ssidbroad)) && (src->channel == dst->channel) && !memcmp(src->bssid, dst->bssid, ETH_ALEN) && @@ -2422,7 +2432,7 @@ static inline int is_beacon(__le16 fc) static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) { if (MAX_CHANNEL_NUMBER < channel) { - printk(KERN_INFO "%s(): Invalid Channel\n", __func__); + netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__); return 0; } @@ -2435,7 +2445,7 @@ static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel) { if (MAX_CHANNEL_NUMBER < channel) { - printk(KERN_INFO "%s(): Invalid Channel\n", __func__); + netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__); return 0; } if (rtllib->active_channel_map[channel] > 0) @@ -2501,8 +2511,9 @@ static inline void rtllib_process_probe_response( if (WLAN_FC_GET_STYPE(le16_to_cpu(beacon->header.frame_ctl)) == RTLLIB_STYPE_PROBE_RESP) { if (IsPassiveChannel(ieee, network->channel)) { - printk(KERN_INFO "GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", - network->channel); + netdev_info(ieee->dev, + "GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", + network->channel); goto free_network; } } @@ -2512,10 +2523,12 @@ static inline void rtllib_process_probe_response( * * NOTE: This search is definitely not optimized. Once its doing * the "right thing" we'll optimize it for efficiency if - * necessary */ + * necessary + */ /* Search for this entry in the list and update it if it is - * already there. */ + * already there. + */ spin_lock_irqsave(&ieee->lock, flags); if (is_same_network(&ieee->current_network, network, @@ -2544,7 +2557,8 @@ static inline void rtllib_process_probe_response( } /* If we didn't find a match, then get a new network slot to initialize - * with this beacon's information */ + * with this beacon's information + */ if (&target->list == &ieee->network_list) { if (list_empty(&ieee->network_free_list)) { /* If there are no more slots, expire the oldest */ @@ -2611,7 +2625,6 @@ static inline void rtllib_process_probe_response( } free_network: kfree(network); - return; } void rtllib_rx_mgt(struct rtllib_device *ieee, |