mirror of
https://github.com/RinCat/RTL88x2BU-Linux-Driver.git
synced 2026-01-29 07:16:35 +00:00
Update to 5.13.1 from upstream
This commit is contained in:
2792
os_dep/linux/ioctl_cfg80211.c
Executable file → Normal file
2792
os_dep/linux/ioctl_cfg80211.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2019 Realtek Corporation.
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
@@ -166,7 +166,6 @@ struct rtw_wdev_priv {
|
||||
u8 bandroid_scan;
|
||||
bool block;
|
||||
bool block_scan;
|
||||
bool power_mgmt;
|
||||
|
||||
/**
|
||||
* mgmt_regs: bitmap of management frame subtypes registered for the
|
||||
@@ -186,12 +185,12 @@ struct rtw_wdev_priv {
|
||||
ATOMIC_T switch_ch_to;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_RANDOM_MAC_OUI
|
||||
#if defined(CONFIG_RTW_CFGVENDOR_RANDOM_MAC_OUI) || defined(CONFIG_RTW_SCAN_RAND)
|
||||
u8 pno_mac_addr[ETH_ALEN];
|
||||
u16 pno_scan_seq_num;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_RSSIMONITOR
|
||||
s8 rssi_monitor_max;
|
||||
s8 rssi_monitor_min;
|
||||
u8 rssi_monitor_enable;
|
||||
@@ -246,8 +245,8 @@ struct rtw_wiphy_data {
|
||||
struct wireless_dev *pd_wdev; /* P2P device wdev */
|
||||
#endif
|
||||
|
||||
s16 txpwr_total_lmt_mbm;
|
||||
s16 txpwr_total_target_mbm;
|
||||
s16 txpwr_total_lmt_mbm; /* EIRP */
|
||||
s16 txpwr_total_target_mbm; /* EIRP */
|
||||
};
|
||||
|
||||
#define rtw_wiphy_priv(wiphy) ((struct rtw_wiphy_data *)wiphy_priv(wiphy))
|
||||
@@ -299,14 +298,13 @@ s16 rtw_cfg80211_dev_get_total_txpwr_lmt_mbm(struct dvobj_priv *dvobj);
|
||||
s16 rtw_cfg80211_dev_get_total_txpwr_target_mbm(struct dvobj_priv *dvobj);
|
||||
|
||||
void rtw_cfg80211_init_wdev_data(_adapter *padapter);
|
||||
void rtw_cfg80211_init_wiphy(_adapter *padapter);
|
||||
|
||||
void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork);
|
||||
void rtw_cfg80211_surveydone_event_callback(_adapter *padapter);
|
||||
struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_network *pnetwork);
|
||||
int rtw_cfg80211_check_bss(_adapter *padapter);
|
||||
void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter);
|
||||
int rtw_cfg80211_indicate_connect(_adapter *padapter);
|
||||
void rtw_cfg80211_indicate_connect(_adapter *padapter);
|
||||
void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally_generated);
|
||||
void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted);
|
||||
u32 rtw_cfg80211_wait_scan_req_empty(_adapter *adapter, u32 timeout_ms);
|
||||
@@ -319,15 +317,16 @@ void rtw_cfg80211_indicate_scan_done_for_buddy(_adapter *padapter, bool bscan_ab
|
||||
#ifdef CONFIG_AP_MODE
|
||||
void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
|
||||
void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, const u8 *da, unsigned short reason);
|
||||
int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, int type);
|
||||
#endif /* CONFIG_AP_MODE */
|
||||
|
||||
#ifdef CONFIG_P2P
|
||||
void rtw_cfg80211_set_is_roch(_adapter *adapter, bool val);
|
||||
bool rtw_cfg80211_get_is_roch(_adapter *adapter);
|
||||
bool rtw_cfg80211_is_ro_ch_once(_adapter *adapter);
|
||||
void rtw_cfg80211_set_last_ro_ch_time(_adapter *adapter);
|
||||
s32 rtw_cfg80211_get_last_ro_ch_passing_ms(_adapter *adapter);
|
||||
|
||||
#ifdef CONFIG_P2P
|
||||
int rtw_cfg80211_iface_has_p2p_group_cap(_adapter *adapter);
|
||||
int rtw_cfg80211_is_p2p_scan(_adapter *adapter);
|
||||
#if defined(RTW_DEDICATED_P2P_DEVICE)
|
||||
@@ -354,8 +353,6 @@ void rtw_cfg80211_external_auth_request(_adapter *padapter, union recv_frame *rf
|
||||
void rtw_cfg80211_external_auth_status(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct rtw_external_auth_params *params);
|
||||
|
||||
int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, int type);
|
||||
|
||||
bool rtw_cfg80211_pwr_mgmt(_adapter *adapter);
|
||||
#ifdef CONFIG_RTW_80211K
|
||||
void rtw_cfg80211_rx_rrm_action(_adapter *adapter, union recv_frame *rframe);
|
||||
@@ -427,6 +424,11 @@ void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy);
|
||||
u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht, bool started);
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31))
|
||||
#define IEEE80211_CHAN_NO_HT40PLUS IEEE80211_CHAN_NO_FAT_ABOVE
|
||||
#define IEEE80211_CHAN_NO_HT40MINUS IEEE80211_CHAN_NO_FAT_BELOW
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
|
||||
#define NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
|
||||
#define NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2019 Realtek Corporation.
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
@@ -54,20 +54,16 @@ void Linkdown_workitem_callback(struct work_struct *work)
|
||||
extern void rtw_indicate_wx_assoc_event(_adapter *padapter);
|
||||
extern void rtw_indicate_wx_disassoc_event(_adapter *padapter);
|
||||
|
||||
int rtw_os_indicate_connect(_adapter *adapter)
|
||||
void rtw_os_indicate_connect(_adapter *adapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
|
||||
int err = 0;
|
||||
|
||||
#ifdef CONFIG_IOCTL_CFG80211
|
||||
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) ||
|
||||
(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)) {
|
||||
(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE))
|
||||
rtw_cfg80211_ibss_indicate_connect(adapter);
|
||||
} else {
|
||||
err = rtw_cfg80211_indicate_connect(adapter);
|
||||
if (err)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
rtw_cfg80211_indicate_connect(adapter);
|
||||
#endif /* CONFIG_IOCTL_CFG80211 */
|
||||
|
||||
rtw_indicate_wx_assoc_event(adapter);
|
||||
@@ -86,7 +82,7 @@ int rtw_os_indicate_connect(_adapter *adapter)
|
||||
_set_workitem(&adapter->mlmepriv.Linkup_workitem);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
extern void indicate_wx_scan_complete_event(_adapter *padapter);
|
||||
@@ -110,6 +106,11 @@ void rtw_reset_securitypriv(_adapter *adapter)
|
||||
_enter_critical_bh(&adapter->security_key_mutex, &irqL);
|
||||
|
||||
if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { /* 802.1x */
|
||||
u8 backup_sw_encrypt, backup_sw_decrypt;
|
||||
|
||||
backup_sw_encrypt = adapter->securitypriv.sw_encrypt;
|
||||
backup_sw_decrypt = adapter->securitypriv.sw_decrypt;
|
||||
|
||||
/* Added by Albert 2009/02/18 */
|
||||
/* We have to backup the PMK information for WiFi PMK Caching test item. */
|
||||
/* */
|
||||
@@ -136,6 +137,9 @@ void rtw_reset_securitypriv(_adapter *adapter)
|
||||
|
||||
adapter->securitypriv.extauth_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
|
||||
adapter->securitypriv.sw_encrypt = backup_sw_encrypt;
|
||||
adapter->securitypriv.sw_decrypt = backup_sw_decrypt;
|
||||
|
||||
} else { /* reset values in securitypriv */
|
||||
/* if(adapter->mlmepriv.fw_state & WIFI_STATION_STATE) */
|
||||
/* { */
|
||||
@@ -177,7 +181,9 @@ void rtw_os_indicate_disconnect(_adapter *adapter, u16 reason, u8 locally_gener
|
||||
_set_workitem(&adapter->mlmepriv.Linkdown_workitem);
|
||||
#endif
|
||||
/* modify for CONFIG_IEEE80211W, none 11w also can use the same command */
|
||||
rtw_reset_securitypriv(adapter);
|
||||
rtw_reset_securitypriv_cmd(adapter);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void rtw_report_sec_ie(_adapter *adapter, u8 authmode, u8 *sec_ie)
|
||||
|
||||
583
os_dep/linux/nlrtw.c
Normal file
583
os_dep/linux/nlrtw.c
Normal file
@@ -0,0 +1,583 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2020 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define _RTW_NLRTW_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
#include "nlrtw.h"
|
||||
|
||||
#ifdef CONFIG_RTW_NLRTW
|
||||
|
||||
#include <net/netlink.h>
|
||||
#include <net/genetlink.h>
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0))
|
||||
#include <uapi/linux/netlink.h>
|
||||
#endif
|
||||
|
||||
|
||||
enum nlrtw_cmds {
|
||||
NLRTW_CMD_UNSPEC,
|
||||
|
||||
NLRTW_CMD_CHANNEL_UTILIZATION,
|
||||
NLRTW_CMD_REG_CHANGE,
|
||||
NLRTW_CMD_REG_BEACON_HINT,
|
||||
NLRTW_CMD_RADAR_EVENT,
|
||||
NLRTW_CMD_RADIO_OPMODE,
|
||||
|
||||
__NLRTW_CMD_AFTER_LAST,
|
||||
NLRTW_CMD_MAX = __NLRTW_CMD_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
enum nlrtw_attrs {
|
||||
NLRTW_ATTR_UNSPEC,
|
||||
|
||||
NLRTW_ATTR_WIPHY_NAME,
|
||||
NLRTW_ATTR_CHANNEL_UTILIZATIONS,
|
||||
NLRTW_ATTR_CHANNEL_UTILIZATION_THRESHOLD,
|
||||
NLRTW_ATTR_CHANNEL_CENTER,
|
||||
NLRTW_ATTR_CHANNEL_WIDTH,
|
||||
NLRTW_ATTR_RADAR_EVENT,
|
||||
NLRTW_ATTR_OP_CLASS,
|
||||
NLRTW_ATTR_OP_CHANNEL,
|
||||
NLRTW_ATTR_OP_TXPWR_MAX,
|
||||
NLRTW_ATTR_IF_OPMODES,
|
||||
|
||||
__NLRTW_ATTR_AFTER_LAST,
|
||||
NUM_NLRTW_ATTR = __NLRTW_ATTR_AFTER_LAST,
|
||||
NLRTW_ATTR_MAX = __NLRTW_ATTR_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
enum nlrtw_ch_util_attrs {
|
||||
__NLRTW_ATTR_CHANNEL_UTILIZATION_INVALID,
|
||||
|
||||
NLRTW_ATTR_CHANNEL_UTILIZATION_VALUE,
|
||||
NLRTW_ATTR_CHANNEL_UTILIZATION_BSSID,
|
||||
|
||||
__NLRTW_ATTR_CHANNEL_UTILIZATION_AFTER_LAST,
|
||||
NUM_NLRTW_ATTR_CHANNEL_UTILIZATION = __NLRTW_ATTR_CHANNEL_UTILIZATION_AFTER_LAST,
|
||||
NLRTW_ATTR_CHANNEL_UTILIZATION_MAX = __NLRTW_ATTR_CHANNEL_UTILIZATION_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
enum nlrtw_radar_event {
|
||||
NLRTW_RADAR_DETECTED,
|
||||
NLRTW_RADAR_CAC_FINISHED,
|
||||
NLRTW_RADAR_CAC_ABORTED,
|
||||
NLRTW_RADAR_NOP_FINISHED,
|
||||
NLRTW_RADAR_NOP_STARTED, /* NON_OCP started not by local radar detection */
|
||||
};
|
||||
|
||||
enum nlrtw_if_opmode_attrs {
|
||||
NLRTW_IF_OPMODE_UNSPEC,
|
||||
|
||||
NLRTW_IF_OPMODE_MACADDR,
|
||||
NLRTW_IF_OPMODE_OP_CLASS,
|
||||
NLRTW_IF_OPMODE_OP_CHANNEL,
|
||||
|
||||
__NLRTW_IF_OPMODE_ATTR_AFTER_LAST,
|
||||
NUM_NLRTW_IF_OPMODE_ATTR = __NLRTW_IF_OPMODE_ATTR_AFTER_LAST,
|
||||
NLRTW_IF_OPMODE_ATTR_MAX = __NLRTW_IF_OPMODE_ATTR_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
static int nlrtw_ch_util_set(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
unsigned int msg;
|
||||
|
||||
if (!info->attrs[NLRTW_ATTR_CHANNEL_UTILIZATION_THRESHOLD])
|
||||
return -EINVAL;
|
||||
msg = nla_get_u8(info->attrs[NLRTW_ATTR_CHANNEL_UTILIZATION_THRESHOLD]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct nla_policy nlrtw_genl_policy[NUM_NLRTW_ATTR] = {
|
||||
[NLRTW_ATTR_CHANNEL_UTILIZATION_THRESHOLD] = { .type = NLA_U8 },
|
||||
};
|
||||
|
||||
static struct genl_ops nlrtw_genl_ops[] = {
|
||||
{
|
||||
.cmd = NLRTW_CMD_CHANNEL_UTILIZATION,
|
||||
.flags = 0,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||
.policy = nlrtw_genl_policy,
|
||||
#endif
|
||||
.doit = nlrtw_ch_util_set,
|
||||
.dumpit = NULL,
|
||||
},
|
||||
};
|
||||
|
||||
enum nlrtw_multicast_groups {
|
||||
NLRTW_MCGRP_DEFAULT,
|
||||
};
|
||||
static struct genl_multicast_group nlrtw_genl_mcgrp[] = {
|
||||
[NLRTW_MCGRP_DEFAULT] = { .name = "nlrtw_default" },
|
||||
};
|
||||
|
||||
/* family definition */
|
||||
static struct genl_family nlrtw_genl_family = {
|
||||
.hdrsize = 0,
|
||||
.name = "nlrtw_"DRV_NAME,
|
||||
.version = 1,
|
||||
.maxattr = NLRTW_ATTR_MAX,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0)
|
||||
.policy = nlrtw_genl_policy,
|
||||
#endif
|
||||
.netnsok = true,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 12)
|
||||
.module = THIS_MODULE,
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
|
||||
.ops = nlrtw_genl_ops,
|
||||
.n_ops = ARRAY_SIZE(nlrtw_genl_ops),
|
||||
.mcgrps = nlrtw_genl_mcgrp,
|
||||
.n_mcgrps = ARRAY_SIZE(nlrtw_genl_mcgrp),
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline int nlrtw_multicast(const struct genl_family *family,
|
||||
struct sk_buff *skb, u32 portid,
|
||||
unsigned int group, gfp_t flags)
|
||||
{
|
||||
int ret;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
|
||||
ret = genlmsg_multicast(&nlrtw_genl_family, skb, portid, group, flags);
|
||||
#else
|
||||
ret = genlmsg_multicast(skb, portid, nlrtw_genl_mcgrp[group].id, flags);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw_nlrtw_ch_util_rpt(_adapter *adapter, u8 n_rpts, u8 *val, u8 **mac_addr)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
void *msg_header = NULL;
|
||||
struct nlattr *nl_ch_util, *nl_ch_utils;
|
||||
struct wiphy *wiphy;
|
||||
u8 i;
|
||||
int ret;
|
||||
|
||||
wiphy = adapter_to_wiphy(adapter);
|
||||
if (!wiphy)
|
||||
return -EINVAL;
|
||||
|
||||
/* allocate memory */
|
||||
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
if (!skb) {
|
||||
nlmsg_free(skb);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* create the message headers */
|
||||
msg_header = genlmsg_put(skb, 0, 0, &nlrtw_genl_family, 0,
|
||||
NLRTW_CMD_CHANNEL_UTILIZATION);
|
||||
if (!msg_header) {
|
||||
ret = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* add attributes */
|
||||
ret = nla_put_string(skb, NLRTW_ATTR_WIPHY_NAME, wiphy_name(wiphy));
|
||||
|
||||
nl_ch_utils = nla_nest_start(skb, NLRTW_ATTR_CHANNEL_UTILIZATIONS);
|
||||
if (!nl_ch_utils) {
|
||||
ret = -EMSGSIZE;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
for (i = 0; i < n_rpts; i++) {
|
||||
nl_ch_util = nla_nest_start(skb, i);
|
||||
if (!nl_ch_util) {
|
||||
ret = -EMSGSIZE;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
ret = nla_put(skb, NLRTW_ATTR_CHANNEL_UTILIZATION_BSSID, ETH_ALEN, *(mac_addr + i));
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
ret = nla_put_u8(skb, NLRTW_ATTR_CHANNEL_UTILIZATION_VALUE, *(val + i));
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
nla_nest_end(skb, nl_ch_util);
|
||||
}
|
||||
|
||||
nla_nest_end(skb, nl_ch_utils);
|
||||
|
||||
/* finalize the message */
|
||||
genlmsg_end(skb, msg_header);
|
||||
|
||||
ret = nlrtw_multicast(&nlrtw_genl_family, skb, 0, NLRTW_MCGRP_DEFAULT, GFP_KERNEL);
|
||||
if (ret == -ESRCH) {
|
||||
RTW_INFO("[%s] return ESRCH(No such process)."
|
||||
" Maybe no process waits for this msg\n", __func__);
|
||||
return ret;
|
||||
} else if (ret != 0) {
|
||||
RTW_INFO("[%s] ret = %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
err_out:
|
||||
nlmsg_free(skb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw_nlrtw_reg_change_event(_adapter *adapter)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
void *msg_header = NULL;
|
||||
struct wiphy *wiphy;
|
||||
u8 i;
|
||||
int ret;
|
||||
|
||||
wiphy = adapter_to_wiphy(adapter);
|
||||
if (!wiphy) {
|
||||
ret = -EINVAL;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* allocate memory */
|
||||
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
if (!skb) {
|
||||
ret = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* create the message headers */
|
||||
msg_header = genlmsg_put(skb, 0, 0, &nlrtw_genl_family, 0, NLRTW_CMD_REG_CHANGE);
|
||||
if (!msg_header) {
|
||||
ret = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* add attributes */
|
||||
ret = nla_put_string(skb, NLRTW_ATTR_WIPHY_NAME, wiphy_name(wiphy));
|
||||
if (ret)
|
||||
goto err_out;
|
||||
|
||||
/* finalize the message */
|
||||
genlmsg_end(skb, msg_header);
|
||||
|
||||
ret = nlrtw_multicast(&nlrtw_genl_family, skb, 0, NLRTW_MCGRP_DEFAULT, GFP_KERNEL);
|
||||
if (ret == -ESRCH) {
|
||||
RTW_DBG(FUNC_WIPHY_FMT" return -ESRCH(No such process)."
|
||||
" Maybe no process waits for this msg\n", FUNC_WIPHY_ARG(wiphy));
|
||||
return ret;
|
||||
} else if (ret != 0) {
|
||||
RTW_WARN(FUNC_WIPHY_FMT" return %d\n", FUNC_WIPHY_ARG(wiphy), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
if (skb)
|
||||
nlmsg_free(skb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw_nlrtw_reg_beacon_hint_event(_adapter *adapter)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
void *msg_header = NULL;
|
||||
struct wiphy *wiphy;
|
||||
u8 i;
|
||||
int ret;
|
||||
|
||||
wiphy = adapter_to_wiphy(adapter);
|
||||
if (!wiphy) {
|
||||
ret = -EINVAL;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* allocate memory */
|
||||
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
if (!skb) {
|
||||
ret = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* create the message headers */
|
||||
msg_header = genlmsg_put(skb, 0, 0, &nlrtw_genl_family, 0, NLRTW_CMD_REG_BEACON_HINT);
|
||||
if (!msg_header) {
|
||||
ret = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* add attributes */
|
||||
ret = nla_put_string(skb, NLRTW_ATTR_WIPHY_NAME, wiphy_name(wiphy));
|
||||
if (ret)
|
||||
goto err_out;
|
||||
|
||||
/* finalize the message */
|
||||
genlmsg_end(skb, msg_header);
|
||||
|
||||
ret = nlrtw_multicast(&nlrtw_genl_family, skb, 0, NLRTW_MCGRP_DEFAULT, GFP_KERNEL);
|
||||
if (ret == -ESRCH) {
|
||||
RTW_DBG(FUNC_WIPHY_FMT" return -ESRCH(No such process)."
|
||||
" Maybe no process waits for this msg\n", FUNC_WIPHY_ARG(wiphy));
|
||||
return ret;
|
||||
} else if (ret != 0) {
|
||||
RTW_WARN(FUNC_WIPHY_FMT" return %d\n", FUNC_WIPHY_ARG(wiphy), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
if (skb)
|
||||
nlmsg_free(skb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DFS_MASTER
|
||||
static int _rtw_nlrtw_radar_event(_adapter *adapter, enum nlrtw_radar_event evt_type, u8 cch, u8 bw)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
void *msg_header = NULL;
|
||||
struct wiphy *wiphy;
|
||||
u8 i;
|
||||
int ret;
|
||||
|
||||
wiphy = adapter_to_wiphy(adapter);
|
||||
if (!wiphy) {
|
||||
ret = -EINVAL;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* allocate memory */
|
||||
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
if (!skb) {
|
||||
ret = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* create the message headers */
|
||||
msg_header = genlmsg_put(skb, 0, 0, &nlrtw_genl_family, 0, NLRTW_CMD_RADAR_EVENT);
|
||||
if (!msg_header) {
|
||||
ret = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* add attributes */
|
||||
ret = nla_put_string(skb, NLRTW_ATTR_WIPHY_NAME, wiphy_name(wiphy));
|
||||
if (ret)
|
||||
goto err_out;
|
||||
|
||||
ret = nla_put_u8(skb, NLRTW_ATTR_RADAR_EVENT, (uint8_t)evt_type);
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
ret = nla_put_u8(skb, NLRTW_ATTR_CHANNEL_CENTER, cch);
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
ret = nla_put_u8(skb, NLRTW_ATTR_CHANNEL_WIDTH, bw);
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
/* finalize the message */
|
||||
genlmsg_end(skb, msg_header);
|
||||
|
||||
ret = nlrtw_multicast(&nlrtw_genl_family, skb, 0, NLRTW_MCGRP_DEFAULT, GFP_KERNEL);
|
||||
if (ret == -ESRCH) {
|
||||
RTW_DBG(FUNC_WIPHY_FMT" return -ESRCH(No such process)."
|
||||
" Maybe no process waits for this msg\n", FUNC_WIPHY_ARG(wiphy));
|
||||
return ret;
|
||||
} else if (ret != 0) {
|
||||
RTW_WARN(FUNC_WIPHY_FMT" return %d\n", FUNC_WIPHY_ARG(wiphy), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
if (skb)
|
||||
nlmsg_free(skb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw_nlrtw_radar_detect_event(_adapter *adapter, u8 cch, u8 bw)
|
||||
{
|
||||
return _rtw_nlrtw_radar_event(adapter, NLRTW_RADAR_DETECTED, cch, bw);
|
||||
}
|
||||
|
||||
int rtw_nlrtw_cac_finish_event(_adapter *adapter, u8 cch, u8 bw)
|
||||
{
|
||||
return _rtw_nlrtw_radar_event(adapter, NLRTW_RADAR_CAC_FINISHED, cch, bw);
|
||||
}
|
||||
|
||||
int rtw_nlrtw_cac_abort_event(_adapter *adapter, u8 cch, u8 bw)
|
||||
{
|
||||
return _rtw_nlrtw_radar_event(adapter, NLRTW_RADAR_CAC_ABORTED, cch, bw);
|
||||
}
|
||||
|
||||
int rtw_nlrtw_nop_finish_event(_adapter *adapter, u8 cch, u8 bw)
|
||||
{
|
||||
return _rtw_nlrtw_radar_event(adapter, NLRTW_RADAR_NOP_FINISHED, cch, bw);
|
||||
}
|
||||
|
||||
int rtw_nlrtw_nop_start_event(_adapter *adapter, u8 cch, u8 bw)
|
||||
{
|
||||
return _rtw_nlrtw_radar_event(adapter, NLRTW_RADAR_NOP_STARTED, cch, bw);
|
||||
}
|
||||
#endif /* CONFIG_DFS_MASTER */
|
||||
|
||||
int rtw_nlrtw_radio_opmode_notify(struct rf_ctl_t *rfctl)
|
||||
{
|
||||
struct dvobj_priv *dvobj = rfctl_to_dvobj(rfctl);
|
||||
_adapter *iface;
|
||||
struct sk_buff *skb = NULL;
|
||||
void *msg_header = NULL;
|
||||
struct nlattr *nl_if_opmodes, *nl_if_opmode;
|
||||
struct wiphy *wiphy;
|
||||
u16 op_txpwr_max_u16;
|
||||
u8 i;
|
||||
int ret;
|
||||
|
||||
wiphy = dvobj_to_wiphy(dvobj);
|
||||
if (!wiphy) {
|
||||
ret = -EINVAL;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* allocate memory */
|
||||
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
if (!skb) {
|
||||
ret = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* create the message headers */
|
||||
msg_header = genlmsg_put(skb, 0, 0, &nlrtw_genl_family, 0, NLRTW_CMD_RADIO_OPMODE);
|
||||
if (!msg_header) {
|
||||
ret = -ENOBUFS;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* add attributes */
|
||||
ret = nla_put_string(skb, NLRTW_ATTR_WIPHY_NAME, wiphy_name(wiphy));
|
||||
if (ret)
|
||||
goto err_out;
|
||||
|
||||
ret = nla_put_u8(skb, NLRTW_ATTR_OP_CLASS, rfctl->op_class);
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
ret = nla_put_u8(skb, NLRTW_ATTR_OP_CHANNEL, rfctl->op_ch);
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
*((s16 *)&op_txpwr_max_u16) = rfctl->op_txpwr_max;
|
||||
ret = nla_put_u16(skb, NLRTW_ATTR_OP_TXPWR_MAX, op_txpwr_max_u16);
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
if (0)
|
||||
RTW_INFO("radio: %u,%u %d\n", rfctl->op_class, rfctl->op_ch, rfctl->op_txpwr_max);
|
||||
|
||||
nl_if_opmodes = nla_nest_start(skb, NLRTW_ATTR_IF_OPMODES);
|
||||
if (!nl_if_opmodes) {
|
||||
ret = -ENOBUFS;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
for (i = 0; i < dvobj->iface_nums; i++) {
|
||||
if (!dvobj->padapters[i])
|
||||
continue;
|
||||
iface = dvobj->padapters[i];
|
||||
|
||||
if (!rfctl->if_op_class[i] || !rfctl->if_op_ch[i])
|
||||
continue;
|
||||
|
||||
if (0)
|
||||
RTW_INFO(ADPT_FMT": %u,%u\n", ADPT_ARG(iface), rfctl->if_op_class[i], rfctl->if_op_ch[i]);
|
||||
|
||||
nl_if_opmode = nla_nest_start(skb, i + 1);
|
||||
if (!nl_if_opmode) {
|
||||
ret = -ENOBUFS;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
ret = nla_put(skb, NLRTW_IF_OPMODE_MACADDR, ETH_ALEN, adapter_mac_addr(iface));
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
ret = nla_put_u8(skb, NLRTW_IF_OPMODE_OP_CLASS, rfctl->if_op_class[i]);
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
ret = nla_put_u8(skb, NLRTW_IF_OPMODE_OP_CHANNEL, rfctl->if_op_ch[i]);
|
||||
if (ret != 0)
|
||||
goto err_out;
|
||||
|
||||
nla_nest_end(skb, nl_if_opmode);
|
||||
}
|
||||
|
||||
nla_nest_end(skb, nl_if_opmodes);
|
||||
|
||||
/* finalize the message */
|
||||
genlmsg_end(skb, msg_header);
|
||||
|
||||
ret = nlrtw_multicast(&nlrtw_genl_family, skb, 0, NLRTW_MCGRP_DEFAULT, GFP_KERNEL);
|
||||
if (ret == -ESRCH) {
|
||||
RTW_DBG(FUNC_WIPHY_FMT" return -ESRCH(No such process)."
|
||||
" Maybe no process waits for this msg\n", FUNC_WIPHY_ARG(wiphy));
|
||||
return ret;
|
||||
} else if (ret != 0) {
|
||||
RTW_WARN(FUNC_WIPHY_FMT" return %d\n", FUNC_WIPHY_ARG(wiphy), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
if (skb)
|
||||
nlmsg_free(skb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtw_nlrtw_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
|
||||
err = genl_register_family(&nlrtw_genl_family);
|
||||
if (err)
|
||||
return err;
|
||||
#else
|
||||
err = genl_register_family_with_ops(&nlrtw_genl_family, nlrtw_genl_ops, ARRAY_SIZE(nlrtw_genl_ops));
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = genl_register_mc_group(&nlrtw_genl_family, &nlrtw_genl_mcgrp[0]);
|
||||
if (err) {
|
||||
genl_unregister_family(&nlrtw_genl_family);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
RTW_INFO("[%s] %s\n", __func__, nlrtw_genl_family.name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rtw_nlrtw_deinit(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = genl_unregister_family(&nlrtw_genl_family);
|
||||
RTW_INFO("[%s] err = %d\n", __func__, err);
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif /* CONFIG_RTW_NLRTW */
|
||||
48
os_dep/linux/nlrtw.h
Normal file
48
os_dep/linux/nlrtw.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2020 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __RTW_NLRTW_H_
|
||||
#define __RTW_NLRTW_H_
|
||||
|
||||
#ifdef CONFIG_RTW_NLRTW
|
||||
int rtw_nlrtw_init(void);
|
||||
int rtw_nlrtw_deinit(void);
|
||||
int rtw_nlrtw_ch_util_rpt(_adapter *adapter, u8 n_rpts, u8 *val, u8 **mac_addr);
|
||||
int rtw_nlrtw_reg_change_event(_adapter *adapter);
|
||||
int rtw_nlrtw_reg_beacon_hint_event(_adapter *adapter);
|
||||
int rtw_nlrtw_radio_opmode_notify(struct rf_ctl_t *rfctl);
|
||||
#else
|
||||
static inline int rtw_nlrtw_init(void) {return _FAIL;}
|
||||
static inline int rtw_nlrtw_deinit(void) {return _FAIL;}
|
||||
static inline int rtw_nlrtw_ch_util_rpt(_adapter *adapter, u8 n_rpts, u8 *val, u8 **mac_addr) {return _FAIL;}
|
||||
static inline int rtw_nlrtw_reg_change_event(_adapter *adapter) {return _FAIL;}
|
||||
static inline int rtw_nlrtw_reg_beacon_hint_event(_adapter *adapter) {return _FAIL;}
|
||||
static inline int rtw_nlrtw_radio_opmode_notify(struct rf_ctl_t *rfctl) {return _FAIL;}
|
||||
#endif /* CONFIG_RTW_NLRTW */
|
||||
|
||||
#if defined(CONFIG_RTW_NLRTW) && defined(CONFIG_DFS_MASTER)
|
||||
int rtw_nlrtw_radar_detect_event(_adapter *adapter, u8 cch, u8 bw);
|
||||
int rtw_nlrtw_cac_finish_event(_adapter *adapter, u8 cch, u8 bw);
|
||||
int rtw_nlrtw_cac_abort_event(_adapter *adapter, u8 cch, u8 bw);
|
||||
int rtw_nlrtw_nop_finish_event(_adapter *adapter, u8 cch, u8 bw);
|
||||
int rtw_nlrtw_nop_start_event(_adapter *adapter, u8 cch, u8 bw);
|
||||
#else
|
||||
static inline int rtw_nlrtw_radar_detect_event(_adapter *adapter, u8 cch, u8 bw) {return _FAIL;}
|
||||
static inline int rtw_nlrtw_cac_finish_event(_adapter *adapter, u8 cch, u8 bw) {return _FAIL;}
|
||||
static inline int rtw_nlrtw_cac_abort_event(_adapter *adapter, u8 cch, u8 bw) {return _FAIL;}
|
||||
static inline int rtw_nlrtw_nop_finish_event(_adapter *adapter, u8 cch, u8 bw) {return _FAIL;}
|
||||
static inline int rtw_nlrtw_nop_start_event(_adapter *adapter, u8 cch, u8 bw) {return _FAIL;}
|
||||
#endif /* defined(CONFIG_RTW_NLRTW) && defined(CONFIG_DFS_MASTER) */
|
||||
|
||||
#endif /* __RTW_NLRTW_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -208,8 +208,52 @@ void rtw_os_recv_resource_free(struct recv_priv *precvpriv)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
|
||||
#if !defined(CONFIG_RTL8822B) && !defined(CONFIG_RTL8822C)
|
||||
#ifdef CONFIG_SDIO_RX_COPY
|
||||
static int sdio_init_recvbuf_with_skb(struct recv_priv *recvpriv, struct recv_buf *rbuf, u32 size)
|
||||
{
|
||||
#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER
|
||||
if (RBUF_IS_PREALLOC(rbuf)) {
|
||||
rbuf->pskb = rtw_alloc_skb_premem(size);
|
||||
if (!rbuf->pskb) {
|
||||
RTW_WARN("%s: Fail to get pre-alloc skb! size=%d\n", __func__, size);
|
||||
return _FAIL;
|
||||
}
|
||||
skb_set_tail_pointer(rbuf->pskb, 0); /* TODO: do this in RTKM */
|
||||
} else
|
||||
#else
|
||||
{
|
||||
SIZE_PTR tmpaddr = 0;
|
||||
SIZE_PTR alignment = 0;
|
||||
|
||||
rbuf->pskb = rtw_skb_alloc(size + RECVBUFF_ALIGN_SZ);
|
||||
if (!rbuf->pskb)
|
||||
return _FAIL;
|
||||
|
||||
tmpaddr = (SIZE_PTR)rbuf->pskb->data;
|
||||
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
|
||||
skb_reserve(rbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
|
||||
}
|
||||
#endif
|
||||
|
||||
rbuf->pskb->dev = recvpriv->adapter->pnetdev;
|
||||
|
||||
/* init recvbuf */
|
||||
rbuf->phead = rbuf->pskb->head;
|
||||
rbuf->pdata = rbuf->pskb->data;
|
||||
rbuf->ptail = skb_tail_pointer(rbuf->pskb);
|
||||
rbuf->pend = skb_end_pointer(rbuf->pskb);
|
||||
rbuf->len = 0;
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
#endif /* CONFIG_SDIO_RX_COPY */
|
||||
#endif /* !defined(CONFIG_RTL8822B) && !defined(CONFIG_RTL8822C) */
|
||||
#endif /* defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) */
|
||||
|
||||
/* alloc os related resource in struct recv_buf */
|
||||
int rtw_os_recvbuf_resource_alloc(_adapter *padapter, struct recv_buf *precvbuf)
|
||||
int rtw_os_recvbuf_resource_alloc(_adapter *padapter, struct recv_buf *precvbuf, u32 size)
|
||||
{
|
||||
int res = _SUCCESS;
|
||||
|
||||
@@ -235,13 +279,20 @@ int rtw_os_recvbuf_resource_alloc(_adapter *padapter, struct recv_buf *precvbuf)
|
||||
precvbuf->len = 0;
|
||||
|
||||
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
precvbuf->pallocated_buf = rtw_usb_buffer_alloc(pusbd, (size_t)precvbuf->alloc_sz, &precvbuf->dma_transfer_addr);
|
||||
precvbuf->pallocated_buf = rtw_usb_buffer_alloc(pusbd, (size_t)size, &precvbuf->dma_transfer_addr);
|
||||
precvbuf->pbuf = precvbuf->pallocated_buf;
|
||||
if (precvbuf->pallocated_buf == NULL)
|
||||
return _FAIL;
|
||||
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
|
||||
|
||||
#endif /* CONFIG_USB_HCI */
|
||||
#elif defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
|
||||
#if !defined(CONFIG_RTL8822B) && !defined(CONFIG_RTL8822C)
|
||||
#ifdef CONFIG_SDIO_RX_COPY
|
||||
res = sdio_init_recvbuf_with_skb(&padapter->recvpriv, precvbuf, size);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_XXX_HCI */
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -282,9 +333,9 @@ int rtw_os_recvbuf_resource_free(_adapter *padapter, struct recv_buf *precvbuf)
|
||||
|
||||
}
|
||||
|
||||
_pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, const u8 *da, const u8 *sa, u8 *msdu ,u16 msdu_len)
|
||||
_pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, const u8 *da, const u8 *sa
|
||||
, u8 *msdu ,u16 msdu_len, enum rtw_rx_llc_hdl llc_hdl)
|
||||
{
|
||||
u16 eth_type;
|
||||
u8 *data_ptr;
|
||||
_pkt *sub_skb;
|
||||
struct rx_pkt_attrib *pattrib;
|
||||
@@ -311,13 +362,7 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, const u8 *da, const u8 *s
|
||||
}
|
||||
}
|
||||
|
||||
eth_type = RTW_GET_BE16(&sub_skb->data[6]);
|
||||
|
||||
if (sub_skb->len >= 8
|
||||
&& ((_rtw_memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE)
|
||||
&& eth_type != ETH_P_AARP && eth_type != ETH_P_IPX)
|
||||
|| _rtw_memcmp(sub_skb->data, rtw_bridge_tunnel_header, SNAP_SIZE))
|
||||
) {
|
||||
if (llc_hdl) {
|
||||
/* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */
|
||||
skb_pull(sub_skb, SNAP_SIZE);
|
||||
_rtw_memcpy(skb_push(sub_skb, ETH_ALEN), sa, ETH_ALEN);
|
||||
@@ -354,12 +399,13 @@ static int napi_recv(_adapter *padapter, int budget)
|
||||
rx_ok = _FALSE;
|
||||
|
||||
#ifdef CONFIG_RTW_GRO
|
||||
if (pregistrypriv->en_gro) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
|
||||
if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_MERGED_FREE)
|
||||
#else
|
||||
/*
|
||||
cloned SKB use dataref to avoid kernel release it.
|
||||
But dataref changed in napi_gro_receive.
|
||||
So, we should prevent cloned SKB go into napi_gro_receive.
|
||||
*/
|
||||
if (pregistrypriv->en_gro && !skb_cloned(pskb)) {
|
||||
if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_DROP)
|
||||
#endif
|
||||
rx_ok = _TRUE;
|
||||
goto next;
|
||||
}
|
||||
@@ -437,52 +483,8 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, union recv_frame *r
|
||||
|
||||
DBG_COUNTER(padapter->rx_logs.os_indicate);
|
||||
|
||||
if (MLME_IS_AP(padapter) && !pmlmepriv->ap_isolate) {
|
||||
_pkt *pskb2 = NULL;
|
||||
struct sta_info *psta = NULL;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
int bmcast = IS_MCAST(ehdr->h_dest);
|
||||
|
||||
/* RTW_INFO("bmcast=%d\n", bmcast); */
|
||||
|
||||
if (_rtw_memcmp(ehdr->h_dest, adapter_mac_addr(padapter), ETH_ALEN) == _FALSE) {
|
||||
/* RTW_INFO("not ap psta=%p, addr=%pM\n", psta, ehdr->h_dest); */
|
||||
|
||||
if (bmcast) {
|
||||
psta = rtw_get_bcmc_stainfo(padapter);
|
||||
pskb2 = rtw_skb_clone(pkt);
|
||||
} else
|
||||
psta = rtw_get_stainfo(pstapriv, ehdr->h_dest);
|
||||
|
||||
if (psta) {
|
||||
struct net_device *pnetdev = (struct net_device *)padapter->pnetdev;
|
||||
|
||||
/* RTW_INFO("directly forwarding to the rtw_xmit_entry\n"); */
|
||||
|
||||
/* skb->ip_summed = CHECKSUM_NONE; */
|
||||
pkt->dev = pnetdev;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
skb_set_queue_mapping(pkt, rtw_recv_select_queue(pkt));
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) */
|
||||
|
||||
_rtw_xmit_entry(pkt, pnetdev);
|
||||
|
||||
if (bmcast && (pskb2 != NULL)) {
|
||||
pkt = pskb2;
|
||||
DBG_COUNTER(padapter->rx_logs.os_indicate_ap_mcast);
|
||||
} else {
|
||||
DBG_COUNTER(padapter->rx_logs.os_indicate_ap_forward);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else { /* to APself */
|
||||
/* RTW_INFO("to APSelf\n"); */
|
||||
DBG_COUNTER(padapter->rx_logs.os_indicate_ap_self);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BR_EXT
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE) == _TRUE) {
|
||||
if (!adapter_use_wds(padapter) && check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE) == _TRUE) {
|
||||
/* Insert NAT2.5 RX here! */
|
||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
|
||||
br_port = padapter->pnetdev->br_port;
|
||||
@@ -639,20 +641,15 @@ void rtw_hostapd_mlme_rx(_adapter *padapter, union recv_frame *precv_frame)
|
||||
}
|
||||
#endif /* CONFIG_HOSTAPD_MLME */
|
||||
|
||||
#ifdef CONFIG_WIFI_MONITOR
|
||||
/*
|
||||
precv_frame: impossible to be NULL
|
||||
precv_frame: free by caller
|
||||
*/
|
||||
int rtw_recv_monitor(_adapter *padapter, union recv_frame *precv_frame)
|
||||
{
|
||||
int ret = _FAIL;
|
||||
struct recv_priv *precvpriv;
|
||||
_queue *pfree_recv_queue;
|
||||
_pkt *skb;
|
||||
struct rx_pkt_attrib *pattrib;
|
||||
|
||||
if (NULL == precv_frame)
|
||||
goto _recv_drop;
|
||||
|
||||
pattrib = &precv_frame->u.hdr.attrib;
|
||||
precvpriv = &(padapter->recvpriv);
|
||||
pfree_recv_queue = &(precvpriv->free_recv_queue);
|
||||
|
||||
skb = precv_frame->u.hdr.pkt;
|
||||
if (skb == NULL) {
|
||||
@@ -667,6 +664,7 @@ int rtw_recv_monitor(_adapter *padapter, union recv_frame *precv_frame)
|
||||
skb->pkt_type = PACKET_OTHERHOST;
|
||||
skb->protocol = htons(0x0019); /* ETH_P_80211_RAW */
|
||||
|
||||
/* send to kernel */
|
||||
rtw_netif_rx(padapter->pnetdev, skb);
|
||||
|
||||
/* pointers to NULL before rtw_free_recvframe() */
|
||||
@@ -675,14 +673,9 @@ int rtw_recv_monitor(_adapter *padapter, union recv_frame *precv_frame)
|
||||
ret = _SUCCESS;
|
||||
|
||||
_recv_drop:
|
||||
|
||||
/* enqueue back to free_recv_queue */
|
||||
if (precv_frame)
|
||||
rtw_free_recvframe(precv_frame, pfree_recv_queue);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
#endif /* CONFIG_WIFI_MONITOR */
|
||||
|
||||
inline void rtw_rframe_set_os_pkt(union recv_frame *rframe)
|
||||
{
|
||||
|
||||
@@ -371,7 +371,7 @@ int rtw_android_get_rssi(struct net_device *net, char *command, int total_len)
|
||||
struct wlan_network *pcur_network = &pmlmepriv->cur_network;
|
||||
int bytes_written = 0;
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE) == _TRUE) {
|
||||
bytes_written += snprintf(&command[bytes_written], total_len, "%s rssi %d",
|
||||
pcur_network->network.Ssid.Ssid, padapter->recvpriv.rssi);
|
||||
}
|
||||
@@ -828,11 +828,13 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_IOCTL_CFG80211
|
||||
#ifdef CONFIG_AP_MODE
|
||||
case ANDROID_WIFI_CMD_SET_AP_WPS_P2P_IE: {
|
||||
int skip = strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_SET_AP_WPS_P2P_IE]) + 3;
|
||||
bytes_written = rtw_cfg80211_set_mgnt_wpsp2pie(net, command + skip, priv_cmd.total_len - skip, *(command + skip - 2) - '0');
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_IOCTL_CFG80211 */
|
||||
|
||||
#ifdef CONFIG_WFD
|
||||
@@ -1148,6 +1150,7 @@ extern PADAPTER g_test_adapter;
|
||||
|
||||
static void shutdown_card(void)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(g_test_adapter);
|
||||
u32 addr;
|
||||
u8 tmp8, cnt = 0;
|
||||
|
||||
@@ -1164,7 +1167,7 @@ static void shutdown_card(void)
|
||||
#ifdef CONFIG_GPIO_WAKEUP
|
||||
/*default wake up pin change to BT*/
|
||||
RTW_INFO("%s:default wake up pin change to BT\n", __FUNCTION__);
|
||||
rtw_hal_switch_gpio_wl_ctrl(g_test_adapter, WAKEUP_GPIO_IDX, _FALSE);
|
||||
rtw_hal_switch_gpio_wl_ctrl(g_test_adapter, pwrpriv->wowlan_gpio_index, _FALSE);
|
||||
#endif /* CONFIG_GPIO_WAKEUP */
|
||||
#endif /* CONFIG_WOWLAN */
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@
|
||||
|
||||
#include <net/rtnetlink.h>
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifdef DBG_MEM_ALLOC
|
||||
extern bool match_mstat_sniff_rules(const enum mstat_f flags, const size_t size);
|
||||
struct sk_buff *dbg_rtw_cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, int len, int event_id, gfp_t gfp
|
||||
@@ -171,7 +175,7 @@ struct sk_buff *rtw_cfg80211_vendor_event_alloc(
|
||||
int rtw_cfgvendor_send_async_event(struct wiphy *wiphy,
|
||||
struct net_device *dev, int event_id, const void *data, int len)
|
||||
{
|
||||
u16 kflags;
|
||||
gfp_t kflags;
|
||||
struct sk_buff *skb;
|
||||
|
||||
kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
|
||||
@@ -236,6 +240,10 @@ static int rtw_cfgvendor_send_cmd_reply(struct wiphy *wiphy,
|
||||
#define WIFI_FEATURE_CONTROL_ROAMING 0x800000 // Enable/Disable firmware roaming
|
||||
#define WIFI_FEATURE_IE_WHITELIST 0x1000000 // Support Probe IE white listing
|
||||
#define WIFI_FEATURE_SCAN_RAND 0x2000000 // Support MAC & Probe Sequence Number randomization
|
||||
#define WIFI_FEATURE_SET_TX_POWER_LIMIT 0x4000000 // Support Tx Power Limit setting
|
||||
#define WIFI_FEATURE_USE_BODY_HEAD_SAR 0x8000000 // Support Using Body/Head Proximity for SAR
|
||||
#define WIFI_FEATURE_SET_LATENCY_MODE 0x40000000 // Support Latency mode setting
|
||||
#define WIFI_FEATURE_P2P_RAND_MAC 0x80000000 // Support Support P2P MAC randomization
|
||||
// Add more features here
|
||||
|
||||
#define MAX_FEATURE_SET_CONCURRRENT_GROUPS 3
|
||||
@@ -258,11 +266,11 @@ int rtw_dev_get_feature_set(struct net_device *dev)
|
||||
feature_set |= WIFI_FEATURE_SOFT_AP;
|
||||
|
||||
feature_set |= WIFI_FEATURE_ADDITIONAL_STA;
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
feature_set |= WIFI_FEATURE_LINK_LAYER_STATS;
|
||||
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_LLSTATS */
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_RSSIMONITOR
|
||||
feature_set |= WIFI_FEATURE_RSSI_MONITOR;
|
||||
#endif
|
||||
|
||||
@@ -272,7 +280,9 @@ int rtw_dev_get_feature_set(struct net_device *dev)
|
||||
|
||||
#ifdef CONFIG_RTW_WIFI_HAL
|
||||
feature_set |= WIFI_FEATURE_CONFIG_NDO;
|
||||
#if defined(CONFIG_RTW_CFGVENDOR_RANDOM_MAC_OUI) || defined(CONFIG_RTW_SCAN_RAND)
|
||||
feature_set |= WIFI_FEATURE_SCAN_RAND;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return feature_set;
|
||||
@@ -1135,7 +1145,7 @@ exit:
|
||||
|
||||
#endif /* RTT_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
enum {
|
||||
LSTATS_SUBCMD_GET_INFO = ANDROID_NL80211_SUBCMD_LSTATS_RANGE_START,
|
||||
LSTATS_SUBCMD_SET_INFO,
|
||||
@@ -1162,7 +1172,7 @@ static void LinkLayerStats(_adapter *padapter)
|
||||
|
||||
pwrpriv->on_time = rtw_get_passing_time_ms(pwrpriv->radio_on_start_time);
|
||||
|
||||
if (rtw_mi_check_fwstate(padapter, _FW_LINKED)) {
|
||||
if (rtw_mi_check_fwstate(padapter, WIFI_ASOC_STATE)) {
|
||||
if ( pwrpriv->bpower_saving == _TRUE ) {
|
||||
pwrpriv->pwr_saving_time += rtw_get_passing_time_ms(pwrpriv->pwr_saving_start_time);
|
||||
pwrpriv->pwr_saving_start_time = rtw_get_current_time();
|
||||
@@ -1292,8 +1302,8 @@ static int rtw_cfgvendor_lstats_clear_info(struct wiphy *wiphy,
|
||||
RTW_INFO("%s\n", __func__);
|
||||
return err;
|
||||
}
|
||||
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_LLSTATS */
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_RSSIMONITOR
|
||||
static int rtw_cfgvendor_set_rssi_monitor(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev, const void *data, int len)
|
||||
{
|
||||
@@ -1338,7 +1348,7 @@ void rtw_cfgvendor_rssi_monitor_evt(_adapter *padapter) {
|
||||
rssi_monitor_evt data ;
|
||||
s8 rssi = precvpriv->rssi;
|
||||
|
||||
if (pwdev_priv->rssi_monitor_enable == 0 || check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE)
|
||||
if (pwdev_priv->rssi_monitor_enable == 0 || check_fwstate(pmlmepriv, WIFI_ASOC_STATE) != _TRUE)
|
||||
return;
|
||||
|
||||
if (rssi < pwdev_priv->rssi_monitor_max || rssi > pwdev_priv->rssi_monitor_min)
|
||||
@@ -1364,7 +1374,7 @@ void rtw_cfgvendor_rssi_monitor_evt(_adapter *padapter) {
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_RTW_CFGVEDNOR_RSSIMONITR */
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_RSSIMONITR */
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_WIFI_LOGGER
|
||||
static int rtw_cfgvendor_logger_start_logging(struct wiphy *wiphy,
|
||||
@@ -1589,21 +1599,6 @@ void rtw_hal_pno_random_gen_mac_addr(PADAPTER adapter)
|
||||
#endif
|
||||
}
|
||||
|
||||
void rtw_hal_set_hw_mac_addr(PADAPTER adapter, u8 *mac_addr)
|
||||
{
|
||||
rtw_ps_deny(adapter, PS_DENY_IOCTL);
|
||||
LeaveAllPowerSaveModeDirect(adapter);
|
||||
|
||||
#ifdef CONFIG_MI_WITH_MBSSID_CAM
|
||||
rtw_hal_change_macaddr_mbid(adapter, mac_addr);
|
||||
#else
|
||||
rtw_hal_set_hwreg(adapter, HW_VAR_MAC_ADDR, mac_addr);
|
||||
#endif
|
||||
#ifdef CONFIG_RTW_DEBUG
|
||||
rtw_hal_dump_macaddr(RTW_DBGDUMP, adapter);
|
||||
#endif
|
||||
rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL);
|
||||
}
|
||||
|
||||
static int rtw_cfgvendor_set_rand_mac_oui(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev, const void *data, int len)
|
||||
@@ -1660,9 +1655,47 @@ static int rtw_cfgvendor_set_rand_mac_oui(struct wiphy *wiphy,
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTW_CFGVENDOR_RANDOM_MAC_OUI) || defined(CONFIG_RTW_SCAN_RAND)
|
||||
void rtw_hal_set_hw_mac_addr(PADAPTER adapter, u8 *mac_addr)
|
||||
{
|
||||
rtw_ps_deny(adapter, PS_DENY_IOCTL);
|
||||
LeaveAllPowerSaveModeDirect(adapter);
|
||||
|
||||
#ifdef CONFIG_MI_WITH_MBSSID_CAM
|
||||
rtw_hal_change_macaddr_mbid(adapter, mac_addr);
|
||||
#else
|
||||
rtw_hal_set_hwreg(adapter, HW_VAR_MAC_ADDR, mac_addr);
|
||||
#endif
|
||||
#ifdef CONFIG_RTW_DEBUG
|
||||
rtw_hal_dump_macaddr(RTW_DBGDUMP, adapter);
|
||||
#endif
|
||||
rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_WIFI_OFFLOAD
|
||||
static int rtw_cfgvendor_start_mkeep_alive(struct wiphy *wiphy, struct wireless_dev *wdev,
|
||||
const void *data, int len)
|
||||
{
|
||||
int ret = WIFI_SUCCESS;
|
||||
|
||||
RTW_INFO("%s : TODO\n", __func__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rtw_cfgvendor_stop_mkeep_alive(struct wiphy *wiphy, struct wireless_dev *wdev,
|
||||
const void *data, int len)
|
||||
{
|
||||
int ret = WIFI_SUCCESS;
|
||||
|
||||
RTW_INFO("%s : TODO\n", __func__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int rtw_cfgvendor_set_nodfs_flag(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev, const void *data, int len)
|
||||
@@ -1843,13 +1876,16 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.doit = rtw_cfgvendor_rtt_get_capability
|
||||
},
|
||||
#endif /* RTT_SUPPORT */
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
{
|
||||
{
|
||||
.vendor_id = OUI_GOOGLE,
|
||||
.subcmd = LSTATS_SUBCMD_GET_INFO
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_lstats_get_info
|
||||
},
|
||||
{
|
||||
@@ -1858,6 +1894,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LSTATS_SUBCMD_SET_INFO
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_lstats_set_info
|
||||
},
|
||||
{
|
||||
@@ -1866,19 +1905,25 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LSTATS_SUBCMD_CLEAR_INFO
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_lstats_clear_info
|
||||
},
|
||||
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_LLSTATS */
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_RSSIMONITOR
|
||||
{
|
||||
{
|
||||
.vendor_id = OUI_GOOGLE,
|
||||
.subcmd = WIFI_SUBCMD_SET_RSSI_MONITOR
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_set_rssi_monitor
|
||||
},
|
||||
#endif /* CONFIG_RTW_CFGVEDNOR_RSSIMONITOR */
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_RSSIMONITOR */
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_WIFI_LOGGER
|
||||
{
|
||||
{
|
||||
@@ -1886,6 +1931,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LOGGER_START_LOGGING
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_logger_start_logging
|
||||
},
|
||||
{
|
||||
@@ -1894,6 +1942,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LOGGER_GET_FEATURE
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_logger_get_feature
|
||||
},
|
||||
{
|
||||
@@ -1902,6 +1953,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LOGGER_GET_VER
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_logger_get_version
|
||||
},
|
||||
{
|
||||
@@ -1910,6 +1964,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LOGGER_GET_RING_STATUS
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_logger_get_ring_status
|
||||
},
|
||||
{
|
||||
@@ -1918,6 +1975,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LOGGER_GET_RING_DATA
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_logger_get_ring_data
|
||||
},
|
||||
{
|
||||
@@ -1926,6 +1986,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LOGGER_TRIGGER_MEM_DUMP
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_logger_get_firmware_memory_dump
|
||||
},
|
||||
{
|
||||
@@ -1934,6 +1997,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LOGGER_START_PKT_FATE_MONITORING
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_logger_start_pkt_fate_monitoring
|
||||
},
|
||||
{
|
||||
@@ -1942,6 +2008,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LOGGER_GET_TX_PKT_FATES
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_logger_get_tx_pkt_fates
|
||||
},
|
||||
{
|
||||
@@ -1950,6 +2019,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = LOGGER_GET_RX_PKT_FATES
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_logger_get_rx_pkt_fates
|
||||
},
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_WIFI_LOGGER */
|
||||
@@ -1961,8 +2033,35 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = WIFI_SUBCMD_SET_PNO_RANDOM_MAC_OUI
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_set_rand_mac_oui
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_WIFI_OFFLOAD
|
||||
{
|
||||
{
|
||||
.vendor_id = OUI_GOOGLE,
|
||||
.subcmd = WIFI_OFFLOAD_SUBCMD_START_MKEEP_ALIVE
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_start_mkeep_alive
|
||||
},
|
||||
{
|
||||
{
|
||||
.vendor_id = OUI_GOOGLE,
|
||||
.subcmd = WIFI_OFFLOAD_SUBCMD_STOP_MKEEP_ALIVE
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_stop_mkeep_alive
|
||||
},
|
||||
#endif
|
||||
{
|
||||
{
|
||||
@@ -1970,6 +2069,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = WIFI_SUBCMD_NODFS_SET
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_set_nodfs_flag
|
||||
|
||||
},
|
||||
@@ -1979,6 +2081,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = WIFI_SUBCMD_SET_COUNTRY_CODE
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_set_country
|
||||
},
|
||||
{
|
||||
@@ -1987,6 +2092,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = WIFI_SUBCMD_CONFIG_ND_OFFLOAD
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_set_nd_offload
|
||||
},
|
||||
#endif /* CONFIG_RTW_WIFI_HAL */
|
||||
@@ -1996,6 +2104,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = WIFI_SUBCMD_GET_FEATURE_SET
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_get_feature_set
|
||||
},
|
||||
{
|
||||
@@ -2004,6 +2115,9 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = {
|
||||
.subcmd = WIFI_SUBCMD_GET_FEATURE_SET_MATRIX
|
||||
},
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0))
|
||||
.policy = VENDOR_CMD_RAW_DATA,
|
||||
#endif
|
||||
.doit = rtw_cfgvendor_get_feature_set_matrix
|
||||
}
|
||||
};
|
||||
@@ -2019,9 +2133,9 @@ static const struct nl80211_vendor_cmd_info rtw_vendor_events[] = {
|
||||
{ OUI_GOOGLE, RTT_EVENT_COMPLETE },
|
||||
#endif /* RTT_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_RSSIMONITOR
|
||||
{ OUI_GOOGLE, GOOGLE_RSSI_MONITOR_EVENT },
|
||||
#endif /* RTW_CFGVEDNOR_RSSIMONITR */
|
||||
#endif /* RTW_CFGVENDOR_RSSIMONITR */
|
||||
|
||||
#if defined(GSCAN_SUPPORT) && 0
|
||||
{ OUI_GOOGLE, GSCAN_EVENT_COMPLETE_SCAN },
|
||||
|
||||
@@ -137,6 +137,9 @@ enum rtw_vendor_subcmd {
|
||||
LOGGER_GET_TX_PKT_FATES,
|
||||
LOGGER_GET_RX_PKT_FATES,
|
||||
|
||||
WIFI_OFFLOAD_SUBCMD_START_MKEEP_ALIVE = ANDROID_NL80211_SUBCMD_WIFI_OFFLOAD_RANGE_START,
|
||||
WIFI_OFFLOAD_SUBCMD_STOP_MKEEP_ALIVE,
|
||||
|
||||
VENDOR_SUBCMD_MAX
|
||||
};
|
||||
|
||||
@@ -380,7 +383,7 @@ typedef struct {
|
||||
// monotonously increasing integer
|
||||
} wifi_ring_buffer_status;
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_LLSTATS
|
||||
#define STATS_MAJOR_VERSION 1
|
||||
#define STATS_MINOR_VERSION 0
|
||||
#define STATS_MICRO_VERSION 0
|
||||
@@ -606,7 +609,7 @@ typedef struct {
|
||||
#define WIFI_STATS_IFACE_AC 0x00000040 // all ac statistics (within interface statistics)
|
||||
#define WIFI_STATS_IFACE_CONTENTION 0x00000080 // all contention (min, max, avg) statistics (within ac statisctics)
|
||||
|
||||
#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */
|
||||
#endif /* CONFIG_RTW_CFGVENDOR_LLSTATS */
|
||||
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT)
|
||||
@@ -620,12 +623,14 @@ extern int rtw_cfgvendor_send_hotlist_event(struct wiphy *wiphy,
|
||||
#endif
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) */
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_RSSIMONITOR
|
||||
void rtw_cfgvendor_rssi_monitor_evt(_adapter *padapter);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTW_CFGVENDOR_RANDOM_MAC_OUI
|
||||
void rtw_hal_pno_random_gen_mac_addr(PADAPTER adapter);
|
||||
#endif
|
||||
#if defined(CONFIG_RTW_CFGVENDOR_RANDOM_MAC_OUI) || defined(CONFIG_RTW_SCAN_RAND)
|
||||
void rtw_hal_set_hw_mac_addr(PADAPTER adapter, u8 *mac_addr);
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,10 +13,10 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTW_MESH /* for now, only promised for kernel versions we support mesh */
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#if defined(CONFIG_RTW_WDS) || defined(CONFIG_RTW_MESH) /* for now, only promised for kernel versions we support mesh */
|
||||
|
||||
int rtw_rhashtable_walk_enter(rtw_rhashtable *ht, rtw_rhashtable_iter *iter)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
|
||||
@@ -73,5 +73,5 @@ void kvfree(const void *addr)
|
||||
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)) */
|
||||
|
||||
#endif /* CONFIG_RTW_MESH */
|
||||
#endif /* defined(CONFIG_RTW_WDS) || defined(CONFIG_RTW_MESH) */
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#ifndef __RTW_RHASHTABLE_H__
|
||||
#define __RTW_RHASHTABLE_H__
|
||||
|
||||
#ifdef CONFIG_RTW_MESH /* for now, only promised for kernel versions we support mesh */
|
||||
#if defined(CONFIG_RTW_WDS) || defined(CONFIG_RTW_MESH) /* for now, only promised for kernel versions we support mesh */
|
||||
|
||||
/* directly reference rhashtable in kernel */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
|
||||
@@ -27,6 +27,14 @@
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0))
|
||||
#define NULLS_MARKER(value) (1UL | (((long)value) << 1))
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0))
|
||||
static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
|
||||
{
|
||||
if (size != 0 && n > ULONG_MAX / size)
|
||||
return NULL;
|
||||
return __kmalloc(n * size, flags);
|
||||
}
|
||||
#endif
|
||||
#include "rhashtable.h"
|
||||
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)) */
|
||||
|
||||
@@ -53,7 +61,7 @@ int rtw_rhashtable_walk_enter(rtw_rhashtable *ht, rtw_rhashtable_iter *iter);
|
||||
#define rtw_rhashtable_lookup_insert_fast(ht, obj, params) rhashtable_lookup_insert_fast((ht), (obj), (params))
|
||||
#define rtw_rhashtable_remove_fast(ht, obj, params) rhashtable_remove_fast((ht), (obj), (params))
|
||||
|
||||
#endif /* CONFIG_RTW_MESH */
|
||||
#endif /* defined(CONFIG_RTW_WDS) || defined(CONFIG_RTW_MESH) */
|
||||
|
||||
#endif /* __RTW_RHASHTABLE_H__ */
|
||||
|
||||
|
||||
301
os_dep/linux/usb_intf.c
Executable file → Normal file
301
os_dep/linux/usb_intf.c
Executable file → Normal file
@@ -62,7 +62,7 @@ static void rtw_dev_shutdown(struct device *dev)
|
||||
#ifdef CONFIG_GPIO_WAKEUP
|
||||
/*default wake up pin change to BT*/
|
||||
RTW_INFO("%s:default wake up pin change to BT\n", __FUNCTION__);
|
||||
rtw_hal_switch_gpio_wl_ctrl(adapter, WAKEUP_GPIO_IDX, _FALSE);
|
||||
rtw_hal_switch_gpio_wl_ctrl(adapter, pwrctl->wowlan_gpio_index, _FALSE);
|
||||
#endif /* CONFIG_GPIO_WAKEUP */
|
||||
|
||||
if (pwrctl->wowlan_mode == _TRUE)
|
||||
@@ -70,6 +70,10 @@ static void rtw_dev_shutdown(struct device *dev)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef CONFIG_BT_COEXIST
|
||||
RTW_INFO("%s call halt notify\n", __FUNCTION__);
|
||||
rtw_btcoex_HaltNotify(adapter);
|
||||
#endif
|
||||
rtw_hal_deinit(adapter);
|
||||
rtw_set_surprise_removed(adapter);
|
||||
}
|
||||
@@ -135,6 +139,7 @@ static void rtw_dev_shutdown(struct device *dev)
|
||||
#endif
|
||||
|
||||
|
||||
#define USB_VENDER_ID_EDOMAX 0x7392
|
||||
#define USB_VENDER_ID_REALTEK 0x0BDA
|
||||
|
||||
|
||||
@@ -238,19 +243,8 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xB812, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Default ID for USB Single-function, WiFi only */
|
||||
/*=== Customer ID ===*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x13b1, 0x0043, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Alpha - Alpha*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x0b05, 0x1841, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* ASUS AC1300 USB-AC55 B1 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x0b05, 0x184C, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* ASUS U2*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x0B05, 0x19AA, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* ASUS USB-AC58 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xB822, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Edimax EW-7822ULC */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xC822, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Edimax EW-7822UTC */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xF822, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Edimax EW-7822UAD */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x331e, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Dlink - DWA-181*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x331c, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Dlink - DWA-182*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x0846, 0x9055, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* NetGear A6150 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x012D, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* TP-Link Archer T3U */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0138, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* TP-Link Archer T3U Plus */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0115, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* TP-Link Archer T4U V3 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x20F4, 0x808A, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* TRENDnet TEW-808UBM */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_EDOMAX, 0xB822, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Edimax */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_EDOMAX, 0xC822, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Edimax */
|
||||
#endif /* CONFIG_RTL8822B */
|
||||
|
||||
#ifdef CONFIG_RTL8723D
|
||||
@@ -273,7 +267,9 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xC82A, 0xff, 0xff, 0xff), .driver_info = RTL8821C}, /* 8821CU */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xC82B, 0xff, 0xff, 0xff), .driver_info = RTL8821C}, /* 8821CU */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xC811, 0xff, 0xff, 0xff), .driver_info = RTL8821C}, /* 8811CU */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x8811, 0xff, 0xff, 0xff), .driver_info = RTL8821C}, /* 8811CU */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x8811, 0xff, 0xff, 0xff), .driver_info = RTL8821C}, /* 8811CU */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x8731, 0xff, 0xff, 0xff), .driver_info = RTL8821C}, /* 8731AU */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xC80C, 0xff, 0xff, 0xff), .driver_info = RTL8821C}, /* 8821CUH */
|
||||
/*=== Customer ID ===*/
|
||||
#endif
|
||||
|
||||
@@ -285,7 +281,10 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
|
||||
#ifdef CONFIG_RTL8822C
|
||||
/*=== Realtek demoboard ===*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xC82C, 0xff, 0xff, 0xff), .driver_info = RTL8822C}, /* Default ID for USB multi-function */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xC82E, 0xff, 0xff, 0xff), .driver_info = RTL8822C}, /* Default ID for USB multi-function */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xC812, 0xff, 0xff, 0xff), .driver_info = RTL8822C}, /* Default ID for USB Single-function, WiFi only */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xD820, 0xff, 0xff, 0xff), .driver_info = RTL8822C}, /* 21D USB multi-fuction*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xD82B, 0xff, 0xff, 0xff), .driver_info = RTL8822C}, /* 21D USB Single-fuction, WiFi only*/
|
||||
/*=== Customer ID ===*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x13b1, 0x0043, 0xff, 0xff, 0xff), .driver_info = RTL8822C}, /* Alpha - Alpha*/
|
||||
#endif /* CONFIG_RTL8822C */
|
||||
@@ -294,6 +293,10 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
|
||||
/*=== Realtek demoboard ===*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xB814, 0xff, 0xff, 0xff), .driver_info = RTL8814B}, /* Default ID for USB multi-function */
|
||||
#endif /* CONFIG_RTL8814B */
|
||||
#ifdef CONFIG_RTL8723F
|
||||
/*=== Realtek IC ===*/
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xB733, 0xff, 0xff, 0xff), .driver_info = RTL8723F},
|
||||
#endif
|
||||
|
||||
{} /* Terminating entry */
|
||||
};
|
||||
@@ -331,9 +334,6 @@ struct rtw_usb_drv usb_drv = {
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
|
||||
.usbdrv.reset_resume = rtw_resume,
|
||||
#endif
|
||||
#ifdef CONFIG_AUTOSUSPEND
|
||||
.usbdrv.supports_autosuspend = 1,
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
|
||||
.usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,
|
||||
@@ -500,6 +500,11 @@ static void rtw_decide_chip_type_by_usb_info(struct dvobj_priv *pdvobjpriv, cons
|
||||
if (pdvobjpriv->chip_type == RTL8814B)
|
||||
rtl8814bu_set_hw_type(pdvobjpriv);
|
||||
#endif /* CONFIG_RTL8814B */
|
||||
|
||||
#ifdef CONFIG_RTL8723F
|
||||
if (pdvobjpriv->chip_type == RTL8723F)
|
||||
rtl8723fu_set_hw_type(pdvobjpriv);
|
||||
#endif /* CONFIG_RTL8723F */
|
||||
}
|
||||
|
||||
static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf, const struct usb_device_id *pdid)
|
||||
@@ -777,6 +782,10 @@ u8 rtw_set_hal_ops(_adapter *padapter)
|
||||
rtl8814bu_set_hal_ops(padapter);
|
||||
#endif /* CONFIG_RTL8814B */
|
||||
|
||||
#ifdef CONFIG_RTL8723F
|
||||
if (rtw_get_chip_type(padapter) == RTL8723F)
|
||||
rtl8723fu_set_hal_ops(padapter);
|
||||
#endif /* CONFIG_RTL8723F */
|
||||
|
||||
if (_FAIL == rtw_hal_ops_check(padapter))
|
||||
return _FAIL;
|
||||
@@ -893,8 +902,8 @@ int rtw_hw_suspend(_adapter *padapter)
|
||||
/* rtw_indicate_disconnect(padapter); */
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
_clr_fwstate_(pmlmepriv, _FW_LINKED);
|
||||
if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE)) {
|
||||
_clr_fwstate_(pmlmepriv, WIFI_ASOC_STATE);
|
||||
rtw_led_control(padapter, LED_CTL_NO_LINK);
|
||||
|
||||
rtw_os_indicate_disconnect(padapter, 0, _FALSE);
|
||||
@@ -980,21 +989,6 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((padapter->bup) || !rtw_is_drv_stopped(padapter) || !rtw_is_surprise_removed(padapter)) {
|
||||
#ifdef CONFIG_AUTOSUSPEND
|
||||
if (pwrpriv->bInternalAutoSuspend) {
|
||||
|
||||
#ifdef SUPPORT_HW_RFOFF_DETECTED
|
||||
/* The FW command register update must after MAC and FW init ready. */
|
||||
if ((GET_HAL_DATA(padapter)->bFWReady) && (pwrpriv->bHWPwrPindetect) && (padapter->registrypriv.usbss_enable)) {
|
||||
u8 bOpen = _TRUE;
|
||||
rtw_interface_ps_func(padapter, HAL_USB_SELECT_SUSPEND, &bOpen);
|
||||
}
|
||||
#endif/* SUPPORT_HW_RFOFF_DETECTED */
|
||||
}
|
||||
#endif/* CONFIG_AUTOSUSPEND */
|
||||
}
|
||||
|
||||
ret = rtw_suspend_common(padapter);
|
||||
|
||||
exit:
|
||||
@@ -1004,9 +998,6 @@ exit:
|
||||
int rtw_resume_process(_adapter *padapter)
|
||||
{
|
||||
int ret;
|
||||
#if defined(CONFIG_BT_COEXIST) && defined(CONFIG_AUTOSUSPEND)
|
||||
int pm_cnt = 0;
|
||||
#endif
|
||||
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
|
||||
struct dvobj_priv *pdvobj = padapter->dvobj;
|
||||
struct debug_priv *pdbgpriv = &pdvobj->drv_dbg;
|
||||
@@ -1018,24 +1009,6 @@ int rtw_resume_process(_adapter *padapter)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_COEXIST) && defined(CONFIG_AUTOSUSPEND) /* add by amy for 8723as-vau */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
RTW_INFO("%s...pm_usage_cnt(%d) pwrpriv->bAutoResume=%x. ....\n", __func__, atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt)), pwrpriv->bAutoResume);
|
||||
pm_cnt = atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt));
|
||||
#else /* kernel < 2.6.32 */
|
||||
RTW_INFO("...pm_usage_cnt(%d).....\n", adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt);
|
||||
pm_cnt = adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt;
|
||||
#endif /* kernel < 2.6.32 */
|
||||
|
||||
RTW_INFO("pwrpriv->bAutoResume (%x)\n", pwrpriv->bAutoResume);
|
||||
if (_TRUE == pwrpriv->bAutoResume) {
|
||||
pwrpriv->bInternalAutoSuspend = _FALSE;
|
||||
pwrpriv->bAutoResume = _FALSE;
|
||||
RTW_INFO("pwrpriv->bAutoResume (%x) pwrpriv->bInternalAutoSuspend(%x)\n", pwrpriv->bAutoResume, pwrpriv->bInternalAutoSuspend);
|
||||
|
||||
}
|
||||
#endif /* #ifdef CONFIG_BT_COEXIST &CONFIG_AUTOSUSPEND& */
|
||||
|
||||
/*
|
||||
* Due to usb wow suspend flow will cancel read/write port via intf_stop and
|
||||
* bReadPortCancel and bWritePortCancel are set _TRUE in intf_stop.
|
||||
@@ -1047,31 +1020,6 @@ int rtw_resume_process(_adapter *padapter)
|
||||
|
||||
ret = rtw_resume_common(padapter);
|
||||
|
||||
#ifdef CONFIG_AUTOSUSPEND
|
||||
if (pwrpriv->bInternalAutoSuspend) {
|
||||
#ifdef SUPPORT_HW_RFOFF_DETECTED
|
||||
/* The FW command register update must after MAC and FW init ready. */
|
||||
if ((GET_HAL_DATA(padapter)->bFWReady) && (pwrpriv->bHWPwrPindetect) && (padapter->registrypriv.usbss_enable)) {
|
||||
u8 bOpen = _FALSE;
|
||||
rtw_interface_ps_func(padapter, HAL_USB_SELECT_SUSPEND, &bOpen);
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_BT_COEXIST /* for 8723as-vau */
|
||||
RTW_INFO("pwrpriv->bAutoResume (%x)\n", pwrpriv->bAutoResume);
|
||||
if (_TRUE == pwrpriv->bAutoResume) {
|
||||
pwrpriv->bInternalAutoSuspend = _FALSE;
|
||||
pwrpriv->bAutoResume = _FALSE;
|
||||
RTW_INFO("pwrpriv->bAutoResume (%x) pwrpriv->bInternalAutoSuspend(%x)\n", pwrpriv->bAutoResume, pwrpriv->bInternalAutoSuspend);
|
||||
}
|
||||
|
||||
#else /* #ifdef CONFIG_BT_COEXIST */
|
||||
pwrpriv->bInternalAutoSuspend = _FALSE;
|
||||
#endif /* #ifdef CONFIG_BT_COEXIST */
|
||||
pwrpriv->brfoffbyhw = _FALSE;
|
||||
}
|
||||
#endif/* CONFIG_AUTOSUSPEND */
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1094,30 +1042,24 @@ static int rtw_resume(struct usb_interface *pusb_intf)
|
||||
RTW_INFO("==> %s (%s:%d)\n", __FUNCTION__, current->comm, current->pid);
|
||||
pdbgpriv->dbg_resume_cnt++;
|
||||
|
||||
#ifdef CONFIG_AUTOSUSPEND
|
||||
if (pwrpriv->bInternalAutoSuspend)
|
||||
|
||||
if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) {
|
||||
rtw_resume_lock_suspend();
|
||||
ret = rtw_resume_process(padapter);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) {
|
||||
rtw_resume_unlock_suspend();
|
||||
} else {
|
||||
#ifdef CONFIG_RESUME_IN_WORKQUEUE
|
||||
rtw_resume_in_workqueue(pwrpriv);
|
||||
#else
|
||||
if (rtw_is_earlysuspend_registered(pwrpriv)) {
|
||||
/* jeff: bypass resume here, do in late_resume */
|
||||
rtw_set_do_late_resume(pwrpriv, _TRUE);
|
||||
} else {
|
||||
rtw_resume_lock_suspend();
|
||||
ret = rtw_resume_process(padapter);
|
||||
rtw_resume_unlock_suspend();
|
||||
} else {
|
||||
#ifdef CONFIG_RESUME_IN_WORKQUEUE
|
||||
rtw_resume_in_workqueue(pwrpriv);
|
||||
#else
|
||||
if (rtw_is_earlysuspend_registered(pwrpriv)) {
|
||||
/* jeff: bypass resume here, do in late_resume */
|
||||
rtw_set_do_late_resume(pwrpriv, _TRUE);
|
||||
} else {
|
||||
rtw_resume_lock_suspend();
|
||||
ret = rtw_resume_process(padapter);
|
||||
rtw_resume_unlock_suspend();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
pmlmeext->last_scan_time = rtw_get_current_time();
|
||||
@@ -1127,124 +1069,6 @@ static int rtw_resume(struct usb_interface *pusb_intf)
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef CONFIG_AUTOSUSPEND
|
||||
void autosuspend_enter(_adapter *padapter)
|
||||
{
|
||||
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
|
||||
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj);
|
||||
|
||||
RTW_INFO("==>autosuspend_enter...........\n");
|
||||
|
||||
pwrpriv->bInternalAutoSuspend = _TRUE;
|
||||
pwrpriv->bips_processing = _TRUE;
|
||||
|
||||
if (rf_off == pwrpriv->change_rfpwrstate) {
|
||||
#ifndef CONFIG_BT_COEXIST
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
usb_enable_autosuspend(dvobj->pusbdev);
|
||||
#else
|
||||
dvobj->pusbdev->autosuspend_disabled = 0;/* autosuspend disabled by the user */
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33))
|
||||
usb_autopm_put_interface(dvobj->pusbintf);
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))
|
||||
usb_autopm_enable(dvobj->pusbintf);
|
||||
#else
|
||||
usb_autosuspend_device(dvobj->pusbdev, 1);
|
||||
#endif
|
||||
#else /* #ifndef CONFIG_BT_COEXIST */
|
||||
if (1 == pwrpriv->autopm_cnt) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
usb_enable_autosuspend(dvobj->pusbdev);
|
||||
#else
|
||||
dvobj->pusbdev->autosuspend_disabled = 0;/* autosuspend disabled by the user */
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33))
|
||||
usb_autopm_put_interface(dvobj->pusbintf);
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))
|
||||
usb_autopm_enable(dvobj->pusbintf);
|
||||
#else
|
||||
usb_autosuspend_device(dvobj->pusbdev, 1);
|
||||
#endif
|
||||
pwrpriv->autopm_cnt--;
|
||||
} else
|
||||
RTW_INFO("0!=pwrpriv->autopm_cnt[%d] didn't usb_autopm_put_interface\n", pwrpriv->autopm_cnt);
|
||||
|
||||
#endif /* #ifndef CONFIG_BT_COEXIST */
|
||||
}
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
RTW_INFO("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
|
||||
#else
|
||||
RTW_INFO("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int autoresume_enter(_adapter *padapter)
|
||||
{
|
||||
int result = _SUCCESS;
|
||||
struct security_priv *psecuritypriv = &(padapter->securitypriv);
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
|
||||
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj);
|
||||
|
||||
RTW_INFO("====> autoresume_enter\n");
|
||||
|
||||
if (rf_off == pwrpriv->rf_pwrstate) {
|
||||
pwrpriv->ps_flag = _FALSE;
|
||||
#ifndef CONFIG_BT_COEXIST
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33))
|
||||
if (usb_autopm_get_interface(dvobj->pusbintf) < 0) {
|
||||
RTW_INFO("can't get autopm: %d\n", result);
|
||||
result = _FAIL;
|
||||
goto error_exit;
|
||||
}
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))
|
||||
usb_autopm_disable(dvobj->pusbintf);
|
||||
#else
|
||||
usb_autoresume_device(dvobj->pusbdev, 1);
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
RTW_INFO("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
|
||||
#else
|
||||
RTW_INFO("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt);
|
||||
#endif
|
||||
#else /* #ifndef CONFIG_BT_COEXIST */
|
||||
pwrpriv->bAutoResume = _TRUE;
|
||||
if (0 == pwrpriv->autopm_cnt) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33))
|
||||
if (usb_autopm_get_interface(dvobj->pusbintf) < 0) {
|
||||
RTW_INFO("can't get autopm: %d\n", result);
|
||||
result = _FAIL;
|
||||
goto error_exit;
|
||||
}
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))
|
||||
usb_autopm_disable(dvobj->pusbintf);
|
||||
#else
|
||||
usb_autoresume_device(dvobj->pusbdev, 1);
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
RTW_INFO("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
|
||||
#else
|
||||
RTW_INFO("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt);
|
||||
#endif
|
||||
pwrpriv->autopm_cnt++;
|
||||
} else
|
||||
RTW_INFO("0!=pwrpriv->autopm_cnt[%d] didn't usb_autopm_get_interface\n", pwrpriv->autopm_cnt);
|
||||
#endif /* #ifndef CONFIG_BT_COEXIST */
|
||||
}
|
||||
RTW_INFO("<==== autoresume_enter\n");
|
||||
error_exit:
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PLATFORM_RTD2880B
|
||||
extern void rtd2885_wlan_netlink_sendMsg(char *action_string, char *name);
|
||||
#endif
|
||||
@@ -1327,33 +1151,6 @@ _adapter *rtw_usb_primary_adapter_init(struct dvobj_priv *dvobj,
|
||||
RTW_INFO("pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n", device_may_wakeup(&pusb_intf->dev));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AUTOSUSPEND
|
||||
if (padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) {
|
||||
if (padapter->registrypriv.usbss_enable) { /* autosuspend (2s delay) */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38))
|
||||
dvobj->pusbdev->dev.power.autosuspend_delay = 0 * HZ;/* 15 * HZ; idle-delay time */
|
||||
#else
|
||||
dvobj->pusbdev->autosuspend_delay = 0 * HZ;/* 15 * HZ; idle-delay time */
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
usb_enable_autosuspend(dvobj->pusbdev);
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34))
|
||||
padapter->bDisableAutosuspend = dvobj->pusbdev->autosuspend_disabled ;
|
||||
dvobj->pusbdev->autosuspend_disabled = 0;/* autosuspend disabled by the user */
|
||||
#endif
|
||||
|
||||
/* usb_autopm_get_interface(adapter_to_dvobj(padapter)->pusbintf ); */ /* init pm_usage_cnt ,let it start from 1 */
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
RTW_INFO("%s...pm_usage_cnt(%d).....\n", __FUNCTION__, atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
|
||||
#else
|
||||
RTW_INFO("%s...pm_usage_cnt(%d).....\n", __FUNCTION__, dvobj->pusbintf->pm_usage_cnt);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* 2012-07-11 Move here to prevent the 8723AS-VAU BT auto suspend influence */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33))
|
||||
@@ -1406,7 +1203,7 @@ static void rtw_usb_primary_adapter_deinit(_adapter *padapter)
|
||||
|
||||
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED))
|
||||
if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE))
|
||||
rtw_disassoc_cmd(padapter, 0, RTW_CMDF_DIRECTLY);
|
||||
|
||||
#ifdef CONFIG_AP_MODE
|
||||
@@ -1641,6 +1438,10 @@ static int __init rtw_drv_entry(void)
|
||||
usb_drv.drv_registered = _TRUE;
|
||||
rtw_suspend_lock_init();
|
||||
rtw_drv_proc_init();
|
||||
rtw_nlrtw_init();
|
||||
#ifdef CONFIG_PLATFORM_CMAP_INTFS
|
||||
cmap_intfs_init();
|
||||
#endif
|
||||
rtw_ndev_notifier_register();
|
||||
rtw_inetaddr_notifier_register();
|
||||
|
||||
@@ -1650,6 +1451,10 @@ static int __init rtw_drv_entry(void)
|
||||
usb_drv.drv_registered = _FALSE;
|
||||
rtw_suspend_lock_uninit();
|
||||
rtw_drv_proc_deinit();
|
||||
rtw_nlrtw_deinit();
|
||||
#ifdef CONFIG_PLATFORM_CMAP_INTFS
|
||||
cmap_intfs_deinit();
|
||||
#endif
|
||||
rtw_ndev_notifier_unregister();
|
||||
rtw_inetaddr_notifier_unregister();
|
||||
goto exit;
|
||||
@@ -1672,6 +1477,10 @@ static void __exit rtw_drv_halt(void)
|
||||
|
||||
rtw_suspend_lock_uninit();
|
||||
rtw_drv_proc_deinit();
|
||||
rtw_nlrtw_deinit();
|
||||
#ifdef CONFIG_PLATFORM_CMAP_INTFS
|
||||
cmap_intfs_deinit();
|
||||
#endif
|
||||
rtw_ndev_notifier_unregister();
|
||||
rtw_inetaddr_notifier_unregister();
|
||||
|
||||
|
||||
@@ -410,11 +410,12 @@ void usb_read_port_cancel(struct intf_hdl *pintfhdl)
|
||||
int i;
|
||||
struct recv_buf *precvbuf;
|
||||
_adapter *padapter = pintfhdl->padapter;
|
||||
struct registry_priv *regsty = adapter_to_regsty(padapter);
|
||||
precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf;
|
||||
|
||||
RTW_INFO("%s\n", __func__);
|
||||
|
||||
for (i = 0; i < NR_RECVBUFF ; i++) {
|
||||
for (i = 0; i < regsty->recvbuf_nr ; i++) {
|
||||
|
||||
if (precvbuf->purb) {
|
||||
/* RTW_INFO("usb_read_port_cancel : usb_kill_urb\n"); */
|
||||
|
||||
@@ -16,13 +16,10 @@
|
||||
#include <drv_types.h>
|
||||
|
||||
#ifdef CONFIG_IOCTL_CFG80211
|
||||
void rtw_regd_apply_flags(struct wiphy *wiphy)
|
||||
static void rtw_regd_overide_flags(struct wiphy *wiphy, struct rf_ctl_t *rfctl)
|
||||
{
|
||||
struct dvobj_priv *dvobj = wiphy_to_dvobj(wiphy);
|
||||
struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj);
|
||||
RT_CHANNEL_INFO *channel_set = rfctl->channel_set;
|
||||
u8 max_chan_nums = rfctl->max_chan_nums;
|
||||
|
||||
struct ieee80211_supported_band *sband;
|
||||
struct ieee80211_channel *ch;
|
||||
unsigned int i, j;
|
||||
@@ -47,13 +44,15 @@ void rtw_regd_apply_flags(struct wiphy *wiphy)
|
||||
channel = channel_set[i].ChannelNum;
|
||||
freq = rtw_ch2freq(channel);
|
||||
ch = ieee80211_get_channel(wiphy, freq);
|
||||
if (!ch)
|
||||
if (!ch) {
|
||||
rtw_warn_on(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* enable */
|
||||
ch->flags = 0;
|
||||
|
||||
if (channel_set[i].dfs) {
|
||||
if (channel_set[i].flags & RTW_CHF_DFS) {
|
||||
/*
|
||||
* before integrating with nl80211 flow
|
||||
* bypass IEEE80211_CHAN_RADAR when configured with radar detection
|
||||
@@ -63,7 +62,7 @@ void rtw_regd_apply_flags(struct wiphy *wiphy)
|
||||
ch->flags |= IEEE80211_CHAN_RADAR;
|
||||
}
|
||||
|
||||
if (channel_set[i].ScanType == SCAN_PASSIVE) {
|
||||
if (channel_set[i].flags & RTW_CHF_NO_IR) {
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
||||
ch->flags |= IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN;
|
||||
#else
|
||||
@@ -73,26 +72,313 @@ void rtw_regd_apply_flags(struct wiphy *wiphy)
|
||||
}
|
||||
}
|
||||
|
||||
static void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
|
||||
#ifdef CONFIG_REGD_SRC_FROM_OS
|
||||
static void rtw_regd_apply_dfs_flags(struct rf_ctl_t *rfctl)
|
||||
{
|
||||
switch (request->initiator) {
|
||||
case NL80211_REGDOM_SET_BY_DRIVER:
|
||||
RTW_INFO("%s: %s\n", __func__, "NL80211_REGDOM_SET_BY_DRIVER");
|
||||
break;
|
||||
case NL80211_REGDOM_SET_BY_CORE:
|
||||
RTW_INFO("%s: %s\n", __func__, "NL80211_REGDOM_SET_BY_CORE");
|
||||
break;
|
||||
case NL80211_REGDOM_SET_BY_USER:
|
||||
RTW_INFO("%s: %s alpha2:%c%c\n", __func__, "NL80211_REGDOM_SET_BY_USER"
|
||||
, request->alpha2[0], request->alpha2[1]);
|
||||
rtw_set_country(wiphy_to_adapter(wiphy), request->alpha2);
|
||||
break;
|
||||
case NL80211_REGDOM_SET_BY_COUNTRY_IE:
|
||||
RTW_INFO("%s: %s\n", __func__, "NL80211_REGDOM_SET_BY_COUNTRY_IE");
|
||||
break;
|
||||
RT_CHANNEL_INFO *channel_set = rfctl->channel_set;
|
||||
u8 max_chan_nums = rfctl->max_chan_nums;
|
||||
unsigned int i;
|
||||
struct ieee80211_channel *chan;
|
||||
|
||||
/* channels apply by channel plans. */
|
||||
for (i = 0; i < max_chan_nums; i++) {
|
||||
chan = channel_set[i].os_chan;
|
||||
if (channel_set[i].flags & RTW_CHF_DFS) {
|
||||
/*
|
||||
* before integrating with nl80211 flow
|
||||
* clear IEEE80211_CHAN_RADAR when configured with radar detection
|
||||
* to prevent from hostapd blocking DFS channels
|
||||
*/
|
||||
if (!rtw_rfctl_dfs_domain_unknown(rfctl))
|
||||
chan->flags &= ~IEEE80211_CHAN_RADAR;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void rtw_regd_apply_flags(struct wiphy *wiphy)
|
||||
{
|
||||
struct dvobj_priv *dvobj = wiphy_to_dvobj(wiphy);
|
||||
struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj);
|
||||
|
||||
if (rfctl->regd_src == REGD_SRC_RTK_PRIV)
|
||||
rtw_regd_overide_flags(wiphy, rfctl);
|
||||
#ifdef CONFIG_REGD_SRC_FROM_OS
|
||||
else if (rfctl->regd_src == REGD_SRC_OS)
|
||||
rtw_regd_apply_dfs_flags(rfctl);
|
||||
#endif
|
||||
else
|
||||
rtw_warn_on(1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_REGD_SRC_FROM_OS
|
||||
/* init_channel_set_from_wiphy */
|
||||
u8 rtw_os_init_channel_set(_adapter *padapter, RT_CHANNEL_INFO *channel_set)
|
||||
{
|
||||
struct wiphy *wiphy = adapter_to_wiphy(padapter);
|
||||
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
|
||||
struct registry_priv *regsty = adapter_to_regsty(padapter);
|
||||
struct ieee80211_channel *chan;
|
||||
u8 chanset_size = 0;
|
||||
int i, j;
|
||||
|
||||
_rtw_memset(channel_set, 0, sizeof(RT_CHANNEL_INFO) * MAX_CHANNEL_NUM);
|
||||
|
||||
for (i = NL80211_BAND_2GHZ; i <= NL80211_BAND_5GHZ; i++) {
|
||||
if (!wiphy->bands[i])
|
||||
continue;
|
||||
for (j = 0; j < wiphy->bands[i]->n_channels; j++) {
|
||||
chan = &wiphy->bands[i]->channels[j];
|
||||
if (chan->flags & IEEE80211_CHAN_DISABLED)
|
||||
continue;
|
||||
if (rtw_regsty_is_excl_chs(regsty, chan->hw_value))
|
||||
continue;
|
||||
|
||||
if (chanset_size >= MAX_CHANNEL_NUM) {
|
||||
RTW_WARN("chset size can't exceed MAX_CHANNEL_NUM(%u)\n", MAX_CHANNEL_NUM);
|
||||
i = NL80211_BAND_5GHZ + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
channel_set[chanset_size].ChannelNum = chan->hw_value;
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
||||
if (chan->flags & (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN))
|
||||
#else
|
||||
if (chan->flags & IEEE80211_CHAN_NO_IR)
|
||||
#endif
|
||||
channel_set[chanset_size].flags |= RTW_CHF_NO_IR;
|
||||
if (chan->flags & IEEE80211_CHAN_RADAR)
|
||||
channel_set[chanset_size].flags |= RTW_CHF_DFS;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
|
||||
if (chan->flags & IEEE80211_CHAN_NO_HT40PLUS)
|
||||
channel_set[chanset_size].flags |= RTW_CHF_NO_HT40U;
|
||||
if (chan->flags & IEEE80211_CHAN_NO_HT40MINUS)
|
||||
channel_set[chanset_size].flags |= RTW_CHF_NO_HT40L;
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0))
|
||||
if (chan->flags & IEEE80211_CHAN_NO_80MHZ)
|
||||
channel_set[chanset_size].flags |= RTW_CHF_NO_80MHZ;
|
||||
if (chan->flags & IEEE80211_CHAN_NO_160MHZ)
|
||||
channel_set[chanset_size].flags |= RTW_CHF_NO_160MHZ;
|
||||
#endif
|
||||
channel_set[chanset_size].os_chan = chan;
|
||||
chanset_size++;
|
||||
}
|
||||
}
|
||||
|
||||
rtw_regd_apply_flags(wiphy);
|
||||
#if CONFIG_IEEE80211_BAND_5GHZ
|
||||
#ifdef CONFIG_DFS_MASTER
|
||||
for (i = 0; i < chanset_size; i++)
|
||||
channel_set[i].non_ocp_end_time = rtw_get_current_time();
|
||||
#endif
|
||||
#endif /* CONFIG_IEEE80211_BAND_5GHZ */
|
||||
|
||||
if (chanset_size)
|
||||
RTW_INFO(FUNC_ADPT_FMT" ch num:%d\n"
|
||||
, FUNC_ADPT_ARG(padapter), chanset_size);
|
||||
else
|
||||
RTW_WARN(FUNC_ADPT_FMT" final chset has no channel\n"
|
||||
, FUNC_ADPT_ARG(padapter));
|
||||
|
||||
return chanset_size;
|
||||
}
|
||||
|
||||
s16 rtw_os_get_total_txpwr_regd_lmt_mbm(_adapter *adapter, u8 cch, enum channel_width bw)
|
||||
{
|
||||
struct wiphy *wiphy = adapter_to_wiphy(adapter);
|
||||
s16 mbm = UNSPECIFIED_MBM;
|
||||
u8 *op_chs;
|
||||
u8 op_ch_num;
|
||||
u8 i;
|
||||
u32 freq;
|
||||
struct ieee80211_channel *ch;
|
||||
|
||||
if (!rtw_get_op_chs_by_cch_bw(cch, bw, &op_chs, &op_ch_num))
|
||||
goto exit;
|
||||
|
||||
for (i = 0; i < op_ch_num; i++) {
|
||||
freq = rtw_ch2freq(op_chs[i]);
|
||||
ch = ieee80211_get_channel(wiphy, freq);
|
||||
if (!ch) {
|
||||
rtw_warn_on(1);
|
||||
continue;
|
||||
}
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
|
||||
mbm = rtw_min(mbm, ch->max_reg_power * MBM_PDBM);
|
||||
#else
|
||||
/* require max_power == 0 (therefore orig_mpwr set to 0) when wiphy registration */
|
||||
mbm = rtw_min(mbm, ch->max_power * MBM_PDBM);
|
||||
#endif
|
||||
}
|
||||
|
||||
exit:
|
||||
return mbm;
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
static enum rtw_dfs_regd nl80211_dfs_regions_to_rtw_dfs_region(enum nl80211_dfs_regions region)
|
||||
{
|
||||
switch (region) {
|
||||
case NL80211_DFS_FCC:
|
||||
return RTW_DFS_REGD_FCC;
|
||||
case NL80211_DFS_ETSI:
|
||||
return RTW_DFS_REGD_ETSI;
|
||||
case NL80211_DFS_JP:
|
||||
return RTW_DFS_REGD_MKK;
|
||||
case NL80211_DFS_UNSET:
|
||||
default:
|
||||
return RTW_DFS_REGD_NONE;
|
||||
}
|
||||
};
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) */
|
||||
#endif /* CONFIG_REGD_SRC_FROM_OS */
|
||||
|
||||
#ifdef CONFIG_RTW_DEBUG
|
||||
static const char *nl80211_reg_initiator_str(enum nl80211_reg_initiator initiator)
|
||||
{
|
||||
switch (initiator) {
|
||||
case NL80211_REGDOM_SET_BY_DRIVER:
|
||||
return "DRIVER";
|
||||
case NL80211_REGDOM_SET_BY_CORE:
|
||||
return "CORE";
|
||||
case NL80211_REGDOM_SET_BY_USER:
|
||||
return "USER";
|
||||
case NL80211_REGDOM_SET_BY_COUNTRY_IE:
|
||||
return "COUNTRY_IE";
|
||||
}
|
||||
rtw_warn_on(1);
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
static const char *nl80211_user_reg_hint_type_str(enum nl80211_user_reg_hint_type type)
|
||||
{
|
||||
switch (type) {
|
||||
case NL80211_USER_REG_HINT_USER:
|
||||
return "USER";
|
||||
case NL80211_USER_REG_HINT_CELL_BASE:
|
||||
return "CELL_BASE";
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
|
||||
case NL80211_USER_REG_HINT_INDOOR:
|
||||
return "INDOOR";
|
||||
#endif
|
||||
}
|
||||
rtw_warn_on(1);
|
||||
return "UNKNOWN";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
static const char *nl80211_dfs_regions_str(enum nl80211_dfs_regions region)
|
||||
{
|
||||
switch (region) {
|
||||
case NL80211_DFS_UNSET:
|
||||
return "UNSET";
|
||||
case NL80211_DFS_FCC:
|
||||
return "FCC";
|
||||
case NL80211_DFS_ETSI:
|
||||
return "ETSI";
|
||||
case NL80211_DFS_JP:
|
||||
return "JP";
|
||||
}
|
||||
rtw_warn_on(1);
|
||||
return "UNKNOWN";
|
||||
};
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) */
|
||||
|
||||
static const char *environment_cap_str(enum environment_cap cap)
|
||||
{
|
||||
switch (cap) {
|
||||
case ENVIRON_ANY:
|
||||
return "ANY";
|
||||
case ENVIRON_INDOOR:
|
||||
return "INDOOR";
|
||||
case ENVIRON_OUTDOOR:
|
||||
return "OUTDOOR";
|
||||
}
|
||||
rtw_warn_on(1);
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
static void dump_requlatory_request(void *sel, struct regulatory_request *request)
|
||||
{
|
||||
u8 alpha2_len;
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0))
|
||||
alpha2_len = 3;
|
||||
#else
|
||||
alpha2_len = 2;
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
RTW_PRINT_SEL(sel, "initiator:%s, wiphy_idx:%d, type:%s\n"
|
||||
, nl80211_reg_initiator_str(request->initiator)
|
||||
, request->wiphy_idx
|
||||
, nl80211_user_reg_hint_type_str(request->user_reg_hint_type));
|
||||
#else
|
||||
RTW_PRINT_SEL(sel, "initiator:%s, wiphy_idx:%d\n"
|
||||
, nl80211_reg_initiator_str(request->initiator)
|
||||
, request->wiphy_idx);
|
||||
#endif
|
||||
|
||||
RTW_PRINT_SEL(sel, "alpha2:%.*s\n", alpha2_len, request->alpha2);
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
RTW_PRINT_SEL(sel, "dfs_region:%s\n", nl80211_dfs_regions_str(request->dfs_region));
|
||||
#endif
|
||||
|
||||
RTW_PRINT_SEL(sel, "intersect:%d\n", request->intersect);
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38))
|
||||
RTW_PRINT_SEL(sel, "processed:%d\n", request->processed);
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36))
|
||||
RTW_PRINT_SEL(sel, "country_ie_checksum:0x%08x\n", request->country_ie_checksum);
|
||||
#endif
|
||||
|
||||
RTW_PRINT_SEL(sel, "country_ie_env:%s\n", environment_cap_str(request->country_ie_env));
|
||||
}
|
||||
#endif /* CONFIG_RTW_DEBUG */
|
||||
|
||||
static void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
|
||||
{
|
||||
struct dvobj_priv *dvobj = wiphy_to_dvobj(wiphy);
|
||||
struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj);
|
||||
struct registry_priv *regsty = dvobj_to_regsty(dvobj);
|
||||
|
||||
#ifdef CONFIG_RTW_DEBUG
|
||||
if (rtw_drv_log_level >= _DRV_INFO_) {
|
||||
RTW_INFO(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(wiphy));
|
||||
dump_requlatory_request(RTW_DBGDUMP, request);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_REGD_SRC_FROM_OS
|
||||
if (REGSTY_REGD_SRC_FROM_OS(regsty)) {
|
||||
enum rtw_dfs_regd dfs_region = RTW_DFS_REGD_NONE;
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
dfs_region = nl80211_dfs_regions_to_rtw_dfs_region(request->dfs_region);
|
||||
#endif
|
||||
|
||||
/* trigger command to sync regulatory form OS */
|
||||
rtw_sync_os_regd_cmd(wiphy_to_adapter(wiphy), RTW_CMDF_WAIT_ACK, request->alpha2, dfs_region);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* use alpha2 as input to select the corresponding channel plan settings defined by Realtek */
|
||||
switch (request->initiator) {
|
||||
case NL80211_REGDOM_SET_BY_DRIVER:
|
||||
break;
|
||||
case NL80211_REGDOM_SET_BY_CORE:
|
||||
break;
|
||||
case NL80211_REGDOM_SET_BY_USER:
|
||||
rtw_set_country(wiphy_to_adapter(wiphy), request->alpha2);
|
||||
break;
|
||||
case NL80211_REGDOM_SET_BY_COUNTRY_IE:
|
||||
break;
|
||||
}
|
||||
|
||||
rtw_regd_apply_flags(wiphy);
|
||||
}
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0))
|
||||
@@ -112,16 +398,16 @@ int rtw_regd_init(struct wiphy *wiphy)
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
||||
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
|
||||
wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY;
|
||||
wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS;
|
||||
#else
|
||||
wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
|
||||
wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG;
|
||||
wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS;
|
||||
#endif
|
||||
|
||||
rtw_regd_apply_flags(wiphy);
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
|
||||
wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#define __WIFI_REGD_H__
|
||||
|
||||
void rtw_regd_apply_flags(struct wiphy *wiphy);
|
||||
#ifdef CONFIG_REGD_SRC_FROM_OS
|
||||
struct _RT_CHANNEL_INFO;
|
||||
u8 rtw_os_init_channel_set(_adapter *padapter, struct _RT_CHANNEL_INFO *channel_set);
|
||||
s16 rtw_os_get_total_txpwr_regd_lmt_mbm(_adapter *adapter, u8 cch, enum channel_width bw);
|
||||
#endif
|
||||
int rtw_regd_init(struct wiphy *wiphy);
|
||||
|
||||
#endif /* __WIFI_REGD_H__ */
|
||||
|
||||
@@ -199,13 +199,13 @@ void dump_os_queue(void *sel, _adapter *padapter)
|
||||
|
||||
#define WMM_XMIT_THRESHOLD (NR_XMITFRAME*2/5)
|
||||
|
||||
static inline bool rtw_os_need_wake_queue(_adapter *padapter, u16 qidx)
|
||||
static inline bool rtw_os_need_wake_queue(_adapter *padapter, u16 os_qid)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
if (padapter->registrypriv.wifi_spec) {
|
||||
if (pxmitpriv->hwxmits[qidx].accnt < WMM_XMIT_THRESHOLD)
|
||||
if (pxmitpriv->hwxmits[os_qid].accnt < WMM_XMIT_THRESHOLD)
|
||||
return _TRUE;
|
||||
#ifdef DBG_CONFIG_ERROR_DETECT
|
||||
#ifdef DBG_CONFIG_ERROR_RESET
|
||||
@@ -236,13 +236,13 @@ static inline bool rtw_os_need_wake_queue(_adapter *padapter, u16 qidx)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool rtw_os_need_stop_queue(_adapter *padapter, u16 qidx)
|
||||
static inline bool rtw_os_need_stop_queue(_adapter *padapter, u16 os_qid)
|
||||
{
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
if (padapter->registrypriv.wifi_spec) {
|
||||
/* No free space for Tx, tx_worker is too slow */
|
||||
if (pxmitpriv->hwxmits[qidx].accnt > WMM_XMIT_THRESHOLD)
|
||||
if (pxmitpriv->hwxmits[os_qid].accnt > WMM_XMIT_THRESHOLD)
|
||||
return _TRUE;
|
||||
} else {
|
||||
if (pxmitpriv->free_xmitframe_cnt <= 4)
|
||||
@@ -257,23 +257,6 @@ static inline bool rtw_os_need_stop_queue(_adapter *padapter, u16 qidx)
|
||||
|
||||
void rtw_os_pkt_complete(_adapter *padapter, _pkt *pkt)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
u16 qidx;
|
||||
|
||||
qidx = skb_get_queue_mapping(pkt);
|
||||
if (rtw_os_need_wake_queue(padapter, qidx)) {
|
||||
if (DBG_DUMP_OS_QUEUE_CTL)
|
||||
RTW_INFO(FUNC_ADPT_FMT": netif_wake_subqueue[%d]\n", FUNC_ADPT_ARG(padapter), qidx);
|
||||
netif_wake_subqueue(padapter->pnetdev, qidx);
|
||||
}
|
||||
#else
|
||||
if (rtw_os_need_wake_queue(padapter, 0)) {
|
||||
if (DBG_DUMP_OS_QUEUE_CTL)
|
||||
RTW_INFO(FUNC_ADPT_FMT": netif_wake_queue\n", FUNC_ADPT_ARG(padapter));
|
||||
netif_wake_queue(padapter->pnetdev);
|
||||
}
|
||||
#endif
|
||||
|
||||
rtw_skb_free(pkt);
|
||||
}
|
||||
|
||||
@@ -323,24 +306,39 @@ void rtw_os_xmit_schedule(_adapter *padapter)
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool rtw_check_xmit_resource(_adapter *padapter, _pkt *pkt)
|
||||
void rtw_os_check_wakup_queue(_adapter *adapter, u16 os_qid)
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
if (rtw_os_need_wake_queue(adapter, os_qid)) {
|
||||
if (DBG_DUMP_OS_QUEUE_CTL)
|
||||
RTW_INFO(FUNC_ADPT_FMT": netif_wake_subqueue[%d]\n", FUNC_ADPT_ARG(adapter), os_qid);
|
||||
netif_wake_subqueue(adapter->pnetdev, os_qid);
|
||||
}
|
||||
#else
|
||||
if (rtw_os_need_wake_queue(adapter, 0)) {
|
||||
if (DBG_DUMP_OS_QUEUE_CTL)
|
||||
RTW_INFO(FUNC_ADPT_FMT": netif_wake_queue\n", FUNC_ADPT_ARG(adapter));
|
||||
netif_wake_queue(adapter->pnetdev);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool rtw_os_check_stop_queue(_adapter *adapter, u16 os_qid)
|
||||
{
|
||||
bool busy = _FALSE;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
u16 qidx;
|
||||
|
||||
qidx = skb_get_queue_mapping(pkt);
|
||||
if (rtw_os_need_stop_queue(padapter, qidx)) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
if (rtw_os_need_stop_queue(adapter, os_qid)) {
|
||||
if (DBG_DUMP_OS_QUEUE_CTL)
|
||||
RTW_INFO(FUNC_ADPT_FMT": netif_stop_subqueue[%d]\n", FUNC_ADPT_ARG(padapter), qidx);
|
||||
netif_stop_subqueue(padapter->pnetdev, qidx);
|
||||
RTW_INFO(FUNC_ADPT_FMT": netif_stop_subqueue[%d]\n", FUNC_ADPT_ARG(adapter), os_qid);
|
||||
netif_stop_subqueue(adapter->pnetdev, os_qid);
|
||||
busy = _TRUE;
|
||||
}
|
||||
#else
|
||||
if (rtw_os_need_stop_queue(padapter, 0)) {
|
||||
if (rtw_os_need_stop_queue(adapter, 0)) {
|
||||
if (DBG_DUMP_OS_QUEUE_CTL)
|
||||
RTW_INFO(FUNC_ADPT_FMT": netif_stop_queue\n", FUNC_ADPT_ARG(padapter));
|
||||
rtw_netif_stop_queue(padapter->pnetdev);
|
||||
RTW_INFO(FUNC_ADPT_FMT": netif_stop_queue\n", FUNC_ADPT_ARG(adapter));
|
||||
rtw_netif_stop_queue(adapter->pnetdev);
|
||||
busy = _TRUE;
|
||||
}
|
||||
#endif
|
||||
@@ -373,97 +371,16 @@ void rtw_os_wake_queue_at_free_stainfo(_adapter *padapter, int *qcnt_freed)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TX_MCAST2UNI
|
||||
int rtw_mlcst2unicst(_adapter *padapter, struct sk_buff *skb)
|
||||
{
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
_irqL irqL;
|
||||
_list *phead, *plist;
|
||||
struct sk_buff *newskb;
|
||||
struct sta_info *psta = NULL;
|
||||
u8 chk_alive_num = 0;
|
||||
char chk_alive_list[NUM_STA];
|
||||
u8 bc_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
u8 null_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
int i;
|
||||
s32 res;
|
||||
|
||||
DBG_COUNTER(padapter->tx_logs.os_tx_m2u);
|
||||
|
||||
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
phead = &pstapriv->asoc_list;
|
||||
plist = get_next(phead);
|
||||
|
||||
/* free sta asoc_queue */
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
|
||||
int stainfo_offset;
|
||||
psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
|
||||
plist = get_next(plist);
|
||||
|
||||
stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
|
||||
if (stainfo_offset_valid(stainfo_offset))
|
||||
chk_alive_list[chk_alive_num++] = stainfo_offset;
|
||||
}
|
||||
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
|
||||
|
||||
for (i = 0; i < chk_alive_num; i++) {
|
||||
psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
|
||||
if (!(psta->state & _FW_LINKED)) {
|
||||
DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_fw_linked);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* avoid come from STA1 and send back STA1 */
|
||||
if (_rtw_memcmp(psta->cmn.mac_addr, &skb->data[6], ETH_ALEN) == _TRUE
|
||||
|| _rtw_memcmp(psta->cmn.mac_addr, null_addr, ETH_ALEN) == _TRUE
|
||||
|| _rtw_memcmp(psta->cmn.mac_addr, bc_addr, ETH_ALEN) == _TRUE
|
||||
) {
|
||||
DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_self);
|
||||
continue;
|
||||
}
|
||||
|
||||
DBG_COUNTER(padapter->tx_logs.os_tx_m2u_entry);
|
||||
|
||||
newskb = rtw_skb_copy(skb);
|
||||
|
||||
if (newskb) {
|
||||
_rtw_memcpy(newskb->data, psta->cmn.mac_addr, ETH_ALEN);
|
||||
res = rtw_xmit(padapter, &newskb);
|
||||
if (res < 0) {
|
||||
DBG_COUNTER(padapter->tx_logs.os_tx_m2u_entry_err_xmit);
|
||||
RTW_INFO("%s()-%d: rtw_xmit() return error! res=%d\n", __FUNCTION__, __LINE__, res);
|
||||
pxmitpriv->tx_drop++;
|
||||
rtw_skb_free(newskb);
|
||||
}
|
||||
} else {
|
||||
DBG_COUNTER(padapter->tx_logs.os_tx_m2u_entry_err_skb);
|
||||
RTW_INFO("%s-%d: rtw_skb_copy() failed!\n", __FUNCTION__, __LINE__);
|
||||
pxmitpriv->tx_drop++;
|
||||
/* rtw_skb_free(skb); */
|
||||
return _FALSE; /* Caller shall tx this multicast frame via normal way. */
|
||||
}
|
||||
}
|
||||
|
||||
rtw_skb_free(skb);
|
||||
return _TRUE;
|
||||
}
|
||||
#endif /* CONFIG_TX_MCAST2UNI */
|
||||
|
||||
|
||||
int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
|
||||
{
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev);
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
#ifdef CONFIG_TX_MCAST2UNI
|
||||
extern int rtw_mc2u_disable;
|
||||
#endif /* CONFIG_TX_MCAST2UNI */
|
||||
#ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
|
||||
struct sk_buff *skb = pkt;
|
||||
struct sk_buff *segs, *nskb;
|
||||
netdev_features_t features = padapter->pnetdev->features;
|
||||
#endif
|
||||
u16 os_qid = 0;
|
||||
s32 res = 0;
|
||||
|
||||
if (padapter->registrypriv.mp_mode) {
|
||||
@@ -472,7 +389,11 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
|
||||
}
|
||||
DBG_COUNTER(padapter->tx_logs.os_tx);
|
||||
|
||||
if (rtw_if_up(padapter) == _FALSE) {
|
||||
if ((rtw_if_up(padapter) == _FALSE)
|
||||
#ifdef CONFIG_LAYER2_ROAMING
|
||||
&&(!padapter->mlmepriv.roam_network)
|
||||
#endif
|
||||
){
|
||||
DBG_COUNTER(padapter->tx_logs.os_tx_err_up);
|
||||
#ifdef DBG_TX_DROP_FRAME
|
||||
RTW_INFO("DBG_TX_DROP_FRAME %s if_up fail\n", __FUNCTION__);
|
||||
@@ -480,30 +401,9 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
|
||||
goto drop_packet;
|
||||
}
|
||||
|
||||
rtw_check_xmit_resource(padapter, pkt);
|
||||
|
||||
#ifdef CONFIG_TX_MCAST2UNI
|
||||
if (!rtw_mc2u_disable
|
||||
&& MLME_IS_AP(padapter)
|
||||
&& (IP_MCAST_MAC(pkt->data)
|
||||
|| ICMPV6_MCAST_MAC(pkt->data)
|
||||
#ifdef CONFIG_TX_BCAST2UNI
|
||||
|| is_broadcast_mac_addr(pkt->data)
|
||||
#endif
|
||||
)
|
||||
&& (padapter->registrypriv.wifi_spec == 0)
|
||||
) {
|
||||
if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME / 4)) {
|
||||
res = rtw_mlcst2unicst(padapter, pkt);
|
||||
if (res == _TRUE)
|
||||
goto exit;
|
||||
} else {
|
||||
/* RTW_INFO("Stop M2U(%d, %d)! ", pxmitpriv->free_xmitframe_cnt, pxmitpriv->free_xmitbuf_cnt); */
|
||||
/* RTW_INFO("!m2u ); */
|
||||
DBG_COUNTER(padapter->tx_logs.os_tx_m2u_stop);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_TX_MCAST2UNI */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
os_qid = skb_get_queue_mapping(pkt);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
|
||||
if (skb_shinfo(skb)->gso_size) {
|
||||
@@ -518,7 +418,7 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
|
||||
segs = segs->next;
|
||||
nskb->next = NULL;
|
||||
rtw_mstat_update( MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, nskb->truesize);
|
||||
res = rtw_xmit(padapter, &nskb);
|
||||
res = rtw_xmit(padapter, &nskb, os_qid);
|
||||
if (res < 0) {
|
||||
#ifdef DBG_TX_DROP_FRAME
|
||||
RTW_INFO("DBG_TX_DROP_FRAME %s rtw_xmit fail\n", __FUNCTION__);
|
||||
@@ -532,7 +432,7 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
|
||||
}
|
||||
#endif
|
||||
|
||||
res = rtw_xmit(padapter, &pkt);
|
||||
res = rtw_xmit(padapter, &pkt, os_qid);
|
||||
if (res < 0) {
|
||||
#ifdef DBG_TX_DROP_FRAME
|
||||
RTW_INFO("DBG_TX_DROP_FRAME %s rtw_xmit fail\n", __FUNCTION__);
|
||||
@@ -614,11 +514,11 @@ fail:
|
||||
}
|
||||
#endif
|
||||
|
||||
inline netdev_tx_t rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev)
|
||||
int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
|
||||
{
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev);
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
netdev_tx_t ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (pkt) {
|
||||
#ifdef CONFIG_CUSTOMER_ALIBABA_GENERAL
|
||||
|
||||
Reference in New Issue
Block a user