Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] net: fix neigh_resolve_output can cause skb_under_panic
From: gregkh @ 2012-09-29  0:57 UTC (permalink / raw)
  To: Ramesh Nagappa
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, michel@digirati.com.br,
	eric.dumazet@gmail.com
In-Reply-To: <CA3E5132752D1F49871ED0FC40D56BBA43ECE2E743@EUSAACMS0701.eamcs.ericsson.se>

On Fri, Sep 28, 2012 at 08:26:51PM -0400, Ramesh Nagappa wrote:
> > 
> > Why is all of this in the middle of the changelog section?
> > 
> > I'm guessing you didn't use 'git send-email' for this?
> > 
> > And why are you copying me on the patch?
> 
> I got the CC list from scripts/get_maintainers.pl
> 
> asglx-2-300 $ scripts/get_maintainer.pl 0001-net-fix-neigh_resolve_output-can-cause-skb_under_pan.patch
> "David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING [GENERAL],commit_signer:3/4=75%)
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/4=75%)
> Eric Dumazet <eric.dumazet@gmail.com> (commit_signer:2/4=50%)
> Shawn Lu <shawn.lu@ericsson.com> (commit_signer:1/4=25%)
> Michel Machado <michel@digirati.com.br> (commit_signer:1/4=25%)
> netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
> linux-kernel@vger.kernel.org (open list)

I can't reproduce this:
	$ ./scripts/get_maintainer.pl --file net/core/neighbour.c
	"David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING [GENERAL],commit_signer:22/22=100%)
	Eric Dumazet <edumazet@google.com> (commit_signer:4/22=18%)
	"Eric W. Biederman" <ebiederm@xmission.com> (commit_signer:2/22=9%)
	Pavel Emelyanov <xemul@parallels.com> (commit_signer:2/22=9%)
	netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
	linux-kernel@vger.kernel.org (open list)

What tree are you doing that against?

> > You need a blank line before the first Signed-off-by: line.  
> > Surely one of the reviewers should have caught this basic thing?
> 
> Outlook mangled the patch. I am unable to use git send-email because of
> a corporate firewall on the build machine.

Then your patch would also be corrupted, Outlook, and Exchange, can not
handle patches at all.  Please read Documentation/email_clients.txt for
more details.

Also, ask your coworkers who properly submit patches what they do to
work around your broken email infrastructure.

good luck,

greg k-h

^ permalink raw reply

* RE: [PATCH] net: fix neigh_resolve_output can cause skb_under_panic
From: Ramesh Nagappa @ 2012-09-29  0:26 UTC (permalink / raw)
  To: gregkh@linuxfoundation.org
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, michel@digirati.com.br,
	eric.dumazet@gmail.com
In-Reply-To: <20120928235209.GA11474@kroah.com>

> 
> Why is all of this in the middle of the changelog section?
> 
> I'm guessing you didn't use 'git send-email' for this?
> 
> And why are you copying me on the patch?

I got the CC list from scripts/get_maintainers.pl

asglx-2-300 $ scripts/get_maintainer.pl 0001-net-fix-neigh_resolve_output-can-cause-skb_under_pan.patch
"David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING [GENERAL],commit_signer:3/4=75%)
Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/4=75%)
Eric Dumazet <eric.dumazet@gmail.com> (commit_signer:2/4=50%)
Shawn Lu <shawn.lu@ericsson.com> (commit_signer:1/4=25%)
Michel Machado <michel@digirati.com.br> (commit_signer:1/4=25%)
netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
linux-kernel@vger.kernel.org (open list)

> 
> 
> You need a blank line before the first Signed-off-by: line.  
> Surely one of the reviewers should have caught this basic thing?

Outlook mangled the patch. I am unable to use git send-email because of
a corporate firewall on the build machine.

> 
> greg k-h
> 

Thanks,
Ramesh

^ permalink raw reply

* RE: [PATCH] net: fix neigh_resolve_output can cause skb_under_panic
From: Ramesh Nagappa @ 2012-09-29  0:17 UTC (permalink / raw)
  To: gregkh@linuxfoundation.org
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, michel@digirati.com.br,
	eric.dumazet@gmail.com
In-Reply-To: <20120928235209.GA11474@kroah.com>

Sorry, Outlook managled the patch. I will try to find a way to re-submit it.

> 
> You need a blank line before the first Signed-off-by: line.  
> Surely one of the reviewers should have caught this basic thing?
> 
> greg k-h
> 

-- Ramesh

^ permalink raw reply

* Re: [PATCH] net: fix neigh_resolve_output can cause skb_under_panic
From: gregkh @ 2012-09-28 23:52 UTC (permalink / raw)
  To: Ramesh Nagappa
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, michel@digirati.com.br,
	eric.dumazet@gmail.com
In-Reply-To: <CA3E5132752D1F49871ED0FC40D56BBA43ECE2E72D@EUSAACMS0701.eamcs.ericsson.se>

On Fri, Sep 28, 2012 at 07:40:39PM -0400, Ramesh Nagappa wrote:
> >From fd023edd911ef12aca38a72b40241661c202684f Mon Sep 17 00:00:00 2001
> From: Ramesh Nagappa <ramesh.nagappa@ericsson.com>
> Date: Thu, 27 Sep 2012 10:20:58 -0700
> Subject: [PATCH] net: fix neigh_resolve_output can cause skb_under_panic

Why is all of this in the middle of the changelog section?

I'm guessing you didn't use 'git send-email' for this?

And why are you copying me on the patch?

> The retry loop in the neigh_resolve_output() and neigh_connected_output() can add
> a hard_header without resetting the skb to network header. This causes the
> skb_push() in dev_hard_header() to fail.
> Signed-off-by: Ramesh Nagappa <ramesh.nagappa@ericsson.com>
> Signed-off-by: Shawn Lu <shawn.lu@ericsson.com>
> Reviewed-by: Billie Alsup <billie.alsup@ericsson.com>
> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>

You need a blank line before the first Signed-off-by: line.  Surely one
of the reviewers should have caught this basic thing?

greg k-h

^ permalink raw reply

* [PATCH] net: fix neigh_resolve_output can cause skb_under_panic
From: Ramesh Nagappa @ 2012-09-28 23:40 UTC (permalink / raw)
  To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
  Cc: davem@davemloft.net, gregkh@linuxfoundation.org,
	michel@digirati.com.br, eric.dumazet@gmail.com

>From fd023edd911ef12aca38a72b40241661c202684f Mon Sep 17 00:00:00 2001
From: Ramesh Nagappa <ramesh.nagappa@ericsson.com>
Date: Thu, 27 Sep 2012 10:20:58 -0700
Subject: [PATCH] net: fix neigh_resolve_output can cause skb_under_panic

The retry loop in the neigh_resolve_output() and neigh_connected_output() can add
a hard_header without resetting the skb to network header. This causes the
skb_push() in dev_hard_header() to fail.
Signed-off-by: Ramesh Nagappa <ramesh.nagappa@ericsson.com>
Signed-off-by: Shawn Lu <shawn.lu@ericsson.com>
Reviewed-by: Billie Alsup <billie.alsup@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
---
 net/core/neighbour.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 96bb0a3..5a3dfec5 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1327,6 +1327,7 @@ int neigh_resolve_output(struct sk_buff *skb)
 
 		do {
 			seq = read_seqbegin(&neigh->ha_lock);
+			__skb_pull(skb, skb_network_offset(skb));
 			err = dev_hard_header(skb, dev, ntohs(skb->protocol),
 					      neigh->ha, NULL, skb->len);
 		} while (read_seqretry(&neigh->ha_lock, seq));
@@ -1358,10 +1359,10 @@ int neigh_connected_output(struct sk_buff *skb)
 	struct net_device *dev = neigh->dev;
 	unsigned int seq;
 
-	__skb_pull(skb, skb_network_offset(skb));
 
 	do {
 		seq = read_seqbegin(&neigh->ha_lock);
+		__skb_pull(skb, skb_network_offset(skb));
 		err = dev_hard_header(skb, dev, ntohs(skb->protocol),
 				      neigh->ha, NULL, skb->len);
 	} while (read_seqretry(&neigh->ha_lock, seq));
-- 
1.7.3.1

^ permalink raw reply related

* Re: [PATCH net] ipv6: return errno pointers consistently for fib6_add_1()
From: David Miller @ 2012-09-28 22:49 UTC (permalink / raw)
  To: mlin; +Cc: netdev
In-Reply-To: <1348622227.4935.1.camel@minggr>

From: Lin Ming <mlin@ss.pku.edu.cn>
Date: Wed, 26 Sep 2012 09:17:07 +0800

> fib6_add_1() should consistently return errno pointers,
> rather than a mixture of NULL and errno pointers.
> 
> Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>

Applied, thanks.

^ permalink raw reply

* Re: pull-request: can-next 2012-09-27
From: David Miller @ 2012-09-28 22:47 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can
In-Reply-To: <5064661E.1000000@pengutronix.de>

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Thu, 27 Sep 2012 16:43:42 +0200

> Hello David,
> 
> this pull request is for net-next, for the v3.7 release cycle.
> AnilKumar Ch contributed a fix for a segfault in the c_can driver,
> which is triggered by an earlier commit [1] in net-next (so no backport
> is needed).
> 
> Marc
> 
> [1] 4cdd34b can: c_can: Add runtime PM support to Bosch C_CAN/D_CAN controller

Pulled, thanks.

^ permalink raw reply

* Re: [PATCH 0/4] smsc75xx: enhancements (V2)
From: David Miller @ 2012-09-28 22:39 UTC (permalink / raw)
  To: steve.glendinning; +Cc: netdev
In-Reply-To: <1348829873-30779-1-git-send-email-steve.glendinning@shawell.net>

From: Steve Glendinning <steve.glendinning@shawell.net>
Date: Fri, 28 Sep 2012 11:57:49 +0100

> This patchset makes a few enhancements to the smsc75xx driver
> including improved power saving during suspend and support for
> magic packet wol.
> 
> This patchset has been rebased against net-next/master but I
> believe the first patch has already been included in net/master.
> 
> Steve Glendinning (4):
>   smsc75xx: fix resume after device reset
>   smsc75xx: add explicit test that device is READY
>   smsc75xx: enable power saving mode during system suspend
>   smsc75xx: add wol magic packet support

I already applied the first patch, a bug fix, to 'net' and pushed
it off to Linus.  Maybe you didn't see that.

The rest I put into net-next, thanks.

^ permalink raw reply

* Re: [PATCH 0/6] smsc95xx enhancements (V3)
From: David Miller @ 2012-09-28 22:39 UTC (permalink / raw)
  To: steve.glendinning; +Cc: netdev
In-Reply-To: <1348826832-1986-1-git-send-email-steve.glendinning@shawell.net>

From: Steve Glendinning <steve.glendinning@shawell.net>
Date: Fri, 28 Sep 2012 11:07:06 +0100

> This patchset makes a few minor enhancements to the smsc95xx driver
> including improved power saving during suspend and support for
> magic packet wol.
> 
> Please consider all for net-next.

All applied.

^ permalink raw reply

* tg3 driver upgrade (Linux 2.6.32 -> 3.2) breaks IBM Bladecenter SoL
From: Ferenc Wagner @ 2012-09-28 20:45 UTC (permalink / raw)
  To: netdev
  Cc: Matt Carlson, Michael Chan, Grant Likely, Rob Herring,
	linux-kernel, wferi

Hi,

Upgrading the kernel on our HS20 blades resulted in their SoL (serial
over LAN) connection being broken.  The disconnection happens when eth0
(the interface involved in SoL) is brought up during the boot sequence.
If I later "ip link set eth0 down", then the connection is restored, but
"ip link set eth0 up" breaks it again on 3.2.  ethtool -a, -c, -g, -k
and -u show no difference; ethtool -i on the 2.6.32 kernel reports:

driver: tg3
version: 3.116
firmware-version: 5704s-v3.38, ASFIPMIs v2.47
bus-info: 0000:05:01.0

In the 3.2 kernel the driver version is 3.121.  In the output of lspci
-vv only the Interrupt line shows variability.  I'd be grateful for any
workaround suggestion; I understand that is't not easy given the lack of
information about the SoL implementation, but maybe somebody can guess
what changed in the driver which could affect it this way.
-- 
Regards,
Feri.

^ permalink raw reply

* Re: network-namespace and unix-domain-sockets
From: Dilip Daya @ 2012-09-28 19:51 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Linux Netdev List
In-Reply-To: <87ehlmkku5.fsf@xmission.com>

Hi Eric,

I very much appreciate your quick response!.  I found it:
<http://lists.linux-foundation.org/pipermail/containers/2010-June/024725.html>

Thanking you for your time and effort.
-DilipD.

On Fri, 2012-09-28 at 12:29 -0700, Eric W. Biederman wrote:
> Dilip Daya <dilip.daya@hp.com> writes:
> 
> > Hi Eric,
> >
> > => kernel 3.6.0-rc6 + network-namespace + unix-domain-sockets
> >
> > srv/cli sample programs at:
> > <http://tkhanson.net/cgit.cgi/misc.git/plain/unixdomain/Unix_domain_sockets.html>
> > Executing UNIX domain sockets between two network-namespaces fails but
> > successful if both srv and cli are executed within a network-namespace.
> >
> > Test results:
> >
> > (1) Executing both srv and cli within default/host network-namespace:
> >
> > On host/default netns:
> > # ./cli 
> > testing...
> > ^C
> >
> > On host/default netns:
> > # ./srv 
> > read 11 bytes: testing...
> >
> > EOF
> >
> >
> > (2) Executing srv in default/host netns and cli within netns named
> > netns0:
> >
> > On host/default netns:
> > # ip netns
> > netns1
> > netns0
> >
> > On host/default netns:
> > # ./srv 
> >
> > Within netns name netns0:
> > # ip netns exec netns0 ./cli
> > connect error: Connection refused
> 
> Yes that is correct behavior.
> 
> > => I find difference between __unix_find_socket_byname()  and
> >                               *unix_find_socket_byinode()
> >
> > 	---
> > 		if (!net_eq(sock_net(s), net))
> > 			continue;
> > 	---
> >
> > => Is there an explanation for why __unix_find_socket_byname() was left
> >    netns aware and *unix_find_socket_byinode() is not netns aware ?
> 
> The abstract namespace will cause two sockets with the same name
> in different network namespaces to conflict.
> 
> The network namespace a socket is in is irrelevant for purposes of
> conflicts on the filesystem.
> 
> There is also a detailed commit message that was written at the time
> the per network namespace restrictions were relaxed on
> unix_find_socket_byinode if you would like to read it.
> 
> > => Please see attached patch. Is this valid? or will it break something?
> >    I've tested network namespaces with this patch applied and I did not 
> >    find any issues.
> 
> Totally invalid.
> 
> Eric

^ permalink raw reply

* Re: network-namespace and unix-domain-sockets
From: Eric W. Biederman @ 2012-09-28 19:29 UTC (permalink / raw)
  To: dilip.daya; +Cc: Linux Netdev List
In-Reply-To: <1348841564.32187.7.camel@pro6455b.example.com>

Dilip Daya <dilip.daya@hp.com> writes:

> Hi Eric,
>
> => kernel 3.6.0-rc6 + network-namespace + unix-domain-sockets
>
> srv/cli sample programs at:
> <http://tkhanson.net/cgit.cgi/misc.git/plain/unixdomain/Unix_domain_sockets.html>
> Executing UNIX domain sockets between two network-namespaces fails but
> successful if both srv and cli are executed within a network-namespace.
>
> Test results:
>
> (1) Executing both srv and cli within default/host network-namespace:
>
> On host/default netns:
> # ./cli 
> testing...
> ^C
>
> On host/default netns:
> # ./srv 
> read 11 bytes: testing...
>
> EOF
>
>
> (2) Executing srv in default/host netns and cli within netns named
> netns0:
>
> On host/default netns:
> # ip netns
> netns1
> netns0
>
> On host/default netns:
> # ./srv 
>
> Within netns name netns0:
> # ip netns exec netns0 ./cli
> connect error: Connection refused

Yes that is correct behavior.

> => I find difference between __unix_find_socket_byname()  and
>                               *unix_find_socket_byinode()
>
> 	---
> 		if (!net_eq(sock_net(s), net))
> 			continue;
> 	---
>
> => Is there an explanation for why __unix_find_socket_byname() was left
>    netns aware and *unix_find_socket_byinode() is not netns aware ?

The abstract namespace will cause two sockets with the same name
in different network namespaces to conflict.

The network namespace a socket is in is irrelevant for purposes of
conflicts on the filesystem.

There is also a detailed commit message that was written at the time
the per network namespace restrictions were relaxed on
unix_find_socket_byinode if you would like to read it.

> => Please see attached patch. Is this valid? or will it break something?
>    I've tested network namespaces with this patch applied and I did not 
>    find any issues.

Totally invalid.

Eric

^ permalink raw reply

* [PATCH] scsi: move scsi_netlink code out of SCSI core
From: Jan Engelhardt @ 2012-09-28 18:47 UTC (permalink / raw)
  To: netdev; +Cc: linux-scsi, James.Smart, James.Bottomley, ebiederm, davem

Only scsi_transport_fc needs scsi_netlink, so recombine the logic such
that scsi_netlink is bundled with scsi_transport_fc instead of scsi_mod.

Cc: James Smart <James.Smart@emulex.com>
Cc: James Bottomley <James.Bottomley@parallels.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---

(What's with the 2001-09-17 date git is emitting in the From line?!
 "From be20b2... Mon Sep 17 00:00:00 2001" while git send-email --annotate)


Roughly two years ago, I had a patch which turned scsi_netlink.c into
its own .ko module (this was not applied). The recent submission of
8289bab1daf9768c20114051a99c1bd5f48d4420 has made me look into
scsi_netlinkage again. scsi_netlink.c is too small to warrant a
separate module, so instead I thought it could be moved into fc.c.
And that's what I am loosely proposing here...



 drivers/scsi/Kconfig             |    6 ------
 drivers/scsi/Makefile            |    4 ++--
 drivers/scsi/scsi.c              |    3 ---
 drivers/scsi/scsi_netlink.c      |   12 +++++-------
 drivers/scsi/scsi_priv.h         |    7 ++-----
 drivers/scsi/scsi_transport_fc.c |    8 +++++++-
 6 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 74bf1aa..52993ae 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -47,11 +47,6 @@ config SCSI_TGT
 	  If you want to use SCSI target mode drivers enable this option.
 	  If you choose M, the module will be called scsi_tgt.
 
-config SCSI_NETLINK
-	bool
-	default	n
-	select NET
-
 config SCSI_PROC_FS
 	bool "legacy /proc/scsi/ support"
 	depends on SCSI && PROC_FS
@@ -276,7 +271,6 @@ config SCSI_SPI_ATTRS
 config SCSI_FC_ATTRS
 	tristate "FiberChannel Transport Attributes"
 	depends on SCSI
-	select SCSI_NETLINK
 	help
 	  If you wish to export transport-specific information about
 	  each attached FiberChannel device to sysfs, say Y.
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 888f73a..32bcb3d 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -29,7 +29,8 @@ obj-$(CONFIG_RAID_ATTRS)	+= raid_class.o
 # be initialised before drivers
 # --------------------------
 obj-$(CONFIG_SCSI_SPI_ATTRS)	+= scsi_transport_spi.o
-obj-$(CONFIG_SCSI_FC_ATTRS) 	+= scsi_transport_fc.o
+obj-$(CONFIG_SCSI_FC_ATTRS) 	+= scsi_transport_fcattr.o
+scsi_transport_fcattr-y		:= scsi_transport_fc.o scsi_netlink.o
 obj-$(CONFIG_SCSI_ISCSI_ATTRS)	+= scsi_transport_iscsi.o
 obj-$(CONFIG_SCSI_SAS_ATTRS)	+= scsi_transport_sas.o
 obj-$(CONFIG_SCSI_SAS_LIBSAS)	+= libsas/
@@ -163,7 +164,6 @@ scsi_mod-y			+= scsi.o hosts.o scsi_ioctl.o constants.o \
 				   scsicam.o scsi_error.o scsi_lib.o
 scsi_mod-$(CONFIG_SCSI_DMA)	+= scsi_lib_dma.o
 scsi_mod-y			+= scsi_scan.o scsi_sysfs.o scsi_devinfo.o
-scsi_mod-$(CONFIG_SCSI_NETLINK)	+= scsi_netlink.o
 scsi_mod-$(CONFIG_SYSCTL)	+= scsi_sysctl.o
 scsi_mod-$(CONFIG_SCSI_PROC_FS)	+= scsi_proc.o
 scsi_mod-y			+= scsi_trace.o
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 2936b44..f5dedc7 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1326,8 +1326,6 @@ static int __init init_scsi(void)
 	if (error)
 		goto cleanup_sysctl;
 
-	scsi_netlink_init();
-
 	printk(KERN_NOTICE "SCSI subsystem initialized\n");
 	return 0;
 
@@ -1348,7 +1346,6 @@ cleanup_queue:
 
 static void __exit exit_scsi(void)
 {
-	scsi_netlink_exit();
 	scsi_sysfs_unregister();
 	scsi_exit_sysctl();
 	scsi_exit_hosts();
diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c
index 65123a2..20ca4b8 100644
--- a/drivers/scsi/scsi_netlink.c
+++ b/drivers/scsi/scsi_netlink.c
@@ -18,6 +18,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+#include <linux/module.h>
 #include <linux/time.h>
 #include <linux/jiffies.h>
 #include <linux/security.h>
@@ -122,8 +123,7 @@ next_msg:
  * 	the SCSI transport netlink interface
  *
  **/
-void
-scsi_netlink_init(void)
+int __init scsi_netlink_init(void)
 {
 	struct netlink_kernel_cfg cfg = {
 		.input	= scsi_nl_rcv_msg,
@@ -135,10 +135,10 @@ scsi_netlink_init(void)
 	if (!scsi_nl_sock) {
 		printk(KERN_ERR "%s: register of receive handler failed\n",
 				__func__);
-		return;
+		return -ENOMEM;
 	}
 
-	return;
+	return 0;
 }
 
 
@@ -146,8 +146,7 @@ scsi_netlink_init(void)
  * scsi_netlink_exit - Called by SCSI subsystem to disable the SCSI transport netlink interface
  *
  **/
-void
-scsi_netlink_exit(void)
+void scsi_netlink_exit(void)
 {
 	if (scsi_nl_sock) {
 		netlink_kernel_release(scsi_nl_sock);
@@ -155,4 +154,3 @@ scsi_netlink_exit(void)
 
 	return;
 }
-
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 8f9a0ca..f875844 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -139,13 +139,10 @@ extern struct bus_type scsi_bus_type;
 extern const struct attribute_group *scsi_sysfs_shost_attr_groups[];
 
 /* scsi_netlink.c */
-#ifdef CONFIG_SCSI_NETLINK
-extern void scsi_netlink_init(void);
+#if IS_ENABLED(CONFIG_SCSI_FC_ATTRS)
+extern int scsi_netlink_init(void);
 extern void scsi_netlink_exit(void);
 extern struct sock *scsi_nl_sock;
-#else
-static inline void scsi_netlink_init(void) {}
-static inline void scsi_netlink_exit(void) {}
 #endif
 
 /* scsi_pm.c */
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index e894ca7..3716ce2 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -661,9 +661,12 @@ static __init int fc_transport_init(void)
 
 	atomic_set(&fc_event_seq, 0);
 
+	error = scsi_netlink_init();
+	if (error < 0)
+		return error;
 	error = transport_class_register(&fc_host_class);
 	if (error)
-		return error;
+		goto unreg_netlink;
 	error = transport_class_register(&fc_vport_class);
 	if (error)
 		goto unreg_host_class;
@@ -681,6 +684,8 @@ unreg_vport_class:
 	transport_class_unregister(&fc_vport_class);
 unreg_host_class:
 	transport_class_unregister(&fc_host_class);
+unreg_netlink:
+	scsi_netlink_exit();
 	return error;
 }
 
@@ -690,6 +695,7 @@ static void __exit fc_transport_exit(void)
 	transport_class_unregister(&fc_rport_class);
 	transport_class_unregister(&fc_host_class);
 	transport_class_unregister(&fc_vport_class);
+	scsi_netlink_exit();
 }
 
 /*
-- 
1.7.10.4


^ permalink raw reply related

* Re: pull request: batman-adv 2012-09-25
From: David Miller @ 2012-09-28 18:42 UTC (permalink / raw)
  To: ordex-GaUfNO9RBHfsrOwW+9ziJQ
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <20120925160119.GA31069-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>

From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Date: Tue, 25 Sep 2012 18:01:19 +0200

> here are some instructions to solve the conflict you will hit while merging net
> with net-next.

Thanks a lot.

^ permalink raw reply

* Re: [PATCH] vlan: Make it possible to add vlan with id 4095
From: Eric Dumazet @ 2012-09-28 17:55 UTC (permalink / raw)
  To: David Miller; +Cc: paulius.zaleckas, kaber, netdev
In-Reply-To: <20120928.134417.1763308761361480629.davem@davemloft.net>

On Fri, 2012-09-28 at 13:44 -0400, David Miller wrote:

> 
> Awesome, we don't need VXVLAN any more after this fix.

Hey, I guess you meant to send this to G+, not netdev ;)

^ permalink raw reply

* [PATCH net-next] mlx4: dont orphan skbs in mlx4_en_xmit()
From: Eric Dumazet @ 2012-09-28 17:53 UTC (permalink / raw)
  To: Yevgeny Petrilin; +Cc: David Miller, netdev, Or Gerlitz
In-Reply-To: <1348056777.26523.750.camel@edumazet-glaptop>

From: Eric Dumazet <edumazet@google.com>

After commit e22979d96a55d (mlx4_en: Moving to Interrupts for TX
completions) we no longer need to orphan skbs in mlx4_en_xmit()
since skb wont stay a long time in TX ring before their release.

Orphaning skbs in ndo_start_xmit() should be avoided as much as
possible, since it breaks TCP Small Queue or other flow control
mechanisms (per socket limits)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yevgeny Petrilin <yevgenyp@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 10bba09..c10e3a6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -712,10 +712,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (bounce)
 		tx_desc = mlx4_en_bounce_to_desc(priv, ring, index, desc_size);
 
-	/* Run destructor before passing skb to HW */
-	if (likely(!skb_shared(skb)))
-		skb_orphan(skb);
-
 	if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tag) {
 		*(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn);
 		op_own |= htonl((bf_index & 0xffff) << 8);

^ permalink raw reply related

* Re: [PATCH RFC net-next 4/4] time: remove the timecompare code.
From: John Stultz @ 2012-09-28 17:44 UTC (permalink / raw)
  To: Richard Cochran
  Cc: netdev, device-drivers-devel, uclinux-dist-devel, David Miller,
	Jacob Keller, Jeff Kirsher, John Ronciak, Mike Frysinger,
	Miroslav Lichvar, Patrick Ohly, Sonic Zhang
In-Reply-To: <e100d86136270dae62ff546e3a6c5ef10631c68c.1348851539.git.richardcochran@gmail.com>

On 09/28/2012 10:20 AM, Richard Cochran wrote:
> This patch removes the timecompare code from the kernel. The top five
> reasons to do this are:
>
> 1. There are no more users of this code.
> 2. The original idea was a bit weak.
> 3. The original author has disappeared.
> 4. The code was not general purpose but tuned to a particular hardware,
> 5. There are better ways to accomplish clock synchronization.
>
> Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Nice cleanup!

Acked-by: John Stultz <john.stultz@linaro.org>

thanks!
-john

^ permalink raw reply

* Re: [PATCH] vlan: Make it possible to add vlan with id 4095
From: David Miller @ 2012-09-28 17:44 UTC (permalink / raw)
  To: paulius.zaleckas; +Cc: kaber, netdev
In-Reply-To: <20120928123258.9454.95197.stgit@localhost.localdomain>

From: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Date: Fri, 28 Sep 2012 15:32:58 +0300

> vconfig help tells that vlan_id should be 0-4095, but fails
> with 4095.
> 
> There is an off-by-one bug while evaluating vlan_id.
> Fix it by evaluating against count(4096), not mask(0x0fff = 4095).
> 
> Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>

Awesome, we don't need VXVLAN any more after this fix.

^ permalink raw reply

* Re: You have to fix this
From: David Miller @ 2012-09-28 17:43 UTC (permalink / raw)
  To: vipul; +Cc: netdev
In-Reply-To: <5065911A.3000509@chelsio.com>

From: Vipul Pandya <vipul@chelsio.com>
Date: Fri, 28 Sep 2012 17:29:22 +0530

> Please let me know how else would I get above warning message?

Maybe your compiler is too old.  Does -Wframe-larger-than= show up in your
build logs with "make V=1"?

^ permalink raw reply

* pull request: wireless-next 2012-09-28
From: John W. Linville @ 2012-09-28 17:34 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

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

commit c487606f835a93a725bac1aefd536be98f22474d

Dave,

Here is another batch of updates intended for 3.7...

Highlights include an hci_connect re-write in Bluetooth, HCI/LLC
layer separation in NFC, removal of the raw pn544 NFC driver, NFC LLCP
raw sockets support, improved IBSS auth frame handling in mac80211,
full-MAC AP mode notification support in mac80211, a lot of attention
paid to brcmfmac, and the usual level of updates to iwlwifi, ath9k,
mwifiex, and rt2x00, and various other updates.

Please let me know if there are problems!

Thanks,

John

P.S.  I anticipate having at least one more pull request early in
the upcoming(?) merge window, due to some stragglers posted within
the last week...

---

The following changes since commit d9f72f359e00a45a6cd7cc2d5121b04b9dc927e1:

  Revert "be2net: fix vfs enumeration" (2012-09-27 22:19:02 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git for-davem

for you to fetch changes up to c487606f835a93a725bac1aefd536be98f22474d:

  Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem (2012-09-28 11:11:16 -0400)

----------------------------------------------------------------

Alan Cox (1):
      wireless: remove unreachable code

Amitkumar Karwar (3):
      mwifiex: fix issue in resumed scan operation
      mwifiex: disconnect the device before entering suspend state
      mwifiex: block scan request during heavy Tx traffic

Andrei Emeltchenko (7):
      Bluetooth: trivial: Shorten variable scope
      Bluetooth: trivial: Use preferred method for NULL check
      Bluetooth: Remove unneeded zero init
      Bluetooth: trivial: Make hci_chan_del return void
      Bluetooth: trivial: Remove empty line
      Bluetooth: debug: Print refcnt for hci_dev
      Bluetooth: AMP: Add Read Data Block Size to amp_init

Antonio Quartulli (2):
      mac80211: move ieee80211_send_deauth_disassoc outside mlme code
      mac80211: reply to AUTH with DEAUTH if sta allocation fails in IBSS

Arend van Spriel (8):
      cfg80211: remove obsolete comment for .sched_scan_stop() callback
      brcmfmac: add parameter check in brcmf_c_mkiovar()
      brcmfmac: simplify handling e-scan result firmware event
      brcmfmac: fix sparse warnings in e-scan related code
      brcmfmac: extend brcmf_term_iscan() to abort e-scan
      brcmfmac: introduce scheduled scan support
      brcmfmac: change struct brcmf_cfg80211_priv comments to kernel-doc
      brcmfmac: get rid of void pointer in struct brcmf_cfg80211_priv

Christian Lamparter (2):
      p54: connect to 11w protected networks
      carl9170: connect to 11w protected networks

Chun-Yeow Yeoh (2):
      mac80211: allow re-open the blocked peer link in mesh
      ath5k: disable HW crypto in management frame

Cong Wang (1):
      NFC: Remove the pn544 raw driver

Dan Carpenter (1):
      mwifiex: potential corruption in mwifiex_update_uap_custom_ie()

David Spinadel (2):
      iwlwifi: don't reset interupts after disabling
      iwlwifi: stop interrupts before stopping device

Eliad Peller (2):
      mac80211: use synchronize_net() on key destroying
      mac80211: use call_rcu() on sta deletion

Emmanuel Grumbach (2):
      iwlwifi: some clean up in transport layer
      iwlwifi: don't access the HW when it is not available

Eric Lapuyade (9):
      NFC: Changed the HCI cmd execution callback prototype
      NFC: Add a public nfc_hci_send_cmd_async method
      NFC: Modified hci_transceive to become an asynchronous operation
      NFC: Add an LLC Core layer to HCI
      NFC: Add a nop (passthrough) llc module to llc core
      NFC: Add an shdlc llc module to llc core
      NFC: Changed HCI and PN544 HCI driver to use the new HCI LLC Core
      NFC: Fix LLC registration definitions for ANSI compliance
      NFC: Add HCI module description

Felix Fietkau (1):
      mac80211: validate skb->dev in the tx status path

Franky Lin (8):
      brcmfmac: absorb brcmf_sendpkt into brcmf_netdev_start_xmit
      brcmfmac: remove obsolete sdio bus sleep mechanism
      brcmfmac: use atomic variable for interrupt pending flag
      brcmfmac: convert SDIO dpc implementation to workqueue
      brcmfmac: streamline SDIO dpc
      brcmfmac: raise SDIO host lock to higher level
      brcmfmac: clear status for in-band interrupt in brcmf_sdbrcm_isr
      brcmfmac: streamline SDIO read frame routine

Gertjan van Wingerde (7):
      rt2x00: Code clean up in rt2800lib.
      rt2x00: rt2800 - Fix default vgc values for RT3572
      rt2x00: rt2800lib - code cleanup.
      rt2x00: Code style cleanup in rt2800lib.c
      rt2x00: Clean up RFCSR1 programming in rt2800_config_channel_rf3xxx.
      rt2x00: Deprecate max_sta_intf field of struct rt2x00_ops.
      rt2x00: Replace open coded interface checking with interface combinations.

Gustavo Padovan (1):
      Bluetooth: Add USB_VENDOR_AND_INTERFACE_INFO() for Broadcom/Foxconn

Hante Meuleman (7):
      brcmfmac: fix bug causing errorneous free on exception.
      brcmfmac: fix debug printout of event data.
      brcmfmac: store usb fw images in local linked list.
      brcmfmac: remove unused function.
      brcmfmac: fix bug in determining phy bands.
      brcmfmac: remove unused usb bmac model code.
      brcmfmac: clear control lock on usb error.

Ilan Elias (3):
      NFC: Set local general bytes in nci_start_poll
      NFC: Parse NCI NFC-DEP activation params
      NFC: Implement NCI dep_link_up and dep_link_down

Jaroslav Resler (1):
      Bluetooth: Add support for BCM20702A0 [04ca, 2003]

Johan Hedberg (2):
      Bluetooth: mgmt: Implement support for passkey notification
      Bluetooth: Update management interface revision

Johannes Berg (22):
      iwlwifi: remove unused IDI code stubs
      Merge remote-tracking branch 'mac80211/master' into mac80211-next
      mac80211: don't hang on to sched_scan_ies
      mac80211: disconnect if channel switch fails
      Merge remote-tracking branch 'wireless-next/master' into mac80211-next
      wireless: remove obsolete chan no/center freq conversion functions
      mac80211_hwsim: move module_init/exit
      mac80211: check power constraint IE size when parsing
      mac80211: add key flag for management keys
      iwlwifi: fix indentation in iwl_load_given_ucode
      iwlwifi: load firmware in chunks
      mac80211: remove unneeded CONFIG_PM ifdef
      mac80211: handle power constraint/country IE better
      mac80211: change locking around ieee80211_recalc_smps
      mac80211: make reset debugfs depend on CONFIG_PM
      cfg80211: constify name parameter to add_virtual_intf
      iwlwifi: use eth_broadcast_addr
      iwlwifi: fix async station command crash
      mac80211: don't send delBA before disassoc
      mac80211: don't send delBA when removing stations
      mac80211: don't send delBA on addBA failure
      iwlegacy: use eth_broadcast_addr

John W. Linville (11):
      Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211-next
      Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-next
      Merge branch 'master' of git://git.kernel.org/.../bluetooth/bluetooth-next
      Merge tag 'nfc-next-3.7-1' of git://git.kernel.org/.../sameo/nfc-3.0
      Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211-next
      Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-next
      ath5k: add missing breaks in ath5k_hw_set_spur_mitigation_filter
      nfc: add dummy nfc_llc_shdlc_register definition
      NFC: Add dummy nfc_llc_shdlc_register definition
      Merge tag 'nfc-next-3.7-2' of git://git.kernel.org/.../sameo/nfc-3.0
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next into for-davem

Michal Kazior (1):
      mac80211: refactor set_channel_type

Mikel Astiz (3):
      Bluetooth: Add more HCI error codes
      Bluetooth: Fix minor coding style in hci_event.c
      Bluetooth: mgmt: Add device disconnect reason

Ming Lei (1):
      wireless: ath9k-htc: fix possible use after free

Mohammed Shafi Shajakhan (1):
      ath9k: update hw_timer_enabled to false when we stop generic timers

Pandiyarajan Pitchaimuthu (1):
      cfg80211/nl80211: Notify connection request failure in AP mode

Paul Bolle (1):
      ipw2x00: silence GCC warning for unused variable 'dev'

Peter Senna Tschudin (6):
      net/mac80211/scan.c: removes unnecessary semicolon
      Bluetooth: bluecard_cs.c: removes unnecessary semicolon
      Bluetooth: hci_ldisc.c: removes unnecessary semicolon
      Bluetooth: hci_ll.c: removes unnecessary semicolon
      Bluetooth: hci_vhci.c: removes unnecessary semicolon
      Bluetooth: btuart_cs.c: removes unnecessary semicolon

Piotr Haber (1):
      brcmsmac: don't start device when RfKill is engaged

Rafał Miłecki (1):
      bcma: handle BCM43227

Rajkumar Manoharan (7):
      ath9k_hw: move 2g5g switch before nfcal start
      ath9k_hw: fix ar9462 selfgen chainmask
      ath9k: flush bt profile whenever it is requested
      ath9k: move coex param updation within mci work
      ath9k: fill led_pin before drv_start
      ath9k: fix queuing MCI work twice
      ath9k_hw: fix BT sleep state on chip wakeup

Sachin Kamat (1):
      Bluetooth: Use module_platform_driver() in btwilink.c file

Samuel Ortiz (4):
      NFC: Queue pn533 commands
      NFC: Set the IRQF_ONESHOT flag from the pn544_hci IRQ handler request
      NFC: Remove unneeded LLC symbols export
      MAINTAINERS: Add NFC specific mailing list

Sujith Manoharan (10):
      ath9k: Enable SGI correctly
      ath9k_hw: Use HW cap ATH9K_HW_CAP_ANT_DIV_COMB
      ath9k: Remove redundant variable assignment
      ath9k: Remove a couple of unused variables
      ath9k_hw: Add antenna diversity group for AR9565
      ath9k_hw: Update AR9565 initvals
      ath9k_hw: Add a HW callback to set diversity
      ath9k: Add a module parameter to enable diversity
      ath9k_hw: Enable WLAN RX diversity for AR9565
      ath9k: Disable ASPM only for AR9285

Syam Sidhardhan (4):
      Bluetooth: debug: Correct the PSM printing
      Bluetooth: Use kref for l2cap channel reference counting
      NFC: Use module_platform_driver macro for nfcwilink.c
      NFC: Remove repeated code for NULL check

Sylvain Roger Rieunier (1):
      mac80211: fix IBSS auth TX debug message

Szymon Janc (4):
      NFC: Use dynamic initialization for rwlocks
      NFC: Fix missing mutex unlock in pn533_send_cmd_frame_async
      NFC: Fix sleeping in invalid context when netlink socket is closed
      NFC: Fix sleeping in atomic when releasing socket

Tejun Heo (2):
      NFC: Use system_nrt_wq instead of custom ones
      NFC: Don't use WQ_MEM_RECLAIM for pn533

Thierry Escande (1):
      NFC: LLCP raw socket support

Vinicius Costa Gomes (8):
      Bluetooth: Remove some functions from being exported
      Bluetooth: Rename LE and ACL connection functions
      Bluetooth: Refactor LE connection into its own function
      Bluetooth: Refactor ACL connection into its own function
      Bluetooth: Refactor SCO connection into its own function
      Bluetooth: Simplify a the connection type handling
      Bluetooth: Add type information to the hci_connect() debug statement
      Bluetooth: Fix establishing ESCO links

Vitaly Wool (1):
      rfkill: prevent unnecessary event generation

Vladimir Kondratiev (1):
      cfg80211: Fix regulatory check for 60GHz band frequencies

Waldemar Rymarkiewicz (6):
      NFC: Remove crc generation from shdlc layer
      NFC: Correct outgoing frame before requeueing
      NFC: xmit from hci ops must return 0 or negative
      NFC: Handle RSET in SHDLC_CONNECTING state
      NFC: Don't handle consequent RSET frames after UA
      NFC: Fix typo negociating -> negotiating

Wei Yongjun (6):
      mac80211: use list_move instead of list_del/list_add
      Bluetooth: btmrvl: remove pointless conditional before kfree_skb()
      NFC: Remove pointless conditional before HCI kfree_skb()
      NFC: Fix possible LLCP memory leak
      NFC: Move the nfcwilink dereference below the NULL test
      NFC: Move the pn544_hci dereference below the NULL test

 Documentation/feature-removal-schedule.txt         |   12 -
 MAINTAINERS                                        |    1 +
 drivers/bcma/host_pci.c                            |    1 +
 drivers/bcma/sprom.c                               |    2 +
 drivers/bluetooth/bluecard_cs.c                    |    2 +-
 drivers/bluetooth/btmrvl_sdio.c                    |    3 +-
 drivers/bluetooth/btuart_cs.c                      |    2 +-
 drivers/bluetooth/btusb.c                          |    3 +-
 drivers/bluetooth/btwilink.c                       |   16 +-
 drivers/bluetooth/hci_ldisc.c                      |    2 +-
 drivers/bluetooth/hci_ll.c                         |    2 +-
 drivers/bluetooth/hci_vhci.c                       |    2 +-
 drivers/net/wireless/ath/ath.h                     |    1 +
 drivers/net/wireless/ath/ath5k/base.c              |    1 +
 drivers/net/wireless/ath/ath5k/mac80211-ops.c      |    5 +-
 drivers/net/wireless/ath/ath5k/phy.c               |    2 +
 drivers/net/wireless/ath/ath6kl/cfg80211.c         |    4 +-
 drivers/net/wireless/ath/ath6kl/cfg80211.h         |    2 +-
 drivers/net/wireless/ath/ath9k/antenna.c           |  117 ++-
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c     |   20 +-
 drivers/net/wireless/ath/ath9k/ar9003_mci.c        |    7 +-
 drivers/net/wireless/ath/ath9k/ar9003_mci.h        |    4 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.c        |   66 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.h        |   24 +
 .../net/wireless/ath/ath9k/ar9565_1p0_initvals.h   |  100 +-
 drivers/net/wireless/ath/ath9k/ath9k.h             |    6 +-
 drivers/net/wireless/ath/ath9k/gpio.c              |   58 +-
 drivers/net/wireless/ath/ath9k/hif_usb.c           |    5 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c      |    2 +-
 drivers/net/wireless/ath/ath9k/hw-ops.h            |    7 +
 drivers/net/wireless/ath/ath9k/hw.c                |   12 +-
 drivers/net/wireless/ath/ath9k/hw.h                |    3 +-
 drivers/net/wireless/ath/ath9k/init.c              |   13 +
 drivers/net/wireless/ath/ath9k/main.c              |    2 +-
 drivers/net/wireless/ath/ath9k/mci.c               |   62 +-
 drivers/net/wireless/ath/ath9k/pci.c               |    5 +-
 drivers/net/wireless/ath/ath9k/rc.c                |   11 +-
 drivers/net/wireless/ath/carl9170/mac.c            |    3 +-
 drivers/net/wireless/ath/carl9170/main.c           |    2 +
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c   |   39 +-
 .../net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   25 -
 drivers/net/wireless/brcm80211/brcmfmac/dhd.h      |    4 -
 .../net/wireless/brcm80211/brcmfmac/dhd_common.c   |   19 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h  |    2 +
 .../net/wireless/brcm80211/brcmfmac/dhd_linux.c    |   41 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 1037 ++++++++------------
 .../net/wireless/brcm80211/brcmfmac/sdio_host.h    |    2 +
 drivers/net/wireless/brcm80211/brcmfmac/usb.c      |   90 +-
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  |  422 ++++++--
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.h  |  202 +++-
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |    5 +-
 drivers/net/wireless/ipw2x00/libipw_wx.c           |    2 +-
 drivers/net/wireless/iwlegacy/common.c             |    4 +-
 drivers/net/wireless/iwlwifi/dvm/scan.c            |    4 +-
 drivers/net/wireless/iwlwifi/dvm/sta.c             |    7 +-
 drivers/net/wireless/iwlwifi/dvm/ucode.c           |    4 +-
 drivers/net/wireless/iwlwifi/iwl-drv.c             |   26 +-
 drivers/net/wireless/iwlwifi/iwl-fw.h              |    3 +-
 drivers/net/wireless/iwlwifi/pcie/drv.c            |   13 -
 drivers/net/wireless/iwlwifi/pcie/internal.h       |    2 +-
 drivers/net/wireless/iwlwifi/pcie/rx.c             |   75 +-
 drivers/net/wireless/iwlwifi/pcie/trans.c          |   84 +-
 drivers/net/wireless/mac80211_hwsim.c              |    5 +-
 drivers/net/wireless/mwifiex/cfg80211.c            |    8 +-
 drivers/net/wireless/mwifiex/ie.c                  |    2 +-
 drivers/net/wireless/mwifiex/init.c                |    1 +
 drivers/net/wireless/mwifiex/main.h                |    4 +-
 drivers/net/wireless/mwifiex/sta_ioctl.c           |   13 +
 drivers/net/wireless/p54/main.c                    |   12 +
 drivers/net/wireless/rt2x00/rt2400pci.c            |    1 -
 drivers/net/wireless/rt2x00/rt2500pci.c            |    1 -
 drivers/net/wireless/rt2x00/rt2500usb.c            |    1 -
 drivers/net/wireless/rt2x00/rt2800lib.c            |   72 +-
 drivers/net/wireless/rt2x00/rt2800pci.c            |    1 -
 drivers/net/wireless/rt2x00/rt2800usb.c            |    1 -
 drivers/net/wireless/rt2x00/rt2x00.h               |   15 +-
 drivers/net/wireless/rt2x00/rt2x00dev.c            |   33 +
 drivers/net/wireless/rt2x00/rt2x00mac.c            |   40 -
 drivers/net/wireless/rt2x00/rt61pci.c              |    1 -
 drivers/net/wireless/rt2x00/rt73usb.c              |    1 -
 drivers/nfc/Kconfig                                |   14 +-
 drivers/nfc/Makefile                               |    1 -
 drivers/nfc/nfcwilink.c                            |   20 +-
 drivers/nfc/pn533.c                                |  107 +-
 drivers/nfc/pn544.c                                |  893 -----------------
 drivers/nfc/pn544_hci.c                            |  177 ++--
 include/linux/ieee80211.h                          |   80 --
 include/linux/nfc.h                                |   11 +
 include/linux/nl80211.h                            |   24 +
 include/net/bluetooth/hci.h                        |   21 +
 include/net/bluetooth/hci_core.h                   |   26 +-
 include/net/bluetooth/l2cap.h                      |    3 +-
 include/net/bluetooth/mgmt.h                       |   16 +
 include/net/cfg80211.h                             |   25 +-
 include/net/mac80211.h                             |   12 +-
 include/net/nfc/hci.h                              |   21 +-
 include/net/nfc/llc.h                              |   54 +
 include/net/nfc/nci.h                              |   29 +
 include/net/nfc/nci_core.h                         |    5 +
 include/net/nfc/nfc.h                              |    2 +-
 include/net/nfc/shdlc.h                            |  107 --
 net/bluetooth/af_bluetooth.c                       |   10 +-
 net/bluetooth/hci_conn.c                           |  100 +-
 net/bluetooth/hci_core.c                           |    6 +-
 net/bluetooth/hci_event.c                          |   99 +-
 net/bluetooth/l2cap_core.c                         |   17 +-
 net/bluetooth/mgmt.c                               |   28 +-
 net/mac80211/agg-tx.c                              |    2 +-
 net/mac80211/cfg.c                                 |   37 +-
 net/mac80211/chan.c                                |   67 +-
 net/mac80211/debugfs.c                             |    4 +
 net/mac80211/ibss.c                                |   35 +-
 net/mac80211/ieee80211_i.h                         |   23 +-
 net/mac80211/iface.c                               |   15 +-
 net/mac80211/key.c                                 |    2 +-
 net/mac80211/main.c                                |   10 +-
 net/mac80211/mesh_plink.c                          |    3 +-
 net/mac80211/mlme.c                                |  207 ++--
 net/mac80211/offchannel.c                          |    3 +-
 net/mac80211/scan.c                                |   41 +-
 net/mac80211/sta_info.c                            |  123 +--
 net/mac80211/sta_info.h                            |    2 +
 net/mac80211/status.c                              |   48 +-
 net/mac80211/tx.c                                  |    2 +-
 net/mac80211/util.c                                |   51 +-
 net/nfc/core.c                                     |   13 +-
 net/nfc/hci/Makefile                               |    4 +-
 net/nfc/hci/command.c                              |   45 +-
 net/nfc/hci/core.c                                 |  336 ++++---
 net/nfc/hci/hci.h                                  |   15 +-
 net/nfc/hci/hcp.c                                  |    6 +-
 net/nfc/hci/llc.c                                  |  170 ++++
 net/nfc/hci/llc.h                                  |   69 ++
 net/nfc/hci/llc_nop.c                              |   99 ++
 net/nfc/hci/{shdlc.c => llc_shdlc.c}               |  544 +++++-----
 net/nfc/llcp/commands.c                            |    2 +
 net/nfc/llcp/llcp.c                                |  131 +--
 net/nfc/llcp/llcp.h                                |    6 +-
 net/nfc/llcp/sock.c                                |   93 +-
 net/nfc/nci/core.c                                 |   91 +-
 net/nfc/nci/ntf.c                                  |   52 +
 net/nfc/nci/rsp.c                                  |   14 +
 net/nfc/netlink.c                                  |   46 +-
 net/rfkill/core.c                                  |    8 +-
 net/wireless/mlme.c                                |   11 +
 net/wireless/nl80211.c                             |   34 +
 net/wireless/nl80211.h                             |    5 +
 net/wireless/reg.c                                 |   39 +-
 148 files changed, 3919 insertions(+), 3413 deletions(-)
 delete mode 100644 drivers/nfc/pn544.c
 create mode 100644 include/net/nfc/llc.h
 delete mode 100644 include/net/nfc/shdlc.h
 create mode 100644 net/nfc/hci/llc.c
 create mode 100644 net/nfc/hci/llc.h
 create mode 100644 net/nfc/hci/llc_nop.c
 rename net/nfc/hci/{shdlc.c => llc_shdlc.c} (54%)
-- 
John W. Linville		Someday the world will need a hero, and you
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org			might be all we have.  Be ready.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [RFC PATCH net-next] tcp: introduce tcp_tw_interval to specifiy the time of TIME-WAIT
From: Rick Jones @ 2012-09-28 17:30 UTC (permalink / raw)
  To: David Miller; +Cc: amwang, nhorman, netdev, kuznet, kaber, edumazet
In-Reply-To: <20120928.024336.598451765169362800.davem@davemloft.net>

On 09/27/2012 11:43 PM, David Miller wrote:
> From: Cong Wang <amwang@redhat.com>
> Date: Fri, 28 Sep 2012 14:33:07 +0800
>
>> I don't think reducing TIME_WAIT is a good idea either, but there must
>> be some reason behind as several UNIX provides a microsecond-scale
>> tuning interface, or maybe in non-recycle mode, their RTO is much less
>> than 2*MSL?

Microsecond?  HP-UX uses milliseconds for the units of the tunable, 
though that does not necessarily mean it will actually be implemented to 
millisecond accuracy

> Yes, there is a reason.  It's there for retaining multi-million-dollar
> customers.
>
> There is no other reasons these other systems provide these
> facilities, they are simply there in an attempt to retain a dwindling
> customer base.
 >
 > Any other belief is extremely naive.

HP-UX's TIME_WAIT interval tunability goes back to HP-UX 11.0, which 
first shipped in 1997.  It got it by virtue of using a "Mentat-based" 
stack which had that functionality.  I may not have my history 
completely correct, but Solaris 2 also got their networking bits from 
Mentat, and I believe shipped before HP-UX 11.

To my recollection, neither were faced with a dwindling customer base at 
the time.

rick jones

^ permalink raw reply

* Re: [PATCH] rtlwifi: use %*ph[C] to dump small buffers
From: Joe Perches @ 2012-09-28 17:24 UTC (permalink / raw)
  To: Larry Finger
  Cc: David Laight, Andy Shevchenko, Chaoming Li, David S. Miller,
	linux-wireless, netdev
In-Reply-To: <5065D32F.9090107@lwfinger.net>

On Fri, 2012-09-28 at 11:41 -0500, Larry Finger wrote:
> On 09/28/2012 04:04 AM, David Laight wrote:
> >>> Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
[]
> >>> -       *(u32 *)&rate_mask = (ratr_bitmap & 0x0fffffff) |
> >>> -                                    (ratr_index << 28);
> >>> +       for (i = 0; i < 3; i++)
> >>> +               rate_mask[i] = ratr_bitmap & (0xff << (i * 4));
[]
> > So this either fixes, or adds, an endianness bug.
> 
> Yes, the rate_mask array is little endian after this fragment is run, but the 
> only use of the byte array is to write it to the device, and LE is what it needs 
> no matter the platform. This change fixes an endianness bug.
> 
> As I tend to get confused when doing these things, I wrote a small test program 
> and ran it on x86_64 and PPC-32 to confirm the result.
> 
> Thanks for teaching me about a = b >>= 8. I was not aware that C could do that.

The other thing that could be done is to use cpu_to_le32()
but David's method I think is superior for this use as there's
no absolute guarantee that rate_mask is aligned on a u32.

I'd add parens to make the precedence explicit.

	rate_mask[0] = ratr_bitmap;
	rate_mask[1] = (ratr_bitmap >>= 8);
	rate_mask[2] = (ratr_bitmap >>= 8);
	rate_mask[3] = ((ratr_bitmap >> 8) & 0xf) | (ratr_index << 4);

^ permalink raw reply

* [PATCH RFC net-next 4/4] time: remove the timecompare code.
From: Richard Cochran @ 2012-09-28 17:20 UTC (permalink / raw)
  To: netdev
  Cc: device-drivers-devel, uclinux-dist-devel, David Miller,
	Jacob Keller, Jeff Kirsher, John Ronciak, John Stultz,
	Mike Frysinger, Miroslav Lichvar, Patrick Ohly, Sonic Zhang
In-Reply-To: <cover.1348851539.git.richardcochran@gmail.com>

This patch removes the timecompare code from the kernel. The top five
reasons to do this are:

1. There are no more users of this code.
2. The original idea was a bit weak.
3. The original author has disappeared.
4. The code was not general purpose but tuned to a particular hardware,
5. There are better ways to accomplish clock synchronization.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 include/linux/timecompare.h |  125 ----------------------------
 kernel/time/Makefile        |    2 +-
 kernel/time/timecompare.c   |  193 -------------------------------------------
 3 files changed, 1 insertions(+), 319 deletions(-)
 delete mode 100644 include/linux/timecompare.h
 delete mode 100644 kernel/time/timecompare.c

diff --git a/include/linux/timecompare.h b/include/linux/timecompare.h
deleted file mode 100644
index 546e223..0000000
--- a/include/linux/timecompare.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Utility code which helps transforming between two different time
- * bases, called "source" and "target" time in this code.
- *
- * Source time has to be provided via the timecounter API while target
- * time is accessed via a function callback whose prototype
- * intentionally matches ktime_get() and ktime_get_real(). These
- * interfaces where chosen like this so that the code serves its
- * initial purpose without additional glue code.
- *
- * This purpose is synchronizing a hardware clock in a NIC with system
- * time, in order to implement the Precision Time Protocol (PTP,
- * IEEE1588) with more accurate hardware assisted time stamping.  In
- * that context only synchronization against system time (=
- * ktime_get_real()) is currently needed. But this utility code might
- * become useful in other situations, which is why it was written as
- * general purpose utility code.
- *
- * The source timecounter is assumed to return monotonically
- * increasing time (but this code does its best to compensate if that
- * is not the case) whereas target time may jump.
- *
- * The target time corresponding to a source time is determined by
- * reading target time, reading source time, reading target time
- * again, then assuming that average target time corresponds to source
- * time. In other words, the assumption is that reading the source
- * time is slow and involves equal time for sending the request and
- * receiving the reply, whereas reading target time is assumed to be
- * fast.
- *
- * Copyright (C) 2009 Intel Corporation.
- * Author: Patrick Ohly <patrick.ohly@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#ifndef _LINUX_TIMECOMPARE_H
-#define _LINUX_TIMECOMPARE_H
-
-#include <linux/clocksource.h>
-#include <linux/ktime.h>
-
-/**
- * struct timecompare - stores state and configuration for the two clocks
- *
- * Initialize to zero, then set source/target/num_samples.
- *
- * Transformation between source time and target time is done with:
- * target_time = source_time + offset +
- *               (source_time - last_update) * skew /
- *               TIMECOMPARE_SKEW_RESOLUTION
- *
- * @source:          used to get source time stamps via timecounter_read()
- * @target:          function returning target time (for example, ktime_get
- *                   for monotonic time, or ktime_get_real for wall clock)
- * @num_samples:     number of times that source time and target time are to
- *                   be compared when determining their offset
- * @offset:          (target time - source time) at the time of the last update
- * @skew:            average (target time - source time) / delta source time *
- *                   TIMECOMPARE_SKEW_RESOLUTION
- * @last_update:     last source time stamp when time offset was measured
- */
-struct timecompare {
-	struct timecounter *source;
-	ktime_t (*target)(void);
-	int num_samples;
-
-	s64 offset;
-	s64 skew;
-	u64 last_update;
-};
-
-/**
- * timecompare_transform - transform source time stamp into target time base
- * @sync:            context for time sync
- * @source_tstamp:   the result of timecounter_read() or
- *                   timecounter_cyc2time()
- */
-extern ktime_t timecompare_transform(struct timecompare *sync,
-				     u64 source_tstamp);
-
-/**
- * timecompare_offset - measure current (target time - source time) offset
- * @sync:            context for time sync
- * @offset:          average offset during sample period returned here
- * @source_tstamp:   average source time during sample period returned here
- *
- * Returns number of samples used. Might be zero (= no result) in the
- * unlikely case that target time was monotonically decreasing for all
- * samples (= broken).
- */
-extern int timecompare_offset(struct timecompare *sync,
-			      s64 *offset,
-			      u64 *source_tstamp);
-
-extern void __timecompare_update(struct timecompare *sync,
-				 u64 source_tstamp);
-
-/**
- * timecompare_update - update offset and skew by measuring current offset
- * @sync:            context for time sync
- * @source_tstamp:   the result of timecounter_read() or
- *                   timecounter_cyc2time(), pass zero to force update
- *
- * Updates are only done at most once per second.
- */
-static inline void timecompare_update(struct timecompare *sync,
-				      u64 source_tstamp)
-{
-	if (!source_tstamp ||
-	    (s64)(source_tstamp - sync->last_update) >= NSEC_PER_SEC)
-		__timecompare_update(sync, source_tstamp);
-}
-
-#endif /* _LINUX_TIMECOMPARE_H */
diff --git a/kernel/time/Makefile b/kernel/time/Makefile
index e2fd74b..ff7d9d2 100644
--- a/kernel/time/Makefile
+++ b/kernel/time/Makefile
@@ -1,4 +1,4 @@
-obj-y += timekeeping.o ntp.o clocksource.o jiffies.o timer_list.o timecompare.o
+obj-y += timekeeping.o ntp.o clocksource.o jiffies.o timer_list.o
 obj-y += timeconv.o posix-clock.o alarmtimer.o
 
 obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD)		+= clockevents.o
diff --git a/kernel/time/timecompare.c b/kernel/time/timecompare.c
deleted file mode 100644
index a9ae369..0000000
--- a/kernel/time/timecompare.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2009 Intel Corporation.
- * Author: Patrick Ohly <patrick.ohly@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/timecompare.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/math64.h>
-#include <linux/kernel.h>
-
-/*
- * fixed point arithmetic scale factor for skew
- *
- * Usually one would measure skew in ppb (parts per billion, 1e9), but
- * using a factor of 2 simplifies the math.
- */
-#define TIMECOMPARE_SKEW_RESOLUTION (((s64)1)<<30)
-
-ktime_t timecompare_transform(struct timecompare *sync,
-			      u64 source_tstamp)
-{
-	u64 nsec;
-
-	nsec = source_tstamp + sync->offset;
-	nsec += (s64)(source_tstamp - sync->last_update) * sync->skew /
-		TIMECOMPARE_SKEW_RESOLUTION;
-
-	return ns_to_ktime(nsec);
-}
-EXPORT_SYMBOL_GPL(timecompare_transform);
-
-int timecompare_offset(struct timecompare *sync,
-		       s64 *offset,
-		       u64 *source_tstamp)
-{
-	u64 start_source = 0, end_source = 0;
-	struct {
-		s64 offset;
-		s64 duration_target;
-	} buffer[10], sample, *samples;
-	int counter = 0, i;
-	int used;
-	int index;
-	int num_samples = sync->num_samples;
-
-	if (num_samples > ARRAY_SIZE(buffer)) {
-		samples = kmalloc(sizeof(*samples) * num_samples, GFP_ATOMIC);
-		if (!samples) {
-			samples = buffer;
-			num_samples = ARRAY_SIZE(buffer);
-		}
-	} else {
-		samples = buffer;
-	}
-
-	/* run until we have enough valid samples, but do not try forever */
-	i = 0;
-	counter = 0;
-	while (1) {
-		u64 ts;
-		ktime_t start, end;
-
-		start = sync->target();
-		ts = timecounter_read(sync->source);
-		end = sync->target();
-
-		if (!i)
-			start_source = ts;
-
-		/* ignore negative durations */
-		sample.duration_target = ktime_to_ns(ktime_sub(end, start));
-		if (sample.duration_target >= 0) {
-			/*
-			 * assume symetric delay to and from source:
-			 * average target time corresponds to measured
-			 * source time
-			 */
-			sample.offset =
-				(ktime_to_ns(end) + ktime_to_ns(start)) / 2 -
-				ts;
-
-			/* simple insertion sort based on duration */
-			index = counter - 1;
-			while (index >= 0) {
-				if (samples[index].duration_target <
-				    sample.duration_target)
-					break;
-				samples[index + 1] = samples[index];
-				index--;
-			}
-			samples[index + 1] = sample;
-			counter++;
-		}
-
-		i++;
-		if (counter >= num_samples || i >= 100000) {
-			end_source = ts;
-			break;
-		}
-	}
-
-	*source_tstamp = (end_source + start_source) / 2;
-
-	/* remove outliers by only using 75% of the samples */
-	used = counter * 3 / 4;
-	if (!used)
-		used = counter;
-	if (used) {
-		/* calculate average */
-		s64 off = 0;
-		for (index = 0; index < used; index++)
-			off += samples[index].offset;
-		*offset = div_s64(off, used);
-	}
-
-	if (samples && samples != buffer)
-		kfree(samples);
-
-	return used;
-}
-EXPORT_SYMBOL_GPL(timecompare_offset);
-
-void __timecompare_update(struct timecompare *sync,
-			  u64 source_tstamp)
-{
-	s64 offset;
-	u64 average_time;
-
-	if (!timecompare_offset(sync, &offset, &average_time))
-		return;
-
-	if (!sync->last_update) {
-		sync->last_update = average_time;
-		sync->offset = offset;
-		sync->skew = 0;
-	} else {
-		s64 delta_nsec = average_time - sync->last_update;
-
-		/* avoid division by negative or small deltas */
-		if (delta_nsec >= 10000) {
-			s64 delta_offset_nsec = offset - sync->offset;
-			s64 skew; /* delta_offset_nsec *
-				     TIMECOMPARE_SKEW_RESOLUTION /
-				     delta_nsec */
-			u64 divisor;
-
-			/* div_s64() is limited to 32 bit divisor */
-			skew = delta_offset_nsec * TIMECOMPARE_SKEW_RESOLUTION;
-			divisor = delta_nsec;
-			while (unlikely(divisor >= ((s64)1) << 32)) {
-				/* divide both by 2; beware, right shift
-				   of negative value has undefined
-				   behavior and can only be used for
-				   the positive divisor */
-				skew = div_s64(skew, 2);
-				divisor >>= 1;
-			}
-			skew = div_s64(skew, divisor);
-
-			/*
-			 * Calculate new overall skew as 4/16 the
-			 * old value and 12/16 the new one. This is
-			 * a rather arbitrary tradeoff between
-			 * only using the latest measurement (0/16 and
-			 * 16/16) and even more weight on past measurements.
-			 */
-#define TIMECOMPARE_NEW_SKEW_PER_16 12
-			sync->skew =
-				div_s64((16 - TIMECOMPARE_NEW_SKEW_PER_16) *
-					sync->skew +
-					TIMECOMPARE_NEW_SKEW_PER_16 * skew,
-					16);
-			sync->last_update = average_time;
-			sync->offset = offset;
-		}
-	}
-}
-EXPORT_SYMBOL_GPL(__timecompare_update);
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH RFC net-next 3/4] bfin_mac: offer a PTP Hardware Clock.
From: Richard Cochran @ 2012-09-28 17:20 UTC (permalink / raw)
  To: netdev
  Cc: device-drivers-devel, uclinux-dist-devel, David Miller,
	Jacob Keller, Jeff Kirsher, John Ronciak, John Stultz,
	Mike Frysinger, Miroslav Lichvar, Patrick Ohly, Sonic Zhang
In-Reply-To: <cover.1348851539.git.richardcochran@gmail.com>

The BF518 has a PTP time unit that works in a similar way to other MAC
based clocks, like gianfar, ixp46x, and igb. This patch adds support for
using the blackfin as a PHC. Although the blackfin hardware does offer a
few ancillary features, this patch implements only the basic operations.

Compile tested only.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/adi/Kconfig    |    2 +-
 drivers/net/ethernet/adi/bfin_mac.c |  170 ++++++++++++++++++++++++++++++++++-
 drivers/net/ethernet/adi/bfin_mac.h |    6 ++
 3 files changed, 175 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/adi/Kconfig b/drivers/net/ethernet/adi/Kconfig
index 49a30d3..175c38c 100644
--- a/drivers/net/ethernet/adi/Kconfig
+++ b/drivers/net/ethernet/adi/Kconfig
@@ -61,7 +61,7 @@ config BFIN_RX_DESC_NUM
 
 config BFIN_MAC_USE_HWSTAMP
 	bool "Use IEEE 1588 hwstamp"
-	depends on BFIN_MAC && BF518
+	depends on BFIN_MAC && BF518 && PTP_1588_CLOCK && !(BFIN_MAC=y && PTP_1588_CLOCK=m)
 	default y
 	---help---
 	  To support the IEEE 1588 Precision Time Protocol (PTP), select y here
diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c
index 393d1b5..88053a4 100644
--- a/drivers/net/ethernet/adi/bfin_mac.c
+++ b/drivers/net/ethernet/adi/bfin_mac.c
@@ -552,11 +552,13 @@ static int bfin_mac_ethtool_setwol(struct net_device *dev,
 static int bfin_mac_ethtool_get_ts_info(struct net_device *dev,
 	struct ethtool_ts_info *info)
 {
+	struct bfin_mac_local *lp = netdev_priv(dev);
+
 	info->so_timestamping =
 		SOF_TIMESTAMPING_TX_HARDWARE |
 		SOF_TIMESTAMPING_RX_HARDWARE |
 		SOF_TIMESTAMPING_RAW_HARDWARE;
-	info->phc_index = -1;
+	info->phc_index = lp->phc_index;
 	info->tx_types =
 		(1 << HWTSTAMP_TX_OFF) |
 		(1 << HWTSTAMP_TX_ON);
@@ -887,7 +889,7 @@ static void bfin_rx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 static void bfin_mac_hwtstamp_init(struct net_device *netdev)
 {
 	struct bfin_mac_local *lp = netdev_priv(netdev);
-	u64 addend;
+	u64 addend, ppb;
 	u32 input_clk, phc_clk;
 
 	/* Initialize hardware timer */
@@ -898,18 +900,175 @@ static void bfin_mac_hwtstamp_init(struct net_device *netdev)
 	bfin_write_EMAC_PTP_ADDEND((u32)addend);
 
 	lp->addend = addend;
+	ppb = 1000000000ULL * input_clk;
+	do_div(ppb, phc_clk);
+	lp->max_ppb = ppb - 1000000000ULL - 1ULL;
 
 	/* Initialize hwstamp config */
 	lp->stamp_cfg.rx_filter = HWTSTAMP_FILTER_NONE;
 	lp->stamp_cfg.tx_type = HWTSTAMP_TX_OFF;
 }
 
+static u64 bfin_ptp_time_read(struct bfin_mac_local *lp)
+{
+	u64 ns;
+	u32 lo, hi;
+
+	lo = bfin_read_EMAC_PTP_TIMELO();
+	hi = bfin_read_EMAC_PTP_TIMEHI();
+
+	ns = ((u64) hi) << 32;
+	ns |= lo;
+	ns <<= lp->shift;
+
+	return ns;
+}
+
+static void bfin_ptp_time_write(struct bfin_mac_local *lp, u64 ns)
+{
+	u32 hi, lo;
+
+	ns >>= lp->shift;
+	hi = ns >> 32;
+	lo = ns & 0xffffffff;
+
+	bfin_write_EMAC_PTP_TIMELO(lo);
+	bfin_write_EMAC_PTP_TIMEHI(hi);
+}
+
+/* PTP Hardware Clock operations */
+
+static int bfin_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
+{
+	u64 adj;
+	u32 diff, addend;
+	int neg_adj = 0;
+	struct bfin_mac_local *lp =
+		container_of(ptp, struct bfin_mac_local, caps);
+
+	if (ppb < 0) {
+		neg_adj = 1;
+		ppb = -ppb;
+	}
+	addend = lp->addend;
+	adj = addend;
+	adj *= ppb;
+	diff = div_u64(adj, 1000000000ULL);
+
+	addend = neg_adj ? addend - diff : addend + diff;
+
+	bfin_write_EMAC_PTP_ADDEND(addend);
+
+	return 0;
+}
+
+static int bfin_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
+{
+	s64 now;
+	unsigned long flags;
+	struct bfin_mac_local *lp =
+		container_of(ptp, struct bfin_mac_local, caps);
+
+	spin_lock_irqsave(&lp->phc_lock, flags);
+
+	now = bfin_ptp_time_read(lp);
+	now += delta;
+	bfin_ptp_time_write(lp, now);
+
+	spin_unlock_irqrestore(&lp->phc_lock, flags);
+
+	return 0;
+}
+
+static int bfin_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
+{
+	u64 ns;
+	u32 remainder;
+	unsigned long flags;
+	struct bfin_mac_local *lp =
+		container_of(ptp, struct bfin_mac_local, caps);
+
+	spin_lock_irqsave(&lp->phc_lock, flags);
+
+	ns = bfin_ptp_time_read(lp);
+
+	spin_unlock_irqrestore(&lp->phc_lock, flags);
+
+	ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder);
+	ts->tv_nsec = remainder;
+	return 0;
+}
+
+static int bfin_ptp_settime(struct ptp_clock_info *ptp,
+			   const struct timespec *ts)
+{
+	u64 ns;
+	unsigned long flags;
+	struct bfin_mac_local *lp =
+		container_of(ptp, struct bfin_mac_local, caps);
+
+	ns = ts->tv_sec * 1000000000ULL;
+	ns += ts->tv_nsec;
+
+	spin_lock_irqsave(&lp->phc_lock, flags);
+
+	bfin_ptp_time_write(lp, ns);
+
+	spin_unlock_irqrestore(&lp->phc_lock, flags);
+
+	return 0;
+}
+
+static int bfin_ptp_enable(struct ptp_clock_info *ptp,
+			  struct ptp_clock_request *rq, int on)
+{
+	return -EOPNOTSUPP;
+}
+
+static struct ptp_clock_info bfin_ptp_caps = {
+	.owner		= THIS_MODULE,
+	.name		= "BF518 clock",
+	.max_adj	= 0,
+	.n_alarm	= 0,
+	.n_ext_ts	= 0,
+	.n_per_out	= 0,
+	.pps		= 0,
+	.adjfreq	= bfin_ptp_adjfreq,
+	.adjtime	= bfin_ptp_adjtime,
+	.gettime	= bfin_ptp_gettime,
+	.settime	= bfin_ptp_settime,
+	.enable		= bfin_ptp_enable,
+};
+
+static int bfin_phc_init(struct net_device *netdev, struct device *dev)
+{
+	struct bfin_mac_local *lp = netdev_priv(netdev);
+
+	lp->caps = bfin_ptp_caps;
+	lp->caps.max_adj = lp->max_ppb;
+	lp->clock = ptp_clock_register(&lp->caps, dev);
+	if (IS_ERR(lp->clock))
+		return PTR_ERR(lp->clock);
+
+	lp->phc_index = ptp_clock_index(lp->clock);
+	spin_lock_init(&lp->phc_lock);
+
+	return 0;
+}
+
+static void bfin_phc_release(struct bfin_mac_local *lp)
+{
+	ptp_clock_unregister(lp->clock);
+}
+
 #else
 # define bfin_mac_hwtstamp_is_none(cfg) 0
 # define bfin_mac_hwtstamp_init(dev)
 # define bfin_mac_hwtstamp_ioctl(dev, ifr, cmd) (-EOPNOTSUPP)
 # define bfin_rx_hwtstamp(dev, skb)
 # define bfin_tx_hwtstamp(dev, skb)
+# define bfin_phc_init(netdev, dev) 0
+# define bfin_phc_release(lp)
 #endif
 
 static inline void _tx_reclaim_skb(void)
@@ -1544,12 +1703,17 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)
 	}
 
 	bfin_mac_hwtstamp_init(ndev);
+	if (bfin_phc_init(ndev, &pdev->dev)) {
+		dev_err(&pdev->dev, "Cannot register PHC device!\n");
+		goto out_err_phc;
+	}
 
 	/* now, print out the card info, in a short format.. */
 	netdev_info(ndev, "%s, Version %s\n", DRV_DESC, DRV_VERSION);
 
 	return 0;
 
+out_err_phc:
 out_err_reg_ndev:
 	free_irq(IRQ_MAC_RX, ndev);
 out_err_request_irq:
@@ -1568,6 +1732,8 @@ static int __devexit bfin_mac_remove(struct platform_device *pdev)
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct bfin_mac_local *lp = netdev_priv(ndev);
 
+	bfin_phc_release(lp);
+
 	platform_set_drvdata(pdev, NULL);
 
 	lp->mii_bus->priv = NULL;
diff --git a/drivers/net/ethernet/adi/bfin_mac.h b/drivers/net/ethernet/adi/bfin_mac.h
index 57f042c..7a07ee0 100644
--- a/drivers/net/ethernet/adi/bfin_mac.h
+++ b/drivers/net/ethernet/adi/bfin_mac.h
@@ -11,6 +11,7 @@
 #define _BFIN_MAC_H_
 
 #include <linux/net_tstamp.h>
+#include <linux/ptp_clock_kernel.h>
 #include <linux/timer.h>
 #include <linux/etherdevice.h>
 #include <linux/bfin_mac.h>
@@ -94,7 +95,12 @@ struct bfin_mac_local {
 #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
 	u32 addend;
 	unsigned int shift;
+	s32 max_ppb;
 	struct hwtstamp_config stamp_cfg;
+	struct ptp_clock_info caps;
+	struct ptp_clock *clock;
+	int phc_index;
+	spinlock_t phc_lock; /* protects time lo/hi registers */
 #endif
 };
 
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH RFC net-next 2/4] bfin_mac: replace sys time stamps with raw ones instead.
From: Richard Cochran @ 2012-09-28 17:20 UTC (permalink / raw)
  To: netdev
  Cc: device-drivers-devel, uclinux-dist-devel, David Miller,
	Jacob Keller, Jeff Kirsher, John Ronciak, John Stultz,
	Mike Frysinger, Miroslav Lichvar, Patrick Ohly, Sonic Zhang
In-Reply-To: <cover.1348851539.git.richardcochran@gmail.com>

This patch replaces the sys time stamps and timecompare code with simple
raw hardware time stamps in nanosecond resolution. The only tricky bit is
to find a PTP Hardware Clock period slower than the input clock period
and a power of two.

Compile tested only.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/adi/bfin_mac.c |   91 ++++++++++-------------------------
 drivers/net/ethernet/adi/bfin_mac.h |    7 +--
 2 files changed, 28 insertions(+), 70 deletions(-)

diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c
index 2349abb..393d1b5 100644
--- a/drivers/net/ethernet/adi/bfin_mac.c
+++ b/drivers/net/ethernet/adi/bfin_mac.c
@@ -555,7 +555,7 @@ static int bfin_mac_ethtool_get_ts_info(struct net_device *dev,
 	info->so_timestamping =
 		SOF_TIMESTAMPING_TX_HARDWARE |
 		SOF_TIMESTAMPING_RX_HARDWARE |
-		SOF_TIMESTAMPING_SYS_HARDWARE;
+		SOF_TIMESTAMPING_RAW_HARDWARE;
 	info->phc_index = -1;
 	info->tx_types =
 		(1 << HWTSTAMP_TX_OFF) |
@@ -653,6 +653,20 @@ static int bfin_mac_set_mac_address(struct net_device *dev, void *p)
 #ifdef CONFIG_BFIN_MAC_USE_HWSTAMP
 #define bfin_mac_hwtstamp_is_none(cfg) ((cfg) == HWTSTAMP_FILTER_NONE)
 
+static u32 bfin_select_phc_clock(u32 input_clk, unsigned int *shift_result)
+{
+	u32 ipn = 1000000000UL / input_clk;
+	u32 ppn = 1;
+	unsigned int shift = 0;
+
+	while (ppn <= ipn) {
+		ppn <<= 1;
+		shift++;
+	}
+	*shift_result = shift;
+	return 1000000000UL / ppn;
+}
+
 static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
 		struct ifreq *ifr, int cmd)
 {
@@ -802,19 +816,7 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
 		bfin_read_EMAC_PTP_TXSNAPLO();
 		bfin_read_EMAC_PTP_TXSNAPHI();
 
-		/*
-		 * Set registers so that rollover occurs soon to test this.
-		 */
-		bfin_write_EMAC_PTP_TIMELO(0x00000000);
-		bfin_write_EMAC_PTP_TIMEHI(0xFF800000);
-
 		SSYNC();
-
-		lp->compare.last_update = 0;
-		timecounter_init(&lp->clock,
-				&lp->cycles,
-				ktime_to_ns(ktime_get_real()));
-		timecompare_update(&lp->compare, 0);
 	}
 
 	lp->stamp_cfg = config;
@@ -822,15 +824,6 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
 		-EFAULT : 0;
 }
 
-static void bfin_dump_hwtamp(char *s, ktime_t *hw, ktime_t *ts, struct timecompare *cmp)
-{
-	ktime_t sys = ktime_get_real();
-
-	pr_debug("%s %s hardware:%d,%d transform system:%d,%d system:%d,%d, cmp:%lld, %lld\n",
-			__func__, s, hw->tv.sec, hw->tv.nsec, ts->tv.sec, ts->tv.nsec, sys.tv.sec,
-			sys.tv.nsec, cmp->offset, cmp->skew);
-}
-
 static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 {
 	struct bfin_mac_local *lp = netdev_priv(netdev);
@@ -861,15 +854,9 @@ static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 			regval = bfin_read_EMAC_PTP_TXSNAPLO();
 			regval |= (u64)bfin_read_EMAC_PTP_TXSNAPHI() << 32;
 			memset(&shhwtstamps, 0, sizeof(shhwtstamps));
-			ns = timecounter_cyc2time(&lp->clock,
-					regval);
-			timecompare_update(&lp->compare, ns);
+			ns = regval >> lp->shift;
 			shhwtstamps.hwtstamp = ns_to_ktime(ns);
-			shhwtstamps.syststamp =
-				timecompare_transform(&lp->compare, ns);
 			skb_tstamp_tx(skb, &shhwtstamps);
-
-			bfin_dump_hwtamp("TX", &shhwtstamps.hwtstamp, &shhwtstamps.syststamp, &lp->compare);
 		}
 	}
 }
@@ -892,51 +879,25 @@ static void bfin_rx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 
 	regval = bfin_read_EMAC_PTP_RXSNAPLO();
 	regval |= (u64)bfin_read_EMAC_PTP_RXSNAPHI() << 32;
-	ns = timecounter_cyc2time(&lp->clock, regval);
-	timecompare_update(&lp->compare, ns);
+	ns = regval >> lp->shift;
 	memset(shhwtstamps, 0, sizeof(*shhwtstamps));
 	shhwtstamps->hwtstamp = ns_to_ktime(ns);
-	shhwtstamps->syststamp = timecompare_transform(&lp->compare, ns);
-
-	bfin_dump_hwtamp("RX", &shhwtstamps->hwtstamp, &shhwtstamps->syststamp, &lp->compare);
-}
-
-/*
- * bfin_read_clock - read raw cycle counter (to be used by time counter)
- */
-static cycle_t bfin_read_clock(const struct cyclecounter *tc)
-{
-	u64 stamp;
-
-	stamp =  bfin_read_EMAC_PTP_TIMELO();
-	stamp |= (u64)bfin_read_EMAC_PTP_TIMEHI() << 32ULL;
-
-	return stamp;
 }
 
-#define PTP_CLK 25000000
-
 static void bfin_mac_hwtstamp_init(struct net_device *netdev)
 {
 	struct bfin_mac_local *lp = netdev_priv(netdev);
-	u64 append;
+	u64 addend;
+	u32 input_clk, phc_clk;
 
 	/* Initialize hardware timer */
-	append = PTP_CLK * (1ULL << 32);
-	do_div(append, get_sclk());
-	bfin_write_EMAC_PTP_ADDEND((u32)append);
-
-	memset(&lp->cycles, 0, sizeof(lp->cycles));
-	lp->cycles.read = bfin_read_clock;
-	lp->cycles.mask = CLOCKSOURCE_MASK(64);
-	lp->cycles.mult = 1000000000 / PTP_CLK;
-	lp->cycles.shift = 0;
-
-	/* Synchronize our NIC clock against system wall clock */
-	memset(&lp->compare, 0, sizeof(lp->compare));
-	lp->compare.source = &lp->clock;
-	lp->compare.target = ktime_get_real;
-	lp->compare.num_samples = 10;
+	input_clk = get_sclk();
+	phc_clk = bfin_select_phc_clock(input_clk, &lp->shift);
+	addend = phc_clk * (1ULL << 32);
+	do_div(addend, input_clk);
+	bfin_write_EMAC_PTP_ADDEND((u32)addend);
+
+	lp->addend = addend;
 
 	/* Initialize hwstamp config */
 	lp->stamp_cfg.rx_filter = HWTSTAMP_FILTER_NONE;
diff --git a/drivers/net/ethernet/adi/bfin_mac.h b/drivers/net/ethernet/adi/bfin_mac.h
index 960905c..57f042c 100644
--- a/drivers/net/ethernet/adi/bfin_mac.h
+++ b/drivers/net/ethernet/adi/bfin_mac.h
@@ -11,8 +11,6 @@
 #define _BFIN_MAC_H_
 
 #include <linux/net_tstamp.h>
-#include <linux/clocksource.h>
-#include <linux/timecompare.h>
 #include <linux/timer.h>
 #include <linux/etherdevice.h>
 #include <linux/bfin_mac.h>
@@ -94,9 +92,8 @@ struct bfin_mac_local {
 	struct mii_bus *mii_bus;
 
 #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
-	struct cyclecounter cycles;
-	struct timecounter clock;
-	struct timecompare compare;
+	u32 addend;
+	unsigned int shift;
 	struct hwtstamp_config stamp_cfg;
 #endif
 };
-- 
1.7.2.5

^ 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