diff options
Diffstat (limited to 'drivers/staging/otus/80211core/cmmsta.c')
-rw-r--r-- | drivers/staging/otus/80211core/cmmsta.c | 123 |
1 files changed, 81 insertions, 42 deletions
diff --git a/drivers/staging/otus/80211core/cmmsta.c b/drivers/staging/otus/80211core/cmmsta.c index c3fd475..0fda30d 100644 --- a/drivers/staging/otus/80211core/cmmsta.c +++ b/drivers/staging/otus/80211core/cmmsta.c @@ -602,7 +602,8 @@ void zfStaProtErpMonitor(zdev_t* dev, zbuf_t* buf) if (zfRxBufferEqualToStr(dev, buf, bssid, ZM_WLAN_HEADER_A2_OFFSET, 6)) { - if ( (offset=zfFindElement(dev, buf, ZM_WLAN_EID_ERP)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_ERP); + if (offset != 0xffff) { erp = zmw_rx_buf_readb(dev, buf, offset+2); @@ -628,7 +629,8 @@ void zfStaProtErpMonitor(zdev_t* dev, zbuf_t* buf) } //Check the existence of Non-N AP //Follow the check the "pBssInfo->EnableHT" - if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY)) != 0xffff) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY); + if (offset != 0xffff) {} else if ((offset = zfFindElement(dev, buf, ZM_WLAN_PREN2_EID_HTCAPABILITY)) != 0xffff) {} @@ -658,9 +660,11 @@ void zfStaUpdateWmeParameter(zdev_t* dev, zbuf_t* buf) if (wd->sta.wmeConnected != 0) { /* Find WME parameter element */ - if ((offset = zfFindWifiElement(dev, buf, 2, 1)) != 0xffff) + offset = zfFindWifiElement(dev, buf, 2, 1); + if (offset != 0xffff) { - if ((len = zmw_rx_buf_readb(dev, buf, offset+1)) >= 7) + len = zmw_rx_buf_readb(dev, buf, offset+1); + if (len >= 7) { rxWmeParameterSetCount=zmw_rx_buf_readb(dev, buf, offset+8); if (rxWmeParameterSetCount != wd->sta.wmeParameterSetCount) @@ -741,7 +745,8 @@ void zfStaUpdateDot11HDFS(zdev_t* dev, zbuf_t* buf) */ /* get EID(Channel Switch Announcement) */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_CHANNEL_SWITCH_ANNOUNCE)) == 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_CHANNEL_SWITCH_ANNOUNCE); + if (offset == 0xffff) { //zm_debug_msg0("EID(Channel Switch Announcement) not found"); return; @@ -1216,7 +1221,8 @@ void zfStaSendBeacon(zdev_t* dev) //zm_debug_msg0("\n"); /* TBD : Maximum size of beacon */ - if ((buf = zfwBufAllocate(dev, 1024)) == NULL) + buf = zfwBufAllocate(dev, 1024); + if (buf == NULL) { zm_debug_msg0("Allocate beacon buffer failed"); return; @@ -1370,7 +1376,8 @@ struct zsBssInfo* zfStaFindBssInfo(zdev_t* dev, zbuf_t* buf, struct zsWlanProbeR zmw_get_wlan_dev(dev); - if ((pBssInfo = wd->sta.bssList.head) == NULL) + pBssInfo = wd->sta.bssList.head; + if (pBssInfo == NULL) { return NULL; } @@ -1420,8 +1427,10 @@ struct zsBssInfo* zfStaFindBssInfo(zdev_t* dev, zbuf_t* buf, struct zsWlanProbeR /* Check channel */ /* Add check channel to solve the bug #31222 */ if (isMatched) { - if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_DS)) != 0xffff) { - if ((length = zmw_rx_buf_readb(dev, buf, offset+1)) == 1) { + offset = zfFindElement(dev, buf, ZM_WLAN_EID_DS); + if (offset != 0xffff) { + length = zmw_rx_buf_readb(dev, buf, offset+1); + if (length == 1) { channel = zmw_rx_buf_readb(dev, buf, offset+2); if (zfHpIsAllowedChannel(dev, zfChNumToFreq(dev, channel, 0)) == 0) { frequency = 0; @@ -1473,7 +1482,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, } /* get SSID */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID)) == 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID); + if (offset == 0xffff) { zm_debug_msg0("EID(SSID) not found"); goto zlError; @@ -1506,7 +1516,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, zfCopyFromRxBuffer(dev, buf, pBssInfo->ssid, offset, length+2); /* get DS parameter */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_DS)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_DS); + if (offset != 0xffff) { length = zmw_rx_buf_readb(dev, buf, offset+1); if ( length != 1 ) @@ -1590,7 +1601,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, pBssInfo->frameBodysize = accumulateLen; /* get supported rates */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_SUPPORT_RATE)) == 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_SUPPORT_RATE); + if (offset == 0xffff) { zm_debug_msg0("EID(supported rates) not found"); goto zlError; @@ -1607,7 +1619,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, /* get Country information */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_COUNTRY)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_COUNTRY); + if (offset != 0xffff) { length = zmw_rx_buf_readb(dev, buf, offset+1); if (length > ZM_MAX_COUNTRY_INFO_SIZE) @@ -1625,13 +1638,15 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, } /* get ERP information */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_ERP)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_ERP); + if (offset != 0xffff) { pBssInfo->erp = zmw_rx_buf_readb(dev, buf, offset+2); } /* get extended supported rates */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_RATE)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_RATE); + if (offset != 0xffff) { length = zmw_rx_buf_readb(dev, buf, offset+1); if (length > ZM_MAX_SUPP_RATES_IE_SIZE) @@ -1648,7 +1663,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, } /* get WPA IE */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_WPA_IE)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_WPA_IE); + if (offset != 0xffff) { length = zmw_rx_buf_readb(dev, buf, offset+1); if (length > ZM_MAX_IE_SIZE) @@ -1664,7 +1680,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, } /* get WPS IE */ - if ((offset = zfFindWifiElement(dev, buf, 4, 0xff)) != 0xffff) + offset = zfFindWifiElement(dev, buf, 4, 0xff); + if (offset != 0xffff) { length = zmw_rx_buf_readb(dev, buf, offset+1); if (length > ZM_MAX_WPS_IE_SIZE ) @@ -1679,19 +1696,22 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, } /* get SuperG IE */ - if ((offset = zfFindSuperGElement(dev, buf, ZM_WLAN_EID_VENDOR_PRIVATE)) != 0xffff) + offset = zfFindSuperGElement(dev, buf, ZM_WLAN_EID_VENDOR_PRIVATE); + if (offset != 0xffff) { pBssInfo->apCap |= ZM_SuperG_AP; } /* get XR IE */ - if ((offset = zfFindXRElement(dev, buf, ZM_WLAN_EID_VENDOR_PRIVATE)) != 0xffff) + offset = zfFindXRElement(dev, buf, ZM_WLAN_EID_VENDOR_PRIVATE); + if (offset != 0xffff) { pBssInfo->apCap |= ZM_XR_AP; } /* get RSN IE */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_RSN_IE)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_RSN_IE); + if (offset != 0xffff) { length = zmw_rx_buf_readb(dev, buf, offset+1); if (length > ZM_MAX_IE_SIZE) @@ -1707,7 +1727,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, } #ifdef ZM_ENABLE_CENC /* get CENC IE */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_CENC_IE)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_CENC_IE); + if (offset != 0xffff) { length = zmw_rx_buf_readb(dev, buf, offset+1); if (length > ZM_MAX_IE_SIZE ) @@ -1726,7 +1747,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, /* get WME Parameter IE, probe rsp may contain WME parameter element */ //if ( wd->bQoSEnable ) { - if ((offset = zfFindWifiElement(dev, buf, 2, 1)) != 0xffff) + offset = zfFindWifiElement(dev, buf, 2, 1); + if (offset != 0xffff) { apQosInfo = zmw_rx_buf_readb(dev, buf, offset+8) & 0x80; pBssInfo->wmeSupport = 1 | apQosInfo; @@ -1742,7 +1764,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, } } //CWYang(+) - if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY)) != 0xffff) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY); + if (offset != 0xffff) { /* 11n AP */ pBssInfo->EnableHT = 1; @@ -1792,7 +1815,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, pBssInfo->EnableHT = 0; } /* HT information */ - if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY)) != 0xffff) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY); + if (offset != 0xffff) { /* atheros pre n */ pBssInfo->extChOffset = zmw_rx_buf_readb(dev, buf, offset+2) & 0x03; @@ -1848,7 +1872,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, } /* get Marvel Extended Capability */ - if ((offset = zfFindMarvelExtCap(dev, buf)) != 0xffff) + offset = zfFindMarvelExtCap(dev, buf); + if (offset != 0xffff) { pBssInfo->marvelAp = 1; } @@ -1858,7 +1883,8 @@ u8_t zfStaInitBssInfo(zdev_t* dev, zbuf_t* buf, } /* get ATIM window */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_IBSS)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_IBSS); + if (offset != 0xffff ) { pBssInfo->atimWindow = zmw_rx_buf_readh(dev, buf,offset+2); } @@ -2017,7 +2043,8 @@ zlUpdateRssi: pBssInfo->tick = wd->tick; /* Update ERP information */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_ERP)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_ERP); + if (offset != 0xffff) { pBssInfo->erp = zmw_rx_buf_readb(dev, buf, offset+2); } @@ -2116,7 +2143,8 @@ void zfStaProcessBeacon(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInfo #if 0 else if ( wd->sta.oppositeCount == 0 ) { /* IBSS merge if SSID matched */ - if ( (offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID)) != 0xffff ) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID); + if (offset != 0xffff) { if ( (wd->sta.ssidLen == zmw_buf_readb(dev, buf, offset+1))&& (zfRxBufferEqualToStr(dev, buf, wd->sta.ssid, @@ -2410,7 +2438,8 @@ void zfStaProcessAsocRsp(zdev_t* dev, zbuf_t* buf) if ((wd->sta.wmeEnabled & ZM_STA_WME_ENABLE_BIT) != 0) //WME enabled { /* Asoc rsp may contain WME parameter element */ - if ((offset = zfFindWifiElement(dev, buf, 2, 1)) != 0xffff) + offset = zfFindWifiElement(dev, buf, 2, 1); + if (offset != 0xffff) { zm_debug_msg0("WME enable"); wd->sta.wmeConnected = 1; @@ -2605,7 +2634,8 @@ void zfStaStoreAsocRspIe(zdev_t* dev, zbuf_t* buf) return; } - if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY)) != 0xffff) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_HT_CAPABILITY); + if (offset != 0xffff) { /* atheros pre n */ zm_debug_msg0("atheros pre n"); @@ -2645,7 +2675,8 @@ void zfStaStoreAsocRspIe(zdev_t* dev, zbuf_t* buf) asocBw40 = (u8_t)((wd->sta.ie.HtCap.HtCapInfo & HTCAP_SupChannelWidthSet) >> 1); /* HT information */ - if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY)) != 0xffff) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_EXTENDED_HT_CAPABILITY); + if (offset != 0xffff) { /* atheros pre n */ zm_debug_msg0("atheros pre n HTINFO"); @@ -2815,7 +2846,8 @@ void zfStaProcessProbeReq(zdev_t* dev, zbuf_t* buf, u16_t* src) } /* check SSID */ - if ((offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID)) == 0xffff) + offset = zfFindElement(dev, buf, ZM_WLAN_EID_SSID); + if (offset == 0xffff) { zm_msg0_mm(ZM_LV_3, "probe req SSID not found"); return; @@ -3774,7 +3806,8 @@ static struct zsBssInfo* zfInfraFindAPToConnect(zdev_t* dev, } /* Skip if AP in blocking list */ - if ((ret = zfStaIsApInBlockingList(dev, pBssInfo->bssid)) == TRUE) + ret = zfStaIsApInBlockingList(dev, pBssInfo->bssid); + if (ret == TRUE) { zm_msg0_mm(ZM_LV_0, "Candidate AP in blocking List, skip if there's stilla choice!"); pNowBssInfo = pBssInfo; @@ -5007,7 +5040,8 @@ void zfSendNullData(zdev_t* dev, u8_t type) zmw_get_wlan_dev(dev); - if ((buf = zfwBufAllocate(dev, 1024)) == NULL) + buf = zfwBufAllocate(dev, 1024); + if (buf == NULL) { zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!"); return; @@ -5056,8 +5090,9 @@ void zfSendNullData(zdev_t* dev, u8_t type) /*increase unicast frame counter*/ wd->commTally.txUnicastFrm++; - if ((err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0, - ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS) + err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0, + ZM_INTERNAL_ALLOC_BUF, 0, 0xff); + if (err != ZM_SUCCESS) { goto zlError; } @@ -5083,7 +5118,8 @@ void zfSendPSPoll(zdev_t* dev) zmw_get_wlan_dev(dev); - if ((buf = zfwBufAllocate(dev, 1024)) == NULL) + buf = zfwBufAllocate(dev, 1024); + if (buf == NULL) { zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!"); return; @@ -5107,8 +5143,9 @@ void zfSendPSPoll(zdev_t* dev) // goto zlError; //} - if ((err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0, - ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS) + err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0, + ZM_INTERNAL_ALLOC_BUF, 0, 0xff); + if (err != ZM_SUCCESS) { goto zlError; } @@ -5134,7 +5171,8 @@ void zfSendBA(zdev_t* dev, u16_t start_seq, u8_t *bitmap) zmw_get_wlan_dev(dev); - if ((buf = zfwBufAllocate(dev, 1024)) == NULL) + buf = zfwBufAllocate(dev, 1024); + if (buf == NULL) { zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!"); return; @@ -5166,8 +5204,9 @@ void zfSendBA(zdev_t* dev, u16_t start_seq, u8_t *bitmap) offset++; } - if ((err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0, - ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS) + err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0, + ZM_INTERNAL_ALLOC_BUF, 0, 0xff); + if (err != ZM_SUCCESS) { goto zlError; } |