Re: [PATCH net-next v2 4/7] net: mscc: Add initial Ocelot switch support

From: kbuild test robot
Date: Sat Apr 28 2018 - 16:43:04 EST


Hi Alexandre,

I love your patch! Yet something to improve:

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

url: https://github.com/0day-ci/linux/commits/Alexandre-Belloni/Microsemi-Ocelot-Ethernet-switch-support/20180429-024136
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

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

drivers/net/ethernet/mscc/ocelot_board.c:23:26: sparse: Expected ) at end of cast operator
drivers/net/ethernet/mscc/ocelot_board.c:23:26: sparse: got _be32
drivers/net/ethernet/mscc/ocelot_board.c:23:26: sparse: cast from unknown type
In file included from include/linux/swab.h:5:0,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/x86/include/uapi/asm/byteorder.h:5,
from include/asm-generic/bitops/le.h:6,
from arch/x86/include/asm/bitops.h:521,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/interrupt.h:6,
from drivers/net/ethernet/mscc/ocelot_board.c:7:
drivers/net/ethernet/mscc/ocelot_board.c: In function 'ocelot_parse_ifh':
>> drivers/net/ethernet/mscc/ocelot_board.c:23:27: error: '_be32' undeclared (first use in this function); did you mean '__be32'?
ifh[i] = ntohl((__force _be32)ifh[i]);
^
include/uapi/linux/swab.h:114:54: note: in definition of macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
>> include/linux/byteorder/generic.h:136:21: note: in expansion of macro '__be32_to_cpu'
#define ___ntohl(x) __be32_to_cpu(x)
^~~~~~~~~~~~~
>> include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___ntohl'
#define ntohl(x) ___ntohl(x)
^~~~~~~~
>> drivers/net/ethernet/mscc/ocelot_board.c:23:12: note: in expansion of macro 'ntohl'
ifh[i] = ntohl((__force _be32)ifh[i]);
^~~~~
drivers/net/ethernet/mscc/ocelot_board.c:23:27: note: each undeclared identifier is reported only once for each function it appears in
ifh[i] = ntohl((__force _be32)ifh[i]);
^
include/uapi/linux/swab.h:114:54: note: in definition of macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
>> include/linux/byteorder/generic.h:136:21: note: in expansion of macro '__be32_to_cpu'
#define ___ntohl(x) __be32_to_cpu(x)
^~~~~~~~~~~~~
>> include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___ntohl'
#define ntohl(x) ___ntohl(x)
^~~~~~~~
>> drivers/net/ethernet/mscc/ocelot_board.c:23:12: note: in expansion of macro 'ntohl'
ifh[i] = ntohl((__force _be32)ifh[i]);
^~~~~
>> drivers/net/ethernet/mscc/ocelot_board.c:23:33: error: expected ')' before 'ifh'
ifh[i] = ntohl((__force _be32)ifh[i]);
^
include/uapi/linux/swab.h:114:54: note: in definition of macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
>> include/linux/byteorder/generic.h:136:21: note: in expansion of macro '__be32_to_cpu'
#define ___ntohl(x) __be32_to_cpu(x)
^~~~~~~~~~~~~
>> include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___ntohl'
#define ntohl(x) ___ntohl(x)
^~~~~~~~
>> drivers/net/ethernet/mscc/ocelot_board.c:23:12: note: in expansion of macro 'ntohl'
ifh[i] = ntohl((__force _be32)ifh[i]);
^~~~~
--
In file included from include/linux/swab.h:5:0,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/x86/include/uapi/asm/byteorder.h:5,
from include/asm-generic/bitops/le.h:6,
from arch/x86/include/asm/bitops.h:521,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/interrupt.h:6,
from drivers/net//ethernet/mscc/ocelot_board.c:7:
drivers/net//ethernet/mscc/ocelot_board.c: In function 'ocelot_parse_ifh':
drivers/net//ethernet/mscc/ocelot_board.c:23:27: error: '_be32' undeclared (first use in this function); did you mean '__be32'?
ifh[i] = ntohl((__force _be32)ifh[i]);
^
include/uapi/linux/swab.h:114:54: note: in definition of macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
>> include/linux/byteorder/generic.h:136:21: note: in expansion of macro '__be32_to_cpu'
#define ___ntohl(x) __be32_to_cpu(x)
^~~~~~~~~~~~~
>> include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___ntohl'
#define ntohl(x) ___ntohl(x)
^~~~~~~~
drivers/net//ethernet/mscc/ocelot_board.c:23:12: note: in expansion of macro 'ntohl'
ifh[i] = ntohl((__force _be32)ifh[i]);
^~~~~
drivers/net//ethernet/mscc/ocelot_board.c:23:27: note: each undeclared identifier is reported only once for each function it appears in
ifh[i] = ntohl((__force _be32)ifh[i]);
^
include/uapi/linux/swab.h:114:54: note: in definition of macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
>> include/linux/byteorder/generic.h:136:21: note: in expansion of macro '__be32_to_cpu'
#define ___ntohl(x) __be32_to_cpu(x)
^~~~~~~~~~~~~
>> include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___ntohl'
#define ntohl(x) ___ntohl(x)
^~~~~~~~
drivers/net//ethernet/mscc/ocelot_board.c:23:12: note: in expansion of macro 'ntohl'
ifh[i] = ntohl((__force _be32)ifh[i]);
^~~~~
drivers/net//ethernet/mscc/ocelot_board.c:23:33: error: expected ')' before 'ifh'
ifh[i] = ntohl((__force _be32)ifh[i]);
^
include/uapi/linux/swab.h:114:54: note: in definition of macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
>> include/linux/byteorder/generic.h:136:21: note: in expansion of macro '__be32_to_cpu'
#define ___ntohl(x) __be32_to_cpu(x)
^~~~~~~~~~~~~
>> include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___ntohl'
#define ntohl(x) ___ntohl(x)
^~~~~~~~
drivers/net//ethernet/mscc/ocelot_board.c:23:12: note: in expansion of macro 'ntohl'
ifh[i] = ntohl((__force _be32)ifh[i]);
^~~~~

