1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-26 07:04:12 +00:00

Fixed some around minors around frame injection

This commit is contained in:
kimocoder 2019-02-15 18:20:44 +01:00
parent 0eda114fda
commit 7360779d5a
5 changed files with 120 additions and 94 deletions

View File

@ -93,7 +93,7 @@ CONFIG_AP_WOWLAN = n
######### Notify SDIO Host Keep Power During Syspend ##########
CONFIG_RTW_SDIO_PM_KEEP_POWER = y
###################### MP HW TX MODE FOR VHT #######################
CONFIG_MP_VHT_HW_TX_MODE = y
CONFIG_MP_VHT_HW_TX_MODE = n
###################### Platform Related #######################
CONFIG_PLATFORM_I386_PC = y
CONFIG_PLATFORM_ANDROID_X86 = n

View File

@ -12554,7 +12554,7 @@ static void rtw_mlmeext_disconnect(_adapter *padapter)
self_action = MLME_ACTION_NONE;
else {
RTW_INFO("state:0x%x\n", MLME_STATE(padapter));
rtw_warn_on(1);
//rtw_warn_on(1);
}
/* set_opmode_cmd(padapter, infra_client_with_mlme); */

View File

@ -104,7 +104,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba
/* RTW_INFO("%s, pkt_offset=0x%02x\n",__FUNCTION__,pxmitframe->pkt_offset); */
/* pkt_offset, unit:8 bytes padding */
if (pxmitframe->pkt_offset > 0)
SET_TX_DESC_PKT_OFFSET_8812(ptxdesc, pxmitframe->pkt_offset);
SET_TX_DESC_PKT_OFFSET_8812(ptxdesc, pxmitframe->pkt_offset);
SET_TX_DESC_MACID_8812(ptxdesc, pattrib->mac_id);
SET_TX_DESC_RATE_ID_8812(ptxdesc, pattrib->raid);
@ -115,13 +115,41 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba
if (!pattrib->qos_en) {
SET_TX_DESC_HWSEQ_EN_8812(ptxdesc, 1); /* Hw set sequence number */
} else
} else {
SET_TX_DESC_SEQ_8812(ptxdesc, pattrib->seqnum);
}
/* injected frame */
if (pattrib->inject == 0xa5) {
SET_TX_DESC_RETRY_LIMIT_ENABLE_8812(ptxdesc, 1);
if (pattrib->retry_ctrl == _TRUE) {
SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 6);
} else {
SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 0);
}
if (pattrib->sgi == _TRUE) {
SET_TX_DESC_DATA_SHORT_8812(ptxdesc, 1);
} else {
SET_TX_DESC_DATA_SHORT_8812(ptxdesc, 0);
}
if ((pxmitframe->frame_tag & 0x0f) == DATA_FRAMETAG) {
/* RTW_INFO("pxmitframe->frame_tag == DATA_FRAMETAG\n"); */
SET_TX_DESC_DISABLE_FB_8812(ptxdesc, 1); // svpcom: ?
SET_TX_DESC_USE_RATE_8812(ptxdesc, 1);
SET_TX_DESC_TX_RATE_8812(ptxdesc, MRateToHwRate(pattrib->rate));
rtl8812a_fill_txdesc_sectype(pattrib, ptxdesc);
if (pattrib->ldpc)
SET_TX_DESC_DATA_LDPC_8812(ptxdesc, 1);
SET_TX_DESC_DATA_STBC_8812(ptxdesc, pattrib->stbc & 3);
//SET_TX_DESC_GF_8812(ptxdesc, 1); // no MCS rates if sets, GreenField?
//SET_TX_DESC_LSIG_TXOP_EN_8812(ptxdesc, 1);
//SET_TX_DESC_HTC_8812(ptxdesc, 1);
//SET_TX_DESC_NO_ACM_8812(ptxdesc, 1);
SET_TX_DESC_DATA_BW_8812(ptxdesc, pattrib->bwmode); // 0 - 20 MHz, 1 - 40 MHz, 2 - 80 MHz
}
if ((pxmitframe->frame_tag & 0x0f) == DATA_FRAMETAG) {
/* RTW_INFO("pxmitframe->frame_tag == DATA_FRAMETAG\n"); */
rtl8812a_fill_txdesc_sectype(pattrib, ptxdesc);
#if defined(CONFIG_CONCURRENT_MODE)
if (bmcst)
fill_txdesc_force_bmc_camid(pattrib, ptxdesc);
@ -1102,7 +1130,7 @@ s32 rtl8812au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
ptxdesc->txdw3 |= cpu_to_le32((8 << 28)); /* set bit3 to 1. Suugested by TimChen. 2009.12.29. */
rtl8188eu_cal_txdesc_chksum(ptxdesc);
rtl8812eu_cal_txdesc_chksum(ptxdesc);
/* ----- end of fill tx desc ----- */
/* */
@ -1120,7 +1148,7 @@ s32 rtl8812au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
pipe = usb_sndbulkpipe(pdvobj->pusbdev, pHalData->Queue2EPNum[(u8)MGT_QUEUE_INX] & 0x0f);
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;
usb_anchor_urb(urb, &phostapdpriv->anchored);

View File

@ -94,12 +94,12 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
#ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX
if (padapter->registrypriv.mp_mode == 0)
{
if((PACKET_OFFSET_SZ != 0) && (!bagg_pkt)){
if((pull) && (pxmitframe->pkt_offset>0)) {
if ((PACKET_OFFSET_SZ != 0) && (!bagg_pkt)) {
if ((pull) && (pxmitframe->pkt_offset>0)) {
pxmitframe->pkt_offset = pxmitframe->pkt_offset -1;
}
}
}
}
#endif
//RTW_INFO("%s, pkt_offset=0x%02x\n",__FUNCTION__,pxmitframe->pkt_offset);
@ -125,13 +125,37 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
SET_TX_DESC_SEQ_8814A(ptxdesc, pattrib->seqnum);
}
if((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG)
{
//RTW_INFO("pxmitframe->frame_tag == DATA_FRAMETAG\n");
/* injected frame */
if (pattrib->inject == 0xa5) {
SET_TX_DESC_RETRY_LIMIT_ENABLE_8814A(ptxdesc, 1);
if (pattrib->retry_ctrl == _TRUE) {
SET_TX_DESC_DATA_RETRY_LIMIT_8814A(ptxdesc, 6);
} else {
SET_TX_DESC_DATA_RETRY_LIMIT_8814A(ptxdesc, 0);
}
if (pattrib->sgi == _TRUE) {
SET_TX_DESC_DATA_SHORT_8814A(ptxdesc, 1);
} else {
SET_TX_DESC_DATA_SHORT_8814A(ptxdesc, 0);
}
SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1);
SET_TX_DESC_TX_RATE_8814A(ptxdesc, MRateToHwRate(pattrib->rate));
if (pattrib->ldpc) {
SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 1);
} else {
SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 0);
}
SET_TX_DESC_DATA_STBC_8814A(ptxdesc, pattrib->stbc & 3);
SET_TX_DESC_DATA_BW_8814A(ptxdesc, pattrib->bwmode); // 0 - 20 MHz, 1 - 40 MHz, 2 - 80 MHz
}
else if ((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) {
//RTW_INFO("pxmitframe->frame_tag == DATA_FRAMETAG\n");
rtl8814a_fill_txdesc_sectype(pattrib, ptxdesc);
//offset 20
}
#ifdef CONFIG_USB_TX_AGGREGATION
if (pxmitframe->agg_num > 1){
//RTW_INFO("%s agg_num:%d\n",__FUNCTION__,pxmitframe->agg_num );
@ -223,17 +247,15 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
SET_TX_DESC_TX_RATE_8814A(ptxdesc, MRateToHwRate(pmlmeext->tx_rate));
}
}
else if((pxmitframe->frame_tag&0x0f)== MGNT_FRAMETAG)
{
//RTW_INFO("pxmitframe->frame_tag == MGNT_FRAMETAG\n");
if ((pxmitframe->frame_tag&0x0f)== MGNT_FRAMETAG) {
//RTW_INFO("pxmitframe->frame_tag == MGNT_FRAMETAG\n");
SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1);
DriverFixedRate = 0x01;
#ifdef CONFIG_INTEL_PROXIM
if((padapter->proximity.proxim_on==_TRUE)&&(pattrib->intel_proxim==_TRUE)){
RTW_INFO("\n %s pattrib->rate=%d\n",__FUNCTION__,pattrib->rate);
if ((padapter->proximity.proxim_on==_TRUE)&&(pattrib->intel_proxim==_TRUE)){
RTW_INFO("\n %s pattrib->rate=%d\n", __func__,pattrib->rate);
SET_TX_DESC_TX_RATE_8814A(ptxdesc, pattrib->rate);
}
else
@ -243,7 +265,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
}
// 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)))
{
SET_TX_DESC_NAV_USE_HDR_8814A(ptxdesc, 1);
@ -258,7 +280,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
//if(pattrib->rts_cca)
//{
// SET_TX_DESC_NDPA_8812(ptxdesc, 2);
//}
//}
//else
{
SET_TX_DESC_NDPA_8814A(ptxdesc, 1);
@ -308,34 +330,10 @@ 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_GID_8814A(ptxdesc, pattrib->txbf_g_id);
SET_TX_DESC_PAID_8814A(ptxdesc, pattrib->txbf_p_aid);
#if 0
/* injected frame */
if(pattrib->inject == 0xa5) {
SET_TX_DESC_RETRY_LIMIT_ENABLE_8814A(ptxdesc, 1);
if (pattrib->retry_ctrl == _TRUE) {
SET_TX_DESC_DATA_RETRY_LIMIT_8814A(ptxdesc, 6);
} else {
SET_TX_DESC_DATA_RETRY_LIMIT_8814A(ptxdesc, 0);
}
if(pattrib->sgi == _TRUE) {
SET_TX_DESC_DATA_SHORT_8814A(ptxdesc, 1);
} else {
SET_TX_DESC_DATA_SHORT_8814A(ptxdesc, 0);
}
SET_TX_DESC_USE_RATE_8814A(ptxdesc, 1);
SET_TX_DESC_TX_RATE_8814A(ptxdesc, MRateToHwRate(pattrib->rate));
if (pattrib->ldpc) {
SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 1);
} else {
SET_TX_DESC_DATA_LDPC_8814A(ptxdesc, 0);
}
SET_TX_DESC_DATA_STBC_8814A(ptxdesc, pattrib->stbc & 3);
SET_TX_DESC_DATA_BW_8814A(ptxdesc, pattrib->bwmode); // 0 - 20 MHz, 1 - 40 MHz, 2 - 80 MHz
}
#endif
SET_TX_DESC_PAID_8814A(ptxdesc, pattrib->txbf_p_aid);
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;
}
@ -428,12 +426,12 @@ static s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe)
mem_addr = pxmitframe->buf_addr;
//RTW_INFO("rtw_dump_xframe()\n");
for (t = 0; t < pattrib->nr_frags; t++)
{
if (inner_ret != _SUCCESS && ret == _SUCCESS)
ret = _FAIL;
if (t != (pattrib->nr_frags - 1))
{
RTW_DBG("pattrib->nr_frags=%d\n", pattrib->nr_frags);
@ -447,12 +445,11 @@ static s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe)
}
pull = update_txdesc(pxmitframe, mem_addr, sz, _FALSE);
if(pull)
{
if (pull) {
mem_addr += PACKET_OFFSET_SZ; //pull txdesc head
//pxmitbuf ->pbuf = mem_addr;
//pxmitbuf ->pbuf = mem_addr;
pxmitframe->buf_addr = mem_addr;
w_sz = sz + TXDESC_SIZE;
@ -460,7 +457,7 @@ static s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe)
else
{
w_sz = sz + TXDESC_SIZE + PACKET_OFFSET_SZ;
}
}
ff_hwaddr = rtw_get_ff_hwaddr(pxmitframe);
@ -481,12 +478,12 @@ static s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe)
mem_addr = (u8 *)RND4(((SIZE_PTR)(mem_addr)));
}
rtw_free_xmitframe(pxmitpriv, pxmitframe);
if (ret != _SUCCESS)
rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_UNKNOWN);
return ret;
}
@ -558,7 +555,7 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
//3 1. pick up first frame
do {
rtw_free_xmitframe(pxmitpriv, pxmitframe);
pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
if (pxmitframe == NULL) {
// no more xmit frame, release xmit buffer
@ -666,31 +663,30 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
xmitframe_phead = get_list_head(&ptxservq->sta_pending);
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);
xmitframe_plist = get_next(xmitframe_plist);
if(_FAIL == rtw_hal_busagg_qsel_check(padapter,pfirstframe->attrib.qsel,pxmitframe->attrib.qsel))
break;
pxmitframe->agg_num = 0; // not first frame of aggregation
pxmitframe->agg_num = 0; // not first frame of aggregation
#ifdef CONFIG_TX_EARLY_MODE
pxmitframe->pkt_offset = 1;// not first frame of aggregation,reserve offset for EM Info
#else
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);
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
{
//RTW_INFO("%s....len> MAX_XMITBUF_SZ\n",__FUNCTION__);
pxmitframe->agg_num = 1;
pxmitframe->pkt_offset = 1;
break;
pxmitframe->pkt_offset = 1;
break;
}
rtw_list_delete(&pxmitframe->list);
ptxservq->qcnt--;
@ -719,7 +715,7 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
// pxmitframe->pxmitbuf = pxmitbuf;
pxmitframe->buf_addr = pxmitbuf->pbuf + pbuf;
if (rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe) == _FALSE) {
RTW_INFO("%s coalesce failed \n",__FUNCTION__);
rtw_free_xmitframe(pxmitpriv, pxmitframe);
@ -732,7 +728,7 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
// (len - TXDESC_SIZE) == pxmitframe->attrib.last_txcmdsz
update_txdesc(pxmitframe, pxmitframe->buf_addr, pxmitframe->attrib.last_txcmdsz,_TRUE);
// don't need xmitframe any more
rtw_free_xmitframe(pxmitpriv, pxmitframe);
@ -742,9 +738,9 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
pfirstframe->agg_num++;
#ifdef CONFIG_TX_EARLY_MODE
pxmitpriv->agg_pkt[pfirstframe->agg_num-1].offset = _RND8(len);
pxmitpriv->agg_pkt[pfirstframe->agg_num-1].pkt_len = pxmitframe->attrib.last_txcmdsz;
#ifdef CONFIG_TX_EARLY_MODE
pxmitpriv->agg_pkt[pfirstframe->agg_num-1].offset = _RND8(len);
pxmitpriv->agg_pkt[pfirstframe->agg_num-1].pkt_len = pxmitframe->attrib.last_txcmdsz;
#endif
if (MAX_TX_AGG_PACKET_NUMBER == pfirstframe->agg_num)
break;
@ -789,15 +785,15 @@ agg_end:
#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX
update_txdesc(pfirstframe, pfirstframe->buf_addr, pfirstframe->attrib.last_txcmdsz,_TRUE);
#ifdef CONFIG_TX_EARLY_MODE
//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].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 );
#endif
//3 4. write xmit buffer to USB FIFO
ff_hwaddr = rtw_get_ff_hwaddr(pfirstframe);
//RTW_INFO("%s ===================================== write port,buf_size(%d) \n",__FUNCTION__,pbuf_tail);
@ -808,8 +804,8 @@ agg_end:
//3 5. update statisitc
pbuf_tail -= (pfirstframe->agg_num * TXDESC_SIZE);
pbuf_tail -= (pfirstframe->pkt_offset * PACKET_OFFSET_SZ);
rtw_count_tx_stats(padapter, pfirstframe, pbuf_tail);
rtw_free_xmitframe(pxmitpriv, pfirstframe);
@ -820,11 +816,11 @@ agg_end:
#else //CONFIG_USB_TX_AGGREGATION
s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
{
{
struct hw_xmit *phwxmits;
sint hwentry;
struct xmit_frame *pxmitframe=NULL;
struct xmit_frame *pxmitframe=NULL;
int res=_SUCCESS, xcnt = 0;
phwxmits = pxmitpriv->hwxmits;
@ -834,40 +830,40 @@ s32 rtl8814au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
if(pxmitbuf==NULL)
{
pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
if(!pxmitbuf)
{
return _FALSE;
}
}
}
}
do
{
{
pxmitframe = rtw_dequeue_xframe(pxmitpriv, phwxmits, hwentry);
if(pxmitframe)
{
pxmitframe->pxmitbuf = pxmitbuf;
pxmitframe->pxmitbuf = pxmitbuf;
pxmitframe->buf_addr = pxmitbuf->pbuf;
pxmitbuf->priv_data = pxmitframe;
pxmitbuf->priv_data = pxmitframe;
if((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG)
{
{
if(pxmitframe->attrib.priority<=15)//TID0~15
{
res = rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe);
}
}
//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_DBG("xmitframe_complete(): rtw_dump_xframe\n");
if(res == _SUCCESS)
{
rtw_dump_xframe(padapter, pxmitframe);

View File

@ -495,6 +495,8 @@ struct pkt_attrib {
u8 bf_pkt_type;
#endif
u8 inject; /* == a5 if injected */
};
#endif