mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-28 15:13:39 +00:00
rtl8188eu: More sparse cleanups
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
aae7d37e24
commit
61b38d5714
7 changed files with 88 additions and 153 deletions
|
@ -148,6 +148,7 @@ int _rtw_write8(_adapter *adapter, u32 addr, u8 val)
|
|||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_write16(_adapter *adapter, u32 addr, u16 val)
|
||||
{
|
||||
//struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
|
||||
|
@ -155,11 +156,12 @@ int _rtw_write16(_adapter *adapter, u32 addr, u16 val)
|
|||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
|
||||
int ret;
|
||||
__le16 ival;
|
||||
_func_enter_;
|
||||
_write16 = pintfhdl->io_ops._write16;
|
||||
|
||||
val = rtw_cpu_to_le16(val);
|
||||
ret = _write16(pintfhdl, addr, val);
|
||||
ival = rtw_cpu_to_le16(val);
|
||||
ret = _write16(pintfhdl, addr, ival);
|
||||
_func_exit_;
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
|
@ -171,11 +173,12 @@ int _rtw_write32(_adapter *adapter, u32 addr, u32 val)
|
|||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
|
||||
int ret;
|
||||
__le32 ival;
|
||||
_func_enter_;
|
||||
_write32 = pintfhdl->io_ops._write32;
|
||||
|
||||
val = rtw_cpu_to_le32(val);
|
||||
ret = _write32(pintfhdl, addr, val);
|
||||
ival = rtw_cpu_to_le32(val);
|
||||
ret = _write32(pintfhdl, addr, ival);
|
||||
_func_exit_;
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include <drv_types.h>
|
||||
#include "rtw_led.h"
|
||||
|
||||
//
|
||||
// Description:
|
||||
|
@ -139,7 +140,7 @@ void SwLedOff(_adapter *padapter, PLED_871x pLed);
|
|||
|
||||
#define CONFIG_LED_REMOVE_HAL
|
||||
|
||||
void
|
||||
static void
|
||||
SwLedBlink(
|
||||
PLED_871x pLed
|
||||
)
|
||||
|
@ -257,7 +258,7 @@ SwLedBlink(
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SwLedBlink1(
|
||||
PLED_871x pLed
|
||||
)
|
||||
|
@ -469,7 +470,7 @@ SwLedBlink1(
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SwLedBlink2(
|
||||
PLED_871x pLed
|
||||
)
|
||||
|
@ -591,7 +592,7 @@ SwLedBlink2(
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SwLedBlink3(
|
||||
PLED_871x pLed
|
||||
)
|
||||
|
@ -762,7 +763,7 @@ SwLedBlink3(
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
SwLedBlink4(
|
||||
PLED_871x pLed
|
||||
)
|
||||
|
@ -961,7 +962,7 @@ SwLedBlink4(
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SwLedBlink5(
|
||||
PLED_871x pLed
|
||||
)
|
||||
|
@ -1079,7 +1080,7 @@ SwLedBlink5(
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SwLedBlink6(
|
||||
PLED_871x pLed
|
||||
)
|
||||
|
|
|
@ -1122,9 +1122,10 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
|
|||
{
|
||||
#ifdef CONFIG_AP_MODE
|
||||
_irqL irqL;
|
||||
unsigned int auth_mode, seq, ie_len;
|
||||
unsigned int auth_mode, ie_len;
|
||||
__le16 seq;
|
||||
unsigned char *sa, *p;
|
||||
u16 algorithm;
|
||||
__le16 algorithm;
|
||||
int status;
|
||||
static struct sta_info stat;
|
||||
struct sta_info *pstat=NULL;
|
||||
|
@ -2240,7 +2241,7 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame)
|
|||
|
||||
unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame)
|
||||
{
|
||||
unsigned short reason;
|
||||
__le16 reason;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
|
|
|
@ -212,7 +212,7 @@ _func_enter_;
|
|||
|
||||
length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len;
|
||||
|
||||
*((unsigned long *)crc)=cpu_to_le32(getcrc32(payload,length));
|
||||
*((__le32 *)crc)=cpu_to_le32(getcrc32(payload,length));
|
||||
|
||||
arcfour_init(&mycontext, wepkey,3+keylength);
|
||||
arcfour_encrypt(&mycontext, payload, payload, length);
|
||||
|
@ -222,7 +222,7 @@ _func_enter_;
|
|||
else
|
||||
{
|
||||
length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
|
||||
*((unsigned long *)crc)=cpu_to_le32(getcrc32(payload,length));
|
||||
*((__le32 *)crc)=cpu_to_le32(getcrc32(payload,length));
|
||||
arcfour_init(&mycontext, wepkey,3+keylength);
|
||||
arcfour_encrypt(&mycontext, payload, payload, length);
|
||||
arcfour_encrypt(&mycontext, payload+length, crc, 4);
|
||||
|
@ -725,8 +725,10 @@ _func_enter_;
|
|||
|
||||
if ((curfragnum+1)==pattrib->nr_frags){ //4 the last fragment
|
||||
length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len;
|
||||
RT_TRACE(_module_rtl871x_security_c_,_drv_info_,("pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len,pattrib->icv_len));
|
||||
*((u32 *)crc)=cpu_to_le32(getcrc32(payload,length));/* modified by Amy*/
|
||||
RT_TRACE(_module_rtl871x_security_c_, _drv_info_,
|
||||
("pattrib->iv_len =%x, pattrib->icv_len =%x\n",
|
||||
pattrib->iv_len,pattrib->icv_len));
|
||||
*((__le32 *)crc)=cpu_to_le32(getcrc32(payload,length));/* modified by Amy*/
|
||||
|
||||
arcfour_init(&mycontext, rc4key,16);
|
||||
arcfour_encrypt(&mycontext, payload, payload, length);
|
||||
|
@ -735,7 +737,7 @@ _func_enter_;
|
|||
}
|
||||
else{
|
||||
length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
|
||||
*((u32 *)crc)=cpu_to_le32(getcrc32(payload,length));/* modified by Amy*/
|
||||
*((__le32 *)crc)=cpu_to_le32(getcrc32(payload,length));/* modified by Amy*/
|
||||
arcfour_init(&mycontext,rc4key,16);
|
||||
arcfour_encrypt(&mycontext, payload, payload, length);
|
||||
arcfour_encrypt(&mycontext, payload+length, crc, 4);
|
||||
|
|
|
@ -52,38 +52,16 @@ void rtl8188eu_free_xmit_priv(_adapter *padapter)
|
|||
{
|
||||
}
|
||||
|
||||
u8 urb_zero_packet_chk(_adapter *padapter, int sz)
|
||||
static u8 urb_zero_packet_chk(_adapter *padapter, int sz)
|
||||
{
|
||||
#if 1
|
||||
u8 blnSetTxDescOffset;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
blnSetTxDescOffset = (((sz + TXDESC_SIZE) % pHalData->UsbBulkOutSize) ==0)?1:0;
|
||||
|
||||
#else
|
||||
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
|
||||
if ( pdvobj->ishighspeed )
|
||||
{
|
||||
if ( ( (sz + TXDESC_SIZE) % 512 ) == 0 ) {
|
||||
blnSetTxDescOffset = 1;
|
||||
} else {
|
||||
blnSetTxDescOffset = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ( (sz + TXDESC_SIZE) % 64 ) == 0 ) {
|
||||
blnSetTxDescOffset = 1;
|
||||
} else {
|
||||
blnSetTxDescOffset = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return blnSetTxDescOffset;
|
||||
|
||||
}
|
||||
|
||||
void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc)
|
||||
static void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc)
|
||||
{
|
||||
u16 *usPtr = (u16*)ptxdesc;
|
||||
u32 count = 16; // (32 bytes / 2 bytes per XOR) => 16 times
|
||||
|
@ -93,12 +71,9 @@ void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc)
|
|||
//Clear first
|
||||
ptxdesc->txdw7 &= cpu_to_le32(0xffff0000);
|
||||
|
||||
for (index = 0 ; index < count ; index++){
|
||||
for (index = 0; index < count; index++)
|
||||
checksum = checksum ^ le16_to_cpu(*(usPtr + index));
|
||||
}
|
||||
|
||||
ptxdesc->txdw7 |= cpu_to_le32(0x0000ffff&checksum);
|
||||
|
||||
}
|
||||
//
|
||||
// Description: In normal chip, we should send some packet to Hw which will be used by Fw
|
||||
|
@ -155,12 +130,10 @@ void rtl8188e_fill_fake_txdesc(
|
|||
#endif
|
||||
}
|
||||
|
||||
void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc)
|
||||
{
|
||||
if ((pattrib->encrypt > 0) && !pattrib->bswenc)
|
||||
{
|
||||
switch (pattrib->encrypt)
|
||||
static void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc)
|
||||
{
|
||||
if ((pattrib->encrypt > 0) && !pattrib->bswenc) {
|
||||
switch (pattrib->encrypt) {
|
||||
//SEC_TYPE : 0:NO_ENC,1:WEP40/TKIP,2:WAPI,3:AES
|
||||
case _WEP40_:
|
||||
case _WEP104_:
|
||||
|
@ -185,19 +158,13 @@ void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc)
|
|||
case _NO_PRIVACY_:
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void fill_txdesc_vcs(struct pkt_attrib *pattrib, u32 *pdw)
|
||||
{
|
||||
//DBG_88E("cvs_mode=%d\n", pattrib->vcs_mode);
|
||||
|
||||
switch (pattrib->vcs_mode)
|
||||
static void fill_txdesc_vcs(struct pkt_attrib *pattrib, __le32 *pdw)
|
||||
{
|
||||
switch (pattrib->vcs_mode) {
|
||||
case RTS_CTS:
|
||||
*pdw |= cpu_to_le32(RTS_EN);
|
||||
break;
|
||||
|
@ -208,13 +175,10 @@ void fill_txdesc_vcs(struct pkt_attrib *pattrib, u32 *pdw)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (pattrib->vcs_mode) {
|
||||
*pdw |= cpu_to_le32(HW_RTS_EN);
|
||||
|
||||
// Set RTS BW
|
||||
if (pattrib->ht_en)
|
||||
{
|
||||
if (pattrib->ht_en) {
|
||||
*pdw |= (pattrib->bwmode&HT_CHANNEL_WIDTH_40)? cpu_to_le32(BIT(27)):0;
|
||||
|
||||
if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
|
||||
|
@ -229,12 +193,9 @@ void fill_txdesc_vcs(struct pkt_attrib *pattrib, u32 *pdw)
|
|||
}
|
||||
}
|
||||
|
||||
void fill_txdesc_phy(struct pkt_attrib *pattrib, u32 *pdw)
|
||||
{
|
||||
//DBG_88E("bwmode=%d, ch_off=%d\n", pattrib->bwmode, pattrib->ch_offset);
|
||||
|
||||
if (pattrib->ht_en)
|
||||
static void fill_txdesc_phy(struct pkt_attrib *pattrib, __le32 *pdw)
|
||||
{
|
||||
if (pattrib->ht_en) {
|
||||
*pdw |= (pattrib->bwmode&HT_CHANNEL_WIDTH_40)? cpu_to_le32(BIT(25)):0;
|
||||
|
||||
if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
|
||||
|
@ -347,7 +308,7 @@ if (padapter->registrypriv.mp_mode == 0)
|
|||
//SET_TX_DESC_MCSG2_MAX_LEN_88E(pDesc, 0x6);
|
||||
//SET_TX_DESC_MCSG3_MAX_LEN_88E(pDesc, 0x6);
|
||||
//SET_TX_DESC_MCS7_SGI_MAX_LEN_88E(pDesc, 0x6);
|
||||
ptxdesc->txdw6 = 0x6666f800;
|
||||
ptxdesc->txdw6 = cpu_to_le32(0x6666f800);
|
||||
}
|
||||
else{
|
||||
ptxdesc->txdw2 |= cpu_to_le32(AGG_BK);//AGG BK
|
||||
|
|
|
@ -168,42 +168,14 @@ do{\
|
|||
struct tx_desc{
|
||||
|
||||
//DWORD 0
|
||||
unsigned int txdw0;
|
||||
|
||||
unsigned int txdw1;
|
||||
|
||||
unsigned int txdw2;
|
||||
|
||||
unsigned int txdw3;
|
||||
|
||||
unsigned int txdw4;
|
||||
|
||||
unsigned int txdw5;
|
||||
|
||||
unsigned int txdw6;
|
||||
|
||||
unsigned int txdw7;
|
||||
#ifdef CONFIG_PCI_HCI
|
||||
unsigned int txdw8;
|
||||
|
||||
unsigned int txdw9;
|
||||
|
||||
unsigned int txdw10;
|
||||
|
||||
unsigned int txdw11;
|
||||
|
||||
// 2008/05/15 MH Because PCIE HW memory R/W 4K limit. And now, our descriptor
|
||||
// size is 40 bytes. If you use more than 102 descriptor( 103*40>4096), HW will execute
|
||||
// memoryR/W CRC error. And then all DMA fetch will fail. We must decrease descriptor
|
||||
// number or enlarge descriptor size as 64 bytes.
|
||||
unsigned int txdw12;
|
||||
|
||||
unsigned int txdw13;
|
||||
|
||||
unsigned int txdw14;
|
||||
|
||||
unsigned int txdw15;
|
||||
#endif
|
||||
__le32 txdw0;
|
||||
__le32 txdw1;
|
||||
__le32 txdw2;
|
||||
__le32 txdw3;
|
||||
__le32 txdw4;
|
||||
__le32 txdw5;
|
||||
__le32 txdw6;
|
||||
__le32 txdw7;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#endif
|
||||
#endif /* defined(RTW_ENABLE_WIFI_CONTROL_FUNC) */
|
||||
|
||||
const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = {
|
||||
static const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = {
|
||||
"START",
|
||||
"STOP",
|
||||
"SCAN-ACTIVE",
|
||||
|
@ -237,7 +237,7 @@ int rtw_android_cmdstr_to_num(char *cmdstr)
|
|||
return cmd_num;
|
||||
}
|
||||
|
||||
int rtw_android_get_rssi(struct net_device *net, char *command, int total_len)
|
||||
static int rtw_android_get_rssi(struct net_device *net, char *command, int total_len)
|
||||
{
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(net);
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
|
@ -252,7 +252,7 @@ int rtw_android_get_rssi(struct net_device *net, char *command, int total_len)
|
|||
return bytes_written;
|
||||
}
|
||||
|
||||
int rtw_android_get_link_speed(struct net_device *net, char *command, int total_len)
|
||||
static int rtw_android_get_link_speed(struct net_device *net, char *command, int total_len)
|
||||
{
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(net);
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
|
@ -266,7 +266,7 @@ int rtw_android_get_link_speed(struct net_device *net, char *command, int total_
|
|||
return bytes_written;
|
||||
}
|
||||
|
||||
int rtw_android_get_macaddr(struct net_device *net, char *command, int total_len)
|
||||
static int rtw_android_get_macaddr(struct net_device *net, char *command, int total_len)
|
||||
{
|
||||
_adapter *adapter = (_adapter *)rtw_netdev_priv(net);
|
||||
int bytes_written = 0;
|
||||
|
@ -275,7 +275,7 @@ int rtw_android_get_macaddr(struct net_device *net, char *command, int total_len
|
|||
return bytes_written;
|
||||
}
|
||||
|
||||
int rtw_android_set_country(struct net_device *net, char *command, int total_len)
|
||||
static int rtw_android_set_country(struct net_device *net, char *command, int total_len)
|
||||
{
|
||||
_adapter *adapter = (_adapter *)rtw_netdev_priv(net);
|
||||
char *country_code = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_COUNTRY]) + 1;
|
||||
|
@ -286,7 +286,7 @@ int rtw_android_set_country(struct net_device *net, char *command, int total_len
|
|||
return (ret==_SUCCESS)?0:-1;
|
||||
}
|
||||
|
||||
int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, int total_len)
|
||||
static int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, int total_len)
|
||||
{
|
||||
int ret;
|
||||
int bytes_written = 0;
|
||||
|
@ -298,7 +298,7 @@ int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, int tota
|
|||
return bytes_written;
|
||||
}
|
||||
|
||||
int rtw_android_set_block(struct net_device *net, char *command, int total_len)
|
||||
static int rtw_android_set_block(struct net_device *net, char *command, int total_len)
|
||||
{
|
||||
int ret;
|
||||
_adapter *adapter = (_adapter *)rtw_netdev_priv(net);
|
||||
|
@ -311,7 +311,7 @@ int rtw_android_set_block(struct net_device *net, char *command, int total_len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int get_int_from_command( char* pcmd )
|
||||
static int get_int_from_command( char* pcmd )
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -346,7 +346,6 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
//DBG_88E("%s priv_cmd.buf=%p priv_cmd.total_len=%d priv_cmd.used_len=%d\n",__func__,priv_cmd.buf,priv_cmd.total_len,priv_cmd.used_len);
|
||||
command = kmalloc(priv_cmd.total_len, GFP_KERNEL);
|
||||
if (!command)
|
||||
{
|
||||
|
@ -568,17 +567,13 @@ response:
|
|||
DBG_88E("%s: failed to copy data to user buffer\n", __func__);
|
||||
ret = -EFAULT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ret = bytes_written;
|
||||
}
|
||||
|
||||
exit:
|
||||
rtw_unlock_suspend();
|
||||
if (command) {
|
||||
if (command)
|
||||
kfree(command);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue