Commit 067ba6cf authored by Mike McCormack's avatar Mike McCormack Committed by Greg Kroah-Hartman

Staging: rtl8192e: Clean formatting in rtl8192_tx()

Signed-off-by: default avatarMike McCormack <mikem@ring3k.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4b37700d
...@@ -1378,12 +1378,13 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) ...@@ -1378,12 +1378,13 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
tx_desc_819x_pci *pdesc = NULL; tx_desc_819x_pci *pdesc = NULL;
TX_FWINFO_8190PCI *pTxFwInfo = NULL; TX_FWINFO_8190PCI *pTxFwInfo = NULL;
dma_addr_t mapping; dma_addr_t mapping;
bool multi_addr=false,broad_addr=false,uni_addr=false; bool multi_addr = false, broad_addr = false, uni_addr = false;
u8* pda_addr = NULL; u8 *pda_addr = NULL;
int idx; int idx;
if(priv->bdisable_nic){ if (priv->bdisable_nic) {
RT_TRACE(COMP_ERR,"%s: ERR!! Nic is disabled! Can't tx packet len=%d qidx=%d!!!\n", __FUNCTION__, skb->len, tcb_desc->queue_index); RT_TRACE(COMP_ERR, "Nic is disabled! Can't tx packet len=%d qidx=%d!!!\n",
skb->len, tcb_desc->queue_index);
return skb->len; return skb->len;
} }
...@@ -1392,32 +1393,33 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) ...@@ -1392,32 +1393,33 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
#endif #endif
mapping = pci_map_single(priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); mapping = pci_map_single(priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
/* collect the tx packets statitcs */ /* collect the tx packets statitcs */
pda_addr = ((u8*)skb->data) + sizeof(TX_FWINFO_8190PCI); pda_addr = ((u8 *)skb->data) + sizeof(TX_FWINFO_8190PCI);
if(is_multicast_ether_addr(pda_addr)) if (is_multicast_ether_addr(pda_addr))
multi_addr = true; multi_addr = true;
else if(is_broadcast_ether_addr(pda_addr)) else if (is_broadcast_ether_addr(pda_addr))
broad_addr = true; broad_addr = true;
else else
uni_addr = true; uni_addr = true;
if(uni_addr) if (uni_addr)
priv->stats.txbytesunicast += (u8)(skb->len) - sizeof(TX_FWINFO_8190PCI); priv->stats.txbytesunicast += (u8)(skb->len) - sizeof(TX_FWINFO_8190PCI);
else if(multi_addr) else if (multi_addr)
priv->stats.txbytesmulticast +=(u8)(skb->len) - sizeof(TX_FWINFO_8190PCI); priv->stats.txbytesmulticast += (u8)(skb->len) - sizeof(TX_FWINFO_8190PCI);
else else
priv->stats.txbytesbroadcast += (u8)(skb->len) - sizeof(TX_FWINFO_8190PCI); priv->stats.txbytesbroadcast += (u8)(skb->len) - sizeof(TX_FWINFO_8190PCI);
/* fill tx firmware */ /* fill tx firmware */
pTxFwInfo = (PTX_FWINFO_8190PCI)skb->data; pTxFwInfo = (PTX_FWINFO_8190PCI)skb->data;
memset(pTxFwInfo,0,sizeof(TX_FWINFO_8190PCI)); memset(pTxFwInfo, 0, sizeof(TX_FWINFO_8190PCI));
pTxFwInfo->TxHT = (tcb_desc->data_rate&0x80)?1:0; pTxFwInfo->TxHT = (tcb_desc->data_rate&0x80) ? 1 : 0;
pTxFwInfo->TxRate = MRateToHwRate8190Pci((u8)tcb_desc->data_rate); pTxFwInfo->TxRate = MRateToHwRate8190Pci((u8)tcb_desc->data_rate);
pTxFwInfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur; pTxFwInfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur;
pTxFwInfo->Short = QueryIsShort(pTxFwInfo->TxHT, pTxFwInfo->TxRate, tcb_desc); pTxFwInfo->Short = QueryIsShort(pTxFwInfo->TxHT, pTxFwInfo->TxRate, tcb_desc);
/* Aggregation related */ /* Aggregation related */
if(tcb_desc->bAMPDUEnable) { if (tcb_desc->bAMPDUEnable) {
pTxFwInfo->AllowAggregation = 1; pTxFwInfo->AllowAggregation = 1;
pTxFwInfo->RxMF = tcb_desc->ampdu_factor; pTxFwInfo->RxMF = tcb_desc->ampdu_factor;
pTxFwInfo->RxAMD = tcb_desc->ampdu_density; pTxFwInfo->RxAMD = tcb_desc->ampdu_density;
...@@ -1427,33 +1429,27 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) ...@@ -1427,33 +1429,27 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
pTxFwInfo->RxAMD = 0; pTxFwInfo->RxAMD = 0;
} }
// /* Protection mode related */
// Protection mode related pTxFwInfo->RtsEnable = (tcb_desc->bRTSEnable) ? 1 : 0;
// pTxFwInfo->CtsEnable = (tcb_desc->bCTSEnable) ? 1 : 0;
pTxFwInfo->RtsEnable = (tcb_desc->bRTSEnable)?1:0; pTxFwInfo->RtsSTBC = (tcb_desc->bRTSSTBC) ? 1 : 0;
pTxFwInfo->CtsEnable = (tcb_desc->bCTSEnable)?1:0; pTxFwInfo->RtsHT = (tcb_desc->rts_rate&0x80) ? 1 : 0;
pTxFwInfo->RtsSTBC = (tcb_desc->bRTSSTBC)?1:0;
pTxFwInfo->RtsHT= (tcb_desc->rts_rate&0x80)?1:0;
pTxFwInfo->RtsRate = MRateToHwRate8190Pci((u8)tcb_desc->rts_rate); pTxFwInfo->RtsRate = MRateToHwRate8190Pci((u8)tcb_desc->rts_rate);
pTxFwInfo->RtsBandwidth = 0; pTxFwInfo->RtsBandwidth = 0;
pTxFwInfo->RtsSubcarrier = tcb_desc->RTSSC; pTxFwInfo->RtsSubcarrier = tcb_desc->RTSSC;
pTxFwInfo->RtsShort = (pTxFwInfo->RtsHT==0)?(tcb_desc->bRTSUseShortPreamble?1:0):(tcb_desc->bRTSUseShortGI?1:0); pTxFwInfo->RtsShort = (pTxFwInfo->RtsHT == 0) ? (tcb_desc->bRTSUseShortPreamble ? 1 : 0) : (tcb_desc->bRTSUseShortGI? 1 : 0);
//
// Set Bandwidth and sub-channel settings. /* Set Bandwidth and sub-channel settings. */
// if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) {
if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) if (tcb_desc->bPacketBW) {
{
if(tcb_desc->bPacketBW)
{
pTxFwInfo->TxBandwidth = 1; pTxFwInfo->TxBandwidth = 1;
#ifdef RTL8190P #ifdef RTL8190P
pTxFwInfo->TxSubCarrier = 3; pTxFwInfo->TxSubCarrier = 3;
#else #else
pTxFwInfo->TxSubCarrier = 0; //By SD3's Jerry suggestion, use duplicated mode, cosa 04012008 /* use duplicated mode */
pTxFwInfo->TxSubCarrier = 0;
#endif #endif
} } else {
else
{
pTxFwInfo->TxBandwidth = 0; pTxFwInfo->TxBandwidth = 0;
pTxFwInfo->TxSubCarrier = priv->nCur40MhzPrimeSC; pTxFwInfo->TxSubCarrier = priv->nCur40MhzPrimeSC;
} }
...@@ -1462,35 +1458,34 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) ...@@ -1462,35 +1458,34 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
pTxFwInfo->TxSubCarrier = 0; pTxFwInfo->TxSubCarrier = 0;
} }
spin_lock_irqsave(&priv->irq_th_lock,flags); spin_lock_irqsave(&priv->irq_th_lock, flags);
ring = &priv->tx_ring[tcb_desc->queue_index]; ring = &priv->tx_ring[tcb_desc->queue_index];
if (tcb_desc->queue_index != BEACON_QUEUE) { if (tcb_desc->queue_index != BEACON_QUEUE)
idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries;
} else { else
idx = 0; idx = 0;
}
pdesc = &ring->desc[idx]; pdesc = &ring->desc[idx];
if((pdesc->OWN == 1) && (tcb_desc->queue_index != BEACON_QUEUE)) { if ((pdesc->OWN == 1) && (tcb_desc->queue_index != BEACON_QUEUE)) {
RT_TRACE(COMP_ERR,"No more TX desc@%d, ring->idx = %d,idx = %d,%x", RT_TRACE(COMP_ERR, "No more TX desc@%d, ring->idx = %d,idx = %d,%x",
tcb_desc->queue_index,ring->idx, idx,skb->len); tcb_desc->queue_index, ring->idx, idx, skb->len);
spin_unlock_irqrestore(&priv->irq_th_lock,flags); spin_unlock_irqrestore(&priv->irq_th_lock, flags);
return skb->len; return skb->len;
} }
/* fill tx descriptor */ /* fill tx descriptor */
memset((u8*)pdesc,0,12); memset(pdesc, 0, 12);
/*DWORD 0*/ /*DWORD 0*/
pdesc->LINIP = 0; pdesc->LINIP = 0;
pdesc->CmdInit = 1; pdesc->CmdInit = 1;
pdesc->Offset = sizeof(TX_FWINFO_8190PCI) + 8; //We must add 8!! Emily pdesc->Offset = sizeof(TX_FWINFO_8190PCI) + 8; /* We must add 8!! */
pdesc->PktSize = (u16)skb->len-sizeof(TX_FWINFO_8190PCI); pdesc->PktSize = (u16)skb->len-sizeof(TX_FWINFO_8190PCI);
/*DWORD 1*/ /*DWORD 1*/
pdesc->SecCAMID= 0; pdesc->SecCAMID = 0;
pdesc->RATid = tcb_desc->RATRIndex; pdesc->RATid = tcb_desc->RATRIndex;
pdesc->NoEnc = 1; pdesc->NoEnc = 1;
pdesc->SecType = 0x0; pdesc->SecType = 0x0;
if (tcb_desc->bHwSec) { if (tcb_desc->bHwSec) {
...@@ -1515,9 +1510,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) ...@@ -1515,9 +1510,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
} }
} }
// /* Set Packet ID */
// Set Packet ID
//
pdesc->PktId = 0x0; pdesc->PktId = 0x0;
pdesc->QueueSelect = MapHwQueueToFirmwareQueue(tcb_desc->queue_index); pdesc->QueueSelect = MapHwQueueToFirmwareQueue(tcb_desc->queue_index);
...@@ -1526,16 +1519,16 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) ...@@ -1526,16 +1519,16 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
pdesc->DISFB = tcb_desc->bTxDisableRateFallBack; pdesc->DISFB = tcb_desc->bTxDisableRateFallBack;
pdesc->USERATE = tcb_desc->bTxUseDriverAssingedRate; pdesc->USERATE = tcb_desc->bTxUseDriverAssingedRate;
pdesc->FirstSeg =1; pdesc->FirstSeg = 1;
pdesc->LastSeg = 1; pdesc->LastSeg = 1;
pdesc->TxBufferSize = skb->len; pdesc->TxBufferSize = skb->len;
pdesc->TxBuffAddr = cpu_to_le32(mapping); pdesc->TxBuffAddr = cpu_to_le32(mapping);
__skb_queue_tail(&ring->queue, skb); __skb_queue_tail(&ring->queue, skb);
pdesc->OWN = 1; pdesc->OWN = 1;
spin_unlock_irqrestore(&priv->irq_th_lock,flags); spin_unlock_irqrestore(&priv->irq_th_lock, flags);
dev->trans_start = jiffies; dev->trans_start = jiffies;
write_nic_word(dev,TPPoll,0x01<<tcb_desc->queue_index); write_nic_word(dev, TPPoll, 0x01<<tcb_desc->queue_index);
return 0; return 0;
} }
......
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