Netdev List
 help / color / mirror / Atom feed
* [PATCH ethtool v5 0/2]  Adding downshift support to ethtool
From: Allan W. Nielsen @ 2016-11-24  8:56 UTC (permalink / raw)
  To: netdev; +Cc: linville, andrew, f.fainelli, raju.lakkaraju, allan.nielsen

(downshift feature is applied in the net-next tree - d3c19c0a72)

This series adds support for downshift (using phy-tunables).

Downshifting can either be turned on/off, or it can be configured to a
specifc count. "count" is optional.

Change set:
v1:
- Initial version of set/get phy tunable with downshift feature.
v2:
- (ethtool) Syntax is changed from "--set-phy-tunable downshift on|off|%d"
  to "--set-phy-tunable [downshift on|off [count N]]" - as requested by
  Andrew.
v3:
- Fixed Spelling in "ethtool-copy.h:sync with net" 
- Fixed "if send_ioctl() returns an error, print the error message and then
  still print th value of count".
v4:
- Fixing spelling in the example included in the commit message
- Improve the description in the man-page
v5:
- re-sync ethtool.h from the net-next tree.


Allan W. Nielsen (1):
  ethtool-copy.h:sync with net-next

Raju Lakkaraju (1):
  Ethtool: Implements ETHTOOL_PHY_GTUNABLE/ETHTOOL_PHY_STUNABLE and PHY
    downshift

 ethtool-copy.h |  21 +++++++--
 ethtool.8.in   |  40 ++++++++++++++++
 ethtool.c      | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 202 insertions(+), 3 deletions(-)

-- 
2.7.3

^ permalink raw reply

* stmmac ethernet in kernel 4.9-rc6: coalescing related pauses.
From: Pavel Machek @ 2016-11-24  8:55 UTC (permalink / raw)
  To: peppe.cavallaro, netdev, kernel list
In-Reply-To: <20161123105125.GA26394@amd>

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

Hi!

> I'm debugging strange delays during transmit in stmmac driver. They
> seem to be present in 4.4 kernel (and older kernels, too). Workload is
> burst of udp packets being sent, pause, burst of udp packets, ...
> 
> Test code is attached, I use these parameters for testing:
> 
> ./udp-test raw 10.0.0.6 1234 1000 100 30
> 
> The delays seem to be related to coalescing:
> 
> drivers/net/ethernet/stmicro/stmmac/common.h
> #define STMMAC_COAL_TX_TIMER    40000
> #define STMMAC_MAX_COAL_TX_TICK 100000
> #define STMMAC_TX_MAX_FRAMES    256
> 
> If I lower the parameters, delays are gone, but I get netdev watchdog
> backtrace followed by broken driver.
> 
> Any ideas what is going on there?

4.9-rc6 still has the delays. With the

#define STMMAC_COAL_TX_TIMER 1000
#define STMMAC_TX_MAX_FRAMES 2

settings, delays go away, and driver still works. (It fails fairly
fast in 4.4). Good news. But the question still is: what is going on
there?

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply

* Re: [patch net-next v2 09/11] ipv4: fib: Add an API to request a FIB dump
From: Ido Schimmel @ 2016-11-24  8:47 UTC (permalink / raw)
  To: Hannes Frederic Sowa
  Cc: Jiri Pirko, netdev, davem, idosch, eladr, yotamg, nogahf, arkadis,
	ogerlitz, roopa, dsa, nikolay, andy, vivien.didelot, andrew,
	f.fainelli, alexander.h.duyck, kaber
In-Reply-To: <6d57dab8-2c83-501e-f3ee-0bad0b72efbb@stressinduktion.org>

On Thu, Nov 24, 2016 at 12:04:57AM +0100, Hannes Frederic Sowa wrote:
> On 23.11.2016 20:53, Ido Schimmel wrote:
> > On Wed, Nov 23, 2016 at 06:47:03PM +0100, Hannes Frederic Sowa wrote:
> >> Hmm, I think you need to read the sequence counter under rtnl_lock to
> >> have an ordering with the rest of the updates to the RCU trie. Otherwise
> >> you don't know if the fib trie has the correct view regarding to the
> >> incoming notifications as a whole. This is also necessary during restarts.
> >
> > I spent quite a lot of time thinking about this specific issue, but I
> > couldn't convince myself that the read should be done under RTNL and I'm
> > not sure I understand your reasoning. Can you please elaborate?
> >
> > If, before each notification sent, we call atomic_inc() and then call
> > atomic_read() at the end, then how can we be tricked?
> 
> The race I am suspecting to happen is:
> 
> <CPU0> fib_register()
> 
> <CPU1> delete route by notifier
> <CPU1> enqueue delete cmd into ordered queue
> 
> <CPU0> starts dump
> <CPU0> sees deleted route by CPU1 because route not yet removed from RCU
> <CPU0> enqueues route for addition

Yea, I missed this trivial case... My mind was fixed on problems that
could happen after the dump already started. :(

Regarding your suggestion, I think the API will be more useful if we
don't bundle fib_register() and fib_dump() together. We can do the
following instead:

1) Sum 'fib_seq' (doesn't need to be atomic_t anymore) from all net
namespaces under RTNL
2) Dump FIB tables under RCU
3) Do 1) again
4) Compare results from 1) and 3) and retry (according to sysctl limit)
if results differ. Before each retry the module's callback (if passed)
will be invoked.

Sounds OK?

^ permalink raw reply

* Re: [PATCH net-next 1/4] net: mvneta: Convert to be 64 bits compatible
From: Jisheng Zhang @ 2016-11-24  8:37 UTC (permalink / raw)
  To: Marcin Wojtas, Gregory CLEMENT, Arnd Bergmann
  Cc: linux-arm-kernel@lists.infradead.org, Thomas Petazzoni,
	Andrew Lunn, Jason Cooper, netdev, linux-kernel, David S. Miller,
	Sebastian Hesselbarth
In-Reply-To: <CAPv3WKf0a63qQT+xwXfUatbgLFF58e6L8J10VtBOUTam+kUcjg@mail.gmail.com>

Hi Marcin, Gregory, Arnd,

On Wed, 23 Nov 2016 17:02:11 +0100 Marcin Wojtas  wrote:

> Hi Gregory,
> 
> 2016-11-23 14:07 GMT+01:00 Gregory CLEMENT:
> > Hi Jisheng, Arnd,
> >
> >
> > Thanks for your feedback.
> >
> >
> >  On mer., nov. 23 2016, Arnd Bergmann wrote:
> >  
> >> On Wednesday, November 23, 2016 5:53:41 PM CET Jisheng Zhang wrote:  
> >>> On Tue, 22 Nov 2016 22:04:12 +0100 Arnd Bergmann wrote:
> >>>  
> >>> > On Tuesday, November 22, 2016 5:48:41 PM CET Gregory CLEMENT wrote:  
> >>> > > +#ifdef CONFIG_64BIT
> >>> > > +       void *data_tmp;
> >>> > > +
> >>> > > +       /* In Neta HW only 32 bits data is supported, so in order to
> >>> > > +        * obtain whole 64 bits address from RX descriptor, we store
> >>> > > +        * the upper 32 bits when allocating buffer, and put it back
> >>> > > +        * when using buffer cookie for accessing packet in memory.
> >>> > > +        * Frags should be allocated from single 'memory' region,
> >>> > > +        * hence common upper address half should be sufficient.
> >>> > > +        */
> >>> > > +       data_tmp = mvneta_frag_alloc(pp->frag_size);
> >>> > > +       if (data_tmp) {
> >>> > > +               pp->data_high = (u64)upper_32_bits((u64)data_tmp) << 32;
> >>> > > +               mvneta_frag_free(pp->frag_size, data_tmp);
> >>> > > +       }
> >>> > >  
> >>> >
> >>> > How does this work when the region spans a n*4GB address boundary?  
> >>>
> >>> indeed. We also make use of this driver on 64bit platforms. We use
> >>> different solution to make the driver 64bit safe.
> >>>
> >>> solA: make use of the reserved field in the mvneta_rx_desc, such
> >>> as reserved2 etc. Yes, the field is marked as "for future use, PnC", but
> >>> now it's not used at all. This is one possible solution however.  
> >>
> >> Right, this sounds like the most straightforward choice.  
> >
> > The PnC (which stands for Parsing and Classification) is not used yet
> > indeed but this field will be needed when we will enable it. It is
> > something we want to do but it is not planned in a near future. However
> > from the datasheets I have it seems only present on the Armada XP. It is
> > not mentioned on datasheets for the Armada 38x or the Armada 3700.
> >  
> 
> It is not mentioned in A38x spec, but this SoC has exactly the same
> PnC as Armada XP (they differ only with used SRAM details). I wouldn't
> be surprised if it was supported on A3700 as well.
> 
> > That would mean it was safe to use on of this field in 64-bits mode on
> > the Armada 3700.
> >
> > So I am going to take this approach.
> >  
> 
> I think for now it's safe and is much easier than handling extra
> software ring for virtual addresses.
> 

solB (a SW shadow cookie) perhaps gives a better performance: in hot path,
such as mvneta_rx(), the driver accesses buf_cookie and buf_phys_addr of
rx_desc which is allocated by dma_alloc_coherent, it's noncacheable if the
device isn't cache-coherent. I didn't measure the performance difference,
because in fact we take solA as well internally. From your experience,
can the performance gain deserve the complex code?

Thanks,
Jisheng

^ permalink raw reply

* Re: wl1251 & mac address & calibration data
From: Pali Rohár @ 2016-11-24  8:33 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Michal Kazior, Kalle Valo, Ivaylo Dimitrov, Sebastian Reichel,
	Aaro Koskinen, Tony Lindgren, linux-wireless, Network Development,
	linux-kernel
In-Reply-To: <20161124075104.GA26721@amd>

On Thursday 24 November 2016 08:51:04 Pavel Machek wrote:
> Hi!
> 
> > > "ifconfig hw ether XX" normally sets the address. I guess that's
> > > ioctl?
> > 
> > This sets temporary address and it is ioctl. IIRC same as what ethtool 
> > uses. (ifconfig is already deprecated).
> > 
> > > And I guess we should use similar mechanism for permanent
> > > address.
> > 
> > I'm not sure here... Above ioctl ↑↑↑ is for changing temporary mac 
> > address. But here we do not want to change permanent mac address. We 
> > want to tell kernel driver current permanent mac address which is
> > stored
> 
> Well... I'd still use similar mechanism :-).

Thats problematic, because in time when wlan0 interface is registered
into system and visible in ifconfig output it already needs to have
permanent mac address assigned.

We should assign permanent mac address before wlan0 of wl1251 is
registered into system.

-- 
Pali Rohár
pali.rohar@gmail.com

^ permalink raw reply

* Re: [Patch net-next] net_sched: move the empty tp check from ->destroy() to ->delete()
From: Roi Dayan @ 2016-11-24  8:29 UTC (permalink / raw)
  To: Cong Wang, netdev; +Cc: roid, jiri, Daniel Borkmann, John Fastabend
In-Reply-To: <1479952708-26763-1-git-send-email-xiyou.wangcong@gmail.com>

Hi,

I'm testing this patch with KASAN enabled and got into a new kernel 
crash I didn't hit before.


[ 1860.725065] 
==================================================================
[ 1860.733893] BUG: KASAN: use-after-free in 
__netif_receive_skb_core+0x1ebe/0x29a0 at addr ffff880a68b04028
[ 1860.745415] Read of size 8 by task CPU 0/KVM/5334
[ 1860.751368] CPU: 8 PID: 5334 Comm: CPU 0/KVM Tainted: G O    
4.9.0-rc3+ #18
[ 1860.760547] Hardware name: HP ProLiant DL380p Gen8, BIOS P70 07/01/2015
[ 1860.768036] Call Trace:
[ 1860.771307]  [<ffffffffa9b6dc42>] dump_stack+0x63/0x81
[ 1860.777167]  [<ffffffffa95fb751>] kasan_object_err+0x21/0x70
[ 1860.783826]  [<ffffffffa95fb9dd>] kasan_report_error+0x1ed/0x4e0
[ 1860.790640]  [<ffffffffa9b9b841>] ? csum_partial+0x11/0x20
[ 1860.796871]  [<ffffffffaa44a6b9>] ? csum_partial_ext+0x9/0x10
[ 1860.803571]  [<ffffffffaa453155>] ? __skb_checksum+0x115/0x8d0
[ 1860.810370]  [<ffffffffa95fbe81>] __asan_report_load8_noabort+0x61/0x70
[ 1860.818263]  [<ffffffffaa49c3fe>] ? 
__netif_receive_skb_core+0x1ebe/0x29a0
[ 1860.826215]  [<ffffffffaa49c3fe>] __netif_receive_skb_core+0x1ebe/0x29a0
[ 1860.833991]  [<ffffffffaa49a540>] ? netdev_info+0x100/0x100
[ 1860.840529]  [<ffffffffaa671792>] ? udp4_gro_receive+0x802/0x1090
[ 1860.847783]  [<ffffffffa9bb9a08>] ? find_next_bit+0x18/0x20
[ 1860.854126]  [<ffffffffaa49cf04>] __netif_receive_skb+0x24/0x150
[ 1860.861695]  [<ffffffffaa49d0d1>] netif_receive_skb_internal+0xa1/0x1d0
[ 1860.869366]  [<ffffffffaa49d030>] ? __netif_receive_skb+0x150/0x150
[ 1860.876464]  [<ffffffffaa49f7e9>] ? dev_gro_receive+0x969/0x1660
[ 1860.883924]  [<ffffffffaa4a0e1f>] napi_gro_receive+0x1df/0x300
[ 1860.890744]  [<ffffffffc02e885d>] mlx5e_handle_rx_cqe_rep+0x83d/0xd30 
[mlx5_core]

checking with gdb

(gdb) l *(__netif_receive_skb_core+0x1ebe)
0xffffffff8249c3fe is in __netif_receive_skb_core (net/core/dev.c:3937).
3932                    *pt_prev = NULL;
3933            }
3934
3935            qdisc_skb_cb(skb)->pkt_len = skb->len;
3936            skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_INGRESS);
3937            qdisc_bstats_cpu_update(cl->q, skb);
3938
3939            switch (tc_classify(skb, cl, &cl_res, false)) {
3940            case TC_ACT_OK:
3941            case TC_ACT_RECLASSIFY:


Thanks,
Roi



On 24/11/2016 03:58, Cong Wang wrote:
> Roi reported we could have a race condition where in ->classify() path
> we dereference tp->root and meanwhile a parallel ->destroy() makes it
> a NULL.
>
> This is possible because ->destroy() could be called when deleting
> a filter to check if we are the last one in tp, this tp is still
> linked and visible at that time.
>
> The root cause of this problem is the semantic of ->destroy(), it
> does two things (for non-force case):
>
> 1) check if tp is empty
> 2) if tp is empty we could really destroy it
>
> and its caller, if cares, needs to check its return value to see if
> it is really destroyed. Therefore we can't unlink tp unless we know
> it is empty.
>
> As suggested by Daniel, we could actually move the test logic to ->delete()
> so that we can safely unlink tp after ->delete() tells us the last one is
> just deleted and before ->destroy().
>
> What's more, even we unlink it before ->destroy(), it could still have
> readers since we don't wait for a grace period here, we should not modify
> tp->root in ->destroy() either.
>
> Fixes: 1e052be69d04 ("net_sched: destroy proto tp when all filters are gone")
> Reported-by: Roi Dayan <roid@mellanox.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
>   include/net/sch_generic.h |  6 ++--
>   net/sched/cls_api.c       | 18 +++++++-----
>   net/sched/cls_basic.c     | 11 +++-----
>   net/sched/cls_bpf.c       | 11 +++-----
>   net/sched/cls_cgroup.c    | 12 ++------
>   net/sched/cls_flow.c      | 11 +++-----
>   net/sched/cls_flower.c    | 10 ++-----
>   net/sched/cls_fw.c        | 30 +++++++++++---------
>   net/sched/cls_matchall.c  | 10 ++-----
>   net/sched/cls_route.c     | 30 ++++++++++----------
>   net/sched/cls_rsvp.h      | 34 +++++++++++------------
>   net/sched/cls_tcindex.c   | 15 +++++-----
>   net/sched/cls_u32.c       | 71 +++++++++++++++++++++++++++--------------------
>   net/sched/sch_api.c       | 14 ++++------
>   14 files changed, 137 insertions(+), 146 deletions(-)
>
> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> index e6aa0a2..27cd1bd 100644
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -203,14 +203,14 @@ struct tcf_proto_ops {
>   					    const struct tcf_proto *,
>   					    struct tcf_result *);
>   	int			(*init)(struct tcf_proto*);
> -	bool			(*destroy)(struct tcf_proto*, bool);
> +	void			(*destroy)(struct tcf_proto*);
>   
>   	unsigned long		(*get)(struct tcf_proto*, u32 handle);
>   	int			(*change)(struct net *net, struct sk_buff *,
>   					struct tcf_proto*, unsigned long,
>   					u32 handle, struct nlattr **,
>   					unsigned long *, bool);
> -	int			(*delete)(struct tcf_proto*, unsigned long);
> +	int			(*delete)(struct tcf_proto*, unsigned long, bool*);
>   	void			(*walk)(struct tcf_proto*, struct tcf_walker *arg);
>   
>   	/* rtnetlink specific */
> @@ -405,7 +405,7 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
>   				const struct Qdisc_ops *ops, u32 parentid);
>   void __qdisc_calculate_pkt_len(struct sk_buff *skb,
>   			       const struct qdisc_size_table *stab);
> -bool tcf_destroy(struct tcf_proto *tp, bool force);
> +void tcf_destroy(struct tcf_proto *tp);
>   void tcf_destroy_chain(struct tcf_proto __rcu **fl);
>   int skb_do_redirect(struct sk_buff *);
>   
> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
> index 8e93d4a..f159aeb 100644
> --- a/net/sched/cls_api.c
> +++ b/net/sched/cls_api.c
> @@ -321,7 +321,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
>   
>   			tfilter_notify(net, skb, n, tp, fh,
>   				       RTM_DELTFILTER, false);
> -			tcf_destroy(tp, true);
> +			tcf_destroy(tp);
>   			err = 0;
>   			goto errout;
>   		}
> @@ -331,25 +331,29 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
>   		    !(n->nlmsg_flags & NLM_F_CREATE))
>   			goto errout;
>   	} else {
> +		bool last;
> +
>   		switch (n->nlmsg_type) {
>   		case RTM_NEWTFILTER:
>   			err = -EEXIST;
>   			if (n->nlmsg_flags & NLM_F_EXCL) {
>   				if (tp_created)
> -					tcf_destroy(tp, true);
> +					tcf_destroy(tp);
>   				goto errout;
>   			}
>   			break;
>   		case RTM_DELTFILTER:
> -			err = tp->ops->delete(tp, fh);
> +			err = tp->ops->delete(tp, fh, &last);
>   			if (err == 0) {
> -				struct tcf_proto *next = rtnl_dereference(tp->next);
> -
>   				tfilter_notify(net, skb, n, tp,
>   					       t->tcm_handle,
>   					       RTM_DELTFILTER, false);
> -				if (tcf_destroy(tp, false))
> +				if (last) {
> +					struct tcf_proto *next = rtnl_dereference(tp->next);
> +
>   					RCU_INIT_POINTER(*back, next);
> +					tcf_destroy(tp);
> +				}
>   			}
>   			goto errout;
>   		case RTM_GETTFILTER:
> @@ -372,7 +376,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
>   		tfilter_notify(net, skb, n, tp, fh, RTM_NEWTFILTER, false);
>   	} else {
>   		if (tp_created)
> -			tcf_destroy(tp, true);
> +			tcf_destroy(tp);
>   	}
>   
>   errout:
> diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
> index eb219b7..dd63230 100644
> --- a/net/sched/cls_basic.c
> +++ b/net/sched/cls_basic.c
> @@ -96,31 +96,28 @@ static void basic_delete_filter(struct rcu_head *head)
>   	kfree(f);
>   }
>   
> -static bool basic_destroy(struct tcf_proto *tp, bool force)
> +static void basic_destroy(struct tcf_proto *tp)
>   {
>   	struct basic_head *head = rtnl_dereference(tp->root);
>   	struct basic_filter *f, *n;
>   
> -	if (!force && !list_empty(&head->flist))
> -		return false;
> -
>   	list_for_each_entry_safe(f, n, &head->flist, link) {
>   		list_del_rcu(&f->link);
>   		tcf_unbind_filter(tp, &f->res);
>   		call_rcu(&f->rcu, basic_delete_filter);
>   	}
> -	RCU_INIT_POINTER(tp->root, NULL);
>   	kfree_rcu(head, rcu);
> -	return true;
>   }
>   
> -static int basic_delete(struct tcf_proto *tp, unsigned long arg)
> +static int basic_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
> +	struct basic_head *head = rtnl_dereference(tp->root);
>   	struct basic_filter *f = (struct basic_filter *) arg;
>   
>   	list_del_rcu(&f->link);
>   	tcf_unbind_filter(tp, &f->res);
>   	call_rcu(&f->rcu, basic_delete_filter);
> +	*last = list_empty(&head->flist);
>   	return 0;
>   }
>   
> diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
> index 52dc85a..770984c0 100644
> --- a/net/sched/cls_bpf.c
> +++ b/net/sched/cls_bpf.c
> @@ -265,26 +265,25 @@ static void __cls_bpf_delete_prog(struct rcu_head *rcu)
>   	cls_bpf_delete_prog(prog->tp, prog);
>   }
>   
> -static int cls_bpf_delete(struct tcf_proto *tp, unsigned long arg)
> +static int cls_bpf_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
>   	struct cls_bpf_prog *prog = (struct cls_bpf_prog *) arg;
> +	struct cls_bpf_head *head = rtnl_dereference(tp->root);
>   
>   	cls_bpf_stop_offload(tp, prog);
>   	list_del_rcu(&prog->link);
>   	tcf_unbind_filter(tp, &prog->res);
>   	call_rcu(&prog->rcu, __cls_bpf_delete_prog);
> +	*last = list_empty(&head->plist);
>   
>   	return 0;
>   }
>   
> -static bool cls_bpf_destroy(struct tcf_proto *tp, bool force)
> +static void cls_bpf_destroy(struct tcf_proto *tp)
>   {
>   	struct cls_bpf_head *head = rtnl_dereference(tp->root);
>   	struct cls_bpf_prog *prog, *tmp;
>   
> -	if (!force && !list_empty(&head->plist))
> -		return false;
> -
>   	list_for_each_entry_safe(prog, tmp, &head->plist, link) {
>   		cls_bpf_stop_offload(tp, prog);
>   		list_del_rcu(&prog->link);
> @@ -292,9 +291,7 @@ static bool cls_bpf_destroy(struct tcf_proto *tp, bool force)
>   		call_rcu(&prog->rcu, __cls_bpf_delete_prog);
>   	}
>   
> -	RCU_INIT_POINTER(tp->root, NULL);
>   	kfree_rcu(head, rcu);
> -	return true;
>   }
>   
>   static unsigned long cls_bpf_get(struct tcf_proto *tp, u32 handle)
> diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
> index 85233c47..fa9405e 100644
> --- a/net/sched/cls_cgroup.c
> +++ b/net/sched/cls_cgroup.c
> @@ -131,21 +131,15 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
>   	return err;
>   }
>   
> -static bool cls_cgroup_destroy(struct tcf_proto *tp, bool force)
> +static void cls_cgroup_destroy(struct tcf_proto *tp)
>   {
>   	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
>   
> -	if (!force)
> -		return false;
> -
> -	if (head) {
> -		RCU_INIT_POINTER(tp->root, NULL);
> +	if (head)
>   		call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
> -	}
> -	return true;
>   }
>   
> -static int cls_cgroup_delete(struct tcf_proto *tp, unsigned long arg)
> +static int cls_cgroup_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
>   	return -EOPNOTSUPP;
>   }
> diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
> index e396723..ea2be75 100644
> --- a/net/sched/cls_flow.c
> +++ b/net/sched/cls_flow.c
> @@ -563,12 +563,14 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
>   	return err;
>   }
>   
> -static int flow_delete(struct tcf_proto *tp, unsigned long arg)
> +static int flow_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
> +	struct flow_head *head = rtnl_dereference(tp->root);
>   	struct flow_filter *f = (struct flow_filter *)arg;
>   
>   	list_del_rcu(&f->list);
>   	call_rcu(&f->rcu, flow_destroy_filter);
> +	*last = list_empty(&head->filters);
>   	return 0;
>   }
>   
> @@ -584,21 +586,16 @@ static int flow_init(struct tcf_proto *tp)
>   	return 0;
>   }
>   
> -static bool flow_destroy(struct tcf_proto *tp, bool force)
> +static void flow_destroy(struct tcf_proto *tp)
>   {
>   	struct flow_head *head = rtnl_dereference(tp->root);
>   	struct flow_filter *f, *next;
>   
> -	if (!force && !list_empty(&head->filters))
> -		return false;
> -
>   	list_for_each_entry_safe(f, next, &head->filters, list) {
>   		list_del_rcu(&f->list);
>   		call_rcu(&f->rcu, flow_destroy_filter);
>   	}
> -	RCU_INIT_POINTER(tp->root, NULL);
>   	kfree_rcu(head, rcu);
> -	return true;
>   }
>   
>   static unsigned long flow_get(struct tcf_proto *tp, u32 handle)
> diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
> index e8dd09a..495d63224 100644
> --- a/net/sched/cls_flower.c
> +++ b/net/sched/cls_flower.c
> @@ -280,21 +280,16 @@ static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f)
>   	call_rcu(&f->rcu, fl_destroy_filter);
>   }
>   
> -static bool fl_destroy(struct tcf_proto *tp, bool force)
> +static void fl_destroy(struct tcf_proto *tp)
>   {
>   	struct cls_fl_head *head = rtnl_dereference(tp->root);
>   	struct cls_fl_filter *f, *next;
>   
> -	if (!force && !list_empty(&head->filters))
> -		return false;
> -
>   	list_for_each_entry_safe(f, next, &head->filters, list)
>   		__fl_delete(tp, f);
> -	RCU_INIT_POINTER(tp->root, NULL);
>   	if (head->mask_assigned)
>   		rhashtable_destroy(&head->ht);
>   	kfree_rcu(head, rcu);
> -	return true;
>   }
>   
>   static unsigned long fl_get(struct tcf_proto *tp, u32 handle)
> @@ -777,7 +772,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
>   	return err;
>   }
>   
> -static int fl_delete(struct tcf_proto *tp, unsigned long arg)
> +static int fl_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
>   	struct cls_fl_head *head = rtnl_dereference(tp->root);
>   	struct cls_fl_filter *f = (struct cls_fl_filter *) arg;
> @@ -785,6 +780,7 @@ static int fl_delete(struct tcf_proto *tp, unsigned long arg)
>   	rhashtable_remove_fast(&head->ht, &f->ht_node,
>   			       head->ht_params);
>   	__fl_delete(tp, f);
> +	*last = list_empty(&head->filters);
>   	return 0;
>   }
>   
> diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
> index 9dc63d5..bc8ceb7 100644
> --- a/net/sched/cls_fw.c
> +++ b/net/sched/cls_fw.c
> @@ -127,20 +127,14 @@ static void fw_delete_filter(struct rcu_head *head)
>   	kfree(f);
>   }
>   
> -static bool fw_destroy(struct tcf_proto *tp, bool force)
> +static void fw_destroy(struct tcf_proto *tp)
>   {
>   	struct fw_head *head = rtnl_dereference(tp->root);
>   	struct fw_filter *f;
>   	int h;
>   
>   	if (head == NULL)
> -		return true;
> -
> -	if (!force) {
> -		for (h = 0; h < HTSIZE; h++)
> -			if (rcu_access_pointer(head->ht[h]))
> -				return false;
> -	}
> +		return;
>   
>   	for (h = 0; h < HTSIZE; h++) {
>   		while ((f = rtnl_dereference(head->ht[h])) != NULL) {
> @@ -150,17 +144,17 @@ static bool fw_destroy(struct tcf_proto *tp, bool force)
>   			call_rcu(&f->rcu, fw_delete_filter);
>   		}
>   	}
> -	RCU_INIT_POINTER(tp->root, NULL);
>   	kfree_rcu(head, rcu);
> -	return true;
>   }
>   
> -static int fw_delete(struct tcf_proto *tp, unsigned long arg)
> +static int fw_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
>   	struct fw_head *head = rtnl_dereference(tp->root);
>   	struct fw_filter *f = (struct fw_filter *)arg;
>   	struct fw_filter __rcu **fp;
>   	struct fw_filter *pfp;
> +	int ret = -EINVAL;
> +	int h;
>   
>   	if (head == NULL || f == NULL)
>   		goto out;
> @@ -173,11 +167,21 @@ static int fw_delete(struct tcf_proto *tp, unsigned long arg)
>   			RCU_INIT_POINTER(*fp, rtnl_dereference(f->next));
>   			tcf_unbind_filter(tp, &f->res);
>   			call_rcu(&f->rcu, fw_delete_filter);
> -			return 0;
> +			ret = 0;
> +			break;
>   		}
>   	}
> +
> +	*last = true;
> +	for (h = 0; h < HTSIZE; h++) {
> +		if (rcu_access_pointer(head->ht[h])) {
> +			*last = false;
> +			break;
> +		}
> +	}
> +
>   out:
> -	return -EINVAL;
> +	return ret;
>   }
>   
>   static const struct nla_policy fw_policy[TCA_FW_MAX + 1] = {
> diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
> index 25927b6..7d54805 100644
> --- a/net/sched/cls_matchall.c
> +++ b/net/sched/cls_matchall.c
> @@ -99,24 +99,19 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp,
>   					     &offload);
>   }
>   
> -static bool mall_destroy(struct tcf_proto *tp, bool force)
> +static void mall_destroy(struct tcf_proto *tp)
>   {
>   	struct cls_mall_head *head = rtnl_dereference(tp->root);
>   	struct net_device *dev = tp->q->dev_queue->dev;
>   	struct cls_mall_filter *f = head->filter;
>   
> -	if (!force && f)
> -		return false;
> -
>   	if (f) {
>   		if (tc_should_offload(dev, tp, f->flags))
>   			mall_destroy_hw_filter(tp, f, (unsigned long) f);
>   
>   		call_rcu(&f->rcu, mall_destroy_filter);
>   	}
> -	RCU_INIT_POINTER(tp->root, NULL);
>   	kfree_rcu(head, rcu);
> -	return true;
>   }
>   
>   static unsigned long mall_get(struct tcf_proto *tp, u32 handle)
> @@ -225,7 +220,7 @@ static int mall_change(struct net *net, struct sk_buff *in_skb,
>   	return err;
>   }
>   
> -static int mall_delete(struct tcf_proto *tp, unsigned long arg)
> +static int mall_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
>   	struct cls_mall_head *head = rtnl_dereference(tp->root);
>   	struct cls_mall_filter *f = (struct cls_mall_filter *) arg;
> @@ -237,6 +232,7 @@ static int mall_delete(struct tcf_proto *tp, unsigned long arg)
>   	RCU_INIT_POINTER(head->filter, NULL);
>   	tcf_unbind_filter(tp, &f->res);
>   	call_rcu(&f->rcu, mall_destroy_filter);
> +	*last = true;
>   	return 0;
>   }
>   
> diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
> index 455fc8f..1a38e41 100644
> --- a/net/sched/cls_route.c
> +++ b/net/sched/cls_route.c
> @@ -276,20 +276,13 @@ static void route4_delete_filter(struct rcu_head *head)
>   	kfree(f);
>   }
>   
> -static bool route4_destroy(struct tcf_proto *tp, bool force)
> +static void route4_destroy(struct tcf_proto *tp)
>   {
>   	struct route4_head *head = rtnl_dereference(tp->root);
>   	int h1, h2;
>   
>   	if (head == NULL)
> -		return true;
> -
> -	if (!force) {
> -		for (h1 = 0; h1 <= 256; h1++) {
> -			if (rcu_access_pointer(head->table[h1]))
> -				return false;
> -		}
> -	}
> +		return;
>   
>   	for (h1 = 0; h1 <= 256; h1++) {
>   		struct route4_bucket *b;
> @@ -312,12 +305,10 @@ static bool route4_destroy(struct tcf_proto *tp, bool force)
>   			kfree_rcu(b, rcu);
>   		}
>   	}
> -	RCU_INIT_POINTER(tp->root, NULL);
>   	kfree_rcu(head, rcu);
> -	return true;
>   }
>   
> -static int route4_delete(struct tcf_proto *tp, unsigned long arg)
> +static int route4_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
>   	struct route4_head *head = rtnl_dereference(tp->root);
>   	struct route4_filter *f = (struct route4_filter *)arg;
> @@ -325,7 +316,7 @@ static int route4_delete(struct tcf_proto *tp, unsigned long arg)
>   	struct route4_filter *nf;
>   	struct route4_bucket *b;
>   	unsigned int h = 0;
> -	int i;
> +	int i, h1;
>   
>   	if (!head || !f)
>   		return -EINVAL;
> @@ -356,16 +347,25 @@ static int route4_delete(struct tcf_proto *tp, unsigned long arg)
>   
>   				rt = rtnl_dereference(b->ht[i]);
>   				if (rt)
> -					return 0;
> +					goto out;
>   			}
>   
>   			/* OK, session has no flows */
>   			RCU_INIT_POINTER(head->table[to_hash(h)], NULL);
>   			kfree_rcu(b, rcu);
> +			break;
> +		}
> +	}
>   
> -			return 0;
> +out:
> +	*last = true;
> +	for (h1 = 0; h1 <= 256; h1++) {
> +		if (rcu_access_pointer(head->table[h1])) {
> +			*last = false;
> +			break;
>   		}
>   	}
> +
>   	return 0;
>   }
>   
> diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
> index 4f05a19..e8ba81a 100644
> --- a/net/sched/cls_rsvp.h
> +++ b/net/sched/cls_rsvp.h
> @@ -301,22 +301,13 @@ static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f)
>   	call_rcu(&f->rcu, rsvp_delete_filter_rcu);
>   }
>   
> -static bool rsvp_destroy(struct tcf_proto *tp, bool force)
> +static void rsvp_destroy(struct tcf_proto *tp)
>   {
>   	struct rsvp_head *data = rtnl_dereference(tp->root);
>   	int h1, h2;
>   
>   	if (data == NULL)
> -		return true;
> -
> -	if (!force) {
> -		for (h1 = 0; h1 < 256; h1++) {
> -			if (rcu_access_pointer(data->ht[h1]))
> -				return false;
> -		}
> -	}
> -
> -	RCU_INIT_POINTER(tp->root, NULL);
> +		return;
>   
>   	for (h1 = 0; h1 < 256; h1++) {
>   		struct rsvp_session *s;
> @@ -336,10 +327,9 @@ static bool rsvp_destroy(struct tcf_proto *tp, bool force)
>   		}
>   	}
>   	kfree_rcu(data, rcu);
> -	return true;
>   }
>   
> -static int rsvp_delete(struct tcf_proto *tp, unsigned long arg)
> +static int rsvp_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
>   	struct rsvp_head *head = rtnl_dereference(tp->root);
>   	struct rsvp_filter *nfp, *f = (struct rsvp_filter *)arg;
> @@ -347,7 +337,7 @@ static int rsvp_delete(struct tcf_proto *tp, unsigned long arg)
>   	unsigned int h = f->handle;
>   	struct rsvp_session __rcu **sp;
>   	struct rsvp_session *nsp, *s = f->sess;
> -	int i;
> +	int i, h1;
>   
>   	fp = &s->ht[(h >> 8) & 0xFF];
>   	for (nfp = rtnl_dereference(*fp); nfp;
> @@ -360,7 +350,7 @@ static int rsvp_delete(struct tcf_proto *tp, unsigned long arg)
>   
>   			for (i = 0; i <= 16; i++)
>   				if (s->ht[i])
> -					return 0;
> +					goto out;
>   
>   			/* OK, session has no flows */
>   			sp = &head->ht[h & 0xFF];
> @@ -369,13 +359,23 @@ static int rsvp_delete(struct tcf_proto *tp, unsigned long arg)
>   				if (nsp == s) {
>   					RCU_INIT_POINTER(*sp, s->next);
>   					kfree_rcu(s, rcu);
> -					return 0;
> +					goto out;
>   				}
>   			}
>   
> -			return 0;
> +			break;
>   		}
>   	}
> +
> +out:
> +	*last = true;
> +	for (h1 = 0; h1 < 256; h1++) {
> +		if (rcu_access_pointer(head->ht[h1])) {
> +			*last = false;
> +			break;
> +		}
> +	}
> +
>   	return 0;
>   }
>   
> diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
> index 96144bd..9149a03 100644
> --- a/net/sched/cls_tcindex.c
> +++ b/net/sched/cls_tcindex.c
> @@ -150,7 +150,7 @@ static void tcindex_destroy_fexts(struct rcu_head *head)
>   	kfree(f);
>   }
>   
> -static int tcindex_delete(struct tcf_proto *tp, unsigned long arg)
> +static int tcindex_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
>   	struct tcindex_data *p = rtnl_dereference(tp->root);
>   	struct tcindex_filter_result *r = (struct tcindex_filter_result *) arg;
> @@ -186,6 +186,8 @@ static int tcindex_delete(struct tcf_proto *tp, unsigned long arg)
>   		call_rcu(&f->rcu, tcindex_destroy_fexts);
>   	else
>   		call_rcu(&r->rcu, tcindex_destroy_rexts);
> +
> +	*last = false;
>   	return 0;
>   }
>   
> @@ -193,7 +195,9 @@ static int tcindex_destroy_element(struct tcf_proto *tp,
>   				   unsigned long arg,
>   				   struct tcf_walker *walker)
>   {
> -	return tcindex_delete(tp, arg);
> +	bool last;
> +
> +	return tcindex_delete(tp, arg, &last);
>   }
>   
>   static void __tcindex_destroy(struct rcu_head *head)
> @@ -529,23 +533,18 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker)
>   	}
>   }
>   
> -static bool tcindex_destroy(struct tcf_proto *tp, bool force)
> +static void tcindex_destroy(struct tcf_proto *tp)
>   {
>   	struct tcindex_data *p = rtnl_dereference(tp->root);
>   	struct tcf_walker walker;
>   
> -	if (!force)
> -		return false;
> -
>   	pr_debug("tcindex_destroy(tp %p),p %p\n", tp, p);
>   	walker.count = 0;
>   	walker.skip = 0;
>   	walker.fn = tcindex_destroy_element;
>   	tcindex_walk(tp, &walker);
>   
> -	RCU_INIT_POINTER(tp->root, NULL);
>   	call_rcu(&p->rcu, __tcindex_destroy);
> -	return true;
>   }
>   
>   
> diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
> index ae83c3ae..787573b 100644
> --- a/net/sched/cls_u32.c
> +++ b/net/sched/cls_u32.c
> @@ -582,37 +582,13 @@ static bool ht_empty(struct tc_u_hnode *ht)
>   	return true;
>   }
>   
> -static bool u32_destroy(struct tcf_proto *tp, bool force)
> +static void u32_destroy(struct tcf_proto *tp)
>   {
>   	struct tc_u_common *tp_c = tp->data;
>   	struct tc_u_hnode *root_ht = rtnl_dereference(tp->root);
>   
>   	WARN_ON(root_ht == NULL);
>   
> -	if (!force) {
> -		if (root_ht) {
> -			if (root_ht->refcnt > 1)
> -				return false;
> -			if (root_ht->refcnt == 1) {
> -				if (!ht_empty(root_ht))
> -					return false;
> -			}
> -		}
> -
> -		if (tp_c->refcnt > 1)
> -			return false;
> -
> -		if (tp_c->refcnt == 1) {
> -			struct tc_u_hnode *ht;
> -
> -			for (ht = rtnl_dereference(tp_c->hlist);
> -			     ht;
> -			     ht = rtnl_dereference(ht->next))
> -				if (!ht_empty(ht))
> -					return false;
> -		}
> -	}
> -
>   	if (root_ht && --root_ht->refcnt == 0)
>   		u32_destroy_hnode(tp, root_ht);
>   
> @@ -637,20 +613,22 @@ static bool u32_destroy(struct tcf_proto *tp, bool force)
>   	}
>   
>   	tp->data = NULL;
> -	return true;
>   }
>   
> -static int u32_delete(struct tcf_proto *tp, unsigned long arg)
> +static int u32_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
>   {
>   	struct tc_u_hnode *ht = (struct tc_u_hnode *)arg;
>   	struct tc_u_hnode *root_ht = rtnl_dereference(tp->root);
> +	struct tc_u_common *tp_c = tp->data;
> +	int ret = 0;
>   
>   	if (ht == NULL)
> -		return 0;
> +		goto out;
>   
>   	if (TC_U32_KEY(ht->handle)) {
>   		u32_remove_hw_knode(tp, ht->handle);
> -		return u32_delete_key(tp, (struct tc_u_knode *)ht);
> +		ret = u32_delete_key(tp, (struct tc_u_knode *)ht);
> +		goto out;
>   	}
>   
>   	if (root_ht == ht)
> @@ -663,7 +641,40 @@ static int u32_delete(struct tcf_proto *tp, unsigned long arg)
>   		return -EBUSY;
>   	}
>   
> -	return 0;
> +out:
> +	*last = true;
> +	if (root_ht) {
> +		if (root_ht->refcnt > 1) {
> +			*last = false;
> +			goto ret;
> +		}
> +		if (root_ht->refcnt == 1) {
> +			if (!ht_empty(root_ht)) {
> +				*last = false;
> +				goto ret;
> +			}
> +		}
> +	}
> +
> +	if (tp_c->refcnt > 1) {
> +		*last = false;
> +		goto ret;
> +	}
> +
> +	if (tp_c->refcnt == 1) {
> +		struct tc_u_hnode *ht;
> +
> +		for (ht = rtnl_dereference(tp_c->hlist);
> +		     ht;
> +		     ht = rtnl_dereference(ht->next))
> +			if (!ht_empty(ht)) {
> +				*last = false;
> +				break;
> +			}
> +	}
> +
> +ret:
> +	return ret;
>   }
>   
>   #define NR_U32_NODE (1<<12)
> diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
> index f337f1b..7fc48b3 100644
> --- a/net/sched/sch_api.c
> +++ b/net/sched/sch_api.c
> @@ -1899,15 +1899,11 @@ int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
>   }
>   EXPORT_SYMBOL(tc_classify);
>   
> -bool tcf_destroy(struct tcf_proto *tp, bool force)
> +void tcf_destroy(struct tcf_proto *tp)
>   {
> -	if (tp->ops->destroy(tp, force)) {
> -		module_put(tp->ops->owner);
> -		kfree_rcu(tp, rcu);
> -		return true;
> -	}
> -
> -	return false;
> +	tp->ops->destroy(tp);
> +	module_put(tp->ops->owner);
> +	kfree_rcu(tp, rcu);
>   }
>   
>   void tcf_destroy_chain(struct tcf_proto __rcu **fl)
> @@ -1916,7 +1912,7 @@ void tcf_destroy_chain(struct tcf_proto __rcu **fl)
>   
>   	while ((tp = rtnl_dereference(*fl)) != NULL) {
>   		RCU_INIT_POINTER(*fl, tp->next);
> -		tcf_destroy(tp, true);
> +		tcf_destroy(tp);
>   	}
>   }
>   EXPORT_SYMBOL(tcf_destroy_chain);

