Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] net/mlx4: Use cpumask_available for eq->affinity_mask
From: Tariq Toukan @ 2018-09-23  7:52 UTC (permalink / raw)
  To: Nathan Chancellor, Tariq Toukan, David S. Miller
  Cc: netdev, linux-rdma, linux-kernel
In-Reply-To: <20180921094412.15547-1-natechancellor@gmail.com>



On 21/09/2018 12:44 PM, Nathan Chancellor wrote:
> Clang warns that the address of a pointer will always evaluated as true
> in a boolean context:
> 
> drivers/net/ethernet/mellanox/mlx4/eq.c:243:11: warning: address of
> array 'eq->affinity_mask' will always evaluate to 'true'
> [-Wpointer-bool-conversion]
>          if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask))
>              ~~~~~^~~~~~~~~~~~~
> 1 warning generated.
> 
> Use cpumask_available, introduced in commit f7e30f01a9e2 ("cpumask: Add
> helper cpumask_available()"), which does the proper checking and avoids
> this warning.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/86
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/eq.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
> index 1f3372c1802e..2df92dbd38e1 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/eq.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
> @@ -240,7 +240,8 @@ static void mlx4_set_eq_affinity_hint(struct mlx4_priv *priv, int vec)
>   	struct mlx4_dev *dev = &priv->dev;
>   	struct mlx4_eq *eq = &priv->eq_table.eq[vec];
>   
> -	if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask))
> +	if (!cpumask_available(eq->affinity_mask) ||
> +	    cpumask_empty(eq->affinity_mask))
>   		return;
>   
>   	hint_err = irq_set_affinity_hint(eq->irq, eq->affinity_mask);
> 

Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Thanks.

^ permalink raw reply

* Re: [PATCH] RDS: IB: Use DEFINE_PER_CPU_SHARED_ALIGNED for rds_ib_stats
From: Nathan Chancellor @ 2018-09-23  6:44 UTC (permalink / raw)
  To: Santosh Shilimkar, David S. Miller
  Cc: netdev, linux-rdma, linux-kernel, Nick Desaulniers
In-Reply-To: <20180921180451.18711-1-natechancellor@gmail.com>

On Fri, Sep 21, 2018 at 11:04:51AM -0700, Nathan Chancellor wrote:
> Clang warns when two declarations' section attributes don't match.
> 
> net/rds/ib_stats.c:40:1: warning: section does not match previous
> declaration [-Wsection]
> DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_ib_statistics, rds_ib_stats);
> ^
> ./include/linux/percpu-defs.h:142:2: note: expanded from macro
> 'DEFINE_PER_CPU_SHARED_ALIGNED'
>         DEFINE_PER_CPU_SECTION(type, name,
> PER_CPU_SHARED_ALIGNED_SECTION) \
>         ^
> ./include/linux/percpu-defs.h:93:9: note: expanded from macro
> 'DEFINE_PER_CPU_SECTION'
>         extern __PCPU_ATTRS(sec) __typeof__(type) name;
> \
>                ^
> ./include/linux/percpu-defs.h:49:26: note: expanded from macro
> '__PCPU_ATTRS'
>         __percpu __attribute__((section(PER_CPU_BASE_SECTION sec)))
> \
>                                 ^
> net/rds/ib.h:446:1: note: previous attribute is here
> DECLARE_PER_CPU(struct rds_ib_statistics, rds_ib_stats);
> ^
> ./include/linux/percpu-defs.h:111:2: note: expanded from macro
> 'DECLARE_PER_CPU'
>         DECLARE_PER_CPU_SECTION(type, name, "")
>         ^
> ./include/linux/percpu-defs.h:87:9: note: expanded from macro
> 'DECLARE_PER_CPU_SECTION'
>         extern __PCPU_ATTRS(sec) __typeof__(type) name
>                ^
> ./include/linux/percpu-defs.h:49:26: note: expanded from macro
> '__PCPU_ATTRS'
>         __percpu __attribute__((section(PER_CPU_BASE_SECTION sec)))
> \
>                                 ^
> 1 warning generated.
> 
> The initial definition was added in commit ec16227e1414 ("RDS/IB:
> Infiniband transport") and the cache aligned definition was added in
> commit e6babe4cc4ce ("RDS/IB: Stats and sysctls") right after. The
> definition probably should have been updated in net/rds/ib.h, which is
> what this patch does.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/114
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  net/rds/ib.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/rds/ib.h b/net/rds/ib.h
> index 73427ff439f9..fd483760c910 100644
> --- a/net/rds/ib.h
> +++ b/net/rds/ib.h
> @@ -443,7 +443,7 @@ int rds_ib_send_grab_credits(struct rds_ib_connection *ic, u32 wanted,
>  int rds_ib_xmit_atomic(struct rds_connection *conn, struct rm_atomic_op *op);
>  
>  /* ib_stats.c */
> -DECLARE_PER_CPU(struct rds_ib_statistics, rds_ib_stats);
> +DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_ib_statistics, rds_ib_stats);

I have sent a v2 because this should be DECLARE_PER_CPU_SHARED_ALIGNED,
not DEFINE (thanks to 0day for catching it).

I will make sure the '--in-reply-to' option in the future.

Nathan

>  #define rds_ib_stats_inc(member) rds_stats_inc_which(rds_ib_stats, member)
>  #define rds_ib_stats_add(member, count) \
>  		rds_stats_add_which(rds_ib_stats, member, count)
> -- 
> 2.19.0
> 

^ permalink raw reply

* [PATCH v2] rtlwifi: btcoex: Use proper enumerated types for Wi-Fi only interface
From: Nathan Chancellor @ 2018-09-23  6:31 UTC (permalink / raw)
  To: Ping-Ke Shih, Kalle Valo
  Cc: linux-wireless, netdev, linux-kernel, Nathan Chancellor

Clang warns when one enumerated type is implicitly converted to another.

drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c:1327:34:
warning: implicit conversion from enumeration type 'enum
btc_chip_interface' to different enumeration type 'enum
wifionly_chip_interface' [-Wenum-conversion]
                wifionly_cfg->chip_interface = BTC_INTF_PCI;
                                             ~ ^~~~~~~~~~~~
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c:1330:34:
warning: implicit conversion from enumeration type 'enum
btc_chip_interface' to different enumeration type 'enum
wifionly_chip_interface' [-Wenum-conversion]
                wifionly_cfg->chip_interface = BTC_INTF_USB;
                                             ~ ^~~~~~~~~~~~
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c:1333:34:
warning: implicit conversion from enumeration type 'enum
btc_chip_interface' to different enumeration type 'enum
wifionly_chip_interface' [-Wenum-conversion]
                wifionly_cfg->chip_interface = BTC_INTF_UNKNOWN;
                                             ~ ^~~~~~~~~~~~~~~~
3 warnings generated.

Use the values from the correct enumerated type, wifionly_chip_interface.

BTC_INTF_UNKNOWN = WIFIONLY_INTF_UNKNOWN = 0
BTC_INTF_PCI = WIFIONLY_INTF_PCI = 1
BTC_INTF_USB = WIFIONLY_INTF_USB = 2

Link: https://github.com/ClangBuiltLinux/linux/issues/135
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

v1 -> v2:

* Fix enum values in commit message (previously all 0)

 .../net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
index b026e80940a4..6fbf8845a2ab 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -1324,13 +1324,13 @@ bool exhalbtc_initlize_variables_wifi_only(struct rtl_priv *rtlpriv)
 
 	switch (rtlpriv->rtlhal.interface) {
 	case INTF_PCI:
-		wifionly_cfg->chip_interface = BTC_INTF_PCI;
+		wifionly_cfg->chip_interface = WIFIONLY_INTF_PCI;
 		break;
 	case INTF_USB:
-		wifionly_cfg->chip_interface = BTC_INTF_USB;
+		wifionly_cfg->chip_interface = WIFIONLY_INTF_USB;
 		break;
 	default:
-		wifionly_cfg->chip_interface = BTC_INTF_UNKNOWN;
+		wifionly_cfg->chip_interface = WIFIONLY_INTF_UNKNOWN;
 		break;
 	}
 
-- 
2.19.0

^ permalink raw reply related

* Re: [PATCH] net-ethtool: ETHTOOL_GUFO did not and should not require CAP_NET_ADMIN
From: David Miller @ 2018-09-23  0:12 UTC (permalink / raw)
  To: zenczykowski; +Cc: maze, netdev
In-Reply-To: <20180922083401.12131-1-zenczykowski@gmail.com>

From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Date: Sat, 22 Sep 2018 01:34:01 -0700

> From: Maciej Żenczykowski <maze@google.com>
> 
> So it should not fail with EPERM even though it is no longer implemented...
> 
> This is a fix for:
>   (userns)$ egrep ^Cap /proc/self/status
>   CapInh: 0000003fffffffff
>   CapPrm: 0000003fffffffff
>   CapEff: 0000003fffffffff
>   CapBnd: 0000003fffffffff
>   CapAmb: 0000003fffffffff
> 
>   (userns)$ tcpdump -i usb_rndis0
>   tcpdump: WARNING: usb_rndis0: SIOCETHTOOL(ETHTOOL_GUFO) ioctl failed: Operation not permitted
>   Warning: Kernel filter failed: Bad file descriptor
>   tcpdump: can't remove kernel filter: Bad file descriptor
> 
> With this change it returns EOPNOTSUPP instead of EPERM.
> 
> See also https://github.com/the-tcpdump-group/libpcap/issues/689
> 
> Fixes: 08a00fea6de2 "net: Remove references to NETIF_F_UFO from ethtool."
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Maciej Żenczykowski <maze@google.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply

* Re: [PATCH RFT net-next 0/2] net: phy: Eliminate unnecessary soft
From: Andrew Lunn @ 2018-09-22 23:58 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, David S. Miller, nbd, cphealy, harini.katakam, afleming,
	agust, arnd, asmirnov, avi.kp.137, avorontsov, baijiaju1990, benh,
	charles-antoine.couret, clemens.gruber, colin.king, cyril,
	david.thomson, ddaney, dongsheng.wang, dwmw2, eha, houjingj, jeff,
	Jingju.Hou, Jisheng.Zhang, johan, Kapil.Juneja, kim.phillips,
	linyunsheng, madalin.bucur, michael, mic
In-Reply-To: <20180919013505.11347-1-f.fainelli@gmail.com>

On Tue, Sep 18, 2018 at 06:35:03PM -0700, Florian Fainelli wrote:
> Hi all,
> 
> This patch series eliminates unnecessary software resets of the PHY.
> This should hopefully not break anybody's hardware; but I would
> appreciate testing to make sure this is is the case.
> 
> Sorry for this long email list, I wanted to make sure I reached out to
> all people who made changes to the Marvell PHY driver.

I got around to testing this at last. Not too much testing, just
booting it on five different systems using Marvell and Micrel PHYs.
They all got link as expected.

Tested-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply

* [PATCH v2] RDS: IB: Use DECLARE_PER_CPU_SHARED_ALIGNED for rds_ib_stats
From: Nathan Chancellor @ 2018-09-23  3:29 UTC (permalink / raw)
  To: Santosh Shilimkar, David S. Miller
  Cc: netdev, linux-rdma, linux-kernel, Nick Desaulniers,
	Nathan Chancellor

Clang warns when two declarations' section attributes don't match.

net/rds/ib_stats.c:40:1: warning: section does not match previous
declaration [-Wsection]
DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_ib_statistics, rds_ib_stats);
^
./include/linux/percpu-defs.h:142:2: note: expanded from macro
'DEFINE_PER_CPU_SHARED_ALIGNED'
        DEFINE_PER_CPU_SECTION(type, name,
PER_CPU_SHARED_ALIGNED_SECTION) \
        ^
./include/linux/percpu-defs.h:93:9: note: expanded from macro
'DEFINE_PER_CPU_SECTION'
        extern __PCPU_ATTRS(sec) __typeof__(type) name;
\
               ^
./include/linux/percpu-defs.h:49:26: note: expanded from macro
'__PCPU_ATTRS'
        __percpu __attribute__((section(PER_CPU_BASE_SECTION sec)))
\
                                ^
net/rds/ib.h:446:1: note: previous attribute is here
DECLARE_PER_CPU(struct rds_ib_statistics, rds_ib_stats);
^
./include/linux/percpu-defs.h:111:2: note: expanded from macro
'DECLARE_PER_CPU'
        DECLARE_PER_CPU_SECTION(type, name, "")
        ^
./include/linux/percpu-defs.h:87:9: note: expanded from macro
'DECLARE_PER_CPU_SECTION'
        extern __PCPU_ATTRS(sec) __typeof__(type) name
               ^
./include/linux/percpu-defs.h:49:26: note: expanded from macro
'__PCPU_ATTRS'
        __percpu __attribute__((section(PER_CPU_BASE_SECTION sec)))
\
                                ^
1 warning generated.

The initial definition was added in commit ec16227e1414 ("RDS/IB:
Infiniband transport") and the cache aligned definition was added in
commit e6babe4cc4ce ("RDS/IB: Stats and sysctls") right after. The
definition probably should have been updated in net/rds/ib.h, which is
what this patch does.

Link: https://github.com/ClangBuiltLinux/linux/issues/114
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

v1 -> v2:

Fix reported build error by using DECLARE instead of DEFINE

 net/rds/ib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rds/ib.h b/net/rds/ib.h
index 73427ff439f9..71ff356ee702 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -443,7 +443,7 @@ int rds_ib_send_grab_credits(struct rds_ib_connection *ic, u32 wanted,
 int rds_ib_xmit_atomic(struct rds_connection *conn, struct rm_atomic_op *op);
 
 /* ib_stats.c */
-DECLARE_PER_CPU(struct rds_ib_statistics, rds_ib_stats);
+DECLARE_PER_CPU_SHARED_ALIGNED(struct rds_ib_statistics, rds_ib_stats);
 #define rds_ib_stats_inc(member) rds_stats_inc_which(rds_ib_stats, member)
 #define rds_ib_stats_add(member, count) \
 		rds_stats_add_which(rds_ib_stats, member, count)
-- 
2.19.0

^ permalink raw reply related

* [PATCH iproute2 7/7] examples: Remove cbq.init-v0.7.3
From: Petr Vorel @ 2018-09-22 21:24 UTC (permalink / raw)
  To: netdev; +Cc: Petr Vorel, Stephen Hemminger
In-Reply-To: <20180922212451.327-1-petr.vorel@gmail.com>

This script is obsolete.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 examples/cbq.init-v0.7.3 | 983 ---------------------------------------
 1 file changed, 983 deletions(-)
 delete mode 100644 examples/cbq.init-v0.7.3

diff --git a/examples/cbq.init-v0.7.3 b/examples/cbq.init-v0.7.3
deleted file mode 100644
index 66448d88..00000000
--- a/examples/cbq.init-v0.7.3
+++ /dev/null
@@ -1,983 +0,0 @@
-#!/bin/bash
-#
-#    cbq.init v0.7.3
-#    Copyright (C) 1999  Pavel Golubev <pg@ksi-linux.com>
-#    Copyright (C) 2001-2004  Lubomir Bulej <pallas@kadan.cz>
-#
-#    chkconfig:   2345 11 89
-#    description: sets up CBQ-based traffic control
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-#    To get the latest version, check on Freshmeat for actual location:
-#
-#		http://freshmeat.net/projects/cbq.init
-#
-#
-# VERSION HISTORY
-# ---------------
-# v0.7.3- Deepak Singhal <singhal at users.sourceforge.net>
-#	  - fix timecheck to not ignore regular TIME rules after
-#	    encountering a TIME rule that spans over midnight
-#	- Nathan Shafer <nicodemus at users.sourceforge.net>
-#	  - allow symlinks to class files
-#	- Seth J. Blank <antifreeze at users.sourceforge.net>
-#	  - replace hardcoded ip/tc location with variables
-#	- Mark Davis <mark.davis at gmx.de>
-#	  - allow setting of PRIO_{MARK,RULE,REALM} in class file
-#	- Fernando Sanch <toptnc at users.sourceforge.net>
-#	  - allow underscores in interface names
-# v0.7.2- Paulo Sedrez
-#	  - fix time2abs to allow hours with leading zero in TIME rules
-#	- Svetlin Simeonov <zvero at yahoo.com>
-#	  - fix cbq_device_list to allow VLAN interfaces
-#	- Mark Davis <mark.davis at gmx.de>
-#	  - ignore *~ backup files when looking for classes
-#	- Mike Boyer <boyer at administrative.com>
-#	  - fix to allow arguments to be passed to "restart" command
-# v0.7.1- Lubomir Bulej <pallas at kadan.cz>
-#	  - default value for PERTURB
-#	  - fixed small bug in RULE parser to correctly parse rules with
-#	    identical source and destination fields
-#	  - faster initial scanning of DEVICE fields
-# v0.7	- Lubomir Bulej <pallas at kadan.cz>
-#	  - lots of various cleanups and reorganizations; the parsing is now
-#	    some 40% faster, but the class ID must be in range 0x0002-0xffff
-#	    (again). Because of the number of internal changes and the above
-#	    class ID restriction, I bumped the version to 0.7 to indicate
-#	    something might have got broken :)
-#	  - changed PRIO_{U32,FW,ROUTE} to PRIO_{RULE,MARK,REALM}
-#	    for consistency with filter keywords
-#	  - exposed "compile" command
-#	- Catalin Petrescu <taz at dntis.ro>
-#	  - support for port masks in RULE (u32) filter
-#	- Jordan Vrtanoski <obeliks at mt.net.mk>
-#	  - support for week days in TIME rules
-# v0.6.4- Lubomir Bulej <pallas at kadan.cz>
-#	  - added PRIO_* variables to allow easy control of filter priorities
-#	  - added caching to speed up CBQ start, the cache is invalidated
-#	    whenever any of the configuration files changes
-#	  - updated the readme section + some cosmetic fixes
-# v0.6.3- Lubomir Bulej <pallas at kadan.cz>
-#	  - removed setup of (unnecessary) class 1:1 - all classes
-#	    now use qdisc's default class 1:0 as their parent
-#	  - minor fix in the timecheck branch - classes
-#	    without leaf qdisc were not updated
-#	  - minor fix to avoid timecheck failure when run
-#	    at time with minutes equal to 08 or 09
-#	  - respect CBQ_PATH setting in environment
-#	  - made PRIO=5 default, rendering it optional in configs
-#	  - added support for route filter, see notes about REALM keyword
-#	  - added support for fw filter, see notes about MARK keyword
-#	  - added filter display to "list" and "stats" commands
-#	  - readme section update + various cosmetic fixes
-# v0.6.2- Catalin Petrescu <taz at dntis.ro>
-#	  - added tunnels interface handling
-# v0.6.1- Pavel Golubev <pg at ksi-linux.com>
-#	  - added sch_prio module loading
-#	    (thanks johan at iglo.virtual.or.id for reminding)
-#	  - resolved errors resulting from stricter syntax checking in bash2
-#	- Lubomir Bulej <pallas at kadan.cz>
-#	  - various cosmetic fixes
-# v0.6	- Lubomir Bulej <pallas at kadan.cz>
-#	  - attempt to limit number of spawned processes by utilizing
-#	    more of sed power (use sed instead of grep+cut)
-#	  - simplified TIME parser, using bash builtins
-#	  - added initial support for SFQ as leaf qdisc
-#	  - reworked the documentation part a little
-#	  - incorporated pending patches and ideas submitted by
-#	    following people for versions 0.3 into version 0.6
-#	- Miguel Freitas <miguel at cetuc.puc-rio.br>
-#	  - in case of overlapping TIME parameters, the last match is taken
-#	- Juanjo Ciarlante <jjo at mendoza.gov.ar>
-#	  - chkconfig tags, list + stats startup parameters
-#	  - optional tc & ip command logging (into /var/run/cbq-*)
-#	- Rafal Maszkowski <rzm at icm.edu.pl>
-#	  - PEAK parameter for setting TBF's burst peak rate
-#	  - fix for many config files (use find instead of ls)
-# v0.5.1- Lubomir Bulej <pallas at kadan.cz>
-#	  - fixed little but serious bug in RULE parser
-# v0.5	- Lubomir Bulej <pallas at kadan.cz>
-#	  - added options PARENT, LEAF, ISOLATED and BOUNDED. This allows
-#	    (with some attention to config file ordering) for creating
-#	    hierarchical structures of shapers with classes able (or unable)
-#	    to borrow bandwidth from their parents.
-#	  - class ID check allows hexadecimal numbers
-#	  - rewritten & simplified RULE parser
-#	  - cosmetic changes to improve readability
-#	  - reorganization to avoid duplicate code (timecheck etc.)
-#	  - timecheck doesn't check classes without TIME fields anymore
-# v0.4  - Lubomir Bulej <pallas at kadan.cz>
-#	  - small bugfix in RULE parsing code
-#	  - simplified configuration parsing code
-#	  - several small cosmetic changes
-#	  - TIME parameter can be now specified more than once allowing you to
-#	    differentiate RATE throughout the whole day. Time overlapping is
-#	    not checked, first match is taken. Midnight wrap (eg. 20:00-6:00)
-#	    is allowed and taken care of.
-# v0.3a4- fixed small bug in IF operator. Thanks to
-#	  Rafal Maszkowski <rzm at icm.edu.pl>
-# v0.3a3- fixed grep bug when using more than 10 eth devices. Thanks to David
-#	  Trcka <trcka at poda.cz>.
-# v0.3a2- fixed bug in "if" operator. Thanks kad at dgtu.donetsk.ua.
-# v0.3a - added TIME parameter. Example: TIME=00:00-19:00;64Kbit/6Kbit
-#	  So, between 00:00 and 19:00 the RATE will be 64Kbit.
-#	  Just start "cbq.init timecheck" periodically from cron
-#	  (every 10 minutes for example). DON'T FORGET though, to run
-#	  "cbq.init start" for CBQ to initialize.
-# v0.2  - Some cosmetic changes. Now it is more compatible with old bash
-#	  version. Thanks to Stanislav V. Voronyi <stas at cnti.uanet.kharkov.ua>.
-# v0.1  - First public release
-#
-#
-# README
-# ------
-#
-# First of all - this is just a SIMPLE EXAMPLE of CBQ power.
-# Don't ask me "why" and "how" :)
-#
-# This script is meant to simplify setup and management of relatively simple
-# CBQ-based traffic control on Linux. Access to advanced networking features
-# of Linux kernel is provided by "ip" and "tc" utilities from A. Kuznetsov's
-# iproute2 package, available at ftp://ftp.inr.ac.ru/ip-routing. Because the
-# utilities serve primarily to translate user wishes to RTNETLINK commands,
-# their interface is rather spartan, intolerant and requires quite a lot of
-# typing. And typing is what this script attempts to reduce :)
-#
-# The advanced networking stuff in Linux is pretty flexible and this script
-# aims to bring some of its features to the not-so-hard-core Linux users. Of
-# course, there is a tradeoff between simplicity and flexibility and you may
-# realize that the flexibility suffered too much for your needs -- time to
-# face "ip" and "tc" interface.
-#
-# To speed up the "start" command, simple caching was introduced in version
-# 0.6.4. The caching works so that the sequence of "tc" commands for given
-# configuration is stored in a file (/var/cache/cbq.init by default) which
-# is used next time the "start" command is run to avoid repeated parsing of
-# configuration files. This cache is invalidated whenever any of the CBQ
-# configuration files changes. If you want to run "cbq.init start" without
-# caching, run it as "cbq.init start nocache". If you want to force cache
-# invalidation, run it as "cbq.init start invalidate". Caching is disabled
-# if you have logging enabled (ie. CBQ_DEBUG is not empty).
-#
-# If you only want cqb.init to translate your configuration to "tc" commands,
-# use "compile" command which will output "tc" commands required to build
-# your configuration. Bear in mind that "compile" does not check if the "tc"
-# commands were successful - this is done (in certain places) only when the
-# "start nocache" command is used, which is also useful when creating the
-# configuration to check whether it is completely valid.
-#
-# All CBQ parameters are valid for Ethernet interfaces only, The script was
-# tested on various Linux kernel versions from series 2.1 to 2.4 and several
-# distributions with KSI Linux (Nostromo version) as the premier one.
-#
-#
-# HOW DOES IT WORK?
-# -----------------
-#
-# Every traffic class must be described by a file in the $CBQ_PATH directory
-# (/etc/sysconfig/cbq by default) - one file per class.
-#
-# The config file names must obey mandatory format: cbq-<clsid>.<name> where
-# <clsid> is two-byte hexadecimal number in range <0002-FFFF> (which in fact
-# is a CBQ class ID) and <name> is the name of the class -- anything to help
-# you distinguish the configuration files. For small amount of classes it is
-# often possible (and convenient) to let <clsid> resemble bandwidth of the
-# class.
-#
-# Example of valid config name:
-#	cbq-1280.My_first_shaper
-#
-#
-# The configuration file may contain the following parameters:
-#
-### Device parameters
-#
-# DEVICE=<ifname>,<bandwidth>[,<weight>]	mandatory
-# DEVICE=eth0,10Mbit,1Mbit
-#
-#	<ifname> is the name of the interface you want to control
-#		traffic on, e.g. eth0
-#	<bandwidth> is the physical bandwidth of the device, e.g. for
-#		ethernet 10Mbit or 100Mbit, for arcnet 2Mbit
-#	<weight> is tuning parameter that should be proportional to
-#		<bandwidth>. As a rule of thumb: <weight> = <bandwidth> / 10
-#
-# When you have more classes on one interface, it is enough to specify
-# <bandwidth> [and <weight>] only once, therefore in other files you only
-# need to set DEVICE=<ifname>.
-#
-### Class parameters
-#
-# RATE=<speed>					mandatory
-# RATE=5Mbit
-#
-#	Bandwidth allocated to the class. Traffic going through the class is
-#	shaped to conform to specified rate. You can use Kbit, Mbit or bps,
-#	Kbps and Mbps as suffices. If you don't specify any unit, bits/sec
-#	are used. Also note that "bps" means "bytes per second", not bits.
-#
-# WEIGHT=<speed> 				mandatory
-# WEIGHT=500Kbit
-#
-#	Tuning parameter that should be proportional to RATE. As a rule
-#	of thumb, use WEIGHT ~= RATE / 10.
-#
-# PRIO=<1-8>					optional, default 5
-# PRIO=5
-#
-#	Priority of class traffic. The higher the number, the lesser
-#	the priority. Priority of 5 is just fine.
-#
-# PARENT=<clsid>				optional, default not set
-# PARENT=1280
-#
-#	Specifies ID of the parent class to which you want this class be
-#	attached. You might want to use LEAF=none for the parent class as
-#	mentioned below. By using this parameter and carefully ordering the
-#	configuration files, it is possible to create simple hierarchical
-#	structures of CBQ classes. The ordering is important so that parent
-#	classes are constructed prior to their children.
-#
-# LEAF=none|tbf|sfq				optional, default "tbf"
-#
-#	Tells the script to attach specified leaf queueing discipline to CBQ
-#	class. By default, TBF is used. Note that attaching TBF to CBQ class
-#	shapes the traffic to conform to TBF parameters and prevents the class
-#	from borrowing bandwidth from its parent even if you have BOUNDED set
-#	to "no". To allow the class to borrow bandwith (provided it is not
-#	bounded), you must set LEAF to "none" or "sfq".
-#
-#	If you want to ensure (approximately) fair sharing of bandwidth among
-#	several hosts in the same class, you might want to specify LEAF=sfq to
-#	attach SFQ as leaf queueing discipline to that class.
-#
-# BOUNDED=yes|no				optional, default "yes"
-#
-#	If set to "yes", the class is not allowed to borrow bandwidth from
-#	its parent class in overlimit situation. If set to "no", the class
-#	will be allowed to borrow bandwidth from its parent.
-#
-# Note:	Don't forget to set LEAF to "none" or "sfq", otherwise the class will
-#	have TBF attached to itself and will not be able to borrow unused
-#	bandwith from its parent.
-#
-# ISOLATED=yes|no				optional, default "no"
-#
-#	If set to "yes", the class will not lend unused bandwidth to
-#	its children.
-#
-### TBF qdisc parameters
-#
-# BUFFER=<bytes>[/<bytes>]			optional, default "10Kb/8"
-#
-#	This parameter controls the depth of the token bucket. In other
-#	words it represents the maximal burst size the class can send.
-#	The optional part of parameter is used to determine the length
-#	of intervals in packet sizes, for which the transmission times
-#	are kept.
-#
-# LIMIT=<bytes>					optional, default "15Kb"
-#
-#	This parameter determines the maximal length of backlog. If
-#	the queue contains more data than specified by LIMIT, the
-#	newly arriving packets are dropped. The length of backlog
-#	determines queue latency in case of congestion.
-#
-# PEAK=<speed>					optional, default not set
-#
-#	Maximal peak rate for short-term burst traffic. This allows you
-#	to control the absolute peak rate the class can send at, because
-#	single TBF that allows 256Kbit/s would of course allow rate of
-#	512Kbit for half a second or 1Mbit for a quarter of second.
-#
-# MTU=<bytes>  					optional, default "1500"
-#
-#	Maximum number of bytes that can be sent at once over the
-#	physical medium. This parameter is required when you specify
-#	PEAK parameter. It defaults to MTU of ethernet - for other
-#	media types you might want to change it.
-#
-# Note: Setting TBF as leaf qdisc will effectively prevent the class from
-#	borrowing bandwidth from the ancestor class, because even if the
-#	class allows more traffic to pass through, it is then shaped to
-#	conform to TBF.
-#
-### SFQ qdisc parameters
-#
-# The SFQ queueing discipline is a cheap way for sharing class bandwidth
-# among several hosts. As it is stochastic, the fairness is approximate but
-# it will do the job in most cases. If you want real fairness, you should
-# probably use WRR (weighted round robin) or WFQ queueing disciplines. Note
-# that SFQ does not do any traffic shaping - the shaping is done by the CBQ
-# class the SFQ is attached to.
-#
-# QUANTUM=<bytes>				optional, default not set
-#
-#	This parameter should not be set lower than link MTU, for ethernet
-#	it is 1500b, or (with MAC header) 1514b which is the value used
-#	in Alexey Kuznetsov's examples.
-#
-# PERTURB=<seconds>				optional, default "10"
-#
-#	Period of hash function perturbation. If unset, hash reconfiguration
-#	will never take place which is what you probably don't want. The
-#	default value of 10 seconds is probably a good one.
-#
-### Filter parameters
-#
-# RULE=[[saddr[/prefix]][:port[/mask]],][daddr[/prefix]][:port[/mask]]
-#
-#	These parameters make up "u32" filter rules that select traffic for
-#	each of the classes. You can use multiple RULE fields per config.
-#
-#	The optional port mask should only be used by advanced users who
-#	understand how the u32 filter works.
-#
-# Some examples:
-#
-#	RULE=10.1.1.0/24:80
-#		selects traffic going to port 80 in network 10.1.1.0
-#
-#	RULE=10.2.2.5
-#		selects traffic going to any port on single host 10.2.2.5
-#
-#	RULE=10.2.2.5:20/0xfffe
-#		selects traffic going to ports 20 and 21 on host 10.2.2.5
-#
-#	RULE=:25,10.2.2.128/26:5000
-#		selects traffic going from anywhere on port 50 to
-#		port 5000 in network 10.2.2.128
-#
-#	RULE=10.5.5.5:80,
-#		selects traffic going from port 80 of single host 10.5.5.5
-#
-#
-#
-# REALM=[srealm,][drealm]
-#
-#	These parameters make up "route" filter rules that classify traffic
-#	according to packet source/destination realms. For information about
-#	realms, see Alexey Kuznetsov's IP Command Reference. This script
-#	does not define any realms, it justs builds "tc filter" commands
-#	for you if you need to classify traffic this way.
-#
-#	Realm is either a decimal number or a string referencing entry in
-#	/etc/iproute2/rt_realms (usually).
-#
-# Some examples:
-#
-#	REALM=russia,internet
-#		selects traffic going from realm "russia" to realm "internet"
-#
-#	REALM=freenet,
-#		selects traffic going from realm "freenet"
-#
-#	REALM=10
-#		selects traffic going to realm 10
-#
-#
-#
-# MARK=<mark>
-#
-#	These parameters make up "fw" filter rules that select traffic for
-#	each of the classes accoring to firewall "mark". Mark is a decimal
-#	number packets are tagged with if firewall rules say so. You can
-#	use multiple MARK fields per config.
-#
-#
-# Note: Rules for different filter types can be combined. Attention must be
-#	paid to the priority of filter rules, which can be set below using
-#	PRIO_{RULE,MARK,REALM} variables.
-#
-### Time ranging parameters
-#
-# TIME=[<dow>,<dow>, ...,<dow>/]<from>-<till>;<rate>/<weight>[/<peak>]
-# TIME=0,1,2,5/18:00-06:00;256Kbit/25Kbit
-# TIME=60123/18:00-06:00;256Kbit/25Kbit
-# TIME=18:00-06:00;256Kbit/25Kbit
-#
-#	This parameter allows you to differentiate the class bandwidth
-#	throughout the day. You can specify multiple TIME parameters, if
-#	the times overlap, last match is taken. The fields <rate>, <weight>
-#	and <peak> correspond to parameters RATE, WEIGHT and PEAK (which
-#	is optional and applies to TBF leaf qdisc only).
-#
-#	You can also specify days of week when the TIME rule applies. <dow>
-#	is numeric, 0 corresponds to sunday, 1 corresponds to monday, etc.
-#
-###
-#
-# Sample configuration file: cbq-1280.My_first_shaper
-#
-# --------------------------------------------------------------------------
-# DEVICE=eth0,10Mbit,1Mbit
-# RATE=128Kbit
-# WEIGHT=10Kbit
-# PRIO=5
-# RULE=192.128.1.0/24
-# --------------------------------------------------------------------------
-#
-# The configuration says that we will control traffic on 10Mbit ethernet
-# device eth0 and the traffic going to network 192.168.1.0 will be
-# processed with priority 5 and shaped to rate of 128Kbit.
-#
-# Note that you can control outgoing traffic only. If you want to control
-# traffic in both directions, you must set up CBQ for both interfaces.
-#
-# Consider the following example:
-#
-#                    +---------+      192.168.1.1
-# BACKBONE -----eth0-|  linux  |-eth1------*-[client]
-#                    +---------+
-#
-# Imagine you want to shape traffic from backbone to the client to 28Kbit
-# and traffic in the opposite direction to 128Kbit. You need to setup CBQ
-# on both eth0 and eth1 interfaces, thus you need two config files:
-#
-# cbq-028.backbone-client
-# --------------------------------------------------------------------------
-# DEVICE=eth1,10Mbit,1Mbit
-# RATE=28Kbit
-# WEIGHT=2Kbit
-# PRIO=5
-# RULE=192.168.1.1
-# --------------------------------------------------------------------------
-#
-# cbq-128.client-backbone
-# --------------------------------------------------------------------------
-# DEVICE=eth0,10Mbit,1Mbit
-# RATE=128Kbit
-# WEIGHT=10Kbit
-# PRIO=5
-# RULE=192.168.1.1,
-# --------------------------------------------------------------------------
-#
-# Pay attention to comma "," in the RULE field - it denotes source address!
-#
-# Enjoy.
-#
-#############################################################################
-
-export LC_ALL=C
-
-### Command locations
-TC=/sbin/tc
-IP=/sbin/ip
-MP=/sbin/modprobe
-
-### Default filter priorities (must be different)
-PRIO_RULE_DEFAULT=${PRIO_RULE:-100}
-PRIO_MARK_DEFAULT=${PRIO_MARK:-200}
-PRIO_REALM_DEFAULT=${PRIO_REALM:-300}
-
-### Default CBQ_PATH & CBQ_CACHE settings
-CBQ_PATH=${CBQ_PATH:-/etc/sysconfig/cbq}
-CBQ_CACHE=${CBQ_CACHE:-/var/cache/cbq.init}
-
-### Uncomment to enable logfile for debugging
-#CBQ_DEBUG="/var/run/cbq-$1"
-
-### Modules to probe for. Uncomment the last CBQ_PROBE
-### line if you have QoS support compiled into kernel
-CBQ_PROBE="sch_cbq sch_tbf sch_sfq sch_prio"
-CBQ_PROBE="$CBQ_PROBE cls_fw cls_u32 cls_route"
-#CBQ_PROBE=""
-
-### Keywords required for qdisc & class configuration
-CBQ_WORDS="DEVICE|RATE|WEIGHT|PRIO|PARENT|LEAF|BOUNDED|ISOLATED"
-CBQ_WORDS="$CBQ_WORDS|PRIO_MARK|PRIO_RULE|PRIO_REALM|BUFFER"
-CBQ_WORDS="$CBQ_WORDS|LIMIT|PEAK|MTU|QUANTUM|PERTURB"
-
-### Source AVPKT if it exists
-[ -r /etc/sysconfig/cbq/avpkt ] && . /etc/sysconfig/cbq/avpkt
-AVPKT=${AVPKT:-3000}
-
-
-#############################################################################
-############################# SUPPORT FUNCTIONS #############################
-#############################################################################
-
-### Get list of network devices
-cbq_device_list () {
-	ip link show| sed -n "/^[0-9]/ \
-		{ s/^[0-9]\+: \([a-z0-9._]\+\)[:@].*/\1/; p; }"
-} # cbq_device_list
-
-
-### Remove root class from device $1
-cbq_device_off () {
-	tc qdisc del dev $1 root 2> /dev/null
-} # cbq_device_off
-
-
-### Remove CBQ from all devices
-cbq_off () {
-	for dev in `cbq_device_list`; do
-		cbq_device_off $dev
-	done
-} # cbq_off
-
-
-### Prefixed message
-cbq_message () {
-	echo -e "**CBQ: $*"
-} # cbq_message
-
-### Failure message
-cbq_failure () {
-	cbq_message "$@"
-	exit 1
-} # cbq_failure
-
-### Failure w/ cbq-off
-cbq_fail_off () {
-	cbq_message "$@"
-	cbq_off
-	exit 1
-} # cbq_fail_off
-
-
-### Convert time to absolute value
-cbq_time2abs () {
-	local min=${1##*:}; min=${min##0}
-	local hrs=${1%%:*}; hrs=${hrs##0}
-	echo $[hrs*60 + min]
-} # cbq_time2abs
-
-
-### Display CBQ setup
-cbq_show () {
-	for dev in `cbq_device_list`; do
-		[ "`tc qdisc show dev $dev| wc -l`" -eq 0 ] && continue
-		echo -e "### $dev: queueing disciplines\n"
-		tc $1 qdisc show dev $dev; echo
-
-		[ "`tc class show dev $dev| wc -l`" -eq 0 ] && continue
-		echo -e "### $dev: traffic classes\n"
-		tc $1 class show dev $dev; echo
-
-		[ "`tc filter show dev $dev| wc -l`" -eq 0 ] && continue
-		echo -e "### $dev: filtering rules\n"
-		tc $1 filter show dev $dev; echo
-	done
-} # cbq_show
-
-
-### Check configuration and load DEVICES, DEVFIELDS and CLASSLIST from $1
-cbq_init () {
-	### Get a list of configured classes
-	CLASSLIST=`find $1 -maxdepth 1 \( -type f -or -type l \) -name 'cbq-*' \
-		-not -name '*~' -printf "%f\n"| sort`
-	[ -z "$CLASSLIST" ] &&
-		cbq_failure "no configuration files found in $1!"
-
-	### Gather all DEVICE fields from $1/cbq-*
-	DEVFIELDS=`find $1 -maxdepth 1 \( -type f -or -type l \) -name 'cbq-*' \
-		  -not -name '*~' -print0 | xargs -0 sed -n 's/#.*//; \
-		  s/[[:space:]]//g; /^DEVICE=[^,]*,[^,]*\(,[^,]*\)\?/ \
-		  { s/.*=//; p; }'| sort -u`
-	[ -z "$DEVFIELDS" ] &&
-		cbq_failure "no DEVICE field found in $1/cbq-*!"
-
-	### Check for different DEVICE fields for the same device
-	DEVICES=`echo "$DEVFIELDS"| sed 's/,.*//'| sort -u`
-	[ "`echo "$DEVICES"| wc -l`" -ne "`echo "$DEVFIELDS"| wc -l`" ] &&
-		cbq_failure "different DEVICE fields for single device!\n$DEVFIELDS"
-} # cbq_init
-
-
-### Load class configuration from $1/$2
-cbq_load_class () {
-	CLASS=`echo $2| sed 's/^cbq-0*//; s/^\([0-9a-fA-F]\+\).*/\1/'`
-	CFILE=`sed -n 's/#.*//; s/[[:space:]]//g; /^[[:alnum:]_]\+=[[:alnum:].,:;/*@-_]\+$/ p' $1/$2`
-
-	### Check class number
-	IDVAL=`/usr/bin/printf "%d" 0x$CLASS 2> /dev/null`
-	[ $? -ne 0 -o $IDVAL -lt 2 -o $IDVAL -gt 65535 ] &&
-		cbq_fail_off "class ID of $2 must be in range <0002-FFFF>!"
-
-	### Set defaults & load class
-	RATE=""; WEIGHT=""; PARENT=""; PRIO=5
-	LEAF=tbf; BOUNDED=yes; ISOLATED=no
-	BUFFER=10Kb/8; LIMIT=15Kb; MTU=1500
-	PEAK=""; PERTURB=10; QUANTUM=""
-
-	PRIO_RULE=$PRIO_RULE_DEFAULT
-	PRIO_MARK=$PRIO_MARK_DEFAULT
-	PRIO_REALM=$PRIO_REALM_DEFAULT
-
-	eval "`echo "$CFILE"| grep -E "^($CBQ_WORDS)="`"
-
-	### Require RATE/WEIGHT
-	[ -z "$RATE" -o -z "$WEIGHT" ] &&
-		cbq_fail_off "missing RATE or WEIGHT in $2!"
-
-	### Class device
-	DEVICE=${DEVICE%%,*}
-	[ -z "$DEVICE" ] && cbq_fail_off "missing DEVICE field in $2!"
-
-	BANDWIDTH=`echo "$DEVFIELDS"| sed -n "/^$DEVICE,/ \
-		  { s/[^,]*,\([^,]*\).*/\1/; p; q; }"`
-
-	### Convert to "tc" options
-	PEAK=${PEAK:+peakrate $PEAK}
-	PERTURB=${PERTURB:+perturb $PERTURB}
-	QUANTUM=${QUANTUM:+quantum $QUANTUM}
-
-	[ "$BOUNDED" = "no" ] && BOUNDED="" || BOUNDED="bounded"
-	[ "$ISOLATED" = "yes" ] && ISOLATED="isolated" || ISOLATED=""
-} # cbq_load_class
-
-
-#############################################################################
-#################################### INIT ###################################
-#############################################################################
-
-### Check for presence of ip-route2 in usual place
-[ -x $TC -a -x $IP ] ||
-	cbq_failure "ip-route2 utilities not installed or executable!"
-
-
-### ip/tc wrappers
-if [ "$1" = "compile" ]; then
-	### no module probing
-	CBQ_PROBE=""
-
-	ip () {
-		$IP "$@"
-	} # ip
-
-	### echo-only version of "tc" command
-	tc () {
-		echo "$TC $*"
-	} # tc
-
-elif [ -n "$CBQ_DEBUG" ]; then
-	echo -e "# `date`" > $CBQ_DEBUG
-
-	### Logging version of "ip" command
-	ip () {
-		echo -e "\n# ip $*" >> $CBQ_DEBUG
-		$IP "$@" 2>&1 | tee -a $CBQ_DEBUG
-	} # ip
-
-	### Logging version of "tc" command
-	tc () {
-		echo -e "\n# tc $*" >> $CBQ_DEBUG
-		$TC "$@" 2>&1 | tee -a $CBQ_DEBUG
-	} # tc
-else
-	### Default wrappers
-	
-	ip () {
-		$IP "$@"
-	} # ip
-	
-	tc () {
-		$TC "$@"
-	} # tc
-fi # ip/tc wrappers
-
-
-case "$1" in
-
-#############################################################################
-############################### START/COMPILE ###############################
-#############################################################################
-
-start|compile)
-
-### Probe QoS modules (start only)
-for module in $CBQ_PROBE; do
-	$MP $module || cbq_failure "failed to load module $module"
-done
-
-### If we are in compile/nocache/logging mode, don't bother with cache
-if [ "$1" != "compile" -a "$2" != "nocache" -a -z "$CBQ_DEBUG" ]; then
-	VALID=1
-
-	### validate the cache
-	[ "$2" = "invalidate" -o ! -f $CBQ_CACHE ] && VALID=0
-	if [ $VALID -eq 1 ]; then
-		[ "`find $CBQ_PATH -maxdepth 1 -newer $CBQ_CACHE| \
-		  wc -l`" -gt 0 ] && VALID=0
-	fi
-
-	### compile the config if the cache is invalid
-	if [ $VALID -ne 1 ]; then
-		$0 compile > $CBQ_CACHE ||
-			cbq_fail_off "failed to compile CBQ configuration!"
-	fi
-
-	### run the cached commands
-	exec /bin/sh $CBQ_CACHE 2> /dev/null
-fi
-
-### Load DEVICES, DEVFIELDS and CLASSLIST
-cbq_init $CBQ_PATH
-
-
-### Setup root qdisc on all configured devices
-for dev in $DEVICES; do
-	### Retrieve device bandwidth and, optionally, weight
-	DEVTEMP=`echo "$DEVFIELDS"| sed -n "/^$dev,/ { s/$dev,//; p; q; }"`
-	DEVBWDT=${DEVTEMP%%,*};	DEVWGHT=${DEVTEMP##*,}
-	[ "$DEVBWDT" = "$DEVWGHT" ] && DEVWGHT=""
-
-	### Device bandwidth is required
-	if [ -z "$DEVBWDT" ]; then
-		cbq_message "could not determine bandwidth for device $dev!"
-		cbq_failure "please set up the DEVICE fields properly!"
-	fi
-
-	### Check if the device is there
-	ip link show $dev &> /dev/null ||
-		cbq_fail_off "device $dev not found!"
-
-	### Remove old root qdisc from device
-	cbq_device_off $dev
-
-
-	### Setup root qdisc + class for device
-	tc qdisc add dev $dev root handle 1 cbq \
-	bandwidth $DEVBWDT avpkt $AVPKT cell 8
-
-	### Set weight of the root class if set
-	[ -n "$DEVWGHT" ] &&
-		tc class change dev $dev root cbq weight $DEVWGHT allot 1514
-
-	[ "$1" = "compile" ] && echo
-done # dev
-
-
-### Setup traffic classes
-for classfile in $CLASSLIST; do
-	cbq_load_class $CBQ_PATH $classfile
-
-	### Create the class
-	tc class add dev $DEVICE parent 1:$PARENT classid 1:$CLASS cbq \
-	bandwidth $BANDWIDTH rate $RATE weight $WEIGHT prio $PRIO \
-	allot 1514 cell 8 maxburst 20 avpkt $AVPKT $BOUNDED $ISOLATED ||
-		cbq_fail_off "failed to add class $CLASS with parent $PARENT on $DEVICE!"
-
-	### Create leaf qdisc if set
-	if [ "$LEAF" = "tbf" ]; then
-		tc qdisc add dev $DEVICE parent 1:$CLASS handle $CLASS tbf \
-		rate $RATE buffer $BUFFER limit $LIMIT mtu $MTU $PEAK
-	elif [ "$LEAF" = "sfq" ]; then
-		tc qdisc add dev $DEVICE parent 1:$CLASS handle $CLASS sfq \
-		$PERTURB $QUANTUM
-	fi
-
-
-	### Create fw filter for MARK fields
-	for mark in `echo "$CFILE"| sed -n '/^MARK/ { s/.*=//; p; }'`; do
-		### Attach fw filter to root class
-		tc filter add dev $DEVICE parent 1:0 protocol ip \
-		prio $PRIO_MARK handle $mark fw classid 1:$CLASS
-	done ### mark
-
-	### Create route filter for REALM fields
-	for realm in `echo "$CFILE"| sed -n '/^REALM/ { s/.*=//; p; }'`; do
-		### Split realm into source & destination realms
-		SREALM=${realm%%,*}; DREALM=${realm##*,}
-		[ "$SREALM" = "$DREALM" ] && SREALM=""
-
-		### Convert asterisks to empty strings
-		SREALM=${SREALM#\*}; DREALM=${DREALM#\*}
-
-		### Attach route filter to the root class
-		tc filter add dev $DEVICE parent 1:0 protocol ip \
-		prio $PRIO_REALM route ${SREALM:+from $SREALM} \
-		${DREALM:+to $DREALM} classid 1:$CLASS
-	done ### realm
-
-	### Create u32 filter for RULE fields
-	for rule in `echo "$CFILE"| sed -n '/^RULE/ { s/.*=//; p; }'`; do
-		### Split rule into source & destination
-		SRC=${rule%%,*}; DST=${rule##*,}
-		[ "$SRC" = "$rule" ] && SRC=""
-
-
-		### Split destination into address, port & mask fields
-		DADDR=${DST%%:*}; DTEMP=${DST##*:}
-		[ "$DADDR" = "$DST" ] && DTEMP=""
-
-		DPORT=${DTEMP%%/*}; DMASK=${DTEMP##*/}
-		[ "$DPORT" = "$DTEMP" ] && DMASK="0xffff"
-
-
-		### Split up source (if specified)
-		SADDR=""; SPORT=""
-		if [ -n "$SRC" ]; then
-			SADDR=${SRC%%:*}; STEMP=${SRC##*:}
-			[ "$SADDR" = "$SRC" ] && STEMP=""
-
-			SPORT=${STEMP%%/*}; SMASK=${STEMP##*/}
-			[ "$SPORT" = "$STEMP" ] && SMASK="0xffff"
-		fi
-
-
-		### Convert asterisks to empty strings
-		SADDR=${SADDR#\*}; DADDR=${DADDR#\*}
-
-		### Compose u32 filter rules
-		u32_s="${SPORT:+match ip sport $SPORT $SMASK}"
-		u32_s="${SADDR:+match ip src $SADDR} $u32_s"
-		u32_d="${DPORT:+match ip dport $DPORT $DMASK}"
-		u32_d="${DADDR:+match ip dst $DADDR} $u32_d"
-
-		### Uncomment the following if you want to see parsed rules
-		#echo "$rule: $u32_s $u32_d"
-
-		### Attach u32 filter to the appropriate class
-		tc filter add dev $DEVICE parent 1:0 protocol ip \
-		prio $PRIO_RULE u32 $u32_s $u32_d classid 1:$CLASS
-	done ### rule
-
-	[ "$1" = "compile" ] && echo
-done ### classfile
-;;
-
-
-#############################################################################
-################################# TIME CHECK ################################
-#############################################################################
-
-timecheck)
-
-### Get time + weekday
-TIME_TMP=`date +%w/%k:%M`
-TIME_DOW=${TIME_TMP%%/*}
-TIME_NOW=${TIME_TMP##*/}
-
-### Load DEVICES, DEVFIELDS and CLASSLIST
-cbq_init $CBQ_PATH
-
-### Run through all classes
-for classfile in $CLASSLIST; do
-	### Gather all TIME rules from class config
-	TIMESET=`sed -n 's/#.*//; s/[[:space:]]//g; /^TIME/ { s/.*=//; p; }' \
-		$CBQ_PATH/$classfile`
-	[ -z "$TIMESET" ] && continue
-
-	MATCH=0; CHANGE=0
-	for timerule in $TIMESET; do
-		TIME_ABS=`cbq_time2abs $TIME_NOW`
-		
-		### Split TIME rule to pieces
-		TIMESPEC=${timerule%%;*}; PARAMS=${timerule##*;}
-		WEEKDAYS=${TIMESPEC%%/*}; INTERVAL=${TIMESPEC##*/}
-		BEG_TIME=${INTERVAL%%-*}; END_TIME=${INTERVAL##*-}
-
-		### Check the day-of-week (if present)
-		[ "$WEEKDAYS" != "$INTERVAL" -a \
-		  -n "${WEEKDAYS##*$TIME_DOW*}" ] && continue
-
-		### Compute interval boundaries
-		BEG_ABS=`cbq_time2abs $BEG_TIME`
-		END_ABS=`cbq_time2abs $END_TIME`
-
-		### Midnight wrap fixup
-		if [ $BEG_ABS -gt $END_ABS ]; then
-			[ $TIME_ABS -le $END_ABS ] &&
-				TIME_ABS=$[TIME_ABS + 24*60]
-
-			END_ABS=$[END_ABS + 24*60]
-		fi
-
-		### If the time matches, remember params and set MATCH flag
-		if [ $TIME_ABS -ge $BEG_ABS -a $TIME_ABS -lt $END_ABS ]; then
-			TMP_RATE=${PARAMS%%/*}; PARAMS=${PARAMS#*/}
-			TMP_WGHT=${PARAMS%%/*}; TMP_PEAK=${PARAMS##*/}
-
-			[ "$TMP_PEAK" = "$TMP_WGHT" ] && TMP_PEAK=""
-			TMP_PEAK=${TMP_PEAK:+peakrate $TMP_PEAK}
-
-			MATCH=1
-		fi
-	done ### timerule
-
-
-	cbq_load_class $CBQ_PATH $classfile
-
-	### Get current RATE of CBQ class
-	RATE_NOW=`tc class show dev $DEVICE| sed -n \
-		 "/cbq 1:$CLASS / { s/.*rate //; s/ .*//; p; q; }"`
-	[ -z "$RATE_NOW" ] && continue
-
-	### Time interval matched
-	if [ $MATCH -ne 0 ]; then
-
-		### Check if there is any change in class RATE
-		if [ "$RATE_NOW" != "$TMP_RATE" ]; then
-			NEW_RATE="$TMP_RATE"
-			NEW_WGHT="$TMP_WGHT"
-			NEW_PEAK="$TMP_PEAK"
-			CHANGE=1
-		fi
-
-	### Match not found, reset to default RATE if necessary
-	elif [ "$RATE_NOW" != "$RATE" ]; then
-		NEW_WGHT="$WEIGHT"
-		NEW_RATE="$RATE"
-		NEW_PEAK="$PEAK"
-		CHANGE=1
-	fi
-
-	### If there are no changes, go for next class
-	[ $CHANGE -eq 0 ] && continue
-
-	### Replace CBQ class
-	tc class replace dev $DEVICE classid 1:$CLASS cbq \
-	bandwidth $BANDWIDTH rate $NEW_RATE weight $NEW_WGHT prio $PRIO \
-	allot 1514 cell 8 maxburst 20 avpkt $AVPKT $BOUNDED $ISOLATED
-
-	### Replace leaf qdisc (if any)
-	if [ "$LEAF" = "tbf" ]; then
-		tc qdisc replace dev $DEVICE handle $CLASS tbf \
-		rate $NEW_RATE buffer $BUFFER limit $LIMIT mtu $MTU $NEW_PEAK
-	fi
-
-	cbq_message "$TIME_NOW: class $CLASS on $DEVICE changed rate ($RATE_NOW -> $NEW_RATE)"
-done ### class file
-;;
-
-
-#############################################################################
-################################## THE REST #################################
-#############################################################################
-
-stop)
-	cbq_off
-	;;
-
-list)
-	cbq_show
-	;;
-
-stats)
-	cbq_show -s
-	;;
-
-restart)
-	shift
-	$0 stop
-	$0 start "$@"
-	;;
-
-*)
-	echo "Usage: `basename $0` {start|compile|stop|restart|timecheck|list|stats}"
-esac
-- 
2.19.0.rc2

^ permalink raw reply related

* [PATCH iproute2 6/7] examples: Remove dhcp-client-script
From: Petr Vorel @ 2018-09-22 21:24 UTC (permalink / raw)
  To: netdev; +Cc: Petr Vorel, Stephen Hemminger
In-Reply-To: <20180922212451.327-1-petr.vorel@gmail.com>

This script is obsolete.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 examples/dhcp-client-script | 446 ------------------------------------
 1 file changed, 446 deletions(-)
 delete mode 100644 examples/dhcp-client-script

diff --git a/examples/dhcp-client-script b/examples/dhcp-client-script
deleted file mode 100644
index f39bc109..00000000
--- a/examples/dhcp-client-script
+++ /dev/null
@@ -1,446 +0,0 @@
-#!/bin/bash
-#
-# dhclient-script for Linux.
-#
-#		This program is free software; you can redistribute it and/or
-#		modify it under the terms of the GNU General Public License
-#		as published by the Free Software Foundation; either version
-#		2 of the License, or (at your option) any later version.
-#
-# Authors:	Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
-#
-# Probably, I did not understand, what this funny feature as "alias"
-# means exactly. For now I suppose, that it is a static address, which
-# we should install and preserve.
-#
-
-exec >> /var/log/DHS.log 2>&1
-
-echo dhc-script $* reason=$reason
-set | grep "^\(old_\|new_\|check_\)"
-
-LOG () {
-    echo LOG $* ;
-}
-
-# convert 8bit mask to length
-# arg: $1 = mask
-#
-Mask8ToLen() {
-	local l=0;
-
-	while [ $l -le 7 ]; do
-		if [ $[ ( 1 << $l ) + $1 ] -eq 256 ]; then
-			return	$[ 8 - $l ]
-		fi
-		l=$[ $l + 1 ]
-	done
-	return 0;
-}
-
-# convert inet dotted quad mask to length
-# arg: $1 = dotquad mask
-#
-MaskToLen() {
- local masklen=0
- local mask8=$1
-
- case $1 in
- 0.0.0.0)
-	return 0;
-	;;
- 255.*.0.0)
-	masklen=8
-	mask8=${mask8#255.}
-	mask8=${mask8%.0.0}
-	;;
- 255.255.*.0)
-	masklen=16
-	mask8=${mask8#255.255.}
-	mask8=${mask8%.0}
-	;;
- 255.255.255.*)
-	masklen=24
-	mask8=${mask8#255.255.255.}
-	;;
- *)
-	return 255
-	;;
- esac
- Mask8ToLen $mask8
- return $[ $? + $masklen ]
-}
-
-# calculate ABC "natural" mask
-# arg: $1 = dotquad address
-#
-ABCMask () {
- local class;
-
- class=${1%%.*}
-
- if [ "$1" = "255.255.255.255" ]; then
-    echo $1
- elif [ "$1" = "0.0.0.0" ]; then
-    echo $1
- elif [ $class -ge 224 ]; then
-    echo 240.0.0.0
- elif [ $class -ge 192 ]; then
-    echo 255.255.255.0
- elif [ $class -ge 128 ]; then
-    echo 255.255.0.0
- else
-    echo 255.0.0.0
- fi
-}
-
-# calculate ABC "natural" mask length
-# arg: $1 = dotquad address
-#
-ABCMaskLen () {
- local class;
-
- class=${1%%.*}
-
- if [ "$1" = "255.255.255.255" ]; then
-    return 32
- elif [ "$1" = "0.0.0.0" ]; then
-    return 0
- elif [ $class -ge 224 ]; then
-    return 4;
- elif [ $class -ge 192 ]; then
-    return 24;
- elif [ $class -ge 128 ]; then
-    return 16;
- else
-    return 8;
- fi
-}
-
-# Delete IP address
-# args: $1 = interface
-#       $2 = address
-#       $3 = mask
-#       $4 = broadcast
-#       $5 = label
-#
-DelINETAddr () {
-  local masklen=32
-  local addrid=$1
-
-  LOG DelINETAddr $*
-
-  if [ "$5" ]; then
-    addrid=$addrid:$5
-  fi
-  LOG ifconfig $addrid down
-  ifconfig $addrid down
-}
-
-# Add IP address
-# args: $1 = interface
-#       $2 = address
-#       $3 = mask
-#       $4 = broadcast
-#       $5 = label
-#
-AddINETAddr () {
-  local mask_arg
-  local brd_arg
-  local addrid=$1
-
-  LOG AddINETAddr $*
-
-  if [ "$5" ]; then
-    addrid=$addrid:$5
-  fi
-  if [ "$3" ]; then
-    mask_arg="netmask $3"
-  fi
-  if [ "$4" ]; then
-    brd_arg="broadcast $4"
-  fi
-
-  LOG ifconfig $addrid $2 $mask_arg $brd_arg up
-  ifconfig $addrid $2 $mask_arg $brd_arg up
-}
-
-# Add default routes
-# args: $1 = routers list
-#
-AddDefaultRoutes() {
-    local router
-
-    if [ "$1" ]; then
-      LOG AddDefaultRoutes $*
-      for router in $1; do
-        LOG route add default gw $router
-        route add default gw $router
-      done ;
-    fi
-}
-
-# Delete default routes
-# args: $1 = routers list
-#
-DelDefaultRoutes() {
-    local router
-
-    if [ "$1" ]; then
-      LOG DelDefaultRoutes $*
-
-      for router in $1; do
-        LOG route del default gw $router
-        route del default gw $router
-      done
-    fi
-}
-
-# ping a host
-# args: $1 = dotquad address of the host
-#
-PingNode() {
-    LOG PingNode $*
-    if ping -q -c 1 -w 2 $1 ; then
-	return 0;
-    fi
-    return 1;
-}
-
-# Check (and add route, if alive) default routers
-# args: $1 = routers list
-# returns: 0 if at least one router is alive.
-#
-CheckRouterList() {
-    local router
-    local succeed=1
-
-    LOG CheckRouterList $*
-
-    for router in $1; do
-      if PingNode $router ; then
-	succeed=0
-        route add default gw $router
-      fi
-    done
-    return $succeed
-}
-
-# Delete/create static routes.
-# args: $1 = operation (del/add)
-#       $2 = routes list in format "dst1 nexthop1 dst2 ..."
-#
-# BEWARE: this feature of DHCP is obsolete, because does not
-#         support subnetting.
-#
-X-StaticRouteList() {
-    local op=$1
-    local lst="$2"
-    local masklen
-
-    LOG X-StaticRouteList $*
-
-    if [ "$lst" ]; then
-      set $lst
-      while [ $# -gt 1 ]; do
-	route $op -net $1 netmask `ABCMask "$1"` gw $2
-	shift; shift;
-      done
-   fi
-}
-
-# Create static routes.
-# arg: $1 = routes list in format "dst1 nexthop1 dst2 ..."
-#
-AddStaticRouteList() {
-    LOG AddStaticRouteList $*
-    X-StaticRouteList add "$1"
-}
-
-# Delete static routes.
-# arg: $1 = routes list in format "dst1 nexthop1 dst2 ..."
-#
-DelStaticRouteList() {
-    LOG DelStaticRouteList $*
-    X-StaticRouteList del "$1"
-}
-
-# Broadcast unsolicited ARP to update neighbours' caches.
-# args: $1 = interface
-#       $2 = address
-#
-UnsolicitedARP() {
-    if [ -f /sbin/arping ]; then
-	/sbin/arping -A -c 1 -I "$1" "$2" &
-	(sleep 2 ; /sbin/arping -U -c 1 -I "$1" "$2" ) &
-    fi
-}
-
-# Duplicate address detection.
-# args: $1 = interface
-#       $2 = test address
-# returns: 0, if DAD succeeded.
-DAD() {
-  if [ -f /sbin/arping ]; then
-	/sbin/arping -c 2 -w 3 -D -I "$1" "$2"
-	return $?
-  fi
-  return 0
-}
-
-
-# Setup resolver.
-# args: NO
-#       domain and nameserver list are passed in global variables.
-#
-# NOTE: we try to be careful and not to break user supplied resolv.conf.
-#       The script mangles it, only if it has dhcp magic signature.
-#
-UpdateDNS() {
-    local nameserver
-    local idstring="#### Generated by DHCPCD"
-
-    LOG UpdateDNS $*
-
-    if [ "$new_domain_name" = "" -a "$new_domain_name_servers" = "" ]; then
-	return 0;
-    fi
-
-    echo $idstring > /etc/resolv.conf.dhcp
-    if [ "$new_domain_name" ]; then
-	echo search $new_domain_name >> /etc/resolv.conf.dhcp
-    fi
-    echo options ndots:1 >> /etc/resolv.conf.dhcp
-
-    if [ "$new_domain_name_servers" ]; then
-	for nameserver in $new_domain_name_servers; do
-	    echo nameserver $nameserver >> /etc/resolv.conf.dhcp
-	done
-    else
-	echo nameserver 127.0.0.1 >> /etc/resolv.conf.dhcp
-    fi
-
-    if [ -f /etc/resolv.conf ]; then
-	if [ "`head -1 /etc/resolv.conf`" != "$idstring" ]; then
-	    return 0
-	fi
-	if [ "$old_domain_name" = "$new_domain_name" -a
-	     "$new_domain_name_servers" = "$old_domain_name_servers" ]; then
-	     return 0
-	fi
-    fi
-    mv /etc/resolv.conf.dhcp /etc/resolv.conf
-}
-
-case $reason in
-NBI)
-  exit 1
-  ;;
-
-MEDIUM)
-  exit 0
-  ;;
-
-PREINIT)
-  ifconfig $interface:dhcp down
-  ifconfig $interface:dhcp1 down
-  if [ -d /proc/sys/net/ipv4/conf/$interface ]; then
-    ifconfig $interface:dhcp 10.10.10.10 netmask 255.255.255.255
-    ifconfig $interface:dhcp down
-    if [ -d /proc/sys/net/ipv4/conf/$interface ]; then
-	LOG The interface $interface already configured.
-    fi
-  fi
-  ifconfig $interface:dhcp up
-  exit 0
-  ;;
-
-ARPSEND)
-  exit 0
-  ;;
-
-ARPCHECK)
-  if DAD "$interface" "$check_ip_address" ; then
-    exit 0
-  fi
-  exit 1
-  ;;
-
-BOUND|RENEW|REBIND|REBOOT)
-  if [ "$old_ip_address" -a "$alias_ip_address" -a \
-	"$alias_ip_address" != "$old_ip_address" ]; then
-    DelINETAddr "$interface" "$alias_ip_address" "$alias_subnet_mask" "$alias_broadcast_address" dhcp1
-  fi
-  if [ "$old_ip_address" -a "$old_ip_address" != "$new_ip_address" ]; then
-    DelINETAddr "$interface" "$old_ip_address" "$old_subnet_mask" "$old_broadcast_address" dhcp
-    DelDefaultRoutes "$old_routers"
-    DelStaticRouteList "$old_static_routes"
-  fi
-  if [ "$old_ip_address" = "" -o "$old_ip_address" != "$new_ip_address" -o \
-       "$reason" = "BOUND" -o "$reason" = "REBOOT" ]; then
-    AddINETAddr "$interface" "$new_ip_address" "$new_subnet_mask" "$new_broadcast_address" dhcp
-    AddStaticRouteList "$new_static_routes"
-    AddDefaultRoutes "$new_routers"
-    UnsolicitedARP "$interface" "$new_ip_address"
-  fi
-  if [ "$new_ip_address" != "$alias_ip_address" -a "$alias_ip_address" ]; then
-    AddINETAddr "$interface" "$alias_ip_address" "$alias_subnet_mask" "$alias_broadcast_address" dhcp1
-  fi
-  UpdateDNS
-  exit 0
-  ;;
-
-EXPIRE|FAIL)
-  if [ "$alias_ip_address" ]; then
-    DelINETAddr "$interface" "$alias_ip_address" "$alias_subnet_mask" "$alias_broadcast_address" dhcp1
-  fi
-  if [ "$old_ip_address" ]; then
-    DelINETAddr "$interface" "$old_ip_address" "$old_subnet_mask" "$old_broadcast_address" dhcp
-    DelDefaultRoutes "$old_routers"
-    DelStaticRouteList "$old_static_routes"
-  fi
-  if [ "$alias_ip_address" ]; then
-    AddINETAddr "$interface" "$alias_ip_address" "$alias_subnet_mask" "$alias_broadcast_address" dhcp1
-  fi
-  exit 0
-  ;;
-
-TIMEOUT)
-  if [ "$alias_ip_address" ]; then
-    DelINETAddr "$interface" "$alias_ip_address" "$alias_subnet_mask" "$alias_broadcast_address" dhcp1
-  fi
-# Seems, <null address> means, that no more old leases found.
-# Or does it mean bug in dhcpcd? 8) Fail for now.
-  if [ "$new_ip_address" = "<null address>" ]; then
-    if [ "$old_ip_address" ]; then
-	DelINETAddr "$interface" "$old_ip_address" "$old_subnet_mask" "$old_broadcast_address" dhcp
-    fi
-    if [ "$alias_ip_address" ]; then
-        AddINETAddr "$interface" "$alias_ip_address" "$alias_subnet_mask" "$alias_broadcast_address" dhcp1
-    fi
-    exit 1
-  fi
-  if DAD "$interface" "$new_ip_address" ; then
-    AddINETAddr "$interface" "$new_ip_address" "$new_subnet_mask" "$new_broadcast_address" dhcp
-    UnsolicitedARP "$interface" "$new_ip_address"
-    if [ "$alias_ip_address" -a "$alias_ip_address" != "$new_ip_address" ]; then
-      AddINETAddr "$interface" "$alias_ip_address" "$alias_subnet_mask" "$alias_broadcast_address" dhcp1
-      UnsolicitedARP "$interface" "$alias_ip_address"
-    fi
-    if CheckRouterList "$new_routers" ; then
-	AddStaticRouteList "$new_static_routes"
-	UpdateDNS
-	exit 0
-    fi
-  fi
-  DelINETAddr "$interface" "$new_ip_address" "$new_subnet_mask" "$new_broadcast_address" dhcp
-  DelDefaultRoutes "$old_routers"
-  DelStaticRouteList "$old_static_routes"
-  if [ "$alias_ip_address" ]; then
-    AddINETAddr "$interface" "$alias_ip_address" "$alias_subnet_mask" "$alias_broadcast_address" dhcp1
-  fi
-  exit 1
-  ;;
-esac
-
-exit 0
-- 
2.19.0.rc2

