mirror of
https://github.com/MiSTer-devel/Linux-Kernel_MiSTer.git
synced 2026-04-19 03:04:24 +00:00
Sync rtl8821au with upstream
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
config RTL8812AU
|
||||
tristate "Realtek 8812A USB WiFi"
|
||||
depends on USB
|
||||
select WIRELESS_EXT
|
||||
help
|
||||
Help message of RTL8812AU
|
||||
|
||||
|
||||
@@ -2511,7 +2511,7 @@ install:
|
||||
/sbin/depmod -a ${KVER}
|
||||
|
||||
uninstall:
|
||||
rm -f $(MODDESTDIR)/$(MODULE_NAME).ko
|
||||
rm -f $(MODDESTDIR)$(MODULE_NAME).ko
|
||||
/sbin/depmod -a ${KVER}
|
||||
|
||||
backup_rtlwifi:
|
||||
|
||||
@@ -198,6 +198,7 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
|
||||
/* each antenna information */
|
||||
rx_cnt = rf_type_to_rf_rx_cnt(pHalData->rf_type);
|
||||
#if 0
|
||||
if (rx_cnt > 1) {
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE) |
|
||||
BIT(IEEE80211_RADIOTAP_EXT);
|
||||
@@ -218,9 +219,10 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
_rtw_memcpy(&hdr_buf[rt_len], &tmp_32bit, 4);
|
||||
rt_len += 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* tsft, Required Alignment: 8 bytes */
|
||||
if (a->free_cnt) {
|
||||
if (0) { //(a->free_cnt) {
|
||||
/* TSFT + free_cnt */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_TSFT);
|
||||
if (!IS_ALIGNED(rt_len, 8))
|
||||
@@ -285,11 +287,13 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
hdr_buf[rt_len] = a->phy_info.recv_signal_power;
|
||||
rt_len += 1;
|
||||
|
||||
#if 0
|
||||
/* dBm Antenna Noise */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_DBM_ANTNOISE);
|
||||
hdr_buf[rt_len] = 0;
|
||||
rt_len += 1;
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
/* Signal Quality, Required Alignment: 2 bytes */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_LOCK_QUALITY);
|
||||
if (!IS_ALIGNED(rt_len, 2))
|
||||
@@ -297,16 +301,21 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
hdr_buf[rt_len] = a->phy_info.signal_quality;
|
||||
rt_len += 2;
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Antenna */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_ANTENNA);
|
||||
hdr_buf[rt_len] = 0; /* pHalData->rf_type; */
|
||||
rt_len += 1;
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
/* RX flags, Required Alignment: 2 bytes */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_RX_FLAGS);
|
||||
tmp_16bit = 0;
|
||||
_rtw_memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);
|
||||
rt_len += 2;
|
||||
#endif
|
||||
|
||||
/* MCS information, Required Alignment: 1 bytes */
|
||||
if (a->data_rate >= DESC_RATEMCS0 && a->data_rate <= DESC_RATEMCS31) {
|
||||
@@ -393,8 +402,10 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
}
|
||||
|
||||
if (a->ampdu_eof) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
||||
tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF_KNOWN);
|
||||
tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF);
|
||||
#endif
|
||||
}
|
||||
|
||||
_rtw_memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);
|
||||
@@ -521,7 +532,7 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
}
|
||||
|
||||
/* frame timestamp, Required Alignment: 8 bytes */
|
||||
if (a->free_cnt) {
|
||||
if (0) { //(a->free_cnt) {
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_TIMESTAMP);
|
||||
if (!IS_ALIGNED(rt_len, 8))
|
||||
rt_len = ((rt_len + 7) & 0xFFF8); /* Alignment */
|
||||
@@ -547,6 +558,7 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
}
|
||||
|
||||
/* each antenna information */
|
||||
#if 0
|
||||
if (rx_cnt > 1) {
|
||||
for (i = 0; i <= rx_cnt; i++) {
|
||||
/* dBm Antenna Signal */
|
||||
@@ -564,6 +576,7 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
rt_len += 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* push to skb */
|
||||
pskb = (_pkt *)buf;
|
||||
|
||||
@@ -115,7 +115,7 @@ static void _get_sta_beamform_cap(PADAPTER adapter, struct sta_info *sta,
|
||||
mlme = &adapter->mlmepriv;
|
||||
|
||||
if (is_supported_ht(sta->wireless_mode) == _FALSE)
|
||||
return;
|
||||
goto get_bfcap_next;
|
||||
|
||||
/* HT */
|
||||
if (check_fwstate(mlme, WIFI_AP_STATE)) {
|
||||
@@ -154,8 +154,8 @@ static void _get_sta_beamform_cap(PADAPTER adapter, struct sta_info *sta,
|
||||
}
|
||||
}
|
||||
|
||||
get_bfcap_next:
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
|
||||
if (is_supported_vht(sta->wireless_mode) == _FALSE)
|
||||
return;
|
||||
|
||||
|
||||
@@ -12278,6 +12278,11 @@ static void rtw_mlmeext_disconnect(_adapter *padapter)
|
||||
self_action = MLME_STA_DISCONNECTED;
|
||||
else if (MLME_IS_ADHOC(padapter) || MLME_IS_ADHOC_MASTER(padapter))
|
||||
self_action = MLME_ADHOC_STOPPED;
|
||||
/* nrm */
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
else if (MLME_IS_MONITOR(padapter))
|
||||
self_action = MLME_ACTION_NONE;
|
||||
#endif
|
||||
else {
|
||||
RTW_INFO("state:0x%x\n", MLME_STATE(padapter));
|
||||
rtw_warn_on(1);
|
||||
@@ -16350,6 +16355,12 @@ u8 rtw_set_chbw_hdl(_adapter *padapter, u8 *pbuf)
|
||||
}
|
||||
|
||||
LeaveAllPowerSaveModeDirect(padapter);
|
||||
|
||||
#ifdef CONFIG_MONITOR_MODE_XMIT
|
||||
pmlmeext->cur_channel = set_ch_parm->ch;
|
||||
pmlmeext->cur_ch_offset = set_ch_parm->ch_offset;
|
||||
pmlmeext->cur_bwmode = set_ch_parm->bw;
|
||||
#endif /* CONFIG_MONITOR_MODE_XMIT */
|
||||
|
||||
set_channel_bwmode(padapter, set_ch_parm->ch, set_ch_parm->ch_offset, set_ch_parm->bw);
|
||||
|
||||
|
||||
@@ -233,6 +233,10 @@ bool rtw_pwr_unassociated_idle(_adapter *adapter)
|
||||
|| check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS)
|
||||
|| MLME_IS_AP(iface)
|
||||
|| MLME_IS_MESH(iface)
|
||||
/* nrm */
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
|| MLME_IS_MONITOR(iface)
|
||||
#endif
|
||||
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)
|
||||
#if defined(CONFIG_IOCTL_CFG80211)
|
||||
|| rtw_cfg80211_get_is_roch(iface) == _TRUE
|
||||
@@ -665,7 +669,10 @@ u8 PS_RDY_CHECK(_adapter *padapter)
|
||||
|| check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS)
|
||||
|| MLME_IS_AP(padapter)
|
||||
|| MLME_IS_MESH(padapter)
|
||||
/* nrm */
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
|| MLME_IS_MONITOR(padapter)
|
||||
#endif
|
||||
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)
|
||||
#if defined(CONFIG_IOCTL_CFG80211)
|
||||
|| rtw_cfg80211_get_is_roch(padapter) == _TRUE
|
||||
|
||||
@@ -4068,9 +4068,8 @@ int recv_frame_monitor(_adapter *padapter, union recv_frame *rframe)
|
||||
|
||||
/* read skb information from recv frame */
|
||||
pskb = rframe->u.hdr.pkt;
|
||||
pskb->head = rframe->u.hdr.rx_head;
|
||||
pskb->data = rframe->u.hdr.rx_data;
|
||||
pskb->len = rframe->u.hdr.len;
|
||||
pskb->data = rframe->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(pskb, rframe->u.hdr.len);
|
||||
|
||||
if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) {
|
||||
|
||||
@@ -4871,7 +4871,8 @@ static void do_queue_select(_adapter *padapter, struct pkt_attrib *pattrib)
|
||||
s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
||||
{
|
||||
u16 frame_ctl;
|
||||
struct ieee80211_radiotap_header rtap_hdr;
|
||||
/* nrm */
|
||||
// struct ieee80211_radiotap_header rtap_hdr;
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
|
||||
struct pkt_file pktfile;
|
||||
struct rtw_ieee80211_hdr *pwlanhdr;
|
||||
@@ -4880,36 +4881,84 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
||||
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
||||
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
|
||||
unsigned char *pframe;
|
||||
u8 dummybuf[32];
|
||||
int len = skb->len, rtap_len;
|
||||
|
||||
/* nrm */
|
||||
// u8 dummybuf[32];
|
||||
// int len = skb->len, rtap_len;
|
||||
int len = skb->len, rtap_len, rtap_remain, alloc_tries, ret;
|
||||
struct ieee80211_radiotap_header *rtap_hdr; // net/ieee80211_radiotap.h
|
||||
struct ieee80211_radiotap_iterator iterator; // net/cfg80211.h
|
||||
u8 rtap_buf[256];
|
||||
|
||||
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
|
||||
|
||||
#ifndef CONFIG_CUSTOMER_ALIBABA_GENERAL
|
||||
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
|
||||
goto fail;
|
||||
/* nrm */
|
||||
// if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
|
||||
// goto fail;
|
||||
if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) {
|
||||
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
|
||||
goto fail;
|
||||
|
||||
_rtw_open_pktfile((_pkt *)skb, &pktfile);
|
||||
_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))
|
||||
goto fail;
|
||||
/* nrm */
|
||||
// _rtw_open_pktfile((_pkt *)skb, &pktfile);
|
||||
// _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))
|
||||
// goto fail;
|
||||
_rtw_open_pktfile((_pkt *)skb, &pktfile);
|
||||
_rtw_pktfile_read(&pktfile, rtap_buf, sizeof(struct ieee80211_radiotap_header));
|
||||
rtap_hdr = (struct ieee80211_radiotap_header*)(rtap_buf);
|
||||
rtap_len = ieee80211_get_radiotap_len(rtap_buf);
|
||||
|
||||
if (unlikely(skb->len < rtap_len))
|
||||
goto fail;
|
||||
/* nrm */
|
||||
// if (unlikely(skb->len < rtap_len))
|
||||
// goto fail;
|
||||
if (unlikely(rtap_hdr->it_version))
|
||||
goto fail;
|
||||
|
||||
if (rtap_len != 12) {
|
||||
RTW_INFO("radiotap len (should be 14): %d\n", rtap_len);
|
||||
goto fail;
|
||||
/* nrm */
|
||||
// if (rtap_len != 12) {
|
||||
// RTW_INFO("radiotap len (should be 14): %d\n", rtap_len);
|
||||
// goto fail;
|
||||
|
||||
if (unlikely(rtap_len < sizeof(struct ieee80211_radiotap_header)))
|
||||
goto fail;
|
||||
|
||||
len -= sizeof(struct ieee80211_radiotap_header);
|
||||
rtap_remain = rtap_len - sizeof(struct ieee80211_radiotap_header);
|
||||
|
||||
if (rtap_remain > 0) {
|
||||
_rtw_pktfile_read(&pktfile, &rtap_buf[sizeof(struct ieee80211_radiotap_header)], rtap_remain);
|
||||
len -= rtap_remain;
|
||||
}
|
||||
|
||||
// NOTE: we process the radiotap header details later
|
||||
}
|
||||
_rtw_pktfile_read(&pktfile, dummybuf, rtap_len-sizeof(struct ieee80211_radiotap_header));
|
||||
len = len - rtap_len;
|
||||
|
||||
/* nrm */
|
||||
// _rtw_pktfile_read(&pktfile, dummybuf, rtap_len-sizeof(struct ieee80211_radiotap_header));
|
||||
// len = len - rtap_len;
|
||||
#endif
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe == NULL) {
|
||||
rtw_udelay_os(500);
|
||||
goto fail;
|
||||
|
||||
/* nrm */
|
||||
// pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
// if (pmgntframe == NULL) {
|
||||
// rtw_udelay_os(500);
|
||||
// goto fail;
|
||||
// v5.2.20 had an allocation wrapper (monitor_alloc_mgtxmitframe) that performed a few
|
||||
// tries to allocate an xmit frame before giving up. This can be beneficial when there
|
||||
// is a rapid-fire sequence of injected frames. Without it, frames can be randomly
|
||||
// dropped. So this recreates the same functionality.
|
||||
|
||||
for (alloc_tries=3; alloc_tries > 0; alloc_tries--) {
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe != NULL)
|
||||
break;
|
||||
if (alloc_tries <= 1) {
|
||||
rtw_udelay_os(500);
|
||||
goto fail;
|
||||
}
|
||||
rtw_udelay_os(100);
|
||||
}
|
||||
|
||||
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
|
||||
@@ -4917,17 +4966,24 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
||||
// _rtw_memcpy(pframe, (void *)checking, len);
|
||||
_rtw_pktfile_read(&pktfile, pframe, len);
|
||||
|
||||
|
||||
/* Check DATA/MGNT frames */
|
||||
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
|
||||
frame_ctl = le16_to_cpu(pwlanhdr->frame_ctl);
|
||||
/* nrm */
|
||||
// frame_ctl = le16_to_cpu(pwlanhdr->frame_ctl);
|
||||
if (unlikely(len < sizeof(struct rtw_ieee80211_hdr_3addr)))
|
||||
frame_ctl = 0;
|
||||
else
|
||||
frame_ctl = le16_to_cpu(pwlanhdr->frame_ctl);
|
||||
|
||||
if ((frame_ctl & RTW_IEEE80211_FCTL_FTYPE) == RTW_IEEE80211_FTYPE_DATA) {
|
||||
|
||||
pattrib = &pmgntframe->attrib;
|
||||
update_monitor_frame_attrib(padapter, pattrib);
|
||||
|
||||
if (is_broadcast_mac_addr(pwlanhdr->addr3) || is_broadcast_mac_addr(pwlanhdr->addr1))
|
||||
pattrib->rate = MGN_24M;
|
||||
/* nrm */
|
||||
// if (is_broadcast_mac_addr(pwlanhdr->addr3) || is_broadcast_mac_addr(pwlanhdr->addr1))
|
||||
// pattrib->rate = MGN_24M;
|
||||
pattrib->rate = MGN_1M; // Override a more practical default rate
|
||||
|
||||
} else {
|
||||
|
||||
@@ -4942,7 +4998,179 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
||||
pmlmeext->mgnt_seq++;
|
||||
pattrib->last_txcmdsz = pattrib->pktlen;
|
||||
|
||||
/* nrm */
|
||||
#ifndef CONFIG_CUSTOMER_ALIBABA_GENERAL
|
||||
|
||||
if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) {
|
||||
// Parse radiotap for injection items and overwrite attribs as needed.
|
||||
// This code should probably live in core/monitor/rtw_radiotap.c, but we would have to
|
||||
// pass pointers to a large number of things simply for the sake of organization,
|
||||
// and it isn't worth it at this preliminary point to get things up and running.
|
||||
// Let's call it a possible FUTURE-TODO.
|
||||
|
||||
ret = ieee80211_radiotap_iterator_init(&iterator, rtap_hdr, rtap_len, NULL);
|
||||
while (!ret) {
|
||||
ret = ieee80211_radiotap_iterator_next(&iterator);
|
||||
if (ret)
|
||||
continue;
|
||||
|
||||
switch (iterator.this_arg_index) {
|
||||
case IEEE80211_RADIOTAP_RATE:
|
||||
// This is basic 802.11b/g rate; use MCS/VHT for higher rates
|
||||
pattrib->rate = *iterator.this_arg;
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
pattrib->raid = RATEID_IDX_BGN_40M_1SS;
|
||||
#else
|
||||
if (pattrib->rate == IEEE80211_CCK_RATE_1MB
|
||||
|| pattrib->rate == IEEE80211_CCK_RATE_2MB
|
||||
|| pattrib->rate == IEEE80211_CCK_RATE_5MB
|
||||
|| pattrib->rate == IEEE80211_CCK_RATE_11MB )
|
||||
pattrib->raid = rtw_get_mgntframe_raid(padapter, WIRELESS_11B);
|
||||
else
|
||||
pattrib->raid = rtw_get_mgntframe_raid(padapter, WIRELESS_11G);
|
||||
#endif
|
||||
|
||||
// We have to reset other attributes that may have been set prior for MCS/VHT rates
|
||||
pattrib->ht_en = _FALSE;
|
||||
pattrib->ampdu_en = _FALSE;
|
||||
pattrib->sgi = _FALSE;
|
||||
pattrib->ldpc = _FALSE;
|
||||
pattrib->stbc = 0;
|
||||
pattrib->bwmode = CHANNEL_WIDTH_20;
|
||||
pattrib->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||
|
||||
break;
|
||||
|
||||
case IEEE80211_RADIOTAP_TX_FLAGS: {
|
||||
u16 txflags = get_unaligned_le16(iterator.this_arg);
|
||||
|
||||
if ((txflags & IEEE80211_RADIOTAP_F_TX_NOACK) == 0)
|
||||
pattrib->retry_ctrl = _TRUE; // Note; already _FALSE by default
|
||||
|
||||
if (txflags & 0x0010) { // Use preconfigured seq num
|
||||
if (len >= sizeof(struct rtw_ieee80211_hdr_3addr)) {
|
||||
pattrib->seqnum = GetSequence(pwlanhdr);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case IEEE80211_RADIOTAP_MCS: {
|
||||
u8 mcs_have = iterator.this_arg[0];
|
||||
|
||||
// Set up defaults
|
||||
pattrib->rate = MGN_MCS0;
|
||||
pattrib->bwmode = IEEE80211_RADIOTAP_MCS_BW_20;
|
||||
pattrib->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||
pattrib->ht_en = _TRUE;
|
||||
pattrib->sgi = _FALSE;
|
||||
pattrib->ldpc = _FALSE;
|
||||
pattrib->stbc = 0;
|
||||
|
||||
if (mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_BW) {
|
||||
|
||||
u8 bw = (iterator.this_arg[1] & IEEE80211_RADIOTAP_MCS_BW_MASK);
|
||||
if (bw == IEEE80211_RADIOTAP_MCS_BW_20L) {
|
||||
bw = IEEE80211_RADIOTAP_MCS_BW_20;
|
||||
pattrib->ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
|
||||
}
|
||||
if (bw == IEEE80211_RADIOTAP_MCS_BW_20U) {
|
||||
bw = IEEE80211_RADIOTAP_MCS_BW_20;
|
||||
pattrib->ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
|
||||
}
|
||||
|
||||
pattrib->bwmode = bw;
|
||||
}
|
||||
|
||||
if (mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_MCS) {
|
||||
u8 fixed_rate = iterator.this_arg[2] & 0x7f;
|
||||
if(fixed_rate > 31)
|
||||
fixed_rate = 0;
|
||||
fixed_rate += MGN_MCS0;
|
||||
pattrib->rate = fixed_rate;
|
||||
}
|
||||
|
||||
if ((mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_GI) && (iterator.this_arg[1] & IEEE80211_RADIOTAP_MCS_SGI))
|
||||
pattrib->sgi = _TRUE;
|
||||
|
||||
if ((mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_FEC) && (iterator.this_arg[1] & IEEE80211_RADIOTAP_MCS_FEC_LDPC))
|
||||
pattrib->ldpc = _TRUE;
|
||||
|
||||
if (mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
|
||||
u8 stbc = (iterator.this_arg[1] & IEEE80211_RADIOTAP_MCS_STBC_MASK) >> IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
|
||||
pattrib->stbc = stbc;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
case IEEE80211_RADIOTAP_VHT: {
|
||||
unsigned int mcs, nss;
|
||||
|
||||
u8 known = iterator.this_arg[0];
|
||||
u8 flags = iterator.this_arg[2];
|
||||
|
||||
// Set up defaults
|
||||
pattrib->stbc = 0;
|
||||
pattrib->sgi = _FALSE;
|
||||
pattrib->bwmode = CHANNEL_WIDTH_20;
|
||||
pattrib->ldpc = _FALSE;
|
||||
pattrib->rate = MGN_VHT1SS_MCS0;
|
||||
pattrib->raid = RATEID_IDX_VHT_1SS;
|
||||
|
||||
// NOTE: this code currently only supports 1SS for radiotap defined rates
|
||||
|
||||
if ((known & IEEE80211_RADIOTAP_VHT_KNOWN_STBC) && (flags & IEEE80211_RADIOTAP_VHT_FLAG_STBC))
|
||||
pattrib->stbc = 1;
|
||||
|
||||
if ((known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) && (flags & IEEE80211_RADIOTAP_VHT_FLAG_SGI))
|
||||
pattrib->sgi = _TRUE;
|
||||
|
||||
if (known & IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
|
||||
u8 bw = iterator.this_arg[3] & 0x1F;
|
||||
// NOTE: there are various L and U, but we just use straight 20/40/80
|
||||
// since it's not clear how to set CHNL_OFFSET_LOWER/_UPPER with different
|
||||
// sideband sizes/configurations. TODO.
|
||||
// Also, any 160 is treated as 80 due to lack of WIDTH_160.
|
||||
if (bw == 0)
|
||||
pattrib->bwmode = CHANNEL_WIDTH_20;
|
||||
else if (bw >=1 && bw <= 3)
|
||||
pattrib->bwmode = CHANNEL_WIDTH_40;
|
||||
else if (bw >=4 && bw <= 10)
|
||||
pattrib->bwmode = CHANNEL_WIDTH_80;
|
||||
else if (bw >= 11 && bw <= 25)
|
||||
pattrib->bwmode = CHANNEL_WIDTH_80; // Supposed to be 160Mhz, we use 80Mhz
|
||||
}
|
||||
|
||||
// User 0
|
||||
nss = iterator.this_arg[4] & 0x0F; // Number of spatial streams
|
||||
if (nss > 0) {
|
||||
if (nss > 4) nss = 4;
|
||||
mcs = (iterator.this_arg[4]>>4) & 0x0F; // MCS rate index
|
||||
if (mcs > 8) mcs = 9;
|
||||
pattrib->rate = MGN_VHT1SS_MCS0 + ((nss-1)*10 + mcs);
|
||||
|
||||
if (iterator.this_arg[8] & IEEE80211_RADIOTAP_CODING_LDPC_USER0)
|
||||
pattrib->ldpc = _TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
#endif // CONFIG_80211AC_VHT
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CONFIG_CUSTOMER_ALIBABA_GENERAL
|
||||
|
||||
dump_mgntframe(padapter, pmgntframe);
|
||||
/* nrm */
|
||||
pxmitpriv->tx_pkts++;
|
||||
pxmitpriv->tx_bytes += skb->len;
|
||||
|
||||
fail:
|
||||
rtw_skb_free(skb);
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
/* ***** temporarily flag ******* */
|
||||
#define CONFIG_SINGLE_IMG
|
||||
/* #define CONFIG_DISABLE_ODM */
|
||||
|
||||
/* ***** temporarily flag ******* */
|
||||
/*
|
||||
* Public General Config
|
||||
*/
|
||||
@@ -67,6 +65,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
/* nrm - activates beamforming */
|
||||
#define CONFIG_BEAMFORMING
|
||||
#endif
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ static u8 rtw_chbw_to_cfg80211_chan_def(struct wiphy *wiphy, struct cfg80211_cha
|
||||
if (!chan)
|
||||
goto exit;
|
||||
|
||||
if (bw == CHANNEL_WIDTH_20)
|
||||
if (bw == CHANNEL_WIDTH_20)
|
||||
chdef->width = ht ? NL80211_CHAN_WIDTH_20 : NL80211_CHAN_WIDTH_20_NOHT;
|
||||
else if (bw == CHANNEL_WIDTH_40)
|
||||
chdef->width = NL80211_CHAN_WIDTH_40;
|
||||
@@ -295,7 +295,7 @@ static void rtw_get_chbw_from_cfg80211_chan_def(struct cfg80211_chan_def *chdef,
|
||||
rtw_warn_on(1);
|
||||
*ch = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (chdef->width) {
|
||||
case NL80211_CHAN_WIDTH_20_NOHT:
|
||||
@@ -2127,7 +2127,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
|| (MLME_IS_STA(adapter) && !pairwise)
|
||||
#endif
|
||||
) {
|
||||
) {
|
||||
/* WEP key, TX GTK/IGTK, RX GTK/IGTK(for STA mode) */
|
||||
if (is_wep_enc(sec->dot118021XGrpPrivacy)) {
|
||||
if (keyid >= WEP_KEYS)
|
||||
@@ -2239,7 +2239,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
||||
exit:
|
||||
RTW_INFO(FUNC_NDEV_FMT
|
||||
GET_KEY_PARAM_FMT_S
|
||||
@@ -5110,9 +5110,11 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
|
||||
ie_offset = _REASOCREQ_IE_OFFSET_;
|
||||
|
||||
memset(&sinfo, 0, sizeof(sinfo));
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
|
||||
sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
|
||||
sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset;
|
||||
sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset;
|
||||
#endif
|
||||
cfg80211_new_sta(ndev, get_addr2_ptr(pmgmt_frame), &sinfo, GFP_ATOMIC);
|
||||
}
|
||||
#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
|
||||
@@ -5412,7 +5414,7 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2))
|
||||
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev,
|
||||
unsigned int link_id)
|
||||
unsigned int link_id)
|
||||
#else
|
||||
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
|
||||
#endif
|
||||
@@ -6210,11 +6212,15 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy
|
||||
#endif
|
||||
, struct ieee80211_channel *chan, enum nl80211_channel_type channel_type)
|
||||
{
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||
#else /* CONFIG_WIFI_MONITOR */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
|
||||
#else
|
||||
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||
#endif
|
||||
#endif /* CONFIG_WIFI_MONITOR */
|
||||
int chan_target = (u8) ieee80211_frequency_to_channel(chan->center_freq);
|
||||
int chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||
int chan_width = CHANNEL_WIDTH_20;
|
||||
|
||||
@@ -72,7 +72,7 @@ int rtw_scan_mode = 1;/* active, passive */
|
||||
#else
|
||||
int rtw_wow_power_mgnt = PS_MODE_ACTIVE;
|
||||
int rtw_wow_lps_level = LPS_NORMAL;
|
||||
#endif
|
||||
#endif
|
||||
#endif /* CONFIG_WOWLAN */
|
||||
|
||||
#else /* !CONFIG_POWER_SAVING */
|
||||
@@ -118,7 +118,7 @@ MODULE_PARM_DESC(rtw_wow_lps_1t1r, "The default WOW LPS 1T1R setting");
|
||||
#endif
|
||||
#endif /* CONFIG_WOWLAN */
|
||||
|
||||
/* LPS:
|
||||
/* LPS:
|
||||
* rtw_smart_ps = 0 => TX: pwr bit = 1, RX: PS_Poll
|
||||
* rtw_smart_ps = 1 => TX: pwr bit = 0, RX: PS_Poll
|
||||
* rtw_smart_ps = 2 => TX: pwr bit = 0, RX: NullData with pwr bit = 0
|
||||
@@ -127,8 +127,8 @@ int rtw_smart_ps = 2;
|
||||
|
||||
int rtw_max_bss_cnt = 0;
|
||||
module_param(rtw_max_bss_cnt, int, 0644);
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
/* WMMPS:
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
/* WMMPS:
|
||||
* rtw_smart_ps = 0 => Only for fw test
|
||||
* rtw_smart_ps = 1 => Refer to Beacon's TIM Bitmap
|
||||
* rtw_smart_ps = 2 => Don't refer to Beacon's TIM Bitmap
|
||||
|
||||
@@ -139,6 +139,7 @@ int rtw_os_alloc_recvframe(_adapter *padapter, union recv_frame *precvframe, u8
|
||||
|
||||
precvframe->u.hdr.pkt = rtw_skb_clone(pskb);
|
||||
if (precvframe->u.hdr.pkt) {
|
||||
RTW_INFO("%s: rtw_skb_clone success, RX throughput may be low!\n", __FUNCTION__);
|
||||
precvframe->u.hdr.pkt->dev = padapter->pnetdev;
|
||||
precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pdata;
|
||||
precvframe->u.hdr.rx_end = pdata + alloc_sz;
|
||||
@@ -353,7 +354,6 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, const u8 *da, const u8 *s
|
||||
{
|
||||
sub_skb = rtw_skb_clone(prframe->u.hdr.pkt);
|
||||
if (sub_skb) {
|
||||
sub_skb->head = msdu;
|
||||
sub_skb->data = msdu;
|
||||
sub_skb->len = msdu_len;
|
||||
skb_set_tail_pointer(sub_skb, msdu_len);
|
||||
@@ -619,9 +619,8 @@ void rtw_hostapd_mlme_rx(_adapter *padapter, union recv_frame *precv_frame)
|
||||
if (skb == NULL)
|
||||
return;
|
||||
|
||||
skb->head = precv_frame->u.hdr.rx_head;
|
||||
skb->data = precv_frame->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(skb, precv_frame->u.hdr.rx_tail - precv_frame->u.hdr.rx_data);
|
||||
skb->tail = precv_frame->u.hdr.rx_tail;
|
||||
skb->len = precv_frame->u.hdr.len;
|
||||
|
||||
/* pskb_copy = rtw_skb_copy(skb);
|
||||
@@ -663,7 +662,6 @@ int rtw_recv_monitor(_adapter *padapter, union recv_frame *precv_frame)
|
||||
goto _recv_drop;
|
||||
}
|
||||
|
||||
skb->head = precv_frame->u.hdr.rx_head;
|
||||
skb->data = precv_frame->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(skb, precv_frame->u.hdr.len);
|
||||
skb->len = precv_frame->u.hdr.len;
|
||||
@@ -688,7 +686,6 @@ inline void rtw_rframe_set_os_pkt(union recv_frame *rframe)
|
||||
{
|
||||
_pkt *skb = rframe->u.hdr.pkt;
|
||||
|
||||
skb->head = rframe->u.hdr.rx_head;
|
||||
skb->data = rframe->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(skb, rframe->u.hdr.len);
|
||||
skb->len = rframe->u.hdr.len;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
config RTL8821AU
|
||||
tristate "Realtek 8821A USB WiFi"
|
||||
depends on USB
|
||||
select WIRELESS_EXT
|
||||
help
|
||||
Help message of RTL8821AU
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ endif
|
||||
CONFIG_RTW_DEBUG = y
|
||||
# default log level is _DRV_INFO_ = 4,
|
||||
# please refer to "How_to_set_driver_debug_log_level.doc" to set the available level.
|
||||
CONFIG_RTW_LOG_LEVEL = 0
|
||||
CONFIG_RTW_LOG_LEVEL = 1
|
||||
|
||||
# enable /proc/net/rtlxxxx/ debug interfaces
|
||||
CONFIG_PROC_DEBUG = y
|
||||
@@ -2508,7 +2508,7 @@ install:
|
||||
/sbin/depmod -a ${KVER}
|
||||
|
||||
uninstall:
|
||||
rm -f $(MODDESTDIR)/$(MODULE_NAME).ko
|
||||
rm -f $(MODDESTDIR)$(MODULE_NAME).ko
|
||||
/sbin/depmod -a ${KVER}
|
||||
|
||||
backup_rtlwifi:
|
||||
|
||||
@@ -198,6 +198,7 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
|
||||
/* each antenna information */
|
||||
rx_cnt = rf_type_to_rf_rx_cnt(pHalData->rf_type);
|
||||
#if 0
|
||||
if (rx_cnt > 1) {
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE) |
|
||||
BIT(IEEE80211_RADIOTAP_EXT);
|
||||
@@ -218,9 +219,10 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
_rtw_memcpy(&hdr_buf[rt_len], &tmp_32bit, 4);
|
||||
rt_len += 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* tsft, Required Alignment: 8 bytes */
|
||||
if (a->free_cnt) {
|
||||
if (0) { //(a->free_cnt) {
|
||||
/* TSFT + free_cnt */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_TSFT);
|
||||
if (!IS_ALIGNED(rt_len, 8))
|
||||
@@ -285,11 +287,13 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
hdr_buf[rt_len] = a->phy_info.recv_signal_power;
|
||||
rt_len += 1;
|
||||
|
||||
#if 0
|
||||
/* dBm Antenna Noise */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_DBM_ANTNOISE);
|
||||
hdr_buf[rt_len] = 0;
|
||||
rt_len += 1;
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
/* Signal Quality, Required Alignment: 2 bytes */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_LOCK_QUALITY);
|
||||
if (!IS_ALIGNED(rt_len, 2))
|
||||
@@ -297,16 +301,21 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
hdr_buf[rt_len] = a->phy_info.signal_quality;
|
||||
rt_len += 2;
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Antenna */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_ANTENNA);
|
||||
hdr_buf[rt_len] = 0; /* pHalData->rf_type; */
|
||||
rt_len += 1;
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
/* RX flags, Required Alignment: 2 bytes */
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_RX_FLAGS);
|
||||
tmp_16bit = 0;
|
||||
_rtw_memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);
|
||||
rt_len += 2;
|
||||
#endif
|
||||
|
||||
/* MCS information, Required Alignment: 1 bytes */
|
||||
if (a->data_rate >= DESC_RATEMCS0 && a->data_rate <= DESC_RATEMCS31) {
|
||||
@@ -393,8 +402,10 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
}
|
||||
|
||||
if (a->ampdu_eof) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
||||
tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF_KNOWN);
|
||||
tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF);
|
||||
#endif
|
||||
}
|
||||
|
||||
_rtw_memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);
|
||||
@@ -521,7 +532,7 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
}
|
||||
|
||||
/* frame timestamp, Required Alignment: 8 bytes */
|
||||
if (a->free_cnt) {
|
||||
if (0) { //(a->free_cnt) {
|
||||
rtap_hdr->it_present |= BIT(IEEE80211_RADIOTAP_TIMESTAMP);
|
||||
if (!IS_ALIGNED(rt_len, 8))
|
||||
rt_len = ((rt_len + 7) & 0xFFF8); /* Alignment */
|
||||
@@ -547,6 +558,7 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
}
|
||||
|
||||
/* each antenna information */
|
||||
#if 0
|
||||
if (rx_cnt > 1) {
|
||||
for (i = 0; i <= rx_cnt; i++) {
|
||||
/* dBm Antenna Signal */
|
||||
@@ -564,6 +576,7 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
rt_len += 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* push to skb */
|
||||
pskb = (_pkt *)buf;
|
||||
|
||||
@@ -5773,10 +5773,10 @@ int rtw_ap_rx_data_validate_hdr(_adapter *adapter, union recv_frame *rframe, str
|
||||
#endif
|
||||
|
||||
process_pwrbit_data(adapter, rframe, *sta);
|
||||
|
||||
|
||||
if ((get_frame_sub_type(whdr) & WIFI_QOS_DATA_TYPE) == WIFI_QOS_DATA_TYPE)
|
||||
process_wmmps_data(adapter, rframe, *sta);
|
||||
|
||||
|
||||
if (get_frame_sub_type(whdr) & BIT(6)) {
|
||||
/* No data, will not indicate to upper layer, temporily count it here */
|
||||
count_rx_stats(adapter, rframe, *sta);
|
||||
|
||||
@@ -115,7 +115,7 @@ static void _get_sta_beamform_cap(PADAPTER adapter, struct sta_info *sta,
|
||||
mlme = &adapter->mlmepriv;
|
||||
|
||||
if (is_supported_ht(sta->wireless_mode) == _FALSE)
|
||||
return;
|
||||
goto get_bfcap_next;
|
||||
|
||||
/* HT */
|
||||
if (check_fwstate(mlme, WIFI_AP_STATE)) {
|
||||
@@ -154,8 +154,8 @@ static void _get_sta_beamform_cap(PADAPTER adapter, struct sta_info *sta,
|
||||
}
|
||||
}
|
||||
|
||||
get_bfcap_next:
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
|
||||
if (is_supported_vht(sta->wireless_mode) == _FALSE)
|
||||
return;
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/if_arp.h>
|
||||
#include <net/ip.h>
|
||||
#include <linux/version.h>
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
||||
#include <net/ipx.h>
|
||||
#endif
|
||||
#include <linux/atalk.h>
|
||||
#include <linux/udp.h>
|
||||
#include <linux/if_pppox.h>
|
||||
@@ -168,6 +172,41 @@ static void __nat25_generate_ipv4_network_addr(unsigned char *networkAddr,
|
||||
}
|
||||
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
||||
static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
|
||||
unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
|
||||
{
|
||||
memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
|
||||
|
||||
networkAddr[0] = NAT25_IPX;
|
||||
memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
|
||||
memcpy(networkAddr + 5, ipxNodeAddr, 6);
|
||||
}
|
||||
|
||||
|
||||
static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr,
|
||||
unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr)
|
||||
{
|
||||
memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
|
||||
|
||||
networkAddr[0] = NAT25_IPX;
|
||||
memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
|
||||
memcpy(networkAddr + 5, (unsigned char *)ipxSocketAddr, 2);
|
||||
}
|
||||
|
||||
|
||||
static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
|
||||
unsigned short *network, unsigned char *node)
|
||||
{
|
||||
memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
|
||||
|
||||
networkAddr[0] = NAT25_APPLE;
|
||||
memcpy(networkAddr + 1, (unsigned char *)network, 2);
|
||||
networkAddr[3] = *node;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
|
||||
unsigned char *ac_mac, unsigned short *sid)
|
||||
{
|
||||
@@ -296,6 +335,7 @@ static int __nat25_network_hash(unsigned char *networkAddr)
|
||||
x = networkAddr[7] ^ networkAddr[8] ^ networkAddr[9] ^ networkAddr[10];
|
||||
|
||||
return x & (NAT25_HASH_SIZE - 1);
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
||||
} else if (networkAddr[0] == NAT25_IPX) {
|
||||
unsigned long x;
|
||||
|
||||
@@ -309,6 +349,7 @@ static int __nat25_network_hash(unsigned char *networkAddr)
|
||||
x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3];
|
||||
|
||||
return x & (NAT25_HASH_SIZE - 1);
|
||||
#endif
|
||||
} else if (networkAddr[0] == NAT25_PPPOE) {
|
||||
unsigned long x;
|
||||
|
||||
@@ -855,6 +896,229 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
||||
}
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
||||
/*---------------------------------------------------*/
|
||||
/* Handle IPX and Apple Talk frame */
|
||||
/*---------------------------------------------------*/
|
||||
else if ((protocol == __constant_htons(ETH_P_IPX)) ||
|
||||
(protocol == __constant_htons(ETH_P_ATALK)) ||
|
||||
(protocol == __constant_htons(ETH_P_AARP))) {
|
||||
unsigned char ipx_header[2] = {0xFF, 0xFF};
|
||||
struct ipxhdr *ipx = NULL;
|
||||
struct elapaarp *ea = NULL;
|
||||
struct ddpehdr *ddp = NULL;
|
||||
unsigned char *framePtr = skb->data + ETH_HLEN;
|
||||
|
||||
if (protocol == __constant_htons(ETH_P_IPX)) {
|
||||
RTW_INFO("NAT25: Protocol=IPX (Ethernet II)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
} else { /* if(protocol <= __constant_htons(ETH_FRAME_LEN)) */
|
||||
if (!memcmp(ipx_header, framePtr, 2)) {
|
||||
RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
} else {
|
||||
unsigned char ipx_8022_type = 0xE0;
|
||||
unsigned char snap_8022_type = 0xAA;
|
||||
|
||||
if (*framePtr == snap_8022_type) {
|
||||
unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; /* IPX SNAP ID */
|
||||
unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; /* Apple Talk AARP SNAP ID */
|
||||
unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; /* Apple Talk DDP SNAP ID */
|
||||
|
||||
framePtr += 3; /* eliminate the 802.2 header */
|
||||
|
||||
if (!memcmp(ipx_snap_id, framePtr, 5)) {
|
||||
framePtr += 5; /* eliminate the SNAP header */
|
||||
|
||||
RTW_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
} else if (!memcmp(aarp_snap_id, framePtr, 5)) {
|
||||
framePtr += 5; /* eliminate the SNAP header */
|
||||
|
||||
ea = (struct elapaarp *)framePtr;
|
||||
} else if (!memcmp(ddp_snap_id, framePtr, 5)) {
|
||||
framePtr += 5; /* eliminate the SNAP header */
|
||||
|
||||
ddp = (struct ddpehdr *)framePtr;
|
||||
} else {
|
||||
DEBUG_WARN("NAT25: Protocol=Ethernet SNAP %02x%02x%02x%02x%02x\n", framePtr[0],
|
||||
framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
|
||||
return -1;
|
||||
}
|
||||
} else if (*framePtr == ipx_8022_type) {
|
||||
framePtr += 3; /* eliminate the 802.2 header */
|
||||
|
||||
if (!memcmp(ipx_header, framePtr, 2)) {
|
||||
RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.2)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* IPX */
|
||||
if (ipx != NULL) {
|
||||
switch (method) {
|
||||
case NAT25_CHECK:
|
||||
if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
|
||||
RTW_INFO("NAT25: Check IPX skb_copy\n");
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
||||
case NAT25_INSERT: {
|
||||
RTW_INFO("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n",
|
||||
ipx->ipx_dest.net,
|
||||
ipx->ipx_dest.node[0],
|
||||
ipx->ipx_dest.node[1],
|
||||
ipx->ipx_dest.node[2],
|
||||
ipx->ipx_dest.node[3],
|
||||
ipx->ipx_dest.node[4],
|
||||
ipx->ipx_dest.node[5],
|
||||
ipx->ipx_dest.sock,
|
||||
ipx->ipx_source.net,
|
||||
ipx->ipx_source.node[0],
|
||||
ipx->ipx_source.node[1],
|
||||
ipx->ipx_source.node[2],
|
||||
ipx->ipx_source.node[3],
|
||||
ipx->ipx_source.node[4],
|
||||
ipx->ipx_source.node[5],
|
||||
ipx->ipx_source.sock);
|
||||
|
||||
if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
|
||||
RTW_INFO("NAT25: Use IPX Net, and Socket as network addr\n");
|
||||
|
||||
__nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
|
||||
|
||||
/* change IPX source node addr to wlan STA address */
|
||||
memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
|
||||
} else
|
||||
__nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_source.net, ipx->ipx_source.node);
|
||||
|
||||
__nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
|
||||
|
||||
__nat25_db_print(priv);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case NAT25_LOOKUP: {
|
||||
if (!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN)) {
|
||||
RTW_INFO("NAT25: Lookup IPX, Modify Destination IPX Node addr\n");
|
||||
|
||||
__nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_dest.net, &ipx->ipx_dest.sock);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
|
||||
/* replace IPX destination node addr with Lookup destination MAC addr */
|
||||
memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
|
||||
} else {
|
||||
__nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_dest.net, ipx->ipx_dest.node);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* AARP */
|
||||
else if (ea != NULL) {
|
||||
/* Sanity check fields. */
|
||||
if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) {
|
||||
DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (method) {
|
||||
case NAT25_CHECK:
|
||||
return 0;
|
||||
|
||||
case NAT25_INSERT: {
|
||||
/* change to AARP source mac address to wlan STA address */
|
||||
memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
|
||||
|
||||
RTW_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
|
||||
ea->pa_src_net,
|
||||
ea->pa_src_node,
|
||||
ea->pa_dst_net,
|
||||
ea->pa_dst_node);
|
||||
|
||||
__nat25_generate_apple_network_addr(networkAddr, &ea->pa_src_net, &ea->pa_src_node);
|
||||
|
||||
__nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
|
||||
|
||||
__nat25_db_print(priv);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case NAT25_LOOKUP: {
|
||||
RTW_INFO("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n",
|
||||
ea->pa_src_net,
|
||||
ea->pa_src_node,
|
||||
ea->pa_dst_net,
|
||||
ea->pa_dst_node);
|
||||
|
||||
__nat25_generate_apple_network_addr(networkAddr, &ea->pa_dst_net, &ea->pa_dst_node);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
|
||||
/* change to AARP destination mac address to Lookup result */
|
||||
memcpy(ea->hw_dst, skb->data, ETH_ALEN);
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* DDP */
|
||||
else if (ddp != NULL) {
|
||||
switch (method) {
|
||||
case NAT25_CHECK:
|
||||
return -1;
|
||||
|
||||
case NAT25_INSERT: {
|
||||
RTW_INFO("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n",
|
||||
ddp->deh_snet,
|
||||
ddp->deh_snode,
|
||||
ddp->deh_dnet,
|
||||
ddp->deh_dnode);
|
||||
|
||||
__nat25_generate_apple_network_addr(networkAddr, &ddp->deh_snet, &ddp->deh_snode);
|
||||
|
||||
__nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
|
||||
|
||||
__nat25_db_print(priv);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case NAT25_LOOKUP: {
|
||||
RTW_INFO("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n",
|
||||
ddp->deh_snet,
|
||||
ddp->deh_snode,
|
||||
ddp->deh_dnet,
|
||||
ddp->deh_dnode);
|
||||
|
||||
__nat25_generate_apple_network_addr(networkAddr, &ddp->deh_dnet, &ddp->deh_dnode);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
/* Handle PPPoE frame */
|
||||
/*---------------------------------------------------*/
|
||||
|
||||
@@ -12222,6 +12222,11 @@ static void rtw_mlmeext_disconnect(_adapter *padapter)
|
||||
self_action = MLME_STA_DISCONNECTED;
|
||||
else if (MLME_IS_ADHOC(padapter) || MLME_IS_ADHOC_MASTER(padapter))
|
||||
self_action = MLME_ADHOC_STOPPED;
|
||||
/* nrm */
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
else if (MLME_IS_MONITOR(padapter))
|
||||
self_action = MLME_ACTION_NONE;
|
||||
#endif
|
||||
else {
|
||||
RTW_INFO("state:0x%x\n", MLME_STATE(padapter));
|
||||
rtw_warn_on(1);
|
||||
@@ -16141,6 +16146,12 @@ u8 rtw_set_chbw_hdl(_adapter *padapter, u8 *pbuf)
|
||||
}
|
||||
|
||||
LeaveAllPowerSaveModeDirect(padapter);
|
||||
|
||||
#ifdef CONFIG_MONITOR_MODE_XMIT
|
||||
pmlmeext->cur_channel = set_ch_parm->ch;
|
||||
pmlmeext->cur_ch_offset = set_ch_parm->ch_offset;
|
||||
pmlmeext->cur_bwmode = set_ch_parm->bw;
|
||||
#endif /* CONFIG_MONITOR_MODE_XMIT */
|
||||
|
||||
set_channel_bwmode(padapter, set_ch_parm->ch, set_ch_parm->ch_offset, set_ch_parm->bw);
|
||||
|
||||
|
||||
@@ -89,12 +89,13 @@ void _ips_enter(_adapter *padapter)
|
||||
|
||||
if (rf_off == pwrpriv->change_rfpwrstate) {
|
||||
pwrpriv->bpower_saving = _TRUE;
|
||||
RTW_PRINT("nolinked power save enter\n");
|
||||
/* nrm */
|
||||
// RTW_PRINT("nolinked power save enter\n");
|
||||
|
||||
if (pwrpriv->ips_mode == IPS_LEVEL_2)
|
||||
pwrpriv->bkeepfwalive = _TRUE;
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
pwrpriv->pwr_saving_start_time = rtw_get_current_time();
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_LLSTATS */
|
||||
|
||||
@@ -137,12 +138,13 @@ int _ips_leave(_adapter *padapter)
|
||||
result = rtw_ips_pwr_up(padapter);
|
||||
if (result == _SUCCESS)
|
||||
pwrpriv->rf_pwrstate = rf_on;
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
pwrpriv->pwr_saving_time += rtw_get_passing_time_ms(pwrpriv->pwr_saving_start_time);
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_LLSTATS */
|
||||
|
||||
RTW_PRINT("nolinked power save leave\n");
|
||||
/* nrm */
|
||||
// RTW_PRINT("nolinked power save leave\n");
|
||||
|
||||
RTW_INFO("==> ips_leave.....LED(0x%08x)...\n", rtw_read32(padapter, 0x4c));
|
||||
pwrpriv->bips_processing = _FALSE;
|
||||
@@ -231,6 +233,10 @@ bool rtw_pwr_unassociated_idle(_adapter *adapter)
|
||||
|| check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS)
|
||||
|| MLME_IS_AP(iface)
|
||||
|| MLME_IS_MESH(iface)
|
||||
/* nrm */
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
|| MLME_IS_MONITOR(iface)
|
||||
#endif
|
||||
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)
|
||||
#if defined(CONFIG_IOCTL_CFG80211)
|
||||
|| rtw_cfg80211_get_is_roch(iface) == _TRUE
|
||||
@@ -306,7 +312,7 @@ void rtw_ps_processor(_adapter *padapter)
|
||||
|
||||
/* RTW_INFO("==> fw report state(0x%x)\n",rtw_read8(padapter,0x1ca)); */
|
||||
if (pwrpriv->bHWPwrPindetect) {
|
||||
|
||||
|
||||
rfpwrstate = RfOnOffDetect(padapter);
|
||||
RTW_INFO("@@@@- #2 %s==> rfstate:%s\n", __FUNCTION__, (rfpwrstate == rf_on) ? "rf_on" : "rf_off");
|
||||
|
||||
@@ -321,7 +327,7 @@ void rtw_ps_processor(_adapter *padapter)
|
||||
}
|
||||
RTW_INFO("current rf_pwrstate(%s)\n", (pwrpriv->rf_pwrstate == rf_off) ? "rf_off" : "rf_on");
|
||||
}
|
||||
|
||||
|
||||
pwrpriv->pwr_state_check_cnts++;
|
||||
}
|
||||
#endif /* SUPPORT_HW_RFOFF_DETECTED */
|
||||
@@ -334,7 +340,7 @@ void rtw_ps_processor(_adapter *padapter)
|
||||
|
||||
if ((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts % 4) == 0)) {
|
||||
RTW_INFO("==>%s .fw_state(%x)\n", __FUNCTION__, get_fwstate(pmlmepriv));
|
||||
pwrpriv->change_rfpwrstate = rf_off;
|
||||
pwrpriv->change_rfpwrstate = rf_off;
|
||||
|
||||
#ifdef CONFIG_IPS
|
||||
ips_enter(padapter);
|
||||
@@ -663,7 +669,10 @@ u8 PS_RDY_CHECK(_adapter *padapter)
|
||||
|| check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS)
|
||||
|| MLME_IS_AP(padapter)
|
||||
|| MLME_IS_MESH(padapter)
|
||||
/* nrm */
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
|| MLME_IS_MONITOR(padapter)
|
||||
#endif
|
||||
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)
|
||||
#if defined(CONFIG_IOCTL_CFG80211)
|
||||
|| rtw_cfg80211_get_is_roch(padapter) == _TRUE
|
||||
@@ -867,7 +876,7 @@ void rtw_lps_rfon_ctrl(_adapter *padapter, u8 rfon_ctrl)
|
||||
} while (1);
|
||||
|
||||
if (ready == _FAIL)
|
||||
RTW_INFO(FUNC_ADPT_FMT": It is not ready to leave 32K !!!\n",
|
||||
RTW_INFO(FUNC_ADPT_FMT": It is not ready to leave 32K !!!\n",
|
||||
FUNC_ADPT_ARG(padapter));
|
||||
}
|
||||
#endif /* CONFIG_LPS_LCLK */
|
||||
@@ -888,7 +897,7 @@ void rtw_lps_rfon_ctrl(_adapter *padapter, u8 rfon_ctrl)
|
||||
#ifdef CONFIG_LPS_PG
|
||||
if (pwrpriv->lps_level == LPS_PG) {
|
||||
if (rtw_hal_set_lps_pg_info_cmd(padapter) == _FAIL)
|
||||
RTW_INFO(FUNC_ADPT_FMT": Send PG H2C command Fail! \n",
|
||||
RTW_INFO(FUNC_ADPT_FMT": Send PG H2C command Fail! \n",
|
||||
FUNC_ADPT_ARG(padapter));
|
||||
}
|
||||
#endif /* CONFIG_LPS_PG */
|
||||
@@ -918,14 +927,14 @@ void rtw_lps_rfon_ctrl(_adapter *padapter, u8 rfon_ctrl)
|
||||
} while (polling_cnt < 100);
|
||||
|
||||
if (result == _FAIL )
|
||||
RTW_INFO(FUNC_ADPT_FMT": It is not finished to enter 32K !!!\n",
|
||||
RTW_INFO(FUNC_ADPT_FMT": It is not finished to enter 32K !!!\n",
|
||||
FUNC_ADPT_ARG(padapter));
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_LPS_LCLK */
|
||||
}
|
||||
} else {
|
||||
RTW_INFO(FUNC_ADPT_FMT": RFON can't work due to ps state is not in LPS !\n",
|
||||
RTW_INFO(FUNC_ADPT_FMT": RFON can't work due to ps state is not in LPS !\n",
|
||||
FUNC_ADPT_ARG(padapter));
|
||||
}
|
||||
}
|
||||
@@ -938,7 +947,7 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
|
||||
struct dvobj_priv *psdpriv = padapter->dvobj;
|
||||
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
|
||||
#endif
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
struct registry_priv *pregistrypriv = &padapter->registrypriv;
|
||||
#endif
|
||||
#ifdef CONFIG_P2P
|
||||
@@ -966,7 +975,7 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
|
||||
return;
|
||||
|
||||
#ifndef CONFIG_BT_COEXIST
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
if (!rtw_is_wmmps_mode(padapter))
|
||||
#endif /* CONFIG_WMMPS_STA */
|
||||
if ((pwrpriv->smart_ps == smart_ps) &&
|
||||
@@ -1152,12 +1161,12 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
pwrpriv->wmm_smart_ps = pregistrypriv->wmm_smart_ps;
|
||||
#endif /* CONFIG_WMMPS_STA */
|
||||
|
||||
|
||||
rtw_exec_lps(padapter, ps_mode);
|
||||
|
||||
|
||||
#ifdef CONFIG_WOWLAN
|
||||
if (pwrpriv->wowlan_mode == _TRUE)
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_INACTIVE_IPS, (u8 *)(&ps_mode));
|
||||
@@ -1266,10 +1275,10 @@ void LPS_Enter(PADAPTER padapter, const char *msg)
|
||||
if (rtw_is_wmmps_mode(padapter))
|
||||
msg = "WMMPS_IDLE";
|
||||
#endif /* CONFIG_WMMPS_STA */
|
||||
|
||||
|
||||
sprintf(buf, "WIFI-%s", msg);
|
||||
pwrpriv->bpower_saving = _TRUE;
|
||||
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
pwrpriv->pwr_saving_start_time = rtw_get_current_time();
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_LLSTATS */
|
||||
@@ -1322,11 +1331,11 @@ void LPS_Leave(PADAPTER padapter, const char *msg)
|
||||
if (rtw_is_wmmps_mode(padapter))
|
||||
msg = "WMMPS_BUSY";
|
||||
#endif /* CONFIG_WMMPS_STA */
|
||||
|
||||
|
||||
sprintf(buf, "WIFI-%s", msg);
|
||||
rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, buf);
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
pwrpriv->pwr_saving_time += rtw_get_passing_time_ms(pwrpriv->pwr_saving_start_time);
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_LLSTATS */
|
||||
}
|
||||
@@ -1488,14 +1497,14 @@ void LeaveAllPowerSaveMode(PADAPTER Adapter)
|
||||
#endif
|
||||
} else {
|
||||
if (adapter_to_pwrctl(Adapter)->rf_pwrstate == rf_off) {
|
||||
|
||||
|
||||
#if defined(CONFIG_FWLPS_IN_IPS) || defined(CONFIG_SWLPS_IN_IPS) || (defined(CONFIG_PLATFORM_SPRD) && defined(CONFIG_RTL8188E))
|
||||
#ifdef CONFIG_IPS
|
||||
if (_FALSE == ips_leave(Adapter))
|
||||
RTW_INFO("======> ips_leave fail.............\n");
|
||||
#endif
|
||||
#endif /* CONFIG_SWLPS_IN_IPS || (CONFIG_PLATFORM_SPRD && CONFIG_RTL8188E) */
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2250,7 +2259,7 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
|
||||
pwrctrlpriv->tog = 0x80;
|
||||
pwrctrlpriv->rpwm_retry = 0;
|
||||
|
||||
RTW_INFO("%s: IPS_mode=%d, LPS_mode=%d, LPS_level=%d"LPS_1T1R_FMT"\n",
|
||||
RTW_INFO("%s: IPS_mode=%d, LPS_mode=%d, LPS_level=%d"LPS_1T1R_FMT"\n",
|
||||
__func__, pwrctrlpriv->ips_mode, pwrctrlpriv->power_mgnt, pwrctrlpriv->lps_level
|
||||
LPS_1T1R_ARG
|
||||
);
|
||||
@@ -2325,7 +2334,7 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
|
||||
, pwrctrlpriv->wowlan_gpio_output_state);
|
||||
rtw_hal_switch_gpio_wl_ctrl(padapter, pwrctrlpriv->wowlan_gpio_index, _TRUE);
|
||||
RTW_INFO("%s: set GPIO_%d to OUTPUT %s state in initial and %s_ACTIVE.\n",
|
||||
__func__, pwrctrlpriv->wowlan_gpio_index,
|
||||
__func__, pwrctrlpriv->wowlan_gpio_index,
|
||||
pwrctrlpriv->wowlan_gpio_output_state ? "HIGH" : "LOW",
|
||||
pwrctrlpriv->is_high_active ? "HIGI" : "LOW");
|
||||
#endif /*CONFIG_WAKEUP_GPIO_INPUT_MODE*/
|
||||
@@ -2700,7 +2709,7 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
|
||||
}
|
||||
|
||||
if (rf_off == pwrpriv->rf_pwrstate) {
|
||||
|
||||
|
||||
#ifdef CONFIG_IPS
|
||||
RTW_INFO("%s call ips_leave....\n", __FUNCTION__);
|
||||
if (_FAIL == ips_leave(padapter)) {
|
||||
@@ -2709,7 +2718,7 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* TODO: the following checking need to be merged... */
|
||||
@@ -2801,7 +2810,7 @@ int rtw_pm_set_wow_lps(_adapter *padapter, u8 mode)
|
||||
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
|
||||
|
||||
if (mode < PS_MODE_NUM) {
|
||||
if (pwrctrlpriv->wowlan_power_mgmt != mode)
|
||||
if (pwrctrlpriv->wowlan_power_mgmt != mode)
|
||||
pwrctrlpriv->wowlan_power_mgmt = mode;
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
|
||||
@@ -4049,9 +4049,8 @@ int recv_frame_monitor(_adapter *padapter, union recv_frame *rframe)
|
||||
|
||||
/* read skb information from recv frame */
|
||||
pskb = rframe->u.hdr.pkt;
|
||||
pskb->head = rframe->u.hdr.rx_head;
|
||||
pskb->data = rframe->u.hdr.rx_data;
|
||||
pskb->len = rframe->u.hdr.len;
|
||||
pskb->data = rframe->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(pskb, rframe->u.hdr.len);
|
||||
|
||||
if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) {
|
||||
|
||||
@@ -4866,7 +4866,8 @@ static void do_queue_select(_adapter *padapter, struct pkt_attrib *pattrib)
|
||||
s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
||||
{
|
||||
u16 frame_ctl;
|
||||
struct ieee80211_radiotap_header rtap_hdr;
|
||||
/* nrm */
|
||||
// struct ieee80211_radiotap_header rtap_hdr;
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
|
||||
struct pkt_file pktfile;
|
||||
struct rtw_ieee80211_hdr *pwlanhdr;
|
||||
@@ -4875,36 +4876,84 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
||||
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
||||
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
|
||||
unsigned char *pframe;
|
||||
u8 dummybuf[32];
|
||||
int len = skb->len, rtap_len;
|
||||
|
||||
/* nrm */
|
||||
// u8 dummybuf[32];
|
||||
// int len = skb->len, rtap_len;
|
||||
int len = skb->len, rtap_len, rtap_remain, alloc_tries, ret;
|
||||
struct ieee80211_radiotap_header *rtap_hdr; // net/ieee80211_radiotap.h
|
||||
struct ieee80211_radiotap_iterator iterator; // net/cfg80211.h
|
||||
u8 rtap_buf[256];
|
||||
|
||||
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
|
||||
|
||||
#ifndef CONFIG_CUSTOMER_ALIBABA_GENERAL
|
||||
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
|
||||
goto fail;
|
||||
/* nrm */
|
||||
// if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
|
||||
// goto fail;
|
||||
if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) {
|
||||
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
|
||||
goto fail;
|
||||
|
||||
_rtw_open_pktfile((_pkt *)skb, &pktfile);
|
||||
_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))
|
||||
goto fail;
|
||||
/* nrm */
|
||||
// _rtw_open_pktfile((_pkt *)skb, &pktfile);
|
||||
// _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))
|
||||
// goto fail;
|
||||
_rtw_open_pktfile((_pkt *)skb, &pktfile);
|
||||
_rtw_pktfile_read(&pktfile, rtap_buf, sizeof(struct ieee80211_radiotap_header));
|
||||
rtap_hdr = (struct ieee80211_radiotap_header*)(rtap_buf);
|
||||
rtap_len = ieee80211_get_radiotap_len(rtap_buf);
|
||||
|
||||
if (unlikely(skb->len < rtap_len))
|
||||
goto fail;
|
||||
/* nrm */
|
||||
// if (unlikely(skb->len < rtap_len))
|
||||
// goto fail;
|
||||
if (unlikely(rtap_hdr->it_version))
|
||||
goto fail;
|
||||
|
||||
if (rtap_len != 12) {
|
||||
RTW_INFO("radiotap len (should be 14): %d\n", rtap_len);
|
||||
goto fail;
|
||||
/* nrm */
|
||||
// if (rtap_len != 12) {
|
||||
// RTW_INFO("radiotap len (should be 14): %d\n", rtap_len);
|
||||
// goto fail;
|
||||
|
||||
if (unlikely(rtap_len < sizeof(struct ieee80211_radiotap_header)))
|
||||
goto fail;
|
||||
|
||||
len -= sizeof(struct ieee80211_radiotap_header);
|
||||
rtap_remain = rtap_len - sizeof(struct ieee80211_radiotap_header);
|
||||
|
||||
if (rtap_remain > 0) {
|
||||
_rtw_pktfile_read(&pktfile, &rtap_buf[sizeof(struct ieee80211_radiotap_header)], rtap_remain);
|
||||
len -= rtap_remain;
|
||||
}
|
||||
|
||||
// NOTE: we process the radiotap header details later
|
||||
}
|
||||
_rtw_pktfile_read(&pktfile, dummybuf, rtap_len-sizeof(struct ieee80211_radiotap_header));
|
||||
len = len - rtap_len;
|
||||
|
||||
/* nrm */
|
||||
// _rtw_pktfile_read(&pktfile, dummybuf, rtap_len-sizeof(struct ieee80211_radiotap_header));
|
||||
// len = len - rtap_len;
|
||||
#endif
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe == NULL) {
|
||||
rtw_udelay_os(500);
|
||||
goto fail;
|
||||
|
||||
/* nrm */
|
||||
// pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
// if (pmgntframe == NULL) {
|
||||
// rtw_udelay_os(500);
|
||||
// goto fail;
|
||||
// v5.2.20 had an allocation wrapper (monitor_alloc_mgtxmitframe) that performed a few
|
||||
// tries to allocate an xmit frame before giving up. This can be beneficial when there
|
||||
// is a rapid-fire sequence of injected frames. Without it, frames can be randomly
|
||||
// dropped. So this recreates the same functionality.
|
||||
|
||||
for (alloc_tries=3; alloc_tries > 0; alloc_tries--) {
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe != NULL)
|
||||
break;
|
||||
if (alloc_tries <= 1) {
|
||||
rtw_udelay_os(500);
|
||||
goto fail;
|
||||
}
|
||||
rtw_udelay_os(100);
|
||||
}
|
||||
|
||||
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
|
||||
@@ -4912,17 +4961,24 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
||||
// _rtw_memcpy(pframe, (void *)checking, len);
|
||||
_rtw_pktfile_read(&pktfile, pframe, len);
|
||||
|
||||
|
||||
/* Check DATA/MGNT frames */
|
||||
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
|
||||
frame_ctl = le16_to_cpu(pwlanhdr->frame_ctl);
|
||||
/* nrm */
|
||||
// frame_ctl = le16_to_cpu(pwlanhdr->frame_ctl);
|
||||
if (unlikely(len < sizeof(struct rtw_ieee80211_hdr_3addr)))
|
||||
frame_ctl = 0;
|
||||
else
|
||||
frame_ctl = le16_to_cpu(pwlanhdr->frame_ctl);
|
||||
|
||||
if ((frame_ctl & RTW_IEEE80211_FCTL_FTYPE) == RTW_IEEE80211_FTYPE_DATA) {
|
||||
|
||||
pattrib = &pmgntframe->attrib;
|
||||
update_monitor_frame_attrib(padapter, pattrib);
|
||||
|
||||
if (is_broadcast_mac_addr(pwlanhdr->addr3) || is_broadcast_mac_addr(pwlanhdr->addr1))
|
||||
pattrib->rate = MGN_24M;
|
||||
/* nrm */
|
||||
// if (is_broadcast_mac_addr(pwlanhdr->addr3) || is_broadcast_mac_addr(pwlanhdr->addr1))
|
||||
// pattrib->rate = MGN_24M;
|
||||
pattrib->rate = MGN_1M; // Override a more practical default rate
|
||||
|
||||
} else {
|
||||
|
||||
@@ -4937,7 +4993,179 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
|
||||
pmlmeext->mgnt_seq++;
|
||||
pattrib->last_txcmdsz = pattrib->pktlen;
|
||||
|
||||
/* nrm */
|
||||
#ifndef CONFIG_CUSTOMER_ALIBABA_GENERAL
|
||||
|
||||
if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) {
|
||||
// Parse radiotap for injection items and overwrite attribs as needed.
|
||||
// This code should probably live in core/monitor/rtw_radiotap.c, but we would have to
|
||||
// pass pointers to a large number of things simply for the sake of organization,
|
||||
// and it isn't worth it at this preliminary point to get things up and running.
|
||||
// Let's call it a possible FUTURE-TODO.
|
||||
|
||||
ret = ieee80211_radiotap_iterator_init(&iterator, rtap_hdr, rtap_len, NULL);
|
||||
while (!ret) {
|
||||
ret = ieee80211_radiotap_iterator_next(&iterator);
|
||||
if (ret)
|
||||
continue;
|
||||
|
||||
switch (iterator.this_arg_index) {
|
||||
case IEEE80211_RADIOTAP_RATE:
|
||||
// This is basic 802.11b/g rate; use MCS/VHT for higher rates
|
||||
pattrib->rate = *iterator.this_arg;
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
pattrib->raid = RATEID_IDX_BGN_40M_1SS;
|
||||
#else
|
||||
if (pattrib->rate == IEEE80211_CCK_RATE_1MB
|
||||
|| pattrib->rate == IEEE80211_CCK_RATE_2MB
|
||||
|| pattrib->rate == IEEE80211_CCK_RATE_5MB
|
||||
|| pattrib->rate == IEEE80211_CCK_RATE_11MB )
|
||||
pattrib->raid = rtw_get_mgntframe_raid(padapter, WIRELESS_11B);
|
||||
else
|
||||
pattrib->raid = rtw_get_mgntframe_raid(padapter, WIRELESS_11G);
|
||||
#endif
|
||||
|
||||
// We have to reset other attributes that may have been set prior for MCS/VHT rates
|
||||
pattrib->ht_en = _FALSE;
|
||||
pattrib->ampdu_en = _FALSE;
|
||||
pattrib->sgi = _FALSE;
|
||||
pattrib->ldpc = _FALSE;
|
||||
pattrib->stbc = 0;
|
||||
pattrib->bwmode = CHANNEL_WIDTH_20;
|
||||
pattrib->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||
|
||||
break;
|
||||
|
||||
case IEEE80211_RADIOTAP_TX_FLAGS: {
|
||||
u16 txflags = get_unaligned_le16(iterator.this_arg);
|
||||
|
||||
if ((txflags & IEEE80211_RADIOTAP_F_TX_NOACK) == 0)
|
||||
pattrib->retry_ctrl = _TRUE; // Note; already _FALSE by default
|
||||
|
||||
if (txflags & 0x0010) { // Use preconfigured seq num
|
||||
if (len >= sizeof(struct rtw_ieee80211_hdr_3addr)) {
|
||||
pattrib->seqnum = GetSequence(pwlanhdr);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case IEEE80211_RADIOTAP_MCS: {
|
||||
u8 mcs_have = iterator.this_arg[0];
|
||||
|
||||
// Set up defaults
|
||||
pattrib->rate = MGN_MCS0;
|
||||
pattrib->bwmode = IEEE80211_RADIOTAP_MCS_BW_20;
|
||||
pattrib->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||
pattrib->ht_en = _TRUE;
|
||||
pattrib->sgi = _FALSE;
|
||||
pattrib->ldpc = _FALSE;
|
||||
pattrib->stbc = 0;
|
||||
|
||||
if (mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_BW) {
|
||||
|
||||
u8 bw = (iterator.this_arg[1] & IEEE80211_RADIOTAP_MCS_BW_MASK);
|
||||
if (bw == IEEE80211_RADIOTAP_MCS_BW_20L) {
|
||||
bw = IEEE80211_RADIOTAP_MCS_BW_20;
|
||||
pattrib->ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
|
||||
}
|
||||
if (bw == IEEE80211_RADIOTAP_MCS_BW_20U) {
|
||||
bw = IEEE80211_RADIOTAP_MCS_BW_20;
|
||||
pattrib->ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
|
||||
}
|
||||
|
||||
pattrib->bwmode = bw;
|
||||
}
|
||||
|
||||
if (mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_MCS) {
|
||||
u8 fixed_rate = iterator.this_arg[2] & 0x7f;
|
||||
if(fixed_rate > 31)
|
||||
fixed_rate = 0;
|
||||
fixed_rate += MGN_MCS0;
|
||||
pattrib->rate = fixed_rate;
|
||||
}
|
||||
|
||||
if ((mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_GI) && (iterator.this_arg[1] & IEEE80211_RADIOTAP_MCS_SGI))
|
||||
pattrib->sgi = _TRUE;
|
||||
|
||||
if ((mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_FEC) && (iterator.this_arg[1] & IEEE80211_RADIOTAP_MCS_FEC_LDPC))
|
||||
pattrib->ldpc = _TRUE;
|
||||
|
||||
if (mcs_have & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
|
||||
u8 stbc = (iterator.this_arg[1] & IEEE80211_RADIOTAP_MCS_STBC_MASK) >> IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
|
||||
pattrib->stbc = stbc;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
case IEEE80211_RADIOTAP_VHT: {
|
||||
unsigned int mcs, nss;
|
||||
|
||||
u8 known = iterator.this_arg[0];
|
||||
u8 flags = iterator.this_arg[2];
|
||||
|
||||
// Set up defaults
|
||||
pattrib->stbc = 0;
|
||||
pattrib->sgi = _FALSE;
|
||||
pattrib->bwmode = CHANNEL_WIDTH_20;
|
||||
pattrib->ldpc = _FALSE;
|
||||
pattrib->rate = MGN_VHT1SS_MCS0;
|
||||
pattrib->raid = RATEID_IDX_VHT_1SS;
|
||||
|
||||
// NOTE: this code currently only supports 1SS for radiotap defined rates
|
||||
|
||||
if ((known & IEEE80211_RADIOTAP_VHT_KNOWN_STBC) && (flags & IEEE80211_RADIOTAP_VHT_FLAG_STBC))
|
||||
pattrib->stbc = 1;
|
||||
|
||||
if ((known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) && (flags & IEEE80211_RADIOTAP_VHT_FLAG_SGI))
|
||||
pattrib->sgi = _TRUE;
|
||||
|
||||
if (known & IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
|
||||
u8 bw = iterator.this_arg[3] & 0x1F;
|
||||
// NOTE: there are various L and U, but we just use straight 20/40/80
|
||||
// since it's not clear how to set CHNL_OFFSET_LOWER/_UPPER with different
|
||||
// sideband sizes/configurations. TODO.
|
||||
// Also, any 160 is treated as 80 due to lack of WIDTH_160.
|
||||
if (bw == 0)
|
||||
pattrib->bwmode = CHANNEL_WIDTH_20;
|
||||
else if (bw >=1 && bw <= 3)
|
||||
pattrib->bwmode = CHANNEL_WIDTH_40;
|
||||
else if (bw >=4 && bw <= 10)
|
||||
pattrib->bwmode = CHANNEL_WIDTH_80;
|
||||
else if (bw >= 11 && bw <= 25)
|
||||
pattrib->bwmode = CHANNEL_WIDTH_80; // Supposed to be 160Mhz, we use 80Mhz
|
||||
}
|
||||
|
||||
// User 0
|
||||
nss = iterator.this_arg[4] & 0x0F; // Number of spatial streams
|
||||
if (nss > 0) {
|
||||
if (nss > 4) nss = 4;
|
||||
mcs = (iterator.this_arg[4]>>4) & 0x0F; // MCS rate index
|
||||
if (mcs > 8) mcs = 9;
|
||||
pattrib->rate = MGN_VHT1SS_MCS0 + ((nss-1)*10 + mcs);
|
||||
|
||||
if (iterator.this_arg[8] & IEEE80211_RADIOTAP_CODING_LDPC_USER0)
|
||||
pattrib->ldpc = _TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
#endif // CONFIG_80211AC_VHT
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CONFIG_CUSTOMER_ALIBABA_GENERAL
|
||||
|
||||
dump_mgntframe(padapter, pmgntframe);
|
||||
/* nrm */
|
||||
pxmitpriv->tx_pkts++;
|
||||
pxmitpriv->tx_bytes += skb->len;
|
||||
|
||||
fail:
|
||||
rtw_skb_free(skb);
|
||||
|
||||
@@ -26,7 +26,11 @@ int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz)
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
tasklet_init(&precvpriv->recv_tasklet,
|
||||
(void(*))usb_recv_tasklet,
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
|
||||
(void(*)(unsigned long))usb_recv_tasklet,
|
||||
#else
|
||||
(void *)usb_recv_tasklet,
|
||||
#endif
|
||||
(unsigned long)padapter);
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
#define PHYDM_SNPRINTF snprintf
|
||||
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
|
||||
#undef pr_debug
|
||||
#define pr_debug _RTW_DBG
|
||||
#define pr_debug printk
|
||||
#define RT_PRINTK(fmt, args...) pr_debug(fmt, ## args)
|
||||
#define RT_DISP(dbgtype, dbgflag, printstr)
|
||||
#define RT_TRACE(adapter, comp, drv_level, fmt, args...) \
|
||||
|
||||
@@ -5110,9 +5110,11 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
|
||||
ie_offset = _REASOCREQ_IE_OFFSET_;
|
||||
|
||||
memset(&sinfo, 0, sizeof(sinfo));
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
|
||||
sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
|
||||
sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset;
|
||||
sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset;
|
||||
#endif
|
||||
cfg80211_new_sta(ndev, get_addr2_ptr(pmgmt_frame), &sinfo, GFP_ATOMIC);
|
||||
}
|
||||
#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
|
||||
@@ -5412,7 +5414,7 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2))
|
||||
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev,
|
||||
unsigned int link_id)
|
||||
unsigned int link_id)
|
||||
#else
|
||||
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
|
||||
#endif
|
||||
@@ -6210,11 +6212,15 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy
|
||||
#endif
|
||||
, struct ieee80211_channel *chan, enum nl80211_channel_type channel_type)
|
||||
{
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||
#else /* CONFIG_WIFI_MONITOR */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
|
||||
#else
|
||||
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||
#endif
|
||||
#endif /* CONFIG_WIFI_MONITOR */
|
||||
int chan_target = (u8) ieee80211_frequency_to_channel(chan->center_freq);
|
||||
int chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||
int chan_width = CHANNEL_WIDTH_20;
|
||||
|
||||
@@ -143,7 +143,7 @@ int rtw_early_mode = 1;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SW_LED
|
||||
int rtw_led_ctrl = 1; // default to normal blink
|
||||
int rtw_led_ctrl = 1; // default to normal blinking
|
||||
#endif
|
||||
|
||||
int rtw_usb_rxagg_mode = 2;/* RX_AGG_DMA=1, RX_AGG_USB=2 */
|
||||
|
||||
@@ -139,6 +139,7 @@ int rtw_os_alloc_recvframe(_adapter *padapter, union recv_frame *precvframe, u8
|
||||
|
||||
precvframe->u.hdr.pkt = rtw_skb_clone(pskb);
|
||||
if (precvframe->u.hdr.pkt) {
|
||||
RTW_INFO("%s: rtw_skb_clone success, RX throughput may be low!\n", __FUNCTION__);
|
||||
precvframe->u.hdr.pkt->dev = padapter->pnetdev;
|
||||
precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pdata;
|
||||
precvframe->u.hdr.rx_end = pdata + alloc_sz;
|
||||
@@ -353,7 +354,6 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, const u8 *da, const u8 *s
|
||||
{
|
||||
sub_skb = rtw_skb_clone(prframe->u.hdr.pkt);
|
||||
if (sub_skb) {
|
||||
sub_skb->head = msdu;
|
||||
sub_skb->data = msdu;
|
||||
sub_skb->len = msdu_len;
|
||||
skb_set_tail_pointer(sub_skb, msdu_len);
|
||||
@@ -619,9 +619,8 @@ void rtw_hostapd_mlme_rx(_adapter *padapter, union recv_frame *precv_frame)
|
||||
if (skb == NULL)
|
||||
return;
|
||||
|
||||
skb->head = precv_frame->u.hdr.rx_head;
|
||||
skb->data = precv_frame->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(skb, precv_frame->u.hdr.rx_tail - precv_frame->u.hdr.rx_data);
|
||||
skb->tail = precv_frame->u.hdr.rx_tail;
|
||||
skb->len = precv_frame->u.hdr.len;
|
||||
|
||||
/* pskb_copy = rtw_skb_copy(skb);
|
||||
@@ -663,7 +662,6 @@ int rtw_recv_monitor(_adapter *padapter, union recv_frame *precv_frame)
|
||||
goto _recv_drop;
|
||||
}
|
||||
|
||||
skb->head = precv_frame->u.hdr.rx_head;
|
||||
skb->data = precv_frame->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(skb, precv_frame->u.hdr.len);
|
||||
skb->len = precv_frame->u.hdr.len;
|
||||
@@ -688,7 +686,6 @@ inline void rtw_rframe_set_os_pkt(union recv_frame *rframe)
|
||||
{
|
||||
_pkt *skb = rframe->u.hdr.pkt;
|
||||
|
||||
skb->head = rframe->u.hdr.rx_head;
|
||||
skb->data = rframe->u.hdr.rx_data;
|
||||
skb_set_tail_pointer(skb, rframe->u.hdr.len);
|
||||
skb->len = rframe->u.hdr.len;
|
||||
|
||||
@@ -2539,7 +2539,7 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the file with @param path and wirte @param sz byte of data starting from @param buf into the file
|
||||
* Open the file with @param path and write @param sz byte of data starting from @param buf into the file
|
||||
* @param path the path of the file to open and write
|
||||
* @param buf the starting address of the data to write into file
|
||||
* @param sz how many bytes to write at most
|
||||
|
||||
@@ -940,11 +940,11 @@ void rtw_efuse_analyze(PADAPTER padapter, u8 Type, u8 Fake)
|
||||
for (i = 0; i < mapLen; i++) {
|
||||
if (i % 16 == 0)
|
||||
RTW_PRINT_SEL(RTW_DBGDUMP, "0x%03x: ", i);
|
||||
_RTW_PRINT_SEL(RTW_DBGDUMP, "%02X%s"
|
||||
, pEfuseHal->fakeEfuseInitMap[i]
|
||||
, ((i + 1) % 16 == 0) ? "\n" : (((i + 1) % 8 == 0) ? " " : " ")
|
||||
);
|
||||
}
|
||||
_RTW_PRINT_SEL(RTW_DBGDUMP, "%02X%s"
|
||||
, pEfuseHal->fakeEfuseInitMap[i]
|
||||
, ((i + 1) % 16 == 0) ? "\n" : (((i + 1) % 8 == 0) ? " " : " ")
|
||||
);
|
||||
}
|
||||
_RTW_PRINT_SEL(RTW_DBGDUMP, "\n");
|
||||
|
||||
out_free_buffer:
|
||||
|
||||
@@ -402,8 +402,10 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
|
||||
}
|
||||
|
||||
if (a->ampdu_eof) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
||||
tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF_KNOWN);
|
||||
tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF);
|
||||
#endif
|
||||
}
|
||||
|
||||
_rtw_memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/if_arp.h>
|
||||
#include <net/ip.h>
|
||||
// #if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 14, 0))
|
||||
// #include <net/ipx.h>
|
||||
// #endif
|
||||
#include <linux/version.h>
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
||||
#include <net/ipx.h>
|
||||
#endif
|
||||
#include <linux/atalk.h>
|
||||
#include <linux/udp.h>
|
||||
#include <linux/if_pppox.h>
|
||||
@@ -170,8 +171,8 @@ static void __nat25_generate_ipv4_network_addr(unsigned char *networkAddr,
|
||||
memcpy(networkAddr + 7, (unsigned char *)ipAddr, 4);
|
||||
}
|
||||
|
||||
/* The following 3 functions are no longer used
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
||||
static void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
|
||||
unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
|
||||
{
|
||||
@@ -203,8 +204,8 @@ static void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
|
||||
memcpy(networkAddr + 1, (unsigned char *)network, 2);
|
||||
networkAddr[3] = *node;
|
||||
}
|
||||
#endif
|
||||
|
||||
*/
|
||||
|
||||
static void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
|
||||
unsigned char *ac_mac, unsigned short *sid)
|
||||
@@ -334,6 +335,7 @@ static int __nat25_network_hash(unsigned char *networkAddr)
|
||||
x = networkAddr[7] ^ networkAddr[8] ^ networkAddr[9] ^ networkAddr[10];
|
||||
|
||||
return x & (NAT25_HASH_SIZE - 1);
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
||||
} else if (networkAddr[0] == NAT25_IPX) {
|
||||
unsigned long x;
|
||||
|
||||
@@ -347,6 +349,7 @@ static int __nat25_network_hash(unsigned char *networkAddr)
|
||||
x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3];
|
||||
|
||||
return x & (NAT25_HASH_SIZE - 1);
|
||||
#endif
|
||||
} else if (networkAddr[0] == NAT25_PPPOE) {
|
||||
unsigned long x;
|
||||
|
||||
@@ -893,6 +896,229 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
||||
}
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
|
||||
/*---------------------------------------------------*/
|
||||
/* Handle IPX and Apple Talk frame */
|
||||
/*---------------------------------------------------*/
|
||||
else if ((protocol == __constant_htons(ETH_P_IPX)) ||
|
||||
(protocol == __constant_htons(ETH_P_ATALK)) ||
|
||||
(protocol == __constant_htons(ETH_P_AARP))) {
|
||||
unsigned char ipx_header[2] = {0xFF, 0xFF};
|
||||
struct ipxhdr *ipx = NULL;
|
||||
struct elapaarp *ea = NULL;
|
||||
struct ddpehdr *ddp = NULL;
|
||||
unsigned char *framePtr = skb->data + ETH_HLEN;
|
||||
|
||||
if (protocol == __constant_htons(ETH_P_IPX)) {
|
||||
RTW_INFO("NAT25: Protocol=IPX (Ethernet II)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
} else { /* if(protocol <= __constant_htons(ETH_FRAME_LEN)) */
|
||||
if (!memcmp(ipx_header, framePtr, 2)) {
|
||||
RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
} else {
|
||||
unsigned char ipx_8022_type = 0xE0;
|
||||
unsigned char snap_8022_type = 0xAA;
|
||||
|
||||
if (*framePtr == snap_8022_type) {
|
||||
unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; /* IPX SNAP ID */
|
||||
unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; /* Apple Talk AARP SNAP ID */
|
||||
unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; /* Apple Talk DDP SNAP ID */
|
||||
|
||||
framePtr += 3; /* eliminate the 802.2 header */
|
||||
|
||||
if (!memcmp(ipx_snap_id, framePtr, 5)) {
|
||||
framePtr += 5; /* eliminate the SNAP header */
|
||||
|
||||
RTW_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
} else if (!memcmp(aarp_snap_id, framePtr, 5)) {
|
||||
framePtr += 5; /* eliminate the SNAP header */
|
||||
|
||||
ea = (struct elapaarp *)framePtr;
|
||||
} else if (!memcmp(ddp_snap_id, framePtr, 5)) {
|
||||
framePtr += 5; /* eliminate the SNAP header */
|
||||
|
||||
ddp = (struct ddpehdr *)framePtr;
|
||||
} else {
|
||||
DEBUG_WARN("NAT25: Protocol=Ethernet SNAP %02x%02x%02x%02x%02x\n", framePtr[0],
|
||||
framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
|
||||
return -1;
|
||||
}
|
||||
} else if (*framePtr == ipx_8022_type) {
|
||||
framePtr += 3; /* eliminate the 802.2 header */
|
||||
|
||||
if (!memcmp(ipx_header, framePtr, 2)) {
|
||||
RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.2)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* IPX */
|
||||
if (ipx != NULL) {
|
||||
switch (method) {
|
||||
case NAT25_CHECK:
|
||||
if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
|
||||
RTW_INFO("NAT25: Check IPX skb_copy\n");
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
||||
case NAT25_INSERT: {
|
||||
RTW_INFO("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n",
|
||||
ipx->ipx_dest.net,
|
||||
ipx->ipx_dest.node[0],
|
||||
ipx->ipx_dest.node[1],
|
||||
ipx->ipx_dest.node[2],
|
||||
ipx->ipx_dest.node[3],
|
||||
ipx->ipx_dest.node[4],
|
||||
ipx->ipx_dest.node[5],
|
||||
ipx->ipx_dest.sock,
|
||||
ipx->ipx_source.net,
|
||||
ipx->ipx_source.node[0],
|
||||
ipx->ipx_source.node[1],
|
||||
ipx->ipx_source.node[2],
|
||||
ipx->ipx_source.node[3],
|
||||
ipx->ipx_source.node[4],
|
||||
ipx->ipx_source.node[5],
|
||||
ipx->ipx_source.sock);
|
||||
|
||||
if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
|
||||
RTW_INFO("NAT25: Use IPX Net, and Socket as network addr\n");
|
||||
|
||||
__nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
|
||||
|
||||
/* change IPX source node addr to wlan STA address */
|
||||
memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
|
||||
} else
|
||||
__nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_source.net, ipx->ipx_source.node);
|
||||
|
||||
__nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
|
||||
|
||||
__nat25_db_print(priv);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case NAT25_LOOKUP: {
|
||||
if (!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN)) {
|
||||
RTW_INFO("NAT25: Lookup IPX, Modify Destination IPX Node addr\n");
|
||||
|
||||
__nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_dest.net, &ipx->ipx_dest.sock);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
|
||||
/* replace IPX destination node addr with Lookup destination MAC addr */
|
||||
memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
|
||||
} else {
|
||||
__nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_dest.net, ipx->ipx_dest.node);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* AARP */
|
||||
else if (ea != NULL) {
|
||||
/* Sanity check fields. */
|
||||
if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) {
|
||||
DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (method) {
|
||||
case NAT25_CHECK:
|
||||
return 0;
|
||||
|
||||
case NAT25_INSERT: {
|
||||
/* change to AARP source mac address to wlan STA address */
|
||||
memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
|
||||
|
||||
RTW_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
|
||||
ea->pa_src_net,
|
||||
ea->pa_src_node,
|
||||
ea->pa_dst_net,
|
||||
ea->pa_dst_node);
|
||||
|
||||
__nat25_generate_apple_network_addr(networkAddr, &ea->pa_src_net, &ea->pa_src_node);
|
||||
|
||||
__nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
|
||||
|
||||
__nat25_db_print(priv);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case NAT25_LOOKUP: {
|
||||
RTW_INFO("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n",
|
||||
ea->pa_src_net,
|
||||
ea->pa_src_node,
|
||||
ea->pa_dst_net,
|
||||
ea->pa_dst_node);
|
||||
|
||||
__nat25_generate_apple_network_addr(networkAddr, &ea->pa_dst_net, &ea->pa_dst_node);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
|
||||
/* change to AARP destination mac address to Lookup result */
|
||||
memcpy(ea->hw_dst, skb->data, ETH_ALEN);
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* DDP */
|
||||
else if (ddp != NULL) {
|
||||
switch (method) {
|
||||
case NAT25_CHECK:
|
||||
return -1;
|
||||
|
||||
case NAT25_INSERT: {
|
||||
RTW_INFO("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n",
|
||||
ddp->deh_snet,
|
||||
ddp->deh_snode,
|
||||
ddp->deh_dnet,
|
||||
ddp->deh_dnode);
|
||||
|
||||
__nat25_generate_apple_network_addr(networkAddr, &ddp->deh_snet, &ddp->deh_snode);
|
||||
|
||||
__nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
|
||||
|
||||
__nat25_db_print(priv);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case NAT25_LOOKUP: {
|
||||
RTW_INFO("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n",
|
||||
ddp->deh_snet,
|
||||
ddp->deh_snode,
|
||||
ddp->deh_dnet,
|
||||
ddp->deh_dnode);
|
||||
|
||||
__nat25_generate_apple_network_addr(networkAddr, &ddp->deh_dnet, &ddp->deh_dnode);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
/* Handle PPPoE frame */
|
||||
/*---------------------------------------------------*/
|
||||
|
||||
@@ -16164,6 +16164,12 @@ u8 rtw_set_chbw_hdl(_adapter *padapter, u8 *pbuf)
|
||||
}
|
||||
|
||||
LeaveAllPowerSaveModeDirect(padapter);
|
||||
|
||||
#ifdef CONFIG_MONITOR_MODE_XMIT
|
||||
pmlmeext->cur_channel = set_ch_parm->ch;
|
||||
pmlmeext->cur_ch_offset = set_ch_parm->ch_offset;
|
||||
pmlmeext->cur_bwmode = set_ch_parm->bw;
|
||||
#endif /* CONFIG_MONITOR_MODE_XMIT */
|
||||
|
||||
set_channel_bwmode(padapter, set_ch_parm->ch, set_ch_parm->ch_offset, set_ch_parm->bw);
|
||||
|
||||
|
||||
@@ -26,7 +26,11 @@ int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz)
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
tasklet_init(&precvpriv->recv_tasklet,
|
||||
(void(*))usb_recv_tasklet,
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
|
||||
(void(*)(unsigned long))usb_recv_tasklet,
|
||||
#else
|
||||
(void *)usb_recv_tasklet,
|
||||
#endif
|
||||
(unsigned long)padapter);
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
|
||||
@@ -931,7 +931,12 @@ s32 rtl8821cu_init_xmit_priv(PADAPTER padapter)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
tasklet_init(&pxmitpriv->xmit_tasklet, rtl8821cu_xmit_tasklet,
|
||||
tasklet_init(&pxmitpriv->xmit_tasklet,
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
|
||||
(void(*)(unsigned long))rtl8821cu_xmit_tasklet,
|
||||
#else
|
||||
(void *)rtl8821cu_xmit_tasklet,
|
||||
#endif
|
||||
(unsigned long)padapter);
|
||||
#endif
|
||||
#ifdef CONFIG_TX_EARLY_MODE
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
|
||||
#define STATION_INFO_INACTIVE_TIME BIT(NL80211_STA_INFO_INACTIVE_TIME)
|
||||
#define STATION_INFO_LLID BIT(NL80211_STA_INFO_LLID)
|
||||
#define STATION_INFO_PLID BIT(NL80211_STA_INFO_PLID)
|
||||
#define STATION_INFO_LLID BIT(NL80211_STA_INFO_LLID)
|
||||
#define STATION_INFO_PLID BIT(NL80211_STA_INFO_PLID)
|
||||
#define STATION_INFO_PLINK_STATE BIT(NL80211_STA_INFO_PLINK_STATE)
|
||||
#define STATION_INFO_SIGNAL BIT(NL80211_STA_INFO_SIGNAL)
|
||||
#define STATION_INFO_SIGNAL BIT(NL80211_STA_INFO_SIGNAL)
|
||||
#define STATION_INFO_TX_BITRATE BIT(NL80211_STA_INFO_TX_BITRATE)
|
||||
#define STATION_INFO_RX_PACKETS BIT(NL80211_STA_INFO_RX_PACKETS)
|
||||
#define STATION_INFO_TX_PACKETS BIT(NL80211_STA_INFO_TX_PACKETS)
|
||||
@@ -87,7 +87,7 @@
|
||||
#define WIFI_CIPHER_SUITE_BIP_CMAC_256 0x000FAC0D
|
||||
|
||||
/*
|
||||
* If customer need, defining this flag will make driver
|
||||
* If customer need, defining this flag will make driver
|
||||
* always return -EBUSY at the condition of scan deny.
|
||||
*/
|
||||
/* #define CONFIG_NOTIFY_SCAN_ABORT_WITH_BUSY */
|
||||
@@ -229,7 +229,7 @@ static u8 rtw_chbw_to_cfg80211_chan_def(struct wiphy *wiphy, struct cfg80211_cha
|
||||
if (!chan)
|
||||
goto exit;
|
||||
|
||||
if (bw == CHANNEL_WIDTH_20)
|
||||
if (bw == CHANNEL_WIDTH_20)
|
||||
chdef->width = ht ? NL80211_CHAN_WIDTH_20 : NL80211_CHAN_WIDTH_20_NOHT;
|
||||
else if (bw == CHANNEL_WIDTH_40)
|
||||
chdef->width = NL80211_CHAN_WIDTH_40;
|
||||
@@ -295,7 +295,7 @@ static void rtw_get_chbw_from_cfg80211_chan_def(struct cfg80211_chan_def *chdef,
|
||||
rtw_warn_on(1);
|
||||
*ch = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (chdef->width) {
|
||||
case NL80211_CHAN_WIDTH_20_NOHT:
|
||||
@@ -1813,8 +1813,8 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
|
||||
_rtw_memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8);
|
||||
_rtw_memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8);
|
||||
padapter->securitypriv.binstallGrpkey = _TRUE;
|
||||
if (param->u.crypt.idx < 4)
|
||||
_rtw_memcpy(padapter->securitypriv.iv_seq[param->u.crypt.idx], param->u.crypt.seq, 8);
|
||||
if (param->u.crypt.idx < 4)
|
||||
_rtw_memcpy(padapter->securitypriv.iv_seq[param->u.crypt.idx], param->u.crypt.seq, 8);
|
||||
padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx;
|
||||
rtw_set_key(padapter, &padapter->securitypriv, param->u.crypt.idx, 1, _TRUE);
|
||||
} else if (strcmp(param->u.crypt.alg, "GCMP_256") == 0
|
||||
@@ -2127,7 +2127,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
|| (MLME_IS_STA(adapter) && !pairwise)
|
||||
#endif
|
||||
) {
|
||||
) {
|
||||
/* WEP key, TX GTK/IGTK, RX GTK/IGTK(for STA mode) */
|
||||
if (is_wep_enc(sec->dot118021XGrpPrivacy)) {
|
||||
if (keyid >= WEP_KEYS)
|
||||
@@ -2239,7 +2239,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
||||
exit:
|
||||
RTW_INFO(FUNC_NDEV_FMT
|
||||
GET_KEY_PARAM_FMT_S
|
||||
@@ -3234,7 +3234,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
||||
if (request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
|
||||
get_random_mask_addr(pwdev_priv->pno_mac_addr, request->mac_addr,
|
||||
request->mac_addr_mask);
|
||||
print_hex_dump(KERN_DEBUG, "random mac_addr: ",
|
||||
print_hex_dump(KERN_DEBUG, "random mac_addr: ",
|
||||
DUMP_PREFIX_OFFSET, 16, 1, pwdev_priv->pno_mac_addr, ETH_ALEN, 1);
|
||||
}
|
||||
else
|
||||
@@ -3557,7 +3557,7 @@ check_need_indicate_scan_done:
|
||||
info.aborted = 0;
|
||||
#endif
|
||||
/* the process time of scan results must be over at least 1ms in the newly Android */
|
||||
rtw_msleep_os(1);
|
||||
rtw_msleep_os(1);
|
||||
|
||||
_rtw_cfg80211_surveydone_event_callback(padapter, request);
|
||||
#if (KERNEL_VERSION(4, 8, 0) <= LINUX_VERSION_CODE)
|
||||
@@ -3817,8 +3817,8 @@ static int rtw_cfg80211_set_key_mgt(struct security_priv *psecuritypriv, u32 key
|
||||
psecuritypriv->rsn_akm_suite_type = 4;
|
||||
}
|
||||
#endif
|
||||
else if (key_mgt == WLAN_AKM_SUITE_SAE) {
|
||||
psecuritypriv->rsn_akm_suite_type = 8;
|
||||
else if (key_mgt == WLAN_AKM_SUITE_SAE) {
|
||||
psecuritypriv->rsn_akm_suite_type = 8;
|
||||
} else {
|
||||
RTW_INFO("Invalid key mgt: 0x%x\n", key_mgt);
|
||||
/* return -EINVAL; */
|
||||
@@ -5111,9 +5111,11 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
|
||||
ie_offset = _REASOCREQ_IE_OFFSET_;
|
||||
|
||||
memset(&sinfo, 0, sizeof(sinfo));
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
|
||||
sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
|
||||
sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset;
|
||||
sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset;
|
||||
#endif
|
||||
cfg80211_new_sta(ndev, get_addr2_ptr(pmgmt_frame), &sinfo, GFP_ATOMIC);
|
||||
}
|
||||
#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
|
||||
@@ -6102,7 +6104,7 @@ static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *nde
|
||||
else
|
||||
_rtw_memcpy(mac, plink->addr, ETH_ALEN);
|
||||
#endif
|
||||
|
||||
|
||||
sinfo->filled = 0;
|
||||
|
||||
if (psta) {
|
||||
@@ -6264,11 +6266,15 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy
|
||||
#endif
|
||||
, struct ieee80211_channel *chan, enum nl80211_channel_type channel_type)
|
||||
{
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||
#else /* CONFIG_WIFI_MONITOR */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
|
||||
#else
|
||||
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||
#endif
|
||||
#endif /* CONFIG_WIFI_MONITOR */
|
||||
int chan_target = (u8) ieee80211_frequency_to_channel(chan->center_freq);
|
||||
int chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||
int chan_width = CHANNEL_WIDTH_20;
|
||||
@@ -8823,7 +8829,7 @@ void dump_mesh_config(void *sel, const struct mesh_config *conf)
|
||||
RTW_PRINT_SEL(sel, "path_refresh_time:%u\n", conf->path_refresh_time);
|
||||
RTW_PRINT_SEL(sel, "min_discovery_timeout:%u\n", conf->min_discovery_timeout);
|
||||
RTW_PRINT_SEL(sel, "dot11MeshHWMPactivePathTimeout:%u\n", conf->dot11MeshHWMPactivePathTimeout);
|
||||
RTW_PRINT_SEL(sel, "dot11MeshHWMPpreqMinInterval:%u\n", conf->dot11MeshHWMPpreqMinInterval);
|
||||
RTW_PRINT_SEL(sel, "dot11MeshHWMPpreqMinInterval:%u\n", conf->dot11MeshHWMPpreqMinInterval);
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
RTW_PRINT_SEL(sel, "dot11MeshHWMPperrMinInterval:%u\n", conf->dot11MeshHWMPperrMinInterval);
|
||||
#endif
|
||||
@@ -8838,11 +8844,11 @@ void dump_mesh_config(void *sel, const struct mesh_config *conf)
|
||||
RTW_PRINT_SEL(sel, "dot11MeshForwarding:%d\n", conf->dot11MeshForwarding);
|
||||
RTW_PRINT_SEL(sel, "rssi_threshold:%d\n", conf->rssi_threshold);
|
||||
#endif
|
||||
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0))
|
||||
RTW_PRINT_SEL(sel, "ht_opmode:0x%04x\n", conf->ht_opmode);
|
||||
#endif
|
||||
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
RTW_PRINT_SEL(sel, "dot11MeshHWMPactivePathToRootTimeout:%u\n", conf->dot11MeshHWMPactivePathToRootTimeout);
|
||||
RTW_PRINT_SEL(sel, "dot11MeshHWMProotInterval:%u\n", conf->dot11MeshHWMProotInterval);
|
||||
@@ -8853,7 +8859,7 @@ void dump_mesh_config(void *sel, const struct mesh_config *conf)
|
||||
RTW_PRINT_SEL(sel, "power_mode:%s\n", nl80211_mesh_power_mode_str(conf->power_mode));
|
||||
RTW_PRINT_SEL(sel, "dot11MeshAwakeWindowDuration:%u\n", conf->dot11MeshAwakeWindowDuration);
|
||||
#endif
|
||||
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
|
||||
RTW_PRINT_SEL(sel, "plink_timeout:%u\n", conf->plink_timeout);
|
||||
#endif
|
||||
@@ -8989,14 +8995,14 @@ static void rtw_cfg80211_mesh_cfg_set(_adapter *adapter, const struct mesh_confi
|
||||
if (chk_mesh_attr(NL80211_MESHCONF_HT_OPMODE, mask));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
if (chk_mesh_attr(NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, mask))
|
||||
mcfg->dot11MeshHWMPactivePathToRootTimeout = conf->dot11MeshHWMPactivePathToRootTimeout;
|
||||
if (chk_mesh_attr(NL80211_MESHCONF_HWMP_ROOT_INTERVAL, mask))
|
||||
mcfg->dot11MeshHWMProotInterval = conf->dot11MeshHWMProotInterval;
|
||||
if (chk_mesh_attr(NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, mask))
|
||||
mcfg->dot11MeshHWMPconfirmationInterval = conf->dot11MeshHWMPconfirmationInterval;
|
||||
mcfg->dot11MeshHWMPconfirmationInterval = conf->dot11MeshHWMPconfirmationInterval;
|
||||
#endif
|
||||
|
||||
#if 0 /* TBD */
|
||||
@@ -9054,7 +9060,7 @@ u8 *rtw_cfg80211_construct_mesh_beacon_ies(struct wiphy *wiphy, _adapter *adapte
|
||||
#endif
|
||||
if (!ch)
|
||||
goto exit;
|
||||
|
||||
|
||||
#if defined(CONFIG_80211AC_VHT) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
vht = ht && ch > 14 && bw >= CHANNEL_WIDTH_80; /* VHT40/VHT20? */
|
||||
#endif
|
||||
@@ -9385,7 +9391,7 @@ static int cfg80211_rtw_join_mesh(struct wiphy *wiphy, struct net_device *dev,
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
||||
rtw_mesh_work(&adapter->mesh_work);
|
||||
|
||||
exit:
|
||||
@@ -9465,7 +9471,7 @@ static int cfg80211_rtw_del_mpath(struct wiphy *wiphy, struct net_device *dev
|
||||
}
|
||||
} else {
|
||||
rtw_mesh_path_flush_by_iface(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
@@ -9766,13 +9772,13 @@ int cfg80211_rtw_resume(struct wiphy *wiphy) {
|
||||
//rtw_sitesurvey_cmd(padapter, NULL);
|
||||
rtw_sitesurvey_cmd(padapter, &parm);
|
||||
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
|
||||
|
||||
for (PNOWakeupScanWaitCnt = 0; PNOWakeupScanWaitCnt < 10; PNOWakeupScanWaitCnt++) {
|
||||
if(check_fwstate(pmlmepriv, WIFI_UNDER_SURVEY) == _FALSE)
|
||||
break;
|
||||
rtw_msleep_os(1000);
|
||||
}
|
||||
|
||||
|
||||
_enter_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
cfg80211_sched_scan_results(padapter->rtw_wdev->wiphy);
|
||||
_exit_critical_bh(&pmlmepriv->lock, &irqL);
|
||||
@@ -9780,7 +9786,7 @@ int cfg80211_rtw_resume(struct wiphy *wiphy) {
|
||||
}
|
||||
RTW_DBG("<== %s\n",__func__);
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
#endif /* CONFIG_PNO_SUPPORT */
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ int rtw_scan_mode = 1;/* active, passive */
|
||||
#else
|
||||
int rtw_wow_power_mgnt = PS_MODE_ACTIVE;
|
||||
int rtw_wow_lps_level = LPS_NORMAL;
|
||||
#endif
|
||||
#endif
|
||||
#endif /* CONFIG_WOWLAN */
|
||||
|
||||
#else /* !CONFIG_POWER_SAVING */
|
||||
@@ -118,7 +118,7 @@ MODULE_PARM_DESC(rtw_wow_lps_1t1r, "The default WOW LPS 1T1R setting");
|
||||
#endif
|
||||
#endif /* CONFIG_WOWLAN */
|
||||
|
||||
/* LPS:
|
||||
/* LPS:
|
||||
* rtw_smart_ps = 0 => TX: pwr bit = 1, RX: PS_Poll
|
||||
* rtw_smart_ps = 1 => TX: pwr bit = 0, RX: PS_Poll
|
||||
* rtw_smart_ps = 2 => TX: pwr bit = 0, RX: NullData with pwr bit = 0
|
||||
@@ -127,8 +127,8 @@ int rtw_smart_ps = 2;
|
||||
|
||||
int rtw_max_bss_cnt = 0;
|
||||
module_param(rtw_max_bss_cnt, int, 0644);
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
/* WMMPS:
|
||||
#ifdef CONFIG_WMMPS_STA
|
||||
/* WMMPS:
|
||||
* rtw_smart_ps = 0 => Only for fw test
|
||||
* rtw_smart_ps = 1 => Refer to Beacon's TIM Bitmap
|
||||
* rtw_smart_ps = 2 => Don't refer to Beacon's TIM Bitmap
|
||||
@@ -200,7 +200,7 @@ int rtw_uapsd_ac_enable = 0x0;
|
||||
/*PHYDM API, must enable by default*/
|
||||
int rtw_pwrtrim_enable = 1;
|
||||
#else
|
||||
int rtw_pwrtrim_enable = 0; /* Default Enalbe power trim by efuse config */
|
||||
int rtw_pwrtrim_enable = 0; /* Default Enable power trim by efuse config */
|
||||
#endif
|
||||
|
||||
#if CONFIG_TX_AC_LIFETIME
|
||||
|
||||
@@ -86,18 +86,17 @@ static void rtw_dev_shutdown(struct device *dev)
|
||||
|
||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23))
|
||||
/* Some useful macros to use to create struct usb_device_id */
|
||||
#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
|
||||
#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
|
||||
#define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
|
||||
#define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
|
||||
#define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
|
||||
#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
|
||||
#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
|
||||
#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
|
||||
#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
|
||||
#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
|
||||
#define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400
|
||||
|
||||
#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
|
||||
#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
|
||||
#define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
|
||||
#define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
|
||||
#define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
|
||||
#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
|
||||
#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
|
||||
#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
|
||||
#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
|
||||
#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
|
||||
#define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400
|
||||
|
||||
#define USB_DEVICE_ID_MATCH_INT_INFO \
|
||||
(USB_DEVICE_ID_MATCH_INT_CLASS | \
|
||||
|
||||
Reference in New Issue
Block a user