netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Jiri Pirko <jpirko@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, eric.dumazet@gmail.com
Subject: Re: [patch net-next-2.6] dummy: allow report link status and change it via sysfs
Date: Fri, 29 Jul 2011 18:03:09 +0200	[thread overview]
Message-ID: <1311955389.3220.15.camel@deadeye> (raw)
In-Reply-To: <1311953253-25059-1-git-send-email-jpirko@redhat.com>

On Fri, 2011-07-29 at 17:27 +0200, Jiri Pirko wrote:
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
> ---
>  drivers/net/dummy.c |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 54 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
> index 39cf9b9..fc39c24 100644
> --- a/drivers/net/dummy.c
> +++ b/drivers/net/dummy.c
> @@ -37,9 +37,57 @@
>  #include <linux/rtnetlink.h>
>  #include <net/rtnetlink.h>
>  #include <linux/u64_stats_sync.h>
> +#include <linux/ethtool.h>
>  
>  static int numdummies = 1;
>  
> +static ssize_t dummy_show_link(struct device *d,
> +			       struct device_attribute *attr,
> +			       char *buf)
> +{
> +	struct net_device *dev = to_net_dev(d);
> +
> +	return sprintf(buf, "%d\n", netif_carrier_ok(dev) ? 1 : 0);
> +}
[...]

Net devices already have the 'carrier' attribute.  You should make that
attribute writable for dummy devices, rather than adding another one.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  reply	other threads:[~2011-07-29 16:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29 15:27 [patch net-next-2.6] dummy: allow report link status and change it via sysfs Jiri Pirko
2011-07-29 16:03 ` Ben Hutchings [this message]
2011-07-29 16:55   ` Stephen Hemminger

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=1311955389.3220.15.camel@deadeye \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jpirko@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).