[PATCH] MESH ALWAYS ON
Brajesh Dave
brajeshd at marvell.com
Thu Oct 18 02:47:56 EDT 2007
The patch implements Mesh Always On feature in the driver.
>From fd7c8d183c0355fb9484952f8b47b3aaceaadc5c Mon Sep 17 00:00:00 2001
From: root <root at localhost.localdomain>
Date: Thu, 18 Oct 2007 16:11:26 +0530
Subject: [PATCH] MESH ALWAYS ON
---
drivers/net/wireless/libertas/cmd.c | 3 +-
drivers/net/wireless/libertas/cmdresp.c | 2 +-
drivers/net/wireless/libertas/dev.h | 1 +
drivers/net/wireless/libertas/if_usb.c | 3 +-
drivers/net/wireless/libertas/join.c | 9 -------
drivers/net/wireless/libertas/main.c | 35
++++++++++++++++++++++-------
drivers/net/wireless/libertas/scan.c | 12 ++++++----
drivers/net/wireless/libertas/tx.c | 11 ++++++---
drivers/net/wireless/libertas/wext.c | 36
+++++++++++++++++++++++-------
9 files changed, 73 insertions(+), 39 deletions(-)
diff --git a/drivers/net/wireless/libertas/cmd.c
b/drivers/net/wireless/libertas/cmd.c
index ce28417..98295e1 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1752,7 +1752,8 @@ int libertas_execute_next_command(wlan_private *
priv)
*/
if ((adapter->psmode != WLAN802_11POWERMODECAM) &&
(adapter->psstate == PS_STATE_FULL_POWER) &&
- (adapter->connect_status == LIBERTAS_CONNECTED)) {
+ ((adapter->connect_status == LIBERTAS_CONNECTED) ||
+ (adapter->mesh_connect_status ==
LIBERTAS_CONNECTED)) ) {
if (adapter->secinfo.WPAenabled ||
adapter->secinfo.WPA2enabled) {
/* check for valid WPA group keys */
diff --git a/drivers/net/wireless/libertas/cmdresp.c
b/drivers/net/wireless/libertas/cmdresp.c
index c43b272..da72dfc 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -974,7 +974,7 @@ int libertas_process_event(wlan_private * priv)
break;
}
lbs_pr_info("EVENT: MESH_AUTO_STARTED\n");
- adapter->connect_status = LIBERTAS_CONNECTED;
+ adapter->mesh_connect_status = LIBERTAS_CONNECTED;
if (priv->mesh_open == 1) {
netif_wake_queue(priv->mesh_dev);
netif_carrier_on(priv->mesh_dev);
diff --git a/drivers/net/wireless/libertas/dev.h
b/drivers/net/wireless/libertas/dev.h
index 762c479..5302074 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -294,6 +294,7 @@ struct _wlan_adapter {
/** NIC Operation characteristics */
u16 currentpacketfilter;
u32 connect_status;
+ u32 mesh_connect_status;
u16 regioncode;
u16 txpowerlevel;
diff --git a/drivers/net/wireless/libertas/if_usb.c
b/drivers/net/wireless/libertas/if_usb.c
index 13a7263..82888e4 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -80,7 +80,8 @@ static void if_usb_write_bulk_callback(struct urb
*urb)
/* Wake main thread if commands are pending */
if (!adapter->cur_cmd)
wake_up_interruptible(&priv->waitq);
- if ((adapter->connect_status == LIBERTAS_CONNECTED)) {
+ if ( (adapter->connect_status == LIBERTAS_CONNECTED)
||
+ (adapter->mesh_connect_status ==
LIBERTAS_CONNECTED) ) {
netif_wake_queue(dev);
netif_wake_queue(priv->mesh_dev);
}
diff --git a/drivers/net/wireless/libertas/join.c
b/drivers/net/wireless/libertas/join.c
index ccb0df1..4408579 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -750,10 +750,6 @@ int libertas_ret_80211_associate(wlan_private *
priv,
netif_carrier_on(priv->dev);
netif_wake_queue(priv->dev);
- if (priv->mesh_dev) {
- netif_carrier_on(priv->mesh_dev);
- netif_wake_queue(priv->mesh_dev);
- }
lbs_deb_join("ASSOC_RESP: Associated \n");
@@ -840,11 +836,6 @@ int libertas_ret_80211_ad_hoc_start(wlan_private *
priv,
netif_carrier_on(priv->dev);
netif_wake_queue(priv->dev);
- if (priv->mesh_dev) {
- netif_carrier_on(priv->mesh_dev);
- netif_wake_queue(priv->mesh_dev);
- }
-
memset(&wrqu, 0, sizeof(wrqu));
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid,
ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
diff --git a/drivers/net/wireless/libertas/main.c
b/drivers/net/wireless/libertas/main.c
index 38eea15..83d534b 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -410,12 +410,16 @@ static int libertas_dev_open(struct net_device
*dev)
if (adapter->connect_status == LIBERTAS_CONNECTED) {
netif_carrier_on(priv->dev);
- if (priv->mesh_dev)
- netif_carrier_on(priv->mesh_dev);
- } else {
+ }
+ else {
netif_carrier_off(priv->dev);
- if (priv->mesh_dev)
- netif_carrier_off(priv->mesh_dev);
+ }
+
+ if (adapter->mesh_connect_status == LIBERTAS_CONNECTED) {
+ netif_carrier_on(priv->mesh_dev);
+ }
+ else {
+ netif_carrier_off(priv->mesh_dev);
}
lbs_deb_leave(LBS_DEB_NET);
@@ -435,6 +439,11 @@ static int libertas_mesh_open(struct net_device
*dev)
return -1;
priv->mesh_open = 1 ;
netif_wake_queue(priv->mesh_dev);
+
+ priv->adapter->mesh_connect_status = LIBERTAS_CONNECTED;
+
+ netif_carrier_on(priv->mesh_dev);
+ netif_wake_queue(priv->mesh_dev);
if (priv->infra_open == 0)
return libertas_dev_open(priv->dev) ;
return 0;
@@ -550,7 +559,8 @@ static int libertas_mesh_pre_start_xmit(struct
sk_buff *skb,
SET_MESH_FRAME(skb);
- ret = libertas_hard_start_xmit(skb, priv->dev);
+
+ ret = libertas_hard_start_xmit(skb, priv->mesh_dev);
lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
return ret;
}
@@ -597,10 +607,16 @@ static void libertas_tx_timeout(struct net_device
*dev)
libertas_send_tx_feedback(priv);
} else
wake_up_interruptible(&priv->waitq);
- } else if (priv->adapter->connect_status == LIBERTAS_CONNECTED)
{
+ } else if(dev == priv->dev){
+
+ if (priv->adapter->connect_status == LIBERTAS_CONNECTED)
netif_wake_queue(priv->dev);
- if (priv->mesh_dev)
- netif_wake_queue(priv->mesh_dev);
+
+ }else if(dev == priv->mesh_dev){
+
+ if (priv->adapter->mesh_connect_status ==
LIBERTAS_CONNECTED)
+ netif_wake_queue(priv->mesh_dev);
+
}
lbs_deb_leave(LBS_DEB_TX);
@@ -1095,6 +1111,7 @@ static void wlan_init_adapter(wlan_private * priv)
int i;
adapter->connect_status = LIBERTAS_DISCONNECTED;
+ adapter->mesh_connect_status = LIBERTAS_DISCONNECTED;
memset(adapter->current_addr, 0xff, ETH_ALEN);
/* 802.11 specific */
diff --git a/drivers/net/wireless/libertas/scan.c
b/drivers/net/wireless/libertas/scan.c
index e2e9ebc..540d3fc 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -256,7 +256,8 @@ static void
wlan_scan_create_channel_list(wlan_private * priv,
for (rgnidx = 0; rgnidx < ARRAY_SIZE(adapter->region_channel);
rgnidx++) {
if (priv->adapter->enable11d &&
- adapter->connect_status != LIBERTAS_CONNECTED) {
+ (adapter->connect_status != LIBERTAS_CONNECTED) &&
+ (adapter->mesh_connect_status != LIBERTAS_CONNECTED)
) {
/* Scan all the supported chan for the first
scan */
if (!adapter->universal_channel[rgnidx].valid)
continue;
@@ -841,10 +842,11 @@ int wlan_scan_networks(wlan_private * priv,
if (priv->adapter->connect_status == LIBERTAS_CONNECTED) {
netif_carrier_on(priv->dev);
netif_wake_queue(priv->dev);
- if (priv->mesh_dev) {
- netif_carrier_on(priv->mesh_dev);
- netif_wake_queue(priv->mesh_dev);
- }
+ }
+
+ if (priv->adapter->mesh_connect_status == LIBERTAS_CONNECTED) {
+ netif_carrier_on(priv->mesh_dev);
+ netif_wake_queue(priv->mesh_dev);
}
out:
diff --git a/drivers/net/wireless/libertas/tx.c
b/drivers/net/wireless/libertas/tx.c
index fbec06c..bc9c2e1 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -273,10 +273,13 @@ void libertas_send_tx_feedback(wlan_private *
priv)
libertas_upload_rx_packet(priv, adapter->currenttxskb);
adapter->currenttxskb = NULL;
priv->adapter->TxLockFlag = 0;
- if (priv->adapter->connect_status == LIBERTAS_CONNECTED) {
+
+ if (priv->adapter->connect_status == LIBERTAS_CONNECTED)
netif_wake_queue(priv->dev);
- if (priv->mesh_dev)
- netif_wake_queue(priv->mesh_dev);
- }
+
+ if (priv->adapter->mesh_connect_status == LIBERTAS_CONNECTED)
+ netif_wake_queue(priv->mesh_dev);
+
+
}
EXPORT_SYMBOL_GPL(libertas_send_tx_feedback);
diff --git a/drivers/net/wireless/libertas/wext.c
b/drivers/net/wireless/libertas/wext.c
index e692729..aa46335 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -142,7 +142,8 @@ static void copy_active_data_rates(wlan_adapter *
adapter, u8 * rates)
{
lbs_deb_enter(LBS_DEB_WEXT);
- if (adapter->connect_status != LIBERTAS_CONNECTED)
+ if ((adapter->connect_status != LIBERTAS_CONNECTED) &&
+ (adapter->mesh_connect_status != LIBERTAS_CONNECTED))
memcpy(rates, libertas_bg_rates, MAX_RATES);
else
memcpy(rates, adapter->curbssparams.rates, MAX_RATES);
@@ -283,7 +284,7 @@ static int mesh_get_nick(struct net_device *dev,
struct iw_request_info *info,
/* Use nickname to indicate that mesh is on */
- if (adapter->connect_status == LIBERTAS_CONNECTED) {
+ if (adapter->mesh_connect_status == LIBERTAS_CONNECTED) {
strncpy(extra, "Mesh", 12);
extra[12] = '\0';
dwrq->length = strlen(extra);
@@ -597,7 +598,8 @@ static int wlan_get_range(struct net_device *dev,
struct iw_request_info *info,
range->num_frequency = 0;
if (priv->adapter->enable11d &&
- adapter->connect_status == LIBERTAS_CONNECTED) {
+ (adapter->connect_status == LIBERTAS_CONNECTED ||
+ adapter->mesh_connect_status == LIBERTAS_CONNECTED)) {
u8 chan_no;
u8 band;
@@ -780,7 +782,9 @@ static int wlan_set_power(struct net_device *dev,
struct iw_request_info *info,
adapter->psmode = WLAN802_11POWERMODEMAX_PSP;
- if (adapter->connect_status == LIBERTAS_CONNECTED) {
+ if ( (adapter->connect_status == LIBERTAS_CONNECTED)||
+ (adapter->mesh_connect_status == LIBERTAS_CONNECTED) ) {
+
libertas_ps_sleep(priv, CMD_OPTION_WAITFORRSP);
}
@@ -799,12 +803,24 @@ static int wlan_get_power(struct net_device *dev,
struct iw_request_info *info,
mode = adapter->psmode;
- if ((vwrq->disabled = (mode == WLAN802_11POWERMODECAM))
- || adapter->connect_status == LIBERTAS_DISCONNECTED)
+ if(dev == priv->dev)
{
- goto out;
+ if ((vwrq->disabled = (mode == WLAN802_11POWERMODECAM))
+ || adapter->connect_status == LIBERTAS_DISCONNECTED)
+ {
+ goto out;
+ }
}
+ if(dev == priv->mesh_dev)
+ {
+ if ((vwrq->disabled = (mode == WLAN802_11POWERMODECAM))
+ || adapter->mesh_connect_status ==
LIBERTAS_DISCONNECTED)
+ {
+ goto out;
+ }
+
+ }
vwrq->value = 0;
out:
@@ -885,7 +901,8 @@ static struct iw_statistics
*wlan_get_wireless_stats(struct net_device *dev)
priv->wstats.status = adapter->mode;
/* If we're not associated, all quality values are meaningless
*/
- if (adapter->connect_status != LIBERTAS_CONNECTED)
+ if( (adapter->connect_status != LIBERTAS_CONNECTED)&&
+ (adapter->mesh_connect_status != LIBERTAS_CONNECTED))
goto out;
/* Quality by RSSI */
@@ -1080,7 +1097,8 @@ static int wlan_get_rate(struct net_device *dev,
struct iw_request_info *info,
lbs_deb_enter(LBS_DEB_WEXT);
- if (adapter->connect_status == LIBERTAS_CONNECTED) {
+ if( (adapter->connect_status == LIBERTAS_CONNECTED) ||
+ (adapter->mesh_connect_status == LIBERTAS_CONNECTED)) {
vwrq->value = adapter->cur_rate * 500000;
if (adapter->auto_rate)
--
1.5.2.4
More information about the libertas-dev
mailing list