[PATCH] Kill most of netqueue macros

Marcelo Tosatti marcelo at kvack.org
Wed Jun 7 20:28:02 EDT 2006


Kill more os macros: os_{start,stop}_queue, os_carrier_{on,off}
and UpdateTransStart.

Signed-off-by: Marcelo Tosatti <marcelo at kvack.org>

diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 93a60d1..0370ee3 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -146,7 +146,8 @@ static void if_usb_write_bulk_callback(s
 		PRINTM(INFO, "URB status is successfull\n");
 		PRINTM(INFO, "Actual length transmitted %d\n", urb->actual_length);
 		priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
-		os_start_queue(priv);
+		if (priv->adapter->MediaConnectStatus==WlanMediaStateConnected)
+			netif_wake_queue(priv->wlan_dev.netdev);
 	}
 
 	if (!cardp->IsFWDnld) {
diff --git a/drivers/net/wireless/libertas/os_macros.h b/drivers/net/wireless/libertas/os_macros.h
index eaa878f..d6d7dac 100644
--- a/drivers/net/wireless/libertas/os_macros.h
+++ b/drivers/net/wireless/libertas/os_macros.h
@@ -22,10 +22,6 @@ #define _OS_MACROS_H
 
 extern spinlock_t	driver_lock;
 
-#define UpdateTransStart(dev) { \
-	dev->trans_start = jiffies; \
-}
-
 #define OS_SET_THREAD_STATE(x)		set_current_state(x)
 
 #define MODULE_GET	try_module_get(THIS_MODULE)
@@ -83,34 +79,6 @@ #define IPFIELD_ALIGN_OFFSET	2
  tx-timeout
  */
 