^ permalink raw reply related

* [PATCH iproute2 5/7] configure: Code cleanup
From: Petr Vorel @ 2018-09-22 21:24 UTC (permalink / raw)
  To: netdev; +Cc: Petr Vorel, Stephen Hemminger
In-Reply-To: <20180922212451.327-1-petr.vorel@gmail.com>

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 configure | 65 +++++++++++++++----------------------------------------
 1 file changed, 18 insertions(+), 47 deletions(-)

diff --git a/configure b/configure
index 8f4a7f1e..86c4cf58 100755
--- a/configure
+++ b/configure
@@ -32,9 +32,7 @@ int main(int argc, char **argv) {
 }
 EOF
 
-    $CC -I$INCLUDE -o $TMPDIR/atmtest $TMPDIR/atmtest.c -latm >/dev/null 2>&1
-    if [ $? -eq 0 ]
-    then
+    if $CC -I$INCLUDE -o $TMPDIR/atmtest $TMPDIR/atmtest.c -latm >/dev/null 2>&1; then
 	echo "TC_CONFIG_ATM:=y" >>$CONFIG
 	echo yes
     else
@@ -45,8 +43,7 @@ EOF
 
 check_xtables()
 {
-	if ! ${PKG_CONFIG} xtables --exists
-	then
+	if ! ${PKG_CONFIG} xtables --exists; then
 		echo "TC_CONFIG_NO_XT:=y" >>$CONFIG
 	fi
 }
@@ -85,10 +82,7 @@ EOF
 check_xt_old()
 {
     # bail if previous XT checks has already succeded.
-    if grep -q TC_CONFIG_XT $CONFIG
-    then
-	return
-    fi
+    grep -q TC_CONFIG_XT $CONFIG && return
 
     #check if we dont need our internal header ..
     cat >$TMPDIR/ipttest.c <<EOF
@@ -112,9 +106,7 @@ int main(int argc, char **argv) {
 
 EOF
 
-    $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1
-    if [ $? -eq 0 ]
-    then
+    if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1; then
 	echo "TC_CONFIG_XT_OLD:=y" >>$CONFIG
 	echo "using old xtables (no need for xt-internal.h)"
     fi
@@ -124,10 +116,7 @@ EOF
 check_xt_old_internal_h()
 {
     # bail if previous XT checks has already succeded.
-    if grep -q TC_CONFIG_XT $CONFIG
-    then
-	return
-    fi
+    grep -q TC_CONFIG_XT $CONFIG && return
 
     #check if we need our own internal.h
     cat >$TMPDIR/ipttest.c <<EOF
@@ -151,10 +140,7 @@ int main(int argc, char **argv) {
 }
 
 EOF
-	$CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1
-
-	if [ $? -eq 0 ]
-	then
+	if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1; then
 	    echo "using old xtables with xt-internal.h"
 	    echo "TC_CONFIG_XT_OLD_H:=y" >>$CONFIG
 	fi
@@ -163,8 +149,7 @@ EOF
 
 check_ipt()
 {
-	if ! grep TC_CONFIG_XT $CONFIG > /dev/null
-	then
+	if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
 		echo "using iptables"
 	fi
 }
@@ -178,8 +163,7 @@ check_ipt_lib_dir()
 		return
 	fi
 
-	for dir in /lib /usr/lib /usr/local/lib
-	do
+	for dir in /lib /usr/lib /usr/local/lib; do
 		for file in "xtables" "iptables"; do
 			file="$dir/$file/lib*t_*so"
 			if [ -f $file ]; then
@@ -202,9 +186,7 @@ int main(int argc, char **argv)
 	return 0;
 }
 EOF
-    $CC -I$INCLUDE -o $TMPDIR/setnstest $TMPDIR/setnstest.c >/dev/null 2>&1
-    if [ $? -eq 0 ]
-    then
+    if $CC -I$INCLUDE -o $TMPDIR/setnstest $TMPDIR/setnstest.c >/dev/null 2>&1; then
 	echo "IP_CONFIG_SETNS:=y" >>$CONFIG
 	echo "yes"
 	echo "CFLAGS += -DHAVE_SETNS" >>$CONFIG
@@ -235,8 +217,7 @@ int main(void)
 #endif
 EOF
 
-    if $CC -I$INCLUDE -o $TMPDIR/ipsettest $TMPDIR/ipsettest.c >/dev/null 2>&1
-    then
+    if $CC -I$INCLUDE -o $TMPDIR/ipsettest $TMPDIR/ipsettest.c >/dev/null 2>&1; then
 	echo "TC_CONFIG_IPSET:=y" >>$CONFIG
 	echo "yes"
     else
@@ -247,8 +228,7 @@ EOF
 
 check_elf()
 {
-    if ${PKG_CONFIG} libelf --exists
-    then
+    if ${PKG_CONFIG} libelf --exists; then
 	echo "HAVE_ELF:=y" >>$CONFIG
 	echo "yes"
 
@@ -262,8 +242,7 @@ check_elf()
 check_selinux()
 # SELinux is a compile time option in the ss utility
 {
-	if ${PKG_CONFIG} libselinux --exists
-	then
+	if ${PKG_CONFIG} libselinux --exists; then
 		echo "HAVE_SELINUX:=y" >>$CONFIG
 		echo "yes"
 
@@ -276,8 +255,7 @@ check_selinux()
 
 check_mnl()
 {
-	if ${PKG_CONFIG} libmnl --exists
-	then
+	if ${PKG_CONFIG} libmnl --exists; then
 		echo "HAVE_MNL:=y" >>$CONFIG
 		echo "yes"
 
@@ -299,9 +277,7 @@ int main(int argc, char **argv) {
 	return 0;
 }
 EOF
-    $CC -I$INCLUDE -o $TMPDIR/dbtest $TMPDIR/dbtest.c -ldb >/dev/null 2>&1
-    if [ $? -eq 0 ]
-    then
+    if $CC -I$INCLUDE -o $TMPDIR/dbtest $TMPDIR/dbtest.c -ldb >/dev/null 2>&1; then
 	echo "HAVE_BERKELEY_DB:=y" >>$CONFIG
 	echo "yes"
     else
@@ -320,9 +296,7 @@ int main(int argc, char **argv) {
 	return 0;
 }
 EOF
-    $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1
-    if [ $? -eq 0 ]
-    then
+    if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then
 	echo "no"
     else
 	echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
@@ -333,8 +307,7 @@ EOF
 
 check_cap()
 {
-	if ${PKG_CONFIG} libcap --exists
-	then
+	if ${PKG_CONFIG} libcap --exists; then
 		echo "HAVE_CAP:=y" >>$CONFIG
 		echo "yes"
 
@@ -382,8 +355,7 @@ echo -n " ATM	"
 check_atm
 
 check_xtables
-if ! grep -q TC_CONFIG_NO_XT $CONFIG
-then
+if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
 	echo -n " IPT	"
 	check_xt
 	check_xt_old
@@ -395,8 +367,7 @@ then
 fi
 
 echo
-if ! grep -q TC_CONFIG_NO_XT $CONFIG
-then
+if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
 	echo -n "iptables modules directory: "
 	check_ipt_lib_dir
 fi
-- 
2.19.0.rc2

^ permalink raw reply related

* [PATCH iproute2 4/7] configure: Remove non-posix shell expansion
From: Petr Vorel @ 2018-09-22 21:24 UTC (permalink / raw)
  To: netdev; +Cc: Petr Vorel, Stephen Hemminger
In-Reply-To: <20180922212451.327-1-petr.vorel@gmail.com>

+ change shebang to /bin/sh

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 34325f99..8f4a7f1e 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 # This is not an autoconf generated configure
 #
@@ -180,7 +180,8 @@ check_ipt_lib_dir()
 
 	for dir in /lib /usr/lib /usr/local/lib
 	do
-		for file in $dir/{xtables,iptables}/lib*t_*so ; do
+		for file in "xtables" "iptables"; do
+			file="$dir/$file/lib*t_*so"
 			if [ -f $file ]; then
 				echo ${file%/*}
 				echo "IPT_LIB_DIR:=${file%/*}" >> $CONFIG
-- 
2.19.0.rc2

^ permalink raw reply related

* [PATCH iproute2 3/7] configure: Remove unused function check_prog()
From: Petr Vorel @ 2018-09-22 21:24 UTC (permalink / raw)
  To: netdev; +Cc: Petr Vorel, Stephen Hemminger
In-Reply-To: <20180922212451.327-1-petr.vorel@gmail.com>

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 configure | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/configure b/configure
index 5ef5cd4c..34325f99 100755
--- a/configure
+++ b/configure
@@ -11,12 +11,6 @@ CONFIG=config.mk
 TMPDIR=$(mktemp -d config.XXXXXX)
 trap 'status=$?; rm -rf $TMPDIR; exit $status' EXIT HUP INT QUIT TERM
 
-check_prog()
-{
-    echo -n "$2"
-    command -v $1 >/dev/null 2>&1 && (echo "$3:=y" >> $CONFIG; echo "yes") || (echo "no"; return 1)
-}
-
 check_toolchain()
 {
     : ${PKG_CONFIG:=pkg-config}
-- 
2.19.0.rc2

^ permalink raw reply related

* [PATCH iproute2 2/7] tests: Use /bin/sh shebang
From: Petr Vorel @ 2018-09-22 21:24 UTC (permalink / raw)
  To: netdev; +Cc: Petr Vorel, Stephen Hemminger
In-Reply-To: <20180922212451.327-1-petr.vorel@gmail.com>

Bashisms for both tests were removed in ecd44e68 ("tests: Remove
bashisms (s/source/.)"), so no need to use bash shebang.

+ remove trailing whitespace.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 testsuite/tests/tc/cls-testbed.t | 4 ++--
 testsuite/tests/tc/dsmark.t      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/testsuite/tests/tc/cls-testbed.t b/testsuite/tests/tc/cls-testbed.t
index d5c21e5c..cf34dd63 100755
--- a/testsuite/tests/tc/cls-testbed.t
+++ b/testsuite/tests/tc/cls-testbed.t
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # vim: ft=sh
 
 . lib/generic.sh
@@ -61,7 +61,7 @@ for q in ${QDISCS}; do
 		ts_tc "cls-testbed" "tree listing" qdisc list dev eth0
 		ts_tc "cls-testbed" "tree class listing" class list dev eth0
 		ts_log "cls-testbed: starting classifier test $c"
-		$c 
+		$c
 
 		case "$q" in
 		*)
diff --git a/testsuite/tests/tc/dsmark.t b/testsuite/tests/tc/dsmark.t
index 177585e6..3f1d5ef2 100755
--- a/testsuite/tests/tc/dsmark.t
+++ b/testsuite/tests/tc/dsmark.t
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # vim: ft=sh
 
 . lib/generic.sh
-- 
2.19.0.rc2

^ permalink raw reply related

* [PATCH iproute2 1/7] man: rtpr: Rename s/bash/shell/
From: Petr Vorel @ 2018-09-22 21:24 UTC (permalink / raw)
  To: netdev; +Cc: Petr Vorel, Stephen Hemminger
In-Reply-To: <20180922212451.327-1-petr.vorel@gmail.com>

ip/rtpr mentioned in man as bash script is actually posix shell script
(doesn't require to use bash).

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 man/man8/rtpr.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/man8/rtpr.8 b/man/man8/rtpr.8
index 1b04a821..87f291ab 100644
--- a/man/man8/rtpr.8
+++ b/man/man8/rtpr.8
@@ -5,7 +5,7 @@ rtpr \- replace backslashes with newlines.
 
 .SH DESCRIPTION
 .B rtpr
-is a trivial bash script which converts backslashes in standard input to newlines. It's sole purpose is to be fed with input from
+is a trivial shell script which converts backslashes in standard input to newlines. It's sole purpose is to be fed with input from
 .B ip
 when executed with it's
 .B --oneline
-- 
2.19.0.rc2

^ permalink raw reply related

* [PATCH iproute2 0/7] Minor shell code cleanup
From: Petr Vorel @ 2018-09-22 21:24 UTC (permalink / raw)
  To: netdev; +Cc: Petr Vorel, Stephen Hemminger

Hi,

this patchset does minor cleanup in shell scripts:
* remove bashisms
* use /bin/sh shebang
* remove obsolete code from examples
* remove unused code

Kind regards,
Petr

Petr Vorel (7):
  man: rtpr: Rename s/bash/shell/
  tests: Use /bin/sh shebang
  configure: Remove unused function check_prog()
  configure: Remove non-posix shell expansion
  configure: Code cleanup
  examples: Remove dhcp-client-script
  examples: Remove cbq.init-v0.7.3

 configure                        |  76 +--
 examples/cbq.init-v0.7.3         | 983 -------------------------------
 examples/dhcp-client-script      | 446 --------------
 man/man8/rtpr.8                  |   2 +-
 testsuite/tests/tc/cls-testbed.t |   4 +-
 testsuite/tests/tc/dsmark.t      |   2 +-
 6 files changed, 25 insertions(+), 1488 deletions(-)
 delete mode 100644 examples/cbq.init-v0.7.3
 delete mode 100644 examples/dhcp-client-script

-- 
2.19.0.rc2

^ permalink raw reply

* Re: [PATCH net-next v2] net: phy: don't reschedule state machine when PHY is halted
From: Florian Fainelli @ 2018-09-22 19:21 UTC (permalink / raw)
  To: Heiner Kallweit, Andrew Lunn, David Miller; +Cc: netdev@vger.kernel.org
In-Reply-To: <47ddfc78-61ce-3ebd-df10-ca291620c61f@gmail.com>



On September 20, 2018 1:34:25 PM PDT, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>When being in state PHY_HALTED we don't have to reschedule the
>state machine, phy_start() will start it again.
>
>Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* Re: [PATCH] net: phy: phylink: fix SFP interface autodetection
From: Russell King - ARM Linux @ 2018-09-22 19:18 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Andrew Lunn, Florian Fainelli, netdev, Antoine Tenart,
	Gregory CLEMENT
In-Reply-To: <be339ca81893a87e382a41da84d17850a4cfe940.1537643384.git.baruch@tkos.co.il>

On Sat, Sep 22, 2018 at 10:09:44PM +0300, Baruch Siach wrote:
> When connecting a PHY to phylink use the detected interface. Otherwise,
> the link fails to come up when the configured 'phy-mode' differs from
> the SFP detected mode.
> 
> This fixes 1GB SFP module link up on eth3 of the Macchiatobin board that
> is configured in the DT to "2500base-x" phy-mode.

What I actually meant is that a PHY attached from a SFP interface
should use link_config.interface.  A PHY attached as not part of
a SFP interface should continue using the DT-parsed link_interface.

What I envisaged seeing is phylink_connect_phy() being renamed to
__phylink_connect_phy(), and taking the phy interface,
phylink_sfp_connect_phy() calling __phylink_connect_phy() with
link_config.interface, and a replacement phylink_connect_phy() which
called __phylink_connect_phy() with link_interface.

Sorry I wasn't explicit enough last time around.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up
According to speedtest.net: 13Mbps down 490kbps up

^ permalink raw reply

* [PATCH] net: phy: phylink: fix SFP interface autodetection
From: Baruch Siach @ 2018-09-22 19:09 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli
  Cc: netdev, Russell King, Antoine Tenart, Gregory CLEMENT,
	Baruch Siach

When connecting a PHY to phylink use the detected interface. Otherwise,
the link fails to come up when the configured 'phy-mode' differs from
the SFP detected mode.

This fixes 1GB SFP module link up on eth3 of the Macchiatobin board that
is configured in the DT to "2500base-x" phy-mode.

Fixes: 9525ae83959b6 ("phylink: add phylink infrastructure")
Suggested-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 drivers/net/phy/phylink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 3ba5cf2a8a5f..aa745decc81d 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -738,7 +738,7 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
 
 	if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
 		    (pl->link_an_mode == MLO_AN_INBAND &&
-		     phy_interface_mode_is_8023z(pl->link_interface))))
+		     phy_interface_mode_is_8023z(pl->link_config.interface))))
 		return -EINVAL;
 
 	if (pl->phydev)
@@ -750,7 +750,7 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
 		pl->link_config.interface = pl->link_interface;
 	}
 
-	ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface);
+	ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_config.interface);
 	if (ret)
 		return ret;
 
-- 
2.19.0

^ permalink raw reply related

* Re: [PATCH net-next,v2,0/3] hv_netvsc: Support LRO/RSC in the vSwitch
From: David Miller @ 2018-09-23  0:23 UTC (permalink / raw)
  To: haiyangz, haiyangz; +Cc: olaf, sthemmin, netdev, linux-kernel, devel, vkuznets
In-Reply-To: <20180921182037.10077-1-haiyangz@linuxonhyperv.com>

From: Haiyang Zhang <haiyangz@linuxonhyperv.com>
Date: Fri, 21 Sep 2018 18:20:34 +0000

> From: Haiyang Zhang <haiyangz@microsoft.com>
> 
> The patch adds support for LRO/RSC in the vSwitch feature. It reduces
> the per packet processing overhead by coalescing multiple TCP segments
> when possible. The feature is enabled by default on VMs running on
> Windows Server 2019 and later.
> 
> The patch set also adds ethtool command handler and documents.

Series applied, thank you.

^ permalink raw reply

* Re: [PATCH net] net: phy: fix WoL handling when suspending the PHY
From: Heiner Kallweit @ 2018-09-22 17:32 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Florian Fainelli, David Miller, Realtek linux nic maintainers,
	netdev@vger.kernel.org
In-Reply-To: <20180922164441.GB13316@lunn.ch>

On 22.09.2018 18:44, Andrew Lunn wrote:
> On Sat, Sep 22, 2018 at 01:32:55AM +0200, Heiner Kallweit wrote:
>> Actually there's nothing wrong with the two changes, they just
>> revealed a problem which has been existing before.
> 
> Hi Heiner
> 
> This is missing a bit of context. Which two changes? I assume you mean
> the two Fixes:
> 
Right. I should have mentioned that the actual trigger were
reported problems with WoL.

>>
>> Core of the problem is that phy_suspend() suspends the PHY when it
>> should not because of WoL. phy_suspend() checks for WoL already, but
>> this works only if the PHY driver handles WoL (what is rarely the case).
>> Typically WoL is handled by the MAC driver.
>>
>> phylib knows about this and handles it in mdio_bus_phy_may_suspend(),
>> but that's used only when suspending the system, not in other cases
>> like shutdown.
>>
>> This patch basically moves the check for WoL having been activated
>> by the MAC driver into phy_suspend(). mdio_bus_phy_resume() now
>> resumes the PHY only if it's actually suspended. Also don't do
>> anything in phy_suspend() if the PHY is suspended already.
>>
>> Last but not least change phy_detach() to call phy_suspend() before
>> attached_dev is set to NULL. phy_suspend() accesses attached_dev
>> when checking whether the MAC driver activated WoL.
> 
> This sounds like it should be multiple patches, not one. Can it be
> split, or is there two much inter connectivity? Being able to bisect
> could be useful here.
> 
I could split it to two patches:
1. Add phy_may_suspend() and use it in phy_suspend()
2. Remove mdio_bus_phy_may_suspend() and change mdio_bus_phy_suspend()
   and mdio_bus_phy_resume()

Heiner

>       Thanks
> 	Andrew
> 

^ permalink raw reply

* [net-next:master 569/583] htmldocs: include/linux/skbuff.h:860: warning: Function parameter or member 'skb_mstamp_ns' not described in 'sk_buff'
From: kbuild test robot @ 2018-09-22 10:40 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: kbuild-all, netdev

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   bd4d08daeb959234a9f8365037b0fefa6ae790c6
commit: d3edd06ea8ea9e03de6567fda80b8be57e21a537 [569/583] tcp: provide earliest departure time in skb->tstamp
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   include/net/cfg80211.h:4882: warning: Excess function parameter 'ptr' description in 'reg_query_regdb_wmm'
   include/net/cfg80211.h:4882: warning: Excess function parameter 'ptr' description in 'reg_query_regdb_wmm'
   include/net/cfg80211.h:4882: warning: Excess function parameter 'ptr' description in 'reg_query_regdb_wmm'
   include/net/cfg80211.h:4882: warning: Excess function parameter 'ptr' description in 'reg_query_regdb_wmm'
   include/net/cfg80211.h:4882: warning: Excess function parameter 'ptr' description in 'reg_query_regdb_wmm'
   include/net/mac80211.h:2367: warning: Function parameter or member 'radiotap_timestamp.units_pos' not described in 'ieee80211_hw'
   include/net/mac80211.h:2367: warning: Function parameter or member 'radiotap_timestamp.accuracy' not described in 'ieee80211_hw'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.rates' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.rts_cts_rate_idx' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.use_rts' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.use_cts_prot' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.short_preamble' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.skip_table' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.jiffies' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.vif' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.hw_key' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.flags' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'control.enqueue_time' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'ack' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'ack.cookie' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'status.rates' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'status.ack_signal' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'status.ampdu_ack_len' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'status.ampdu_len' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'status.antenna' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'status.tx_time' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'status.is_valid_ack_signal' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'status.status_driver_data' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'driver_rates' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'pad' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:978: warning: Function parameter or member 'rate_driver_data' not described in 'ieee80211_tx_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'rx_stats_avg' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'rx_stats_avg.signal' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'rx_stats_avg.chain_signal' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.filtered' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.retry_failed' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.retry_count' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.lost_packets' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.last_tdls_pkt_time' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.msdu_retries' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.msdu_failed' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.last_ack' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.last_ack_signal' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.ack_signal_filled' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.avg_ack_signal' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.packets' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.bytes' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.last_rate' not described in 'sta_info'
   net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.msdu' not described in 'sta_info'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_excl.cb' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_excl.poll' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_excl.active' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_shared.cb' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_shared.poll' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_shared.active' not described in 'dma_buf'
   include/linux/dma-fence-array.h:54: warning: Function parameter or member 'work' not described in 'dma_fence_array'
   include/linux/gpio/driver.h:142: warning: Function parameter or member 'request_key' not described in 'gpio_irq_chip'
   include/linux/iio/hw-consumer.h:1: warning: no structured comments found
   include/linux/input/sparse-keymap.h:46: warning: Function parameter or member 'sw' not described in 'key_entry'
   drivers/pci/pci.c:218: warning: Excess function parameter 'p' description in 'pci_dev_str_match_path'
   include/linux/regulator/driver.h:227: warning: Function parameter or member 'resume' not described in 'regulator_ops'
   drivers/regulator/core.c:4479: warning: Excess function parameter 'state' description in 'regulator_suspend'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw0' not described in 'irb'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw1' not described in 'irb'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw2' not described in 'irb'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw3' not described in 'irb'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.eadm' not described in 'irb'
   drivers/slimbus/stream.c:1: warning: no structured comments found
   drivers/target/target_core_device.c:1: warning: no structured comments found
   drivers/usb/typec/bus.c:1: warning: no structured comments found
   drivers/usb/typec/class.c:1: warning: no structured comments found
   include/linux/w1.h:281: warning: Function parameter or member 'of_match_table' not described in 'w1_family'
   fs/direct-io.c:257: warning: Excess function parameter 'offset' description in 'dio_complete'
   fs/file_table.c:1: warning: no structured comments found
   fs/libfs.c:477: warning: Excess function parameter 'available' description in 'simple_write_end'
   fs/posix_acl.c:646: warning: Function parameter or member 'inode' not described in 'posix_acl_update_mode'
   fs/posix_acl.c:646: warning: Function parameter or member 'mode_p' not described in 'posix_acl_update_mode'
   fs/posix_acl.c:646: warning: Function parameter or member 'acl' not described in 'posix_acl_update_mode'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:183: warning: Function parameter or member 'blockable' not described in 'amdgpu_mn_read_lock'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:254: warning: Function parameter or member 'blockable' not described in 'amdgpu_mn_invalidate_range_start_gfx'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:302: warning: Function parameter or member 'blockable' not described in 'amdgpu_mn_invalidate_range_start_hsa'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3011: warning: Excess function parameter 'dev' description in 'amdgpu_vm_get_task_info'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3012: warning: Function parameter or member 'adev' not described in 'amdgpu_vm_get_task_info'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3012: warning: Excess function parameter 'dev' description in 'amdgpu_vm_get_task_info'
   include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_pin' not described in 'drm_driver'
   include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_unpin' not described in 'drm_driver'
   include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_res_obj' not described in 'drm_driver'
   include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_get_sg_table' not described in 'drm_driver'
   include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_import_sg_table' not described in 'drm_driver'
   include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_vmap' not described in 'drm_driver'
   include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_vunmap' not described in 'drm_driver'
   include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_mmap' not described in 'drm_driver'
   include/drm/drm_panel.h:98: warning: Function parameter or member 'link' not described in 'drm_panel'
   drivers/gpu/drm/i915/i915_vma.h:49: warning: cannot understand function prototype: 'struct i915_vma '
   drivers/gpu/drm/i915/i915_vma.h:1: warning: no structured comments found
   drivers/gpu/drm/i915/intel_guc_fwif.h:553: warning: cannot understand function prototype: 'struct guc_log_buffer_state '
   drivers/gpu/drm/i915/i915_trace.h:1: warning: no structured comments found
   include/linux/skbuff.h:860: warning: Function parameter or member 'dev_scratch' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'list' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'ip_defrag_offset' not described in 'sk_buff'
>> include/linux/skbuff.h:860: warning: Function parameter or member 'skb_mstamp_ns' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member '__cloned_offset' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'head_frag' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member '__pkt_type_offset' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'encapsulation' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'encap_hdr_csum' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'csum_valid' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'csum_complete_sw' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'csum_level' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'inner_protocol_type' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'remcsum_offload' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'offload_fwd_mark' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'offload_mr_fwd_mark' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'sender_cpu' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'reserved_tailroom' not described in 'sk_buff'
   include/linux/skbuff.h:860: warning: Function parameter or member 'inner_ipproto' not described in 'sk_buff'
   include/net/sock.h:238: warning: Function parameter or member 'skc_addrpair' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_portpair' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_ipv6only' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_net_refcnt' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_v6_daddr' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_v6_rcv_saddr' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_cookie' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_listener' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_tw_dr' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_rcv_wnd' not described in 'sock_common'
   include/net/sock.h:238: warning: Function parameter or member 'skc_tw_rcv_nxt' not described in 'sock_common'
   include/net/sock.h:509: warning: Function parameter or member 'sk_backlog.rmem_alloc' not described in 'sock'
   include/net/sock.h:509: warning: Function parameter or member 'sk_backlog.len' not described in 'sock'
   include/net/sock.h:509: warning: Function parameter or member 'sk_backlog.head' not described in 'sock'
   include/net/sock.h:509: warning: Function parameter or member 'sk_backlog.tail' not described in 'sock'
   include/net/sock.h:509: warning: Function parameter or member 'sk_wq_raw' not described in 'sock'
   include/net/sock.h:509: warning: Function parameter or member 'tcp_rtx_queue' not described in 'sock'
   include/net/sock.h:509: warning: Function parameter or member 'sk_route_forced_caps' not described in 'sock'
   include/net/sock.h:509: warning: Function parameter or member 'sk_txtime_report_errors' not described in 'sock'
   include/net/sock.h:509: warning: Function parameter or member 'sk_validate_xmit_skb' not described in 'sock'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'adj_list.upper' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'adj_list.lower' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'gso_partial_features' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'switchdev_ops' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'l3mdev_ops' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'xfrmdev_ops' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'tlsdev_ops' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'name_assign_type' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'ieee802154_ptr' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'mpls_ptr' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'xdp_prog' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'gro_flush_timeout' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'nf_hooks_ingress' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member '____cacheline_aligned_in_smp' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'qdisc_hash' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'xps_cpus_map' not described in 'net_device'
   include/linux/netdevice.h:2043: warning: Function parameter or member 'xps_rxqs_map' not described in 'net_device'
   include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising' not described in 'phylink_link_state'
   include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising' not described in 'phylink_link_state'
   sound/soc/soc-core.c:2918: warning: Excess function parameter 'legacy_dai_naming' description in 'snd_soc_register_dais'
   Documentation/admin-guide/cgroup-v2.rst:1485: WARNING: Block quote ends without a blank line; unexpected unindent.
   Documentation/admin-guide/cgroup-v2.rst:1487: WARNING: Block quote ends without a blank line; unexpected unindent.
   Documentation/admin-guide/cgroup-v2.rst:1488: WARNING: Block quote ends without a blank line; unexpected unindent.
   Documentation/core-api/boot-time-mm.rst:78: ERROR: Error in "kernel-doc" directive:
   unknown option: "nodocs".

vim +860 include/linux/skbuff.h

^1da177e Linus Torvalds 2005-04-16 @860  

:::::: The code at line 860 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

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

^ permalink raw reply

* Re: [PATCH rdma-next v1 0/7] Preparation to DevX extension series
From: Jason Gunthorpe @ 2018-09-22 17:02 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Leon Romanovsky, RDMA mailing list, Yishai Hadas,
	Saeed Mahameed, linux-netdev
In-Reply-To: <20180920183526.13995-1-leon@kernel.org>

On Thu, Sep 20, 2018 at 09:35:19PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Changelog v0->v1:
>  * Update commit messages
>  * Split DevX series to small sub-series.
>  * Change static initialization from {0} to be {}
> 
> 
> Set uid as part of various IB commands so that the firmware can manage
> the IB object in a secured way.
> 
> The firmware should mark this IB object with the given uid so that it
> can be used later on only by objects with the same uid.
> 
> Upon DEVX flows that use this objec, the pointed object must have
> the same uid as of the issuer uid command.
> 
> When a command is issued with uid=0 it means that the issuer of the
> command is trusted (i.e. kernel), in that case any pointed object
> can be used regardless of its uid.
> 
> Thanks
> 
> Leon Romanovsky (1):
>   net/mlx5: Update mlx5_ifc with DEVX UID bits
> 
> Yishai Hadas (6):
>   net/mlx5: Set uid as part of CQ commands
>   net/mlx5: Set uid as part of QP commands
>   net/mlx5: Set uid as part of RQ commands
>   net/mlx5: Set uid as part of SQ commands
>   net/mlx5: Set uid as part of SRQ commands
>   net/mlx5: Set uid as part of DCT commands

This and the next series look OK to me. Let me know when it is applied
to the mlx branch

Thanks,
Jason

^ permalink raw reply

* Re: [PATCH net] net: phy: fix WoL handling when suspending the PHY
From: Andrew Lunn @ 2018-09-22 16:44 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Florian Fainelli, David Miller, Realtek linux nic maintainers,
	netdev@vger.kernel.org
In-Reply-To: <4dbcdd2c-96c2-2921-5016-affc8fce1d19@gmail.com>

On Sat, Sep 22, 2018 at 01:32:55AM +0200, Heiner Kallweit wrote:
> Actually there's nothing wrong with the two changes, they just
> revealed a problem which has been existing before.

Hi Heiner

This is missing a bit of context. Which two changes? I assume you mean
the two Fixes:

> 
> Core of the problem is that phy_suspend() suspends the PHY when it
> should not because of WoL. phy_suspend() checks for WoL already, but
> this works only if the PHY driver handles WoL (what is rarely the case).
> Typically WoL is handled by the MAC driver.
> 
> phylib knows about this and handles it in mdio_bus_phy_may_suspend(),
> but that's used only when suspending the system, not in other cases
> like shutdown.
> 
> This patch basically moves the check for WoL having been activated
> by the MAC driver into phy_suspend(). mdio_bus_phy_resume() now
> resumes the PHY only if it's actually suspended. Also don't do
> anything in phy_suspend() if the PHY is suspended already.
> 
> Last but not least change phy_detach() to call phy_suspend() before
> attached_dev is set to NULL. phy_suspend() accesses attached_dev
> when checking whether the MAC driver activated WoL.

This sounds like it should be multiple patches, not one. Can it be
split, or is there two much inter connectivity? Being able to bisect
could be useful here.

      Thanks
	Andrew

^ permalink raw reply

* [PATCH net] net: sched: act_ipt: check for underflow in __tcf_ipt_init()
From: Dan Carpenter @ 2018-09-22 13:46 UTC (permalink / raw)
  To: Jamal Hadi Salim, Patrick McHardy
  Cc: Cong Wang, Jiri Pirko, David S. Miller, netdev, kernel-janitors

If "td->u.target_size" is larger than sizeof(struct xt_entry_target) we
return -EINVAL.  But we don't check whether it's smaller than
sizeof(struct xt_entry_target) and that could lead to an out of bounds
read.

Fixes: 7ba699c604ab ("[NET_SCHED]: Convert actions from rtnetlink to new netlink API")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I haven't tested this.  Please review carefully.

diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 1efbfb10b1fc..8af6c11d2482 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -135,7 +135,7 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla,
 	}
 
 	td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]);
-	if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) {
+	if (nla_len(tb[TCA_IPT_TARG]) != td->u.target_size) {
 		if (exists)
 			tcf_idr_release(*a, bind);
 		else

^ permalink raw reply related

* Re: [PATCH net 02/15] bonding: use netpoll_poll_dev() helper
From: Jay Vosburgh @ 2018-09-22 10:23 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, netdev, Michael Chan, Ariel Elior, Eric Dumazet,
	Tariq Toukan, Saeed Mahameed, Jeff Kirsher, Jakub Kicinski,
	Song Liu, Veaceslav Falico, Andy Gospodarek
In-Reply-To: <20180921222752.101307-3-edumazet@google.com>

Eric Dumazet <edumazet@google.com> wrote:

>We want to allow NAPI drivers to no longer provide
>ndo_poll_controller() method, as it has been proven problematic.
>
>team driver must not look at its presence, but instead call
>netpoll_poll_dev() which factorize the needed actions.

	This patch is for bonding, not team; otherwise LGTM.

Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>

	-J


>Signed-off-by: Eric Dumazet <edumazet@google.com>
>Cc: Jay Vosburgh <j.vosburgh@gmail.com>
>Cc: Veaceslav Falico <vfalico@gmail.com>
>Cc: Andy Gospodarek <andy@greyhouse.net>
>---
> drivers/net/bonding/bond_main.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index a764a83f99dabe54585dbad7dba40b6601177c03..0d87e11e7f1d84537fe43d95249b1bd3a2ce291d 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -971,16 +971,13 @@ static void bond_poll_controller(struct net_device *bond_dev)
> 	struct slave *slave = NULL;
> 	struct list_head *iter;
> 	struct ad_info ad_info;
>-	struct netpoll_info *ni;
>-	const struct net_device_ops *ops;
> 
> 	if (BOND_MODE(bond) == BOND_MODE_8023AD)
> 		if (bond_3ad_get_active_agg_info(bond, &ad_info))
> 			return;
> 
> 	bond_for_each_slave_rcu(bond, slave, iter) {
>-		ops = slave->dev->netdev_ops;
>-		if (!bond_slave_is_up(slave) || !ops->ndo_poll_controller)
>+		if (!bond_slave_is_up(slave))
> 			continue;
> 
> 		if (BOND_MODE(bond) == BOND_MODE_8023AD) {
>@@ -992,11 +989,7 @@ static void bond_poll_controller(struct net_device *bond_dev)
> 				continue;
> 		}
> 
>-		ni = rcu_dereference_bh(slave->dev->npinfo);
>-		if (down_trylock(&ni->dev_lock))
>-			continue;
>-		ops->ndo_poll_controller(slave->dev);
>-		up(&ni->dev_lock);
>+		netpoll_poll_dev(slave->dev);
> 	}
> }
> 
>-- 
>2.19.0.444.g18242da7ef-goog
>

^ permalink raw reply

* Re: [PATCH net-next v5 02/20] zinc: introduce minimal cryptography library
From: Arnd Bergmann @ 2018-09-22 16:11 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: Ard Biesheuvel, Eric Biggers, Linux Kernel Mailing List,
	Networking, open list:HARDWARE RANDOM NUMBER GENERATOR CORE,
	David Miller, gregkh, Samuel Neves, Andy Lutomirski,
	Jean-Philippe Aumasson
In-Reply-To: <CAHmME9rJq=q7xj_E_84GN5FuzSW2KdP4Ch=y527Lem0ME4GnLg@mail.gmail.com>

On Thu, Sep 20, 2018 at 5:12 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> Hey Arnd,
>
> On Thu, Sep 20, 2018 at 6:02 PM Arnd Bergmann <arnd@arndb.de> wrote:
> > Right, if you hit a stack requirement like this, it's usually the compiler
> > doing something bad, not just using too much stack but also generating
> > rather slow object code in the process. It's better to fix the bug by
> > optimizing the code to not spill registers to the stack.
> >
> > In the long run, I'd like to reduce the stack frame size further, so
> > best assume that anything over 1024 bytes (on 32-bit) or 1280 bytes
> > (on 64-bit) is a bug in the code, and stay below that.
> >
> > For prototyping, you can just mark the broken functions individually
> > by setting the warning limit for a specific function that is known to
> > be misoptimized by the compiler (with a comment about which compiler
> > and architectures are affected), but not override the limit for the
> > entire file.
>
> Thanks for the explanation. Fortunately in my case, the issues were
> trivially fixable to get it under 1024/1280

A lot of these bugs are not trivial, but we still need a full analysis of what
failed and what the possible mititgations are. Can you describe more
specifically what causes it?

> (By the way, why does
> 64-bit have a slightly larger stack frame? To account for 32 pointers
> taking double the space or something?) That will be rectified in v6.

Correct. We have some functions in the kernel that take 128 pointers
on the stack. This fits fine within the 1024 byte limit on 32 bit, but goes
beyond the same limit on 64 bit. Everything that took more than 1280
bytes (without KASAN) in my analysis was a real problem and reducing
the stack size fixed a bug or improved the code in other ways. I never got
around to reposting all those bug fixes I made back then, and there are
probably a couple new ones we'd need.

> There is one exception though: sometimes KASAN bloats the frame on
> 64-bit compiles. How would you feel about me adding
> 'ccflags-$(CONFIG_KASAN) += -Wframe-larger-than=16384' in my makefile?

I ran into several ciphers in the kernel that required a large stack allocation,
with or without KASAN. Typically these turned out to be optimization bugs
in gcc where gcc tried to be smart about optimizing part of the cipher that
was intentionally designed to not be optimizable, but in the process it
ended up spilling registers to the stack. Adding KASAN into the mix then
added an extra redzone around each of those.

My best approach here was to figure out which optimization step in gcc
caused the register spilling in the first place, and adjust the set of
optimizations done to a specific function in that cipher.

Note that some crypto ciphers are rather performance sensitive and we
have users that care about every percent of performance one can get
out. The bugs that cause the stack size explode beyond a few hundred
bytes that one might expect are usually the same bugs that make the
ciphers much slower than they should be even without KASAN.

For a cryptographic library it might therefore even make sense to have an
even smaller limit (e.g. 400 bytes) in the Makefile and then audit each
case that does not fit into that after determining what exactly caused the
problem, and making sure we find  workaround that produces optmized
object code. When you end up with a function that gcc-8 still
misoptimizes in all optmization levels and you find no other workaround,
please set the higher limit specifically for that function with a gcc version
check in it, and add a comment pointing to the gcc bugzilla report you
have. gcc developers tend to be good about fixing these issues in new
compilers, but the version check helps to ensure we find it if a future
version regresses again, and of course we have to make sure we apply
the hack on all unpatched compilers.

> I'm not remotely close to reaching that limit (it's just a tiny bit
> over 1280), but it does seem like telling gcc to quiet down about
> stack frames when KASAN is being used might make sense. Alternatively,
> I see the defaults for FRAME_WARN are:
>
> config FRAME_WARN
>        int "Warn for stack frames larger than (needs gcc 4.4)"
>        range 0 8192
>        default 3072 if KASAN_EXTRA
>        default 2048 if GCC_PLUGIN_LATENT_ENTROPY
>        default 1280 if (!64BIT && PARISC)
>        default 1024 if (!64BIT && !PARISC)
>        default 2048 if 64BIT
>
> What about changing that KASAN_EXTRA into just KASAN? This seems
> cleanest; I'll send a patch for it.

I saw you already posted a patch for that, sorry for not being able to
reply earlier. I actually spent several months of my work to introduce
the KASAN_EXTRA option specifically in order to have a separate
stack size limit for that, so I definitely object to that one. We need the
default (allmodconfig) stack size check to be as small as we can in
order to catch kernel and gcc bugs that bloat the stack more than
it is currently at.

> On the other hand, this KASAN behavior is only observable on 64-bit
> systems when I force it to be 1280, whereas the default is still 2048,
> so probably this isn't a problem *now* for this patchset. But it is
> something to think about for down the road when you lower the default
> frame.

Right. Some background about that limit: 2048 has been what we used
traditionally on 64-bit before KASAN. When I first saw the problems
with KASAN, I had a more detailed look at it and found that we can
significantly reduce it without KASAN, but obviously KASAN needs a
little extra space. I got all my patches upstream to get the KASAN
limit below 2048 and remove that special case for it, and I sent a
lot of the other patches to reduce the limit further to 1280/1535
without/with KASAN, but not all those patches got accepted, so for
the moment that traditional limit is still in place.

clang with KASAN still has known bugs that make it go beyond
2048 bytes, as I said in the other thread, and this is something that
first needs to be addressed in clang before we can take specific
measures in the kernel to work around any remaining unrelated
bugs with clang building our kernel with KASAN.

        Arnd

^ 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