Netdev List
 help / color / mirror / Atom feed
* [PATCH v4 1/1] ip-link: add switch to show human readable output
From: Christian Hesse @ 2014-10-31 21:33 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Christian Hesse
In-Reply-To: <20141031123115.4cd13371@urahara>

Byte and packet count can increase to really big numbers. This adds a
switch to show human readable output.

4: wl: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:de:ad:be:ee:ef brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    1523846973 3969051  0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    8710088361 6077735  0       0       0       0
4: wl: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:de:ad:be:ee:ef brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    1.5G       3.9M     0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    8.7G       6.0M     0       0       0       0
---
 include/utils.h       |   1 +
 ip/ip.c               |   5 +
 ip/ipaddress.c        | 286 ++++++++++++++++++++++++++++++++++++++------------
 man/man8/ip-link.8.in |   7 ++
 4 files changed, 233 insertions(+), 66 deletions(-)

diff --git a/include/utils.h b/include/utils.h
index 704dc51..7bb19e9 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -11,6 +11,7 @@
 #include "rtm_map.h"
 
 extern int preferred_family;
+extern int human_readable;
 extern int show_stats;
 extern int show_details;
 extern int show_raw;
diff --git a/ip/ip.c b/ip/ip.c
index 739b88d..6b352c8 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -24,6 +24,7 @@
 #include "ip_common.h"
 
 int preferred_family = AF_UNSPEC;
+int human_readable = 0;
 int show_stats = 0;
 int show_details = 0;
 int resolve_hosts = 0;
@@ -47,6 +48,7 @@ static void usage(void)
 "                   tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm |\n"
 "                   netns | l2tp | tcp_metrics | token | netconf }\n"
 "       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
+"                    -h[uman-readable] |\n"
 "                    -f[amily] { inet | inet6 | ipx | dnet | bridge | link } |\n"
 "                    -4 | -6 | -I | -D | -B | -0 |\n"
 "                    -l[oops] { maximum-addr-flush-attempts } |\n"
@@ -212,6 +214,9 @@ int main(int argc, char **argv)
 			preferred_family = AF_DECnet;
 		} else if (strcmp(opt, "-B") == 0) {
 			preferred_family = AF_BRIDGE;
+		} else if (matches(opt, "-human") == 0 ||
+			   matches(opt, "-human-readable") == 0) {
+			++human_readable;
 		} else if (matches(opt, "-stats") == 0 ||
 			   matches(opt, "-statistics") == 0) {
 			++show_stats;
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 45729d8..4b8ddca 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -319,107 +319,261 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
 	}
 }
 
+
+static void print_human64(FILE *fp, int length, uint64_t count)
+{
+	char * prefix = "kMGTPE";
+	int written = 0, i;
+	uint64_t powi = 1;
+
+	if (count < 1000) {
+		/* we are below 1000, so no precision and no prefix */
+		written = fprintf(fp, "%"PRIu64, count);
+	} else {
+		/* increase value by a factor of 1000 and print
+		 * if result is something a human can read */
+		for (i = 0; i < 6; i++) {
+			powi *= 1000;
+			if (count / 1000 < powi) {
+				 written = fprintf(fp, "%"PRIu64".%"PRIu64"%c",
+					 count / powi, count * 10 / powi % 10, *prefix);
+				 break;
+			}
+			prefix++;
+		}
+	}
+
+	do {
+		fputc(' ', fp);
+	} while (written++ < length);
+}
+
+static void print_human32(FILE *fp, int length, uint32_t count)
+{
+	char * prefix = "KMG";
+	int written = 0, i;
+	uint32_t powi = 1;
+
+	if (count < 1000) {
+		/* we are below 1000, so no precision and no prefix */
+		written = fprintf(fp, "%u", count);
+	} else {
+		/* increase value by a factor of 1000 and print
+		 * if result is something a human can read */
+		for (i = 0; i < 3; i++) {
+			powi *= 1000;
+			if (count / 1000 < powi) {
+				 written = fprintf(fp, "%u.%u%c",
+					 count / powi, count * 10 / powi % 10, *prefix);
+				 break;
+			}
+			prefix++;
+		}
+	}
+
+	do {
+		fputc(' ', fp);
+	} while (written++ < length);
+}
+
 static void print_link_stats64(FILE *fp, const struct rtnl_link_stats64 *s,
                                const struct rtattr *carrier_changes)
 {
+	/* RX stats */
 	fprintf(fp, "    RX: bytes  packets  errors  dropped overrun mcast   %s%s",
 		s->rx_compressed ? "compressed" : "", _SL_);
-	fprintf(fp, "    %-10"PRIu64" %-8"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64"",
-		(uint64_t)s->rx_bytes,
-		(uint64_t)s->rx_packets,
-		(uint64_t)s->rx_errors,
-		(uint64_t)s->rx_dropped,
-		(uint64_t)s->rx_over_errors,
-		(uint64_t)s->multicast);
-	if (s->rx_compressed)
-		fprintf(fp, " %-7"PRIu64"",
-			(uint64_t)s->rx_compressed);
+	if (human_readable) {
+		fprintf(fp, "    ");
+		print_human64(fp, 10, (uint64_t)s->rx_bytes);
+		print_human64(fp, 8, (uint64_t)s->rx_packets);
+		print_human64(fp, 7, (uint64_t)s->rx_errors);
+		print_human64(fp, 7, (uint64_t)s->rx_dropped);
+		print_human64(fp, 7, (uint64_t)s->rx_over_errors);
+		print_human64(fp, 7, (uint64_t)s->multicast);
+		if (s->rx_compressed)
+			print_human64(fp, 7, (uint64_t)s->rx_compressed);
+	} else {
+		fprintf(fp, "    %-10"PRIu64" %-8"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64"",
+			(uint64_t)s->rx_bytes,
+			(uint64_t)s->rx_packets,
+			(uint64_t)s->rx_errors,
+			(uint64_t)s->rx_dropped,
+			(uint64_t)s->rx_over_errors,
+			(uint64_t)s->multicast);
+		if (s->rx_compressed)
+			fprintf(fp, " %-7"PRIu64"",
+				(uint64_t)s->rx_compressed);
+	}
+
+	/* RX error stats */
 	if (show_stats > 1) {
 		fprintf(fp, "%s", _SL_);
-		fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
-		fprintf(fp, "               %-7"PRIu64"  %-7"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64"",
-			(uint64_t)s->rx_length_errors,
-			(uint64_t)s->rx_crc_errors,
-			(uint64_t)s->rx_frame_errors,
-			(uint64_t)s->rx_fifo_errors,
-			(uint64_t)s->rx_missed_errors);
+		fprintf(fp, "    RX errors: length   crc     frame   fifo    missed%s", _SL_);
+		if (human_readable) {
+			fprintf(fp, "               ");
+			print_human64(fp, 8, (uint64_t)s->rx_length_errors);
+			print_human64(fp, 7, (uint64_t)s->rx_crc_errors);
+			print_human64(fp, 7, (uint64_t)s->rx_frame_errors);
+			print_human64(fp, 7, (uint64_t)s->rx_fifo_errors);
+			print_human64(fp, 7, (uint64_t)s->rx_missed_errors);
+		} else {
+			fprintf(fp, "               %-8"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64"",
+				(uint64_t)s->rx_length_errors,
+				(uint64_t)s->rx_crc_errors,
+				(uint64_t)s->rx_frame_errors,
+				(uint64_t)s->rx_fifo_errors,
+				(uint64_t)s->rx_missed_errors);
+		}
 	}
 	fprintf(fp, "%s", _SL_);
+
+	/* TX stats */
 	fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
 		(uint64_t)s->tx_compressed ? "compressed" : "", _SL_);
-	fprintf(fp, "    %-10"PRIu64" %-8"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64"",
-		(uint64_t)s->tx_bytes,
-		(uint64_t)s->tx_packets,
-		(uint64_t)s->tx_errors,
-		(uint64_t)s->tx_dropped,
-		(uint64_t)s->tx_carrier_errors,
-		(uint64_t)s->collisions);
-	if (s->tx_compressed)
-		fprintf(fp, " %-7"PRIu64"",
-			(uint64_t)s->tx_compressed);
+	if (human_readable) {
+		fprintf(fp, "    ");
+		print_human64(fp, 10, (uint64_t)s->tx_bytes);
+		print_human64(fp, 8, (uint64_t)s->tx_packets);
+		print_human64(fp, 7, (uint64_t)s->tx_errors);
+		print_human64(fp, 7, (uint64_t)s->tx_dropped);
+		print_human64(fp, 7, (uint64_t)s->tx_carrier_errors);
+		print_human64(fp, 7, (uint64_t)s->collisions);
+		if (s->tx_compressed)
+			print_human64(fp, 7, (uint64_t)s->tx_compressed);
+	} else {
+		fprintf(fp, "    %-10"PRIu64" %-8"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64"",
+			(uint64_t)s->tx_bytes,
+			(uint64_t)s->tx_packets,
+			(uint64_t)s->tx_errors,
+			(uint64_t)s->tx_dropped,
+			(uint64_t)s->tx_carrier_errors,
+			(uint64_t)s->collisions);
+		if (s->tx_compressed)
+			fprintf(fp, " %-7"PRIu64"",
+				(uint64_t)s->tx_compressed);
+	}
+
+	/* TX error stats */
 	if (show_stats > 1) {
 		fprintf(fp, "%s", _SL_);
-		fprintf(fp, "    TX errors: aborted fifo    window  heartbeat");
+		fprintf(fp, "    TX errors: aborted  fifo   window heartbeat");
                 if (carrier_changes)
 			fprintf(fp, " transns");
 		fprintf(fp, "%s", _SL_);
-		fprintf(fp, "               %-7"PRIu64"  %-7"PRIu64" %-7"PRIu64" %-8"PRIu64"",
-			(uint64_t)s->tx_aborted_errors,
-			(uint64_t)s->tx_fifo_errors,
-			(uint64_t)s->tx_window_errors,
-			(uint64_t)s->tx_heartbeat_errors);
-		if (carrier_changes)
-			fprintf(fp, " %-7u",
-				*(uint32_t*)RTA_DATA(carrier_changes));
+		if (human_readable) {
+			fprintf(fp, "               ");
+			print_human64(fp, 8, (uint64_t)s->tx_aborted_errors);
+			print_human64(fp, 7, (uint64_t)s->tx_fifo_errors);
+			print_human64(fp, 7, (uint64_t)s->tx_window_errors);
+			print_human64(fp, 7, (uint64_t)s->tx_heartbeat_errors);
+			if (carrier_changes)
+				print_human64(fp, 7, (uint64_t)*(uint32_t*)RTA_DATA(carrier_changes));
+		} else {
+			fprintf(fp, "               %-8"PRIu64" %-7"PRIu64" %-7"PRIu64" %-7"PRIu64"",
+				(uint64_t)s->tx_aborted_errors,
+				(uint64_t)s->tx_fifo_errors,
+				(uint64_t)s->tx_window_errors,
+				(uint64_t)s->tx_heartbeat_errors);
+			if (carrier_changes)
+				fprintf(fp, " %-7u",
+					*(uint32_t*)RTA_DATA(carrier_changes));
+		}
 	}
 }
 
 static void print_link_stats32(FILE *fp, const struct rtnl_link_stats *s,
 			       const struct rtattr *carrier_changes)
 {
+	/* RX stats */
 	fprintf(fp, "    RX: bytes  packets  errors  dropped overrun mcast   %s%s",
 		s->rx_compressed ? "compressed" : "", _SL_);
-	fprintf(fp, "    %-10u %-8u %-7u %-7u %-7u %-7u",
-		s->rx_bytes, s->rx_packets, s->rx_errors,
-		s->rx_dropped, s->rx_over_errors,
-		s->multicast
-		);
-	if (s->rx_compressed)
-		fprintf(fp, " %-7u", s->rx_compressed);
+	if (human_readable) {
+		fprintf(fp, "    ");
+		print_human32(fp, 10, s->rx_bytes);
+		print_human32(fp, 8, s->rx_packets);
+		print_human32(fp, 7, s->rx_errors);
+		print_human32(fp, 7, s->rx_dropped);
+		print_human32(fp, 7, s->rx_over_errors);
+		print_human32(fp, 7, s->multicast);
+		if (s->rx_compressed)
+			print_human32(fp, 7, s->rx_compressed);
+	} else {
+		fprintf(fp, "    %-10u %-8u %-7u %-7u %-7u %-7u",
+			s->rx_bytes, s->rx_packets, s->rx_errors,
+			s->rx_dropped, s->rx_over_errors,
+			s->multicast);
+		if (s->rx_compressed)
+			fprintf(fp, " %-7u", s->rx_compressed);
+	}
+
+	/* RX error stats */
 	if (show_stats > 1) {
 		fprintf(fp, "%s", _SL_);
-		fprintf(fp, "    RX errors: length  crc     frame   fifo    missed%s", _SL_);
-		fprintf(fp, "               %-7u  %-7u %-7u %-7u %-7u",
-			s->rx_length_errors,
-			s->rx_crc_errors,
-			s->rx_frame_errors,
-			s->rx_fifo_errors,
-			s->rx_missed_errors
-			);
+		fprintf(fp, "    RX errors: length   crc     frame   fifo    missed%s", _SL_);
+		if (human_readable) {
+			fprintf(fp, "               ");
+			print_human32(fp, 8, s->rx_length_errors);
+			print_human32(fp, 7, s->rx_crc_errors);
+			print_human32(fp, 7, s->rx_frame_errors);
+			print_human32(fp, 7, s->rx_fifo_errors);
+			print_human32(fp, 7, s->rx_missed_errors);
+		} else {
+			fprintf(fp, "               %-8u %-7u %-7u %-7u %-7u",
+				s->rx_length_errors,
+				s->rx_crc_errors,
+				s->rx_frame_errors,
+				s->rx_fifo_errors,
+				s->rx_missed_errors);
+		}
 	}
 	fprintf(fp, "%s", _SL_);
+
+	/* TX stats */
 	fprintf(fp, "    TX: bytes  packets  errors  dropped carrier collsns %s%s",
 		s->tx_compressed ? "compressed" : "", _SL_);
-	fprintf(fp, "    %-10u %-8u %-7u %-7u %-7u %-7u",
-		s->tx_bytes, s->tx_packets, s->tx_errors,
-		s->tx_dropped, s->tx_carrier_errors, s->collisions);
-	if (s->tx_compressed)
-		fprintf(fp, " %-7u", s->tx_compressed);
+	if (human_readable) {
+		fprintf(fp, "    ");
+		print_human32(fp, 10, s->tx_bytes);
+		print_human32(fp, 8, s->tx_packets);
+		print_human32(fp, 7, s->tx_errors);
+		print_human32(fp, 7, s->tx_dropped);
+		print_human32(fp, 7, s->tx_carrier_errors);
+		print_human32(fp, 7, s->collisions);
+		if (s->tx_compressed)
+			print_human32(fp, 7, s->tx_compressed);
+	} else {
+		fprintf(fp, "    %-10u %-8u %-7u %-7u %-7u %-7u",
+			s->tx_bytes, s->tx_packets, s->tx_errors,
+			s->tx_dropped, s->tx_carrier_errors, s->collisions);
+		if (s->tx_compressed)
+			fprintf(fp, " %-7u", s->tx_compressed);
+	}
+
+	/* TX error stats */
 	if (show_stats > 1) {
 		fprintf(fp, "%s", _SL_);
-		fprintf(fp, "    TX errors: aborted fifo    window  heartbeat");
+		fprintf(fp, "    TX errors: aborted  fifo   window heartbeat");
                 if (carrier_changes)
 			fprintf(fp, " transns");
 		fprintf(fp, "%s", _SL_);
-		fprintf(fp, "               %-7u  %-7u %-7u %-8u",
-			s->tx_aborted_errors,
-			s->tx_fifo_errors,
-			s->tx_window_errors,
-			s->tx_heartbeat_errors
-			);
-		if (carrier_changes)
-			fprintf(fp, " %-7u",
-				*(uint32_t*)RTA_DATA(carrier_changes));
+		if (human_readable) {
+			fprintf(fp, "               ");
+			print_human32(fp, 8, s->tx_aborted_errors);
+			print_human32(fp, 7, s->tx_fifo_errors);
+			print_human32(fp, 7, s->tx_window_errors);
+			print_human32(fp, 7, s->tx_heartbeat_errors);
+			if (carrier_changes)
+				print_human32(fp, 7, *(uint32_t*)RTA_DATA(carrier_changes));
+		} else {
+			fprintf(fp, "               %-8u %-7u %-7u %-7u",
+				s->tx_aborted_errors,
+				s->tx_fifo_errors,
+				s->tx_window_errors,
+				s->tx_heartbeat_errors);
+			if (carrier_changes)
+				fprintf(fp, " %-7u",
+					*(uint32_t*)RTA_DATA(carrier_changes));
+		}
 	}
 }
 
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 464009d..9747c4c 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -16,6 +16,7 @@ ip-link \- network device configuration
 .ti -8
 .IR OPTIONS " := { "
 \fB\-V\fR[\fIersion\fR] |
