Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] net/netfilter/ipvs: Move #define KMSG_COMPONENT to Makefile
From: Joe Perches @ 2009-09-30 23:09 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Patrick McHardy, David S. Miller, Simon Horman, Julian Anastasov,
	netfilter-devel, coreteam, netdev, linux-kernel, lvs-devel
In-Reply-To: <alpine.LSU.2.00.0910010042540.782@obet.zrqbmnf.qr>

On Thu, 2009-10-01 at 00:46 +0200, Jan Engelhardt wrote:
> On Thursday 2009-10-01 00:37, Joe Perches wrote:
> >This centralizes the definition and removes the
> >replicated #defines from all files
> And increases the length of the command line. Not that Linux does not
> support long command lines (in fact, configure often determines huge
> possible values on the max length test), but sometimes, developers
> have to inspect the command lines anyway for bugs, or something. It
> is already pretty long due to all the compiler flags.

Hi Jan.

I think this increased command line length hardly matters.

I think a reasonable complaint might be that it separates
the definition of a macro from the code.  I think it's
similar to the already used KBUILD_MODNAME macro though.

> How about an #include file for the ipvs private things?

It's not just IPVS, this style could be used treewide
without requiring extra #includes.

cheers, Joe


^ permalink raw reply

* capi.c calls receive_buf with interrupts disabled (was: N_PPP_SYNC ldisc BUG: sleeping function called from invalid context)
From: Tilman Schmidt @ 2009-09-30 23:15 UTC (permalink / raw)
  To: Jarek Poplawski
  Cc: Alan Cox, linux-kernel, netdev, Alan Cox, Michael Buesch,
	isdn4linux
In-Reply-To: <4AC3C9B8.9080003@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2709 bytes --]

Jarek Poplawski schrieb:
> Tilman Schmidt wrote, On 09/30/2009 08:55 PM:
[...]
>> - ppp_sync_receive() was called, as the LD's receive_buf method,
>>   via handle_recv_skb() [drivers/isdn/capi/capi.c line 504, inlined]
>>   from handle_minor_recv() [drivers/isdn/capi/capi.c line 519]
>>
>> - handle_minor_recv() was called from capi_recv_message()
>>   [drivers/isdn/capi/capi.c line 656]
>>
>> - capi_recv_message() was called, as the CAPI application's
>>   recv_message method, from recv_handler()
>>   [drivers/isdn/capi/kcapi.c line 268]
>>
>> - recv_handler() is never called directly. It's only scheduled
>>   via the work queue ap->recv_work from capi_ctr_handle_message()
>>   [drivers/isdn/capi/kcapi.c line 349]
>>
>> Even if we don't trust the backtraces, there's not much room for
>> another activation path. So for all I know, the expectation of the
>> tty logic should have been met. The call was indeed processed from
>> a work queue.
>>
>> Why then does mutex_lock() complain?
> 
> Hmm... capi_recv_message() calls handle_minor_recv() under
> spin_lock_irqsave(), doesn't it?

Well spotted. Indeed it does. That explains it, of course.

The spinlock in question was added by:

commit 053b47ff249b9e0a634dae807f81465205e7c228
Author: Michael Buesch <mb@bu3sch.de>
Date:   Mon Feb 12 00:53:26 2007 -0800

    [PATCH] Workaround CAPI subsystem locking issue
    
    I think the following patch should go into the kernel, until the ISDN/CAPI
    guys create the real fix for this issue.
     
    The issue is a concurrency issue with some internal CAPI data structure
    which can crash the kernel.

    On my FritzCard DSL with the AVM driver it crashes about once a day without
    this workaround patch.  With this workaround patch it's rock-stable (at
    least on UP, but I don't see why this shouldn't work on SMP as well.  But
    maybe I'm missing something.)
    
    This workaround is kind of a sledgehammer which inserts a global lock to
    wrap around all the critical sections.  Of course, this is a scalability
    issue, if you have many ISDN/CAPI cards.  But it prevents a crash.  So I
    vote for this fix to get merged, until people come up with a better
    solution.  Better have a stable kernel that's less scalable, than a
    crashing and useless kernel.
    
So let's cc the author of that patch, and also the good people on the
isdn4linux developer mailing list ...

Any ideas for a fix?

Thanks,
Tilman

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

^ permalink raw reply

* Re: [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
From: Andrew Morton @ 2009-09-30 23:19 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: hpa, linux-kernel, mingo, tglx, davem, andi, netdev
In-Reply-To: <20090930230138.GZ6451@const.famille.thibault.fr>

On Thu, 1 Oct 2009 01:01:38 +0200
Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:

> Actually it hit Hurd's pfinetv4 when we tried to compile it with
> gcc-4.3 (bogus checksums).

That's important information!  I updated the changelog and added the
Cc:stable, thanks.


Full patch for netdev benefit:


From: Samuel Thibault <samuel.thibault@ens-lyon.org>

Just like ip_fast_csum, the assembly snippet in csum_ipv6_magic needs a
memory clobber, as it is only passed the address of the buffer, not a
memory reference to the buffer itself.

This caused failures in Hurd's pfinetv4 when we tried to compile it with
gcc-4.3 (bogus checksums).

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 arch/x86/include/asm/checksum_32.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN arch/x86/include/asm/checksum_32.h~x86-fix-csum_ipv6_magic-asm-memory-clobber arch/x86/include/asm/checksum_32.h
--- a/arch/x86/include/asm/checksum_32.h~x86-fix-csum_ipv6_magic-asm-memory-clobber
+++ a/arch/x86/include/asm/checksum_32.h
@@ -161,7 +161,8 @@ static inline __sum16 csum_ipv6_magic(co
 	    "adcl $0, %0	;\n"
 	    : "=&r" (sum)
 	    : "r" (saddr), "r" (daddr),
-	      "r" (htonl(len)), "r" (htonl(proto)), "0" (sum));
+	      "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
+	    : "memory");
 
 	return csum_fold(sum);
 }
_


^ permalink raw reply

* Re: [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
From: David Miller @ 2009-09-30 23:22 UTC (permalink / raw)
  To: akpm; +Cc: samuel.thibault, hpa, linux-kernel, mingo, tglx, andi, netdev
In-Reply-To: <20090930161939.8c6d140a.akpm@linux-foundation.org>

From: Andrew Morton <akpm@linux-foundation.org>
Date: Wed, 30 Sep 2009 16:19:39 -0700

> From: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 
> Just like ip_fast_csum, the assembly snippet in csum_ipv6_magic needs a
> memory clobber, as it is only passed the address of the buffer, not a
> memory reference to the buffer itself.
> 
> This caused failures in Hurd's pfinetv4 when we tried to compile it with
> gcc-4.3 (bogus checksums).
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

I'm happy to see this go in via the x86 tree, and thus:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply

* Re: [PATCH] net: Fix sock_wfree() race
From: David Miller @ 2009-09-30 23:23 UTC (permalink / raw)
  To: eric.dumazet; +Cc: jarkao2, albcamus, parag.lkml, linux-kernel, netdev
In-Reply-To: <4ABBDB54.4000609@gmail.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 24 Sep 2009 22:49:24 +0200

> [PATCH] net: Fix sock_wfree() race
> 
> Commit 2b85a34e911bf483c27cfdd124aeb1605145dc80
> (net: No more expensive sock_hold()/sock_put() on each tx)
> opens a window in sock_wfree() where another cpu
> might free the socket we are working on.
> 
> A fix is to call sk->sk_write_space(sk) while still
> holding a reference on sk.
> 
> 
> Reported-by: Jike Song <albcamus@gmail.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied to net-2.6 and I'll queue this up for -stable.

Thanks!

^ permalink raw reply

* Re: [PATCH] net: fix NOHZ: local_softirq_pending 08
From: David Miller @ 2009-09-30 23:33 UTC (permalink / raw)
  To: oliver-fJ+pQTUTwRTk1uMJSBkQmQ
  Cc: johannes-cdvu00un1VgdHxzADdlk8Q, mb-fseUSCV1ubazQB+pC5nmwQ,
	kalle.valo-X3B1VOXEql0, linville-2XuSBdqkA4R54TAoqtyWWQ,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <4AC3A0F1.3060306-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>

From: Oliver Hartkopp <oliver-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
Date: Wed, 30 Sep 2009 20:18:25 +0200

> Socket buffers that are generated and received inside softirqs or from process
> context must not use netif_rx() that's intended to be used from irq context only.
> 
> This patch introduces a new helper function netif_rx_ti(skb) that tests for
> in_interrupt() before invoking netif_rx() or netif_rx_ni().
> 
> It fixes the ratelimited kernel warning
> 
>         NOHZ: local_softirq_pending 08
> 
> in the mac80211 and can subsystems.
> 
> Signed-off-by: Oliver Hartkopp <oliver-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>

I bet all of these code paths can use netif_receive_skb() or
don't need this conditional blob at all.

Looking at some specific cases in this patch:

1) VCAN:  This RX routine is only invoked from the drivers
   ->ndo_start_xmit() handler, and therefore like the loopback
   driver we know that BH's are already disabled and therefore
   it can always use netif_rx() safely.

   Why did you convert this case?

   And if this needs to be converted, why doesn't loopback need
   to be?

2) af_can.c:  In what situation will netif_rx_ni() not be appropriate
   here?  It should always execute in softirq or user context, now
   hardirq context.

And the list goes on and on, I don't really like this new conditional
testing of interrupt state.  As always, that's usually a red flag and
as far as I can see these spots where you're changing things are only
trying to receive packets in one of the two possible cases not both.

I'm not applying this until all of these details are sorted out and
you add some verbosity to the commit message explaining each and every
case you are changing, what contexts those cases can be called
from, and from where.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH net-next-2.6] be2net: Workaround to fix a bug in Rx Completion processing.
From: David Miller @ 2009-09-30 23:37 UTC (permalink / raw)
  To: ajitk; +Cc: netdev
In-Reply-To: <20090930090656.GA5215@serverengines.com>

From: Ajit Khaparde <ajitk@serverengines.com>
Date: Wed, 30 Sep 2009 14:37:06 +0530

> vtp bit in RX completion descriptor could be wrongly set in
> some skews of BladEngine.  Ignore this  bit if vtm is not set.
> This patch is against the net-next-2.6 tree.
> 
> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>

This doesn't apply.

Until I start taking new feature patches, net-next-2.6 is just
going to be a stale GIT tree based upon Linus's tree at some
point in time long ago.

net-2.6 is far in front of that, and actually since this is a bug
fix you really should be sending me this patch against that.

^ permalink raw reply

* Re: [PATCH] sit: fix off-by-one in ipip6_tunnel_get_prl
From: David Miller @ 2009-09-30 23:40 UTC (permalink / raw)
  To: contact; +Cc: netdev, fred.l.templin
In-Reply-To: <1254259625-29320-1-git-send-email-contact@saschahlusiak.de>

From: Sascha Hlusiak <contact@saschahlusiak.de>
Date: Tue, 29 Sep 2009 23:27:05 +0200

> When requesting all prl entries (kprl.addr == INADDR_ANY) and there are
> more prl entries than there is space passed from userspace, the existing
> code would always copy cmax+1 entries, which is more than can be handled.
> 
> This patch makes the kernel copy only exactly cmax entries.
> 
> Signed-off-by: Sascha Hlusiak <contact@saschahlusiak.de>
> Acked-By: Fred L. Templin <Fred.L.Templin@boeing.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply

* Re: [PATCH] Phonet: fix mutex imbalance
From: David Miller @ 2009-09-30 23:41 UTC (permalink / raw)
  To: remi; +Cc: netdev, remi.denis-courmont
In-Reply-To: <1254208599-1274-1-git-send-email-remi@remlab.net>

From: Rémi Denis-Courmont <remi@remlab.net>
Date: Tue, 29 Sep 2009 10:16:39 +0300

> From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
> 
> port_mutex was unlocked twice.
> 
> Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>

Applied, thanks!

^ permalink raw reply

* Re: [PATCH] net: restore tx timestamping for accelerated vlans
From: David Miller @ 2009-09-30 23:43 UTC (permalink / raw)
  To: eric.dumazet; +Cc: kaber, netdev
In-Reply-To: <4AC20441.8040004@gmail.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 29 Sep 2009 14:57:37 +0200

> Since commit 9b22ea560957de1484e6b3e8538f7eef202e3596
> ( net: fix packet socket delivery in rx irq handler )
> 
> We lost rx timestamping of packets received on accelerated vlans.
> 
> Effect is that tcpdump on real dev can show strange timings, since it gets rx timestamps
> too late (ie at skb dequeueing time, not at skb queueing time)
 ...
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, and queued up for -stable, thanks!

^ permalink raw reply

* Re: [PATCH] ax25: Fix possible oops in ax25_make_new
From: David Miller @ 2009-09-30 23:44 UTC (permalink / raw)
  To: jarkao2; +Cc: ralf, f6bvp, bernard.pidoux, netdev, linux-hams
In-Reply-To: <20090927205701.GA7205@del.dom.local>

From: Jarek Poplawski <jarkao2@gmail.com>
Date: Sun, 27 Sep 2009 22:57:02 +0200

> In ax25_make_new, if kmemdup of digipeat returns an error, there would
> be an oops in sk_free while calling sk_destruct, because sk_protinfo
> is NULL at the moment; move sk->sk_destruct initialization after this.
> 
> BTW of reported-by: Bernard Pidoux F6BVP <f6bvp@free.fr>
> 
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>

Applied and queued up for -stable, thanks!

^ permalink raw reply

* Re: [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
From: H. Peter Anvin @ 2009-09-30 23:45 UTC (permalink / raw)
  To: David Miller
  Cc: akpm, samuel.thibault, linux-kernel, mingo, tglx, andi, netdev
In-Reply-To: <20090930.162233.208543104.davem@davemloft.net>

On 09/30/2009 04:22 PM, David Miller wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
> Date: Wed, 30 Sep 2009 16:19:39 -0700
> 
>> From: Samuel Thibault <samuel.thibault@ens-lyon.org>
>>
>> Just like ip_fast_csum, the assembly snippet in csum_ipv6_magic needs a
>> memory clobber, as it is only passed the address of the buffer, not a
>> memory reference to the buffer itself.
>>
>> This caused failures in Hurd's pfinetv4 when we tried to compile it with
>> gcc-4.3 (bogus checksums).
>>
>> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
>> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> 
> I'm happy to see this go in via the x86 tree, and thus:
> 
> Acked-by: David S. Miller <davem@davemloft.net>

I'll put it in x86/urgent tonight or early tomorrow morning (just about
to leave for the airport.)

	-hpa

^ permalink raw reply

* [GIT]: Networking
From: David Miller @ 2009-10-01  0:01 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel


1) Make optlen in setsockopt unsigned, providing type level
   protection against several "< 0" issues that tend to
   be (wrongly) addressed at the implementation level.

2) sock_wfree() can race with a cpu freeing up a socket,
   fix from Eric Dumazet.  Lots of people are hitting this
   lately.

3) Off-by-one in ipv6 SIT tunnel driver, fix from Sascha Hlusiak

4) phonet does double mutex unlock, fix from Rémi Denis-Courmont.

5) ax25 sets up destructor callback pointer before state is ready,
   fix from Jarek Poplawski

6) TX timestamping stopped working on hw accelerated VLANs a few
   releases ago, oops, fix from Eric Dumazet.

Please pull, thanks a lot!

The following changes since commit 9c1fe834c1bd7725b411055c66886b64c928083d:
  Linus Torvalds (1):
        Merge branch 'pm-fixes' of git://git.kernel.org/.../rafael/suspend-2.6

are available in the git repository at:

  master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git master

David S. Miller (1):
      net: Make setsockopt() optlen be unsigned.

Eric Dumazet (2):
      net: Fix sock_wfree() race
      net: restore tx timestamping for accelerated vlans

Jarek Poplawski (1):
      ax25: Fix possible oops in ax25_make_new

Rémi Denis-Courmont (1):
      Phonet: fix mutex imbalance

Sascha Hlusiak (1):
      sit: fix off-by-one in ipip6_tunnel_get_prl

 drivers/atm/ambassador.c           |    8 -----
 drivers/atm/eni.c                  |    2 +-
 drivers/atm/firestream.c           |    2 +-
 drivers/atm/fore200e.c             |    2 +-
 drivers/atm/horizon.c              |    2 +-
 drivers/atm/iphase.c               |    2 +-
 drivers/atm/zatm.c                 |    2 +-
 drivers/isdn/mISDN/socket.c        |    2 +-
 drivers/net/pppol2tp.c             |    2 +-
 include/linux/atmdev.h             |    2 +-
 include/linux/mroute.h             |    4 +-
 include/linux/mroute6.h            |    4 +-
 include/linux/net.h                |    8 ++--
 include/linux/netfilter.h          |    4 +-
 include/net/compat.h               |    4 +-
 include/net/inet_connection_sock.h |    6 ++--
 include/net/ip.h                   |    4 +-
 include/net/ipv6.h                 |    4 +-
 include/net/sctp/structs.h         |    4 +-
 include/net/sock.h                 |   12 +++---
 include/net/tcp.h                  |    4 +-
 include/net/udp.h                  |    2 +-
 net/atm/common.c                   |    2 +-
 net/atm/common.h                   |    2 +-
 net/atm/pvc.c                      |    2 +-
 net/atm/svc.c                      |    2 +-
 net/ax25/af_ax25.c                 |    4 +-
 net/bluetooth/hci_sock.c           |    2 +-
 net/bluetooth/l2cap.c              |    4 +-
 net/bluetooth/rfcomm/sock.c        |    4 +-
 net/bluetooth/sco.c                |    2 +-
 net/can/raw.c                      |    2 +-
 net/compat.c                       |   12 +++---
 net/core/dev.c                     |    6 ++--
 net/core/sock.c                    |   27 +++++++++------
 net/dccp/dccp.h                    |    4 +-
 net/dccp/proto.c                   |   10 +++---
 net/decnet/af_decnet.c             |    6 ++--
 net/ieee802154/dgram.c             |    2 +-
 net/ieee802154/raw.c               |    2 +-
 net/ipv4/inet_connection_sock.c    |    2 +-
 net/ipv4/ip_sockglue.c             |    6 ++--
 net/ipv4/ipmr.c                    |    2 +-
 net/ipv4/raw.c                     |    6 ++--
 net/ipv4/tcp.c                     |    6 ++--
 net/ipv4/udp.c                     |    6 ++--
 net/ipv4/udp_impl.h                |    4 +-
 net/ipv6/ip6mr.c                   |    2 +-
 net/ipv6/ipv6_sockglue.c           |    6 ++--
 net/ipv6/raw.c                     |    6 ++--
 net/ipv6/sit.c                     |    2 +-
 net/ipv6/udp.c                     |    4 +-
 net/ipv6/udp_impl.h                |    4 +-
 net/ipx/af_ipx.c                   |    2 +-
 net/irda/af_irda.c                 |    2 +-
 net/iucv/af_iucv.c                 |    2 +-
 net/llc/af_llc.c                   |    2 +-
 net/netfilter/nf_sockopt.c         |    4 +-
 net/netlink/af_netlink.c           |    2 +-
 net/netrom/af_netrom.c             |    2 +-
 net/packet/af_packet.c             |    2 +-
 net/phonet/pep.c                   |    2 +-
 net/phonet/socket.c                |    1 -
 net/rds/af_rds.c                   |    2 +-
 net/rose/af_rose.c                 |    2 +-
 net/rxrpc/af_rxrpc.c               |    2 +-
 net/sctp/socket.c                  |   62 +++++++++++++++++++-----------------
 net/socket.c                       |    2 +-
 net/tipc/socket.c                  |    2 +-
 net/x25/af_x25.c                   |    2 +-
 70 files changed, 166 insertions(+), 166 deletions(-)

^ permalink raw reply

* Re: [PATCH] pktgen: Avoid dirtying skb->users when txq is full
From: Stephen Hemminger @ 2009-10-01  0:25 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Jesper Dangaard Brouer, Robert Olsson, netdev, David S. Miller
In-Reply-To: <4AC3E3C5.1090108@gmail.com>

On Thu, 01 Oct 2009 01:03:33 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Stephen Hemminger a écrit :
> > On Tue, 22 Sep 2009 22:49:02 -0700
> > Stephen Hemminger <shemminger@vyatta.com> wrote:
> > 
> >> I thought others want to know how to get maximum speed of pktgen.
> >>
> >> 1. Run nothing else (even X11), just a command line
> >> 2. Make sure ethernet flow control is disabled
> >>    ethtool -A eth0 autoneg off rx off tx off
> >> 3. Make sure clocksource is TSC.  On my old SMP Opteron's
> >>    needed to get patch since in 2.6.30 or later, the clock guru's
> >>    decided to remove it on all non Intel machines.  Look for patch
> >>    than enables "tsc=reliable"
> >> 4. Compile Ethernet drivers in, the overhead of the indirect
> >>    function call required for modules (or cache footprint),
> >>    slows things down.
> >> 5. Increase transmit ring size to 1000
> >>    ethtool -G eth0 tx 1000
> >>
> 
> Thanks a lot Stephen.
> 
> I did some pktgen session tonight and found one contention on skb->users field
> that following patch avoids.
> 
> 
> Before patch :
> ------------------------------------------------------------------------------
>    PerfTop:    5187 irqs/sec  kernel:100.0% [100000 cycles],  (all, cpu: 0)
> ------------------------------------------------------------------------------
> 
>              samples    pcnt   kernel function
>              _______   _____   _______________
> 
>             16688.00 - 50.9% : consume_skb
>              6541.00 - 20.0% : skb_dma_unmap
>              3277.00 - 10.0% : tg3_poll
>              1968.00 -  6.0% : mwait_idle
>               651.00 -  2.0% : irq_entries_start
>               466.00 -  1.4% : _spin_lock
>               442.00 -  1.3% : mix_pool_bytes_extract
>               373.00 -  1.1% : tg3_msi
>               353.00 -  1.1% : read_tsc
>               177.00 -  0.5% : sched_clock_local
>               176.00 -  0.5% : sched_clock
>               137.00 -  0.4% : tick_nohz_stop_sched_tick
> 
> After patch:
> ------------------------------------------------------------------------------
>    PerfTop:    3530 irqs/sec  kernel:99.9% [100000 cycles],  (all, cpu: 0)
> ------------------------------------------------------------------------------
> 
>              samples    pcnt   kernel function
>              _______   _____   _______________
> 
>             17127.00 - 34.0% : tg3_poll
>             12691.00 - 25.2% : consume_skb
>              5299.00 - 10.5% : skb_dma_unmap
>              4179.00 -  8.3% : mwait_idle
>              1583.00 -  3.1% : irq_entries_start
>              1288.00 -  2.6% : mix_pool_bytes_extract
>              1239.00 -  2.5% : tg3_msi
>              1062.00 -  2.1% : read_tsc
>               583.00 -  1.2% : _spin_lock
>               432.00 -  0.9% : sched_clock
>               416.00 -  0.8% : sched_clock_local
>               360.00 -  0.7% : tick_nohz_stop_sched_tick
>               329.00 -  0.7% : ktime_get
>               263.00 -  0.5% : _spin_lock_irqsave
> 
> I believe we could go further, batching the atomic_inc(&skb->users) we do all the
> time, competing with the atomic_dec() done by tx completion handler (possibly run
> on other cpu): Reserve XXXXXXX units to the skb->users, and decrement a pktgen
> local variable and refill the reserve if necessary, once in a while...

When buffer is allocated we know the number of times it will be cloned. So why
not set it there, would need to cleanup on interrupt but that should be possible.

Alternatively, just change skb->destructor on last packet and use a proper
completion mechanism.

> [PATCH] pktgen: Avoid dirtying skb->users when txq is full
> 
> We can avoid two atomic ops on skb->users if packet is not going to be
> sent to the device (because hardware txqueue is full)
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> 
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 4d11c28..6a9ab28 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -3439,12 +3439,14 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
>  	txq = netdev_get_tx_queue(odev, queue_map);
>  
>  	__netif_tx_lock_bh(txq);
> -	atomic_inc(&(pkt_dev->skb->users));
>  
> -	if (unlikely(netif_tx_queue_stopped(txq) || netif_tx_queue_frozen(txq)))
> +	if (unlikely(netif_tx_queue_stopped(txq) || netif_tx_queue_frozen(txq))) {
>  		ret = NETDEV_TX_BUSY;
> -	else
> -		ret = (*xmit)(pkt_dev->skb, odev);
> +		pkt_dev->last_ok = 0;
> +		goto unlock;
> +	}
> +	atomic_inc(&(pkt_dev->skb->users));
> +	ret = (*xmit)(pkt_dev->skb, odev);
>  
>  	switch (ret) {
>  	case NETDEV_TX_OK:
> @@ -3466,6 +3468,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
>  		atomic_dec(&(pkt_dev->skb->users));
>  		pkt_dev->last_ok = 0;
>  	}
> +unlock:
>  	__netif_tx_unlock_bh(txq);
>  
>  	/* If pkt_dev->count is zero, then run forever */

Acked-by: Stephen Hemminger <shemminger@vyatta.com>

^ permalink raw reply

* Re: [PATCH] skge: Make sure both ports initialize correctly
From: Stephen Hemminger @ 2009-10-01  0:28 UTC (permalink / raw)
  To: Mike McCormack; +Cc: Stephen Hemminger, netdev
In-Reply-To: <4ABA27AC.7030207@ring3k.org>

On Wed, 23 Sep 2009 22:50:36 +0900
Mike McCormack <mikem@ring3k.org> wrote:

> If allocation of the second ports fails, make sure that hw->ports
>  is not 2 otherwise we'll crash trying to access the second port.
> 
> This fix is copied from a similar fix in the sky2 driver (ca519274...),
> but is untested, as I don't have a skge card.
> 
> Signed-off-by: Mike McCormack <mikem@ring3k.org>
> ---
>  drivers/net/skge.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/skge.c b/drivers/net/skge.c
> index 62e852e..21b816f 100644
> --- a/drivers/net/skge.c
> +++ b/drivers/net/skge.c
> @@ -3982,14 +3982,17 @@ static int __devinit skge_probe(struct pci_dev *pdev,
>  	}
>  	skge_show_addr(dev);
>  
> -	if (hw->ports > 1 && (dev1 = skge_devinit(hw, 1, using_dac))) {
> -		if (register_netdev(dev1) == 0)
> +	if (hw->ports > 1) {
> +		dev1 = skge_devinit(hw, 1, using_dac);
> +		if (dev1 && register_netdev(dev1) == 0)
>  			skge_show_addr(dev1);
>  		else {
>  			/* Failure to register second port need not be fatal */
>  			dev_warn(&pdev->dev, "register of second port failed\n");
>  			hw->dev[1] = NULL;
> -			free_netdev(dev1);
> +			hw->ports = 1;
> +			if (dev1)
> +				free_netdev(dev1);
>  		}
>  	}
>  	pci_set_drvdata(pdev, hw);

Looks good.
Acked-by: Stephen Hemminger <shemminger@vyatta.com>

^ permalink raw reply

* Re: kernel doc / docbook pdfdocs question
From: Stephen Hemminger @ 2009-10-01  0:30 UTC (permalink / raw)
  To: Doug Maxey; +Cc: Randy Dunlap, netdev
In-Reply-To: <8223.1254340776@jerryjeff.riw.enoyolf.org>

On Wed, 30 Sep 2009 14:59:36 -0500
Doug Maxey <dwm@enoyolf.org> wrote:

> 
> Randy,
> 
> This may be slightly off topic for this list, but it does involve an
> (as yet un-released) network driver. :)
> 
> Do you have any insight that could guide me toward a fix for an issue
> seen with some header file constructs when trying to generate a pdf
> docbook?
> 

Why clutter docbook output (which is supposed to be about general kernel
API's) with output for data structures in one driver.

^ permalink raw reply

* Re: [PATCH 1/2] net/netfilter/ipvs: Move #define KMSG_COMPONENT to Makefile
From: Jan Engelhardt @ 2009-10-01  0:31 UTC (permalink / raw)
  To: Joe Perches
  Cc: Patrick McHardy, David S. Miller, Simon Horman, Julian Anastasov,
	netfilter-devel, coreteam, netdev, linux-kernel, lvs-devel
In-Reply-To: <1254352160.2960.119.camel@Joe-Laptop.home>


On Thursday 2009-10-01 01:09, Joe Perches wrote:
>On Thu, 2009-10-01 at 00:46 +0200, Jan Engelhardt wrote:
>> On Thursday 2009-10-01 00:37, Joe Perches wrote:
>> >This centralizes the definition and removes the
>> >replicated #defines from all files
>
>I think this increased command line length hardly matters.
>
>I think a reasonable complaint might be that it separates
>the definition of a macro from the code.  I think it's
>similar to the already used KBUILD_MODNAME macro though.

KBUILD_MODNAME is special in that it is derived from the actual
source filename. Of course you could put #define KBUILD_MODNAME "foo"
in your source file, but that is like putting changelogs there
when they belong into the git log.

>> How about an #include file for the ipvs private things?
>
>It's not just IPVS, this style could be used treewide
>without requiring extra #includes.

Well I personally prefer the #include instead of hiding such in 
Makefiles. You know, when newcomers could start doing `grep 
KMSG_COMPONENT *.[ch]`. Perhaps GCC's -include flag in a Makefile
to avoid #includes in .c files?

^ permalink raw reply

* Re: [PATCH 2.6.32-rc1] net: VMware virtual Ethernet NIC driver: vmxnet3
From: Stephen Hemminger @ 2009-10-01  0:39 UTC (permalink / raw)
  To: Shreyas Bhatewara
  Cc: linux-kernel, netdev, Stephen Hemminger, David S. Miller,
	Jeff Garzik, Anthony Liguori, Chris Wright, Greg Kroah-Hartman,
	Andrew Morton, virtualization, pv-drivers
In-Reply-To: <alpine.LRH.2.00.0909301432410.8073@localhost.localdomain>

On Wed, 30 Sep 2009 14:34:57 -0700 (PDT)
Shreyas Bhatewara <sbhatewara@vmware.com> wrote:

Note: your patch was linewrapped again

> +
> +
> +static void
> +vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64)
> +{
> +	struct net_device *netdev = adapter->netdev;
> +
> +	netdev->features = NETIF_F_SG |
> +		NETIF_F_HW_CSUM |
> +		NETIF_F_HW_VLAN_TX |
> +		NETIF_F_HW_VLAN_RX |
> +		NETIF_F_HW_VLAN_FILTER |
> +		NETIF_F_TSO |
> +		NETIF_F_TSO6;
> +
> +	printk(KERN_INFO "features: sg csum vlan jf tso tsoIPv6");
> +
> +	adapter->rxcsum = true;
> +	adapter->jumbo_frame = true;
> +
> +	if (!disable_lro) {
> +		adapter->lro = true;
> +		printk(" lro");
> +	}

Why not use NETIF_F_LRO and ethtool to control LRO support?

^ permalink raw reply

* Re: [PATCH 1/2] net/netfilter/ipvs: Move #define KMSG_COMPONENT to Makefile
From: Joe Perches @ 2009-10-01  0:50 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Patrick McHardy, David S. Miller, Simon Horman, Julian Anastasov,
	netfilter-devel, coreteam, netdev, linux-kernel, lvs-devel
In-Reply-To: <alpine.LSU.2.00.0910010219100.7559@obet.zrqbmnf.qr>

On Thu, 2009-10-01 at 02:31 +0200, Jan Engelhardt wrote:
> KBUILD_MODNAME is special in that it is derived from the actual
> source filename.

Kind of.  It's derived from the module name, not the filename.

> Of course you could put #define KBUILD_MODNAME "foo"
> in your source file, but that is like putting changelogs there
> when they belong into the git log.

I agree with that.

> Well I personally prefer the #include instead of hiding such in 
> Makefiles. You know, when newcomers could start doing `grep 
> KMSG_COMPONENT *.[ch]`. Perhaps GCC's -include flag in a Makefile
> to avoid #includes in .c files?

I imagine an eventual goal of standardizing the default
pr_fmt define in kernel.h to

	#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

so that all pr_<level> calls get this unless otherwise
specified.

Or perhaps better, to get rid of pr_fmt(fmt) altogether and
have printk emit the filename/modulename, function and/or
code offset by using something like %pS after the level.

I see the Makefile use, which I don't really like too much
because of the information hiding, as an intermediate step
until that's possible.



^ permalink raw reply

* Re: [PATCH 0/2] cfg80211: firmware and hardware version
From: John W. Linville @ 2009-10-01  1:13 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: Kalle Valo, linux-wireless, netdev
In-Reply-To: <43e72e890909250953r1714c79bsa679b96ca6f5797@mail.gmail.com>

On Fri, Sep 25, 2009 at 09:53:35AM -0700, Luis R. Rodriguez wrote:
> On Fri, Sep 25, 2009 at 9:47 AM, Kalle Valo <kalle.valo@iki.fi> wrote:

> > But we want to export two strings to user space (at least for now), is
> > it really worth the effort to add ethtool support for such a minor
> > feature? Also I have understood that ethtool is implemented only for
> > ethernet drivers, I don't feel comfortable that we use ethernet driver
> > interfaces with 802.11 device drivers. They are so much different that
> > there isn't that much common functionality. That's why I prefer
> > nl80211 over ethtool.
> >
> > What do people think?
> 
> So for Wake-on-Wireless I ran into the same, ethtool just did not
> offer the same wake up events needed for wireless. I could have
> technically used ethtool and expanded it to support wireless but it
> just seemed dirty.
> 
> I agree that using ethtool seems overkill compared to the patches you posted.

I think you either overestimate the amount of trouble for implementing
(minimal) ethtool support or you underestimate the amount of
functionality available through that interface.  That, or you just
don't like using something named "eth"tool for wireless -- but hey,
let's be honest about the frames we send/receive to/from the kernel...
:-)

The ethtool interface provides functionality for viewing and modifying
eeprom contents, dumping registers, trigger self-tests, basic driver
info, getting and setting message reporting levels, external card
identification (hey, _could_ be useful!), and some other bits like
checksum offload that might(?) be useful in the future.  I understand
regarding the WoW vs. WoL issue but probably the answer is just to
add a new method for WoW...?

I'll post a patch series based on what Kalle sent but using ethtool
instead of nl80211...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* RE: [PATCH 2.6.32-rc1] net: VMware virtual Ethernet NIC driver: vmxnet3
From: Shreyas Bhatewara @ 2009-10-01  1:18 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: linux-kernel, netdev, Stephen Hemminger, David S. Miller,
	Jeff Garzik, Anthony Liguori, Chris Wright, Greg Kroah-Hartman,
	Andrew Morton, virtualization, pv-drivers
In-Reply-To: <20090930173923.4520716a@s6510>

Stephen,

Thanks for taking a look.



> -----Original Message-----
> From: Stephen Hemminger [mailto:shemminger@vyatta.com]
> Sent: Wednesday, September 30, 2009 5:39 PM
> To: Shreyas Bhatewara
> Cc: linux-kernel; netdev; Stephen Hemminger; David S. Miller; Jeff
> Garzik; Anthony Liguori; Chris Wright; Greg Kroah-Hartman; Andrew
> Morton; virtualization; pv-drivers
> Subject: Re: [PATCH 2.6.32-rc1] net: VMware virtual Ethernet NIC
> driver: vmxnet3
> 
> On Wed, 30 Sep 2009 14:34:57 -0700 (PDT)
> Shreyas Bhatewara <sbhatewara@vmware.com> wrote:
> 
> Note: your patch was linewrapped again
> 

Fixed the alpine option. Should not happen again.

> > +
> > +
> > +static void
> > +vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool
> dma64)
> > +{
> > +	struct net_device *netdev = adapter->netdev;
> > +
> > +	netdev->features = NETIF_F_SG |
> > +		NETIF_F_HW_CSUM |
> > +		NETIF_F_HW_VLAN_TX |
> > +		NETIF_F_HW_VLAN_RX |
> > +		NETIF_F_HW_VLAN_FILTER |
> > +		NETIF_F_TSO |
> > +		NETIF_F_TSO6;
> > +
> > +	printk(KERN_INFO "features: sg csum vlan jf tso tsoIPv6");
> > +
> > +	adapter->rxcsum = true;
> > +	adapter->jumbo_frame = true;
> > +
> > +	if (!disable_lro) {
> > +		adapter->lro = true;
> > +		printk(" lro");
> > +	}
> 
> Why not use NETIF_F_LRO and ethtool to control LRO support?

Yes, that would be a better way to do it. I will make that change.

^ permalink raw reply

* [PATCH 1/3] wireless: implement basic ethtool support for cfg80211 devices
From: John W. Linville @ 2009-10-01  1:19 UTC (permalink / raw)
  To: linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Kalle Valo, Kalle Valo,
	Luis R. Rodriguez, John W. Linville
In-Reply-To: <20091001011340.GA3123-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>

Signed-off-by: John W. Linville <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
---
 net/wireless/Makefile  |    2 +-
 net/wireless/core.c    |    3 +++
 net/wireless/ethtool.c |   27 +++++++++++++++++++++++++++
 net/wireless/ethtool.h |   10 ++++++++++
 4 files changed, 41 insertions(+), 1 deletions(-)
 create mode 100644 net/wireless/ethtool.c
 create mode 100644 net/wireless/ethtool.h

diff --git a/net/wireless/Makefile b/net/wireless/Makefile
index c814150..f07c8dc 100644
--- a/net/wireless/Makefile
+++ b/net/wireless/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_WEXT_SPY) += wext-spy.o
 obj-$(CONFIG_WEXT_PRIV) += wext-priv.o
 
 cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
-cfg80211-y += mlme.o ibss.o sme.o chan.o
+cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o
 cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
 cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
 
diff --git a/net/wireless/core.c b/net/wireless/core.c
index c761532..faada5c 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -21,6 +21,7 @@
 #include "sysfs.h"
 #include "debugfs.h"
 #include "wext-compat.h"
+#include "ethtool.h"
 
 /* name for sysfs, %d is appended */
 #define PHY_NAME "phy"
@@ -683,6 +684,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
 				wdev->wext.ps = false;
 			}
 #endif
+		if (!dev->ethtool_ops)
+			dev->ethtool_ops = &cfg80211_ethtool_ops;
 		break;
 	case NETDEV_GOING_DOWN:
 		switch (wdev->iftype) {
diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
new file mode 100644
index 0000000..94ca377
--- /dev/null
+++ b/net/wireless/ethtool.c
@@ -0,0 +1,27 @@
+#include <linux/utsrelease.h>
+#include <net/cfg80211.h>
+#include "ethtool.h"
+
+const struct ethtool_ops cfg80211_ethtool_ops = {
+	.get_drvinfo = cfg80211_get_drvinfo,
+	.get_link = ethtool_op_get_link,
+};
+
+void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+	strncpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name,
+		sizeof(info->driver));
+	info->driver[sizeof(info->driver) - 1] = '\0';
+
+	strncpy(info->version, UTS_RELEASE, sizeof(info->version));
+	info->version[sizeof(info->version) - 1] = '\0';
+
+	strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
+	info->fw_version[sizeof(info->fw_version) - 1] = '\0';
+
+	strncpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
+		sizeof(info->bus_info));
+	info->bus_info[sizeof(info->bus_info) - 1] = '\0';
+}
diff --git a/net/wireless/ethtool.h b/net/wireless/ethtool.h
new file mode 100644
index 0000000..a51b470
--- /dev/null
+++ b/net/wireless/ethtool.h
@@ -0,0 +1,10 @@
+#ifndef __CFG80211_ETHTOOL__
+#define __CFG80211_ETHTOOL__
+
+#include <linux/ethtool.h>
+
+extern void cfg80211_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
+
+extern const struct ethtool_ops cfg80211_ethtool_ops;
+
+#endif /* __CFG80211_ETHTOOL__ */
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 3/3] at76c50x-usb: set firmware and hardware version in wiphy
From: John W. Linville @ 2009-10-01  1:19 UTC (permalink / raw)
  To: linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Kalle Valo, Kalle Valo,
	Luis R. Rodriguez, John W. Linville
In-Reply-To: <1254359942-3483-2-git-send-email-linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>

From: Kalle Valo <kalle.valo-X3B1VOXEql0@public.gmane.org>

Set firmware and hardware version in wiphy so that user space can access
it.

