* [RFC net-next 08/11] firewire net: Fix leakage of kmap for broadcast receive buffer.
From: YOSHIFUJI Hideaki @ 2013-03-08 1:43 UTC (permalink / raw)
To: stefanr, linux1394-devel; +Cc: netdev
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
drivers/firewire/net.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index d8cb6ac..0dc2fdf 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1228,6 +1228,8 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
failed_rcv_queue:
kfree(dev->broadcast_rcv_buffer_ptrs);
dev->broadcast_rcv_buffer_ptrs = NULL;
+ for (u = 0; u < FWNET_ISO_PAGE_COUNT; u++)
+ kunmap(dev->broadcast_rcv_buffer.pages[u]);
failed_ptrs_alloc:
fw_iso_buffer_destroy(&dev->broadcast_rcv_buffer, dev->card);
failed_buffer_init:
@@ -1620,10 +1622,15 @@ static int fwnet_remove(struct device *_dev)
fwnet_fifo_stop(dev);
if (dev->broadcast_rcv_context) {
+ unsigned u;
+
fw_iso_context_stop(dev->broadcast_rcv_context);
kfree(dev->broadcast_rcv_buffer_ptrs);
dev->broadcast_rcv_buffer_ptrs = NULL;
+ for (u = 0; u < FWNET_ISO_PAGE_COUNT; u++)
+ kunmap(dev->broadcast_rcv_buffer.pages[u]);
+
fw_iso_buffer_destroy(&dev->broadcast_rcv_buffer,
dev->card);
fw_iso_context_destroy(dev->broadcast_rcv_context);
--
1.7.9.5
^ permalink raw reply related
* [RFC net-next 07/11] firewire net: Omit checking dev->broadcast_rcv_context in fwnet_broadcast_start().
From: YOSHIFUJI Hideaki @ 2013-03-08 1:43 UTC (permalink / raw)
To: stefanr, linux1394-devel; +Cc: netdev
dev->broadcast_rcv_context is always non-NULL if dev->broadcast_state is
not FWNET_BROADCAST_ERROR.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
drivers/firewire/net.c | 57 ++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 31 deletions(-)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index efed4a6..d8cb6ac 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1154,6 +1154,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
unsigned max_receive;
struct fw_iso_packet packet;
unsigned long offset;
+ void **ptrptr;
unsigned u;
if (dev->broadcast_state != FWNET_BROADCAST_ERROR)
@@ -1162,42 +1163,36 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
max_receive = 1U << (dev->card->max_receive + 1);
num_packets = (FWNET_ISO_PAGE_COUNT * PAGE_SIZE) / max_receive;
- if (!dev->broadcast_rcv_context) {
- void **ptrptr;
-
- context = fw_iso_context_create(dev->card,
- FW_ISO_CONTEXT_RECEIVE, IEEE1394_BROADCAST_CHANNEL,
- dev->card->link_speed, 8, fwnet_receive_broadcast, dev);
- if (IS_ERR(context)) {
- retval = PTR_ERR(context);
- goto failed_context_create;
- }
+ context = fw_iso_context_create(dev->card, FW_ISO_CONTEXT_RECEIVE,
+ IEEE1394_BROADCAST_CHANNEL,
+ dev->card->link_speed, 8,
+ fwnet_receive_broadcast, dev);
+ if (IS_ERR(context)) {
+ retval = PTR_ERR(context);
+ goto failed_context_create;
+ }
- retval = fw_iso_buffer_init(&dev->broadcast_rcv_buffer,
- dev->card, FWNET_ISO_PAGE_COUNT, DMA_FROM_DEVICE);
- if (retval < 0)
- goto failed_buffer_init;
+ retval = fw_iso_buffer_init(&dev->broadcast_rcv_buffer, dev->card,
+ FWNET_ISO_PAGE_COUNT, DMA_FROM_DEVICE);
+ if (retval < 0)
+ goto failed_buffer_init;
- ptrptr = kmalloc(sizeof(void *) * num_packets, GFP_KERNEL);
- if (!ptrptr) {
- retval = -ENOMEM;
- goto failed_ptrs_alloc;
- }
+ ptrptr = kmalloc(sizeof(void *) * num_packets, GFP_KERNEL);
+ if (!ptrptr) {
+ retval = -ENOMEM;
+ goto failed_ptrs_alloc;
+ }
- dev->broadcast_rcv_buffer_ptrs = ptrptr;
- for (u = 0; u < FWNET_ISO_PAGE_COUNT; u++) {
- void *ptr;
- unsigned v;
+ dev->broadcast_rcv_buffer_ptrs = ptrptr;
+ for (u = 0; u < FWNET_ISO_PAGE_COUNT; u++) {
+ void *ptr;
+ unsigned v;
- ptr = kmap(dev->broadcast_rcv_buffer.pages[u]);
- for (v = 0; v < num_packets / FWNET_ISO_PAGE_COUNT; v++)
- *ptrptr++ = (void *)
- ((char *)ptr + v * max_receive);
- }
- dev->broadcast_rcv_context = context;
- } else {
- context = dev->broadcast_rcv_context;
+ ptr = kmap(dev->broadcast_rcv_buffer.pages[u]);
+ for (v = 0; v < num_packets / FWNET_ISO_PAGE_COUNT; v++)
+ *ptrptr++ = (void *) ((char *)ptr + v * max_receive);
}
+ dev->broadcast_rcv_context = context;
packet.payload_length = max_receive;
packet.interrupt = 1;
--
1.7.9.5
^ permalink raw reply related
* [RFC net-next 04/11] firewire net: Check dev->broadcast_state inside fwnet_broadcast_start().
From: YOSHIFUJI Hideaki @ 2013-03-08 1:43 UTC (permalink / raw)
To: stefanr, linux1394-devel; +Cc: netdev
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
drivers/firewire/net.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index fbd07eb..9a2634a 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1156,6 +1156,9 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
unsigned long offset;
unsigned u;
+ if (dev->broadcast_state != FWNET_BROADCAST_ERROR)
+ return 0;
+
max_receive = 1U << (dev->card->max_receive + 1);
num_packets = (FWNET_ISO_PAGE_COUNT * PAGE_SIZE) / max_receive;
@@ -1258,11 +1261,10 @@ static int fwnet_open(struct net_device *net)
if (ret)
return ret;
- if (dev->broadcast_state == FWNET_BROADCAST_ERROR) {
- ret = fwnet_broadcast_start(dev);
- if (ret)
- goto out;
- }
+ ret = fwnet_broadcast_start(dev);
+ if (ret)
+ goto out;
+
netif_start_queue(net);
spin_lock_irq(&dev->lock);
--
1.7.9.5
^ permalink raw reply related
* [RFC net-next 06/11] firewire net: Clear dev->broadcast_rcv_context and dev->broadcast_state after destruction of context.
From: YOSHIFUJI Hideaki @ 2013-03-08 1:42 UTC (permalink / raw)
To: stefanr, linux1394-devel; +Cc: netdev
Clear dev->broadcast_rcv_context to NULL and set dev->broadcast_state
to FWNET_BROADCAST_ERROR after descruction of broadcast context.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
drivers/firewire/net.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index d9b2105..efed4a6 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1626,11 +1626,14 @@ static int fwnet_remove(struct device *_dev)
fwnet_fifo_stop(dev);
if (dev->broadcast_rcv_context) {
fw_iso_context_stop(dev->broadcast_rcv_context);
+
kfree(dev->broadcast_rcv_buffer_ptrs);
dev->broadcast_rcv_buffer_ptrs = NULL;
fw_iso_buffer_destroy(&dev->broadcast_rcv_buffer,
dev->card);
fw_iso_context_destroy(dev->broadcast_rcv_context);
+ dev->broadcast_rcv_context = NULL;
+ dev->broadcast_state = FWNET_BROADCAST_ERROR;
}
for (i = 0; dev->queued_datagrams && i < 5; i++)
ssleep(1);
--
1.7.9.5
^ permalink raw reply related
* [RFC net-next 05/11] firewire net: Fix memory leakage in fwnet_remove().
From: YOSHIFUJI Hideaki @ 2013-03-08 1:42 UTC (permalink / raw)
To: stefanr, linux1394-devel; +Cc: netdev
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
drivers/firewire/net.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index 9a2634a..d9b2105 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1626,6 +1626,8 @@ static int fwnet_remove(struct device *_dev)
fwnet_fifo_stop(dev);
if (dev->broadcast_rcv_context) {
fw_iso_context_stop(dev->broadcast_rcv_context);
+ kfree(dev->broadcast_rcv_buffer_ptrs);
+ dev->broadcast_rcv_buffer_ptrs = NULL;
fw_iso_buffer_destroy(&dev->broadcast_rcv_buffer,
dev->card);
fw_iso_context_destroy(dev->broadcast_rcv_context);
--
1.7.9.5
^ permalink raw reply related
* [RFC net-next 03/11] firewire net: Setup broadcast and local fifo independently.
From: YOSHIFUJI Hideaki @ 2013-03-08 1:42 UTC (permalink / raw)
To: stefanr, linux1394-devel; +Cc: netdev
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
drivers/firewire/net.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index 96f6ee5..fbd07eb 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1156,10 +1156,6 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
unsigned long offset;
unsigned u;
- retval = fwnet_fifo_start(dev);
- if (retval < 0)
- goto failed_initial;
-
max_receive = 1U << (dev->card->max_receive + 1);
num_packets = (FWNET_ISO_PAGE_COUNT * PAGE_SIZE) / max_receive;
@@ -1240,8 +1236,6 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
fw_iso_context_destroy(context);
dev->broadcast_rcv_context = NULL;
failed_context_create:
- fwnet_fifo_stop(dev);
- failed_initial:
return retval;
}
@@ -1260,10 +1254,14 @@ static int fwnet_open(struct net_device *net)
struct fwnet_device *dev = netdev_priv(net);
int ret;
+ ret = fwnet_fifo_start(dev);
+ if (ret)
+ return ret;
+
if (dev->broadcast_state == FWNET_BROADCAST_ERROR) {
ret = fwnet_broadcast_start(dev);
if (ret)
- return ret;
+ goto out;
}
netif_start_queue(net);
@@ -1272,6 +1270,9 @@ static int fwnet_open(struct net_device *net)
spin_unlock_irq(&dev->lock);
return 0;
+out:
+ fwnet_fifo_stop(dev);
+ return ret;
}
/* ifdown */
--
1.7.9.5
^ permalink raw reply related
* [RFC net-next 02/11] firewire net: Introduce fwnet_fifo_{start,stop}() helpers.
From: YOSHIFUJI Hideaki @ 2013-03-08 1:42 UTC (permalink / raw)
To: stefanr, linux1394-devel; +Cc: netdev
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
drivers/firewire/net.c | 51 +++++++++++++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 16 deletions(-)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index a7a0e82..96f6ee5 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1116,6 +1116,36 @@ static int fwnet_send_packet(struct fwnet_packet_task *ptask)
return 0;
}
+static void fwnet_fifo_stop(struct fwnet_device *dev)
+{
+ if (dev->local_fifo == FWNET_NO_FIFO_ADDR)
+ return;
+
+ fw_core_remove_address_handler(&dev->handler);
+ dev->local_fifo = FWNET_NO_FIFO_ADDR;
+}
+
+static int fwnet_fifo_start(struct fwnet_device *dev)
+{
+ int retval;
+
+ if (dev->local_fifo != FWNET_NO_FIFO_ADDR)
+ return 0;
+
+ dev->handler.length = 4096;
+ dev->handler.address_callback = fwnet_receive_packet;
+ dev->handler.callback_data = dev;
+
+ retval = fw_core_add_address_handler(&dev->handler,
+ &fw_high_memory_region);
+ if (retval < 0)
+ return retval;
+
+ dev->local_fifo = dev->handler.offset;
+
+ return 0;
+}
+
static int fwnet_broadcast_start(struct fwnet_device *dev)
{
struct fw_iso_context *context;
@@ -1126,18 +1156,9 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
unsigned long offset;
unsigned u;
- if (dev->local_fifo == FWNET_NO_FIFO_ADDR) {
- dev->handler.length = 4096;
- dev->handler.address_callback = fwnet_receive_packet;
- dev->handler.callback_data = dev;
-
- retval = fw_core_add_address_handler(&dev->handler,
- &fw_high_memory_region);
- if (retval < 0)
- goto failed_initial;
-
- dev->local_fifo = dev->handler.offset;
- }
+ retval = fwnet_fifo_start(dev);
+ if (retval < 0)
+ goto failed_initial;
max_receive = 1U << (dev->card->max_receive + 1);
num_packets = (FWNET_ISO_PAGE_COUNT * PAGE_SIZE) / max_receive;
@@ -1219,8 +1240,7 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
fw_iso_context_destroy(context);
dev->broadcast_rcv_context = NULL;
failed_context_create:
- fw_core_remove_address_handler(&dev->handler);
- dev->local_fifo = FWNET_NO_FIFO_ADDR;
+ fwnet_fifo_stop(dev);
failed_initial:
return retval;
@@ -1600,8 +1620,7 @@ static int fwnet_remove(struct device *_dev)
if (list_empty(&dev->peer_list)) {
unregister_netdev(net);
- if (dev->local_fifo != FWNET_NO_FIFO_ADDR)
- fw_core_remove_address_handler(&dev->handler);
+ fwnet_fifo_stop(dev);
if (dev->broadcast_rcv_context) {
fw_iso_context_stop(dev->broadcast_rcv_context);
fw_iso_buffer_destroy(&dev->broadcast_rcv_buffer,
--
1.7.9.5
^ permalink raw reply related
* [RFC net-next 01/11] firewire net: No need to reset dev->local_fifo after failure of fw_core_add_address_handler().
From: YOSHIFUJI Hideaki @ 2013-03-08 1:42 UTC (permalink / raw)
To: stefanr, linux1394-devel; +Cc: netdev
fwnet_broadcast_start() try to register address handler at first
if it was not registered yet; dev->local_fifo ==
FWNET_NO_FIFO_ADDR.
Since dev->local_info not changed if fw_core_add_address_hander()
has failed, we do not need to set dev->local_info to
FWNET_NO_FIFO_ADDR.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
drivers/firewire/net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index 2b27bff..a7a0e82 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1220,8 +1220,8 @@ static int fwnet_broadcast_start(struct fwnet_device *dev)
dev->broadcast_rcv_context = NULL;
failed_context_create:
fw_core_remove_address_handler(&dev->handler);
- failed_initial:
dev->local_fifo = FWNET_NO_FIFO_ADDR;
+ failed_initial:
return retval;
}
--
1.7.9.5
^ permalink raw reply related
* [RFC net-next 00/11] firewire net: resource management improvements
From: YOSHIFUJI Hideaki @ 2013-03-08 1:40 UTC (permalink / raw)
To: stefanr, linux1394-devel; +Cc: David Miller, netdev, YOSHIFUJI Hideaki
Hello.
This series of patches tries to improve resource management of IP over Firewire
device.
Because upcoming IPv6 over Firewire patch depends on this series, it would
be better to let this series of patches go through Dave's net-next tree, if
firewire people do not mind.
--yoshfuji
YOSHIFUJI Hideaki (11):
firewire net: No need to reset dev->local_fifo after failure of
fw_core_add_address_handler().
firewire net: Introduce fwnet_fifo_{start,stop}() helpers.
firewire net: Setup broadcast and local fifo independently.
firewire net: Check dev->broadcast_state inside
fwnet_broadcast_start().
firewire net: Fix memory leakage in fwnet_remove().
firewire net: Clear dev->broadcast_rcv_context and
dev->broadcast_state after destruction of context.
firewire net: Omit checking dev->broadcast_rcv_context in
fwnet_broadcast_start().
firewire net: Fix leakage of kmap for broadcast receive buffer.
firewire net: Allocate dev->broadcast_rcv_buffer_ptrs early.
firewire net: Introduce fwnet_broadcast_stop() to destroy broadcast
resources.
firewire net: Release broadcast/fifo resources on ifdown.
drivers/firewire/net.c | 177 ++++++++++++++++++++++++++++--------------------
1 file changed, 105 insertions(+), 72 deletions(-)
--
1.7.9.5
^ permalink raw reply
* Re: re L4 conntracking netns conversion
From: Eric W. Biederman @ 2013-03-08 1:32 UTC (permalink / raw)
To: Gao feng; +Cc: Alexey Dobriyan, Pablo Neira Ayuso, netdev, netfilter-devel
In-Reply-To: <51393870.1030709@cn.fujitsu.com>
Gao feng <gaofeng@cn.fujitsu.com> writes:
> On 2013/03/07 19:50, Alexey Dobriyan wrote:
>> Lots of netns changes!
>>
>> I can't verify right now, but unless I'm not mistaken,
>> every L4 protocol conversion is buggy/oopsable/remotely ddosable
>> because per-netns stuff is initialized after protocol is hooked into
>> master dispatcher.
>>
>
> Doesn't we do register_pernet_subsys before we register hooks and l4proto?
> Sorry I don't quite understand what you mean. :(
>> See c296bb4d5d417d466c9bcc8afef68a3db5449a64.
The registration in the referenced commit has register_pernet_subsys
happening after nf_ct_l4_proto_register. The unregistration is also
happening in that order so something seems fishy. If there is
an ordering dependency between the two unregistration should happen
in the opposite order of registration.
However, I don't know the code well enough to know if it is a problem or
not.
Eric
^ permalink raw reply
* Re: [PATCH] VSOCK: Split vm_sockets.h into kernel/uapi
From: David Howells @ 2013-03-08 1:09 UTC (permalink / raw)
To: Greg KH
Cc: Andy King, pv-drivers, netdev, linux-kernel, virtualization,
dhowells, davem
In-Reply-To: <20130307232453.GD10304@kroah.com>
Greg KH <gregkh@linuxfoundation.org> wrote:
> David, is there any rush to get stuff like this into 3.9 for any
> uapi-type changes, or can it just wait for 3.10?
Not especially. It won't appear in userspace due to the __KERNEL__ guards.
David
^ permalink raw reply
* Re: re L4 conntracking netns conversion
From: Gao feng @ 2013-03-08 1:01 UTC (permalink / raw)
To: Alexey Dobriyan
Cc: Eric W. Biederman, Pablo Neira Ayuso, netdev, netfilter-devel
In-Reply-To: <CACVxJT9mPb+Fh7gc-PYwC288sjJct+-s5bSZ783j_6tiTNJKMg@mail.gmail.com>
On 2013/03/07 19:50, Alexey Dobriyan wrote:
> Lots of netns changes!
>
> I can't verify right now, but unless I'm not mistaken,
> every L4 protocol conversion is buggy/oopsable/remotely ddosable
> because per-netns stuff is initialized after protocol is hooked into
> master dispatcher.
>
Doesn't we do register_pernet_subsys before we register hooks and l4proto?
Sorry I don't quite understand what you mean. :(
> See c296bb4d5d417d466c9bcc8afef68a3db5449a64.
>
^ permalink raw reply
* Re: [PATCH v2 3/7] USBHID: don't recover device if suspend fails in system sleep
From: Greg Kroah-Hartman @ 2013-03-07 23:48 UTC (permalink / raw)
To: Jiri Kosina
Cc: Ming Lei, David S. Miller, Alan Stern, Oliver Neukum, netdev,
linux-usb, linux-input
In-Reply-To: <alpine.LNX.2.00.1303080013210.19460@pobox.suse.cz>
On Fri, Mar 08, 2013 at 12:16:08AM +0100, Jiri Kosina wrote:
> On Fri, 8 Mar 2013, Ming Lei wrote:
>
> > If suspend callback fails in system sleep context, usb core will
> > ignore the failure and let the system sleep go ahead further, so this
> > patch doesn't recover device under this situation, otherwise
> > may cause resume() confused.
> >
> > Cc: Jiri Kosina <jkosina@suse.cz>
> > Signed-off-by: Ming Lei <ming.lei@canonical.com>
>
> Acked-by: Jiri Kosina <jkosina@suse.cz>
>
> I guess this will go through USB tree as a series ...
Yes, I can take this, thanks for the ack.
greg k-h
^ permalink raw reply
* Re: [PATCH net-next 00/12] IPVS optimizations
From: Julian Anastasov @ 2013-03-07 23:46 UTC (permalink / raw)
To: Jesper Dangaard Brouer; +Cc: Simon Horman, lvs-devel, netdev
In-Reply-To: <1362650966.18590.127.camel@localhost>
Hello,
On Thu, 7 Mar 2013, Jesper Dangaard Brouer wrote:
> On Wed, 2013-03-06 at 10:42 +0200, Julian Anastasov wrote:
> > This is a first patchset for IPVS optimizations.
> > Another patchset will address the locking in schedulers
> > and moving the global _bh disabling from LOCAL_OUT to all
> > locks. It is in TODO list.
>
> Do you have any performance measurements?
Unfortunately, I don't have suitable
hardware to do real tests, only virtual setup.
> Or is this code primarily cleanup optimizations, and the next patchset
> will address the performance part?
This patchset converts all global locks to RCU,
except the __ip_vs_svc_lock usage. The states in
some schedulers probably will need some protection
with lock as before now, others like WLC and LC will
run (after patchset2) just under RCU lock for the
svc->destinations list. But I'll need some time to
finalize this 2nd patchset because there are other
patches in the queue...
So, the answer is that packets that create
connections (via schedulers) hit this __ip_vs_svc_lock
with read_lock and some write lock in scheduler.
This happens only when connection is created. Next packets
should not reach any global locks in IPVS. The cached
dst->refcnt is not changed anymore for traffic to
real server.
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: [PATCH] VSOCK: Split vm_sockets.h into kernel/uapi
From: Greg KH @ 2013-03-07 23:24 UTC (permalink / raw)
To: David Howells
Cc: Andy King, pv-drivers, netdev, linux-kernel, virtualization,
davem
In-Reply-To: <26621.1362675490@warthog.procyon.org.uk>
On Thu, Mar 07, 2013 at 04:58:10PM +0000, David Howells wrote:
> Andy King <acking@vmware.com> wrote:
>
> > Split the vSockets header into kernel and UAPI parts. The former gets the bits
> > that used to be in __KERNEL__ guards, while the latter gets everything that is
> > user-visible. Tested by compiling vsock (+transport) and a simple user-mode
> > vSockets application.
> >
> > Reported-by: David Howells <dhowells@redhat.com>
> > Acked-by: Dmitry Torokhov <dtor@vmware.com>
> > Signed-off-by: Andy King <acking@vmware.com>
>
> Acked-by: David Howells <dhowells@redhat.com>
David, is there any rush to get stuff like this into 3.9 for any
uapi-type changes, or can it just wait for 3.10?
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH v2 0/7] USB: don't recover device if suspend fails in system sleep
From: Greg KH @ 2013-03-07 23:24 UTC (permalink / raw)
To: David Miller
Cc: ming.lei, jkosina, stern, oneukum, netdev, linux-usb, linux-input
In-Reply-To: <20130307.152807.2038557949816610391.davem@davemloft.net>
On Thu, Mar 07, 2013 at 03:28:07PM -0500, David Miller wrote:
> From: Ming Lei <ming.lei@canonical.com>
> Date: Fri, 8 Mar 2013 00:15:17 +0800
>
> > This patch adds comments on interface driver suspend callback
> > to emphasize that the failure return value is ignored by
> > USB core in system sleep context, so do not try to recover
> > device for this case, otherwise the recovery things may confuse
> > resume().
> >
> > Also fixes the USB serial, HID and several usbnet drivers
> > which may recover device in suspend failure path of system sleep.
> >
> > v2:
> > - improve comments on suspend callback as suggested by Alan
> > - update kerneldoc for usb_suspend_both as suggested by Alan
> > - remove previous check of PMSG_IS_AUTO(message) in cdc_mbim/
> > qmi_wwan and add comments on suspend failure case, since Bjørn
> > doesn't like the check.
> > - add comments on smsc95xx/smsc75xx
> > v1:
> > - fix compile failure
> > - add comments about handling suspend failure in resume()
>
> Feel free to merge this via the USB tree and to add my ACK to the
> networking driver bits:
>
> Acked-by: David S. Miller <davem@davemloft.net>
Thanks, I will do that.
greg k-h
^ permalink raw reply
* Re: [PATCH net-next 11/12] ipvs: reorder keys in connection structure
From: Julian Anastasov @ 2013-03-07 23:23 UTC (permalink / raw)
To: Hans Schillstrom; +Cc: Simon Horman, lvs-devel, netdev
In-Reply-To: <1362642592.17102.140.camel@hawk.mlab.se>
Hello,
On Thu, 7 Mar 2013, Hans Schillstrom wrote:
> I made some tests on weaker machine (i7-3930K) with moderate background
> load, there is absolute no measurable difference with daddr in first
> cache line or in second line.
> So based on that I prefer your solution since it keeps data together.
Thanks for the review and the tests. But I'll
slightly extend this patch in v2 with more optimizations...
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* [PATCH net-next 4/4] VXLAN: Use UDP Tunnel segmention.
From: Pravin B Shelar @ 2013-03-07 23:22 UTC (permalink / raw)
To: davem, netdev; +Cc: jesse, Pravin B Shelar
Enable TSO for VXLAN devices and use UDP_TUNNEL to offload vxlan
segmentation.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
drivers/net/vxlan.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index f10e58a..f057ec0 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -820,6 +820,20 @@ static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb)
return (((u64) hash * range) >> 32) + vxlan->port_min;
}
+static int handle_offloads(struct sk_buff *skb)
+{
+ if (skb_is_gso(skb)) {
+ int err = skb_unclone(skb, GFP_ATOMIC);
+ if (unlikely(err))
+ return err;
+
+ skb_shinfo(skb)->gso_type |= (SKB_GSO_UDP_TUNNEL | SKB_GSO_UDP);
+ } else if (skb->ip_summed != CHECKSUM_PARTIAL)
+ skb->ip_summed = CHECKSUM_NONE;
+
+ return 0;
+}
+
/* Transmit local packets over Vxlan
*
* Outer IP header inherits ECN and DF from inner header.
@@ -963,9 +977,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
vxlan_set_owner(dev, skb);
- /* See iptunnel_xmit() */
- if (skb->ip_summed != CHECKSUM_PARTIAL)
- skb->ip_summed = CHECKSUM_NONE;
+ if (handle_offloads(skb))
+ goto drop;
err = ip_local_out(skb);
if (likely(net_xmit_eval(err) == 0)) {
@@ -1187,8 +1200,10 @@ static void vxlan_setup(struct net_device *dev)
dev->features |= NETIF_F_NETNS_LOCAL;
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM;
dev->features |= NETIF_F_RXCSUM;
+ dev->features |= NETIF_F_GSO_SOFTWARE;
dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
+ dev->hw_features |= NETIF_F_GSO_SOFTWARE;
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 3/4] tunneling: Add generic Tunnel segmentation.
From: Pravin B Shelar @ 2013-03-07 23:21 UTC (permalink / raw)
To: davem, netdev; +Cc: jesse, Pravin B Shelar
Adds generic tunneling offloading support for IPv4-UDP based
tunnels.
GSO type is added to request this offload for a skb.
netdev feature NETIF_F_UDP_TUNNEL is added for hardware offloaded
udp-tunnel support. Currently no device supports this feature,
software offload is used.
This can be used by tunneling protocols like VXLAN.
CC: Jesse Gross <jesse@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
include/linux/netdev_features.h | 7 ++-
include/linux/skbuff.h | 2 +
net/core/ethtool.c | 1 +
net/ipv4/af_inet.c | 6 ++-
net/ipv4/tcp.c | 1 +
net/ipv4/udp.c | 115 ++++++++++++++++++++++++++++++---------
net/ipv6/ip6_offload.c | 1 +
net/ipv6/udp_offload.c | 10 +++-
8 files changed, 112 insertions(+), 31 deletions(-)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 3dd3934..9980e8d 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -42,9 +42,9 @@ enum {
NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
NETIF_F_FSO_BIT, /* ... FCoE segmentation */
NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
- /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */
- NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */
- = NETIF_F_GSO_LAST,
+ NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
+ /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
+ NETIF_F_GSO_UDP_TUNNEL_BIT,
NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
@@ -103,6 +103,7 @@ enum {
#define NETIF_F_RXFCS __NETIF_F(RXFCS)
#define NETIF_F_RXALL __NETIF_F(RXALL)
#define NETIF_F_GRE_GSO __NETIF_F(GSO_GRE)
+#define NETIF_F_UDP_TUNNEL __NETIF_F(UDP_TUNNEL)
/* Features valid for ethtool to change */
/* = all defined minus driver/device-class-related */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d7f96ff..eb2106f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -316,6 +316,8 @@ enum {
SKB_GSO_FCOE = 1 << 5,
SKB_GSO_GRE = 1 << 6,
+
+ SKB_GSO_UDP_TUNNEL = 1 << 7,
};
#if BITS_PER_LONG > 32
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 3e9b2c3..adc1351 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -78,6 +78,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
[NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation",
[NETIF_F_FSO_BIT] = "tx-fcoe-segmentation",
[NETIF_F_GSO_GRE_BIT] = "tx-gre-segmentation",
+ [NETIF_F_GSO_UDP_TUNNEL_BIT] = "tx-udp_tnl-segmentation",
[NETIF_F_FCOE_CRC_BIT] = "tx-checksum-fcoe-crc",
[NETIF_F_SCTP_CSUM_BIT] = "tx-checksum-sctp",
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 68f6a94..1924069 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1283,6 +1283,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
int ihl;
int id;
unsigned int offset = 0;
+ bool tunnel;
if (!(features & NETIF_F_V4_CSUM))
features &= ~NETIF_F_SG;
@@ -1293,6 +1294,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
SKB_GSO_DODGY |
SKB_GSO_TCP_ECN |
SKB_GSO_GRE |
+ SKB_GSO_UDP_TUNNEL |
0)))
goto out;
@@ -1307,6 +1309,8 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
if (unlikely(!pskb_may_pull(skb, ihl)))
goto out;
+ tunnel = !!skb->encapsulation;
+
__skb_pull(skb, ihl);
skb_reset_transport_header(skb);
iph = ip_hdr(skb);
@@ -1326,7 +1330,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
skb = segs;
do {
iph = ip_hdr(skb);
- if (proto == IPPROTO_UDP) {
+ if (!tunnel && proto == IPPROTO_UDP) {
iph->id = htons(id);
iph->frag_off = htons(offset >> 3);
if (skb->next != NULL)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 47e854f..8d14573 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3044,6 +3044,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
SKB_GSO_TCP_ECN |
SKB_GSO_TCPV6 |
SKB_GSO_GRE |
+ SKB_GSO_UDP_TUNNEL |
0) ||
!(type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))))
goto out;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 265c42c..41760e0 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2272,31 +2272,88 @@ void __init udp_init(void)
int udp4_ufo_send_check(struct sk_buff *skb)
{
- const struct iphdr *iph;
- struct udphdr *uh;
-
- if (!pskb_may_pull(skb, sizeof(*uh)))
+ if (!pskb_may_pull(skb, sizeof(struct udphdr)))
return -EINVAL;
- iph = ip_hdr(skb);
- uh = udp_hdr(skb);
+ if (likely(!skb->encapsulation)) {
+ const struct iphdr *iph;
+ struct udphdr *uh;
- uh->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, skb->len,
- IPPROTO_UDP, 0);
- skb->csum_start = skb_transport_header(skb) - skb->head;
- skb->csum_offset = offsetof(struct udphdr, check);
- skb->ip_summed = CHECKSUM_PARTIAL;
+ iph = ip_hdr(skb);
+ uh = udp_hdr(skb);
+
+ uh->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, skb->len,
+ IPPROTO_UDP, 0);
+ skb->csum_start = skb_transport_header(skb) - skb->head;
+ skb->csum_offset = offsetof(struct udphdr, check);
+ skb->ip_summed = CHECKSUM_PARTIAL;
+ }
return 0;
}
+static struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
+ netdev_features_t features)
+{
+ struct sk_buff *segs = ERR_PTR(-EINVAL);
+ int mac_len = skb->mac_len;
+ int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
+ int outer_hlen;
+ netdev_features_t enc_features;
+
+ if (unlikely(!pskb_may_pull(skb, tnl_hlen)))
+ goto out;
+
+ skb->encapsulation = 0;
+ __skb_pull(skb, tnl_hlen);
+ skb_reset_mac_header(skb);
+ skb_set_network_header(skb, skb_inner_network_offset(skb));
+ skb->mac_len = skb_inner_network_offset(skb);
+
+ /* segment inner packet. */
+ enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
+ segs = skb_mac_gso_segment(skb, enc_features);
+ if (!segs || IS_ERR(segs))
+ goto out;
+
+ outer_hlen = skb_tnl_header_len(skb);
+ skb = segs;
+ do {
+ struct udphdr *uh;
+ int udp_offset = outer_hlen - tnl_hlen;
+
+ skb->mac_len = mac_len;
+
+ skb_push(skb, outer_hlen);
+ skb_reset_mac_header(skb);
+ skb_set_network_header(skb, mac_len);
+ skb_set_transport_header(skb, udp_offset);
+ uh = udp_hdr(skb);
+ uh->len = htons(skb->len - udp_offset);
+
+ /* csum segment if tunnel sets skb with csum. */
+ if (unlikely(uh->check)) {
+ struct iphdr *iph = ip_hdr(skb);
+
+ uh->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
+ skb->len - udp_offset,
+ IPPROTO_UDP, 0);
+ uh->check = csum_fold(skb_checksum(skb, udp_offset,
+ skb->len - udp_offset, 0));
+ if (uh->check == 0)
+ uh->check = CSUM_MANGLED_0;
+
+ }
+ skb->ip_summed = CHECKSUM_NONE;
+ } while ((skb = skb->next));
+out:
+ return segs;
+}
+
struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
netdev_features_t features)
{
struct sk_buff *segs = ERR_PTR(-EINVAL);
unsigned int mss;
- int offset;
- __wsum csum;
-
mss = skb_shinfo(skb)->gso_size;
if (unlikely(skb->len <= mss))
goto out;
@@ -2306,6 +2363,7 @@ struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
int type = skb_shinfo(skb)->gso_type;
if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY |
+ SKB_GSO_UDP_TUNNEL |
SKB_GSO_GRE) ||
!(type & (SKB_GSO_UDP))))
goto out;
@@ -2316,20 +2374,27 @@ struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
goto out;
}
- /* Do software UFO. Complete and fill in the UDP checksum as HW cannot
- * do checksum of UDP packets sent as multiple IP fragments.
- */
- offset = skb_checksum_start_offset(skb);
- csum = skb_checksum(skb, offset, skb->len - offset, 0);
- offset += skb->csum_offset;
- *(__sum16 *)(skb->data + offset) = csum_fold(csum);
- skb->ip_summed = CHECKSUM_NONE;
-
/* Fragment the skb. IP headers of the fragments are updated in
* inet_gso_segment()
*/
- segs = skb_segment(skb, features);
+ if (skb->encapsulation && skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL)
+ segs = skb_udp_tunnel_segment(skb, features);
+ else {
+ int offset;
+ __wsum csum;
+
+ /* Do software UFO. Complete and fill in the UDP checksum as
+ * HW cannot do checksum of UDP packets sent as multiple
+ * IP fragments.
+ */
+ offset = skb_checksum_start_offset(skb);
+ csum = skb_checksum(skb, offset, skb->len - offset, 0);
+ offset += skb->csum_offset;
+ *(__sum16 *)(skb->data + offset) = csum_fold(csum);
+ skb->ip_summed = CHECKSUM_NONE;
+
+ segs = skb_segment(skb, features);
+ }
out:
return segs;
}
-
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index 8234c1d..e02a65a 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -100,6 +100,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
SKB_GSO_DODGY |
SKB_GSO_TCP_ECN |
SKB_GSO_GRE |
+ SKB_GSO_UDP_TUNNEL |
SKB_GSO_TCPV6 |
0)))
goto out;
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
index cf05cf0..3ced14e 100644
--- a/net/ipv6/udp_offload.c
+++ b/net/ipv6/udp_offload.c
@@ -21,6 +21,10 @@ static int udp6_ufo_send_check(struct sk_buff *skb)
const struct ipv6hdr *ipv6h;
struct udphdr *uh;
+ /* UDP Tunnel offload on ipv6 is not yet supported. */
+ if (skb->encapsulation)
+ return -EINVAL;
+
if (!pskb_may_pull(skb, sizeof(*uh)))
return -EINVAL;
@@ -56,8 +60,10 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
/* Packet is from an untrusted source, reset gso_segs. */
int type = skb_shinfo(skb)->gso_type;
- if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY |
- SKB_GSO_GRE) ||
+ if (unlikely(type & ~(SKB_GSO_UDP |
+ SKB_GSO_DODGY |
+ SKB_GSO_UDP_TUNNEL |
+ SKB_GSO_GRE) ||
!(type & (SKB_GSO_UDP))))
goto out;
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 2/4] tunneling: Capture inner mac header during encapsulation.
From: Pravin B Shelar @ 2013-03-07 23:21 UTC (permalink / raw)
To: davem, netdev; +Cc: jesse, Pravin B Shelar
This patch adds inner mac header. This will be used in next patch
to find tunner header length. Header len is required to copy tunnel
header to each gso segment.
This patch does not change any functionality.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
include/linux/skbuff.h | 34 ++++++++++++++++++++++++++++++++++
net/core/skbuff.c | 2 ++
2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 821c7f4..d7f96ff 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -387,6 +387,7 @@ typedef unsigned char *sk_buff_data_t;
* @vlan_tci: vlan tag control information
* @inner_transport_header: Inner transport layer header (encapsulation)
* @inner_network_header: Network layer header (encapsulation)
+ * @inner_mac_header: Link layer header (encapsulation)
* @transport_header: Transport layer header
* @network_header: Network layer header
* @mac_header: Link layer header
@@ -505,6 +506,7 @@ struct sk_buff {
sk_buff_data_t inner_transport_header;
sk_buff_data_t inner_network_header;
+ sk_buff_data_t inner_mac_header;
sk_buff_data_t transport_header;
sk_buff_data_t network_header;
sk_buff_data_t mac_header;
@@ -1466,6 +1468,7 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
static inline void skb_reset_inner_headers(struct sk_buff *skb)
{
+ skb->inner_mac_header = skb->mac_header;
skb->inner_network_header = skb->network_header;
skb->inner_transport_header = skb->transport_header;
}
@@ -1511,6 +1514,22 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
skb->inner_network_header += offset;
}
+static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
+{
+ return skb->head + skb->inner_mac_header;
+}
+
+static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
+{
+ skb->inner_mac_header = skb->data - skb->head;
+}
+
+static inline void skb_set_inner_mac_header(struct sk_buff *skb,
+ const int offset)
+{
+ skb_reset_inner_mac_header(skb);
+ skb->inner_mac_header += offset;
+}
static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
{
return skb->transport_header != ~0U;
@@ -1604,6 +1623,21 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
skb->inner_network_header = skb->data + offset;
}
+static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
+{
+ return skb->inner_mac_header;
+}
+
+static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
+{
+ skb->inner_mac_header = skb->data;
+}
+
+static inline void skb_set_inner_mac_header(struct sk_buff *skb,
+ const int offset)
+{
+ skb->inner_mac_header = skb->data + offset;
+}
static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
{
return skb->transport_header != NULL;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b3e8db8..2fd5e90 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -673,6 +673,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
new->mac_header = old->mac_header;
new->inner_transport_header = old->inner_transport_header;
new->inner_network_header = old->inner_network_header;
+ new->inner_mac_header = old->inner_mac_header;
skb_dst_copy(new, old);
new->rxhash = old->rxhash;
new->ooo_okay = old->ooo_okay;
@@ -876,6 +877,7 @@ static void skb_headers_offset_update(struct sk_buff *skb, int off)
skb->mac_header += off;
skb->inner_transport_header += off;
skb->inner_network_header += off;
+ skb->inner_mac_header += off;
}
static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 1/4] net: Add skb_headers_offset_update helper function.
From: Pravin B Shelar @ 2013-03-07 23:21 UTC (permalink / raw)
To: davem, netdev; +Cc: jesse, Pravin B Shelar
This function will be used in next VXLAN_GSO patch. This patch does
not change any functionality.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
net/core/skbuff.c | 34 ++++++++++++++--------------------
1 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 33245ef..b3e8db8 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -867,6 +867,17 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
}
EXPORT_SYMBOL(skb_clone);
+static void skb_headers_offset_update(struct sk_buff *skb, int off)
+{
+ /* {transport,network,mac}_header and tail are relative to skb->head */
+ skb->transport_header += off;
+ skb->network_header += off;
+ if (skb_mac_header_was_set(skb))
+ skb->mac_header += off;
+ skb->inner_transport_header += off;
+ skb->inner_network_header += off;
+}
+
static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
{
#ifndef NET_SKBUFF_DATA_USES_OFFSET
@@ -879,13 +890,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
__copy_skb_header(new, old);
#ifndef NET_SKBUFF_DATA_USES_OFFSET
- /* {transport,network,mac}_header are relative to skb->head */
- new->transport_header += offset;
- new->network_header += offset;
- if (skb_mac_header_was_set(new))
- new->mac_header += offset;
- new->inner_transport_header += offset;
- new->inner_network_header += offset;
+ skb_headers_offset_update(new, offset);
#endif
skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
@@ -1077,14 +1082,8 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
#else
skb->end = skb->head + size;
#endif
- /* {transport,network,mac}_header and tail are relative to skb->head */
skb->tail += off;
- skb->transport_header += off;
- skb->network_header += off;
- if (skb_mac_header_was_set(skb))
- skb->mac_header += off;
- skb->inner_transport_header += off;
- skb->inner_network_header += off;
+ skb_headers_offset_update(skb, off);
/* Only adjust this if it actually is csum_start rather than csum */
if (skb->ip_summed == CHECKSUM_PARTIAL)
skb->csum_start += nhead;
@@ -1180,12 +1179,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
if (n->ip_summed == CHECKSUM_PARTIAL)
n->csum_start += off;
#ifdef NET_SKBUFF_DATA_USES_OFFSET
- n->transport_header += off;
- n->network_header += off;
- if (skb_mac_header_was_set(skb))
- n->mac_header += off;
- n->inner_transport_header += off;
- n->inner_network_header += off;
+ skb_headers_offset_update(n, off);
#endif
return n;
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 0/4] VXLAN: segmentation offload
From: Pravin B Shelar @ 2013-03-07 23:21 UTC (permalink / raw)
To: davem, netdev; +Cc: jesse, Pravin B Shelar
Following patches add segmentation offload to VXLAN. These
patches shows performance improvement from 3.9G to 5.8G (+50%)
with netperf single process TCP_STREAM test on 10G network.
Pravin B Shelar (4):
net: Add skb_headers_offset_update helper function.
tunneling: Capture inner mac header during encapsulation.
tunneling: Add generic Tunnel segmentation.
VXLAN: Use UDP Tunnel segmention.
drivers/net/vxlan.c | 21 ++++++-
include/linux/netdev_features.h | 7 +-
include/linux/skbuff.h | 36 ++++++++++++
net/core/ethtool.c | 1 +
net/core/skbuff.c | 36 +++++-------
net/ipv4/af_inet.c | 6 ++-
net/ipv4/tcp.c | 1 +
net/ipv4/udp.c | 116 ++++++++++++++++++++++++++++++--------
net/ipv6/ip6_offload.c | 1 +
net/ipv6/udp_offload.c | 10 +++-
10 files changed, 181 insertions(+), 54 deletions(-)
^ permalink raw reply
* Re: [PATCH] ipv6 addrconf: Fix addrconf_ifid_eui64 of 802.15.4 devices
From: David Miller @ 2013-03-07 23:17 UTC (permalink / raw)
To: eric.dumazet
Cc: bhutchings, alex.aring, kuznet, jmorris, yoshfuji,
linux-zigbee-devel, netdev
In-Reply-To: <1362697025.15793.221.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 07 Mar 2013 14:57:05 -0800
> On Thu, 2013-03-07 at 22:41 +0000, Ben Hutchings wrote:
>> On Thu, 2013-03-07 at 21:13 +0100, Alexander Aring wrote:
>> > The function addrconf_ifid_eui64 will copy eui into dev->dev_addr.
>> > We need first to manipulate eui[0] before we call memcpy afterwards.
>>
>> memcpy() does not work that way.
>>
>> > Broken since commit:
>> > 5e98a36ed4bf6ea396170e3af0dd4fcbe51d772f
>> >
>> > Since this commit I got many trouble with the ieee802154 stack.
>>
>> Your change is effectively reverting that commit.
>
> Reverting the commit seems the solution ;)
So Yoshifuji HIDEAKI and Alexander need to work out what is happening
here.
^ permalink raw reply
* Re: [PATCH v2 3/7] USBHID: don't recover device if suspend fails in system sleep
From: Jiri Kosina @ 2013-03-07 23:16 UTC (permalink / raw)
To: Ming Lei
Cc: David S. Miller, Greg Kroah-Hartman, Alan Stern, Oliver Neukum,
netdev, linux-usb, linux-input
In-Reply-To: <1362672924-22975-4-git-send-email-ming.lei@canonical.com>
On Fri, 8 Mar 2013, Ming Lei wrote:
> If suspend callback fails in system sleep context, usb core will
> ignore the failure and let the system sleep go ahead further, so this
> patch doesn't recover device under this situation, otherwise
> may cause resume() confused.
>
> Cc: Jiri Kosina <jkosina@suse.cz>
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
I guess this will go through USB tree as a series ...
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [RFC PATCH] udp: don't rereference dst_entry dev pointer on rcv
From: David Miller @ 2013-03-07 23:15 UTC (permalink / raw)
To: eric.dumazet; +Cc: tparkin, netdev
In-Reply-To: <1362696444.15793.220.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 07 Mar 2013 14:47:24 -0800
> On Thu, 2013-03-07 at 22:36 +0000, Tom Parkin wrote:
>> When a fragmented IP packet is queued during device teardown, it is possible
>> for the reassembled packet to hit the UDP rcv path with a NULL dst_entry dev
>> pointer. Drop such packets to prevent an oops.
>> ---
>> net/ipv4/udp.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
>> index 0a073a2..c38a4b1 100644
>> --- a/net/ipv4/udp.c
>> +++ b/net/ipv4/udp.c
>> @@ -1700,6 +1700,9 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
>> return __udp4_lib_mcast_deliver(net, skb, uh,
>> saddr, daddr, udptable);
>>
>> + if (skb_dst(skb)->dev == NULL)
>> + goto drop;
>> +
>> sk = __udp4_lib_lookup_skb(skb, uh->source, uh->dest, udptable);
>>
>> if (sk != NULL) {
>
>
> Hmm... couldnt it be tested in reassembly layer instead ?
>
> Why is it specific to UDP ?
Furthermore, when devices are unregistered we set the route's device
pointer to point to the loopback device, not NULL, exactly to avoid
this kind of problem.
I don't see anything in our generic DST handler nor the ipv4 specific
route handling, that would set dst->dev to NULL.
You really have to show us how this can actually happen.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox