rtl8188eu: Backport kernel version

This driver was added to the kernel with version 3.12. The changes in that
version are now brought back to the GitHub repo. Essentually all of the code
is updated.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-10-19 12:45:47 -05:00
parent 868a407435
commit 19db43ecbd
89 changed files with 2026 additions and 5957 deletions

File diff suppressed because it is too large Load diff

View file

@ -88,14 +88,14 @@ void rtw_reset_securitypriv(struct adapter *adapter)
/* Backup the btkip_countermeasure information. */
/* When the countermeasure is trigger, the driver have to disconnect with AP for 60 seconds. */
_rtw_memset(&backup_pmkid[0], 0x00, sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
_rtw_memcpy(&backup_pmkid[0], &adapter->securitypriv.PMKIDList[0], sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
memcpy(&backup_pmkid[0], &adapter->securitypriv.PMKIDList[0], sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
backup_index = adapter->securitypriv.PMKIDIndex;
backup_counter = adapter->securitypriv.btkip_countermeasure;
backup_time = adapter->securitypriv.btkip_countermeasure_time;
_rtw_memset((unsigned char *)&adapter->securitypriv, 0, sizeof(struct security_priv));
/* Restore the PMK information to securitypriv structure for the following connection. */
_rtw_memcpy(&adapter->securitypriv.PMKIDList[0],
memcpy(&adapter->securitypriv.PMKIDList[0],
&backup_pmkid[0],
sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
adapter->securitypriv.PMKIDIndex = backup_index;
@ -155,8 +155,7 @@ _func_enter_;
wrqu.data.length = (wrqu.data.length < IW_CUSTOM_MAX) ?
wrqu.data.length : IW_CUSTOM_MAX;
wireless_send_event(adapter->pnetdev, IWEVCUSTOM, &wrqu, buff);
if (buff)
rtw_mfree(buff, IW_CUSTOM_MAX);
kfree(buff);
}
exit:
_func_exit_;
@ -194,7 +193,7 @@ void init_mlme_ext_timer(struct adapter *padapter)
_init_timer(&pmlmeext->link_timer, padapter->pnetdev, _link_timer_hdl, padapter);
}
#ifdef CONFIG_AP_MODE
#ifdef CONFIG_88EU_AP_MODE
void rtw_indicate_sta_assoc_event(struct adapter *padapter, struct sta_info *psta)
{
@ -213,7 +212,7 @@ void rtw_indicate_sta_assoc_event(struct adapter *padapter, struct sta_info *pst
wrqu.addr.sa_family = ARPHRD_ETHER;
_rtw_memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN);
memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN);
DBG_88E("+rtw_indicate_sta_assoc_event\n");
@ -237,7 +236,7 @@ void rtw_indicate_sta_disassoc_event(struct adapter *padapter, struct sta_info *
wrqu.addr.sa_family = ARPHRD_ETHER;
_rtw_memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN);
memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN);
DBG_88E("+rtw_indicate_sta_disassoc_event\n");

View file

@ -35,6 +35,10 @@ MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Realtek Wireless Lan Driver");
MODULE_AUTHOR("Realtek Semiconductor Corp.");
MODULE_VERSION(DRIVERVERSION);
MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin");
#define CONFIG_BR_EXT_BRNAME "br0"
#define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */
/* module param defaults */
static int rtw_chip_version = 0x00;
@ -93,14 +97,6 @@ static int rtw_rf_config = RF_819X_MAX_TYPE; /* auto */
static int rtw_low_power;
static int rtw_wifi_spec;
static int rtw_channel_plan = RT_CHANNEL_DOMAIN_MAX;
#ifdef CONFIG_BT_COEXIST
int rtw_btcoex_enable = 1;
int rtw_bt_iso = 2;/* 0:Low, 1:High, 2:From Efuse */
int rtw_bt_sco = 3;/* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter, 4.Busy, 5.OtherBusy */
int rtw_bt_ampdu = 1 ;/* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */
#endif
static int rtw_AcceptAddbaReq = true;/* 0:Reject AP's Add BA req, 1:Accept AP's Add BA req. */
static int rtw_antdiv_cfg = 2; /* 0:OFF , 1:ON, 2:decide by Efuse config */
@ -171,25 +167,12 @@ module_param(rtw_mc2u_disable, int, 0644);
module_param(rtw_80211d, int, 0644);
MODULE_PARM_DESC(rtw_80211d, "Enable 802.11d mechanism");
#ifdef CONFIG_BT_COEXIST
module_param(rtw_btcoex_enable, int, 0644);
MODULE_PARM_DESC(rtw_btcoex_enable, "Enable BT co-existence mechanism");
#endif
static uint rtw_notch_filter = RTW_NOTCH_FILTER;
module_param(rtw_notch_filter, uint, 0644);
MODULE_PARM_DESC(rtw_notch_filter, "0:Disable, 1:Enable, 2:Enable only for P2P");
module_param_named(debug, rtw_debug, int, 0444);
MODULE_PARM_DESC(debug, "Set debug level (1-9) (default 1)");
static char rtw_proc_name[IFNAMSIZ];
static struct proc_dir_entry *rtw_proc;
static int rtw_proc_cnt;
#define RTW_PROC_NAME DRV_NAME
#ifndef create_proc_entry
/* dummy routines */
void rtw_proc_remove_one(struct net_device *dev)
{
@ -199,7 +182,7 @@ void rtw_proc_init_one(struct net_device *dev)
{
}
#else /* create_proc_entry not defined */
#if 0 /* TODO: Convert these to /sys */
void rtw_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *dir_dev = NULL;
@ -208,13 +191,9 @@ void rtw_proc_init_one(struct net_device *dev)
u8 rf_type;
if (rtw_proc == NULL) {
_rtw_memcpy(rtw_proc_name, RTW_PROC_NAME, sizeof(RTW_PROC_NAME));
memcpy(rtw_proc_name, DRV_NAME, sizeof(DRV_NAME));
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
rtw_proc = create_proc_entry(rtw_proc_name, S_IFDIR, proc_net);
#else
rtw_proc = create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net);
#endif
if (rtw_proc == NULL) {
DBG_88E(KERN_ERR "Unable to create rtw_proc directory\n");
return;
@ -235,11 +214,7 @@ void rtw_proc_init_one(struct net_device *dev)
if (dir_dev == NULL) {
if (rtw_proc_cnt == 0) {
if (rtw_proc) {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
remove_proc_entry(rtw_proc_name, proc_net);
#else
remove_proc_entry(rtw_proc_name, init_net.proc_net);
#endif
rtw_proc = NULL;
}
}
@ -406,7 +381,7 @@ void rtw_proc_init_one(struct net_device *dev)
}
}
#ifdef CONFIG_AP_MODE
#ifdef CONFIG_88EU_AP_MODE
entry = create_proc_read_entry("all_sta_info", S_IFREG | S_IRUGO,
dir_dev, proc_get_all_sta_info, dev);
@ -475,15 +450,6 @@ void rtw_proc_init_one(struct net_device *dev)
return;
}
entry->write_proc = proc_set_rssi_disp;
#ifdef CONFIG_BT_COEXIST
entry = create_proc_read_entry("btcoex_dbg", S_IFREG | S_IRUGO,
dir_dev, proc_get_btcoex_dbg, dev);
if (!entry) {
pr_info("Unable to create_proc_read_entry!\n");
return;
}
entry->write_proc = proc_set_btcoex_dbg;
#endif /*CONFIG_BT_COEXIST*/
}
void rtw_proc_remove_one(struct net_device *dev)
@ -520,7 +486,7 @@ void rtw_proc_remove_one(struct net_device *dev)
remove_proc_entry("rf_reg_dump3", dir_dev);
remove_proc_entry("rf_reg_dump4", dir_dev);
}
#ifdef CONFIG_AP_MODE
#ifdef CONFIG_88EU_AP_MODE
remove_proc_entry("all_sta_info", dir_dev);
#endif
@ -532,9 +498,6 @@ void rtw_proc_remove_one(struct net_device *dev)
remove_proc_entry("rx_stbc", dir_dev);
remove_proc_entry("path_rssi", dir_dev);
remove_proc_entry("rssi_disp", dir_dev);
#ifdef CONFIG_BT_COEXIST
remove_proc_entry("btcoex_dbg", dir_dev);
#endif /* CONFIG_BT_COEXIST */
remove_proc_entry(dev->name, rtw_proc);
dir_dev = NULL;
} else {
@ -546,11 +509,7 @@ void rtw_proc_remove_one(struct net_device *dev)
if (rtw_proc) {
remove_proc_entry("ver_info", rtw_proc);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
remove_proc_entry(rtw_proc_name, proc_net);
#else
remove_proc_entry(rtw_proc_name, init_net.proc_net);
#endif
rtw_proc = NULL;
}
}
@ -570,7 +529,7 @@ _func_enter_;
registry_par->lbkmode = (u8)rtw_lbkmode;
registry_par->network_mode = (u8)rtw_network_mode;
_rtw_memcpy(registry_par->ssid.Ssid, "ANY", 3);
memcpy(registry_par->ssid.Ssid, "ANY", 3);
registry_par->ssid.SsidLength = 3;
registry_par->channel = (u8)rtw_channel;
@ -615,12 +574,6 @@ _func_enter_;
registry_par->low_power = (u8)rtw_low_power;
registry_par->wifi_spec = (u8)rtw_wifi_spec;
registry_par->channel_plan = (u8)rtw_channel_plan;
#ifdef CONFIG_BT_COEXIST
registry_par->btcoex = (u8)rtw_btcoex_enable;
registry_par->bt_iso = (u8)rtw_bt_iso;
registry_par->bt_sco = (u8)rtw_bt_sco;
registry_par->bt_ampdu = (u8)rtw_bt_ampdu;
#endif
registry_par->bAcceptAddbaReq = (u8)rtw_AcceptAddbaReq;
registry_par->antdiv_cfg = (u8)rtw_antdiv_cfg;
registry_par->antdiv_type = (u8)rtw_antdiv_type;
@ -646,7 +599,7 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p)
struct sockaddr *addr = p;
if (!padapter->bup)
_rtw_memcpy(padapter->eeprompriv.mac_addr, addr->sa_data, ETH_ALEN);
memcpy(padapter->eeprompriv.mac_addr, addr->sa_data, ETH_ALEN);
return 0;
}
@ -666,7 +619,6 @@ static struct net_device_stats *rtw_net_get_stats(struct net_device *pnetdev)
return &padapter->stats;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
/*
* AC to queue mapping
*
@ -722,7 +674,7 @@ u16 rtw_recv_select_queue(struct sk_buff *skb)
u32 priority;
u8 *pdata = skb->data;
_rtw_memcpy(&eth_type, pdata+(ETH_ALEN<<1), 2);
memcpy(&eth_type, pdata+(ETH_ALEN<<1), 2);
switch (eth_type) {
case htons(ETH_P_IP):
@ -737,26 +689,18 @@ u16 rtw_recv_select_queue(struct sk_buff *skb)
return rtw_1d_to_queue[priority];
}
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
static const struct net_device_ops rtw_netdev_ops = {
.ndo_open = netdev_open,
.ndo_stop = netdev_close,
.ndo_start_xmit = rtw_xmit_entry,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
.ndo_select_queue = rtw_select_queue,
#endif
.ndo_set_mac_address = rtw_net_set_mac_address,
.ndo_get_stats = rtw_net_get_stats,
.ndo_do_ioctl = rtw_ioctl,
};
#endif
int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname)
{
struct adapter *padapter = rtw_netdev_priv(pnetdev);
if (dev_alloc_name(pnetdev, ifname) < 0)
RT_TRACE(_module_os_intfs_c_, _drv_err_, ("dev_alloc_name, fail!\n"));
@ -786,26 +730,10 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter)
pnetdev->dev.type = &wlan_type;
padapter = rtw_netdev_priv(pnetdev);
padapter->pnetdev = pnetdev;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
SET_MODULE_OWNER(pnetdev);
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
DBG_88E("register rtw_netdev_ops to netdev_ops\n");
pnetdev->netdev_ops = &rtw_netdev_ops;
#else
pnetdev->open = netdev_open;
pnetdev->stop = netdev_close;
pnetdev->hard_start_xmit = rtw_xmit_entry;
pnetdev->set_mac_address = rtw_net_set_mac_address;
pnetdev->get_stats = rtw_net_get_stats;
pnetdev->do_ioctl = rtw_ioctl;
#endif
pnetdev->watchdog_timeo = HZ*3; /* 3 second timeout */
#ifdef CONFIG_WIRELESS_EXT
pnetdev->wireless_handlers = (struct iw_handler_def *)&rtw_handlers_def;
#endif
/* step 2. */
loadparam(padapter, pnetdev);
@ -886,7 +814,7 @@ static u8 rtw_init_default_value(struct adapter *padapter)
padapter->bWritePortCancel = false;
padapter->bRxRSSIDisplay = 0;
padapter->bNotifyChannelChange = 0;
#ifdef CONFIG_P2P
#ifdef CONFIG_88EU_P2P
padapter->bShowGetP2PState = 1;
#endif
return ret;
@ -951,11 +879,11 @@ _func_enter_;
goto exit;
}
#ifdef CONFIG_P2P
#ifdef CONFIG_88EU_P2P
rtw_init_wifidirect_timers(padapter);
init_wifidirect_info(padapter, P2P_ROLE_DISABLE);
reset_global_wifidirect_info(padapter);
#endif /* CONFIG_P2P */
#endif /* CONFIG_88EU_P2P */
if (init_mlme_ext_priv(padapter) == _FAIL) {
RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init mlme_ext_priv\n"));
@ -1007,14 +935,6 @@ exit:
return ret8;
}
#ifdef CONFIG_WOWLAN
void rtw_cancel_dynamic_chk_timer(struct adapter *padapter)
{
_cancel_timer_ex(&padapter->mlmepriv.dynamic_chk_timer);
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("rtw_cancel_all_timer:cancel dynamic_chk_timer!\n"));
}
#endif
void rtw_cancel_all_timer(struct adapter *padapter)
{
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_cancel_all_timer\n"));
@ -1041,14 +961,12 @@ void rtw_cancel_all_timer(struct adapter *padapter)
u8 rtw_free_drv_sw(struct adapter *padapter)
{
struct net_device *pnetdev = (struct net_device *)padapter->pnetdev;
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("==>rtw_free_drv_sw"));
/* we can call rtw_p2p_enable here, but: */
/* 1. rtw_p2p_enable may have IO operation */
/* 2. rtw_p2p_enable is bundled with wext interface */
#ifdef CONFIG_P2P
#ifdef CONFIG_88EU_P2P
{
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) {
@ -1101,45 +1019,25 @@ void netdev_br_init(struct net_device *netdev)
{
struct adapter *adapter = (struct adapter *)rtw_netdev_priv(netdev);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35))
rcu_read_lock();
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) */
{
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
if (netdev->br_port)
#else /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */
if (rcu_dereference(adapter->pnetdev->rx_handler_data))
#endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */
{
struct net_device *br_netdev;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
br_netdev = dev_get_by_name(CONFIG_BR_EXT_BRNAME);
#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) */
struct net *devnet = NULL;
if (rcu_dereference(adapter->pnetdev->rx_handler_data)) {
struct net_device *br_netdev;
struct net *devnet = NULL;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26))
devnet = netdev->nd_net;
#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)) */
devnet = dev_net(netdev);
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)) */
br_netdev = dev_get_by_name(devnet, CONFIG_BR_EXT_BRNAME);
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) */
if (br_netdev) {
memcpy(adapter->br_mac, br_netdev->dev_addr, ETH_ALEN);
dev_put(br_netdev);
} else {
pr_info("%s()-%d: dev_get_by_name(%s) failed!", __func__, __LINE__, CONFIG_BR_EXT_BRNAME);
}
devnet = dev_net(netdev);
br_netdev = dev_get_by_name(devnet, CONFIG_BR_EXT_BRNAME);
if (br_netdev) {
memcpy(adapter->br_mac, br_netdev->dev_addr, ETH_ALEN);
dev_put(br_netdev);
} else {
pr_info("%s()-%d: dev_get_by_name(%s) failed!",
__func__, __LINE__, CONFIG_BR_EXT_BRNAME);
}
adapter->ethBrExtInfo.addPPPoETag = 1;
}
adapter->ethBrExtInfo.addPPPoETag = 1;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35))
rcu_read_unlock();
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) */
}
int _netdev_open(struct net_device *pnetdev)
@ -1167,7 +1065,7 @@ int _netdev_open(struct net_device *pnetdev)
goto netdev_open_error;
}
pr_info("MAC Address = %pM\n", pnetdev->dev_addr);
pr_info("%sMAC Address = %pM\n", DRIVER_PREFIX, pnetdev->dev_addr);
status = rtw_start_drv_threads(padapter);
if (status == _FAIL) {
@ -1289,8 +1187,6 @@ void rtw_ips_pwr_down(struct adapter *padapter)
void rtw_ips_dev_unload(struct adapter *padapter)
{
struct net_device *pnetdev = (struct net_device *)padapter->pnetdev;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
DBG_88E("====> %s...\n", __func__);
rtw_hal_set_hwreg(padapter, HW_VAR_FIFO_CLEARN_UP, NULL);
@ -1314,7 +1210,7 @@ int pm_netdev_open(struct net_device *pnetdev, u8 bnormal)
return status;
}
static int netdev_close(struct net_device *pnetdev)
int netdev_close(struct net_device *pnetdev)
{
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
@ -1351,9 +1247,9 @@ static int netdev_close(struct net_device *pnetdev)
nat25_db_cleanup(padapter);
#ifdef CONFIG_P2P
#ifdef CONFIG_88EU_P2P
rtw_p2p_enable(padapter, P2P_ROLE_DISABLE);
#endif /* CONFIG_P2P */
#endif /* CONFIG_88EU_P2P */
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - drv_close\n"));
DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup);

View file

@ -93,11 +93,6 @@ u8 *_rtw_zmalloc(u32 sz)
return pbuf;
}
void _rtw_mfree(u8 *pbuf, u32 sz)
{
kfree(pbuf);
}
void *rtw_malloc2d(int h, int w, int size)
{
int j;
@ -116,12 +111,7 @@ void *rtw_malloc2d(int h, int w, int size)
void rtw_mfree2d(void *pbuf, int h, int w, int size)
{
rtw_mfree((u8 *)pbuf, h*sizeof(void *) + w*h*size);
}
void _rtw_memcpy(void *dst, void *src, u32 sz)
{
memcpy(dst, src, sz);
kfree(pbuf);
}
int _rtw_memcmp(void *dst, void *src, u32 sz)
@ -195,18 +185,12 @@ u32 _rtw_down_sema(struct semaphore *sema)
void _rtw_mutex_init(struct mutex *pmutex)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
mutex_init(pmutex);
#else
init_MUTEX(pmutex);
#endif
}
void _rtw_mutex_free(struct mutex *pmutex)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
mutex_destroy(pmutex);
#endif
}
void _rtw_spinlock_init(spinlock_t *plock)
@ -322,12 +306,6 @@ inline void rtw_unlock_suspend(void)
{
}
#ifdef CONFIG_WOWLAN
inline void rtw_lock_suspend_timeout(long timeout)
{
}
#endif /* CONFIG_WOWLAN */
inline void ATOMIC_SET(ATOMIC_T *v, int i)
{
atomic_set(v, i);
@ -592,12 +570,7 @@ struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv,
struct net_device *pnetdev;
struct rtw_netdev_priv_indicator *pnpi;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
pnetdev = alloc_etherdev_mq(sizeof(struct rtw_netdev_priv_indicator),
4);
#else
pnetdev = alloc_etherdev(sizeof(struct rtw_netdev_priv_indicator));
#endif
pnetdev = alloc_etherdev_mq(sizeof(struct rtw_netdev_priv_indicator), 4);
if (!pnetdev)
goto RETURN;
@ -614,12 +587,7 @@ struct net_device *rtw_alloc_etherdev(int sizeof_priv)
struct net_device *pnetdev;
struct rtw_netdev_priv_indicator *pnpi;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
pnetdev = alloc_etherdev_mq(sizeof(struct rtw_netdev_priv_indicator),
4);
#else
pnetdev = alloc_etherdev(sizeof(struct rtw_netdev_priv_indicator));
#endif
pnetdev = alloc_etherdev_mq(sizeof(struct rtw_netdev_priv_indicator), 4);
if (!pnetdev)
goto RETURN;
@ -656,20 +624,15 @@ RETURN:
return;
}
/*
* this function should be called under ioctl (rtnl_lock is accquired) while
* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
*/
int rtw_change_ifname(struct adapter *padapter, const char *ifname)
{
struct net_device *pnetdev;
struct net_device *cur_pnetdev;
struct net_device *cur_pnetdev = padapter->pnetdev;
struct rereg_nd_name_data *rereg_priv;
int ret;
if (!padapter)
goto error;
cur_pnetdev = padapter->pnetdev;
rereg_priv = &padapter->rereg_nd_name_priv;
@ -679,11 +642,9 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname)
rereg_priv->old_pnetdev = NULL;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26))
if (!rtnl_is_locked())
unregister_netdev(cur_pnetdev);
else
#endif
unregister_netdevice(cur_pnetdev);
rtw_proc_remove_one(cur_pnetdev);
@ -700,13 +661,11 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname)
rtw_init_netdev_name(pnetdev, ifname);
_rtw_memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26))
if (!rtnl_is_locked())
ret = register_netdev(pnetdev);
else
#endif
ret = register_netdevice(pnetdev);
if (ret != 0) {
RT_TRACE(_module_hci_intfs_c_, _drv_err_,
@ -732,14 +691,9 @@ u64 rtw_division64(u64 x, u64 y)
void rtw_buf_free(u8 **buf, u32 *buf_len)
{
if (!buf || !buf_len)
return;
if (*buf) {
*buf_len = 0;
_rtw_mfree(*buf, *buf_len);
*buf = NULL;
}
*buf_len = 0;
kfree(*buf);
*buf = NULL;
}
void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len)
@ -758,7 +712,7 @@ void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len)
dup = rtw_malloc(src_len);
if (dup) {
dup_len = src_len;
_rtw_memcpy(dup, src, dup_len);
memcpy(dup, src, dup_len);
}
keep_ori:
@ -771,8 +725,7 @@ keep_ori:
*buf_len = dup_len;
/* free ori */
if (ori && ori_len > 0)
_rtw_mfree(ori, ori_len);
kfree(ori);
}
@ -860,12 +813,3 @@ struct rtw_cbuf *rtw_cbuf_alloc(u32 size)
}
return cbuf;
}
/**
* rtw_cbuf_free - free the given rtw_cbuf
* @cbuf: pointer of struct rtw_cbuf to free
*/
void rtw_cbuf_free(struct rtw_cbuf *cbuf)
{
rtw_mfree((u8 *)cbuf, sizeof(*cbuf) + sizeof(void *)*cbuf->size);
}

