Skip to contentSkip to conversation

Mark network interface as running on ifconfig up

PATCH In review Yegor Yefremov 2 participants 4 messages Feb 11, 2010 – Feb 26, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Mark network interface as running on ifconfig up

[KS8695] Mark network interface as running on ifconfig up

Without netif_carrier_on() network interface will not transmit any packets after ifconfig down and subsequent ifconfig up.

drivers/net/arm/ks8695net.c +1 -0
Index: linux-2.6.33-rc7/drivers/net/arm/ks8695net.c
===================================================================
@@ -1371,6 +1371,7 @@ ks8695_open(struct net_device *ndev)
 
 	napi_enable(&ksp->napi);
 	netif_start_queue(ndev);
+	netif_carrier_on(ndev);
 
 	return 0;
 }
maintainer
#1 lore raw

From: Yegor Yefremov <[email protected]>
Date: Thu, 11 Feb 2010 12:12:43 +0100

Quoted 13 lines

[KS8695] Mark network interface as running on ifconfig up

Without netif_carrier_on() network interface will not transmit any packets after ifconfig down and subsequent ifconfig up.

Index: linux-2.6.33-rc7/drivers/net/arm/ks8695net.c
===================================================================

drivers/net/arm/ks8695net.c ks8695_open(struct net_device *ndev) · line 1377

Quoted 7 lines
drivers/net/arm/ks8695net.c +1 -0
@@ -1371,6 +1371,7 @@ ks8695_open(struct net_device *ndev)
 
 	napi_enable(&ksp->napi);
 	netif_start_queue(ndev);
+	netif_carrier_on(ndev);
 
 	return 0;
 }

Only ks8695_link_irq() should be setting the carrier state.

If necessary, reset the PHY on device open so that the link up interrupt arrives and the code handling that event can set the carrier status properly.

This is how every other driver handles this situation.

#2 lore raw
Quoted 26 lines · David Miller

From: Yegor Yefremov <[email protected]>
Date: Thu, 11 Feb 2010 12:12:43 +0100

Quoted 13 lines

[KS8695] Mark network interface as running on ifconfig up

Without netif_carrier_on() network interface will not transmit any packets after ifconfig down and subsequent ifconfig up.

Index: linux-2.6.33-rc7/drivers/net/arm/ks8695net.c
===================================================================

drivers/net/arm/ks8695net.c ks8695_open(struct net_device *ndev) · line 1377

Quoted 7 lines
drivers/net/arm/ks8695net.c +1 -0
@@ -1371,6 +1371,7 @@ ks8695_open(struct net_device *ndev)
 
 	napi_enable(&ksp->napi);
 	netif_start_queue(ndev);
+	netif_carrier_on(ndev);
 
 	return 0;
 }

Only ks8695_link_irq() should be setting the carrier state.

Quoted 5 lines

If necessary, reset the PHY on device open so that the link up interrupt arrives and the code handling that event can set the carrier status properly.

This is how every other driver handles this situation.

According to this guideline is it also wrong to call netif_carrier_on(ndev) within ndo_stop() routine? I removed this call and the ifconfig up/down is functioning properly. So the resulting patch could look like this:

[KS8695] Don't call netif_carrier_off() from ndo_stop()

netif_carrier_on() and netif_carrier_off() should be called from link status interrupt handler

drivers/net/arm/ks8695net.c +0 -1
Index: linux-2.6.33-rc7/drivers/net/arm/ks8695net.c
===================================================================
@@ -1335,7 +1335,6 @@ ks8695_stop(struct net_device *ndev)
 
 	netif_stop_queue(ndev);
 	napi_disable(&ksp->napi);
-	netif_carrier_off(ndev);
 
 	ks8695_shutdown(ksp);
 
maintainer
#3 lore raw

From: Yegor Yefremov <[email protected]>
Date: Mon, 22 Feb 2010 16:47:58 +0100

Quoted 6 lines

[KS8695] Don't call netif_carrier_off() from ndo_stop()

netif_carrier_on() and netif_carrier_off() should be called from link status interrupt handler

Looks good, applied.

Please do not put text you want to make it into the commit message header line in brackets "[]", those get removed by automated tools that apply patches because patches are usually posted as:

Subject: [PATCH N/M] xxxx

and the GIT tools kill all the text inside of the brackets so that the commit header properly reads "xxx"

Thanks.