Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1448787

[PATCH 2/9] staging: slicoss: notifiy network stack about change in link state

From Lino Sanfilippo <LinoSanfilippo@gmx.de>
Newsgroups linux.kernel
Subject [PATCH 2/9] staging: slicoss: notifiy network stack about change in link state
Date 2016-07-22 23:20 +0200
Message-ID <rXQ1s-2G8-23@gated-at.bofh.it> (permalink)
References <rXQ1r-2G8-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Notify the network stack about link states via netif_carrier_[off|on]().
Also set the link state off initially and when the interface is brought
down.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
---
 drivers/staging/slicoss/slicoss.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index dae07410..a9323a9 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1016,6 +1016,7 @@ static void slic_link_upr_complete(struct adapter *adapter, u32 isr)
 	/* link has gone from up to down */
 	if (linkup == LINK_DOWN) {
 		adapter->linkstate = LINK_DOWN;
+		netif_carrier_off(adapter->netdev);
 		return;
 	}
 
@@ -1028,6 +1029,7 @@ static void slic_link_upr_complete(struct adapter *adapter, u32 isr)
 		slic_config_set(adapter, true);
 		adapter->linkstate = LINK_UP;
 		netif_start_queue(adapter->netdev);
+		netif_carrier_on(adapter->netdev);
 	}
 }
 
@@ -2418,6 +2420,7 @@ static int slic_entry_open(struct net_device *dev)
 	int status;
 
 	netif_stop_queue(adapter->netdev);
+	netif_carrier_off(dev);
 
 	spin_lock_irqsave(&slic_global.driver_lock, flags);
 	if (!adapter->activated) {
@@ -2530,6 +2533,9 @@ static int slic_entry_halt(struct net_device *dev)
 #endif
 
 	spin_unlock_irqrestore(&slic_global.driver_lock, flags);
+
+	netif_carrier_off(dev);
+
 	return 0;
 }
 
@@ -3172,6 +3178,8 @@ static int slic_entry_probe(struct pci_dev *pcidev,
 	netdev->irq = adapter->irq;
 	netdev->netdev_ops = &slic_netdev_ops;
 
+	netif_carrier_off(netdev);
+
 	strcpy(netdev->name, "eth%d");
 	err = register_netdev(netdev);
 	if (err) {
-- 
1.9.1

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Slicoss fixes and improvements Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-07-22 23:20 +0200
  [PATCH 4/9] staging: slicoss: start tx queue when interface is brought up Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-07-22 23:20 +0200
  [PATCH 2/9] staging: slicoss: notifiy network stack about change in link state Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-07-22 23:20 +0200
  [PATCH 3/9] staging: slicoss: ensure mapping of io-memory is uncached Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-07-22 23:20 +0200
  [PATCH 7/9] staging: slicoss: dont use a structure but offsets for register accesses Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-07-22 23:20 +0200
  [PATCH 8/9] staging: slicoss: improve implementation concerning the shared memory Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-07-22 23:20 +0200
  [PATCH 5/9] staging: slicoss: introduce register accessors that use register offsets Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-07-22 23:20 +0200

csiph-web