Netdev List
 help / color / mirror / Atom feed
* Re: linux-next: build warning after merge of the net tree
From: David Miller @ 2010-07-08  0:45 UTC (permalink / raw)
  To: sfr; +Cc: netdev, linux-next, linux-kernel, joe, gregkh
In-Reply-To: <20100706142542.d723903f.sfr@canb.auug.org.au>

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Tue, 6 Jul 2010 14:25:42 +1000

> After merging the net tree, today's linux-next build (powerpc
> ppc64_defconfig) produced these warnings:
> 
> drivers/scsi/sym53c8xx_2/sym_hipd.c: In function 'sym_print_msg':
> drivers/scsi/sym53c8xx_2/sym_hipd.c:78: warning: zero-length gnu_printf format string

Thanks Stephen I'll look into this.

^ permalink raw reply

* [PATCH] b44: remove unused dma_desc_align_mask
From: FUJITA Tomonori @ 2010-07-08  0:55 UTC (permalink / raw)
  To: netdev; +Cc: zambrano


Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 drivers/net/b44.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 3d52538..37617ab 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -135,7 +135,6 @@ static void b44_init_rings(struct b44 *);
 
 static void b44_init_hw(struct b44 *, int);
 
-static int dma_desc_align_mask;
 static int dma_desc_sync_size;
 static int instance;
 
@@ -2340,7 +2339,6 @@ static int __init b44_init(void)
 	int err;
 
 	/* Setup paramaters for syncing RX/TX DMA descriptors */
-	dma_desc_align_mask = ~(dma_desc_align_size - 1);
 	dma_desc_sync_size = max_t(unsigned int, dma_desc_align_size, sizeof(struct dma_desc));
 
 	err = b44_pci_init();
-- 
1.6.5


^ permalink raw reply related

* Re: linux-next: build warning after merge of the net tree
From: David Miller @ 2010-07-08  1:18 UTC (permalink / raw)
  To: sfr; +Cc: netdev, linux-next, linux-kernel, joe, gregkh
In-Reply-To: <20100707.174522.148565561.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Wed, 07 Jul 2010 17:45:22 -0700 (PDT)

> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Tue, 6 Jul 2010 14:25:42 +1000
> 
>> After merging the net tree, today's linux-next build (powerpc
>> ppc64_defconfig) produced these warnings:
>> 
>> drivers/scsi/sym53c8xx_2/sym_hipd.c: In function 'sym_print_msg':
>> drivers/scsi/sym53c8xx_2/sym_hipd.c:78: warning: zero-length gnu_printf format string
> 
> Thanks Stephen I'll look into this.

Yeah this is a bit ugly.

It used to be that the dev_*() format string was CPP pasted to whatever
format string the user gave.  So if the user gave an empty string it
still looked like a non-empty printf string.

But that no longer happens because we hide the implementation, and thus
the top-level printf format string, in the external functions.

It seems the construction:

/*
 * Stupid hackaround for existing uses of non-printk uses dev_info
 *
 * Note that the definition of dev_info below is actually _dev_info
 * and a macro is used to avoid redefining dev_info
 */

#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)

added to linux/device.h was meant to handle these cases, but as we see
it doesn't.

It looks like there are just a hand-ful of cases, so maybe we can tweak
them by hand.  For example, in the sym53c8xx_2 driver bits we can replace
the NULL labels passed to sym_print_msg() with a real string and therefore
remove the "" case.

Joe, any better ideas?

^ permalink raw reply

* Re: linux-next: build warning after merge of the net tree
From: David Miller @ 2010-07-08  1:23 UTC (permalink / raw)
  To: sfr; +Cc: netdev, linux-next, linux-kernel, jonas
In-Reply-To: <20100707143045.0c472f5d.sfr@canb.auug.org.au>

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 7 Jul 2010 14:30:45 +1000

> Hi Dave,
> 
> After merging the net tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
> 
> drivers/net/ethoc.c: In function 'ethoc_init_ring':
> drivers/net/ethoc.c:302: warning: assignment makes integer from pointer without a cast
> 
> Introduced by commit f8555ad0cfb0ba6cbc8729f337341fb11c82db89 ("ethoc:
> Write bus addresses to registers").

I'll fix this as follows:

--------------------
ethoc: Fix warning in ethoc_init_ring().

Get rid of the pointless back-and-forth casting of dev->mem_start
from long to pointer back to long again.

Also fixes a warning reported by Stephen Rothwell:

drivers/net/ethoc.c: In function 'ethoc_init_ring':
drivers/net/ethoc.c:302: warning: assignment makes integer from pointer without a cast

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/ethoc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index db519a8..5bb6bb7 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -286,7 +286,7 @@ static inline void ethoc_disable_rx_and_tx(struct ethoc *dev)
 	ethoc_write(dev, MODER, mode);
 }
 
-static int ethoc_init_ring(struct ethoc *dev, void* mem_start)
+static int ethoc_init_ring(struct ethoc *dev, unsigned long mem_start)
 {
 	struct ethoc_bd bd;
 	int i;
@@ -670,7 +670,7 @@ static int ethoc_open(struct net_device *dev)
 	if (ret)
 		return ret;
 
-	ethoc_init_ring(priv, (void*)dev->mem_start);
+	ethoc_init_ring(priv, dev->mem_start);
 	ethoc_reset(priv);
 
 	if (netif_queue_stopped(dev)) {
-- 
1.7.1.1

^ permalink raw reply related

* Re: [PATCH] b44: remove unused dma_desc_align_mask
From: David Miller @ 2010-07-08  1:25 UTC (permalink / raw)
  To: fujita.tomonori; +Cc: netdev, zambrano
In-Reply-To: <20100708095537B.fujita.tomonori@lab.ntt.co.jp>

From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Thu, 8 Jul 2010 09:55:58 +0900

> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

Applied, thanks.

^ permalink raw reply

* Re: IPVS: Incorrect helper use for SCTP [was: wensong@linux-vs.org, horms@verge.net.au]
From: xiaoyu Du @ 2010-07-08  1:33 UTC (permalink / raw)
  To: Simon Horman; +Cc: lvs-devel, linux-kernel, netdev
In-Reply-To: <20100707122110.GF17967@verge.net.au>

This function is used  for sctp app heplers.
since  there's no sctp helpers yet at present, it does nothing.
If I make sure this is a bug. I will resend the pathch.


2010/7/7 Simon Horman <horms@verge.net.au>:
> [CCed netdev]
>
> Thanks,
>
> that looks correct to me. Have you tested this change?
> If so could you provided a Signed-off-by line
> as per section 12 of Documentation/SubmittingPatches?
>
> On Wed, Jul 07, 2010 at 05:19:06PM +0800, xiaoyu Du wrote:
>> Hi,all
>>
>> After I compared the sctp with tcp and udp, I thinkt his a bug that
>> sctp_dnat_handler Incorrectly invoked ip_vs_app_pkt_out.
>> below is the patch.
>>
>> ---
>>  net/netfilter/ipvs/ip_vs_proto_sctp.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c
>> b/net/netfilter/ipvs/ip_vs_proto_sctp.c
>> index c9a3f7a..db55759 100644
>> --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c
>> +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c
>> @@ -173,7 +173,7 @@ sctp_dnat_handler(struct sk_buff *skb,
>>                        return 0;
>>
>>                /* Call application helper if needed */
>> -               if (!ip_vs_app_pkt_out(cp, skb))
>> +               if (!ip_vs_app_pkt_in(cp, skb))
>>                        return 0;
>>        }
>>
>> --
>> --
>> To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* [GIT] Networking
From: David Miller @ 2010-07-08  1:35 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel


1) Fix missing length checks in ETHTOOL_* command handling, from Ben
   Hutchings.

2) Disable netpoll support for bond interfaces, it's a feature we
   tried to add this merge window and we can't make it work properly
   without major locking changes.  From Andy Gospodarek.

3) XFRMA_MARK attribute extraction uses wrong sizeof() in memcpy(),
   fix from Andreas Steffen.

4) ll_temac driver leaks iomaps on error, from Denis Kirjanov.

5) Bridge injection into IPV4 stack crashes because it fails to
   clear out the SKB control block, fix from Herbert Xu.

   Also, handle correctly the case where we have no bridging multicast
   table and see an IGMP.  People have reported crashes due to this.

6) Bonding driver can babble excessively in certain configurations
   because it sends out pointless notifications when the MAC address
   of a client hasn't even changed.  Fix from Flavio Leitner.

7) rndis_host status polling change broke some chips, revert.
   From Ben Hutchings.

8) netif_vdbg() is bogusly defined when VERBOSE_DEBUG is enabled.
   Also from Ben Hutchings.

9) qlge driver timer crash fixes, from Breno Leitao.

10) netfilter ipv6 REJECT module leaks routes, fix from Eric Dumazet.

11) Fix bogus statistic reporting in s2io driver, previously it was possible
    (for example) to see more multicast RX than total RX.  Fix from
    Jon Mason.

12) SB1250 fails to initialize module owner, from Ralf Baechle.

13) virtio net fixes from Michael S. Tsirkin, including a fix for
    infinite rx refilling and error handling in polling.

    As well as a TX oom handling fix from Rusty.

14) vxge driver shows probe time driver info using KERN_CRIT, fix
    from Wu Fengguang.

15) A few small wireless fixes via Wey-Yi Guy, Vasanthakumar Thiagarajan,
    and Johannes Berg.

16) Drivers that modify ->real_num_tx_queues on a potentially active
    interface must flush the attached qdisc or we get illegal accesses
    later, from John Fastabend.

Please pull, thanks a lot!

The following changes since commit 815c4163b6c8ebf8152f42b0a5fd015cfdcedc78:

  Linux 2.6.35-rc4 (2010-07-04 20:22:50 -0700)

are available in the git repository at:
  master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git master

Andreas Steffen (1):
      xfrm: fix XFRMA_MARK extraction in xfrm_mark_get

Andy Gospodarek (2):
      bonding: prevent netpoll over bonded interfaces
      ixgbe: fix panic when shutting down system with WoL enabled

Ben Hutchings (5):
      ethtool: Fix potential kernel buffer overflow in ETHTOOL_GRXCLSRLALL
      ethtool: Fix potential user buffer overflow for ETHTOOL_{G, S}RXFH
      net: Revert "rndis_host: Poll status channel before control channel"
      usbnet: Set parent device early for netdev_printk()
      net: Fix definition of netif_vdbg() when VERBOSE_DEBUG is defined

Breno Leitao (2):
      qlge: Replacing add_timer() to mod_timer()
      qlge: fix a eeh handler to not add a pending timer

Cody Rester (1):
      drivers: bluetooth: bluecard_cs.c: Fixed include error, changed to linux/io.h

David Howells (1):
      Bluetooth: Fix abuse of the preincrement operator

David S. Miller (3):
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-2.6
      Merge branch 'master' of git://git.kernel.org/.../kaber/nf-2.6
      Merge branch 'vhost-net' of git://git.kernel.org/.../mst/vhost

Denis Kirjanov (1):
      ll_temac: Fix missing iounmaps

Eric Dumazet (1):
      netfilter: ip6t_REJECT: fix a dst leak in ipv6 REJECT

Flavio Leitner (1):
      bonding: check if clients MAC addr has changed

Guillaume Gaudonville (1):
      ixgbe: skip non IPv4 packets in ATR filter

Herbert Xu (2):
      bridge br_multicast: BUG: unable to handle kernel NULL pointer dereference
      bridge: Clear IPCB before possible entry into IP stack

Johannes Berg (1):
      iwlwifi: fix multicast

John Fastabend (3):
      ixgbe: disable tx engine before disabling tx laser
      sched: qdisc_reset_all_tx is calling qdisc_reset without qdisc_lock
      net: decreasing real_num_tx_queues needs to flush qdisc

Jon Mason (1):
      s2io: resolve statistics issues

Kulikov Vasiliy (1):
      net/ne: fix memory leak in ne_drv_probe()

Michael S. Tsirkin (3):
      vhost: break out of polling loop on error
      vhost: add unlikely annotations to error path
      virtio_net: do not reschedule rx refill forever

Peter Kosyh (1):
      xfrm: fix xfrm by MARK logic

Ralf Baechle (1):
      NET: SB1250: Initialize .owner

Randy Dunlap (1):
      linux/net.h: fix kernel-doc warnings

Rusty Russell (1):
      virtio_net: fix oom handling on tx

Saeed Bishara (1):
      mv643xx_eth: use sw csum for big packets

Vasanthakumar Thiagarajan (1):
      ath9k: Fix bug in starting ani

Wey-Yi Guy (1):
      iwlwifi: set TX_CMD_FLAG_PROT_REQUIRE_MSK in tx_flag

Wu Fengguang (1):
      vxge: show startup message with KERN_INFO

 drivers/bluetooth/bluecard_cs.c             |    2 +-
 drivers/bluetooth/hci_bcsp.c                |    2 +-
 drivers/net/bonding/bond_alb.c              |    3 +-
 drivers/net/bonding/bond_main.c             |   33 ++++++---
 drivers/net/ixgbe/ixgbe_main.c              |   17 +++--
 drivers/net/ll_temac_main.c                 |   18 ++++--
 drivers/net/mv643xx_eth.c                   |    9 ++-
 drivers/net/ne.c                            |    4 +-
 drivers/net/qlge/qlge_main.c                |   11 ++--
 drivers/net/s2io.c                          |  101 +++++++++++++++++----------
 drivers/net/s2io.h                          |    4 -
 drivers/net/sb1250-mac.c                    |    1 +
 drivers/net/usb/rndis_host.c                |   18 ++---
 drivers/net/usb/usbnet.c                    |    5 +-
 drivers/net/virtio_net.c                    |   28 ++++---
 drivers/net/vxge/vxge-main.c                |    4 +-
 drivers/net/wireless/ath/ath9k/ath9k.h      |    1 +
 drivers/net/wireless/ath/ath9k/main.c       |   11 +++-
 drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c |    6 +--
 drivers/net/wireless/iwlwifi/iwl-core.c     |    7 ++-
 drivers/vhost/net.c                         |   12 +++-
 drivers/vhost/vhost.c                       |   86 ++++++++++++-----------
 drivers/vhost/vhost.h                       |    8 +-
 include/linux/ethtool.h                     |    2 +
 include/linux/mv643xx_eth.h                 |    5 ++
 include/linux/net.h                         |    3 +-
 include/linux/netdevice.h                   |    5 +-
 include/net/sch_generic.h                   |   20 ++++-
 include/net/xfrm.h                          |    2 +-
 net/bridge/br_multicast.c                   |   21 +++---
 net/bridge/br_netfilter.c                   |    3 +
 net/core/dev.c                              |   18 +++++
 net/core/ethtool.c                          |   41 ++++++++---
 net/ipv4/xfrm4_policy.c                     |    2 +
 net/ipv6/netfilter/ip6t_REJECT.c            |    6 +-
 net/ipv6/xfrm6_policy.c                     |    2 +
 36 files changed, 332 insertions(+), 189 deletions(-)

