Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH ipv4 multicast] Fix IPv4 multicast over network namespaces
From: Benjamin LaHaise @ 2012-03-28  0:49 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20120327.173541.1721499825104013533.davem@davemloft.net>

On Tue, Mar 27, 2012 at 05:35:41PM -0400, David Miller wrote:
> No signoff.

My apologies.  Doing this manually clearly isn't working, so I've switched 
to a script to try to catch this.

> No proper subsystem prefix in Subject line (should be "ipv4: " here)

I'm trying to get this right, and it looks like I botched this again, for 
that I am truely sorry.

		-ben

> And third you've been warned about this repeatedly in your previous
> patch postings.
> 
> Therefore I'm not applying this.

-- 
"Thought is the essence of where you are now."

^ permalink raw reply

* [PATCH 10/13] smsc911x: Use lockdep_assert_held instead of home grown buggy construct
From: Andi Kleen @ 2012-03-28  0:47 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Andi Kleen, netdev
In-Reply-To: <1332895637-32572-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

Cc: netdev@vger.kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 drivers/net/ethernet/smsc/smsc911x.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.h b/drivers/net/ethernet/smsc/smsc911x.h
index 9ad5e5d..4fbb697 100644
--- a/drivers/net/ethernet/smsc/smsc911x.h
+++ b/drivers/net/ethernet/smsc/smsc911x.h
@@ -52,7 +52,7 @@
 
 #ifdef CONFIG_DEBUG_SPINLOCK
 #define SMSC_ASSERT_MAC_LOCK(pdata) \
-		WARN_ON(!spin_is_locked(&pdata->mac_lock))
+		lockdep_assert_held(&(pdata)->mac_lock)
 #else
 #define SMSC_ASSERT_MAC_LOCK(pdata) do {} while (0)
 #endif				/* CONFIG_DEBUG_SPINLOCK */
-- 
1.7.7.6

^ permalink raw reply related

* [PATCH 08/13] irda: remove spin_is_locked
From: Andi Kleen @ 2012-03-28  0:47 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Andi Kleen, netdev, samuel
In-Reply-To: <1332895637-32572-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

It's hard to imagine how this spin_is_locked debugging check is not
totally racy.  Remove it.

Cc: netdev@vger.kernel.org
Cc: samuel@sortiz.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 drivers/net/irda/sir_dev.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index 5039f08..90a1b3e 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -632,11 +632,6 @@ static netdev_tx_t sirdev_hard_xmit(struct sk_buff *skb,
 	/* Init tx buffer*/
 	dev->tx_buff.data = dev->tx_buff.head;
 
-	/* Check problems */
-	if(spin_is_locked(&dev->tx_lock)) {
-		IRDA_DEBUG(3, "%s(), write not completed\n", __func__);
-	}
-
 	/* serialize with write completion */
 	spin_lock_irqsave(&dev->tx_lock, flags);
 
-- 
1.7.7.6

^ permalink raw reply related

* [PATCH 2/2] dev_forward_skb() should clear skb_iif
From: Benjamin LaHaise @ 2012-03-28  0:44 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

While investigating another bug, I found that the code on the incoming path
in __netif_receive_skb will only set skb->skb_iif if it is already 0.  When
dev_forward_skb() is used in the case of interfaces like veth, skb_iif may
already have been set.  Making dev_forward_skb() cause the packet to look
like a newly received packet would seem to the the correct behaviour here,
as otherwise the wrong incoming interface can be reported for such a packet.

Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
---
 net/core/dev.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 0f3eb7d..021bb25 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1597,6 +1597,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 		kfree_skb(skb);
 		return NET_RX_DROP;
 	}
+	skb->skb_iif = 0;
 	skb_set_dev(skb, dev);
 	skb->tstamp.tv64 = 0;
 	skb->pkt_type = PACKET_HOST;
-- 
1.7.4.1


-- 
"Thought is the essence of where you are now."

^ permalink raw reply related

* [PATCH 1/2] Fix IPv4 multicast over network namespaces
From: Benjamin LaHaise @ 2012-03-28  0:44 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

When using multicast over a local bridge feeding a number of LXC guests
using veth, the LXC guests are unable to get a response from other guests
when pinging 224.0.0.1.  Multicast packets did not appear to be getting
delivered to the network namespaces of the guest hosts, and further
inspection showed that the incoming route was pointing to the loopback
device of the host, not the guest.  This lead to the wrong network namespace
being picked up by sockets (like ICMP).  Fix this by using the correct
network namespace when creating the inbound route entry.

Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
---
 net/ipv4/route.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 12ccf88..3b110a4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2042,7 +2042,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 		if (err < 0)
 			goto e_err;
 	}
-	rth = rt_dst_alloc(init_net.loopback_dev,
+	rth = rt_dst_alloc(dev_net(dev)->loopback_dev,
 			   IN_DEV_CONF_GET(in_dev, NOPOLICY), false);
 	if (!rth)
 		goto e_nobufs;
-- 
1.7.4.1


-- 
"Thought is the essence of where you are now."

^ permalink raw reply related

* kernel BUG at include/net/netns/generic.h:41
From: Dave Jones @ 2012-03-28  0:23 UTC (permalink / raw)
  To: Linux Kernel; +Cc: netdev

I started seeing this every boot.. (v3.3-6972-ge22057c)

	Dave

[   17.103931] ------------[ cut here ]------------
[   17.105987] RPC: Registered named UNIX socket transport module.
[   17.105989] RPC: Registered udp transport module.
[   17.105990] RPC: Registered tcp transport module.
[   17.105992] RPC: Registered tcp NFSv4.1 backchannel transport module.
[   17.104856] kernel BUG at include/net/netns/generic.h:41!
[   17.104856] invalid opcode: 0000 [#1] PREEMPT SMP 
[   17.104856] CPU 0 
[   17.104856] Modules linked in: sunrpc btrfs zlib_deflate libcrc32c firewire_ohci firewire_core sata_sil crc_itu_t floppy radeon ttm drm_kms_helper drm i2c_algo_bit i2c_core
[   17.104856] 
[   17.104856] Pid: 416, comm: mount Not tainted 3.3.0+ #19                  /D975XBX
[   17.104856] RIP: 0010:[<ffffffffa029068b>]  [<ffffffffa029068b>] rpc_fill_super+0x29b/0x2a0 [sunrpc]
[   17.104856] RSP: 0018:ffff8800b52c5cf8  EFLAGS: 00010246
[   17.104856] RAX: 0000000000000001 RBX: ffff8800a394dcd0 RCX: 0000000000000000
[   17.104856] RDX: ffff8800a4c10000 RSI: ffffffff81c2cd00 RDI: ffff8800a4c10918
[   17.104856] RBP: ffff8800b52c5d38 R08: 0000000000000001 R09: 0000000000000000
[   17.104856] R10: 0000000000000001 R11: 0000000000000002 R12: 0000000000000000
[   17.104856] R13: ffffffff82d0f140 R14: ffff8800ba54c000 R15: 0000000000000000
[   17.104856] FS:  00007f1a97593800(0000) GS:ffff8800bf600000(0000) knlGS:0000000000000000
[   17.104856] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[   17.104856] CR2: 0000003e92478a90 CR3: 00000000a4d22000 CR4: 00000000000007f0
[   17.104856] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   17.104856] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[   17.104856] Process mount (pid: 416, threadinfo ffff8800b52c4000, task ffff8800a4c10000)
[   17.104856] Stack:
[   17.104856]  ffffffffa02903f0 00000000000000d0 000060ff40002438 ffffffff82d0f140
[   17.104856]  0000000000000000 ffffffffa02903f0 ffff8800a394dcd0 0000000000000000
[   17.104856]  ffff8800b52c5d88 ffffffff811a9d8c 0000000000000003 ffffffff00000001
[   17.104856] Call Trace:
[   17.104856]  [<ffffffffa02903f0>] ? rpc_mkpipe_dentry+0x180/0x180 [sunrpc]
[   17.104856]  [<ffffffffa02903f0>] ? rpc_mkpipe_dentry+0x180/0x180 [sunrpc]
[   17.104856]  [<ffffffff811a9d8c>] mount_ns+0xac/0xe0
[   17.104856]  [<ffffffffa028ea39>] rpc_mount+0x29/0x30 [sunrpc]
[   17.104856]  [<ffffffff811aaab3>] mount_fs+0x43/0x1b0
[   17.104856]  [<ffffffff8115dd80>] ? __alloc_percpu+0x10/0x20
[   17.104856]  [<ffffffff811c8af2>] vfs_kern_mount+0x72/0x100
[   17.104856]  [<ffffffff811c92d4>] do_kern_mount+0x54/0x110
[   17.104856]  [<ffffffff811caa44>] do_mount+0x1a4/0x830
[   17.104856]  [<ffffffff8115765b>] ? memdup_user+0x4b/0x90
[   17.104856]  [<ffffffff811576fb>] ? strndup_user+0x5b/0x80
[   17.104856]  [<ffffffff811cb210>] sys_mount+0x90/0xe0
[   17.104856]  [<ffffffff816624d2>] system_call_fastpath+0x16/0x1b
[   17.104856] Code: e8 db 7a e6 e0 84 c0 74 c9 48 c7 c7 00 cd c2 81 e8 bb e5 e1 e0 85 c0 0f 85 f4 fd ff ff eb b3 90 41 bf f4 ff ff ff e9 ce fe ff ff <0f> 0b 0f 0b 90 55 48 89 e5 41 54 53 48 83 ec 10 66 66 66 66 90 
[   17.104856] RIP  [<ffffffffa029068b>] rpc_fill_super+0x29b/0x2a0 [sunrpc]
[   17.104856]  RSP <ffff8800b52c5cf8>
[   17.469688] ---[ end trace 74871f164631364c ]---
[   17.488286] BUG: sleeping function called from invalid context at kernel/rwsem.c:21
[   17.498626] in_atomic(): 0, irqs_disabled(): 0, pid: 416, name: mount
[   17.498629] INFO: lockdep is turned off.
[   17.498631] Pid: 416, comm: mount Tainted: G      D      3.3.0+ #19
[   17.498632] Call Trace:
[   17.498639]  [<ffffffff8107d96c>] __might_sleep+0x13c/0x1f0
[   17.498644]  [<ffffffff81657c06>] down_read+0x26/0x93
[   17.498646]  [<ffffffff81061164>] exit_signals+0x24/0x130
[   17.498650]  [<ffffffff8104d3cf>] do_exit+0xbf/0xb60
[   17.498652]  [<ffffffff8104a443>] ? kmsg_dump+0x1c3/0x2c0
[   17.498654]  [<ffffffff8104a2ff>] ? kmsg_dump+0x7f/0x2c0
[   17.498657]  [<ffffffff8165b9d4>] oops_end+0xa4/0xf0
[   17.498660]  [<ffffffff81005be8>] die+0x58/0x90
[   17.498662]  [<ffffffff8165b2f4>] do_trap+0xc4/0x170
[   17.498665]  [<ffffffff81002f35>] ? do_invalid_op+0xa5/0xb0
[   17.498667]  [<ffffffff81002f25>] do_invalid_op+0x95/0xb0
[   17.498684]  [<ffffffffa029068b>] ? rpc_fill_super+0x29b/0x2a0 [sunrpc]
[   17.498686]  [<ffffffff8165e3cd>] ? sub_preempt_count+0x9d/0xd0
[   17.498689]  [<ffffffff8131baad>] ? trace_hardirqs_off_thunk+0x3a/0x3c
[   17.498692]  [<ffffffff8165ac4d>] ? restore_args+0x30/0x30
[   17.498696]  [<ffffffff81663755>] invalid_op+0x15/0x20
[   17.498704]  [<ffffffffa029068b>] ? rpc_fill_super+0x29b/0x2a0 [sunrpc]
[   17.498713]  [<ffffffffa0290675>] ? rpc_fill_super+0x285/0x2a0 [sunrpc]
[   17.498721]  [<ffffffffa02903f0>] ? rpc_mkpipe_dentry+0x180/0x180 [sunrpc]
[   17.498731]  [<ffffffffa02903f0>] ? rpc_mkpipe_dentry+0x180/0x180 [sunrpc]
[   17.498734]  [<ffffffff811a9d8c>] mount_ns+0xac/0xe0
[   17.498743]  [<ffffffffa028ea39>] rpc_mount+0x29/0x30 [sunrpc]
[   17.498746]  [<ffffffff811aaab3>] mount_fs+0x43/0x1b0
[   17.498750]  [<ffffffff8115dd80>] ? __alloc_percpu+0x10/0x20
[   17.498754]  [<ffffffff811c8af2>] vfs_kern_mount+0x72/0x100
[   17.498756]  [<ffffffff811c92d4>] do_kern_mount+0x54/0x110
[   17.498760]  [<ffffffff811caa44>] do_mount+0x1a4/0x830
[   17.498763]  [<ffffffff8115765b>] ? memdup_user+0x4b/0x90
[   17.498765]  [<ffffffff811576fb>] ? strndup_user+0x5b/0x80
[   17.498769]  [<ffffffff811cb210>] sys_mount+0x90/0xe0
[   17.498773]  [<ffffffff816624d2>] system_call_fastpath+0x16/0x1b
[   17.775067] systemd[1]: var-lib-nfs-rpc_pipefs.mount mount process exited, code=killed status=11
[   17.829617] systemd[1]: Job nfs-idmap.service/start failed with result 'dependency'.
[   17.856061] systemd[1]: Unit var-lib-nfs-rpc_pipefs.mount entered failed state.

^ permalink raw reply

* Re: [GIT] Networking
From: Linus Torvalds @ 2012-03-27 23:51 UTC (permalink / raw)
  To: David Miller; +Cc: akpm, netdev, linux-kernel
In-Reply-To: <20120327.185129.633367112180291954.davem@davemloft.net>

On Tue, Mar 27, 2012 at 3:51 PM, David Miller <davem@davemloft.net> wrote:
>
> I don't know if you've pulled this or not, but I just wanted to let
> you know that I just added the following critical fix to my tree
> which I'd like to propagate to -stable ASAP.
>
> So if you have pulled, if you would repull to get this guy, I'd
> really appreciate it.

I hadn't gotten around to it yet, I was doing arm merges now that I'm
back from the coast. Will pull probably next. Thanks,

                  Linus

^ permalink raw reply

* [PATCH v3, 1/1] net/hyperv: Add flow control based on hi/low watermark
From: Haiyang Zhang @ 2012-03-27 23:20 UTC (permalink / raw)
  To: davem, netdev; +Cc: devel, haiyangz, olaf, linux-kernel
In-Reply-To: <1332890445-12562-1-git-send-email-haiyangz@microsoft.com>

In the existing code, we only stop queue when the ringbuffer is full,
so the current packet has to be dropped or retried from upper layer.

This patch stops the tx queue when available ringbuffer is below
the low watermark. So the ringbuffer still has small amount of space
available for the current packet. This will reduce the overhead of
retries on sending.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/ring_buffer.c        |   31 -----------------------------
 drivers/net/hyperv/netvsc.c     |   41 +++++++++++++++++++++++++++++++++++---
 drivers/net/hyperv/netvsc_drv.c |    6 ++++-
 include/linux/hyperv.h          |   27 +++++++++++++++++++++++++
 4 files changed, 69 insertions(+), 36 deletions(-)

diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 8af25a0..7233c88 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -30,37 +30,6 @@
 #include "hyperv_vmbus.h"
 
 
-/* #defines */
-
-
-/* Amount of space to write to */
-#define BYTES_AVAIL_TO_WRITE(r, w, z) \
-	((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w))
-
-
-/*
- *
- * hv_get_ringbuffer_availbytes()
- *
- * Get number of bytes available to read and to write to
- * for the specified ring buffer
- */
-static inline void
-hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
-			  u32 *read, u32 *write)
-{
-	u32 read_loc, write_loc;
-
-	smp_read_barrier_depends();
-
-	/* Capture the read/write indices before they changed */
-	read_loc = rbi->ring_buffer->read_index;
-	write_loc = rbi->ring_buffer->write_index;
-
-	*write = BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->ring_datasize);
-	*read = rbi->ring_datasize - *write;
-}
-
 /*
  * hv_get_next_write_location()
  *
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index d025c83..8b91947 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -428,6 +428,24 @@ int netvsc_device_remove(struct hv_device *device)
 	return 0;
 }
 
+
+#define RING_AVAIL_PERCENT_HIWATER 20
+#define RING_AVAIL_PERCENT_LOWATER 10
+
+/*
+ * Get the percentage of available bytes to write in the ring.
+ * The return value is in range from 0 to 100.
+ */
+static inline u32 hv_ringbuf_avail_percent(
+		struct hv_ring_buffer_info *ring_info)
+{
+	u32 avail_read, avail_write;
+
+	hv_get_ringbuffer_availbytes(ring_info, &avail_read, &avail_write);
+
+	return avail_write * 100 / ring_info->ring_datasize;
+}
+
 static void netvsc_send_completion(struct hv_device *device,
 				   struct vmpacket_descriptor *packet)
 {
@@ -455,6 +473,8 @@ static void netvsc_send_completion(struct hv_device *device,
 		complete(&net_device->channel_init_wait);
 	} else if (nvsp_packet->hdr.msg_type ==
 		   NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE) {
+		int num_outstanding_sends;
+
 		/* Get the send context */
 		nvsc_packet = (struct hv_netvsc_packet *)(unsigned long)
 			packet->trans_id;
@@ -463,10 +483,14 @@ static void netvsc_send_completion(struct hv_device *device,
 		nvsc_packet->completion.send.send_completion(
 			nvsc_packet->completion.send.send_completion_ctx);
 
-		atomic_dec(&net_device->num_outstanding_sends);
+		num_outstanding_sends =
+			atomic_dec_return(&net_device->num_outstanding_sends);
 
-		if (netif_queue_stopped(ndev) && !net_device->start_remove)
-			netif_wake_queue(ndev);
+		if (netif_queue_stopped(ndev) && !net_device->start_remove &&
+			(hv_ringbuf_avail_percent(&device->channel->outbound)
+			> RING_AVAIL_PERCENT_HIWATER ||
+			num_outstanding_sends < 1))
+				netif_wake_queue(ndev);
 	} else {
 		netdev_err(ndev, "Unknown send completion packet type- "
 			   "%d received!!\n", nvsp_packet->hdr.msg_type);
@@ -519,10 +543,19 @@ int netvsc_send(struct hv_device *device,
 
 	if (ret == 0) {
 		atomic_inc(&net_device->num_outstanding_sends);
+		if (hv_ringbuf_avail_percent(&device->channel->outbound) <
+			RING_AVAIL_PERCENT_LOWATER) {
+			netif_stop_queue(ndev);
+			if (atomic_read(&net_device->
+				num_outstanding_sends) < 1)
+				netif_wake_queue(ndev);
+		}
 	} else if (ret == -EAGAIN) {
 		netif_stop_queue(ndev);
-		if (atomic_read(&net_device->num_outstanding_sends) < 1)
+		if (atomic_read(&net_device->num_outstanding_sends) < 1) {
 			netif_wake_queue(ndev);
+			ret = -ENOSPC;
+		}
 	} else {
 		netdev_err(ndev, "Unable to send packet %p ret %d\n",
 			   packet, ret);
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index dd29478..a0cc127 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -224,9 +224,13 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
 		net->stats.tx_packets++;
 	} else {
 		kfree(packet);
+		if (ret != -EAGAIN) {
+			dev_kfree_skb_any(skb);
+			net->stats.tx_dropped++;
+		}
 	}
 
-	return ret ? NETDEV_TX_BUSY : NETDEV_TX_OK;
+	return (ret == -EAGAIN) ? NETDEV_TX_BUSY : NETDEV_TX_OK;
 }
 
 /*
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 5852545..6af8738 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -274,6 +274,33 @@ struct hv_ring_buffer_debug_info {
 	u32 bytes_avail_towrite;
 };
 
+
+/*
+ *
+ * hv_get_ringbuffer_availbytes()
+ *
+ * Get number of bytes available to read and to write to
+ * for the specified ring buffer
+ */
+static inline void
+hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
+			  u32 *read, u32 *write)
+{
+	u32 read_loc, write_loc, dsize;
+
+	smp_read_barrier_depends();
+
+	/* Capture the read/write indices before they changed */
+	read_loc = rbi->ring_buffer->read_index;
+	write_loc = rbi->ring_buffer->write_index;
+	dsize = rbi->ring_datasize;
+
+	*write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
+		read_loc - write_loc;
+	*read = dsize - *write;
+}
+
+
 /*
  * We use the same version numbering for all Hyper-V modules.
  *
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH v3, 0/1] net/hyperv: Add flow control based on hi/low watermark
From: Haiyang Zhang @ 2012-03-27 23:20 UTC (permalink / raw)
  To: davem, netdev; +Cc: devel, haiyangz, olaf, linux-kernel

This patch is targeting 'net-next' tree (when re-opened).


Haiyang Zhang (1):
  net/hyperv: Add flow control based on hi/low watermark

 drivers/hv/ring_buffer.c        |   31 -----------------------------
 drivers/net/hyperv/netvsc.c     |   41 +++++++++++++++++++++++++++++++++++---
 drivers/net/hyperv/netvsc_drv.c |    6 ++++-
 include/linux/hyperv.h          |   27 +++++++++++++++++++++++++
 4 files changed, 69 insertions(+), 36 deletions(-)

-- 
1.7.4.1

^ permalink raw reply

* Re: bnx2x - bnx2x_credit_pool_get_entry bug?
From: Maciej Żenczykowski @ 2012-03-27 22:55 UTC (permalink / raw)
  To: Dmitry Kravkov; +Cc: Linux NetDev
In-Reply-To: <1332831515.21698.2.camel@lb-tlvb-dmitry>

On Mon, Mar 26, 2012 at 11:58 PM, Dmitry Kravkov <dmitry@broadcom.com> wrote:
> On Mon, 2012-03-26 at 22:14 -0700, Maciej Żenczykowski wrote:
>
>> looks to me like idx = vec * BNX2X_POOL_VEC_SIZE should actually be
>> idx = vec * BIT_VEC64_ELEM_SZ
>>
>
> This is correct! Thank you, Maciej. The patch is coming ...

Thanks.

-- 
Maciej A. Żenczykowski
Kernel Networking Developer @ Google
1600 Amphitheatre Parkway, Mountain View, CA 94043
tel: +1 (650) 253-0062

^ permalink raw reply

* Re: [PATCH net-next 5/5] r8169: support RTL8411
From: Francois Romieu @ 2012-03-27 22:54 UTC (permalink / raw)
  To: Hayes Wang; +Cc: netdev, linux-kernel
In-Reply-To: <1332834834-5185-5-git-send-email-hayeswang@realtek.com>

Hayes Wang <hayeswang@realtek.com> :
[...]
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 6c2835f..99daad7 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
[...]
> @@ -250,6 +252,9 @@ static const struct {
>  							JUMBO_9K, false),
>  	[RTL_GIGA_MAC_VER_37] =
>  		_R("RTL8402",		RTL_TD_1, FIRMWARE_8402_1,
> +							JUMBO_1K, true),
> +	[RTL_GIGA_MAC_VER_38] =
> +		_R("RTL8411",		RTL_TD_1, FIRMWARE_8411_1,
>  							JUMBO_1K, true)

Realtek's product page documents this chipset as a gigabit one. It seems
strange to configure it as a jumbo packet unable one.

The patch seems otherwise fine.

On a tangent topic:

"The RTL8411 supports Receive Side Scaling (RSS) to hash incoming TCP
connections and load-balance received data processing across multiple CPUs.
RSS improves the number of transactions per second and number of connections
per second, for increased network throughput. Header Data Split (HDS) support
enables faster processing of TCP/IP networking protocols for improved network
performance.

Virtual Machine Queue (VMQ) is a hardware virtualization technology for the
efficient transfer of network traffic to a virtualized host OS. VMQ uses
hardware packets filtering to deliver packet data from an external virtual
machine network directly to virtual machines, which reduces the overhead of
routing packets and copying them from the management operating system to the
virtual machine.

Note: RTL8411 Virtual Machine Queue (VMQ) is only functional in computers
running Windows Server 2008 R2 with the Hyper-V server role installed."

Will Realtek consider helping make those being available on Linux ?

-- 
Ueimor

^ permalink raw reply

* Re: [PATCH net-next 2/5] r8169: add csi_opt
From: Francois Romieu @ 2012-03-27 22:54 UTC (permalink / raw)
  To: Hayes Wang; +Cc: netdev, linux-kernel
In-Reply-To: <1332834834-5185-2-git-send-email-hayeswang@realtek.com>

Hayes Wang <hayeswang@realtek.com> :
> Modify the CSI relative functions by using csi_opt method.

I'll queue the series until Davem opens net-next.

We are supposed to be in a "merge previously queued patches and fix problems"
phase yet.

> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 3edb996..35b1fea 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
[...]
> -static void rtl_csi_access_enable_2(void __iomem *ioaddr)
> +static void __devinit rtl_init_csi_ops(struct rtl8169_private *tp)
>  {
> -	rtl_csi_access_enable(ioaddr, 0x27000000);
> +	struct csi_ops *ops = &tp->csi_ops;
> +
> +	switch (tp->mac_version) {
> +	default:
> +		ops->write	= r8169_csi_write;
> +		ops->read	= r8169_csi_read;
> +		break;
> +	}
>  }
>  
>  struct ephy_info {
[...]
> @@ -6199,6 +6267,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	rtl_init_mdio_ops(tp);
>  	rtl_init_pll_power_ops(tp);
>  	rtl_init_jumbo_ops(tp);
> +	rtl_init_csi_ops(tp);
>  
>  	rtl8169_print_mac_version(tp);

It will enable the CSI read/write functions where they previously weren't.

Is it really supposed to behave this way ?

Thanks.

-- 
Ueimor

^ permalink raw reply

* Re: [PATCH net-next 1/5] r8169: modify pll power function
From: Francois Romieu @ 2012-03-27 22:54 UTC (permalink / raw)
  To: Hayes Wang; +Cc: netdev, linux-kernel
In-Reply-To: <1332834834-5185-1-git-send-email-hayeswang@realtek.com>

Hayes Wang <hayeswang@realtek.com> :
> Adjust r810x_pll_power_down, r810x_pll_power_up, and r8168_pll_power_up.
> Always power up device during rtl_open.
> For r810x, turn off more power when the WOL is disabled.

Would the "Always power up" part qualify as a "fix something" change ?

-- 
Ueimor

^ permalink raw reply

* Re: [GIT] Networking
From: David Miller @ 2012-03-27 22:51 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel
In-Reply-To: <20120325.175151.853542033329072696.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Sun, 25 Mar 2012 17:51:51 -0400 (EDT)

> 1) Name string overrun fix in gianfar driver from Joe Perches.
 ...
> 
> Please pull, thanks a lot!

I don't know if you've pulled this or not, but I just wanted to let
you know that I just added the following critical fix to my tree
which I'd like to propagate to -stable ASAP.

So if you have pulled, if you would repull to get this guy, I'd
really appreciate it.

Thanks a lot!

The following changes since commit 50269e19ad990e79eeda101fc6df80cffd5d4831:

  net: add a truesize parameter to skb_add_rx_frag() (2012-03-25 13:29:58 -0400)

are available in the git repository at:
  gitolite@ra.kernel.org:/pub/scm/linux/kernel/git/davem/net.git master

Eric Dumazet (1):
      net: fix a potential rcu_read_lock() imbalance in rt6_fill_node()

 net/ipv6/route.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

^ permalink raw reply

* Re: pull request: wireless 2012-03-27
From: David Miller @ 2012-03-27 22:28 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20120327183242.GB20938@tuxdriver.com>

From: "John W. Linville" <linville@tuxdriver.com>
Date: Tue, 27 Mar 2012 14:32:42 -0400

> First, we have a MAINTAINERS update -- not truly a "fix", but it might
> help to keep unwanted traffic out of Bob's inbox.  We also have a
> removal of an outdated comment that was overlooked when the related
> code was removed.

MAINTAINERS updates can always go in, so no problems with this.

> Beyond those, we have a fix for a memory leak in ath9k, a cfg80211
> fix to prevent passing bad info over nl80211 to userspace, a tuning
> fix for some rtlwifi family drivers, a couple of minor ath9k tuning
> fixes, a mac80211 use-after-free fix, a couple of rt2x00 thinko fixes,
> an iwlegacy fix to properly set BSSID after an association, and an
> iwlegacy fix to avoid an oops by properly reinitializing a variable
> after reset.

Ok.

I'll pull this in as soon as Linus processes my most recent networking
pull request.

Thanks!

^ permalink raw reply

* RE: [PATCH 1/1] net/hyperv: Add flow control based on hi/low watermark
From: Haiyang Zhang @ 2012-03-27 22:25 UTC (permalink / raw)
  To: Greg KH
  Cc: davem@davemloft.net, netdev@vger.kernel.org,
	devel@linuxdriverproject.org, olaf@aepfle.de,
	linux-kernel@vger.kernel.org
In-Reply-To: <20120327222045.GA469@kroah.com>



> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Tuesday, March 27, 2012 6:21 PM
> To: Haiyang Zhang
> Cc: davem@davemloft.net; netdev@vger.kernel.org;
> devel@linuxdriverproject.org; olaf@aepfle.de; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/1] net/hyperv: Add flow control based on hi/low
> watermark
> 
> On Tue, Mar 27, 2012 at 03:23:07PM -0700, Haiyang Zhang wrote:
> > --- a/include/linux/hyperv.h
> > +++ b/include/linux/hyperv.h
> > @@ -274,6 +274,35 @@ struct hv_ring_buffer_debug_info {
> >  	u32 bytes_avail_towrite;
> >  };
> >
> > +/* Amount of space to write to */
> > +#define BYTES_AVAIL_TO_WRITE(r, w, z) \
> > +	(((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w)))
> > +
> 
> That's a very bad #define to use in a .h file, please do not do that.
> 
> > +
> > +/*
> > + *
> > + * hv_get_ringbuffer_availbytes()
> > + *
> > + * Get number of bytes available to read and to write to
> > + * for the specified ring buffer
> > + */
> > +extern inline void
> > +hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
> > +			  u32 *read, u32 *write)
> 
> What does "extern inline" mean?
> 
> Please fix.

Will do.

Thanks,
- Haiyang

^ permalink raw reply

* [PATCH 0/1] net/hyperv: Add flow control based on hi/low watermark
From: Haiyang Zhang @ 2012-03-27 22:23 UTC (permalink / raw)
  To: davem, netdev; +Cc: haiyangz, kys, olaf, linux-kernel, devel

This patch is targeting 'net-next' tree (when re-opened).


Haiyang Zhang (1):
  net/hyperv: Add flow control based on hi/low watermark

 drivers/hv/ring_buffer.c        |   31 -----------------------------
 drivers/net/hyperv/netvsc.c     |   41 +++++++++++++++++++++++++++++++++++---
 drivers/net/hyperv/netvsc_drv.c |    6 ++++-
 include/linux/hyperv.h          |   29 +++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 36 deletions(-)

-- 
1.7.4.1

^ permalink raw reply

* Re: [PATCH] net: fix a potential rcu_read_lock() imbalance in rt6_fill_node()
From: David Miller @ 2012-03-27 22:22 UTC (permalink / raw)
  To: eric.dumazet; +Cc: greearb, netdev, gregkh, paulmck, davej
In-Reply-To: <1332878032.3547.39.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 27 Mar 2012 21:53:52 +0200

> Commit f2c31e32b378 (net: fix NULL dereferences in check_peer_redir() )
> added a regression in rt6_fill_node(), leading to rcu_read_lock()
> imbalance.
> 
> Thats because NLA_PUT() can make a jump to nla_put_failure label.
> 
> Fix this by using nla_put()
> 
> Many thanks to Ben Greear for his help
> 
> Reported-by: Ben Greear <greearb@candelatech.com>
> Reported-by: Dave Jones <davej@redhat.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Great work everyone.

I'll apply this and queue it up for stable soon.

In other news, I think the days of hidden gotos from the NLA macros
should be over.  I'll work in net-next to redo this so that the
gotos must be explicitly coded and therefore be visible when people
audit these routines.

Thanks!

^ permalink raw reply

* Re: [PATCH 1/1] net/hyperv: Add flow control based on hi/low watermark
From: Greg KH @ 2012-03-27 22:20 UTC (permalink / raw)
  To: Haiyang Zhang; +Cc: davem, netdev, devel, olaf, linux-kernel
In-Reply-To: <1332886987-11613-2-git-send-email-haiyangz@microsoft.com>

On Tue, Mar 27, 2012 at 03:23:07PM -0700, Haiyang Zhang wrote:
> --- a/include/linux/hyperv.h
> +++ b/include/linux/hyperv.h
> @@ -274,6 +274,35 @@ struct hv_ring_buffer_debug_info {
>  	u32 bytes_avail_towrite;
>  };
>  
> +/* Amount of space to write to */
> +#define BYTES_AVAIL_TO_WRITE(r, w, z) \
> +	(((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w)))
> +

That's a very bad #define to use in a .h file, please do not do that.

> +
> +/*
> + *
> + * hv_get_ringbuffer_availbytes()
> + *
> + * Get number of bytes available to read and to write to
> + * for the specified ring buffer
> + */
> +extern inline void
> +hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
> +			  u32 *read, u32 *write)