^ permalink raw reply

* Re: [net-next PATCH v4] net: dummy: Introduce dummy virtual functions
From: kbuild test robot @ 2016-11-24  8:25 UTC (permalink / raw)
  To: Phil Sutter; +Cc: kbuild-all, David Miller, netdev, Sabrina Dubroca
In-Reply-To: <20161123162539.7778-1-phil@nwl.cc>

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

Hi Phil,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Phil-Sutter/net-dummy-Introduce-dummy-virtual-functions/20161124-040435
config: x86_64-randconfig-a0-11241529 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/net/dummy.c:54: error: unknown field 'sriov' specified in initializer
   drivers/net/dummy.c:54: warning: initialization makes integer from pointer without a cast
>> drivers/net/dummy.c:54: error: initializer element is not computable at load time
   drivers/net/dummy.c:54: error: (near initialization for 'pci_pdev.is_virtfn')
   cc1: warning: unrecognized command line option "-Wno-maybe-uninitialized"

vim +/sriov +54 drivers/net/dummy.c

    48	
    49	static struct pci_sriov pdev_sriov;
    50	
    51	static struct pci_dev pci_pdev = {
    52		.is_physfn = 0,
    53	#ifdef CONFIG_PCI_ATS
  > 54		.sriov = &pdev_sriov,
    55	#endif
    56	#ifdef CONFIG_PCI
    57		.dev.bus = &pci_bus_type,

---
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: 32096 bytes --]

