Microsemi Ocelot Ethernet switch support
Subsystems (7)
Alexandre Belloni
maintainerv2 cover Microsemi Ocelot Ethernet switch support
Hi,
This series adds initial support for the Microsemi Ethernet switch present on Ocelot SoCs.
This only has bridging (and STP) support for now and it uses the switchdev framework.
Coming features are VLAN filtering, link aggregation, IGMP snooping.
The switch can also be connected to an external CPU using PCIe.
Also, support for integration on other SoCs will be submitted.
The ocelot dts changes are here for reference and should probably go through the MIPS tree once the bindings are accepted.
Changes in v2:
- Dropped Microsemi Ocelot PHY support
* MIIM driver:
- Documented interrupts bindings
- Moved the driver to drivers/net/phy/
- Removed unused mutex
- Removed MDIO bus scanning
* Switchdev driver:
- Changed compatible to mscc,vsc7514-switch
- Removed unused header inclusion
- Factorized MAC table selection in ocelot_mact_select()
- Disable the port in ocelot_port_stop()
- Fixed the smatch endianness warnings
- int to unsinged int where necessary
- Removed VID handling for the FDB it has been reworked anyway and will be submitted with VLAN support
- Fixed up unused cases in ocelot_port_attr_set()
- Added a loop to register all the IO register spaces
- the ports are now in an ethernet-ports node
I've tried switching to NAPI but this is not working well, mainly because the only way to disable interrupts is to actually mask them in the interrupt controller (it is not possible to tell the switch to stop generating interrupts).
Alexandre Belloni (7):
dt-bindings: net: add DT bindings for Microsemi MIIM
net: mscc: Add MDIO driver
dt-bindings: net: add DT bindings for Microsemi Ocelot Switch
net: mscc: Add initial Ocelot switch support
MIPS: mscc: Add switch to ocelot
MIPS: mscc: connect phys to ports on ocelot_pcb123
MAINTAINERS: Add entry for Microsemi Ethernet switches
.../devicetree/bindings/net/mscc-miim.txt | 26 + .../devicetree/bindings/net/mscc-ocelot.txt | 82 + MAINTAINERS | 6 + arch/mips/boot/dts/mscc/ocelot.dtsi | 88 ++ arch/mips/boot/dts/mscc/ocelot_pcb123.dts | 20 + drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/Makefile | 1 + drivers/net/ethernet/mscc/Kconfig | 29 + drivers/net/ethernet/mscc/Makefile | 5 + drivers/net/ethernet/mscc/ocelot.c | 1316 +++++++++++++++++ drivers/net/ethernet/mscc/ocelot.h | 554 +++++++ drivers/net/ethernet/mscc/ocelot_ana.h | 625 ++++++++ drivers/net/ethernet/mscc/ocelot_board.c | 313 ++++ drivers/net/ethernet/mscc/ocelot_dev.h | 275 ++++ drivers/net/ethernet/mscc/ocelot_dev_gmii.h | 154 ++ drivers/net/ethernet/mscc/ocelot_hsio.h | 785 ++++++++++ drivers/net/ethernet/mscc/ocelot_io.c | 116 ++ drivers/net/ethernet/mscc/ocelot_qs.h | 78 + drivers/net/ethernet/mscc/ocelot_qsys.h | 270 ++++ drivers/net/ethernet/mscc/ocelot_regs.c | 399 +++++ drivers/net/ethernet/mscc/ocelot_rew.h | 81 + drivers/net/ethernet/mscc/ocelot_sys.h | 140 ++ drivers/net/phy/Kconfig | 7 + drivers/net/phy/Makefile | 1 + drivers/net/phy/mdio-mscc-miim.c | 197 +++ 25 files changed, 5569 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/mscc-miim.txt create mode 100644 Documentation/devicetree/bindings/net/mscc-ocelot.txt create mode 100644 drivers/net/ethernet/mscc/Kconfig create mode 100644 drivers/net/ethernet/mscc/Makefile create mode 100644 drivers/net/ethernet/mscc/ocelot.c create mode 100644 drivers/net/ethernet/mscc/ocelot.h create mode 100644 drivers/net/ethernet/mscc/ocelot_ana.h create mode 100644 drivers/net/ethernet/mscc/ocelot_board.c create mode 100644 drivers/net/ethernet/mscc/ocelot_dev.h create mode 100644 drivers/net/ethernet/mscc/ocelot_dev_gmii.h create mode 100644 drivers/net/ethernet/mscc/ocelot_hsio.h create mode 100644 drivers/net/ethernet/mscc/ocelot_io.c create mode 100644 drivers/net/ethernet/mscc/ocelot_qs.h create mode 100644 drivers/net/ethernet/mscc/ocelot_qsys.h create mode 100644 drivers/net/ethernet/mscc/ocelot_regs.c create mode 100644 drivers/net/ethernet/mscc/ocelot_rew.h create mode 100644 drivers/net/ethernet/mscc/ocelot_sys.h create mode 100644 drivers/net/phy/mdio-mscc-miim.c
Signature · 1 line
2.17.0
Alexandre Belloni
maintainerPATCH v2 1/7 dt-bindings: net: add DT bindings for Microsemi MIIM
DT bindings for the Microsemi MII Management Controller found on Microsemi SoCs
--- .../devicetree/bindings/net/mscc-miim.txt | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/mscc-miim.txt
Documentation/devicetree/bindings/net/mscc-miim.txt new file +26 -0
@@ -0,0 +1,26 @@ +Microsemi MII Management Controller (MIIM) / MDIO +================================================= + +Properties: +- compatible: must be "mscc,ocelot-miim" +- reg: The base address of the MDIO bus controller register bank. Optionally, a + second register bank can be defined if there is an associated reset register + for internal PHYs +- #address-cells: Must be <1>. +- #size-cells: Must be <0>. MDIO addresses have no size component. +- interrupts: interrupt specifier (refer to the interrupt binding) + +Typically an MDIO bus might have several children. + +Example: + mdio@107009c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mscc,ocelot-miim"; + reg = <0x107009c 0x36>, <0x10700f0 0x8>; + interrupts = <14>; + + phy0: ethernet-phy@0 { + reg = <0>; + }; + };
Signature · 1 line
2.17.0
Re: [PATCH net-next v2 1/7] dt-bindings: net: add DT bindings for Microsemi MIIM
Quoted 10 lines · Alexandre Belloni
DT bindings for the Microsemi MII Management Controller found on Microsemi SoCs
Cc Rob Herring <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>--- .../devicetree/bindings/net/mscc-miim.txt | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/mscc-miim.txt
Alexandre Belloni
maintainerPATCH v2 2/7 net: mscc: Add MDIO driver
In reply to Alexandre BelloniAdd a driver for the Microsemi MII Management controller (MIIM) found on Microsemi SoCs.
On Ocelot, there are two controllers, one is connected to the internal PHYs, the other one can communicate with external PHYs.
--- drivers/net/phy/Kconfig | 7 ++ drivers/net/phy/Makefile | 1 + drivers/net/phy/mdio-mscc-miim.c | 197 +++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 drivers/net/phy/mdio-mscc-miim.c
drivers/net/phy/Kconfig +7 -0
@@ -123,6 +123,13 @@ config MDIO_MOXART This driver supports the MDIO interface found in the network interface units of the MOXA ART SoC +config MDIO_MSCC_MIIM + tristate "Microsemi MIIM interface support" + depends on HAS_IOMEM + help + This driver supports the MIIM (MDIO) interface found in the network + switches of the Microsemi SoCs + config MDIO_OCTEON tristate "Octeon and some ThunderX SOCs MDIO buses" depends on 64BIT
drivers/net/phy/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o obj-$(CONFIG_MDIO_HISI_FEMAC) += mdio-hisi-femac.o obj-$(CONFIG_MDIO_I2C) += mdio-i2c.o obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o +obj-$(CONFIG_MDIO_MSCC_MIIM) += mdio-mscc-miim.o obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o obj-$(CONFIG_MDIO_THUNDER) += mdio-thunder.o
drivers/net/phy/mdio-mscc-miim.c new file +197 -0
197 lines not on this page · raw message
Signature · 1 line
2.17.0
Re: [PATCH net-next v2 2/7] net: mscc: Add MDIO driver
Quoted 6 lines · Alexandre Belloni
Add a driver for the Microsemi MII Management controller (MIIM) found on Microsemi SoCs.
On Ocelot, there are two controllers, one is connected to the internal PHYs, the other one can communicate with external PHYs.Signed-off-by Alexandre Belloni <[email protected]>
Andrew
Alexandre Belloni
maintainerPATCH v2 3/7 dt-bindings: net: add DT bindings for Microsemi Ocelot Switch
In reply to Alexandre BelloniDT bindings for the Ethernet switch found on Microsemi Ocelot platforms.
--- .../devicetree/bindings/net/mscc-ocelot.txt | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/mscc-ocelot.txt
Documentation/devicetree/bindings/net/mscc-ocelot.txt new file +82 -0
@@ -0,0 +1,82 @@ +Microsemi Ocelot network Switch +=============================== + +The Microsemi Ocelot network switch can be found on Microsemi SoCs (VSC7513, +VSC7514) + +Required properties: +- compatible: Should be "mscc,vsc7514-switch" +- reg: Must contain an (offset, length) pair of the register set for each + entry in reg-names. +- reg-names: Must include the following entries: + - "sys" + - "rew" + - "qs" + - "hsio" + - "qsys" + - "ana" + - "portX" with X from 0 to the number of last port index available on that + switch +- interrupts: Should contain the switch interrupts for frame extraction and + frame injection +- interrupt-names: should contain the interrupt names: "xtr", "inj" +- ethernet-ports: A container for child nodes representing switch ports. + +The ethernet-ports container has the following properties + +Required properties: + +- #address-cells: Must be 1 +- #size-cells: Must be 0 + +Each port node must have the following mandatory properties: +- reg: Describes the port address in the switch + +Port nodes may also contain the following optional standardised +properties, described in binding documents: + +- phy-handle: Phandle to a PHY on an MDIO bus. See + Documentation/devicetree/bindings/net/ethernet.txt for details. + +Example: + + switch@1010000 { + compatible = "mscc,vsc7514-switch"; + reg = <0x1010000 0x10000>, + <0x1030000 0x10000>, + <0x1080000 0x100>, + <0x10d0000 0x10000>, + <0x11e0000 0x100>, + <0x11f0000 0x100>, + <0x1200000 0x100>, + <0x1210000 0x100>, + <0x1220000 0x100>, + <0x1230000 0x100>, + <0x1240000 0x100>, + <0x1250000 0x100>, + <0x1260000 0x100>, + <0x1270000 0x100>, + <0x1280000 0x100>, + <0x1800000 0x80000>, + <0x1880000 0x10000>; + reg-names = "sys", "rew", "qs", "hsio", "port0", + "port1", "port2", "port3", "port4", "port5", + "port6", "port7", "port8", "port9", "port10", + "qsys", "ana"; + interrupts = <21 22>; + interrupt-names = "xtr", "inj"; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port0: port@0 { + reg = <0>; + phy-handle = <&phy0>; + }; + port1: port@1 { + reg = <1>; + phy-handle = <&phy1>; + }; + }; + };
Signature · 1 line
2.17.0
Re: [PATCH net-next v2 3/7] dt-bindings: net: add DT bindings for Microsemi Ocelot Switch
Quoted 9 lines · Alexandre Belloni
DT bindings for the Ethernet switch found on Microsemi Ocelot platforms.
Cc Rob Herring <[email protected]>Cc James Hogan <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>--- .../devicetree/bindings/net/mscc-ocelot.txt | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/mscc-ocelot.txt
Alexandre Belloni
maintainerPATCH v2 4/7 net: mscc: Add initial Ocelot switch support
In reply to Alexandre BelloniAdd a driver for Microsemi Ocelot Ethernet switch support.
This makes two modules:mscc_ocelot_common handles all the common features that doesn't depend on how the switch is integrated in the SoC. Currently, it handles offloading bridging to the hardware. ocelot_io.c handles register accesses. This is unfortunately needed because the register layout is packed and then depends on the number of ports available on the switch. The register definition files are automatically generated.
ocelot_board handles the switch integration on the SoC and on the board.
Frame injection and extraction to/from the CPU port is currently done using register accesses which is quite slow. DMA is possible but the port is not able to absorb the whole switch bandwidth.
--- drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/Makefile | 1 + drivers/net/ethernet/mscc/Kconfig | 29 + drivers/net/ethernet/mscc/Makefile | 5 + drivers/net/ethernet/mscc/ocelot.c | 1316 +++++++++++++++++++ drivers/net/ethernet/mscc/ocelot.h | 554 ++++++++ drivers/net/ethernet/mscc/ocelot_ana.h | 625 +++++++++ drivers/net/ethernet/mscc/ocelot_board.c | 313 +++++ drivers/net/ethernet/mscc/ocelot_dev.h | 275 ++++ drivers/net/ethernet/mscc/ocelot_dev_gmii.h | 154 +++ drivers/net/ethernet/mscc/ocelot_hsio.h | 785 +++++++++++ drivers/net/ethernet/mscc/ocelot_io.c | 116 ++ drivers/net/ethernet/mscc/ocelot_qs.h | 78 ++ drivers/net/ethernet/mscc/ocelot_qsys.h | 270 ++++ drivers/net/ethernet/mscc/ocelot_regs.c | 399 ++++++ drivers/net/ethernet/mscc/ocelot_rew.h | 81 ++ drivers/net/ethernet/mscc/ocelot_sys.h | 140 ++ 17 files changed, 5142 insertions(+) create mode 100644 drivers/net/ethernet/mscc/Kconfig create mode 100644 drivers/net/ethernet/mscc/Makefile create mode 100644 drivers/net/ethernet/mscc/ocelot.c create mode 100644 drivers/net/ethernet/mscc/ocelot.h create mode 100644 drivers/net/ethernet/mscc/ocelot_ana.h create mode 100644 drivers/net/ethernet/mscc/ocelot_board.c create mode 100644 drivers/net/ethernet/mscc/ocelot_dev.h create mode 100644 drivers/net/ethernet/mscc/ocelot_dev_gmii.h create mode 100644 drivers/net/ethernet/mscc/ocelot_hsio.h create mode 100644 drivers/net/ethernet/mscc/ocelot_io.c create mode 100644 drivers/net/ethernet/mscc/ocelot_qs.h create mode 100644 drivers/net/ethernet/mscc/ocelot_qsys.h create mode 100644 drivers/net/ethernet/mscc/ocelot_regs.c create mode 100644 drivers/net/ethernet/mscc/ocelot_rew.h create mode 100644 drivers/net/ethernet/mscc/ocelot_sys.h
drivers/net/ethernet/Kconfig +1 -0
@@ -114,6 +114,7 @@ source "drivers/net/ethernet/mediatek/Kconfig" source "drivers/net/ethernet/mellanox/Kconfig" source "drivers/net/ethernet/micrel/Kconfig" source "drivers/net/ethernet/microchip/Kconfig" +source "drivers/net/ethernet/mscc/Kconfig" source "drivers/net/ethernet/moxa/Kconfig" source "drivers/net/ethernet/myricom/Kconfig"
drivers/net/ethernet/Makefile +1 -0
@@ -55,6 +55,7 @@ obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/ obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/ obj-$(CONFIG_NET_VENDOR_MICREL) += micrel/ obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/ +obj-$(CONFIG_NET_VENDOR_MICROSEMI) += mscc/ obj-$(CONFIG_NET_VENDOR_MOXART) += moxa/ obj-$(CONFIG_NET_VENDOR_MYRI) += myricom/ obj-$(CONFIG_FEALNX) += fealnx.o
drivers/net/ethernet/mscc/Kconfig new file +29 -0
@@ -0,0 +1,29 @@ +# SPDX-License-Identifier: (GPL-2.0 OR MIT) +config NET_VENDOR_MICROSEMI + bool "Microsemi devices" + default y + help + If you have a network (Ethernet) card belonging to this class, say Y. + + Note that the answer to this question doesn't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about Microsemi devices. + +if NET_VENDOR_MICROSEMI + +config MSCC_OCELOT_SWITCH + tristate "Ocelot switch driver" + depends on NET_SWITCHDEV + select PHYLIB + select REGMAP_MMIO + help + This driver supports the Ocelot network switch device. + +config MSCC_OCELOT_SWITCH_OCELOT + tristate "Ocelot switch driver on Ocelot" + depends on MSCC_OCELOT_SWITCH + help + This driver supports the Ocelot network switch device as present on + the Ocelot SoCs. + +endif # NET_VENDOR_MICROSEMI
drivers/net/ethernet/mscc/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: (GPL-2.0 OR MIT) +obj-$(CONFIG_MSCC_OCELOT_SWITCH) += mscc_ocelot_common.o +mscc_ocelot_common-y := ocelot.o ocelot_io.o +mscc_ocelot_common-y += ocelot_regs.o +obj-$(CONFIG_MSCC_OCELOT_SWITCH_OCELOT) += ocelot_board.o
drivers/net/ethernet/mscc/ocelot.c new file +1316 -0
1,316 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot.h new file +554 -0
554 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_ana.h new file +625 -0
625 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_board.c new file +313 -0
313 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_dev.h new file +275 -0
144 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_dev_gmii.h new file +154 -0
154 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_hsio.h new file +785 -0
785 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_io.c new file +116 -0
116 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_qs.h new file +78 -0
78 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_qsys.h new file +270 -0
270 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_regs.c new file +399 -0
399 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_rew.h new file +81 -0
81 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot_sys.h new file +140 -0
140 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.17.0
Part of the diff is not shown here. View the raw message.
Andrew Lunn
maintainerRe: [PATCH net-next v2 4/7] net: mscc: Add initial Ocelot switch support
drivers/net/ethernet/mscc/ocelot.c line 1101
Quoted 5 lines
drivers/net/ethernet/mscc/ocelot.c new file +5
-0+/* Checks if the net_device instance given to us originate from our driver. */ +static bool ocelot_netdevice_dev_check (const struct net_device *dev) +{ +return dev->netdev_ops == &ocelot_port_netdev_ops; +}
This is probably O.K. now, but when you add support for controlling the switch over PCIe, i think it breaks. A board could have two switches...
It might be possible to do something with dev->parent. All ports of a switch should have the same parent.
Andrew
Alexandre Belloni
maintainerRe: [PATCH net-next v2 4/7] net: mscc: Add initial Ocelot switch support
Quoted 10 lines · Andrew Lunn
drivers/net/ethernet/mscc/ocelot.c line 1101
Quoted 5 lines
drivers/net/ethernet/mscc/ocelot.c new file +5
-0+/* Checks if the net_device instance given to us originate from our driver. */ +static bool ocelot_netdevice_dev_check (const struct net_device *dev) +{ +return dev->netdev_ops == &ocelot_port_netdev_ops; +}This is probably O.K. now, but when you add support for controlling the switch over PCIe, i think it breaks. A board could have two switches...
Quoted 3 lines
It might be possible to do something with
dev->parent. All ports of a switch should have the same parent.
Actually, that is fine because it simply ensures netdev_priv(dev); is a struct ocelot_port.
Later on, we get ocelot_port->ocelot and do the right thing.
The only thing that would not be working when having multiple of those switches on the same platform would be having interfaces from different switches in the same bridge. Anyway, this is definitively not something we want because of the limited bandwidth of the CPU port.
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
kbuild test robot
build botRe: [PATCH net-next v2 4/7] net: mscc: Add initial Ocelot switch support
In reply to Alexandre BelloniI love your patch! Perhaps something to improve:
Hi Alexandre,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Alexandre-Belloni/Microsemi-Ocelot-Ethernet-switch-support/20180429-024136
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sh
All warnings (new ones prefixed by >>):
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/sh/include/uapi/asm/byteorder.h:6,
from arch/sh/include/asm/bitops.h:12,
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:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__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:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__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:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__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:18:12: note: in definition of macro '___constant_swab32'
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
^
>> include/uapi/linux/byteorder/little_endian.h:40:26: note: in expansion of macro '__swab32'
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(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:19:12: note: in definition of macro '___constant_swab32'
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
^
>> include/uapi/linux/byteorder/little_endian.h:40:26: note: in expansion of macro '__swab32'
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(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:20:12: note: in definition of macro '___constant_swab32'
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
^
>> include/uapi/linux/byteorder/little_endian.h:40:26: note: in expansion of macro '__swab32'
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(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:21:12: note: in definition of macro '___constant_swab32'
(((__u32)(x) & (__u32)0xff000000UL) >> 24)))
^
>> include/uapi/linux/byteorder/little_endian.h:40:26: note: in expansion of macro '__swab32'
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(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:119:12: note: in definition of macro '__swab32'
__fswab32(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/sh/include/uapi/asm/byteorder.h:6,
from arch/sh/include/asm/bitops.h:12,
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:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__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:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__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:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__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:18:12: note: in definition of macro '___constant_swab32'
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
^
>> include/uapi/linux/byteorder/little_endian.h:40:26: note: in expansion of macro '__swab32'
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(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:19:12: note: in definition of macro '___constant_swab32'
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
^
>> include/uapi/linux/byteorder/little_endian.h:40:26: note: in expansion of macro '__swab32'
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(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:20:12: note: in definition of macro '___constant_swab32'
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
^
>> include/uapi/linux/byteorder/little_endian.h:40:26: note: in expansion of macro '__swab32'
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(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:21:12: note: in definition of macro '___constant_swab32'
(((__u32)(x) & (__u32)0xff000000UL) >> 24)))
^
>> include/uapi/linux/byteorder/little_endian.h:40:26: note: in expansion of macro '__swab32'
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(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:119:12: note: in definition of macro '__swab32'
__fswab32(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 +/__swab32 +40 include/uapi/linux/byteorder/little_endian.h
5921e6f8 David Howells 2012-10-13 14 5921e6f8 David Howells 2012-10-13 15 #define __constant_htonl(x) ((__force __be32)___constant_swab32((x))) 5921e6f8 David Howells 2012-10-13 16 #define __constant_ntohl(x) ___constant_swab32((__force __be32)(x)) 5921e6f8 David Howells 2012-10-13 17 #define __constant_htons(x) ((__force __be16)___constant_swab16((x))) 5921e6f8 David Howells 2012-10-13 18 #define __constant_ntohs(x) ___constant_swab16((__force __be16)(x)) 5921e6f8 David Howells 2012-10-13 19 #define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x)) 5921e6f8 David Howells 2012-10-13 20 #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x)) 5921e6f8 David Howells 2012-10-13 21 #define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x)) 5921e6f8 David Howells 2012-10-13 22 #define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x)) 5921e6f8 David Howells 2012-10-13 23 #define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x)) 5921e6f8 David Howells 2012-10-13 24 #define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x)) 5921e6f8 David Howells 2012-10-13 25 #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x))) 5921e6f8 David Howells 2012-10-13 26 #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x)) 5921e6f8 David Howells 2012-10-13 27 #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) 5921e6f8 David Howells 2012-10-13 28 #define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x)) 5921e6f8 David Howells 2012-10-13 29 #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) 5921e6f8 David Howells 2012-10-13 30 #define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x)) 5921e6f8 David Howells 2012-10-13 31 #define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) 5921e6f8 David Howells 2012-10-13 32 #define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) 5921e6f8 David Howells 2012-10-13 33 #define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) 5921e6f8 David Howells 2012-10-13 34 #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) 5921e6f8 David Howells 2012-10-13 35 #define __cpu_to_le16(x) ((__force __le16)(__u16)(x)) 5921e6f8 David Howells 2012-10-13 36 #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) 5921e6f8 David Howells 2012-10-13 37 #define __cpu_to_be64(x) ((__force __be64)__swab64((x))) 5921e6f8 David Howells 2012-10-13 38 #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x)) 5921e6f8 David Howells 2012-10-13 39 #define __cpu_to_be32(x) ((__force __be32)__swab32((x))) 5921e6f8 David Howells 2012-10-13 @40 #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x)) 5921e6f8 David Howells 2012-10-13 41 #define __cpu_to_be16(x) ((__force __be16)__swab16((x))) 5921e6f8 David Howells 2012-10-13 42 #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
5921e6f8 David Howells 2012-10-13 43
:::::: The code at line 40 was first introduced by commit
:::::: 5921e6f8809b1616932ca4afd40fe449faa8fd88 UAPI: (Scripted) Disintegrate include/linux/byteorder
:::::: TO: David Howells <[email protected]>
:::::: CC: David Howells <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH net-next v2 4/7] net: mscc: Add initial Ocelot switch support
In reply to Alexandre BelloniI love your patch! Yet something to improve:
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
Alexandre Belloni
maintainerPATCH v2 5/7 MIPS: mscc: Add switch to ocelot
In reply to Alexandre BelloniOcelot has an integrated switch, add support for it.
--- arch/mips/boot/dts/mscc/ocelot.dtsi | 88 +++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+)
arch/mips/boot/dts/mscc/ocelot.dtsi +88 -0
@@ -91,6 +91,72 @@ status = "disabled"; }; + switch@1010000 { + compatible = "mscc,vsc7514-switch"; + reg = <0x1010000 0x10000>, + <0x1030000 0x10000>, + <0x1080000 0x100>, + <0x10d0000 0x10000>, + <0x11e0000 0x100>, + <0x11f0000 0x100>, + <0x1200000 0x100>, + <0x1210000 0x100>, + <0x1220000 0x100>, + <0x1230000 0x100>, + <0x1240000 0x100>, + <0x1250000 0x100>, + <0x1260000 0x100>, + <0x1270000 0x100>, + <0x1280000 0x100>, + <0x1800000 0x80000>, + <0x1880000 0x10000>; + reg-names = "sys", "rew", "qs", "hsio", "port0", + "port1", "port2", "port3", "port4", "port5", + "port6", "port7", "port8", "port9", "port10", + "qsys", "ana"; + interrupts = <21 22>; + interrupt-names = "xtr", "inj"; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port0: port@0 { + reg = <0>; + }; + port1: port@1 { + reg = <1>; + }; + port2: port@2 { + reg = <2>; + }; + port3: port@3 { + reg = <3>; + }; + port4: port@4 { + reg = <4>; + }; + port5: port@5 { + reg = <5>; + }; + port6: port@6 { + reg = <6>; + }; + port7: port@7 { + reg = <7>; + }; + port8: port@8 { + reg = <8>; + }; + port9: port@9 { + reg = <9>; + }; + port10: port@10 { + reg = <10>; + }; + }; + }; + reset@1070008 { compatible = "mscc,ocelot-chip-reset"; reg = <0x1070008 0x4>;
@@ -113,5 +179,27 @@ function = "uart2"; }; }; + + mdio0: mdio@107009c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mscc,ocelot-miim"; + reg = <0x107009c 0x36>, <0x10700f0 0x8>; + interrupts = <14>; + status = "disabled"; + + phy0: ethernet-phy@0 { + reg = <0>; + }; + phy1: ethernet-phy@1 { + reg = <1>; + }; + phy2: ethernet-phy@2 { + reg = <2>; + }; + phy3: ethernet-phy@3 { + reg = <3>; + }; + }; }; };
Signature · 1 line
2.17.0
Andrew Lunn
maintainerRe: [PATCH net-next v2 5/7] MIPS: mscc: Add switch to ocelot
Quoted 100 lines · Alexandre Belloni
Ocelot has an integrated switch, add support for it.
Cc James Hogan <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>--- arch/mips/boot/dts/mscc/ocelot.dtsi | 88 +++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+)arch/mips/boot/dts/mscc/ocelot.dtsi +77
-0@@ -91,6 +91,72 @@ status = "disabled"; }; + switch@1010000 { + compatible = "mscc,vsc7514-switch"; + reg = <0x1010000 0x10000>, + <0x1030000 0x10000>, + <0x1080000 0x100>, + <0x10d0000 0x10000>, + <0x11e0000 0x100>, + <0x11f0000 0x100>, + <0x1200000 0x100>, + <0x1210000 0x100>, + <0x1220000 0x100>, + <0x1230000 0x100>, + <0x1240000 0x100>, + <0x1250000 0x100>, + <0x1260000 0x100>, + <0x1270000 0x100>, + <0x1280000 0x100>, + <0x1800000 0x80000>, + <0x1880000 0x10000>; + reg-names = "sys", "rew", "qs", "hsio", "port0", + "port1", "port2", "port3", "port4", "port5", + "port6", "port7", "port8", "port9", "port10", + "qsys", "ana"; + interrupts = <21 22>; + interrupt-names = "xtr", "inj"; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port0: port@0 { + reg = <0>; + }; + port1: port@1 { + reg = <1>; + }; + port2: port@2 { + reg = <2>; + }; + port3: port@3 { + reg = <3>; + }; + port4: port@4 { + reg = <4>; + }; + port5: port@5 { + reg = <5>; + }; + port6: port@6 { + reg = <6>; + }; + port7: port@7 { + reg = <7>; + }; + port8: port@8 { + reg = <8>; + }; + port9: port@9 { + reg = <9>; + }; + port10: port@10 { + reg = <10>; + }; + }; + }; + reset@1070008 { compatible = "mscc,ocelot-chip-reset"; reg = <0x1070008 0x4>;@@ -113,5 +179,27 @@ function = "uart2"; }; }; + + mdio0: mdio@107009c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mscc,ocelot-miim"; + reg = <0x107009c 0x36>, <0x10700f0 0x8>; + interrupts = <14>; + status = "disabled"; + + phy0: ethernet-phy@0 { + reg = <0>;
arch/mips/boot/dts/mscc/ocelot.dtsi line 202
Quoted 10 lines
arch/mips/boot/dts/mscc/ocelot.dtsi +10
-0+ }; + phy1: ethernet-phy@1 { + reg = <1>; + }; + phy2: ethernet-phy@2 { + reg = <2>; + }; + phy3: ethernet-phy@3 { + reg = <3>; + };
Hi Alexandre
These are internal PHYs? Is there an option to use external PHYs for the ports which have internal PHYs?
I'm just wondering if they should be linked together by default. Or a comment added to the commit message about why they are not linked together here.
Andrew
Alexandre Belloni
maintainerRe: [PATCH net-next v2 5/7] MIPS: mscc: Add switch to ocelot
Quoted 24 lines · Andrew Lunn
Quoted 11 lines
arch/mips/boot/dts/mscc/ocelot.dtsi +11
-0+ + mdio0: mdio@107009c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mscc,ocelot-miim"; + reg = <0x107009c 0x36>, <0x10700f0 0x8>; + interrupts = <14>; + status = "disabled"; + + phy0: ethernet-phy@0 { + reg = <0>;arch/mips/boot/dts/mscc/ocelot.dtsi line 202
Quoted 10 lines
arch/mips/boot/dts/mscc/ocelot.dtsi +10
-0+ }; + phy1: ethernet-phy@1 { + reg = <1>; + }; + phy2: ethernet-phy@2 { + reg = <2>; + }; + phy3: ethernet-phy@3 { + reg = <3>; + };Hi Alexandre
Quoted 7 lines
These are internal PHYs? Is there an option to use external PHYs for the ports which have internal PHYs?
I'm just wondering if they should be linked together by default. Or a comment added to the commit message about why they are not linked together here.
They are dual media ports so they are not necessarily using the integrated PHY but can use SerDEs1G lanes.
I'll add that to the commit message.
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Alexandre Belloni
maintainerPATCH v2 6/7 MIPS: mscc: connect phys to ports on ocelot_pcb123
In reply to Alexandre BelloniAdd phy to switch port connections for PCB123 for internal PHYs.
--- arch/mips/boot/dts/mscc/ocelot_pcb123.dts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
arch/mips/boot/dts/mscc/ocelot_pcb123.dts +20 -0
@@ -25,3 +25,23 @@ &uart2 { status = "okay"; }; + +&mdio0 { + status = "okay"; +}; + +&port0 { + phy-handle = <&phy0>; +}; + +&port1 { + phy-handle = <&phy1>; +}; + +&port2 { + phy-handle = <&phy2>; +}; + +&port3 { + phy-handle = <&phy3>; +};
Signature · 1 line
2.17.0
Alexandre Belloni
maintainerPATCH v2 7/7 MAINTAINERS: Add entry for Microsemi Ethernet switches
In reply to Alexandre BelloniAdd myself as a maintainer for the Microsemi Ethernet switches.
--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -9280,6 +9280,12 @@ F: include/linux/cciss*.h F: include/uapi/linux/cciss*.h F: Documentation/scsi/smartpqi.txt +MICROSEMI ETHERNET SWITCH DRIVER +M: Alexandre Belloni <[email protected]> +L: [email protected] +S: Supported +F: drivers/net/ethernet/mscc/ + MICROSOFT SURFACE PRO 3 BUTTON DRIVER M: Chen Yu <[email protected]> L: [email protected]
Signature · 1 line
2.17.0