Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH v5 2/7] ipv6 addrconf: remove addrconf_sysctl_hop_limit()
From: YOSHIFUJI Hideaki @ 2016-09-27 10:18 UTC (permalink / raw)
  To: Maciej Żenczykowski, Maciej Żenczykowski,
	David S . Miller
  Cc: hideaki.yoshifuji, netdev, Erik Kline, Lorenzo Colitti,
	Hannes Frederic Sowa
In-Reply-To: <1474969963-17402-3-git-send-email-zenczykowski@gmail.com>

Hi,

Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> replace with extra1/2 magic
> 
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---
>  net/ipv6/addrconf.c | 21 ++++++---------------
>  1 file changed, 6 insertions(+), 15 deletions(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 11fa1a5564d4..8bd2d06eefe7 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -5467,20 +5467,6 @@ int addrconf_sysctl_forward(struct ctl_table *ctl, int write,
>  }
>  
>  static
> -int addrconf_sysctl_hop_limit(struct ctl_table *ctl, int write,
> -                              void __user *buffer, size_t *lenp, loff_t *ppos)
> -{
> -	struct ctl_table lctl;
> -	int min_hl = 1, max_hl = 255;
> -
> -	lctl = *ctl;
> -	lctl.extra1 = &min_hl;
> -	lctl.extra2 = &max_hl;
> -
> -	return proc_dointvec_minmax(&lctl, write, buffer, lenp, ppos);
> -}
> -
> -static
>  int addrconf_sysctl_mtu(struct ctl_table *ctl, int write,
>  			void __user *buffer, size_t *lenp, loff_t *ppos)
>  {
> @@ -5713,6 +5699,9 @@ int addrconf_sysctl_ignore_routes_with_linkdown(struct ctl_table *ctl,
>  	return ret;
>  }
>  
> +static const int one = 1;
> +static const int two_five_five = 255;
> +
>  static const struct ctl_table addrconf_sysctl[] = {
>  	{
>  		.procname	= "forwarding",
> @@ -5726,7 +5715,9 @@ static const struct ctl_table addrconf_sysctl[] = {
>  		.data		= &ipv6_devconf.hop_limit,
>  		.maxlen		= sizeof(int),
>  		.mode		= 0644,
> -		.proc_handler	= addrconf_sysctl_hop_limit,
> +		.proc_handler	= proc_dointvec_minmax,
> +		.extra1		= (void *)&one,
> +		.extra2		= (void *)&two_five_five,
>  	},
>  	{
>  		.procname	= "mtu",
> 

Please submit this in a different series of patches
(like 1/7).

--yoshfuji

^ permalink raw reply

* Re: [PATCH v5 1/7] ipv6 addrconf: enable use of proc_dointvec_minmax in addrconf_sysctl
From: YOSHIFUJI Hideaki @ 2016-09-27 10:16 UTC (permalink / raw)
  To: Maciej Żenczykowski, Maciej Żenczykowski,
	David S . Miller
  Cc: hideaki.yoshifuji, netdev, Erik Kline, Lorenzo Colitti,
	Hannes Frederic Sowa
In-Reply-To: <1474969963-17402-2-git-send-email-zenczykowski@gmail.com>

Hi,

Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---
>  net/ipv6/addrconf.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 2f1f5d439788..11fa1a5564d4 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -6044,8 +6044,14 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name,
>  
>  	for (i = 0; table[i].data; i++) {
>  		table[i].data += (char *)p - (char *)&ipv6_devconf;
> -		table[i].extra1 = idev; /* embedded; no ref */
> -		table[i].extra2 = net;
> +		/* If one of these is already set, then it is not safe to
> +		 * overwrite either of them: this makes proc_dointvec_minmax
> +		 * usable.
> +		 */
> +		if (!table[i].extra1 && !table[i].extra2) {
> +			table[i].extra1 = idev; /* embedded; no ref */
> +			table[i].extra2 = net;
> +		}
>  	}
>  
>  	snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name);
> 

This seems nothing to do with the RFC7559 changes.
Why don't you submit this as a separate patch?

-- 
Hideaki Yoshifuji <hideaki.yoshifuji@miraclelinux.com>
Technical Division, MIRACLE LINUX CORPORATION

^ permalink raw reply

* [PATCH] brcmfmac: replace WARNING on timeout with a simple error message
From: Rafał Miłecki @ 2016-09-27 10:12 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arend van Spriel, Franky Lin, Hante Meuleman,
	Pieter-Paul Giesberts, Franky Lin, linux-wireless,
	brcm80211-dev-list.pdl, netdev, linux-kernel,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

Even with timeout increased to 950 ms we get WARNINGs from time to time.
It mostly happens on A-MPDU stalls (e.g. when station goes out of
range). It may take up to 5-10 secods for the firmware to recover and
for that time it doesn't process packets.

It's still useful to have a message on time out as it may indicate some
firmware problem and incorrect key update. Raising a WARNING however
wasn't really that necessary, it doesn't point to any driver bug anymore
and backtrace wasn't much useful.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 6d046ba..9e6f60a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -1161,7 +1161,8 @@ int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp)
 				 !brcmf_get_pend_8021x_cnt(ifp),
 				 MAX_WAIT_FOR_8021X_TX);
 
-	WARN_ON(!err);
+	if (!err)
+		brcmf_err("Timed out waiting for no pending 802.1x packets\n");
 
 	return !err;
 }
-- 
2.9.3

^ permalink raw reply related

* Re: [PATCH v4 4/7] ipv6 addrconf: add new sysctl 'router_solicitation_max_interval'
From: Maciej Żenczykowski @ 2016-09-27 10:08 UTC (permalink / raw)
  To: Hannes Frederic Sowa
  Cc: David S . Miller, Linux NetDev, Erik Kline, Lorenzo Colitti
In-Reply-To: <8e332a23-5653-1e70-7c74-e7bcbbe0884a@stressinduktion.org>

> Good point. Using ms should actually be easy, instead of
> proc_dointvec_jiffies you can use proc_dointvec_ms_jiffies.

Yes, I'm aware of this, but 'proc_dointvec_ms_jiffies' seems to be a
bit of a hack, and especially for large settings like this exporting
them to userspace in units of ms instead of seconds seems to impose
unnecessary cognitive burden on the user.

(furthermore the other two related settings are exported as seconds)

> It seems good practice to add a _ms then to the sysctl, too.

If we wanted to do that, we'd have to add _ms versions of
router_solicitation_{delay,interval}.
This seems like pointless duplication - since we can't actually delete
the older seconds one.

There isn't really any real world scenario I can think of (besides
unit-testing) where ms granularity would be useful.

If we were to actually fix proc_dointvec_jiffies to accept fractional
seconds, we'd fix all of these interfaces in one fell swoop...

I took a look at what this would take, and there doesn't really appear
to be a nice way to do it :-(
The lower level conversion functions get a character buffer and
convert it to/from an int (or maybe long).

We'd either need to switch these over to take a void* or add an
entirely separate implementation of proc_dointvec_jiffies...

(at which point it could probably also parse units (ns, us, ms, s, m,
h, d) on input if we wanted to...)

> I am fine with both ways.

I'm going to leave this as is (especially since I send out v5 before I
saw your comment)

^ permalink raw reply

* Re: [PATCH 4.9] brcmfmac: use correct skb freeing helper when deleting flowring
From: Arend Van Spriel @ 2016-09-27 10:05 UTC (permalink / raw)
  To: Rafał Miłecki, Kalle Valo
  Cc: Franky Lin, Hante Meuleman, Pieter-Paul Giesberts, Franky Lin,
	linux-wireless, brcm80211-dev-list.pdl, netdev, linux-kernel,
	Rafał Miłecki
In-Reply-To: <20160927091428.19223-1-zajec5@gmail.com>

On 27-9-2016 11:14, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> Flowrings contain skbs waiting for transmission that were passed to us
> by netif. It means we checked every one of them looking for 802.1x
> Ethernet type. When deleting flowring we have to use freeing function
> that will check for 802.1x type as well.
> 
> Freeing skbs without a proper check was leading to counter not being
> properly decreased. This was triggering a WARNING every time
> brcmf_netdev_wait_pend8021x was called.

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> Kalle: this isn't important enough for 4.8 as it's too late for that.
> 
> I'd like to get it for 4.9 however, as this fixes bug that could lead
> to WARNING on every add_key/del_key call. We was struggling with these
> WARNINGs for some time and this fixes one of two problems causing them.

Please mark it for stable as well.

> ---
>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
> index b16b367..d0b738d 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
> @@ -234,13 +234,20 @@ static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
>  
>  void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
>  {
> +	struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
>  	struct brcmf_flowring_ring *ring;
> +	struct brcmf_if *ifp;
>  	u16 hash_idx;
> +	u8 ifidx;
>  	struct sk_buff *skb;
>  
>  	ring = flow->rings[flowid];
>  	if (!ring)
>  		return;
> +
> +	ifidx = brcmf_flowring_ifidx_get(flow, flowid);
> +	ifp = brcmf_get_ifp(bus_if->drvr, ifidx);
> +
>  	brcmf_flowring_block(flow, flowid, false);
>  	hash_idx = ring->hash_id;
>  	flow->hash[hash_idx].ifidx = BRCMF_FLOWRING_INVALID_IFIDX;

I am not very familiar with flowring code, but I suppose this is just
initializing the entry for later use, right?

> @@ -249,7 +256,7 @@ void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
>  
>  	skb = skb_dequeue(&ring->skblist);
>  	while (skb) {
> -		brcmu_pkt_buf_free_skb(skb);
> +		brcmf_txfinalize(ifp, skb, false);
>  		skb = skb_dequeue(&ring->skblist);
>  	}
>  
> 

^ permalink raw reply

* Re: linux-next: Tree for Sep 27
From: Sergey Senozhatsky @ 2016-09-27 10:03 UTC (permalink / raw)
  To: Aaron Conole
  Cc: linux-next, linux-kernel, Stephen Rothwell, Florian Westphal,
	Pablo Neira Ayuso, netdev, netfilter-devel, Sergey Senozhatsky,
	Sergey Senozhatsky
In-Reply-To: <20160927164026.741b290b@canb.auug.org.au>

Hello,

On (09/27/16 16:40), Stephen Rothwell wrote:
> 
> Changes since 20160923:
> 

seems that commit e3b37f11e6e4e6b6 ("netfilter: replace list_head with
single linked list") breaks the build on !CONFIG_NETFILTER_INGRESS systems
accessing ->nf_hooks_ingress

static void nf_set_hooks_head(struct net *net, const struct nf_hook_ops *reg,
                             struct nf_hook_entry *entry)
{
       switch (reg->pf) {
       case NFPROTO_NETDEV:
               /* We already checked in nf_register_net_hook() that this is
                * used from ingress.
                */
               rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
					^^^^^^^^^^^^^^^^^^^^


log:


In file included from ./include/linux/linkage.h:4:0,
                 from ./include/linux/kernel.h:6,
                 from net/netfilter/core.c:10:
net/netfilter/core.c: In function ‘nf_set_hooks_head’:
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:322:17: note: in definition of macro ‘WRITE_ONCE’
  union { typeof(x) __val; char __c[1]; } __u = \
                 ^
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:323:30: note: in definition of macro ‘WRITE_ONCE’
   { .__val = (__force typeof(x)) (val) }; \
                              ^
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:323:35: note: in definition of macro ‘WRITE_ONCE’
   { .__val = (__force typeof(x)) (val) }; \
                                   ^~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:324:22: note: in definition of macro ‘WRITE_ONCE’
  __write_once_size(&(x), __u.__c, sizeof(x)); \
                      ^
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:324:42: note: in definition of macro ‘WRITE_ONCE’
  __write_once_size(&(x), __u.__c, sizeof(x)); \
                                          ^
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
In file included from ./include/linux/linkage.h:4:0,
                 from ./include/linux/kernel.h:6,
                 from net/netfilter/core.c:10:
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:498:19: note: in definition of macro ‘__compiletime_assert’
   bool __cond = !(condition);    \
                   ^~~~~~~~~
./include/linux/compiler.h:518:2: note: in expansion of macro ‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
  ^~~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:521:2: note: in expansion of macro ‘compiletime_assert’
  compiletime_assert(__native_word(t),    \
  ^~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:521:21: note: in expansion of macro ‘__native_word’
  compiletime_assert(__native_word(t),    \
                     ^~~~~~~~~~~~~
./arch/x86/include/asm/barrier.h:64:2: note: in expansion of macro ‘compiletime_assert_atomic_type’
  compiletime_assert_atomic_type(*p);    \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:498:19: note: in definition of macro ‘__compiletime_assert’
   bool __cond = !(condition);    \
                   ^~~~~~~~~
./include/linux/compiler.h:518:2: note: in expansion of macro ‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
  ^~~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:521:2: note: in expansion of macro ‘compiletime_assert’
  compiletime_assert(__native_word(t),    \
  ^~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:521:21: note: in expansion of macro ‘__native_word’
  compiletime_assert(__native_word(t),    \
                     ^~~~~~~~~~~~~
./arch/x86/include/asm/barrier.h:64:2: note: in expansion of macro ‘compiletime_assert_atomic_type’
  compiletime_assert_atomic_type(*p);    \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:498:19: note: in definition of macro ‘__compiletime_assert’
   bool __cond = !(condition);    \
                   ^~~~~~~~~
./include/linux/compiler.h:518:2: note: in expansion of macro ‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
  ^~~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:521:2: note: in expansion of macro ‘compiletime_assert’
  compiletime_assert(__native_word(t),    \
  ^~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:521:21: note: in expansion of macro ‘__native_word’
  compiletime_assert(__native_word(t),    \
                     ^~~~~~~~~~~~~
./arch/x86/include/asm/barrier.h:64:2: note: in expansion of macro ‘compiletime_assert_atomic_type’
  compiletime_assert_atomic_type(*p);    \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:498:19: note: in definition of macro ‘__compiletime_assert’
   bool __cond = !(condition);    \
                   ^~~~~~~~~
./include/linux/compiler.h:518:2: note: in expansion of macro ‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
  ^~~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:521:2: note: in expansion of macro ‘compiletime_assert’
  compiletime_assert(__native_word(t),    \
  ^~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:521:21: note: in expansion of macro ‘__native_word’
  compiletime_assert(__native_word(t),    \
                     ^~~~~~~~~~~~~
./arch/x86/include/asm/barrier.h:64:2: note: in expansion of macro ‘compiletime_assert_atomic_type’
  compiletime_assert_atomic_type(*p);    \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
In file included from ./include/linux/linkage.h:4:0,
                 from ./include/linux/kernel.h:6,
                 from net/netfilter/core.c:10:
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:322:17: note: in definition of macro ‘WRITE_ONCE’
  union { typeof(x) __val; char __c[1]; } __u = \
                 ^
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:323:30: note: in definition of macro ‘WRITE_ONCE’
   { .__val = (__force typeof(x)) (val) }; \
                              ^
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:323:35: note: in definition of macro ‘WRITE_ONCE’
   { .__val = (__force typeof(x)) (val) }; \
                                   ^~~
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:25: note: in expansion of macro ‘RCU_INITIALIZER’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
                         ^~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:323:35: note: in definition of macro ‘WRITE_ONCE’
   { .__val = (__force typeof(x)) (val) }; \
                                   ^~~
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:25: note: in expansion of macro ‘RCU_INITIALIZER’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
                         ^~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:324:22: note: in definition of macro ‘WRITE_ONCE’
  __write_once_size(&(x), __u.__c, sizeof(x)); \
                      ^
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:30: error: ‘struct net_device’ has no member named ‘nf_hooks_ingress’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
                              ^
./include/linux/compiler.h:324:42: note: in definition of macro ‘WRITE_ONCE’
  __write_once_size(&(x), __u.__c, sizeof(x)); \
                                          ^
./include/asm-generic/barrier.h:157:33: note: in expansion of macro ‘__smp_store_release’
 #define smp_store_release(p, v) __smp_store_release(p, v)
                                 ^~~~~~~~~~~~~~~~~~~
./include/linux/rcupdate.h:668:3: note: in expansion of macro ‘smp_store_release’
   smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
   ^~~~~~~~~~~~~~~~~
net/netfilter/core.c:96:3: note: in expansion of macro ‘rcu_assign_pointer’
   rcu_assign_pointer(reg->dev->nf_hooks_ingress, entry);
   ^~~~~~~~~~~~~~~~~~
  CC      net/ipv4/ip_fragment.o
make[2]: *** [scripts/Makefile.build:290: net/netfilter/core.o] Error 1
make[1]: *** [scripts/Makefile.build:475: net/netfilter] Error 2
make[1]: *** Waiting for unfinished jobs....

	-ss

^ permalink raw reply

* Re: [PATCH v4 5/7] ipv6 addrconf: implement RFC7559 router solicitation backoff
From: Hannes Frederic Sowa @ 2016-09-27  9:58 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: David S . Miller, Linux NetDev, Erik Kline, Lorenzo Colitti
In-Reply-To: <CANP3RGfHPZLHFnp4Rq8_dRNCro6Uh8O8767NgoGu7gvzu5h9BQ@mail.gmail.com>

On 27.09.2016 11:42, Maciej Żenczykowski wrote:
>> Please just use do_div here and go back to the first version of the
>> patch. Variable names could be more aligned with the RFC maybe?
> 
> So I tried:
> 
> static inline s32 rfc3315_s14_backoff_init(s32 irt)
>  {
>        /* multiply 'initial retransmission time' by 0.9 .. 1.1 */
>        u64 tmp = (900000 + prandom_u32() % 200001) * (u64)irt;
>        do_div(tmp, 1000000);
>        return (s32)tmp;
>  }
> 
> static inline s32 rfc3315_s14_backoff_update(s32 rt, s32 mrt)
>  {
>        /* multiply 'retransmission timeout' by 1.9 .. 2.1 */
>        u64 tmp = (1900000 + prandom_u32() % 200001) * (u64)rt;
>        do_div(tmp, 1000000);
>        if ((s32)tmp > mrt) {
>                /* multiply 'maximum retransmission time' by 0.9 .. 1.1 */
>                tmp = (900000 + prandom_u32() % 200001) * (u64)mrt;
>                do_div(tmp, 1000000);
>         }
>        return (s32)tmp;
> }
> 
> but then building for i386 I get:
> 
> ERROR: "__udivdi3" [net/netfilter/xt_hashlimit.ko] undefined!
> 
> which happens even at net-next/master itself.
> 
> Anyway, I'll resubmit assuming the above is what you're looking for...

I think the __udivdi3 comes from the fact you are doing the modulo
operation and the reciprocal divide optimization doesn't work in this
case thus you end up with the call to libgcc.

Can you use the remainder from the do_div operation also?

u32 r = prandom_u32();
u64 tmp = (900000 + do_div(r,200001)) * (u64)irt;

Depending on if you keep the values in ms or jiffies, maybe it would
make sense to simply use msecs_to_jiffies and vice versa?

Thanks,
Hannes

^ permalink raw reply

* Re: [PATCH net 2/5] sctp: reuse sent_count to avoid retransmitted chunks for RTT measurements
From: Xin Long @ 2016-09-27  9:54 UTC (permalink / raw)
  To: Neil Horman
  Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner,
	Vlad Yasevich, daniel
In-Reply-To: <20160926131300.GA6812@hmsreliant.think-freely.org>

>
> Maybe wrap this in a macro?  i.e.:
> #define chunk_retransmitted(chunk) (chunk->sent_count > 1)
>
> For readability?
>
That's a nice suggestion.
chunk->sent_count == 1 is confusing there for reading.
will improve it in v2.

Thanks.

^ permalink raw reply

* [PATCH v5 7/7] ipv6 addrconf: change default MAX_RTR_SOLICITATIONS from 3 to -1 (unlimited)
From: Maciej Żenczykowski @ 2016-09-27  9:52 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller
  Cc: netdev, Erik Kline, Lorenzo Colitti, Hannes Frederic Sowa
In-Reply-To: <1474969963-17402-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <maze@google.com>

This changes:
  /proc/sys/net/ipv6/conf/all/router_solicitations
  /proc/sys/net/ipv6/conf/default/router_solicitations
from 3 to unlimited.

This is the https://tools.ietf.org/html/rfc7559 recommended default.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 include/net/addrconf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 8f3677269f9a..f2d072787947 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -1,7 +1,7 @@
 #ifndef _ADDRCONF_H
 #define _ADDRCONF_H
 
-#define MAX_RTR_SOLICITATIONS		3
+#define MAX_RTR_SOLICITATIONS		-1		/* unlimited */
 #define RTR_SOLICITATION_INTERVAL	(4*HZ)
 #define RTR_SOLICITATION_MAX_INTERVAL	(3600*HZ)	/* 1 hour */
 
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* [PATCH v5 5/7] ipv6 addrconf: implement RFC7559 router solicitation backoff
From: Maciej Żenczykowski @ 2016-09-27  9:52 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller
  Cc: netdev, Erik Kline, Lorenzo Colitti, Hannes Frederic Sowa
In-Reply-To: <1474969963-17402-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <maze@google.com>

This implements:
  https://tools.ietf.org/html/rfc7559

Backoff is performed according to RFC3315 section 14:
  https://tools.ietf.org/html/rfc3315#section-14

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 include/net/if_inet6.h |  1 +
 net/ipv6/addrconf.c    | 34 ++++++++++++++++++++++++++++++----
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 1c8b6820b694..515352c6280a 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -201,6 +201,7 @@ struct inet6_dev {
 	struct ipv6_devstat	stats;
 
 	struct timer_list	rs_timer;
+	__s32			rs_interval;	/* in jiffies */
 	__u8			rs_probes;
 
 	__u8			addr_gen_mode;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 84c46950876a..dc287f57c39b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -112,6 +112,27 @@ static inline u32 cstamp_delta(unsigned long cstamp)
 	return (cstamp - INITIAL_JIFFIES) * 100UL / HZ;
 }
 
+static inline s32 rfc3315_s14_backoff_init(s32 irt)
+{
+	/* multiply 'initial retransmission time' by 0.9 .. 1.1 */
+	u64 tmp = (900000 + prandom_u32() % 200001) * (u64)irt;
+	do_div(tmp, 1000000);
+	return (s32)tmp;
+}
+
+static inline s32 rfc3315_s14_backoff_update(s32 rt, s32 mrt)
+{
+	/* multiply 'retransmission timeout' by 1.9 .. 2.1 */
+	u64 tmp = (1900000 + prandom_u32() % 200001) * (u64)rt;
+	do_div(tmp, 1000000);
+	if ((s32)tmp > mrt) {
+		/* multiply 'maximum retransmission time' by 0.9 .. 1.1 */
+		tmp = (900000 + prandom_u32() % 200001) * (u64)mrt;
+		do_div(tmp, 1000000);
+	}
+	return (s32)tmp;
+}
+
 #ifdef CONFIG_SYSCTL
 static int addrconf_sysctl_register(struct inet6_dev *idev);
 static void addrconf_sysctl_unregister(struct inet6_dev *idev);
@@ -3698,11 +3719,13 @@ static void addrconf_rs_timer(unsigned long data)
 			goto put;
 
 		write_lock(&idev->lock);
+		idev->rs_interval = rfc3315_s14_backoff_update(
+			idev->rs_interval, idev->cnf.rtr_solicit_max_interval);
 		/* The wait after the last probe can be shorter */
 		addrconf_mod_rs_timer(idev, (idev->rs_probes ==
 					     idev->cnf.rtr_solicits) ?
 				      idev->cnf.rtr_solicit_delay :
-				      idev->cnf.rtr_solicit_interval);
+				      idev->rs_interval);
 	} else {
 		/*
 		 * Note: we do not support deprecated "all on-link"
@@ -3973,10 +3996,11 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
 
 		write_lock_bh(&ifp->idev->lock);
 		spin_lock(&ifp->lock);
+		ifp->idev->rs_interval = rfc3315_s14_backoff_init(
+			ifp->idev->cnf.rtr_solicit_interval);
 		ifp->idev->rs_probes = 1;
 		ifp->idev->if_flags |= IF_RS_SENT;
-		addrconf_mod_rs_timer(ifp->idev,
-				      ifp->idev->cnf.rtr_solicit_interval);
+		addrconf_mod_rs_timer(ifp->idev, ifp->idev->rs_interval);
 		spin_unlock(&ifp->lock);
 		write_unlock_bh(&ifp->idev->lock);
 	}
@@ -5132,8 +5156,10 @@ update_lft:
 
 	if (update_rs) {
 		idev->if_flags |= IF_RS_SENT;
+		idev->rs_interval = rfc3315_s14_backoff_init(
+			idev->cnf.rtr_solicit_interval);
 		idev->rs_probes = 1;
-		addrconf_mod_rs_timer(idev, idev->cnf.rtr_solicit_interval);
+		addrconf_mod_rs_timer(idev, idev->rs_interval);
 	}
 
 	/* Well, that's kinda nasty ... */
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* [PATCH v5 6/7] ipv6 addrconf: change default RTR_SOLICITATION_MAX_INTERVAL from 4s to 1h
From: Maciej Żenczykowski @ 2016-09-27  9:52 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller
  Cc: netdev, Erik Kline, Lorenzo Colitti, Hannes Frederic Sowa
In-Reply-To: <1474969963-17402-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <maze@google.com>

This changes:
  /proc/sys/net/ipv6/conf/all/router_solicitation_max_interval
  /proc/sys/net/ipv6/conf/default/router_solicitation_max_interval
from 4 seconds to 1 hour.

This is the https://tools.ietf.org/html/rfc7559 recommended default.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 include/net/addrconf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 275e5af4c2f4..8f3677269f9a 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -3,7 +3,7 @@
 
 #define MAX_RTR_SOLICITATIONS		3
 #define RTR_SOLICITATION_INTERVAL	(4*HZ)
-#define RTR_SOLICITATION_MAX_INTERVAL	(4*HZ)
+#define RTR_SOLICITATION_MAX_INTERVAL	(3600*HZ)	/* 1 hour */
 
 #define MIN_VALID_LIFETIME		(2*3600)	/* 2 hours */
 
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* [PATCH v5 4/7] ipv6 addrconf: add new sysctl 'router_solicitation_max_interval'
From: Maciej Żenczykowski @ 2016-09-27  9:52 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller
  Cc: netdev, Erik Kline, Lorenzo Colitti, Hannes Frederic Sowa
In-Reply-To: <1474969963-17402-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <maze@google.com>

Accessible via:
  /proc/sys/net/ipv6/conf/*/router_solicitation_max_interval

For now we default it to the same value as the normal interval.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 include/linux/ipv6.h      |  1 +
 include/net/addrconf.h    |  1 +
 include/uapi/linux/ipv6.h |  1 +
 net/ipv6/addrconf.c       | 11 +++++++++++
 4 files changed, 14 insertions(+)

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index c6dbcd84a2c7..7e9a789be5e0 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -18,6 +18,7 @@ struct ipv6_devconf {
 	__s32		dad_transmits;
 	__s32		rtr_solicits;
 	__s32		rtr_solicit_interval;
+	__s32		rtr_solicit_max_interval;
 	__s32		rtr_solicit_delay;
 	__s32		force_mld_version;
 	__s32		mldv1_unsolicited_report_interval;
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 9826d3a9464c..275e5af4c2f4 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -3,6 +3,7 @@
 
 #define MAX_RTR_SOLICITATIONS		3
 #define RTR_SOLICITATION_INTERVAL	(4*HZ)
+#define RTR_SOLICITATION_MAX_INTERVAL	(4*HZ)
 
 #define MIN_VALID_LIFETIME		(2*3600)	/* 2 hours */
 
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index 395876060f50..8c2772340c3f 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -177,6 +177,7 @@ enum {
 	DEVCONF_DROP_UNICAST_IN_L2_MULTICAST,
 	DEVCONF_DROP_UNSOLICITED_NA,
 	DEVCONF_KEEP_ADDR_ON_DOWN,
+	DEVCONF_RTR_SOLICIT_MAX_INTERVAL,
 	DEVCONF_MAX
 };
 
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1e59c0034916..84c46950876a 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -187,6 +187,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
 	.dad_transmits		= 1,
 	.rtr_solicits		= MAX_RTR_SOLICITATIONS,
 	.rtr_solicit_interval	= RTR_SOLICITATION_INTERVAL,
+	.rtr_solicit_max_interval = RTR_SOLICITATION_MAX_INTERVAL,
 	.rtr_solicit_delay	= MAX_RTR_SOLICITATION_DELAY,
 	.use_tempaddr		= 0,
 	.temp_valid_lft		= TEMP_VALID_LIFETIME,
@@ -232,6 +233,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
 	.dad_transmits		= 1,
 	.rtr_solicits		= MAX_RTR_SOLICITATIONS,
 	.rtr_solicit_interval	= RTR_SOLICITATION_INTERVAL,
+	.rtr_solicit_max_interval = RTR_SOLICITATION_MAX_INTERVAL,
 	.rtr_solicit_delay	= MAX_RTR_SOLICITATION_DELAY,
 	.use_tempaddr		= 0,
 	.temp_valid_lft		= TEMP_VALID_LIFETIME,
@@ -4891,6 +4893,8 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
 	array[DEVCONF_RTR_SOLICITS] = cnf->rtr_solicits;
 	array[DEVCONF_RTR_SOLICIT_INTERVAL] =
 		jiffies_to_msecs(cnf->rtr_solicit_interval);
+	array[DEVCONF_RTR_SOLICIT_MAX_INTERVAL] =
+		jiffies_to_msecs(cnf->rtr_solicit_max_interval);
 	array[DEVCONF_RTR_SOLICIT_DELAY] =
 		jiffies_to_msecs(cnf->rtr_solicit_delay);
 	array[DEVCONF_FORCE_MLD_VERSION] = cnf->force_mld_version;
@@ -5771,6 +5775,13 @@ static const struct ctl_table addrconf_sysctl[] = {
 		.proc_handler	= proc_dointvec_jiffies,
 	},
 	{
+		.procname	= "router_solicitation_max_interval",
+		.data		= &ipv6_devconf.rtr_solicit_max_interval,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_jiffies,
+	},
+	{
 		.procname	= "router_solicitation_delay",
 		.data		= &ipv6_devconf.rtr_solicit_delay,
 		.maxlen		= sizeof(int),
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* [PATCH v5 3/7] ipv6 addrconf: rtr_solicits == -1 means unlimited
From: Maciej Żenczykowski @ 2016-09-27  9:52 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller
  Cc: netdev, Erik Kline, Lorenzo Colitti, Hannes Frederic Sowa
In-Reply-To: <1474969963-17402-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <maze@google.com>

This allows setting /proc/sys/net/ipv6/conf/*/router_solicitations
to -1 meaning an unlimited number of retransmits.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/ipv6/addrconf.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 8bd2d06eefe7..1e59c0034916 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3687,7 +3687,7 @@ static void addrconf_rs_timer(unsigned long data)
 	if (idev->if_flags & IF_RA_RCVD)
 		goto out;
 
-	if (idev->rs_probes++ < idev->cnf.rtr_solicits) {
+	if (idev->rs_probes++ < idev->cnf.rtr_solicits || idev->cnf.rtr_solicits == -1) {
 		write_unlock(&idev->lock);
 		if (!ipv6_get_lladdr(dev, &lladdr, IFA_F_TENTATIVE))
 			ndisc_send_rs(dev, &lladdr,
@@ -3949,7 +3949,7 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
 	send_mld = ifp->scope == IFA_LINK && ipv6_lonely_lladdr(ifp);
 	send_rs = send_mld &&
 		  ipv6_accept_ra(ifp->idev) &&
-		  ifp->idev->cnf.rtr_solicits > 0 &&
+		  ifp->idev->cnf.rtr_solicits != 0 &&
 		  (dev->flags&IFF_LOOPBACK) == 0;
 	read_unlock_bh(&ifp->idev->lock);
 
@@ -5099,7 +5099,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
 		return -EINVAL;
 	if (!ipv6_accept_ra(idev))
 		return -EINVAL;
-	if (idev->cnf.rtr_solicits <= 0)
+	if (idev->cnf.rtr_solicits == 0)
 		return -EINVAL;
 
 	write_lock_bh(&idev->lock);
@@ -5699,6 +5699,7 @@ int addrconf_sysctl_ignore_routes_with_linkdown(struct ctl_table *ctl,
 	return ret;
 }
 
+static const int minus_one = -1;
 static const int one = 1;
 static const int two_five_five = 255;
 
@@ -5759,7 +5760,8 @@ static const struct ctl_table addrconf_sysctl[] = {
 		.data		= &ipv6_devconf.rtr_solicits,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= (void *)&minus_one,
 	},
 	{
 		.procname	= "router_solicitation_interval",
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* [PATCH v5 2/7] ipv6 addrconf: remove addrconf_sysctl_hop_limit()
From: Maciej Żenczykowski @ 2016-09-27  9:52 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller
  Cc: netdev, Erik Kline, Lorenzo Colitti, Hannes Frederic Sowa
In-Reply-To: <1474969963-17402-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <maze@google.com>

replace with extra1/2 magic

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/ipv6/addrconf.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 11fa1a5564d4..8bd2d06eefe7 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5467,20 +5467,6 @@ int addrconf_sysctl_forward(struct ctl_table *ctl, int write,
 }
 
 static
-int addrconf_sysctl_hop_limit(struct ctl_table *ctl, int write,
-                              void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-	struct ctl_table lctl;
-	int min_hl = 1, max_hl = 255;
-
-	lctl = *ctl;
-	lctl.extra1 = &min_hl;
-	lctl.extra2 = &max_hl;
-
-	return proc_dointvec_minmax(&lctl, write, buffer, lenp, ppos);
-}
-
-static
 int addrconf_sysctl_mtu(struct ctl_table *ctl, int write,
 			void __user *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -5713,6 +5699,9 @@ int addrconf_sysctl_ignore_routes_with_linkdown(struct ctl_table *ctl,
 	return ret;
 }
 
+static const int one = 1;
+static const int two_five_five = 255;
+
 static const struct ctl_table addrconf_sysctl[] = {
 	{
 		.procname	= "forwarding",
@@ -5726,7 +5715,9 @@ static const struct ctl_table addrconf_sysctl[] = {
 		.data		= &ipv6_devconf.hop_limit,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= addrconf_sysctl_hop_limit,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= (void *)&one,
+		.extra2		= (void *)&two_five_five,
 	},
 	{
 		.procname	= "mtu",
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* [PATCH v5 0/7] implement rfc7559 ipv6 router solicitation backoff
From: Maciej Żenczykowski @ 2016-09-27  9:52 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller
  Cc: netdev, Erik Kline, Lorenzo Colitti, Hannes Frederic Sowa
In-Reply-To: <CANP3RGfHPZLHFnp4Rq8_dRNCro6Uh8O8767NgoGu7gvzu5h9BQ@mail.gmail.com>

Hi,

This patch series implements RFC7559 style backoff of IPv6 router
solicitation requests.

Patches 1 and 2 are minor cleanup and stand on their own.

Patch 3 allows a (potentially) infinite number of RS'es to be sent
when the rtr_solicits sysctl is set to -1 (this depends on patch 1).

Patch 4 is just boilerplate to add a new sysctl for the maximum
backoff period.

Patch 5 implements the backoff algorithm (and depends on the previous
patches).

Patches 6 and 7 switch the defaults over to enable this by default
(defaults come from the RFC).

[PATCH v5 1/7] ipv6 addrconf: enable use of proc_dointvec_minmax in
[PATCH v5 2/7] ipv6 addrconf: remove addrconf_sysctl_hop_limit()
[PATCH v5 3/7] ipv6 addrconf: rtr_solicits == -1 means unlimited
[PATCH v5 4/7] ipv6 addrconf: add new sysctl
[PATCH v5 5/7] ipv6 addrconf: implement RFC7559 router solicitation
[PATCH v5 6/7] ipv6 addrconf: change default
[PATCH v5 7/7] ipv6 addrconf: change default MAX_RTR_SOLICITATIONS

Changes v4->v5:
  added 'const' qualifier to extra1/2 constants - requires (void*) casting
  switched away from shifts by 20 to do_div(..., 1000000)
  switched to variable names from the rfc, elaborated a bit in the comments

Changes v3->v4:
  added subject line to cover letter

Changes v2->v3:
  added cover letter

Changes v1->v2:
  avoid 64-bit divisions to fix 32-bit build errors

^ permalink raw reply

* [PATCH v5 1/7] ipv6 addrconf: enable use of proc_dointvec_minmax in addrconf_sysctl
From: Maciej Żenczykowski @ 2016-09-27  9:52 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller
  Cc: netdev, Erik Kline, Lorenzo Colitti, Hannes Frederic Sowa
In-Reply-To: <1474969963-17402-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <maze@google.com>

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/ipv6/addrconf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 2f1f5d439788..11fa1a5564d4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6044,8 +6044,14 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name,
 
 	for (i = 0; table[i].data; i++) {
 		table[i].data += (char *)p - (char *)&ipv6_devconf;
-		table[i].extra1 = idev; /* embedded; no ref */
-		table[i].extra2 = net;
+		/* If one of these is already set, then it is not safe to
+		 * overwrite either of them: this makes proc_dointvec_minmax
+		 * usable.
+		 */
+		if (!table[i].extra1 && !table[i].extra2) {
+			table[i].extra1 = idev; /* embedded; no ref */
+			table[i].extra2 = net;
+		}
 	}
 
 	snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name);
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* Re: [PATCH v4 4/7] ipv6 addrconf: add new sysctl 'router_solicitation_max_interval'
From: Hannes Frederic Sowa @ 2016-09-27  9:49 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: David S . Miller, Linux NetDev, Erik Kline, Lorenzo Colitti
In-Reply-To: <CANP3RGfNGgw9H5Hsn7sgadHu5+kBcGfhY6Y_iTKNEjoL9gL7xg@mail.gmail.com>

On 27.09.2016 04:30, Maciej Żenczykowski wrote:
>> Is seconds granular enough?
> 
> The only reason why one would ever want to go into fractions of
> seconds would be some sort of unittesting with very low delays.
> 
> In any normal environment the max is going to be tens if not hundreds
> or thousands of seconds.
> 
> Also note that the delay and interval (ie. not max interval) are also
> currently exported in seconds, so having more granularity for
> max_seconds is kind of pointless.
> 
> I have been considering whether I could make proc_dointvec_jiffies
> accept floating point input (and output) though... although that seems
> a little harder and probably out of scope of this change.

Good point. Using ms should actually be easy, instead of
proc_dointvec_jiffies you can use proc_dointvec_ms_jiffies.

It seems good practice to add a _ms then to the sysctl, too.

I am fine with both ways.

Bye,
Hannes

^ permalink raw reply

* Re: ISDN-Gigaset: Release memory in gigaset_initcs() after an allocation failure
From: Paul Bolle @ 2016-09-27  9:48 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Bjørn Mork, gigaset307x-common, netdev, Karsten Keil, LKML,
	kernel-janitors, Julia Lawall
In-Reply-To: <ad12e1a0-f5d5-176a-7d37-be2f3cb0af5d@users.sourceforge.net>

You're in Eliza mode again.

(Hat tip to Björn Mork, https://lkml.org/lkml/2016/1/4/259).


Paul Bolle

^ permalink raw reply

* Re: [PATCH v4 5/7] ipv6 addrconf: implement RFC7559 router solicitation backoff
From: Maciej Żenczykowski @ 2016-09-27  9:42 UTC (permalink / raw)
  To: Hannes Frederic Sowa
  Cc: David S . Miller, Linux NetDev, Erik Kline, Lorenzo Colitti
In-Reply-To: <f249b2b1-e19f-bbc6-d02e-b256fd369c16@stressinduktion.org>

> Please just use do_div here and go back to the first version of the
> patch. Variable names could be more aligned with the RFC maybe?

So I tried:

static inline s32 rfc3315_s14_backoff_init(s32 irt)
 {
       /* multiply 'initial retransmission time' by 0.9 .. 1.1 */
       u64 tmp = (900000 + prandom_u32() % 200001) * (u64)irt;
       do_div(tmp, 1000000);
       return (s32)tmp;
 }

static inline s32 rfc3315_s14_backoff_update(s32 rt, s32 mrt)
 {
       /* multiply 'retransmission timeout' by 1.9 .. 2.1 */
       u64 tmp = (1900000 + prandom_u32() % 200001) * (u64)rt;
       do_div(tmp, 1000000);
       if ((s32)tmp > mrt) {
               /* multiply 'maximum retransmission time' by 0.9 .. 1.1 */
               tmp = (900000 + prandom_u32() % 200001) * (u64)mrt;
               do_div(tmp, 1000000);
        }
       return (s32)tmp;
}

but then building for i386 I get:

ERROR: "__udivdi3" [net/netfilter/xt_hashlimit.ko] undefined!

which happens even at net-next/master itself.

Anyway, I'll resubmit assuming the above is what you're looking for...

^ permalink raw reply

* Re: ISDN-Gigaset: Release memory in gigaset_initcs() after an allocation failure
From: SF Markus Elfring @ 2016-09-27  9:34 UTC (permalink / raw)
  To: Paul Bolle
  Cc: gigaset307x-common, netdev, Karsten Keil, LKML, kernel-janitors,
	Julia Lawall
In-Reply-To: <1474966121.9970.5.camel@tiscali.nl>

>> Will it matter here if the function "kfree" will be called for the
>> data structure members "bcs" and "inbuf" after a later function call
>> failed within the implementation of "gigaset_initcs"?
> 
> My translation of this question is: could you please hold my hand while
> I read the code of a driver I do not use - a driver for hardware that I
> don't even have, and therefor cannot really test - after I submitted a
> patch that appears to be broken?

I got the impression that the exception handling  was incomplete in the
implementation of the function "gigaset_initcs".
Does anybody (besides me) care for improving the software situation there?


> My answer to that question is: no, sorry, I won't do that.

I find that the process has just started once more to clarify in which
directions this software module could evolve.

Do we discuss a potential memory leak under special conditions here?

Regards,
Markus

^ permalink raw reply

* Explaining RX-stages for XDP
From: Jesper Dangaard Brouer via iovisor-dev @ 2016-09-27  9:32 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: Eric Dumazet, Tom Herbert,
	iovisor-dev-9jONkmmOlFHEE9lA1F8Ukti2O/JbrIOy@public.gmane.org,
	John Fastabend, Jamal Hadi Salim, Saeed Mahameed, Daniel Borkmann,
	David Miller, Pablo Neira Ayuso


Let me try in a calm way (not like [1]) to explain how I imagine that
the XDP processing RX-stage should be implemented. As I've pointed out
before[2], I'm proposing splitting up the driver into RX-stages.  This
is a mental-model change, I hope you can follow my "inception" attempt.

The basic concept behind this idea is, if the RX-ring contains
multiple "ready" packets, then the kernel was too slow, processing
incoming packets. Thus, switch into more efficient mode, which is a
"packet-vector" mode.

Today, our XDP micro-benchmarks looks amazing, and they are!  But once
real-life intermixed traffic is used, then we loose the XDP I-cache
benefit.  XDP is meant for DoS protection, and an attacker can easily
construct intermixed traffic.  Why not fix this architecturally?

Most importantly concept: If XDP return XDP_PASS, do NOT pass the
packet up the network stack immediately (that would flush I-cache).
Instead store the packet for the next RX-stage.  Basically splitting
the packet-vector into two packet-vectors, one for network-stack and
one for XDP.  Thus, intermixed XDP vs. netstack not longer have effect
on XDP performance.

The reason for also creating an XDP packet-vector, is to move the
XDP_TX transmit code out of the XDP processing stage (and future
features).  This maximize I-cache availability to the eBPF program,
and make eBPF performance more uniform across drivers.


Inception:
 * Instead of individual packets, see it as a RX packet-vector.
 * XDP should be seen as a stage *before* the network stack gets called.

If your mind can handle it: I'm NOT proposing a RX-vector of 64-packets.
I actually want N-packet per vector (8-16).  As the NIC HW RX process
runs concurrently, and by the time it takes to process N-packets, more
packets have had a chance to arrive in the RX-ring queue.

-- 
Best regards,
  Jesper Dangaard Brouertho
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

[1] https://mid.mail-archive.com/netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg127043.html

[2] http://lists.openwall.net/netdev/2016/01/15/51  

[3] http://lists.openwall.net/netdev/2016/04/19/89

^ permalink raw reply

* Re: [PATCH net-next] net/sched: cls_flower: Use a proper mask value for enc key id parameter
From: Amir Vadai" @ 2016-09-27  9:30 UTC (permalink / raw)
  To: Hadar Hen Zion
  Cc: David S. Miller, netdev, Amir Vadai, Jiri Pirko, Or Gerlitz
In-Reply-To: <1474964478-4483-1-git-send-email-hadarh@mellanox.com>

On Tue, Sep 27, 2016 at 11:21:18AM +0300, Hadar Hen Zion wrote:
> The current code use the encapsulation key id value as the mask of that
> parameter which is wrong. Fix that by using a full mask.
> 
> Fixes: bc3103f1ed40 ('net/sched: cls_flower: Classify packet in ip tunnels')
> Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
> ---

Acked-by: Amir Vadai <amir@vadai.me>

^ permalink raw reply

* Re: [PATCH] brcmfmac: implement more accurate skb tracking
From: Arend Van Spriel @ 2016-09-27  9:24 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Kalle Valo, Franky Lin, Hante Meuleman, Pieter-Paul Giesberts,
	Franky Lin, linux-wireless@vger.kernel.org,
	open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER,
	Network Development, Linux Kernel Mailing List,
	Rafał Miłecki
In-Reply-To: <CACna6ryNLOqrwsa9KFueUdqStxjP7KoRyvsn6eynLc6Y7Ug_sw@mail.gmail.com>

On 26-9-2016 14:38, Rafał Miłecki wrote:
> On 26 September 2016 at 14:13, Rafał Miłecki <zajec5@gmail.com> wrote:
>> On 26 September 2016 at 13:46, Arend Van Spriel
>> <arend.vanspriel@broadcom.com> wrote:
>>> On 26-9-2016 12:23, Rafał Miłecki wrote:
>>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>>
>>>> We need to track 802.1x packets to know if there are any pending ones
>>>> for transmission. This is required for performing key update in the
>>>> firmware.
>>>
>>> The problem we are trying to solve is a pretty old one. The problem is
>>> that wpa_supplicant uses two separate code paths: EAPOL messaging
>>> through data path and key configuration though nl80211.
>>
>> Can I find it described/reported somewhere?
>>
>>
>>>> Unfortunately our old tracking code wasn't very accurate. It was
>>>> treating skb as pending as soon as it was passed by the netif. Actual
>>>> handling packet to the firmware was happening later as brcmfmac
>>>> internally queues them and uses its own worker(s).
>>>
>>> That does not seem right. As soon as we get a 1x packet we need to wait
>>> with key configuration regardless whether it is still in the driver or
>>> handed over to firmware already.
>>
>> OK, thanks.
> 
> Actually, it's not OK. I was trying to report/describe/discuss this
> problem for over a week. I couldn't get much of answer from you.
> 
> I had to come with a patch I worked on for quite some time. Only then
> you decided to react and reply with a reason for a nack. I see this
> patch may be wrong (but it's still hard to know what's going wrong
> without a proper hostapd bug report). I'd expect you to somehow work &
> communicate with open source community.

We do or at least make an honest attempt, but there is more on our plate
so responses may be delayed. It also does not help when you get anal and
preachy when we do respond. Also not OK. In this case the delay is
caused because I had to pick up the thread(s) as Hante is on vacation
(he needed a break :-p ). However, you started sending patches so I
decided to look at and respond to those. Sorry if you felt like we left
you hanging to dry.

Regards,
Arend

^ permalink raw reply

* RE: [PATCH v5 13/16] IB/pvrdma: Add the main driver module for PVRDMA
From: David Laight @ 2016-09-27  9:21 UTC (permalink / raw)
  To: 'Adit Ranadive', Yuval Shaia
  Cc: dledford@redhat.com, linux-rdma@vger.kernel.org,
	pv-drivers@vmware.com, netdev@vger.kernel.org,
	linux-pci@vger.kernel.org, jhansen@vmware.com,
	asarwade@vmware.com, georgezhang@vmware.com, bryantan@vmware.com
In-Reply-To: <651b18ee-55ca-0c72-af9c-c55c42b57fd1@vmware.com>

From: Adit Ranadive
> Sent: 26 September 2016 19:15
> On Mon, Sep 26, 2016 at 00:27:40AM -0700, Yuval Shaia wrote:
> > On Sat, Sep 24, 2016 at 04:21:37PM -0700, Adit Ranadive wrote:
> > > +
> > > +	/* Currently, the driver only supports RoCE mode. */
> > > +	if (dev->dsr->caps.mode != PVRDMA_DEVICE_MODE_ROCE) {
> > > +		dev_err(&pdev->dev, "unsupported transport %d\n",
> > > +			dev->dsr->caps.mode);
> > > +		ret = -EINVAL;
> >
> > This is some fatal error with the device, not that something wrong with the
> > function's argument.
> > Suggesting to replace with -EFAULT.
> >
> 
> Thanks, will fix this one and the others here.

Won't EFAULT generate SIGSEGV ?

	David


^ permalink raw reply

* Re: [PATCH net-next V2] net/sched: pkt_cls: change tc actions order to be as the user sets
From: Hadar Hen Zion @ 2016-09-27  9:15 UTC (permalink / raw)
  To: Hadar Hen Zion
  Cc: David S. Miller, netdev, Jamal Hadi Salim, Cong Wang, Or Gerlitz
In-Reply-To: <1474963791-3717-1-git-send-email-hadarh@mellanox.com>

On Tue, Sep 27, 2016 at 11:09 AM, Hadar Hen Zion <hadarh@mellanox.com> wrote:
> Currently the created tc actions list is reversed against the order
> set by the user.
> Change the actions list order to be the same as was set by the user.
>
> This patch doesn't affect dump actions behavior.
> For dumping, action->order parameter is used so the list order doesn't
> matter.
>
> Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>


Changes from V1:
- Add a comment to the change log


> ---
>  include/net/pkt_cls.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
> index 5ccaa4b..767b03a 100644
> --- a/include/net/pkt_cls.h
> +++ b/include/net/pkt_cls.h
> @@ -123,7 +123,7 @@ static inline void tcf_exts_to_list(const struct tcf_exts *exts,
>         for (i = 0; i < exts->nr_actions; i++) {
>                 struct tc_action *a = exts->actions[i];
>
> -               list_add(&a->list, actions);
> +               list_add_tail(&a->list, actions);
>         }
>  #endif
>  }
> --
> 1.8.3.1
>

^ permalink raw reply


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