Netdev List
 help / color / mirror / Atom feed
* [PATCH 14/14] mm: Account for the number of times direct reclaimers get throttled
From: Mel Gorman @ 2011-10-06 12:41 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux-MM, Linux-Netdev, LKML, David Miller, Neil Brown,
	Peter Zijlstra, Mel Gorman
In-Reply-To: <1317904910-14095-1-git-send-email-mgorman@suse.de>

Under significant pressure when writing back to network-backed storage,
direct reclaimers may get throttled. This is expected to be a
short-lived event and the processes get woken up again but processes do
get stalled. This patch counts how many times such stalling occurs. It's
up to the administrator whether to reduce these stalls by increasing
min_free_kbytes.

Signed-off-by: Mel Gorman <mgorman@suse.de>
---
 include/linux/vm_event_item.h |    1 +
 mm/vmscan.c                   |    1 +
 mm/vmstat.c                   |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 03b90cdc..652e5f3 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -29,6 +29,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
 		FOR_ALL_ZONES(PGSTEAL),
 		FOR_ALL_ZONES(PGSCAN_KSWAPD),
 		FOR_ALL_ZONES(PGSCAN_DIRECT),
+		PGSCAN_DIRECT_THROTTLE,
 #ifdef CONFIG_NUMA
 		PGSCAN_ZONE_RECLAIM_FAILED,
 #endif
diff --git a/mm/vmscan.c b/mm/vmscan.c
index ca5ca02..6cb1aee 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2258,6 +2258,7 @@ static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
 		return;
 
 	/* Throttle */
+	count_vm_event(PGSCAN_DIRECT_THROTTLE);
 	wait_event_killable(zone->zone_pgdat->pfmemalloc_wait,
 		pfmemalloc_watermark_ok(zone->zone_pgdat, high_zoneidx));
 }
diff --git a/mm/vmstat.c b/mm/vmstat.c
index d52b13d..96070b4 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -740,6 +740,7 @@ const char * const vmstat_text[] = {
 	TEXTS_FOR_ZONES("pgsteal")
 	TEXTS_FOR_ZONES("pgscan_kswapd")
 	TEXTS_FOR_ZONES("pgscan_direct")
+	"pgscan_direct_throttle",
 
 #ifdef CONFIG_NUMA
 	"zone_reclaim_failed",
-- 
1.7.3.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related

* [PATCH 0/3] iproute2: various usage and doc fixes
From: Petr Sabata @ 2011-10-06 12:45 UTC (permalink / raw)
  To: netdev; +Cc: Petr Sabata

Petr Sabata (3):
  iproute2: ss - fix missing parameters
  iproute2: lnstat - fix typos
  iproute2: arpd - fix usage and manpage options

 man/man8/arpd.8 |    4 ++--
 man/man8/ss.8   |    4 ++--
 misc/arpd.c     |    2 +-
 misc/lnstat.c   |    4 ++--
 misc/ss.c       |    6 ++++--
 5 files changed, 11 insertions(+), 9 deletions(-)

-- 
1.7.6.4

^ permalink raw reply

* [PATCH 2/3] iproute2: lnstat - fix typos
From: Petr Sabata @ 2011-10-06 12:45 UTC (permalink / raw)
  To: netdev; +Cc: Petr Sabata
In-Reply-To: <1317905134-23175-1-git-send-email-contyk@redhat.com>

Signed-off-by: Petr Sabata <contyk@redhat.com>
---
 misc/lnstat.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/misc/lnstat.c b/misc/lnstat.c
index 32ab6a4..bd19cc1 100644
--- a/misc/lnstat.c
+++ b/misc/lnstat.c
@@ -45,7 +45,7 @@ static struct option opts[] = {
 	{ "file", 1, NULL, 'f' },
 	{ "help", 0, NULL, 'h' },
 	{ "interval", 1, NULL, 'i' },
-	{ "key", 1, NULL, 'k' },
+	{ "keys", 1, NULL, 'k' },
 	{ "subject", 1, NULL, 's' },
 	{ "width", 1, NULL, 'w' },
 };
@@ -61,7 +61,7 @@ static int usage(char *name, int exit_code)
 	fprintf(stderr, "\t-V --version\t\tPrint Version of Program\n");
 	fprintf(stderr, "\t-c --count <count>\t"
 			"Print <count> number of intervals\n");
-	fprintf(stderr, "\t-d --dumpt\t\t"
+	fprintf(stderr, "\t-d --dump\t\t"
 			"Dump list of available files/keys\n");
 	fprintf(stderr, "\t-f --file <file>\tStatistics file to use\n");
 	fprintf(stderr, "\t-h --help\t\tThis help message\n");
-- 
1.7.6.4

^ permalink raw reply related

* [PATCH 1/3] iproute2: ss - fix missing parameters
From: Petr Sabata @ 2011-10-06 12:45 UTC (permalink / raw)
  To: netdev; +Cc: Petr Sabata
In-Reply-To: <1317905134-23175-1-git-send-email-contyk@redhat.com>

Signed-off-by: Petr Sabata <contyk@redhat.com>
---
 man/man8/ss.8 |    4 ++--
 misc/ss.c     |    6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/man/man8/ss.8 b/man/man8/ss.8
index b309df2..0b9a8c4 100644
--- a/man/man8/ss.8
+++ b/man/man8/ss.8
@@ -85,12 +85,12 @@ Display Unix domain sockets (alias for -f unix).
 Display sockets of type FAMILY.
 Currently the following families are supported: unix, inet, inet6, link, netlink.
 .TP
-.B \-A QUERY, \-\-query=QUERY
+.B \-A QUERY, \-\-query=QUERY, \-\-socket=QUERY
 List of socket tables to dump, separated by commas. The following identifiers
 are understood: all, inet, tcp, udp, raw, unix, packet, netlink, unix_dgram,
 unix_stream, packet_raw, packet_dgram.
 .TP
-.B \-D FILE
+.B \-D FILE, \-\-diag=FILE
 Do not display anything, just dump raw information about TCP sockets to FILE after applying filters. If FILE is - stdout is used.
 .TP
 .B \-F FILE, \-\-filter=FILE
diff --git a/misc/ss.c b/misc/ss.c
index 1597ff9..253f8d3 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2416,9 +2416,10 @@ static void _usage(FILE *dest)
 "   -x, --unix		display only Unix domain sockets\n"
 "   -f, --family=FAMILY display sockets of type FAMILY\n"
 "\n"
-"   -A, --query=QUERY\n"
+"   -A, --query=QUERY, --socket=QUERY\n"
 "       QUERY := {all|inet|tcp|udp|raw|unix|packet|netlink}[,QUERY]\n"
 "\n"
+"   -D, --diag=FILE     Dump raw information about TCP sockets to FILE\n"
 "   -F, --filter=FILE   read filter information from FILE\n"
 "       FILTER := [ state TCP-STATE ] [ EXPRESSION ]\n"
 		);
@@ -2486,8 +2487,9 @@ static const struct option long_opts[] = {
 	{ "packet", 0, 0, '0' },
 	{ "family", 1, 0, 'f' },
 	{ "socket", 1, 0, 'A' },
+	{ "query", 1, 0, 'A' },
 	{ "summary", 0, 0, 's' },
-	{ "diag", 0, 0, 'D' },
+	{ "diag", 1, 0, 'D' },
 	{ "filter", 1, 0, 'F' },
 	{ "version", 0, 0, 'V' },
 	{ "help", 0, 0, 'h' },
-- 
1.7.6.4

^ permalink raw reply related

* [PATCH 3/3] iproute2: arpd - fix usage and manpage options
From: Petr Sabata @ 2011-10-06 12:45 UTC (permalink / raw)
  To: netdev; +Cc: Petr Sabata
In-Reply-To: <1317905134-23175-1-git-send-email-contyk@redhat.com>

Signed-off-by: Petr Sabata <contyk@redhat.com>
---
 man/man8/arpd.8 |    4 ++--
 misc/arpd.c     |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/man/man8/arpd.8 b/man/man8/arpd.8
index d172600..37b6ba4 100644
--- a/man/man8/arpd.8
+++ b/man/man8/arpd.8
@@ -4,7 +4,7 @@
 arpd \- userspace arp daemon.
 
 .SH SYNOPSIS
-Usage: arpd [ -lk ] [ -a N ] [ -b dbase ] [ -f file ] [ interfaces ]
+Usage: arpd [ -lkh? ] [ -a N ] [ -b dbase ] [ -B number ] [ -f file ] [ -n time ] [ -R rate ] [ interfaces ]
 
 .SH DESCRIPTION
 The
@@ -34,7 +34,7 @@ Suppress sending broadcast queries by kernel. It takes sense together with optio
 -n <TIME>
 Timeout of negative cache. When resolution fails arpd suppresses further attempts to resolve for this period. It makes sense only together with option -k This timeout should not be too much longer than boot time of a typical host not supporting gratuitous ARP. Default value is 60 seconds.
 .TP
--r <RATE>
+-R <RATE>
 Maximal steady rate of broadcasts sent by arpd in packets per second. Default value is 1.
 .TP
 -B <NUMBER>
diff --git a/misc/arpd.c b/misc/arpd.c
index 128c49d..124d3fb 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -94,7 +94,7 @@ int broadcast_burst = 3000;
 void usage(void)
 {
 	fprintf(stderr,
-"Usage: arpd [ -lk ] [ -a N ] [ -b dbase ] [ -f file ] [ interfaces ]\n");
+"Usage: arpd [ -lkh? ] [ -a N ] [ -b dbase ] [ -B number ] [ -f file ] [ -n time ] [ -R rate ] [ interfaces ]\n");
 	exit(1);
 }
 
-- 
1.7.6.4

^ permalink raw reply related

* [net-next] cs89x0: Move the driver into the Cirrus dir
From: Jeff Kirsher @ 2011-10-06 13:14 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, gospo, sassmann, Russell Nelson,
	Andrew Morton

The cs89x0 driver was initial placed in the apple/ when it
should have been placed in the cirrus/.  This resolves the
issue by moving the dirver and fixing up the respective
Kconfig(s) and Makefile(s).

Thanks to Sascha for reporting the issue.

CC: Russell Nelson <nelson@crynwr.com>
CC: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/apple/Kconfig              |   22 +---------------------
 drivers/net/ethernet/apple/Makefile             |    1 -
 drivers/net/ethernet/cirrus/Kconfig             |   22 +++++++++++++++++++++-
 drivers/net/ethernet/cirrus/Makefile            |    1 +
 drivers/net/ethernet/{apple => cirrus}/cs89x0.c |    0
 drivers/net/ethernet/{apple => cirrus}/cs89x0.h |    0
 6 files changed, 23 insertions(+), 23 deletions(-)
 rename drivers/net/ethernet/{apple => cirrus}/cs89x0.c (100%)
 rename drivers/net/ethernet/{apple => cirrus}/cs89x0.h (100%)

diff --git a/drivers/net/ethernet/apple/Kconfig b/drivers/net/ethernet/apple/Kconfig
index 59d5c26..90ad2c1 100644
--- a/drivers/net/ethernet/apple/Kconfig
+++ b/drivers/net/ethernet/apple/Kconfig
@@ -5,8 +5,7 @@
 config NET_VENDOR_APPLE
 	bool "Apple devices"
 	default y
-	depends on (PPC_PMAC && PPC32) || MAC || ISA || EISA || MACH_IXDP2351 \
-		   || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440
+	depends on (PPC_PMAC && PPC32) || MACE || MAC
 	---help---
 	  If you have a network (Ethernet) card belonging to this class, say Y
 	  and read the Ethernet-HOWTO, available from
@@ -75,23 +74,4 @@ config MACMACE
 	  say Y and read the Ethernet-HOWTO, available from
 	  <http://www.tldp.org/docs.html#howto>.
 
-config CS89x0
-	tristate "CS89x0 support"
-	depends on (ISA || EISA || MACH_IXDP2351 \
-		|| ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440)
-	---help---
-	  Support for CS89x0 chipset based Ethernet cards. If you have a
-	  network (Ethernet) card of this type, say Y and read the
-	  Ethernet-HOWTO, available from
-	  <http://www.tldp.org/docs.html#howto> as well as
-	  <file:Documentation/networking/cs89x0.txt>.
-
-	  To compile this driver as a module, choose M here. The module
-	  will be called cs89x0.
-
-config CS89x0_NONISA_IRQ
-	def_bool y
-	depends on CS89x0 != n
-	depends on MACH_IXDP2351 || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440
-
 endif # NET_VENDOR_APPLE
diff --git a/drivers/net/ethernet/apple/Makefile b/drivers/net/ethernet/apple/Makefile
index 9d30086..0d3a591 100644
--- a/drivers/net/ethernet/apple/Makefile
+++ b/drivers/net/ethernet/apple/Makefile
@@ -5,5 +5,4 @@
 obj-$(CONFIG_MACE) += mace.o
 obj-$(CONFIG_BMAC) += bmac.o
 obj-$(CONFIG_MAC89x0) += mac89x0.o
-obj-$(CONFIG_CS89x0) += cs89x0.o
 obj-$(CONFIG_MACMACE) += macmace.o
diff --git a/drivers/net/ethernet/cirrus/Kconfig b/drivers/net/ethernet/cirrus/Kconfig
index e9386ef..6cbb81c 100644
--- a/drivers/net/ethernet/cirrus/Kconfig
+++ b/drivers/net/ethernet/cirrus/Kconfig
@@ -5,7 +5,8 @@
 config NET_VENDOR_CIRRUS
 	bool "Cirrus devices"
 	default y
-	depends on ARM && ARCH_EP93XX
+	depends on ISA || EISA || MACH_IXDP2351 || ARCH_IXDP2X01 \
+		|| MACH_MX31ADS || MACH_QQ2440 || (ARM && ARCH_EP93XX)
 	---help---
 	  If you have a network (Ethernet) card belonging to this class, say Y
 	  and read the Ethernet-HOWTO, available from
@@ -18,6 +19,25 @@ config NET_VENDOR_CIRRUS
 
 if NET_VENDOR_CIRRUS
 
+config CS89x0
+	tristate "CS89x0 support"
+	depends on (ISA || EISA || MACH_IXDP2351 \
+		|| ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440)
+	---help---
+	  Support for CS89x0 chipset based Ethernet cards. If you have a
+	  network (Ethernet) card of this type, say Y and read the
+	  Ethernet-HOWTO, available from
+	  <http://www.tldp.org/docs.html#howto> as well as
+	  <file:Documentation/networking/cs89x0.txt>.
+
+	  To compile this driver as a module, choose M here. The module
+	  will be called cs89x0.
+
+config CS89x0_NONISA_IRQ
+	def_bool y
+	depends on CS89x0 != n
+	depends on MACH_IXDP2351 || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440
+
 config EP93XX_ETH
 	tristate "EP93xx Ethernet support"
 	depends on ARM && ARCH_EP93XX
diff --git a/drivers/net/ethernet/cirrus/Makefile b/drivers/net/ethernet/cirrus/Makefile
index 9905ea2..14bd77e 100644
--- a/drivers/net/ethernet/cirrus/Makefile
+++ b/drivers/net/ethernet/cirrus/Makefile
@@ -2,4 +2,5 @@
 # Makefile for the Cirrus network device drivers.
 #
 
+obj-$(CONFIG_CS89x0) += cs89x0.o
 obj-$(CONFIG_EP93XX_ETH) += ep93xx_eth.o
diff --git a/drivers/net/ethernet/apple/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c
similarity index 100%
rename from drivers/net/ethernet/apple/cs89x0.c
rename to drivers/net/ethernet/cirrus/cs89x0.c
diff --git a/drivers/net/ethernet/apple/cs89x0.h b/drivers/net/ethernet/cirrus/cs89x0.h
similarity index 100%
rename from drivers/net/ethernet/apple/cs89x0.h
rename to drivers/net/ethernet/cirrus/cs89x0.h
-- 
1.7.6.4

^ permalink raw reply related

* Re: loopback IP alias breaks tftp?
From: Josh Boyer @ 2011-10-06 13:23 UTC (permalink / raw)
  To: Julian Anastasov, Joel Sing; +Cc: netdev
In-Reply-To: <alpine.LFD.2.00.1110060009020.1959@ja.ssi.bg>

On Thu, Oct 06, 2011 at 12:18:44AM +0300, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Wed, 5 Oct 2011, Josh Boyer wrote:
> 
> > Hi All,
> > 
> > We've had a report [1] of a change in behavior when trying to use an IP
> > alias to tftp from a loopback device.  Apparently the steps outlined in
> > the bug worked in 2.6.35, and broke somewhere before 2.6.38.6.
> > 
> > I can confirm the steps fail on a 3.0 based kernel and I'm trying to do
> > a git bisect to find the commit involved, but I thought I would send
> > this along to see if anyone might have an idea.  (Also, I'm not really
> > sure how valid of a usecase this was to begin with.)
> 
> 	What about commit 9fc3bbb4a752f108cf096d96640f3b548bbbce6c ?
> 
> ipv4/route.c: respect prefsrc for local routes
> 
> http://marc.info/?t=129412232500001&r=1&w=2
> 
> > [1] https://bugzilla.redhat.com/show_bug.cgi?id=739534

Yep.  That is exactly what my git bisect said too.

So now we have a change in behavior since that commit for the usecase
described in the bug above, but I'm unsure if that usecase was ever
really valid or if the commit had unintentional side effects.

Joel (or anyone else) can you take a look and comment?

josh

^ permalink raw reply

* Re: [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled
From: Eli Cohen @ 2011-10-06 13:57 UTC (permalink / raw)
  To: Thadeu Lima de Souza Cascardo
  Cc: Benjamin Herrenschmidt, Yevgeny Petrilin, netdev@vger.kernel.org,
	Eli Cohen, linuxppc-dev
In-Reply-To: <20111005081502.GB2681@mtldesk30>

On Wed, Oct 05, 2011 at 10:15:02AM +0200, Eli Cohen wrote:

How about this patch - can you give it a try?


>From dee60547aa9e35a02835451d9e694cd80dd3072f Mon Sep 17 00:00:00 2001
From: Eli Cohen <eli@mellanox.co.il>
Date: Thu, 6 Oct 2011 15:50:02 +0200
Subject: [PATCH] mlx4_en: Fix blue flame on powerpc

The source buffer used for copying into the blue flame register is already in
big endian. However, when copying to device on powerpc, the endianess is
swapped so the data reaches th device in little endian which is wrong. On x86
based platform no swapping occurs so it reaches the device with the correct
endianess. Fix this by calling le32_to_cpu() on the buffer. On LE systems there
is no change; on BE there will be a swap.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
---
 drivers/net/mlx4/en_tx.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
index 16337fb..3743acc 100644
--- a/drivers/net/mlx4/en_tx.c
+++ b/drivers/net/mlx4/en_tx.c
@@ -601,6 +601,16 @@ u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb)
 
 static void mlx4_bf_copy(unsigned long *dst, unsigned long *src, unsigned bytecnt)
 {
+	int i;
+	__le32 *psrc = (__le32 *)src;
+
+	/*
+	 * the buffer is already in big endian. For little endian machines that's
+	 * fine. For big endain machines we must swap since the chipset swaps again
+	 */
+	for (i = 0; i < bytecnt / 4; ++i)
+		psrc[i] = le32_to_cpu(psrc[i]);
+
 	__iowrite64_copy(dst, src, bytecnt / 8);
 }
 
-- 
1.7.7.rc0.70.g82660



> On Tue, Oct 04, 2011 at 05:26:20PM -0300, Thadeu Lima de Souza Cascardo wrote:
> 
> I believe we have an endianess problem here. The source buffer is in
> big endian - in x86 archs, it will rich the pci device unswapped since
> both x86 and pci are little endian. In ppc, it wil be swapped by the
> chipset so it will reach the device in little endian which is wrong.
> So, in mlx4_bf_copy, you could loop over the buffer and swap32 the all
> the dwords before the call to __iowrite64_copy. Of course which should
> fix this in an arch independent manner. Let me know this works for
> you.
> 
> > On Tue, Oct 04, 2011 at 08:02:12AM +0200, Benjamin Herrenschmidt wrote:
> > > On Mon, 2011-10-03 at 17:53 -0300, Thadeu Lima de Souza Cascardo wrote:
> > > 
> > >  .../...
> > > 
> > > > > Can you also send me the output of ethtool -i?
> > > > > It seems that there is a problem with write combining on Power processors, we will check this issue.
> > > > > 
> > > > > Yevgeny
> > > > 
> > > > Hello, Yevgeny.
> > > > 
> > > > You will find the output of ethtool -i below.
> > > > 
> > > > I am copying Ben and powerpc list, in case this is an issue with Power
> > > > processors. They can provide us some more insight into this.
> > > 
> > > May I get some background please ? :-)
> > > 
> > > I'm not aware of a specific issue with write combining but I'd need to
> > > know more about what you are doing and the code to do it to comment on
> > > whether it should work or not.
> > > 
> > > Cheers,
> > > Ben.
> > > 
> > > 
> > 
> > Hello, Ben.
> > 
> > Sorry for that. I am testing mlx4_en driver on a POWER. Yevgeny has
> > added blue frame support, that does not require writing to the device
> > memory to indicate a new packet (the doorbell register as it is called).
> > 
> > Well, the ring is getting full with no interrupt or packets transmitted.
> > I simply added a write to the doorbell register and it works for me.
> > Yevgeny says this is not the right fix, claiming there is a problem with
> > write combining on POWER. The code uses memory barriers, so I don't know
> > why there is any problem.
> > 
> > I am posting the code here to show better what the situation is.
> > Yevgeny can tell more about the device and the driver.
> > 
> > The code below is the driver as of now, including a diff with what I
> > changed and had resulted OK for me. Before the blue frame support, the
> > only code executed was the else part. I can't tell much what the device
> > should be seeing and doing after the blue frame part of the code is
> > executed. But it does send the packet if I write to the doorbell
> > register.
> > 
> > Yevgeny, can you tell us what the device should be doing and why you
> > think this is a problem on POWER? Is it possible that this is simply a
> > problem with the firmware version?
> > 
> > Thanks,
> > Cascardo.
> > 
> > ---
> >         if (ring->bf_enabled && desc_size <= MAX_BF && !bounce &&
> > !vlan_tag) {
> >                 *(u32 *) (&tx_desc->ctrl.vlan_tag) |=
> > ring->doorbell_qpn;
> >                 op_own |= htonl((bf_index & 0xffff) << 8);
> >                 /* Ensure new descirptor hits memory
> >                 * before setting ownership of this descriptor to HW */
> >                 wmb();
> >                 tx_desc->ctrl.owner_opcode = op_own;
> > 
> >                 wmb();
> > 
> >                 mlx4_bf_copy(ring->bf.reg + ring->bf.offset, (unsigned
> > long *) &tx_desc->ctrl,
> >                      desc_size);
> > 
> >                 wmb();
> > 
> >                 ring->bf.offset ^= ring->bf.buf_size;
> >         } else {
> >                 /* Ensure new descirptor hits memory
> >                 * before setting ownership of this descriptor to HW */
> >                 wmb();
> >                 tx_desc->ctrl.owner_opcode = op_own;
> > -               wmb();
> > -               writel(ring->doorbell_qpn, ring->bf.uar->map +
> > MLX4_SEND_DOORBELL);
> >         }
> > 
> > +       wmb();
> > +       writel(ring->doorbell_qpn, ring->bf.uar->map +
> > MLX4_SEND_DOORBELL);
> > +
> > ---

^ permalink raw reply related

* Re: [PATCH net] mscan: zero accidentally copied register content
From: Oliver Hartkopp @ 2011-10-06 14:01 UTC (permalink / raw)
  To: Wolfram Sang, Wolfgang Grandegger; +Cc: Linux Netdev List, Andre Naujoks
In-Reply-To: <20111006092456.GB1974@pengutronix.de>

On 10/06/11 11:24, Wolfram Sang wrote:

> 
>> Why do you want to change 16-bit accesses in general? They are faster
>> than two 8 bit accesses. 
> 
> Yup, was thinking the same.


Ah, i did not get this from your code example

	if (can_dlc & 1)
		*payload = in_be16() & mask;


which probably does the same as Wolfgangs more obvious suggestion

	if (frame->can_dlc & 1)
		frame->data[frame->can_dlc - 1] = in_8(data);


:-)

As my patch could be done without real testing, as i did not change the
register access and only fixed the result ...

	if (frame->can_dlc & 1)
		frame->data[frame->can_dlc] = 0;


... it would be nice if e.g. Wolfgang could send his patch after some testing,
as i currently don't have access to my MPC5200 hardware here.

Tnx & best regards,
Oliver

^ permalink raw reply

* Re: [PATCH net] mscan: zero accidentally copied register content
From: Wolfram Sang @ 2011-10-06 14:09 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: Wolfgang Grandegger, Linux Netdev List, Andre Naujoks
In-Reply-To: <4E8DB4C9.30109@hartkopp.net>

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


> Ah, i did not get this from your code example
> 
> 	if (can_dlc & 1)
> 		*payload = in_be16() & mask;

Sorry, I thought it was obvious that I was using pseudo_code here :)

> ... it would be nice if e.g. Wolfgang could send his patch after some testing,
> as i currently don't have access to my MPC5200 hardware here.

What about Andre?

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

^ permalink raw reply

* RE: [PATCH] mlx4_en: fix transmit of packages when blue frame isenabled
From: David Laight @ 2011-10-06 14:10 UTC (permalink / raw)
  To: Eli Cohen, Thadeu Lima de Souza Cascardo
  Cc: Eli Cohen, Yevgeny Petrilin, linuxppc-dev, netdev
In-Reply-To: <20111006135759.GH2681@mtldesk30>

 
>  static void mlx4_bf_copy(unsigned long *dst, unsigned long *src,
unsigned bytecnt) {
> +	int i;
> +	__le32 *psrc = (__le32 *)src;
> +
> +	/*
> +	 * the buffer is already in big endian. For little endian
machines that's
> +	 * fine. For big endain machines we must swap since the chipset
swaps again
> +	 */
> +	for (i = 0; i < bytecnt / 4; ++i)
> +		psrc[i] = le32_to_cpu(psrc[i]);
> +
>  	__iowrite64_copy(dst, src, bytecnt / 8);
>  }

That code looks horrid...
1) I'm not sure the caller expects the buffer to be corrupted.
2) It contains a lot of memory cycles.
3) It looked from the calls that this code is copying descriptors,
   so the transfer length is probably 1 or 2 words - so the loop
   is inefficient.
4) ppc doesn't have a fast byteswap instruction (very new gcc might
   use the byteswapping memery access for the le32_to_cpu() though),
   so it would be better getting the byteswap done inside
   __iowrite64_copy() - since that is probably requesting a byteswap
   anyway.
OTOH I'm not at all clear about the 64bit xfers....

^ permalink raw reply

* Re: [PATCH net] mscan: zero accidentally copied register content
From: Andre Naujoks @ 2011-10-06 14:14 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Oliver Hartkopp, Wolfgang Grandegger, Linux Netdev List
In-Reply-To: <20111006140904.GD1974@pengutronix.de>

Hi.

2011/10/6 Wolfram Sang <w.sang@pengutronix.de>
>
> > Ah, i did not get this from your code example
> >
> >       if (can_dlc & 1)
> >               *payload = in_be16() & mask;
>
> Sorry, I thought it was obvious that I was using pseudo_code here :)
>
> > ... it would be nice if e.g. Wolfgang could send his patch after some testing,
> > as i currently don't have access to my MPC5200 hardware here.
>
> What about Andre?

I am currently trying to test the first version Oliver sent. I am
currently having some problems
with my hardware and I don't know what it is yet.

I will give Wolfgangs suggestion a try after my problems are sorted out here.

Regards
  Andre

>
> Regards,
>
>   Wolfram
>
> --
> Pengutronix e.K.                           | Wolfram Sang                |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAk6NtoAACgkQD27XaX1/VRudMQCeMX3yMc+Au65BwKDocJNXtG/d
> RxgAoJnY/p0csrHa0o/7SpnQdtEhEOQn
> =Sxlb
> -----END PGP SIGNATURE-----
>

^ permalink raw reply

* Re: [PATCH net] mscan: zero accidentally copied register content
From: Oliver Hartkopp @ 2011-10-06 14:33 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: Wolfram Sang, Linux Netdev List, Andre Naujoks
In-Reply-To: <4E8D7065.8040905@grandegger.com>

On 10/06/11 11:09, Wolfgang Grandegger wrote:

> On 10/06/2011 09:02 AM, Oliver Hartkopp wrote:
>>
>> I think if one would like to rework the 16bit register access (which is used
>> in the rx path /and/ in the tx path also) this should go via net-next after
>> some discussion and testing.
> 
> Why do you want to change 16-bit accesses in general? They are faster
> than two 8 bit accesses. 
> 
>> IMHO this fix is small and clear and especially not risky. I wonder if
>> reworking the 16 bit register access is worth the effort?
> 
> I would prefer:
> 
>  	if (!(frame->can_id & CAN_RTR_FLAG)) {
>  		void __iomem *data = &regs->rx.dsr1_0;
>  		u16 *payload = (u16 *)frame->data;
>  
>  		for (i = 0; i < frame->can_dlc / 2; i++) {
>  			*payload++ = in_be16(data);
>  			data += 2 + _MSCAN_RESERVED_DSR_SIZE;
>  		}
> 		/* copy remaining byte */
> 		if (frame->can_dlc & 1)
> 			frame->data[frame->can_dlc - 1] = in_8(data);
>  	}


Besides the fact that Andre is going to test this idea from Wolfgang now, are
you really sure that it must be

	in_8(data)

and not

	in_8(data+1)

???

And that data definitely points to the right place?

I would prefer to be really cautious with these big endian 16 bit registers!

Therefore my fix with

+		/* zero accidentally copied register content at odd DLCs */
+		if (frame->can_dlc & 1)
+			frame->data[frame->can_dlc] = 0;

only repairing the result looks much more defensive to me.

Regards,
Oliver

^ permalink raw reply

* Re: [PATCH net] mscan: zero accidentally copied register content
From: Andre Naujoks @ 2011-10-06 15:03 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: Wolfgang Grandegger, Wolfram Sang, Linux Netdev List
In-Reply-To: <4E8DBC34.80607@hartkopp.net>

2011/10/6 Oliver Hartkopp <socketcan@hartkopp.net>:
> On 10/06/11 11:09, Wolfgang Grandegger wrote:
>
>> On 10/06/2011 09:02 AM, Oliver Hartkopp wrote:
>>>
>>> I think if one would like to rework the 16bit register access (which is used
>>> in the rx path /and/ in the tx path also) this should go via net-next after
>>> some discussion and testing.
>>
>> Why do you want to change 16-bit accesses in general? They are faster
>> than two 8 bit accesses.
>>
>>> IMHO this fix is small and clear and especially not risky. I wonder if
>>> reworking the 16 bit register access is worth the effort?
>>
>> I would prefer:
>>
>>       if (!(frame->can_id & CAN_RTR_FLAG)) {
>>               void __iomem *data = &regs->rx.dsr1_0;
>>               u16 *payload = (u16 *)frame->data;
>>
>>               for (i = 0; i < frame->can_dlc / 2; i++) {
>>                       *payload++ = in_be16(data);
>>                       data += 2 + _MSCAN_RESERVED_DSR_SIZE;
>>               }
>>               /* copy remaining byte */
>>               if (frame->can_dlc & 1)
>>                       frame->data[frame->can_dlc - 1] = in_8(data);
>>       }
>
>
> Besides the fact that Andre is going to test this idea from Wolfgang now, are
> you really sure that it must be
>
>        in_8(data)
>
> and not
>
>        in_8(data+1)
>
> ???
>
> And that data definitely points to the right place?
>
> I would prefer to be really cautious with these big endian 16 bit registers!
>
> Therefore my fix with
>
> +               /* zero accidentally copied register content at odd DLCs */
> +               if (frame->can_dlc & 1)
> +                       frame->data[frame->can_dlc] = 0;
>
> only repairing the result looks much more defensive to me.

First things first: Both ways seem to work correctly. At least on the
MPC5200 I have here.

But I am with Oliver on this one. The solution looks much simpler and
endianess errors are not possible. If the few CPU cycles are worth it
on the other hand, then Wolfgangs version is probably preferable. I
don't have access to this kind of hardware on a little endian machine
to test it, though.

Greetings
  Andre

>
> Regards,
> Oliver
>

^ permalink raw reply

* Re: A new 40G Network driver ready to submit to the kernel tree
From: David @ 2011-10-06 15:06 UTC (permalink / raw)
  To: Joyce Yu - System Software; +Cc: netdev@vger.kernel.org
In-Reply-To: <4E8CE4A0.4060202@oracle.com>


在 2011-10-6,7:13,Joyce Yu - System Software <joyce.yu@oracle.com> 写道:

> 
> 
> I have a new 40G Network driver ready to submit to the kernel tree. The driver has been ported to latest linux-3.0-rc5 and net-2.6-353e5c9 tree. The driver versions for 2.6.18 and 2.6.32 based kernel have been fully tested and released to the customer. Shall I just send the driverxx.c and driverxx.h for net-2.6-353e5c9 and linux-3.0-rc5 to this alias?  

net tree and linux tree are just only for bug fix. New features or new drivers should be merged from net-next tree which locates at Github site. 

Shan Wei
> 
> Thanks,
> Joyce
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply

* Re: [PATCH 0/3] iproute2: various usage and doc fixes
From: Stephen Hemminger @ 2011-10-06 15:25 UTC (permalink / raw)
  To: Petr Sabata; +Cc: netdev
In-Reply-To: <1317905134-23175-1-git-send-email-contyk@redhat.com>

On Thu,  6 Oct 2011 14:45:31 +0200
Petr Sabata <contyk@redhat.com> wrote:

> Petr Sabata (3):
>   iproute2: ss - fix missing parameters
>   iproute2: lnstat - fix typos
>   iproute2: arpd - fix usage and manpage options
> 
>  man/man8/arpd.8 |    4 ++--
>  man/man8/ss.8   |    4 ++--
>  misc/arpd.c     |    2 +-
>  misc/lnstat.c   |    4 ++--
>  misc/ss.c       |    6 ++++--
>  5 files changed, 11 insertions(+), 9 deletions(-)
> 

All applied. 

^ permalink raw reply

* Re: [PATCH 1/8] vxge: convert to SKB paged frag API.
From: Ian Campbell @ 2011-10-06 16:00 UTC (permalink / raw)
  To: Michał Mirosław, David Miller; +Cc: netdev@vger.kernel.org, Jon Mason
In-Reply-To: <1317884756.24742.13.camel@dagon.hellion.org.uk>

On Thu, 2011-10-06 at 08:05 +0100, Ian Campbell wrote:
> On Wed, 2011-10-05 at 22:03 +0100, Michał Mirosław wrote:
> > 2011/10/5 Ian Campbell <ian.campbell@citrix.com>:
> > [...]
> > > --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
> > > +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
> > > @@ -923,9 +923,9 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev)
> > >                if (!frag->size)
> > >                        continue;
> > >
> > > -               dma_pointer = (u64) pci_map_page(fifo->pdev, frag->page,
> > > -                               frag->page_offset, frag->size,
> > > -                               PCI_DMA_TODEVICE);
> > > +               dma_pointer = (u64)skb_frag_dma_map(&fifo->pdev->dev, frag,
> > > +                                                   0, frag->size,
> > > +                                                   PCI_DMA_TODEVICE);
> > 
> > This should be DMA_TO_DEVICE instead of PCI_DMA_TODEVICE.
> > 
> > >
> > >                if (unlikely(pci_dma_mapping_error(fifo->pdev, dma_pointer)))
> > >                        goto _exit2;
> > 
> > I would also change this to dma_mapping_error() in one go.
> > 
> > Just a random patch check.
> 
> Thanks Michał.
> 
> I'm sure I must have made the same mistakes in a whole bunch of patches
> which have already been applied. I'll knock up a fixup patch.

Here it is. David, if you want N separate patches (or a git pull
request?) let me know.

8<---------------------------------------------

From 755028af197868cc63ac71248742b3bc3eefaf37 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@citrix.com>
Date: Thu, 6 Oct 2011 11:10:48 +0100
Subject: [PATCH] net: use DMA_x_DEVICE and dma_mapping_error with skb_frag_dma_map

When I converted some drivers from pci_map_page to skb_frag_dma_map I
neglected to convert PCI_DMA_xDEVICE into DMA_x_DEVICE and
pci_dma_mapping_error into dma_mapping_error.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 drivers/infiniband/hw/amso1100/c2.c                |    3 +--
 drivers/infiniband/hw/nes/nes_nic.c                |    4 ++--
 drivers/net/ethernet/alteon/acenic.c               |    2 +-
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c    |    2 +-
 drivers/net/ethernet/atheros/atl1e/atl1e_main.c    |    2 +-
 drivers/net/ethernet/atheros/atlx/atl1.c           |    2 +-
 drivers/net/ethernet/broadcom/bnx2.c               |    2 +-
 drivers/net/ethernet/broadcom/tg3.c                |    4 ++--
 drivers/net/ethernet/chelsio/cxgb/sge.c            |    2 +-
 drivers/net/ethernet/chelsio/cxgb3/sge.c           |    2 +-
 drivers/net/ethernet/cisco/enic/enic_main.c        |    4 ++--
 drivers/net/ethernet/marvell/skge.c                |    2 +-
 drivers/net/ethernet/marvell/sky2.c                |    8 ++++----
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c   |    2 +-
 drivers/net/ethernet/natsemi/ns83820.c             |    2 +-
 drivers/net/ethernet/neterion/s2io.c               |    2 +-
 drivers/net/ethernet/nvidia/forcedeth.c            |    4 ++--
 drivers/net/ethernet/pasemi/pasemi_mac.c           |    4 ++--
 .../net/ethernet/qlogic/netxen/netxen_nic_main.c   |    4 ++--
 drivers/net/ethernet/qlogic/qla3xxx.c              |    4 ++--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c   |    4 ++--
 drivers/net/ethernet/qlogic/qlge/qlge_main.c       |    4 ++--
 drivers/net/ethernet/sfc/tx.c                      |    6 +++---
 drivers/net/ethernet/sun/cassini.c                 |    2 +-
 drivers/net/ethernet/sun/sungem.c                  |    2 +-
 drivers/net/ethernet/tehuti/tehuti.c               |    2 +-
 drivers/net/ethernet/via/via-velocity.c            |    2 +-
 drivers/net/vmxnet3/vmxnet3_drv.c                  |    2 +-
 drivers/staging/et131x/et1310_tx.c                 |    2 +-
 29 files changed, 43 insertions(+), 44 deletions(-)

diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c
index 6a8f36e..6e85a75 100644
--- a/drivers/infiniband/hw/amso1100/c2.c
+++ b/drivers/infiniband/hw/amso1100/c2.c
@@ -803,8 +803,7 @@ static int c2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 			skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 			maplen = frag->size;
 			mapaddr = skb_frag_dma_map(&c2dev->pcidev->dev, frag,
-						   0, maplen,
-						   PCI_DMA_TODEVICE);
+						   0, maplen, DMA_TO_DEVICE);
 			elem = elem->next;
 			elem->skb = NULL;
 			elem->mapaddr = mapaddr;
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index 96cb35a..7cb7f29 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -445,7 +445,7 @@ static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
 				&skb_shinfo(skb)->frags[skb_fragment_index];
 			bus_address = skb_frag_dma_map(&nesdev->pcidev->dev,
 						       frag, 0, frag->size,
-						       PCI_DMA_TODEVICE);
+						       DMA_TO_DEVICE);
 			wqe_fragment_length[wqe_fragment_index] =
 					cpu_to_le16(skb_shinfo(skb)->frags[skb_fragment_index].size);
 			set_wqe_64bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_FRAG0_LOW_IDX+(2*wqe_fragment_index),
@@ -566,7 +566,7 @@ tso_sq_no_longer_full:
 				tso_bus_address[tso_frag_count] =
 					skb_frag_dma_map(&nesdev->pcidev->dev,
 							 frag, 0, frag->size,
-							 PCI_DMA_TODEVICE);
+							 DMA_TO_DEVICE);
 			}
 
 			tso_frag_index = 0;
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c
index 8794cf8..b1a4e82 100644
--- a/drivers/net/ethernet/alteon/acenic.c
+++ b/drivers/net/ethernet/alteon/acenic.c
@@ -2487,7 +2487,7 @@ restart:
 
 			mapping = skb_frag_dma_map(&ap->pdev->dev, frag, 0,
 						   frag->size,
-						   PCI_DMA_TODEVICE);
+						   DMA_TO_DEVICE);
 
 			flagsize = (frag->size << 16);
 			if (skb->ip_summed == CHECKSUM_PARTIAL)
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 2b9f925..12a0b30 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -2183,7 +2183,7 @@ static void atl1c_tx_map(struct atl1c_adapter *adapter,
 		buffer_info->dma = skb_frag_dma_map(&adapter->pdev->dev,
 						    frag, 0,
 						    buffer_info->length,
-						    PCI_DMA_TODEVICE);
+						    DMA_TO_DEVICE);
 		ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY);
 		ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_PAGE,
 			ATL1C_PCIMAP_TODEVICE);
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 7e27eb3..97c45a4b 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -1769,7 +1769,7 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
 							  frag,
 							  (i * MAX_TX_BUF_LEN),
 							  tx_buffer->length,
-							  PCI_DMA_TODEVICE);
+							  DMA_TO_DEVICE);
 			ATL1E_SET_PCIMAP_TYPE(tx_buffer, ATL1E_TX_PCIMAP_PAGE);
 			use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma);
 			use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
index edf826a..43511ab 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -2285,7 +2285,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
 			buf_len -= buffer_info->length;
 			buffer_info->dma = skb_frag_dma_map(&adapter->pdev->dev,
 				frag, i * ATL1_MAX_TX_BUF_LEN,
-				buffer_info->length, PCI_DMA_TODEVICE);
+				buffer_info->length, DMA_TO_DEVICE);
 
 			if (++next_to_use == tpd_ring->count)
 				next_to_use = 0;
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 21bdda3..ad24d8c 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -6539,7 +6539,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 		len = frag->size;
 		mapping = skb_frag_dma_map(&bp->pdev->dev, frag, 0, len,
-					   PCI_DMA_TODEVICE);
+					   DMA_TO_DEVICE);
 		if (dma_mapping_error(&bp->pdev->dev, mapping))
 			goto dma_error;
 		dma_unmap_addr_set(&txr->tx_buf_ring[ring_prod], mapping,
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 26c6bd4..3abcb4d 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6779,12 +6779,12 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 			len = frag->size;
 			mapping = skb_frag_dma_map(&tp->pdev->dev, frag, 0,
-						   len, PCI_DMA_TODEVICE);
+						   len, DMA_TO_DEVICE);
 
 			tnapi->tx_buffers[entry].skb = NULL;
 			dma_unmap_addr_set(&tnapi->tx_buffers[entry], mapping,
 					   mapping);
-			if (pci_dma_mapping_error(tp->pdev, mapping))
+			if (dma_mapping_error(tp->pdev, mapping))
 				goto dma_error;
 
 			if (tg3_tx_frag_set(tnapi, &entry, &budget, mapping,
diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c b/drivers/net/ethernet/chelsio/cxgb/sge.c
index 7cde425..0a511c4a 100644
--- a/drivers/net/ethernet/chelsio/cxgb/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c
@@ -1278,7 +1278,7 @@ static inline void write_tx_descs(struct adapter *adapter, struct sk_buff *skb,
 		}
 
 		mapping = skb_frag_dma_map(&adapter->pdev->dev, frag, 0,
-					   frag->size, PCI_DMA_TODEVICE);
+					   frag->size, DMA_TO_DEVICE);
 		desc_mapping = mapping;
 		desc_len = frag->size;
 
diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c
index a0baaa0..2f46b37 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
@@ -980,7 +980,7 @@ static inline unsigned int make_sgl(const struct sk_buff *skb,
 		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
 		mapping = skb_frag_dma_map(&pdev->dev, frag, 0, frag->size,
-					   PCI_DMA_TODEVICE);
+					   DMA_TO_DEVICE);
 		sgp->len[j] = cpu_to_be32(frag->size);
 		sgp->addr[j] = cpu_to_be64(mapping);
 		j ^= 1;
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index aeab6cd..1bc908f 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -607,7 +607,7 @@ static inline void enic_queue_wq_skb_cont(struct enic *enic,
 		enic_queue_wq_desc_cont(wq, skb,
 			skb_frag_dma_map(&enic->pdev->dev,
 					 frag, 0, frag->size,
-					 PCI_DMA_TODEVICE),
+					 DMA_TO_DEVICE),
 			frag->size,
 			(len_left == 0),	/* EOP? */
 			loopback);
@@ -726,7 +726,7 @@ static inline void enic_queue_wq_skb_tso(struct enic *enic,
 				(unsigned int)WQ_ENET_MAX_DESC_LEN);
 			dma_addr = skb_frag_dma_map(&enic->pdev->dev, frag,
 						    offset, len,
-						    PCI_DMA_TODEVICE);
+						    DMA_TO_DEVICE);
 			enic_queue_wq_desc_cont(wq, skb,
 				dma_addr,
 				len,
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
index a0a6471..32db4c8 100644
--- a/drivers/net/ethernet/marvell/skge.c
+++ b/drivers/net/ethernet/marvell/skge.c
@@ -2777,7 +2777,7 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb,
 			skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
 			map = skb_frag_dma_map(&hw->pdev->dev, frag, 0,
-					       frag->size, PCI_DMA_TODEVICE);
+					       frag->size, DMA_TO_DEVICE);
 
 			e = e->next;
 			e->skb = skb;
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 338b10c..7baff3e 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -1229,9 +1229,9 @@ static int sky2_rx_map_skb(struct pci_dev *pdev, struct rx_ring_info *re,
 
 		re->frag_addr[i] = skb_frag_dma_map(&pdev->dev, frag, 0,
 						    frag->size,
-						    PCI_DMA_FROMDEVICE);
+						    DMA_FROM_DEVICE);
 
-		if (pci_dma_mapping_error(pdev, re->frag_addr[i]))
+		if (dma_mapping_error(pdev, re->frag_addr[i]))
 			goto map_page_error;
 	}
 	return 0;
@@ -1936,9 +1936,9 @@ static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
 		const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
 		mapping = skb_frag_dma_map(&hw->pdev->dev, frag, 0,
-					   frag->size, PCI_DMA_TODEVICE);
+					   frag->size, DMA_TO_DEVICE);
 
-		if (pci_dma_mapping_error(hw->pdev, mapping))
+		if (dma_mapping_error(hw->pdev, mapping))
 			goto mapping_unwind;
 
 		upper = upper_32_bits(mapping);
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 8bf6034..2663727 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -2928,7 +2928,7 @@ again:
 		frag_idx++;
 		len = frag->size;
 		bus = skb_frag_dma_map(&mgp->pdev->dev, frag, 0, len,
-				       PCI_DMA_TODEVICE);
+				       DMA_TO_DEVICE);
 		dma_unmap_addr_set(&tx->info[idx], bus, bus);
 		dma_unmap_len_set(&tx->info[idx], len, len);
 	}
diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c
index e0895e4..73616b9 100644
--- a/drivers/net/ethernet/natsemi/ns83820.c
+++ b/drivers/net/ethernet/natsemi/ns83820.c
@@ -1161,7 +1161,7 @@ again:
 			break;
 
 		buf = skb_frag_dma_map(&dev->pci_dev->dev, frag, 0,
-				       frag->size, PCI_DMA_TODEVICE);
+				       frag->size, DMA_TO_DEVICE);
 		dprintk("frag: buf=%08Lx  page=%08lx offset=%08lx\n",
 			(long long)buf, (long) page_to_pfn(frag->page),
 			frag->page_offset);
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
index ef5b825..4ec7e3f 100644
--- a/drivers/net/ethernet/neterion/s2io.c
+++ b/drivers/net/ethernet/neterion/s2io.c
@@ -4193,7 +4193,7 @@ static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev)
 		txdp->Buffer_Pointer = (u64)skb_frag_dma_map(&sp->pdev->dev,
 							     frag, 0,
 							     frag->size,
-							     PCI_DMA_TODEVICE);
+							     DMA_TO_DEVICE);
 		txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size);
 		if (offload_type == SKB_GSO_UDP)
 			txdp->Control_1 |= TXD_UFO_EN;
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 4e39b8c..84baa59 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -2150,7 +2150,7 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
 							&np->pci_dev->dev,
 							frag, offset,
 							bcnt,
-							PCI_DMA_TODEVICE);
+							DMA_TO_DEVICE);
 			np->put_tx_ctx->dma_len = bcnt;
 			np->put_tx_ctx->dma_single = 0;
 			put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma);
@@ -2264,7 +2264,7 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
 							&np->pci_dev->dev,
 							frag, offset,
 							bcnt,
-							PCI_DMA_TODEVICE);
+							DMA_TO_DEVICE);
 			np->put_tx_ctx->dma_len = bcnt;
 			np->put_tx_ctx->dma_single = 0;
 			put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma));
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
index 5322095..d247030 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
@@ -1506,9 +1506,9 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
 		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
 		map[i + 1] = skb_frag_dma_map(&mac->dma_pdev->dev, frag, 0,
-					      frag->size, PCI_DMA_TODEVICE);
+					      frag->size, DMA_TO_DEVICE);
 		map_size[i+1] = frag->size;
-		if (pci_dma_mapping_error(mac->dma_pdev, map[i+1])) {
+		if (dma_mapping_error(mac->dma_pdev, map[i + 1])) {
 			nfrags = i;
 			goto out_err_nolock;
 		}
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index dc9e21a..b061c07 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1906,8 +1906,8 @@ netxen_map_tx_skb(struct pci_dev *pdev,
 		nf = &pbuf->frag_array[i+1];
 
 		map = skb_frag_dma_map(&pdev->dev, frag, 0, frag->size,
-				       PCI_DMA_TODEVICE);
-		if (pci_dma_mapping_error(pdev, map))
+				       DMA_TO_DEVICE);
+		if (dma_mapping_error(pdev, map))
 			goto unwind;
 
 		nf->dma = map;
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index 1871d88..8932265 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -2389,9 +2389,9 @@ static int ql_send_map(struct ql3_adapter *qdev,
 		}
 
 		map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, frag->size,
-				       PCI_DMA_TODEVICE);
+				       DMA_TO_DEVICE);
 
-		err = pci_dma_mapping_error(qdev->pdev, map);
+		err = dma_mapping_error(qdev->pdev, map);
 		if (err) {
 			netdev_err(qdev->ndev,
 				   "PCI mapping frags failed with error: %d\n",
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 445956e..c9756e7 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -2136,8 +2136,8 @@ qlcnic_map_tx_skb(struct pci_dev *pdev,
 		nf = &pbuf->frag_array[i+1];
 
 		map = skb_frag_dma_map(&pdev->dev, frag, 0, frag->size,
-				       PCI_DMA_TODEVICE);
-		if (pci_dma_mapping_error(pdev, map))
+				       DMA_TO_DEVICE);
+		if (dma_mapping_error(pdev, map))
 			goto unwind;
 
 		nf->dma = map;
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index ce6c6fe..094ac22 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -1432,9 +1432,9 @@ static int ql_map_send(struct ql_adapter *qdev,
 		}
 
 		map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, frag->size,
-				       PCI_DMA_TODEVICE);
+				       DMA_TO_DEVICE);
 
-		err = pci_dma_mapping_error(qdev->pdev, map);
+		err = dma_mapping_error(qdev->pdev, map);
 		if (err) {
 			netif_err(qdev, tx_queued, qdev->ndev,
 				  "PCI mapping frags failed with error: %d.\n",
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index f2467a1..7f47efc 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -243,7 +243,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
 		/* Map for DMA */
 		unmap_single = false;
 		dma_addr = skb_frag_dma_map(&pci_dev->dev, fragment, 0, len,
-					    PCI_DMA_TODEVICE);
+					    DMA_TO_DEVICE);
 	}
 
 	/* Transfer ownership of the skb to the final buffer */
@@ -926,8 +926,8 @@ static int tso_get_fragment(struct tso_state *st, struct efx_nic *efx,
 			    skb_frag_t *frag)
 {
 	st->unmap_addr = skb_frag_dma_map(&efx->pci_dev->dev, frag, 0,
-					  frag->size, PCI_DMA_TODEVICE);
-	if (likely(!pci_dma_mapping_error(efx->pci_dev, st->unmap_addr))) {
+					  frag->size, DMA_TO_DEVICE);
+	if (likely(!dma_mapping_error(efx->pci_dev, st->unmap_addr))) {
 		st->unmap_single = false;
 		st->unmap_len = frag->size;
 		st->in_len = frag->size;
diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c
index 1206821..d9460d8 100644
--- a/drivers/net/ethernet/sun/cassini.c
+++ b/drivers/net/ethernet/sun/cassini.c
@@ -2830,7 +2830,7 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
 
 		len = fragp->size;
 		mapping = skb_frag_dma_map(&cp->pdev->dev, fragp, 0, len,
-					   PCI_DMA_TODEVICE);
+					   DMA_TO_DEVICE);
 
 		tabort = cas_calc_tabort(cp, fragp->page_offset, len);
 		if (unlikely(tabort)) {
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c
index 2bfa171..6b62a73 100644
--- a/drivers/net/ethernet/sun/sungem.c
+++ b/drivers/net/ethernet/sun/sungem.c
@@ -1072,7 +1072,7 @@ static netdev_tx_t gem_start_xmit(struct sk_buff *skb,
 
 			len = this_frag->size;
 			mapping = skb_frag_dma_map(&gp->pdev->dev, this_frag,
-						   0, len, PCI_DMA_TODEVICE);
+						   0, len, DMA_TO_DEVICE);
 			this_ctrl = ctrl;
 			if (frag == skb_shinfo(skb)->nr_frags - 1)
 				this_ctrl |= TXDCTRL_EOF;
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c
index 1151cf9..c77e3bf 100644
--- a/drivers/net/ethernet/tehuti/tehuti.c
+++ b/drivers/net/ethernet/tehuti/tehuti.c
@@ -1499,7 +1499,7 @@ bdx_tx_map_skb(struct bdx_priv *priv, struct sk_buff *skb,
 		db->wptr->len = frag->size;
 		db->wptr->addr.dma = skb_frag_dma_map(&priv->pdev->dev, frag,
 						      0, frag->size,
-						      PCI_DMA_TODEVICE);
+						      DMA_TO_DEVICE);
 
 		pbl++;
 		pbl->len = CPU_CHIP_SWAP32(db->wptr->len);
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index 1ec32c4..b47bce1 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -2559,7 +2559,7 @@ static netdev_tx_t velocity_xmit(struct sk_buff *skb,
 		tdinfo->skb_dma[i + 1] = skb_frag_dma_map(&vptr->pdev->dev,
 							  frag, 0,
 							  frag->size,
-							  PCI_DMA_TODEVICE);
+							  DMA_TO_DEVICE);
 
 		td_ptr->td_buf[i + 1].pa_low = cpu_to_le32(tdinfo->skb_dma[i + 1]);
 		td_ptr->td_buf[i + 1].pa_high = 0;
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 57e7c66..1694038 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -750,7 +750,7 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
 		tbi->map_type = VMXNET3_MAP_PAGE;
 		tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
 						 0, frag->size,
-						 PCI_DMA_TODEVICE);
+						 DMA_TO_DEVICE);
 
 		tbi->len = frag->size;
 
diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c
index 03e7a4e..e4f51e6 100644
--- a/drivers/staging/et131x/et1310_tx.c
+++ b/drivers/staging/et131x/et1310_tx.c
@@ -524,7 +524,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb)
 							&frags[i - 1],
 							0,
 							frags[i - 1].size,
-							PCI_DMA_TODEVICE);
+							DMA_TO_DEVICE);
 		}
 	}
 
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 1/3] net/phy: added autocross feature for forced links on VSC82x4
From: Madalin Bucur @ 2011-10-06 16:48 UTC (permalink / raw)
  To: netdev, davem; +Cc: afleming, Madalin Bucur

Added auto MDI/MDI-X capability for forced (autonegotiation disabled)
10/100 Mbps speeds on Vitesse VSC82x4 PHYs.

Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
---
 drivers/net/phy/phy_device.c |    5 ++-
 drivers/net/phy/vitesse.c    |   67 ++++++++++++++++++++++++++++++++++++++++--
 include/linux/phy.h          |    3 +-
 3 files changed, 69 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 7216e68..a1e132c 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -6,7 +6,7 @@
  *
  * Author: Andy Fleming
  *
- * Copyright (c) 2004-2006, 2008-2010 Freescale Semiconductor, Inc.
+ * Copyright (c) 2004-2006, 2008-2011 Freescale Semiconductor, Inc.
  *
  * 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
@@ -637,7 +637,7 @@ EXPORT_SYMBOL(gen10g_config_advert);
  *   to the values in phydev. Assumes that the values are valid.
  *   Please see phy_sanitize_settings().
  */
-static int genphy_setup_forced(struct phy_device *phydev)
+int genphy_setup_forced(struct phy_device *phydev)
 {
 	int err;
 	int ctl = 0;
@@ -656,6 +656,7 @@ static int genphy_setup_forced(struct phy_device *phydev)
 
 	return err;
 }
+EXPORT_SYMBOL(genphy_setup_forced);
 
 int gen10g_setup_forced(struct phy_device *phydev)
 {
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index d0f36a1..ae87c1c 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -3,7 +3,7 @@
  *
  * Author: Kriston Carson
  *
- * Copyright (c) 2005, 2009 Freescale Semiconductor, Inc.
+ * Copyright (c) 2005, 2009, 2011 Freescale Semiconductor, Inc.
  *
  * 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
@@ -45,6 +45,10 @@
 
 /* Vitesse Auxiliary Control/Status Register */
 #define MII_VSC8244_AUX_CONSTAT        	0x1c
+#define MII_VSC82X4_EXT_PAGE_16E	0x10
+#define MII_VSC82X4_EXT_PAGE_17E	0x11
+#define MII_VSC82X4_EXT_PAGE_18E	0x12
+#define MII_VSC82X4_EXT_PAGE_ACCESS	0x1f
 #define MII_VSC8244_AUXCONSTAT_INIT    	0x0000
 #define MII_VSC8244_AUXCONSTAT_DUPLEX  	0x0020
 #define MII_VSC8244_AUXCONSTAT_SPEED   	0x0018
@@ -140,6 +144,63 @@ static int vsc82xx_config_intr(struct phy_device *phydev)
 	return err;
 }
 
