[PATCH 018/510] beceem: Add proper carrier and link management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Stephen Hemminger <stephen.hemminger@xxxxxxxxxx>

Start with carrier off.
Don't track up/down status in driver private flag.

Signed-off-by: Stephen Hemminger <shemminger@xxxxxxxxxx>
---
 drivers/staging/bcm/Adapter.h     |    1 -
 drivers/staging/bcm/Bcmnet.c      |    3 +--
 drivers/staging/bcm/InterfaceRx.c |    2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h
index 9c9dff3..c679b71 100644
--- a/drivers/staging/bcm/Adapter.h
+++ b/drivers/staging/bcm/Adapter.h
@@ -498,7 +498,6 @@ struct _MINI_ADAPTER
 	int 				irq;
 	unsigned long 		chip_id;
 	unsigned int		bFlashBoot;
-	unsigned int 		if_up;
 //	spinlock_t			sleeper_lock;
 	atomic_t			rdm_wrm_access;
 	atomic_t			tx_rx_access;
diff --git a/drivers/staging/bcm/Bcmnet.c b/drivers/staging/bcm/Bcmnet.c
index c77c1d1..9518e38 100644
--- a/drivers/staging/bcm/Bcmnet.c
+++ b/drivers/staging/bcm/Bcmnet.c
@@ -17,7 +17,6 @@ static INT bcm_open(struct net_device *dev)
     BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "======>");
     if(Adapter->fw_download_done==FALSE)
         return -EINVAL;
-	Adapter->if_up=1;
 	if(Adapter->LinkUpStatus == 1){
 		if(netif_queue_stopped(Adapter->dev)){
 			netif_carrier_on(Adapter->dev);
@@ -34,7 +33,6 @@ static INT bcm_close(struct net_device *dev)
    PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
 
     BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "=====>");
-	Adapter->if_up=0;
 	if(!netif_queue_stopped(dev)) {
 		netif_carrier_off(dev);
 	    netif_stop_queue(dev);
@@ -145,6 +143,7 @@ int register_networkdev(PMINI_ADAPTER Adapter)
 	net->ethtool_ops = &bcm_ethtool_ops;
 	net->mtu          = MTU_SIZE; /* 1400 Bytes */
 	net->tx_queue_len = TX_QLEN;
+	netif_carrier_off(net);
 
 	SET_NETDEV_DEV(net, &uintf->dev);
 	SET_NETDEV_DEVTYPE(net, &wimax_type);
diff --git a/drivers/staging/bcm/InterfaceRx.c b/drivers/staging/bcm/InterfaceRx.c
index 128aa91..ab33895 100644
--- a/drivers/staging/bcm/InterfaceRx.c
+++ b/drivers/staging/bcm/InterfaceRx.c
@@ -148,7 +148,7 @@ static void read_bulk_callback(struct urb *urb)
 		atomic_add(pLeader->PLength, &Adapter->GoodRxByteCount);
         BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "Recived Data pkt of len :0x%X", pLeader->PLength);
 
-		if(Adapter->if_up)
+		if(netif_running(Adapter->dev))
 		{
 			/* Moving ahead by ETH_HLEN to the data ptr as received from FW */
 			skb_pull(skb, ETH_HLEN);
-- 
1.7.3.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux