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,
}
}
void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent)
void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex,
u16 KeyType, const u8 *MacAddr, u8 DefaultKey,
u32 *KeyContent)
{
u32 TargetCommand = 0;
u32 TargetContent = 0;
......@@ -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__);
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);
if (DefaultKey)
......@@ -179,33 +180,38 @@ void rtl92e_cam_restore(struct net_device *dev)
for (EntryId = 0; EntryId < 4; EntryId++) {
MacAddr = CAM_CONST_ADDR[EntryId];
if (priv->rtllib->swcamtable[EntryId].bused) {
setKey(dev, EntryId, EntryId,
priv->rtllib->pairwise_key_type, MacAddr,
0, (u32 *)(&priv->rtllib->swcamtable
rtl92e_set_key(dev, 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) {
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
setKey(dev, 4, 0, priv->rtllib->pairwise_key_type,
rtl92e_set_key(dev, 4, 0,
priv->rtllib->pairwise_key_type,
(u8 *)dev->dev_addr, 0,
(u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
(u32 *)(&priv->rtllib->swcamtable[4].
key_buf[0]));
} else {
setKey(dev, 4, 0, priv->rtllib->pairwise_key_type,
rtl92e_set_key(dev, 4, 0,
priv->rtllib->pairwise_key_type,
MacAddr, 0,
(u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
(u32 *)(&priv->rtllib->swcamtable[4].
key_buf[0]));
}
} else if (priv->rtllib->pairwise_key_type == KEY_TYPE_CCMP) {
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
setKey(dev, 4, 0,
rtl92e_set_key(dev, 4, 0,
priv->rtllib->pairwise_key_type,
(u8 *)dev->dev_addr, 0,
(u32 *)(&priv->rtllib->swcamtable[4].
key_buf[0]));
} else {
setKey(dev, 4, 0,
rtl92e_set_key(dev, 4, 0,
priv->rtllib->pairwise_key_type, MacAddr,
0, (u32 *)(&priv->rtllib->swcamtable[4].
key_buf[0]));
......@@ -216,20 +222,18 @@ void rtl92e_cam_restore(struct net_device *dev)
MacAddr = CAM_CONST_BROAD;
for (EntryId = 1; EntryId < 4; EntryId++) {
if (priv->rtllib->swcamtable[EntryId].bused) {
setKey(dev, EntryId, EntryId,
rtl92e_set_key(dev, EntryId, EntryId,
priv->rtllib->group_key_type,
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->swcamtable[0].bused) {
setKey(dev, 0, 0,
rtl92e_set_key(dev, 0, 0,
priv->rtllib->group_key_type,
CAM_CONST_ADDR[0], 0,
(u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])
);
(u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]));
} else {
netdev_warn(dev,
"%s(): ADHOC TKIP: missing key entry.\n",
......@@ -241,7 +245,7 @@ void rtl92e_cam_restore(struct net_device *dev)
MacAddr = CAM_CONST_BROAD;
for (EntryId = 1; EntryId < 4; EntryId++) {
if (priv->rtllib->swcamtable[EntryId].bused) {
setKey(dev, EntryId, EntryId,
rtl92e_set_key(dev, EntryId, EntryId,
priv->rtllib->group_key_type,
MacAddr, 0,
(u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0]));
......@@ -250,7 +254,7 @@ void rtl92e_cam_restore(struct net_device *dev)
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
if (priv->rtllib->swcamtable[0].bused) {
setKey(dev, 0, 0,
rtl92e_set_key(dev, 0, 0,
priv->rtllib->group_key_type,
CAM_CONST_ADDR[0], 0,
(u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]));
......
......@@ -30,8 +30,9 @@ struct net_device;
void rtl92e_cam_reset(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,
const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex,
u16 KeyType, const u8 *MacAddr, u8 DefaultKey,
u32 *KeyContent);
void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh);
void rtl92e_cam_restore(struct net_device *dev);
......
......@@ -2380,16 +2380,18 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
ieee->pairwise_key_type,
(u8 *)ieee->ap_mac_addr,
0, key, 0);
setKey(dev, 4, ipw->u.crypt.idx,
rtl92e_set_key(dev, 4, ipw->u.crypt.idx,
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) {
set_swcam(dev, ipw->u.crypt.idx,
ipw->u.crypt.idx,
ieee->pairwise_key_type,
(u8 *)ieee->ap_mac_addr,
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,
(u8 *)ieee->ap_mac_addr,
......@@ -2422,7 +2424,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
ipw->u.crypt.idx,
ieee->group_key_type,
broadcast_addr, 0, key, 0);
setKey(dev, ipw->u.crypt.idx,
rtl92e_set_key(dev, ipw->u.crypt.idx,
ipw->u.crypt.idx,
ieee->group_key_type,
broadcast_addr, 0, key);
......
......@@ -756,7 +756,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
else if (wrqu->encoding.length == 0xd) {
ieee->pairwise_key_type = KEY_TYPE_WEP104;
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);
set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104,
zero_addr[key_idx], 0, hwkey, 0);
......@@ -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 (ext->key_len == 13)
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);
} else if (group) {
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,
key, 0);
} else {
if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) &&
ieee->pHTInfo->bCurrentHTSupport)
write_nic_byte(dev, 0x173, 1);
setKey(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr,
0, key);
rtl92e_set_key(dev, 4, idx, alg,
(u8 *)ieee->ap_mac_addr, 0, key);
set_swcam(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr,
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