--- a/rt2860pci.c +++ b/rt2860pci.c @@ -73,15 +73,14 @@ static struct pci_driver rt2860_pci_driv /* Callbacks from mac80211 */ static int rt2860_tx(struct ieee80211_hw *hw, - struct sk_buff *skb, - struct ieee80211_tx_control *control); + struct sk_buff *skb); static int rt2860_start(struct ieee80211_hw *hw); static void rt2860_stop(struct ieee80211_hw *hw); static int rt2860_add_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf); static void rt2860_remove_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf); -static int rt2860_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); +static int rt2860_config(struct ieee80211_hw *hw, u32 changed); static int rt2860_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_if_conf *conf); @@ -393,6 +392,7 @@ static void rt2860_rxring_handle(struct void *pNewPacket; void *AllocVa; dma_addr_t AllocPa; + int rx_status_ssi; pRxRing = &pAd->RxRing; RTMP_IO_READ32(pAd, RX_DRX_IDX , &pRxRing->RxDmaIdx); @@ -445,13 +445,13 @@ static void rt2860_rxring_handle(struct skb_put(skb,pRxWI->MPDUtotalByteCount + RXWI_SIZE); skb_pull(skb,RXWI_SIZE); - rx_status.ssi = max((int) ConvertToRssi(pAd, \ + rx_status_ssi = max((int) ConvertToRssi(pAd, \ (CHAR) pRxWI->RSSI0, (UCHAR) 0), (int) ConvertToRssi(pAd, \ (CHAR) pRxWI->RSSI1, (UCHAR) 1)); - rx_status.ssi = max(rx_status.ssi,(int) ConvertToRssi(pAd, \ + rx_status_ssi = max(rx_status_ssi,(int) ConvertToRssi(pAd, \ (CHAR) pRxWI->RSSI2, (UCHAR) 2)); - rx_status.signal = ConvertRssiToSignalQuality(rx_status.ssi); + rx_status.signal = ConvertRssiToSignalQuality(rx_status_ssi); if(pAd->signalQuality !=0) rx_status.signal = (unsigned int)((pAd->signalQuality + rx_status.signal + 1) / 2); @@ -492,9 +492,9 @@ static void rt2860_txring_handle(struct RTMP_DMACB *pCell; PTXWI_STRUC pTxWI; PTXD_STRUC pTxD; - struct ieee80211_tx_status tx_status; RTMP_TX_RING *pTxRing = NULL; - + struct ieee80211_tx_info *info; + while (1) { RTMP_IO_READ32(pAd, TX_STA_FIFO, &StaFifo.word); @@ -512,54 +512,45 @@ static void rt2860_txring_handle(struct pCell = &pTxRing->Cell[pTxRing->TxDmaIdx]; pTxWI = (TXWI_STRUC *) pCell->skb->data; - memset(&tx_status, 0, sizeof(tx_status)); while (pTxWI->PacketId != (USHORT) pid) { DBGPRINT_TX(DEBUG_TRACE, ("Different:TxWI->PacketId=%d,pid= %d\n",pTxWI->PacketId, pid)); - memcpy(&tx_status.control, &pCell->tx_control,sizeof(pCell->tx_control)); - if (!(tx_status.control.flags & IEEE80211_TXCTL_NO_ACK)) { - tx_status.excessive_retries = 1; - } - tx_status.retry_count = pTxWI->MCS; + info = IEEE80211_SKB_CB(pCell->skb); + ieee80211_tx_info_clear_status(info); + info->status.rates[0].count = pTxWI->MCS; pTxD = (PTXD_STRUC) pCell->AllocVa; - pci_unmap_single(pAd->pdev, pTxD->SDPtr1, pTxD->SDLen1 , PCI_DMA_FROMDEVICE); + pci_unmap_single(pAd->pdev, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); skb_pull(pCell->skb,TXWI_SIZE); pTxD->DMADONE = 1; pTxRing->TxDmaIdx = (pTxRing->TxDmaIdx + 1) % TX_RING_SIZE; pTxRing->TxSwFreeIdx = (pTxRing->TxSwFreeIdx + 1) % TX_RING_SIZE; pAd->lastPacketId = pid; - ieee80211_tx_status_irqsafe(hw, pCell->skb, &tx_status); + ieee80211_tx_status_irqsafe(hw, pCell->skb); pCell = &pTxRing->Cell[pTxRing->TxDmaIdx]; pTxWI = (TXWI_STRUC *) pCell->skb->data; } if (pTxWI->PacketId == (USHORT) pid) { - memcpy(&tx_status.control, &pCell->tx_control,sizeof(pCell->tx_control)); - if (!(tx_status.control.flags & IEEE80211_TXCTL_NO_ACK)) { + info = IEEE80211_SKB_CB(pCell->skb); + ieee80211_tx_info_clear_status(info); + info->status.rates[0].count = pTxWI->MCS; + if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { if (StaFifo.field.TxSuccess) { - tx_status.flags = IEEE80211_TX_STATUS_ACK; - } else { - tx_status.excessive_retries = 1; + info->flags |= IEEE80211_TX_STAT_ACK; } - tx_status.retry_count = pTxWI->MCS - SuccessRate; - if (tx_status.retry_count > 1) { - DBGPRINT_TX(DEBUG_TRACE, - ("PacketId=%d,Request MCS=%d,Send MCS=%d, Rerty=%d\n", \ - pTxWI->PacketId,pTxWI->MCS,SuccessRate,tx_status.retry_count)); - } - + info->status.rates[0].count = pTxWI->MCS - SuccessRate; } pTxD = (PTXD_STRUC) pCell->AllocVa; - pci_unmap_single(pAd->pdev, pTxD->SDPtr1, pTxD->SDLen1 , PCI_DMA_FROMDEVICE); + pci_unmap_single(pAd->pdev, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); skb_pull(pCell->skb,TXWI_SIZE); pTxD->DMADONE = 1; pTxRing->TxDmaIdx = (pTxRing->TxDmaIdx + 1) % TX_RING_SIZE; pTxRing->TxSwFreeIdx = (pTxRing->TxSwFreeIdx + 1) % TX_RING_SIZE; pAd->lastPacketId = pid; - ieee80211_tx_status_irqsafe(hw, pCell->skb, &tx_status); + ieee80211_tx_status_irqsafe(hw, pCell->skb); } spin_unlock_irqrestore(&pAd->TxRing[QID_AC_BK].Txlock, flags); @@ -702,8 +693,7 @@ static irqreturn_t rt2860_interrupt(int } /* End of rt2860_interrupt */ -static int rt2860_tx(struct ieee80211_hw *hw, struct sk_buff *skb, - struct ieee80211_tx_control *control) +static int rt2860_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { RTMP_ADAPTER *pAd = hw->priv; ULONG flags; @@ -714,6 +704,8 @@ static int rt2860_tx(struct ieee80211_hw PTXD_STRUC pTxD; struct ieee80211_hdr *hdr; u16 fc; + unsigned int rc_flags; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); DBGPRINT_MAC(DEBUG_TRACE, ("--->rt2860_tx\n")); @@ -743,29 +735,29 @@ static int rt2860_tx(struct ieee80211_hw pCell->skb = skb; - memcpy(&pCell->tx_control, control, sizeof(*control)); skb_push(skb, TXWI_SIZE); + rc_flags = info->control.rates[0].flags; pTxWI = (TXWI_STRUC *) skb->data; memset(pTxWI,0, TXWI_SIZE); pTxWI->MPDUtotalByteCount = skb->len - TXWI_SIZE; pAd->frontPacketId = ((pAd->frontPacketId) % MAX_PacketID) + 1; pTxWI->PacketId = pAd->frontPacketId; - pTxWI->ACK = (control->flags & IEEE80211_TXCTL_NO_ACK)? 0:1; - pTxWI->BW = (control->flags & IEEE80211_TXCTL_40_MHZ_WIDTH)? BW_40:BW_20; - pTxWI->ShortGI = (control->flags & IEEE80211_TXCTL_SHORT_GI)? 1:0; + pTxWI->ACK = (info->flags & IEEE80211_TX_CTL_NO_ACK)? 0:1; + pTxWI->BW = (rc_flags & IEEE80211_TX_RC_40_MHZ_WIDTH)? BW_40:BW_20; + pTxWI->ShortGI = (rc_flags & IEEE80211_TX_RC_SHORT_GI)? 1:0; - if (control->flags & IEEE80211_TXCTL_FIRST_FRAGMENT) + if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) pTxWI->FRAG = 1; - if (control->flags & IEEE80211_TXCTL_AMPDU) + if (info->flags & IEEE80211_TX_CTL_AMPDU) pTxWI->AMPDU = 1; pTxWI->BW = BW_20; - pRate = control->tx_rate; + pRate = ieee80211_get_tx_rate(hw, info); if ((pRate->bitrate == 10) || (pRate->bitrate == 20) || (pRate->bitrate == 55) || (pRate->bitrate == 110)) { - if (control->tx_rate->flags & IEEE80211_TXCTL_SHORT_PREAMBLE) + if (rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) pTxWI->MCS = pRate->hw_value_short; else pTxWI->MCS = pRate->hw_value; @@ -775,6 +767,7 @@ static int rt2860_tx(struct ieee80211_hw pTxWI->MCS = pRate->hw_value; } +#if 0 DBGPRINT_TX(DEBUG_TRACE, ("Dev->xmit[%d bytes] at rate %d\n", skb->len, control->tx_rate->bitrate)); DBGPRINT_TX(DEBUG_INFO, ("TxWI: FRAG=%d, MMPS=%d, CFACK=%d, TS=%d, AMPDU=%d, MpduDensity=%d, txop=%d\n" ,pTxWI->FRAG,pTxWI->MIMOps,pTxWI->CFACK,pTxWI->TS,pTxWI->AMPDU,pTxWI->MpduDensity,pTxWI->txop)); @@ -782,6 +775,7 @@ static int rt2860_tx(struct ieee80211_hw ,pTxWI->MCS,pTxWI->BW,pTxWI->ShortGI,pTxWI->STBC,pTxWI->Ifs,pTxWI->TxBF,pTxWI->PHYMODE)); DBGPRINT_TX(DEBUG_INFO, ("TxWI: ACK=%d, NSEQ=%d, BAWinSize=%d, WCID=%d, MPDUtotalByteCount=%d, PacketId=%d\n" ,pTxWI->ACK,pTxWI->NSEQ,pTxWI->BAWinSize,pTxWI->WirelessCliID,pTxWI->MPDUtotalByteCount,pTxWI->PacketId)); +#endif pTxD = (PTXD_STRUC) pCell->AllocVa; memset(pTxD, 0,TXD_SIZE); @@ -949,7 +943,7 @@ static int rt2860_add_interface(struct i DBGPRINT_MAC(DEBUG_TRACE, ("--->rt2860_add_interface\n")); switch (conf->type) { - case IEEE80211_IF_TYPE_STA: + case NL80211_IFTYPE_STATION: pAd->mode = conf->type; break; default: @@ -973,15 +967,16 @@ static void rt2860_remove_interface(stru DBGPRINT_MAC(DEBUG_TRACE, ("--->rt2860_remove_interface\n")); - pAd->mode = IEEE80211_IF_TYPE_MNTR; + pAd->mode = NL80211_IFTYPE_MONITOR; DBGPRINT_MAC(DEBUG_TRACE, ("<---rt2860_remove_interface\n")); } /* End of rt2860_remove_interface */ -static int rt2860_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) +static int rt2860_config(struct ieee80211_hw *hw, u32 changed) { RTMP_ADAPTER *pAd = hw->priv; + struct ieee80211_conf *conf = &hw->conf; int channel = ieee80211_frequency_to_channel(conf->channel->center_freq); DBGPRINT_MAC(DEBUG_TRACE, ("--->rt2860_config\n")); @@ -1025,9 +1020,6 @@ static int rt2860_config_interface(struc Addr4 = (ULONG)(pAd->bssid[4]) | (ULONG)(pAd->bssid[5] << 8); RTMP_IO_WRITE32(pAd, MAC_BSSID_DW1, Addr4); } - pAd->ssid_len = conf->ssid_len; - memcpy(pAd->ssid, conf->ssid, conf->ssid_len); - DBGPRINT_MAC(DEBUG_WARN, ("Bssid was set to: %s\n", (char *) conf->ssid)); } DBGPRINT_MAC(DEBUG_TRACE, ("--->rt2860_config_interface\n")); @@ -1157,11 +1149,14 @@ static int __devinit rt2860_probe(struct /* Initialize driver private data */ hw->rate_control_algorithm = NULL; hw->flags = 0; + hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); hw->extra_tx_headroom = TXWI_SIZE; hw->channel_change_time = 200; hw->queues = 1; +#if 0 hw->max_rssi = -29; hw->max_noise = -29; +#endif hw->max_signal = 100; /* link quality (%) */ /* 2.4GHz ISM band */ --- a/rtmp.h +++ b/rtmp.h @@ -321,7 +321,6 @@ typedef struct _RTMP_DMACB TXWI_STRUC *pTxWI; struct sk_buff *skb; - struct ieee80211_tx_control tx_control; } RTMP_DMACB, *PRTMP_DMACB; typedef struct _RTMP_TX_RING @@ -389,8 +388,6 @@ typedef struct _RTMP_ADAPTER UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED UCHAR PermanentAddress[6]; //Factory default MAC address UCHAR bssid[6]; - u8 ssid[32]; - size_t ssid_len; int mode; int channel; UCHAR BBPCurrentBW; --- a/rtmp_init.c +++ b/rtmp_init.c @@ -35,7 +35,7 @@ Eddy Tsai 01-12-2008 Created */ #include "rt_config.h" -#include "firmware.h" +#include "firmware/rt2860_firmware.h" typedef struct _RTMP_REG_PAIR {