public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Philippe De Muyter <phdm@macqel.be>
To: chas3@users.sourceforge.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)
Date: Sun, 14 Feb 2010 18:51:36 +0100	[thread overview]
Message-ID: <20100214175136.GA15891@frolo.macqel> (raw)
In-Reply-To: <201002132324.o1DNOY0F030510@thirdoffive.cmf.nrl.navy.mil>

Hi Chas,

On Sat, Feb 13, 2010 at 06:24:34PM -0500, Chas Williams (CONTRACTOR) wrote:
> In message <20100213215633.GA4345@frolo.macqel>,Philippe De Muyter writes:
> >value '1' while actually carrier was not yet established and real carrier
> >state was not yet known to linux.  I propose to fix that by using '?' as the
> >/sys/devices/virtual/atm/cxacru0/carrier value when carrier state is not yet
> >known to linux.  Any other value except '1' would also be OK for me.
> 
> this is sort of intentional because some drivers dont actually implement
> atm_dev->signal.  ATM_PHY_SIG_UNKNOWN and ATM_PHY_SIG_LOST should
> likely be carrier = 0.  if the driver doesnt isnt going to handle
> changing the state of atm_dev->signal it should just set the value to
> ATM_PHY_SIG_FOUND.
> 
> i dont like the idea of carrier being '?' -- carrier is either true or false.
> you have it or you dont.

OK for me.  I would agree with

	carrier = 0 when signal == ATM_PHY_SIG_UNKNOWN,

but currently we have

	carrier = 1 when signal == ATM_PHY_SIG_UNKNOWN

cxacru itself does the right thing : as soon as carrier state is known,
signal is set to ATM_PHY_SIG_LOST or ATM_PHY_SIG_FOUND, but
atm_sysfs.c::show_carrier is wrong.

So here is a revised patch :

--

The carrier field of /sys/devices/virtual/atm/cxacru0 shows 1 when carrier
is actually down (but unknown to linux).  Make it show 0 instead in that case.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>

--- a/net/atm/atm_sysfs.c	2010-02-14 18:17:05.604508129 +0100
+++ b/net/atm/atm_sysfs.c	2010-02-14 18:15:08.316917041 +0100
@@ -63,8 +63,7 @@ static ssize_t show_carrier(struct devic
 	char *pos = buf;
 	struct atm_dev *adev = to_atm_dev(cdev);
 
-	pos += sprintf(pos, "%d\n",
-		       adev->signal == ATM_PHY_SIG_LOST ? 0 : 1);
+	pos += sprintf(pos, "%d\n", adev->signal == ATM_PHY_SIG_FOUND);
 
 	return pos - buf;
 }

  reply	other threads:[~2010-02-14 17:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-13 21:56 [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN) Philippe De Muyter
2010-02-13 23:24 ` Chas Williams (CONTRACTOR)
2010-02-14 17:51   ` Philippe De Muyter [this message]
2010-02-14 21:34     ` Chas Williams (CONTRACTOR)
2010-02-17  6:16       ` David Miller
2010-02-17 11:35         ` Philippe De Muyter
2010-02-18 14:22     ` Chas Williams (CONTRACTOR)
2013-08-08  8:34       ` Philippe De Muyter

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=20100214175136.GA15891@frolo.macqel \
    --to=phdm@macqel.be \
    --cc=chas3@users.sourceforge.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox