Merge pull request #10 from kimocoder/v5.1.5

Merge changes
This commit is contained in:
evilphish 2017-11-16 10:12:02 +01:00 committed by GitHub
commit 9edb25c686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 109 additions and 117 deletions

View File

@ -4,3 +4,8 @@ config RTL8812AU
---help--- ---help---
Help message of RTL8812AU Help message of RTL8812AU
config RTL8814AU
tristate "Realtek 8814A USB WiFi"
depends on USB
---help---
Help message of RTL8814AU

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation. * published by the Free Software Foundation.
@ -22,7 +22,6 @@
//#include <drv_types.h> //#include <drv_types.h>
#include <rtl8814a_hal.h> #include <rtl8814a_hal.h>
s32 rtl8814au_init_xmit_priv(_adapter *padapter) s32 rtl8814au_init_xmit_priv(_adapter *padapter)
{ {
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@ -45,22 +44,22 @@ void rtl8814au_free_xmit_priv(_adapter *padapter)
} }
static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bagg_pkt) static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bagg_pkt)
{ {
int pull=0; int pull=0;
uint qsel; uint qsel;
u8 data_rate,pwr_status,offset; u8 data_rate,pwr_status,offset;
_adapter *padapter = pxmitframe->padapter; _adapter *padapter = pxmitframe->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct pkt_attrib *pattrib = &pxmitframe->attrib; struct pkt_attrib *pattrib = &pxmitframe->attrib;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
u8 *ptxdesc = pmem; u8 *ptxdesc = pmem;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
sint bmcst = IS_MCAST(pattrib->ra); sint bmcst = IS_MCAST(pattrib->ra);
u16 SWDefineContent = 0x0; u16 SWDefineContent = 0x0;
u8 DriverFixedRate = 0x0; u8 DriverFixedRate = 0x0;
#ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX #ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX
if (padapter->registrypriv.mp_mode == 0) if (padapter->registrypriv.mp_mode == 0)
{ {
if((PACKET_OFFSET_SZ != 0) && (!bagg_pkt) &&(rtw_usb_bulk_size_boundary(padapter,TXDESC_SIZE+sz)==_FALSE)) if((PACKET_OFFSET_SZ != 0) && (!bagg_pkt) &&(rtw_usb_bulk_size_boundary(padapter,TXDESC_SIZE+sz)==_FALSE))
@ -73,20 +72,20 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX #endif // CONFIG_USE_USB_BUFFER_ALLOC_TX
_rtw_memset(ptxdesc, 0, TXDESC_SIZE); _rtw_memset(ptxdesc, 0, TXDESC_SIZE);
//4 offset 0 //4 offset 0
//SET_TX_DESC_FIRST_SEG_8812(ptxdesc, 1); //SET_TX_DESC_FIRST_SEG_8812(ptxdesc, 1);
SET_TX_DESC_LAST_SEG_8814A(ptxdesc, 1); SET_TX_DESC_LAST_SEG_8814A(ptxdesc, 1);
//SET_TX_DESC_OWN_8812(ptxdesc, 1); //SET_TX_DESC_OWN_8812(ptxdesc, 1);
//RTW_INFO("%s==> pkt_len=%d,bagg_pkt=%02x\n",__FUNCTION__,sz,bagg_pkt); //RTW_INFO("%s==> pkt_len=%d,bagg_pkt=%02x\n",__FUNCTION__,sz,bagg_pkt);
SET_TX_DESC_PKT_SIZE_8814A(ptxdesc, sz); SET_TX_DESC_PKT_SIZE_8814A(ptxdesc, sz);
offset = TXDESC_SIZE + OFFSET_SZ;
#ifdef CONFIG_TX_EARLY_MODE offset = TXDESC_SIZE + OFFSET_SZ;
if(bagg_pkt){
offset += EARLY_MODE_INFO_SIZE ;//0x28 #ifdef CONFIG_TX_EARLY_MODE
if(bagg_pkt){
offset += EARLY_MODE_INFO_SIZE ;//0x28
} }
#endif #endif
//RTW_INFO("%s==>offset(0x%02x) \n",__FUNCTION__,offset); //RTW_INFO("%s==>offset(0x%02x) \n",__FUNCTION__,offset);
@ -100,11 +99,11 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
if (padapter->registrypriv.mp_mode == 0) if (padapter->registrypriv.mp_mode == 0)
{ {
if((PACKET_OFFSET_SZ != 0) && (!bagg_pkt)){ if((PACKET_OFFSET_SZ != 0) && (!bagg_pkt)){
if((pull) && (pxmitframe->pkt_offset>0)) { if((pull) && (pxmitframe->pkt_offset>0)) {
pxmitframe->pkt_offset = pxmitframe->pkt_offset -1; pxmitframe->pkt_offset = pxmitframe->pkt_offset -1;
} }
} }
} }
#endif #endif
//RTW_INFO("%s, pkt_offset=0x%02x\n",__FUNCTION__,pxmitframe->pkt_offset); //RTW_INFO("%s, pkt_offset=0x%02x\n",__FUNCTION__,pxmitframe->pkt_offset);
@ -135,7 +134,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
if((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) if((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG)
{ {
//RTW_INFO("pxmitframe->frame_tag == DATA_FRAMETAG\n"); //RTW_INFO("pxmitframe->frame_tag == DATA_FRAMETAG\n");
rtl8814a_fill_txdesc_sectype(pattrib, ptxdesc); rtl8814a_fill_txdesc_sectype(pattrib, ptxdesc);
@ -186,7 +185,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
if (pHalData->fw_ractrl == _FALSE) { if (pHalData->fw_ractrl == _FALSE) {
SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1); SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1);
DriverFixedRate = 0x01; DriverFixedRate = 0x01;
if(pHalData->INIDATA_RATE[pattrib->mac_id] & BIT(7)) if(pHalData->INIDATA_RATE[pattrib->mac_id] & BIT(7))
SET_TX_DESC_DATA_SHORT_8814A(ptxdesc, 1); SET_TX_DESC_DATA_SHORT_8814A(ptxdesc, 1);
@ -195,7 +194,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
if (padapter->fix_rate != 0xFF) { // modify data rate by iwpriv if (padapter->fix_rate != 0xFF) { // modify data rate by iwpriv
SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1); SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1);
DriverFixedRate = 0x01; DriverFixedRate = 0x01;
if(padapter->fix_rate & BIT(7)) if(padapter->fix_rate & BIT(7))
SET_TX_DESC_DATA_SHORT_8814A(ptxdesc, 1); SET_TX_DESC_DATA_SHORT_8814A(ptxdesc, 1);
@ -206,9 +205,9 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
if (pattrib->ldpc) if (pattrib->ldpc)
SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 1); SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 1);
if (pattrib->stbc) if (pattrib->stbc)
SET_TX_DESC_DATA_STBC_8814A(ptxdesc, 1); SET_TX_DESC_DATA_STBC_8814A(ptxdesc, 1);
//work arond before fixing RA //work arond before fixing RA
//SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1); //SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1);
//SET_TX_DESC_TX_RATE_8814A(ptxdesc, 0x10); //SET_TX_DESC_TX_RATE_8814A(ptxdesc, 0x10);
@ -234,7 +233,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
} }
else if((pxmitframe->frame_tag&0x0f)== MGNT_FRAMETAG) else if((pxmitframe->frame_tag&0x0f)== MGNT_FRAMETAG)
{ {
//RTW_INFO("pxmitframe->frame_tag == MGNT_FRAMETAG\n"); //RTW_INFO("pxmitframe->frame_tag == MGNT_FRAMETAG\n");
SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1); SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1);
DriverFixedRate = 0x01; DriverFixedRate = 0x01;
@ -251,7 +250,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
} }
// VHT NDPA or HT NDPA Packet for Beamformer. // VHT NDPA or HT NDPA Packet for Beamformer.
if((pattrib->subtype == WIFI_NDPA) || if((pattrib->subtype == WIFI_NDPA) ||
((pattrib->subtype == WIFI_ACTION_NOACK) && (pattrib->order == 1))) ((pattrib->subtype == WIFI_ACTION_NOACK) && (pattrib->order == 1)))
{ {
SET_TX_DESC_NAV_USE_HDR_8814A(ptxdesc, 1); SET_TX_DESC_NAV_USE_HDR_8814A(ptxdesc, 1);
@ -266,7 +265,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
//if(pattrib->rts_cca) //if(pattrib->rts_cca)
//{ //{
// SET_TX_DESC_NDPA_8812(ptxdesc, 2); // SET_TX_DESC_NDPA_8812(ptxdesc, 2);
//} //}
//else //else
{ {
SET_TX_DESC_NDPA_8814A(ptxdesc, 1); SET_TX_DESC_NDPA_8814A(ptxdesc, 1);
@ -316,7 +315,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
SET_TX_DESC_SW_DEFINE_8814A(ptxdesc, SWDefineContent); SET_TX_DESC_SW_DEFINE_8814A(ptxdesc, SWDefineContent);
SET_TX_DESC_GID_8814A(ptxdesc, pattrib->txbf_g_id); SET_TX_DESC_GID_8814A(ptxdesc, pattrib->txbf_g_id);
SET_TX_DESC_PAID_8814A(ptxdesc, pattrib->txbf_p_aid); SET_TX_DESC_PAID_8814A(ptxdesc, pattrib->txbf_p_aid);
/* injected frame */ /* injected frame */
if(pattrib->inject == 0xa5) { if(pattrib->inject == 0xa5) {
@ -335,7 +334,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
SET_TX_DESC_TX_RATE_8814A(ptxdesc, MRateToHwRate(pattrib->rate)); SET_TX_DESC_TX_RATE_8814A(ptxdesc, MRateToHwRate(pattrib->rate));
if (pattrib->ldpc) { if (pattrib->ldpc) {
SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 1); SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 1);
} else { } else {
SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 0); SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 0);
} }
SET_TX_DESC_DATA_STBC_8814A(ptxdesc, pattrib->stbc & 3); SET_TX_DESC_DATA_STBC_8814A(ptxdesc, pattrib->stbc & 3);
@ -343,7 +342,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
} }
rtl8814a_cal_txdesc_chksum(ptxdesc); rtl8814a_cal_txdesc_chksum(ptxdesc);
_dbg_dump_tx_info(padapter,pxmitframe->frame_tag,ptxdesc); _dbg_dump_tx_info(padapter,pxmitframe->frame_tag,ptxdesc);
return pull; return pull;
} }
@ -438,18 +437,18 @@ static s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe)
mem_addr = pxmitframe->buf_addr; mem_addr = pxmitframe->buf_addr;
//RTW_INFO("rtw_dump_xframe()\n"); //RTW_INFO("rtw_dump_xframe()\n");
for (t = 0; t < pattrib->nr_frags; t++) for (t = 0; t < pattrib->nr_frags; t++)
{ {
if (inner_ret != _SUCCESS && ret == _SUCCESS) if (inner_ret != _SUCCESS && ret == _SUCCESS)
ret = _FAIL; ret = _FAIL;
if (t != (pattrib->nr_frags - 1)) if (t != (pattrib->nr_frags - 1))
{ {
RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("pattrib->nr_frags=%d\n", pattrib->nr_frags)); RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("pattrib->nr_frags=%d\n", pattrib->nr_frags));
sz = pxmitpriv->frag_len; sz = pxmitpriv->frag_len;
sz = sz - 4 - (psecuritypriv->sw_encrypt ? 0 : pattrib->icv_len); sz = sz - 4 - (psecuritypriv->sw_encrypt ? 0 : pattrib->icv_len);
} }
else //no frag else //no frag
{ {
@ -457,12 +456,12 @@ static s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe)
} }
pull = update_txdesc(pxmitframe, mem_addr, sz, _FALSE); pull = update_txdesc(pxmitframe, mem_addr, sz, _FALSE);
if(pull) if(pull)
{ {
mem_addr += PACKET_OFFSET_SZ; //pull txdesc head mem_addr += PACKET_OFFSET_SZ; //pull txdesc head
//pxmitbuf ->pbuf = mem_addr; //pxmitbuf ->pbuf = mem_addr;
pxmitframe->buf_addr = mem_addr; pxmitframe->buf_addr = mem_addr;
w_sz = sz + TXDESC_SIZE; w_sz = sz + TXDESC_SIZE;
@ -470,7 +469,7 @@ static s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe)
else else
{ {
w_sz = sz + TXDESC_SIZE + PACKET_OFFSET_SZ; w_sz = sz + TXDESC_SIZE + PACKET_OFFSET_SZ;
} }
ff_hwaddr = rtw_get_ff_hwaddr(pxmitframe); ff_hwaddr = rtw_get_ff_hwaddr(pxmitframe);
@ -484,19 +483,19 @@ static s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe)
rtw_count_tx_stats(padapter, pxmitframe, sz); rtw_count_tx_stats(padapter, pxmitframe, sz);
//RTW_INFO("rtw_write_port, w_sz=%d\n", w_sz); //RTW_INFO("rtw_write_port, w_sz=%d\n", w_sz);
//RTW_INFO("rtw_write_port, w_sz=%d, sz=%d, txdesc_sz=%d, tid=%d\n", w_sz, sz, w_sz-sz, pattrib->priority); //RTW_INFO("rtw_write_port, w_sz=%d, sz=%d, txdesc_sz=%d, tid=%d\n", w_sz, sz, w_sz-sz, pattrib->priority);
mem_addr += w_sz; mem_addr += w_sz;
mem_addr = (u8 *)RND4(((SIZE_PTR)(mem_addr))); mem_addr = (u8 *)RND4(((SIZE_PTR)(mem_addr)));
} }
rtw_free_xmitframe(pxmitpriv, pxmitframe); rtw_free_xmitframe(pxmitpriv, pxmitframe);
if (ret != _SUCCESS) if (ret != _SUCCESS)
rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_UNKNOWN); rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_UNKNOWN);
return ret; return ret;
} }
@ -568,7 +567,7 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
//3 1. pick up first frame //3 1. pick up first frame
do { do {
rtw_free_xmitframe(pxmitpriv, pxmitframe); rtw_free_xmitframe(pxmitpriv, pxmitframe);
pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
if (pxmitframe == NULL) { if (pxmitframe == NULL) {
// no more xmit frame, release xmit buffer // no more xmit frame, release xmit buffer
@ -629,9 +628,10 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
// check pkt amount in one bulk // check pkt amount in one bulk
descCount = 0; descCount = 0;
bulkPtr = bulkSize; bulkPtr = bulkSize;
if (pbuf < bulkPtr) if (pbuf < bulkPtr) {
descCount++; descCount++;
if (descCount == pHalData->UsbTxAggDescNum) }
if (descCount == pHalData->UsbTxAggDescNum)
goto agg_end; goto agg_end;
else { else {
descCount = 0; descCount = 0;
@ -678,7 +678,7 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
xmitframe_phead = get_list_head(&ptxservq->sta_pending); xmitframe_phead = get_list_head(&ptxservq->sta_pending);
xmitframe_plist = get_next(xmitframe_phead); xmitframe_plist = get_next(xmitframe_phead);
while (rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist) == _FALSE) while (rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist) == _FALSE)
{ {
pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list);
@ -686,23 +686,23 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
if(_FAIL == rtw_hal_busagg_qsel_check(padapter,pfirstframe->attrib.qsel,pxmitframe->attrib.qsel)) if(_FAIL == rtw_hal_busagg_qsel_check(padapter,pfirstframe->attrib.qsel,pxmitframe->attrib.qsel))
break; break;
pxmitframe->agg_num = 0; // not first frame of aggregation pxmitframe->agg_num = 0; // not first frame of aggregation
#ifdef CONFIG_TX_EARLY_MODE #ifdef CONFIG_TX_EARLY_MODE
pxmitframe->pkt_offset = 1;// not first frame of aggregation,reserve offset for EM Info pxmitframe->pkt_offset = 1;// not first frame of aggregation,reserve offset for EM Info
#else #else
pxmitframe->pkt_offset = 0; // not first frame of aggregation, no need to reserve offset pxmitframe->pkt_offset = 0; // not first frame of aggregation, no need to reserve offset
#endif #endif
len = xmitframe_need_length(pxmitframe) + TXDESC_SIZE +(pxmitframe->pkt_offset*PACKET_OFFSET_SZ); len = xmitframe_need_length(pxmitframe) + TXDESC_SIZE +(pxmitframe->pkt_offset*PACKET_OFFSET_SZ);
if (_RND8(pbuf + len) > MAX_XMITBUF_SZ) if (_RND8(pbuf + len) > MAX_XMITBUF_SZ)
//if (_RND8(pbuf + len) > (MAX_XMITBUF_SZ/2))//to do : for TX TP finial tune , Georgia 2012-0323 //if (_RND8(pbuf + len) > (MAX_XMITBUF_SZ/2))//to do : for TX TP finial tune , Georgia 2012-0323
{ {
//RTW_INFO("%s....len> MAX_XMITBUF_SZ\n",__FUNCTION__); //RTW_INFO("%s....len> MAX_XMITBUF_SZ\n",__FUNCTION__);
pxmitframe->agg_num = 1; pxmitframe->agg_num = 1;
pxmitframe->pkt_offset = 1; pxmitframe->pkt_offset = 1;
break; break;
} }
rtw_list_delete(&pxmitframe->list); rtw_list_delete(&pxmitframe->list);
ptxservq->qcnt--; ptxservq->qcnt--;
@ -731,7 +731,7 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
// pxmitframe->pxmitbuf = pxmitbuf; // pxmitframe->pxmitbuf = pxmitbuf;
pxmitframe->buf_addr = pxmitbuf->pbuf + pbuf; pxmitframe->buf_addr = pxmitbuf->pbuf + pbuf;
if (rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe) == _FALSE) { if (rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe) == _FALSE) {
RTW_INFO("%s coalesce failed \n",__FUNCTION__); RTW_INFO("%s coalesce failed \n",__FUNCTION__);
rtw_free_xmitframe(pxmitpriv, pxmitframe); rtw_free_xmitframe(pxmitpriv, pxmitframe);
@ -744,7 +744,7 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
// (len - TXDESC_SIZE) == pxmitframe->attrib.last_txcmdsz // (len - TXDESC_SIZE) == pxmitframe->attrib.last_txcmdsz
update_txdesc(pxmitframe, pxmitframe->buf_addr, pxmitframe->attrib.last_txcmdsz,_TRUE); update_txdesc(pxmitframe, pxmitframe->buf_addr, pxmitframe->attrib.last_txcmdsz,_TRUE);
// don't need xmitframe any more // don't need xmitframe any more
rtw_free_xmitframe(pxmitpriv, pxmitframe); rtw_free_xmitframe(pxmitpriv, pxmitframe);
@ -754,9 +754,9 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
pfirstframe->agg_num++; pfirstframe->agg_num++;
#ifdef CONFIG_TX_EARLY_MODE #ifdef CONFIG_TX_EARLY_MODE
pxmitpriv->agg_pkt[pfirstframe->agg_num-1].offset = _RND8(len); pxmitpriv->agg_pkt[pfirstframe->agg_num-1].offset = _RND8(len);
pxmitpriv->agg_pkt[pfirstframe->agg_num-1].pkt_len = pxmitframe->attrib.last_txcmdsz; pxmitpriv->agg_pkt[pfirstframe->agg_num-1].pkt_len = pxmitframe->attrib.last_txcmdsz;
#endif #endif
if (MAX_TX_AGG_PACKET_NUMBER == pfirstframe->agg_num) if (MAX_TX_AGG_PACKET_NUMBER == pfirstframe->agg_num)
break; break;
@ -801,27 +801,25 @@ agg_end:
#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX #endif // CONFIG_USE_USB_BUFFER_ALLOC_TX
update_txdesc(pfirstframe, pfirstframe->buf_addr, pfirstframe->attrib.last_txcmdsz,_TRUE); update_txdesc(pfirstframe, pfirstframe->buf_addr, pfirstframe->attrib.last_txcmdsz,_TRUE);
#ifdef CONFIG_TX_EARLY_MODE #ifdef CONFIG_TX_EARLY_MODE
//prepare EM info for first frame, agg_num value start from 1 //prepare EM info for first frame, agg_num value start from 1
pxmitpriv->agg_pkt[0].offset = _RND8(pfirstframe->attrib.last_txcmdsz +TXDESC_SIZE +(pfirstframe->pkt_offset*PACKET_OFFSET_SZ)); pxmitpriv->agg_pkt[0].offset = _RND8(pfirstframe->attrib.last_txcmdsz +TXDESC_SIZE +(pfirstframe->pkt_offset*PACKET_OFFSET_SZ));
pxmitpriv->agg_pkt[0].pkt_len = pfirstframe->attrib.last_txcmdsz;//get from rtw_xmitframe_coalesce pxmitpriv->agg_pkt[0].pkt_len = pfirstframe->attrib.last_txcmdsz;//get from rtw_xmitframe_coalesce
UpdateEarlyModeInfo8812(pxmitpriv,pxmitbuf ); UpdateEarlyModeInfo8812(pxmitpriv,pxmitbuf );
#endif #endif
//3 4. write xmit buffer to USB FIFO //3 4. write xmit buffer to USB FIFO
ff_hwaddr = rtw_get_ff_hwaddr(pfirstframe); ff_hwaddr = rtw_get_ff_hwaddr(pfirstframe);
//RTW_INFO("%s ===================================== write port,buf_size(%d) \n",__FUNCTION__,pbuf_tail); //RTW_INFO("%s ===================================== write port,buf_size(%d) \n",__FUNCTION__,pbuf_tail);
// xmit address == ((xmit_frame*)pxmitbuf->priv_data)->buf_addr // xmit address == ((xmit_frame*)pxmitbuf->priv_data)->buf_addr
rtw_write_port(padapter, ff_hwaddr, pbuf_tail, (u8*)pxmitbuf); rtw_write_port(padapter, ff_hwaddr, pbuf_tail, (u8*)pxmitbuf);
//3 5. update statisitc //3 5. update statisitc
pbuf_tail -= (pfirstframe->agg_num * TXDESC_SIZE); pbuf_tail -= (pfirstframe->agg_num * TXDESC_SIZE);
pbuf_tail -= (pfirstframe->pkt_offset * PACKET_OFFSET_SZ); pbuf_tail -= (pfirstframe->pkt_offset * PACKET_OFFSET_SZ);
rtw_count_tx_stats(padapter, pfirstframe, pbuf_tail); rtw_count_tx_stats(padapter, pfirstframe, pbuf_tail);
rtw_free_xmitframe(pxmitpriv, pfirstframe); rtw_free_xmitframe(pxmitpriv, pfirstframe);
@ -832,11 +830,11 @@ agg_end:
#else //CONFIG_USB_TX_AGGREGATION #else //CONFIG_USB_TX_AGGREGATION
s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
{ {
struct hw_xmit *phwxmits; struct hw_xmit *phwxmits;
sint hwentry; sint hwentry;
struct xmit_frame *pxmitframe=NULL; struct xmit_frame *pxmitframe=NULL;
int res=_SUCCESS, xcnt = 0; int res=_SUCCESS, xcnt = 0;
phwxmits = pxmitpriv->hwxmits; phwxmits = pxmitpriv->hwxmits;
@ -846,70 +844,65 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
if(pxmitbuf==NULL) if(pxmitbuf==NULL)
{ {
pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv); pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
if(!pxmitbuf) if(!pxmitbuf)
{ {
return _FALSE; return _FALSE;
} }
} }
do do
{ {
pxmitframe = rtw_dequeue_xframe(pxmitpriv, phwxmits, hwentry); pxmitframe = rtw_dequeue_xframe(pxmitpriv, phwxmits, hwentry);
if(pxmitframe) if(pxmitframe)
{ {
pxmitframe->pxmitbuf = pxmitbuf; pxmitframe->pxmitbuf = pxmitbuf;
pxmitframe->buf_addr = pxmitbuf->pbuf; pxmitframe->buf_addr = pxmitbuf->pbuf;
pxmitbuf->priv_data = pxmitframe; pxmitbuf->priv_data = pxmitframe;
if((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) if((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG)
{ {
if(pxmitframe->attrib.priority<=15)//TID0~15 if(pxmitframe->attrib.priority<=15)//TID0~15
{ {
res = rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe); res = rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe);
} }
//RTW_INFO("==> pxmitframe->attrib.priority:%d\n",pxmitframe->attrib.priority); //RTW_INFO("==> pxmitframe->attrib.priority:%d\n",pxmitframe->attrib.priority);
rtw_os_xmit_complete(padapter, pxmitframe);//always return ndis_packet after rtw_xmitframe_coalesce rtw_os_xmit_complete(padapter, pxmitframe);//always return ndis_packet after rtw_xmitframe_coalesce
} }
RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("xmitframe_complete(): rtw_dump_xframe\n")); RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("xmitframe_complete(): rtw_dump_xframe\n"));
if(res == _SUCCESS) if(res == _SUCCESS)
{ {
rtw_dump_xframe(padapter, pxmitframe); rtw_dump_xframe(padapter, pxmitframe);
} }
else else
{ {
rtw_free_xmitbuf(pxmitpriv, pxmitbuf); rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
rtw_free_xmitframe(pxmitpriv, pxmitframe); rtw_free_xmitframe(pxmitpriv, pxmitframe);
} }
xcnt++; xcnt++;
} }
else else
{ {
rtw_free_xmitbuf(pxmitpriv, pxmitbuf); rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
return _FALSE; return _FALSE;
} }
break; break;
}while(0/*xcnt < (NR_XMITFRAME >> 3)*/); }while(0/*xcnt < (NR_XMITFRAME >> 3)*/);
return _TRUE; return _TRUE;
} }
#endif #endif
static s32 xmitframe_direct(_adapter *padapter, struct xmit_frame *pxmitframe) static s32 xmitframe_direct(_adapter *padapter, struct xmit_frame *pxmitframe)
{ {
s32 res = _SUCCESS; s32 res = _SUCCESS;
@ -1006,12 +999,12 @@ s32 rtl8814au_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmi
{ {
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
s32 err; s32 err;
if ((err=rtw_xmitframe_enqueue(padapter, pxmitframe)) != _SUCCESS) if ((err=rtw_xmitframe_enqueue(padapter, pxmitframe)) != _SUCCESS)
{ {
rtw_free_xmitframe(pxmitpriv, pxmitframe); rtw_free_xmitframe(pxmitpriv, pxmitframe);
pxmitpriv->tx_drop++; pxmitpriv->tx_drop++;
} }
else else
{ {
@ -1019,46 +1012,44 @@ s32 rtl8814au_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmi
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
#endif #endif
} }
return err;
}
return err;
}
#ifdef CONFIG_HOSTAPD_MLME #ifdef CONFIG_HOSTAPD_MLME
static void rtl8814au_hostap_mgnt_xmit_cb(struct urb *urb) static void rtl8814au_hostap_mgnt_xmit_cb(struct urb *urb)
{ {
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
struct sk_buff *skb = (struct sk_buff *)urb->context; struct sk_buff *skb = (struct sk_buff *)urb->context;
//RTW_INFO("%s\n", __FUNCTION__); //RTW_INFO("%s\n", __FUNCTION__);
rtw_skb_free(skb); rtw_skb_free(skb);
#endif #endif
} }
s32 rtl8814au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt) s32 rtl8814au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
{ {
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
u16 fc; u16 fc;
int rc, len, pipe; int rc, len, pipe;
unsigned int bmcst, tid, qsel; unsigned int bmcst, tid, qsel;
struct sk_buff *skb, *pxmit_skb; struct sk_buff *skb, *pxmit_skb;
struct urb *urb; struct urb *urb;
unsigned char *pxmitbuf; unsigned char *pxmitbuf;
struct tx_desc *ptxdesc; struct tx_desc *ptxdesc;
struct rtw_ieee80211_hdr *tx_hdr; struct rtw_ieee80211_hdr *tx_hdr;
struct hostapd_priv *phostapdpriv = padapter->phostapdpriv; struct hostapd_priv *phostapdpriv = padapter->phostapdpriv;
struct net_device *pnetdev = padapter->pnetdev; struct net_device *pnetdev = padapter->pnetdev;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
//RTW_INFO("%s\n", __FUNCTION__); //RTW_INFO("%s\n", __FUNCTION__);
skb = pkt; skb = pkt;
len = skb->len; len = skb->len;
tx_hdr = (struct rtw_ieee80211_hdr *)(skb->data); tx_hdr = (struct rtw_ieee80211_hdr *)(skb->data);
fc = le16_to_cpu(tx_hdr->frame_ctl); fc = le16_to_cpu(tx_hdr->frame_ctl);
@ -1079,42 +1070,40 @@ s32 rtl8814au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
goto _exit; goto _exit;
} }
// ----- fill tx desc ----- // ----- fill tx desc -----
ptxdesc = (struct tx_desc *)pxmitbuf; ptxdesc = (struct tx_desc *)pxmitbuf;
_rtw_memset(ptxdesc, 0, sizeof(*ptxdesc)); _rtw_memset(ptxdesc, 0, sizeof(*ptxdesc));
//offset 0 //offset 0
ptxdesc->txdw0 |= cpu_to_le32(len&0x0000ffff); ptxdesc->txdw0 |= cpu_to_le32(len&0x0000ffff);
ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE+OFFSET_SZ)<<OFFSET_SHT)&0x00ff0000);//default = 32 bytes for TX Desc ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE+OFFSET_SZ)<<OFFSET_SHT)&0x00ff0000);//default = 32 bytes for TX Desc
ptxdesc->txdw0 |= cpu_to_le32(OWN | FSG | LSG); ptxdesc->txdw0 |= cpu_to_le32(OWN | FSG | LSG);
if(bmcst) if(bmcst)
{ {
ptxdesc->txdw0 |= cpu_to_le32(BIT(24)); ptxdesc->txdw0 |= cpu_to_le32(BIT(24));
} }
//offset 4 //offset 4
ptxdesc->txdw1 |= cpu_to_le32(0x00);//MAC_ID ptxdesc->txdw1 |= cpu_to_le32(0x00);//MAC_ID
ptxdesc->txdw1 |= cpu_to_le32((0x12<<QSEL_SHT)&0x00001f00); ptxdesc->txdw1 |= cpu_to_le32((0x12<<QSEL_SHT)&0x00001f00);
ptxdesc->txdw1 |= cpu_to_le32((0x06<< 16) & 0x000f0000);//b mode ptxdesc->txdw1 |= cpu_to_le32((0x06<< 16) & 0x000f0000);//b mode
//offset 8 //offset 8
//offset 12 //offset 12
ptxdesc->txdw3 |= cpu_to_le32((le16_to_cpu(tx_hdr->seq_ctl)<<16)&0xffff0000); ptxdesc->txdw3 |= cpu_to_le32((le16_to_cpu(tx_hdr->seq_ctl)<<16)&0xffff0000);
//offset 16 //offset 16
ptxdesc->txdw4 |= cpu_to_le32(BIT(8));//driver uses rate ptxdesc->txdw4 |= cpu_to_le32(BIT(8));//driver uses rate
//offset 20
//offset 20
//HW append seq //HW append seq
ptxdesc->txdw4 |= cpu_to_le32(BIT(7)); // Hw set sequence number ptxdesc->txdw4 |= cpu_to_le32(BIT(7)); // Hw set sequence number
ptxdesc->txdw3 |= cpu_to_le32((8 <<28)); //set bit3 to 1. Suugested by TimChen. 2009.12.29. ptxdesc->txdw3 |= cpu_to_le32((8 <<28)); //set bit3 to 1. Suugested by TimChen. 2009.12.29.
rtl8188eu_cal_txdesc_chksum(ptxdesc); rtl8188eu_cal_txdesc_chksum(ptxdesc);
// ----- end of fill tx desc ----- // ----- end of fill tx desc -----
@ -1126,16 +1115,15 @@ s32 rtl8814au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
//RTW_INFO("mgnt_xmit, len=%x\n", pxmit_skb->len); //RTW_INFO("mgnt_xmit, len=%x\n", pxmit_skb->len);
// ----- prepare urb for submit ----- // ----- prepare urb for submit -----
//translate DMA FIFO addr to pipehandle //translate DMA FIFO addr to pipehandle
//pipe = ffaddr2pipehdl(pdvobj, MGT_QUEUE_INX); //pipe = ffaddr2pipehdl(pdvobj, MGT_QUEUE_INX);
pipe = usb_sndbulkpipe(pdvobj->pusbdev, pHalData->Queue2EPNum[(u8)MGT_QUEUE_INX]&0x0f); pipe = usb_sndbulkpipe(pdvobj->pusbdev, pHalData->Queue2EPNum[(u8)MGT_QUEUE_INX]&0x0f);
usb_fill_bulk_urb(urb, pdvobj->pusbdev, pipe, usb_fill_bulk_urb(urb, pdvobj->pusbdev, pipe,
pxmit_skb->data, pxmit_skb->len, rtl8192cu_hostap_mgnt_xmit_cb, pxmit_skb); pxmit_skb->data, pxmit_skb->len, rtl8192cu_hostap_mgnt_xmit_cb, pxmit_skb);
urb->transfer_flags |= URB_ZERO_PACKET; urb->transfer_flags |= URB_ZERO_PACKET;
usb_anchor_urb(urb, &phostapdpriv->anchored); usb_anchor_urb(urb, &phostapdpriv->anchored);
rc = usb_submit_urb(urb, GFP_ATOMIC); rc = usb_submit_urb(urb, GFP_ATOMIC);
@ -1145,9 +1133,8 @@ s32 rtl8814au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
} }
usb_free_urb(urb); usb_free_urb(urb);
_exit:
_exit:
rtw_skb_free(skb); rtw_skb_free(skb);
#endif #endif
@ -1156,4 +1143,3 @@ _exit:
} }
#endif #endif

View File

@ -202,6 +202,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
{USB_DEVICE(0x2019, 0xAB32), .driver_info = RTL8821}, /* Planex - GW-450S */ {USB_DEVICE(0x2019, 0xAB32), .driver_info = RTL8821}, /* Planex - GW-450S */
{USB_DEVICE(0x0846, 0x9052), .driver_info = RTL8821}, /* Netgear - A6100 */ {USB_DEVICE(0x0846, 0x9052), .driver_info = RTL8821}, /* Netgear - A6100 */
{USB_DEVICE(0x0411, 0x029B), .driver_info = RTL8821}, /* Buffalo - WI-U2-433DHP */ {USB_DEVICE(0x0411, 0x029B), .driver_info = RTL8821}, /* Buffalo - WI-U2-433DHP */
{USB_DEVICE(0x056E, 0x4007), .driver_info = RTL8821}, /* Elecom - WDC-433DU2HBK */
#endif #endif
#ifdef CONFIG_RTL8192E #ifdef CONFIG_RTL8192E