View file

@ -55,8 +55,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
struct recv_buf *precvbuf)
{
int res = _SUCCESS;
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
struct usb_device *pusbd = pdvobjpriv->pusbdev;
precvbuf->irp_pending = false;
precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL);
@ -113,7 +111,7 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup)
ev.flags |= IW_MICFAILURE_PAIRWISE;
ev.src_addr.sa_family = ARPHRD_ETHER;
_rtw_memcpy(ev.src_addr.sa_data, &pmlmepriv->assoc_bssid[0], ETH_ALEN);
memcpy(ev.src_addr.sa_data, &pmlmepriv->assoc_bssid[0], ETH_ALEN);
_rtw_memset(&wrqu, 0x00, sizeof(wrqu));
wrqu.data.length = sizeof(ev);
wireless_send_event(padapter->pnetdev, IWEVMICHAELMICFAILURE,
@ -132,7 +130,6 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
struct __queue *pfree_recv_queue;
struct sk_buff *skb;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
void *br_port = NULL;
_func_enter_;
@ -188,9 +185,7 @@ _func_enter_;
pnetdev = (struct net_device *)padapter->pnetdev;
skb->dev = pnetdev;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
skb_set_queue_mapping(skb, rtw_recv_select_queue(skb));
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) */
rtw_xmit_entry(skb, pnetdev);
@ -202,13 +197,9 @@ _func_enter_;
}
}
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
br_port = padapter->pnetdev->br_port;
#else /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */
rcu_read_lock();
br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
rcu_dereference(padapter->pnetdev->rx_handler_data);
rcu_read_unlock();
#endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */
skb->ip_summed = CHECKSUM_NONE;
skb->dev = padapter->pnetdev;
@ -232,8 +223,9 @@ _func_exit_;
_recv_indicatepkt_drop:
/* enqueue back to free_recv_queue */
rtw_free_recvframe(precv_frame, pfree_recv_queue);
/* enqueue back to free_recv_queue */
if (precv_frame)
rtw_free_recvframe(precv_frame, pfree_recv_queue);
_func_exit_;
return _FAIL;
@ -253,7 +245,7 @@ void rtw_os_read_port(struct adapter *padapter, struct recv_buf *precvbuf)
(unsigned char *)precvbuf);
}
void _rtw_reordering_ctrl_timeout_handler(void *func_context)
static void _rtw_reordering_ctrl_timeout_handler(void *func_context)
{
struct recv_reorder_ctrl *preorder_ctrl;

View file

@ -107,12 +107,10 @@ static int rtw_android_get_link_speed(struct net_device *net, char *command,
int total_len)
{
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(net);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct wlan_network *pcur_network = &pmlmepriv->cur_network;
int bytes_written = 0;
u16 link_speed = 0;
int bytes_written;
u16 link_speed;
link_speed = rtw_get_cur_max_rate(padapter)/10;
link_speed = rtw_get_cur_max_rate(padapter) / 10;
bytes_written = snprintf(command, total_len, "LinkSpeed %d",
link_speed);
return bytes_written;
@ -121,8 +119,7 @@ static int rtw_android_get_link_speed(struct net_device *net, char *command,
static int rtw_android_get_macaddr(struct net_device *net, char *command,
int total_len)
{
struct adapter *adapter = (struct adapter *)rtw_netdev_priv(net);
int bytes_written = 0;
int bytes_written;
bytes_written = snprintf(command, total_len, "Macaddr = %pM",
net->dev_addr);
@ -143,39 +140,17 @@ static int android_set_cntry(struct net_device *net, char *command,
static int android_get_p2p_addr(struct net_device *net, char *command,
int total_len)
{
int ret;
int bytes_written = 0;
/* We use the same address as our HW MAC address */
_rtw_memcpy(command, net->dev_addr, ETH_ALEN);
bytes_written = ETH_ALEN;
return bytes_written;
memcpy(command, net->dev_addr, ETH_ALEN);
return ETH_ALEN;
}
static int rtw_android_set_block(struct net_device *net, char *command,
int total_len)
{
int ret;
struct adapter *adapter = (struct adapter *)rtw_netdev_priv(net);
char *block_value = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_BLOCK]) + 1;
return 0;
}
static int get_int_from_command(char *pcmd)
{
int i;
for (i = 0; i < strlen(pcmd); i++) {
if (pcmd[i] == '=') {
/* Skip the '=' and space characters. */
i += 2;
break;
}
}
return rtw_atoi(pcmd + i);
}
int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
{
int ret = 0;

View file

@ -43,61 +43,8 @@ static int rtw_resume(struct usb_interface *intf);
static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid);
static void rtw_dev_remove(struct usb_interface *pusb_intf);
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23))
/* Some useful macros to use to create struct usb_device_id */
#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
#define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
#define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
#define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
#define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400
#define USB_DEVICE_ID_MATCH_INT_INFO \
(USB_DEVICE_ID_MATCH_INT_CLASS | \
USB_DEVICE_ID_MATCH_INT_SUBCLASS | \
USB_DEVICE_ID_MATCH_INT_PROTOCOL)
#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
| USB_DEVICE_ID_MATCH_DEVICE, \
.idVendor = (vend), \
.idProduct = (prod), \
.bInterfaceClass = (cl), \
.bInterfaceSubClass = (sc), \
.bInterfaceProtocol = (pr)
/**
* USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces
* @vend: the 16 bit USB Vendor ID
* @cl: bInterfaceClass value
* @sc: bInterfaceSubClass value
* @pr: bInterfaceProtocol value
*
* This macro is used to create a struct usb_device_id that matches a
* specific vendor with a specific class of interfaces.
*
* This is especially useful when explicitly matching devices that have
* vendor specific bDeviceClass values, but standards-compliant interfaces.
*/
#define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
| USB_DEVICE_ID_MATCH_VENDOR, \
.idVendor = (vend), \
.bInterfaceClass = (cl), \
.bInterfaceSubClass = (sc), \
.bInterfaceProtocol = (pr)
/* ----------------------------------------------------------------------- */
#endif
#define USB_VENDER_ID_REALTEK 0x0BDA
#define USB_VENDER_ID_REALTEK 0x0bda
/* DID_USB_v916_20130116 */
static struct usb_device_id rtw_usb_id_tbl[] = {
@ -124,15 +71,13 @@ struct rtw_usb_drv {
};
static struct rtw_usb_drv rtl8188e_usb_drv = {
.usbdrv.name = (char *)"rtl8188eu",
.usbdrv.name = (char *)"r8188eu",
.usbdrv.probe = rtw_drv_init,
.usbdrv.disconnect = rtw_dev_remove,
.usbdrv.id_table = rtw_usb_id_tbl,
.usbdrv.suspend = rtw_suspend,
.usbdrv.resume = rtw_resume,
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
.usbdrv.reset_resume = rtw_resume,
#endif
};
static struct rtw_usb_drv *usb_drv = &rtl8188e_usb_drv;
@ -198,8 +143,7 @@ static u8 rtw_deinit_intf_priv(struct dvobj_priv *dvobj)
{
u8 rst = _SUCCESS;
if (dvobj->usb_vendor_req_buf)
rtw_mfree(dvobj->usb_alloc_vendor_req_buf, MAX_USB_IO_CTL_SIZE);
kfree(dvobj->usb_alloc_vendor_req_buf);
_rtw_mutex_free(&dvobj->usb_vendor_req_mutex);
return rst;
}
@ -207,7 +151,6 @@ static u8 rtw_deinit_intf_priv(struct dvobj_priv *dvobj)
static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
{
int i;
u8 val8;
int status = _FAIL;
struct dvobj_priv *pdvobjpriv;
struct usb_host_config *phost_conf;
@ -307,7 +250,7 @@ _func_enter_;
free_dvobj:
if (status != _SUCCESS && pdvobjpriv) {
usb_set_intfdata(usb_intf, NULL);
rtw_mfree((u8 *)pdvobjpriv, sizeof(*pdvobjpriv));
kfree(pdvobjpriv);
pdvobjpriv = NULL;
}
exit:
@ -339,7 +282,7 @@ _func_enter_;
}
}
rtw_deinit_intf_priv(dvobj);
rtw_mfree((u8 *)dvobj, sizeof(*dvobj));
kfree(dvobj);
}
usb_put_dev(interface_to_usbdev(usb_intf));
@ -388,8 +331,6 @@ static void usb_intf_stop(struct adapter *padapter)
static void rtw_dev_unload(struct adapter *padapter)
{
struct net_device *pnetdev = (struct net_device *)padapter->pnetdev;
u8 val8;
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_dev_unload\n"));
if (padapter->bup) {
@ -406,21 +347,11 @@ static void rtw_dev_unload(struct adapter *padapter)
/* s5. */
if (!padapter->bSurpriseRemoved) {
#ifdef CONFIG_WOWLAN
if ((padapter->pwrctrlpriv.bSupportRemoteWakeup) &&
(padapter->pwrctrlpriv.wowlan_mode))
DBG_88E("%s bSupportWakeOnWlan == true do not run rtw_hal_deinit()\n",
__func__);
else
#endif /* CONFIG_WOWLAN */
rtw_hal_deinit(padapter);
rtw_hal_deinit(padapter);
padapter->bSurpriseRemoved = true;
}
padapter->bup = false;
#ifdef CONFIG_WOWLAN
padapter->hw_init_completed = false;
#endif /* CONFIG_WOWLAN */
} else {
RT_TRACE(_module_hci_intfs_c_, _drv_err_,
("r871x_dev_unload():padapter->bup == false\n"));
@ -456,7 +387,6 @@ static void process_spec_devid(const struct usb_device_id *pdid)
int rtw_hw_suspend(struct adapter *padapter)
{
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct usb_interface *pusb_intf = adapter_to_dvobj(padapter)->pusbintf;
struct net_device *pnetdev = padapter->pnetdev;
_func_enter_;
@ -523,7 +453,6 @@ error_exit:
int rtw_hw_resume(struct adapter *padapter)
{
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct usb_interface *pusb_intf = adapter_to_dvobj(padapter)->pusbintf;
struct net_device *pnetdev = padapter->pnetdev;
_func_enter_;
@ -573,10 +502,6 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
struct net_device *pnetdev = padapter->pnetdev;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct usb_device *usb_dev = interface_to_usbdev(pusb_intf);
#ifdef CONFIG_WOWLAN
struct wowlan_ioctl_param poidparam;
#endif /* CONFIG_WOWLAN */
int ret = 0;
u32 start_time = rtw_get_current_time();
@ -585,13 +510,6 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
DBG_88E("==> %s (%s:%d)\n", __func__, current->comm, current->pid);
#ifdef CONFIG_WOWLAN
if (check_fwstate(pmlmepriv, _FW_LINKED))
padapter->pwrctrlpriv.wowlan_mode = true;
else
padapter->pwrctrlpriv.wowlan_mode = false;
#endif
if ((!padapter->bup) || (padapter->bDriverStopped) ||
(padapter->bSurpriseRemoved)) {
DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n",
@ -611,20 +529,8 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
rtw_netif_stop_queue(pnetdev);
}
#ifdef CONFIG_WOWLAN
if (padapter->pwrctrlpriv.bSupportRemoteWakeup &&
padapter->pwrctrlpriv.wowlan_mode) {
/* set H2C command */
poidparam.subcode = WOWLAN_ENABLE;
padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN,
(u8 *)&poidparam);
} else
#else
{
/* s2. */
rtw_disassoc_cmd(padapter, 0, false);
}
#endif /* CONFIG_WOWLAN */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) &&
check_fwstate(pmlmepriv, _FW_LINKED)) {
@ -665,7 +571,6 @@ static int rtw_resume(struct usb_interface *pusb_intf)
{
struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
struct adapter *padapter = dvobj->if1;
struct net_device *pnetdev = padapter->pnetdev;
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
int ret = 0;
@ -679,12 +584,9 @@ static int rtw_resume(struct usb_interface *pusb_intf)
int rtw_resume_process(struct adapter *padapter)
{
struct net_device *pnetdev;
struct pwrctrl_priv *pwrpriv;
struct pwrctrl_priv *pwrpriv = NULL;
int ret = -1;
u32 start_time = rtw_get_current_time();
#ifdef CONFIG_BT_COEXIST
u8 pm_cnt;
#endif /* ifdef CONFIG_BT_COEXIST */
_func_enter_;
DBG_88E("==> %s (%s:%d)\n", __func__, current->comm, current->pid);
@ -698,7 +600,8 @@ int rtw_resume_process(struct adapter *padapter)
_enter_pwrlock(&pwrpriv->lock);
rtw_reset_drv_sw(padapter);
pwrpriv->bkeepfwalive = false;
if (pwrpriv)
pwrpriv->bkeepfwalive = false;
DBG_88E("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive);
if (pm_netdev_open(pnetdev, true) != 0)
@ -720,10 +623,11 @@ int rtw_resume_process(struct adapter *padapter)
exit:
if (pwrpriv)
pwrpriv->bInSuspend = false;
DBG_88E("<=== %s return %d.............. in %dms\n", __func__
, ret, rtw_get_passing_time_ms(start_time));
DBG_88E("<=== %s return %d.............. in %dms\n", __func__,
ret, rtw_get_passing_time_ms(start_time));
_func_exit_;
return ret;
}
@ -735,8 +639,6 @@ exit:
* We accept the new device by returning 0.
*/
static struct adapter *rtw_sw_export;
static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
{
@ -793,33 +695,29 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
}
#ifdef CONFIG_PM
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 18))
if (padapter->pwrctrlpriv.bSupportRemoteWakeup) {
dvobj->pusbdev->do_remote_wakeup = 1;
pusb_intf->needs_remote_wakeup = 1;
device_init_wakeup(&pusb_intf->dev, 1);
DBG_88E("\n padapter->pwrctrlpriv.bSupportRemoteWakeup~~~~~~\n");
DBG_88E("\n padapter->pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n", device_may_wakeup(&pusb_intf->dev));
DBG_88E("\n padapter->pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n",
device_may_wakeup(&pusb_intf->dev));
}
#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))
if (usb_autopm_get_interface(pusb_intf) < 0)
DBG_88E("can't get autopm:\n");
#endif
#ifdef CONFIG_BT_COEXIST
padapter->pwrctrlpriv.autopm_cnt = 1;
#endif
/* alloc dev name after read efuse. */
rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname);
rtw_macaddr_cfg(padapter->eeprompriv.mac_addr);
#ifdef CONFIG_88EU_P2P
rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr,
padapter->eeprompriv.mac_addr);
_rtw_memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
#endif
memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
DBG_88E("MAC Address from pnetdev->dev_addr = %pM\n",
pnetdev->dev_addr);
@ -841,7 +739,6 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
free_hal_data:
if (status != _SUCCESS && padapter->HalData)
kfree(padapter->HalData);
free_wdev:
handle_dualmac:
if (status != _SUCCESS)
rtw_handle_dualmac(padapter, 0);
@ -865,7 +762,7 @@ static void rtw_usb_if1_deinit(struct adapter *if1)
if (check_fwstate(pmlmepriv, _FW_LINKED))
rtw_disassoc_cmd(if1, 0, false);
#ifdef CONFIG_AP_MODE
#ifdef CONFIG_88EU_AP_MODE
free_mlme_ap_info(if1);
#endif
@ -878,141 +775,18 @@ static void rtw_usb_if1_deinit(struct adapter *if1)
}
rtw_cancel_all_timer(if1);
#ifdef CONFIG_WOWLAN
if1->pwrctrlpriv.wowlan_mode = false;
#endif /* CONFIG_WOWLAN */
rtw_dev_unload(if1);
DBG_88E("+r871xu_dev_remove, hw_init_completed=%d\n",
if1->hw_init_completed);
rtw_handle_dualmac(if1, 0);
#ifdef CONFIG_BT_COEXIST
if (1 == if1->pwrctrlpriv.autopm_cnt) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33))
usb_autopm_put_interface(adapter_to_dvobj(if1)->pusbintf);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20))
usb_autopm_enable(adapter_to_dvobj(if1)->pusbintf);
#else
usb_autosuspend_device(adapter_to_dvobj(if1)->pusbdev, 1);
#endif
if1->pwrctrlpriv.autopm_cnt--;
}
#endif
rtw_free_drv_sw(if1);
if (pnetdev)
rtw_free_netdev(pnetdev);
}
static void dump_usb_interface(struct usb_interface *usb_intf)
{
int i;
u8 val8;
struct usb_device *udev = interface_to_usbdev(usb_intf);
struct usb_device_descriptor *dev_desc = &udev->descriptor;
struct usb_host_config *act_conf = udev->actconfig;
struct usb_config_descriptor *act_conf_desc = &act_conf->desc;
struct usb_host_interface *host_iface;
struct usb_interface_descriptor *iface_desc;
struct usb_host_endpoint *host_endp;
struct usb_endpoint_descriptor *endp_desc;
/* The usb device this usb interface belongs to */
DBG_88E("usb_interface:%p, usb_device:%p(num:%d, path:%s), usb_device_descriptor:%p\n",
usb_intf, udev, udev->devnum, udev->devpath, dev_desc);
DBG_88E("bLength:%u\n", dev_desc->bLength);
DBG_88E("bDescriptorType:0x%02x\n", dev_desc->bDescriptorType);
DBG_88E("bcdUSB:0x%04x\n", le16_to_cpu(dev_desc->bcdUSB));
DBG_88E("bDeviceClass:0x%02x\n", dev_desc->bDeviceClass);
DBG_88E("bDeviceSubClass:0x%02x\n", dev_desc->bDeviceSubClass);
DBG_88E("bDeviceProtocol:0x%02x\n", dev_desc->bDeviceProtocol);
DBG_88E("bMaxPacketSize0:%u\n", dev_desc->bMaxPacketSize0);
DBG_88E("idVendor:0x%04x\n", le16_to_cpu(dev_desc->idVendor));
DBG_88E("idProduct:0x%04x\n", le16_to_cpu(dev_desc->idProduct));
DBG_88E("bcdDevice:0x%04x\n", le16_to_cpu(dev_desc->bcdDevice));
DBG_88E("iManufacturer:0x02%x\n", dev_desc->iManufacturer);
DBG_88E("iProduct:0x%02x\n", dev_desc->iProduct);
DBG_88E("iSerialNumber:0x%02x\n", dev_desc->iSerialNumber);
DBG_88E("bNumConfigurations:%u\n", dev_desc->bNumConfigurations);
/* The acting usb_config_descriptor */
DBG_88E("\nact_conf_desc:%p\n", act_conf_desc);
DBG_88E("bLength:%u\n", act_conf_desc->bLength);
DBG_88E("bDescriptorType:0x%02x\n", act_conf_desc->bDescriptorType);
DBG_88E("wTotalLength:%u\n", le16_to_cpu(act_conf_desc->wTotalLength));
DBG_88E("bNumInterfaces:%u\n", act_conf_desc->bNumInterfaces);
DBG_88E("bConfigurationValue:0x%02x\n",
act_conf_desc->bConfigurationValue);
DBG_88E("iConfiguration:0x%02x\n", act_conf_desc->iConfiguration);
DBG_88E("bmAttributes:0x%02x\n", act_conf_desc->bmAttributes);
DBG_88E("bMaxPower=%u\n", act_conf_desc->bMaxPower);
DBG_88E("****** num of altsetting = (%d) ******/\n",
usb_intf->num_altsetting);
/* Get he host side alternate settingi
* (the current alternate setting) for this interface*/
host_iface = usb_intf->cur_altsetting;
iface_desc = &host_iface->desc;
/* The current alternate setting*/
DBG_88E("\nusb_interface_descriptor:%p:\n", iface_desc);
DBG_88E("bLength:%u\n", iface_desc->bLength);
DBG_88E("bDescriptorType:0x%02x\n", iface_desc->bDescriptorType);
DBG_88E("bInterfaceNumber:0x%02x\n", iface_desc->bInterfaceNumber);
DBG_88E("bAlternateSetting=%x\n", iface_desc->bAlternateSetting);
DBG_88E("bNumEndpoints=%x\n", iface_desc->bNumEndpoints);
DBG_88E("bInterfaceClass=%x\n", iface_desc->bInterfaceClass);
DBG_88E("bInterfaceSubClass=%x\n", iface_desc->bInterfaceSubClass);
DBG_88E("bInterfaceProtocol=%x\n", iface_desc->bInterfaceProtocol);
DBG_88E("iInterface=%x\n", iface_desc->iInterface);
for (i = 0; i < iface_desc->bNumEndpoints; i++) {
host_endp = host_iface->endpoint + i;
if (host_endp) {
endp_desc = &host_endp->desc;
DBG_88E("\nusb_endpoint_descriptor(%d):\n", i);
DBG_88E("bLength=%x\n", endp_desc->bLength);
DBG_88E("bDescriptorType=%x\n",
endp_desc->bDescriptorType);
DBG_88E("bEndpointAddress=%x\n",
endp_desc->bEndpointAddress);
DBG_88E("bmAttributes=%x\n",
endp_desc->bmAttributes);
DBG_88E("wMaxPacketSize=%x\n",
endp_desc->wMaxPacketSize);
DBG_88E("wMaxPacketSize=%x\n",
le16_to_cpu(endp_desc->wMaxPacketSize));
DBG_88E("bInterval=%x\n", endp_desc->bInterval);
if (RT_usb_endpoint_is_bulk_in(endp_desc))
DBG_88E("RT_usb_endpoint_is_bulk_in = %x\n",
RT_usb_endpoint_num(endp_desc));
else if (usb_endpoint_is_int(endp_desc))
DBG_88E("usb_endpoint_is_int = %x, Interval = %x\n",
RT_usb_endpoint_num(endp_desc),
endp_desc->bInterval);
else if (RT_usb_endpoint_is_bulk_out(endp_desc))
DBG_88E("RT_usb_endpoint_is_bulk_out = %x\n",
RT_usb_endpoint_num(endp_desc));
}
}
if (udev->speed == USB_SPEED_HIGH)
DBG_88E("USB_SPEED_HIGH\n");
else
DBG_88E("NON USB_SPEED_HIGH\n");
}
static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
{
int i;
struct adapter *if1 = NULL, *if2 = NULL;
struct adapter *if1 = NULL;
int status;
struct dvobj_priv *dvobj;
@ -1044,7 +818,6 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device
status = _SUCCESS;
free_if1:
if (status != _SUCCESS && if1)
rtw_usb_if1_deinit(if1);
free_dvobj:
@ -1062,8 +835,6 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf)
{
struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
struct adapter *padapter = dvobj->if1;
struct net_device *pnetdev = padapter->pnetdev;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
_func_enter_;

View file

@ -46,65 +46,6 @@ struct zero_bulkout_context {
void *padapter;
};
static void usb_bulkout_zero_complete(struct urb *purb, struct pt_regs *regs)
{
struct zero_bulkout_context *pcontext = (struct zero_bulkout_context *)purb->context;
if (pcontext) {
if (pcontext->pbuf)
rtw_mfree(pcontext->pbuf, sizeof(int));
if (pcontext->purb && (pcontext->purb == purb))
usb_free_urb(pcontext->purb);
rtw_mfree((u8 *)pcontext, sizeof(struct zero_bulkout_context));
}
}
static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr)
{
int pipe, status, len;
u32 ret;
unsigned char *pbuf;
struct zero_bulkout_context *pcontext;
struct urb *purb = NULL;
struct adapter *padapter = (struct adapter *)pintfhdl->padapter;
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
struct usb_device *pusbd = pdvobj->pusbdev;
if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||
(padapter->pwrctrlpriv.pnp_bstop_trx))
return _FAIL;
pcontext = (struct zero_bulkout_context *)rtw_zmalloc(sizeof(struct zero_bulkout_context));
pbuf = (unsigned char *)rtw_zmalloc(sizeof(int));
purb = usb_alloc_urb(0, GFP_ATOMIC);
len = 0;
pcontext->pbuf = pbuf;
pcontext->purb = purb;
pcontext->pirp = NULL;
pcontext->padapter = padapter;
/* translate DMA FIFO addr to pipehandle */
usb_fill_bulk_urb(purb, pusbd, pipe,
pbuf,
len,
usb_bulkout_zero_complete,
pcontext);/* context is pcontext */
status = usb_submit_urb(purb, GFP_ATOMIC);
if (!status)
ret = _SUCCESS;
else
ret = _FAIL;
return ret;
}
void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
{
}
@ -134,8 +75,6 @@ void usb_read_port_cancel(struct intf_hdl *pintfhdl)
static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs)
{
unsigned long irqL;
int i;
struct xmit_buf *pxmitbuf = (struct xmit_buf *)purb->context;
struct adapter *padapter = pxmitbuf->padapter;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@ -157,7 +96,7 @@ _func_enter_;
pxmitpriv->bkq_cnt--;
break;
case HIGH_QUEUE_INX:
#ifdef CONFIG_AP_MODE
#ifdef CONFIG_88EU_AP_MODE
rtw_chk_hi_queue_cmd(padapter);
#endif
break;
@ -226,7 +165,7 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
unsigned long irqL;
unsigned int pipe;
int status;
u32 ret = _FAIL, bwritezero = false;
u32 ret = _FAIL;
struct urb *purb = NULL;
struct adapter *padapter = (struct adapter *)pintfhdl->padapter;
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
@ -234,7 +173,6 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
struct xmit_buf *pxmitbuf = (struct xmit_buf *)wmem;
struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data;
struct usb_device *pusbd = pdvobj->pusbdev;
struct pkt_attrib *pattrib = &pxmitframe->attrib;
_func_enter_;

View file

@ -19,6 +19,7 @@
******************************************************************************/
#define _XMIT_OSDEP_C_
#include <linux/version.h>
#include <osdep_service.h>
#include <drv_types.h>
@ -92,8 +93,6 @@ void rtw_set_tx_chksum_offload(struct sk_buff *pkt, struct pkt_attrib *pattrib)
int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf, u32 alloc_sz)
{
int i;
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
struct usb_device *pusbd = pdvobjpriv->pusbdev;
pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
if (pxmitbuf->pallocated_buf == NULL)
@ -116,15 +115,11 @@ void rtw_os_xmit_resource_free(struct adapter *padapter,
struct xmit_buf *pxmitbuf, u32 free_sz)
{
int i;
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
struct usb_device *pusbd = pdvobjpriv->pusbdev;
for (i = 0; i < 8; i++)
usb_free_urb(pxmitbuf->pxmit_urb[i]);
if (pxmitbuf->pallocated_buf)
rtw_mfree(pxmitbuf->pallocated_buf, free_sz);
kfree(pxmitbuf->pallocated_buf);
}
#define WMM_XMIT_THRESHOLD (NR_XMITFRAME*2/5)
@ -161,9 +156,7 @@ void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe)
void rtw_os_xmit_schedule(struct adapter *padapter)
{
struct adapter *pri_adapter = padapter;
unsigned long irqL;
unsigned long irql;
struct xmit_priv *pxmitpriv;
if (!padapter)
@ -171,18 +164,17 @@ void rtw_os_xmit_schedule(struct adapter *padapter)
pxmitpriv = &padapter->xmitpriv;
_enter_critical_bh(&pxmitpriv->lock, &irqL);
_enter_critical_bh(&pxmitpriv->lock, &irql);
if (rtw_txframes_pending(padapter))
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
_exit_critical_bh(&pxmitpriv->lock, &irqL);
_exit_critical_bh(&pxmitpriv->lock, &irql);
}
static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pkt)
{
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
u16 queue;
queue = skb_get_queue_mapping(pkt);
@ -196,25 +188,19 @@ static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pk
netif_stop_subqueue(padapter->pnetdev, queue);
}
}
#else
if (pxmitpriv->free_xmitframe_cnt <= 4) {
if (!rtw_netif_queue_stopped(padapter->pnetdev))
rtw_netif_stop_queue(padapter->pnetdev);
}
#endif
}
static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
{
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
unsigned long irqL;
unsigned long irql;
struct list_head *phead, *plist;
struct sk_buff *newskb;
struct sta_info *psta = NULL;
s32 res;
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
_enter_critical_bh(&pstapriv->asoc_list_lock, &irql);
phead = &pstapriv->asoc_list;
plist = get_next(phead);
@ -244,12 +230,12 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
DBG_88E("%s-%d: skb_copy() failed!\n", __func__, __LINE__);
pxmitpriv->tx_drop++;
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
_exit_critical_bh(&pstapriv->asoc_list_lock, &irql);
return false; /* Caller shall tx this multicast frame via normal way. */
}
}
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
_exit_critical_bh(&pstapriv->asoc_list_lock, &irql);
dev_kfree_skb_any(skb);
return true;
}
@ -261,9 +247,6 @@ int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev)
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
s32 res = 0;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
u16 queue;
#endif
_func_enter_;