(Modification from original in favor of cfg80211 ethtool support. -- JWL)

Cc: Kalle Valo <kalle.valo-X3B1VOXEql0@public.gmane.org>
Signed-off-by: John W. Linville <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
---
 drivers/net/wireless/at76c50x-usb.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 8e1a55d..533954d 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -2217,6 +2217,8 @@ static struct ieee80211_supported_band at76_supported_band = {
 static int at76_init_new_device(struct at76_priv *priv,
 				struct usb_interface *interface)
 {
+	struct wiphy *wiphy;
+	size_t len;
 	int ret;
 
 	/* set up the endpoint information */
@@ -2254,6 +2256,7 @@ static int at76_init_new_device(struct at76_priv *priv,
 	priv->device_unplugged = 0;
 
 	/* mac80211 initialisation */
+	wiphy = priv->hw->wiphy;
 	priv->hw->wiphy->max_scan_ssids = 1;
 	priv->hw->wiphy->max_scan_ie_len = 0;
 	priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
@@ -2265,6 +2268,15 @@ static int at76_init_new_device(struct at76_priv *priv,
 	SET_IEEE80211_DEV(priv->hw, &interface->dev);
 	SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
 
+	len = sizeof(wiphy->fw_version);
+	snprintf(wiphy->fw_version, len, "%d.%d.%d-%d",
+		 priv->fw_version.major, priv->fw_version.minor,
+		 priv->fw_version.patch, priv->fw_version.build);
+	/* null terminate the strings in case they were truncated */
+	wiphy->fw_version[len - 1] = '\0';
+
+	wiphy->hw_version = priv->board_type;
+
 	ret = ieee80211_register_hw(priv->hw);
 	if (ret) {
 		printk(KERN_ERR "cannot register mac80211 hw (status %d)!\n",
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 2/3] cfg80211: add firmware and hardware version to wiphy
From: John W. Linville @ 2009-10-01  1:19 UTC (permalink / raw)
  To: linux-wireless
  Cc: netdev, Kalle Valo, Kalle Valo, Luis R. Rodriguez,
	John W. Linville
In-Reply-To: <1254359942-3483-1-git-send-email-linville@tuxdriver.com>

From: Kalle Valo <kalle.valo@nokia.com>

It's useful to provide firmware and hardware version to user space and have a
generic interface to retrieve them. Users can provide the version information
in bug reports etc.

Add fields for firmware and hardware version to struct wiphy.

(Dropped nl80211 bits for now and modified remaining bits in favor of
ethtool. -- JWL)

Cc: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 include/net/cfg80211.h |    3 +++
 net/wireless/ethtool.c |   23 ++++++++++++++++++++++-
 net/wireless/ethtool.h |    3 +++
 3 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 241ea14..6f4862b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1142,6 +1142,9 @@ struct wiphy {
 	u32 frag_threshold;
 	u32 rts_threshold;
 
+	char fw_version[ETHTOOL_BUSINFO_LEN];
+	u32 hw_version;
+
 	/* If multiple wiphys are registered and you're handed e.g.
 	 * a regular netdev with assigned ieee80211_ptr, you won't
 	 * know whether it points to a wiphy your driver has registered
diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
index 94ca377..3c59549 100644
--- a/net/wireless/ethtool.c
+++ b/net/wireless/ethtool.c
@@ -4,6 +4,8 @@
 
 const struct ethtool_ops cfg80211_ethtool_ops = {
 	.get_drvinfo = cfg80211_get_drvinfo,
+	.get_regs_len = cfg80211_get_regs_len,
+	.get_regs = cfg80211_get_regs,
 	.get_link = ethtool_op_get_link,
 };
 
@@ -18,10 +20,29 @@ void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 	strncpy(info->version, UTS_RELEASE, sizeof(info->version));
 	info->version[sizeof(info->version) - 1] = '\0';
 
-	strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
+	if (wdev->wiphy->fw_version[0])
+		strncpy(info->fw_version, wdev->wiphy->fw_version,
+			sizeof(info->fw_version));
+	else
+		strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
 	info->fw_version[sizeof(info->fw_version) - 1] = '\0';
 
 	strncpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
 		sizeof(info->bus_info));
 	info->bus_info[sizeof(info->bus_info) - 1] = '\0';
 }
+
+int cfg80211_get_regs_len(struct net_device *dev)
+{
+	/* For now, return 0... */
+	return 0;
+}
+
+void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
+			void *data)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+	regs->version = wdev->wiphy->hw_version;
+	regs->len = 0;
+}
diff --git a/net/wireless/ethtool.h b/net/wireless/ethtool.h
index a51b470..2d4602a 100644
--- a/net/wireless/ethtool.h
+++ b/net/wireless/ethtool.h
@@ -4,6 +4,9 @@
 #include <linux/ethtool.h>
 
 extern void cfg80211_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
+extern int cfg80211_get_regs_len(struct net_device *);
+extern void cfg80211_get_regs(struct net_device *, struct ethtool_regs *,
+				void *);
 
 extern const struct ethtool_ops cfg80211_ethtool_ops;
 
-- 
1.6.2.5


^ permalink raw reply related

* Re: [PATCH 1/3] wireless: implement basic ethtool support for cfg80211 devices
From: Ben Hutchings @ 2009-10-01  1:30 UTC (permalink / raw)
  To: John W. Linville
  Cc: linux-wireless, netdev, Kalle Valo, Kalle Valo, Luis R. Rodriguez
In-Reply-To: <1254359942-3483-1-git-send-email-linville@tuxdriver.com>

On Wed, 2009-09-30 at 21:19 -0400, John W. Linville wrote:
[...]
> +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
> +{
> +	struct wireless_dev *wdev = dev->ieee80211_ptr;
> +
> +	strncpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name,
> +		sizeof(info->driver));
> +	info->driver[sizeof(info->driver) - 1] = '\0';
[...]

Use strlcpy() instead of these two statements.

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.


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox