Netdev List
 help / color / mirror / Atom feed
* [PATCH v8 46/50] af_packet: virtio 1.0 stubs
From: Michael S. Tsirkin @ 2014-12-01 16:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
	Daniel Borkmann, Hannes Frederic Sowa, Eric Dumazet,
	Atzm Watanabe, Tom Herbert, Willem de Bruijn, netdev
In-Reply-To: <1417449619-24896-1-git-send-email-mst@redhat.com>

This merely fixes sparse warnings, without actually
adding support for the new APIs.

Still working out the best way to enable the new
functionality.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 net/packet/af_packet.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 87d20f4..d4a877e 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2444,13 +2444,15 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
 			goto out_unlock;
 
 		if ((vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
-		    (vnet_hdr.csum_start + vnet_hdr.csum_offset + 2 >
-		      vnet_hdr.hdr_len))
-			vnet_hdr.hdr_len = vnet_hdr.csum_start +
-						 vnet_hdr.csum_offset + 2;
+		    (__virtio16_to_cpu(false, vnet_hdr.csum_start) +
+		     __virtio16_to_cpu(false, vnet_hdr.csum_offset) + 2 >
+		      __virtio16_to_cpu(false, vnet_hdr.hdr_len)))
+			vnet_hdr.hdr_len = __cpu_to_virtio16(false,
+				 __virtio16_to_cpu(false, vnet_hdr.csum_start) +
+				__virtio16_to_cpu(false, vnet_hdr.csum_offset) + 2);
 
 		err = -EINVAL;
-		if (vnet_hdr.hdr_len > len)
+		if (__virtio16_to_cpu(false, vnet_hdr.hdr_len) > len)
 			goto out_unlock;
 
 		if (vnet_hdr.gso_type != VIRTIO_NET_HDR_GSO_NONE) {
@@ -2492,7 +2494,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
 	err = -ENOBUFS;
 	hlen = LL_RESERVED_SPACE(dev);
 	tlen = dev->needed_tailroom;
-	skb = packet_alloc_skb(sk, hlen + tlen, hlen, len, vnet_hdr.hdr_len,
+	skb = packet_alloc_skb(sk, hlen + tlen, hlen, len,
+			       __virtio16_to_cpu(false, vnet_hdr.hdr_len),
 			       msg->msg_flags & MSG_DONTWAIT, &err);
 	if (skb == NULL)
 		goto out_unlock;
@@ -2534,14 +2537,16 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
 
 	if (po->has_vnet_hdr) {
 		if (vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {
-			if (!skb_partial_csum_set(skb, vnet_hdr.csum_start,
-						  vnet_hdr.csum_offset)) {
+			u16 s = __virtio16_to_cpu(false, vnet_hdr.csum_start);
+			u16 o = __virtio16_to_cpu(false, vnet_hdr.csum_offset);
+			if (!skb_partial_csum_set(skb, s, o)) {
 				err = -EINVAL;
 				goto out_free;
 			}
 		}
 
-		skb_shinfo(skb)->gso_size = vnet_hdr.gso_size;
+		skb_shinfo(skb)->gso_size =
+			__virtio16_to_cpu(false, vnet_hdr.gso_size);
 		skb_shinfo(skb)->gso_type = gso_type;
 
 		/* Header must be checked, and gso_segs computed. */
@@ -2912,8 +2917,10 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,
 			struct skb_shared_info *sinfo = skb_shinfo(skb);
 
 			/* This is a hint as to how much should be linear. */
-			vnet_hdr.hdr_len = skb_headlen(skb);
-			vnet_hdr.gso_size = sinfo->gso_size;
+			vnet_hdr.hdr_len =
+				__cpu_to_virtio16(false, skb_headlen(skb));
+			vnet_hdr.gso_size =
+				__cpu_to_virtio16(false, sinfo->gso_size);
 			if (sinfo->gso_type & SKB_GSO_TCPV4)
 				vnet_hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
 			else if (sinfo->gso_type & SKB_GSO_TCPV6)
@@ -2931,8 +2938,10 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,
 
 		if (skb->ip_summed == CHECKSUM_PARTIAL) {
 			vnet_hdr.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
-			vnet_hdr.csum_start = skb_checksum_start_offset(skb);
-			vnet_hdr.csum_offset = skb->csum_offset;
+			vnet_hdr.csum_start = __cpu_to_virtio16(false,
+					  skb_checksum_start_offset(skb));
+			vnet_hdr.csum_offset = __cpu_to_virtio16(false,
+							 skb->csum_offset);
 		} else if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
 			vnet_hdr.flags = VIRTIO_NET_HDR_F_DATA_VALID;
 		} /* else everything is zero */
-- 
MST

^ permalink raw reply related

* [PATCH v8 50/50] virtio: drop VIRTIO_F_VERSION_1 from drivers
From: Michael S. Tsirkin @ 2014-12-01 16:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
	Rusty Russell, Amit Shah, Arnd Bergmann, Greg Kroah-Hartman,
	James E.J. Bottomley, virtualization, netdev, linux-scsi
In-Reply-To: <1417449619-24896-1-git-send-email-mst@redhat.com>

Core activates this bit automatically now,
drop it from drivers that set it explicitly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/block/virtio_blk.c    | 1 -
 drivers/char/virtio_console.c | 1 -
 drivers/net/virtio_net.c      | 1 -
 drivers/scsi/virtio_scsi.c    | 1 -
 4 files changed, 4 deletions(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 1f8b111..1fb9e09 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -836,7 +836,6 @@ static unsigned int features[] = {
 	VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
 	VIRTIO_BLK_F_TOPOLOGY,
 	VIRTIO_BLK_F_MQ,
-	VIRTIO_F_VERSION_1,
 };
 
 static struct virtio_driver virtio_blk = {
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 775c898..6cc832b 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -2130,7 +2130,6 @@ static struct virtio_device_id id_table[] = {
 static unsigned int features[] = {
 	VIRTIO_CONSOLE_F_SIZE,
 	VIRTIO_CONSOLE_F_MULTIPORT,
-	VIRTIO_F_VERSION_1,
 };
 
 static struct virtio_device_id rproc_serial_id_table[] = {
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9ab3c50..b8bd719 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2004,7 +2004,6 @@ static unsigned int features[] = {
 	VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ,
 	VIRTIO_NET_F_CTRL_MAC_ADDR,
 	VIRTIO_F_ANY_LAYOUT,
-	VIRTIO_F_VERSION_1,
 };
 
 static struct virtio_driver virtio_net_driver = {
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index d9ec806..2308278 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -1085,7 +1085,6 @@ static unsigned int features[] = {
 	VIRTIO_SCSI_F_HOTPLUG,
 	VIRTIO_SCSI_F_CHANGE,
 	VIRTIO_SCSI_F_T10_PI,
-	VIRTIO_F_VERSION_1,
 };
 
 static struct virtio_driver virtio_scsi_driver = {
-- 
MST

^ permalink raw reply related

* Re: Is this 32-bit NCM?
From: Enrico Mioso @ 2014-12-01 16:11 UTC (permalink / raw)
  To: Kevin Zhu
  Cc: Alex Strizhevsky, Eli Britstein, linux-usb@vger.kernel.org,
	youtux@gmail.com, Midge Shaojun Tan, netdev@vger.kernel.org,
	Bjørn Mork
In-Reply-To: <547C01DF.8030001@audiocodes.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 7775 bytes --]

thank you.
The interesting thing is that, by the way, I am not even able to use the dongle 
via PPP - it is not relevant, but curious.
Ok - at the moment I don't have other ideas.
I am sorry.

On Mon, 1 Dec 2014, Kevin Zhu wrote:

==Date: Mon, 1 Dec 2014 06:51:31
==From: Kevin Zhu <Mingying.Zhu@audiocodes.com>
==To: Enrico Mioso <mrkiko.rs@gmail.com>
==Cc: Alex Strizhevsky <alexxst@gmail.com>,
==    Eli Britstein <Eli.Britstein@audiocodes.com>,
==    "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
==    "youtux@gmail.com" <youtux@gmail.com>,
==    Midge Shaojun  Tan <ShaojunMidge.Tan@audiocodes.com>,
==    "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
==    Bjørn Mork <bjorn@mork.no>
==Subject: Re: Is this 32-bit NCM?
==
==I'm sorry.
==
==According to the wireshark capture, those packets without NCM signature
==are probably some periodical status checking interrupts. And some other
==packets in the same capture do show the NCM signature. Those packets are
==ping packets.
==
==Regarding the offset and alignment definition, the specification says as
==below:
==
==Alignment requirements are met by controlling the location of the
==payload (the data following the Ether-
==net header in each datagram). This alignment is specified by indicating
==a constraint as a divisor and a
==remainder. The agent formatting a given NTB aligns the payload of each
==datagram by inserting padding,
==such that the offset of each datagram satisfies the constraint:
==
==Offset % wNdpInDivisor == wNdpInPayloadRemainder (for IN datagrams)
==Or
==Offset % wNdpOutDivisor == wNdpOutPayloadRemainder (for OUT datagrams)
==
==
==Regards,
==Kevin
==
==On 12/01/2014 01:28 PM, Enrico Mioso wrote:
==> Sorry.
==> I am a visually impaired person - and use a braille display to read your
==> messages; can't have access to files that don't contain ascii-based content.
==> Sorry Kevin.
==>
==> And thank you for everything. Don't worry about the lateness.
==> It was sunday.
==>
==>
==> On Mon, 1 Dec 2014, Kevin Zhu wrote:
==>
==> ==Date: Mon, 1 Dec 2014 04:14:10
==> ==From: Kevin Zhu <Mingying.Zhu@audiocodes.com>
==> ==To: Enrico Mioso <mrkiko.rs@gmail.com>, Alex Strizhevsky <alexxst@gmail.com>
==> ==Cc: Eli Britstein <Eli.Britstein@audiocodes.com>,
==> ==    "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
==> ==    "youtux@gmail.com" <youtux@gmail.com>,
==> ==    Midge Shaojun  Tan <ShaojunMidge.Tan@audiocodes.com>,
==> ==    "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
==> ==    Bjørn Mork <bjorn@mork.no>
==> ==Subject: Re: Is this 32-bit NCM?
==> ==
==> ==Hi Enrico,
==> ==
==> ==I think those packets are some interrupt status. Please check my capture by
==> ==wireshark.
==> ==
==> ==[IMAGE]
==> ==
==> ==And this is a ping packet from window, which indicates it's an NCM packet.
==> ==
==> ==[IMAGE]
==> ==
==> ==Regards,
==> ==Kevin
==> ==On 11/30/2014 06:39 PM, Enrico Mioso wrote:
==> ==
==> ==My impression guys is that this is not cdc_ncm protocol.
==> ==Look how many short packets you can see in there.
==> ==Without any ncm signature.
==> ==right?
==> ==
==> ==
==> ==On Sun, 30 Nov 2014, Alex Strizhevsky wrote:
==> ==
==> ====Date: Sun, 30 Nov 2014 05:22:20
==> ====From: Alex Strizhevsky <alexxst@gmail.com>
==> ====To: Mrkiko Rs <mrkiko.rs@gmail.com>
==> ====Cc: Eli Britstein <Eli.Britstein@audiocodes.com>, linux-usb@vger.kernel.or
==> ==g,
==> ====    "youtux@gmail.com" <youtux@gmail.com>,
==> ====    Midge Shaojun Tan <ShaojunMidge.Tan@audiocodes.com>,
==> ====    "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
==> ====    Kevin Zhu <Mingying.Zhu@audiocodes.com>, Bjørn Mork <bjorn@mork.no>
==> ====Subject: Re: Is this 32-bit NCM?
==> ====
==> ====
==> ====Hi Enrico,
==> ====
==> ====Actually I have two dongles with different firmwares (23.128.00.00.00 &
==> ====21.286.03.01.209).
==> ====Probably have sent to you the USB  capture with the first one.
==> ====
==> ====In fact we have to make work the second one, this dongle has relevant SW.
==> ====
==> ====On Nov 30, 2014 3:13 AM, "Enrico Mioso" <mrkiko.rs@gmail.com> wrote:
==> ====      Hi guys.
==> ====      Sorry for the late our but ... I was trying to figure out
==> ====      something new about
==> ====      this dongle.
==> ====      I also searched for it in my city shops without finding it
==> ====      actually.
==> ====      But then I came back and ... tried to look at some things.
==> ====
==> ====      Alex, Kevin: in the Windows USB captures you sent me (and that I
==> ====      sent on the
==> ====      List), I can notiche something very strange.
==> ====      with a shell on a computer connected to a test device I can see
==> ====      the following:
==> ====      at+gmr
==> ====      21.286.03.01.209
==> ====      OK
==> ====      and so why in the Windows sniff the dongle answers to the same
==> ====      question
==> ====      something like
==> ====      23.128.00.00.00
==> ====      ?
==> ====      Alex - was it the same dongle?
==> ====      Kevin or anyone: can you use putty to interact with the dongle
==> ====      under Windows
==> ====      and type some commands, like:
==> ====      at+gmr
==> ====      and other similar commands?
==> ====      If the dongle reports different firmware versions under Linux
==> ====      and Windows, then
==> ====      guys... we need to figure out the Windows switch message.
==> ====      Overmore - in the device installation sh*t, you can see there is
==> ====      a firmware
==> ====      updater... Why?
==> ====
==> ====      Alex: I used the
==> ====      at^reset
==> ====      command to get the modem back to normal state once; and so it
==> ====      restored the
==> ====      nvram to default or something.
==> ====      If you reconnect it to windows ... i hope it gets re-setup as
==> ====      before.
==> ====      But - nothing harmful to the device, only to it's settings,
==> ====      sorry.
==> ====      I restored the relevant settings and it connects again, but no
==> ====      dhcp. But - be
==> ====      peaceful: other modems out there seems to not get dhcp anyway.
==> ====      this is the state the modem arrives when you buy it, so windows
==> ====      should know
==> ====      Wwhat To Say To The Modem (TM).
==> ====      Another thing - note that:
==> ====      [14170.048693] cdc_ncm 1-2:1.2: GET_MAX_DATAGRAM_SIZE failed
==> ====
==> ====      Any ideas, comments, suggestions are highly appreciated guys.
==> ====      Of any type.
==> ====
==> ====      Bjorn - unfortunately it seems this problem is related to E3727
==> ====      and E3276
==> ====      sticks; they can get IP from DHCP but not go ahead.
==> ====
==> ====
==> ====
==> ==
==> ==
==> ==This email and any files transmitted with it are confidential material. They
==> ==are intended solely for the use of the designated individual or entity to
==> ==whom they are addressed. If the reader of this message is not the intended
==> ==recipient, you are hereby notified that any dissemination, use, distribution
==> ==or copying of this communication is strictly prohibited and may be unlawful.
==> ==
==> ==If you have received this email in error please immediately notify the
==> ==sender and delete or destroy any copy of this message
==> ==
==This email and any files transmitted with it are confidential material. They are intended solely for the use of the designated individual or entity to whom they are addressed. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful.
==
==If you have received this email in error please immediately notify the sender and delete or destroy any copy of this message
==

^ permalink raw reply

* Re: [PATCH v2 11/19] selftests/memory-hotplug: add install target to enable installing test
From: Shuah Khan @ 2014-12-01 16:12 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
	hughd, bobby.prani, ebiederm, serge.hallyn, linux-kbuild,
	linux-kernel, linux-api, netdev, yrl.pp-manager.tt@hitachi.com,
	Shuah Khan
In-Reply-To: <5476BB87.6010808@hitachi.com>

On 11/26/2014 10:49 PM, Masami Hiramatsu wrote:
> (2014/11/12 5:27), Shuah Khan wrote:
>> Add a new make target to enable installing test. This target
>> installs test in the kselftest install location and add to the
>> kselftest script to run the test. Install target can be run
>> only from top level source dir.
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  tools/testing/selftests/memory-hotplug/Makefile    |  17 +-
>>  .../selftests/memory-hotplug/mem-on-off-test.sh    | 238 +++++++++++++++++++++
>>  .../selftests/memory-hotplug/on-off-test.sh        | 238 ---------------------
>>  3 files changed, 253 insertions(+), 240 deletions(-)
>>  create mode 100644 tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
>>  delete mode 100644 tools/testing/selftests/memory-hotplug/on-off-test.sh
>>
>> diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile
>> index d46b8d4..8921631 100644
>> --- a/tools/testing/selftests/memory-hotplug/Makefile
>> +++ b/tools/testing/selftests/memory-hotplug/Makefile
>> @@ -1,9 +1,22 @@
>> +TEST_STR=/bin/bash ./mem-on-off-test.sh -r 2 || echo memory-hotplug selftests: [FAIL]
>> +
>>  all:
>>  
>> +install:
>> +ifdef INSTALL_KSFT_PATH
>> +	install ./mem-on-off-test.sh $(INSTALL_KSFT_PATH)/mem-on-off-test.sh
>> +	@echo echo Start memory hotplug test .... >> $(KSELFTEST)
>> +	@echo "$(TEST_STR)" >> $(KSELFTEST) >> $(KSELFTEST)
>> +	@echo echo End memory hotplug test .... >> $(KSELFTEST)
>> +	@echo echo ============================== >> $(KSELFTEST)
>> +else
>> +	@echo Run make kselftest_install in top level source directory
>> +endif
> 
> I saw this pattern repeated many times in this series.
> Can we make it a macro and include it instead of repeating this code?
> 

I might be able to move this to the selftest Makfile and use target as the
string. I will play with it and see if I can reduce the duplication further.

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

^ permalink raw reply

* Re: [PATCH v2 03/19] selftests: add install target to enable installing selftests
From: Shuah Khan @ 2014-12-01 16:16 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
	hughd, bobby.prani, ebiederm, serge.hallyn, linux-kbuild,
	linux-kernel, linux-api, netdev, yrl.pp-manager.tt@hitachi.com,
	Shuah Khan
In-Reply-To: <5476BA67.6020305@hitachi.com>

On 11/26/2014 10:45 PM, Masami Hiramatsu wrote:
> (2014/11/12 5:27), Shuah Khan wrote:
>> Add a new make target to enable installing selftests. This
>> new target will call install targets for the tests that are
>> specified in INSTALL_TARGETS. During install, a script is
>> generated to run tests that are installed. This script will
>> be installed in the selftest install directory. Individual
>> test Makefiles are changed to add to the script. This will
>> allow new tests to add install and run test commands to the
>> generated kselftest script. run_tests target runs the
>> generated kselftest script to run tests when it is initiated
>> from from "make kselftest" from top level source directory.
>>
>> Approach:
>>
>> make kselftest_target:
>> -- exports kselftest INSTALL_KSFT_PATH
>>    default $(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
>> -- exports path for ksefltest.sh
>> -- runs selftests make install target:
>>
>> selftests make install target
>> -- creates kselftest.sh script in install install dir
>> -- runs install targets for all INSTALL_TARGETS
>>    (Note: ftrace and powerpc aren't included in INSTALL_TARGETS,
>>           to not add more content to patch v1 series. This work
>>           will happen soon. In this series these two targets are
>>           run after running the generated kselftest script, without
>>           any regression in the way these tests are run with
>>           "make kselftest" prior to this work.)
>> -- install target can be run only from top level source dir.
>>
>> Individual test make install targets:
>> -- install test programs and/or scripts in install dir
>> -- append to the ksefltest.sh file to add commands to run test
>> -- install target can be run only from top level source dir.
>>
>> Adds the following new ways to initiate selftests:
>> -- Installing and running kselftest from install directory
>>    by running  "make kselftest"
>> -- Running kselftest script from install directory
>>
>> Maintains the following ways to run tests:
>> -- make -C tools/testing/selftests run_tests
>> -- make -C tools/testing/selftests TARGETS=target run_tests
>>    Ability specify targets: e.g TARGETS=net
>> -- make run_tests from tools/testing/selftests
>> -- make run_tests from individual test directories:
>>    e.g: make run_tests in tools/testing/selftests/breakpoints
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  tools/testing/selftests/Makefile | 31 ++++++++++++++++++++++++++++++-
>>  1 file changed, 30 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
>> index 45f145c..b9bdc1d 100644
>> --- a/tools/testing/selftests/Makefile
>> +++ b/tools/testing/selftests/Makefile
>> @@ -16,6 +16,10 @@ TARGETS += sysctl
>>  TARGETS += firmware
>>  TARGETS += ftrace
>>  
>> +INSTALL_TARGETS = breakpoints cpu-hotplug efivarfs firmware ipc
>> +INSTALL_TARGETS += kcmp memfd memory-hotplug mqueue mount net
>> +INSTALL_TARGETS += ptrace sysctl timers user vm
>> +
>>  TARGETS_HOTPLUG = cpu-hotplug
>>  TARGETS_HOTPLUG += memory-hotplug
>>  
> 
> I think KSELFTEST itself should be defined here, since that is not
> a parameter.

I can do that.

> 
>> @@ -24,10 +28,35 @@ all:
>>  		make -C $$TARGET; \
>>  	done;
>>  
>> -run_tests: all
>> +install:
>> +ifdef INSTALL_KSFT_PATH
>> +	make all
>> +	@echo #!/bin/sh\n# Kselftest Run Tests .... >> $(KSELFTEST)
>> +	@echo # This file is generated during kselftest_install >> $(KSELFTEST)
>> +	@echo # Please don't change it !!\n  >> $(KSELFTEST)
>> +	@echo echo ============================== >> $(KSELFTEST)
>> +	for TARGET in $(INSTALL_TARGETS); do \
>> +		echo Installing $$TARGET; \
>> +		make -C $$TARGET install; \
> 
> Please pass O= option and others here.

I will change that.

> 
>> +	done;
>> +	chmod +x $(KSELFTEST)
>> +else
>> +	@echo Run make kselftest_install in top level source directory
>> +endif
>> +
>> +run_tests:
>> +ifdef INSTALL_KSFT_PATH
>> +	@cd $(INSTALL_KSFT_PATH); ./kselftest.sh; cd -
> 
> We'd better use some macro instead of ./kselftest.sh?
> 

I can play with this and see if there is a better way.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

^ permalink raw reply

* Re: [PATCH v2 02/19] kbuild: kselftest_install - add a new make target to install selftests
From: Shuah Khan @ 2014-12-01 16:27 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: gregkh, akpm, mmarek, davem, keescook, tranmanphong, dh.herrmann,
	hughd, bobby.prani, ebiederm, serge.hallyn, linux-kbuild,
	linux-kernel, linux-api, netdev, Shuah Khan
In-Reply-To: <5476B763.1030701@hitachi.com>

On 11/26/2014 10:32 PM, Masami Hiramatsu wrote:
> (2014/11/12 5:27), Shuah Khan wrote:
>> Add a new make target to install to install kernel selftests.
>> This new target will build and install selftests. kselftest
>> target now depends on kselftest_install and runs the generated
>> kselftest script to reduce duplicate work and for common look
>> and feel when running tests.
>>
>> Approach:
>>
>> make kselftest_target:
> 
> kselftest_install?

Thanks for catching this. Will fix it.

> 
>> -- exports kselftest INSTALL_KSFT_PATH
>>    default $(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
>> -- exports path for ksefltest.sh
>> -- runs selftests make install target:
> 
> This direction is OK to me.
> 
> BTW, I've found another path to make selftest in Makefile,
> Actually you can do
> 
> make -C tools/ selftest
> 
> And there are selftest_install and selftest_clean targets (but
> currently it has a bug and doesn't work, anyway)

Thanks for pointing this out. I didn't know this existed. kind of
hidden.

> 
> I think we'd better do subdir make instead of adding these targets.
> This means that "make kselftest*" should be an alias of "make -C tools/ selftest*"
> 

Yes that would be a good way to go and helps leverage these options
at tools/Makefile level.

> Also, I'd like to request passing some options like as O=$(objtree)
> so that we can make test kmodules in selftests.

Sounds good. I will look into it.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

^ permalink raw reply

* Re: [PATCH v2 02/19] kbuild: kselftest_install - add a new make target to install selftests
From: Shuah Khan @ 2014-12-01 16:39 UTC (permalink / raw)
  To: Michal Marek, gregkh, akpm, davem, keescook, tranmanphong,
	dh.herrmann, hughd, bobby.prani, ebiederm, serge.hallyn
  Cc: linux-kbuild, linux-kernel, linux-api, netdev,
	masami.hiramatsu.pt@hitachi.com >> Masami Hiramatsu,
	Shuah Khan
In-Reply-To: <547C8D81.1030605@suse.cz>

On 12/01/2014 08:47 AM, Michal Marek wrote:
> On 2014-11-11 21:27, Shuah Khan wrote:
>> Add a new make target to install to install kernel selftests.
>> This new target will build and install selftests. kselftest
>> target now depends on kselftest_install and runs the generated
>> kselftest script to reduce duplicate work and for common look
>> and feel when running tests.
>>
>> Approach:
>>
>> make kselftest_target:
>> -- exports kselftest INSTALL_KSFT_PATH
>>    default $(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
>> -- exports path for ksefltest.sh
>> -- runs selftests make install target:
>>
>> selftests make install target
>> -- creates kselftest.sh script in install install dir
>> -- runs install targets for all INSTALL_TARGETS
>>    (Note: ftrace and powerpc aren't included in INSTALL_TARGETS,
>>           to not add more content to patch v1 series. This work
>>           will happen soon. In this series these two targets are
>>           run after running the generated kselftest script, without
>>           any regression in the way these tests are run with
>>           "make kselftest" prior to this work.)
>> -- install target can be run only from top level source dir.
>>
>> Individual test make install targets:
>> -- install test programs and/or scripts in install dir
>> -- append to the ksefltest.sh file to add commands to run test
>> -- install target can be run only from top level source dir.
>>
>> Adds the following new ways to initiate selftests:
>> -- Installing and running kselftest from install directory
>>    by running  "make kselftest"
>> -- Running kselftest script from install directory
>>
>> Maintains the following ways to run tests:
>> -- make -C tools/testing/selftests run_tests
>> -- make -C tools/testing/selftests TARGETS=target run_tests
>>    Ability specify targets: e.g TARGETS=net
>> -- make run_tests from tools/testing/selftests
>> -- make run_tests from individual test directories:
>>    e.g: make run_tests in tools/testing/selftests/breakpoints
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  Makefile | 21 +++++++++++++++++++--
>>  1 file changed, 19 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 05d67af..ccbd2e1 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -1071,12 +1071,26 @@ headers_check: headers_install
>>  	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) HDRCHECK=1
>>  
>>  # ---------------------------------------------------------------------------
>> -# Kernel selftest
>> +# Kernel selftest targets
>> +
>> +PHONY += __kselftest_configure
>> +INSTALL_KSFT_PATH=$(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
>> +export INSTALL_KSFT_PATH
>> +KSELFTEST=$(INSTALL_KSFT_PATH)/kselftest.sh
>> +export KSELFTEST
> 
> Can this be moved to tools/testing/selftests/Makefile? It's only used in
> this part of the tree.

I looked into doing that. KERNELRELEASE will have to be exported for
tools/testing/selftests/Makefile to use it? Does that sound okay?

> 
> 
>>  PHONY += kselftest
>> -kselftest:
>> +kselftest: kselftest_install
>>  	$(Q)$(MAKE) -C tools/testing/selftests run_tests
>>  
>> +# Kernel selftest install
>> +
>> +PHONY += kselftest_install
>> +kselftest_install: __kselftest_configure
>> +	@rm -rf $(INSTALL_KSFT_PATH)
>> +	@mkdir -p $(INSTALL_KSFT_PATH)
> 
> Please use $(Q) insteaf od hardcoding the @.

I can do that.

> 
> 
>> +	$(Q)$(MAKE) -C tools/testing/selftests install
> 
> The install target is only added by the next patch, which in turn
> depends on changes done by later patches. The order (in the current
> numbering) should be 01/19, 04/19, ... 19/19, 03/19 and 02/19.
> 

Right. I can re-order the patches in my next version and make other
changes you recommended.

Also, it might be easier to get this series in, if you can Ack the main
Makefile patch (when we are ready i.e), so I can take it through
kselftest tree.

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

^ permalink raw reply

* Re: [bisected] xfrm: TCP connection initiating PMTU discovery stalls on v3.12+
From: Wolfgang Walter @ 2014-12-01 16:41 UTC (permalink / raw)
  To: Thomas Jarosch; +Cc: netdev, Eric Dumazet
In-Reply-To: <2335530.7OPnEQXbmV@h2o.as.studentenwerk.mhn.de>

Am Montag, 1. Dezember 2014, 14:17:28 schrieb Wolfgang Walter:
> Am Samstag, 29. November 2014, 12:44:07 schrieb Thomas Jarosch:
> > Hello,
> > 
> > we're in the process of updating production level machines
> > from kernel 3.4.101 to kernel 3.14.25. On one mail server
> > we noticed that emails destined for an IPSec tunnel sometimes
> > get stuck in the mail queue with TCP timeouts.
> > 
> > To make a long story short: When the VPN connection is initially
> > set up or re-newed, the path MTU for the xfrm tunnel is undetermined.
> > 
> > As soon as a TCP client starts to send large packets,
> > it triggers path MTU detection. Some middlebox on the
> > way to the final server has a lower MTU and sends back
> > an "ICMP fragmentation needed" packet as normal.
> > 
> > With the old kernel, the packet size for the TCP connection inside
> > the xfrm tunnel gets adjusted and all is fine. With kernel v3.12+,
> > the connection stalls completely. Same thing with kernel v3.18-rc6.
> 
> We see something similar with real nic (RTL8139). In our case only the first
> tcp-connection which triggers PMTU stalls. Later tcp-connections then work
> fine.
> 
> I will revert that patch and see if that fixes the problem.


Reverting the commit fixes the problem here, too.


> 
> > We wrote a small tool to mimic postfix's TCP behavior (see attached file).
> > In the end it's a normal TCP client sending large packets.
> > The server side is just "socat - tcp4-listen:667".
> > 
> > If you run "socket_client" a second time, the path MTU
> > for the xfrm tunnel is already known and packets flow normal, too.
> > 
> > 
> > The "evil" commit in question is this one:
> > ---------------------------------------------------------------------
> > commit 8f26fb1c1ed81c33f5d87c5936f4d9d1b4118918
> > Author: Eric Dumazet <edumazet@google.com>
> > Date:   Tue Oct 15 12:24:54 2013 -0700
> > 
> >     tcp: remove the sk_can_gso() check from tcp_set_skb_tso_segs()
> >     
> >     sk_can_gso() should only be used as a hint in tcp_sendmsg() to build
> >     GSO
> > 
> > packets in the first place. (As a performance hint)
> > 
> >     Once we have GSO packets in write queue, we can not decide they are no
> >     longer GSO only because flow now uses a route which doesn't handle
> >     TSO/GSO.
> >     
> >     Core networking stack handles the case very well for us, all we need
> >     is keeping track of packet counts in MSS terms, regardless of
> >     segmentation done later (in GSO or hardware)
> >     
> >     Right now, if  tcp_fragment() splits a GSO packet in two parts,
> >     @left and @right, and route changed through a non GSO device,
> >     both @left and @right have pcount set to 1, which is wrong,
> >     and leads to incorrect packet_count tracking.
> >     
> >     This problem was added in commit d5ac99a648 ("[TCP]: skb pcount with
> >     MTU
> > 
> > discovery")
> > 
> >     Signed-off-by: Eric Dumazet <edumazet@google.com>
> >     Signed-off-by: Neal Cardwell <ncardwell@google.com>
> >     Signed-off-by: Yuchung Cheng <ycheng@google.com>
> >     Reported-by: Maciej Żenczykowski <maze@google.com>
> >     Signed-off-by: David S. Miller <davem@davemloft.net>
> > 
> > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> > index 8fad1c1..d46f214 100644
> > --- a/net/ipv4/tcp_output.c
> > +++ b/net/ipv4/tcp_output.c
> > @@ -989,8 +989,7 @@ static void tcp_set_skb_tso_segs(const struct sock
> > *sk,
> > struct sk_buff *skb, /* Make sure we own this skb before messing
> > gso_size/gso_segs */ WARN_ON_ONCE(skb_cloned(skb));
> > 
> > -       if (skb->len <= mss_now || !sk_can_gso(sk) ||
> > -           skb->ip_summed == CHECKSUM_NONE) {
> > +       if (skb->len <= mss_now || skb->ip_summed == CHECKSUM_NONE) {
> > 
> >                 /* Avoid the costly divide in the normal
> >                 
> >                  * non-TSO case.
> >                  */
> > 
> > ---------------------------------------------------------------------
> > 
> > When I revert it, even kernel v3.18-rc6 starts working.
> > But I doubt this is the root problem, may be just hiding another issue.
> > 
> > --- Sample output of socket_client using vanilla v3.12 kernel ---
> > [1417258063 SEND result: 4096, strerror: Success]
> > tcp max seg: res: 0, max_seg: 1370
> > [1417258063 SEND result: 4096, strerror: Success]
> > tcp max seg: res: 0, max_seg: 1370
> > [1417258063 SEND result: 4096, strerror: Success]
> > tcp max seg: res: 0, max_seg: 1370
> > [1417258063 SEND result: 4096, strerror: Success]
> > tcp max seg: res: 0, max_seg: 1370
> > [1417258063 SEND result: 4096, strerror: Success]
> > tcp max seg: res: 0, max_seg: 1338
> > [1417258063 SEND result: 4096, strerror: Success]
> > tcp max seg: res: 0, max_seg: 1338
> > *STUCK*
> > --------------------------------------------------------
> > 
> > The "machine" is running on KVM and using "virtio_net" as NIC driver.
> > I've played with the ethtool offload settings:
> > 
> > *** eth1 defaults ***
> > Offload parameters for eth1:
> > rx-checksumming: on
> > tx-checksumming: on
> > scatter-gather: on
> > tcp-segmentation-offload: on
> > udp-fragmentation-offload: on
> > generic-segmentation-offload: on
> > generic-receive-offload: on
> > large-receive-offload: off
> > 
> > *** eth1 working (no stalls) using vanilla kernel ***
> > Offload parameters for eth1:
> > rx-checksumming: on
> > tx-checksumming: off  <-- the magic switch
> > scatter-gather: off
> > tcp-segmentation-offload: off
> > udp-fragmentation-offload: off
> > generic-segmentation-offload: off
> > generic-receive-offload: off
> > large-receive-offload: off
> > 
> > When I turn "tx-checksumming" back on, it fails again.
> > Though that is probably also just a side effect.
> > 
> > I can provide tcpdumps if needed but they are no real help
> > since you can just see the kernel stops sending TCP packets.
> > (and the outgoing TCP packets are encrypted in ESP packets)
> > 
> > 
> > Any vague idea what might be the root cause?
> > 
> > I also tried reverting commit 4d53eff48b5f03ce67f4f301d6acca1d2145cb7a
> > ("xfrm: Don't queue retransmitted packets if the original is still on the
> > host") but that didn't change the situation. In fact it wasn't even
> > triggered.
> > 
> > Please CC: comments. Thanks.
> > 
> > Best regards,
> > Thomas
> 
> Regards,

Regards,
-- 
Wolfgang Walter
Studentenwerk München
Anstalt des öffentlichen Rechts

^ permalink raw reply

* Re: Is this 32-bit NCM?
From: Enrico Mioso @ 2014-12-01 16:54 UTC (permalink / raw)
  To: Kevin Zhu
  Cc: Alex Strizhevsky, Bjørn Mork, Midge Shaojun Tan,
	youtux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Eli Britstein
In-Reply-To: <54783F18.1070709-6C2+4RG2qWF0ubjbjo6WXg@public.gmane.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2181 bytes --]

Evne to thank you for giving me a test device / shell, I am now modifying 
thedriver to be extra debug-ful. I don't know where exactly this will lead if 
anywhere, and really have no clue of whatto do next, since all seems normal. 
But at least I'll have a clue of what happens.


On Fri, 28 Nov 2014, Kevin Zhu wrote:

==Date: Fri, 28 Nov 2014 10:23:43
==From: Kevin Zhu <Mingying.Zhu-6C2+4RG2qWF0ubjbjo6WXg@public.gmane.org>
==To: Enrico Mioso <mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
==Cc: Alex Strizhevsky <alexxst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>,
==    Midge Shaojun  Tan <ShaojunMidge.Tan-6C2+4RG2qWF0ubjbjo6WXg@public.gmane.org>,
==    "youtux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <youtux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
==    "linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
==    "netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
==    Eli Britstein <Eli.Britstein-6C2+4RG2qWF0ubjbjo6WXg@public.gmane.org>
==Subject: Re: Is this 32-bit NCM?
==
==Yes. The MACs are right. When I started Wireshark, promisc mode was set.
==
==Regards,
==Kevin
==
==On 11/28/2014 05:17 PM, Enrico Mioso wrote:
==> Sorry - resending message to all.
==> Is the MAC right? In my case it was, but ... you never know.
==> And - have you tried the promisc mode, just in case... don't know if this might
==> even be implementedi n the driver, think not, but...
==> I don't know what to think anymore.
==> this ARP packet seems the same as with windows... but might be it's only my
==> impression.
==This email and any files transmitted with it are confidential material. They are intended solely for the use of the designated individual or entity to whom they are addressed. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful.
==
==If you have received this email in error please immediately notify the sender and delete or destroy any copy of this message
==

^ permalink raw reply

* Re: [PATCH 1/3] net-PPP: Deletion of unnecessary checks before the function call "kfree"
From: Sergei Shtylyov @ 2014-12-01 17:11 UTC (permalink / raw)
  To: SF Markus Elfring, Paul Mackerras, linux-ppp, netdev
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <547C82A6.2030808@users.sourceforge.net>

On 12/01/2014 06:00 PM, SF Markus Elfring wrote:

>>> diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp/ppp_mppe.c
>>> index 911b216..7e44212 100644
>>> --- a/drivers/net/ppp/ppp_mppe.c
>>> +++ b/drivers/net/ppp/ppp_mppe.c
>>> @@ -238,8 +238,7 @@ static void *mppe_alloc(unsigned char *options, int optlen)
>>>        return (void *)state;
>>>
>>>        out_free:
>>> -        if (state->sha1_digest)
>>> -        kfree(state->sha1_digest);
>>> +    kfree(state->sha1_digest);

>>     Please keep this line aligned to the others.

> Can it be that the previous source code contained unwanted space
> characters at this place?

    Yes, it seems so.

> Do you want indentation fixes as a separate update step?

    Yes, that would be better to keep it separate.

> Regards,
> Markus

WBR, Sergei

^ permalink raw reply

* Re: [PATCH net-next] test: bpf: expand DIV_KX to DIV_MOD_KX
From: Alexei Starovoitov @ 2014-12-01 17:44 UTC (permalink / raw)
  To: Denis Kirjanov, Daniel Borkmann; +Cc: Network Development

On Mon, Dec 1, 2014 at 2:12 AM, Denis Kirjanov <kda@linux-powerpc.org> wrote:
> Expand DIV_KX to use BPF_MOD operation in the
> DIV_KX bpf 'classic' test.
>
> CC: Alexei Starovoitov <ast@plumgrid.com>
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>

Increases test coverage. Makes sense. Thanks
Acked-by: Alexei Starovoitov <ast@plumgrid.com>

> ---
>  lib/test_bpf.c |   10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/lib/test_bpf.c b/lib/test_bpf.c
> index 3f167d2..80d78c5 100644
> --- a/lib/test_bpf.c
> +++ b/lib/test_bpf.c
> @@ -124,7 +124,7 @@ static struct bpf_test tests[] = {
>                 { { 0, 0xfffffffd } }
>         },
>         {
> -               "DIV_KX",
> +               "DIV_MOD_KX",
>                 .u.insns = {
>                         BPF_STMT(BPF_LD | BPF_IMM, 8),
>                         BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 2),
> @@ -134,12 +134,18 @@ static struct bpf_test tests[] = {
>                         BPF_STMT(BPF_MISC | BPF_TAX, 0),
>                         BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
>                         BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 0x70000000),
> +                       BPF_STMT(BPF_MISC | BPF_TAX, 0),
> +                       BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
> +                       BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0),
> +                       BPF_STMT(BPF_MISC | BPF_TAX, 0),
> +                       BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
> +                       BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x70000000),
>                         BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
>                         BPF_STMT(BPF_RET | BPF_A, 0)
>                 },
>                 CLASSIC | FLAG_NO_DATA,
>                 { },
> -               { { 0, 0x40000001 } }
> +               { { 0, 0x20000000 } }
>         },
>         {
>                 "AND_OR_LSH_K",
> --
> 1.7.10.4
>

^ permalink raw reply

* RE: [linux-nics] [PATCH] e1000: remove unused variables
From: Fujinaka, Todd @ 2014-12-01 18:56 UTC (permalink / raw)
  To: Sudip Mukherjee, Ben Hutchings
  Cc: Linux NICS, e1000-devel@lists.sourceforge.net, Hisashi T Fujinaka,
	Vick, Matthew, Greg@isotope.jf.intel.com, Kirsher, Jeffrey T,
	netdev@vger.kernel.org, Wyborny, Carolyn,
	John@isotope.jf.intel.com, linux-kernel@vger.kernel.org
In-Reply-To: <20141201045446.GA3277@sudip-PC>

After discussing this locally, I'd like to NAK it because this could cause regressions to parts that are still in use but we don't have access to. Also, the assignment was necessary in the past for some versions of gcc and since this may be used in embedded systems using older compilers, we should leave it be.

Thanks.

Todd Fujinaka
Software Application Engineer
Networking Division (ND)
Intel Corporation
todd.fujinaka@intel.com
(503) 712-4565

-----Original Message-----
From: linux-nics-bounces@isotope.jf.intel.com [mailto:linux-nics-bounces@isotope.jf.intel.com] On Behalf Of Sudip Mukherjee
Sent: Sunday, November 30, 2014 8:55 PM
To: Ben Hutchings
Cc: Linux NICS; e1000-devel@lists.sourceforge.net; Hisashi T Fujinaka; Vick, Matthew; Greg@isotope.jf.intel.com; Kirsher, Jeffrey T; netdev@vger.kernel.org; Wyborny, Carolyn; John@isotope.jf.intel.com; linux-kernel@vger.kernel.org
Subject: Re: [linux-nics] [PATCH] e1000: remove unused variables

On Sun, Nov 30, 2014 at 01:45:13AM +0000, Ben Hutchings wrote:
> On Wed, 2014-11-26 at 21:59 -0800, Hisashi T Fujinaka wrote:
> > I'm pretty sure those double reads are there for a reason, so most 
> > of this I'm going to have to check on Monday. We have a long holiday 
> > weekend here in the US.
> [...]
> 
> If there were double register reads being replaced with single 
> register reads, I'd agree this was likely to introduce a regression.  
> But all I see is var = er32(REG) being changed to er32(REG).

no, double register reads are not modified. only the unused variables are removed.

thanks
sudip

> 
> Ben.
> 
> --
> Ben Hutchings
> The world is coming to an end.	Please log off.


_______________________________________________
Linux-nics mailing list
Linux-nics@intel.com

^ permalink raw reply

* RE: [PATCH v2] Add support of Cavium Liquidio ethernet adapters
From: Vatsavayi, Raghu @ 2014-12-01 19:57 UTC (permalink / raw)
  To: David Miller, f.fainelli@gmail.com
  Cc: netdev@vger.kernel.org, Chickles, Derek, Burla, Satananda,
	Manlunas, Felix
In-Reply-To: <20141124.160837.1008717214755094566.davem@davemloft.net>


> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Monday, November 24, 2014 1:09 PM
> To: f.fainelli@gmail.com
> Cc: Vatsavayi, Raghu; netdev@vger.kernel.org; Chickles, Derek; Burla,
> Satananda; Manlunas, Felix; Vatsavayi, Raghu
> Subject: Re: [PATCH v2] Add support of Cavium Liquidio ethernet adapters
> 
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Mon, 24 Nov 2014 13:01:06 -0800
> 
> > On 11/23/2014 07:19 PM, Raghu Vatsavayi wrote:
> >> +if LIQUIDIO
> >> +
> >> +config LIQUIDIO_NAPI
> >> +	bool "Enable NAPI for LiquidIO"
> >> +	default y
> >> +	---help---
> >> +	  NAPI is a new driver API designed to reduce CPU and interrupt load
> >> +	  when the driver is receiving lots of packets from the card. You
> >> +	  would only disable this feature in very specific instances, like
> >> +	  an application that very rapidly sets up and tears down connections.
> >> +
> >> +	  If in doubt, say Y.
> >
> > You probably do not want to offer a non-NAPI variant, pretty much all
> > drivers have NAPI built-in now.
> 
> +1.
> 
> >> +config LIQUIDIO_DEBUG
> >> +	int "Debug level for LiquidIO"
> >> +	range 0 4
> >> +	default 0
> >
> > This should be moved to dynamic_debug/ethtools' msglvl control knob.
> 
> +1

Thanks for the comments. We are in the process of removing Kconfig based non-NAPI
selection and enabling NAPI by default. We are also removing  separate debug section
and integrating it with ethtool based msglvl debug infrastructure. Additionally we are
planning to clean up non-kerneldoc style comments.

Regards
Raghu

^ permalink raw reply

* Re: [PATCH] wireless/p54: Remove duplicated net2280 header
From: John W. Linville @ 2014-12-01 19:59 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado
  Cc: Christian Lamparter, LKML, linux-wireless, netdev, David Miller
In-Reply-To: <CAPybu_1LBqp5JKBUr85HWfkcSJH5vy2zY9Z13Xvw7W1xyjKOzg@mail.gmail.com>

Did you check the wireless-next tree's git logs?

commit a831f20b6d6460640b83644d1c1df6e7e8ca9f68
Author: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Date:   Mon Nov 24 11:19:51 2014 +0100

    wireless/p54: Remove duplicated net2280 header
    
    The usb gadget driver net2280 has exported a header file with the
    register definition of the net2280 chip.
    
    Remove the custom/duplicated header file in favor of that header file
    in include/linux
    
    Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>

On Mon, Dec 01, 2014 at 11:46:43AM +0100, Ricardo Ribalda Delgado wrote:
> David Miller has marked the patch as "Awaiting Upstream", which I
> think means that it should be merged through the wireless tree.
> 
> Any comment from there?
> 
> On Mon, Nov 24, 2014 at 11:19 AM, Ricardo Ribalda Delgado
> <ricardo.ribalda@gmail.com> wrote:
> > The usb gadget driver net2280 has exported a header file with the
> > register definition of the net2280 chip.
> >
> > Remove the custom/duplicated header file in favor of that header file
> > in include/linux
> >
> > Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> > ---
> >  drivers/net/wireless/p54/net2280.h | 451 -------------------------------------
> >  drivers/net/wireless/p54/p54usb.h  |  13 +-
> >  2 files changed, 12 insertions(+), 452 deletions(-)
> >  delete mode 100644 drivers/net/wireless/p54/net2280.h
> >
> > diff --git a/drivers/net/wireless/p54/net2280.h b/drivers/net/wireless/p54/net2280.h
> > deleted file mode 100644
> > index aedfaf2..0000000
> > --- a/drivers/net/wireless/p54/net2280.h
> > +++ /dev/null
> > @@ -1,451 +0,0 @@
> > -#ifndef NET2280_H
> > -#define NET2280_H
> > -/*
> > - * NetChip 2280 high/full speed USB device controller.
> > - * Unlike many such controllers, this one talks PCI.
> > - */
> > -
> > -/*
> > - * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
> > - * Copyright (C) 2003 David Brownell
> > - *
> > - * 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, see <http://www.gnu.org/licenses/>.
> > - */
> > -
> > -/*-------------------------------------------------------------------------*/
> > -
> > -/* NET2280 MEMORY MAPPED REGISTERS
> > - *
> > - * The register layout came from the chip documentation, and the bit
> > - * number definitions were extracted from chip specification.
> > - *
> > - * Use the shift operator ('<<') to build bit masks, with readl/writel
> > - * to access the registers through PCI.
> > - */
> > -
> > -/* main registers, BAR0 + 0x0000 */
> > -struct net2280_regs {
> > -       /* offset 0x0000 */
> > -       __le32                  devinit;
> > -#define LOCAL_CLOCK_FREQUENCY                                  8
> > -#define FORCE_PCI_RESET                                                7
> > -#define PCI_ID                                                 6
> > -#define PCI_ENABLE                                             5
> > -#define FIFO_SOFT_RESET                                                4
> > -#define CFG_SOFT_RESET                                         3
> > -#define PCI_SOFT_RESET                                         2
> > -#define USB_SOFT_RESET                                         1
> > -#define M8051_RESET                                            0
> > -       __le32                  eectl;
> > -#define EEPROM_ADDRESS_WIDTH                                   23
> > -#define EEPROM_CHIP_SELECT_ACTIVE                              22
> > -#define EEPROM_PRESENT                                         21
> > -#define EEPROM_VALID                                           20
> > -#define EEPROM_BUSY                                            19
> > -#define EEPROM_CHIP_SELECT_ENABLE                              18
> > -#define EEPROM_BYTE_READ_START                                 17
> > -#define EEPROM_BYTE_WRITE_START                                        16
> > -#define EEPROM_READ_DATA                                       8
> > -#define EEPROM_WRITE_DATA                                      0
> > -       __le32                  eeclkfreq;
> > -       u32                     _unused0;
> > -       /* offset 0x0010 */
> > -
> > -       __le32                  pciirqenb0;     /* interrupt PCI master ... */
> > -#define SETUP_PACKET_INTERRUPT_ENABLE                          7
> > -#define ENDPOINT_F_INTERRUPT_ENABLE                            6
> > -#define ENDPOINT_E_INTERRUPT_ENABLE                            5
> > -#define ENDPOINT_D_INTERRUPT_ENABLE                            4
> > -#define ENDPOINT_C_INTERRUPT_ENABLE                            3
> > -#define ENDPOINT_B_INTERRUPT_ENABLE                            2
> > -#define ENDPOINT_A_INTERRUPT_ENABLE                            1
> > -#define ENDPOINT_0_INTERRUPT_ENABLE                            0
> > -       __le32                  pciirqenb1;
> > -#define PCI_INTERRUPT_ENABLE                                   31
> > -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE                    27
> > -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE                   26
> > -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE                      25
> > -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE             20
> > -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE             19
> > -#define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE             18
> > -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE                       17
> > -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE                 16
> > -#define GPIO_INTERRUPT_ENABLE                                  13
> > -#define DMA_D_INTERRUPT_ENABLE                                 12
> > -#define DMA_C_INTERRUPT_ENABLE                                 11
> > -#define DMA_B_INTERRUPT_ENABLE                                 10
> > -#define DMA_A_INTERRUPT_ENABLE                                 9
> > -#define EEPROM_DONE_INTERRUPT_ENABLE                           8
> > -#define VBUS_INTERRUPT_ENABLE                                  7
> > -#define CONTROL_STATUS_INTERRUPT_ENABLE                                6
> > -#define ROOT_PORT_RESET_INTERRUPT_ENABLE                       4
> > -#define SUSPEND_REQUEST_INTERRUPT_ENABLE                       3
> > -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE                        2
> > -#define RESUME_INTERRUPT_ENABLE                                        1
> > -#define SOF_INTERRUPT_ENABLE                                   0
> > -       __le32                  cpu_irqenb0;    /* ... or onboard 8051 */
> > -#define SETUP_PACKET_INTERRUPT_ENABLE                          7
> > -#define ENDPOINT_F_INTERRUPT_ENABLE                            6
> > -#define ENDPOINT_E_INTERRUPT_ENABLE                            5
> > -#define ENDPOINT_D_INTERRUPT_ENABLE                            4
> > -#define ENDPOINT_C_INTERRUPT_ENABLE                            3
> > -#define ENDPOINT_B_INTERRUPT_ENABLE                            2
> > -#define ENDPOINT_A_INTERRUPT_ENABLE                            1
> > -#define ENDPOINT_0_INTERRUPT_ENABLE                            0
> > -       __le32                  cpu_irqenb1;
> > -#define CPU_INTERRUPT_ENABLE                                   31
> > -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE                    27
> > -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE                   26
> > -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE                      25
> > -#define PCI_INTA_INTERRUPT_ENABLE                              24
> > -#define PCI_PME_INTERRUPT_ENABLE                               23
> > -#define PCI_SERR_INTERRUPT_ENABLE                              22
> > -#define PCI_PERR_INTERRUPT_ENABLE                              21
> > -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE             20
> > -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE             19
> > -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE                       17
> > -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE                 16
> > -#define GPIO_INTERRUPT_ENABLE                                  13
> > -#define DMA_D_INTERRUPT_ENABLE                                 12
> > -#define DMA_C_INTERRUPT_ENABLE                                 11
> > -#define DMA_B_INTERRUPT_ENABLE                                 10
> > -#define DMA_A_INTERRUPT_ENABLE                                 9
> > -#define EEPROM_DONE_INTERRUPT_ENABLE                           8
> > -#define VBUS_INTERRUPT_ENABLE                                  7
> > -#define CONTROL_STATUS_INTERRUPT_ENABLE                                6
> > -#define ROOT_PORT_RESET_INTERRUPT_ENABLE                       4
> > -#define SUSPEND_REQUEST_INTERRUPT_ENABLE                       3
> > -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE                        2
> > -#define RESUME_INTERRUPT_ENABLE                                        1
> > -#define SOF_INTERRUPT_ENABLE                                   0
> > -
> > -       /* offset 0x0020 */
> > -       u32                     _unused1;
> > -       __le32                  usbirqenb1;
> > -#define USB_INTERRUPT_ENABLE                                   31
> > -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE                    27
> > -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE                   26
> > -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE                      25
> > -#define PCI_INTA_INTERRUPT_ENABLE                              24
> > -#define PCI_PME_INTERRUPT_ENABLE                               23
> > -#define PCI_SERR_INTERRUPT_ENABLE                              22
> > -#define PCI_PERR_INTERRUPT_ENABLE                              21
> > -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE             20
> > -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE             19
> > -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE                       17
> > -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE                 16
> > -#define GPIO_INTERRUPT_ENABLE                                  13
> > -#define DMA_D_INTERRUPT_ENABLE                                 12
> > -#define DMA_C_INTERRUPT_ENABLE                                 11
> > -#define DMA_B_INTERRUPT_ENABLE                                 10
> > -#define DMA_A_INTERRUPT_ENABLE                                 9
> > -#define EEPROM_DONE_INTERRUPT_ENABLE                           8
> > -#define VBUS_INTERRUPT_ENABLE                                  7
> > -#define CONTROL_STATUS_INTERRUPT_ENABLE                                6
> > -#define ROOT_PORT_RESET_INTERRUPT_ENABLE                       4
> > -#define SUSPEND_REQUEST_INTERRUPT_ENABLE                       3
> > -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE                        2
> > -#define RESUME_INTERRUPT_ENABLE                                        1
> > -#define SOF_INTERRUPT_ENABLE                                   0
> > -       __le32                  irqstat0;
> > -#define INTA_ASSERTED                                          12
> > -#define SETUP_PACKET_INTERRUPT                                 7
> > -#define ENDPOINT_F_INTERRUPT                                   6
> > -#define ENDPOINT_E_INTERRUPT                                   5
> > -#define ENDPOINT_D_INTERRUPT                                   4
> > -#define ENDPOINT_C_INTERRUPT                                   3
> > -#define ENDPOINT_B_INTERRUPT                                   2
> > -#define ENDPOINT_A_INTERRUPT                                   1
> > -#define ENDPOINT_0_INTERRUPT                                   0
> > -       __le32                  irqstat1;
> > -#define POWER_STATE_CHANGE_INTERRUPT                           27
> > -#define PCI_ARBITER_TIMEOUT_INTERRUPT                          26
> > -#define PCI_PARITY_ERROR_INTERRUPT                             25
> > -#define PCI_INTA_INTERRUPT                                     24
> > -#define PCI_PME_INTERRUPT                                      23
> > -#define PCI_SERR_INTERRUPT                                     22
> > -#define PCI_PERR_INTERRUPT                                     21
> > -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT                    20
> > -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT                    19
> > -#define PCI_RETRY_ABORT_INTERRUPT                              17
> > -#define PCI_MASTER_CYCLE_DONE_INTERRUPT                                16
> > -#define GPIO_INTERRUPT                                         13
> > -#define DMA_D_INTERRUPT                                                12
> > -#define DMA_C_INTERRUPT                                                11
> > -#define DMA_B_INTERRUPT                                                10
> > -#define DMA_A_INTERRUPT                                                9
> > -#define EEPROM_DONE_INTERRUPT                                  8
> > -#define VBUS_INTERRUPT                                         7
> > -#define CONTROL_STATUS_INTERRUPT                               6
> > -#define ROOT_PORT_RESET_INTERRUPT                              4
> > -#define SUSPEND_REQUEST_INTERRUPT                              3
> > -#define SUSPEND_REQUEST_CHANGE_INTERRUPT                       2
> > -#define RESUME_INTERRUPT                                       1
> > -#define SOF_INTERRUPT                                          0
> > -       /* offset 0x0030 */
> > -       __le32                  idxaddr;
> > -       __le32                  idxdata;
> > -       __le32                  fifoctl;
> > -#define PCI_BASE2_RANGE                                                16
> > -#define IGNORE_FIFO_AVAILABILITY                               3
> > -#define PCI_BASE2_SELECT                                       2
> > -#define FIFO_CONFIGURATION_SELECT                              0
> > -       u32                     _unused2;
> > -       /* offset 0x0040 */
> > -       __le32                  memaddr;
> > -#define START                                                  28
> > -#define DIRECTION                                              27
> > -#define FIFO_DIAGNOSTIC_SELECT                                 24
> > -#define MEMORY_ADDRESS                                         0
> > -       __le32                  memdata0;
> > -       __le32                  memdata1;
> > -       u32                     _unused3;
> > -       /* offset 0x0050 */
> > -       __le32                  gpioctl;
> > -#define GPIO3_LED_SELECT                                       12
> > -#define GPIO3_INTERRUPT_ENABLE                                 11
> > -#define GPIO2_INTERRUPT_ENABLE                                 10
> > -#define GPIO1_INTERRUPT_ENABLE                                 9
> > -#define GPIO0_INTERRUPT_ENABLE                                 8
> > -#define GPIO3_OUTPUT_ENABLE                                    7
> > -#define GPIO2_OUTPUT_ENABLE                                    6
> > -#define GPIO1_OUTPUT_ENABLE                                    5
> > -#define GPIO0_OUTPUT_ENABLE                                    4
> > -#define GPIO3_DATA                                             3
> > -#define GPIO2_DATA                                             2
> > -#define GPIO1_DATA                                             1
> > -#define GPIO0_DATA                                             0
> > -       __le32                  gpiostat;
> > -#define GPIO3_INTERRUPT                                                3
> > -#define GPIO2_INTERRUPT                                                2
> > -#define GPIO1_INTERRUPT                                                1
> > -#define GPIO0_INTERRUPT                                                0
> > -} __packed;
> > -
> > -/* usb control, BAR0 + 0x0080 */
> > -struct net2280_usb_regs {
> > -       /* offset 0x0080 */
> > -       __le32                  stdrsp;
> > -#define STALL_UNSUPPORTED_REQUESTS                             31
> > -#define SET_TEST_MODE                                          16
> > -#define GET_OTHER_SPEED_CONFIGURATION                          15
> > -#define GET_DEVICE_QUALIFIER                                   14
> > -#define SET_ADDRESS                                            13
> > -#define ENDPOINT_SET_CLEAR_HALT                                        12
> > -#define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP                  11
> > -#define GET_STRING_DESCRIPTOR_2                                        10
> > -#define GET_STRING_DESCRIPTOR_1                                        9
> > -#define GET_STRING_DESCRIPTOR_0                                        8
> > -#define GET_SET_INTERFACE                                      6
> > -#define GET_SET_CONFIGURATION                                  5
> > -#define GET_CONFIGURATION_DESCRIPTOR                           4
> > -#define GET_DEVICE_DESCRIPTOR                                  3
> > -#define GET_ENDPOINT_STATUS                                    2
> > -#define GET_INTERFACE_STATUS                                   1
> > -#define GET_DEVICE_STATUS                                      0
> > -       __le32                  prodvendid;
> > -#define     PRODUCT_ID                                         16
> > -#define     VENDOR_ID                                          0
> > -       __le32                  relnum;
> > -       __le32                  usbctl;
> > -#define SERIAL_NUMBER_INDEX                                    16
> > -#define PRODUCT_ID_STRING_ENABLE                               13
> > -#define VENDOR_ID_STRING_ENABLE                                        12
> > -#define USB_ROOT_PORT_WAKEUP_ENABLE                            11
> > -#define VBUS_PIN                                               10
> > -#define TIMED_DISCONNECT                                       9
> > -#define SUSPEND_IMMEDIATELY                                    7
> > -#define SELF_POWERED_USB_DEVICE                                        6
> > -#define REMOTE_WAKEUP_SUPPORT                                  5
> > -#define PME_POLARITY                                           4
> > -#define USB_DETECT_ENABLE                                      3
> > -#define PME_WAKEUP_ENABLE                                      2
> > -#define DEVICE_REMOTE_WAKEUP_ENABLE                            1
> > -#define SELF_POWERED_STATUS                                    0
> > -       /* offset 0x0090 */
> > -       __le32                  usbstat;
> > -#define HIGH_SPEED                                             7
> > -#define FULL_SPEED                                             6
> > -#define GENERATE_RESUME                                                5
> > -#define GENERATE_DEVICE_REMOTE_WAKEUP                          4
> > -       __le32                  xcvrdiag;
> > -#define FORCE_HIGH_SPEED_MODE                                  31
> > -#define FORCE_FULL_SPEED_MODE                                  30
> > -#define USB_TEST_MODE                                          24
> > -#define LINE_STATE                                             16
> > -#define TRANSCEIVER_OPERATION_MODE                             2
> > -#define TRANSCEIVER_SELECT                                     1
> > -#define TERMINATION_SELECT                                     0
> > -       __le32                  setup0123;
> > -       __le32                  setup4567;
> > -       /* offset 0x0090 */
> > -       u32                     _unused0;
> > -       __le32                  ouraddr;
> > -#define FORCE_IMMEDIATE                                                7
> > -#define OUR_USB_ADDRESS                                                0
> > -       __le32                  ourconfig;
> > -} __packed;
> > -
> > -/* pci control, BAR0 + 0x0100 */
> > -struct net2280_pci_regs {
> > -       /* offset 0x0100 */
> > -       __le32                  pcimstctl;
> > -#define PCI_ARBITER_PARK_SELECT                                        13
> > -#define PCI_MULTI LEVEL_ARBITER                                        12
> > -#define PCI_RETRY_ABORT_ENABLE                                 11
> > -#define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE                 10
> > -#define DMA_READ_MULTIPLE_ENABLE                               9
> > -#define DMA_READ_LINE_ENABLE                                   8
> > -#define PCI_MASTER_COMMAND_SELECT                              6
> > -#define                MEM_READ_OR_WRITE                               0
> > -#define                IO_READ_OR_WRITE                                1
> > -#define                CFG_READ_OR_WRITE                               2
> > -#define PCI_MASTER_START                                       5
> > -#define PCI_MASTER_READ_WRITE                                  4
> > -#define                PCI_MASTER_WRITE                                0
> > -#define                PCI_MASTER_READ                                 1
> > -#define PCI_MASTER_BYTE_WRITE_ENABLES                          0
> > -       __le32                  pcimstaddr;
> > -       __le32                  pcimstdata;
> > -       __le32                  pcimststat;
> > -#define PCI_ARBITER_CLEAR                                      2
> > -#define PCI_EXTERNAL_ARBITER                                   1
> > -#define PCI_HOST_MODE                                          0
> > -} __packed;
> > -
> > -/* dma control, BAR0 + 0x0180 ... array of four structs like this,
> > - * for channels 0..3.  see also struct net2280_dma:  descriptor
> > - * that can be loaded into some of these registers.
> > - */
> > -struct net2280_dma_regs {      /* [11.7] */
> > -       /* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */
> > -       __le32                  dmactl;
> > -#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE               25
> > -#define DMA_CLEAR_COUNT_ENABLE                                 21
> > -#define DESCRIPTOR_POLLING_RATE                                        19
> > -#define                POLL_CONTINUOUS                                 0
> > -#define                POLL_1_USEC                                     1
> > -#define                POLL_100_USEC                                   2
> > -#define                POLL_1_MSEC                                     3
> > -#define DMA_VALID_BIT_POLLING_ENABLE                           18
> > -#define DMA_VALID_BIT_ENABLE                                   17
> > -#define DMA_SCATTER_GATHER_ENABLE                              16
> > -#define DMA_OUT_AUTO_START_ENABLE                              4
> > -#define DMA_PREEMPT_ENABLE                                     3
> > -#define DMA_FIFO_VALIDATE                                      2
> > -#define DMA_ENABLE                                             1
> > -#define DMA_ADDRESS_HOLD                                       0
> > -       __le32                  dmastat;
> > -#define DMA_SCATTER_GATHER_DONE_INTERRUPT                      25
> > -#define DMA_TRANSACTION_DONE_INTERRUPT                         24
> > -#define DMA_ABORT                                              1
> > -#define DMA_START                                              0
> > -       u32                     _unused0[2];
> > -       /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
> > -       __le32                  dmacount;
> > -#define VALID_BIT                                              31
> > -#define DMA_DIRECTION                                          30
> > -#define DMA_DONE_INTERRUPT_ENABLE                              29
> > -#define END_OF_CHAIN                                           28
> > -#define DMA_BYTE_COUNT_MASK                                    ((1<<24)-1)
> > -#define DMA_BYTE_COUNT                                         0
> > -       __le32                  dmaaddr;
> > -       __le32                  dmadesc;
> > -       u32                     _unused1;
> > -} __packed;
> > -
> > -/* dedicated endpoint registers, BAR0 + 0x0200 */
> > -
> > -struct net2280_dep_regs {      /* [11.8] */
> > -       /* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */
> > -       __le32                  dep_cfg;
> > -       /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
> > -       __le32                  dep_rsp;
> > -       u32                     _unused[2];
> > -} __packed;
> > -
> > -/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
> > - * like this, for ep0 then the configurable endpoints A..F
> > - * ep0 reserved for control; E and F have only 64 bytes of fifo
> > - */
> > -struct net2280_ep_regs {       /* [11.9] */
> > -       /* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */
> > -       __le32                  ep_cfg;
> > -#define ENDPOINT_BYTE_COUNT                                    16
> > -#define ENDPOINT_ENABLE                                                10
> > -#define ENDPOINT_TYPE                                          8
> > -#define ENDPOINT_DIRECTION                                     7
> > -#define ENDPOINT_NUMBER                                                0
> > -       __le32                  ep_rsp;
> > -#define SET_NAK_OUT_PACKETS                                    15
> > -#define SET_EP_HIDE_STATUS_PHASE                               14
> > -#define SET_EP_FORCE_CRC_ERROR                                 13
> > -#define SET_INTERRUPT_MODE                                     12
> > -#define SET_CONTROL_STATUS_PHASE_HANDSHAKE                     11
> > -#define SET_NAK_OUT_PACKETS_MODE                               10
> > -#define SET_ENDPOINT_TOGGLE                                    9
> > -#define SET_ENDPOINT_HALT                                      8
> > -#define CLEAR_NAK_OUT_PACKETS                                  7
> > -#define CLEAR_EP_HIDE_STATUS_PHASE                             6
> > -#define CLEAR_EP_FORCE_CRC_ERROR                               5
> > -#define CLEAR_INTERRUPT_MODE                                   4
> > -#define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE                   3
> > -#define CLEAR_NAK_OUT_PACKETS_MODE                             2
> > -#define CLEAR_ENDPOINT_TOGGLE                                  1
> > -#define CLEAR_ENDPOINT_HALT                                    0
> > -       __le32                  ep_irqenb;
> > -#define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE                 6
> > -#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE              5
> > -#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE                  3
> > -#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE               2
> > -#define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE                   1
> > -#define DATA_IN_TOKEN_INTERRUPT_ENABLE                         0
> > -       __le32                  ep_stat;
> > -#define FIFO_VALID_COUNT                                       24
> > -#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID                     22
> > -#define TIMEOUT                                                        21
> > -#define USB_STALL_SENT                                         20
> > -#define USB_IN_NAK_SENT                                                19
> > -#define USB_IN_ACK_RCVD                                                18
> > -#define USB_OUT_PING_NAK_SENT                                  17
> > -#define USB_OUT_ACK_SENT                                       16
> > -#define FIFO_OVERFLOW                                          13
> > -#define FIFO_UNDERFLOW                                         12
> > -#define FIFO_FULL                                              11
> > -#define FIFO_EMPTY                                             10
> > -#define FIFO_FLUSH                                             9
> > -#define SHORT_PACKET_OUT_DONE_INTERRUPT                                6
> > -#define SHORT_PACKET_TRANSFERRED_INTERRUPT                     5
> > -#define NAK_OUT_PACKETS                                                4
> > -#define DATA_PACKET_RECEIVED_INTERRUPT                         3
> > -#define DATA_PACKET_TRANSMITTED_INTERRUPT                      2
> > -#define DATA_OUT_PING_TOKEN_INTERRUPT                          1
> > -#define DATA_IN_TOKEN_INTERRUPT                                        0
> > -       /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
> > -       __le32                  ep_avail;
> > -       __le32                  ep_data;
> > -       u32                     _unused0[2];
> > -} __packed;
> > -
> > -struct net2280_reg_write {
> > -       __le16 port;
> > -       __le32 addr;
> > -       __le32 val;
> > -} __packed;
> > -
> > -struct net2280_reg_read {
> > -       __le16 port;
> > -       __le32 addr;
> > -} __packed;
> > -#endif /* NET2280_H */
> > diff --git a/drivers/net/wireless/p54/p54usb.h b/drivers/net/wireless/p54/p54usb.h
> > index d273be7..a5f5f0f 100644
> > --- a/drivers/net/wireless/p54/p54usb.h
> > +++ b/drivers/net/wireless/p54/p54usb.h
> > @@ -16,7 +16,7 @@
> >
> >  /* for isl3886 register definitions used on ver 1 devices */
> >  #include "p54pci.h"
> > -#include "net2280.h"
> > +#include <linux/usb/net2280.h>
> >
> >  /* pci */
> >  #define NET2280_BASE           0x10000000
> > @@ -93,6 +93,17 @@ enum net2280_op_type {
> >         NET2280_DEV_CFG_U16     = 0x0883
> >  };
> >
> > +struct net2280_reg_write {
> > +       __le16 port;
> > +       __le32 addr;
> > +       __le32 val;
> > +} __packed;
> > +
> > +struct net2280_reg_read {
> > +       __le16 port;
> > +       __le32 addr;
> > +} __packed;
> > +
> >  #define P54U_FW_BLOCK 2048
> >
> >  #define X2_SIGNATURE "x2  "
> > --
> > 2.1.3
> >
> 
> 
> 
> -- 
> Ricardo Ribalda
> 

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

^ permalink raw reply

* [PATCH] stmmac: platform: fix stmmac probe failure
From: dinguyen @ 2014-12-01 20:00 UTC (permalink / raw)
  To: davem, peppe.cavallaro
  Cc: dinh.linux, maxime.ripard, olof, vbridger, netdev, linux-kernel,
	Dinh Nguyen

From: Dinh Nguyen <dinguyen@opensource.altera.com>

The commit 571dcfde23712b ("stmmac: platform: fix default values of the filter
bins setting") broke support for stmmac probe for all CONFIG_OF platforms.

[    0.743567] Unable to handle kernel NULL pointer dereference at virtual address 00000048
[    0.751679] pgd = c0004000
[    0.754384] [00000048] *pgd=00000000
[    0.757983] Internal error: Oops: 805 [#1] SMP ARM
[    0.762774] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.18.0-rc7 #1
[    0.769034] task: ee86c000 ti: ee870000 task.ti: ee870000
[    0.774429] PC is at stmmac_pltfr_probe+0x40/0x5d0
[    0.779217] LR is at devm_ioremap_nocache+0x54/0x74
...
[    0.951644] [<c0287938>] (stmmac_pltfr_probe) from [<c0234c4c>] (platform_drv_probe+0x44/0xa4)
[    0.960250] [<c0234c4c>] (platform_drv_probe) from [<c023390c>] (driver_probe_device+0x10c/0x240)
[    0.969113] [<c023390c>] (driver_probe_device) from [<c0233b10>] (__driver_attach+0x8c/0x90)
[    0.977544] [<c0233b10>] (__driver_attach) from [<c02320fc>] (bus_for_each_dev+0x6c/0xa0)

The reason is that in stmmac_pltfr_probe(), the plat_dat on a CONFIG_OF
platform is NULL until devm_kzalloc() is called to allocate plat_dat.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 5b0da39..62c9e75 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -265,12 +265,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 
 	plat_dat = dev_get_platdata(&pdev->dev);
 
-	/* Set default value for multicast hash bins */
-	plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
-
-	/* Set default value for unicast filter entries */
-	plat_dat->unicast_filter_entries = 1;
-
 	if (pdev->dev.of_node) {
 		if (!plat_dat)
 			plat_dat = devm_kzalloc(&pdev->dev,
@@ -288,6 +282,12 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 		}
 	}
 
+	/* Set default value for multicast hash bins */
+	plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
+
+	/* Set default value for unicast filter entries */
+	plat_dat->unicast_filter_entries = 1;
+
 	/* Custom setup (if needed) */
 	if (plat_dat->setup) {
 		plat_dat->bsp_priv = plat_dat->setup(pdev);
-- 
2.0.3

^ permalink raw reply related

* Re: [PATCH] stmmac: platform: fix stmmac probe failure
From: Dinh Nguyen @ 2014-12-01 20:14 UTC (permalink / raw)
  To: davem, peppe.cavallaro
  Cc: dinh.linux, maxime.ripard, olof, vbridger, netdev, linux-kernel
In-Reply-To: <1417464054-8777-1-git-send-email-dinguyen@opensource.altera.com>

Apologies for the noise, but it looks like Arnd has already send a patch
for this.

http://www.spinics.net/lists/netdev/msg306603.html

Dinh

On 12/1/14, 2:00 PM, dinguyen@opensource.altera.com wrote:
> From: Dinh Nguyen <dinguyen@opensource.altera.com>
> 
> The commit 571dcfde23712b ("stmmac: platform: fix default values of the filter
> bins setting") broke support for stmmac probe for all CONFIG_OF platforms.
> 
> [    0.743567] Unable to handle kernel NULL pointer dereference at virtual address 00000048
> [    0.751679] pgd = c0004000
> [    0.754384] [00000048] *pgd=00000000
> [    0.757983] Internal error: Oops: 805 [#1] SMP ARM
> [    0.762774] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.18.0-rc7 #1
> [    0.769034] task: ee86c000 ti: ee870000 task.ti: ee870000
> [    0.774429] PC is at stmmac_pltfr_probe+0x40/0x5d0
> [    0.779217] LR is at devm_ioremap_nocache+0x54/0x74
> ...
> [    0.951644] [<c0287938>] (stmmac_pltfr_probe) from [<c0234c4c>] (platform_drv_probe+0x44/0xa4)
> [    0.960250] [<c0234c4c>] (platform_drv_probe) from [<c023390c>] (driver_probe_device+0x10c/0x240)
> [    0.969113] [<c023390c>] (driver_probe_device) from [<c0233b10>] (__driver_attach+0x8c/0x90)
> [    0.977544] [<c0233b10>] (__driver_attach) from [<c02320fc>] (bus_for_each_dev+0x6c/0xa0)
> 
> The reason is that in stmmac_pltfr_probe(), the plat_dat on a CONFIG_OF
> platform is NULL until devm_kzalloc() is called to allocate plat_dat.
> 
> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index 5b0da39..62c9e75 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -265,12 +265,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
>  
>  	plat_dat = dev_get_platdata(&pdev->dev);
>  
> -	/* Set default value for multicast hash bins */
> -	plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
> -
> -	/* Set default value for unicast filter entries */
> -	plat_dat->unicast_filter_entries = 1;
> -
>  	if (pdev->dev.of_node) {
>  		if (!plat_dat)
>  			plat_dat = devm_kzalloc(&pdev->dev,
> @@ -288,6 +282,12 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> +	/* Set default value for multicast hash bins */
> +	plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
> +
> +	/* Set default value for unicast filter entries */
> +	plat_dat->unicast_filter_entries = 1;
> +
>  	/* Custom setup (if needed) */
>  	if (plat_dat->setup) {
>  		plat_dat->bsp_priv = plat_dat->setup(pdev);
> 

^ permalink raw reply

* Re: net-PA Semi: Deletion of unnecessary checks before the function call "pci_dev_put"
From: Johannes Berg @ 2014-12-01 20:29 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Lino Sanfilippo, Olof Johansson, netdev, backports, LKML,
	kernel-janitors, Julia Lawall, Luis R. Rodriguez
In-Reply-To: <547BC5AD.6090500@users.sourceforge.net>

On Mon, 2014-12-01 at 02:34 +0100, SF Markus Elfring wrote:

> > Some of those NULL pointer checks on input parameters may have been
> > added subsequently to functions. So there may be older kernel versions
> > out there in which those checks dont exists in some cases. If some of
> > the now "cleaned up" code is backported to such a kernel chances are
> > good that those missing checks are overseen. And then neither caller nor
> > callee is doing the NULL pointer check.

> I assume that a few backporters can tell you more about their corresponding
> software development experiences.
> http://www.do-not-panic.com/2014/04/automatic-linux-kernel-backporting-with-coccinelle.html

In such cases we just provide an appropriate wrapper and replace callers
of the original function by callers of the wrapper, typically with a
#define.

So this kind of evolution is no problem for the (automated) backports
using the backports project - although it can be difficult to detect
such a thing is needed.

johannes

^ permalink raw reply

* Re: net-PA Semi: Deletion of unnecessary checks before the function call "pci_dev_put"
From: Julia Lawall @ 2014-12-01 20:34 UTC (permalink / raw)
  To: Johannes Berg
  Cc: SF Markus Elfring, Lino Sanfilippo, Olof Johansson, netdev,
	backports, LKML, kernel-janitors, Luis R. Rodriguez
In-Reply-To: <1417465745.28610.0.camel@sipsolutions.net>



On Mon, 1 Dec 2014, Johannes Berg wrote:

> On Mon, 2014-12-01 at 02:34 +0100, SF Markus Elfring wrote:
> 
> > > Some of those NULL pointer checks on input parameters may have been
> > > added subsequently to functions. So there may be older kernel versions
> > > out there in which those checks dont exists in some cases. If some of
> > > the now "cleaned up" code is backported to such a kernel chances are
> > > good that those missing checks are overseen. And then neither caller nor
> > > callee is doing the NULL pointer check.
> 
> > I assume that a few backporters can tell you more about their corresponding
> > software development experiences.
> > http://www.do-not-panic.com/2014/04/automatic-linux-kernel-backporting-with-coccinelle.html
> 
> In such cases we just provide an appropriate wrapper and replace callers
> of the original function by callers of the wrapper, typically with a
> #define.
> 
> So this kind of evolution is no problem for the (automated) backports
> using the backports project - although it can be difficult to detect
> such a thing is needed.

That is exactly the problem...

julia

^ permalink raw reply

* Re: [PATCH 1/1] net-PA Semi: Deletion of unnecessary checks before the function call "pci_dev_put"
From: Olof Johansson @ 2014-12-01 20:36 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Network Development, LKML, kernel-janitors, Julia Lawall
In-Reply-To: <547A09B1.9090102@users.sourceforge.net>

On Sat, Nov 29, 2014 at 10:00 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 29 Nov 2014 18:55:40 +0100
>
> The pci_dev_put() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call
> is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

For this particular case:

Acked-by: Olof Johansson <olof@lixom.net>

Note that the "this might cause problems with backports" case is
mostly academic in the scope of _this particular driver_. It's still a
very valid discussion and issue though.

So I'll be happy to give the ack on this driver, but the larger
problem needs consideration still.


-Olof

^ permalink raw reply

* [PATCH] SSB / B44: fix WOL for BCM4401
From: Andrey Skvortsov @ 2014-12-01 20:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Gary Zambrano, Michael Buesch, netdev,
	linux-kernel
  Cc: Andrey Skvortsov
In-Reply-To: <20141201111125.GA11974@localhost.localdomain>

Wake On Lan was not working on laptop DELL Vostro 1500.
If WOL was turned on, BCM4401 was powered up in suspend mode. LEDs blinked.
But the laptop could not be woken up with the Magic Packet. The reason for
that was that PCIE was not enabled as a system wakeup source and
therefore the host PCI bridge was not powered up in suspend mode.
PCIE was not enabled in suspend by PM because no child devices were
registered as wakeup source during suspend process.
On laptop BCM4401 is connected through the SSB bus, that is connected to the
PCI-Express bus. SSB and B44 did not use standard PM wakeup functions
and did not forward wakeup settings to their parents.
To fix that B44 driver enables PM wakeup and registers new wakeup source
using device_set_wakeup_enable(). Wakeup is automatically reported to the parent SSB
bus via power.wakeup_path. SSB bus enables wakeup for the parent PCI bridge, if there is any
child devices with enabled wakeup functionality. All other steps are
done by PM core code.

Signed-off-by: Andrey Skvortsov <Andrej.Skvortzov@gmail.com>
---
 drivers/net/ethernet/broadcom/b44.c |    2 ++
 drivers/ssb/pcihost_wrapper.c       |   33 ++++++++++++++++++++++-----------
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 416620f..ffeaf47 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -2104,6 +2104,7 @@ static int b44_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 		bp->flags &= ~B44_FLAG_WOL_ENABLE;
 	spin_unlock_irq(&bp->lock);
 
+	device_set_wakeup_enable(bp->sdev->dev, wol->wolopts & WAKE_MAGIC);
 	return 0;
 }
 
@@ -2452,6 +2453,7 @@ static int b44_init_one(struct ssb_device *sdev,
 		}
 	}
 
+	device_set_wakeup_capable(sdev->dev, true);
 	netdev_info(dev, "%s %pM\n", DRV_DESCRIPTION, dev->dev_addr);
 
 	return 0;
diff --git a/drivers/ssb/pcihost_wrapper.c b/drivers/ssb/pcihost_wrapper.c
index 69161bb..410215c 100644
--- a/drivers/ssb/pcihost_wrapper.c
+++ b/drivers/ssb/pcihost_wrapper.c
@@ -11,15 +11,17 @@
  * Licensed under the GNU/GPL. See COPYING for details.
  */
 
+#include <linux/pm.h>
 #include <linux/pci.h>
 #include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/ssb/ssb.h>
 
 
-#ifdef CONFIG_PM
-static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int ssb_pcihost_suspend(struct device *d)
 {
+	struct pci_dev *dev = to_pci_dev(d);
 	struct ssb_bus *ssb = pci_get_drvdata(dev);
 	int err;
 
@@ -28,17 +30,23 @@ static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state)
 		return err;
 	pci_save_state(dev);
 	pci_disable_device(dev);
-	pci_set_power_state(dev, pci_choose_state(dev, state));
+
+	/* if there is a wakeup enabled child device on ssb bus,
+	   enable pci wakeup posibility. */
+	device_set_wakeup_enable(d, d->power.wakeup_path);
+
+	pci_prepare_to_sleep(dev);
 
 	return 0;
 }
 
-static int ssb_pcihost_resume(struct pci_dev *dev)
+static int ssb_pcihost_resume(struct device *d)
 {
+	struct pci_dev *dev = to_pci_dev(d);
 	struct ssb_bus *ssb = pci_get_drvdata(dev);
 	int err;
 
-	pci_set_power_state(dev, PCI_D0);
+	pci_back_from_sleep(dev);
 	err = pci_enable_device(dev);
 	if (err)
 		return err;
@@ -49,10 +57,12 @@ static int ssb_pcihost_resume(struct pci_dev *dev)
 
 	return 0;
 }
-#else /* CONFIG_PM */
-# define ssb_pcihost_suspend	NULL
-# define ssb_pcihost_resume	NULL
-#endif /* CONFIG_PM */
+
+static const struct dev_pm_ops ssb_pcihost_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(ssb_pcihost_suspend, ssb_pcihost_resume)
+};
+
+#endif /* CONFIG_PM_SLEEP */
 
 static int ssb_pcihost_probe(struct pci_dev *dev,
 			     const struct pci_device_id *id)
@@ -115,8 +125,9 @@ int ssb_pcihost_register(struct pci_driver *driver)
 {
 	driver->probe = ssb_pcihost_probe;
 	driver->remove = ssb_pcihost_remove;
-	driver->suspend = ssb_pcihost_suspend;
-	driver->resume = ssb_pcihost_resume;
+#ifdef CONFIG_PM_SLEEP
+	driver->driver.pm = &ssb_pcihost_pm_ops;
+#endif
 
 	return pci_register_driver(driver);
 }
-- 
1.7.2.5

^ permalink raw reply related

* Re: no connectivity on PF with Intel 82599/SR-IOV/OVS
From: Alexei Starovoitov @ 2014-12-01 20:47 UTC (permalink / raw)
  To: Dmitry N., netdev@vger.kernel.org; +Cc: linux-kernel@vger.kernel.org

cc-ing netdev

On Mon, Dec 1, 2014 at 3:45 AM, Dmitry N. <plretbox@gmail.com> wrote:
> Hello all.
>
> I'm having an issue with SR-IOV on 82599 NIC in lab env. Basically
> what I have is Ubuntu 12.04 with a set of vanilla kernels and Open
> vSwitch.
>
> A simplified scheme for ovs setup:
> br-mgmt -> [vlan 102]br-eth0 -> eth0 -> fabric
>
> When VFs are disabled, connectivity works fine. However when at least
> one VF is enabled, traffic just doesn't go any further than br-eth0.
> Oddly enough, it acts this way only if VLAN is configured on br-eth0
> via OVS. When I try to configure VLAN with ip link, it works just
> fine.
>
> It's not an udev issue because re-adding eth0 to br-eth0 doesn't help.
> I've tried different OVS and ixgbe/ixgbevf versions against different
> kernel versions and ruled out issues with OVS and ixgbe.
>
> This could be a kernel bug.
>
> Kernel versions I've tried:
> 3.11.0 works fine
> 3.12.24 has this issue
> 3.14.23 has this issue
> 3.15.10 has this issue
> 3.16.7 and later kernels: the situation is opposite: when VFs are
> disabled, there is no connectivity on PF; as soon as at leas 1 VF is
> enabled, connectivity appears.
>
> OVS versions:
> 2.3.0 for user space
> 2.3.0 (and kernel native where 2.3.0 is not supported - starting with
> 3.15.x) for kernel space
>
> ixgbe:
> latest from Intel website (3.22.3)
>
> ixgbevf:
> latest from Intel website (2.15.3)
>
> Any suggestions? Thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH] wireless/p54: Remove duplicated net2280 header
From: Ricardo Ribalda Delgado @ 2014-12-01 20:56 UTC (permalink / raw)
  To: John W. Linville
  Cc: Christian Lamparter, LKML, linux-wireless, netdev, David Miller
In-Reply-To: <20141201195924.GA7266@tuxdriver.com>

Hello John

No sorry. I only checked patchwork and the mailing list. I was
expecting the typical mail when a patch is merged into a tree :),
sorry about that, first contrib to the wireless subsystem.

Thanks

On Mon, Dec 1, 2014 at 8:59 PM, John W. Linville <linville@tuxdriver.com> wrote:
> Did you check the wireless-next tree's git logs?
>
> commit a831f20b6d6460640b83644d1c1df6e7e8ca9f68
> Author: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> Date:   Mon Nov 24 11:19:51 2014 +0100
>
>     wireless/p54: Remove duplicated net2280 header
>
>     The usb gadget driver net2280 has exported a header file with the
>     register definition of the net2280 chip.
>
>     Remove the custom/duplicated header file in favor of that header file
>     in include/linux
>
>     Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
>     Signed-off-by: John W. Linville <linville@tuxdriver.com>
>
> On Mon, Dec 01, 2014 at 11:46:43AM +0100, Ricardo Ribalda Delgado wrote:
>> David Miller has marked the patch as "Awaiting Upstream", which I
>> think means that it should be merged through the wireless tree.
>>
>> Any comment from there?
>>
>> On Mon, Nov 24, 2014 at 11:19 AM, Ricardo Ribalda Delgado
>> <ricardo.ribalda@gmail.com> wrote:
>> > The usb gadget driver net2280 has exported a header file with the
>> > register definition of the net2280 chip.
>> >
>> > Remove the custom/duplicated header file in favor of that header file
>> > in include/linux
>> >
>> > Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
>> > ---
>> >  drivers/net/wireless/p54/net2280.h | 451 -------------------------------------
>> >  drivers/net/wireless/p54/p54usb.h  |  13 +-
>> >  2 files changed, 12 insertions(+), 452 deletions(-)
>> >  delete mode 100644 drivers/net/wireless/p54/net2280.h
>> >
>> > diff --git a/drivers/net/wireless/p54/net2280.h b/drivers/net/wireless/p54/net2280.h
>> > deleted file mode 100644
>> > index aedfaf2..0000000
>> > --- a/drivers/net/wireless/p54/net2280.h
>> > +++ /dev/null
>> > @@ -1,451 +0,0 @@
>> > -#ifndef NET2280_H
>> > -#define NET2280_H
>> > -/*
>> > - * NetChip 2280 high/full speed USB device controller.
>> > - * Unlike many such controllers, this one talks PCI.
>> > - */
>> > -
>> > -/*
>> > - * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
>> > - * Copyright (C) 2003 David Brownell
>> > - *
>> > - * 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, see <http://www.gnu.org/licenses/>.
>> > - */
>> > -
>> > -/*-------------------------------------------------------------------------*/
>> > -
>> > -/* NET2280 MEMORY MAPPED REGISTERS
>> > - *
>> > - * The register layout came from the chip documentation, and the bit
>> > - * number definitions were extracted from chip specification.
>> > - *
>> > - * Use the shift operator ('<<') to build bit masks, with readl/writel
>> > - * to access the registers through PCI.
>> > - */
>> > -
>> > -/* main registers, BAR0 + 0x0000 */
>> > -struct net2280_regs {
>> > -       /* offset 0x0000 */
>> > -       __le32                  devinit;
>> > -#define LOCAL_CLOCK_FREQUENCY                                  8
>> > -#define FORCE_PCI_RESET                                                7
>> > -#define PCI_ID                                                 6
>> > -#define PCI_ENABLE                                             5
>> > -#define FIFO_SOFT_RESET                                                4
>> > -#define CFG_SOFT_RESET                                         3
>> > -#define PCI_SOFT_RESET                                         2
>> > -#define USB_SOFT_RESET                                         1
>> > -#define M8051_RESET                                            0
>> > -       __le32                  eectl;
>> > -#define EEPROM_ADDRESS_WIDTH                                   23
>> > -#define EEPROM_CHIP_SELECT_ACTIVE                              22
>> > -#define EEPROM_PRESENT                                         21
>> > -#define EEPROM_VALID                                           20
>> > -#define EEPROM_BUSY                                            19
>> > -#define EEPROM_CHIP_SELECT_ENABLE                              18
>> > -#define EEPROM_BYTE_READ_START                                 17
>> > -#define EEPROM_BYTE_WRITE_START                                        16
>> > -#define EEPROM_READ_DATA                                       8
>> > -#define EEPROM_WRITE_DATA                                      0
>> > -       __le32                  eeclkfreq;
>> > -       u32                     _unused0;
>> > -       /* offset 0x0010 */
>> > -
>> > -       __le32                  pciirqenb0;     /* interrupt PCI master ... */
>> > -#define SETUP_PACKET_INTERRUPT_ENABLE                          7
>> > -#define ENDPOINT_F_INTERRUPT_ENABLE                            6
>> > -#define ENDPOINT_E_INTERRUPT_ENABLE                            5
>> > -#define ENDPOINT_D_INTERRUPT_ENABLE                            4
>> > -#define ENDPOINT_C_INTERRUPT_ENABLE                            3
>> > -#define ENDPOINT_B_INTERRUPT_ENABLE                            2
>> > -#define ENDPOINT_A_INTERRUPT_ENABLE                            1
>> > -#define ENDPOINT_0_INTERRUPT_ENABLE                            0
>> > -       __le32                  pciirqenb1;
>> > -#define PCI_INTERRUPT_ENABLE                                   31
>> > -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE                    27
>> > -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE                   26
>> > -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE                      25
>> > -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE             20
>> > -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE             19
>> > -#define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE             18
>> > -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE                       17
>> > -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE                 16
>> > -#define GPIO_INTERRUPT_ENABLE                                  13
>> > -#define DMA_D_INTERRUPT_ENABLE                                 12
>> > -#define DMA_C_INTERRUPT_ENABLE                                 11
>> > -#define DMA_B_INTERRUPT_ENABLE                                 10
>> > -#define DMA_A_INTERRUPT_ENABLE                                 9
>> > -#define EEPROM_DONE_INTERRUPT_ENABLE                           8
>> > -#define VBUS_INTERRUPT_ENABLE                                  7
>> > -#define CONTROL_STATUS_INTERRUPT_ENABLE                                6
>> > -#define ROOT_PORT_RESET_INTERRUPT_ENABLE                       4
>> > -#define SUSPEND_REQUEST_INTERRUPT_ENABLE                       3
>> > -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE                        2
>> > -#define RESUME_INTERRUPT_ENABLE                                        1
>> > -#define SOF_INTERRUPT_ENABLE                                   0
>> > -       __le32                  cpu_irqenb0;    /* ... or onboard 8051 */
>> > -#define SETUP_PACKET_INTERRUPT_ENABLE                          7
>> > -#define ENDPOINT_F_INTERRUPT_ENABLE                            6
>> > -#define ENDPOINT_E_INTERRUPT_ENABLE                            5
>> > -#define ENDPOINT_D_INTERRUPT_ENABLE                            4
>> > -#define ENDPOINT_C_INTERRUPT_ENABLE                            3
>> > -#define ENDPOINT_B_INTERRUPT_ENABLE                            2
>> > -#define ENDPOINT_A_INTERRUPT_ENABLE                            1
>> > -#define ENDPOINT_0_INTERRUPT_ENABLE                            0
>> > -       __le32                  cpu_irqenb1;
>> > -#define CPU_INTERRUPT_ENABLE                                   31
>> > -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE                    27
>> > -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE                   26
>> > -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE                      25
>> > -#define PCI_INTA_INTERRUPT_ENABLE                              24
>> > -#define PCI_PME_INTERRUPT_ENABLE                               23
>> > -#define PCI_SERR_INTERRUPT_ENABLE                              22
>> > -#define PCI_PERR_INTERRUPT_ENABLE                              21
>> > -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE             20
>> > -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE             19
>> > -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE                       17
>> > -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE                 16
>> > -#define GPIO_INTERRUPT_ENABLE                                  13
>> > -#define DMA_D_INTERRUPT_ENABLE                                 12
>> > -#define DMA_C_INTERRUPT_ENABLE                                 11
>> > -#define DMA_B_INTERRUPT_ENABLE                                 10
>> > -#define DMA_A_INTERRUPT_ENABLE                                 9
>> > -#define EEPROM_DONE_INTERRUPT_ENABLE                           8
>> > -#define VBUS_INTERRUPT_ENABLE                                  7
>> > -#define CONTROL_STATUS_INTERRUPT_ENABLE                                6
>> > -#define ROOT_PORT_RESET_INTERRUPT_ENABLE                       4
>> > -#define SUSPEND_REQUEST_INTERRUPT_ENABLE                       3
>> > -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE                        2
>> > -#define RESUME_INTERRUPT_ENABLE                                        1
>> > -#define SOF_INTERRUPT_ENABLE                                   0
>> > -
>> > -       /* offset 0x0020 */
>> > -       u32                     _unused1;
>> > -       __le32                  usbirqenb1;
>> > -#define USB_INTERRUPT_ENABLE                                   31
>> > -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE                    27
>> > -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE                   26
>> > -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE                      25
>> > -#define PCI_INTA_INTERRUPT_ENABLE                              24
>> > -#define PCI_PME_INTERRUPT_ENABLE                               23
>> > -#define PCI_SERR_INTERRUPT_ENABLE                              22
>> > -#define PCI_PERR_INTERRUPT_ENABLE                              21
>> > -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE             20
>> > -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE             19
>> > -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE                       17
>> > -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE                 16
>> > -#define GPIO_INTERRUPT_ENABLE                                  13
>> > -#define DMA_D_INTERRUPT_ENABLE                                 12
>> > -#define DMA_C_INTERRUPT_ENABLE                                 11
>> > -#define DMA_B_INTERRUPT_ENABLE                                 10
>> > -#define DMA_A_INTERRUPT_ENABLE                                 9
>> > -#define EEPROM_DONE_INTERRUPT_ENABLE                           8
>> > -#define VBUS_INTERRUPT_ENABLE                                  7
>> > -#define CONTROL_STATUS_INTERRUPT_ENABLE                                6
>> > -#define ROOT_PORT_RESET_INTERRUPT_ENABLE                       4
>> > -#define SUSPEND_REQUEST_INTERRUPT_ENABLE                       3
>> > -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE                        2
>> > -#define RESUME_INTERRUPT_ENABLE                                        1
>> > -#define SOF_INTERRUPT_ENABLE                                   0
>> > -       __le32                  irqstat0;
>> > -#define INTA_ASSERTED                                          12
>> > -#define SETUP_PACKET_INTERRUPT                                 7
>> > -#define ENDPOINT_F_INTERRUPT                                   6
>> > -#define ENDPOINT_E_INTERRUPT                                   5
>> > -#define ENDPOINT_D_INTERRUPT                                   4
>> > -#define ENDPOINT_C_INTERRUPT                                   3
>> > -#define ENDPOINT_B_INTERRUPT                                   2
>> > -#define ENDPOINT_A_INTERRUPT                                   1
>> > -#define ENDPOINT_0_INTERRUPT                                   0
>> > -       __le32                  irqstat1;
>> > -#define POWER_STATE_CHANGE_INTERRUPT                           27
>> > -#define PCI_ARBITER_TIMEOUT_INTERRUPT                          26
>> > -#define PCI_PARITY_ERROR_INTERRUPT                             25
>> > -#define PCI_INTA_INTERRUPT                                     24
>> > -#define PCI_PME_INTERRUPT                                      23
>> > -#define PCI_SERR_INTERRUPT                                     22
>> > -#define PCI_PERR_INTERRUPT                                     21
>> > -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT                    20
>> > -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT                    19
>> > -#define PCI_RETRY_ABORT_INTERRUPT                              17
>> > -#define PCI_MASTER_CYCLE_DONE_INTERRUPT                                16
>> > -#define GPIO_INTERRUPT                                         13
>> > -#define DMA_D_INTERRUPT                                                12
>> > -#define DMA_C_INTERRUPT                                                11
>> > -#define DMA_B_INTERRUPT                                                10
>> > -#define DMA_A_INTERRUPT                                                9
>> > -#define EEPROM_DONE_INTERRUPT                                  8
>> > -#define VBUS_INTERRUPT                                         7
>> > -#define CONTROL_STATUS_INTERRUPT                               6
>> > -#define ROOT_PORT_RESET_INTERRUPT                              4
>> > -#define SUSPEND_REQUEST_INTERRUPT                              3
>> > -#define SUSPEND_REQUEST_CHANGE_INTERRUPT                       2
>> > -#define RESUME_INTERRUPT                                       1
>> > -#define SOF_INTERRUPT                                          0
>> > -       /* offset 0x0030 */
>> > -       __le32                  idxaddr;
>> > -       __le32                  idxdata;
>> > -       __le32                  fifoctl;
>> > -#define PCI_BASE2_RANGE                                                16
>> > -#define IGNORE_FIFO_AVAILABILITY                               3
>> > -#define PCI_BASE2_SELECT                                       2
>> > -#define FIFO_CONFIGURATION_SELECT                              0
>> > -       u32                     _unused2;
>> > -       /* offset 0x0040 */
>> > -       __le32                  memaddr;
>> > -#define START                                                  28
>> > -#define DIRECTION                                              27
>> > -#define FIFO_DIAGNOSTIC_SELECT                                 24
>> > -#define MEMORY_ADDRESS                                         0
>> > -       __le32                  memdata0;
>> > -       __le32                  memdata1;
>> > -       u32                     _unused3;
>> > -       /* offset 0x0050 */
>> > -       __le32                  gpioctl;
>> > -#define GPIO3_LED_SELECT                                       12
>> > -#define GPIO3_INTERRUPT_ENABLE                                 11
>> > -#define GPIO2_INTERRUPT_ENABLE                                 10
>> > -#define GPIO1_INTERRUPT_ENABLE                                 9
>> > -#define GPIO0_INTERRUPT_ENABLE                                 8
>> > -#define GPIO3_OUTPUT_ENABLE                                    7
>> > -#define GPIO2_OUTPUT_ENABLE                                    6
>> > -#define GPIO1_OUTPUT_ENABLE                                    5
>> > -#define GPIO0_OUTPUT_ENABLE                                    4
>> > -#define GPIO3_DATA                                             3
>> > -#define GPIO2_DATA                                             2
>> > -#define GPIO1_DATA                                             1
>> > -#define GPIO0_DATA                                             0
>> > -       __le32                  gpiostat;
>> > -#define GPIO3_INTERRUPT                                                3
>> > -#define GPIO2_INTERRUPT                                                2
>> > -#define GPIO1_INTERRUPT                                                1
>> > -#define GPIO0_INTERRUPT                                                0
>> > -} __packed;
>> > -
>> > -/* usb control, BAR0 + 0x0080 */
>> > -struct net2280_usb_regs {
>> > -       /* offset 0x0080 */
>> > -       __le32                  stdrsp;
>> > -#define STALL_UNSUPPORTED_REQUESTS                             31
>> > -#define SET_TEST_MODE                                          16
>> > -#define GET_OTHER_SPEED_CONFIGURATION                          15
>> > -#define GET_DEVICE_QUALIFIER                                   14
>> > -#define SET_ADDRESS                                            13
>> > -#define ENDPOINT_SET_CLEAR_HALT                                        12
>> > -#define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP                  11
>> > -#define GET_STRING_DESCRIPTOR_2                                        10
>> > -#define GET_STRING_DESCRIPTOR_1                                        9
>> > -#define GET_STRING_DESCRIPTOR_0                                        8
>> > -#define GET_SET_INTERFACE                                      6
>> > -#define GET_SET_CONFIGURATION                                  5
>> > -#define GET_CONFIGURATION_DESCRIPTOR                           4
>> > -#define GET_DEVICE_DESCRIPTOR                                  3
>> > -#define GET_ENDPOINT_STATUS                                    2
>> > -#define GET_INTERFACE_STATUS                                   1
>> > -#define GET_DEVICE_STATUS                                      0
>> > -       __le32                  prodvendid;
>> > -#define     PRODUCT_ID                                         16
>> > -#define     VENDOR_ID                                          0
>> > -       __le32                  relnum;
>> > -       __le32                  usbctl;
>> > -#define SERIAL_NUMBER_INDEX                                    16
>> > -#define PRODUCT_ID_STRING_ENABLE                               13
>> > -#define VENDOR_ID_STRING_ENABLE                                        12
>> > -#define USB_ROOT_PORT_WAKEUP_ENABLE                            11
>> > -#define VBUS_PIN                                               10
>> > -#define TIMED_DISCONNECT                                       9
>> > -#define SUSPEND_IMMEDIATELY                                    7
>> > -#define SELF_POWERED_USB_DEVICE                                        6
>> > -#define REMOTE_WAKEUP_SUPPORT                                  5
>> > -#define PME_POLARITY                                           4
>> > -#define USB_DETECT_ENABLE                                      3
>> > -#define PME_WAKEUP_ENABLE                                      2
>> > -#define DEVICE_REMOTE_WAKEUP_ENABLE                            1
>> > -#define SELF_POWERED_STATUS                                    0
>> > -       /* offset 0x0090 */
>> > -       __le32                  usbstat;
>> > -#define HIGH_SPEED                                             7
>> > -#define FULL_SPEED                                             6
>> > -#define GENERATE_RESUME                                                5
>> > -#define GENERATE_DEVICE_REMOTE_WAKEUP                          4
>> > -       __le32                  xcvrdiag;
>> > -#define FORCE_HIGH_SPEED_MODE                                  31
>> > -#define FORCE_FULL_SPEED_MODE                                  30
>> > -#define USB_TEST_MODE                                          24
>> > -#define LINE_STATE                                             16
>> > -#define TRANSCEIVER_OPERATION_MODE                             2
>> > -#define TRANSCEIVER_SELECT                                     1
>> > -#define TERMINATION_SELECT                                     0
>> > -       __le32                  setup0123;
>> > -       __le32                  setup4567;
>> > -       /* offset 0x0090 */
>> > -       u32                     _unused0;
>> > -       __le32                  ouraddr;
>> > -#define FORCE_IMMEDIATE                                                7
>> > -#define OUR_USB_ADDRESS                                                0
>> > -       __le32                  ourconfig;
>> > -} __packed;
>> > -
>> > -/* pci control, BAR0 + 0x0100 */
>> > -struct net2280_pci_regs {
>> > -       /* offset 0x0100 */
>> > -       __le32                  pcimstctl;
>> > -#define PCI_ARBITER_PARK_SELECT                                        13
>> > -#define PCI_MULTI LEVEL_ARBITER                                        12
>> > -#define PCI_RETRY_ABORT_ENABLE                                 11
>> > -#define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE                 10
>> > -#define DMA_READ_MULTIPLE_ENABLE                               9
>> > -#define DMA_READ_LINE_ENABLE                                   8
>> > -#define PCI_MASTER_COMMAND_SELECT                              6
>> > -#define                MEM_READ_OR_WRITE                               0
>> > -#define                IO_READ_OR_WRITE                                1
>> > -#define                CFG_READ_OR_WRITE                               2
>> > -#define PCI_MASTER_START                                       5
>> > -#define PCI_MASTER_READ_WRITE                                  4
>> > -#define                PCI_MASTER_WRITE                                0
>> > -#define                PCI_MASTER_READ                                 1
>> > -#define PCI_MASTER_BYTE_WRITE_ENABLES                          0
>> > -       __le32                  pcimstaddr;
>> > -       __le32                  pcimstdata;
>> > -       __le32                  pcimststat;
>> > -#define PCI_ARBITER_CLEAR                                      2
>> > -#define PCI_EXTERNAL_ARBITER                                   1
>> > -#define PCI_HOST_MODE                                          0
>> > -} __packed;
>> > -
>> > -/* dma control, BAR0 + 0x0180 ... array of four structs like this,
>> > - * for channels 0..3.  see also struct net2280_dma:  descriptor
>> > - * that can be loaded into some of these registers.
>> > - */
>> > -struct net2280_dma_regs {      /* [11.7] */
>> > -       /* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */
>> > -       __le32                  dmactl;
>> > -#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE               25
>> > -#define DMA_CLEAR_COUNT_ENABLE                                 21
>> > -#define DESCRIPTOR_POLLING_RATE                                        19
>> > -#define                POLL_CONTINUOUS                                 0
>> > -#define                POLL_1_USEC                                     1
>> > -#define                POLL_100_USEC                                   2
>> > -#define                POLL_1_MSEC                                     3
>> > -#define DMA_VALID_BIT_POLLING_ENABLE                           18
>> > -#define DMA_VALID_BIT_ENABLE                                   17
>> > -#define DMA_SCATTER_GATHER_ENABLE                              16
>> > -#define DMA_OUT_AUTO_START_ENABLE                              4
>> > -#define DMA_PREEMPT_ENABLE                                     3
>> > -#define DMA_FIFO_VALIDATE                                      2
>> > -#define DMA_ENABLE                                             1
>> > -#define DMA_ADDRESS_HOLD                                       0
>> > -       __le32                  dmastat;
>> > -#define DMA_SCATTER_GATHER_DONE_INTERRUPT                      25
>> > -#define DMA_TRANSACTION_DONE_INTERRUPT                         24
>> > -#define DMA_ABORT                                              1
>> > -#define DMA_START                                              0
>> > -       u32                     _unused0[2];
>> > -       /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
>> > -       __le32                  dmacount;
>> > -#define VALID_BIT                                              31
>> > -#define DMA_DIRECTION                                          30
>> > -#define DMA_DONE_INTERRUPT_ENABLE                              29
>> > -#define END_OF_CHAIN                                           28
>> > -#define DMA_BYTE_COUNT_MASK                                    ((1<<24)-1)
>> > -#define DMA_BYTE_COUNT                                         0
>> > -       __le32                  dmaaddr;
>> > -       __le32                  dmadesc;
>> > -       u32                     _unused1;
>> > -} __packed;
>> > -
>> > -/* dedicated endpoint registers, BAR0 + 0x0200 */
>> > -
>> > -struct net2280_dep_regs {      /* [11.8] */
>> > -       /* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */
>> > -       __le32                  dep_cfg;
>> > -       /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
>> > -       __le32                  dep_rsp;
>> > -       u32                     _unused[2];
>> > -} __packed;
>> > -
>> > -/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
>> > - * like this, for ep0 then the configurable endpoints A..F
>> > - * ep0 reserved for control; E and F have only 64 bytes of fifo
>> > - */
>> > -struct net2280_ep_regs {       /* [11.9] */
>> > -       /* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */
>> > -       __le32                  ep_cfg;
>> > -#define ENDPOINT_BYTE_COUNT                                    16
>> > -#define ENDPOINT_ENABLE                                                10
>> > -#define ENDPOINT_TYPE                                          8
>> > -#define ENDPOINT_DIRECTION                                     7
>> > -#define ENDPOINT_NUMBER                                                0
>> > -       __le32                  ep_rsp;
>> > -#define SET_NAK_OUT_PACKETS                                    15
>> > -#define SET_EP_HIDE_STATUS_PHASE                               14
>> > -#define SET_EP_FORCE_CRC_ERROR                                 13
>> > -#define SET_INTERRUPT_MODE                                     12
>> > -#define SET_CONTROL_STATUS_PHASE_HANDSHAKE                     11
>> > -#define SET_NAK_OUT_PACKETS_MODE                               10
>> > -#define SET_ENDPOINT_TOGGLE                                    9
>> > -#define SET_ENDPOINT_HALT                                      8
>> > -#define CLEAR_NAK_OUT_PACKETS                                  7
>> > -#define CLEAR_EP_HIDE_STATUS_PHASE                             6
>> > -#define CLEAR_EP_FORCE_CRC_ERROR                               5
>> > -#define CLEAR_INTERRUPT_MODE                                   4
>> > -#define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE                   3
>> > -#define CLEAR_NAK_OUT_PACKETS_MODE                             2
>> > -#define CLEAR_ENDPOINT_TOGGLE                                  1
>> > -#define CLEAR_ENDPOINT_HALT                                    0
>> > -       __le32                  ep_irqenb;
>> > -#define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE                 6
>> > -#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE              5
>> > -#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE                  3
>> > -#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE               2
>> > -#define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE                   1
>> > -#define DATA_IN_TOKEN_INTERRUPT_ENABLE                         0
>> > -       __le32                  ep_stat;
>> > -#define FIFO_VALID_COUNT                                       24
>> > -#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID                     22
>> > -#define TIMEOUT                                                        21
>> > -#define USB_STALL_SENT                                         20
>> > -#define USB_IN_NAK_SENT                                                19
>> > -#define USB_IN_ACK_RCVD                                                18
>> > -#define USB_OUT_PING_NAK_SENT                                  17
>> > -#define USB_OUT_ACK_SENT                                       16
>> > -#define FIFO_OVERFLOW                                          13
>> > -#define FIFO_UNDERFLOW                                         12
>> > -#define FIFO_FULL                                              11
>> > -#define FIFO_EMPTY                                             10
>> > -#define FIFO_FLUSH                                             9
>> > -#define SHORT_PACKET_OUT_DONE_INTERRUPT                                6
>> > -#define SHORT_PACKET_TRANSFERRED_INTERRUPT                     5
>> > -#define NAK_OUT_PACKETS                                                4
>> > -#define DATA_PACKET_RECEIVED_INTERRUPT                         3
>> > -#define DATA_PACKET_TRANSMITTED_INTERRUPT                      2
>> > -#define DATA_OUT_PING_TOKEN_INTERRUPT                          1
>> > -#define DATA_IN_TOKEN_INTERRUPT                                        0
>> > -       /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
>> > -       __le32                  ep_avail;
>> > -       __le32                  ep_data;
>> > -       u32                     _unused0[2];
>> > -} __packed;
>> > -
>> > -struct net2280_reg_write {
>> > -       __le16 port;
>> > -       __le32 addr;
>> > -       __le32 val;
>> > -} __packed;
>> > -
>> > -struct net2280_reg_read {
>> > -       __le16 port;
>> > -       __le32 addr;
>> > -} __packed;
>> > -#endif /* NET2280_H */
>> > diff --git a/drivers/net/wireless/p54/p54usb.h b/drivers/net/wireless/p54/p54usb.h
>> > index d273be7..a5f5f0f 100644
>> > --- a/drivers/net/wireless/p54/p54usb.h
>> > +++ b/drivers/net/wireless/p54/p54usb.h
>> > @@ -16,7 +16,7 @@
>> >
>> >  /* for isl3886 register definitions used on ver 1 devices */
>> >  #include "p54pci.h"
>> > -#include "net2280.h"
>> > +#include <linux/usb/net2280.h>
>> >
>> >  /* pci */
>> >  #define NET2280_BASE           0x10000000
>> > @@ -93,6 +93,17 @@ enum net2280_op_type {
>> >         NET2280_DEV_CFG_U16     = 0x0883
>> >  };
>> >
>> > +struct net2280_reg_write {
>> > +       __le16 port;
>> > +       __le32 addr;
>> > +       __le32 val;
>> > +} __packed;
>> > +
>> > +struct net2280_reg_read {
>> > +       __le16 port;
>> > +       __le32 addr;
>> > +} __packed;
>> > +
>> >  #define P54U_FW_BLOCK 2048
>> >
>> >  #define X2_SIGNATURE "x2  "
>> > --
>> > 2.1.3
>> >
>>
>>
>>
>> --
>> Ricardo Ribalda
>>
>
> --
> John W. Linville                Someday the world will need a hero, and you
> linville@tuxdriver.com                  might be all we have.  Be ready.



-- 
Ricardo Ribalda

^ permalink raw reply

* Re: [PATCH] SSB / B44: fix WOL for BCM4401
From: Michael Büsch @ 2014-12-01 21:10 UTC (permalink / raw)
  To: Andrey Skvortsov
  Cc: Rafael J. Wysocki, Gary Zambrano, netdev, linux-kernel, b43-dev,
	Rafał Miłecki, Larry Finger
In-Reply-To: <1417466798-15735-1-git-send-email-Andrej.Skvortzov@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 4854 bytes --]

On Mon,  1 Dec 2014 23:46:38 +0300
Andrey Skvortsov <andrej.skvortzov@gmail.com> wrote:

> Wake On Lan was not working on laptop DELL Vostro 1500.
> If WOL was turned on, BCM4401 was powered up in suspend mode. LEDs blinked.
> But the laptop could not be woken up with the Magic Packet. The reason for
> that was that PCIE was not enabled as a system wakeup source and
> therefore the host PCI bridge was not powered up in suspend mode.
> PCIE was not enabled in suspend by PM because no child devices were
> registered as wakeup source during suspend process.
> On laptop BCM4401 is connected through the SSB bus, that is connected to the
> PCI-Express bus. SSB and B44 did not use standard PM wakeup functions
> and did not forward wakeup settings to their parents.
> To fix that B44 driver enables PM wakeup and registers new wakeup source
> using device_set_wakeup_enable(). Wakeup is automatically reported to the parent SSB
> bus via power.wakeup_path. SSB bus enables wakeup for the parent PCI bridge, if there is any
> child devices with enabled wakeup functionality. All other steps are
> done by PM core code.

Thanks, this looks good.
I assume you tested this (I currently don't have a device to test this).

Larry, Rafał, any other b43 user:
Can you please test whether this doesn't cause regressions for suspend/resume on b43?
(Patch is attached as reference)


> Signed-off-by: Andrey Skvortsov <Andrej.Skvortzov@gmail.com>
> ---
>  drivers/net/ethernet/broadcom/b44.c |    2 ++
>  drivers/ssb/pcihost_wrapper.c       |   33 ++++++++++++++++++++++-----------
>  2 files changed, 24 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
> index 416620f..ffeaf47 100644
> --- a/drivers/net/ethernet/broadcom/b44.c
> +++ b/drivers/net/ethernet/broadcom/b44.c
> @@ -2104,6 +2104,7 @@ static int b44_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
>  		bp->flags &= ~B44_FLAG_WOL_ENABLE;
>  	spin_unlock_irq(&bp->lock);
>  
> +	device_set_wakeup_enable(bp->sdev->dev, wol->wolopts & WAKE_MAGIC);
>  	return 0;
>  }
>  
> @@ -2452,6 +2453,7 @@ static int b44_init_one(struct ssb_device *sdev,
>  		}
>  	}
>  
> +	device_set_wakeup_capable(sdev->dev, true);
>  	netdev_info(dev, "%s %pM\n", DRV_DESCRIPTION, dev->dev_addr);
>  
>  	return 0;
> diff --git a/drivers/ssb/pcihost_wrapper.c b/drivers/ssb/pcihost_wrapper.c
> index 69161bb..410215c 100644
> --- a/drivers/ssb/pcihost_wrapper.c
> +++ b/drivers/ssb/pcihost_wrapper.c
> @@ -11,15 +11,17 @@
>   * Licensed under the GNU/GPL. See COPYING for details.
>   */
>  
> +#include <linux/pm.h>
>  #include <linux/pci.h>
>  #include <linux/export.h>
>  #include <linux/slab.h>
>  #include <linux/ssb/ssb.h>
>  
>  
> -#ifdef CONFIG_PM
> -static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state)
> +#ifdef CONFIG_PM_SLEEP
> +static int ssb_pcihost_suspend(struct device *d)
>  {
> +	struct pci_dev *dev = to_pci_dev(d);
>  	struct ssb_bus *ssb = pci_get_drvdata(dev);
>  	int err;
>  
> @@ -28,17 +30,23 @@ static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state)
>  		return err;
>  	pci_save_state(dev);
>  	pci_disable_device(dev);
> -	pci_set_power_state(dev, pci_choose_state(dev, state));
> +
> +	/* if there is a wakeup enabled child device on ssb bus,
> +	   enable pci wakeup posibility. */
> +	device_set_wakeup_enable(d, d->power.wakeup_path);
> +
> +	pci_prepare_to_sleep(dev);
>  
>  	return 0;
>  }
>  
> -static int ssb_pcihost_resume(struct pci_dev *dev)
> +static int ssb_pcihost_resume(struct device *d)
>  {
> +	struct pci_dev *dev = to_pci_dev(d);
>  	struct ssb_bus *ssb = pci_get_drvdata(dev);
>  	int err;
>  
> -	pci_set_power_state(dev, PCI_D0);
> +	pci_back_from_sleep(dev);
>  	err = pci_enable_device(dev);
>  	if (err)
>  		return err;
> @@ -49,10 +57,12 @@ static int ssb_pcihost_resume(struct pci_dev *dev)
>  
>  	return 0;
>  }
> -#else /* CONFIG_PM */
> -# define ssb_pcihost_suspend	NULL
> -# define ssb_pcihost_resume	NULL
> -#endif /* CONFIG_PM */
> +
> +static const struct dev_pm_ops ssb_pcihost_pm_ops = {
> +	SET_SYSTEM_SLEEP_PM_OPS(ssb_pcihost_suspend, ssb_pcihost_resume)
> +};
> +
> +#endif /* CONFIG_PM_SLEEP */
>  
>  static int ssb_pcihost_probe(struct pci_dev *dev,
>  			     const struct pci_device_id *id)
> @@ -115,8 +125,9 @@ int ssb_pcihost_register(struct pci_driver *driver)
>  {
>  	driver->probe = ssb_pcihost_probe;
>  	driver->remove = ssb_pcihost_remove;
> -	driver->suspend = ssb_pcihost_suspend;
> -	driver->resume = ssb_pcihost_resume;
> +#ifdef CONFIG_PM_SLEEP
> +	driver->driver.pm = &ssb_pcihost_pm_ops;
> +#endif
>  
>  	return pci_register_driver(driver);
>  }




-- 
Michael

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: b44_wol.patch --]
[-- Type: text/x-patch, Size: 4357 bytes --]

From: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Subject: [PATCH] SSB / B44: fix WOL for BCM4401

Wake On Lan was not working on laptop DELL Vostro 1500.
If WOL was turned on, BCM4401 was powered up in suspend mode. LEDs blinked.
But the laptop could not be woken up with the Magic Packet. The reason for
that was that PCIE was not enabled as a system wakeup source and
therefore the host PCI bridge was not powered up in suspend mode.
PCIE was not enabled in suspend by PM because no child devices were
registered as wakeup source during suspend process.
On laptop BCM4401 is connected through the SSB bus, that is connected to the
PCI-Express bus. SSB and B44 did not use standard PM wakeup functions
and did not forward wakeup settings to their parents.
To fix that B44 driver enables PM wakeup and registers new wakeup source
using device_set_wakeup_enable(). Wakeup is automatically reported to the parent SSB
bus via power.wakeup_path. SSB bus enables wakeup for the parent PCI bridge, if there is any
child devices with enabled wakeup functionality. All other steps are
done by PM core code.

Signed-off-by: Andrey Skvortsov <Andrej.Skvortzov@gmail.com>
---
 drivers/net/ethernet/broadcom/b44.c |    2 ++
 drivers/ssb/pcihost_wrapper.c       |   33 ++++++++++++++++++++++-----------
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 416620f..ffeaf47 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -2104,6 +2104,7 @@ static int b44_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 		bp->flags &= ~B44_FLAG_WOL_ENABLE;
 	spin_unlock_irq(&bp->lock);
 
+	device_set_wakeup_enable(bp->sdev->dev, wol->wolopts & WAKE_MAGIC);
 	return 0;
 }
 
@@ -2452,6 +2453,7 @@ static int b44_init_one(struct ssb_device *sdev,
 		}
 	}
 
+	device_set_wakeup_capable(sdev->dev, true);
 	netdev_info(dev, "%s %pM\n", DRV_DESCRIPTION, dev->dev_addr);
 
 	return 0;
diff --git a/drivers/ssb/pcihost_wrapper.c b/drivers/ssb/pcihost_wrapper.c
index 69161bb..410215c 100644
--- a/drivers/ssb/pcihost_wrapper.c
+++ b/drivers/ssb/pcihost_wrapper.c
@@ -11,15 +11,17 @@
  * Licensed under the GNU/GPL. See COPYING for details.
  */
 
+#include <linux/pm.h>
 #include <linux/pci.h>
 #include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/ssb/ssb.h>
 
 
-#ifdef CONFIG_PM
-static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int ssb_pcihost_suspend(struct device *d)
 {
+	struct pci_dev *dev = to_pci_dev(d);
 	struct ssb_bus *ssb = pci_get_drvdata(dev);
 	int err;
 
@@ -28,17 +30,23 @@ static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state)
 		return err;
 	pci_save_state(dev);
 	pci_disable_device(dev);
-	pci_set_power_state(dev, pci_choose_state(dev, state));
+
+	/* if there is a wakeup enabled child device on ssb bus,
+	   enable pci wakeup posibility. */
+	device_set_wakeup_enable(d, d->power.wakeup_path);
+
+	pci_prepare_to_sleep(dev);
 
 	return 0;
 }
 
-static int ssb_pcihost_resume(struct pci_dev *dev)
+static int ssb_pcihost_resume(struct device *d)
 {
+	struct pci_dev *dev = to_pci_dev(d);
 	struct ssb_bus *ssb = pci_get_drvdata(dev);
 	int err;
 
-	pci_set_power_state(dev, PCI_D0);
+	pci_back_from_sleep(dev);
 	err = pci_enable_device(dev);
 	if (err)
 		return err;
@@ -49,10 +57,12 @@ static int ssb_pcihost_resume(struct pci_dev *dev)
 
 	return 0;
 }
-#else /* CONFIG_PM */
-# define ssb_pcihost_suspend	NULL
-# define ssb_pcihost_resume	NULL
-#endif /* CONFIG_PM */
+
+static const struct dev_pm_ops ssb_pcihost_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(ssb_pcihost_suspend, ssb_pcihost_resume)
+};
+
+#endif /* CONFIG_PM_SLEEP */
 
 static int ssb_pcihost_probe(struct pci_dev *dev,
 			     const struct pci_device_id *id)
@@ -115,8 +125,9 @@ int ssb_pcihost_register(struct pci_driver *driver)
 {
 	driver->probe = ssb_pcihost_probe;
 	driver->remove = ssb_pcihost_remove;
-	driver->suspend = ssb_pcihost_suspend;
-	driver->resume = ssb_pcihost_resume;
+#ifdef CONFIG_PM_SLEEP
+	driver->driver.pm = &ssb_pcihost_pm_ops;
+#endif
 
 	return pci_register_driver(driver);
 }
-- 
1.7.2.5



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

^ permalink raw reply related

* Re: Is this 32-bit NCM?
From: Enrico Mioso @ 2014-12-01 21:11 UTC (permalink / raw)
  To: Mingying.Zhu
  Cc: Bjørn Mork, Alex Strizhevsky, ShaojunMidge.Tan, youtux,
	linux-usb, netdev, Eli.Britstein
In-Reply-To: <87ppc71xne.fsf@nemi.mork.no>

So ... I have two ideas left for now.
We know for sure the problem is in the way we TX frames, not the way we RX them 
(the way we send, generate them, not the way we receive them).
Si I have two ideas, and I ask for help from the Linux-usb mailing list for 
this first one.

1 - Does a wayexist to "replay" traffic crom a usb capture?
We might try to take the usb frames generated by Windows, and send them to the 
device to see if there is any reaction. It should not be science fiction, I saw 
them do that in the eciadsl old project.
2 - The huawei ndis driver: does it work with these devices?
It should be a little bit out-dated now (at least in terms of dates, it might 
work as well): the code is A LOT but, just in case, to see if there is any 
chances it'll work. It remains to be seen in which kernels it can actually 
compile again.

If this works we might analyse what's happening and try to debug this out.
But I really would like this to work in the cdc_ncm driver + huawei_cdc_ncm.
Thank you.

^ permalink raw reply

* Re: [PATCH net-next] net: bcmgenet: enable driver to work without a device tree
From: Petri Gynther @ 2014-12-01 21:13 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, David Miller
In-Reply-To: <CAGXr9JH2w1xoUwzzfdC4gi99iu3Eo4zkyWCsZi1b_x_gm+OKqg@mail.gmail.com>

Hi Florian,

Getting back to this (finally). I have made changes per your comments.
Sending a new patch shortly.

-- Petri

On Fri, Oct 10, 2014 at 12:46 PM, Petri Gynther <pgynther@google.com> wrote:
> Hi Florian,
>
> On Fri, Oct 10, 2014 at 11:59 AM, Florian Fainelli <f.fainelli@gmail.com> wrote:
>> On 10/10/2014 11:35 AM, Petri Gynther wrote:
>>> Broadcom 7xxx MIPS-based STB platforms do not use device trees.
>>> Modify bcmgenet driver so that it can be used on those platforms.
>>>
>>> Signed-off-by: Petri Gynther <pgynther@google.com>
>>> ---
>>
>> [snip]
>>
>>> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
>>> index dbf524e..5191e3f 100644
>>> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
>>> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
>>> @@ -17,6 +17,17 @@
>>>  #include <linux/if_vlan.h>
>>>  #include <linux/phy.h>
>>>
>>> +struct bcmgenet_platform_data {
>>> +     void __iomem    *base_reg;
>>> +     int             irq0;
>>> +     int             irq1;
>>
>> Why would these members here? The platform device should provide those
>> as standard resources that the driver fetches using
>> platform_get_resource() and platform_get_irq().
>>
>
> I modeled this on struct bcmemac_platform_data that was used in the
> legacy BRCMSTB code.
> include/linux/brcmstb/brcmstb.h:
>
> struct bcmemac_platform_data {
>         /* used by the BSP code only */
>         uintptr_t               base_reg;
>         int                     irq0;
>         int                     irq1;
>
>         int                     phy_type;
>         int                     phy_id;
>         int                     phy_speed;
>         u8                      macaddr[ETH_ALEN];
> };
>
> The legacy BRCMSTB code stores all relevant GENET info in this struct
> and then creates the resources from that info:
>
> static void __init brcm_register_genet(int id, struct bcmemac_platform_data *pd)
> {
>         struct resource res[3];
>         struct platform_device *pdev;
>
>         memset(&res, 0, sizeof(res));
>         res[0].start = BPHYSADDR(pd->base_reg);
>         res[0].end = BPHYSADDR(pd->base_reg + 0x4fff);
>         res[0].flags = IORESOURCE_MEM;
>
>         res[1].start = res[1].end = pd->irq0;
>         res[1].flags = IORESOURCE_IRQ;
>
>         res[2].start = res[2].end = pd->irq1;
>         res[2].flags = IORESOURCE_IRQ;
>
>         brcm_alloc_macaddr(pd->macaddr);
>
>         pdev = platform_device_alloc("bcmgenet", id);
>         platform_device_add_resources(pdev, res, 3);
>         platform_device_add_data(pdev, pd, sizeof(*pd));
>         platform_device_add(pdev);
> }
>
>>> +     int             phy_type;
>>> +     int             phy_addr;
>>> +     int             phy_speed;
>>> +     u8              macaddr[ETH_ALEN];
>>> +     int             genet_version;
>>> +};
>>
>> I would rather we put this in include/linux/platform_data/bcmgenet.h
>> where it belongs.
>>
>
> I wasn't aware of the directory include/linux/platform_data/. Yes,
> that's where this belongs.
>
>>> +
>>>  /* total number of Buffer Descriptors, same for Rx/Tx */
>>>  #define TOTAL_DESC                           256
>>>
>>> diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
>>> index 9ff799a..e5ff913 100644
>>> --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
>>> +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
>>> @@ -157,6 +157,21 @@ static void bcmgenet_mii_setup(struct net_device *dev)
>>>       phy_print_status(phydev);
>>>  }
>>>
>>> +static int bcmgenet_moca_fphy_update(struct net_device *dev,
>>> +                                  struct fixed_phy_status *status)
>>> +{
>>> +     struct bcmgenet_priv *priv = netdev_priv(dev);
>>> +     struct phy_device *phydev = priv->phydev;
>>> +
>>> +     /*
>>> +      * MoCA daemon updates phydev->autoneg to reflect the link status.
>>> +      * Update MoCA fixed PHY status accordingly, so that the PHY state
>>> +      * machine becomes aware of the real link status.
>>> +      */
>>> +     status->link = phydev->autoneg;
>>> +     return 0;
>>> +}
>>
>> I don't want to see that in the upstream driver, please enable the link
>> interrupts like I suggested before and do not use the autoneg field at
>> all, which should require no MoCA daemon modifications.
>>
>
> I added debug printk's to bcmgenet_isr0 to check on UMAC_IRQ_LINK_UP
> and UMAC_IRQ_LINK_DOWN.
> I am not getting those interrupts on eth1 (MoCA) port when coax is
> removed/inserted.
> But, they do work on eth0.
>
> I'll modify init_umac() to enable those interrupts for MoCA port and retest.
>
>> [snip]
>>
>>>
>>>       priv->phydev = phydev;
>>> @@ -437,6 +464,104 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv)
>>>       return 0;
>>>  }
>>>
>>> +static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv)
>>> +{
>>> +     struct device *kdev = &priv->pdev->dev;
>>> +     struct bcmgenet_platform_data *pd = kdev->platform_data;
>>> +     struct mii_bus *mdio = priv->mii_bus;
>>> +     int phy_addr = pd->phy_addr;
>>> +     struct phy_device *phydev;
>>> +     int ret;
>>> +     int i;
>>> +
>>> +     /* Disable automatic MDIO bus scan */
>>> +     mdio->phy_mask = ~0;
>>> +
>>> +     /* Clear all the IRQ properties */
>>> +     if (mdio->irq)
>>> +             for (i = 0; i < PHY_MAX_ADDR; i++)
>>> +                     mdio->irq[i] = PHY_POLL;
>>> +
>>> +     /* Register the MDIO bus */
>>> +     ret = mdiobus_register(mdio);
>>> +     if (ret) {
>>> +             dev_err(kdev, "failed to register MDIO bus\n");
>>> +             return ret;
>>> +     }
>>> +
>>> +     /*
>>> +      * bcmgenet_platform_data needs to pass a valid PHY address for
>>> +      * internal/external PHY or -1 for MoCA PHY.
>>> +      */
>>> +     if (phy_addr >= 0 && phy_addr < PHY_MAX_ADDR) {
>>
>> We do too much low-level PHY device handling, and since you already have
>> the phy_type provided via platform_data, we can use that hint to do the
>> following:
>>
>> 1) an internal or external PHY with MDIO accesses should leave the bus
>> auto-probing on with the specified PHY address in the mdio bus phy_mask
>>
>> 2) a MoCA PHY or an external PHY with MDIO accesses disabled should use
>> the fixed-0 MII bus instead.
>>
>> This would look like this:
>>
>> if (pd->phy_type != PHY_INTERFACE_MODE_MOCA || pd->mdio_enabled)
>>         mdio->phy_mask = ~(1 << pd->phy_addr);
>>
>>         ...
>>         mdiobus_register()
>>
>>         priv->phydev = mdio->bus->phy_map[pd->phy_addr];
>>
>>         phydev->phy_flags |= mask;
>>
>> if (pd->phy_type == PHY_INTERFACE_MODE_MOCA || !pd->mdio_enabled)
>>         priv->phydev = fixed_phy_register(...);
>>
>> and in both cases, later on you do connect to the PHY device
>>
>> I can cook a patch to illustrate what I think this could look like since
>> I realize using pseudo-code to explain might not be the best thing.
>>
>
> I think I understand what you mean. I'll make a change.
>
>>> +             /*
>>> +              * 10/100/1000 Ethernet port with external or internal PHY.
>>> +              */
>>> +             phydev = get_phy_device(mdio, phy_addr, false);
>>> +             if (!phydev || IS_ERR(phydev)) {
>>> +                     dev_err(kdev, "failed to create PHY device\n");
>>> +                     mdiobus_unregister(mdio);
>>> +                     return 1;
>>> +             }
>>> +
>>> +             phydev->irq = PHY_POLL;
>>> +
>>> +             ret = phy_device_register(phydev);
>>> +             if (ret) {
>>> +                     dev_err(kdev, "failed to register PHY device\n");
>>> +                     phy_device_free(phydev);
>>> +                     mdiobus_unregister(mdio);
>>> +                     return 1;
>>> +             }
>>> +
>>> +             priv->phydev = phydev;
>>> +             priv->phy_interface = pd->phy_type;
>>> +     } else {
>>> +             /*
>>> +              * MoCA port with no MDIO-accessible PHY.
>>> +              * We need to use 1000/HD fixed PHY to represent the link layer.
>>> +              * MoCA daemon interacts with this PHY via ethtool.
>>> +              */
>>> +             struct fixed_phy_status moca_fphy_status = {
>>> +                     .link = 0,
>>> +                     .duplex = 0,
>>
>> This should be DUPLEX_FULL here, the link between GENET and the MoCA
>> Ethernet convergence layer is full-duplex by nature (despite we report
>> the PHY being half-duplex, which is a mistake in the downstream driver),
>> the MoCA medium on the coaxial cable is half-duplex though, but that is
>> handled by the MoCA HW.
>>
>> NB: I had issues in the past using a half-duplex link with the MoCA
>> ethernet convergence layer, causing various types of packet loss because
>> we use a simplified signaling internally in the hardware.
>>
>
> I picked this setting from 3.3 GENET driver. I'll test 1000/FULL on my
> platform to see if it works.
>
>>> +                     .speed = 1000,
>>> +                     .pause = 0,
>>> +                     .asym_pause = 0,
>>> +             };
>>> +
>>> +             phydev = fixed_phy_register(PHY_POLL, &moca_fphy_status, NULL);
>>> +             if (!phydev || IS_ERR(phydev)) {
>>> +                     dev_err(kdev, "failed to register fixed PHY device\n");
>>> +                     mdiobus_unregister(mdio);
>>> +                     return 1;
>>> +             }
>>> +
>>> +             phydev->autoneg = AUTONEG_DISABLE;
>>> +
>>> +             ret = fixed_phy_set_link_update(phydev,
>>> +                                             bcmgenet_moca_fphy_update);
>>> +             if (ret) {
>>> +                     dev_err(kdev, "failed to set fixed PHY link update\n");
>>> +             }
>>
>> Should not we propagate this error to the caller?
>
> Good catch. Yes.
>
>> --
>> Florian

^ permalink raw reply


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