Commit 05a15740 authored by Aditya Shankar's avatar Aditya Shankar Committed by Greg Kroah-Hartman

staging: wilc1000: Connect to highest RSSI value for required SSID

Connect to the highest rssi with the required SSID in the shadow
table if the connection criteria is based only on the SSID.
For the first matching SSID, an index to the table is saved.
Later the index is updated if matching SSID has a higher
RSSI value than the last saved index.

However if decision is made based on BSSID, there is only one match
in the table and corresponding index is used.

changes in v2:
initialize sel_bssi_idx to UINT_MAX.
Combine two checks for identifying
sel_bssi_idx value for a SSID.
Signed-off-by: default avatarAditya Shankar <aditya.shankar@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f631a970
...@@ -665,6 +665,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -665,6 +665,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
{ {
s32 s32Error = 0; s32 s32Error = 0;
u32 i; u32 i;
u32 sel_bssi_idx = UINT_MAX;
u8 u8security = NO_ENCRYPT; u8 u8security = NO_ENCRYPT;
enum AUTHTYPE tenuAuth_type = ANY; enum AUTHTYPE tenuAuth_type = ANY;
...@@ -688,18 +689,24 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -688,18 +689,24 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
memcmp(last_scanned_shadow[i].ssid, memcmp(last_scanned_shadow[i].ssid,
sme->ssid, sme->ssid,
sme->ssid_len) == 0) { sme->ssid_len) == 0) {
if (!sme->bssid) if (!sme->bssid) {
break; if (sel_bssi_idx == UINT_MAX ||
else last_scanned_shadow[i].rssi >
last_scanned_shadow[sel_bssi_idx].rssi)
sel_bssi_idx = i;
} else {
if (memcmp(last_scanned_shadow[i].bssid, if (memcmp(last_scanned_shadow[i].bssid,
sme->bssid, sme->bssid,
ETH_ALEN) == 0) ETH_ALEN) == 0) {
sel_bssi_idx = i;
break; break;
}
}
} }
} }
if (i < last_scanned_cnt) { if (sel_bssi_idx < last_scanned_cnt) {
pstrNetworkInfo = &last_scanned_shadow[i]; pstrNetworkInfo = &last_scanned_shadow[sel_bssi_idx];
} else { } else {
s32Error = -ENOENT; s32Error = -ENOENT;
wilc_connecting = 0; wilc_connecting = 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