What does "extern inline" mean?

Please fix.

greg k-h

^ permalink raw reply

* [PATCH 1/1] net/hyperv: Add flow control based on hi/low watermark
From: Haiyang Zhang @ 2012-03-27 22:23 UTC (permalink / raw)
  To: davem, netdev; +Cc: haiyangz, kys, olaf, linux-kernel, devel
In-Reply-To: <1332886987-11613-1-git-send-email-haiyangz@microsoft.com>

In the existing code, we only stop queue when the ringbuffer is full,
so the current packet has to be dropped or retried from upper layer.

This patch stops the tx queue when available ringbuffer is below
the low watermark. So the ringbuffer still has small amount of space
available for the current packet. This will reduce the overhead of
retries on sending.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/ring_buffer.c        |   31 -----------------------------
 drivers/net/hyperv/netvsc.c     |   41 +++++++++++++++++++++++++++++++++++---
 drivers/net/hyperv/netvsc_drv.c |    6 ++++-
 include/linux/hyperv.h          |   29 +++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 36 deletions(-)

diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 8af25a0..7233c88 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -30,37 +30,6 @@
 #include "hyperv_vmbus.h"
 
 
-/* #defines */
-
-
-/* Amount of space to write to */
-#define BYTES_AVAIL_TO_WRITE(r, w, z) \
-	((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w))
-
-
-/*
- *
- * hv_get_ringbuffer_availbytes()
- *
- * Get number of bytes available to read and to write to
- * for the specified ring buffer
- */
-static inline void
-hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
-			  u32 *read, u32 *write)
-{
-	u32 read_loc, write_loc;
-
-	smp_read_barrier_depends();
-
-	/* Capture the read/write indices before they changed */
-	read_loc = rbi->ring_buffer->read_index;
-	write_loc = rbi->ring_buffer->write_index;
-
-	*write = BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->ring_datasize);
-	*read = rbi->ring_datasize - *write;
-}
-
 /*
  * hv_get_next_write_location()
  *
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index d025c83..8b91947 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -428,6 +428,24 @@ int netvsc_device_remove(struct hv_device *device)
 	return 0;
 }
 
+
+#define RING_AVAIL_PERCENT_HIWATER 20
+#define RING_AVAIL_PERCENT_LOWATER 10
+
+/*
+ * Get the percentage of available bytes to write in the ring.
+ * The return value is in range from 0 to 100.
+ */
+static inline u32 hv_ringbuf_avail_percent(
+		struct hv_ring_buffer_info *ring_info)
+{
+	u32 avail_read, avail_write;
+
+	hv_get_ringbuffer_availbytes(ring_info, &avail_read, &avail_write);
+
+	return avail_write * 100 / ring_info->ring_datasize;
+}
+
 static void netvsc_send_completion(struct hv_device *device,
 				   struct vmpacket_descriptor *packet)
 {
@@ -455,6 +473,8 @@ static void netvsc_send_completion(struct hv_device *device,
 		complete(&net_device->channel_init_wait);
 	} else if (nvsp_packet->hdr.msg_type ==
 		   NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE) {
+		int num_outstanding_sends;
+
 		/* Get the send context */
 		nvsc_packet = (struct hv_netvsc_packet *)(unsigned long)
 			packet->trans_id;
@@ -463,10 +483,14 @@ static void netvsc_send_completion(struct hv_device *device,
 		nvsc_packet->completion.send.send_completion(
 			nvsc_packet->completion.send.send_completion_ctx);
 
-		atomic_dec(&net_device->num_outstanding_sends);
+		num_outstanding_sends =
+			atomic_dec_return(&net_device->num_outstanding_sends);
 
-		if (netif_queue_stopped(ndev) && !net_device->start_remove)
-			netif_wake_queue(ndev);
+		if (netif_queue_stopped(ndev) && !net_device->start_remove &&
+			(hv_ringbuf_avail_percent(&device->channel->outbound)
+			> RING_AVAIL_PERCENT_HIWATER ||
+			num_outstanding_sends < 1))
+				netif_wake_queue(ndev);
 	} else {
 		netdev_err(ndev, "Unknown send completion packet type- "
 			   "%d received!!\n", nvsp_packet->hdr.msg_type);
@@ -519,10 +543,19 @@ int netvsc_send(struct hv_device *device,
 
 	if (ret == 0) {
 		atomic_inc(&net_device->num_outstanding_sends);
+		if (hv_ringbuf_avail_percent(&device->channel->outbound) <
+			RING_AVAIL_PERCENT_LOWATER) {
+			netif_stop_queue(ndev);
+			if (atomic_read(&net_device->
+				num_outstanding_sends) < 1)
+				netif_wake_queue(ndev);
+		}
 	} else if (ret == -EAGAIN) {
 		netif_stop_queue(ndev);
-		if (atomic_read(&net_device->num_outstanding_sends) < 1)
+		if (atomic_read(&net_device->num_outstanding_sends) < 1) {
 			netif_wake_queue(ndev);
+			ret = -ENOSPC;
+		}
 	} else {
 		netdev_err(ndev, "Unable to send packet %p ret %d\n",
 			   packet, ret);
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index dd29478..a0cc127 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -224,9 +224,13 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
 		net->stats.tx_packets++;
 	} else {
 		kfree(packet);
+		if (ret != -EAGAIN) {
+			dev_kfree_skb_any(skb);
+			net->stats.tx_dropped++;
+		}
 	}
 
-	return ret ? NETDEV_TX_BUSY : NETDEV_TX_OK;
+	return (ret == -EAGAIN) ? NETDEV_TX_BUSY : NETDEV_TX_OK;
 }
 
 /*
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 5852545..2c366f0 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -274,6 +274,35 @@ struct hv_ring_buffer_debug_info {
 	u32 bytes_avail_towrite;
 };
 
+/* Amount of space to write to */
+#define BYTES_AVAIL_TO_WRITE(r, w, z) \
+	(((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w)))
+
+
+/*
+ *
+ * hv_get_ringbuffer_availbytes()
+ *
+ * Get number of bytes available to read and to write to
+ * for the specified ring buffer
+ */
+extern inline void
+hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
+			  u32 *read, u32 *write)
+{
+	u32 read_loc, write_loc;
+
+	smp_read_barrier_depends();
+
+	/* Capture the read/write indices before they changed */
+	read_loc = rbi->ring_buffer->read_index;
+	write_loc = rbi->ring_buffer->write_index;
+
+	*write = BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->ring_datasize);
+	*read = rbi->ring_datasize - *write;
+}
+
+
 /*
  * We use the same version numbering for all Hyper-V modules.
  *
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH net V4 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
From: chetan loke @ 2012-03-27 21:55 UTC (permalink / raw)
  To: Keller, Jacob E
  Cc: Richard Cochran, netdev@vger.kernel.org,
	e1000-devel@lists.sourceforge.net, Kirsher, Jeffrey T,
	Ronciak, John, john.stultz@linaro.org, tglx@linutronix.de
In-Reply-To: <02874ECE860811409154E81DA85FBB580DC769@ORSMSX105.amr.corp.intel.com>

On Tue, Mar 27, 2012 at 4:58 PM, Keller, Jacob E
<jacob.e.keller@intel.com> wrote:

>
> I think we could see contention regardless because the spinlock doesn't guarantee the ordering of who gets it next.
>
> I am not sure. But I will try and set something like this up. However, I do think that many get-set calls is pretty high for even a 'highly' loaded system. Though the buggy app for sure is possible.
>
> Here is what I am thinking as a test case. Linuxptp running normally with a higher sync rate than once per second, plus a 'buggy' app which will try to infinitely thread the gettime calls. I hope to have something like this working soon.
>

Agreed, we don't know who would grab the lock next. But with just one
app/process we may not be able to induce the contention because
process scheduling would come into play. A single process would only
get that much time slice. With multiple processes, you will be able to
schedule them on multiple CPUs and hence contend with the driver's
completion path because that is what a real-exploit would do.

make sure numactl is installed on your system. Within a shell script,
launch multiple instances of the process as follows:

#!/bin/bash

num_cpus=`cat /proc/cpuinfo |grep -i processor |wc -l`

for ((i=0; i<$num_cpus; i++))
do
  echo "Launching instance:$(($i+1))"
  numa_cmd="numactl --physcpubind=$i /path/to/buggy-app &"
  echo "executing numa-cmd:$numa_cmd"
  eval $numa_cmd
done


> - Jake

Chetan

^ permalink raw reply

* Re: [PATCH net/core] dev_forward_skb() should clear skb_iif
From: David Miller @ 2012-03-27 21:37 UTC (permalink / raw)
  To: bcrl; +Cc: netdev
In-Reply-To: <20120327162920.GB2367@kvack.org>

From: Benjamin LaHaise <bcrl@kvack.org>
Date: Tue, 27 Mar 2012 12:29:20 -0400

> While investigating another bug, I found that the code on the incoming path
> in __netif_receive_skb will only set skb->skb_iif if it is already 0.  When
> dev_forward_skb() is used in the case of interfaces like veth, skb_iif may
> already have been set.  Making dev_forward_skb() cause the packet to look
> more like a newly received packet would seem to the the correct behaviour
> here, as otherwise the wrong incoming interface can be reported for such a
> packet.

Same problems as your ipv4 multicast patch, I'm not applying this.

You must learn how to properly submit your changes, otherwise I
guarentee all of your work will hit the bit bucket.

^ permalink raw reply

* Re: [PATCH ipv4 multicast] Fix IPv4 multicast over network namespaces
From: David Miller @ 2012-03-27 21:35 UTC (permalink / raw)
  To: bcrl; +Cc: netdev
In-Reply-To: <20120327161228.GA2367@kvack.org>

From: Benjamin LaHaise <bcrl@kvack.org>
Date: Tue, 27 Mar 2012 12:12:28 -0400

> When using multicast over a local bridge feeding a number of LXC guests
> using veth, the LXC guests are unable to get a response from other guests
> when pinging 224.0.0.1.  Multicast packets did not appear to be getting
> delivered to the network namespaces of the guest hosts, and further
> inspection showed that the incoming route was pointing to the loopback
> device of the host, not the guest.  This lead to the wrong network namespace
> being picked up by sockets (like ICMP).  Fix this by using the correct
> network namespace when creating the inbound route entry.

No signoff.

No proper subsystem prefix in Subject line (should be "ipv4: " here)

And third you've been warned about this repeatedly in your previous
patch postings.

Therefore I'm not applying this.

^ permalink raw reply

* Re: [PATCH] net/ethernet: ks8851_mll fix rx frame buffer overflow
From: David Miller @ 2012-03-27 21:31 UTC (permalink / raw)
  To: eric.dumazet
  Cc: ciminaghi, adobriyan, thomas, mcuos.com, lucas.demarchi, netdev,
	raffaele.recalcati
In-Reply-To: <1332859171.10620.0.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 27 Mar 2012 07:39:31 -0700

> Le mardi 27 mars 2012 à 15:01 +0200, Davide Ciminaghi a écrit :
>> @@ -40,7 +40,7 @@
>>  #define	DRV_NAME	"ks8851_mll"
>>  
>>  static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 };
>> -#define MAX_RECV_FRAMES			32
>> +#define MAX_RECV_FRAMES			256
>>  #define MAX_BUF_SIZE			2048
>>  #define TX_BUF_SIZE			2000
>>  #define RX_BUF_SIZE			2000
> 
> How can this fix the problem for good ?

Indeed.

^ permalink raw reply

* [PATCH] tcp: bind() use stronger condition for bind_conflict
From: Alexandru Copot @ 2012-03-27 21:11 UTC (permalink / raw)
  To: davem, eric.dumazet
  Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel,
	Alexandru Copot, Daniel Baluta

We must try harder to get unique (addr, port) pairs when
doing port autoselection for sockets with SO_REUSEADDR
option set.

We achieve this by adding a relaxation parameter to
inet_csk_bind_conflict. When 'relax' parameter is off
we return a conflict whenever the current searched
pair (addr, port) is not unique.

This tries to address the problems reported in patch:
	8d238b25b1ec22a73b1c2206f111df2faaff8285
	Revert "tcp: bind() fix when many ports are bound"

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Signed-off-by: Daniel Baluta <dbaluta@ixiacom.com>
---
 include/net/inet6_connection_sock.h |    2 +-
 include/net/inet_connection_sock.h  |    4 ++--
 net/ipv4/inet_connection_sock.c     |   17 +++++++++++++----
 net/ipv6/inet6_connection_sock.c    |    3 ++-
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index 3207e58..9d29ae2 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -23,7 +23,7 @@ struct sock;
 struct sockaddr;
 
 extern int inet6_csk_bind_conflict(const struct sock *sk,
-				   const struct inet_bind_bucket *tb);
+				   const struct inet_bind_bucket *tb, int relax);
 
 extern struct dst_entry* inet6_csk_route_req(struct sock *sk,
 					     const struct request_sock *req);
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index dbf9aab..f05a032 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -60,7 +60,7 @@ struct inet_connection_sock_af_ops {
 #endif
 	void	    (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
 	int	    (*bind_conflict)(const struct sock *sk,
-				     const struct inet_bind_bucket *tb);
+				     const struct inet_bind_bucket *tb, int relax);
 };
 
 /** inet_connection_sock - INET connection oriented sock
@@ -245,7 +245,7 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk,
 						const __be32 raddr,
 						const __be32 laddr);
 extern int inet_csk_bind_conflict(const struct sock *sk,
-				  const struct inet_bind_bucket *tb);
+				  const struct inet_bind_bucket *tb, int relax);
 extern int inet_csk_get_port(struct sock *sk, unsigned short snum);
 
 extern struct dst_entry* inet_csk_route_req(struct sock *sk,
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 19d66ce..bf50e77 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -53,7 +53,7 @@ void inet_get_local_port_range(int *low, int *high)
 EXPORT_SYMBOL(inet_get_local_port_range);
 
 int inet_csk_bind_conflict(const struct sock *sk,
-			   const struct inet_bind_bucket *tb)
+			   const struct inet_bind_bucket *tb, int relax)
 {
 	struct sock *sk2;
 	struct hlist_node *node;
@@ -79,6 +79,13 @@ int inet_csk_bind_conflict(const struct sock *sk,
 				    sk2_rcv_saddr == sk_rcv_saddr(sk))
 					break;
 			}
+			if (!relax && reuse && sk2->sk_reuse &&
+					sk2->sk_state != TCP_LISTEN) {
+				const __be32 sk2_rcv_saddr = sk_rcv_saddr(sk2);
+				if (!sk2_rcv_saddr || !sk_rcv_saddr(sk) ||
+						sk2_rcv_saddr == sk_rcv_saddr(sk))
+					break;
+			}
 		}
 	}
 	return node != NULL;
@@ -122,12 +129,13 @@ again:
 					    (tb->num_owners < smallest_size || smallest_size == -1)) {
 						smallest_size = tb->num_owners;
 						smallest_rover = rover;
-						if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
+						if (atomic_read(&hashinfo->bsockets) > (high - low) + 1 &&
+							!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb, 0)) {
 							snum = smallest_rover;
 							goto tb_found;
 						}
 					}
-					if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
+					if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb, 0)) {
 						snum = rover;
 						goto tb_found;
 					}
@@ -178,12 +186,13 @@ tb_found:
 			goto success;
 		} else {
 			ret = 1;
-			if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
+			if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb, 1)) {
 				if (sk->sk_reuse && sk->sk_state != TCP_LISTEN &&
 				    smallest_size != -1 && --attempts >= 0) {
 					spin_unlock(&head->lock);
 					goto again;
 				}
+
 				goto fail_unlock;
 			}
 		}
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 02dd203..dfc8bc3 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -28,7 +28,8 @@
 #include <net/inet6_connection_sock.h>
 
 int inet6_csk_bind_conflict(const struct sock *sk,
-			    const struct inet_bind_bucket *tb)
+			    const struct inet_bind_bucket *tb,
+				int relax)
 {
 	const struct sock *sk2;
 	const struct hlist_node *node;
-- 
1.7.9.4

^ permalink raw reply related


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