Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH V3 net-next] liquidio: pass date and time info to NIC firmware
From: David Miller @ 2017-10-24  9:57 UTC (permalink / raw)
  To: felix.manlunas
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
	veerasenareddy.burru
In-Reply-To: <20171024033325.GA17455@felix-thinkpad.cavium.com>

From: Felix Manlunas <felix.manlunas@cavium.com>
Date: Mon, 23 Oct 2017 20:33:25 -0700

> From: Veerasenareddy Burru <veerasenareddy.burru@cavium.com>
> 
> Pass date and time information to NIC at the time of loading
> firmware and periodically update the host time to NIC firmware.
> This is to make NIC firmware use the same time reference as Host,
> so that it is easy to correlate logs from firmware and host for debugging.
> 
> Signed-off-by: Veerasenareddy Burru <veerasenareddy.burru@cavium.com>
> Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next] net/sched: Fix actions list corruption when adding offloaded tc flows
From: David Miller @ 2017-10-24 10:01 UTC (permalink / raw)
  To: ogerlitz; +Cc: netdev, mlxsw, roid, paulb
In-Reply-To: <1508824682-5088-1-git-send-email-ogerlitz@mellanox.com>

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Tue, 24 Oct 2017 08:58:02 +0300

> Prior to commit b3f55bdda8df, the networking core doesn't wire an in-place
> actions list the when the low level driver is called to offload the flow,
> but all low level drivers do that (call tcf_exts_to_list()) in their
> offloading "add" logic.
> 
> Now, the in-place list is set in the core which goes over the list in a loop,
> but also by the hw driver when their offloading code is invoked indirectly:
> 
> 	cls_xxx add flow -> tc_setup_cb_call -> tc_exts_setup_cb_egdev_call -> hw driver
> 
> which messes up the core list instance upon driver return. Fix that by avoiding
> in-place list on the net core code that deals with adding flows.
> 
> Fixes: b3f55bdda8df ('net: sched: introduce per-egress action device callbacks')
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> Acked-by: Jiri Pirko <jiri@mellanox.com>

Applied.

^ permalink raw reply

* Re: [patch net-next] mlxsw: spectrum_dpipe: Fix entries dump of the adjacency table
From: David Miller @ 2017-10-24 10:02 UTC (permalink / raw)
  To: jiri; +Cc: netdev, arkadis, idosch, mlxsw
In-Reply-To: <20171024081142.996-1-jiri@resnulli.us>

From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 24 Oct 2017 10:11:42 +0200

> From: Arkadi Sharshevsky <arkadis@mellanox.com>
> 
> During the dump the per netlink packet entry counter should be zeroed out
> when new packet is created.
> 
> Fixes: 190d38a52a73 ("mlxsw: spectrum_dpipe: Add support for adjacency table dump")
> Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
> Reported-by: David Ahern <dsahern@gmail.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Applied.

^ permalink raw reply

* Re: [patch net-next 0/3] mlxsw: Various fixes
From: David Miller @ 2017-10-24 10:07 UTC (permalink / raw)
  To: jiri; +Cc: netdev, yotamg, idosch, mlxsw
In-Reply-To: <20171024091717.1180-1-jiri@resnulli.us>

From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 24 Oct 2017 11:17:14 +0200

> From: Jiri Pirko <jiri@mellanox.com>
> 
> Yotam says:
> 
> Cleanup some issues reported by sparse.

Series applied.

^ permalink raw reply

* [PATCH net-next 1/2] net: updating dst lastusage is an unlikely event.
From: Paolo Abeni @ 2017-10-24 10:37 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Wei Wang, Martin KaFai Lau

Since commit 0da4af00b2ed ("ipv6: only update __use and lastusetime
once per jiffy at most"), updating the dst lastuse field is an
unlikely action: it happens at most once per jiffy, out of
potentially millions of calls per second.

Mark explicitly the code as such, and let the compiler generate
better code.

Note: gcc 7.2 and several older versions do actually generate
different - better - code when the unlikely() hint is in place,
avoid jump in the fast path and keeping better code locality.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 include/net/dst.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index d70b33dc2332..0744a9630eed 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -257,7 +257,7 @@ static inline void dst_hold(struct dst_entry *dst)
 
 static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
 {
-	if (time != dst->lastuse) {
+	if (unlikely(time != dst->lastuse)) {
 		dst->__use++;
 		dst->lastuse = time;
 	}
-- 
2.13.6

^ permalink raw reply related

* pull request (net): ipsec 2017-10-24
From: Steffen Klassert @ 2017-10-24 10:37 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

1) Fix a memleak when we don't find a inner_mode
   during bundle creation. From David Miller.

2) Fix a xfrm policy dump crash. We may crash
   on error when dumping policies via netlink.
   Fix this by initializing the policy walk
   with the cb->start method. This fix is a
   serious stable candidate. From Herbert Xu.

Please pull or let me know if there are problems.

Thanks!

The following changes since commit c0576e3975084d4699b7bfef578613fb8e1144f6:

  net: call cgroup_sk_alloc() earlier in sk_clone_lock() (2017-10-10 20:24:29 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git master

for you to fetch changes up to 1137b5e2529a8f5ca8ee709288ecba3e68044df2:

  ipsec: Fix aborted xfrm policy dump crash (2017-10-23 09:35:48 +0200)

----------------------------------------------------------------
David Miller (1):
      ipsec: Fix dst leak in xfrm_bundle_create().

Herbert Xu (1):
      ipsec: Fix aborted xfrm policy dump crash

 net/xfrm/xfrm_policy.c | 16 ++++++++--------
 net/xfrm/xfrm_user.c   | 25 +++++++++++++++----------
 2 files changed, 23 insertions(+), 18 deletions(-)

^ permalink raw reply

* [PATCH 1/2] ipsec: Fix dst leak in xfrm_bundle_create().
From: Steffen Klassert @ 2017-10-24 10:37 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev
In-Reply-To: <1508841460-26369-1-git-send-email-steffen.klassert@secunet.com>

From: David Miller <davem@davemloft.net>

If we cannot find a suitable inner_mode value, we will leak
the currently allocated 'xdst'.

The fix is to make sure it is linked into the chain before
erroring out.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_policy.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index f062539..2746b62 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1573,6 +1573,14 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
 			goto put_states;
 		}
 
+		if (!dst_prev)
+			dst0 = dst1;
+		else
+			/* Ref count is taken during xfrm_alloc_dst()
+			 * No need to do dst_clone() on dst1
+			 */
+			dst_prev->child = dst1;
+
 		if (xfrm[i]->sel.family == AF_UNSPEC) {
 			inner_mode = xfrm_ip2inner_mode(xfrm[i],
 							xfrm_af2proto(family));
@@ -1584,14 +1592,6 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
 		} else
 			inner_mode = xfrm[i]->inner_mode;
 
-		if (!dst_prev)
-			dst0 = dst1;
-		else
-			/* Ref count is taken during xfrm_alloc_dst()
-			 * No need to do dst_clone() on dst1
-			 */
-			dst_prev->child = dst1;
-
 		xdst->route = dst;
 		dst_copy_metrics(dst1, dst);
 
-- 
2.7.4

^ permalink raw reply related

* [PATCH 2/2] ipsec: Fix aborted xfrm policy dump crash
From: Steffen Klassert @ 2017-10-24 10:37 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev
In-Reply-To: <1508841460-26369-1-git-send-email-steffen.klassert@secunet.com>

From: Herbert Xu <herbert@gondor.apana.org.au>

An independent security researcher, Mohamed Ghannam, has reported
this vulnerability to Beyond Security's SecuriTeam Secure Disclosure
program.

The xfrm_dump_policy_done function expects xfrm_dump_policy to
have been called at least once or it will crash.  This can be
triggered if a dump fails because the target socket's receive
buffer is full.

This patch fixes it by using the cb->start mechanism to ensure that
the initialisation is always done regardless of the buffer situation.

Fixes: 12a169e7d8f4 ("ipsec: Put dumpers on the dump list")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_user.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index b997f13..e44a0fe 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1693,32 +1693,34 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr
 
 static int xfrm_dump_policy_done(struct netlink_callback *cb)
 {
-	struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
+	struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
 	struct net *net = sock_net(cb->skb->sk);
 
 	xfrm_policy_walk_done(walk, net);
 	return 0;
 }
 
+static int xfrm_dump_policy_start(struct netlink_callback *cb)
+{
+	struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
+
+	BUILD_BUG_ON(sizeof(*walk) > sizeof(cb->args));
+
+	xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);
+	return 0;
+}
+
 static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb)
 {
 	struct net *net = sock_net(skb->sk);
-	struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
+	struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
 	struct xfrm_dump_info info;
 
-	BUILD_BUG_ON(sizeof(struct xfrm_policy_walk) >
-		     sizeof(cb->args) - sizeof(cb->args[0]));
-
 	info.in_skb = cb->skb;
 	info.out_skb = skb;
 	info.nlmsg_seq = cb->nlh->nlmsg_seq;
 	info.nlmsg_flags = NLM_F_MULTI;
 
-	if (!cb->args[0]) {
-		cb->args[0] = 1;
-		xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);
-	}
-
 	(void) xfrm_policy_walk(net, walk, dump_one_policy, &info);
 
 	return skb->len;
@@ -2474,6 +2476,7 @@ static const struct nla_policy xfrma_spd_policy[XFRMA_SPD_MAX+1] = {
 
 static const struct xfrm_link {
 	int (*doit)(struct sk_buff *, struct nlmsghdr *, struct nlattr **);
+	int (*start)(struct netlink_callback *);
 	int (*dump)(struct sk_buff *, struct netlink_callback *);
 	int (*done)(struct netlink_callback *);
 	const struct nla_policy *nla_pol;
@@ -2487,6 +2490,7 @@ static const struct xfrm_link {
 	[XFRM_MSG_NEWPOLICY   - XFRM_MSG_BASE] = { .doit = xfrm_add_policy    },
 	[XFRM_MSG_DELPOLICY   - XFRM_MSG_BASE] = { .doit = xfrm_get_policy    },
 	[XFRM_MSG_GETPOLICY   - XFRM_MSG_BASE] = { .doit = xfrm_get_policy,
+						   .start = xfrm_dump_policy_start,
 						   .dump = xfrm_dump_policy,
 						   .done = xfrm_dump_policy_done },
 	[XFRM_MSG_ALLOCSPI    - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi },
@@ -2539,6 +2543,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 		{
 			struct netlink_dump_control c = {
+				.start = link->start,
 				.dump = link->dump,
 				.done = link->done,
 			};
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH net-next 1/2] net: updating dst lastusage is an unlikely event.
From: Paolo Abeni @ 2017-10-24 10:39 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Wei Wang, Martin KaFai Lau
In-Reply-To: <cb6e9e39bdcdaebba87e331d7b18392bdeefebc3.1508841315.git.pabeni@redhat.com>

On Tue, 2017-10-24 at 12:37 +0200, Paolo Abeni wrote:
> Since commit 0da4af00b2ed ("ipv6: only update __use and lastusetime
> once per jiffy at most"), updating the dst lastuse field is an
> unlikely action: it happens at most once per jiffy, out of
> potentially millions of calls per second.
> 
> Mark explicitly the code as such, and let the compiler generate
> better code.
> 
> Note: gcc 7.2 and several older versions do actually generate
> different - better - code when the unlikely() hint is in place,
> avoid jump in the fast path and keeping better code locality.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Oops, I placed a bad subject prefix here, please ignore. I'll resend
soon with a proper one.

Sorry for the noise,

Paolo 

^ permalink raw reply

* [PATCH net-next] net: updating dst lastusage is an unlikely event.
From: Paolo Abeni @ 2017-10-24 10:41 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Wei Wang, Martin KaFai Lau, Hannes Frederic Sowa

Since commit 0da4af00b2ed ("ipv6: only update __use and lastusetime
once per jiffy at most"), updating the dst lastuse field is an
unlikely action: it happens at most once per jiffy, out of
potentially millions of calls per second.

Mark explicitly the code as such, and let the compiler generate
better code.

Note: gcc 7.2 and several older versions do actually generate
different - better - code when the unlikely() hint is in place,
avoid jump in the fast path and keeping better code locality.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 include/net/dst.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index d70b33dc2332..0744a9630eed 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -257,7 +257,7 @@ static inline void dst_hold(struct dst_entry *dst)
 
 static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
 {
-	if (time != dst->lastuse) {
+	if (unlikely(time != dst->lastuse)) {
 		dst->__use++;
 		dst->lastuse = time;
 	}
-- 
2.13.6

^ permalink raw reply related

* Re: [PATCH] drivers/net: sis: Convert timers to use timer_setup()
From: Daniele Venzano @ 2017-10-24 10:37 UTC (permalink / raw)
  To: Kees Cook, David S. Miller; +Cc: Francois Romieu, netdev, linux-kernel
In-Reply-To: <20171024084652.GA23986@beast>



On 24 October 2017 10:46:52 CEST, Kees Cook <keescook@chromium.org> wrote:
>In preparation for unconditionally passing the struct timer_list
>pointer to
>all timer callbacks, switch to using the new timer_setup() and
>from_timer()
>to pass the timer pointer explicitly.
>
>Cc: Francois Romieu <romieu@fr.zoreil.com>
>Cc: Daniele Venzano <venza@brownhat.org>
>Cc: netdev@vger.kernel.org
>Signed-off-by: Kees Cook <keescook@chromium.org>

Signed-off-by: Daniele Venzano <venza@brownhat.org>


>---
> drivers/net/ethernet/sis/sis190.c | 10 ++++------
> drivers/net/ethernet/sis/sis900.c | 10 +++++-----
> 2 files changed, 9 insertions(+), 11 deletions(-)
>
>diff --git a/drivers/net/ethernet/sis/sis190.c
>b/drivers/net/ethernet/sis/sis190.c
>index 445109bd6910..c2c50522b96d 100644
>--- a/drivers/net/ethernet/sis/sis190.c
>+++ b/drivers/net/ethernet/sis/sis190.c
>@@ -1018,10 +1018,10 @@ static void sis190_phy_task(struct work_struct
>*work)
> 	rtnl_unlock();
> }
> 
>-static void sis190_phy_timer(unsigned long __opaque)
>+static void sis190_phy_timer(struct timer_list *t)
> {
>-	struct net_device *dev = (struct net_device *)__opaque;
>-	struct sis190_private *tp = netdev_priv(dev);
>+	struct sis190_private *tp = from_timer(tp, t, timer);
>+	struct net_device *dev = tp->dev;
> 
> 	if (likely(netif_running(dev)))
> 		schedule_work(&tp->phy_task);
>@@ -1039,10 +1039,8 @@ static inline void sis190_request_timer(struct
>net_device *dev)
> 	struct sis190_private *tp = netdev_priv(dev);
> 	struct timer_list *timer = &tp->timer;
> 
>-	init_timer(timer);
>+	timer_setup(timer, sis190_phy_timer, 0);
> 	timer->expires = jiffies + SIS190_PHY_TIMEOUT;
>-	timer->data = (unsigned long)dev;
>-	timer->function = sis190_phy_timer;
> 	add_timer(timer);
> }
> 
>diff --git a/drivers/net/ethernet/sis/sis900.c
>b/drivers/net/ethernet/sis/sis900.c
>index cb61247b0526..4bb89f74742c 100644
>--- a/drivers/net/ethernet/sis/sis900.c
>+++ b/drivers/net/ethernet/sis/sis900.c
>@@ -218,7 +218,7 @@ static void sis900_init_rxfilter (struct net_device
>* net_dev);
> static u16 read_eeprom(void __iomem *ioaddr, int location);
>static int mdio_read(struct net_device *net_dev, int phy_id, int
>location);
>static void mdio_write(struct net_device *net_dev, int phy_id, int
>location, int val);
>-static void sis900_timer(unsigned long data);
>+static void sis900_timer(struct timer_list *t);
>static void sis900_check_mode (struct net_device *net_dev, struct
>mii_phy *mii_phy);
> static void sis900_tx_timeout(struct net_device *net_dev);
> static void sis900_init_tx_ring(struct net_device *net_dev);
>@@ -1065,7 +1065,7 @@ sis900_open(struct net_device *net_dev)
> 
> 	/* Set the timer to switch to check for link beat and perhaps switch
> 	   to an alternate media type. */
>-	setup_timer(&sis_priv->timer, sis900_timer, (unsigned long)net_dev);
>+	timer_setup(&sis_priv->timer, sis900_timer, 0);
> 	sis_priv->timer.expires = jiffies + HZ;
> 	add_timer(&sis_priv->timer);
> 
>@@ -1300,10 +1300,10 @@ static void sis630_set_eq(struct net_device
>*net_dev, u8 revision)
>  *	link status (ON/OFF) and link mode (10/100/Full/Half)
>  */
> 
>-static void sis900_timer(unsigned long data)
>+static void sis900_timer(struct timer_list *t)
> {
>-	struct net_device *net_dev = (struct net_device *)data;
>-	struct sis900_private *sis_priv = netdev_priv(net_dev);
>+	struct sis900_private *sis_priv = from_timer(sis_priv, t, timer);
>+	struct net_device *net_dev = sis_priv->mii_info.dev;
> 	struct mii_phy *mii_phy = sis_priv->mii;
> 	static const int next_tick = 5*HZ;
> 	int speed = 0, duplex = 0;

^ permalink raw reply

* [PATCH net-next] ipv6: update use count on dst_check()
From: Paolo Abeni @ 2017-10-24 10:42 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Wei Wang, Martin KaFai Lau, Hannes Frederic Sowa

Currently, the dst 'lastuse' field is not updated in a reliable way
for dst entries only accessed via socket cache.

This may fool the ipv6 dst gc, especially since we really age out unused
entries, either via the commit 1859bac04fb6 ("ipv6: remove from fib tree
aged out RTF_CACHE dst") or via the commit 1e2ea8ad37be ("ipv6: set
dst.obsolete when a cached route has expired").

Updating such field is now very cheap, thanks to commit 0da4af00b2ed
("ipv6: only update __use and lastusetime once per jiffy at most"),
so we can address the issue updating 'lastuse' in ip6_dst_check(),
if successful.

Fixes: 1859bac04fb6 ("ipv6: remove from fib tree aged out RTF_CACHE dst")
Fixes: 1e2ea8ad37be ("ipv6: set dst.obsolete when a cached route has expired")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/ipv6/route.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 87a15cbd0e8b..8f8c7fb83b9b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1952,6 +1952,7 @@ static struct dst_entry *rt6_check(struct rt6_info *rt, u32 cookie)
 	if (rt6_check_expired(rt))
 		return NULL;
 
+	dst_use_noref(&rt->dst, jiffies);
 	return &rt->dst;
 }
 
-- 
2.13.6

^ permalink raw reply related

* Re: [patch net-next] net: core: introduce mini_Qdisc and eliminate usage of tp->q for clsact fastpath
From: Daniel Borkmann @ 2017-10-24 10:50 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, jhs, xiyou.wangcong, mlxsw, edumazet, alexander.h.duyck,
	willemb, john.fastabend, alexei.starovoitov
In-Reply-To: <20171023212832.1332-1-jiri@resnulli.us>

On 10/23/2017 11:28 PM, Jiri Pirko wrote:
[...]
> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> index 031dffd..c7ddbdb 100644
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -143,6 +143,36 @@ static inline int qdisc_avail_bulklimit(const struct netdev_queue *txq)
>   #endif
>   }
>
> +/* Mini Qdisc serves for specific needs of ingress/clsact Qdisc.
> + * The fast path only needs to access filter list and to update stats
> + */
> +struct mini_Qdisc {
> +	struct tcf_proto __rcu *filter_list;
> +	struct gnet_stats_basic_cpu __percpu *cpu_bstats;
> +	struct gnet_stats_queue	__percpu *cpu_qstats;
> +	struct mini_Qdisc __rcu **p_miniq;
> +};
> +
> +static inline void mini_qdisc_init(struct mini_Qdisc *miniq,
> +				   struct Qdisc *qdisc,
> +				   struct mini_Qdisc __rcu **p_miniq)
> +{
> +	miniq->cpu_bstats = qdisc->cpu_bstats;
> +	miniq->cpu_qstats = qdisc->cpu_qstats;
> +	miniq->p_miniq = p_miniq;
> +}
> +
> +static inline void mini_qdisc_enable(struct mini_Qdisc *miniq)
> +{
> +	rcu_assign_pointer(*miniq->p_miniq, miniq);
> +}
> +
> +static inline void mini_qdisc_disable(struct mini_Qdisc *miniq)
> +{
> +	RCU_INIT_POINTER(*miniq->p_miniq, NULL);
> +	rcu_barrier();

Can you add a comment against which call_rcu() above barrier
protects against?

> +}
> +
>   struct Qdisc_class_ops {
>   	/* Child qdisc manipulation */
>   	struct netdev_queue *	(*select_queue)(struct Qdisc *, struct tcmsg *);
> @@ -259,9 +289,13 @@ struct qdisc_skb_cb {
>   	unsigned char		data[QDISC_CB_PRIV_LEN];
>   };
>
> +typedef void tcf_chain_change_empty_t(struct tcf_proto __rcu **p_filter_chain,
> +				      bool empty);
> +
>   struct tcf_chain {
>   	struct tcf_proto __rcu *filter_chain;
>   	struct tcf_proto __rcu **p_filter_chain;
> +	tcf_chain_change_empty_t *chain_change_empty;
>   	struct list_head list;
>   	struct tcf_block *block;
>   	u32 index; /* chain index */
> @@ -605,6 +639,12 @@ static inline void qdisc_bstats_cpu_update(struct Qdisc *sch,
>   	bstats_cpu_update(this_cpu_ptr(sch->cpu_bstats), skb);
>   }
>
> +static inline void mini_qdisc_bstats_cpu_update(struct mini_Qdisc *miniq,
> +						const struct sk_buff *skb)
> +{
> +	bstats_cpu_update(this_cpu_ptr(miniq->cpu_bstats), skb);
> +}
> +
>   static inline void qdisc_bstats_update(struct Qdisc *sch,
>   				       const struct sk_buff *skb)
>   {
> @@ -648,6 +688,11 @@ static inline void qdisc_qstats_cpu_drop(struct Qdisc *sch)
>   	this_cpu_inc(sch->cpu_qstats->drops);
>   }
>
> +static inline void mini_qdisc_qstats_cpu_drop(struct mini_Qdisc *miniq)
> +{
> +	this_cpu_inc(miniq->cpu_qstats->drops);
> +}
> +
>   static inline void qdisc_qstats_overlimit(struct Qdisc *sch)
>   {
>   	sch->qstats.overlimits++;
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 24ac908..b4a5812 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3274,14 +3274,16 @@ EXPORT_SYMBOL(dev_loopback_xmit);
>   static struct sk_buff *
>   sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
>   {
> -	struct tcf_proto *cl = rcu_dereference_bh(dev->egress_cl_list);
> +	struct mini_Qdisc *miniq = rcu_dereference_bh(skb->dev->miniq_egress);

We already have dev passed here, so lets use it as done previously.

>   	struct tcf_result cl_res;
> +	struct tcf_proto *cl;
>
> -	if (!cl)
> +	if (!miniq)
>   		return skb;
> +	cl = rcu_dereference_bh(miniq->filter_list);

This one still has two RCU dereferences instead of just one. Could
we bind the lifetime of the miniq 1:1 to the filter_list head such
that we can then also get rid of the 2nd rcu_dereference_bh() and
piggy-back on the first one for the filter_list there, thus we push
this into control slow-path instead?

>   	/* qdisc_skb_cb(skb)->pkt_len was already set by the caller. */
> -	qdisc_bstats_cpu_update(cl->q, skb);
> +	mini_qdisc_bstats_cpu_update(miniq, skb);
>
>   	switch (tcf_classify(skb, cl, &cl_res, false)) {
>   	case TC_ACT_OK:
> @@ -3289,7 +3291,7 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
>   		skb->tc_index = TC_H_MIN(cl_res.classid);
>   		break;
>   	case TC_ACT_SHOT:
> -		qdisc_qstats_cpu_drop(cl->q);
> +		mini_qdisc_qstats_cpu_drop(miniq);
>   		*ret = NET_XMIT_DROP;
>   		kfree_skb(skb);
>   		return NULL;
> @@ -4189,16 +4191,19 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
>   		   struct net_device *orig_dev)
>   {
>   #ifdef CONFIG_NET_CLS_ACT
> -	struct tcf_proto *cl = rcu_dereference_bh(skb->dev->ingress_cl_list);
> +	struct mini_Qdisc *miniq = rcu_dereference_bh(skb->dev->miniq_ingress);
>   	struct tcf_result cl_res;
> +	struct tcf_proto *cl;
>
>   	/* If there's at least one ingress present somewhere (so
>   	 * we get here via enabled static key), remaining devices
>   	 * that are not configured with an ingress qdisc will bail
>   	 * out here.
>   	 */
> -	if (!cl)
> +	if (!miniq)
>   		return skb;
> +	cl = rcu_dereference_bh(miniq->filter_list);
> +
>   	if (*pt_prev) {
>   		*ret = deliver_skb(skb, *pt_prev, orig_dev);
>   		*pt_prev = NULL;
> @@ -4206,7 +4211,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
>
>   	qdisc_skb_cb(skb)->pkt_len = skb->len;
>   	skb->tc_at_ingress = 1;
> -	qdisc_bstats_cpu_update(cl->q, skb);
> +	mini_qdisc_bstats_cpu_update(miniq, skb);
>
>   	switch (tcf_classify(skb, cl, &cl_res, false)) {
>   	case TC_ACT_OK:
> @@ -4214,7 +4219,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
>   		skb->tc_index = TC_H_MIN(cl_res.classid);
>   		break;
>   	case TC_ACT_SHOT:
> -		qdisc_qstats_cpu_drop(cl->q);
> +		mini_qdisc_qstats_cpu_drop(miniq);
>   		kfree_skb(skb);
>   		return NULL;
>   	case TC_ACT_STOLEN:

Thanks,
Daniel

^ permalink raw reply

* Re: pull request (net): ipsec 2017-10-24
From: David Miller @ 2017-10-24 11:18 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, netdev
In-Reply-To: <1508841460-26369-1-git-send-email-steffen.klassert@secunet.com>

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Tue, 24 Oct 2017 12:37:38 +0200

> 1) Fix a memleak when we don't find a inner_mode
>    during bundle creation. From David Miller.
> 
> 2) Fix a xfrm policy dump crash. We may crash
>    on error when dumping policies via netlink.
>    Fix this by initializing the policy walk
>    with the cb->start method. This fix is a
>    serious stable candidate. From Herbert Xu.
> 
> Please pull or let me know if there are problems.

Pulled, please submit #2 to -stable indeed!

^ permalink raw reply

* [PATCH 1/3] can: sun4i: fix loopback mode
From: Marc Kleine-Budde @ 2017-10-24 11:27 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Gerhard Bertelsmann, linux-stable,
	Marc Kleine-Budde
In-Reply-To: <20171024112725.13203-1-mkl@pengutronix.de>

From: Gerhard Bertelsmann <info@gerhard-bertelsmann.de>

Fix loopback mode by setting the right flag and remove presume mode.

Signed-off-by: Gerhard Bertelsmann <info@gerhard-bertelsmann.de>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/sun4i_can.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c
index 68ef0a4cd821..b0c80859f746 100644
--- a/drivers/net/can/sun4i_can.c
+++ b/drivers/net/can/sun4i_can.c
@@ -342,7 +342,7 @@ static int sun4i_can_start(struct net_device *dev)
 
 	/* enter the selected mode */
 	mod_reg_val = readl(priv->base + SUN4I_REG_MSEL_ADDR);
-	if (priv->can.ctrlmode & CAN_CTRLMODE_PRESUME_ACK)
+	if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)
 		mod_reg_val |= SUN4I_MSEL_LOOPBACK_MODE;
 	else if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
 		mod_reg_val |= SUN4I_MSEL_LISTEN_ONLY_MODE;
@@ -811,7 +811,6 @@ static int sun4ican_probe(struct platform_device *pdev)
 	priv->can.ctrlmode_supported = CAN_CTRLMODE_BERR_REPORTING |
 				       CAN_CTRLMODE_LISTENONLY |
 				       CAN_CTRLMODE_LOOPBACK |
-				       CAN_CTRLMODE_PRESUME_ACK |
 				       CAN_CTRLMODE_3_SAMPLES;
 	priv->base = addr;
 	priv->clk = clk;
-- 
2.14.2


^ permalink raw reply related

* pull-request: can 2017-10-24
From: Marc Kleine-Budde @ 2017-10-24 11:27 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

here's another pull request for net/master.

The patch by Gerhard Bertelsmann fixes the CAN_CTRLMODE_LOOPBACK in the
sun4i driver. Two patches by Jimmy Assarsson for the kvaser_usb driver
fix a print in the error path of the kvaser_usb_close() and remove a
wrong warning message with the Leaf v2 firmware version v4.1.844.

regards,
Marc

---

The following changes since commit b71d21c274eff20a9db8158882b545b141b73ab8:

  sctp: full support for ipv6 ip_nonlocal_bind & IP_FREEBIND (2017-10-24 18:39:46 +0900)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-4.14-20171024

for you to fetch changes up to e1d2d1329a5722dbecc9c278303fcc4aa01f8790:

  can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages (2017-10-24 13:00:36 +0200)

----------------------------------------------------------------
linux-can-fixes-for-4.14-20171024

----------------------------------------------------------------
Gerhard Bertelsmann (1):
      can: sun4i: fix loopback mode

Jimmy Assarsson (2):
      can: kvaser_usb: Correct return value in printout
      can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages

 drivers/net/can/sun4i_can.c      | 3 +--
 drivers/net/can/usb/kvaser_usb.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

^ permalink raw reply

* [PATCH 2/3] can: kvaser_usb: Correct return value in printout
From: Marc Kleine-Budde @ 2017-10-24 11:27 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Jimmy Assarsson, linux-stable,
	Marc Kleine-Budde
In-Reply-To: <20171024112725.13203-1-mkl@pengutronix.de>

From: Jimmy Assarsson <jimmyassarsson@gmail.com>

If the return value from kvaser_usb_send_simple_msg() was non-zero, the
return value from kvaser_usb_flush_queue() was printed in the kernel
warning.

Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/kvaser_usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 18cc529fb807..861e90efab86 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1609,7 +1609,8 @@ static int kvaser_usb_close(struct net_device *netdev)
 	if (err)
 		netdev_warn(netdev, "Cannot flush queue, error %d\n", err);
 
-	if (kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, priv->channel))
+	err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, priv->channel);
+	if (err)
 		netdev_warn(netdev, "Cannot reset card, error %d\n", err);
 
 	err = kvaser_usb_stop_chip(priv);
-- 
2.14.2

^ permalink raw reply related

* [PATCH 3/3] can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages
From: Marc Kleine-Budde @ 2017-10-24 11:27 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Jimmy Assarsson, linux-stable,
	Marc Kleine-Budde
In-Reply-To: <20171024112725.13203-1-mkl@pengutronix.de>

From: Jimmy Assarsson <jimmyassarsson@gmail.com>

To avoid kernel warning "Unhandled message (68)", ignore the
CMD_FLUSH_QUEUE_REPLY message for now.

As of Leaf v2 firmware version v4.1.844 (2017-02-15), flush tx queue is
synchronous. There is a capability bit indicating whether flushing tx
queue is synchronous or asynchronous.

A proper solution would be to query the device for capabilities. If the
synchronous tx flush capability bit is set, we should wait for
CMD_FLUSH_QUEUE_REPLY message, while flushing the tx queue.

Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/kvaser_usb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 861e90efab86..9b18d96ef526 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -137,6 +137,7 @@ static inline bool kvaser_is_usbcan(const struct usb_device_id *id)
 #define CMD_RESET_ERROR_COUNTER		49
 #define CMD_TX_ACKNOWLEDGE		50
 #define CMD_CAN_ERROR_EVENT		51
+#define CMD_FLUSH_QUEUE_REPLY		68
 
 #define CMD_LEAF_USB_THROTTLE		77
 #define CMD_LEAF_LOG_MESSAGE		106
@@ -1301,6 +1302,11 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev,
 			goto warn;
 		break;
 
+	case CMD_FLUSH_QUEUE_REPLY:
+		if (dev->family != KVASER_LEAF)
+			goto warn;
+		break;
+
 	default:
 warn:		dev_warn(dev->udev->dev.parent,
 			 "Unhandled message (%d)\n", msg->id);
-- 
2.14.2

^ permalink raw reply related

* Re: pull request (net): ipsec 2017-10-24
From: Steffen Klassert @ 2017-10-24 11:35 UTC (permalink / raw)
  To: David Miller; +Cc: herbert, netdev
In-Reply-To: <20171024.201832.1079896012824825450.davem@davemloft.net>

On Tue, Oct 24, 2017 at 08:18:32PM +0900, David Miller wrote:
> From: Steffen Klassert <steffen.klassert@secunet.com>
> Date: Tue, 24 Oct 2017 12:37:38 +0200
> 
> > 1) Fix a memleak when we don't find a inner_mode
> >    during bundle creation. From David Miller.
> > 
> > 2) Fix a xfrm policy dump crash. We may crash
> >    on error when dumping policies via netlink.
> >    Fix this by initializing the policy walk
> >    with the cb->start method. This fix is a
> >    serious stable candidate. From Herbert Xu.
> > 
> > Please pull or let me know if there are problems.
> 
> Pulled, please submit #2 to -stable indeed!

I can do so, but whenever I sent something networking related
to -stable, it was ignored. I think this is because Greg expects
that you do the stable submissions for networking.

^ permalink raw reply

* Re: pull request (net): ipsec 2017-10-24
From: David Miller @ 2017-10-24 11:42 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, netdev
In-Reply-To: <20171024113525.GL3323@secunet.com>

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Tue, 24 Oct 2017 13:35:25 +0200

> On Tue, Oct 24, 2017 at 08:18:32PM +0900, David Miller wrote:
>> From: Steffen Klassert <steffen.klassert@secunet.com>
>> Date: Tue, 24 Oct 2017 12:37:38 +0200
>> 
>> > 1) Fix a memleak when we don't find a inner_mode
>> >    during bundle creation. From David Miller.
>> > 
>> > 2) Fix a xfrm policy dump crash. We may crash
>> >    on error when dumping policies via netlink.
>> >    Fix this by initializing the policy walk
>> >    with the cb->start method. This fix is a
>> >    serious stable candidate. From Herbert Xu.
>> > 
>> > Please pull or let me know if there are problems.
>> 
>> Pulled, please submit #2 to -stable indeed!
> 
> I can do so, but whenever I sent something networking related
> to -stable, it was ignored. I think this is because Greg expects
> that you do the stable submissions for networking.

Send it, CC: me, and I'll reply making sure Greg knows.

Thanks.

^ permalink raw reply

* Re: [PATCH v2 net] tcp/dccp: fix other lockdep splats accessing ireq_opt
From: kbuild test robot @ 2017-10-24 12:17 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: kbuild-all, kernel test robot, David Miller, netdev
In-Reply-To: <1508800508.30291.104.camel@edumazet-glaptop3.roam.corp.google.com>

[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]

Hi Eric,

[auto build test ERROR on net/master]

url:    https://github.com/0day-ci/linux/commits/Eric-Dumazet/tcp-dccp-fix-other-lockdep-splats-accessing-ireq_opt/20171024-200038
config: i386-randconfig-x003-201743 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/srcu.h:33:0,
                    from include/linux/notifier.h:15,
                    from include/linux/memory_hotplug.h:6,
                    from include/linux/mmzone.h:779,
                    from include/linux/gfp.h:5,
                    from include/linux/mm.h:9,
                    from net/socket.c:61:
   include/net/inet_sock.h: In function 'ireq_opt_deref':
>> include/net/inet_sock.h:138:29: error: 'ireq' is a pointer; did you mean to use '->'?
             refcount_read(&ireq.req->rsk_refcnt) > 0);
                                ^
            ->
   include/linux/rcupdate.h:292:52: note: in definition of macro 'RCU_LOCKDEP_WARN'
      if (debug_lockdep_rcu_enabled() && !__warned && (c)) { \
                                                       ^
   include/linux/rcupdate.h:486:2: note: in expansion of macro '__rcu_dereference_check'
     __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
     ^~~~~~~~~~~~~~~~~~~~~~~
>> include/net/inet_sock.h:137:9: note: in expansion of macro 'rcu_dereference_check'
     return rcu_dereference_check(ireq->ireq_opt,
            ^~~~~~~~~~~~~~~~~~~~~

vim +138 include/net/inet_sock.h

   134	
   135	static inline struct ip_options_rcu *ireq_opt_deref(const struct inet_request_sock *ireq)
   136	{
 > 137		return rcu_dereference_check(ireq->ireq_opt,
 > 138					     refcount_read(&ireq.req->rsk_refcnt) > 0);
   139	}
   140	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29923 bytes --]

^ permalink raw reply

* Re: [PATCH v2 net] tcp/dccp: fix other lockdep splats accessing ireq_opt
From: kbuild test robot @ 2017-10-24 12:27 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: kbuild-all, kernel test robot, David Miller, netdev
In-Reply-To: <1508800508.30291.104.camel@edumazet-glaptop3.roam.corp.google.com>

[-- Attachment #1: Type: text/plain, Size: 11005 bytes --]

Hi Eric,

[auto build test WARNING on net/master]

url:    https://github.com/0day-ci/linux/commits/Eric-Dumazet/tcp-dccp-fix-other-lockdep-splats-accessing-ireq_opt/20171024-200038
config: i386-randconfig-x079-201743 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from net//8021q/vlan_dev.c:25:
   include/net/inet_sock.h: In function 'ireq_opt_deref':
   include/net/inet_sock.h:138:29: error: 'ireq' is a pointer; did you mean to use '->'?
             refcount_read(&ireq.req->rsk_refcnt) > 0);
                                ^
            ->
   include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   include/linux/rcupdate.h:292:3: note: in expansion of macro 'if'
      if (debug_lockdep_rcu_enabled() && !__warned && (c)) { \
      ^~
>> include/linux/rcupdate.h:350:2: note: in expansion of macro 'RCU_LOCKDEP_WARN'
     RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
     ^~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:486:2: note: in expansion of macro '__rcu_dereference_check'
     __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
     ^~~~~~~~~~~~~~~~~~~~~~~
   include/net/inet_sock.h:137:9: note: in expansion of macro 'rcu_dereference_check'
     return rcu_dereference_check(ireq->ireq_opt,
            ^~~~~~~~~~~~~~~~~~~~~
   include/net/inet_sock.h:138:29: error: 'ireq' is a pointer; did you mean to use '->'?
             refcount_read(&ireq.req->rsk_refcnt) > 0);
                                ^
            ->
   include/linux/compiler.h:156:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
   include/linux/rcupdate.h:292:3: note: in expansion of macro 'if'
      if (debug_lockdep_rcu_enabled() && !__warned && (c)) { \
      ^~
>> include/linux/rcupdate.h:350:2: note: in expansion of macro 'RCU_LOCKDEP_WARN'
     RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
     ^~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:486:2: note: in expansion of macro '__rcu_dereference_check'
     __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
     ^~~~~~~~~~~~~~~~~~~~~~~
   include/net/inet_sock.h:137:9: note: in expansion of macro 'rcu_dereference_check'
     return rcu_dereference_check(ireq->ireq_opt,
            ^~~~~~~~~~~~~~~~~~~~~
   include/net/inet_sock.h:138:29: error: 'ireq' is a pointer; did you mean to use '->'?
             refcount_read(&ireq.req->rsk_refcnt) > 0);
                                ^
            ->
   include/linux/compiler.h:167:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
   include/linux/rcupdate.h:292:3: note: in expansion of macro 'if'
      if (debug_lockdep_rcu_enabled() && !__warned && (c)) { \
      ^~
>> include/linux/rcupdate.h:350:2: note: in expansion of macro 'RCU_LOCKDEP_WARN'
     RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
     ^~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:486:2: note: in expansion of macro '__rcu_dereference_check'
     __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
     ^~~~~~~~~~~~~~~~~~~~~~~
   include/net/inet_sock.h:137:9: note: in expansion of macro 'rcu_dereference_check'
     return rcu_dereference_check(ireq->ireq_opt,
            ^~~~~~~~~~~~~~~~~~~~~

vim +/RCU_LOCKDEP_WARN +350 include/linux/rcupdate.h

632ee2001 Paul E. McKenney 2010-02-22  283  
4221a9918 Tetsuo Handa     2010-06-26  284  /**
f78f5b90c Paul E. McKenney 2015-06-18  285   * RCU_LOCKDEP_WARN - emit lockdep splat if specified condition is met
f78f5b90c Paul E. McKenney 2015-06-18  286   * @c: condition to check
f78f5b90c Paul E. McKenney 2015-06-18  287   * @s: informative message
f78f5b90c Paul E. McKenney 2015-06-18  288   */
f78f5b90c Paul E. McKenney 2015-06-18  289  #define RCU_LOCKDEP_WARN(c, s)						\
f78f5b90c Paul E. McKenney 2015-06-18  290  	do {								\
f78f5b90c Paul E. McKenney 2015-06-18  291  		static bool __section(.data.unlikely) __warned;		\
f78f5b90c Paul E. McKenney 2015-06-18 @292  		if (debug_lockdep_rcu_enabled() && !__warned && (c)) {	\
f78f5b90c Paul E. McKenney 2015-06-18  293  			__warned = true;				\
f78f5b90c Paul E. McKenney 2015-06-18  294  			lockdep_rcu_suspicious(__FILE__, __LINE__, s);	\
f78f5b90c Paul E. McKenney 2015-06-18  295  		}							\
f78f5b90c Paul E. McKenney 2015-06-18  296  	} while (0)
f78f5b90c Paul E. McKenney 2015-06-18  297  
50406b98b Paul E. McKenney 2012-01-12  298  #if defined(CONFIG_PROVE_RCU) && !defined(CONFIG_PREEMPT_RCU)
50406b98b Paul E. McKenney 2012-01-12  299  static inline void rcu_preempt_sleep_check(void)
50406b98b Paul E. McKenney 2012-01-12  300  {
f78f5b90c Paul E. McKenney 2015-06-18  301  	RCU_LOCKDEP_WARN(lock_is_held(&rcu_lock_map),
5cf05ad75 Paul E. McKenney 2012-05-17  302  			 "Illegal context switch in RCU read-side critical section");
50406b98b Paul E. McKenney 2012-01-12  303  }
50406b98b Paul E. McKenney 2012-01-12  304  #else /* #ifdef CONFIG_PROVE_RCU */
d0df7a349 Paul E. McKenney 2017-05-03  305  static inline void rcu_preempt_sleep_check(void) { }
50406b98b Paul E. McKenney 2012-01-12  306  #endif /* #else #ifdef CONFIG_PROVE_RCU */
50406b98b Paul E. McKenney 2012-01-12  307  
b3fbab057 Paul E. McKenney 2011-05-24  308  #define rcu_sleep_check()						\
b3fbab057 Paul E. McKenney 2011-05-24  309  	do {								\
50406b98b Paul E. McKenney 2012-01-12  310  		rcu_preempt_sleep_check();				\
f78f5b90c Paul E. McKenney 2015-06-18  311  		RCU_LOCKDEP_WARN(lock_is_held(&rcu_bh_lock_map),	\
41f4abd92 Joe Perches      2013-12-05  312  				 "Illegal context switch in RCU-bh read-side critical section"); \
f78f5b90c Paul E. McKenney 2015-06-18  313  		RCU_LOCKDEP_WARN(lock_is_held(&rcu_sched_lock_map),	\
41f4abd92 Joe Perches      2013-12-05  314  				 "Illegal context switch in RCU-sched read-side critical section"); \
b3fbab057 Paul E. McKenney 2011-05-24  315  	} while (0)
b3fbab057 Paul E. McKenney 2011-05-24  316  
ca5ecddfa Paul E. McKenney 2010-04-28  317  #else /* #ifdef CONFIG_PROVE_RCU */
ca5ecddfa Paul E. McKenney 2010-04-28  318  
f78f5b90c Paul E. McKenney 2015-06-18  319  #define RCU_LOCKDEP_WARN(c, s) do { } while (0)
b3fbab057 Paul E. McKenney 2011-05-24  320  #define rcu_sleep_check() do { } while (0)
ca5ecddfa Paul E. McKenney 2010-04-28  321  
ca5ecddfa Paul E. McKenney 2010-04-28  322  #endif /* #else #ifdef CONFIG_PROVE_RCU */
ca5ecddfa Paul E. McKenney 2010-04-28  323  
ca5ecddfa Paul E. McKenney 2010-04-28  324  /*
ca5ecddfa Paul E. McKenney 2010-04-28  325   * Helper functions for rcu_dereference_check(), rcu_dereference_protected()
ca5ecddfa Paul E. McKenney 2010-04-28  326   * and rcu_assign_pointer().  Some of these could be folded into their
ca5ecddfa Paul E. McKenney 2010-04-28  327   * callers, but they are left separate in order to ease introduction of
ca5ecddfa Paul E. McKenney 2010-04-28  328   * multiple flavors of pointers to match the multiple flavors of RCU
ca5ecddfa Paul E. McKenney 2010-04-28  329   * (e.g., __rcu_bh, * __rcu_sched, and __srcu), should this make sense in
ca5ecddfa Paul E. McKenney 2010-04-28  330   * the future.
ca5ecddfa Paul E. McKenney 2010-04-28  331   */
53ecfba25 Paul E. McKenney 2010-09-13  332  
53ecfba25 Paul E. McKenney 2010-09-13  333  #ifdef __CHECKER__
53ecfba25 Paul E. McKenney 2010-09-13  334  #define rcu_dereference_sparse(p, space) \
53ecfba25 Paul E. McKenney 2010-09-13  335  	((void)(((typeof(*p) space *)p) == p))
53ecfba25 Paul E. McKenney 2010-09-13  336  #else /* #ifdef __CHECKER__ */
53ecfba25 Paul E. McKenney 2010-09-13  337  #define rcu_dereference_sparse(p, space)
53ecfba25 Paul E. McKenney 2010-09-13  338  #endif /* #else #ifdef __CHECKER__ */
53ecfba25 Paul E. McKenney 2010-09-13  339  
ca5ecddfa Paul E. McKenney 2010-04-28  340  #define __rcu_access_pointer(p, space) \
ca5ecddfa Paul E. McKenney 2010-04-28  341  ({ \
7d0ae8086 Paul E. McKenney 2015-03-03  342  	typeof(*p) *_________p1 = (typeof(*p) *__force)READ_ONCE(p); \
53ecfba25 Paul E. McKenney 2010-09-13  343  	rcu_dereference_sparse(p, space); \
ca5ecddfa Paul E. McKenney 2010-04-28  344  	((typeof(*p) __force __kernel *)(_________p1)); \
ca5ecddfa Paul E. McKenney 2010-04-28  345  })
ca5ecddfa Paul E. McKenney 2010-04-28  346  #define __rcu_dereference_check(p, c, space) \
ca5ecddfa Paul E. McKenney 2010-04-28  347  ({ \
ac59853c0 Pranith Kumar    2014-11-13  348  	/* Dependency order vs. p above. */ \
ac59853c0 Pranith Kumar    2014-11-13  349  	typeof(*p) *________p1 = (typeof(*p) *__force)lockless_dereference(p); \
f78f5b90c Paul E. McKenney 2015-06-18 @350  	RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
53ecfba25 Paul E. McKenney 2010-09-13  351  	rcu_dereference_sparse(p, space); \
ac59853c0 Pranith Kumar    2014-11-13  352  	((typeof(*p) __force __kernel *)(________p1)); \
ca5ecddfa Paul E. McKenney 2010-04-28  353  })
ca5ecddfa Paul E. McKenney 2010-04-28  354  #define __rcu_dereference_protected(p, c, space) \
ca5ecddfa Paul E. McKenney 2010-04-28  355  ({ \
f78f5b90c Paul E. McKenney 2015-06-18  356  	RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
53ecfba25 Paul E. McKenney 2010-09-13  357  	rcu_dereference_sparse(p, space); \
ca5ecddfa Paul E. McKenney 2010-04-28  358  	((typeof(*p) __force __kernel *)(p)); \
ca5ecddfa Paul E. McKenney 2010-04-28  359  })
995f14056 Paul E. McKenney 2016-07-01  360  #define rcu_dereference_raw(p) \
995f14056 Paul E. McKenney 2016-07-01  361  ({ \
995f14056 Paul E. McKenney 2016-07-01  362  	/* Dependency order vs. p above. */ \
995f14056 Paul E. McKenney 2016-07-01  363  	typeof(p) ________p1 = lockless_dereference(p); \
995f14056 Paul E. McKenney 2016-07-01  364  	((typeof(*p) __force __kernel *)(________p1)); \
995f14056 Paul E. McKenney 2016-07-01  365  })
ca5ecddfa Paul E. McKenney 2010-04-28  366  

:::::: The code at line 350 was first introduced by commit
:::::: f78f5b90c4ffa559e400c3919a02236101f29f3f rcu: Rename rcu_lockdep_assert() to RCU_LOCKDEP_WARN()

:::::: TO: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
:::::: CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32321 bytes --]

^ permalink raw reply

* [PATCH net-next v2 1/2] bridge: netlink: make setlink/dellink notifications more accurate
From: Nikolay Aleksandrov @ 2017-10-24 12:32 UTC (permalink / raw)
  To: netdev; +Cc: Nikolay Aleksandrov, roopa, bridge, mrv, dsa
In-Reply-To: <1508848362-13750-1-git-send-email-nikolay@cumulusnetworks.com>

Before this patch we had cases that either sent notifications when there
were in fact no changes (e.g. non-existent vlan delete) or didn't send
notifications when there were changes (e.g. vlan add range with an error in
the middle, port flags change + vlan update error). This patch sends down
a boolean to the functions setlink/dellink use and if there is even a
single configuration change (port flag, vlan add/del, port state) then
we always send a notification. This is all done to keep backwards
compatibility with the opportunistic vlan delete, where one could
specify a vlan range that has missing vlans inside and still everything
in that range will be cleared, this is mostly used to clear the whole
vlan config with a single call, i.e. range 1-4094.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
 net/bridge/br_netlink.c        | 44 +++++++++++++++++++++++++-----------------
 net/bridge/br_netlink_tunnel.c | 14 +++++++++-----
 net/bridge/br_private_tunnel.h |  3 ++-
 3 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index fb61b6c79235..d0290ede9342 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -506,7 +506,7 @@ int br_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 }
 
 static int br_vlan_info(struct net_bridge *br, struct net_bridge_port *p,
-			int cmd, struct bridge_vlan_info *vinfo)
+			int cmd, struct bridge_vlan_info *vinfo, bool *changed)
 {
 	int err = 0;
 
@@ -517,21 +517,24 @@ static int br_vlan_info(struct net_bridge *br, struct net_bridge_port *p,
 			 * per-VLAN entry as well
 			 */
 			err = nbp_vlan_add(p, vinfo->vid, vinfo->flags);
-			if (err)
-				break;
 		} else {
 			vinfo->flags |= BRIDGE_VLAN_INFO_BRENTRY;
 			err = br_vlan_add(br, vinfo->vid, vinfo->flags);
 		}
+		if (!err)
+			*changed = true;
 		break;
 
 	case RTM_DELLINK:
 		if (p) {
-			nbp_vlan_delete(p, vinfo->vid);
-			if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
-				br_vlan_delete(p->br, vinfo->vid);
-		} else {
-			br_vlan_delete(br, vinfo->vid);
+			if (!nbp_vlan_delete(p, vinfo->vid))
+				*changed = true;
+
+			if ((vinfo->flags & BRIDGE_VLAN_INFO_MASTER) &&
+			    !br_vlan_delete(p->br, vinfo->vid))
+				*changed = true;
+		} else if (!br_vlan_delete(br, vinfo->vid)) {
+			*changed = true;
 		}
 		break;
 	}
@@ -542,7 +545,8 @@ static int br_vlan_info(struct net_bridge *br, struct net_bridge_port *p,
 static int br_process_vlan_info(struct net_bridge *br,
 				struct net_bridge_port *p, int cmd,
 				struct bridge_vlan_info *vinfo_curr,
-				struct bridge_vlan_info **vinfo_last)
+				struct bridge_vlan_info **vinfo_last,
+				bool *changed)
 {
 	if (!vinfo_curr->vid || vinfo_curr->vid >= VLAN_VID_MASK)
 		return -EINVAL;
@@ -572,7 +576,7 @@ static int br_process_vlan_info(struct net_bridge *br,
 		       sizeof(struct bridge_vlan_info));
 		for (v = (*vinfo_last)->vid; v <= vinfo_curr->vid; v++) {
 			tmp_vinfo.vid = v;
-			err = br_vlan_info(br, p, cmd, &tmp_vinfo);
+			err = br_vlan_info(br, p, cmd, &tmp_vinfo, changed);
 			if (err)
 				break;
 		}
@@ -581,13 +585,13 @@ static int br_process_vlan_info(struct net_bridge *br,
 		return err;
 	}
 
-	return br_vlan_info(br, p, cmd, vinfo_curr);
+	return br_vlan_info(br, p, cmd, vinfo_curr, changed);
 }
 
 static int br_afspec(struct net_bridge *br,
 		     struct net_bridge_port *p,
 		     struct nlattr *af_spec,
-		     int cmd)
+		     int cmd, bool *changed)
 {
 	struct bridge_vlan_info *vinfo_curr = NULL;
 	struct bridge_vlan_info *vinfo_last = NULL;
@@ -607,7 +611,8 @@ static int br_afspec(struct net_bridge *br,
 				return err;
 			err = br_process_vlan_tunnel_info(br, p, cmd,
 							  &tinfo_curr,
-							  &tinfo_last);
+							  &tinfo_last,
+							  changed);
 			if (err)
 				return err;
 			break;
@@ -616,7 +621,7 @@ static int br_afspec(struct net_bridge *br,
 				return -EINVAL;
 			vinfo_curr = nla_data(attr);
 			err = br_process_vlan_info(br, p, cmd, vinfo_curr,
-						   &vinfo_last);
+						   &vinfo_last, changed);
 			if (err)
 				return err;
 			break;
@@ -804,6 +809,7 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags)
 	struct nlattr *afspec;
 	struct net_bridge_port *p;
 	struct nlattr *tb[IFLA_BRPORT_MAX + 1];
+	bool changed = false;
 	int err = 0;
 
 	protinfo = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_PROTINFO);
@@ -839,14 +845,15 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags)
 		}
 		if (err)
 			goto out;
+		changed = true;
 	}
 
 	if (afspec) {
 		err = br_afspec((struct net_bridge *)netdev_priv(dev), p,
-				afspec, RTM_SETLINK);
+				afspec, RTM_SETLINK, &changed);
 	}
 
-	if (err == 0)
+	if (changed)
 		br_ifinfo_notify(RTM_NEWLINK, p);
 out:
 	return err;
@@ -857,6 +864,7 @@ int br_dellink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags)
 {
 	struct nlattr *afspec;
 	struct net_bridge_port *p;
+	bool changed = false;
 	int err = 0;
 
 	afspec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC);
@@ -869,8 +877,8 @@ int br_dellink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags)
 		return -EINVAL;
 
 	err = br_afspec((struct net_bridge *)netdev_priv(dev), p,
-			afspec, RTM_DELLINK);
-	if (err == 0)
+			afspec, RTM_DELLINK, &changed);
+	if (changed)
 		/* Send RTM_NEWLINK because userspace
 		 * expects RTM_NEWLINK for vlan dels
 		 */
diff --git a/net/bridge/br_netlink_tunnel.c b/net/bridge/br_netlink_tunnel.c
index 3712c7f0e00c..da8cb99fd259 100644
--- a/net/bridge/br_netlink_tunnel.c
+++ b/net/bridge/br_netlink_tunnel.c
@@ -198,7 +198,7 @@ static const struct nla_policy vlan_tunnel_policy[IFLA_BRIDGE_VLAN_TUNNEL_MAX +
 };
 
 static int br_vlan_tunnel_info(struct net_bridge_port *p, int cmd,
-			       u16 vid, u32 tun_id)
+			       u16 vid, u32 tun_id, bool *changed)
 {
 	int err = 0;
 
@@ -208,9 +208,12 @@ static int br_vlan_tunnel_info(struct net_bridge_port *p, int cmd,
 	switch (cmd) {
 	case RTM_SETLINK:
 		err = nbp_vlan_tunnel_info_add(p, vid, tun_id);
+		if (!err)
+			*changed = true;
 		break;
 	case RTM_DELLINK:
-		nbp_vlan_tunnel_info_delete(p, vid);
+		if (!nbp_vlan_tunnel_info_delete(p, vid))
+			*changed = true;
 		break;
 	}
 
@@ -254,7 +257,8 @@ int br_parse_vlan_tunnel_info(struct nlattr *attr,
 int br_process_vlan_tunnel_info(struct net_bridge *br,
 				struct net_bridge_port *p, int cmd,
 				struct vtunnel_info *tinfo_curr,
-				struct vtunnel_info *tinfo_last)
+				struct vtunnel_info *tinfo_last,
+				bool *changed)
 {
 	int err;
 
@@ -272,7 +276,7 @@ int br_process_vlan_tunnel_info(struct net_bridge *br,
 			return -EINVAL;
 		t = tinfo_last->tunid;
 		for (v = tinfo_last->vid; v <= tinfo_curr->vid; v++) {
-			err = br_vlan_tunnel_info(p, cmd, v, t);
+			err = br_vlan_tunnel_info(p, cmd, v, t, changed);
 			if (err)
 				return err;
 			t++;
@@ -283,7 +287,7 @@ int br_process_vlan_tunnel_info(struct net_bridge *br,
 		if (tinfo_last->flags)
 			return -EINVAL;
 		err = br_vlan_tunnel_info(p, cmd, tinfo_curr->vid,
-					  tinfo_curr->tunid);
+					  tinfo_curr->tunid, changed);
 		if (err)
 			return err;
 		memset(tinfo_last, 0, sizeof(struct vtunnel_info));
diff --git a/net/bridge/br_private_tunnel.h b/net/bridge/br_private_tunnel.h
index 4a447a378ab3..a259471bfd78 100644
--- a/net/bridge/br_private_tunnel.h
+++ b/net/bridge/br_private_tunnel.h
@@ -26,7 +26,8 @@ int br_process_vlan_tunnel_info(struct net_bridge *br,
 				struct net_bridge_port *p,
 				int cmd,
 				struct vtunnel_info *tinfo_curr,
-				struct vtunnel_info *tinfo_last);
+				struct vtunnel_info *tinfo_last,
+				bool *changed);
 int br_get_vlan_tunnel_info_size(struct net_bridge_vlan_group *vg);
 int br_fill_vlan_tunnel_info(struct sk_buff *skb,
 			     struct net_bridge_vlan_group *vg);
-- 
2.1.4

^ permalink raw reply related

* [PATCH net-next 3/4] net: hns3: fix a bug in hclge_uninit_client_instance
From: Lipeng @ 2017-10-24 13:02 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, linuxarm, yisen.zhuang, salil.mehta,
	lipeng321
In-Reply-To: <1508850132-106101-1-git-send-email-lipeng321@huawei.com>

HNS3 driver initialize hdev->roce_client and vport->roce.client in
hclge_init_client_instance, and need set hdev->roce_client and
vport->roce.client NULL.

If do not set them NULL when uninit, it will fail in the scene:
insmod hns3.ko, hns-roce.ko, hns-roce-hw-v3.ko successfully, but
rmmod hns3.ko after rmmod hns-roce-hw-v2.ko and hns-roce.ko.
This patch fixes the issue.

Fixes: 46a3df9 (net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support)

Signed-off-by: Lipeng <lipeng321@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 2c22d3c..d11a9a5 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -4311,13 +4311,19 @@ static void hclge_uninit_client_instance(struct hnae3_client *client,
 
 	for (i = 0; i < hdev->num_vmdq_vport + 1; i++) {
 		vport = &hdev->vport[i];
-		if (hdev->roce_client)
+		if (hdev->roce_client) {
 			hdev->roce_client->ops->uninit_instance(&vport->roce,
 								0);
+			hdev->roce_client = NULL;
+			vport->roce.client = NULL;
+		}
 		if (client->type == HNAE3_CLIENT_ROCE)
 			return;
-		if (client->ops->uninit_instance)
+		if (client->ops->uninit_instance) {
 			client->ops->uninit_instance(&vport->nic, 0);
+			hdev->nic_client = NULL;
+			vport->nic.client = NULL;
+		}
 	}
 }
 
-- 
1.9.1

^ permalink raw reply related

* [PATCH net-next v2 0/2] bridge: make setlink/dellink notifications more accurate
From: Nikolay Aleksandrov @ 2017-10-24 12:32 UTC (permalink / raw)
  To: netdev; +Cc: roopa, dsa, mrv, stephen, bridge, Nikolay Aleksandrov

Hi,
Before this set the bridge would generate a notification on vlan add or del
even if they didn't actually do any changes, which confuses listeners and
is generally not preferred. We could also lose notifications on actual
changes if one adds a range of vlans and there's an error in the middle.
The problem with just breaking and returning an error is that we could
break existing user-space scripts which rely on the vlan delete to clear
all existing entries in the specified range and ignore the non-existing
errors (typically used to clear the current vlan config).
So in order to make the notifications more accurate while keeping backwards
compatibility we add a boolean that tracks if anything actually changed
during the config calls.

The vlan add is more difficult to fix because it always returns 0 even if
nothing changed, but we cannot use a specific error because the drivers
can return anything and we may mask it, also we'd need to update all places
that directly return the add result, thus to signal that a vlan was created
or updated and in order not to break overlapping vlan range add we pass
down the new boolean that tracks changes to the add functions to check
if anything was actually updated.

Can't say that I am happy with this change, but currently I don't see any
simpler way which doesn't affect user-space.

v2: pass changed down to vlan add instead of masking errors

Thanks,
 Nik

Nikolay Aleksandrov (2):
  bridge: netlink: make setlink/dellink notifications more accurate
  bridge: vlan: signal if anything changed on vlan add

 net/bridge/br_netlink.c        | 51 ++++++++++++++++-----------
 net/bridge/br_netlink_tunnel.c | 14 +++++---
 net/bridge/br_private.h        |  6 ++--
 net/bridge/br_private_tunnel.h |  3 +-
 net/bridge/br_vlan.c           | 78 ++++++++++++++++++++++++++++++------------
 5 files changed, 102 insertions(+), 50 deletions(-)

-- 
2.1.4

^ 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