diff mbox series

[net-next,3/4] net: warn if transport header was not set

Message ID 20220509190851.1107955-4-eric.dumazet@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: CONFIG_DEBUG_NET and friends | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5737 this patch: 5737
netdev/cc_maintainers warning 1 maintainers not CCed: imagedong@tencent.com
netdev/build_clang success Errors and warnings before: 1137 this patch: 1137
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 5881 this patch: 5881
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Eric Dumazet May 9, 2022, 7:08 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

Make sure skb_transport_header() and skb_transport_offset() uses
are not fooled if the transport header has not been set.

This change will likely expose existing bugs in linux networking stacks.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/linux/skbuff.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

kernel test robot May 9, 2022, 11:31 p.m. UTC | #1
Hi Eric,

I love your patch! Perhaps something to improve:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d
config: arm-oxnas_v6_defconfig (https://download.01.org/0day-ci/archive/20220510/202205100723.9Wqso3nI-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
        git checkout d316b61f313a417d7dfa97fa006320288f3af150
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/ethernet/stmicro/stmmac/ drivers/net/mdio/ net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from include/linux/phy.h:16,
                    from include/linux/fwnode_mdio.h:9,
                    from drivers/net/mdio/of_mdio.c:13:
>> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                                    ^~~~~~~~~~
   include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       9 | void netdev_emerg(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      11 | void netdev_alert(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      13 | void netdev_crit(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                              ^~~~~~~~~~
   include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      19 | void netdev_notice(const struct net_device *dev, const char *format, ...);
         |                                 ^~~~~~~~~~
   include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   drivers/net/mdio/of_mdio.c: In function 'of_phy_get_and_connect':
   drivers/net/mdio/of_mdio.c:326:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     326 |                         netdev_err(dev, "broken fixed-link specification\n");
         |                                    ^~~
         |                                    |
         |                                    struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from include/linux/phy.h:16,
                    from include/linux/fwnode_mdio.h:9,
                    from drivers/net/mdio/of_mdio.c:13:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/skbuff.h:45,
                    from include/linux/ip.h:16,
                    from drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:20:
>> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                                    ^~~~~~~~~~
   include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       9 | void netdev_emerg(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      11 | void netdev_alert(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      13 | void netdev_crit(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                              ^~~~~~~~~~
   include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      19 | void netdev_notice(const struct net_device *dev, const char *format, ...);
         |                                 ^~~~~~~~~~
   include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   In file included from include/linux/skbuff.h:45,
                    from include/linux/ip.h:16,
                    from drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:20:
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_eee_init':
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:486:40: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types]
     486 |                         netdev_dbg(priv->dev, "disable EEE\n");
         |                                    ~~~~^~~~~
         |                                        |
         |                                        struct net_device *
   include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg'
      61 |                 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
         |                                           ^~~~~
   include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:520:24: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types]
     520 |         netdev_dbg(priv->dev, "Energy-Efficient Ethernet initialized\n");
         |                    ~~~~^~~~~
         |                        |
         |                        struct net_device *
   include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg'
      61 |                 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
         |                                           ^~~~~
   include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_get_tx_hwtstamp':
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:560:32: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types]
     560 |                 netdev_dbg(priv->dev, "get valid TX hw timestamp %llu\n", ns);
         |                            ~~~~^~~~~
         |                                |
         |                                struct net_device *
   include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg'
      61 |                 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
         |                                           ^~~~~
   include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_get_rx_hwtstamp':
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:594:32: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types]
     594 |                 netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns);
         |                            ~~~~^~~~~
         |                                |
         |                                struct net_device *
   include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg'
      61 |                 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
         |                                           ^~~~~
   include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:599:32: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types]
     599 |                 netdev_dbg(priv->dev, "cannot get RX hw timestamp\n");
         |                            ~~~~^~~~~
         |                                |
         |                                struct net_device *
   include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg'
      61 |                 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
         |                                           ^~~~~
   include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_hwtstamp_set':
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:628:34: error: passing argument 1 of 'netdev_alert' from incompatible pointer type [-Werror=incompatible-pointer-types]
     628 |                 netdev_alert(priv->dev, "No support for HW time stamping\n");
         |                              ~~~~^~~~~
         |                                  |
         |                                  struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from include/linux/ip.h:16,
                    from drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:20:
   include/net/net_debug.h:11:44: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      11 | void netdev_alert(const struct net_device *dev, const char *format, ...);
         |                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:639:24: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types]
     639 |         netdev_dbg(priv->dev, "%s config flags:0x%x, tx_type:0x%x, rx_filter:0x%x\n",
         |                    ~~~~^~~~~
         |                        |
--
   In file included from include/linux/skbuff.h:45,
                    from include/linux/if_ether.h:19,
                    from include/linux/etherdevice.h:20,
                    from drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:11:
>> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                                    ^~~~~~~~~~
   include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       9 | void netdev_emerg(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      11 | void netdev_alert(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      13 | void netdev_crit(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                              ^~~~~~~~~~
   include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      19 | void netdev_notice(const struct net_device *dev, const char *format, ...);
         |                                 ^~~~~~~~~~
   include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c: In function 'stmmac_ethtool_op_set_eee':
   drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:803:33: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
     803 |                 netdev_warn(priv->dev,
         |                             ~~~~^~~~~
         |                                 |
         |                                 struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from include/linux/if_ether.h:19,
                    from include/linux/etherdevice.h:20,
                    from drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:11:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from include/linux/linkmode.h:5,
                    from include/linux/mii.h:13,
                    from drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c:16:
>> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                                    ^~~~~~~~~~
   include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       9 | void netdev_emerg(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      11 | void netdev_alert(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      13 | void netdev_crit(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                              ^~~~~~~~~~
   include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      19 | void netdev_notice(const struct net_device *dev, const char *format, ...);
         |                                 ^~~~~~~~~~
   include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
--
   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15:
>> include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                                    ^~~~~~~~~~
   include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       9 | void netdev_emerg(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      11 | void netdev_alert(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      13 | void netdev_crit(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                              ^~~~~~~~~~
   include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      19 | void netdev_notice(const struct net_device *dev, const char *format, ...);
         |                                 ^~~~~~~~~~
   include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c: In function 'dwmac4_write_vlan_filter':
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:462:20: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     462 |         netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n");
         |                    ^~~
         |                    |
         |                    struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c: In function 'dwmac4_add_hw_vlan_rx_fltr':
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:479:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     479 |                 netdev_err(dev,
         |                            ^~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:488:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
     488 |                         netdev_warn(dev, "Adding VLAN ID 0 is not supported\n");
         |                                     ^~~
         |                                     |
         |                                     struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:493:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     493 |                         netdev_err(dev, "Only single VLAN ID supported\n");
         |                                    ^~~
         |                                    |
         |                                    struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:514:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     514 |                 netdev_err(dev, "MAC_VLAN_Tag_Filter full (size: %0u)\n",
         |                            ^~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c: In function 'dwmac4_del_hw_vlan_rx_fltr':
   drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:534:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     534 |                 netdev_err(dev,
         |                            ^~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from include/linux/netlink.h:7,
                    from include/linux/ethtool.h:18,
                    from drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:15:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   cc1: some warnings being treated as errors
..


vim +6 include/net/net_debug.h

877efca8201a88 Eric Dumazet 2022-05-09   4  
877efca8201a88 Eric Dumazet 2022-05-09   5  __printf(3, 4) __cold
877efca8201a88 Eric Dumazet 2022-05-09  @6  void netdev_printk(const char *level, const struct net_device *dev,
877efca8201a88 Eric Dumazet 2022-05-09   7  		   const char *format, ...);
877efca8201a88 Eric Dumazet 2022-05-09   8  __printf(2, 3) __cold
877efca8201a88 Eric Dumazet 2022-05-09   9  void netdev_emerg(const struct net_device *dev, const char *format, ...);
877efca8201a88 Eric Dumazet 2022-05-09  10  __printf(2, 3) __cold
877efca8201a88 Eric Dumazet 2022-05-09  11  void netdev_alert(const struct net_device *dev, const char *format, ...);
877efca8201a88 Eric Dumazet 2022-05-09  12  __printf(2, 3) __cold
877efca8201a88 Eric Dumazet 2022-05-09  13  void netdev_crit(const struct net_device *dev, const char *format, ...);
877efca8201a88 Eric Dumazet 2022-05-09  14  __printf(2, 3) __cold
877efca8201a88 Eric Dumazet 2022-05-09  15  void netdev_err(const struct net_device *dev, const char *format, ...);
877efca8201a88 Eric Dumazet 2022-05-09  16  __printf(2, 3) __cold
877efca8201a88 Eric Dumazet 2022-05-09  17  void netdev_warn(const struct net_device *dev, const char *format, ...);
877efca8201a88 Eric Dumazet 2022-05-09  18  __printf(2, 3) __cold
877efca8201a88 Eric Dumazet 2022-05-09  19  void netdev_notice(const struct net_device *dev, const char *format, ...);
877efca8201a88 Eric Dumazet 2022-05-09  20  __printf(2, 3) __cold
877efca8201a88 Eric Dumazet 2022-05-09  21  void netdev_info(const struct net_device *dev, const char *format, ...);
877efca8201a88 Eric Dumazet 2022-05-09  22
kernel test robot May 9, 2022, 11:31 p.m. UTC | #2
Hi Eric,

I love your patch! Yet something to improve:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220510/202205100711.cCKt89Rb-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
        git checkout d316b61f313a417d7dfa97fa006320288f3af150
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash drivers/net/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/skbuff.h:45,
                    from drivers/net/tun.c:44:
   include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                                    ^~~~~~~~~~
   include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       9 | void netdev_emerg(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      11 | void netdev_alert(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      13 | void netdev_crit(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                              ^~~~~~~~~~
   include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      19 | void netdev_notice(const struct net_device *dev, const char *format, ...);
         |                                 ^~~~~~~~~~
   include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/tun.c:44:
   drivers/net/tun.c: In function 'tun_flow_create':
>> drivers/net/tun.c:380:47: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
     380 |                 netif_info(tun, tx_queued, tun->dev,
         |                                            ~~~^~~~~
         |                                               |
         |                                               struct net_device *
   include/net/net_debug.h:101:32: note: in definition of macro 'netif_level'
     101 |                 netdev_##level(dev, fmt, ##args);               \
         |                                ^~~
   drivers/net/tun.c:380:17: note: in expansion of macro 'netif_info'
     380 |                 netif_info(tun, tx_queued, tun->dev,
         |                 ^~~~~~~~~~
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/tun.c: In function 'tun_flow_delete':
   drivers/net/tun.c:396:39: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
     396 |         netif_info(tun, tx_queued, tun->dev, "delete flow: hash %u index %u\n",
         |                                    ~~~^~~~~
         |                                       |
         |                                       struct net_device *
   include/net/net_debug.h:101:32: note: in definition of macro 'netif_level'
     101 |                 netdev_##level(dev, fmt, ##args);               \
         |                                ^~~
   drivers/net/tun.c:396:9: note: in expansion of macro 'netif_info'
     396 |         netif_info(tun, tx_queued, tun->dev, "delete flow: hash %u index %u\n",
         |         ^~~~~~~~~~
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/tun.c: In function 'tun_net_xmit':
   drivers/net/tun.c:1078:39: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1078 |         netif_info(tun, tx_queued, tun->dev, "%s %d\n", __func__, skb->len);
         |                                    ~~~^~~~~
         |                                       |
         |                                       struct net_device *
   include/net/net_debug.h:101:32: note: in definition of macro 'netif_level'
     101 |                 netdev_##level(dev, fmt, ##args);               \
         |                                ^~~
   drivers/net/tun.c:1078:9: note: in expansion of macro 'netif_info'
    1078 |         netif_info(tun, tx_queued, tun->dev, "%s %d\n", __func__, skb->len);
         |         ^~~~~~~~~~
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/tun.c: In function '__tun_chr_ioctl':
   drivers/net/tun.c:3095:33: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
    3095 |         netif_info(tun, drv, tun->dev, "tun_chr_ioctl cmd %u\n", cmd);
         |                              ~~~^~~~~
         |                                 |
         |                                 struct net_device *
   include/net/net_debug.h:101:32: note: in definition of macro 'netif_level'
     101 |                 netdev_##level(dev, fmt, ##args);               \
         |                                ^~~
   drivers/net/tun.c:3095:9: note: in expansion of macro 'netif_info'
    3095 |         netif_info(tun, drv, tun->dev, "tun_chr_ioctl cmd %u\n", cmd);
         |         ^~~~~~~~~~
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/tun.c:3116:41: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
    3116 |                 netif_info(tun, drv, tun->dev, "ignored: set checksum %s\n",
         |                                      ~~~^~~~~
         |                                         |
         |                                         struct net_device *
   include/net/net_debug.h:101:32: note: in definition of macro 'netif_level'
     101 |                 netdev_##level(dev, fmt, ##args);               \
         |                                ^~~
   drivers/net/tun.c:3116:17: note: in expansion of macro 'netif_info'
    3116 |                 netif_info(tun, drv, tun->dev, "ignored: set checksum %s\n",
         |                 ^~~~~~~~~~
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/tun.c:3135:41: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
    3135 |                 netif_info(tun, drv, tun->dev, "persist %s\n",
         |                                      ~~~^~~~~
         |                                         |
         |                                         struct net_device *
   include/net/net_debug.h:101:32: note: in definition of macro 'netif_level'
     101 |                 netdev_##level(dev, fmt, ##args);               \
         |                                ^~~
   drivers/net/tun.c:3135:17: note: in expansion of macro 'netif_info'
    3135 |                 netif_info(tun, drv, tun->dev, "persist %s\n",
         |                 ^~~~~~~~~~
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/tun.c:3148:41: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
    3148 |                 netif_info(tun, drv, tun->dev, "owner set to %u\n",
         |                                      ~~~^~~~~
         |                                         |
         |                                         struct net_device *
   include/net/net_debug.h:101:32: note: in definition of macro 'netif_level'
     101 |                 netdev_##level(dev, fmt, ##args);               \
         |                                ^~~
   drivers/net/tun.c:3148:17: note: in expansion of macro 'netif_info'
    3148 |                 netif_info(tun, drv, tun->dev, "owner set to %u\n",
         |                 ^~~~~~~~~~
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~


vim +/netdev_info +380 drivers/net/tun.c

96442e42429e5f Jason Wang     2012-10-31  372  
96442e42429e5f Jason Wang     2012-10-31  373  static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
96442e42429e5f Jason Wang     2012-10-31  374  					      struct hlist_head *head,
96442e42429e5f Jason Wang     2012-10-31  375  					      u32 rxhash, u16 queue_index)
96442e42429e5f Jason Wang     2012-10-31  376  {
9fdc6bef5f1e8b Eric Dumazet   2012-12-21  377  	struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC);
9fdc6bef5f1e8b Eric Dumazet   2012-12-21  378  
96442e42429e5f Jason Wang     2012-10-31  379  	if (e) {
3424170f37e78c Michal Kubecek 2020-03-04 @380  		netif_info(tun, tx_queued, tun->dev,
3424170f37e78c Michal Kubecek 2020-03-04  381  			   "create flow: hash %u index %u\n",
96442e42429e5f Jason Wang     2012-10-31  382  			   rxhash, queue_index);
96442e42429e5f Jason Wang     2012-10-31  383  		e->updated = jiffies;
96442e42429e5f Jason Wang     2012-10-31  384  		e->rxhash = rxhash;
9bc8893937c836 Tom Herbert    2013-12-22  385  		e->rps_rxhash = 0;
96442e42429e5f Jason Wang     2012-10-31  386  		e->queue_index = queue_index;
96442e42429e5f Jason Wang     2012-10-31  387  		e->tun = tun;
96442e42429e5f Jason Wang     2012-10-31  388  		hlist_add_head_rcu(&e->hash_link, head);
b8732fb7f8920e Jason Wang     2013-01-23  389  		++tun->flow_count;
96442e42429e5f Jason Wang     2012-10-31  390  	}
96442e42429e5f Jason Wang     2012-10-31  391  	return e;
96442e42429e5f Jason Wang     2012-10-31  392  }
96442e42429e5f Jason Wang     2012-10-31  393
kernel test robot May 9, 2022, 11:51 p.m. UTC | #3
Hi Eric,

I love your patch! Yet something to improve:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d
config: x86_64-randconfig-m001-20220509 (https://download.01.org/0day-ci/archive/20220510/202205100711.gqvHz9Km-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
        git checkout d316b61f313a417d7dfa97fa006320288f3af150
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/can/ctucanfd/ drivers/net/can/spi/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:6:52: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                                    ^~~~~~~~~~
   include/net/net_debug.h:9:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
       9 | void netdev_emerg(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:11:32: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      11 | void netdev_alert(const struct net_device *dev, const char *format, ...);
         |                                ^~~~~~~~~~
   include/net/net_debug.h:13:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      13 | void netdev_crit(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:15:30: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                              ^~~~~~~~~~
   include/net/net_debug.h:17:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   include/net/net_debug.h:19:33: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      19 | void netdev_notice(const struct net_device *dev, const char *format, ...);
         |                                 ^~~~~~~~~~
   include/net/net_debug.h:21:31: warning: 'struct net_device' declared inside parameter list will not be visible outside of this definition or declaration
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                               ^~~~~~~~~~
   In file included from include/linux/can/dev.h:18,
                    from drivers/net/can/ctucanfd/ctucanfd.h:24,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:35:
   include/linux/can/bittiming.h: In function 'can_calc_bittiming':
   include/linux/can/bittiming.h:127:20: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     127 |         netdev_err(dev, "bit-timing calculation not available\n");
         |                    ^~~
         |                    |
         |                    const struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'const struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   In file included from drivers/net/can/ctucanfd/ctucanfd.h:24,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:35:
   include/linux/can/dev.h: In function 'can_set_static_ctrlmode':
   include/linux/can/dev.h:141:29: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
     141 |                 netdev_warn(dev,
         |                             ^~~
         |                             |
         |                             struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_reset':
>> drivers/net/can/ctucanfd/ctucanfd_base.c:190:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
     190 |                         netdev_warn(ndev, "device did not leave reset\n");
         |                                     ^~~~
         |                                     |
         |                                     struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_set_btr':
>> drivers/net/can/ctucanfd/ctucanfd_base.c:214:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     214 |                 netdev_err(ndev, "BUG! Cannot set bittiming - CAN is enabled\n");
         |                            ^~~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_set_secondary_sample_point':
   drivers/net/can/ctucanfd/ctucanfd_base.c:298:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     298 |                 netdev_err(ndev, "BUG! Cannot set SSP - CAN is enabled\n");
         |                            ^~~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:308:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
     308 |                         netdev_warn(ndev, "SSP offset saturated to 127\n");
         |                                     ^~~~
         |                                     |
         |                                     struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_do_set_mode':
   drivers/net/can/ctucanfd/ctucanfd_base.c:455:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     455 |                         netdev_err(ndev, "ctucan_chip_start failed!\n");
         |                                    ^~~~
         |                                    |
         |                                    struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_start_xmit':
   drivers/net/can/ctucanfd/ctucanfd_base.c:608:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     608 |                 netdev_err(ndev, "BUG!, no TXB free when queue awake!\n");
         |                            ^~~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:617:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
     617 |                 netdev_err(ndev, "BUG! TXNF set but cannot insert frame into TXTB! HW Bug?");
         |                            ^~~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_err_interrupt':
>> drivers/net/can/ctucanfd/ctucanfd_base.c:817:29: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
     817 |                 netdev_info(ndev, "%s: ISR = 0x%08x, rxerr %d, txerr %d, error type %lu, pos %lu, ALC id_field %lu, bit %lu\n",
         |                             ^~~~
         |                             |
         |                             struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:832:29: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
     832 |                 netdev_info(ndev, "state changes from %s to %s\n",
         |                             ^~~~
         |                             |
         |                             struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:837:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
     837 |                         netdev_warn(ndev,
         |                                     ^~~~
         |                                     |
         |                                     struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:876:37: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
     876 |                         netdev_warn(ndev, "unhandled error state (%d:%s)!\n",
         |                                     ^~~~
         |                                     |
         |                                     struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:885:37: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
     885 |                         netdev_info(ndev, "arbitration lost\n");
         |                                     ^~~~
         |                                     |
         |                                     struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:895:29: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
     895 |                 netdev_info(ndev, "bus error\n");
         |                             ^~~~
         |                             |
         |                             struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_rx_poll':
   drivers/net/can/ctucanfd/ctucanfd_base.c:944:29: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
     944 |                 netdev_info(ndev, "rx_poll: rx fifo overflow\n");
         |                             ^~~~
         |                             |
         |                             struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_tx_interrupt':
   drivers/net/can/ctucanfd/ctucanfd_base.c:1033:45: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1033 |                                 netdev_warn(ndev, "TXB in Error state\n");
         |                                             ^~~~
         |                                             |
         |                                             struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:1042:45: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1042 |                                 netdev_warn(ndev, "TXB in Aborted state\n");
         |                                             ^~~~
         |                                             |
         |                                             struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:1051:52: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1051 |                                         netdev_err(ndev,
         |                                                    ^~~~
         |                                                    |
         |                                                    struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
--
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:1161:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1161 |                         netdev_err(ndev, "txb[%d] txb status=0x%08x\n", i, status);
         |                                    ^~~~
         |                                    |
         |                                    struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_open':
   drivers/net/can/ctucanfd/ctucanfd_base.c:1209:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1209 |                 netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
         |                            ^~~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:1222:29: error: passing argument 1 of 'netdev_warn' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1222 |                 netdev_warn(ndev, "open_candev failed!\n");
         |                             ^~~~
         |                             |
         |                             struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:17:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      17 | void netdev_warn(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:1228:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1228 |                 netdev_err(ndev, "irq allocation for CAN failed\n");
         |                            ^~~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:1234:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1234 |                 netdev_err(ndev, "ctucan_chip_start failed!\n");
         |                            ^~~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:1238:21: error: passing argument 1 of 'netdev_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1238 |         netdev_info(ndev, "ctu_can_fd device registered\n");
         |                     ^~~~
         |                     |
         |                     struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:21:43: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      21 | void netdev_info(const struct net_device *dev, const char *format, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_get_berr_counter':
   drivers/net/can/ctucanfd/ctucanfd_base.c:1293:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1293 |                 netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", __func__, ret);
         |                            ^~~~
         |                            |
         |                            const struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'const struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c: In function 'ctucan_probe_common':
   drivers/net/can/ctucanfd/ctucanfd_base.c:1406:28: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1406 |                 netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
         |                            ^~~~
         |                            |
         |                            struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/can/ctucanfd/ctucanfd_base.c:1417:36: error: passing argument 1 of 'netdev_err' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1417 |                         netdev_err(ndev, "CTU_CAN_FD signature not found\n");
         |                                    ^~~~
         |                                    |
         |                                    struct net_device *
   In file included from include/linux/skbuff.h:45,
                    from drivers/net/can/ctucanfd/ctucanfd_base.c:28:
   include/net/net_debug.h:15:42: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
      15 | void netdev_err(const struct net_device *dev, const char *format, ...);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
>> drivers/net/can/ctucanfd/ctucanfd_base.c:1441:20: error: passing argument 2 of 'netdev_printk' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1441 |         netdev_dbg(ndev, "mem_base=0x%p irq=%d clock=%d, no. of txt buffers:%d\n",
         |                    ^~~~
         |                    |
         |                    struct net_device *
   include/net/net_debug.h:61:43: note: in definition of macro 'netdev_dbg'
      61 |                 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
         |                                           ^~~~~
   include/net/net_debug.h:6:64: note: expected 'const struct net_device *' but argument is of type 'struct net_device *'
       6 | void netdev_printk(const char *level, const struct net_device *dev,
         |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   cc1: some warnings being treated as errors
..


vim +/netdev_warn +190 drivers/net/can/ctucanfd/ctucanfd_base.c

2dcb8e8782d8e4 Martin Jerabek 2022-03-22  168  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  169  /**
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  170   * ctucan_reset() - Issues software reset request to CTU CAN FD
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  171   * @ndev:	Pointer to net_device structure
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  172   *
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  173   * Return: 0 for success, -%ETIMEDOUT if CAN controller does not leave reset
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  174   */
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  175  static int ctucan_reset(struct net_device *ndev)
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  176  {
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  177  	struct ctucan_priv *priv = netdev_priv(ndev);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  178  	int i = 100;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  179  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  180  	ctucan_write32(priv, CTUCANFD_MODE, REG_MODE_RST);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  181  	clear_bit(CTUCANFD_FLAG_RX_FFW_BUFFERED, &priv->drv_flags);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  182  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  183  	do {
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  184  		u16 device_id = FIELD_GET(REG_DEVICE_ID_DEVICE_ID,
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  185  					  ctucan_read32(priv, CTUCANFD_DEVICE_ID));
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  186  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  187  		if (device_id == 0xCAFD)
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  188  			return 0;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  189  		if (!i--) {
2dcb8e8782d8e4 Martin Jerabek 2022-03-22 @190  			netdev_warn(ndev, "device did not leave reset\n");
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  191  			return -ETIMEDOUT;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  192  		}
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  193  		usleep_range(100, 200);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  194  	} while (1);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  195  }
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  196  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  197  /**
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  198   * ctucan_set_btr() - Sets CAN bus bit timing in CTU CAN FD
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  199   * @ndev:	Pointer to net_device structure
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  200   * @bt:		Pointer to Bit timing structure
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  201   * @nominal:	True - Nominal bit timing, False - Data bit timing
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  202   *
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  203   * Return: 0 - OK, -%EPERM if controller is enabled
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  204   */
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  205  static int ctucan_set_btr(struct net_device *ndev, struct can_bittiming *bt, bool nominal)
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  206  {
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  207  	struct ctucan_priv *priv = netdev_priv(ndev);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  208  	int max_ph1_len = 31;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  209  	u32 btr = 0;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  210  	u32 prop_seg = bt->prop_seg;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  211  	u32 phase_seg1 = bt->phase_seg1;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  212  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  213  	if (CTU_CAN_FD_ENABLED(priv)) {
2dcb8e8782d8e4 Martin Jerabek 2022-03-22 @214  		netdev_err(ndev, "BUG! Cannot set bittiming - CAN is enabled\n");
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  215  		return -EPERM;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  216  	}
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  217  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  218  	if (nominal)
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  219  		max_ph1_len = 63;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  220  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  221  	/* The timing calculation functions have only constraints on tseg1, which is prop_seg +
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  222  	 * phase1_seg combined. tseg1 is then split in half and stored into prog_seg and phase_seg1.
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  223  	 * In CTU CAN FD, PROP is 6/7 bits wide but PH1 only 6/5, so we must re-distribute the
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  224  	 * values here.
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  225  	 */
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  226  	if (phase_seg1 > max_ph1_len) {
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  227  		prop_seg += phase_seg1 - max_ph1_len;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  228  		phase_seg1 = max_ph1_len;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  229  		bt->prop_seg = prop_seg;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  230  		bt->phase_seg1 = phase_seg1;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  231  	}
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  232  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  233  	if (nominal) {
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  234  		btr = FIELD_PREP(REG_BTR_PROP, prop_seg);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  235  		btr |= FIELD_PREP(REG_BTR_PH1, phase_seg1);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  236  		btr |= FIELD_PREP(REG_BTR_PH2, bt->phase_seg2);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  237  		btr |= FIELD_PREP(REG_BTR_BRP, bt->brp);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  238  		btr |= FIELD_PREP(REG_BTR_SJW, bt->sjw);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  239  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  240  		ctucan_write32(priv, CTUCANFD_BTR, btr);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  241  	} else {
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  242  		btr = FIELD_PREP(REG_BTR_FD_PROP_FD, prop_seg);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  243  		btr |= FIELD_PREP(REG_BTR_FD_PH1_FD, phase_seg1);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  244  		btr |= FIELD_PREP(REG_BTR_FD_PH2_FD, bt->phase_seg2);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  245  		btr |= FIELD_PREP(REG_BTR_FD_BRP_FD, bt->brp);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  246  		btr |= FIELD_PREP(REG_BTR_FD_SJW_FD, bt->sjw);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  247  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  248  		ctucan_write32(priv, CTUCANFD_BTR_FD, btr);
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  249  	}
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  250  
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  251  	return 0;
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  252  }
2dcb8e8782d8e4 Martin Jerabek 2022-03-22  253
Eric Dumazet May 9, 2022, 11:52 p.m. UTC | #4
On Mon, May 9, 2022 at 4:32 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi Eric,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on net-next/master]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d
> config: arm-oxnas_v6_defconfig (https://download.01.org/0day-ci/archive/20220510/202205100723.9Wqso3nI-lkp@intel.com/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
>         git checkout d316b61f313a417d7dfa97fa006320288f3af150
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/ethernet/stmicro/stmmac/ drivers/net/mdio/ net/core/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>

I suppose some compiler/arches are asking us to add forward
declaration for struct net_device.
I have no idea what is the justification for that.
Jakub Kicinski May 10, 2022, 1:30 a.m. UTC | #5
On Mon, 9 May 2022 16:52:17 -0700 Eric Dumazet wrote:
> On Mon, May 9, 2022 at 4:32 PM kernel test robot <lkp@intel.com> wrote:
> >
> > Hi Eric,
> >
> > I love your patch! Perhaps something to improve:
> >
> > [auto build test WARNING on net-next/master]
> >
> > url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9c095bd0d4c451d31d0fd1131cc09d3b60de815d
> > config: arm-oxnas_v6_defconfig (https://download.01.org/0day-ci/archive/20220510/202205100723.9Wqso3nI-lkp@intel.com/config)
> > compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # https://github.com/intel-lab-lkp/linux/commit/d316b61f313a417d7dfa97fa006320288f3af150
> >         git remote add linux-review https://github.com/intel-lab-lkp/linux
> >         git fetch --no-tags linux-review Eric-Dumazet/net-CONFIG_DEBUG_NET-and-friends/20220510-031145
> >         git checkout d316b61f313a417d7dfa97fa006320288f3af150
> >         # save the config file
> >         mkdir build_dir && cp config build_dir/.config
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/ethernet/stmicro/stmmac/ drivers/net/mdio/ net/core/
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >  
> 
> I suppose some compiler/arches are asking us to add forward
> declaration for struct net_device.
> I have no idea what is the justification for that.

Yeah the order of inclusion is skbuff -> netdevice, as you probably
figured out by yourself. We may want to pull back the code move for 
the print helpers. Unless you have cycles to untangle that :S
Eric Dumazet May 10, 2022, 2:11 a.m. UTC | #6
On Mon, May 9, 2022 at 6:30 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
>
> Yeah the order of inclusion is skbuff -> netdevice, as you probably
> figured out by yourself. We may want to pull back the code move for
> the print helpers. Unless you have cycles to untangle that :S

I added at the beginning of the new file :

#include <linux/bug.h>
struct net_device;

Hopefully this is enough.
Jakub Kicinski May 10, 2022, 2:23 a.m. UTC | #7
On Mon, 9 May 2022 19:11:15 -0700 Eric Dumazet wrote:
> On Mon, May 9, 2022 at 6:30 PM Jakub Kicinski <kuba@kernel.org> wrote:
> > Yeah the order of inclusion is skbuff -> netdevice, as you probably
> > figured out by yourself. We may want to pull back the code move for
> > the print helpers. Unless you have cycles to untangle that :S  
> 
> I added at the beginning of the new file :
> 
> #include <linux/bug.h>
> struct net_device;
> 
> Hopefully this is enough.

Maybe toss in linux/kern_levels.h for a good measure?

netdev_WARN() uses netdev_name() but it's a macro, so the users of that
will need to include netdevice.h, or we could leave netdev_WARN() in 
netdevice.h. Doesn't matter in practice.
diff mbox series

Patch

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d58669d6cb91aa30edc70d59a0a7e9d4e2298842..a1c73fccccc68641fe46066e6d1195b31483ca4c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -42,6 +42,7 @@ 
 #if IS_ENABLED(CONFIG_NF_CONNTRACK)
 #include <linux/netfilter/nf_conntrack_common.h>
 #endif
+#include <net/net_debug.h>
 
 /* The interface for checksum offload between the stack and networking drivers
  * is as follows...
@@ -2804,6 +2805,7 @@  static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
 
 static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
 {
+	DEBUG_NET_WARN_ON_ONCE(!skb_transport_header_was_set(skb));
 	return skb->head + skb->transport_header;
 }