-static inline void os_carrier_on(wlan_private *priv) 
-{
-	if (!netif_carrier_ok(priv->wlan_dev.netdev) &&
-		(priv->adapter->MediaConnectStatus == WlanMediaStateConnected))
-		netif_carrier_on(priv->wlan_dev.netdev);
-}
-
-static inline void os_carrier_off(wlan_private *priv) 
-{
-	if (netif_carrier_ok(priv->wlan_dev.netdev))
-		netif_carrier_off(priv->wlan_dev.netdev);
-}
-
-static inline void os_start_queue(wlan_private *priv) 
-{
-	if (netif_queue_stopped(priv->wlan_dev.netdev) && 
- 		(priv->adapter->MediaConnectStatus == WlanMediaStateConnected)) {
-		netif_wake_queue(priv->wlan_dev.netdev);
-	}
-}
-
-static inline void os_stop_queue(wlan_private *priv) 
-{
-	if (!netif_queue_stopped(priv->wlan_dev.netdev)) {
-		netif_stop_queue(priv->wlan_dev.netdev);
-	}
-}
-
 static inline int os_queue_is_active(wlan_private *priv)
 {
     return (netif_carrier_ok(priv->wlan_dev.netdev)
diff --git a/drivers/net/wireless/libertas/wlan_cmdresp.c b/drivers/net/wireless/libertas/wlan_cmdresp.c
index dc38a6f..f8c3432 100644
--- a/drivers/net/wireless/libertas/wlan_cmdresp.c
+++ b/drivers/net/wireless/libertas/wlan_cmdresp.c
@@ -89,8 +89,8 @@ void MacEventDisconnected(wlan_private *
 	wlan_send_rxskbQ(priv);
 
 	/* report disconnect to upper layer */
-	os_stop_queue(priv);
-	os_carrier_off(priv);
+	netif_stop_queue(priv->wlan_dev.netdev);
+	netif_carrier_off(priv->wlan_dev.netdev);
 
 	/* reset SNR/NF/RSSI values */
 	memset(Adapter->SNR, 0x00, sizeof(Adapter->SNR));
diff --git a/drivers/net/wireless/libertas/wlan_join.c b/drivers/net/wireless/libertas/wlan_join.c
index f20c8b8..857e4e6 100644
--- a/drivers/net/wireless/libertas/wlan_join.c
+++ b/drivers/net/wireless/libertas/wlan_join.c
@@ -1377,8 +1377,8 @@ int wlan_ret_802_11_associate(wlan_priva
 
 
     {
-        os_carrier_on(priv);
-        os_start_queue(priv);
+        netif_carrier_on(priv->wlan_dev.netdev);
+        netif_wake_queue(priv->wlan_dev.netdev);
     }
 
     PRINTM(INFO, "ASSOC_RESP: Associated \n");
@@ -1493,8 +1493,8 @@ int wlan_ret_802_11_ad_hoc_start(wlan_pr
            &pBSSDesc->Ssid,
            sizeof(struct WLAN_802_11_SSID));
 
-    os_carrier_on(priv);
-    os_start_queue(priv);
+    netif_carrier_on(priv->wlan_dev.netdev);
+    netif_wake_queue(priv->wlan_dev.netdev);
 
     memset(&wrqu, 0, sizeof(wrqu));
     memcpy(wrqu.ap_addr.sa_data, Adapter->CurBssParams.bssid, ETH_ALEN);
diff --git a/drivers/net/wireless/libertas/wlan_main.c b/drivers/net/wireless/libertas/wlan_main.c
index 41ef1df..ecd125e 100644
--- a/drivers/net/wireless/libertas/wlan_main.c
+++ b/drivers/net/wireless/libertas/wlan_main.c
@@ -258,12 +258,13 @@ static int wlan_open(struct net_device *
 
 	priv->open = TRUE;
 
-	if (adapter->MediaConnectStatus == WlanMediaStateConnected)
-		os_carrier_on(priv);
-	else
-		os_carrier_off(priv);
+	if (adapter->MediaConnectStatus == WlanMediaStateConnected) {
+		netif_carrier_on(priv->wlan_dev.netdev);
+		netif_wake_queue(priv->wlan_dev.netdev);
+	} else
+		netif_carrier_off(priv->wlan_dev.netdev);
 
-	os_start_queue(priv);
+	
 
 	LEAVE();
 	return WLAN_STATUS_SUCCESS;
@@ -283,8 +284,8 @@ static int wlan_close(struct net_device 
 
 	/* Flush all the packets upto the OS before stopping */
 	wlan_send_rxskbQ(priv);
-	os_stop_queue(priv);
-	os_carrier_off(priv);
+	netif_stop_queue(priv->wlan_dev.netdev);
+	netif_carrier_off(priv->wlan_dev.netdev);
 
 	MODULE_PUT;
 
@@ -420,15 +421,15 @@ static int wlan_hard_start_xmit(struct s
 
     	ENTER();
 
-	os_stop_queue(priv);
-
+	netif_stop_queue(priv->wlan_dev.netdev);
+	
 	if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) {
 		priv->stats.tx_dropped++;
 		goto done;
 	}
 
 	if (wlan_process_tx(priv, skb) == 0)
-		UpdateTransStart(dev);
+		dev->trans_start = jiffies;
 done:
 
 	LEAVE();
@@ -451,7 +452,7 @@ static void wlan_tx_timeout(struct net_d
 	PRINTM(FATAL, "tx watch dog timeout!\n");
 
 	priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
-	UpdateTransStart(dev);
+	dev->trans_start = jiffies;
 
 	if (priv->adapter->CurrentTxSkb) {
 		if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) {
@@ -461,10 +462,8 @@ static void wlan_tx_timeout(struct net_d
 			SendTxFeedback(priv);
 		} else
 		wake_up_interruptible(&priv->MainThread.waitQ);
-	}
-	else {
-		os_start_queue(priv);
-	}
+	} else if (priv->adapter->MediaConnectStatus == WlanMediaStateConnected)
+		netif_wake_queue(priv->wlan_dev.netdev);
 
 	LEAVE();
 }
@@ -1013,8 +1012,8 @@ #endif
 
 	/* Flush all the packets upto the OS before stopping */
 	wlan_send_rxskbQ(priv);
-	os_stop_queue(priv);
-	os_carrier_off(priv);
+	netif_stop_queue(priv->wlan_dev.netdev);
+	netif_carrier_off(priv->wlan_dev.netdev);
 
 	Adapter->SurpriseRemoved = TRUE;
 
diff --git a/drivers/net/wireless/libertas/wlan_scan.c b/drivers/net/wireless/libertas/wlan_scan.c
index cc9f898..f6e44e3 100644
--- a/drivers/net/wireless/libertas/wlan_scan.c
+++ b/drivers/net/wireless/libertas/wlan_scan.c
@@ -821,8 +821,8 @@ static int wlan_scan_networks(wlan_priva
 
     /* Keep the data path active if we are only scanning our current channel */
     if (!scanCurrentChanOnly) {
-        os_stop_queue(priv);
-        os_carrier_off(priv);
+        netif_stop_queue(priv->wlan_dev.netdev);
+        netif_carrier_off(priv->wlan_dev.netdev);
     }
 
 
@@ -839,9 +839,10 @@ static int wlan_scan_networks(wlan_priva
      */
     wlan_scan_process_results(priv);
 
-
-    os_carrier_on(priv);
-    os_start_queue(priv);
+    if (priv->adapter->MediaConnectStatus == WlanMediaStateConnected) {
+        netif_carrier_on(priv->wlan_dev.netdev);
+        netif_wake_queue(priv->wlan_dev.netdev);
+    }
 
     LEAVE();
     return ret;
diff --git a/drivers/net/wireless/libertas/wlan_tx.c b/drivers/net/wireless/libertas/wlan_tx.c
index 704d947..e7763c6 100644
--- a/drivers/net/wireless/libertas/wlan_tx.c
+++ b/drivers/net/wireless/libertas/wlan_tx.c
@@ -174,7 +174,7 @@ done:
 		   received from FW */
 		skb_orphan(skb);
 		/* stop processing outgoing pkts */
-		os_stop_queue(priv);
+		netif_stop_queue(priv->wlan_dev.netdev);
 		/* freeze any packets already in our queues */
 		priv->adapter->TxLockFlag = 1;
 	} else {
@@ -334,5 +334,6 @@ #endif
 	os_upload_rx_packet(priv, Adapter->CurrentTxSkb);
 	Adapter->CurrentTxSkb = NULL;
 	priv->adapter->TxLockFlag = 0;
-	os_start_queue(priv);
+	if (priv->adapter->MediaConnectStatus == WlanMediaStateConnected)	
+		netif_wake_queue(priv->wlan_dev.netdev);
 }



More information about the libertas-dev mailing list