sparse warnings: (new ones prefixed by >>)

drivers/net/ethernet/mscc/ocelot_board.c:23:26: sparse: Expected ) at end of cast operator
drivers/net/ethernet/mscc/ocelot_board.c:23:26: sparse: got _be32
>> drivers/net/ethernet/mscc/ocelot_board.c:23:26: sparse: cast from unknown type
In file included from include/linux/swab.h:5:0,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/x86/include/uapi/asm/byteorder.h:5,
from include/asm-generic/bitops/le.h:6,
from arch/x86/include/asm/bitops.h:521,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/interrupt.h:6,
from drivers/net/ethernet/mscc/ocelot_board.c:7:
drivers/net/ethernet/mscc/ocelot_board.c: In function 'ocelot_parse_ifh':
drivers/net/ethernet/mscc/ocelot_board.c:23:27: error: '_be32' undeclared (first use in this function); did you mean '__be32'?
ifh[i] = ntohl((__force _be32)ifh[i]);
^
include/uapi/linux/swab.h:114:54: note: in definition of macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
include/linux/byteorder/generic.h:136:21: note: in expansion of macro '__be32_to_cpu'
#define ___ntohl(x) __be32_to_cpu(x)
^~~~~~~~~~~~~
include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___ntohl'
#define ntohl(x) ___ntohl(x)
^~~~~~~~
drivers/net/ethernet/mscc/ocelot_board.c:23:12: note: in expansion of macro 'ntohl'
ifh[i] = ntohl((__force _be32)ifh[i]);
^~~~~
drivers/net/ethernet/mscc/ocelot_board.c:23:27: note: each undeclared identifier is reported only once for each function it appears in
ifh[i] = ntohl((__force _be32)ifh[i]);
^
include/uapi/linux/swab.h:114:54: note: in definition of macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
include/linux/byteorder/generic.h:136:21: note: in expansion of macro '__be32_to_cpu'
#define ___ntohl(x) __be32_to_cpu(x)
^~~~~~~~~~~~~
include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___ntohl'
#define ntohl(x) ___ntohl(x)
^~~~~~~~
drivers/net/ethernet/mscc/ocelot_board.c:23:12: note: in expansion of macro 'ntohl'
ifh[i] = ntohl((__force _be32)ifh[i]);
^~~~~
drivers/net/ethernet/mscc/ocelot_board.c:23:33: error: expected ')' before 'ifh'
ifh[i] = ntohl((__force _be32)ifh[i]);
^
include/uapi/linux/swab.h:114:54: note: in definition of macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
include/linux/byteorder/generic.h:136:21: note: in expansion of macro '__be32_to_cpu'
#define ___ntohl(x) __be32_to_cpu(x)
^~~~~~~~~~~~~
include/linux/byteorder/generic.h:140:18: note: in expansion of macro '___ntohl'
#define ntohl(x) ___ntohl(x)
^~~~~~~~
drivers/net/ethernet/mscc/ocelot_board.c:23:12: note: in expansion of macro 'ntohl'
ifh[i] = ntohl((__force _be32)ifh[i]);
^~~~~

vim +23 drivers/net/ethernet/mscc/ocelot_board.c

> 7 #include <linux/interrupt.h>
8 #include <linux/module.h>
9 #include <linux/netdevice.h>
10 #include <linux/of_mdio.h>
11 #include <linux/of_platform.h>
12 #include <linux/skbuff.h>
13
14 #include "ocelot.h"
15
16 static int ocelot_parse_ifh(u32 *ifh, struct frame_info *info)
17 {
18 int i;
19 u8 llen, wlen;
20
21 /* The IFH is in network order, switch to CPU order */
22 for (i = 0; i < IFH_LEN; i++)
> 23 ifh[i] = ntohl((__force _be32)ifh[i]);
24
25 wlen = (ifh[1] >> 7) & 0xff;
26 llen = (ifh[1] >> 15) & 0x3f;
27 info->len = OCELOT_BUFFER_CELL_SZ * wlen + llen - 80;
28
29 info->port = (ifh[2] & GENMASK(14, 11)) >> 11;
30
31 info->cpuq = (ifh[3] & GENMASK(27, 20)) >> 20;
32 info->tag_type = (ifh[3] & GENMASK(16, 16)) >> 16;
33 info->vid = ifh[3] & GENMASK(11, 0);
34
35 return 0;
36 }
37

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

Attachment: .config.gz
Description: application/gzip