* Re: TUN problems (regression?)
From: Eric Dumazet @ 2012-12-21 3:39 UTC (permalink / raw)
To: Jason Wang; +Cc: Stephen Hemminger, Paul Moore, netdev
In-Reply-To: <50D3D85B.1070605@redhat.com>
On Fri, 2012-12-21 at 11:32 +0800, Jason Wang wrote:
> On 12/21/2012 07:50 AM, Stephen Hemminger wrote:
> > On Thu, 20 Dec 2012 15:38:17 -0800
> > Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> >> On Thu, 2012-12-20 at 18:16 -0500, Paul Moore wrote:
> >>> [CC'ing netdev in case this is a known problem I just missed ...]
> >>>
> >>> Hi Jason,
> >>>
> >>> I started doing some more testing with the multiqueue TUN changes and I ran
> >>> into a problem when running tunctl: running it once w/o arguments works as
> >>> expected, but running it a second time results in failure and a
> >>> kmem_cache_sanity_check() failure. The problem appears to be very repeatable
> >>> on my test VM and happens independent of the LSM/SELinux fixup patches.
> >>>
> >>> Have you seen this before?
> >>>
> >> Obviously code in tun_flow_init() is wrong...
> >>
> >> static int tun_flow_init(struct tun_struct *tun)
> >> {
> >> int i;
> >>
> >> tun->flow_cache = kmem_cache_create("tun_flow_cache",
> >> sizeof(struct tun_flow_entry), 0, 0,
> >> NULL);
> >> if (!tun->flow_cache)
> >> return -ENOMEM;
> >> ...
> >> }
> >>
> >>
> >> I have no idea why we would need a kmem_cache per tun_struct,
> >> and why we even need a kmem_cache.
> > Normally flow malloc/free should be good enough.
> > It might make sense to use private kmem_cache if doing hlist_nulls.
> >
> >
> > Acked-by: Stephen Hemminger <shemminger@vyatta.com>
>
> Should be at least a global cache, I thought I can get some speed-up by
> using kmem_cache.
>
> Acked-by: Jason Wang <jasowang@redhat.com>
Was it with SLUB or SLAB ?
Using generic kmalloc-64 is better than a dedicated kmem_cache of 48
bytes per object, as we guarantee each object is on a single cache line.
^ permalink raw reply
* Re: [PATCH] net: ipv4: route: fixed a coding style issues net: ipv4: tcp: fixed a coding style issues
From: David Miller @ 2012-12-21 3:53 UTC (permalink / raw)
To: hasko.stevo; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1355990910-3688-1-git-send-email-hasko.stevo@gmail.com>
I'm definitely not applying this, sorry.
^ permalink raw reply
* Re: [PATCH] net: ipv4: route: fix coding style issues net: ipv4: tcp: fix coding style issues
From: David Miller @ 2012-12-21 3:58 UTC (permalink / raw)
To: hasko.stevo; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1356013685-31649-1-git-send-email-hasko.stevo@gmail.com>
From: Stefan Hasko <hasko.stevo@gmail.com>
Date: Thu, 20 Dec 2012 15:28:05 +0100
> Fix a coding style issues.
>
> Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
Again, I am absolutely not applying a whole-sale coding
style patch to this file.
Do not submit this patch again, regardless of what other
feedback you might have gotten.
^ permalink raw reply
* Re: [PATCH] net: ipv4: route: fixed a coding style issues net: ipv4: tcp: fixed a coding style issues
From: David Miller @ 2012-12-21 3:59 UTC (permalink / raw)
To: erdnetdev
Cc: nicolas.dichtel, hasko.stevo, kuznet, jmorris, yoshfuji, kaber,
netdev, linux-kernel
In-Reply-To: <1356017039.21834.2819.camel@edumazet-glaptop>
From: Eric Dumazet <erdnetdev@gmail.com>
Date: Thu, 20 Dec 2012 07:23:59 -0800
> Such "coding style" patches are a real pain when trying to fix bugs,
> especially dealing with stable/old kernels.
Totally agreed, and I refuse to apply such patches.
^ permalink raw reply
* Re: TUN problems (regression?)
From: Jason Wang @ 2012-12-21 4:26 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Stephen Hemminger, Paul Moore, netdev
In-Reply-To: <1356061179.21834.4515.camel@edumazet-glaptop>
On 12/21/2012 11:39 AM, Eric Dumazet wrote:
> On Fri, 2012-12-21 at 11:32 +0800, Jason Wang wrote:
>> On 12/21/2012 07:50 AM, Stephen Hemminger wrote:
>>> On Thu, 20 Dec 2012 15:38:17 -0800
>>> Eric Dumazet <eric.dumazet@gmail.com> wrote:
>>>
>>>> On Thu, 2012-12-20 at 18:16 -0500, Paul Moore wrote:
>>>>> [CC'ing netdev in case this is a known problem I just missed ...]
>>>>>
>>>>> Hi Jason,
>>>>>
>>>>> I started doing some more testing with the multiqueue TUN changes and I ran
>>>>> into a problem when running tunctl: running it once w/o arguments works as
>>>>> expected, but running it a second time results in failure and a
>>>>> kmem_cache_sanity_check() failure. The problem appears to be very repeatable
>>>>> on my test VM and happens independent of the LSM/SELinux fixup patches.
>>>>>
>>>>> Have you seen this before?
>>>>>
>>>> Obviously code in tun_flow_init() is wrong...
>>>>
>>>> static int tun_flow_init(struct tun_struct *tun)
>>>> {
>>>> int i;
>>>>
>>>> tun->flow_cache = kmem_cache_create("tun_flow_cache",
>>>> sizeof(struct tun_flow_entry), 0, 0,
>>>> NULL);
>>>> if (!tun->flow_cache)
>>>> return -ENOMEM;
>>>> ...
>>>> }
>>>>
>>>>
>>>> I have no idea why we would need a kmem_cache per tun_struct,
>>>> and why we even need a kmem_cache.
>>> Normally flow malloc/free should be good enough.
>>> It might make sense to use private kmem_cache if doing hlist_nulls.
>>>
>>>
>>> Acked-by: Stephen Hemminger <shemminger@vyatta.com>
>> Should be at least a global cache, I thought I can get some speed-up by
>> using kmem_cache.
>>
>> Acked-by: Jason Wang <jasowang@redhat.com>
> Was it with SLUB or SLAB ?
>
> Using generic kmalloc-64 is better than a dedicated kmem_cache of 48
> bytes per object, as we guarantee each object is on a single cache line.
>
>
Right, thanks for the explanation.
^ permalink raw reply
* Re: [PATCH net-next V4 03/13] bridge: Validate that vlan is permitted on ingress
From: Shmulik Ladkani @ 2012-12-21 4:48 UTC (permalink / raw)
To: vyasevic; +Cc: netdev, shemminger, davem, or.gerlitz, jhs, mst, erdnetdev, jiri
In-Reply-To: <50D331A8.3080206@redhat.com>
On Thu, 20 Dec 2012 10:41:28 -0500 Vlad Yasevich <vyasevic@redhat.com> wrote:
> >> +static bool br_allowed_ingress(struct net_bridge_port *p, struct sk_buff *skb)
> >> +{
> >> + struct net_port_vlan *pve;
> >> + u16 vid;
> >> +
> >> + /* If there are no vlan in the permitted list, all packets are
> >> + * permitted.
> >> + */
> >> + if (list_empty(&p->vlan_list))
> >> + return true;
> >> + if (!br_allowed_ingress(p, skb))
> >> + goto drop;
> >> +
> >
> > This condition should be also encorporated upon "ingress" at the "bridge
> > master port" (that is, early at br_dev_xmit).
> > Think of the "bridge master port" as yet another port:
> > upon "ingress" (meaning, tx packets from the ip stack), we should
> > also enforce any ingress permission rules.
> >
>
> I've tried that before and now can't think of a reason why I rejected
> it. I'll try to remember...
(Current code does not allow you to put the test into 'br_dev_xmit',
since br_allow_ingress expects an 'nbp' as its 1st argument, and the
"master port" is not represented as an 'nbp')
But this is a must. The "master port" shouldn't be treated differently
with respect to vlan ingress/egress membership verifications.
Take for example why egress membership verification is important:
m
|
+----+----+
| |
p1 p2
p1 expects "normal" (untagged) traffic, and should be connected with the
IP stack (master port 'm'), but not leak to p2.
Traffic of some specific service, marked with VLAN 2, arrives at p2 and
should be forwardable with p1 (keeping the tag), but should not go to
the IP stack.
p1 pvid: 1
m pvid: 1
vlan 1 membership map: p1 m
vlan 1 egress policy map: U U
vlan 2 membership map: p1 p2
vlan 2 egress policy map: T T
If you don't verify membership upon egress towards IP stack (at the
"master port"), VLAN 2 packets from p2 will leak into the stack.
Regards,
Shmulik
^ permalink raw reply
* [RFC] IP_MAX_MTU value
From: Eric Dumazet @ 2012-12-21 6:47 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Rick Jones
Hi David
We have the following definition in net/ipv4/route.c
#define IP_MAX_MTU 0xFFF0
This means that "netperf -t UDP_STREAM", using UDP messages of 65507
bytes, are fragmented on loopback interface (while its MTU is now 65536
and should allow those UDP messages being sent without fragments)
I guess Rick chose 65507 bytes in netperf because it was related to the
max IPv4 datagram length :
65507 + 28 = 65535
Changing IP_MAX_MTU from 0xFFF0 to 0x10000 seems safe [1], but I might
miss something really obvious ?
It might be because in old days we reserved 16 bytes for the ethernet
header, and we wanted to avoid kmalloc() round-up to kmalloc-131072
slab ?
If so, we certainly can limit skb->head to 32 or 64 KB and complete with
page fragments the remaining space.
Thanks
[1] performance increase is ~50%
^ permalink raw reply
* Re: [RFC] IP_MAX_MTU value
From: Eric Dumazet @ 2012-12-21 7:08 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Rick Jones
In-Reply-To: <1356072468.21834.4805.camel@edumazet-glaptop>
On Thu, 2012-12-20 at 22:47 -0800, Eric Dumazet wrote:
> It might be because in old days we reserved 16 bytes for the ethernet
> header, and we wanted to avoid kmalloc() round-up to kmalloc-131072
> slab ?
Well, we add the struct skb_shared_info anyway, so we hit kmalloc-131072
with current IP_MAX_MTU value...
^ permalink raw reply
* INVESTMENT ASSISTANCE
From: Thabopeter @ 2012-12-21 8:24 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 67 bytes --]
Good Day Kindly Open The Attachment File
[-- Attachment #2: INVESTMENT ASSISTANCE.doc --]
[-- Type: application/msword, Size: 48640 bytes --]
^ permalink raw reply
* INVESTMENT ASSISTANCE
From: Thabopeter @ 2012-12-21 8:25 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 67 bytes --]
Good Day Kindly Open The Attachment File
[-- Attachment #2: INVESTMENT ASSISTANCE.doc --]
[-- Type: application/msword, Size: 48640 bytes --]
^ permalink raw reply
* Re: [PATCH 4/4] net/smsc911x: Provide common clock functionality
From: Lee Jones @ 2012-12-21 9:13 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Steve Glendinning, Robert Marklund, linus.walleij, arnd, netdev,
Linus Walleij, linux-kernel, linux-arm-kernel
In-Reply-To: <20121220205113.GD14363@n2100.arm.linux.org.uk>
On Thu, 20 Dec 2012, Russell King - ARM Linux wrote:
> On Thu, Dec 20, 2012 at 08:35:14PM +0000, Lee Jones wrote:
> > On Thu, 20 Dec 2012, Russell King - ARM Linux wrote:
> >
> > > On Thu, Dec 20, 2012 at 08:12:08PM +0100, Linus Walleij wrote:
> > > > On Wed, Dec 19, 2012 at 6:19 PM, Lee Jones <lee.jones@linaro.org> wrote:
> > > >
> > > > > Some platforms provide clocks which require enabling before the
> > > > > SMSC911x chip will power on. This patch uses the new common clk
> > > > > framework to do just that. If no clock is provided, it will just
> > > > > be ignored and the driver will continue to assume that no clock
> > > > > is required for the chip to run successfully.
> > > > >
> > > > > Cc: Steve Glendinning <steve.glendinning@shawell.net>
> > > > > Cc: netdev@vger.kernel.org
> > > > > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > > >
> > > > Seems to me like it'll do the trick.
> > > > Acked-by: Linus Walleij <linus.walleij@linaro.org>
> > >
> > > This looks fairly dangerous. What about those platforms which use this
> > > driver, but don't provide a clock for it?
> > >
> > > It looks like this will result in those platforms losing their ethernet
> > > support. There's at least a bunch of the ARM evaluation boards which
> > > make use of this driver...
> >
> > Right, but nothing should regress. If no clock is provided the driver
> > moves on during the request and will refuse to prepare, enable and
> > disable there after.
> >
> > Unless I've made a mistake somewhere? If so, I'd be happy to fixup.
>
> No, but... don't use NULL for that. Use IS_ERR(pdata->clk) instead.
I'm a bit confused. I do use IS_ERR, then if there was a problem
pdata->clk is set to NULL, then we test for NULL thereafter:
> /* Request clock */
> pdata->clk = clk_get(&pdev->dev, NULL);
> if (IS_ERR(pdata->clk)) {
> netdev_warn(ndev, "couldn't get clock %d\n", PTR_ERR(pdata->clk));
> pdata->clk = NULL;
> }
Are you saying remove "pdata->clk = NULL;" and test for IS_ERR
every time?
--
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 4/4] net/smsc911x: Provide common clock functionality
From: Russell King - ARM Linux @ 2012-12-21 9:24 UTC (permalink / raw)
To: Lee Jones
Cc: Linus Walleij, Steve Glendinning, Robert Marklund, linus.walleij,
arnd, netdev, linux-kernel, linux-arm-kernel
In-Reply-To: <20121221091306.GO2691@gmail.com>
On Fri, Dec 21, 2012 at 09:13:06AM +0000, Lee Jones wrote:
> Are you saying remove "pdata->clk = NULL;" and test for IS_ERR
> every time?
Exactly.
^ permalink raw reply
* Re: PMTU discovery is broken on kernel 3.7.1 for UDP sockets
From: Steffen Klassert @ 2012-12-21 10:22 UTC (permalink / raw)
To: Yurij M. Plotnikov; +Cc: Ben Hutchings, netdev, Alexandra N. Kossovsky
In-Reply-To: <20121220123535.GN18940@secunet.com>
On Thu, Dec 20, 2012 at 01:35:35PM +0100, Steffen Klassert wrote:
> On Thu, Dec 20, 2012 at 03:22:13PM +0400, Yurij M. Plotnikov wrote:
> > On 12/20/12 11:34, Steffen Klassert wrote:
> > >
> > >diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
> > >index 3c9d208..1049ce0 100644
> > >--- a/net/ipv4/ip_sockglue.c
> > >+++ b/net/ipv4/ip_sockglue.c
> > >@@ -1198,7 +1198,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
> > > {
> > > struct dst_entry *dst;
> > > val = 0;
> > >- dst = sk_dst_get(sk);
> > >+ dst = sk_dst_check(sk, 0);
> > > if (dst) {
> > > val = dst_mtu(dst);
> > > dst_release(dst);
> > With this patch kernel 3.7.1 works perfect. All described problems
> > are fixed.
>
> Thanks for testing!
>
> I'm not sure if we can't use this as a fix. I think with this patch it
> could happen that we return -ENOTCONN instead of a pmtu value on a
> connected socket. Perhaps it is better to update the cached dst_entry in
> ipv4_sk_update_pmtu() when we receive the -EMSGSIZE. I'll do some
> investigation.
>
It turned out that updating the cached dst_entry in ipv4_sk_update_pmtu()
is not trivial. We need to implement proper socket locking and we need
socket release calback functions for all protocols that use
ipv4_sk_update_pmtu(), similar to tcp.
Today is my last office day for this year, so we probably have to defer
a solution to the next year.
Thanks.
^ permalink raw reply
* Re: [PATCH] xen/netfront: improve truesize tracking
From: Sander Eikelenboom @ 2012-12-21 11:21 UTC (permalink / raw)
To: Eric Dumazet
Cc: Ian Campbell, netdev@vger.kernel.org, Konrad Rzeszutek Wilk,
annie li, xen-devel@lists.xensource.com
In-Reply-To: <1356017968.21834.2859.camel@edumazet-glaptop>
Thursday, December 20, 2012, 4:39:28 PM, you wrote:
> On Thu, 2012-12-20 at 13:51 +0100, Sander Eikelenboom wrote:
>> Eric:
>> From the warn_on_once, delta should be smaller than len, but probably they should be as close together as possible.
>> When you say "accurate estimation", what would be a acceptable difference between DELTA and LEN ?
> I would use the most exact value, which is :
> skb->truesize += nr_frags * PAGE_SIZE;
> Then, if we can spot later a regression in some stacks, adapt the
> limiting parameters. I did a lot of work in GRO and TCP stack to reduce
> the memory, and further changes are possible.
> We really want to account memory, because we want to control how memory
> is used on our machines and don't let some users use more than the
> amount that was allowed to them.
Hi Eric and Ian,
I have ran some perfnet tests (although i'm not an expert, so i'm not sure i have done the right tests).
I you have better tests, please do say so ..
"current" is with netfront as is (skb->truesize += skb->data_len - RX_COPY_THRESHOLD;)
"patched" is with IanC's latest patch (skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags;)
Tested between domU and dom0 (bridged) on a system with only one guest. The results don't seem to differ very much.
+ netperf -H 192.168.1.1 -t TCP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. KBytes/sec
current 87380 16384 16384 60.00 954438.38
patched 87380 16384 16384 60.00 975236.19
+ netperf -H 192.168.1.1 -t TCP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2 -- -s 50
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. KBytes/sec
current 87380 2048 2048 60.00 17614.79
patched 87380 2048 2048 60.00 17207.46
+ netperf -H 192.168.1.1 -t TCP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2 -- -s 50 -M 1432 -m 1432
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. KBytes/sec
current 87380 2048 1432 60.00 35.28
patched 87380 2048 1432 60.00 35.28
+ netperf -H 192.168.1.1 -t TCP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2 -- -s 9000
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. KBytes/sec
current 87380 18000 18000 60.00 157762.45
patched 87380 18000 18000 60.00 158606.02
+ netperf -H 192.168.1.1 -t TCP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2 -- -s 9000 -M 1432 -m 1432
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. KBytes/sec
current 87380 18000 1432 60.00 78567.39
patched 87380 18000 1432 60.00 78329.98
+ netperf -H 192.168.1.1 -t UDP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # KBytes/sec
current 212992 65507 60.00 248771 0 265238.24
current 212992 60.00 214267 228450.01
patched 212992 65507 60.00 251188 0 267814.90
patched 212992 60.00 235101 250662.67
+ netperf -H 192.168.1.1 -t UDP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2 -- -s 50
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # KBytes/sec
current 2048 2048 60.00 1329653 0 44321.73
current 212992 60.00 1329650 44321.62
patched 2048 2048 60.00 1363257 0 45441.68
patched 212992 60.00 1363253 45441.57
+ netperf -H 192.168.1.1 -t UDP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2 -- -s 50 -M 1432 -m 1432
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # KBytes/sec
current 2048 1432 60.00 1516249 0 35339.61
current 212992 60.00 1516247 35339.56
patched 2048 1432 60.00 1483705 0 34581.11
patched 212992 60.00 1483701 34581.01
+ netperf -H 192.168.1.1 -t UDP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2 -- -s 9000
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # KBytes/sec
current 18000 18000 60.00 540410 26 158322.98
current 212992 60.00 540349 158305.24
patched 18000 18000 60.00 555449 32 162728.98
patched 212992 60.00 555392 162712.28
+ netperf -H 192.168.1.1 -t UDP_STREAM -fK -i10,5 -l 60 -I95,5 -P1 -v2 -- -s 9000 -M 1432 -m 1432
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # KBytes/sec
current 18000 1432 60.00 5144189 0 119896.95
current 212992 60.00 5138354 119760.96
patched 18000 1432 60.00 5104540 0 118972.85
patched 212992 60.00 5099802 118862.44
^ permalink raw reply
* Re: bonding driver - how to recognize the active slave
From: Jiri Pirko @ 2012-12-21 11:34 UTC (permalink / raw)
To: Or Gerlitz; +Cc: Eric Dumazet, Erez Shitrit, netdev@vger.kernel.org
In-Reply-To: <CAJZOPZLOj2QCWN75hAsQnmB=YiSGRhdhzf4ODhAD-QoU+Y0ZGg@mail.gmail.com>
Thu, Dec 20, 2012 at 11:21:00PM CET, or.gerlitz@gmail.com wrote:
>On Thu, Dec 20, 2012 at 11:19 PM, Eric Dumazet <erdnetdev@gmail.com> wrote:
>> cat /sys/class/net/bond0/bonding/active_slave
>
>sure, I think Erez would like to know that from within a network
>device kernel code, e.g maybe register to netdev kernel events and on
>the event of bonding fail-over identify the active slave for
>active-backup mode, etc.
I wonder why device should care of such thing? Would it behave
differently?
>
>Or.
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH 4/4 v2] net/smsc911x: Provide common clock functionality
From: Lee Jones @ 2012-12-21 11:41 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Linus Walleij, Steve Glendinning, Robert Marklund, linus.walleij,
arnd, netdev, linux-kernel, linux-arm-kernel
In-Reply-To: <20121221092421.GG14363@n2100.arm.linux.org.uk>
Some platforms provide clocks which require enabling before the
SMSC911x chip will power on. This patch uses the new common clk
framework to do just that. If no clock is provided, it will just
be ignored and the driver will continue to assume that no clock
is required for the chip to run successfully.
Cc: Steve Glendinning <steve.glendinning@shawell.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/net/ethernet/smsc/smsc911x.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index e112877..afa4d62 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -33,6 +33,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/crc32.h>
+#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/etherdevice.h>
@@ -144,6 +145,9 @@ struct smsc911x_data {
/* regulators */
struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES];
+
+ /* clock */
+ struct clk *clk;
};
/* Easy access to information */
@@ -369,7 +373,7 @@ out:
}
/*
- * enable resources, currently just regulators.
+ * enable regulator and clock resources.
*/
static int smsc911x_enable_resources(struct platform_device *pdev)
{
@@ -382,6 +386,13 @@ static int smsc911x_enable_resources(struct platform_device *pdev)
if (ret)
netdev_err(ndev, "failed to enable regulators %d\n",
ret);
+
+ if (IS_ERR(pdata->clk)) {
+ ret = clk_prepare_enable(pdata->clk);
+ if (ret < 0)
+ netdev_err(ndev, "failed to enable clock %d\n", ret);
+ }
+
return ret;
}
@@ -396,6 +407,10 @@ static int smsc911x_disable_resources(struct platform_device *pdev)
ret = regulator_bulk_disable(ARRAY_SIZE(pdata->supplies),
pdata->supplies);
+
+ if (IS_ERR(pdata->clk))
+ clk_disable_unprepare(pdata->clk);
+
return ret;
}
@@ -421,6 +436,12 @@ static int smsc911x_request_resources(struct platform_device *pdev)
if (ret)
netdev_err(ndev, "couldn't get regulators %d\n",
ret);
+
+ /* Request clock */
+ pdata->clk = clk_get(&pdev->dev, NULL);
+ if (IS_ERR(pdata->clk))
+ netdev_warn(ndev, "couldn't get clock %li\n", PTR_ERR(pdata->clk));
+
return ret;
}
@@ -436,6 +457,12 @@ static void smsc911x_free_resources(struct platform_device *pdev)
/* Free regulators */
regulator_bulk_free(ARRAY_SIZE(pdata->supplies),
pdata->supplies);
+
+ /* Free clock */
+ if (IS_ERR(pdata->clk)) {
+ clk_put(pdata->clk);
+ pdata->clk = NULL;
+ }
}
/* waits for MAC not busy, with timeout. Only called by smsc911x_mac_read
--
1.7.9.5
^ permalink raw reply related
* [RFC] Route lost when src address is removed.
From: Hemmo Nieminen @ 2012-12-21 12:09 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 881 bytes --]
Hi,
A route is lost to a subnet, even if it still has addresses
in that subnet.
In normal situations, it seems, a route's source address is the
same as the subnet's primary address and if it gets removed, the
route's source address is updated to be the new primary address.
If, however, the route's source address has been changed to some
other IP address than the primary address, the route is lost
when the source address is removed. This leaves us with IP
addresses in a subnet but no route to that subnet.
I encountered this and was not able to figure out whether this
behaviour is intentional or not? I would sort of expect the
route the be updated to have e.g. the primary address as the new
source address but perhaps not in all cases... What do you
think?
Attached below an example run that should also include all the
information needed to reproduce this.
--
Hemmo
[-- Attachment #2: route.log --]
[-- Type: text/plain, Size: 2209 bytes --]
[root@fcku ~]# ip a s eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:23:54:20:73:3e brd ff:ff:ff:ff:ff:ff
inet 192.168.1.105/24 brd 192.168.1.255 scope global eth0
inet6 fe80::223:54ff:fe20:733e/64 scope link
valid_lft forever preferred_lft forever
[root@fcku ~]# ip a a 1.1.1.1/24 dev eth0
[root@fcku ~]# ip a a 1.1.1.2/24 dev eth0
[root@fcku ~]# ip a a 1.1.1.3/24 dev eth0
[root@fcku ~]# ip a s eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:23:54:20:73:3e brd ff:ff:ff:ff:ff:ff
inet 192.168.1.105/24 brd 192.168.1.255 scope global eth0
inet 1.1.1.1/24 scope global eth0
inet 1.1.1.2/24 scope global secondary eth0
inet 1.1.1.3/24 scope global secondary eth0
inet6 fe80::223:54ff:fe20:733e/64 scope link
valid_lft forever preferred_lft forever
[root@fcku ~]# ip r s
default via 192.168.1.1 dev eth0 metric 202
1.1.1.0/24 dev eth0 proto kernel scope link src 1.1.1.1
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.105 metric 202
[root@fcku ~]# ip r replace 1.1.1.0/24 dev eth0 proto kernel scope link src 1.1.1.2
[root@fcku ~]# ip r s
default via 192.168.1.1 dev eth0 metric 202
1.1.1.0/24 dev eth0 proto kernel scope link src 1.1.1.2
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.105 metric 202
[root@fcku ~]# ip a d 1.1.1.2/24 dev eth0
[root@fcku ~]# ip a s eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:23:54:20:73:3e brd ff:ff:ff:ff:ff:ff
inet 192.168.1.105/24 brd 192.168.1.255 scope global eth0
inet 1.1.1.1/24 scope global eth0
inet 1.1.1.3/24 scope global secondary eth0
inet6 fe80::223:54ff:fe20:733e/64 scope link
valid_lft forever preferred_lft forever
[root@fcku ~]# ip r s
default via 192.168.1.1 dev eth0 metric 202
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.105 metric 202
[root@fcku ~]# uname -a
Linux fcku 3.6.10-1-ARCH #1 SMP PREEMPT Tue Dec 11 09:40:17 CET 2012 x86_64 GNU/Linux
[root@fcku ~]# ip -V
ip utility, iproute2-ss121001
[root@fcku ~]#
^ permalink raw reply
* perm_addr get
From: Jiri Pirko @ 2012-12-21 13:01 UTC (permalink / raw)
To: netdev; +Cc: bhutchings
Hi all.
>From what I understand dev->perm_addr is set only in case the hw has
permanent hw address somewhere written (for example EPROM).
So when I query device which does not have perm_addr set I get:
testt1:~$ ethtool -P team0
Permanent address: 00:00:00:00:00:00
Is this the correct behaviour? Wouldn't it be more correct if
ethtool_get_perm_addr() fails with -ENOENT for something like that?
Thanks.
Jiri
^ permalink raw reply
* Re: [PATCH] pkt_sched: act_xt support new Xtables interface
From: Jamal Hadi Salim @ 2012-12-21 13:03 UTC (permalink / raw)
To: Yury Stankevich
Cc: Hasan Chowdhury, Stephen Hemminger, Jan Engelhardt,
netdev@vger.kernel.org, pablo, netfilter-devel
In-Reply-To: <50D327CD.3050904@gmail.com>
On 12-12-20 09:59 AM, Yury Stankevich wrote:
> interesting,
>
> #tc -s filter show dev usb0 parent ffff:
Given you are adding this on ingress - the settings you have will
happen before pre-routing hook.
If you did things at egress - the setting will take effect after
post-routing. So take a closer look at those details they look
like your source of issues..
cheers,
jamal
^ permalink raw reply
* Re: perm_addr get
From: Ben Hutchings @ 2012-12-21 13:09 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev
In-Reply-To: <20121221130127.GB2040@minipsycho.orion>
On Fri, 2012-12-21 at 14:01 +0100, Jiri Pirko wrote:
> Hi all.
>
> From what I understand dev->perm_addr is set only in case the hw has
> permanent hw address somewhere written (for example EPROM).
>
> So when I query device which does not have perm_addr set I get:
>
> testt1:~$ ethtool -P team0
> Permanent address: 00:00:00:00:00:00
>
> Is this the correct behaviour? Wouldn't it be more correct if
> ethtool_get_perm_addr() fails with -ENOENT for something like that?
I don't think we should change the implementation now, as someone might
depend on it. It's trivial to distinguish this not-a-permanent-address
case. However the ethtool command output could be improved.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH] pkt_sched: act_xt support new Xtables interface
From: Yury Stankevich @ 2012-12-21 13:13 UTC (permalink / raw)
To: Jamal Hadi Salim
Cc: Hasan Chowdhury, Stephen Hemminger, Jan Engelhardt,
netdev@vger.kernel.org, pablo, netfilter-devel
In-Reply-To: <50D45E25.7050703@mojatatu.com>
21.12.2012 17:03, Jamal Hadi Salim пишет:
> On 12-12-20 09:59 AM, Yury Stankevich wrote:
>> interesting,
>>
>> #tc -s filter show dev usb0 parent ffff:
>
>
> Given you are adding this on ingress - the settings you have will
> happen before pre-routing hook.
> If you did things at egress - the setting will take effect after
> post-routing. So take a closer look at those details they look
> like your source of issues..
sure,
i use it ingress,
so, i need to use tc xt action
to get mark on the packet, before filter on ifb will run.
prerouting rule, in turn, used to test if mark was actually restored.
in practice:
1. prerouting rule - is not fired. so, no packets with mark was seen.
2. filter on ifb - do not pass traffic to flow configured.
looks like `CONNMARK --restore` is not really called.
--
Linux registered user #402966 // pub 1024D/E99AF373 <pgp.mit.edu>
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: perm_addr get
From: Jiri Pirko @ 2012-12-21 13:25 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev
In-Reply-To: <1356095395.7055.34.camel@deadeye.wl.decadent.org.uk>
Fri, Dec 21, 2012 at 02:09:55PM CET, bhutchings@solarflare.com wrote:
>On Fri, 2012-12-21 at 14:01 +0100, Jiri Pirko wrote:
>> Hi all.
>>
>> From what I understand dev->perm_addr is set only in case the hw has
>> permanent hw address somewhere written (for example EPROM).
>>
>> So when I query device which does not have perm_addr set I get:
>>
>> testt1:~$ ethtool -P team0
>> Permanent address: 00:00:00:00:00:00
>>
>> Is this the correct behaviour? Wouldn't it be more correct if
>> ethtool_get_perm_addr() fails with -ENOENT for something like that?
>
>I don't think we should change the implementation now, as someone might
>depend on it. It's trivial to distinguish this not-a-permanent-address
>case. However the ethtool command output could be improved.
Well, not change it even if it is not correct? And by "trivial to distinguish"
you mean 00:00:00:00:00:00 ~ device has no permanent address?
But in some cases (like vxge, mac80211) it's possible to see 00:00:00:00:00:00
by ethtool -P even though the device has permanent address (set later on, after
register_netdev call).
I think that ethtool_get_perm_addr should return:
-ENOENT if dev has no perm addr
-EAGAIN if dev perm addr hasn't been obtained yet
0 (and addr) in other cases
And how exactly should be the ethtool output improved?
Thanks
Jiri
>
>Ben.
>
>--
>Ben Hutchings, Staff Engineer, Solarflare
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>
^ permalink raw reply
* Re: [PATCH] pkt_sched: act_xt support new Xtables interface
From: Jamal Hadi Salim @ 2012-12-21 13:50 UTC (permalink / raw)
To: Yury Stankevich
Cc: Hasan Chowdhury, Stephen Hemminger, Jan Engelhardt,
netdev@vger.kernel.org, pablo, netfilter-devel
In-Reply-To: <50D46060.2070308@gmail.com>
On 12-12-21 08:13 AM, Yury Stankevich wrote:
> sure,
> i use it ingress,
> so, i need to use tc xt action
> to get mark on the packet, before filter on ifb will run.
Ok. So does ifb see it?
> prerouting rule, in turn, used to test if mark was actually restored.
No experience with connmark, but - in order to restore something has
to store it, correct?
> in practice:
> 1. prerouting rule - is not fired. so, no packets with mark was seen.
> 2. filter on ifb - do not pass traffic to flow configured.
> looks like `CONNMARK --restore` is not really called.
>
My suspicion is that it is not set to begin with...
cheers,
jamal
^ permalink raw reply
* Re: [PATCH] pkt_sched: act_xt support new Xtables interface
From: Yury Stankevich @ 2012-12-21 14:14 UTC (permalink / raw)
To: Jamal Hadi Salim
Cc: Hasan Chowdhury, Stephen Hemminger, Jan Engelhardt,
netdev@vger.kernel.org, pablo, netfilter-devel
In-Reply-To: <50D46928.9070809@mojatatu.com>
well.
let me describe whole picture i want to achieve
1. use htb/sfq on ingress.
i got a traffic, and use few u32 filters to direct it to 3 flows,
priority, interactive, and bulk.
as http normally pass to interactive flow, i want to move long donwloads
to the bulk one.
how i trying to find these downloads:
iptables -t mangle -A POSTROUTING -p tcp --dport 80 -m connmark --mark 0
-m connbytes --connbytes 204800: --connbytes-dir both --connbytes-mode
bytes -j CONNMARK --set-mark 0xa
so, http connection where more than 200K downloaded, must got a
connection mark.
since ingress traffic hits qos before netfilter,
i use xt action, to copy connection mark, to a packet.
(action xt -j CONNMARK --restore-mark )
from this moment, i expect packet must have a restored mark
after this, i can use high priority tc filter .. handle 0xa fw flowid 1:102
to direct packet with mark 0xa to 1:102 flow (bulk).
now about a problem.
1. i run http download, once i get 200K - i can see that rule in
POSTROUTING is triggered and connection mark is installed (iptables -L
-n -v mangle -- can show number of packets matched by rule)
2. i see to tc stats for my flows, and i see, that packets still going
to interactive flow, not bulk as i expect.
3. from tc -s filter show dev usb0 parent ffff:
filter protocol ip pref 49152 u32
filter protocol ip pref 49152 u32 fh 800: ht divisor 1
filter protocol ip pref 49152 u32 fh 800::800 order 2048 key ht 800 bkt
0 terminal flowid ??? (rule hit 707 success 707)
match 00000000/00000000 at 0 (success 707 )
action order 1: tablename: mangle hook: NF_IP_PRE_ROUTING
target CONNMARK restore
index 5 ref 1 bind 1 installed 394 sec used 11 sec
Action statistics:
Sent 783783 bytes 707 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 2: mirred (Egress Redirect to device ifb0) stolen
index 5 ref 1 bind 1 installed 394 sec used 11 sec
Action statistics:
Sent 783783 bytes 707 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
i can see that packets must reach xt action.
4. lets try to check packets mark with iptables,
if mark restored by xt action - i must be able to match it in prerouting
rule.
iptables -t mangle -A PREROUTING -m mark --mark 0xa -j NFLOG --nflog-group 1
but this rule not macthesd - so, no mark is restored by xt action.
maybe im completely wrong here, and such mode can't work for some reason ?
21.12.2012 17:50, Jamal Hadi Salim пишет:
> On 12-12-21 08:13 AM, Yury Stankevich wrote:
>
>> sure,
>> i use it ingress,
>> so, i need to use tc xt action
>> to get mark on the packet, before filter on ifb will run.
>
> Ok. So does ifb see it?
>
>> prerouting rule, in turn, used to test if mark was actually restored.
>
> No experience with connmark, but - in order to restore something has
> to store it, correct?
>
>> in practice:
>> 1. prerouting rule - is not fired. so, no packets with mark was seen.
>> 2. filter on ifb - do not pass traffic to flow configured.
>> looks like `CONNMARK --restore` is not really called.
>>
>
> My suspicion is that it is not set to begin with...
>
> cheers,
> jamal
>
--
Linux registered user #402966 // pub 1024D/E99AF373 <pgp.mit.edu>
^ permalink raw reply
* Re: [PATCH] pkt_sched: act_xt support new Xtables interface
From: Jan Engelhardt @ 2012-12-21 14:35 UTC (permalink / raw)
To: Jamal Hadi Salim
Cc: Yury Stankevich, Hasan Chowdhury, Stephen Hemminger,
netdev@vger.kernel.org, pablo, netfilter-devel
In-Reply-To: <50D46928.9070809@mojatatu.com>
On Friday 2012-12-21 14:50, Jamal Hadi Salim wrote:
> On 12-12-21 08:13 AM, Yury Stankevich wrote:
>> i use it ingress,
>> so, i need to use tc xt action
>> to get mark on the packet, before filter on ifb will run.
>> prerouting rule, in turn, used to test if mark was actually restored.
>
> No experience with connmark, but - in order to restore something has
> to store it, correct?
The bigger problem here, if I see __netif_receive_skb right, is that
when ingress rules run, skb->nfct is still unset, thereby the
CONNMARK action is a no-op.
^ 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