Commit 285b7c00 authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

staging: rtl8192e: Fix UNNECESSARY_ELSE warning

Fix checkpatch warnings 'else is not generally useful after a break or return'
Signed-off-by: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 28eb1f3b
......@@ -2025,6 +2025,7 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev,
struct sk_buff *skb)
{
struct r8192_priv *priv = rtllib_priv(dev);
struct rx_fwinfo *pDrvInfo = NULL;
stats->bICV = pdesc->ICV;
stats->bCRC = pdesc->CRC32;
......@@ -2046,51 +2047,49 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev,
priv->stats.rxcrcerrmid++;
}
return false;
} else {
struct rx_fwinfo *pDrvInfo = NULL;
}
stats->RxDrvInfoSize = pdesc->RxDrvInfoSize;
stats->RxBufShift = ((pdesc->Shift)&0x03);
stats->Decrypted = !pdesc->SWDec;
stats->RxDrvInfoSize = pdesc->RxDrvInfoSize;
stats->RxBufShift = ((pdesc->Shift)&0x03);
stats->Decrypted = !pdesc->SWDec;
pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift);
pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift);
stats->rate = HwRateToMRate90((bool)pDrvInfo->RxHT,
(u8)pDrvInfo->RxRate);
stats->bShortPreamble = pDrvInfo->SPLCP;
stats->rate = HwRateToMRate90((bool)pDrvInfo->RxHT,
(u8)pDrvInfo->RxRate);
stats->bShortPreamble = pDrvInfo->SPLCP;
rtl8192_UpdateReceivedRateHistogramStatistics(dev, stats);
rtl8192_UpdateReceivedRateHistogramStatistics(dev, stats);
stats->bIsAMPDU = (pDrvInfo->PartAggr == 1);
stats->bFirstMPDU = (pDrvInfo->PartAggr == 1) &&
(pDrvInfo->FirstAGGR == 1);
stats->bIsAMPDU = (pDrvInfo->PartAggr == 1);
stats->bFirstMPDU = (pDrvInfo->PartAggr == 1) &&
(pDrvInfo->FirstAGGR == 1);
stats->TimeStampLow = pDrvInfo->TSFL;
stats->TimeStampHigh = read_nic_dword(dev, TSFR+4);
stats->TimeStampLow = pDrvInfo->TSFL;
stats->TimeStampHigh = read_nic_dword(dev, TSFR+4);
rtl819x_UpdateRxPktTimeStamp(dev, stats);
rtl819x_UpdateRxPktTimeStamp(dev, stats);
if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0)
stats->bShift = 1;
if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0)
stats->bShift = 1;
stats->RxIs40MHzPacket = pDrvInfo->BW;
stats->RxIs40MHzPacket = pDrvInfo->BW;
rtl8192_TranslateRxSignalStuff(dev, skb, stats, pdesc,
pDrvInfo);
rtl8192_TranslateRxSignalStuff(dev, skb, stats, pdesc,
pDrvInfo);
if (pDrvInfo->FirstAGGR == 1 || pDrvInfo->PartAggr == 1)
RT_TRACE(COMP_RXDESC,
"pDrvInfo->FirstAGGR = %d, pDrvInfo->PartAggr = %d\n",
pDrvInfo->FirstAGGR, pDrvInfo->PartAggr);
skb_trim(skb, skb->len - 4/*sCrcLng*/);
if (pDrvInfo->FirstAGGR == 1 || pDrvInfo->PartAggr == 1)
RT_TRACE(COMP_RXDESC,
"pDrvInfo->FirstAGGR = %d, pDrvInfo->PartAggr = %d\n",
pDrvInfo->FirstAGGR, pDrvInfo->PartAggr);
skb_trim(skb, skb->len - 4/*sCrcLng*/);
stats->packetlength = stats->Length-4;
stats->fraglength = stats->packetlength;
stats->fragoffset = 0;
stats->ntotalfrag = 1;
return true;
}
stats->packetlength = stats->Length-4;
stats->fraglength = stats->packetlength;
stats->fragoffset = 0;
stats->ntotalfrag = 1;
return true;
}
void rtl8192_halt_adapter(struct net_device *dev, bool reset)
......@@ -2314,8 +2313,7 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev)
(priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_20M)))) {
if (rx_chk_cnt < 2)
return bStuck;
else
rx_chk_cnt = 0;
rx_chk_cnt = 0;
} else if ((((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) &&
(priv->undecorated_smoothed_pwdb < RateAdaptiveTH_Low_40M)) ||
((priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) &&
......@@ -2323,13 +2321,11 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev)
priv->undecorated_smoothed_pwdb >= VeryLowRSSI) {
if (rx_chk_cnt < 4)
return bStuck;
else
rx_chk_cnt = 0;
rx_chk_cnt = 0;
} else {
if (rx_chk_cnt < 8)
return bStuck;
else
rx_chk_cnt = 0;
rx_chk_cnt = 0;
}
......
......@@ -940,13 +940,11 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel,
}
if (CurrentCmd && CurrentCmd->CmdID == CmdID_End) {
if ((*stage) == 2) {
if ((*stage) == 2)
return true;
} else {
(*stage)++;
(*step) = 0;
continue;
}
(*stage)++;
(*step) = 0;
continue;
}
if (!CurrentCmd)
......
......@@ -116,11 +116,10 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
__func__);
return;
} else {
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
up(&priv->rtllib->ips_sem);
}
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
up(&priv->rtllib->ips_sem);
}
}
priv->rtllib->is_set_key = true;
......
......@@ -204,19 +204,18 @@ u8 read_nic_io_byte(struct net_device *dev, int x)
bool bIsLegalPage = false;
u8 Data = 0;
if (u4bPage == 0) {
if (u4bPage == 0)
return 0xff&inb(dev->base_addr + x);
} else {
bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage,
&u1PageMask);
if (bIsLegalPage) {
u8 u1bPsr = read_nic_io_byte(dev, PSR);
write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) |
(u8)u4bPage));
Data = read_nic_io_byte(dev, (x & 0xff));
write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask));
}
bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage,
&u1PageMask);
if (bIsLegalPage) {
u8 u1bPsr = read_nic_io_byte(dev, PSR);
write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) |
(u8)u4bPage));
Data = read_nic_io_byte(dev, (x & 0xff));
write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask));
}
return Data;
......@@ -229,20 +228,17 @@ u16 read_nic_io_word(struct net_device *dev, int x)
bool bIsLegalPage = false;
u16 Data = 0;
if (u4bPage == 0) {
if (u4bPage == 0)
return inw(dev->base_addr + x);
} else {
bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage,
&u1PageMask);
if (bIsLegalPage) {
u8 u1bPsr = read_nic_io_byte(dev, PSR);
bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage,
&u1PageMask);
if (bIsLegalPage) {
u8 u1bPsr = read_nic_io_byte(dev, PSR);
write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) |
(u8)u4bPage));
Data = read_nic_io_word(dev, (x & 0xff));
write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask));
}
write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) |
(u8)u4bPage));
Data = read_nic_io_word(dev, (x & 0xff));
write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask));
}
return Data;
......@@ -255,20 +251,17 @@ u32 read_nic_io_dword(struct net_device *dev, int x)
bool bIsLegalPage = false;
u32 Data = 0;
if (u4bPage == 0) {
if (u4bPage == 0)
return inl(dev->base_addr + x);
} else {
bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage,
&u1PageMask);
if (bIsLegalPage) {
u8 u1bPsr = read_nic_io_byte(dev, PSR);
write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) |
(u8)u4bPage));
Data = read_nic_io_dword(dev, (x & 0xff));
write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask));
bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage,
&u1PageMask);
if (bIsLegalPage) {
u8 u1bPsr = read_nic_io_byte(dev, PSR);
}
write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) |
(u8)u4bPage));
Data = read_nic_io_dword(dev, (x & 0xff));
write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask));
}
return Data;
......@@ -1331,11 +1324,11 @@ static short rtl8192_init(struct net_device *dev)
dev->name, dev)) {
netdev_err(dev, "Error allocating IRQ %d", dev->irq);
return -1;
} else {
priv->irq = dev->irq;
RT_TRACE(COMP_INIT, "IRQ %d\n", dev->irq);
}
priv->irq = dev->irq;
RT_TRACE(COMP_INIT, "IRQ %d\n", dev->irq);
if (rtl8192_pci_initdescring(dev) != 0) {
netdev_err(dev, "Endopoints initialization failed");
free_irq(dev->irq, dev);
......@@ -1932,17 +1925,16 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (queue_index == TXCMD_QUEUE) {
rtl8192_tx_cmd(dev, skb);
return 0;
} else {
tcb_desc->RATRIndex = 7;
tcb_desc->bTxDisableRateFallBack = 1;
tcb_desc->bTxUseDriverAssingedRate = 1;
tcb_desc->bTxEnableFwCalcDur = 1;
skb_push(skb, priv->rtllib->tx_headroom);
ret = rtl8192_tx(dev, skb);
if (ret != 0)
kfree_skb(skb);
}
tcb_desc->RATRIndex = 7;
tcb_desc->bTxDisableRateFallBack = 1;
tcb_desc->bTxUseDriverAssingedRate = 1;
tcb_desc->bTxEnableFwCalcDur = 1;
skb_push(skb, priv->rtllib->tx_headroom);
ret = rtl8192_tx(dev, skb);
if (ret != 0)
kfree_skb(skb);
return ret;
}
......@@ -2338,76 +2330,73 @@ static void rtl8192_rx_normal(struct net_device *dev)
[priv->rx_idx[rx_queue_idx]];
struct sk_buff *skb = priv->rx_buf[rx_queue_idx]
[priv->rx_idx[rx_queue_idx]];
struct sk_buff *new_skb;
if (pdesc->OWN) {
if (pdesc->OWN)
return;
} else {
struct sk_buff *new_skb;
if (!priv->ops->rx_query_status_descriptor(dev, &stats,
pdesc, skb))
goto done;
new_skb = dev_alloc_skb(priv->rxbuffersize);
/* if allocation of new skb failed - drop current packet
* and reuse skb */
if (unlikely(!new_skb))
goto done;
pci_unmap_single(priv->pdev,
*((dma_addr_t *)skb->cb),
priv->rxbuffersize,
PCI_DMA_FROMDEVICE);
skb_put(skb, pdesc->Length);
skb_reserve(skb, stats.RxDrvInfoSize +
stats.RxBufShift);
skb_trim(skb, skb->len - 4/*sCrcLng*/);
rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data;
if (!is_multicast_ether_addr(rtllib_hdr->addr1)) {
/* unicast packet */
unicast_packet = true;
}
fc = le16_to_cpu(rtllib_hdr->frame_ctl);
type = WLAN_FC_GET_TYPE(fc);
if (type == RTLLIB_FTYPE_MGMT)
bLedBlinking = false;
if (bLedBlinking)
if (priv->rtllib->LedControlHandler)
priv->rtllib->LedControlHandler(dev,
LED_CTL_RX);
if (stats.bCRC) {
if (type != RTLLIB_FTYPE_MGMT)
priv->stats.rxdatacrcerr++;
else
priv->stats.rxmgmtcrcerr++;
}
skb_len = skb->len;
if (!priv->ops->rx_query_status_descriptor(dev, &stats,
pdesc, skb))
goto done;
new_skb = dev_alloc_skb(priv->rxbuffersize);
/* if allocation of new skb failed - drop current packet
* and reuse skb */
if (unlikely(!new_skb))
goto done;
pci_unmap_single(priv->pdev,
*((dma_addr_t *)skb->cb),
priv->rxbuffersize,
PCI_DMA_FROMDEVICE);
skb_put(skb, pdesc->Length);
skb_reserve(skb, stats.RxDrvInfoSize +
stats.RxBufShift);
skb_trim(skb, skb->len - 4/*sCrcLng*/);
rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data;
if (!is_multicast_ether_addr(rtllib_hdr->addr1)) {
/* unicast packet */
unicast_packet = true;
}
fc = le16_to_cpu(rtllib_hdr->frame_ctl);
type = WLAN_FC_GET_TYPE(fc);
if (type == RTLLIB_FTYPE_MGMT)
bLedBlinking = false;
if (bLedBlinking)
if (priv->rtllib->LedControlHandler)
priv->rtllib->LedControlHandler(dev,
LED_CTL_RX);
if (stats.bCRC) {
if (type != RTLLIB_FTYPE_MGMT)
priv->stats.rxdatacrcerr++;
else
priv->stats.rxmgmtcrcerr++;
}
if (!rtllib_rx(priv->rtllib, skb, &stats)) {
dev_kfree_skb_any(skb);
} else {
priv->stats.rxok++;
if (unicast_packet)
priv->stats.rxbytesunicast += skb_len;
}
skb_len = skb->len;
skb = new_skb;
skb->dev = dev;
if (!rtllib_rx(priv->rtllib, skb, &stats)) {
dev_kfree_skb_any(skb);
} else {
priv->stats.rxok++;
if (unicast_packet)
priv->stats.rxbytesunicast += skb_len;
}
priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] =
skb;
*((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev,
skb_tail_pointer_rsl(skb),
priv->rxbuffersize,
PCI_DMA_FROMDEVICE);
if (pci_dma_mapping_error(priv->pdev,
*((dma_addr_t *)skb->cb))) {
dev_kfree_skb_any(skb);
return;
}
skb = new_skb;
skb->dev = dev;
priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] =
skb;
*((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev,
skb_tail_pointer_rsl(skb),
priv->rxbuffersize,
PCI_DMA_FROMDEVICE);
if (pci_dma_mapping_error(priv->pdev,
*((dma_addr_t *)skb->cb))) {
dev_kfree_skb_any(skb);
return;
}
done:
pdesc->BufferAddress = *((dma_addr_t *)skb->cb);
......
This diff is collapsed.
......@@ -202,12 +202,11 @@ void rtllib_ips_leave_wq(struct net_device *dev)
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
__func__);
return;
} else {
netdev_info(dev, "=========>%s(): IPSLeave\n",
__func__);
queue_work_rsl(priv->rtllib->wq,
&priv->rtllib->ips_leave_wq);
}
netdev_info(dev, "=========>%s(): IPSLeave\n",
__func__);
queue_work_rsl(priv->rtllib->wq,
&priv->rtllib->ips_leave_wq);
}
}
}
......
......@@ -346,14 +346,12 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
__func__);
up(&priv->wx_sem);
return -1;
} else {
netdev_info(dev,
"=========>%s(): IPSLeave\n",
__func__);
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
up(&priv->rtllib->ips_sem);
}
netdev_info(dev, "=========>%s(): IPSLeave\n",
__func__);
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
up(&priv->rtllib->ips_sem);
}
}
}
......@@ -509,14 +507,12 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
__func__);
up(&priv->wx_sem);
return -1;
} else {
RT_TRACE(COMP_PS,
"=========>%s(): IPSLeave\n",
__func__);
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
up(&priv->rtllib->ips_sem);
}
RT_TRACE(COMP_PS, "=========>%s(): IPSLeave\n",
__func__);
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
up(&priv->rtllib->ips_sem);
}
}
rtllib_stop_scan(priv->rtllib);
......
......@@ -135,25 +135,22 @@ u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate)
u8 is40MHz = 0;
u8 isShortGI = 0;
if (nDataRate < 12) {
if (nDataRate < 12)
return CCKOFDMRate[nDataRate];
} else {
if (nDataRate >= 0x10 && nDataRate <= 0x1f) {
is40MHz = 0;
isShortGI = 0;
} else if (nDataRate >= 0x20 && nDataRate <= 0x2f) {
is40MHz = 1;
isShortGI = 0;
} else if (nDataRate >= 0x30 && nDataRate <= 0x3f) {
is40MHz = 0;
isShortGI = 1;
} else if (nDataRate >= 0x40 && nDataRate <= 0x4f) {
is40MHz = 1;
isShortGI = 1;
}
return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf];
if (nDataRate >= 0x10 && nDataRate <= 0x1f) {
is40MHz = 0;
isShortGI = 0;
} else if (nDataRate >= 0x20 && nDataRate <= 0x2f) {
is40MHz = 1;
isShortGI = 0;
} else if (nDataRate >= 0x30 && nDataRate <= 0x3f) {
is40MHz = 0;
isShortGI = 1;
} else if (nDataRate >= 0x40 && nDataRate <= 0x4f) {
is40MHz = 1;
isShortGI = 1;
}
return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf];
}
bool IsHTHalfNmodeAPs(struct rtllib_device *ieee)
......
......@@ -311,6 +311,11 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
u8 *Addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs)
{
u8 UP = 0;
union tspec_body TSpec;
union qos_tsinfo *pTSInfo = &TSpec.f.TSInfo;
struct list_head *pUnusedList;
struct list_head *pAddmitList;
enum direction_value Dir;
if (is_multicast_ether_addr(Addr)) {
RTLLIB_DEBUG(RTLLIB_DL_ERR,
......@@ -348,75 +353,70 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
}
*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
if (*ppTS != NULL) {
if (*ppTS != NULL)
return true;
} else {
if (!bAddNewTs) {
RTLLIB_DEBUG(RTLLIB_DL_TS,
"add new TS failed(tid:%d)\n", UP);
return false;
} else {
union tspec_body TSpec;
union qos_tsinfo *pTSInfo = &TSpec.f.TSInfo;
struct list_head *pUnusedList =
(TxRxSelect == TX_DIR) ?
if (!bAddNewTs) {
RTLLIB_DEBUG(RTLLIB_DL_TS,
"add new TS failed(tid:%d)\n", UP);
return false;
}
pUnusedList = (TxRxSelect == TX_DIR) ?
(&ieee->Tx_TS_Unused_List) :
(&ieee->Rx_TS_Unused_List);
struct list_head *pAddmitList =
(TxRxSelect == TX_DIR) ?
pAddmitList = (TxRxSelect == TX_DIR) ?
(&ieee->Tx_TS_Admit_List) :
(&ieee->Rx_TS_Admit_List);
enum direction_value Dir =
(ieee->iw_mode == IW_MODE_MASTER) ?
((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) :
((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN);
RTLLIB_DEBUG(RTLLIB_DL_TS, "to add Ts\n");
if (!list_empty(pUnusedList)) {
(*ppTS) = list_entry(pUnusedList->next,
struct ts_common_info, List);
list_del_init(&(*ppTS)->List);
if (TxRxSelect == TX_DIR) {
struct tx_ts_record *tmp =
container_of(*ppTS,
struct tx_ts_record,
TsCommonInfo);
ResetTxTsEntry(tmp);
} else {
struct rx_ts_record *tmp =
container_of(*ppTS,
struct rx_ts_record,
TsCommonInfo);
ResetRxTsEntry(tmp);
}
RTLLIB_DEBUG(RTLLIB_DL_TS,
"to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n",
UP, Dir, Addr, *ppTS);
pTSInfo->field.ucTrafficType = 0;
pTSInfo->field.ucTSID = UP;
pTSInfo->field.ucDirection = Dir;
pTSInfo->field.ucAccessPolicy = 1;
pTSInfo->field.ucAggregation = 0;
pTSInfo->field.ucPSB = 0;
pTSInfo->field.ucUP = UP;
pTSInfo->field.ucTSInfoAckPolicy = 0;
pTSInfo->field.ucSchedule = 0;
MakeTSEntry(*ppTS, Addr, &TSpec, NULL, 0, 0);
AdmitTS(ieee, *ppTS, 0);
list_add_tail(&((*ppTS)->List), pAddmitList);
return true;
} else {
RTLLIB_DEBUG(RTLLIB_DL_ERR,
"ERR!!in function %s() There is not enough dir=%d(0=up down=1) TS record to be used!!",
__func__, Dir);
return false;
}
Dir = (ieee->iw_mode == IW_MODE_MASTER) ?
((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) :
((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN);
RTLLIB_DEBUG(RTLLIB_DL_TS, "to add Ts\n");
if (!list_empty(pUnusedList)) {
(*ppTS) = list_entry(pUnusedList->next,
struct ts_common_info, List);
list_del_init(&(*ppTS)->List);
if (TxRxSelect == TX_DIR) {
struct tx_ts_record *tmp =
container_of(*ppTS,
struct tx_ts_record,
TsCommonInfo);
ResetTxTsEntry(tmp);
} else {
struct rx_ts_record *tmp =
container_of(*ppTS,
struct rx_ts_record,
TsCommonInfo);
ResetRxTsEntry(tmp);
}
RTLLIB_DEBUG(RTLLIB_DL_TS,
"to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n",
UP, Dir, Addr, *ppTS);
pTSInfo->field.ucTrafficType = 0;
pTSInfo->field.ucTSID = UP;
pTSInfo->field.ucDirection = Dir;
pTSInfo->field.ucAccessPolicy = 1;
pTSInfo->field.ucAggregation = 0;
pTSInfo->field.ucPSB = 0;
pTSInfo->field.ucUP = UP;
pTSInfo->field.ucTSInfoAckPolicy = 0;
pTSInfo->field.ucSchedule = 0;
MakeTSEntry(*ppTS, Addr, &TSpec, NULL, 0, 0);
AdmitTS(ieee, *ppTS, 0);
list_add_tail(&((*ppTS)->List), pAddmitList);
return true;
}
RTLLIB_DEBUG(RTLLIB_DL_ERR,
"ERR!!in function %s() There is not enough dir=%d(0=up down=1) TS record to be used!!",
__func__, Dir);
return false;
}
static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs,
......
......@@ -783,74 +783,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)) {
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;
}
}
/* 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);
/* 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 < (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;
}
/* 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);
/* move the data point to data content */
skb_pull(skb, ETHERNET_HEADER_SIZE);
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);
if (skb->len != 0) {
nPadding_Length = 4 - ((nSubframe_Length +
ETHERNET_HEADER_SIZE) % 4);
if (nPadding_Length == 4)
nPadding_Length = 0;
return rxb->nr_subframes;
if (skb->len < nPadding_Length)
return 0;
skb_pull(skb, nPadding_Length);
}
}
return rxb->nr_subframes;
}
......
......@@ -2540,13 +2540,12 @@ static void rtllib_resume_tx(struct rtllib_device *ieee)
if (ieee->queue_stop) {
ieee->tx_pending.frag = i;
return;
} else {
ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev, ieee->rate);
ieee->stats.tx_packets++;
}
ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev, ieee->rate);
ieee->stats.tx_packets++;
}
rtllib_txb_free(ieee->tx_pending.txb);
......
......@@ -413,6 +413,8 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee,
struct cb_desc *tcb_desc,
struct sk_buff *skb)
{
struct rt_hi_throughput *pHTInfo;
tcb_desc->bRTSSTBC = false;
tcb_desc->bRTSUseShortGI = false;
tcb_desc->bCTSEnable = false;
......@@ -435,50 +437,50 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee,
tcb_desc->rts_rate = MGN_24M;
}
return;
} else {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
}
while (true) {
if (pHTInfo->IOTAction & HT_IOT_ACT_FORCED_CTS2SELF) {
tcb_desc->bCTSEnable = true;
tcb_desc->rts_rate = MGN_24M;
tcb_desc->bRTSEnable = true;
break;
} else if (pHTInfo->IOTAction & (HT_IOT_ACT_FORCED_RTS |
HT_IOT_ACT_PURE_N_MODE)) {
tcb_desc->bRTSEnable = true;
tcb_desc->rts_rate = MGN_24M;
break;
}
if (ieee->current_network.buseprotection) {
tcb_desc->bRTSEnable = true;
tcb_desc->bCTSEnable = true;
tcb_desc->rts_rate = MGN_24M;
break;
}
if (pHTInfo->bCurrentHTSupport && pHTInfo->bEnableHT) {
u8 HTOpMode = pHTInfo->CurrentOpMode;
if ((pHTInfo->bCurBW40MHz && (HTOpMode == 2 ||
HTOpMode == 3)) ||
(!pHTInfo->bCurBW40MHz && HTOpMode == 3)) {
tcb_desc->rts_rate = MGN_24M;
tcb_desc->bRTSEnable = true;
break;
}
}
if (skb->len > ieee->rts) {
pHTInfo = ieee->pHTInfo;
while (true) {
if (pHTInfo->IOTAction & HT_IOT_ACT_FORCED_CTS2SELF) {
tcb_desc->bCTSEnable = true;
tcb_desc->rts_rate = MGN_24M;
tcb_desc->bRTSEnable = true;
break;
} else if (pHTInfo->IOTAction & (HT_IOT_ACT_FORCED_RTS |
HT_IOT_ACT_PURE_N_MODE)) {
tcb_desc->bRTSEnable = true;
tcb_desc->rts_rate = MGN_24M;
break;
}
if (ieee->current_network.buseprotection) {
tcb_desc->bRTSEnable = true;
tcb_desc->bCTSEnable = true;
tcb_desc->rts_rate = MGN_24M;
break;
}
if (pHTInfo->bCurrentHTSupport && pHTInfo->bEnableHT) {
u8 HTOpMode = pHTInfo->CurrentOpMode;
if ((pHTInfo->bCurBW40MHz && (HTOpMode == 2 ||
HTOpMode == 3)) ||
(!pHTInfo->bCurBW40MHz && HTOpMode == 3)) {
tcb_desc->rts_rate = MGN_24M;
tcb_desc->bRTSEnable = true;
break;
}
if (tcb_desc->bAMPDUEnable) {
tcb_desc->rts_rate = MGN_24M;
tcb_desc->bRTSEnable = false;
break;
}
goto NO_PROTECTION;
}
if (skb->len > ieee->rts) {
tcb_desc->rts_rate = MGN_24M;
tcb_desc->bRTSEnable = true;
break;
}
if (tcb_desc->bAMPDUEnable) {
tcb_desc->rts_rate = MGN_24M;
tcb_desc->bRTSEnable = false;
break;
}
goto NO_PROTECTION;
}
if (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
tcb_desc->bUseShortPreamble = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment