All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yegor Yefremov <yegor_sub1@visionsystems.de>
To: David Miller <davem@davemloft.net>
Cc: linux-arm-kernel@lists.infradead.org, avictor.za@gmail.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH][KS8695] Mark network interface as running on ifconfig up
Date: Mon, 22 Feb 2010 16:47:58 +0100	[thread overview]
Message-ID: <4B82A72E.50508@visionsystems.de> (raw)
In-Reply-To: <20100216.160647.208330407.davem@davemloft.net>

David Miller schrieb:
> From: Yegor Yefremov <yegor_sub1@visionsystems.de>
> Date: Thu, 11 Feb 2010 12:12:43 +0100
> 
>> [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.
>>
>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>>
>> Index: linux-2.6.33-rc7/drivers/net/arm/ks8695net.c
>> ===================================================================
>> --- linux-2.6.33-rc7.orig/drivers/net/arm/ks8695net.c
>> +++ 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;
>>  }
>>
> 
> 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.

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

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>

Index: linux-2.6.33-rc7/drivers/net/arm/ks8695net.c
===================================================================
--- linux-2.6.33-rc7.orig/drivers/net/arm/ks8695net.c
+++ 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);
 


WARNING: multiple messages have this Message-ID (diff)
From: yegor_sub1@visionsystems.de (Yegor Yefremov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH][KS8695] Mark network interface as running on ifconfig up
Date: Mon, 22 Feb 2010 16:47:58 +0100	[thread overview]
Message-ID: <4B82A72E.50508@visionsystems.de> (raw)
In-Reply-To: <20100216.160647.208330407.davem@davemloft.net>

David Miller schrieb:
> From: Yegor Yefremov <yegor_sub1@visionsystems.de>
> Date: Thu, 11 Feb 2010 12:12:43 +0100
> 
>> [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.
>>
>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>>
>> Index: linux-2.6.33-rc7/drivers/net/arm/ks8695net.c
>> ===================================================================
>> --- linux-2.6.33-rc7.orig/drivers/net/arm/ks8695net.c
>> +++ 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;
>>  }
>>
> 
> 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.

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

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>

Index: linux-2.6.33-rc7/drivers/net/arm/ks8695net.c
===================================================================
--- linux-2.6.33-rc7.orig/drivers/net/arm/ks8695net.c
+++ 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);
 

  reply	other threads:[~2010-02-22 15:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 11:12 [PATCH][KS8695] Mark network interface as running on ifconfig up Yegor Yefremov
2010-02-11 11:12 ` Yegor Yefremov
2010-02-17  0:06 ` David Miller
2010-02-17  0:06   ` David Miller
2010-02-22 15:47   ` Yegor Yefremov [this message]
2010-02-22 15:47     ` Yegor Yefremov
2010-02-26  9:20     ` David Miller
2010-02-26  9:20       ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2010-02-11  9:05 Yegor Yefremov
2010-02-11 10:56 ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B82A72E.50508@visionsystems.de \
    --to=yegor_sub1@visionsystems.de \
    --cc=avictor.za@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.