^ permalink raw reply

* Re: [PATCH v9 2/6] cgroup: add support for eBPF programs
From: Daniel Mack @ 2016-11-24  8:21 UTC (permalink / raw)
  To: Rami Rosen
  Cc: htejun-b10kYP2dOMg, daniel-FeC+5ew28dpmcu3hnIyYJQ,
	ast-b10kYP2dOMg, David Miller, kafai-b10kYP2dOMg,
	fw-HFFVJYpyMKqzQB+pC5nmwQ, pablo-Cap9r6Oaw4JrovVCs/uTlw,
	harald-H+wXaHxf7aLQT0dZR+AlfA, Netdev, Sargun Dhillon,
	cgroups-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CAKoUArnq-DpwMJPdUutyR7fAhEN_6Spkw3NXkK5O=jZOQR8BXA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi Rami,

On 11/23/2016 11:46 PM, Rami Rosen wrote:
> A minor comment:
> 
>> +/**
>> + * __cgroup_bpf_update() - Update the pinned program of a cgroup, and
>> + *                         propagate the change to descendants
>> + * @cgrp: The cgroup which descendants to traverse
>> + * @parent: The parent of @cgrp, or %NULL if @cgrp is the root
>> + * @prog: A new program to pin
>> + * @type: Type of pinning operation (ingress/egress)
>> + *
>> + * Each cgroup has a set of two pointers for bpf programs; one for eBPF
>> + * programs it owns, and which is effective for execution.
>> + *
> You have in the following section twice identical checks, for If @prog
> is %NULL".
> Shouldn't it be here (in the first case only) "If @prog is not %NULL"
> instead "If @prog is %NULL"?

Yes, you're right, thanks for spotting.

If possible, I would like to not send a v10 just for this one missing
word in the comments though, but rather fix that up in a separate patch
afterwards.


Thanks,
Daniel


> 
>> + * If @prog is %NULL, this function attaches a new program to the cgroup and
>> + * releases the one that is currently attached, if any. @prog is then made
>> + * the effective program of type @type in that cgroup.
>> + *
>> + * If @prog is %NULL, the currently attached program of type @type is released,
>> + * and the effective program of the parent cgroup (if any) is inherited to
>> + * @cgrp.
>> + *
> 
> 
> Regard,
> Rami Rosen
> 

^ permalink raw reply

* [PATCH 4/5] ath10k: Removed unused 'dev' in ath10k_ahb_clock_enable()
From: Kirtika Ruchandani @ 2016-11-24  8:02 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arnd Bergmann, netdev, linux-wireless, Raja Mani, Michal Kazior
In-Reply-To: <cover.1479974100.git.kirtika@chromium.org>

Commit 8beff219c528 introduced ath10k_ahb_clock_enable() which
defines and sets 'struct device* dev' but does not use it.
Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/ahb.c: In function ‘ath10k_ahb_clock_enable’:
drivers/net/wireless/ath/ath10k/ahb.c:133:17: warning: variable ‘dev’ set but not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: 8beff219c528("ath10k: add clock ctrl related functions in ahb")
Cc: Raja Mani <rmani@qti.qualcomm.com>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Kirtika Ruchandani <kirtika@chromium.org>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
index 766c63b..8078d64 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -130,11 +130,8 @@ static void ath10k_ahb_clock_deinit(struct ath10k *ar)
 static int ath10k_ahb_clock_enable(struct ath10k *ar)
 {
	struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
-	struct device *dev;
	int ret;

-	dev = &ar_ahb->pdev->dev;
-
	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk) ||
	    IS_ERR_OR_NULL(ar_ahb->ref_clk) ||
	    IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {

^ permalink raw reply related

* [PATCH 0/5] Fix -Wunused-but-set-variable in ath10k/
From: Kirtika Ruchandani @ 2016-11-24  8:01 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arnd Bergmann, netdev, linux-wireless, Raja Mani, Michal Kazior

This patchset is part of the effort led by Arnd Bergmann to clean up
warnings in the kernel. This and following patchsets will focus on
"-Wunused-but-set-variable" as it among the noisier ones. These were
found compiling with W=1.

Kirtika Ruchandani (5):
  ath10k: Remove unused 'buf_len' variable
  ath10k: Remove unused 'num_vdev_stats' variable
  ath10k: Remove unused wmi_p2p_noa_descriptor 'noa' in wmi-tlv
  ath10k: Removed unused 'dev' in ath10k_ahb_clock_enable()
  ath10k: Removed unused 'dev' in ath10k_ahb_resource_init

 drivers/net/wireless/ath/ath10k/ahb.c     |  5 -----
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  2 --
 drivers/net/wireless/ath/ath10k/wmi.c     | 14 ++------------
 3 files changed, 2 insertions(+), 19 deletions(-)

^ permalink raw reply

* [PATCH 1/5] ath10k: Remove unused 'buf_len' variable
From: Kirtika Ruchandani @ 2016-11-24  8:01 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arnd Bergmann, netdev, linux-wireless, Raja Mani, Michal Kazior
In-Reply-To: <cover.1479974100.git.kirtika@chromium.org>

Commit 32653cf19554 removed the call to 'skb_trim(skb, buf_len)'
in ath10k_wmi_event_mgmt_rx(), leaving the buf_len variable set but
unused. Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_event_mgmt_rx’:
drivers/net/wireless/ath/ath10k/wmi.c:2280:6: warning: variable ‘buf_len’ set but not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: 32653cf19554 ("ath10k: implement intermediate event args")
Cc: Michal Kazior <michal.kazior@tieto.com>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Kirtika Ruchandani <kirtika@chromium.org>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 387c4ee..1f28187 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2277,7 +2277,6 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
	u32 phy_mode;
	u32 snr;
	u32 rate;
-	u32 buf_len;
	u16 fc;
	int ret;

@@ -2289,7 +2288,6 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
	}

	channel = __le32_to_cpu(arg.channel);
-	buf_len = __le32_to_cpu(arg.buf_len);
	rx_status = __le32_to_cpu(arg.status);
	snr = __le32_to_cpu(arg.snr);
	phy_mode = __le32_to_cpu(arg.phy_mode);

^ permalink raw reply related

* [PATCH 5/5] ath10k: Removed unused 'dev' in ath10k_ahb_resource_init
From: Kirtika Ruchandani @ 2016-11-24  8:02 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arnd Bergmann, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Raja Mani, Michal Kazior
In-Reply-To: <cover.1479974100.git.kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Commit 704dc4e36769 introduced ath10k_ahb_resource_init() which
defines and sets 'struct device* dev' but does not use it.
Compiling with W=1 gives the following warning, fix it.

drivers/net/wireless/ath/ath10k/ahb.c: In function ‘ath10k_ahb_resource_init’:
drivers/net/wireless/ath/ath10k/ahb.c:449:17: warning: variable ‘dev’ set but not used [-Wunused-but-set-variable]

This is a harmless warning, and is only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: 704dc4e36769 ("ath10k: add resource init and deinit in ahb")
Cc: Raja Mani <rmani-Rm6X0d1/PG5y9aJCnZT0Uw@public.gmane.org>
Cc: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
Signed-off-by: Kirtika Ruchandani <kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
index 8078d64..19507fe 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -443,12 +443,10 @@ static int ath10k_ahb_resource_init(struct ath10k *ar)
 {
	struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
	struct platform_device *pdev;
-	struct device *dev;
	struct resource *res;
	int ret;

	pdev = ar_ahb->pdev;
-	dev = &pdev->dev;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
--
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* [PATCH 3/5] ath10k: Remove unused wmi_p2p_noa_descriptor 'noa' in wmi-tlv
From: Kirtika Ruchandani @ 2016-11-24  8:01 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arnd Bergmann, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Raja Mani, Michal Kazior
In-Reply-To: <cover.1479974100.git.kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Commit ca996ec56608 (ath10k: implement wmi-tlv backend)
introduced ath10k_wmi_tlv_op_gen_vdev_start() where
'struct wmi_p2p_noa_descriptor *noa' is defined and set but not used.
Compiling with W=1 gives the following warning, fix it.
drivers/net/wireless/ath/ath10k/wmi-tlv.c: In function ‘ath10k_wmi_tlv_op_gen_vdev_start’:
drivers/net/wireless/ath/ath10k/wmi-tlv.c:1647:33: warning: variable ‘noa’ set but not used [-Wunused-but-set-variable]

Fixes: ca996ec56608 ("ath10k: implement wmi-tlv backend")
Cc: Michal Kazior <michal.kazior-++hxYGjEMp0AvxtiuMwx3w@public.gmane.org>
Cc: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
Signed-off-by: Kirtika Ruchandani <kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index e64f593..0e4bd29 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -1644,7 +1644,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
 {
	struct wmi_tlv_vdev_start_cmd *cmd;
	struct wmi_channel *ch;
-	struct wmi_p2p_noa_descriptor *noa;
	struct wmi_tlv *tlv;
	struct sk_buff *skb;
	size_t len;
@@ -1702,7 +1701,6 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar,
	tlv = ptr;
	tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_STRUCT);
	tlv->len = 0;
-	noa = (void *)tlv->value;

	/* Note: This is a nested TLV containing:
	 * [wmi_tlv][wmi_p2p_noa_descriptor][wmi_tlv]..
--
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* [PATCH 2/5] ath10k: Remove unused 'num_vdev_stats' variable
From: Kirtika Ruchandani @ 2016-11-24  8:01 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arnd Bergmann, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Raja Mani, Michal Kazior
In-Reply-To: <cover.1479974100.git.kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Several functions for wmi stats parsing define and set num_vdev_stats
but do not use it. Compiling with W=1 gives the following warnings,
fix them.

drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_main_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2680:22: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
                      ^
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_10x_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2735:22: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
                      ^
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_10_2_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2796:6: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_vdev_stats;
      ^
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_10_2_4_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2875:6: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_vdev_stats;
      ^
drivers/net/wireless/ath/ath10k/wmi.c: In function ‘ath10k_wmi_10_4_op_pull_fw_stats’:
drivers/net/wireless/ath/ath10k/wmi.c:2963:6: warning: variable ‘num_vdev_stats’ set but not used [-Wunused-but-set-variable]
  u32 num_vdev_stats;
      ^

These are harmless warnings and are only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: d15fb5200664 ("ath10k: split wmi stats parsing")
Fixes: 20de2229c634 ("ath10k: fix 10.2 fw stats parsing")
Cc: Michal Kazior <michal.kazior-++hxYGjEMp0AvxtiuMwx3w@public.gmane.org>
Cc: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
Signed-off-by: Kirtika Ruchandani <kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 1f28187..10ec5a5 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2675,14 +2675,13 @@ static int ath10k_wmi_main_op_pull_fw_stats(struct ath10k *ar,
					    struct ath10k_fw_stats *stats)
 {
	const struct wmi_stats_event *ev = (void *)skb->data;
-	u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
+	u32 num_pdev_stats, num_peer_stats;
	int i;

	if (!skb_pull(skb, sizeof(*ev)))
		return -EPROTO;

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

	for (i = 0; i < num_pdev_stats; i++) {
@@ -2730,14 +2729,13 @@ static int ath10k_wmi_10x_op_pull_fw_stats(struct ath10k *ar,
					   struct ath10k_fw_stats *stats)
 {
	const struct wmi_stats_event *ev = (void *)skb->data;
-	u32 num_pdev_stats, num_vdev_stats, num_peer_stats;
+	u32 num_pdev_stats, num_peer_stats;
	int i;

	if (!skb_pull(skb, sizeof(*ev)))
		return -EPROTO;

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

	for (i = 0; i < num_pdev_stats; i++) {
@@ -2791,7 +2789,6 @@ static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k *ar,
	const struct wmi_10_2_stats_event *ev = (void *)skb->data;
	u32 num_pdev_stats;
	u32 num_pdev_ext_stats;
-	u32 num_vdev_stats;
	u32 num_peer_stats;
	int i;

@@ -2800,7 +2797,6 @@ static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k *ar,

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
	num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

	for (i = 0; i < num_pdev_stats; i++) {
@@ -2870,7 +2866,6 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar,
	const struct wmi_10_2_stats_event *ev = (void *)skb->data;
	u32 num_pdev_stats;
	u32 num_pdev_ext_stats;
-	u32 num_vdev_stats;
	u32 num_peer_stats;
	int i;

@@ -2879,7 +2874,6 @@ static int ath10k_wmi_10_2_4_op_pull_fw_stats(struct ath10k *ar,

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
	num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);

	for (i = 0; i < num_pdev_stats; i++) {
@@ -2958,7 +2952,6 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar,
	const struct wmi_10_2_stats_event *ev = (void *)skb->data;
	u32 num_pdev_stats;
	u32 num_pdev_ext_stats;
-	u32 num_vdev_stats;
	u32 num_peer_stats;
	u32 num_bcnflt_stats;
	u32 stats_id;
@@ -2969,7 +2962,6 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar,

	num_pdev_stats = __le32_to_cpu(ev->num_pdev_stats);
	num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats);
-	num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats);
	num_peer_stats = __le32_to_cpu(ev->num_peer_stats);
	num_bcnflt_stats = __le32_to_cpu(ev->num_bcnflt_stats);
	stats_id = __le32_to_cpu(ev->stats_id);
--
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* Re: net/arp: ARP cache aging failed.
From: Julian Anastasov @ 2016-11-24  7:51 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Hannes Frederic Sowa, yuehaibing, davem, netdev
In-Reply-To: <1479944967.8455.516.camel@edumazet-glaptop3.roam.corp.google.com>


	Hello,

On Wed, 23 Nov 2016, Eric Dumazet wrote:

> On Wed, 2016-11-23 at 15:37 +0100, Hannes Frederic Sowa wrote:
> 
> > Irregardless about the question if bonding should keep the MAC address
> > alive, a MAC address can certainly change below a TCP connection.
> 
> Of course ;)
> 
> > 
> > dst_entry is 1:n to neigh_entry and as such we can end up confirming an
> > aging neighbor while sending a reply with dst->pending_confirm set while
> > the confirming packet actually came from a different neighbor.
> > 
> > I agree with Julian, pending_confirm became useless in this way.
> 
> Let's kill it then ;)

	It works for traffic via gateway. I now see that
we can even avoid write in dst_confirm:

	if (!dst->pending_confirm)
		dst->pending_confirm = 1;

	because it is called by non-dup TCP ACKs.

	But for traffic to hosts on LAN we need different solution,
i.e. for cached dsts with rt_gateway = 0 (last entry below).

rt_uses_gateway rt_gateway DST_NOCACHE Description
====================================================================
1               nh_gw      ANY         Traffic via gateway
0               LAN_host   1           FLOWI_FLAG_KNOWN_NH (nexthop
                                       set by IPVS, hdrincl, xt_TEE)
0               0          0           1 dst for many subnet hosts

Regards

^ permalink raw reply

* Re: wl1251 & mac address & calibration data
From: Pavel Machek @ 2016-11-24  7:51 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Michal Kazior, Kalle Valo, Ivaylo Dimitrov, Sebastian Reichel,
	Aaro Koskinen, Tony Lindgren, linux-wireless, Network Development,
	linux-kernel
In-Reply-To: <201611232339.59411@pali>

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

Hi!

> > "ifconfig hw ether XX" normally sets the address. I guess that's
> > ioctl?
> 
> This sets temporary address and it is ioctl. IIRC same as what ethtool 
> uses. (ifconfig is already deprecated).
> 
> > And I guess we should use similar mechanism for permanent
> > address.
> 
> I'm not sure here... Above ioctl ↑↑↑ is for changing temporary mac 
> address. But here we do not want to change permanent mac address. We 
> want to tell kernel driver current permanent mac address which is
> stored

Well... I'd still use similar mechanism :-).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply

* 答复: [scr265482] ip_tunnel.c
From: Liyang Yu (于立洋1) @ 2016-11-24  7:45 UTC (permalink / raw)
  To: Cong Wang
  Cc: security@kernel.org, netdev@vger.kernel.org,
	cve-request@mitre.org
In-Reply-To: <CAM_iQpX7mU7gogGx1peYMoOQbp0CZgYmTZJt=uGFm0c0gviY5A@mail.gmail.com>

Yeah,I means that recreate the tunnel again, 
But I don’t think the patch can fix the bug. It only can make the first packet received successed. And the follow packet will droped also.
In function __gre_xmit  line 366 
  tunnel->o_seqno++;

If you restart from UINT_MAX, the 'o_seqno' of second packet will return to 0 again. 

BTW:
   Can you read Chinese? :)

On Wed, Nov 23, 2016 at 6:47 PM, Liyang Yu (于立洋1) <yuliyang1@le.com> wrote:
> Hi:
>         I found that the GRE tunnel in same case can cause integer 
> overflow in ip_tunnel.c:397
>
> Cause of the problem:
>         When tpi->seq less than tunnel->i_seqno, the packet will be droped.
>
> How to recurrence problem
>         1. Create an tunnel use kernel GRE module.
>     2. Use the tunnel to send packets for awile.
>     3.Reboot one site of the tunnel.
>     4. Communication interrupted

What do you mean by "reboot one site of the tunnel"?

If you mean something like delete and create it again, it has nothing related to integer overflow, the tunnel->o_seqno will restart from 0 and the tunnel->i_seqno will remain as it is since we can't detect the interruption of the tunnel traffic.
If so, the following patch could help?


diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 5719d6b..2738ff2 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -277,6 +277,7 @@ static struct net_device *__ip_tunnel_create(struct net *net,
        tunnel = netdev_priv(dev);
        tunnel->parms = *parms;
        tunnel->net = net;
+       tunnel->o_seqno = UINT_MAX;

        err = register_netdevice(dev);
        if (err)

^ permalink raw reply

* Re: [scr265482] ip_tunnel.c
From: Cong Wang @ 2016-11-24  7:19 UTC (permalink / raw)
  To: Liyang Yu (于立洋1)
  Cc: security@kernel.org, netdev@vger.kernel.org,
	cve-request@mitre.org
In-Reply-To: <F41877A268BCDE49BAEE2286FA8C269F6FECFB15@LETV-MBX-IDC09.letv.local>

On Wed, Nov 23, 2016 at 6:47 PM, Liyang Yu (于立洋1) <yuliyang1@le.com> wrote:
> Hi:
>         I found that the GRE tunnel in same case can cause integer overflow in ip_tunnel.c:397
>
> Cause of the problem:
>         When tpi->seq less than tunnel->i_seqno, the packet will be droped.
>
> How to recurrence problem
>         1. Create an tunnel use kernel GRE module.
>     2. Use the tunnel to send packets for awile.
>     3.Reboot one site of the tunnel.
>     4. Communication interrupted

What do you mean by "reboot one site of the tunnel"?

If you mean something like delete and create it again,
it has nothing related to integer overflow, the tunnel->o_seqno
will restart from 0 and the tunnel->i_seqno will remain as it is
since we can't detect the interruption of the tunnel traffic.
If so, the following patch could help?


diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 5719d6b..2738ff2 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -277,6 +277,7 @@ static struct net_device
*__ip_tunnel_create(struct net *net,
        tunnel = netdev_priv(dev);
        tunnel->parms = *parms;
        tunnel->net = net;
+       tunnel->o_seqno = UINT_MAX;

        err = register_netdevice(dev);
        if (err)

^ permalink raw reply related

* [PATCH] adm80211: Removed unused 'io_addr' 'mem_addr' variables
From: Kirtika Ruchandani @ 2016-11-24  6:40 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Arnd Bergmann, Johannes Berg, linux-wireless, netdev

Initial commit cc0b88cf5ecf ([PATCH] Add adm8211 802.11b wireless driver)
introduced variables mem_addr and io_addr in adm80211_probe() that are
set but not used. Compiling with W=1 gives the following warnings,
fix them.

drivers/net/wireless/admtek/adm8211.c: In function ‘adm8211_probe’:
drivers/net/wireless/admtek/adm8211.c:1769:15: warning: variable ‘io_addr’ set but not used [-Wunused-but-set-variable]
  unsigned int io_addr, io_len;
               ^
drivers/net/wireless/admtek/adm8211.c:1768:16: warning: variable ‘mem_addr’ set but not used [-Wunused-but-set-variable]
  unsigned long mem_addr, mem_len;
                ^

These are harmless warnings and are only being fixed to reduce the
noise with W=1 in the kernel. The calls to pci_resource_start do not
have any side-effects and are safe to remove.

Fixes: cc0b88cf5ecf ("[PATCH] Add adm8211 802.11b wireless driver")
Cc: Michael Wu <flamingice@sourmilk.net>
Cc: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kirtika Ruchandani <kirtika@chromium.org>
---
 drivers/net/wireless/admtek/adm8211.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/admtek/adm8211.c b/drivers/net/wireless/admtek/adm8211.c
index 70ecd82..70b4da0 100644
--- a/drivers/net/wireless/admtek/adm8211.c
+++ b/drivers/net/wireless/admtek/adm8211.c
@@ -1765,8 +1765,8 @@ static int adm8211_probe(struct pci_dev *pdev,
 {
	struct ieee80211_hw *dev;
	struct adm8211_priv *priv;
-	unsigned long mem_addr, mem_len;
-	unsigned int io_addr, io_len;
+	unsigned long mem_len;
+	unsigned int io_len;
	int err;
	u32 reg;
	u8 perm_addr[ETH_ALEN];
@@ -1778,9 +1778,7 @@ static int adm8211_probe(struct pci_dev *pdev,
		return err;
	}

-	io_addr = pci_resource_start(pdev, 0);
	io_len = pci_resource_len(pdev, 0);
-	mem_addr = pci_resource_start(pdev, 1);
	mem_len = pci_resource_len(pdev, 1);
	if (io_len < 256 || mem_len < 1024) {
		printk(KERN_ERR "%s (adm8211): Too short PCI resources\n",

^ permalink raw reply related

* [net-next] neigh: fix the loop index error in neigh dump
From: Zhang Shengju @ 2016-11-24  5:25 UTC (permalink / raw)
  To: netdev, dsa

Loop index in neigh dump function is not updated correctly under some
circumstances, this patch will fix it.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 net/core/neighbour.c | 39 ++++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 2ae929f..ce32e9c 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2256,6 +2256,16 @@ static bool neigh_ifindex_filtered(struct net_device *dev, int filter_idx)
 	return false;
 }
 
+static bool neigh_dump_filtered(struct net_device *dev, int filter_idx,
+		int filter_master_idx)
+{
+	if (neigh_ifindex_filtered(dev, filter_idx) ||
+	    neigh_master_filtered(dev, filter_master_idx))
+		return true;
+
+	return false;
+}
+
 static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
 			    struct netlink_callback *cb)
 {
@@ -2285,20 +2295,15 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
 	rcu_read_lock_bh();
 	nht = rcu_dereference_bh(tbl->nht);
 
-	for (h = s_h; h < (1 << nht->hash_shift); h++) {
-		if (h > s_h)
-			s_idx = 0;
+	for (h = s_h; h < (1 << nht->hash_shift); h++, s_idx = 0) {
 		for (n = rcu_dereference_bh(nht->hash_buckets[h]), idx = 0;
 		     n != NULL;
-		     n = rcu_dereference_bh(n->next)) {
-			if (!net_eq(dev_net(n->dev), net))
-				continue;
-			if (neigh_ifindex_filtered(n->dev, filter_idx))
+		     n = rcu_dereference_bh(n->next), idx++) {
+			if (idx < s_idx || !net_eq(dev_net(n->dev), net))
 				continue;
-			if (neigh_master_filtered(n->dev, filter_master_idx))
+			if (neigh_dump_filtered(n->dev, filter_idx,
+						filter_master_idx))
 				continue;
-			if (idx < s_idx)
-				goto next;
 			if (neigh_fill_info(skb, n, NETLINK_CB(cb->skb).portid,
 					    cb->nlh->nlmsg_seq,
 					    RTM_NEWNEIGH,
@@ -2306,8 +2311,6 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
 				rc = -1;
 				goto out;
 			}
-next:
-			idx++;
 		}
 	}
 	rc = skb->len;
@@ -2328,14 +2331,10 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
 
 	read_lock_bh(&tbl->lock);
 
-	for (h = s_h; h <= PNEIGH_HASHMASK; h++) {
-		if (h > s_h)
-			s_idx = 0;
-		for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) {
-			if (pneigh_net(n) != net)
+	for (h = s_h; h <= PNEIGH_HASHMASK; h++, s_idx = 0) {
+		for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next, idx++) {
+			if (idx < s_idx || pneigh_net(n) != net)
 				continue;
-			if (idx < s_idx)
-				goto next;
 			if (pneigh_fill_info(skb, n, NETLINK_CB(cb->skb).portid,
 					    cb->nlh->nlmsg_seq,
 					    RTM_NEWNEIGH,
@@ -2344,8 +2343,6 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
 				rc = -1;
 				goto out;
 			}
-		next:
-			idx++;
 		}
 	}
 
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH] netdevice: fix sparse warning for HARD_TX_LOCK
From: Michael S. Tsirkin @ 2016-11-24  5:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: David S. Miller, netdev

sparse warns about context imbalance in any code
that uses HARD_TX_LOCK/UNLOCK - this is because it's
unable to determine that flags don't change so
lock and unlock are paired.

Seems easy enough to fix by adding __acquire/__release
calls.

With this patch af_packet.c is now sparse-clean,

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

compile-tested only.

 include/linux/netdevice.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 91ee364..0a58a50 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3539,6 +3539,17 @@ static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
 	txq->xmit_lock_owner = cpu;
 }
 
+static inline bool __netif_tx_acquire(struct netdev_queue *txq)
+{
+	__acquire(&txq->_xmit_lock);
+	return true;
+}
+
+static inline void __netif_tx_release(struct netdev_queue *txq)
+{
+	__release(&txq->_xmit_lock);
+}
+
 static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
 {
 	spin_lock_bh(&txq->_xmit_lock);
@@ -3640,17 +3651,21 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
 #define HARD_TX_LOCK(dev, txq, cpu) {			\
 	if ((dev->features & NETIF_F_LLTX) == 0) {	\
 		__netif_tx_lock(txq, cpu);		\
+	} else {					\
+		__netif_tx_acquire(txq);		\
 	}						\
 }
 
 #define HARD_TX_TRYLOCK(dev, txq)			\
 	(((dev->features & NETIF_F_LLTX) == 0) ?	\
 		__netif_tx_trylock(txq) :		\
-		true )
+		__netif_tx_acquire(txq))
 
 #define HARD_TX_UNLOCK(dev, txq) {			\
 	if ((dev->features & NETIF_F_LLTX) == 0) {	\
 		__netif_tx_unlock(txq);			\
+	} else {					\
+		__netif_tx_release(txq);		\
 	}						\
 }
 
-- 
MST

^ permalink raw reply related

* [PATCH 4/4] mac80211: Remove unused 'beaconint_us' variable
From: Kirtika Ruchandani @ 2016-11-24  4:46 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Arnd Bergmann, netdev, linux-wireless, Marek Kwaczynski,
	David Spinadel, Alexander Bondar, Michal Kazior
In-Reply-To: <cover.1479962513.git.kirtika@chromium.org>

Commit 4a733ef1bea7 (mac80211: remove PM-QoS listener) removed all use
of 'beaconint_us' from ieee80211_recalc_ps() but left the variable
intact. Compiling with W=1 gives the following warning, fix it.
net/mac80211/mlme.c: In function ‘ieee80211_recalc_ps’:
net/mac80211/mlme.c:1481:7: warning: variable ‘beaconint_us’ set but not used [-Wunused-but-set-variable]

iee80211_tu_to_usec has no side-effects and is safe to remove.

Fixes: 4a733ef1bea7 ("mac80211: remove PM-QoS listener")
Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kirtika Ruchandani <kirtika@chromium.org>
---
 net/mac80211/mlme.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 7486f2d..e883345 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1478,10 +1478,6 @@ void ieee80211_recalc_ps(struct ieee80211_local *local)
 
 	if (count == 1 && ieee80211_powersave_allowed(found)) {
 		u8 dtimper = found->u.mgd.dtim_period;
-		s32 beaconint_us;
-
-		beaconint_us = ieee80211_tu_to_usec(
-					found->vif.bss_conf.beacon_int);
 
 		timeout = local->dynamic_ps_forced_timeout;
 		if (timeout < 0)
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related

* [PATCH 3/4] mac80211: Removed unused 'struct ieee80211_supported_band*' variable
From: Kirtika Ruchandani @ 2016-11-24  4:46 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Arnd Bergmann, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Marek Kwaczynski,
	David Spinadel, Alexander Bondar, Michal Kazior
In-Reply-To: <cover.1479962513.git.kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Commit b1bce14a7954 (mac80211: update opmode when adding new station)
refactored ieee80211_vht_handle_opmode into __ieee80211_vht_handle_opmode
and ieee80211_vht_handle_opmode leaving a set but unused variable
(sband) in the former. Compiling with W=1 gives the following warning,
fix it.

net/mac80211/vht.c: In function ‘__ieee80211_vht_handle_opmode’:
net/mac80211/vht.c:424:35: warning: variable ‘sband’ set but not used [-Wunused-but-set-variable]

Remove 'struct ieee80211_local* local' as well, it was only used to
set sband.

This is a harmless warning, and is only being fixed to reduce the
noise with W=1 in the kernel.

Fixes: b1bce14a7954 ("mac80211: update opmode when adding new station")
Cc: Marek Kwaczynski <marek.kwaczynski-++hxYGjEMp0AvxtiuMwx3w@public.gmane.org>
Cc: Johannes Berg <johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kirtika Ruchandani <kirtika-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 net/mac80211/vht.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index ee71576..14920e3 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -420,14 +420,10 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
 				  struct sta_info *sta, u8 opmode,
 				  enum nl80211_band band)
 {
-	struct ieee80211_local *local = sdata->local;
-	struct ieee80211_supported_band *sband;
 	enum ieee80211_sta_rx_bandwidth new_bw;
 	u32 changed = 0;
 	u8 nss;
 
-	sband = local->hw.wiphy->bands[band];

^ permalink raw reply related

* [PATCH net 1/1] tipc: improve sanity check for received domain records
From: Jon Maloy @ 2016-11-24  4:46 UTC (permalink / raw)
  To: davem; +Cc: Jon Maloy, netdev, tipc-discussion

In commit 35c55c9877f8 ("tipc: add neighbor monitoring framework") we
added a data area to the link monitor STATE messages under the
assumption that previous versions did not use any such data area.

For versions older than Linux 4.3 this assumption is not correct. In
those version, all STATE messages sent out from a node inadvertently
contain a 16 byte data area containing a string; -a leftover from
previous RESET messages which were using this during the setup phase.
This string serves no purpose in STATE messages, and should no be there.

Unfortunately, this data area is delivered to the link monitor
framework, where a sanity check catches that it is not a correct domain
record, and drops it. It also issues a rate limited warning about the
event.

Since such events occur much more frequently than anticipated, we now
choose to remove the warning in order to not fill the kernel log with
useless contents. We also make the sanity check stricter, to further
reduce the risk that such data is inavertently admitted.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
 net/tipc/monitor.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
index ed97a58..9e109bb 100644
--- a/net/tipc/monitor.c
+++ b/net/tipc/monitor.c
@@ -455,14 +455,14 @@ void tipc_mon_rcv(struct net *net, void *data, u16 dlen, u32 addr,
 	int i, applied_bef;
 
 	state->probing = false;
-	if (!dlen)
-		return;
 
 	/* Sanity check received domain record */
-	if ((dlen < new_dlen) || ntohs(arrv_dom->len) != new_dlen) {
-		pr_warn_ratelimited("Received illegal domain record\n");
+	if (dlen < dom_rec_len(arrv_dom, 0))
+		return;
+	if (dlen != dom_rec_len(arrv_dom, new_member_cnt))
+		return;
+	if ((dlen < new_dlen) || ntohs(arrv_dom->len) != new_dlen)
 		return;
-	}
 
 	/* Synch generation numbers with peer if link just came up */
 	if (!state->synched) {
-- 
2.7.4


------------------------------------------------------------------------------

^ permalink raw reply related

* [PATCH 2/4] mac80211: Remove unused 'len' variable
From: Kirtika Ruchandani @ 2016-11-24  4:45 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Arnd Bergmann, netdev, linux-wireless, Marek Kwaczynski,
	David Spinadel, Alexander Bondar, Michal Kazior
In-Reply-To: <cover.1479962513.git.kirtika@chromium.org>

Commit 633e27132625 (mac80211: split sched scan IEs) introduced the
len variable to keep track of the return value of
ieee80211_build_preq_ies() but did not use it. Compiling with W=1
gives the following warning, fix it.

net/mac80211/scan.c: In function ‘__ieee80211_request_sched_scan_start’:
net/mac80211/scan.c:1123:9: warning: variable ‘len’ set but not used [-Wunused-but-set-variable]

This is a harmless warning and is only being fixed to reduce the noise
with W=1 in the kernel.

Fixes: 633e27132625 ("mac80211: split sched scan IEs")
Cc: David Spinadel <david.spinadel@intel.com>
Cc: Alexander Bondar <alexander.bondar@intel.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kirtika Ruchandani <kirtika@chromium.org>
---
 net/mac80211/scan.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 23d8ac8..faab3c4 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -1120,7 +1120,6 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
 	u32 rate_masks[NUM_NL80211_BANDS] = {};
 	u8 bands_used = 0;
 	u8 *ie;
-	size_t len;
 
 	iebufsz = local->scan_ies_len + req->ie_len;
 
@@ -1145,10 +1144,9 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
 
 	ieee80211_prepare_scan_chandef(&chandef, req->scan_width);
 
-	len = ieee80211_build_preq_ies(local, ie, num_bands * iebufsz,
-				       &sched_scan_ies, req->ie,
-				       req->ie_len, bands_used,
-				       rate_masks, &chandef);
+	ieee80211_build_preq_ies(local, ie, num_bands * iebufsz,
+				 &sched_scan_ies, req->ie,
+				 req->ie_len, bands_used, rate_masks, &chandef);
 
 	ret = drv_sched_scan_start(local, sdata, req, &sched_scan_ies);
 	if (ret == 0) {
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related


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