^ permalink raw reply

* Re: [PATCH] ixgbe: fix crashing with ixgbe_vlan_filter_enable
From: Yinghai Lu @ 2010-07-08  1:35 UTC (permalink / raw)
  To: Tantilov, Emil S; +Cc: David Miller, Brandeburg, Jesse, NetDev
In-Reply-To: <EA929A9653AAE14F841771FB1DE5A1365FF492082D@rrsmsx501.amr.corp.intel.com>

On 07/07/2010 04:31 PM, Tantilov, Emil S wrote:
> Yinghai Lu wrote:
>> happens with reboot or call kexec on system with ixgbe.
>>
>> [ 4912.773390] BUG: unable to handle kernel NULL pointer dereference
>> [ 4912.785756] IP: [<ffffffff81691600>]
>> ixgbe_vlan_filter_enable+0x74/0xda [ 4912.794084] PGD 10391a0067 PUD
>> 1022e3c067 PMD 0 [ 4912.805976] Oops: 0000 [#1] SMP
...
> There should be a patch in net-2.6 that fixes this issue:
> 
> http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=fa37813401ff52d78591c262d6542e4d5d935584

That fixes the problem.

Thanks

Yinghai

^ permalink raw reply

* [PATCH net-next] cxgb4: fix for new ndo_get_stats64 signature
From: Dimitris Michailidis @ 2010-07-08  2:11 UTC (permalink / raw)
  To: netdev; +Cc: Dimitris Michailidis

The change to ndo_get_stats64 in "net: fix 64 bit counters on 32 bit arches"
missed cxgb4.  Fix it.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
---
 drivers/net/cxgb4/cxgb4_main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 55a720e..2619997 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -2601,12 +2601,12 @@ static int cxgb_close(struct net_device *dev)
 	return t4_enable_vi(adapter, 0, pi->viid, false, false);
 }
 
-static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev)
+static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev,
+						struct rtnl_link_stats64 *ns)
 {
 	struct port_stats stats;
 	struct port_info *p = netdev_priv(dev);
 	struct adapter *adapter = p->adapter;
-	struct rtnl_link_stats64 *ns = &dev->stats64;
 
 	spin_lock(&adapter->stats_lock);
 	t4_get_port_stats(adapter, p->tx_chan, &stats);
-- 
1.5.4


^ permalink raw reply related

* Re: linux-next: build warning after merge of the net tree
From: Joe Perches @ 2010-07-08  4:13 UTC (permalink / raw)
  To: David Miller; +Cc: sfr, netdev, linux-next, linux-kernel, gregkh
In-Reply-To: <20100707.181847.62350965.davem@davemloft.net>

On Wed, 2010-07-07 at 18:18 -0700, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Wed, 07 Jul 2010 17:45:22 -0700 (PDT)
> > From: Stephen Rothwell <sfr@canb.auug.org.au>
> > Date: Tue, 6 Jul 2010 14:25:42 +1000
> >> After merging the net tree, today's linux-next build (powerpc
> >> ppc64_defconfig) produced these warnings:
> >> drivers/scsi/sym53c8xx_2/sym_hipd.c: In function 'sym_print_msg':
> >> drivers/scsi/sym53c8xx_2/sym_hipd.c:78: warning: zero-length gnu_printf format string
> > Thanks Stephen I'll look into this.
> Yeah this is a bit ugly.
> 
> It used to be that the dev_*() format string was CPP pasted to whatever
> format string the user gave.  So if the user gave an empty string it
> still looked like a non-empty printf string.
> 
> But that no longer happens because we hide the implementation, and thus
> the top-level printf format string, in the external functions.
> 
> It seems the construction:
> 
> /*
>  * Stupid hackaround for existing uses of non-printk uses dev_info
>  *
>  * Note that the definition of dev_info below is actually _dev_info
>  * and a macro is used to avoid redefining dev_info
>  */
> 
> #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
> 
> added to linux/device.h was meant to handle these cases, but as we see
> it doesn't.

Nope, the _dev_info/dev_info is meant to handle the
current uses of dev_info as a variable like this one:

$ grep dev_info drivers/net/pcmcia/pcnet_cs.c
static dev_info_t dev_info = "pcnet_cs";
    ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev);

Without the _dev_info and dev_info as a macro,
the function is redefined as a variable.

> It looks like there are just a hand-ful of cases, so maybe we can tweak
> them by hand.  For example, in the sym53c8xx_2 driver bits we can replace
> the NULL labels passed to sym_print_msg() with a real string and therefore
> remove the "" case.
> 
> Joe, any better ideas?

You're right there are just a few cases where dev_info
is uses as a preface for a hex_dump style display.

Maybe it'd be OK to simply add a trailing space to the
preface and remove any leading spaces from the subsequent
initial printks.

dev_info(dev, " ");

^ permalink raw reply

* Re: [PATCH net-next] cxgb4: fix for new ndo_get_stats64 signature
From: Eric Dumazet @ 2010-07-08  5:17 UTC (permalink / raw)
  To: Dimitris Michailidis; +Cc: netdev
In-Reply-To: <1278555085-17074-1-git-send-email-dm@chelsio.com>

Le mercredi 07 juillet 2010 à 19:11 -0700, Dimitris Michailidis a
écrit :
> The change to ndo_get_stats64 in "net: fix 64 bit counters on 32 bit arches"
> missed cxgb4.  Fix it.
> 
> Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
> ---

Indeed, sorry and thanks !

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>



^ permalink raw reply

* Re: [PATCH net-next-2.6 V2] net: fix 64 bit counters on 32 bit arches
From: Eric Dumazet @ 2010-07-08  5:18 UTC (permalink / raw)
  To: David Miller; +Cc: bhutchings, shemminger, arnd, netdev, linux-net-drivers
In-Reply-To: <20100707.154109.26944330.davem@davemloft.net>

Le mercredi 07 juillet 2010 à 15:41 -0700, David Miller a écrit :

> Some dev_get_stats() conversions were missing, such as parisc/led,
> some s390 code, usb rndis, etc.
> 
> I took care of this when integrating this patch.

Thats very kind of you David, thanks !




^ permalink raw reply

* Re: [PATCH net-next] cxgb4: fix for new ndo_get_stats64 signature
From: David Miller @ 2010-07-08  5:41 UTC (permalink / raw)
  To: eric.dumazet; +Cc: dm, netdev
In-Reply-To: <1278566230.2543.0.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 08 Jul 2010 07:17:10 +0200

> Le mercredi 07 juillet 2010 à 19:11 -0700, Dimitris Michailidis a
> écrit :
>> The change to ndo_get_stats64 in "net: fix 64 bit counters on 32 bit arches"
>> missed cxgb4.  Fix it.
>> 
>> Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
>> ---
> 
> Indeed, sorry and thanks !
> 
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks.

^ permalink raw reply

* [PATCH net-next-2.6 V2] tg3: 64 bit stats on all arches
From: Eric Dumazet @ 2010-07-08  6:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Matt Carlson, Michael Chan

Now core network is able to handle 64 bit netdevice stats on 32 bit
arches, we can provide them for tg3, since hardware maintains 64 bit
counters.

I'll provide bnx2 and bnx2x patches as well.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/tg3.c |   35 ++++++++++++-----------------------
 drivers/net/tg3.h |    4 ++--
 2 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 289cdc5..7c75f1e 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -9021,7 +9021,8 @@ err_out1:
 	return err;
 }
 
-static struct net_device_stats *tg3_get_stats(struct net_device *);
+static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *,
+						 struct rtnl_link_stats64 *);
 static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *);
 
 static int tg3_close(struct net_device *dev)
@@ -9055,8 +9056,8 @@ static int tg3_close(struct net_device *dev)
 
 	tg3_ints_fini(tp);
 
-	memcpy(&tp->net_stats_prev, tg3_get_stats(tp->dev),
-	       sizeof(tp->net_stats_prev));
+	tg3_get_stats64(tp->dev, &tp->net_stats_prev);
+
 	memcpy(&tp->estats_prev, tg3_get_estats(tp),
 	       sizeof(tp->estats_prev));
 
@@ -9069,24 +9070,12 @@ static int tg3_close(struct net_device *dev)
 	return 0;
 }
 
-static inline unsigned long get_stat64(tg3_stat64_t *val)
-{
-	unsigned long ret;
-
-#if (BITS_PER_LONG == 32)
-	ret = val->low;
-#else
-	ret = ((u64)val->high << 32) | ((u64)val->low);
-#endif
-	return ret;
-}
-
-static inline u64 get_estat64(tg3_stat64_t *val)
+static inline u64 get_stat64(tg3_stat64_t *val)
 {
        return ((u64)val->high << 32) | ((u64)val->low);
 }
 
-static unsigned long calc_crc_errors(struct tg3 *tp)
+static u64 calc_crc_errors(struct tg3 *tp)
 {
 	struct tg3_hw_stats *hw_stats = tp->hw_stats;
 
@@ -9114,7 +9103,7 @@ static unsigned long calc_crc_errors(struct tg3 *tp)
 
 #define ESTAT_ADD(member) \
 	estats->member =	old_estats->member + \
-				get_estat64(&hw_stats->member)
+				get_stat64(&hw_stats->member)
 
 static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
 {
@@ -9204,11 +9193,11 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
 	return estats;
 }
 
-static struct net_device_stats *tg3_get_stats(struct net_device *dev)
+static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
+						 struct rtnl_link_stats64 *stats)
 {
 	struct tg3 *tp = netdev_priv(dev);
-	struct net_device_stats *stats = &tp->net_stats;
-	struct net_device_stats *old_stats = &tp->net_stats_prev;
+	struct rtnl_link_stats64 *old_stats = &tp->net_stats_prev;
 	struct tg3_hw_stats *hw_stats = tp->hw_stats;
 
 	if (!hw_stats)
@@ -14317,7 +14306,7 @@ static const struct net_device_ops tg3_netdev_ops = {
 	.ndo_open		= tg3_open,
 	.ndo_stop		= tg3_close,
 	.ndo_start_xmit		= tg3_start_xmit,
-	.ndo_get_stats		= tg3_get_stats,
+	.ndo_get_stats64	= tg3_get_stats64,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_set_multicast_list	= tg3_set_rx_mode,
 	.ndo_set_mac_address	= tg3_set_mac_addr,
@@ -14336,7 +14325,7 @@ static const struct net_device_ops tg3_netdev_ops_dma_bug = {
 	.ndo_open		= tg3_open,
 	.ndo_stop		= tg3_close,
 	.ndo_start_xmit		= tg3_start_xmit_dma_bug,
-	.ndo_get_stats		= tg3_get_stats,
+	.ndo_get_stats64	= tg3_get_stats64,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_set_multicast_list	= tg3_set_rx_mode,
 	.ndo_set_mac_address	= tg3_set_mac_addr,
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 6b6af76..b72ac52 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2772,8 +2772,8 @@ struct tg3 {
 
 
 	/* begin "everything else" cacheline(s) section */
-	struct net_device_stats		net_stats;
-	struct net_device_stats		net_stats_prev;
+	struct rtnl_link_stats64	net_stats;
+	struct rtnl_link_stats64	net_stats_prev;
 	struct tg3_ethtool_stats	estats;
 	struct tg3_ethtool_stats	estats_prev;
 



^ permalink raw reply related

* Re: [PATCH] vlan: allow TSO setting on vlan interfaces
From: Eric Dumazet @ 2010-07-08  6:46 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: David Miller, netdev, Patrick McHardy
In-Reply-To: <1278523511.2080.3.camel@achroite.uk.solarflarecom.com>

Le mercredi 07 juillet 2010 à 18:25 +0100, Ben Hutchings a écrit :
> On Wed, 2010-07-07 at 19:14 +0200, Eric Dumazet wrote:
> > When we need to shape traffic with low speeds, we need to disable tso on
> > network interface :
> > 
> > ethtool -K eth0.2240 tso off
> > 
> > It seems vlan interfaces miss the set_tso() ethtool method.
> > Propagating tso changes from lower device is not always wanted, some
> > vlan want TSO on, other want TSO off.
> 
> But it should not be possible to enable TSO if the underlying device
> doesn't support it.

Yes indeed, I'll provide a more generic patch, thanks !



^ permalink raw reply

* [PATCH net-2.6] Phonet: fix skb leak in pipe endpoint accept()
From: Rémi Denis-Courmont @ 2010-07-08  6:56 UTC (permalink / raw)
  To: netdev

From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
---
 net/phonet/pep.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 94d72e8..b2a3ae6 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -698,6 +698,7 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp)
 		newsk = NULL;
 		goto out;
 	}
+	kfree_skb(oskb);
 
 	sock_hold(sk);
 	pep_sk(newsk)->listener = sk;
-- 
1.7.0.4


^ permalink raw reply related

* Re: [PATCH linux-2.6.35-rc3] ks8842 driver
From: Simon Horman @ 2010-07-08  7:52 UTC (permalink / raw)
  To: Choi, David; +Cc: netdev, Li, Charles
In-Reply-To: <C43529A246480145B0A6D0234BDB0F0D0212A4@MELANITE.micrel.com>

On Wed, Jul 07, 2010 at 08:24:33AM -0700, Choi, David wrote:
> To whom it may have concerned,
> 
> It seems that there are differences between Micrel ks8842 device and Timberdale FPGA based device with generic bus interface. In order to check the differences, I have sent several times but have not received any response. This patch is to support ks8841/ks8842 device from Micrel.

Is it desirable that the code can never be compiled to work with both devices?
Is this code likely to be included in a generic/distro kernel?

> 
> From: David J. Choi <david.choi@micrel.com>
> 
> Body of the explanation: 
>    -support 16bit and 32bit bus width.
>    -add device reset for ks8842/8841 Micrel device.
>    -set 100Mbps as a default for Micrel device.
>    -set MAC address in both MAC/Switch layer with different sequence for Micrel device, 
>     as mentioned in data sheet.
> 
> Signed-off-by: David J. Choi <david.choi@micrel.com>
> 
> ---
> --- linux-2.6.35-rc3/drivers/net/ks8842.c.orig	2010-07-01 16:26:50.000000000 -0700
> +++ linux-2.6.35-rc3/drivers/net/ks8842.c	2010-07-07 07:41:03.000000000 -0700
> @@ -18,6 +18,7 @@
>  
>  /* Supports:
>   * The Micrel KS8842 behind the timberdale FPGA
> + * The genuine Micrel KS8841/42 device with ISA 16/32bit bus interface
>   */
>  
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> @@ -191,6 +192,12 @@ static inline u32 ks8842_read32(struct k
>  
>  static void ks8842_reset(struct ks8842_adapter *adapter)
>  {
> +#ifdef CONFIG_MICREL_KS884X
> +	ks8842_write16(adapter, 3, 1, REG_GRR);
> +	msleep(10);
> +	iowrite16(0, adapter->hw_addr + REG_GRR);
> +
> +#else
>  	/* The KS8842 goes haywire when doing softare reset
>  	 * a work around in the timberdale IP is implemented to
>  	 * do a hardware reset instead
> @@ -201,6 +208,7 @@ static void ks8842_reset(struct ks8842_a
>  	iowrite16(32, adapter->hw_addr + REG_SELECT_BANK);
>  	iowrite32(0x1, adapter->hw_addr + REG_TIMB_RST);
>  	msleep(20);
> +#endif
>  }
>  
>  static void ks8842_update_link_status(struct net_device *netdev,
> @@ -269,8 +277,11 @@ static void ks8842_reset_hw(struct ks884
>  
>  	/* restart port auto-negotiation */
>  	ks8842_enable_bits(adapter, 49, 1 << 13, REG_P1CR4);
> +
> +#ifndef CONFIG_MICREL_KS884X
>  	/* only advertise 10Mbps */
>  	ks8842_clear_bits(adapter, 49, 3 << 2, REG_P1CR4);
> +#endif
>  
>  	/* Enable the transmitter */
>  	ks8842_enable_tx(adapter);
> @@ -296,6 +307,20 @@ static void ks8842_read_mac_addr(struct 
>  	for (i = 0; i < ETH_ALEN; i++)
>  		dest[ETH_ALEN - i - 1] = ks8842_read8(adapter, 2, REG_MARL + i);
>  
> +#ifdef CONFIG_MICREL_KS884X
> +	/*
> +		the sequence of saving mac addr between MAC and Switch is
> +		different.
> +	*/
> +
> +	mac = ks8842_read16(adapter, 2, REG_MARL);
> +	ks8842_write16(adapter, 39, mac, REG_MACAR3);
> +	mac = ks8842_read16(adapter, 2, REG_MARM);
> +	ks8842_write16(adapter, 39, mac, REG_MACAR2);
> +	mac = ks8842_read16(adapter, 2, REG_MARH);
> +	ks8842_write16(adapter, 39, mac, REG_MACAR1);
> +#else
> +
>  	/* make sure the switch port uses the same MAC as the QMU */
>  	mac = ks8842_read16(adapter, 2, REG_MARL);
>  	ks8842_write16(adapter, 39, mac, REG_MACAR1);
> @@ -303,6 +328,7 @@ static void ks8842_read_mac_addr(struct 
>  	ks8842_write16(adapter, 39, mac, REG_MACAR2);
>  	mac = ks8842_read16(adapter, 2, REG_MARH);
>  	ks8842_write16(adapter, 39, mac, REG_MACAR3);
> +#endif
>  }
>  
>  static void ks8842_write_mac_addr(struct ks8842_adapter *adapter, u8 *mac)
> @@ -313,8 +339,13 @@ static void ks8842_write_mac_addr(struct
>  	spin_lock_irqsave(&adapter->lock, flags);
>  	for (i = 0; i < ETH_ALEN; i++) {
>  		ks8842_write8(adapter, 2, mac[ETH_ALEN - i - 1], REG_MARL + i);
> +#ifdef CONFIG_MICREL_KS884X
> +		ks8842_write8(adapter, 39, mac[ETH_ALEN - i - 1],
> +			REG_MACAR3 + 1 - i);
> +#else
>  		ks8842_write8(adapter, 39, mac[ETH_ALEN - i - 1],
>  			REG_MACAR1 + i);
> +#endif
>  	}
>  	spin_unlock_irqrestore(&adapter->lock, flags);
>  }
> @@ -328,8 +359,12 @@ static int ks8842_tx_frame(struct sk_buf
>  {
>  	struct ks8842_adapter *adapter = netdev_priv(netdev);
>  	int len = skb->len;
> +#ifdef CONFIG_KS884X_16BIT
> +	u16 *ptr16 = (u16 *)skb->data;
> +#else
>  	u32 *ptr = (u32 *)skb->data;
>  	u32 ctrl;
> +#endif
>  
>  	dev_dbg(&adapter->pdev->dev,
>  		"%s: len %u head %p data %p tail %p end %p\n",
> @@ -340,6 +375,18 @@ static int ks8842_tx_frame(struct sk_buf
>  	if (ks8842_tx_fifo_space(adapter) < len + 8)
>  		return NETDEV_TX_BUSY;
>  
> +#ifdef CONFIG_KS884X_16BIT
> +	ks8842_write16(adapter, 17, 0x8000 | 0x100, REG_QMU_DATA_LO);
> +	ks8842_write16(adapter, 17, (u16)len, REG_QMU_DATA_HI);
> +	netdev->stats.tx_bytes += len;
> +
> +	/* copy buffer */
> +	while (len > 0) {
> +		iowrite16(*ptr16++, adapter->hw_addr + REG_QMU_DATA_LO);
> +		iowrite16(*ptr16++, adapter->hw_addr + REG_QMU_DATA_HI);
> +		len -= sizeof(u32);
> +	}
> +#else
>  	/* the control word, enable IRQ, port 1 and the length */
>  	ctrl = 0x8000 | 0x100 | (len << 16);
>  	ks8842_write32(adapter, 17, ctrl, REG_QMU_DATA_LO);
> @@ -352,6 +399,7 @@ static int ks8842_tx_frame(struct sk_buf
>  		len -= sizeof(u32);
>  		ptr++;
>  	}
> +#endif
>  
>  	/* enqueue packet */
>  	ks8842_write16(adapter, 17, 1, REG_TXQCR);
> @@ -364,10 +412,15 @@ static int ks8842_tx_frame(struct sk_buf
>  static void ks8842_rx_frame(struct net_device *netdev,
>  	struct ks8842_adapter *adapter)
>  {
> +#ifdef CONFIG_KS884X_16BIT
> +	u16 status = ks8842_read16(adapter, 17, REG_QMU_DATA_LO);
> +	int len  = (int)ks8842_read16(adapter, 17, REG_QMU_DATA_HI) & 0xffff;
> +#else
>  	u32 status = ks8842_read32(adapter, 17, REG_QMU_DATA_LO);
>  	int len = (status >> 16) & 0x7ff;
>  
>  	status &= 0xffff;
> +#endif
>  
>  	dev_dbg(&adapter->pdev->dev, "%s - rx_data: status: %x\n",
>  		__func__, status);
> @@ -379,13 +432,28 @@ static void ks8842_rx_frame(struct net_d
>  		dev_dbg(&adapter->pdev->dev, "%s, got package, len: %d\n",
>  			__func__, len);
>  		if (skb) {
> +#ifdef CONFIG_KS884X_16BIT
> +			u16 *data16;
> +#else
>  			u32 *data;
> +#endif
>  
>  			netdev->stats.rx_packets++;
>  			netdev->stats.rx_bytes += len;
>  			if (status & RXSR_MULTICAST)
>  				netdev->stats.multicast++;
>  
> +#ifdef CONFIG_KS884X_16BIT
> +			data16 = (u16 *)skb_put(skb, len);
> +			ks8842_select_bank(adapter, 17);
> +			while (len > 0) {
> +				*data16++ = ioread16(adapter->hw_addr +
> +					REG_QMU_DATA_LO);
> +				*data16++ = ioread16(adapter->hw_addr +
> +					REG_QMU_DATA_HI);
> +				len -= sizeof(u32);
> +			}
> +#else
>  			data = (u32 *)skb_put(skb, len);
>  
>  			ks8842_select_bank(adapter, 17);
> @@ -397,6 +465,7 @@ static void ks8842_rx_frame(struct net_d
>  
>  			skb->protocol = eth_type_trans(skb, netdev);
>  			netif_rx(skb);
> +#endif
>  		} else
>  			netdev->stats.rx_dropped++;
>  	} else {
> --- linux-2.6.35-rc3/drivers/net/Kconfig.orig	2010-07-02 15:52:41.000000000 -0700
> +++ linux-2.6.35-rc3/drivers/net/Kconfig	2010-07-07 07:45:47.000000000 -0700
> @@ -1748,11 +1748,29 @@ config TLAN
>  	  Please email feedback to <torben.mathiasen@compaq.com>.
>  
>  config KS8842
> -	tristate "Micrel KSZ8842"
> +	tristate "Micrel KSZ8841/42 with generic bus interface"
>  	depends on HAS_IOMEM
>  	help
> -	  This platform driver is for Micrel KSZ8842 / KS8842
> -	  2-port ethernet switch chip (managed, VLAN, QoS).
> +	  This platform driver is for KSZ8841(1-port) / KS8842(2-port) 
> +	  ethernet switch chip (managed, VLAN, QoS) from Micrel or
> +	  Timberdale(FPGA).
> +
> +if KS8842
> +config MICREL_KS884X
> +	boolean "KSZ8841/42 device from Micrel"
> +	default n
> +	help
> +	  Say Y to use Micrel device. Otherwise Timberdale(FPGA) device is 
> +	  selected.
> +
> +config KS884X_16BIT
> +	boolean "16bit bus width"
> +	default y
> +	help
> +	  This option specifies 16bit or 32bit bus interface. Say Y to use 
> +	  16bit bus. Otherwise 32bit bus is selected.
> +
> +endif # KS8842
>  
>  config KS8851
>         tristate "Micrel KS8851 SPI"
> ---
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* oops in tcp_xmit_retransmit_queue() w/ v2.6.32.15
From: Tejun Heo @ 2010-07-08  8:22 UTC (permalink / raw)
  To: David S. Miller, lkml, netdev@vger.kernel.org
  Cc: Fehrmann, Henning, Carsten Aulbert

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

Hello,

We've been seeing oops in tcp_xmit_retransmit_queue() w/ 2.6.32.15.
Please see the attached photoshoot.  This is happening on a HPC
cluster and very interestingly caused by one particular job.  How long
it takes isn't clear yet (at least more than a day) but when it
happens it happens on a lot of machines in relatively short time.

With a bit of disassemblying, I've found that the oops is happening
during tcp_for_write_queue_from() because the skb->next points to
NULL.

 void tcp_xmit_retransmit_queue(struct sock *sk)
 {
 ...
	if (tp->retransmit_skb_hint) {
		skb = tp->retransmit_skb_hint;
		last_lost = TCP_SKB_CB(skb)->end_seq;
		if (after(last_lost, tp->retransmit_high))
			last_lost = tp->retransmit_high;
	} else {
		skb = tcp_write_queue_head(sk);
		last_lost = tp->snd_una;
	}

 =>	tcp_for_write_queue_from(skb, sk) {
		 __u8 sacked = TCP_SKB_CB(skb)->sacked;

		 if (skb == tcp_send_head(sk))
			 break;
		 /* we could do better than to assign each time */
		 if (hole == NULL)

This can happen for one of the following reasons,

1. tp->retransmit_skb_hint is NULL and tcp_write_queue_head() is NULL
   too.  ie. tcp_xmit_retransmit_queue() is called on an empty write
   queue for some reason.

2. tp->retransmit_skb_hint is pointing to a skb which is not on the
   write_queue.  ie. somebody forgot to update hint while removing the
   skb from the write queue.

3. The hint is pointing to a skb on the list but the list itself is
   corrupt.

I added some debug code and the crash is happening when
tp->retransmit_skb_hint is not NULL but tp->retransmit_skb_hint->next
is NULL.  So, #1 is out; unfortunately, I didn't have debug code in
place to discern between #2 and #3.

Does anything ring a bell?  This is a production system and debugging
affects quite a number of people.  I can put debug code in to discern
between #2 and #3 but I'm basically shooting in the dark and it would
be great if someone has a better idea.

Thanks.

-- 
tejun

[-- Attachment #2: oops.jpg --]
[-- Type: image/jpeg, Size: 92585 bytes --]

^ permalink raw reply

* [PATCH v4 0/9] atm:  propagate atm_dev signal carrier to LOWER_UP of netdevice
From: Karl Hiramoto @ 2010-07-08  8:34 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto


Changes from v3:
* read_lock_irqsave() instead of read_lock_irq()
* format comments in atmdev.h

Changes from v2:
* use atomic instead of blocking notifier
* use read_lock_irq() instead of read_lock() in atm/br2684
* clean up comments
* remove unused variable.

Changes from v1:
Use atm_dev notifier chain  instead of callback function pointer in struct vcc.
In drivers/usb/atm call atm_dev_signal_change().

In userspace it's helpful to know if a network device has a carrier signal.
Often it is monitored via netlink.  This patchset allows a way for the
struct atm_dev drivers to pass carrier on/off to the netdevice.

For DSL, carrier is on when the line has reached showtime state.

Currently this patchset only propagates the changes to br2684 vccs,
as this is the only type of hardware I have to test.

If you prefer git you can pull from:
git://github.com/karlhiramoto/linux-2.6.git atm-v4


Karl Hiramoto (9):
  atm: propagate signal changes via notifier
  atm/br2684: register notifier event for carrier signal changes.
  atm/adummy: add syfs DEVICE_ATTR to change signal
  atm/idt77105.c: call atm_dev_signal_change() when signal changes.
  atm/solos-pci: call atm_dev_signal_change() when signal changes.
  atm/suni.c: call atm_dev_signal_change() when signal changes.
  usb/atm/cxacru.c: call atm_dev_signal_change() when signal changes.
  usb/atm/speedtch.c: call atm_dev_signal_change() when signal changes.
  usb/atm/ueagle-atm.c: call atm_dev_signal_change() when signal
    changes.

 drivers/atm/adummy.c         |   39 ++++++++++++++++++++++++
 drivers/atm/idt77105.c       |   11 ++++---
 drivers/atm/solos-pci.c      |    6 ++--
 drivers/atm/suni.c           |    5 ++-
 drivers/usb/atm/cxacru.c     |   18 ++++++------
 drivers/usb/atm/speedtch.c   |   10 +++---
 drivers/usb/atm/ueagle-atm.c |   13 ++++++--
 include/linux/atmdev.h       |   20 ++++++++++++
 net/atm/br2684.c             |   66 ++++++++++++++++++++++++++++++++++++++++-
 net/atm/common.c             |   30 +++++++++++++++++++
 10 files changed, 189 insertions(+), 29 deletions(-)


^ permalink raw reply

* [PATCH v4 1/9] atm: propagate signal changes via notifier
From: Karl Hiramoto @ 2010-07-08  8:34 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278578095-25324-1-git-send-email-karl@hiramoto.org>

Add notifier chain for changes in atm_dev.

Clients like br2684 will call register_atmdevice_notifier() to be notified of
changes. Drivers will call atm_dev_signal_change() to notify clients like
br2684 of the change.

On DSL and ATM devices it's usefull to have a know if you have a carrier
signal. netdevice LOWER_UP changes can be propagated to userspace via netlink
monitor.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 include/linux/atmdev.h |   20 ++++++++++++++++++++
 net/atm/common.c       |   30 ++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 817b237..649dd24 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -431,6 +431,15 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
     int number,unsigned long *flags); /* number == -1: pick first available */
 struct atm_dev *atm_dev_lookup(int number);
 void atm_dev_deregister(struct atm_dev *dev);
+
+/*
+ * atm_dev_signal_change
+ *
+ * Propagate lower layer signal change in atm_dev->signal to netdevice.
+ * The event will be sent via a notifier call chain.
+ */
+void atm_dev_signal_change(struct atm_dev *dev, char signal);
+
 void vcc_insert_socket(struct sock *sk);
 
 
@@ -510,6 +519,17 @@ void register_atm_ioctl(struct atm_ioctl *);
  */
 void deregister_atm_ioctl(struct atm_ioctl *);
 
+
+
+/*
+ * register_atmdevice_notifier - register atm_dev notify events
+ *
+ * Clients like br2684 will register notify events
+ * Currently we notify of signal found/lost
+ */
+int register_atmdevice_notifier(struct notifier_block *nb);
+void unregister_atmdevice_notifier(struct notifier_block *nb);
+
 #endif /* __KERNEL__ */
 
 #endif
diff --git a/net/atm/common.c b/net/atm/common.c
index b43feb1..940404a 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -37,6 +37,8 @@ EXPORT_SYMBOL(vcc_hash);
 DEFINE_RWLOCK(vcc_sklist_lock);
 EXPORT_SYMBOL(vcc_sklist_lock);
 
+static ATOMIC_NOTIFIER_HEAD(atm_dev_notify_chain);
+
 static void __vcc_insert_socket(struct sock *sk)
 {
 	struct atm_vcc *vcc = atm_sk(sk);
@@ -212,6 +214,22 @@ void vcc_release_async(struct atm_vcc *vcc, int reply)
 }
 EXPORT_SYMBOL(vcc_release_async);
 
+void atm_dev_signal_change(struct atm_dev *dev, char signal)
+{
+	pr_debug("%s signal=%d dev=%p number=%d dev->signal=%d\n",
+		__func__, signal, dev, dev->number, dev->signal);
+
+	/* atm driver sending invalid signal */
+	WARN_ON(signal < ATM_PHY_SIG_LOST || signal > ATM_PHY_SIG_FOUND);
+
+	if (dev->signal == signal)
+		return; /* no change */
+
+	dev->signal = signal;
+
+	atomic_notifier_call_chain(&atm_dev_notify_chain, signal, dev);
+}
+EXPORT_SYMBOL(atm_dev_signal_change);
 
 void atm_dev_release_vccs(struct atm_dev *dev)
 {
@@ -781,6 +799,18 @@ int vcc_getsockopt(struct socket *sock, int level, int optname,
 	return vcc->dev->ops->getsockopt(vcc, level, optname, optval, len);
 }
 
+int register_atmdevice_notifier(struct notifier_block *nb)
+{
+	return atomic_notifier_chain_register(&atm_dev_notify_chain, nb);
+}
+EXPORT_SYMBOL_GPL(register_atmdevice_notifier);
+
+void unregister_atmdevice_notifier(struct notifier_block *nb)
+{
+	atomic_notifier_chain_unregister(&atm_dev_notify_chain, nb);
+}
+EXPORT_SYMBOL_GPL(unregister_atmdevice_notifier);
+
 static int __init atm_init(void)
 {
 	int error;
-- 
1.7.1


^ permalink raw reply related

* [PATCH v4 2/9] atm/br2684: register notifier event for carrier signal changes.
From: Karl Hiramoto @ 2010-07-08  8:34 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278578095-25324-1-git-send-email-karl@hiramoto.org>

When a signal change event occurs call netif_carrier_on/off.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 net/atm/br2684.c |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 6719af6..651babd 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -139,6 +139,43 @@ static struct net_device *br2684_find_dev(const struct br2684_if_spec *s)
 	return NULL;
 }
 
+static int atm_dev_event(struct notifier_block *this, unsigned long event,
+		 void *arg)
+{
+	struct atm_dev *atm_dev = arg;
+	struct list_head *lh;
+	struct net_device *net_dev;
+	struct br2684_vcc *brvcc;
+	struct atm_vcc *atm_vcc;
+	unsigned long flags;
+
+	pr_debug("event=%ld dev=%p\n", event, atm_dev);
+
+	read_lock_irqsave(&devs_lock, flags);
+	list_for_each(lh, &br2684_devs) {
+		net_dev = list_entry_brdev(lh);
+
+		list_for_each_entry(brvcc, &BRPRIV(net_dev)->brvccs, brvccs) {
+			atm_vcc = brvcc->atmvcc;
+			if (atm_vcc && brvcc->atmvcc->dev == atm_dev) {
+
+				if (atm_vcc->dev->signal == ATM_PHY_SIG_LOST)
+					netif_carrier_off(net_dev);
+				else
+					netif_carrier_on(net_dev);
+
+			}
+		}
+	}
+	read_unlock_irqrestore(&devs_lock, flags);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block atm_dev_notifier = {
+	.notifier_call = atm_dev_event,
+};
+
 /* chained vcc->pop function.  Check if we should wake the netif_queue */
 static void br2684_pop(struct atm_vcc *vcc, struct sk_buff *skb)
 {
@@ -362,6 +399,12 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
 			unregister_netdev(net_dev);
 			free_netdev(net_dev);
 		}
+		read_lock_irq(&devs_lock);
+		if (list_empty(&br2684_devs)) {
+			/* last br2684 device */
+			unregister_atmdevice_notifier(&atm_dev_notifier);
+		}
+		read_unlock_irq(&devs_lock);
 		return;
 	}
 
@@ -530,6 +573,13 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
 
 		br2684_push(atmvcc, skb);
 	}
+
+	/* initialize netdev carrier state */
+	if (atmvcc->dev->signal == ATM_PHY_SIG_LOST)
+		netif_carrier_off(net_dev);
+	else
+		netif_carrier_on(net_dev);
+
 	__module_get(THIS_MODULE);
 	return 0;
 
@@ -620,9 +670,16 @@ static int br2684_create(void __user *arg)
 	}
 
 	write_lock_irq(&devs_lock);
+
 	brdev->payload = payload;
-	brdev->number = list_empty(&br2684_devs) ? 1 :
-	    BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1;
+
+	if (list_empty(&br2684_devs)) {
+		/* 1st br2684 device */
+		register_atmdevice_notifier(&atm_dev_notifier);
+		brdev->number = 1;
+	} else
+		brdev->number = BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1;
+
 	list_add_tail(&brdev->br2684_devs, &br2684_devs);
 	write_unlock_irq(&devs_lock);
 	return 0;
@@ -772,6 +829,11 @@ static void __exit br2684_exit(void)
 	remove_proc_entry("br2684", atm_proc_root);
 #endif
 
+
+	/* if not already empty */
+	if (!list_empty(&br2684_devs))
+		unregister_atmdevice_notifier(&atm_dev_notifier);
+
 	while (!list_empty(&br2684_devs)) {
 		net_dev = list_entry_brdev(br2684_devs.next);
 		brdev = BRPRIV(net_dev);
-- 
1.7.1


^ permalink raw reply related

* [PATCH v4 3/9] atm/adummy: add syfs DEVICE_ATTR to change signal
From: Karl Hiramoto @ 2010-07-08  8:34 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278578095-25324-1-git-send-email-karl@hiramoto.org>

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/atm/adummy.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 6d44f07..46b9476 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -40,6 +40,42 @@ struct adummy_dev {
 
 static LIST_HEAD(adummy_devs);
 
+static ssize_t __set_signal(struct device *dev,
+		struct device_attribute *attr,
+		const char *buf, size_t len)
+{
+	struct atm_dev *atm_dev = container_of(dev, struct atm_dev, class_dev);
+	int signal;
+
+	if (sscanf(buf, "%d", &signal) == 1) {
+
+		if (signal < ATM_PHY_SIG_LOST || signal > ATM_PHY_SIG_FOUND)
+			signal = ATM_PHY_SIG_UNKNOWN;
+
+		atm_dev_signal_change(atm_dev, signal);
+		return 1;
+	}
+	return -EINVAL;
+}
+
+static ssize_t __show_signal(struct device *dev,
+	struct device_attribute *attr, char *buf)
+{
+	struct atm_dev *atm_dev = container_of(dev, struct atm_dev, class_dev);
+	return sprintf(buf, "%d\n", atm_dev->signal);
+}
+static DEVICE_ATTR(signal, 0644, __show_signal, __set_signal);
+
+static struct attribute *adummy_attrs[] = {
+	&dev_attr_signal.attr,
+	NULL
+};
+
+static struct attribute_group adummy_group_attrs = {
+	.name = NULL, /* We want them in dev's root folder */
+	.attrs = adummy_attrs
+};
+
 static int __init
 adummy_start(struct atm_dev *dev)
 {
@@ -128,6 +164,9 @@ static int __init adummy_init(void)
 	adummy_dev->atm_dev = atm_dev;
 	atm_dev->dev_data = adummy_dev;
 
+	if (sysfs_create_group(&atm_dev->class_dev.kobj, &adummy_group_attrs))
+		dev_err(&atm_dev->class_dev, "Could not register attrs for adummy\n");
+
 	if (adummy_start(atm_dev)) {
 		printk(KERN_ERR DEV_LABEL ": adummy_start() failed\n");
 		err = -ENODEV;
-- 
1.7.1


^ permalink raw reply related

* [PATCH v4 4/9] atm/idt77105.c: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-08  8:34 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278578095-25324-1-git-send-email-karl@hiramoto.org>

Propagate changes to upper atm layer.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/atm/idt77105.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index dab5cf5..bca9cb8 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -126,7 +126,7 @@ static void idt77105_restart_timer_func(unsigned long dummy)
                 istat = GET(ISTAT); /* side effect: clears all interrupt status bits */
                 if (istat & IDT77105_ISTAT_GOODSIG) {
                     /* Found signal again */
-                    dev->signal = ATM_PHY_SIG_FOUND;
+                    atm_dev_signal_change(dev, ATM_PHY_SIG_FOUND);
 	            printk(KERN_NOTICE "%s(itf %d): signal detected again\n",
                         dev->type,dev->number);
                     /* flush the receive FIFO */
@@ -222,7 +222,7 @@ static void idt77105_int(struct atm_dev *dev)
             /* Rx Signal Condition Change - line went up or down */
             if (istat & IDT77105_ISTAT_GOODSIG) {   /* signal detected again */
                 /* This should not happen (restart timer does it) but JIC */
-                dev->signal = ATM_PHY_SIG_FOUND;
+		atm_dev_signal_change(dev, ATM_PHY_SIG_FOUND);
             } else {    /* signal lost */
                 /*
                  * Disable interrupts and stop all transmission and
@@ -235,7 +235,7 @@ static void idt77105_int(struct atm_dev *dev)
                     IDT77105_MCR_DRIC|
                     IDT77105_MCR_HALTTX
                     ) & ~IDT77105_MCR_EIP, MCR);
-                dev->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(dev, ATM_PHY_SIG_LOST);
 	        printk(KERN_NOTICE "%s(itf %d): signal lost\n",
                     dev->type,dev->number);
             }
@@ -272,8 +272,9 @@ static int idt77105_start(struct atm_dev *dev)
 	memset(&PRIV(dev)->stats,0,sizeof(struct idt77105_stats));
         
         /* initialise dev->signal from Good Signal Bit */
-        dev->signal = GET(ISTAT) & IDT77105_ISTAT_GOODSIG ? ATM_PHY_SIG_FOUND :
-	  ATM_PHY_SIG_LOST;
+	atm_dev_signal_change(dev,
+		GET(ISTAT) & IDT77105_ISTAT_GOODSIG ?
+		ATM_PHY_SIG_FOUND : ATM_PHY_SIG_LOST);
 	if (dev->signal == ATM_PHY_SIG_LOST)
 		printk(KERN_WARNING "%s(itf %d): no signal\n",dev->type,
 		    dev->number);
-- 
1.7.1


^ permalink raw reply related

* [PATCH v4 5/9] atm/solos-pci: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-08  8:34 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278578095-25324-1-git-send-email-karl@hiramoto.org>

Propagate changes to upper atm layer, so userspace netmontor knows when DSL
showtime reached.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/atm/solos-pci.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index ded76c4..6174965 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -383,7 +383,7 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
 
 	/* Anything but 'Showtime' is down */
 	if (strcmp(state_str, "Showtime")) {
-		card->atmdev[port]->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST);
 		release_vccs(card->atmdev[port]);
 		dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str);
 		return 0;
@@ -401,7 +401,7 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
 		 snr[0]?", SNR ":"", snr, attn[0]?", Attn ":"", attn);
 	
 	card->atmdev[port]->link_rate = rate_down / 424;
-	card->atmdev[port]->signal = ATM_PHY_SIG_FOUND;
+	atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_FOUND);
 
 	return 0;
 }
@@ -1246,7 +1246,7 @@ static int atm_init(struct solos_card *card)
 		card->atmdev[i]->ci_range.vci_bits = 16;
 		card->atmdev[i]->dev_data = card;
 		card->atmdev[i]->phy_data = (void *)(unsigned long)i;
-		card->atmdev[i]->signal = ATM_PHY_SIG_UNKNOWN;
+		atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_UNKNOWN);
 
 		skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
 		if (!skb) {
-- 
1.7.1


^ permalink raw reply related

* [PATCH v4 6/9] atm/suni.c: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-08  8:34 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278578095-25324-1-git-send-email-karl@hiramoto.org>

Propagate changes to upper atm layer.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/atm/suni.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c
index da4b91f..41c56ea 100644
--- a/drivers/atm/suni.c
+++ b/drivers/atm/suni.c
@@ -291,8 +291,9 @@ static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 
 static void poll_los(struct atm_dev *dev)
 {
-	dev->signal = GET(RSOP_SIS) & SUNI_RSOP_SIS_LOSV ? ATM_PHY_SIG_LOST :
-	  ATM_PHY_SIG_FOUND;
+	atm_dev_signal_change(dev,
+		GET(RSOP_SIS) & SUNI_RSOP_SIS_LOSV ?
+		ATM_PHY_SIG_LOST : ATM_PHY_SIG_FOUND);
 }
 
 
-- 
1.7.1


^ permalink raw reply related


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