* Re: [PATCH] net: Fix some fallout from the etner_addr_copy() changes.
From: François-Xavier Le Bail @ 2014-01-22 4:07 UTC (permalink / raw)
To: netdev, David Miller
In-Reply-To: <20140121.190348.1653034020095660800.davem@davemloft.net>
On Tue, 1/21/14, David Miller <davem@davemloft.net> wrote:
> Subject: [PATCH] net: Fix some fallout from the etner_addr_copy() changes.
s/etner_addr_copy/ether_addr_copy.
Cheers,
Francois-Xavier
^ permalink raw reply
* Re: [PATCH] net: Fix some fallout from the etner_addr_copy() changes.
From: Bill Fink @ 2014-01-22 4:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20140121.190348.1653034020095660800.davem@davemloft.net>
On Tue, 21 Jan 2014, David Miller wrote:
> net/appletalk/aarp.c: In function ‘__aarp_send_query’:
> net/appletalk/aarp.c:137:2: error: implicit declaration of function ‘ether_addr_copy’ [-Werror=implicit-function-declaration]
> ...
> net/atm/lec.c: In function ‘send_to_lecd’:
> net/atm/lec.c:524:3: warning: passing argument 1 of ‘ether_addr_copy’ from incompatible pointer type [enabled by default]
> In file included from net/atm/lec.c:17:0:
> include/linux/etherdevice.h:227:20: note: expected ‘u8 *’ but argument is of type ‘unsigned char (*)[6]’
> ...
> net/caif/caif_usb.c: In function ‘cfusbl_create’:
> net/caif/caif_usb.c:108:2: error: implicit declaration of function ‘ether_addr_copy’ [-Werror=implicit-function-declaration]
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> net/appletalk/aarp.c | 1 +
> net/atm/lec.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
The commit message indicates problems with appletalk/aarp.c,
atm/lec.c, and caif/caif_usb.c, but the diffstat and patch only
address the first two and not caif/caif_usb.c. Is that intended
or am I missing something.
-Bill
^ permalink raw reply
* [PATCH net-next] net: update comments of "struct msghdr" with the more accurate RFC3542 ones
From: Francois-Xavier Le Bail @ 2014-01-22 4:39 UTC (permalink / raw)
To: netdev; +Cc: David Miller
Signed-off-by: Francois-Xavier Le Bail <fx.lebail@yahoo.com>
---
include/linux/socket.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 5d488a6..8e98297 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -45,13 +45,13 @@ struct linger {
*/
struct msghdr {
- void * msg_name; /* Socket name */
- int msg_namelen; /* Length of name */
- struct iovec * msg_iov; /* Data blocks */
- __kernel_size_t msg_iovlen; /* Number of blocks */
- void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
- __kernel_size_t msg_controllen; /* Length of cmsg list */
- unsigned int msg_flags;
+ void *msg_name; /* ptr to socket address structure */
+ int msg_namelen; /* size of socket address structure */
+ struct iovec *msg_iov; /* scatter/gather array */
+ __kernel_size_t msg_iovlen; /* # elements in msg_iov */
+ void *msg_control; /* ancillary data */
+ __kernel_size_t msg_controllen; /* ancillary data buffer length */
+ unsigned int msg_flags; /* flags on received message */
};
/* For recvmmsg/sendmmsg */
--
1.7.10.4
^ permalink raw reply related
* Re: ipv4_dst_destroy panic regression after 3.10.15
From: Alexei Starovoitov @ 2014-01-22 6:02 UTC (permalink / raw)
To: dormando
Cc: Alexei Starovoitov, Eric Dumazet, netdev,
linux-kernel@vger.kernel.org
In-Reply-To: <alpine.DEB.2.02.1401212008010.20572@dtop>
On Tue, Jan 21, 2014 at 8:10 PM, dormando <dormando@rydia.net> wrote:
>
>
> On Tue, 21 Jan 2014, Alexei Starovoitov wrote:
>
>> On Tue, Jan 21, 2014 at 5:39 PM, dormando <dormando@rydia.net> wrote:
>> >
>> > > On Fri, Jan 17, 2014 at 11:16 PM, dormando <dormando@rydia.net> wrote:
>> > > >> On Fri, 2014-01-17 at 22:49 -0800, Eric Dumazet wrote:
>> > > >> > On Fri, 2014-01-17 at 17:25 -0800, dormando wrote:
>> > > >> > > Hi,
>> > > >> > >
>> > > >> > > Upgraded a few kernels to the latest 3.10 stable tree while tracking down
>> > > >> > > a rare kernel panic, seems to have introduced a much more frequent kernel
>> > > >> > > panic. Takes anywhere from 4 hours to 2 days to trigger:
>> > > >> > >
>> > > >> > > <4>[196727.311203] general protection fault: 0000 [#1] SMP
>> > > >> > > <4>[196727.311224] Modules linked in: xt_TEE xt_dscp xt_DSCP macvlan bridge coretemp crc32_pclmul ghash_clmulni_intel gpio_ich microcode
>> ipmi_watchdog ipmi_devintf sb_edac edac_core lpc_ich mfd_core tpm_tis tpm tpm_bios ipmi_si ipmi_msghandler isci igb libsas i2c_algo_bit ixgbe ptp
>> pps_core mdio
>> > > >> > > <4>[196727.311333] CPU: 17 PID: 0 Comm: swapper/17 Not tainted 3.10.26 #1
>> > > >> > > <4>[196727.311344] Hardware name: Supermicro X9DRi-LN4+/X9DR3-LN4+/X9DRi-LN4+/X9DR3-LN4+, BIOS 3.0 07/05/2013
>> > > >> > > <4>[196727.311364] task: ffff885e6f069700 ti: ffff885e6f072000 task.ti: ffff885e6f072000
>> > > >> > > <4>[196727.311377] RIP: 0010:[<ffffffff815f8c7f>] [<ffffffff815f8c7f>] ipv4_dst_destroy+0x4f/0x80
>> > > >> > > <4>[196727.311399] RSP: 0018:ffff885effd23a70 EFLAGS: 00010282
>> > > >> > > <4>[196727.311409] RAX: dead000000200200 RBX: ffff8854c398ecc0 RCX: 0000000000000040
>> > > >> > > <4>[196727.311423] RDX: dead000000100100 RSI: dead000000100100 RDI: dead000000200200
>> > > >> > > <4>[196727.311437] RBP: ffff885effd23a80 R08: ffffffff815fd9e0 R09: ffff885d5a590800
>> > > >> > > <4>[196727.311451] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
>> > > >> > > <4>[196727.311464] R13: ffffffff81c8c280 R14: 0000000000000000 R15: ffff880e85ee16ce
>> > > >> > > <4>[196727.311510] FS: 0000000000000000(0000) GS:ffff885effd20000(0000) knlGS:0000000000000000
>> > > >> > > <4>[196727.311554] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> > > >> > > <4>[196727.311581] CR2: 00007a46751eb000 CR3: 0000005e65688000 CR4: 00000000000407e0
>> > > >> > > <4>[196727.311625] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> > > >> > > <4>[196727.311669] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
>> > > >> > > <4>[196727.311713] Stack:
>> > > >> > > <4>[196727.311733] ffff8854c398ecc0 ffff8854c398ecc0 ffff885effd23ab0 ffffffff815b7f42
>> > > >> > > <4>[196727.311784] ffff88be6595bc00 ffff8854c398ecc0 0000000000000000 ffff8854c398ecc0
>> > > >> > > <4>[196727.311834] ffff885effd23ad0 ffffffff815b86c6 ffff885d5a590800 ffff8816827821c0
>> > > >> > > <4>[196727.311885] Call Trace:
>> > > >> > > <4>[196727.311907] <IRQ>
>> > > >> > > <4>[196727.311912] [<ffffffff815b7f42>] dst_destroy+0x32/0xe0
>> > > >> > > <4>[196727.311959] [<ffffffff815b86c6>] dst_release+0x56/0x80
>> > > >> > > <4>[196727.311986] [<ffffffff81620bd5>] tcp_v4_do_rcv+0x2a5/0x4a0
>> > > >> > > <4>[196727.312013] [<ffffffff81622b5a>] tcp_v4_rcv+0x7da/0x820
>> > > >> > > <4>[196727.312041] [<ffffffff815fd9e0>] ? ip_rcv_finish+0x360/0x360
>> > > >> > > <4>[196727.312070] [<ffffffff815de02d>] ? nf_hook_slow+0x7d/0x150
>> > > >> > > <4>[196727.312097] [<ffffffff815fd9e0>] ? ip_rcv_finish+0x360/0x360
>> > > >> > > <4>[196727.312125] [<ffffffff815fda92>] ip_local_deliver_finish+0xb2/0x230
>> > > >> > > <4>[196727.312154] [<ffffffff815fdd9a>] ip_local_deliver+0x4a/0x90
>> > > >> > > <4>[196727.312183] [<ffffffff815fd799>] ip_rcv_finish+0x119/0x360
>> > > >> > > <4>[196727.312212] [<ffffffff815fe00b>] ip_rcv+0x22b/0x340
>> > > >> > > <4>[196727.312242] [<ffffffffa0339680>] ? macvlan_broadcast+0x160/0x160 [macvlan]
>> > > >> > > <4>[196727.312275] [<ffffffff815b0c62>] __netif_receive_skb_core+0x512/0x640
>> > > >> > > <4>[196727.312308] [<ffffffff811427fb>] ? kmem_cache_alloc+0x13b/0x150
>> > > >> > > <4>[196727.312338] [<ffffffff815b0db1>] __netif_receive_skb+0x21/0x70
>> > > >> > > <4>[196727.312368] [<ffffffff815b0fa1>] netif_receive_skb+0x31/0xa0
>> > > >> > > <4>[196727.312397] [<ffffffff815b1ae8>] napi_gro_receive+0xe8/0x140
>> > > >> > > <4>[196727.312433] [<ffffffffa00274f1>] ixgbe_poll+0x551/0x11f0 [ixgbe]
>> > > >> > > <4>[196727.312463] [<ffffffff815fe00b>] ? ip_rcv+0x22b/0x340
>> > > >> > > <4>[196727.312491] [<ffffffff815b1691>] net_rx_action+0x111/0x210
>> > > >> > > <4>[196727.312521] [<ffffffff815b0db1>] ? __netif_receive_skb+0x21/0x70
>> > > >> > > <4>[196727.312552] [<ffffffff810519d0>] __do_softirq+0xd0/0x270
>> > > >> > > <4>[196727.312583] [<ffffffff816cef3c>] call_softirq+0x1c/0x30
>> > > >> > > <4>[196727.312613] [<ffffffff81004205>] do_softirq+0x55/0x90
>> > > >> > > <4>[196727.312640] [<ffffffff81051c85>] irq_exit+0x55/0x60
>> > > >> > > <4>[196727.312668] [<ffffffff816cf5c3>] do_IRQ+0x63/0xe0
>> > > >> > > <4>[196727.312696] [<ffffffff816c5aaa>] common_interrupt+0x6a/0x6a
>> > > >> > > <4>[196727.312722] <EOI>
>> > > >> > > <4>[196727.312727] [<ffffffff8100a150>] ? default_idle+0x20/0xe0
>> > > >> > > <4>[196727.312775] [<ffffffff8100a8ff>] arch_cpu_idle+0xf/0x20
>> > > >> > > <4>[196727.312803] [<ffffffff8108d330>] cpu_startup_entry+0xc0/0x270
>> > > >> > > <4>[196727.312833] [<ffffffff816b276e>] start_secondary+0x1f9/0x200
>> > > >> > > <4>[196727.312860] Code: 4a 9f e9 81 e8 13 cb 0c 00 48 8b 93 b0 00 00 00 48 bf 00 02 20 00 00 00 ad de 48 8b 83 b8 00 00 00 48 be 00 01
>> 10 00 00 00 ad de <48> 89 42 08 48 89 10 48 89 bb b8 00 00 00 48 c7 c7 4a 9f e9 81
>> > > >> > > <1>[196727.313071] RIP [<ffffffff815f8c7f>] ipv4_dst_destroy+0x4f/0x80
>> > > >> > > <4>[196727.313100] RSP <ffff885effd23a70>
>> > > >> > > <4>[196727.313377] ---[ end trace 64b3f14fae0f2e29 ]---
>> > > >> > > <0>[196727.380908] Kernel panic - not syncing: Fatal exception in interrupt
>> > > >> > >
>> > > >> > >
>> > > >> > > ... bisecting it's going to be a pain... I tried eyeballing the diffs and
>> > > >> > > am trying a revert or two.
>> > > >> > >
>> > > >> > > We've hit it in .25, .26 so far. I have .27 running but not sure if it
>> > > >> > > crashed, so the change exists between .15 and .25.
>> > > >> >
>> > > >> > Please try following fix, thanks for the report !
>> > > >> >
>> > > >> > diff --git a/net/ipv4/route.c b/net/ipv4/route.c
>> > > >> > index 25071b48921c..78a50a22298a 100644
>> > > >> > --- a/net/ipv4/route.c
>> > > >> > +++ b/net/ipv4/route.c
>> > > >> > @@ -1333,7 +1333,7 @@ static void ipv4_dst_destroy(struct dst_entry
>> > > >> > *dst)
>> > > >> >
>> > > >> > if (!list_empty(&rt->rt_uncached)) {
>> > > >> > spin_lock_bh(&rt_uncached_lock);
>> > > >> > - list_del(&rt->rt_uncached);
>> > > >> > + list_del_init(&rt->rt_uncached);
>> > > >> > spin_unlock_bh(&rt_uncached_lock);
>> > > >> > }
>> > > >> > }
>> > > >> >
>> > > >>
>> > > >> Problem could come from this commit, in linux 3.10.23,
>> > > >> you also could try to revert it
>> > > >>
>> > > >> commit 62713c4b6bc10c2d082ee1540e11b01a2b2162ab
>> > > >> Author: Alexei Starovoitov <ast@plumgrid.com>
>> > > >> Date: Tue Nov 19 19:12:34 2013 -0800
>> > > >>
>> > > >> ipv4: fix race in concurrent ip_route_input_slow()
>> > > >>
>> > > >> [ Upstream commit dcdfdf56b4a6c9437fc37dbc9cee94a788f9b0c4 ]
>> > > >>
>> > > >> CPUs can ask for local route via ip_route_input_noref() concurrently.
>> > > >> if nh_rth_input is not cached yet, CPUs will proceed to allocate
>> > > >> equivalent DSTs on 'lo' and then will try to cache them in nh_rth_input
>> > > >> via rt_cache_route()
>> > > >> Most of the time they succeed, but on occasion the following two lines:
>> > > >> orig = *p;
>> > > >> prev = cmpxchg(p, orig, rt);
>> > > >> in rt_cache_route() do race and one of the cpus fails to complete cmpxchg.
>> > > >> But ip_route_input_slow() doesn't check the return code of rt_cache_route(),
>> > > >> so dst is leaking. dst_destroy() is never called and 'lo' device
>> > > >> refcnt doesn't go to zero, which can be seen in the logs as:
>> > > >> unregister_netdevice: waiting for lo to become free. Usage count = 1
>> > > >> Adding mdelay() between above two lines makes it easily reproducible.
>> > > >> Fix it similar to nh_pcpu_rth_output case.
>> > > >>
>> > > >> Fixes: d2d68ba9fe8b ("ipv4: Cache input routes in fib_info nexthops.")
>> > > >> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
>> > > >> Signed-off-by: David S. Miller <davem@davemloft.net>
>> > > >> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> > > >>
>> > > >
>> > > > Heh. I spent an hour squinting at the difflog from .15 to .25 and this was
>> > > > my best guess. I have a kernel running in production with only this
>> > > > reverted as of ~5 hours ago. Won't know if it helps for a day or two.
>> > > >
>> > > > I'm building a kernel now with your route patch, but 62713c4 *not*
>> > > > reverted, which I can throw on a different machine. Does this sound like a
>> > > > good idea?
>> > >
>> > > the traces of your crash don't look similar to dst leak that was fixed by
>> > > commit 62713c4...
>> > >
>> > > To trigger the 'fix' logic of the 62713c4 add the following diff:
>> > > diff --git a/net/ipv4/route.c b/net/ipv4/route.c
>> > > index f6c6ab1..8972676 100644
>> > > --- a/net/ipv4/route.c
>> > > +++ b/net/ipv4/route.c
>> > > @@ -1259,7 +1259,7 @@ static bool rt_cache_route(struct fib_nh *nh,
>> > > struct rtable *rt)
>> > > p = (struct rtable **)__this_cpu_ptr(nh->nh_pcpu_rth_output);
>> > > }
>> > > orig = *p;
>> > > -
>> > > + mdelay(100);
>> > > prev = cmpxchg(p, orig, rt);
>> > > if (prev == orig) {
>> > > if (orig)
>> > >
>> > > I've been running with it for a day without issues.
>> > > Note that it will stress both 'input' and 'output' ways of adding dsts to
>> > > rt_uncached list...
>> > > and 'output' was there for ages.
>> > >
>> > > If mdelay() helps to reproduce it in minutes instead of days
>> > > then we're on the right path.
>> > > Could you share details of your workload?
>> > > In our case it was a lot of namespaces with a ton of processes
>> > > talking to each other, forcefully killed and restarted.
>> > > Do you see the same crash in the latest tree?
>> > >
>> > > PS sorry for double posts. netdev email bounced few times for me...
>> > >
>> >
>> > So with 62713c4 reverted on top of 3.10.27 (no other new patches), both of
>> > my machines have survived. One four days, another two days. They'd barely
>> > make it a day before.
>> >
>> > So this patch is introducing a new problem. Weakening the dst reference
>> > too much in a false positive case?
>> >
>> > I'm not entirely sure if the mdelay(100) thing will help much. I can try
>> > it but it's kind of obnoxious to reboot these machines (far away, ipmi
>> > only) too often. Unless you folks have any new ideas before I go off and
>> > do that?
>>
>> mdelay() won't fix things, but it will help debugging. Can you try it on just one machine? It should fail within minutes.
>>
>> Only afterwards we can try alternative fix like:
>> @@ -1722,8 +1722,8 @@ local_input:
>> }
>> if (do_cache) {
>> if (unlikely(!rt_cache_route(&FIB_RES_NH(res), rth))) {
>> - rth->dst.flags |= DST_NOCACHE;
>> - rt_add_uncached_list(rth);
>> + rt_free(rth);
>> + goto local_input;
>> }
>> }
>> skb_dst_set(skb, &rth->dst);
>>
>>
>>
>
> It might take a day or three to find a good time to do it. I don't have
> access to reboot the machines myself. Oh how I wish things broke in the
> lab more often :/
>
> To be clear, I add your old patch back in + the mdelay. If that fails
> within a few minutes, I add this new patch instead of your old one?
yes. vanilla 3.10.23+ and mdelay() will be triggering rt_add_uncached path.
If that fails quickly, I think we better debug it further to really understand
what's going on. Alternative fix may workaround the problem,
since it will be freeing dst immediately if it fails to be cached and retrying
allocation and caching again, but that would mean that double free problem
is simply hidden instead of fixed.
I would add tracing of rth free/alloc.
If mdelay() makes it fail quickly, the trace won't be too long.
config_debug_kmemleak may be helpful (though unlikely in this situation).
since your crash traces look like double free, we can enable config_slub_debug
and call verify_mem_not_deleted() from dst_destroy()
^ permalink raw reply
* Re: [PATCH net-next v3] ipv6: enable anycast addresses as source addresses for datagrams
From: François-Xavier Le Bail @ 2014-01-22 6:46 UTC (permalink / raw)
To: netdev; +Cc: Hannes Frederic Sowa, David Stevens, David Miller
In-Reply-To: <1390361450-3198-1-git-send-email-fx.lebail@yahoo.com>
On Tue, 1/21/14, Francois-Xavier Le Bail <fx.lebail@yahoo.com> wrote:
> Subject: [PATCH net-next v3] ipv6: enable anycast addresses as source addresses for datagrams
I am going to send a v4 (better style).
^ permalink raw reply
* [PATCH 1/2] net/ipv4: queue work on power efficient wq
From: Viresh Kumar @ 2014-01-22 6:53 UTC (permalink / raw)
To: davem; +Cc: linaro-kernel, patches, netdev, linux-kernel, Viresh Kumar
Workqueue used in ipv4 layer have no real dependency of scheduling these on the
cpu which scheduled them.
On a idle system, it is observed that an idle cpu wakes up many times just to
service this work. It would be better if we can schedule it on a cpu which the
scheduler believes to be the most appropriate one.
This patch replaces normal workqueues with power efficient versions. This
doesn't change existing behavior of code unless CONFIG_WQ_POWER_EFFICIENT is
enabled.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
Initial support for power-efficient workqueues was added here:
https://lkml.org/lkml/2013/4/24/215
net/ipv4/devinet.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 646023b..ac2dff3 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -474,7 +474,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
inet_hash_insert(dev_net(in_dev->dev), ifa);
cancel_delayed_work(&check_lifetime_work);
- schedule_delayed_work(&check_lifetime_work, 0);
+ queue_delayed_work(system_power_efficient_wq, &check_lifetime_work, 0);
/* Send message first, then call notifier.
Notifier will trigger FIB update, so that
@@ -684,7 +684,8 @@ static void check_lifetime(struct work_struct *work)
if (time_before(next_sched, now + ADDRCONF_TIMER_FUZZ_MAX))
next_sched = now + ADDRCONF_TIMER_FUZZ_MAX;
- schedule_delayed_work(&check_lifetime_work, next_sched - now);
+ queue_delayed_work(system_power_efficient_wq, &check_lifetime_work,
+ next_sched - now);
}
static void set_ifa_lifetime(struct in_ifaddr *ifa, __u32 valid_lft,
@@ -842,7 +843,8 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
ifa = ifa_existing;
set_ifa_lifetime(ifa, valid_lft, prefered_lft);
cancel_delayed_work(&check_lifetime_work);
- schedule_delayed_work(&check_lifetime_work, 0);
+ queue_delayed_work(system_power_efficient_wq,
+ &check_lifetime_work, 0);
rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid);
blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);
}
@@ -2322,7 +2324,7 @@ void __init devinet_init(void)
register_gifconf(PF_INET, inet_gifconf);
register_netdevice_notifier(&ip_netdev_notifier);
- schedule_delayed_work(&check_lifetime_work, 0);
+ queue_delayed_work(system_power_efficient_wq, &check_lifetime_work, 0);
rtnl_af_register(&inet_af_ops);
--
1.7.12.rc2.18.g61b472e
^ permalink raw reply related
* [PATCH 2/2] net/neighbour: queue work on power efficient wq
From: Viresh Kumar @ 2014-01-22 6:53 UTC (permalink / raw)
To: davem; +Cc: linaro-kernel, patches, netdev, linux-kernel, Viresh Kumar
In-Reply-To: <c24546776d8ec32afd1c084dd1d2a72fc96c6519.1390373223.git.viresh.kumar@linaro.org>
Workqueue used in neighbour layer have no real dependency of scheduling these on
the cpu which scheduled them.
On a idle system, it is observed that an idle cpu wakes up many times just to
service this work. It would be better if we can schedule it on a cpu which the
scheduler believes to be the most appropriate one.
This patch replaces normal workqueues with power efficient versions. This
doesn't change existing behavior of code unless CONFIG_WQ_POWER_EFFICIENT is
enabled.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
net/core/neighbour.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index f8012fe..b9e9e0d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -828,7 +828,7 @@ out:
* ARP entry timeouts range from 1/2 BASE_REACHABLE_TIME to 3/2
* BASE_REACHABLE_TIME.
*/
- schedule_delayed_work(&tbl->gc_work,
+ queue_delayed_work(system_power_efficient_wq, &tbl->gc_work,
NEIGH_VAR(&tbl->parms, BASE_REACHABLE_TIME) >> 1);
write_unlock_bh(&tbl->lock);
}
@@ -1565,7 +1565,8 @@ static void neigh_table_init_no_netlink(struct neigh_table *tbl)
rwlock_init(&tbl->lock);
INIT_DEFERRABLE_WORK(&tbl->gc_work, neigh_periodic_work);
- schedule_delayed_work(&tbl->gc_work, tbl->parms.reachable_time);
+ queue_delayed_work(system_power_efficient_wq, &tbl->gc_work,
+ tbl->parms.reachable_time);
setup_timer(&tbl->proxy_timer, neigh_proxy_process, (unsigned long)tbl);
skb_queue_head_init_class(&tbl->proxy_queue,
&neigh_table_proxy_queue_class);
--
1.7.12.rc2.18.g61b472e
^ permalink raw reply related
* Re: [PATCH] net: Fix some fallout from the etner_addr_copy() changes.
From: David Miller @ 2014-01-22 6:54 UTC (permalink / raw)
To: billfink; +Cc: netdev
In-Reply-To: <20140121232331.130f34fc.billfink@mindspring.com>
From: Bill Fink <billfink@mindspring.com>
Date: Tue, 21 Jan 2014 23:23:31 -0500
> The commit message indicates problems with appletalk/aarp.c,
> atm/lec.c, and caif/caif_usb.c, but the diffstat and patch only
> address the first two and not caif/caif_usb.c. Is that intended
> or am I missing something.
Thanks for catching that, I just pushed the missing change.
^ permalink raw reply
* Re: [PATCH RFC 00/73] tree-wide: clean up some no longer required #include <linux/init.h>
From: Stephen Rothwell @ 2014-01-22 7:00 UTC (permalink / raw)
To: Paul Gortmaker
Cc: linux-kernel, linux-arch, linux-alpha, linux-arm-kernel,
linux-ia64, linux-m68k, linux-mips, linuxppc-dev, linux-s390,
sparclinux, x86, netdev, kvm, rusty, gregkh, akpm, torvalds
In-Reply-To: <1390339396-3479-1-git-send-email-paul.gortmaker@windriver.com>
[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]
Hi Paul,
On Tue, 21 Jan 2014 16:22:03 -0500 Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
>
> Where: This work exists as a queue of patches that I apply to
> linux-next; since the changes are fixing some things that currently
> can only be found there. The patch series can be found at:
>
> http://git.kernel.org/cgit/linux/kernel/git/paulg/init.git
> git://git.kernel.org/pub/scm/linux/kernel/git/paulg/init.git
>
> I've avoided annoying Stephen with another queue of patches for
> linux-next while the development content was in flux, but now that
> the merge window has opened, and new additions are fewer, perhaps he
> wouldn't mind tacking it on the end... Stephen?
OK, I have added this to the end of linux-next today - we will see how we
go. It is called "init".
Thanks for adding your subsystem tree as a participant of linux-next. As
you may know, this is not a judgment of your code. The purpose of
linux-next is for integration testing and to lower the impact of
conflicts between subsystems in the next merge window.
You will need to ensure that the patches/commits in your tree/series have
been:
* submitted under GPL v2 (or later) and include the Contributor's
Signed-off-by,
* posted to the relevant mailing list,
* reviewed by you (or another maintainer of your subsystem tree),
* successfully unit tested, and
* destined for the current or next Linux merge window.
Basically, this should be just what you would send to Linus (or ask him
to fetch). It is allowed to be rebased if you deem it necessary.
--
Cheers,
Stephen Rothwell
sfr@canb.auug.org.au
Legal Stuff:
By participating in linux-next, your subsystem tree contributions are
public and will be included in the linux-next trees. You may be sent
e-mail messages indicating errors or other issues when the
patches/commits from your subsystem tree are merged and tested in
linux-next. These messages may also be cross-posted to the linux-next
mailing list, the linux-kernel mailing list, etc. The linux-next tree
project and IBM (my employer) make no warranties regarding the linux-next
project, the testing procedures, the results, the e-mails, etc. If you
don't agree to these ground rules, let me know and I'll remove your tree
from participation in linux-next.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCH net-next v4] ipv6: enable anycast addresses as source addresses for datagrams
From: Francois-Xavier Le Bail @ 2014-01-22 6:42 UTC (permalink / raw)
To: netdev; +Cc: Hannes Frederic Sowa, David Stevens, David Miller
This change allows to consider an anycast address valid as source address
when given via an IPV6_PKTINFO or IPV6_2292PKTINFO ancillary data item.
So, when sending a datagram with ancillary data, the unicast and anycast
addresses are handled in the same way.
- Adds ipv6_chk_acast_addr_src() to check if an anycast address is link-local
on given interface or is global.
- Uses it in ip6_datagram_send_ctl().
Signed-off-by: Francois-Xavier Le Bail <fx.lebail@yahoo.com>
---
v4: better style
v3: Consideration of Hannes's review (thanks!):
- Uses only ipv6_chk_acast_addr (rcu_read_lock needed).
Typical usage :
A server uses IPV6_RECVPKTINFO socket option to get ancillary data with
recvmsg() and can use sendmsg() to reply with anycast adress as source address
in the same way it does for unicast.
include/net/addrconf.h | 5 +++--
net/ipv6/anycast.c | 11 +++++++++++
net/ipv6/datagram.c | 4 +++-
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 66c4a44..50e39a8 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -205,8 +205,9 @@ void ipv6_sock_ac_close(struct sock *sk);
int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
- const struct in6_addr *addr);
-
+ const struct in6_addr *addr);
+bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev,
+ const struct in6_addr *addr);
/* Device notifier */
int register_inet6addr_notifier(struct notifier_block *nb);
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 5a80f15..2101832 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -383,6 +383,17 @@ bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
return found;
}
+/* check if this anycast address is link-local on given interface or
+ * is global
+ */
+bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev,
+ const struct in6_addr *addr)
+{
+ return ipv6_chk_acast_addr(net,
+ (ipv6_addr_type(addr) & IPV6_ADDR_LINKLOCAL ?
+ dev : NULL),
+ addr);
+}
#ifdef CONFIG_PROC_FS
struct ac6_iter_state {
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 2f5e2f1..c3bf2d2 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -699,7 +699,9 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk,
int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL;
if (!(inet_sk(sk)->freebind || inet_sk(sk)->transparent) &&
!ipv6_chk_addr(net, &src_info->ipi6_addr,
- strict ? dev : NULL, 0))
+ strict ? dev : NULL, 0) &&
+ !ipv6_chk_acast_addr_src(net, dev,
+ &src_info->ipi6_addr))
err = -EINVAL;
else
fl6->saddr = src_info->ipi6_addr;
^ permalink raw reply related
* Re: IPV6 routing problem
From: Hannes Frederic Sowa @ 2014-01-22 7:07 UTC (permalink / raw)
To: Sharat Masetty; +Cc: netdev
In-Reply-To: <CAJzFV37rPo6trvCwWyErchen_MvTzqabSU+BE3JZjNXT5-5H7Q@mail.gmail.com>
Hi!
On Tue, Jan 21, 2014 at 06:41:58PM -0700, Sharat Masetty wrote:
> I have an IPV6 routing problem that has only surfaced on a 3.10
> kernel version. This problem is not seen on 3.4 kernel. I will keep
> the problem statement as brief as possible.
Could you do me a favor and test this on a recent 3.13 kernel? Thanks!
Please also state the specific kernel version (I guess you use one).
> I have two interfaces say eth0 and eth1. I have a host route to a
> destination over eth1, but this route has a global gateway
> address(via) of the router on the link. When this global gateway is
> present in the route, the kernel does not seem to pick up the route,
> but falls back to the default route which is eth0. When this gateway
> is removed from the route or if the gateway is changed to a link local
> address of the router, instead of the global address, then routing
> seems to work as expected and kernel picks up interface eth1.
>
> == does not work ==
> <dest-addr> via <global scope -gateway addr>dev eth1 metric 1024
> <global scope -gateway addr> dev eth1 metric 1024
Do you have CONFIG_IPV6_ROUTER_PREF activated?
>
> I checked the git commits diff between 3.4 and 3.10 for ipv6/route.c
> and ipv6/ip6_fib.c, but looks like they are close to an year apart
> with lots of changes. Hence I wanted to reach out to you to see if any
> recent changes in IPV6 routing is causing this difference in behavior.
It should be a problem in ipv6/route.c, ip6_fib.c does not really care about
interfaces that much.
Thanks,
Hannes
^ permalink raw reply
* Re: [PATCH net] tcp: metrics: Handle v6/v4-mapped sockets in tcp-metrics
From: David Miller @ 2014-01-22 7:09 UTC (permalink / raw)
To: christoph.paasch; +Cc: netdev
In-Reply-To: <1390288632-28729-1-git-send-email-christoph.paasch@uclouvain.be>
From: Christoph Paasch <christoph.paasch@uclouvain.be>
Date: Tue, 21 Jan 2014 08:17:12 +0100
> A socket may be v6/v4-mapped. In that case sk->sk_family is AF_INET6,
> but the IP being used is actually an IPv4-address.
> Current's tcp-metrics will thus represent it as an IPv6-address:
>
> root@server:~# ip tcp_metrics
> ::ffff:10.1.1.2 age 22.920sec rtt 18750us rttvar 15000us cwnd 10
> 10.1.1.2 age 47.970sec rtt 16250us rttvar 10000us cwnd 10
>
> This patch modifies the tcp-metrics so that they are able to handle the
> v6/v4-mapped sockets correctly.
>
> Fixes: 51c5d0c4b169b (tcp: Maintain dynamic metrics in local cache.)
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Please respin this against net-next, thanks.
^ permalink raw reply
* Re: IPV6 routing problem
From: Hannes Frederic Sowa @ 2014-01-22 7:11 UTC (permalink / raw)
To: Sharat Masetty, netdev
In-Reply-To: <20140122070759.GB28225@order.stressinduktion.org>
On Wed, Jan 22, 2014 at 08:07:59AM +0100, Hannes Frederic Sowa wrote:
> Hi!
>
> On Tue, Jan 21, 2014 at 06:41:58PM -0700, Sharat Masetty wrote:
> > I have an IPV6 routing problem that has only surfaced on a 3.10
> > kernel version. This problem is not seen on 3.4 kernel. I will keep
> > the problem statement as brief as possible.
>
> Could you do me a favor and test this on a recent 3.13 kernel? Thanks!
> Please also state the specific kernel version (I guess you use one).
+stable.
A quick test worked for me. Maybe you could try with CONFIG_IPV6_ROUTER_PREF
enabled and one time with it disabled.
We should make this knob a runtime setting soon...
Thanks,
Hannes
^ permalink raw reply
* Re: [PATCH net] bnx2x: Fix VF flr flow
From: David Miller @ 2014-01-22 7:13 UTC (permalink / raw)
To: yuvalmin; +Cc: netdev, ariele
In-Reply-To: <1390293080-21276-1-git-send-email-yuvalmin@broadcom.com>
From: Yuval Mintz <yuvalmin@broadcom.com>
Date: Tue, 21 Jan 2014 10:31:20 +0200
> From: Ariel Elior <ariele@broadcom.com>
>
> When a VF originating from a given PF is flr-ed, that PF gets an interrupt
> from the chip management and takes a part in the flr process.
>
> This patch fixes several corner cases in which the driver performs its part
> of the flr flow out-of-order, causing the FW to assert due to badly timed
> messages received from the driver.
>
> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
> Signed-off-by: Ariel Elior <ariele@broadcom.com>
Applied.
^ permalink raw reply
* Re: [PATCH net] be2net: Fix be_vlan_add/rem_vid() routines
From: David Miller @ 2014-01-22 7:13 UTC (permalink / raw)
To: somnath.kotur; +Cc: netdev, kalesh.purayil
In-Reply-To: <e4c76822-2f55-4a40-a0fa-c4cacb2a480f@CMEXHTCAS2.ad.emulex.com>
From: Somnath Kotur <somnath.kotur@emulex.com>
Date: Tue, 21 Jan 2014 15:50:55 +0530
> The current logic to put interface into VLAN Promiscous mode is not correct.
> We should increment "adapter->vlans_added" before calling be_vid_config().
> Also removed some unwanted log messages.
>
> Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
> Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net/mlx4_core: Remove unnecessary validation for port number
From: David Miller @ 2014-01-22 7:14 UTC (permalink / raw)
To: amirv; +Cc: netdev, ogerlitz, monis, matanb
In-Reply-To: <1390292377-11806-1-git-send-email-amirv@mellanox.com>
From: Amir Vadai <amirv@mellanox.com>
Date: Tue, 21 Jan 2014 10:19:37 +0200
> From: Moni Shoua <monis@mellanox.co.il>
>
> This is a fix to a regression introduced by commit:
> "982290a net/mlx4_core: Check port number for validity
> before accessing data"
>
> IPoIB could not attach to multicast group and we get this in dmesg:
> [144214.145008] ib0: failed to attach to multicast group, ret = -22
> [144214.145016] ib0: couldn't attach QP to multicast group ff12:401b:ffff:0000:0000:0000:ffff:ffff
> [144214.145019] ib0: multicast join failed for ff12:401b:ffff:0000:0000:0000:ffff:ffff, status -22
>
> The cause to the problem is because port is extracted from gid[5].
> Which is only valid for Ethernet.
> Removed this validation in mlx4_qp_attach_common(), which is accessed
> from both Ethernet and IB flows.
> Error flow for bad port value in Ethernet is already exists in that
> function.
>
> Signed-off-by: Moni Shoua <monis@mellanox.co.il>
> Signed-off-by: Matan Barak <matanb@mellanox.com>
> Signed-off-by: Amir Vadai <amirv@mellanox.com>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH 1/2] net: dm9000: Read GPR, modify and write
From: David Miller @ 2014-01-22 7:15 UTC (permalink / raw)
To: chris.ruehl; +Cc: netdev, linux-kernel
In-Reply-To: <1390360813-29185-1-git-send-email-chris.ruehl@gtsys.com.hk>
Please do not mix coding style and functional changes.
Please resubmit this entire series once you have addressed
all feedback.
Thank you.
^ permalink raw reply
* Re: [PATCH net-next v5 0/0] reciprocal_divide update
From: David Miller @ 2014-01-22 7:20 UTC (permalink / raw)
To: hannes; +Cc: netdev
In-Reply-To: <1390354181-5080-1-git-send-email-hannes@stressinduktion.org>
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Wed, 22 Jan 2014 02:29:38 +0100
> This patch is on top of aee636c4809fa5 ("bpf: do not use reciprocal
> divide") from Eric that sits in net tree. It will not create a merge
> conflict, but it depends on this one, so we suggest, if possible, to
> merge net into net-next.
>
> We are proposing this change with only small modifications from the
> v2 version, namely updating the name of trim to reciprocal_scale
> (as commented on by Ben Hutchings and Eric Dumazet, thanks!).
>
> We thought about introducing the reciprocal_divide algorithm in
> parallel to the one already used by the kernel but faced organizational
> issues, leading us to the conclusion that it is best to just replace
> the old one: We could not come up with names for the different
> implementations and also with a way to describe the differences to
> guide developers which one to choose in which situation. This is
> because we cannot specify the correct semantics for the version
> which is currently used by the kernel. Altough it seems to not be
> causing problems in the kernel, we cannot surely say so in the
> case of flex_array for the future. Current usage seems ok, but
> future users could run into problems.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next 03/25] bonding: convert packets_per_slave to use the new option API
From: Hannes Frederic Sowa @ 2014-01-22 7:25 UTC (permalink / raw)
To: Nikolay Aleksandrov; +Cc: netdev
In-Reply-To: <1390316114-17815-4-git-send-email-nikolay@redhat.com>
Hi Nikolay!
On Tue, Jan 21, 2014 at 03:54:52PM +0100, Nikolay Aleksandrov wrote:
> This patch adds the necessary changes so packets_per_slave would use the
> new bonding option API.
Just want to warn you that because of the reciproal_divide merge in net-next
there will be some conflicts with this patch in net-next.
I actually looked to rebase Daniel and my series on your patchset, but now
David pulled ours first.
Greetings,
Hannes
^ permalink raw reply
* Re: [PATCH 1/2] net: dm9000: Read GPR, modify and write
From: Chris Ruehl @ 2014-01-22 7:41 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel
In-Reply-To: <20140121.231537.1961204373265189658.davem@davemloft.net>
On Wednesday, January 22, 2014 03:15 PM, David Miller wrote:
> Please do not mix coding style and functional changes.
>
> Please resubmit this entire series once you have addressed
> all feedback.
>
> Thank you.
Thanks for the advice. I will do.
Chris
^ permalink raw reply
* [patch net-next 0/5] fix bonding slave info API (sysfs and netlink)
From: Jiri Pirko @ 2014-01-22 8:05 UTC (permalink / raw)
To: netdev
Cc: davem, fubar, vfalico, andy, sfeldma, stephen, vyasevic,
nicolas.dichtel, john.r.fastabend
The main part of this patchset is the introduction of a generic way how
to get/set info of slaves unsing rtnl_link_ops.
Jiri Pirko (5):
bonding: change name of sysfs dir for bonding slaves
rtnetlink: put "BOND" into nl attribute names which are related to
bonding
rtnetlink: provide api for getting and setting slave info
bonding: convert netlink to use slave data info api
rtnetlink: remove ndo_get_slave
drivers/net/bonding/bond_main.c | 1 -
drivers/net/bonding/bond_netlink.c | 33 ++++--
drivers/net/bonding/bond_sysfs_slave.c | 2 +-
drivers/net/bonding/bonding.h | 1 -
include/linux/netdevice.h | 5 -
include/net/rtnetlink.h | 14 +++
include/uapi/linux/if_link.h | 21 ++--
net/core/rtnetlink.c | 209 ++++++++++++++++++++++-----------
8 files changed, 190 insertions(+), 96 deletions(-)
--
1.8.3.1
^ permalink raw reply
* [patch net-next 1/5] bonding: change name of sysfs dir for bonding slaves
From: Jiri Pirko @ 2014-01-22 8:05 UTC (permalink / raw)
To: netdev
Cc: davem, fubar, vfalico, andy, sfeldma, stephen, vyasevic,
nicolas.dichtel, john.r.fastabend
In-Reply-To: <1390377957-31466-1-git-send-email-jiri@resnulli.us>
Allow user to identify easily what the attributes are related to. Change
the name of the group to "bonding_slave" to be similar to master which
is named "bonding".
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
drivers/net/bonding/bond_sysfs_slave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c
index 7cb97de..84b0e38 100644
--- a/drivers/net/bonding/bond_sysfs_slave.c
+++ b/drivers/net/bonding/bond_sysfs_slave.c
@@ -118,7 +118,7 @@ int bond_sysfs_slave_add(struct slave *slave)
int err;
err = kobject_init_and_add(&slave->kobj, &slave_ktype,
- &(slave->dev->dev.kobj), "slave");
+ &(slave->dev->dev.kobj), "bonding_slave");
if (err)
return err;
--
1.8.3.1
^ permalink raw reply related
* [patch net-next 2/5] rtnetlink: put "BOND" into nl attribute names which are related to bonding
From: Jiri Pirko @ 2014-01-22 8:05 UTC (permalink / raw)
To: netdev
Cc: davem, fubar, vfalico, andy, sfeldma, stephen, vyasevic,
nicolas.dichtel, john.r.fastabend
In-Reply-To: <1390377957-31466-1-git-send-email-jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
drivers/net/bonding/bond_netlink.c | 12 ++++++------
include/uapi/linux/if_link.h | 19 ++++++++++---------
net/core/rtnetlink.c | 16 ++++++++--------
3 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index 21c6488..dd786a3 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -27,27 +27,27 @@ int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb)
struct slave *slave = bond_slave_get_rtnl(slave_dev);
const struct aggregator *agg;
- if (nla_put_u8(skb, IFLA_SLAVE_STATE, bond_slave_state(slave)))
+ if (nla_put_u8(skb, IFLA_BOND_SLAVE_STATE, bond_slave_state(slave)))
goto nla_put_failure;
- if (nla_put_u8(skb, IFLA_SLAVE_MII_STATUS, slave->link))
+ if (nla_put_u8(skb, IFLA_BOND_SLAVE_MII_STATUS, slave->link))
goto nla_put_failure;
- if (nla_put_u32(skb, IFLA_SLAVE_LINK_FAILURE_COUNT,
+ if (nla_put_u32(skb, IFLA_BOND_SLAVE_LINK_FAILURE_COUNT,
slave->link_failure_count))
goto nla_put_failure;
- if (nla_put(skb, IFLA_SLAVE_PERM_HWADDR,
+ if (nla_put(skb, IFLA_BOND_SLAVE_PERM_HWADDR,
slave_dev->addr_len, slave->perm_hwaddr))
goto nla_put_failure;
- if (nla_put_u16(skb, IFLA_SLAVE_QUEUE_ID, slave->queue_id))
+ if (nla_put_u16(skb, IFLA_BOND_SLAVE_QUEUE_ID, slave->queue_id))
goto nla_put_failure;
if (slave->bond->params.mode == BOND_MODE_8023AD) {
agg = SLAVE_AD_INFO(slave).port.aggregator;
if (agg)
- if (nla_put_u16(skb, IFLA_SLAVE_AD_AGGREGATOR_ID,
+ if (nla_put_u16(skb, IFLA_BOND_SLAVE_AD_AGGREGATOR_ID,
agg->aggregator_identifier))
goto nla_put_failure;
}
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index ba2f3bf..1f30b85 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -144,7 +144,7 @@ enum {
IFLA_NUM_RX_QUEUES,
IFLA_CARRIER,
IFLA_PHYS_PORT_ID,
- IFLA_SLAVE,
+ IFLA_BOND_SLAVE,
__IFLA_MAX
};
@@ -370,16 +370,17 @@ enum {
#define IFLA_BOND_AD_INFO_MAX (__IFLA_BOND_AD_INFO_MAX - 1)
enum {
- IFLA_SLAVE_STATE,
- IFLA_SLAVE_MII_STATUS,
- IFLA_SLAVE_LINK_FAILURE_COUNT,
- IFLA_SLAVE_PERM_HWADDR,
- IFLA_SLAVE_QUEUE_ID,
- IFLA_SLAVE_AD_AGGREGATOR_ID,
- __IFLA_SLAVE_MAX,
+ IFLA_BOND_SLAVE_UNSPEC,
+ IFLA_BOND_SLAVE_STATE,
+ IFLA_BOND_SLAVE_MII_STATUS,
+ IFLA_BOND_SLAVE_LINK_FAILURE_COUNT,
+ IFLA_BOND_SLAVE_PERM_HWADDR,
+ IFLA_BOND_SLAVE_QUEUE_ID,
+ IFLA_BOND_SLAVE_AD_AGGREGATOR_ID,
+ __IFLA_BOND_SLAVE_MAX,
};
-#define IFLA_SLAVE_MAX (__IFLA_SLAVE_MAX - 1)
+#define IFLA_BOND_SLAVE_MAX (__IFLA_BOND_SLAVE_MAX - 1)
/* SR-IOV virtual function management section */
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 4f85de7..cace149 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -725,13 +725,13 @@ static size_t rtnl_bond_slave_size(const struct net_device *dev)
{
struct net_device *bond;
size_t slave_size =
- nla_total_size(sizeof(struct nlattr)) + /* IFLA_SLAVE */
- nla_total_size(1) + /* IFLA_SLAVE_STATE */
- nla_total_size(1) + /* IFLA_SLAVE_MII_STATUS */
- nla_total_size(4) + /* IFLA_SLAVE_LINK_FAILURE_COUNT */
- nla_total_size(MAX_ADDR_LEN) + /* IFLA_SLAVE_PERM_HWADDR */
- nla_total_size(2) + /* IFLA_SLAVE_QUEUE_ID */
- nla_total_size(2) + /* IFLA_SLAVE_AD_AGGREGATOR_ID */
+ nla_total_size(sizeof(struct nlattr)) + /* IFLA_BOND_SLAVE */
+ nla_total_size(1) + /* IFLA_BOND_SLAVE_STATE */
+ nla_total_size(1) + /* IFLA_BOND_SLAVE_MII_STATUS */
+ nla_total_size(4) + /* IFLA_BOND_SLAVE_LINK_FAILURE_COUNT */
+ nla_total_size(MAX_ADDR_LEN) + /* IFLA_BOND_SLAVE_PERM_HWADDR */
+ nla_total_size(2) + /* IFLA_BOND_SLAVE_QUEUE_ID */
+ nla_total_size(2) + /* IFLA_BOND_SLAVE_AD_AGGREGATOR_ID */
0;
if (netif_is_bond_slave((struct net_device *)dev)) {
@@ -883,7 +883,7 @@ static size_t rtnl_bond_slave_fill(struct sk_buff *skb, struct net_device *dev)
if (!bond || !bond->netdev_ops->ndo_get_slave)
return 0;
- nest = nla_nest_start(skb, IFLA_SLAVE);
+ nest = nla_nest_start(skb, IFLA_BOND_SLAVE);
if (!nest)
return -EMSGSIZE;
--
1.8.3.1
^ permalink raw reply related
* [patch net-next 3/5] rtnetlink: provide api for getting and setting slave info
From: Jiri Pirko @ 2014-01-22 8:05 UTC (permalink / raw)
To: netdev
Cc: davem, fubar, vfalico, andy, sfeldma, stephen, vyasevic,
nicolas.dichtel, john.r.fastabend
In-Reply-To: <1390377957-31466-1-git-send-email-jiri@resnulli.us>
Recent patch
bonding: add netlink attributes to slave link dev (1d3ee88ae0d6)
Introduced yet another device specific way to access slave information
over rtnetlink. There is one already there for bridge.
This patch introduces generic way to do this, for getting and setting
info as well by extending link_ops. Later on, this new interface will
be used for bridge ports as well.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
include/net/rtnetlink.h | 14 ++++
include/uapi/linux/if_link.h | 2 +
net/core/rtnetlink.c | 158 +++++++++++++++++++++++++++++++++++++------
3 files changed, 154 insertions(+), 20 deletions(-)
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 8fb4207..661e45d 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -79,6 +79,20 @@ struct rtnl_link_ops {
const struct net_device *dev);
unsigned int (*get_num_tx_queues)(void);
unsigned int (*get_num_rx_queues)(void);
+
+ int slave_maxtype;
+ const struct nla_policy *slave_policy;
+ int (*slave_validate)(struct nlattr *tb[],
+ struct nlattr *data[]);
+ int (*slave_changelink)(struct net_device *dev,
+ struct net_device *slave_dev,
+ struct nlattr *tb[],
+ struct nlattr *data[]);
+ size_t (*get_slave_size)(const struct net_device *dev,
+ const struct net_device *slave_dev);
+ int (*fill_slave_info)(struct sk_buff *skb,
+ const struct net_device *dev,
+ const struct net_device *slave_dev);
};
int __rtnl_link_register(struct rtnl_link_ops *ops);
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 1f30b85..b8fb352 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -241,6 +241,8 @@ enum {
IFLA_INFO_KIND,
IFLA_INFO_DATA,
IFLA_INFO_XSTATS,
+ IFLA_INFO_SLAVE_KIND,
+ IFLA_INFO_SLAVE_DATA,
__IFLA_INFO_MAX,
};
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index cace149..a56bccf 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -365,6 +365,22 @@ void rtnl_link_unregister(struct rtnl_link_ops *ops)
}
EXPORT_SYMBOL_GPL(rtnl_link_unregister);
+static size_t rtnl_link_get_slave_info_data_size(const struct net_device *dev)
+{
+ struct net_device *master_dev;
+ const struct rtnl_link_ops *ops;
+
+ master_dev = netdev_master_upper_dev_get((struct net_device *) dev);
+ if (!master_dev)
+ return 0;
+ ops = master_dev->rtnl_link_ops;
+ if (!ops->get_slave_size)
+ return 0;
+ /* IFLA_INFO_SLAVE_DATA + nested data */
+ return nla_total_size(sizeof(struct nlattr)) +
+ ops->get_slave_size(master_dev, dev);
+}
+
static size_t rtnl_link_get_size(const struct net_device *dev)
{
const struct rtnl_link_ops *ops = dev->rtnl_link_ops;
@@ -385,6 +401,8 @@ static size_t rtnl_link_get_size(const struct net_device *dev)
/* IFLA_INFO_XSTATS */
size += nla_total_size(ops->get_xstats_size(dev));
+ size += rtnl_link_get_slave_info_data_size(dev);
+
return size;
}
@@ -459,40 +477,101 @@ static size_t rtnl_link_get_af_size(const struct net_device *dev)
return size;
}
-static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
+static bool rtnl_have_link_slave_info(const struct net_device *dev)
{
- const struct rtnl_link_ops *ops = dev->rtnl_link_ops;
- struct nlattr *linkinfo, *data;
- int err = -EMSGSIZE;
+ struct net_device *master_dev;
- linkinfo = nla_nest_start(skb, IFLA_LINKINFO);
- if (linkinfo == NULL)
- goto out;
+ master_dev = netdev_master_upper_dev_get((struct net_device *) dev);
+ if (master_dev && master_dev->rtnl_link_ops &&
+ master_dev->rtnl_link_ops->fill_slave_info)
+ return true;
+ return false;
+}
+
+static int rtnl_link_slave_info_fill(struct sk_buff *skb,
+ const struct net_device *dev)
+{
+ struct net_device *master_dev;
+ const struct rtnl_link_ops *ops;
+ struct nlattr *slave_data;
+ int err;
+ master_dev = netdev_master_upper_dev_get((struct net_device *) dev);
+ if (!master_dev)
+ return 0;
+ ops = master_dev->rtnl_link_ops;
+ if (!ops)
+ return 0;
+ if (nla_put_string(skb, IFLA_INFO_SLAVE_KIND, ops->kind) < 0)
+ return -EMSGSIZE;
+ if (ops->fill_slave_info) {
+ slave_data = nla_nest_start(skb, IFLA_INFO_SLAVE_DATA);
+ if (!slave_data)
+ return -EMSGSIZE;
+ err = ops->fill_slave_info(skb, master_dev, dev);
+ if (err < 0)
+ goto err_cancel_slave_data;
+ nla_nest_end(skb, slave_data);
+ }
+ return 0;
+
+err_cancel_slave_data:
+ nla_nest_cancel(skb, slave_data);
+ return err;
+}
+
+static int rtnl_link_info_fill(struct sk_buff *skb,
+ const struct net_device *dev)
+{
+ const struct rtnl_link_ops *ops = dev->rtnl_link_ops;
+ struct nlattr *data;
+ int err;
+
+ if (!ops)
+ return 0;
if (nla_put_string(skb, IFLA_INFO_KIND, ops->kind) < 0)
- goto err_cancel_link;
+ return -EMSGSIZE;
if (ops->fill_xstats) {
err = ops->fill_xstats(skb, dev);
if (err < 0)
- goto err_cancel_link;
+ return err;
}
if (ops->fill_info) {
data = nla_nest_start(skb, IFLA_INFO_DATA);
- if (data == NULL) {
- err = -EMSGSIZE;
- goto err_cancel_link;
- }
+ if (data == NULL)
+ return -EMSGSIZE;
err = ops->fill_info(skb, dev);
if (err < 0)
goto err_cancel_data;
nla_nest_end(skb, data);
}
-
- nla_nest_end(skb, linkinfo);
return 0;
err_cancel_data:
nla_nest_cancel(skb, data);
+ return err;
+}
+
+static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
+{
+ struct nlattr *linkinfo;
+ int err = -EMSGSIZE;
+
+ linkinfo = nla_nest_start(skb, IFLA_LINKINFO);
+ if (linkinfo == NULL)
+ goto out;
+
+ err = rtnl_link_info_fill(skb, dev);
+ if (err < 0)
+ goto err_cancel_link;
+
+ err = rtnl_link_slave_info_fill(skb, dev);
+ if (err < 0)
+ goto err_cancel_link;
+
+ nla_nest_end(skb, linkinfo);
+ return 0;
+
err_cancel_link:
nla_nest_cancel(skb, linkinfo);
out:
@@ -1052,10 +1131,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
if (rtnl_port_fill(skb, dev))
goto nla_put_failure;
- if (rtnl_bond_slave_fill(skb, dev))
- goto nla_put_failure;
-
- if (dev->rtnl_link_ops) {
+ if (dev->rtnl_link_ops || rtnl_have_link_slave_info(dev)) {
if (rtnl_link_fill(skb, dev) < 0)
goto nla_put_failure;
}
@@ -1178,6 +1254,8 @@ EXPORT_SYMBOL(ifla_policy);
static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
[IFLA_INFO_KIND] = { .type = NLA_STRING },
[IFLA_INFO_DATA] = { .type = NLA_NESTED },
+ [IFLA_INFO_SLAVE_KIND] = { .type = NLA_STRING },
+ [IFLA_INFO_SLAVE_DATA] = { .type = NLA_NESTED },
};
static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = {
@@ -1765,7 +1843,9 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh)
{
struct net *net = sock_net(skb->sk);
const struct rtnl_link_ops *ops;
+ const struct rtnl_link_ops *m_ops = NULL;
struct net_device *dev;
+ struct net_device *master_dev = NULL;
struct ifinfomsg *ifm;
char kind[MODULE_NAME_LEN];
char ifname[IFNAMSIZ];
@@ -1795,6 +1875,12 @@ replay:
dev = NULL;
}
+ if (dev) {
+ master_dev = netdev_master_upper_dev_get(dev);
+ if (master_dev)
+ m_ops = master_dev->rtnl_link_ops;
+ }
+
err = validate_linkmsg(dev, tb);
if (err < 0)
return err;
@@ -1816,7 +1902,10 @@ replay:
}
if (1) {
- struct nlattr *attr[ops ? ops->maxtype + 1 : 0], **data = NULL;
+ struct nlattr *attr[ops ? ops->maxtype + 1 : 0];
+ struct nlattr *slave_attr[m_ops ? m_ops->slave_maxtype + 1 : 0];
+ struct nlattr **data = NULL;
+ struct nlattr **slave_data = NULL;
struct net *dest_net;
if (ops) {
@@ -1835,6 +1924,24 @@ replay:
}
}
+ if (m_ops) {
+ if (m_ops->slave_maxtype &&
+ linkinfo[IFLA_INFO_SLAVE_DATA]) {
+ err = nla_parse_nested(slave_attr,
+ m_ops->slave_maxtype,
+ linkinfo[IFLA_INFO_SLAVE_DATA],
+ m_ops->slave_policy);
+ if (err < 0)
+ return err;
+ slave_data = slave_attr;
+ }
+ if (m_ops->slave_validate) {
+ err = m_ops->slave_validate(tb, slave_data);
+ if (err < 0)
+ return err;
+ }
+ }
+
if (dev) {
int modified = 0;
@@ -1854,6 +1961,17 @@ replay:
modified = 1;
}
+ if (linkinfo[IFLA_INFO_SLAVE_DATA]) {
+ if (!m_ops || !m_ops->slave_changelink)
+ return -EOPNOTSUPP;
+
+ err = m_ops->slave_changelink(master_dev, dev,
+ tb, slave_data);
+ if (err < 0)
+ return err;
+ modified = 1;
+ }
+
return do_setlink(dev, ifm, tb, ifname, modified);
}
--
1.8.3.1
^ permalink raw reply related
* [patch net-next 4/5] bonding: convert netlink to use slave data info api
From: Jiri Pirko @ 2014-01-22 8:05 UTC (permalink / raw)
To: netdev
Cc: davem, fubar, vfalico, andy, sfeldma, stephen, vyasevic,
nicolas.dichtel, john.r.fastabend
In-Reply-To: <1390377957-31466-1-git-send-email-jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
drivers/net/bonding/bond_main.c | 1 -
drivers/net/bonding/bond_netlink.c | 21 ++++++++++++++--
drivers/net/bonding/bonding.h | 1 -
net/core/rtnetlink.c | 51 --------------------------------------
4 files changed, 19 insertions(+), 55 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3220b48..df85cec 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3883,7 +3883,6 @@ static const struct net_device_ops bond_netdev_ops = {
#endif
.ndo_add_slave = bond_enslave,
.ndo_del_slave = bond_release,
- .ndo_get_slave = bond_get_slave,
.ndo_fix_features = bond_fix_features,
};
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index dd786a3..524d7ce 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -22,10 +22,23 @@
#include <linux/reciprocal_div.h>
#include "bonding.h"
-int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb)
+static size_t bond_get_slave_size(const struct net_device *bond_dev,
+ const struct net_device *slave_dev)
+{
+ return nla_total_size(sizeof(u8)) + /* IFLA_BOND_SLAVE_STATE */
+ nla_total_size(sizeof(u8)) + /* IFLA_BOND_SLAVE_MII_STATUS */
+ nla_total_size(sizeof(u32)) + /* IFLA_BOND_SLAVE_LINK_FAILURE_COUNT */
+ nla_total_size(MAX_ADDR_LEN) + /* IFLA_BOND_SLAVE_PERM_HWADDR */
+ nla_total_size(sizeof(u16)) + /* IFLA_BOND_SLAVE_QUEUE_ID */
+ nla_total_size(sizeof(u16)) + /* IFLA_BOND_SLAVE_AD_AGGREGATOR_ID */
+ 0;
+}
+
+static int bond_fill_slave_info(struct sk_buff *skb,
+ const struct net_device *bond_dev,
+ const struct net_device *slave_dev)
{
struct slave *slave = bond_slave_get_rtnl(slave_dev);
- const struct aggregator *agg;
if (nla_put_u8(skb, IFLA_BOND_SLAVE_STATE, bond_slave_state(slave)))
goto nla_put_failure;
@@ -45,6 +58,8 @@ int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb)
goto nla_put_failure;
if (slave->bond->params.mode == BOND_MODE_8023AD) {
+ const struct aggregator *agg;
+
agg = SLAVE_AD_INFO(slave).port.aggregator;
if (agg)
if (nla_put_u16(skb, IFLA_BOND_SLAVE_AD_AGGREGATOR_ID,
@@ -518,6 +533,8 @@ struct rtnl_link_ops bond_link_ops __read_mostly = {
.get_num_tx_queues = bond_get_num_tx_queues,
.get_num_rx_queues = bond_get_num_tx_queues, /* Use the same number
as for TX queues */
+ .get_slave_size = bond_get_slave_size,
+ .fill_slave_info = bond_fill_slave_info,
};
int __init bond_netlink_init(void)
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 8a935f8..5033e83 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -432,7 +432,6 @@ int bond_sysfs_slave_add(struct slave *slave);
void bond_sysfs_slave_del(struct slave *slave);
int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
-int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb);
int bond_xmit_hash(struct bonding *bond, struct sk_buff *skb, int count);
int bond_parse_parm(const char *mode_arg, const struct bond_parm_tbl *tbl);
int bond_parm_tbl_lookup(int mode, const struct bond_parm_tbl *tbl);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a56bccf..db6a239 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -800,28 +800,6 @@ static size_t rtnl_port_size(const struct net_device *dev)
return port_self_size;
}
-static size_t rtnl_bond_slave_size(const struct net_device *dev)
-{
- struct net_device *bond;
- size_t slave_size =
- nla_total_size(sizeof(struct nlattr)) + /* IFLA_BOND_SLAVE */
- nla_total_size(1) + /* IFLA_BOND_SLAVE_STATE */
- nla_total_size(1) + /* IFLA_BOND_SLAVE_MII_STATUS */
- nla_total_size(4) + /* IFLA_BOND_SLAVE_LINK_FAILURE_COUNT */
- nla_total_size(MAX_ADDR_LEN) + /* IFLA_BOND_SLAVE_PERM_HWADDR */
- nla_total_size(2) + /* IFLA_BOND_SLAVE_QUEUE_ID */
- nla_total_size(2) + /* IFLA_BOND_SLAVE_AD_AGGREGATOR_ID */
- 0;
-
- if (netif_is_bond_slave((struct net_device *)dev)) {
- bond = netdev_master_upper_dev_get((struct net_device *)dev);
- if (bond && bond->netdev_ops->ndo_get_slave)
- return slave_size;
- }
-
- return 0;
-}
-
static noinline size_t if_nlmsg_size(const struct net_device *dev,
u32 ext_filter_mask)
{
@@ -851,7 +829,6 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
+ rtnl_port_size(dev) /* IFLA_VF_PORTS + IFLA_PORT_SELF */
+ rtnl_link_get_size(dev) /* IFLA_LINKINFO */
+ rtnl_link_get_af_size(dev) /* IFLA_AF_SPEC */
- + rtnl_bond_slave_size(dev) /* IFLA_SLAVE */
+ nla_total_size(MAX_PHYS_PORT_ID_LEN); /* IFLA_PHYS_PORT_ID */
}
@@ -949,34 +926,6 @@ static int rtnl_phys_port_id_fill(struct sk_buff *skb, struct net_device *dev)
return 0;
}
-static size_t rtnl_bond_slave_fill(struct sk_buff *skb, struct net_device *dev)
-{
- struct net_device *bond;
- struct nlattr *nest;
- int err;
-
- if (!netif_is_bond_slave(dev))
- return 0;
-
- bond = netdev_master_upper_dev_get(dev);
- if (!bond || !bond->netdev_ops->ndo_get_slave)
- return 0;
-
- nest = nla_nest_start(skb, IFLA_BOND_SLAVE);
- if (!nest)
- return -EMSGSIZE;
-
- err = bond->netdev_ops->ndo_get_slave(dev, skb);
- if (err) {
- nla_nest_cancel(skb, nest);
- return (err == -EMSGSIZE) ? err : 0;
- }
-
- nla_nest_end(skb, nest);
-
- return 0;
-}
-
static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
int type, u32 pid, u32 seq, u32 change,
unsigned int flags, u32 ext_filter_mask)
--
1.8.3.1
^ 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