mirror of
https://github.com/aircrack-ng/rtl8812au.git
synced 2024-11-22 13:24:36 +00:00
Ability to place rx descriptor into radiotap header
This commit is contained in:
parent
9bb391625f
commit
55b830f375
@ -3540,7 +3540,7 @@ exit:
|
||||
}
|
||||
#endif
|
||||
|
||||
static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, u8 *buf)
|
||||
static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe)
|
||||
{
|
||||
#define CHAN2FREQ(a) ((a < 14) ? (2407+5*a) : (5000+5*a))
|
||||
|
||||
@ -3593,7 +3593,7 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe,
|
||||
|
||||
u16 tmp_16bit = 0;
|
||||
|
||||
u8 data_rate[] = {
|
||||
static u8 data_rate[] = {
|
||||
2, 4, 11, 22, /* CCK */
|
||||
12, 18, 24, 36, 48, 72, 93, 108, /* OFDM */
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* HT MCS index */
|
||||
@ -3609,7 +3609,11 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe,
|
||||
struct ieee80211_radiotap_header *rtap_hdr = NULL;
|
||||
u8 *ptr = NULL;
|
||||
|
||||
#ifdef CONFIG_RADIOTAP_WITH_RXDESC
|
||||
u8 hdr_buf[128] = {0};
|
||||
#else
|
||||
u8 hdr_buf[64] = {0};
|
||||
#endif
|
||||
u16 rt_len = 8;
|
||||
u32 tmp_32bit;
|
||||
int i;
|
||||
@ -3635,8 +3639,16 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe,
|
||||
}
|
||||
tmp_32bit = (1<<IEEE80211_RADIOTAP_ANTENNA) |
|
||||
(1<<IEEE80211_RADIOTAP_DBM_ANTSIGNAL);
|
||||
|
||||
#ifdef CONFIG_RADIOTAP_WITH_RXDESC
|
||||
tmp_32bit |= (1 << IEEE80211_RADIOTAP_VENDOR_NAMESPACE);
|
||||
#endif
|
||||
memcpy(&hdr_buf[rt_len], &tmp_32bit, 4);
|
||||
rt_len += 4;
|
||||
} else {
|
||||
#ifdef CONFIG_RADIOTAP_WITH_RXDESC
|
||||
rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_VENDOR_NAMESPACE);
|
||||
#endif
|
||||
}
|
||||
/* tsft */
|
||||
if (pattrib->tsfl) {
|
||||
@ -3861,23 +3873,54 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe,
|
||||
rt_len ++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RADIOTAP_WITH_RXDESC
|
||||
rt_len += rt_len&1;
|
||||
hdr_buf[rt_len++] = 0xde;
|
||||
hdr_buf[rt_len++] = 0xab;
|
||||
hdr_buf[rt_len++] = 0xbe;
|
||||
hdr_buf[rt_len++] = 0xaf;
|
||||
hdr_buf[rt_len++] = 24;
|
||||
hdr_buf[rt_len++] = 0;
|
||||
_rtw_memcpy(hdr_buf + rt_len, pattrib->rxdesc, RXDESC_SIZE);
|
||||
rt_len += RXDESC_SIZE;
|
||||
#endif
|
||||
|
||||
/* push to skb */
|
||||
pskb = (_pkt *)buf;
|
||||
/* read skb information from recv frame */
|
||||
pskb = precvframe->u.hdr.pkt;
|
||||
pskb->len = precvframe->u.hdr.len;
|
||||
pskb->data = precvframe->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(pskb, precvframe->u.hdr.len);
|
||||
|
||||
if (skb_headroom(pskb) < rt_len) {
|
||||
RTW_INFO("%s:%d %s headroom is too small.\n", __FILE__, __LINE__, __func__);
|
||||
ret = _FAIL;
|
||||
return ret;
|
||||
pskb = skb_realloc_headroom(pskb, rt_len);
|
||||
if(pskb == NULL) {
|
||||
RTW_INFO("%s:%d %s headroom is too small.\n", __FILE__, __LINE__, __func__);
|
||||
ret = _FAIL;
|
||||
return ret;
|
||||
}
|
||||
precvframe->u.hdr.pkt = pskb;
|
||||
}
|
||||
|
||||
ptr = skb_push(pskb, rt_len);
|
||||
if (ptr) {
|
||||
rtap_hdr->it_len = cpu_to_le16(rt_len);
|
||||
memcpy(ptr, rtap_hdr, rt_len);
|
||||
} else
|
||||
_rtw_memcpy(ptr, rtap_hdr, rt_len);
|
||||
} else {
|
||||
ret = _FAIL;
|
||||
return ret;
|
||||
}
|
||||
out:
|
||||
/* write skb information to recv frame */
|
||||
skb_reset_mac_header(pskb);
|
||||
precvframe->u.hdr.len = pskb->len;
|
||||
precvframe->u.hdr.rx_data = pskb->data;
|
||||
precvframe->u.hdr.rx_head = pskb->head;
|
||||
precvframe->u.hdr.rx_tail = skb_tail_pointer(pskb);
|
||||
precvframe->u.hdr.rx_end = skb_end_pointer(pskb);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int recv_frame_monitor(_adapter *padapter, union recv_frame *rframe)
|
||||
@ -3888,27 +3931,14 @@ int recv_frame_monitor(_adapter *padapter, union recv_frame *rframe)
|
||||
_queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;
|
||||
_pkt *pskb = NULL;
|
||||
|
||||
/* read skb information from recv frame */
|
||||
pskb = rframe->u.hdr.pkt;
|
||||
pskb->len = rframe->u.hdr.len;
|
||||
pskb->data = rframe->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(pskb, rframe->u.hdr.len);
|
||||
|
||||
/* fill radiotap header */
|
||||
if (fill_radiotap_hdr(padapter, rframe, (u8 *)pskb) == _FAIL) {
|
||||
if (fill_radiotap_hdr(padapter, rframe) == _FAIL) {
|
||||
ret = _FAIL;
|
||||
rtw_free_recvframe(rframe, pfree_recv_queue); /* free this recv_frame */
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* write skb information to recv frame */
|
||||
skb_reset_mac_header(pskb);
|
||||
rframe->u.hdr.len = pskb->len;
|
||||
rframe->u.hdr.rx_data = pskb->data;
|
||||
rframe->u.hdr.rx_head = pskb->head;
|
||||
rframe->u.hdr.rx_tail = skb_tail_pointer(pskb);
|
||||
rframe->u.hdr.rx_end = skb_end_pointer(pskb);
|
||||
|
||||
if (!RTW_CANNOT_RUN(padapter)) {
|
||||
/* indicate this recv_frame */
|
||||
ret = rtw_recv_monitor(padapter, rframe);
|
||||
|
@ -28,6 +28,10 @@ void rtl8812_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc)
|
||||
|
||||
_rtw_memset(pattrib, 0, sizeof(struct rx_pkt_attrib));
|
||||
|
||||
#ifdef CONFIG_RADIOTAP_WITH_RXDESC
|
||||
_rtw_memcpy(pattrib->rxdesc, pdesc, RXDESC_SIZE);
|
||||
#endif
|
||||
|
||||
/* Offset 0 */
|
||||
pattrib->pkt_len = (u16)GET_RX_STATUS_DESC_PKT_LEN_8812(pdesc);/* (le32_to_cpu(pdesc->rxdw0)&0x00003fff) */
|
||||
pattrib->crc_err = (u8)GET_RX_STATUS_DESC_CRC32_8812(pdesc);/* ((le32_to_cpu(pdesc->rxdw0) >> 14) & 0x1); */
|
||||
|
@ -174,6 +174,9 @@ typedef struct _ODM_Phy_Status_Info_ {
|
||||
} ODM_PHY_INFO_T, *PODM_PHY_INFO_T;
|
||||
#endif
|
||||
|
||||
#define RXDESC_SIZE 24
|
||||
#define RXDESC_OFFSET RXDESC_SIZE
|
||||
|
||||
struct phy_info {
|
||||
u8 RxPWDBAll;
|
||||
u8 SignalQuality; /* in 0-100 index. */
|
||||
@ -266,6 +269,10 @@ struct rx_pkt_attrib {
|
||||
u32 tsfl;
|
||||
u32 MacIDValidEntry[2]; /* 64 bits present 64 entry. */
|
||||
|
||||
#ifdef CONFIG_RADIOTAP_WITH_RXDESC
|
||||
u8 rxdesc[RXDESC_SIZE];
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
u8 signal_qual;
|
||||
s8 rx_mimo_signal_qual[2];
|
||||
@ -292,9 +299,6 @@ struct rx_pkt_attrib {
|
||||
#define RXBD_SIZE sizeof(struct recv_stat)
|
||||
#endif
|
||||
|
||||
#define RXDESC_SIZE 24
|
||||
#define RXDESC_OFFSET RXDESC_SIZE
|
||||
|
||||
#ifdef CONFIG_TRX_BD_ARCH
|
||||
struct rx_buf_desc {
|
||||
/* RX has exactly one segment */
|
||||
|
Loading…
Reference in New Issue
Block a user