+\fB\-h\fR[\fIuman-readable\fR] |
 \fB\-s\fR[\fItatistics\fR] |
 \fB\-r\fR[\fIesolve\fR] |
 \fB\-f\fR[\fIamily\fR] {
@@ -660,6 +661,12 @@ specifies what group of devices to show.
 .B up
 only display running interfaces.
 
+.SH "NOTES"
+Human readable values are calculated with SI prefixes, so with a decimal
+base, not binary. (This is unlike
+.BR ifconfig (8)
+, with uses binary prefix.) 1,000 bytes are 1 kB, 1,000 kB are 1 MB, ...
+
 .SH "EXAMPLES"
 .PP
 ip link show
-- 
2.1.3

^ permalink raw reply related

* [PATCH net 0/2] net: systemport: TX dma fixes
From: Florian Fainelli @ 2014-10-31 22:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli

Hi David,

This patch series contains two fixes for our transmit path, first one
is a pretty nasty one since we were not allocating a large enough
dma coherent pool for our transmit descriptors, which would work most of the
time, since allocations are contiguous and we could have.

Second patch fixes a less frequent, though highly likley crash when using
CMA allocations.

I just missed your pull request to Linus, though I assume there will be
another one?

Thanks!

Florian Fainelli (2):
  net: systemport: fix DMA allocation/freeing sizes
  net: systemport: do not crash freeing an unitialized TX ring

 drivers/net/ethernet/broadcom/bcmsysport.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

-- 
1.9.1

^ permalink raw reply

* [PATCH net 1/2] net: systemport: fix DMA allocation/freeing sizes
From: Florian Fainelli @ 2014-10-31 22:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli
In-Reply-To: <1414795895-31612-1-git-send-email-f.fainelli@gmail.com>

We should not be allocating a single byte of DMA coherent memory, but
instead a full-sized struct dma_desc (8 bytes).

Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 3a6778a667f4..c81bf74685c0 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1110,7 +1110,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,
 	/* We just need one DMA descriptor which is DMA-able, since writing to
 	 * the port will allocate a new descriptor in its internal linked-list
 	 */
-	p = dma_zalloc_coherent(kdev, 1, &ring->desc_dma, GFP_KERNEL);
+	p = dma_zalloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma,
+				GFP_KERNEL);
 	if (!p) {
 		netif_err(priv, hw, priv->netdev, "DMA alloc failed\n");
 		return -ENOMEM;
@@ -1183,7 +1184,8 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv,
 	ring->cbs = NULL;
 
 	if (ring->desc_dma) {
-		dma_free_coherent(kdev, 1, ring->desc_cpu, ring->desc_dma);
+		dma_free_coherent(kdev, sizeof(struct dma_desc),
+				  ring->desc_cpu, ring->desc_dma);
 		ring->desc_dma = 0;
 	}
 	ring->size = 0;
-- 
1.9.1

^ permalink raw reply related

* [PATCH net 2/2] net: systemport: do not crash freeing an unitialized TX ring
From: Florian Fainelli @ 2014-10-31 22:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli
In-Reply-To: <1414795895-31612-1-git-send-email-f.fainelli@gmail.com>

Callers of bcm_sysport_init_tx_ring() can currently fail, and will
always call bcm_sysport_fini_tx_ring() in a loop ending at the number of
TX queues (32) without checking if the TX ring was successfully
initialized or not.

Update bcm_sysport_fini_tx_ring() to return early and avoid a crash
de-referencing ring->cbs if the TX ring was not initialized, since
ring->cbs is the last part of the initialization done by
bcm_sysport_init_tx_ring() that could fail.

Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Reported-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index c81bf74685c0..531bb7c57531 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1175,6 +1175,13 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv,
 	if (!(reg & TDMA_DISABLED))
 		netdev_warn(priv->netdev, "TDMA not stopped!\n");
 
+	/* ring->cbs is the last part in bcm_sysport_init_tx_ring which could
+	 * fail, so by checking this pointer we know whether the TX ring was
+	 * fully initialized or not.
+	 */
+	if (!ring->cbs)
+		return;
+
 	napi_disable(&ring->napi);
 	netif_napi_del(&ring->napi);
 
-- 
1.9.1

^ permalink raw reply related

* Re: [stable request <= 3.11] net/mlx4_en: Fix BlueFlame race
From: Ben Hutchings @ 2014-11-01  1:29 UTC (permalink / raw)
  To: Vinson Lee
  Cc: David S. Miller, Amir Vadai, Or Gerlitz, Jack Morgenstein,
	Eugenia Emantayev, Matan Barak, netdev
In-Reply-To: <CAHTgTXVn1479XCoh1-j=Xghtad3zA-hf0za5r_AyoaKuKeFZ2g@mail.gmail.com>

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

On Sat, 2014-10-18 at 14:14 -0700, Vinson Lee wrote:
> Hi.
> 
> Please consider backporting upstream commit
> 2d4b646613d6b12175b017aca18113945af1faf3 "net/mlx4_en: Fix BlueFlame
> race" to stable kernels <= 3.11.
> 
> commit 2d4b646613d6b12175b017aca18113945af1faf3
> Author: Eugenia Emantayev <eugenia@mellanox.com>
> Date:   Thu Jul 25 19:21:23 2013 +0300
> 
>     net/mlx4_en: Fix BlueFlame race
[...]

David doesn't support anything older than 3.12 now, so you should send
requests for older stable branches directly to the stable list.

I tried to apply this one to 3.2-stable, but it failed.  If it's needed
there you'll have to provide a backport.

Ben.

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply

* Re: [PATCH] net: fix saving TX flow hash in sock for outgoing connections
From: Ben Hutchings @ 2014-11-01  1:30 UTC (permalink / raw)
  To: David Miller; +Cc: eric.dumazet, Sathya.Perla, netdev, therbert
In-Reply-To: <20141022.161402.119032019463935567.davem@davemloft.net>

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

On Wed, 2014-10-22 at 16:14 -0400, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 22 Oct 2014 12:09:56 -0700
> 
> > On Wed, 2014-10-22 at 18:35 +0000, Sathya Perla wrote:
> >> Agree. Are you suggesting that drivers should automatically
> >> register an XPS configuration? I thought it was upto the user
> >> to enable it...
> > 
> > Yep, search for netif_set_xps_queue()
> > 
> > (commit 537c00de1c9ba9876b9)
> > 
> > Look at commit d03a68f8217ea0349 for an example of how it can be done,
> > if user do not override this later.
> 
> Very few people know about this :-/
> 
> I only see 4 drivers adjusted to do this, it would be nice if this
> was more widespread.

It seems to require that the driver also sets IRQ affinity hints, which
I've never been very comfortable with.  Drivers either set queue n = CPU
n without regard for topology, or optimise for whichever
micro-architecture the vendor most cares about.  irqbalance then
slavishly follows these hints, so we have each driver (rather than the
administrator) setting policy.

Alternately the driver could create an irq_cpu_rmap for its TX interupts
and that could be used to select queues based on current affinity
(<http://thread.gmane.org/gmane.linux.network/186698>).  But we already
seem to have too many ways to do TX queue selection.

Ben.

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply

* [PATCH] drivers: net: ethernet: xilinx: xilinx_emaclite: Compatible with 'xlnx,xps-ethernetlite-2.00.b' for QEMU using
From: Chen Gang @ 2014-11-01  3:08 UTC (permalink / raw)
  To: michal.simek, soren.brinkmann
  Cc: davem, sthokal, manuel.schoelling, paul.gortmaker, f.fainelli,
	ebiederm, netdev, linux-arm-kernel, linux-kernel@vger.kernel.org

When use current latest upstream qemu (current version: 2.1.2), need let
driver compatible with 'xlnx,xps-ethernetlite-2.00.b', or can not find
net device in microblaze qemu. Related QEMU commands under fedora 20:

  yum install libvirt
  yum install tunctl
  tunctl -b
  ip link set tap0 up
  brctl addif virbr0 tap0
  ./microblaze-softmmu/qemu-system-microblaze -M petalogix-s3adsp1800 \
    -kernel ../linux-stable.microblaze/arch/microblaze/boot/linux.bin \
    -no-reboot -append "console=ttyUL0,115200 doreboot" -nographic \
    -net nic,vlan=0,model=xlnx.xps-ethernetlite,macaddr=00:16:35:AF:94:00 \
    -net tap,vlan=0,ifname=tap0,script=no,downscript=no

  in microblaze qemu bash (guest machine):

    ifconfig eth0 add 192.168.122.1 netmask 255.255.255.0
    ifconfig eth0 up

After add this patch, can find the device, and can be used by 'telnetd'
(need cross-build busybox with glibc for it), then outside can telnet to
it without password.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 28dbbdc..298fad3 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1236,6 +1236,7 @@ static struct of_device_id xemaclite_of_match[] = {
 	{ .compatible = "xlnx,opb-ethernetlite-1.01.b", },
 	{ .compatible = "xlnx,xps-ethernetlite-1.00.a", },
 	{ .compatible = "xlnx,xps-ethernetlite-2.00.a", },
+	{ .compatible = "xlnx,xps-ethernetlite-2.00.b", },
 	{ .compatible = "xlnx,xps-ethernetlite-2.01.a", },
 	{ .compatible = "xlnx,xps-ethernetlite-3.00.a", },
 	{ /* end of list */ },
-- 
1.9.3

^ permalink raw reply related

* Re: [PATCH] drivers: net: ethernet: xilinx: xilinx_emaclite: Compatible with 'xlnx,xps-ethernetlite-2.00.b' for QEMU using
From: Chen Gang @ 2014-11-01  3:59 UTC (permalink / raw)
  To: michal.simek, soren.brinkmann
  Cc: davem, sthokal, manuel.schoelling, paul.gortmaker, f.fainelli,
	ebiederm, netdev, linux-arm-kernel, linux-kernel@vger.kernel.org
In-Reply-To: <54544E98.4060007@gmail.com>

On 11/1/14 11:08, Chen Gang wrote:
> When use current latest upstream qemu (current version: 2.1.2), need let
> driver compatible with 'xlnx,xps-ethernetlite-2.00.b', or can not find
> net device in microblaze qemu. Related QEMU commands under fedora 20:
> 
>   yum install libvirt
>   yum install tunctl
>   tunctl -b
>   ip link set tap0 up
>   brctl addif virbr0 tap0
>   ./microblaze-softmmu/qemu-system-microblaze -M petalogix-s3adsp1800 \
>     -kernel ../linux-stable.microblaze/arch/microblaze/boot/linux.bin \
>     -no-reboot -append "console=ttyUL0,115200 doreboot" -nographic \
>     -net nic,vlan=0,model=xlnx.xps-ethernetlite,macaddr=00:16:35:AF:94:00 \
>     -net tap,vlan=0,ifname=tap0,script=no,downscript=no
> 
>   in microblaze qemu bash (guest machine):
> 
>     ifconfig eth0 add 192.168.122.1 netmask 255.255.255.0

Oh, sorry, it is 192.168.122.2 (192.168.122.1 is the router address).

Thanks.

>     ifconfig eth0 up
> 
> After add this patch, can find the device, and can be used by 'telnetd'
> (need cross-build busybox with glibc for it), then outside can telnet to
> it without password.
> 
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
>  drivers/net/ethernet/xilinx/xilinx_emaclite.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index 28dbbdc..298fad3 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -1236,6 +1236,7 @@ static struct of_device_id xemaclite_of_match[] = {
>  	{ .compatible = "xlnx,opb-ethernetlite-1.01.b", },
>  	{ .compatible = "xlnx,xps-ethernetlite-1.00.a", },
>  	{ .compatible = "xlnx,xps-ethernetlite-2.00.a", },
> +	{ .compatible = "xlnx,xps-ethernetlite-2.00.b", },
>  	{ .compatible = "xlnx,xps-ethernetlite-2.01.a", },
>  	{ .compatible = "xlnx,xps-ethernetlite-3.00.a", },
>  	{ /* end of list */ },
> 

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply

* Re: DMA-API warning from sunhme - unchecked dma_map_single error
From: David Miller @ 2014-11-01  4:24 UTC (permalink / raw)
  To: mroos; +Cc: netdev, sparclinux
In-Reply-To: <alpine.DEB.2.03.1410312258170.17220@cyber.ee>

From: Meelis Roos <mroos@linux.ee>
Date: Fri, 31 Oct 2014 23:01:09 +0200 (EET)

>>> It seems to be correct warning - dma_map_single is used unchecked in
>>> sunhme.c. I can try fixing it - the error handling will be the only
>>> problem. Is it considered worthwile?
>>
>> Can you test this patch?
> 
> It works fine on E3500 where I had many debugging options on and
> caught it. No warnings, network still works.

Thanks for testing, I'll push this to Linus and -stable soon.

^ permalink raw reply

* RE: suspend/resume broken on 3.18-rc2
From: fugang.duan @ 2014-11-01  7:25 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Anson.Huang@freescale.com, Frank.Li@freescale.com, Russell King,
	Shawn Guo, netdev@vger.kernel.org
In-Reply-To: <CAOMZO5AeBSusV=xHgy8KJOb9po9WbS=DkaKXnS8iOpW8t-Y_Fw@mail.gmail.com>

From: Fabio Estevam <festevam@gmail.com> Sent: Saturday, November 01, 2014 3:36 AM
>To: Duan Fugang-B38611
>Cc: Huang Yongcai-B20788; Li Frank-B20596; Russell King; Shawn Guo;
>netdev@vger.kernel.org
>Subject: Re: suspend/resume broken on 3.18-rc2
>
>Andy,
>
>On Thu, Oct 30, 2014 at 1:11 AM, fugang.duan@freescale.com
><fugang.duan@freescale.com> wrote:
>
>> I tried it yesterday with FEC close, resume cannot back.
>> I will try it again.
>
>We have a regression in 3.18-rc1: if I use the imx6sx-sdb.dtb from
>3.17.1 then I get:
>
>root@freescale /$ echo enabled > /sys/class/tty/ttymxc0/power/wakeup
>root@freescale /$ echo mem > /sys/power/state
>[   13.883094] PM: Syncing filesystems ... done.
>[   13.932184] Freezing user space processes ... (elapsed 0.003 seconds)
>done.
>[   13.942928] Freezing remaining freezable tasks ... (elapsed 0.003
>seconds) d.
>[   14.014823] PM: suspend of devices complete after 54.572 msecs
>[   14.020730] PM: suspend devices took 0.060 seconds
>[   14.035241] PM: late suspend of devices complete after 9.545 msecs
>[   14.050901] PM: noirq suspend of devices complete after 9.383 msecs
>[   14.057626] Disabling non-boot CPUs ...
>[   14.071514] PM: noirq resume of devices complete after 8.338 msecs
>[   14.085645] PM: early resume of devices complete after 6.417 msecs
>[   14.097720] fec 2188000.ethernet eth0: rcv is not +last
>[   14.187491] PM: resume of devices complete after 95.494 msecs
>[   14.199039] PM: resume devices took 0.100 seconds
>[   14.203831] Restarting tasks ... done.
>[   15.892318] fec 2188000.ethernet eth0: rcv is not +last
>[   15.897688] fec 2188000.ethernet eth0: rcv is not +last
>[   15.903010] fec 2188000.ethernet eth0: rcv is not +last
>[   15.908326] fec 2188000.ethernet eth0: rcv is not +last
>[   15.913635] fec 2188000.ethernet eth0: rcv is not +last
>[   15.918945] fec 2188000.ethernet eth0: rcv is not +last
>
>So fec suspend/resume is broken for mx6sx.
>
>Please take a look at it.
Hi, Fabio,

Thanks, I will fix it.

Regards,
Andy

^ permalink raw reply

* [PATCH]  net: mvpp2: fix possible memory leak
From: Sudip Mukherjee @ 2014-11-01 11:29 UTC (permalink / raw)
  To: David S. Miller; +Cc: Sudip Mukherjee, netdev, linux-kernel

we are allocating memory using kzalloc for struct mvpp2_prs_entry,
but later when we are getting error we were just returning the error
value without releasing the memory.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

hi,
i could not build test after modifying it. I tried to compile using
multi_v7_defconfig , but the cross compiler i have is not able to
compile it and giving sevaral warnings from the assembler.

 drivers/net/ethernet/marvell/mvpp2.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index ece83f1..c4382b3 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -1692,6 +1692,7 @@ static int mvpp2_prs_vlan_add(struct mvpp2 *priv, unsigned short tpid, int ai,
 {
 	struct mvpp2_prs_entry *pe;
 	int tid_aux, tid;
+	int ret = 0;
 
 	pe = mvpp2_prs_vlan_find(priv, tpid, ai);
 
@@ -1723,8 +1724,10 @@ static int mvpp2_prs_vlan_add(struct mvpp2 *priv, unsigned short tpid, int ai,
 				break;
 		}
 
-		if (tid <= tid_aux)
-			return -EINVAL;
+		if (tid <= tid_aux) {
+			ret = -EINVAL;
+			goto error;
+		}
 
 		memset(pe, 0 , sizeof(struct mvpp2_prs_entry));
 		mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN);
@@ -1756,9 +1759,10 @@ static int mvpp2_prs_vlan_add(struct mvpp2 *priv, unsigned short tpid, int ai,
 
 	mvpp2_prs_hw_write(priv, pe);
 
+error:
 	kfree(pe);
 
-	return 0;
+	return ret;
 }
 
 /* Get first free double vlan ai number */
@@ -1821,7 +1825,7 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1,
 				     unsigned int port_map)
 {
 	struct mvpp2_prs_entry *pe;
-	int tid_aux, tid, ai;
+	int tid_aux, tid, ai, ret = 0;
 
 	pe = mvpp2_prs_double_vlan_find(priv, tpid1, tpid2);
 
@@ -1838,8 +1842,10 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1,
 
 		/* Set ai value for new double vlan entry */
 		ai = mvpp2_prs_double_vlan_ai_free_get(priv);
-		if (ai < 0)
-			return ai;
+		if (ai < 0) {
+			ret = ai;
+			goto error;
+		}
 
 		/* Get first single/triple vlan tid */
 		for (tid_aux = MVPP2_PE_FIRST_FREE_TID;
@@ -1859,8 +1865,10 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1,
 				break;
 		}
 
-		if (tid >= tid_aux)
-			return -ERANGE;
+		if (tid >= tid_aux) {
+			ret = -ERANGE;
+			goto error;
+		}
 
 		memset(pe, 0, sizeof(struct mvpp2_prs_entry));
 		mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN);
@@ -1887,8 +1895,9 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1,
 	mvpp2_prs_tcam_port_map_set(pe, port_map);
 	mvpp2_prs_hw_write(priv, pe);
 
+error:
 	kfree(pe);
-	return 0;
+	return ret;
 }
 
 /* IPv4 header parsing for fragmentation and L4 offset */
-- 
1.8.1.2

^ permalink raw reply related

* [PATCH 0/1] mv643xx_eth: Disable TSO by default
From: Ezequiel Garcia @ 2014-11-01 15:30 UTC (permalink / raw)
  To: netdev, David Miller
  Cc: Thomas Petazzoni, Gregory Clement, Tawfik Bayouk, Lior Amsalem,
	Nadav Haklai, Ezequiel Garcia

Several users ([1], [2]) have been reporting data corruption with TSO on
Kirkwood platforms (i.e. using the mv643xx_eth driver).

Until we manage to find what's causing this, this simple patch will make
the TSO path disabled by default. This patch should be queued for stable,
fixing the TSO feature introduced in v3.16.

The corruption itself is very easy to reproduce: checking md5sum on a mounted
NFS directory gives a different result each time. Same tests using the mvneta
driver (Armada 370/38x/XP SoC) pass with no issues.

Frankly, I'm a bit puzzled about this, and so any ideas or debugging hints
are well received.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764162
[2] http://archlinuxarm.org/forum/viewtopic.php?f=9&t=7692

Ezequiel Garcia (1):
  net: mv643xx_eth: Make TSO disabled by default

 drivers/net/ethernet/marvell/mv643xx_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.1.0

^ permalink raw reply

* [PATCH 1/1] net: mv643xx_eth: Make TSO disabled by default
From: Ezequiel Garcia @ 2014-11-01 15:30 UTC (permalink / raw)
  To: netdev, David Miller
  Cc: Thomas Petazzoni, Gregory Clement, Tawfik Bayouk, Lior Amsalem,
	Nadav Haklai, Ezequiel Garcia
In-Reply-To: <1414855820-15094-1-git-send-email-ezequiel.garcia@free-electrons.com>

Data corruption has been observed to be produced by TSO. For instance,
accessing files on a NFS-server with TSO enabled results in different data
transferred each time.

This has been observed only on Kirkwood platforms, i.e. with the mv643xx_eth
driver. Same tests on platforms using the mvneta ethernet driver have
passed without errors.

Make TSO disabled by default for now, until we can found a proper fix
for the regression.

Fixes: 3ae8f4e0b98 ('net: mv643xx_eth: Implement software TSO')
Reported-by: Slawomir Gajzner <slawomir.gajzner@gmail.com>
Reported-by: Julien D'Ascenzio <jdascenzio@yahoo.fr>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index b151a94..8b72780 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -3110,11 +3110,11 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	dev->watchdog_timeo = 2 * HZ;
 	dev->base_addr = 0;
 
-	dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
+	dev->features = NETIF_F_SG | NETIF_F_IP_CSUM;
 	dev->vlan_features = dev->features;
 
 	dev->features |= NETIF_F_RXCSUM;
-	dev->hw_features = dev->features;
+	dev->hw_features = dev->features  | NETIF_F_TSO;
 
 	dev->priv_flags |= IFF_UNICAST_FLT;
 	dev->gso_max_segs = MV643XX_MAX_TSO_SEGS;
-- 
2.1.0

^ permalink raw reply related

* Re: [PATCH v2] PPC: bpf_jit_comp: add SKF_AD_PKTTYPE instruction
From: Denis Kirjanov @ 2014-11-01 16:19 UTC (permalink / raw)
  To: Denis Kirjanov
  Cc: Alexei Starovoitov, netdev@vger.kernel.org, linuxppc-dev,
	Michael Ellerman, Matt Evans
In-Reply-To: <CAHj3AVkpouHa1y0jt9c5dyYvnd6dctociTMW1ORdxaKdsFEbhQ@mail.gmail.com>

ping

On 10/31/14, Denis Kirjanov <kirjanov@gmail.com> wrote:
> On 10/30/14, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>> On Wed, Oct 29, 2014 at 11:12 PM, Denis Kirjanov <kda@linux-powerpc.org>
>> wrote:
>>> Add BPF extension SKF_AD_PKTTYPE to ppc JIT to load
>>> skb->pkt_type field.
>>>
>>> Before:
>>> [   88.262622] test_bpf: #11 LD_IND_NET 86 97 99 PASS
>>> [   88.265740] test_bpf: #12 LD_PKTTYPE 109 107 PASS
>>>
>>> After:
>>> [   80.605964] test_bpf: #11 LD_IND_NET 44 40 39 PASS
>>> [   80.607370] test_bpf: #12 LD_PKTTYPE 9 9 PASS
>>
>> if you'd only quoted #12, it would all make sense ;)
>> but #11 test is not using PKTTYPE. So your patch shouldn't
>> make a difference. Are these numbers with JIT on and off?
>
> Right.
>
>> --
>> 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
>>
>
>
> --
> Regards,
> Denis
>

^ permalink raw reply

* DONATION!!!
From: Mrs Birgit Rausing @ 2014-10-30 21:28 UTC (permalink / raw)





I,Birgit authenticate this email, you can read about me on:
http://en.wikipedia.org/wiki/Birgit_Rausing
I have funds for you to manage and disburse to various charities of your
choice. If you are sure you can handle this, it will be of help to you and
others. Please reply if you are interested  for more details.please
Contact my private  email;( mrs_BirgitRausin0@qq.com ) for more
information

With love,
Mrs Birgit Rausing

^ permalink raw reply

* Re: [PATCH 1/1] net: mv643xx_eth: Make TSO disabled by default
From: Thomas Petazzoni @ 2014-11-01 17:00 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: netdev, David Miller, Gregory Clement, Tawfik Bayouk,
	Lior Amsalem, Nadav Haklai
In-Reply-To: <1414855820-15094-2-git-send-email-ezequiel.garcia@free-electrons.com>

Dear Ezequiel Garcia,

On Sat,  1 Nov 2014 12:30:20 -0300, Ezequiel Garcia wrote:
> Data corruption has been observed to be produced by TSO. For instance,
> accessing files on a NFS-server with TSO enabled results in different data
> transferred each time.
> 
> This has been observed only on Kirkwood platforms, i.e. with the mv643xx_eth
> driver. Same tests on platforms using the mvneta ethernet driver have
> passed without errors.
> 
> Make TSO disabled by default for now, until we can found a proper fix
> for the regression.
> 
> Fixes: 3ae8f4e0b98 ('net: mv643xx_eth: Implement software TSO')
> Reported-by: Slawomir Gajzner <slawomir.gajzner@gmail.com>
> Reported-by: Julien D'Ascenzio <jdascenzio@yahoo.fr>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Shouldn't you have a:

   Cc: <stable@vger.kernel.org> # v3.16+

here ?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply

* Re: [stable request <= 3.11] net/mlx4_en: Fix BlueFlame race
From: Cong Wang @ 2014-11-01 17:17 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Vinson Lee, David S. Miller, Amir Vadai, Or Gerlitz,
	Jack Morgenstein, Eugenia Emantayev, Matan Barak, netdev
In-Reply-To: <1414805353.16849.98.camel@decadent.org.uk>

On Fri, Oct 31, 2014 at 6:29 PM, Ben Hutchings <ben@decadent.org.uk> wrote:
> On Sat, 2014-10-18 at 14:14 -0700, Vinson Lee wrote:
>> Hi.
>>
>> Please consider backporting upstream commit
>> 2d4b646613d6b12175b017aca18113945af1faf3 "net/mlx4_en: Fix BlueFlame
>> race" to stable kernels <= 3.11.
>>
>> commit 2d4b646613d6b12175b017aca18113945af1faf3
>> Author: Eugenia Emantayev <eugenia@mellanox.com>
>> Date:   Thu Jul 25 19:21:23 2013 +0300
>>
>>     net/mlx4_en: Fix BlueFlame race
> [...]
>
> David doesn't support anything older than 3.12 now, so you should send
> requests for older stable branches directly to the stable list.

Interesting, is there a document saying which stable kernels netdev
supports? and how are they chosen?

I thought netdev supports all -stable maintainers support.

Anyway, we will send the request directly to Greg then.

Thanks.

^ permalink raw reply

* Re: [PATCH 0/1] mv643xx_eth: Disable TSO by default
From: Eric Dumazet @ 2014-11-01 17:26 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: netdev, David Miller, Thomas Petazzoni, Gregory Clement,
	Tawfik Bayouk, Lior Amsalem, Nadav Haklai
In-Reply-To: <1414855820-15094-1-git-send-email-ezequiel.garcia@free-electrons.com>

On Sat, 2014-11-01 at 12:30 -0300, Ezequiel Garcia wrote:
> Several users ([1], [2]) have been reporting data corruption with TSO on
> Kirkwood platforms (i.e. using the mv643xx_eth driver).
> 
> Until we manage to find what's causing this, this simple patch will make
> the TSO path disabled by default. This patch should be queued for stable,
> fixing the TSO feature introduced in v3.16.
> 
> The corruption itself is very easy to reproduce: checking md5sum on a mounted
> NFS directory gives a different result each time. Same tests using the mvneta
> driver (Armada 370/38x/XP SoC) pass with no issues.
> 
> Frankly, I'm a bit puzzled about this, and so any ideas or debugging hints
> are well received.

lack of barriers maybe ?

It seems you might need to populate all TX descriptors but delay the
first, like doing the populate in descending order.

If you take a look at txq_submit_skb(), you'll see the final
desc->cmd_sts = cmd_sts (line 959) is done _after_ frags were cooked by
txq_submit_frag_skb()

You should kick the nick only when all TX descriptors are ready and
committed to memory.

^ permalink raw reply

* Re: [PATCH 0/1] mv643xx_eth: Disable TSO by default
From: Thomas Petazzoni @ 2014-11-01 17:33 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Ezequiel Garcia, netdev, David Miller, Gregory Clement,
	Tawfik Bayouk, Lior Amsalem, Nadav Haklai
In-Reply-To: <1414862766.31792.7.camel@edumazet-glaptop2.roam.corp.google.com>

Dear Eric Dumazet,

On Sat, 01 Nov 2014 10:26:06 -0700, Eric Dumazet wrote:
> On Sat, 2014-11-01 at 12:30 -0300, Ezequiel Garcia wrote:
> > Several users ([1], [2]) have been reporting data corruption with TSO on
> > Kirkwood platforms (i.e. using the mv643xx_eth driver).
> > 
> > Until we manage to find what's causing this, this simple patch will make
> > the TSO path disabled by default. This patch should be queued for stable,
> > fixing the TSO feature introduced in v3.16.
> > 
> > The corruption itself is very easy to reproduce: checking md5sum on a mounted
> > NFS directory gives a different result each time. Same tests using the mvneta
> > driver (Armada 370/38x/XP SoC) pass with no issues.
> > 
> > Frankly, I'm a bit puzzled about this, and so any ideas or debugging hints
> > are well received.
> 
> lack of barriers maybe ?
> 
> It seems you might need to populate all TX descriptors but delay the
> first, like doing the populate in descending order.
> 
> If you take a look at txq_submit_skb(), you'll see the final
> desc->cmd_sts = cmd_sts (line 959) is done _after_ frags were cooked by
> txq_submit_frag_skb()
> 
> You should kick the nick only when all TX descriptors are ready and
> committed to memory.

As far as I know, ARMv5 does not do out-of-order execution, and so on
ARMv5, mb() == rmb() == wmb() == barrier(). But might be a missing
compiler barrier, indeed, as that's not specific to the architecture.

Thanks for the hint!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply

* Re: [PATCH 0/1] mv643xx_eth: Disable TSO by default
From: Eric Dumazet @ 2014-11-01 17:37 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: netdev, David Miller, Thomas Petazzoni, Gregory Clement,
	Tawfik Bayouk, Lior Amsalem, Nadav Haklai
In-Reply-To: <1414862766.31792.7.camel@edumazet-glaptop2.roam.corp.google.com>

On Sat, 2014-11-01 at 10:26 -0700, Eric Dumazet wrote:
> On Sat, 2014-11-01 at 12:30 -0300, Ezequiel Garcia wrote:
> > Several users ([1], [2]) have been reporting data corruption with TSO on
> > Kirkwood platforms (i.e. using the mv643xx_eth driver).
> > 
> > Until we manage to find what's causing this, this simple patch will make
> > the TSO path disabled by default. This patch should be queued for stable,
> > fixing the TSO feature introduced in v3.16.
> > 
> > The corruption itself is very easy to reproduce: checking md5sum on a mounted
> > NFS directory gives a different result each time. Same tests using the mvneta
> > driver (Armada 370/38x/XP SoC) pass with no issues.
> > 
> > Frankly, I'm a bit puzzled about this, and so any ideas or debugging hints
> > are well received.
> 
> lack of barriers maybe ?
> 
> It seems you might need to populate all TX descriptors but delay the
> first, like doing the populate in descending order.
> 
> If you take a look at txq_submit_skb(), you'll see the final
> desc->cmd_sts = cmd_sts (line 959) is done _after_ frags were cooked by
> txq_submit_frag_skb()
> 
> You should kick the nick only when all TX descriptors are ready and
> committed to memory.
> 

Untested patch would be :

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index b151a949f352a20ec8e74b4f3a7b6bb194ce841c..44789cc9a263992f91e46006d7e12703a2824cb4 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -773,7 +773,8 @@ txq_put_data_tso(struct net_device *dev, struct tx_queue *txq,
 }
 
 static inline void
-txq_put_hdr_tso(struct sk_buff *skb, struct tx_queue *txq, int length)
+txq_put_hdr_tso(struct sk_buff *skb, struct tx_queue *txq, int length,
+		struct tx_desc **pdesc, u32 *cmd)
 {
 	struct mv643xx_eth_private *mp = txq_to_mp(txq);
 	int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
@@ -797,9 +798,13 @@ txq_put_hdr_tso(struct sk_buff *skb, struct tx_queue *txq, int length)
 	desc->byte_cnt = hdr_len;
 	desc->buf_ptr = txq->tso_hdrs_dma +
 			txq->tx_curr_desc * TSO_HEADER_SIZE;
-	desc->cmd_sts = cmd_csum | BUFFER_OWNED_BY_DMA  | TX_FIRST_DESC |
-				   GEN_CRC;
-
+	cmd_csum |= BUFFER_OWNED_BY_DMA  | TX_FIRST_DESC | GEN_CRC;
+	if (*pdesc == NULL) {
+		*pdesc = desc;
+		*cmd = cmd_csum;
+	} else {
+		desc->cmd_sts = cmd_csum;
+	}
 	txq->tx_curr_desc++;
 	if (txq->tx_curr_desc == txq->tx_ring_size)
 		txq->tx_curr_desc = 0;
@@ -813,6 +818,8 @@ static int txq_submit_tso(struct tx_queue *txq, struct sk_buff *skb,
 	int desc_count = 0;
 	struct tso_t tso;
 	int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
+	struct tx_desc *desc = NULL;
+	u32 cmd_sts = 0;
 
 	/* Count needed descriptors */
 	if ((txq->tx_desc_count + tso_count_descs(skb)) >= txq->tx_ring_size) {
@@ -834,7 +841,7 @@ static int txq_submit_tso(struct tx_queue *txq, struct sk_buff *skb,
 		/* prepare packet headers: MAC + IP + TCP */
 		hdr = txq->tso_hdrs + txq->tx_curr_desc * TSO_HEADER_SIZE;
 		tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0);
-		txq_put_hdr_tso(skb, txq, data_left);
+		txq_put_hdr_tso(skb, txq, data_left, &desc, &cmd_sts);
 
 		while (data_left > 0) {
 			int size;
@@ -854,6 +861,10 @@ static int txq_submit_tso(struct tx_queue *txq, struct sk_buff *skb,
 	__skb_queue_tail(&txq->tx_skb, skb);
 	skb_tx_timestamp(skb);
 
+	/* ensure all other descriptors are written before first cmd_sts */
+	wmb();
+	desc->cmd_sts = cmd_sts;
+
 	/* clear TX_END status */
 	mp->work_tx_end &= ~(1 << txq->index);
 

^ permalink raw reply related

* Re: [PATCH v2] PPC: bpf_jit_comp: add SKF_AD_PKTTYPE instruction
From: David Miller @ 2014-11-01 17:39 UTC (permalink / raw)
  To: kda; +Cc: kirjanov, alexei.starovoitov, netdev, linuxppc-dev, mpe, matt
In-Reply-To: <CAOJe8K31iB9+7c1BnS=6DdriU08WUisM7sYgj8nOBo4Fg=XUBg@mail.gmail.com>

From: Denis Kirjanov <kda@linux-powerpc.org>
Date: Sat, 1 Nov 2014 20:19:09 +0400

> ping

What specifically are you waiting for?

^ permalink raw reply

* Re: [PATCH 1/1] net: mv643xx_eth: Make TSO disabled by default
From: David Miller @ 2014-11-01 17:40 UTC (permalink / raw)
  To: thomas.petazzoni
  Cc: ezequiel.garcia, netdev, gregory.clement, tawfik, alior, nadavh
In-Reply-To: <20141101180037.087b7a95@free-electrons.com>

From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sat, 1 Nov 2014 18:00:37 +0100

> Dear Ezequiel Garcia,
> 
> On Sat,  1 Nov 2014 12:30:20 -0300, Ezequiel Garcia wrote:
>> Data corruption has been observed to be produced by TSO. For instance,
>> accessing files on a NFS-server with TSO enabled results in different data
>> transferred each time.
>> 
>> This has been observed only on Kirkwood platforms, i.e. with the mv643xx_eth
>> driver. Same tests on platforms using the mvneta ethernet driver have
>> passed without errors.
>> 
>> Make TSO disabled by default for now, until we can found a proper fix
>> for the regression.
>> 
>> Fixes: 3ae8f4e0b98 ('net: mv643xx_eth: Implement software TSO')
>> Reported-by: Slawomir Gajzner <slawomir.gajzner@gmail.com>
>> Reported-by: Julien D'Ascenzio <jdascenzio@yahoo.fr>
>> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> 
> Shouldn't you have a:
> 
>    Cc: <stable@vger.kernel.org> # v3.16+

Networking patches do not get sent to -stable that way.

Instead, people specifically request that I queue up the change
for -stable and I submit it by hand at the appropriate time.

^ permalink raw reply

* Re: [stable request <= 3.11] net/mlx4_en: Fix BlueFlame race
From: David Miller @ 2014-11-01 17:41 UTC (permalink / raw)
  To: cwang; +Cc: ben, vlee, amirv, ogerlitz, jackm, eugenia, matanb, netdev
In-Reply-To: <CAHA+R7OyLv2YO8AduNhnEgW3RyYZwWNEHY6W-v_HXgVT9AOaKw@mail.gmail.com>

From: Cong Wang <cwang@twopensource.com>
Date: Sat, 1 Nov 2014 10:17:43 -0700

> On Fri, Oct 31, 2014 at 6:29 PM, Ben Hutchings <ben@decadent.org.uk> wrote:
>> On Sat, 2014-10-18 at 14:14 -0700, Vinson Lee wrote:
>>> Hi.
>>>
>>> Please consider backporting upstream commit
>>> 2d4b646613d6b12175b017aca18113945af1faf3 "net/mlx4_en: Fix BlueFlame
>>> race" to stable kernels <= 3.11.
>>>
>>> commit 2d4b646613d6b12175b017aca18113945af1faf3
>>> Author: Eugenia Emantayev <eugenia@mellanox.com>
>>> Date:   Thu Jul 25 19:21:23 2013 +0300
>>>
>>>     net/mlx4_en: Fix BlueFlame race
>> [...]
>>
>> David doesn't support anything older than 3.12 now, so you should send
>> requests for older stable branches directly to the stable list.
> 
> Interesting, is there a document saying which stable kernels netdev
> supports? and how are they chosen?
> 
> I thought netdev supports all -stable maintainers support.
> 
> Anyway, we will send the request directly to Greg then.

There is no documented way nor do I wish to state anything so strictly.
I want maximum flexibility for such a time consuming task.

I tend to go back 3 or 4 releases at most, and it really depends upon
the difficulty of the backports and my own time constraints.

^ permalink raw reply

* Re: [PATCH 0/1] mv643xx_eth: Disable TSO by default
From: David Miller @ 2014-11-01 17:42 UTC (permalink / raw)
  To: eric.dumazet
  Cc: ezequiel.garcia, netdev, thomas.petazzoni, gregory.clement,
	tawfik, alior, nadavh
In-Reply-To: <1414862766.31792.7.camel@edumazet-glaptop2.roam.corp.google.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 01 Nov 2014 10:26:06 -0700

> On Sat, 2014-11-01 at 12:30 -0300, Ezequiel Garcia wrote:
>> Several users ([1], [2]) have been reporting data corruption with TSO on
>> Kirkwood platforms (i.e. using the mv643xx_eth driver).
>> 
>> Until we manage to find what's causing this, this simple patch will make
>> the TSO path disabled by default. This patch should be queued for stable,
>> fixing the TSO feature introduced in v3.16.
>> 
>> The corruption itself is very easy to reproduce: checking md5sum on a mounted
>> NFS directory gives a different result each time. Same tests using the mvneta
>> driver (Armada 370/38x/XP SoC) pass with no issues.
>> 
>> Frankly, I'm a bit puzzled about this, and so any ideas or debugging hints
>> are well received.
> 
> lack of barriers maybe ?
> 
> It seems you might need to populate all TX descriptors but delay the
> first, like doing the populate in descending order.
> 
> If you take a look at txq_submit_skb(), you'll see the final
> desc->cmd_sts = cmd_sts (line 959) is done _after_ frags were cooked by
> txq_submit_frag_skb()
> 
> You should kick the nick only when all TX descriptors are ready and
> committed to memory.

Yes, please look into whether doing something like this fixes the
problem.

^ permalink raw reply

* Re: [PATCH v2] PPC: bpf_jit_comp: add SKF_AD_PKTTYPE instruction
From: Denis Kirjanov @ 2014-11-01 17:49 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, alexei.starovoitov, matt, linuxppc-dev
In-Reply-To: <20141101.133957.1365371956675094081.davem@davemloft.net>

David, you need a feedback from other guys to apply this patch, right?

Alexei wanted some output before/after the patch.
Michael Ellerman wanted the explanation what a BPF_ANC | SKF_AD_PKTTYPE means.
So I'm waiting  the ack/nack from them...

On 11/1/14, David Miller <davem@davemloft.net> wrote:
> From: Denis Kirjanov <kda@linux-powerpc.org>
> Date: Sat, 1 Nov 2014 20:19:09 +0400
>
>> ping
>
> What specifically are you waiting for?
>
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

^ 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