+/* vsc82x4_config_autocross_enable - Enable auto MDI/MDI-X for forced links
+ * @phydev: target phy_device struct
+ *
+ * Enable auto MDI/MDI-X when in 10/100 forced link speeds by writing
+ * special values in the VSC8234/VSC8244 extended reserved registers
+ *
+ */
+static int vsc82x4_config_autocross_enable(struct phy_device *phydev)
+{
+	int result;
+
+	if (AUTONEG_ENABLE == phydev->autoneg || phydev->speed > SPEED_100)
+		return 0;
+
+	result = phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x52b5);
+	if (result >= 0)
+		result = phy_write(phydev, MII_VSC82X4_EXT_PAGE_18E, 0x0012);
+	if (result >= 0)
+		result = phy_write(phydev, MII_VSC82X4_EXT_PAGE_17E, 0x2803);
+	if (result >= 0)
+		result = phy_write(phydev, MII_VSC82X4_EXT_PAGE_16E, 0x87fa);
+	if (result >= 0)
+		result = phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x0000);
+	else
+		phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x0000);
+
+	return result;
+}
+
+/**
+ * vsc82x4_config_aneg - restart auto-negotiation or write BMCR
+ * @phydev: target phy_device struct
+ *
+ * Description: If auto-negotiation is enabled, we configure the
+ *   advertising, and then restart auto-negotiation.  If it is not
+ *   enabled, then we write the BMCR and also start the auto
+ *   MDI/MDI-X feature
+ *
+ */
+static int vsc82x4_config_aneg(struct phy_device *phydev)
+{
+	int result;
+
+	/* Enable auto MDI/MDI-X when in 10/100 forced link speeds by
+	 * writing special values in the VSC8234 extended reserved registers */
+	if (AUTONEG_ENABLE != phydev->autoneg && SPEED_100 >= phydev->speed) {
+		result = genphy_setup_forced(phydev);
+
+		if (result < 0) /* error */
+			return result;
+
+		return vsc82x4_config_autocross_enable(phydev);
+	}
+
+	return genphy_config_aneg(phydev);
+}
+
 /* Vitesse 824x */
 static struct phy_driver vsc8244_driver = {
 	.phy_id		= PHY_ID_VSC8244,
@@ -148,7 +209,7 @@ static struct phy_driver vsc8244_driver = {
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
 	.config_init	= &vsc824x_config_init,
-	.config_aneg	= &genphy_config_aneg,
+	.config_aneg	= &vsc82x4_config_aneg,
 	.read_status	= &genphy_read_status,
 	.ack_interrupt	= &vsc824x_ack_interrupt,
 	.config_intr	= &vsc82xx_config_intr,
@@ -163,7 +224,7 @@ static struct phy_driver vsc8234_driver = {
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
 	.config_init	= &vsc824x_config_init,
-	.config_aneg	= &genphy_config_aneg,
+	.config_aneg	= &vsc82x4_config_aneg,
 	.read_status	= &genphy_read_status,
 	.ack_interrupt	= &vsc824x_ack_interrupt,
 	.config_intr	= &vsc82xx_config_intr,
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d2d2fa4..3610a5e 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -6,7 +6,7 @@
  *
  * Author: Andy Fleming
  *
- * Copyright (c) 2004-2010 Freescale Semiconductor, Inc.
+ * Copyright (c) 2004-2011 Freescale Semiconductor, Inc.
  *
  * 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
@@ -533,6 +533,7 @@ static inline int phy_read_status(struct phy_device *phydev) {
 	return phydev->drv->read_status(phydev);
 }
 
+int genphy_setup_forced(struct phy_device *phydev);
 int genphy_restart_aneg(struct phy_device *phydev);
 int genphy_config_aneg(struct phy_device *phydev);
 int genphy_update_link(struct phy_device *phydev);
-- 
1.7.0.1

^ permalink raw reply related

* [PATCH 2/3] net/phy: avoid reaching an unsupported speed and duplex combination
From: Madalin Bucur @ 2011-10-06 16:48 UTC (permalink / raw)
  To: netdev, davem; +Cc: afleming, Madalin Bucur

 - phy_force_reduction() may get the interface into a speed and duplex combination 
 that is not supported by the device;
 - wait PHY_FORCE_TIMEOUT before each speed/duplex reduction in forced mode

Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
---
 drivers/net/phy/phy.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 79268f6..31d6519 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -6,7 +6,7 @@
  *
  * Author: Andy Fleming
  *
- * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ * Copyright (c) 2004,2011 Freescale Semiconductor, Inc.
  * Copyright (c) 2006, 2007  Maciej W. Rozycki
  *
  * This program is free software; you can redistribute  it and/or modify it
@@ -479,6 +479,10 @@ static void phy_force_reduction(struct phy_device *phydev)
 
 	idx = phy_find_valid(idx, phydev->supported);
 
+	/* Avoid reaching an invalid speed and duplex combination */
+	if (!(settings[idx].setting & phydev->supported))
+		return;
+
 	phydev->speed = settings[idx].speed;
 	phydev->duplex = settings[idx].duplex;
 
@@ -869,6 +873,8 @@ void phy_state_machine(struct work_struct *work)
 				if (0 == phydev->link_timeout--) {
 					phy_force_reduction(phydev);
 					needs_aneg = 1;
+					phydev->link_timeout =
+						PHY_FORCE_TIMEOUT;
 				}
 			}
 
-- 
1.7.0.1

^ permalink raw reply related

* [PATCH 3/3] net/phy: abort genphy_read_status when link changes during speed and duplex reading
From: Madalin Bucur @ 2011-10-06 16:48 UTC (permalink / raw)
  To: netdev, davem; +Cc: afleming, Madalin Bucur

If the link changes during speed and duplex reading the values may be out of sync;
abort the update if the link state changes during the read

Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
---
 drivers/net/phy/phy_device.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index a1e132c..e88f49a 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -824,6 +824,16 @@ int genphy_read_status(struct phy_device *phydev)
 
 		lpa &= adv;
 
+		err = phy_read(phydev, MII_BMSR);
+
+		if (err < 0)
+			return err;
+
+		/* if the link changed while reading speed and duplex
+		 * abort the speed and duplex update */
+		if (((err & BMSR_LSTATUS) == 0) != (phydev->link == 0))
+			return 0;
+
 		phydev->speed = SPEED_10;
 		phydev->duplex = DUPLEX_HALF;
 		phydev->pause = phydev->asym_pause = 0;
-- 
1.7.0.1

^ permalink raw reply related

* Re: bnx2 rxhash
From: Michael Chan @ 2011-10-06 16:52 UTC (permalink / raw)
  To: Jasper Spaans; +Cc: netdev@vger.kernel.org
In-Reply-To: <4E8D7B85.7060702@fox-it.com>


On Thu, 2011-10-06 at 02:57 -0700, Jasper Spaans wrote:
> The data I'm processing consists of (almost 100% tcp) traffic between an
> ssl-offloader and a cluster of webservers, so the range of mac-addresses
> is rather limited. This ssl-offloader does preserve the IP-address and
> tcp ports of the clients, so if the rxhash is based on that data, it
> should be distributed evenly.
> 
> Is there anything I can do about this?
> 

Can you send me a small tcpdump/wireshark trace of the incoming packets?
I just need to see the tuple values in the packet headers.  Thanks.

^ permalink raw reply

* Re: [PATCH 1/3] net/phy: added autocross feature for forced links on VSC82x4
From: Madalin Bucur @ 2011-10-06 17:04 UTC (permalink / raw)
  To: netdev, davem; +Cc: afleming, Madalin Bucur

Please ignore this set of 3 patches, they do not apply as they are based on a modified tree.
I'll update and resend.

^ permalink raw reply

* Cannot delete a bridge using 'ip' netlink interface
From: Sridhar Samudrala @ 2011-10-06 17:18 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

On a linux 3.1.0-rc9 system using the latest iproute2, i tried
creating a bridge and deleting it with an attached interface. 

Here is the sequence of steps i tried
ip link add br0 type bridge
ip link set dev eth1 master br0
ip link set br0 up
ip link del br0

The last command hangs with the following kernel messages
kernel:unregister_netdevice: waiting for br0 to become free. Usage count = 1

I see the same behavior even if the bridge is brought down
before trying to delete the bridge.

brctl delbr fails with an error message if the bridge is up.
But it succeeds if the bridge is brought down before doing a delbr
even if it has interfaces attached.

Thanks
Sridhar

^ permalink raw reply

* Re: [PATCH net] mscan: zero accidentally copied register content
From: Wolfgang Grandegger @ 2011-10-06 18:24 UTC (permalink / raw)
  To: Andre Naujoks; +Cc: Oliver Hartkopp, Wolfram Sang, Linux Netdev List
In-Reply-To: <CAOCMmufQ77Vz4XTSTZTVSMiOA4QtWkZEvWHjGXip5-JK20E=QA@mail.gmail.com>

On 10/06/2011 05:03 PM, Andre Naujoks wrote:
> 2011/10/6 Oliver Hartkopp <socketcan@hartkopp.net>:
>> On 10/06/11 11:09, Wolfgang Grandegger wrote:
>>
>>> On 10/06/2011 09:02 AM, Oliver Hartkopp wrote:
>>>>
>>>> I think if one would like to rework the 16bit register access (which is used
>>>> in the rx path /and/ in the tx path also) this should go via net-next after
>>>> some discussion and testing.
>>>
>>> Why do you want to change 16-bit accesses in general? They are faster
>>> than two 8 bit accesses.
>>>
>>>> IMHO this fix is small and clear and especially not risky. I wonder if
>>>> reworking the 16 bit register access is worth the effort?
>>>
>>> I would prefer:
>>>
>>>       if (!(frame->can_id & CAN_RTR_FLAG)) {
>>>               void __iomem *data = &regs->rx.dsr1_0;
>>>               u16 *payload = (u16 *)frame->data;
>>>
>>>               for (i = 0; i < frame->can_dlc / 2; i++) {
>>>                       *payload++ = in_be16(data);
>>>                       data += 2 + _MSCAN_RESERVED_DSR_SIZE;
>>>               }
>>>               /* copy remaining byte */
>>>               if (frame->can_dlc & 1)
>>>                       frame->data[frame->can_dlc - 1] = in_8(data);
>>>       }
>>
>>
>> Besides the fact that Andre is going to test this idea from Wolfgang now, are
>> you really sure that it must be
>>
>>        in_8(data)

That should be the right byte.

>>
>> and not
>>
>>        in_8(data+1)
>>
>> ???
>>
>> And that data definitely points to the right place?
>>
>> I would prefer to be really cautious with these big endian 16 bit registers!
>>
>> Therefore my fix with
>>
>> +               /* zero accidentally copied register content at odd DLCs */
>> +               if (frame->can_dlc & 1)
>> +                       frame->data[frame->can_dlc] = 0;
>>
>> only repairing the result looks much more defensive to me.
> 
> First things first: Both ways seem to work correctly. At least on the
> MPC5200 I have here.
> 
> But I am with Oliver on this one. The solution looks much simpler and
> endianess errors are not possible. If the few CPU cycles are worth it
> on the other hand, then Wolfgangs version is probably preferable. I
> don't have access to this kind of hardware on a little endian machine
> to test it, though.

Well, copying just the relevant bytes seem much more straight-forward
than removing accidentally copied bytes later-on. You do not need to
care about little endian. The MSCAN is only available on PowerPC SOCs,
which are big endian.

I'm going to test and post a patch tomorrow.

Wolfgang.

^ permalink raw reply

* Re: [PATCH net] mscan: zero accidentally copied register content
From: Marc Kleine-Budde @ 2011-10-06 18:25 UTC (permalink / raw)
  To: Oliver Hartkopp
  Cc: Wolfgang Grandegger, Wolfram Sang, Linux Netdev List,
	Andre Naujoks
In-Reply-To: <4E8C78E8.3010605@hartkopp.net>

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

On 10/05/2011 05:34 PM, Oliver Hartkopp wrote:
> Due to the 16 bit access to mscan registers there's too much data copied to
> the zero initialized CAN frame when having an odd number of bytes to copy.
> This patch clears the data byte read from the invalid register entry.
> 
> Reported-by: Andre Naujoks <nautsch@gmail.com>
> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

This problem have some other drivers, too, e.g. the at91 and the flexcan
driver both copy unconditionally all 8 bytes from the hardware. However,
I don't know if the hardware sets the remaining bytes to zero.

cheers, Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


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

^ 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