mirror of
https://github.com/chinawrj/rtl8812au
synced 2024-11-27 15:44:18 +00:00
Added frame injection capabilities (tested working)
This commit is contained in:
parent
83e1baa6c1
commit
506f1e3c11
@ -7505,21 +7505,22 @@ void update_mgnt_tx_rate(_adapter *padapter, u8 rate)
|
|||||||
/* RTW_INFO("%s(): rate = %x\n",__FUNCTION__, rate); */
|
/* RTW_INFO("%s(): rate = %x\n",__FUNCTION__, rate); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void update_monitor_frame_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
|
void update_monitor_frame_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
|
||||||
{
|
{
|
||||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||||
u8 wireless_mode;
|
u8 wireless_mode;
|
||||||
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
||||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
//struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||||
struct sta_info *psta = NULL;
|
//struct sta_info *psta = NULL;
|
||||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
//struct sta_priv *pstapriv = &padapter->stapriv;
|
||||||
|
|
||||||
psta = rtw_get_stainfo(pstapriv, pattrib->ra);
|
//psta = rtw_get_stainfo(pstapriv, pattrib->ra);
|
||||||
|
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||||
|
|
||||||
pattrib->hdrlen = 24;
|
pattrib->hdrlen = 24;
|
||||||
pattrib->nr_frags = 1;
|
pattrib->nr_frags = 1;
|
||||||
pattrib->priority = 7;
|
pattrib->priority = 7;
|
||||||
|
pattrib->inject = 0xa5;
|
||||||
pattrib->mac_id = RTW_DEFAULT_MGMT_MACID;
|
pattrib->mac_id = RTW_DEFAULT_MGMT_MACID;
|
||||||
pattrib->qsel = QSLT_MGNT;
|
pattrib->qsel = QSLT_MGNT;
|
||||||
|
|
||||||
@ -7531,22 +7532,22 @@ void update_monitor_frame_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
|
|||||||
wireless_mode = WIRELESS_11G;
|
wireless_mode = WIRELESS_11G;
|
||||||
|
|
||||||
pattrib->raid = rtw_get_mgntframe_raid(padapter, wireless_mode);
|
pattrib->raid = rtw_get_mgntframe_raid(padapter, wireless_mode);
|
||||||
#ifdef CONFIG_80211AC_VHT
|
#ifdef CONFIG_80211AC_VHT
|
||||||
if (pHalData->rf_type == RF_1T1R)
|
if (pHalData->rf_type == RF_1T1R)
|
||||||
pattrib->raid = RATEID_IDX_VHT_1SS;
|
pattrib->raid = RATEID_IDX_VHT_1SS;
|
||||||
else if (pHalData->rf_type == RF_2T2R || pHalData->rf_type == RF_2T4R)
|
else if (pHalData->rf_type == RF_2T2R || pHalData->rf_type == RF_2T4R)
|
||||||
pattrib->raid = RATEID_IDX_VHT_2SS;
|
pattrib->raid = RATEID_IDX_VHT_2SS;
|
||||||
else if (pHalData->rf_type == RF_3T3R)
|
else if (pHalData->rf_type == RF_3T3R)
|
||||||
pattrib->raid = RATEID_IDX_VHT_3SS;
|
pattrib->raid = RATEID_IDX_VHT_3SS;
|
||||||
else
|
else
|
||||||
pattrib->raid = RATEID_IDX_BGN_40M_1SS;
|
pattrib->raid = RATEID_IDX_BGN_40M_1SS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_80211AC_VHT
|
#ifdef CONFIG_80211AC_VHT
|
||||||
pattrib->rate = MGN_VHT1SS_MCS9;
|
pattrib->rate = MGN_VHT1SS_MCS9;
|
||||||
#else
|
#else
|
||||||
pattrib->rate = MGN_MCS7;
|
pattrib->rate = MGN_MCS7;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pattrib->encrypt = _NO_PRIVACY_;
|
pattrib->encrypt = _NO_PRIVACY_;
|
||||||
pattrib->bswenc = _FALSE;
|
pattrib->bswenc = _FALSE;
|
||||||
@ -7559,14 +7560,13 @@ void update_monitor_frame_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
|
|||||||
|
|
||||||
pattrib->seqnum = pmlmeext->mgnt_seq;
|
pattrib->seqnum = pmlmeext->mgnt_seq;
|
||||||
|
|
||||||
pattrib->retry_ctrl = _TRUE;
|
pattrib->retry_ctrl = _FALSE;
|
||||||
|
|
||||||
pattrib->mbssid = 0;
|
pattrib->mbssid = 0;
|
||||||
pattrib->hw_ssn_sel = pxmitpriv->hw_ssn_seq_no;
|
pattrib->hw_ssn_sel = pxmitpriv->hw_ssn_seq_no;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void update_mgntframe_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
|
void update_mgntframe_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
|
||||||
{
|
{
|
||||||
u8 wireless_mode;
|
u8 wireless_mode;
|
||||||
@ -7589,7 +7589,6 @@ void update_mgntframe_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
|
|||||||
update_mcc_mgntframe_attrib(padapter, pattrib);
|
update_mcc_mgntframe_attrib(padapter, pattrib);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_P2P_PS_NOA_USE_MACID_SLEEP
|
#ifdef CONFIG_P2P_PS_NOA_USE_MACID_SLEEP
|
||||||
#ifdef CONFIG_CONCURRENT_MODE
|
#ifdef CONFIG_CONCURRENT_MODE
|
||||||
if (rtw_mi_buddy_check_fwstate(padapter, WIFI_ASOC_STATE))
|
if (rtw_mi_buddy_check_fwstate(padapter, WIFI_ASOC_STATE))
|
||||||
@ -7615,7 +7614,6 @@ void update_mgntframe_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_P2P_PS_NOA_USE_MACID_SLEEP */
|
#endif /* CONFIG_P2P_PS_NOA_USE_MACID_SLEEP */
|
||||||
|
|
||||||
|
|
||||||
pattrib->pktlen = 0;
|
pattrib->pktlen = 0;
|
||||||
|
|
||||||
if (IS_CCK_RATE(pmlmeext->tx_rate))
|
if (IS_CCK_RATE(pmlmeext->tx_rate))
|
||||||
@ -7746,7 +7744,6 @@ s32 dump_mgntframe_and_wait_ack(_adapter *padapter, struct xmit_frame *pmgntfram
|
|||||||
return dump_mgntframe_and_wait_ack_timeout(padapter, pmgntframe, 500);
|
return dump_mgntframe_and_wait_ack_timeout(padapter, pmgntframe, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode)
|
int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode)
|
||||||
{
|
{
|
||||||
u8 *ssid_ie;
|
u8 *ssid_ie;
|
||||||
@ -7803,7 +7800,6 @@ void issue_beacon(_adapter *padapter, int timeout_ms)
|
|||||||
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
|
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
|
||||||
#endif /* CONFIG_P2P */
|
#endif /* CONFIG_P2P */
|
||||||
|
|
||||||
|
|
||||||
/* RTW_INFO("%s\n", __FUNCTION__); */
|
/* RTW_INFO("%s\n", __FUNCTION__); */
|
||||||
|
|
||||||
#ifdef CONFIG_BCN_ICF
|
#ifdef CONFIG_BCN_ICF
|
||||||
@ -7840,7 +7836,6 @@ void issue_beacon(_adapter *padapter, int timeout_ms)
|
|||||||
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
|
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
|
||||||
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
|
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
|
||||||
|
|
||||||
|
|
||||||
fctrl = &(pwlanhdr->frame_ctl);
|
fctrl = &(pwlanhdr->frame_ctl);
|
||||||
*(fctrl) = 0;
|
*(fctrl) = 0;
|
||||||
|
|
||||||
@ -8020,7 +8015,7 @@ void issue_beacon(_adapter *padapter, int timeout_ms)
|
|||||||
pattrib->pktlen += rtw_build_vendor_ie(padapter , &pframe , WIFI_BEACON_VENDOR_IE_BIT);
|
pattrib->pktlen += rtw_build_vendor_ie(padapter , &pframe , WIFI_BEACON_VENDOR_IE_BIT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_RTL8812A
|
#ifdef CONFIG_RTL8812A
|
||||||
pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen );
|
pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen );
|
||||||
#endif/*CONFIG_RTL8812A*/
|
#endif/*CONFIG_RTL8812A*/
|
||||||
|
|
||||||
@ -8071,7 +8066,6 @@ void issue_beacon(_adapter *padapter, int timeout_ms)
|
|||||||
pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
|
pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* EXTERNDED SUPPORTED RATE */
|
/* EXTERNDED SUPPORTED RATE */
|
||||||
if (rate_len > 8)
|
if (rate_len > 8)
|
||||||
pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
|
pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
|
||||||
@ -8140,7 +8134,6 @@ void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* update attribute */
|
/* update attribute */
|
||||||
pattrib = &pmgntframe->attrib;
|
pattrib = &pmgntframe->attrib;
|
||||||
update_mgntframe_attrib(padapter, pattrib);
|
update_mgntframe_attrib(padapter, pattrib);
|
||||||
@ -8167,7 +8160,6 @@ void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probe
|
|||||||
pattrib->pktlen = pattrib->hdrlen;
|
pattrib->pktlen = pattrib->hdrlen;
|
||||||
pframe += pattrib->hdrlen;
|
pframe += pattrib->hdrlen;
|
||||||
|
|
||||||
|
|
||||||
if (cur_network->IELength > MAX_IE_SZ)
|
if (cur_network->IELength > MAX_IE_SZ)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -8293,12 +8285,10 @@ void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probe
|
|||||||
pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
|
pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* EXTERNDED SUPPORTED RATE */
|
/* EXTERNDED SUPPORTED RATE */
|
||||||
if (rate_len > 8)
|
if (rate_len > 8)
|
||||||
pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
|
pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
|
||||||
|
|
||||||
|
|
||||||
/* todo:HT for adhoc */
|
/* todo:HT for adhoc */
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -8341,7 +8331,6 @@ void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probe
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_P2P */
|
#endif /* CONFIG_P2P */
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_AUTO_AP_MODE
|
#ifdef CONFIG_AUTO_AP_MODE
|
||||||
{
|
{
|
||||||
struct sta_info *psta;
|
struct sta_info *psta;
|
||||||
@ -8371,13 +8360,12 @@ void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probe
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_AUTO_AP_MODE */
|
#endif /* CONFIG_AUTO_AP_MODE */
|
||||||
|
|
||||||
#ifdef CONFIG_RTL8812A
|
#ifdef CONFIG_RTL8812A
|
||||||
pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen);
|
pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen);
|
||||||
#endif/*CONFIG_RTL8812A*/
|
#endif/*CONFIG_RTL8812A*/
|
||||||
|
|
||||||
pattrib->last_txcmdsz = pattrib->pktlen;
|
pattrib->last_txcmdsz = pattrib->pktlen;
|
||||||
|
|
||||||
|
|
||||||
dump_mgntframe(padapter, pmgntframe);
|
dump_mgntframe(padapter, pmgntframe);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -8414,7 +8402,6 @@ int _issue_probereq(_adapter *padapter, const NDIS_802_11_SSID *pssid, const u8
|
|||||||
pattrib = &pmgntframe->attrib;
|
pattrib = &pmgntframe->attrib;
|
||||||
update_mgntframe_attrib(padapter, pattrib);
|
update_mgntframe_attrib(padapter, pattrib);
|
||||||
|
|
||||||
|
|
||||||
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
|
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
|
||||||
|
|
||||||
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
|
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
|
||||||
@ -8505,14 +8492,12 @@ int _issue_probereq(_adapter *padapter, const NDIS_802_11_SSID *pssid, const u8
|
|||||||
pattrib->pktlen += rtw_build_vendor_ie(padapter , &pframe , WIFI_PROBEREQ_VENDOR_IE_BIT);
|
pattrib->pktlen += rtw_build_vendor_ie(padapter , &pframe , WIFI_PROBEREQ_VENDOR_IE_BIT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_RTL8812A
|
#ifdef CONFIG_RTL8812A
|
||||||
pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen );
|
pframe = rtw_hal_set_8812a_vendor_ie(padapter, pframe, &pattrib->pktlen );
|
||||||
#endif/*CONFIG_RTL8812A*/
|
#endif /* CONFIG_RTL8812A */
|
||||||
|
|
||||||
|
|
||||||
pattrib->last_txcmdsz = pattrib->pktlen;
|
pattrib->last_txcmdsz = pattrib->pktlen;
|
||||||
|
|
||||||
|
|
||||||
if (wait_ack)
|
if (wait_ack)
|
||||||
ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
|
ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
|
||||||
else {
|
else {
|
||||||
@ -8690,7 +8675,6 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status
|
|||||||
val16 = cpu_to_le16(val16);
|
val16 = cpu_to_le16(val16);
|
||||||
pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
|
pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
|
||||||
|
|
||||||
|
|
||||||
/* setting status code... */
|
/* setting status code... */
|
||||||
val16 = status;
|
val16 = status;
|
||||||
val16 = cpu_to_le16(val16);
|
val16 = cpu_to_le16(val16);
|
||||||
@ -8727,7 +8711,6 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *pstat, int pkt_type)
|
void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *pstat, int pkt_type)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_AP_MODE
|
#ifdef CONFIG_AP_MODE
|
||||||
@ -8764,7 +8747,6 @@ void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *p
|
|||||||
pattrib = &pmgntframe->attrib;
|
pattrib = &pmgntframe->attrib;
|
||||||
update_mgntframe_attrib(padapter, pattrib);
|
update_mgntframe_attrib(padapter, pattrib);
|
||||||
|
|
||||||
|
|
||||||
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
|
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
|
||||||
|
|
||||||
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
|
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
|
||||||
|
185
core/rtw_xmit.c
185
core/rtw_xmit.c
@ -4391,6 +4391,15 @@ static void do_queue_select(_adapter *padapter, struct pkt_attrib *pattrib)
|
|||||||
#endif /* CONFIG_MCC_MODE */
|
#endif /* CONFIG_MCC_MODE */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void dump_buf(u8 *buf, u32 len)
|
||||||
|
{
|
||||||
|
u32 i;
|
||||||
|
printk("-----------------Len %d----------------\n", len);
|
||||||
|
for(i=0; i<len; i++)
|
||||||
|
printk("%2.2x-", *(buf+i));
|
||||||
|
printk("\n");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The main transmit(tx) entry
|
* The main transmit(tx) entry
|
||||||
*
|
*
|
||||||
@ -4399,82 +4408,178 @@ static void do_queue_select(_adapter *padapter, struct pkt_attrib *pattrib)
|
|||||||
* 0 success, hardware will handle this xmit frame(packet)
|
* 0 success, hardware will handle this xmit frame(packet)
|
||||||
* <0 fail
|
* <0 fail
|
||||||
*/
|
*/
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
|
|
||||||
|
int rtw_ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
|
||||||
|
void update_monitor_frame_attrib(_adapter *padapter, struct pkt_attrib *pattrib);
|
||||||
|
int rtw_ieee80211_radiotap_iterator_init(
|
||||||
|
struct ieee80211_radiotap_iterator *iterator,
|
||||||
|
struct ieee80211_radiotap_header *radiotap_header,
|
||||||
|
int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
|
||||||
s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
|
int rtap_len;
|
||||||
|
int qos_len = 0;
|
||||||
|
int dot11_hdr_len = 24;
|
||||||
|
int snap_len = 6;
|
||||||
|
unsigned char *pdata;
|
||||||
u16 frame_ctl;
|
u16 frame_ctl;
|
||||||
struct ieee80211_radiotap_header rtap_hdr;
|
unsigned char src_mac_addr[6];
|
||||||
|
unsigned char dst_mac_addr[6];
|
||||||
|
struct ieee80211_hdr *dot11_hdr;
|
||||||
|
struct ieee80211_radiotap_header *rtap_hdr;
|
||||||
|
struct ieee80211_radiotap_iterator iterator;
|
||||||
|
u8 fixed_rate = MGN_1M, sgi = 0, bwidth = 0, ldpc = 0, stbc = 0;
|
||||||
|
u16 txflags = 0;
|
||||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
|
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
|
||||||
|
|
||||||
struct pkt_file pktfile;
|
struct pkt_file pktfile;
|
||||||
struct rtw_ieee80211_hdr *pwlanhdr;
|
struct ieee80211_hdr *pwlanhdr;
|
||||||
struct pkt_attrib *pattrib;
|
struct pkt_attrib *pattrib;
|
||||||
struct xmit_frame *pmgntframe;
|
struct xmit_frame *pmgntframe;
|
||||||
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
||||||
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
|
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
|
||||||
unsigned char *pframe;
|
unsigned char *pframe;
|
||||||
u8 dummybuf[32];
|
u8 *buf = skb->data;
|
||||||
int len = skb->len, rtap_len;
|
u32 len = skb->len;
|
||||||
|
u8 category, action;
|
||||||
|
int type = -1;
|
||||||
|
//u8 dummybuf[32];
|
||||||
|
//int len = skb->len, rtap_len;
|
||||||
|
|
||||||
|
//RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
|
||||||
|
|
||||||
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
|
if (skb)
|
||||||
|
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
|
||||||
|
|
||||||
#ifndef CONFIG_CUSTOMER_ALIBABA_GENERAL
|
//#ifndef CONFIG_CUSTOMER_ALIBABA_GENERAL
|
||||||
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
|
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
_rtw_open_pktfile((_pkt *)skb, &pktfile);
|
//_rtw_open_pktfile((_pkt *)skb, &pktfile);
|
||||||
_rtw_pktfile_read(&pktfile, (u8 *)(&rtap_hdr), sizeof(struct ieee80211_radiotap_header));
|
//_rtw_pktfile_read(&pktfile, (u8 *)(&rtap_hdr), sizeof(struct ieee80211_radiotap_header));
|
||||||
rtap_len = ieee80211_get_radiotap_len((u8 *)(&rtap_hdr));
|
|
||||||
if (unlikely(rtap_hdr.it_version))
|
rtap_hdr = (struct ieee80211_radiotap_header *)skb->data;
|
||||||
|
if (unlikely(rtap_hdr->it_version))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (unlikely(skb->len < rtap_len))
|
if (unlikely(skb->len < rtap_len))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (rtap_len != 12) {
|
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) {
|
||||||
RTW_INFO("radiotap len (should be 14): %d\n", rtap_len);
|
DBG_COUNTER(padapter->tx_logs.core_tx_err_pxmitframe);
|
||||||
goto fail;
|
return NETDEV_TX_BUSY;
|
||||||
}
|
}
|
||||||
_rtw_pktfile_read(&pktfile, dummybuf, rtap_len-sizeof(struct ieee80211_radiotap_header));
|
|
||||||
len = len - rtap_len;
|
ret = rtw_ieee80211_radiotap_iterator_init(&iterator, rtap_hdr, skb->len, NULL);
|
||||||
#endif
|
while (!ret) {
|
||||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
ret = rtw_ieee80211_radiotap_iterator_next(&iterator);
|
||||||
if (pmgntframe == NULL) {
|
|
||||||
rtw_udelay_os(500);
|
if (ret)
|
||||||
goto fail;
|
continue;
|
||||||
|
|
||||||
|
/* see if this argument is something we can use */
|
||||||
|
switch (iterator.this_arg_index) {
|
||||||
|
|
||||||
|
case IEEE80211_RADIOTAP_RATE: /* u8 */
|
||||||
|
fixed_rate = *iterator.this_arg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IEEE80211_RADIOTAP_TX_FLAGS:
|
||||||
|
txflags = get_unaligned_le16(iterator.this_arg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IEEE80211_RADIOTAP_MCS: { /* u8,u8,u8 */
|
||||||
|
u8 mcs_have = iterator.this_arg[0];
|
||||||
|
if (mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_MCS) {
|
||||||
|
fixed_rate = iterator.this_arg[2] & 0x7f;
|
||||||
|
if(fixed_rate > 31)
|
||||||
|
fixed_rate = 0;
|
||||||
|
fixed_rate += MGN_MCS0;
|
||||||
|
}
|
||||||
|
if ((mcs_have & 4) &&
|
||||||
|
(iterator.this_arg[1] & 4))
|
||||||
|
sgi = 1;
|
||||||
|
if ((mcs_have & 1) &&
|
||||||
|
(iterator.this_arg[1] & 1))
|
||||||
|
bwidth = 1;
|
||||||
|
if ((mcs_have & 0x10) &&
|
||||||
|
(iterator.this_arg[1] & 0x10))
|
||||||
|
ldpc = 1;
|
||||||
|
if ((mcs_have & 0x20))
|
||||||
|
stbc = (iterator.this_arg[1] >> 5) & 3;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IEEE80211_RADIOTAP_VHT: {
|
||||||
|
/* u16 known, u8 flags, u8 bandwidth, u8 mcs_nss[4], u8 coding, u8 group_id, u16 partial_aid */
|
||||||
|
u8 known = iterator.this_arg[0];
|
||||||
|
u8 flags = iterator.this_arg[2];
|
||||||
|
unsigned int mcs, nss;
|
||||||
|
if((known & 4) && (flags & 4))
|
||||||
|
sgi = 1;
|
||||||
|
if((known & 1) && (flags & 1))
|
||||||
|
stbc = 1;
|
||||||
|
if(known & 0x40) {
|
||||||
|
bwidth = iterator.this_arg[3] & 0x1f;
|
||||||
|
if(bwidth>=1 && bwidth<=3)
|
||||||
|
bwidth = 1; // 40 MHz
|
||||||
|
else if(bwidth>=4 && bwidth<=10)
|
||||||
|
bwidth = 2; // 80 MHz
|
||||||
|
else
|
||||||
|
bwidth = 0; // 20 MHz
|
||||||
|
}
|
||||||
|
if(iterator.this_arg[8] & 1)
|
||||||
|
ldpc = 1;
|
||||||
|
mcs = (iterator.this_arg[4]>>4) & 0x0f;
|
||||||
|
nss = iterator.this_arg[4] & 0x0f;
|
||||||
|
if(nss > 0) {
|
||||||
|
if(nss > 4) nss = 4;
|
||||||
|
if(mcs > 9) mcs = 9;
|
||||||
|
fixed_rate = MGN_VHT1SS_MCS0 + ((nss-1)*10 + mcs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/* Skip the ratio tap header */
|
||||||
|
skb_pull(skb, rtap_len);
|
||||||
|
|
||||||
|
// dot11_hdr = (struct ieee80211_hdr *)skb->data;
|
||||||
|
// frame_ctl = le16_to_cpu(dot11_hdr->frame_control);
|
||||||
|
/* Check if the QoS bit is set */
|
||||||
|
|
||||||
|
pattrib = &pmgntframe->attrib;
|
||||||
|
update_monitor_frame_attrib(padapter, pattrib);
|
||||||
|
|
||||||
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
|
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
|
||||||
|
|
||||||
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
|
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
|
||||||
// _rtw_memcpy(pframe, (void *)checking, len);
|
|
||||||
_rtw_pktfile_read(&pktfile, pframe, len);
|
|
||||||
|
|
||||||
|
_rtw_memcpy(pframe, (void*)skb->data, skb->len);
|
||||||
|
|
||||||
/* Check DATA/MGNT frames */
|
pattrib->pktlen = skb->len;
|
||||||
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
|
|
||||||
frame_ctl = le16_to_cpu(pwlanhdr->frame_ctl);
|
|
||||||
if ((frame_ctl & RTW_IEEE80211_FCTL_FTYPE) == RTW_IEEE80211_FTYPE_DATA) {
|
|
||||||
|
|
||||||
pattrib = &pmgntframe->attrib;
|
pattrib->rate = fixed_rate;
|
||||||
update_monitor_frame_attrib(padapter, pattrib);
|
pattrib->sgi = sgi;
|
||||||
|
pattrib->bwmode = bwidth; // 0-20 MHz, 1-40 MHz, 2-80 MHz
|
||||||
|
pattrib->ldpc = ldpc;
|
||||||
|
pattrib->stbc = stbc;
|
||||||
|
pattrib->retry_ctrl = (txflags & 0x08)?_FALSE:_TRUE;
|
||||||
|
|
||||||
if (is_broadcast_mac_addr(pwlanhdr->addr3) || is_broadcast_mac_addr(pwlanhdr->addr1))
|
pwlanhdr = (struct ieee80211_hdr *)pframe;
|
||||||
pattrib->rate = MGN_24M;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
pattrib = &pmgntframe->attrib;
|
|
||||||
update_mgntframe_attrib(padapter, pattrib);
|
|
||||||
|
|
||||||
}
|
|
||||||
pattrib->retry_ctrl = _FALSE;
|
|
||||||
pattrib->pktlen = len;
|
|
||||||
pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
|
pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
|
||||||
pattrib->seqnum = pmlmeext->mgnt_seq;
|
pattrib->seqnum = pmlmeext->mgnt_seq;
|
||||||
pmlmeext->mgnt_seq++;
|
pmlmeext->mgnt_seq++;
|
||||||
pattrib->last_txcmdsz = pattrib->pktlen;
|
|
||||||
|
|
||||||
|
pattrib->last_txcmdsz = pattrib->pktlen;
|
||||||
dump_mgntframe(padapter, pmgntframe);
|
dump_mgntframe(padapter, pmgntframe);
|
||||||
|
DBG_COUNTER(padapter->tx_logs.core_tx);
|
||||||
pxmitpriv->tx_pkts++;
|
pxmitpriv->tx_pkts++;
|
||||||
pxmitpriv->tx_bytes += skb->len;
|
pxmitpriv->tx_bytes += skb->len;
|
||||||
|
|
||||||
|
@ -339,6 +339,32 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba
|
|||||||
SET_TX_DESC_GID_8812(ptxdesc, pattrib->txbf_g_id);
|
SET_TX_DESC_GID_8812(ptxdesc, pattrib->txbf_g_id);
|
||||||
SET_TX_DESC_PAID_8812(ptxdesc, pattrib->txbf_p_aid);
|
SET_TX_DESC_PAID_8812(ptxdesc, pattrib->txbf_p_aid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
}
|
||||||
|
SET_TX_DESC_USE_RATE_8812(ptxdesc, 1);
|
||||||
|
SET_TX_DESC_TX_RATE_8812(ptxdesc, MRateToHwRate(pattrib->rate));
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
rtl8812a_cal_txdesc_chksum(ptxdesc);
|
rtl8812a_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;
|
||||||
@ -517,6 +543,7 @@ 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, 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); */
|
||||||
|
//RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("rtw_write_port, w_sz=%d\n", w_sz));
|
||||||
|
|
||||||
mem_addr += w_sz;
|
mem_addr += w_sz;
|
||||||
|
|
||||||
@ -1114,13 +1141,11 @@ s32 rtl8812au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
|
|||||||
|
|
||||||
/* 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. */
|
||||||
|
|
||||||
|
rtl8812au_cal_txdesc_chksum(ptxdesc);
|
||||||
rtl8188eu_cal_txdesc_chksum(ptxdesc);
|
|
||||||
/* ----- end of fill tx desc ----- */
|
/* ----- end of fill tx desc ----- */
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
@ -1138,7 +1163,7 @@ s32 rtl8812au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
|
|||||||
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, rtl8812au_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);
|
||||||
|
@ -310,6 +310,33 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
|
|||||||
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 */
|
||||||
|
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);
|
||||||
|
SET_TX_DESC_DATA_STBC_8814A(ptxdesc, pattrib->stbc & 3);
|
||||||
|
//SET_TX_DESC_GF_8814A(ptxdesc, 1); // no MCS rates if sets, GreenField?
|
||||||
|
//SET_TX_DESC_LSIG_TXOP_EN_8814A(ptxdesc, 1);
|
||||||
|
//SET_TX_DESC_HTC_8814A(ptxdesc, 1);
|
||||||
|
//SET_TX_DESC_NO_ACM_8814A(ptxdesc, 1);
|
||||||
|
SET_TX_DESC_DATA_BW_8814A(ptxdesc, pattrib->bwmode); // 0 - 20 MHz, 1 - 40 MHz, 2 - 80 MHz
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
@ -1078,7 +1105,7 @@ s32 rtl8814au_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.
|
ptxdesc->txdw3 |= cpu_to_le32((8 <<28)); //set bit3 to 1. Suugested by TimChen. 2009.12.29.
|
||||||
|
|
||||||
|
|
||||||
rtl8188eu_cal_txdesc_chksum(ptxdesc);
|
rtl8814a_cal_txdesc_chksum(ptxdesc);
|
||||||
// ----- end of fill tx desc -----
|
// ----- end of fill tx desc -----
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1096,7 +1123,7 @@ s32 rtl8814au_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
|
|||||||
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, rtl8814a_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);
|
||||||
|
@ -496,6 +496,7 @@ struct pkt_attrib {
|
|||||||
*/
|
*/
|
||||||
u8 bf_pkt_type;
|
u8 bf_pkt_type;
|
||||||
#endif
|
#endif
|
||||||
|
u8 inject; /* == a5 if injected */
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -564,7 +565,6 @@ enum {
|
|||||||
RTX_SCTX_CSTR_WAIT_RPT2,
|
RTX_SCTX_CSTR_WAIT_RPT2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms);
|
void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms);
|
||||||
int rtw_sctx_wait(struct submit_ctx *sctx, const char *msg);
|
int rtw_sctx_wait(struct submit_ctx *sctx, const char *msg);
|
||||||
void rtw_sctx_done_err(struct submit_ctx **sctx, int status);
|
void rtw_sctx_done_err(struct submit_ctx **sctx, int status);
|
||||||
|
Loading…
Reference in New Issue
Block a user