* [PATCH] net: filter: move forward declarations to avoid compile warnings
From: Heiko Carstens @ 2011-05-22 17:08 UTC (permalink / raw)
To: David Miller; +Cc: linux-kernel, netdev, Eric Dumazet
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Get rid of this compile warning:
In file included from arch/s390/kernel/compat_linux.c:37:0:
include/linux/filter.h:139:23: warning: 'struct sk_buff' declared inside parameter list
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
include/linux/filter.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 4609b85..9ee3f9f 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -131,6 +131,10 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
#define SKF_LL_OFF (-0x200000)
#ifdef __KERNEL__
+
+struct sk_buff;
+struct sock;
+
struct sk_filter
{
atomic_t refcnt;
@@ -146,9 +150,6 @@ static inline unsigned int sk_filter_len(const struct sk_filter *fp)
return fp->len * sizeof(struct sock_filter) + sizeof(*fp);
}
-struct sk_buff;
-struct sock;
-
extern int sk_filter(struct sock *sk, struct sk_buff *skb);
extern unsigned int sk_run_filter(const struct sk_buff *skb,
const struct sock_filter *filter);
^ permalink raw reply related
* Re: [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling
From: Michael S. Tsirkin @ 2011-05-22 17:32 UTC (permalink / raw)
To: Rusty Russell
Cc: habanero, Shirley Ma, Krishna Kumar2, kvm, steved, Tom Lendacky,
borntraeger, avi, virtualization, netdev, linux-kernel
In-Reply-To: <8739kb5era.fsf@rustcorp.com.au>
On Thu, May 19, 2011 at 05:00:17PM +0930, Rusty Russell wrote:
> On Thu, 19 May 2011 01:01:25 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > The patch virtio_net: limit xmit polling
> > got the logic reversed: it polled while we had
> > capacity not while ring was empty.
> >
> > Fix it up and clean up a bit by using a for loop.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >
> > OK, turns out that patch was borken. Here's
> > a fix that survived stress test on my box.
> > Pushed on my branch, I'll send a rebased series
> > with Rusty's comments addressed ASAP.
>
> Normally you would have missed the merge window by now, but I'd really
> like this stuff in, so I'm holding it open for this. I want these patches
> in linux-next for at least a few days before I push them.
>
> If you think we're not close enough, please tell me and I'll push
> the rest of the virtio patches to Linus now.
>
> Thanks,
> Rusty.
I think it makes sense to push just the patches you have
applied by now (event index + delayed callback) - the
rest are close but they are guest only patches so very easy to
experiment with out of tree. OTOH if event index misses the
window it makes testing painful as we have to keep patching
both host and guest.
--
MST
^ permalink raw reply
* Security Warning
From: Webmaster Administrator @ 2011-05-22 17:25 UTC (permalink / raw)
Your mailbox has exceeded the storage limit which is 20GB as set by your
administrator,you are currently running on 20.9GB,you may not be able to
send or receive new mail until you re-validate your mailbox. To
re-validate your mailbox, please click the link below:
http://doiop.com/4rgn5e
If the link above don't work, please copy and paste the link below to your
browser window.
http://doiop.com/4rgn5e
Thanks
System Administrator Team.
^ permalink raw reply
* Re: [PATCH] net: ipv4: add IPPROTO_ICMP socket kind
From: Vasiliy Kulikov @ 2011-05-22 17:46 UTC (permalink / raw)
To: Pavel Kankovsky; +Cc: Alexey Dobriyan, netdev, Solar Designer
In-Reply-To: <20110522174412.2F0C.0@paddy.troja.mff.cuni.cz>
On Sun, May 22, 2011 at 18:01 +0200, Pavel Kankovsky wrote:
> On Thu, 14 Apr 2011, Alexey Dobriyan wrote:
>
> > Also, there was big discussion re exposing kernel socket pointers,
> > which this file continue to do.
>
> One late comment:
>
> The code was intented to immitate /proc/net/udp.
>
> As far as I can tell UDP and TCP (having checked udp.c and tcp_ipv[46].c
> in the latest net-next-2.6) do not have any qualms about exposing kernel
> pointers so we are a little bit holier than the pope here. :)
Anyway, ping uses %pK:
seq_printf(f, "%5d: %08X:%04X %08X:%04X"
" %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %pK d%n",
bucket, src, srcp, dest, destp, sp->sk_state,
sk_wmem_alloc_get(sp),
sk_rmem_alloc_get(sp),
0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
atomic_read(&sp->sk_refcnt), sp,
atomic_read(&sp->sk_drops), len);
Thanks,
--
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments
^ permalink raw reply
* Block based abstraction in af_packet->Rx::mmap
From: chetan loke @ 2011-05-22 17:46 UTC (permalink / raw)
To: netdev, loke.chetan
Hello,
With the current af_packet->rx::mmap based approach, the element size
in the block needs to be statically configured.
Nothing wrong with the current config/implementation. But since the
traffic profile cannot be known in advance, it would be nice if that
configuration
wasn't static. Normally, one would configure the element-size
to be '2048' so that you can atleast capture the entire 'MTU-size'.
But if the traffic profile varies then we would end up either
i)wasting memory or ii) end up getting a sliced frame.
In other words the packet density will be much much less in the first case.
Also, today we have to spin-wait/poll if a single packet is ready for
consumption(is status == TP_STATUS_USER?).
This does not scale. Rather, poll-waiting on a single block will
definitely help.
Q1)Is anyone working on enhancing the current mmap implementation?
Q2)Do patches exist for such non-static implementation already?
PS: Please CC me on the replies as I am not subscribed on the mailing list.
Regards
Chetan
^ permalink raw reply
* More prefetch fall-out
From: Linus Torvalds @ 2011-05-22 17:49 UTC (permalink / raw)
To: David Miller; +Cc: Network Development
So it turns out that the architectures that don't define their
prefetch() macros in <asm/processor.h> (and instead depend on
linux/prefetch.h to give them the default ones) are currently broken.
Fine, that's really trivial to fix. And, in fact, I'm now testing on
x86 by having x86 put its prefetch infrastructure in <asm/prefetch.h>
and thus making sure that you *have* to include <linux/prefetch.h> to
get it (rather than get it accidentally just because everything ends
up including <asm/processor.h>).
However, one of the breakages is <linux/skbuff.h> that does its own
list-walking functions ("skb_queue_walk*"), and they do prefetching.
So now I have the option to either just add <linux/prefetch.h> to that
file, or remove the prefetches. And you're the one that said that the
prefetches in the networking code were annoying.
So should the skb queues use prefetching? I have a hard time judging.
Are those lists usually long? Is the loop usually large enough that
there is any point to prefetching the next entry?
Linus
^ permalink raw reply
* Re: More prefetch fall-out
From: Eric Dumazet @ 2011-05-22 18:23 UTC (permalink / raw)
To: Linus Torvalds; +Cc: David Miller, Network Development
In-Reply-To: <BANLkTi=YwLaoTVjKguH-uZpZgXduLhiTNg@mail.gmail.com>
Le dimanche 22 mai 2011 à 10:49 -0700, Linus Torvalds a écrit :
> However, one of the breakages is <linux/skbuff.h> that does its own
> list-walking functions ("skb_queue_walk*"), and they do prefetching.
> So now I have the option to either just add <linux/prefetch.h> to that
> file, or remove the prefetches. And you're the one that said that the
> prefetches in the networking code were annoying.
>
> So should the skb queues use prefetching? I have a hard time judging.
> Are those lists usually long? Is the loop usually large enough that
> there is any point to prefetching the next entry?
>
Taking a look at various skb_queue_walk* call sites, I think prefetches
are not a clear win, I would just remove them all from skbuff.h
BTW, the skb_queue_walk_safe(), skb_queue_walk_from_safe(),
skb_queue_reverse_walk_safe, skb_queue_reverse_walk_from_safe() dont
have prefetch() calls.
^ permalink raw reply
* Re: [patch net-next-2.6 v2] net: vlan: make non-hw-accel rx path similar to hw-accel
From: Eric W. Biederman @ 2011-05-22 18:24 UTC (permalink / raw)
To: Jesse Gross
Cc: Jiri Pirko, Nicolas de Pesloüan, Changli Gao, David Miller,
netdev, shemminger, kaber, fubar, eric.dumazet, andy
In-Reply-To: <BANLkTi=4JJa-J-p_JbY1PfooT75KfSB4uA@mail.gmail.com>
Jesse Gross <jesse@nicira.com> writes:
> On Sat, May 21, 2011 at 11:34 PM, Eric W. Biederman
> <ebiederm@xmission.com> wrote:
>> Jiri Pirko <jpirko@redhat.com> writes:
>>
>>> Sun, May 22, 2011 at 04:59:49AM CEST, nicolas.2p.debian@gmail.com wrote:
>>>
>>> <snip>
>>>>
>>>>And because some setups may still require the skb not to be untagged,
>>>>may be we need the ability to re-tag the skb in some situations...
>>>>When a protocol handler or rx_handler is explicitly registered on a
>>>>net_device which expect to receive tagged skb, we should deliver
>>>>tagged skb to it... Arguably, this may sound incredible for the
>>>>general case, but may be required for not-so-special cases like
>>>>bridge or protocol analyzer.
>>>
>>> Wait, what setups/code require the skb not to be untagged? If there's
>>> such, it should be fixed.
>>
>> tcpdump on the non-vlan interface for one.
>
> There are some drivers still using the old vlan model that will drop
> tags or packets when no vlan group is configured but that's a driver
> problem, not one with networking core or tcpdump.
On receive if we have stripped the vlan header and then we go to deliver
the interrupt to a pf_packet socket (on a non-vlan interface) before
or as part of the deliver of the packet to user space we need to
re-add the vlan header. Additionally the socket filter on a pf_packet
socket needs to behave as though we have a vlan header.
So no I am not talking about anything that is driver specific. I am
talking about reasonable userspace expectations. Because otherwise
we simply loose the information that a packet was vlan tagged, and
in doing so we break existing userspace applications because of our
bugs.
Eric
^ permalink raw reply
* Re: More prefetch fall-out
From: Linus Torvalds @ 2011-05-22 18:38 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, Network Development
In-Reply-To: <1306088626.12435.27.camel@edumazet-laptop>
On Sun, May 22, 2011 at 11:23 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> Taking a look at various skb_queue_walk* call sites, I think prefetches
> are not a clear win, I would just remove them all from skbuff.h
Hmm.
I did that, and it turns out that we also have:
- *lots* of network drivers that use "prefetch" (without including prefetch.h)
- net/netlabel/netlabel_addrlist.h doing the same.
and fixing that up is annoying "grunt work".
So for now, I think I'll just do the "add the <linux/prefetch.h> to
<linux/skbuff.h>" thing, and leave networking alone. That makes
everything compile ("allyesconfig") even with my "you *have* to
include <linux/prefetch.h>" test-patch.
Linus
^ permalink raw reply
* Re: More prefetch fall-out
From: Eric Dumazet @ 2011-05-22 18:51 UTC (permalink / raw)
To: Linus Torvalds; +Cc: David Miller, Network Development
In-Reply-To: <BANLkTimQAhP17Hg6D84gtCO3nJ_SSsDAeg@mail.gmail.com>
Le dimanche 22 mai 2011 à 11:38 -0700, Linus Torvalds a écrit :
> On Sun, May 22, 2011 at 11:23 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> > Taking a look at various skb_queue_walk* call sites, I think prefetches
> > are not a clear win, I would just remove them all from skbuff.h
>
> Hmm.
>
> I did that, and it turns out that we also have:
>
> - *lots* of network drivers that use "prefetch" (without including prefetch.h)
> - net/netlabel/netlabel_addrlist.h doing the same.
>
> and fixing that up is annoying "grunt work".
>
> So for now, I think I'll just do the "add the <linux/prefetch.h> to
> <linux/skbuff.h>" thing, and leave networking alone. That makes
> everything compile ("allyesconfig") even with my "you *have* to
> include <linux/prefetch.h>" test-patch.
>
Or include <linux/prefetch.h> from linux/skbuff.h but remove the
prefetch() calls...
BTW this reminds me Andi Kleen prior patch
http://linux.derkeiler.com/Mailing-Lists/Kernel/2010-09/msg03096.html
^ permalink raw reply
* Re: [patch net-next-2.6 v2] net: vlan: make non-hw-accel rx path similar to hw-accel
From: Eric W. Biederman @ 2011-05-22 19:33 UTC (permalink / raw)
To: Jesse Gross
Cc: Jiri Pirko, Nicolas de Pesloüan, Changli Gao, David Miller,
netdev, shemminger, kaber, fubar, eric.dumazet, andy
In-Reply-To: <m1ei3qlhjw.fsf@fess.ebiederm.org>
ebiederm@xmission.com (Eric W. Biederman) writes:
> Jesse Gross <jesse@nicira.com> writes:
>
>> On Sat, May 21, 2011 at 11:34 PM, Eric W. Biederman
>> <ebiederm@xmission.com> wrote:
>>> Jiri Pirko <jpirko@redhat.com> writes:
>>>
>>>> Sun, May 22, 2011 at 04:59:49AM CEST, nicolas.2p.debian@gmail.com wrote:
>>>>
>>>> <snip>
>>>>>
>>>>>And because some setups may still require the skb not to be untagged,
>>>>>may be we need the ability to re-tag the skb in some situations...
>>>>>When a protocol handler or rx_handler is explicitly registered on a
>>>>>net_device which expect to receive tagged skb, we should deliver
>>>>>tagged skb to it... Arguably, this may sound incredible for the
>>>>>general case, but may be required for not-so-special cases like
>>>>>bridge or protocol analyzer.
>>>>
>>>> Wait, what setups/code require the skb not to be untagged? If there's
>>>> such, it should be fixed.
>>>
>>> tcpdump on the non-vlan interface for one.
>>
>> There are some drivers still using the old vlan model that will drop
>> tags or packets when no vlan group is configured but that's a driver
>> problem, not one with networking core or tcpdump.
>
> On receive if we have stripped the vlan header and then we go to deliver
> the interrupt to a pf_packet socket (on a non-vlan interface) before
> or as part of the deliver of the packet to user space we need to
> re-add the vlan header. Additionally the socket filter on a pf_packet
> socket needs to behave as though we have a vlan header.
Hmm. Taking a second look the pf_packet code and with hardware vlan
header removal isn't completely broken. It is possible to receive
packet auxdata and get the information from the vlan header.
It stills seems like a pretty messed up interface to me. Especially
since the socket filter can't get at the information in the stripped
vlan header, but that is another matter entirely.
Eric
^ permalink raw reply
* [PATCH 1/3] vlan: Do not support clearing VLAN_FLAG_REORDER_HDR
From: Eric W. Biederman @ 2011-05-22 19:39 UTC (permalink / raw)
To: David Miller
Cc: Jiri Pirko, Nicolas de Pesloüan, Changli Gao, netdev,
shemminger, kaber, fubar, eric.dumazet, andy, Jesse Gross
In-Reply-To: <BANLkTi=4JJa-J-p_JbY1PfooT75KfSB4uA@mail.gmail.com>
Simplify the vlan handling code by not supporing clearing of
VLAN_FLAG_REORDER_HDR. Which means we always make the vlan handling
code strip the vlan header from the packets, and always insert the vlan
header when transmitting packets.
Not stripping the vlan header has alwasy been broken in combination with
vlan hardware accelleration. Now that we are making everything look
like accelerated vlan handling not stripping the vlan header is always
broken.
I don't think anyone actually cares so simply stop supporting the broken
case.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
net/8021q/vlan_dev.c | 3 +--
net/8021q/vlan_netlink.c | 4 +---
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index f247f5b..20629fe 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -242,8 +242,7 @@ int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask)
struct vlan_dev_info *vlan = vlan_dev_info(dev);
u32 old_flags = vlan->flags;
- if (mask & ~(VLAN_FLAG_REORDER_HDR | VLAN_FLAG_GVRP |
- VLAN_FLAG_LOOSE_BINDING))
+ if (mask & ~(VLAN_FLAG_GVRP | VLAN_FLAG_LOOSE_BINDING))
return -EINVAL;
vlan->flags = (old_flags & ~mask) | (flags & mask);
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index be9a5c1..a638a4c 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -59,9 +59,7 @@ static int vlan_validate(struct nlattr *tb[], struct nlattr *data[])
}
if (data[IFLA_VLAN_FLAGS]) {
flags = nla_data(data[IFLA_VLAN_FLAGS]);
- if ((flags->flags & flags->mask) &
- ~(VLAN_FLAG_REORDER_HDR | VLAN_FLAG_GVRP |
- VLAN_FLAG_LOOSE_BINDING))
+ if (flags->mask & ~(VLAN_FLAG_GVRP | VLAN_FLAG_LOOSE_BINDING))
return -EINVAL;
}
--
1.7.5.1.217.g4e3aa
^ permalink raw reply related
* [PATCH 2/3] vlan: Always strip the vlan header in vlan_untag.
From: Eric W. Biederman @ 2011-05-22 19:40 UTC (permalink / raw)
To: David Miller
Cc: Jiri Pirko, Nicolas de Pesloüan, Changli Gao, netdev,
shemminger, kaber, fubar, eric.dumazet, andy, Jesse Gross
In-Reply-To: <m1ei3qjzix.fsf_-_@fess.ebiederm.org>
Calling vlan_dev_info() on a non-vlan device gives completely undefined
results, and is no longer needed now that we no longer support keeping
the vlan tag.
Simplify and correct the code by remove the check for VLAN_FLAG_REORDER_HDR.
Additionally rename vlan_check_reorder_header to just
vlan_reorder_header as there is no check involved now.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
net/8021q/vlan_core.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 41495dc..302d8e3 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -89,17 +89,15 @@ gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
}
EXPORT_SYMBOL(vlan_gro_frags);
-static struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
+static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
{
- if (vlan_dev_info(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) {
- if (skb_cow(skb, skb_headroom(skb)) < 0)
- skb = NULL;
- if (skb) {
- /* Lifted from Gleb's VLAN code... */
- memmove(skb->data - ETH_HLEN,
- skb->data - VLAN_ETH_HLEN, 12);
- skb->mac_header += VLAN_HLEN;
- }
+ if (skb_cow(skb, skb_headroom(skb)) < 0)
+ skb = NULL;
+ if (skb) {
+ /* Lifted from Gleb's VLAN code... */
+ memmove(skb->data - ETH_HLEN,
+ skb->data - VLAN_ETH_HLEN, 12);
+ skb->mac_header += VLAN_HLEN;
}
return skb;
}
@@ -161,7 +159,7 @@ struct sk_buff *vlan_untag(struct sk_buff *skb)
skb_pull_rcsum(skb, VLAN_HLEN);
vlan_set_encap_proto(skb, vhdr);
- skb = vlan_check_reorder_header(skb);
+ skb = vlan_reorder_header(skb);
if (unlikely(!skb))
goto err_free;
--
1.7.5.1.217.g4e3aa
^ permalink raw reply related
* [PATCH 3/3] vlan: Simplify the code now that VLAN_FLAG_REORDER_HDR is always set
From: Eric W. Biederman @ 2011-05-22 19:42 UTC (permalink / raw)
To: David Miller
Cc: Jiri Pirko, Nicolas de Pesloüan, Changli Gao, netdev,
shemminger, kaber, fubar, eric.dumazet, andy, Jesse Gross
In-Reply-To: <m14o4mjzh3.fsf_-_@fess.ebiederm.org>
Now that we no longer support clearing VLAN_FLAG_REORDER_HDR remove the
code that was needed to cope with the case when it was cleared.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
net/8021q/vlan_dev.c | 45 +++++----------------------------------------
1 files changed, 5 insertions(+), 40 deletions(-)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 20629fe..2b3ca1e 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -96,63 +96,28 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
const void *daddr, const void *saddr,
unsigned int len)
{
- struct vlan_hdr *vhdr;
- unsigned int vhdrlen = 0;
- u16 vlan_tci = 0;
int rc;
- if (!(vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR)) {
- vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);
-
- vlan_tci = vlan_dev_info(dev)->vlan_id;
- vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
- vhdr->h_vlan_TCI = htons(vlan_tci);
-
- /*
- * Set the protocol type. For a packet of type ETH_P_802_3/2 we
- * put the length in here instead.
- */
- if (type != ETH_P_802_3 && type != ETH_P_802_2)
- vhdr->h_vlan_encapsulated_proto = htons(type);
- else
- vhdr->h_vlan_encapsulated_proto = htons(len);
-
- skb->protocol = htons(ETH_P_8021Q);
- type = ETH_P_8021Q;
- vhdrlen = VLAN_HLEN;
- }
-
/* Before delegating work to the lower layer, enter our MAC-address */
if (saddr == NULL)
saddr = dev->dev_addr;
/* Now make the underlying real hard header */
dev = vlan_dev_info(dev)->real_dev;
- rc = dev_hard_header(skb, dev, type, daddr, saddr, len + vhdrlen);
- if (rc > 0)
- rc += vhdrlen;
+ rc = dev_hard_header(skb, dev, type, daddr, saddr, len);
return rc;
}
static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev)
{
- struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
unsigned int len;
+ u16 vlan_tci;
int ret;
- /* Handle non-VLAN frames if they are sent to us, for example by DHCP.
- *
- * NOTE: THIS ASSUMES DIX ETHERNET, SPECIFICALLY NOT SUPPORTING
- * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs...
- */
- if (veth->h_vlan_proto != htons(ETH_P_8021Q) ||
- vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR) {
- u16 vlan_tci;
- vlan_tci = vlan_dev_info(dev)->vlan_id;
- vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
- skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
- }
+ vlan_tci = vlan_dev_info(dev)->vlan_id;
+ vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
+ skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
skb_set_dev(skb, vlan_dev_info(dev)->real_dev);
len = skb->len;
--
1.7.5.1.217.g4e3aa
^ permalink raw reply related
* [PATCH net-2.6 1/4] bnx2x: call dev_kfree_skb_any instead of dev_kfree_skb
From: Dmitry Kravkov @ 2011-05-22 20:06 UTC (permalink / raw)
To: davem, netdev@vger.kernel.org; +Cc: Vladislav Zolotarov, Eilon Greenstein
From: Vladislav Zolotarov <vladz@broadcom.com>
replace function calls when possible call in both irq/non-irq contexts
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/bnx2x/bnx2x_cmn.c | 4 ++--
drivers/net/bnx2x/bnx2x_cmn.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index 16581df..9403049 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -87,7 +87,7 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fastpath *fp,
/* release skb */
WARN_ON(!skb);
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
tx_buf->first_bd = 0;
tx_buf->skb = NULL;
@@ -419,7 +419,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
} else {
DP(NETIF_MSG_RX_STATUS, "Failed to allocate new pages"
" - dropping packet!\n");
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
}
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h
index ef37b98..89eb9ca 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/bnx2x/bnx2x_cmn.h
@@ -838,7 +838,7 @@ static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp,
mapping = dma_map_single(&bp->pdev->dev, skb->data, fp->rx_buf_size,
DMA_FROM_DEVICE);
if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
return -ENOMEM;
}
--
1.7.2.2
^ permalink raw reply related
* [PATCH net-2.6 3/4] bnx2x: fix DMAE timeout according to hw specifications
From: Dmitry Kravkov @ 2011-05-22 20:09 UTC (permalink / raw)
To: David Miller, netdev@vger.kernel.org; +Cc: Eilon Greenstein
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/bnx2x/bnx2x_main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 8b27c75..09586e2 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -571,7 +571,7 @@ static int bnx2x_issue_dmae_with_comp(struct bnx2x *bp,
struct dmae_command *dmae)
{
u32 *wb_comp = bnx2x_sp(bp, wb_comp);
- int cnt = CHIP_REV_IS_SLOW(bp) ? (400000) : 40;
+ int cnt = CHIP_REV_IS_SLOW(bp) ? (400000) : 4000;
int rc = 0;
DP(BNX2X_MSG_OFF, "data before [0x%08x 0x%08x 0x%08x 0x%08x]\n",
--
1.7.2.2
^ permalink raw reply related
* [PATCH net-2.6 2/4] bnx2x: properly handle CFC DEL in cnic flow
From: Dmitry Kravkov @ 2011-05-22 20:08 UTC (permalink / raw)
To: netdev@vger.kernel.org, David Miller
Cc: Vladislav Zolotarov, Eilon Greenstein
From: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/bnx2x/bnx2x_main.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index a97a4a1..e237bea 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -3669,7 +3669,8 @@ static int bnx2x_cnic_handle_cfc_del(struct bnx2x *bp, u32 cid,
union event_ring_elem *elem)
{
if (!bp->cnic_eth_dev.starting_cid ||
- cid < bp->cnic_eth_dev.starting_cid)
+ (cid < bp->cnic_eth_dev.starting_cid &&
+ cid != bp->cnic_eth_dev.iscsi_l2_cid))
return 1;
DP(BNX2X_MSG_SP, "got delete ramrod for CNIC CID %d\n", cid);
--
1.7.2.2
^ permalink raw reply related
* [PATCH net-2.6 4/4] bnx2x: allow device properly initialize after hotplug
From: Dmitry Kravkov @ 2011-05-22 20:11 UTC (permalink / raw)
To: netdev@vger.kernel.org, David Miller; +Cc: Eilon Greenstein
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/bnx2x/bnx2x_main.c | 67 ++++++++++++++-------------------------
1 files changed, 24 insertions(+), 43 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 58e30a2..8bfd857 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -7450,51 +7450,35 @@ static inline void bnx2x_mcp_wait_one(struct bnx2x *bp)
msleep(MCP_ONE_TIMEOUT);
}
-static int bnx2x_reset_mcp_comp(struct bnx2x *bp, u32 magic_val)
+/*
+ * initializes bp->common.shmem_base and waits for validity signature to appear
+ */
+static int bnx2x_init_shmem(struct bnx2x *bp)
{
- u32 shmem, cnt, validity_offset, val;
- int rc = 0;
-
- msleep(100);
+ int cnt = 0;
+ u32 val = 0;
- /* Get shmem offset */
- shmem = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR);
- if (shmem == 0) {
- BNX2X_ERR("Shmem 0 return failure\n");
- rc = -ENOTTY;
- goto exit_lbl;
- }
+ do {
+ bp->common.shmem_base = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR);
+ if (bp->common.shmem_base) {
+ val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]);
+ if (val & SHR_MEM_VALIDITY_MB)
+ return 0;
+ }
- validity_offset = offsetof(struct shmem_region, validity_map[0]);
+ bnx2x_mcp_wait_one(bp);
- /* Wait for MCP to come up */
- for (cnt = 0; cnt < (MCP_TIMEOUT / MCP_ONE_TIMEOUT); cnt++) {
- /* TBD: its best to check validity map of last port.
- * currently checks on port 0.
- */
- val = REG_RD(bp, shmem + validity_offset);
- DP(NETIF_MSG_HW, "shmem 0x%x validity map(0x%x)=0x%x\n", shmem,
- shmem + validity_offset, val);
+ } while (cnt++ < (MCP_TIMEOUT / MCP_ONE_TIMEOUT));
- /* check that shared memory is valid. */
- if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
- == (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
- break;
+ BNX2X_ERR("BAD MCP validity signature\n");
- bnx2x_mcp_wait_one(bp);
- }
-
- DP(NETIF_MSG_HW, "Cnt=%d Shmem validity map 0x%x\n", cnt, val);
+ return -ENODEV;
+}
- /* Check that shared memory is valid. This indicates that MCP is up. */
- if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) !=
- (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) {
- BNX2X_ERR("Shmem signature not present. MCP is not up !!\n");
- rc = -ENOTTY;
- goto exit_lbl;
- }
+static int bnx2x_reset_mcp_comp(struct bnx2x *bp, u32 magic_val)
+{
+ int rc = bnx2x_init_shmem(bp);
-exit_lbl:
/* Restore the `magic' bit value */
if (!CHIP_IS_E1(bp))
bnx2x_clp_reset_done(bp, magic_val);
@@ -8007,10 +7991,12 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
BNX2X_DEV_INFO("flash_size 0x%x (%d)\n",
bp->common.flash_size, bp->common.flash_size);
- bp->common.shmem_base = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR);
+ bnx2x_init_shmem(bp);
+
bp->common.shmem2_base = REG_RD(bp, (BP_PATH(bp) ?
MISC_REG_GENERIC_CR_1 :
MISC_REG_GENERIC_CR_0));
+
bp->link_params.shmem_base = bp->common.shmem_base;
bp->link_params.shmem2_base = bp->common.shmem2_base;
BNX2X_DEV_INFO("shmem offset 0x%x shmem2 offset 0x%x\n",
@@ -8022,11 +8008,6 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
return;
}
- val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]);
- if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
- != (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
- BNX2X_ERR("BAD MCP validity signature\n");
-
bp->common.hw_config = SHMEM_RD(bp, dev_info.shared_hw_config.config);
BNX2X_DEV_INFO("hw_config 0x%08x\n", bp->common.hw_config);
--
1.7.2.2
^ permalink raw reply related
* [PATCH net-2.6 0/4] bnx2x fixes
From: Dmitry Kravkov @ 2011-05-22 20:14 UTC (permalink / raw)
To: David Miller
Cc: netdev@vger.kernel.org, Eilon Greenstein, Vladislav Zolotarov
Hello Dave,
Please consider applying following fixes to net-2.6.
Thanks,
Dmitry
^ permalink raw reply
* Re: More prefetch fall-out
From: Paul Gortmaker @ 2011-05-22 21:02 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Eric Dumazet, David Miller, Network Development
In-Reply-To: <BANLkTimQAhP17Hg6D84gtCO3nJ_SSsDAeg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]
On Sun, May 22, 2011 at 2:38 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Sun, May 22, 2011 at 11:23 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>>
>> Taking a look at various skb_queue_walk* call sites, I think prefetches
>> are not a clear win, I would just remove them all from skbuff.h
>
> Hmm.
>
> I did that, and it turns out that we also have:
>
> - *lots* of network drivers that use "prefetch" (without including prefetch.h)
> - net/netlabel/netlabel_addrlist.h doing the same.
>
> and fixing that up is annoying "grunt work".
I just did a cheezy script (embedded in the attached commit) that should
help make the grunt work less annoying by doing a mechanical 1st pass
on fixing the drivers/net ones. Script is tested -- compile isn't (I'm not
currently somewhere that I can do a yesconfig/compile without growing
old waiting for it). Feel free to use the script and scrap the commit, or
whatever makes things easiest for people.
Paul.
>
> So for now, I think I'll just do the "add the <linux/prefetch.h> to
> <linux/skbuff.h>" thing, and leave networking alone. That makes
> everything compile ("allyesconfig") even with my "you *have* to
> include <linux/prefetch.h>" test-patch.
>
> Linus
[-- Attachment #2: 0001-drivers-net-add-prefetch-header-for-prefetch-users.patch --]
[-- Type: text/x-patch, Size: 12121 bytes --]
From e7e542046f621ecc32e4e4f3c3cd3082571bf38f Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Sun, 22 May 2011 16:47:17 -0400
Subject: [PATCH] drivers/net: add prefetch header for prefetch users
After discovering that wide use of prefetch on modern CPUs
could be a net loss instead of a win, net drivers which were
relying on the implicit inclusion of prefetch.h via the list
headers showed up in the resulting cleanup fallout. Give
them an explicit include via the following $0.02 script.
=========================================
#!/bin/bash
MANUAL=""
for i in `git grep -l 'prefetch(.*)' .` ; do
grep -q '<linux/prefetch.h>' $i
if [ $? = 0 ] ; then
continue
fi
( echo '?^#include <linux/?a'
echo '#include <linux/prefetch.h>'
echo .
echo w
echo q
) | ed -s $i > /dev/null 2>&1
if [ $? != 0 ]; then
echo $i needs manual fixup
MANUAL="$i $MANUAL"
fi
done
echo ------------------- 8\<----------------------
echo vi $MANUAL
=========================================
Signed-off-by: Paul <paul.gortmaker@windriver.com>
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 4b5e0ed..a485f7f 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -15,6 +15,7 @@
* Costa Mesa, CA 92626
*/
+#include <linux/prefetch.h>
#include "be.h"
#include "be_cmds.h"
#include <asm/div64.h>
diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c
index e588511..7d25a97 100644
--- a/drivers/net/bna/bnad.c
+++ b/drivers/net/bna/bnad.c
@@ -23,6 +23,7 @@
#include <linux/if_vlan.h>
#include <linux/if_ether.h>
#include <linux/ip.h>
+#include <linux/prefetch.h>
#include "bnad.h"
#include "bna.h"
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index ca2bbc0..64d01e7 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -21,6 +21,7 @@
#include <net/ipv6.h>
#include <net/ip6_checksum.h>
#include <linux/firmware.h>
+#include <linux/prefetch.h>
#include "bnx2x_cmn.h"
#include "bnx2x_init.h"
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index b948ea7..58380d2 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -54,6 +54,7 @@
#include <linux/in.h>
#include <linux/if_arp.h>
#include <linux/slab.h>
+#include <linux/prefetch.h>
#include "cpl5_cmd.h"
#include "sge.h"
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index cde59b4..11a92af 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -27,6 +27,7 @@
#include <linux/delay.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
+#include <linux/prefetch.h>
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#define BCM_VLAN 1
#endif
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index cba1401..3f562ba 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -37,6 +37,7 @@
#include <linux/tcp.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
+#include <linux/prefetch.h>
#include <net/arp.h>
#include "common.h"
#include "regs.h"
diff --git a/drivers/net/cxgb4/sge.c b/drivers/net/cxgb4/sge.c
index 75a4b0f..56adf44 100644
--- a/drivers/net/cxgb4/sge.c
+++ b/drivers/net/cxgb4/sge.c
@@ -39,6 +39,7 @@
#include <linux/ip.h>
#include <linux/dma-mapping.h>
#include <linux/jiffies.h>
+#include <linux/prefetch.h>
#include <net/ipv6.h>
#include <net/tcp.h>
#include "cxgb4.h"
diff --git a/drivers/net/cxgb4vf/sge.c b/drivers/net/cxgb4vf/sge.c
index 5182960..5fd75fd 100644
--- a/drivers/net/cxgb4vf/sge.c
+++ b/drivers/net/cxgb4vf/sge.c
@@ -41,6 +41,7 @@
#include <net/ipv6.h>
#include <net/tcp.h>
#include <linux/dma-mapping.h>
+#include <linux/prefetch.h>
#include "t4vf_common.h"
#include "t4vf_defs.h"
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index c18cb8e..76e8af0 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -29,6 +29,7 @@
#include "e1000.h"
#include <net/ip6_checksum.h>
#include <linux/io.h>
+#include <linux/prefetch.h>
/* Intel Media SOC GbE MDIO physical base address */
static unsigned long ce4100_gbe_mdio_base_phy;
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 0939040..d960056 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -49,6 +49,7 @@
#include <linux/pm_qos_params.h>
#include <linux/pm_runtime.h>
#include <linux/aer.h>
+#include <linux/prefetch.h>
#include "e1000.h"
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index 3810473..fddff8e 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -29,6 +29,7 @@
#ifndef __EHEA_QMR_H__
#define __EHEA_QMR_H__
+#include <linux/prefetch.h>
#include "ehea.h"
#include "ehea_hw.h"
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 3d99b0f..2f433fb 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -35,6 +35,7 @@
#include <linux/ipv6.h>
#include <linux/tcp.h>
#include <linux/rtnetlink.h>
+#include <linux/prefetch.h>
#include <net/ip6_checksum.h>
#include "cq_enet_desc.h"
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index d09e8b0..537b695 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -64,6 +64,7 @@
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
+#include <linux/prefetch.h>
#include <linux/io.h>
#include <asm/irq.h>
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index ce7838e..0ae9352 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -47,6 +47,7 @@
#include <linux/aer.h>
#ifdef CONFIG_IGB_DCA
#include <linux/dca.h>
+#include <linux/prefetch.h>
#endif
#include "igb.h"
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index 1d04ca6..1c77fb3 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -41,6 +41,7 @@
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
+#include <linux/prefetch.h>
#include "igbvf.h"
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 0f681ac..6a130eb 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -28,6 +28,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/prefetch.h>
#include "ixgb.h"
char ixgb_driver_name[] = "ixgb";
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index fa01b0b..08e8e25 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -41,6 +41,7 @@
#include <net/ip6_checksum.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
+#include <linux/prefetch.h>
#include <scsi/fc/fc_fcoe.h>
#include "ixgbe.h"
diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c
index d7ab202..28d3cb2 100644
--- a/drivers/net/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ixgbevf/ixgbevf_main.c
@@ -44,6 +44,7 @@
#include <net/ip6_checksum.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
+#include <linux/prefetch.h>
#include "ixgbevf.h"
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index b1358f7..bf84849 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -65,6 +65,7 @@
#include <linux/io.h>
#include <linux/log2.h>
#include <linux/slab.h>
+#include <linux/prefetch.h>
#include <net/checksum.h>
#include <net/ip.h>
#include <net/tcp.h>
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 828e97c..9ec112c 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -35,6 +35,7 @@
#include <linux/tcp.h>
#include <net/checksum.h>
#include <linux/inet_lro.h>
+#include <linux/prefetch.h>
#include <asm/irq.h>
#include <asm/firmware.h>
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c
index c2476fd..eac3c5c 100644
--- a/drivers/net/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/pch_gbe/pch_gbe_main.c
@@ -20,6 +20,7 @@
#include "pch_gbe.h"
#include "pch_gbe_api.h"
+#include <linux/prefetch.h>
#define DRV_VERSION "1.00"
const char pch_driver_version[] = DRV_VERSION;
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index d495a68..771bb61 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -35,6 +35,7 @@
#include <linux/if_vlan.h>
#include <linux/delay.h>
#include <linux/mm.h>
+#include <linux/prefetch.h>
#include "qla3xxx.h"
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 6c9d124..930ae45 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -38,6 +38,7 @@
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
+#include <linux/prefetch.h>
#include <net/ip6_checksum.h>
#include "qlge.h"
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 04f4e60..ef1ce2e 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -26,6 +26,7 @@
#include <linux/pm_runtime.h>
#include <linux/firmware.h>
#include <linux/pci-aspm.h>
+#include <linux/prefetch.h>
#include <asm/system.h>
#include <asm/io.h>
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 89cfee7..a9a5f5e 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -78,6 +78,7 @@
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/slab.h>
+#include <linux/prefetch.h>
#include <net/tcp.h>
#include <asm/system.h>
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index d96d2f7..68d5042 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -43,6 +43,7 @@
#include <linux/mii.h>
#include <linux/phy.h>
#include <linux/platform_device.h>
+#include <linux/prefetch.h>
#include <asm/cache.h>
#include <asm/io.h>
diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c
index b7dc891..62e4364 100644
--- a/drivers/net/sfc/rx.c
+++ b/drivers/net/sfc/rx.c
@@ -14,6 +14,7 @@
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/udp.h>
+#include <linux/prefetch.h>
#include <net/ip.h>
#include <net/checksum.h>
#include "net_driver.h"
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 52a48cb..f4be5c7 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -44,6 +44,7 @@
#include <linux/mii.h>
#include <linux/slab.h>
#include <linux/dmi.h>
+#include <linux/prefetch.h>
#include <asm/irq.h>
#include "skge.h"
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index e15c4a0..e25e44a 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -45,6 +45,7 @@
#include <linux/if_vlan.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
+#include <linux/prefetch.h>
#include "stmmac.h"
#define STMMAC_RESOURCE_NAME "stmmaceth"
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 7ca51ce..4a55a16 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -47,6 +47,7 @@ static const char *version = "tc35815.c:v" DRV_VERSION "\n";
#include <linux/phy.h>
#include <linux/workqueue.h>
#include <linux/platform_device.h>
+#include <linux/prefetch.h>
#include <asm/io.h>
#include <asm/byteorder.h>
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index fc837cf..8ab870a 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -52,6 +52,7 @@
#include <linux/etherdevice.h>
#include <linux/firmware.h>
#include <linux/net_tstamp.h>
+#include <linux/prefetch.h>
#include "vxge-main.h"
#include "vxge-reg.h"
diff --git a/drivers/net/vxge/vxge-traffic.c b/drivers/net/vxge/vxge-traffic.c
index 2638b8d..f935170 100644
--- a/drivers/net/vxge/vxge-traffic.c
+++ b/drivers/net/vxge/vxge-traffic.c
@@ -12,6 +12,7 @@
* Copyright(c) 2002-2010 Exar Corp.
******************************************************************************/
#include <linux/etherdevice.h>
+#include <linux/prefetch.h>
#include "vxge-traffic.h"
#include "vxge-config.h"
--
1.7.4.5
^ permalink raw reply related
* Re: [PATCH 1/3] vlan: Do not support clearing VLAN_FLAG_REORDER_HDR
From: Ben Greear @ 2011-05-22 21:04 UTC (permalink / raw)
To: Eric W. Biederman
Cc: David Miller, Jiri Pirko, Nicolas de Pesloüan, Changli Gao,
netdev, shemminger, kaber, fubar, eric.dumazet, andy, Jesse Gross
In-Reply-To: <m1ei3qjzix.fsf_-_@fess.ebiederm.org>
On 05/22/2011 12:39 PM, Eric W. Biederman wrote:
>
> Simplify the vlan handling code by not supporing clearing of
> VLAN_FLAG_REORDER_HDR. Which means we always make the vlan handling
> code strip the vlan header from the packets, and always insert the vlan
> header when transmitting packets.
>
> Not stripping the vlan header has alwasy been broken in combination with
> vlan hardware accelleration. Now that we are making everything look
> like accelerated vlan handling not stripping the vlan header is always
> broken.
>
> I don't think anyone actually cares so simply stop supporting the broken
> case.
I've lost track of the VLAN code a bit. Is there any documentation
somewhere about what happens in these various cases:
* Open a raw packet socket on eth0.
* Do we get tagged VLAN packets? (I'd expect yes.)
* If we sent a tagged VLAN packet, it's sent without modification? (I'd expect yes.)
** Without "yes" to the two above, one cannot do user-space bridging properly.
* Open a raw packet socket on VLAN eth0.5
* Do we get tagged VLAN packets? (I'd expect no.)
* If we send an un-tagged packet, I expect it would be tagged?
* What if we sent a tagged packet with same VID?
* With different VID?
Many years ago we supported the REORDER, but we suggested disabling
it for most users because it was a performance drag. Funny that now
it seems to be the opposite!
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* [PATCH 1/5] caif: Bugfix add check NULL pointer before calling functions.
From: Sjur Brændeland @ 2011-05-22 21:18 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: Sjur Brændeland
Add check on layer->dn != NULL before calling functions in
layer below.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
net/caif/cfctrl.c | 35 ++++++++++++++++++++++++++---------
1 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c
index 0c00a60..f8ac313 100644
--- a/net/caif/cfctrl.c
+++ b/net/caif/cfctrl.c
@@ -178,20 +178,23 @@ static void init_info(struct caif_payload_info *info, struct cfctrl *cfctrl)
void cfctrl_enum_req(struct cflayer *layer, u8 physlinkid)
{
struct cfctrl *cfctrl = container_obj(layer);
- int ret;
struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
+ struct cflayer *dn = cfctrl->serv.layer.dn;
if (!pkt) {
pr_warn("Out of memory\n");
return;
}
+ if (!dn) {
+ pr_debug("not able to send enum request\n");
+ return;
+ }
caif_assert(offsetof(struct cfctrl, serv.layer) == 0);
init_info(cfpkt_info(pkt), cfctrl);
cfpkt_info(pkt)->dev_info->id = physlinkid;
cfctrl->serv.dev_info.id = physlinkid;
cfpkt_addbdy(pkt, CFCTRL_CMD_ENUM);
cfpkt_addbdy(pkt, physlinkid);
- ret =
- cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt);
+ dn->transmit(dn, pkt);
}
int cfctrl_linkup_request(struct cflayer *layer,
@@ -206,6 +209,12 @@ int cfctrl_linkup_request(struct cflayer *layer,
int ret;
char utility_name[16];
struct cfpkt *pkt;
+ struct cflayer *dn = cfctrl->serv.layer.dn;
+
+ if (!dn) {
+ pr_debug("not able to send linkup request\n");
+ return -ENODEV;
+ }
if (cfctrl_cancel_req(layer, user_layer) > 0) {
/* Slight Paranoia, check if already connecting */
@@ -282,7 +291,7 @@ int cfctrl_linkup_request(struct cflayer *layer,
*/
cfpkt_info(pkt)->dev_info->id = param->phyid;
ret =
- cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt);
+ dn->transmit(dn, pkt);
if (ret < 0) {
int count;
@@ -301,15 +310,23 @@ int cfctrl_linkdown_req(struct cflayer *layer, u8 channelid,
int ret;
struct cfctrl *cfctrl = container_obj(layer);
struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
+ struct cflayer *dn = cfctrl->serv.layer.dn;
+
if (!pkt) {
pr_warn("Out of memory\n");
return -ENOMEM;
}
+
+ if (!dn) {
+ pr_debug("not able to send link-down request\n");
+ return -ENODEV;
+ }
+
cfpkt_addbdy(pkt, CFCTRL_CMD_LINK_DESTROY);
cfpkt_addbdy(pkt, channelid);
init_info(cfpkt_info(pkt), cfctrl);
ret =
- cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt);
+ dn->transmit(dn, pkt);
#ifndef CAIF_NO_LOOP
cfctrl->loop_linkused[channelid] = 0;
#endif
@@ -477,7 +494,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)
cfpkt_extr_head(pkt, ¶m, len);
break;
default:
- pr_warn("Request setup - invalid link type (%d)\n",
+ pr_warn("Request setup, invalid type (%d)\n",
serv);
goto error;
}
@@ -489,7 +506,8 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)
if (CFCTRL_ERR_BIT == (CFCTRL_ERR_BIT & cmdrsp) ||
cfpkt_erroneous(pkt)) {
- pr_err("Invalid O/E bit or parse error on CAIF control channel\n");
+ pr_err("Invalid O/E bit or parse error "
+ "on CAIF control channel\n");
cfctrl->res.reject_rsp(cfctrl->serv.layer.up,
0,
req ? req->client_layer
@@ -550,9 +568,8 @@ static void cfctrl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
case _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND:
case CAIF_CTRLCMD_FLOW_OFF_IND:
spin_lock_bh(&this->info_list_lock);
- if (!list_empty(&this->list)) {
+ if (!list_empty(&this->list))
pr_debug("Received flow off in control layer\n");
- }
spin_unlock_bh(&this->info_list_lock);
break;
case _CAIF_CTRLCMD_PHYIF_DOWN_IND: {
--
1.7.0.4
^ permalink raw reply related
* [PATCH 3/5] caif: Fix freezes when running CAIF loopback device
From: Sjur Brændeland @ 2011-05-22 21:18 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: Sjur Brændeland
In-Reply-To: <1306099134-12989-1-git-send-email-sjur.brandeland@stericsson.com>
Fix spinlock bugs when running out of link-ids in loopback tests and
avoid allocating link-id when error is set in link-setup-response.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
net/caif/cfctrl.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c
index f8ac313..e22671b 100644
--- a/net/caif/cfctrl.c
+++ b/net/caif/cfctrl.c
@@ -368,7 +368,8 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)
cfpkt_extr_head(pkt, &cmdrsp, 1);
cmd = cmdrsp & CFCTRL_CMD_MASK;
if (cmd != CFCTRL_CMD_LINK_ERR
- && CFCTRL_RSP_BIT != (CFCTRL_RSP_BIT & cmdrsp)) {
+ && CFCTRL_RSP_BIT != (CFCTRL_RSP_BIT & cmdrsp)
+ && CFCTRL_ERR_BIT != (CFCTRL_ERR_BIT & cmdrsp)) {
if (handle_loop(cfctrl, cmd, pkt) != 0)
cmdrsp |= CFCTRL_ERR_BIT;
}
@@ -604,16 +605,16 @@ static int handle_loop(struct cfctrl *ctrl, int cmd, struct cfpkt *pkt)
case CFCTRL_CMD_LINK_SETUP:
spin_lock_bh(&ctrl->loop_linkid_lock);
if (!dec) {
- for (linkid = last_linkid + 1; linkid < 255; linkid++)
+ for (linkid = last_linkid + 1; linkid < 254; linkid++)
if (!ctrl->loop_linkused[linkid])
goto found;
}
dec = 1;
- for (linkid = last_linkid - 1; linkid > 0; linkid--)
+ for (linkid = last_linkid - 1; linkid > 1; linkid--)
if (!ctrl->loop_linkused[linkid])
goto found;
spin_unlock_bh(&ctrl->loop_linkid_lock);
-
+ return -1;
found:
if (linkid < 10)
dec = 0;
--
1.7.0.4
^ permalink raw reply related
* [PATCH 4/5] caif: Update documentation of CAIF transmit and receive functions.
From: Sjur Brændeland @ 2011-05-22 21:18 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: Sjur Brændeland
In-Reply-To: <1306099134-12989-1-git-send-email-sjur.brandeland@stericsson.com>
Trivial patch updating documentation in header files only.
Error handling of CAIF transmit errors was changed by commit:
caif: Don't resend if dev_queue_xmit fails.
This patch updates the documentation accordingly.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
Hi Dave.
[David Miller]
>net/caif/cfctrl.c:cfctrl_enum_req() does not check the return value of
>the ->transmit() method.
>
>The documentation for this method states that one error, ownership
>of the packet is transferred back to the caller, which means that we
>have a leak here.
>
>Please fix this bug.
In this case the documentation is buggy, Error handling was of
transmit errors was changed the April 11th by commit
"caif: Don't resend if dev_queue_xmit fails", but documentation was not
updated.
I'm sorry about this slip-up.
Regards,
Sjur
include/net/caif/caif_layer.h | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
index c8b07a9..35bc788 100644
--- a/include/net/caif/caif_layer.h
+++ b/include/net/caif/caif_layer.h
@@ -15,7 +15,6 @@ struct cfpktq;
struct caif_payload_info;
struct caif_packet_funcs;
-
#define CAIF_LAYER_NAME_SZ 16
/**
@@ -33,7 +32,6 @@ do { \
} \
} while (0)
-
/**
* enum caif_ctrlcmd - CAIF Stack Control Signaling sent in layer.ctrlcmd().
*
@@ -141,7 +139,7 @@ enum caif_direction {
* - All layers must use this structure. If embedding it, then place this
* structure first in the layer specific structure.
*
- * - Each layer should not depend on any others layer private data.
+ * - Each layer should not depend on any others layer's private data.
*
* - In order to send data upwards do
* layer->up->receive(layer->up, packet);
@@ -155,16 +153,23 @@ struct cflayer {
struct list_head node;
/*
- * receive() - Receive Function.
+ * receive() - Receive Function (non-blocking).
* Contract: Each layer must implement a receive function passing the
* CAIF packets upwards in the stack.
* Packet handling rules:
- * - The CAIF packet (cfpkt) cannot be accessed after
- * passing it to the next layer using up->receive().
+ * - The CAIF packet (cfpkt) ownership is passed to the
+ * called receive function. This means that the the
+ * packet cannot be accessed after passing it to the
+ * above layer using up->receive().
+ *
* - If parsing of the packet fails, the packet must be
- * destroyed and -1 returned from the function.
+ * destroyed and negative error code returned
+ * from the function.
+ * EXCEPTION: If the framing layer (cffrml) returns
+ * -EILSEQ, the packet is not freed.
+ *
* - If parsing succeeds (and above layers return OK) then
- * the function must return a value > 0.
+ * the function must return a value >= 0.
*
* Returns result < 0 indicates an error, 0 or positive value
* indicates success.
@@ -176,7 +181,7 @@ struct cflayer {
int (*receive)(struct cflayer *layr, struct cfpkt *cfpkt);
/*
- * transmit() - Transmit Function.
+ * transmit() - Transmit Function (non-blocking).
* Contract: Each layer must implement a transmit function passing the
* CAIF packet downwards in the stack.
* Packet handling rules:
@@ -185,15 +190,16 @@ struct cflayer {
* cannot be accessed after passing it to the below
* layer using dn->transmit().
*
- * - If transmit fails, however, the ownership is returned
- * to thecaller. The caller of "dn->transmit()" must
- * destroy or resend packet.
+ * - Upon error the packet ownership is still passed on,
+ * so the packet shall be freed where error is detected.
+ * Callers of the transmit function shall not free packets,
+ * but errors shall be returned.
*
* - Return value less than zero means error, zero or
* greater than zero means OK.
*
- * result < 0 indicates an error, 0 or positive value
- * indicate success.
+ * Returns result < 0 indicates an error, 0 or positive value
+ * indicates success.
*
* @layr: Pointer to the current layer the receive function
* isimplemented for (this pointer).
@@ -202,7 +208,7 @@ struct cflayer {
int (*transmit) (struct cflayer *layr, struct cfpkt *cfpkt);
/*
- * cttrlcmd() - Control Function upwards in CAIF Stack.
+ * cttrlcmd() - Control Function upwards in CAIF Stack (non-blocking).
* Used for signaling responses (CAIF_CTRLCMD_*_RSP)
* and asynchronous events from the modem (CAIF_CTRLCMD_*_IND)
*
--
1.7.0.4
^ permalink raw reply related
* [PATCH 5/5] caif: Plug memory leak for checksum error
From: Sjur Brændeland @ 2011-05-22 21:18 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: Sjur Brændeland
In-Reply-To: <1306099134-12989-1-git-send-email-sjur.brandeland@stericsson.com>
In case of checksum error, the framing layer returns -EILSEQ, but
does not free the packet. Plug this hole by freeing the packet if
-EILSEQ is returned.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
net/caif/caif_dev.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index 366ca0f..682c0fe 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -142,6 +142,7 @@ static int receive(struct sk_buff *skb, struct net_device *dev,
{
struct cfpkt *pkt;
struct caif_device_entry *caifd;
+ int err;
pkt = cfpkt_fromnative(CAIF_DIR_IN, skb);
@@ -159,7 +160,11 @@ static int receive(struct sk_buff *skb, struct net_device *dev,
caifd_hold(caifd);
rcu_read_unlock();
- caifd->layer.up->receive(caifd->layer.up, pkt);
+ err = caifd->layer.up->receive(caifd->layer.up, pkt);
+
+ /* For -EILSEQ the packet is not freed so so it now */
+ if (err == -EILSEQ)
+ cfpkt_destroy(pkt);
/* Release reference to stack upwards */
caifd_put(caifd);
--
1.7.0.4
^ permalink raw reply related
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