Commit 408bd7b7 authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

staging: rtl8192e: Rename setKey

Use naming schema found in other rtlwifi devices.
Rename setKey to rtl92e_set_key.
Signed-off-by: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 37420932
...@@ -87,8 +87,9 @@ void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, ...@@ -87,8 +87,9 @@ void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
} }
} }
void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex,
const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent) u16 KeyType, const u8 *MacAddr, u8 DefaultKey,
u32 *KeyContent)
{ {
u32 TargetCommand = 0; u32 TargetCommand = 0;
u32 TargetContent = 0; u32 TargetContent = 0;
...@@ -115,7 +116,7 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, ...@@ -115,7 +116,7 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
netdev_info(dev, "%s(): Invalid CAM entry\n", __func__); netdev_info(dev, "%s(): Invalid CAM entry\n", __func__);
RT_TRACE(COMP_SEC, RT_TRACE(COMP_SEC,
"====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n", "====>to rtl92e_set_key(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n",
dev, EntryNo, KeyIndex, KeyType, MacAddr); dev, EntryNo, KeyIndex, KeyType, MacAddr);
if (DefaultKey) if (DefaultKey)
...@@ -179,36 +180,41 @@ void rtl92e_cam_restore(struct net_device *dev) ...@@ -179,36 +180,41 @@ void rtl92e_cam_restore(struct net_device *dev)
for (EntryId = 0; EntryId < 4; EntryId++) { for (EntryId = 0; EntryId < 4; EntryId++) {
MacAddr = CAM_CONST_ADDR[EntryId]; MacAddr = CAM_CONST_ADDR[EntryId];
if (priv->rtllib->swcamtable[EntryId].bused) { if (priv->rtllib->swcamtable[EntryId].bused) {
setKey(dev, EntryId, EntryId, rtl92e_set_key(dev, EntryId, EntryId,
priv->rtllib->pairwise_key_type, MacAddr, priv->rtllib->pairwise_key_type,
0, (u32 *)(&priv->rtllib->swcamtable MacAddr, 0,
[EntryId].key_buf[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) { if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
setKey(dev, 4, 0, priv->rtllib->pairwise_key_type, rtl92e_set_key(dev, 4, 0,
(u8 *)dev->dev_addr, 0, priv->rtllib->pairwise_key_type,
(u32 *)(&priv->rtllib->swcamtable[4].key_buf[0])); (u8 *)dev->dev_addr, 0,
(u32 *)(&priv->rtllib->swcamtable[4].
key_buf[0]));
} else { } else {
setKey(dev, 4, 0, priv->rtllib->pairwise_key_type, rtl92e_set_key(dev, 4, 0,
MacAddr, 0, priv->rtllib->pairwise_key_type,
(u32 *)(&priv->rtllib->swcamtable[4].key_buf[0])); 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, rtl92e_set_key(dev, 4, 0,
priv->rtllib->pairwise_key_type, priv->rtllib->pairwise_key_type,
(u8 *)dev->dev_addr, 0, (u8 *)dev->dev_addr, 0,
(u32 *)(&priv->rtllib->swcamtable[4]. (u32 *)(&priv->rtllib->swcamtable[4].
key_buf[0])); key_buf[0]));
} else { } else {
setKey(dev, 4, 0, rtl92e_set_key(dev, 4, 0,
priv->rtllib->pairwise_key_type, MacAddr, priv->rtllib->pairwise_key_type, MacAddr,
0, (u32 *)(&priv->rtllib->swcamtable[4]. 0, (u32 *)(&priv->rtllib->swcamtable[4].
key_buf[0])); key_buf[0]));
} }
} }
...@@ -216,20 +222,18 @@ void rtl92e_cam_restore(struct net_device *dev) ...@@ -216,20 +222,18 @@ void rtl92e_cam_restore(struct net_device *dev)
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, rtl92e_set_key(dev, EntryId, EntryId,
priv->rtllib->group_key_type, priv->rtllib->group_key_type,
MacAddr, 0, MacAddr, 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, 0, 0, rtl92e_set_key(dev, 0, 0,
priv->rtllib->group_key_type, priv->rtllib->group_key_type,
CAM_CONST_ADDR[0], 0, CAM_CONST_ADDR[0], 0,
(u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]) (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]));
);
} else { } else {
netdev_warn(dev, netdev_warn(dev,
"%s(): ADHOC TKIP: missing key entry.\n", "%s(): ADHOC TKIP: missing key entry.\n",
...@@ -241,19 +245,19 @@ void rtl92e_cam_restore(struct net_device *dev) ...@@ -241,19 +245,19 @@ void rtl92e_cam_restore(struct net_device *dev)
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, rtl92e_set_key(dev, EntryId, EntryId,
priv->rtllib->group_key_type, priv->rtllib->group_key_type,
MacAddr, 0, MacAddr, 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, 0, 0, rtl92e_set_key(dev, 0, 0,
priv->rtllib->group_key_type, priv->rtllib->group_key_type,
CAM_CONST_ADDR[0], 0, CAM_CONST_ADDR[0], 0,
(u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])); (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]));
} else { } else {
netdev_warn(dev, netdev_warn(dev,
"%s(): ADHOC CCMP: missing key entry.\n", "%s(): ADHOC CCMP: missing key entry.\n",
......
...@@ -30,8 +30,9 @@ struct net_device; ...@@ -30,8 +30,9 @@ struct net_device;
void rtl92e_cam_reset(struct net_device *dev); void rtl92e_cam_reset(struct net_device *dev);
void rtl92e_enable_hw_security_config(struct net_device *dev); void rtl92e_enable_hw_security_config(struct net_device *dev);
void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex,
const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); u16 KeyType, const u8 *MacAddr, u8 DefaultKey,
u32 *KeyContent);
void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh); const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh);
void rtl92e_cam_restore(struct net_device *dev); void rtl92e_cam_restore(struct net_device *dev);
......
...@@ -2380,20 +2380,22 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -2380,20 +2380,22 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
ieee->pairwise_key_type, ieee->pairwise_key_type,
(u8 *)ieee->ap_mac_addr, (u8 *)ieee->ap_mac_addr,
0, key, 0); 0, key, 0);
setKey(dev, 4, ipw->u.crypt.idx, rtl92e_set_key(dev, 4, ipw->u.crypt.idx,
ieee->pairwise_key_type, ieee->pairwise_key_type,
(u8 *)ieee->ap_mac_addr, 0, key); (u8 *)ieee->ap_mac_addr,
0, key);
if (ieee->iw_mode == IW_MODE_ADHOC) { if (ieee->iw_mode == IW_MODE_ADHOC) {
set_swcam(dev, ipw->u.crypt.idx, set_swcam(dev, ipw->u.crypt.idx,
ipw->u.crypt.idx, ipw->u.crypt.idx,
ieee->pairwise_key_type, ieee->pairwise_key_type,
(u8 *)ieee->ap_mac_addr, (u8 *)ieee->ap_mac_addr,
0, key, 0); 0, key, 0);
setKey(dev, ipw->u.crypt.idx, rtl92e_set_key(dev,
ipw->u.crypt.idx, ipw->u.crypt.idx,
ieee->pairwise_key_type, ipw->u.crypt.idx,
(u8 *)ieee->ap_mac_addr, ieee->pairwise_key_type,
0, key); (u8 *)ieee->ap_mac_addr,
0, key);
} }
} }
if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) if ((ieee->pairwise_key_type == KEY_TYPE_CCMP)
...@@ -2422,10 +2424,10 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -2422,10 +2424,10 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
ipw->u.crypt.idx, ipw->u.crypt.idx,
ieee->group_key_type, ieee->group_key_type,
broadcast_addr, 0, key, 0); broadcast_addr, 0, key, 0);
setKey(dev, ipw->u.crypt.idx, rtl92e_set_key(dev, ipw->u.crypt.idx,
ipw->u.crypt.idx, ipw->u.crypt.idx,
ieee->group_key_type, ieee->group_key_type,
broadcast_addr, 0, key); broadcast_addr, 0, key);
} }
} }
} }
......
...@@ -756,8 +756,8 @@ static int r8192_wx_set_enc(struct net_device *dev, ...@@ -756,8 +756,8 @@ static int r8192_wx_set_enc(struct net_device *dev,
else if (wrqu->encoding.length == 0xd) { else if (wrqu->encoding.length == 0xd) {
ieee->pairwise_key_type = KEY_TYPE_WEP104; ieee->pairwise_key_type = KEY_TYPE_WEP104;
rtl92e_enable_hw_security_config(dev); rtl92e_enable_hw_security_config(dev);
setKey(dev, key_idx, key_idx, KEY_TYPE_WEP104, rtl92e_set_key(dev, key_idx, key_idx, KEY_TYPE_WEP104,
zero_addr[key_idx], 0, hwkey); zero_addr[key_idx], 0, hwkey);
set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104, set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104,
zero_addr[key_idx], 0, hwkey, 0); zero_addr[key_idx], 0, hwkey, 0);
} else { } else {
...@@ -950,19 +950,20 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, ...@@ -950,19 +950,20 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode != 2)) { if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode != 2)) {
if (ext->key_len == 13) if (ext->key_len == 13)
ieee->pairwise_key_type = alg = KEY_TYPE_WEP104; ieee->pairwise_key_type = alg = KEY_TYPE_WEP104;
setKey(dev, idx, idx, alg, zero, 0, key); rtl92e_set_key(dev, idx, idx, alg, zero, 0, key);
set_swcam(dev, idx, idx, alg, zero, 0, key, 0); set_swcam(dev, idx, idx, alg, zero, 0, key, 0);
} else if (group) { } else if (group) {
ieee->group_key_type = alg; ieee->group_key_type = alg;
setKey(dev, idx, idx, alg, broadcast_addr, 0, key); rtl92e_set_key(dev, idx, idx, alg, broadcast_addr, 0,
key);
set_swcam(dev, idx, idx, alg, broadcast_addr, 0, set_swcam(dev, idx, idx, alg, broadcast_addr, 0,
key, 0); key, 0);
} else { } else {
if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) &&
ieee->pHTInfo->bCurrentHTSupport) ieee->pHTInfo->bCurrentHTSupport)
write_nic_byte(dev, 0x173, 1); write_nic_byte(dev, 0x173, 1);
setKey(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr, rtl92e_set_key(dev, 4, idx, alg,
0, key); (u8 *)ieee->ap_mac_addr, 0, key);
set_swcam(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr, set_swcam(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr,
0, key, 0); 0, key, 0);
} }
......
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