Commit 922d71a4 authored by Larry Finger's avatar Larry Finger

staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part VII

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
parent d76eaf7e
...@@ -40,12 +40,12 @@ void CamResetAllEntry(struct net_device *dev) ...@@ -40,12 +40,12 @@ void CamResetAllEntry(struct net_device *dev)
void write_cam(struct net_device *dev, u8 addr, u32 data) void write_cam(struct net_device *dev, u8 addr, u32 data)
{ {
write_nic_dword(dev, WCAMI, data); write_nic_dword(dev, WCAMI, data);
write_nic_dword(dev, RWCAM, BIT31|BIT16|(addr&0xff) ); write_nic_dword(dev, RWCAM, BIT31|BIT16|(addr&0xff));
} }
u32 read_cam(struct net_device *dev, u8 addr) u32 read_cam(struct net_device *dev, u8 addr)
{ {
write_nic_dword(dev, RWCAM, 0x80000000|(addr&0xff) ); write_nic_dword(dev, RWCAM, 0x80000000|(addr&0xff));
return read_nic_dword(dev, 0xa8); return read_nic_dword(dev, 0xa8);
} }
...@@ -53,66 +53,53 @@ void EnableHWSecurityConfig8192(struct net_device *dev) ...@@ -53,66 +53,53 @@ void EnableHWSecurityConfig8192(struct net_device *dev)
{ {
u8 SECR_value = 0x0; u8 SECR_value = 0x0;
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
struct rtllib_device* ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
SECR_value = SCR_TxEncEnable | SCR_RxDecEnable; SECR_value = SCR_TxEncEnable | SCR_RxDecEnable;
if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) && (priv->rtllib->auth_mode != 2)) if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) ||
{ (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) &&
(priv->rtllib->auth_mode != 2)) {
SECR_value |= SCR_RxUseDK; SECR_value |= SCR_RxUseDK;
SECR_value |= SCR_TxUseDK; SECR_value |= SCR_TxUseDK;
} } else if ((ieee->iw_mode == IW_MODE_ADHOC) &&
else if ((ieee->iw_mode == IW_MODE_ADHOC) && (ieee->pairwise_key_type & (KEY_TYPE_CCMP | KEY_TYPE_TKIP))) (ieee->pairwise_key_type & (KEY_TYPE_CCMP |
{ KEY_TYPE_TKIP))) {
SECR_value |= SCR_RxUseDK; SECR_value |= SCR_RxUseDK;
SECR_value |= SCR_TxUseDK; SECR_value |= SCR_TxUseDK;
} }
ieee->hwsec_active = 1; ieee->hwsec_active = 1;
if ((ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE) || !hwwep) if ((ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE) || !hwwep) {
{
ieee->hwsec_active = 0; ieee->hwsec_active = 0;
SECR_value &= ~SCR_RxDecEnable; SECR_value &= ~SCR_RxDecEnable;
} }
RT_TRACE(COMP_SEC,"%s:, hwsec:%d, pairwise_key:%d, SECR_value:%x\n", __func__, \ RT_TRACE(COMP_SEC, "%s:, hwsec:%d, pairwise_key:%d, SECR_value:%x\n",
ieee->hwsec_active, ieee->pairwise_key_type, SECR_value); __func__, ieee->hwsec_active, ieee->pairwise_key_type,
{ SECR_value);
write_nic_byte(dev, SECR, SECR_value); write_nic_byte(dev, SECR, SECR_value);
}
} }
void set_swcam(struct net_device *dev, void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
u8 EntryNo, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh)
u8 KeyIndex,
u16 KeyType,
u8 *MacAddr,
u8 DefaultKey,
u32 *KeyContent,
u8 is_mesh)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device *ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
RT_TRACE(COMP_DBG, "===========>%s():EntryNo is %d,KeyIndex is " RT_TRACE(COMP_DBG, "===========>%s():EntryNo is %d,KeyIndex is "
"%d,KeyType is %d,is_mesh is %d\n", __func__, EntryNo, "%d,KeyType is %d,is_mesh is %d\n", __func__, EntryNo,
KeyIndex, KeyType, is_mesh); KeyIndex, KeyType, is_mesh);
if (is_mesh){ if (!is_mesh) {
} else { ieee->swcamtable[EntryNo].bused = true;
ieee->swcamtable[EntryNo].bused=true; ieee->swcamtable[EntryNo].key_index = KeyIndex;
ieee->swcamtable[EntryNo].key_index=KeyIndex; ieee->swcamtable[EntryNo].key_type = KeyType;
ieee->swcamtable[EntryNo].key_type=KeyType; memcpy(ieee->swcamtable[EntryNo].macaddr, MacAddr, 6);
memcpy(ieee->swcamtable[EntryNo].macaddr,MacAddr,6); ieee->swcamtable[EntryNo].useDK = DefaultKey;
ieee->swcamtable[EntryNo].useDK=DefaultKey; memcpy(ieee->swcamtable[EntryNo].key_buf, (u8 *)KeyContent, 16);
memcpy(ieee->swcamtable[EntryNo].key_buf,(u8*)KeyContent,16);
} }
} }
void setKey(struct net_device *dev, void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
u8 EntryNo, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent)
u8 KeyIndex,
u16 KeyType,
u8 *MacAddr,
u8 DefaultKey,
u32 *KeyContent )
{ {
u32 TargetCommand = 0; u32 TargetCommand = 0;
u32 TargetContent = 0; u32 TargetContent = 0;
...@@ -121,17 +108,17 @@ void setKey(struct net_device *dev, ...@@ -121,17 +108,17 @@ void setKey(struct net_device *dev,
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
enum rt_rf_power_state rtState; enum rt_rf_power_state rtState;
rtState = priv->rtllib->eRFPowerState; rtState = priv->rtllib->eRFPowerState;
if (priv->rtllib->PowerSaveControl.bInactivePs){ if (priv->rtllib->PowerSaveControl.bInactivePs) {
if (rtState == eRfOff){ if (rtState == eRfOff) {
if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) {
{ RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__func__); __func__);
return ; return ;
} } else {
else{
down(&priv->rtllib->ips_sem); down(&priv->rtllib->ips_sem);
IPSLeave(dev); IPSLeave(dev);
up(&priv->rtllib->ips_sem); } up(&priv->rtllib->ips_sem);
}
} }
} }
priv->rtllib->is_set_key = true; priv->rtllib->is_set_key = true;
...@@ -139,7 +126,7 @@ void setKey(struct net_device *dev, ...@@ -139,7 +126,7 @@ void setKey(struct net_device *dev,
RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n"); RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n");
RT_TRACE(COMP_SEC, "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d," RT_TRACE(COMP_SEC, "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d,"
"KeyType:%d, MacAddr"MAC_FMT"\n", dev,EntryNo, KeyIndex, "KeyType:%d, MacAddr"MAC_FMT"\n", dev, EntryNo, KeyIndex,
KeyType, MAC_ARG(MacAddr)); KeyType, MAC_ARG(MacAddr));
if (DefaultKey) if (DefaultKey)
...@@ -149,227 +136,167 @@ void setKey(struct net_device *dev, ...@@ -149,227 +136,167 @@ void setKey(struct net_device *dev,
for (i = 0; i < CAM_CONTENT_COUNT; i++) { for (i = 0; i < CAM_CONTENT_COUNT; i++) {
TargetCommand = i+CAM_CONTENT_COUNT*EntryNo; TargetCommand = i + CAM_CONTENT_COUNT * EntryNo;
TargetCommand |= BIT31|BIT16; TargetCommand |= BIT31|BIT16;
if (i == 0) { if (i == 0) {
TargetContent = (u32)(*(MacAddr+0)) << 16| TargetContent = (u32)(*(MacAddr+0)) << 16 |
(u32)(*(MacAddr+1)) << 24| (u32)(*(MacAddr+1)) << 24 |
(u32)usConfig; (u32)usConfig;
write_nic_dword(dev, WCAMI, TargetContent); write_nic_dword(dev, WCAMI, TargetContent);
write_nic_dword(dev, RWCAM, TargetCommand); write_nic_dword(dev, RWCAM, TargetCommand);
} else if (i == 1) { } else if (i == 1) {
TargetContent = (u32)(*(MacAddr+2)) | TargetContent = (u32)(*(MacAddr+2)) |
(u32)(*(MacAddr+3)) << 8| (u32)(*(MacAddr+3)) << 8 |
(u32)(*(MacAddr+4)) << 16| (u32)(*(MacAddr+4)) << 16 |
(u32)(*(MacAddr+5)) << 24; (u32)(*(MacAddr+5)) << 24;
write_nic_dword(dev, WCAMI, TargetContent); write_nic_dword(dev, WCAMI, TargetContent);
write_nic_dword(dev, RWCAM, TargetCommand); write_nic_dword(dev, RWCAM, TargetCommand);
} else { } else {
if (KeyContent != NULL) { if (KeyContent != NULL) {
write_nic_dword(dev, WCAMI, (u32)(*(KeyContent+i-2)) ); write_nic_dword(dev, WCAMI,
(u32)(*(KeyContent+i-2)));
write_nic_dword(dev, RWCAM, TargetCommand); write_nic_dword(dev, RWCAM, TargetCommand);
udelay(100); udelay(100);
} }
} }
} }
RT_TRACE(COMP_SEC,"=========>after set key, usconfig:%x\n", usConfig); RT_TRACE(COMP_SEC, "=========>after set key, usconfig:%x\n", usConfig);
} }
void CAM_read_entry(struct net_device *dev, u32 iIndex) void CAM_read_entry(struct net_device *dev, u32 iIndex)
{ {
u32 target_command=0; u32 target_command = 0;
u32 target_content=0; u32 target_content = 0;
u8 entry_i=0; u8 entry_i = 0;
u32 ulStatus; u32 ulStatus;
s32 i=100; s32 i = 100;
for (entry_i=0;entry_i<CAM_CONTENT_COUNT;entry_i++) for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
{ target_command = entry_i+CAM_CONTENT_COUNT*iIndex;
target_command= entry_i+CAM_CONTENT_COUNT*iIndex; target_command = target_command | BIT31;
target_command= target_command | BIT31;
while((i--)>=0) while ((i--) >= 0) {
{
ulStatus = read_nic_dword(dev, RWCAM); ulStatus = read_nic_dword(dev, RWCAM);
if (ulStatus & BIT31){ if (ulStatus & BIT31)
continue; continue;
} else
else{
break; break;
}
} }
write_nic_dword(dev, RWCAM, target_command); write_nic_dword(dev, RWCAM, target_command);
RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command); RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A0: %x\n",
target_command);
target_content = read_nic_dword(dev, RCAMO); target_content = read_nic_dword(dev, RCAMO);
RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A8: %x \n",target_content); RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A8: %x\n",
target_content);
} }
printk("\n"); printk(KERN_INFO "\n");
} }
void CamRestoreAllEntry( struct net_device *dev) void CamRestoreAllEntry(struct net_device *dev)
{ {
u8 EntryId = 0; u8 EntryId = 0;
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
u8* MacAddr = priv->rtllib->current_network.bssid; u8 *MacAddr = priv->rtllib->current_network.bssid;
static u8 CAM_CONST_ADDR[4][6] = { static u8 CAM_CONST_ADDR[4][6] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x03}}; {0x00, 0x00, 0x00, 0x00, 0x00, 0x03}
static u8 CAM_CONST_BROAD[] = };
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; static u8 CAM_CONST_BROAD[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
RT_TRACE(COMP_SEC, "CamRestoreAllEntry: \n"); RT_TRACE(COMP_SEC, "CamRestoreAllEntry:\n");
if ((priv->rtllib->pairwise_key_type == KEY_TYPE_WEP40)|| if ((priv->rtllib->pairwise_key_type == KEY_TYPE_WEP40) ||
(priv->rtllib->pairwise_key_type == KEY_TYPE_WEP104)) (priv->rtllib->pairwise_key_type == KEY_TYPE_WEP104)) {
{
for (EntryId=0; EntryId<4; EntryId++) for (EntryId = 0; EntryId < 4; EntryId++) {
{ MacAddr = CAM_CONST_ADDR[EntryId];
{ if (priv->rtllib->swcamtable[EntryId].bused) {
MacAddr = CAM_CONST_ADDR[EntryId]; setKey(dev, EntryId , EntryId,
if (priv->rtllib->swcamtable[EntryId].bused ) priv->rtllib->pairwise_key_type, MacAddr,
{ 0, (u32 *)(&priv->rtllib->swcamtable
setKey(dev, [EntryId].key_buf[0]));
EntryId ,
EntryId,
priv->rtllib->pairwise_key_type,
MacAddr,
0,
(u32*)(&priv->rtllib->swcamtable[EntryId].key_buf[0])
);
}
} }
} }
} } else if (priv->rtllib->pairwise_key_type == KEY_TYPE_TKIP) {
else if (priv->rtllib->pairwise_key_type == KEY_TYPE_TKIP) if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
{ setKey(dev, 4, 0, priv->rtllib->pairwise_key_type,
(u8 *)dev->dev_addr, 0,
{ (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) } else {
{ setKey(dev, 4, 0, priv->rtllib->pairwise_key_type,
setKey(dev, MacAddr, 0,
4, (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
0,
priv->rtllib->pairwise_key_type,
(u8*)dev->dev_addr,
0,
(u32*)(&priv->rtllib->swcamtable[4].key_buf[0])
);
}
else
{
setKey(dev,
4,
0,
priv->rtllib->pairwise_key_type,
MacAddr,
0,
(u32*)(&priv->rtllib->swcamtable[4].key_buf[0])
);
}
} }
}
else if (priv->rtllib->pairwise_key_type == KEY_TYPE_CCMP)
{
{ } else if (priv->rtllib->pairwise_key_type == KEY_TYPE_CCMP) {
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
{ setKey(dev, 4, 0,
setKey(dev, priv->rtllib->pairwise_key_type,
4, (u8 *)dev->dev_addr, 0,
0, (u32 *)(&priv->rtllib->swcamtable[4].
priv->rtllib->pairwise_key_type, key_buf[0]));
(u8*)dev->dev_addr, } else {
0, setKey(dev, 4, 0,
(u32*)(&priv->rtllib->swcamtable[4].key_buf[0]) priv->rtllib->pairwise_key_type, MacAddr,
); 0, (u32 *)(&priv->rtllib->swcamtable[4].
} key_buf[0]));
else
{
setKey(dev,
4,
0,
priv->rtllib->pairwise_key_type,
MacAddr,
0,
(u32*)(&priv->rtllib->swcamtable[4].key_buf[0])
);
} }
}
} }
if (priv->rtllib->group_key_type == KEY_TYPE_TKIP) {
if (priv->rtllib->group_key_type == KEY_TYPE_TKIP)
{
MacAddr = CAM_CONST_BROAD; MacAddr = CAM_CONST_BROAD;
for (EntryId=1 ; EntryId<4 ; EntryId++) for (EntryId = 1; EntryId < 4; EntryId++) {
{ if (priv->rtllib->swcamtable[EntryId].bused) {
if (priv->rtllib->swcamtable[EntryId].bused ) setKey(dev, EntryId, EntryId,
{ priv->rtllib->group_key_type,
setKey(dev, MacAddr, 0,
EntryId, (u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0])
EntryId, );
priv->rtllib->group_key_type,
MacAddr,
0,
(u32*)(&priv->rtllib->swcamtable[EntryId].key_buf[0])
);
} }
} }
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
{ if (priv->rtllib->swcamtable[0].bused) {
if (priv->rtllib->swcamtable[0].bused ){ setKey(dev, 0, 0,
setKey(dev, priv->rtllib->group_key_type,
0, CAM_CONST_ADDR[0], 0,
0, (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])
priv->rtllib->group_key_type, );
CAM_CONST_ADDR[0], } else {
0, RT_TRACE(COMP_ERR, "===>%s():ERR!! ADHOC TKIP "
(u32*)(&priv->rtllib->swcamtable[0].key_buf[0]) ",but 0 entry is have no data\n",
); __func__);
}
else
{
RT_TRACE(COMP_ERR,"===>%s():ERR!! ADHOC TKIP ,but 0 entry is have no data\n",__func__);
return; return;
} }
} }
} else if (priv->rtllib->group_key_type == KEY_TYPE_CCMP) { } else if (priv->rtllib->group_key_type == KEY_TYPE_CCMP) {
MacAddr = CAM_CONST_BROAD; MacAddr = CAM_CONST_BROAD;
for (EntryId=1; EntryId<4 ; EntryId++) for (EntryId = 1; EntryId < 4; EntryId++) {
{ if (priv->rtllib->swcamtable[EntryId].bused) {
if (priv->rtllib->swcamtable[EntryId].bused ) setKey(dev, EntryId , EntryId,
{
setKey(dev,
EntryId ,
EntryId,
priv->rtllib->group_key_type, priv->rtllib->group_key_type,
MacAddr, MacAddr, 0,
0, (u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0]));
(u32*)(&priv->rtllib->swcamtable[EntryId].key_buf[0]));
} }
} }
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
if (priv->rtllib->swcamtable[0].bused) { if (priv->rtllib->swcamtable[0].bused) {
setKey(dev, setKey(dev, 0 , 0,
0 ,
0,
priv->rtllib->group_key_type, priv->rtllib->group_key_type,
CAM_CONST_ADDR[0], CAM_CONST_ADDR[0], 0,
0, (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]));
(u32*)(&priv->rtllib->swcamtable[0].key_buf[0]));
} else { } else {
RT_TRACE(COMP_ERR,"===>%s():ERR!! ADHOC CCMP ,but 0 entry is have no data\n", RT_TRACE(COMP_ERR, "===>%s():ERR!! ADHOC CCMP ,"
__func__); "but 0 entry is have no data\n",
__func__);
return; return;
} }
} }
......
...@@ -28,11 +28,13 @@ ...@@ -28,11 +28,13 @@
#include <linux/types.h> #include <linux/types.h>
struct net_device; struct net_device;
void CamResetAllEntry(struct net_device* dev); void CamResetAllEntry(struct net_device *dev);
void EnableHWSecurityConfig8192(struct net_device *dev); void EnableHWSecurityConfig8192(struct net_device *dev);
void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent ); void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh); u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
void CamPrintDbgReg(struct net_device* dev); void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh);
void CamPrintDbgReg(struct net_device *dev);
u32 read_cam(struct net_device *dev, u8 addr); u32 read_cam(struct net_device *dev, u8 addr);
void write_cam(struct net_device *dev, u8 addr, u32 data); void write_cam(struct net_device *dev, u8 addr, u32 data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment