Re: [PATCH] stmmac: Fix 'eth0: No PHY found' regression

2016-03-03 Thread Giuseppe CAVALLARO

On 2/29/2016 5:18 PM, Gabriel Fernandez wrote:

This patch manages the case when you have an Ethernet MAC with
a "fixed link", and not connected to a normal MDIO-managed PHY device.

The test of phy_bus_name was not helpful because it was never affected
and replaced by the mdio test node.

Signed-off-by: Gabriel Fernandez 


Acked-by: Giuseppe Cavallaro 


---
  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 +--
  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |  9 -
  include/linux/stmmac.h|  1 +
  3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 0faf163..efb54f3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -199,21 +199,12 @@ int stmmac_mdio_register(struct net_device *ndev)
struct stmmac_priv *priv = netdev_priv(ndev);
struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
int addr, found;
-   struct device_node *mdio_node = NULL;
-   struct device_node *child_node = NULL;
+   struct device_node *mdio_node = priv->plat->mdio_node;

if (!mdio_bus_data)
return 0;

if (IS_ENABLED(CONFIG_OF)) {
-   for_each_child_of_node(priv->device->of_node, child_node) {
-   if (of_device_is_compatible(child_node,
-   "snps,dwmac-mdio")) {
-   mdio_node = child_node;
-   break;
-   }
-   }
-
if (mdio_node) {
netdev_dbg(ndev, "FOUND MDIO subnode\n");
} else {
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 6a52fa1..4514ba7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -110,6 +110,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const 
char **mac)
struct device_node *np = pdev->dev.of_node;
struct plat_stmmacenet_data *plat;
struct stmmac_dma_cfg *dma_cfg;
+   struct device_node *child_node = NULL;

plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
if (!plat)
@@ -140,13 +141,19 @@ stmmac_probe_config_dt(struct platform_device *pdev, 
const char **mac)
plat->phy_node = of_node_get(np);
}

+   for_each_child_of_node(np, child_node)
+   if (of_device_is_compatible(child_node, "snps,dwmac-mdio")) {
+   plat->mdio_node = child_node;
+   break;
+   }
+
/* "snps,phy-addr" is not a standard property. Mark it as deprecated
 * and warn of its use. Remove this when phy node support is added.
 */
if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0)
dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n");

-   if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name)
+   if ((plat->phy_node && !of_phy_is_fixed_link(np)) || !plat->mdio_node)
plat->mdio_bus_data = NULL;
else
plat->mdio_bus_data =
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index eead8ab..881a79d 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -100,6 +100,7 @@ struct plat_stmmacenet_data {
int interface;
struct stmmac_mdio_bus_data *mdio_bus_data;
struct device_node *phy_node;
+   struct device_node *mdio_node;
struct stmmac_dma_cfg *dma_cfg;
int clk_csr;
int has_gmac;





[RFC 01/15] clocksource: atmel: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/clocksource/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index c346be650892..5927944b46e0 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -239,6 +239,7 @@ config ATMEL_PIT
 
 config ATMEL_ST
bool
+   depends on HAS_IOMEM# For MFD_SYSCON
select CLKSRC_OF
select MFD_SYSCON
 
-- 
2.5.0



[RFC 06/15] pinctrl: rockchip: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/pinctrl/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index fb8200b8e8ec..dc7ab58d4d74 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -131,6 +131,7 @@ config PINCTRL_MESON
 
 config PINCTRL_ROCKCHIP
bool
+   depends on HAS_IOMEM# For MFD_SYSCON
select PINMUX
select GENERIC_PINCONF
select GENERIC_IRQ_CHIP
-- 
2.5.0



[RFC 05/15] phy: hi6220: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/phy/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 0124d17bd9fe..cfdb3551a675 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -225,6 +225,7 @@ config PHY_MT65XX_USB3
 config PHY_HI6220_USB
tristate "hi6220 USB PHY support"
depends on (ARCH_HISI && ARM64) || COMPILE_TEST
+   depends on HAS_IOMEM# For MFD_SYSCON
select GENERIC_PHY
select MFD_SYSCON
help
-- 
2.5.0



[RFC 03/15] hwspinlock: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/hwspinlock/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig
index 73a401662853..5ab2d51dc147 100644
--- a/drivers/hwspinlock/Kconfig
+++ b/drivers/hwspinlock/Kconfig
@@ -21,6 +21,7 @@ config HWSPINLOCK_OMAP
 config HWSPINLOCK_QCOM
tristate "Qualcomm Hardware Spinlock device"
depends on ARCH_QCOM
+   depends on HAS_IOMEM# For MFD_SYSCON
select HWSPINLOCK
select MFD_SYSCON
help
-- 
2.5.0



[RFC 04/15] irqchip: st: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/irqchip/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 00bbec6eca0b..10775b099daa 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -157,6 +157,7 @@ config RENESAS_IRQC
 config ST_IRQCHIP
bool
select REGMAP
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Enables SysCfg Controlled IRQs on STi based platforms.
-- 
2.5.0



[RFC 07/15] pinctrl: mvebu: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/pinctrl/mvebu/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/mvebu/Kconfig b/drivers/pinctrl/mvebu/Kconfig
index 170602407c0d..13685923729c 100644
--- a/drivers/pinctrl/mvebu/Kconfig
+++ b/drivers/pinctrl/mvebu/Kconfig
@@ -7,6 +7,7 @@ config PINCTRL_MVEBU
 
 config PINCTRL_DOVE
bool
+   depends on HAS_IOMEM# For MFD_SYSCON
select PINCTRL_MVEBU
select MFD_SYSCON
 
-- 
2.5.0



[RFC 02/15] dmaengine: nxp: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/dma/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index c77f214c9466..7fbf96bff280 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -290,6 +290,7 @@ config LPC18XX_DMAMUX
bool "NXP LPC18xx/43xx DMA MUX for PL080"
depends on ARCH_LPC18XX || COMPILE_TEST
depends on OF && AMBA_PL08X
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Enable support for DMA on NXP LPC18xx/43xx platforms
-- 
2.5.0



[RFC 08/15] rtc: at91sam9: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/rtc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 0da40e2e4280..5c530b6b125d 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1302,6 +1302,7 @@ config RTC_DRV_AT91RM9200
 config RTC_DRV_AT91SAM9
tristate "AT91SAM9 RTT as RTC"
depends on ARCH_AT91 || COMPILE_TEST
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Some AT91SAM9 SoCs provide an RTT (Real Time Timer) block which
-- 
2.5.0



[RFC 12/15] soc: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/soc/qcom/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 461b387d03cc..24de48134c15 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -4,6 +4,7 @@
 config QCOM_GSBI
 tristate "QCOM General Serial Bus Interface"
 depends on ARCH_QCOM
+depends on HAS_IOMEM   # For MFD_SYSCON
 select MFD_SYSCON
 help
   Say y here to enable GSBI support.  The GSBI provides control
-- 
2.5.0



[RFC 11/15] power: reset: keystone: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/power/reset/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 0a6408a39c66..0f34846ae80d 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -141,6 +141,7 @@ config POWER_RESET_XGENE
 config POWER_RESET_KEYSTONE
bool "Keystone reset driver"
depends on ARCH_KEYSTONE
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Reboot support for the KEYSTONE SoCs.
-- 
2.5.0



[RFC 15/15] mfd: syscon: Fix build of missing ioremap on UM

2016-03-03 Thread Krzysztof Kozlowski
Since commit c89c0114955a ("mfd: syscon: Set regmap max_register in
of_syscon_register") the syscon uses ioremap so it fails on COMPILE_TEST
without HAS_IOMEM:

drivers/mfd/syscon.c: In function ‘of_syscon_register’:
drivers/mfd/syscon.c:67:9: error: implicit declaration of function ‘ioremap’ 
[-Werror=implicit-function-declaration]
  base = ioremap(res.start, resource_size(&res));
 ^
drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer 
without a cast [-Wint-conversion]
  base = ioremap(res.start, resource_size(&res));
   ^
drivers/mfd/syscon.c:109:2: error: implicit declaration of function ‘iounmap’ 
[-Werror=implicit-function-declaration]
  iounmap(base);

When selecting MFD_SYSCON, depend on HAS_IOMEM to avoid unmet direct
dependencies.

Reported-by: kbuild test robot 
Fixes: c89c0114955a ("mfd: syscon: Set regmap max_register in 
of_syscon_register")
Signed-off-by: Krzysztof Kozlowski 
---
 drivers/mfd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index aa21dc55eb15..2e5b1e525a1d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1034,6 +1034,7 @@ config MFD_SUN6I_PRCM
 
 config MFD_SYSCON
bool "System Controller Register R/W Based on Regmap"
+   depends on HAS_IOMEM
select REGMAP_MMIO
help
  Select this option to enable accessing system control registers
-- 
2.5.0



[RFC 14/15] usb: xhci: mtk: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/usb/host/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 8c20ebbc049c..f759a778d606 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -45,6 +45,7 @@ config USB_XHCI_PLATFORM
 
 config USB_XHCI_MTK
tristate "xHCI support for Mediatek MT65xx"
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
depends on ARCH_MEDIATEK || COMPILE_TEST
---help---
-- 
2.5.0



[RFC 10/15] net: ethernet: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/net/ethernet/hisilicon/Kconfig  | 1 +
 drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 ++
 drivers/net/ethernet/ti/Kconfig | 1 +
 3 files changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/Kconfig 
b/drivers/net/ethernet/hisilicon/Kconfig
index 74beb1867230..6a9c91781bf9 100644
--- a/drivers/net/ethernet/hisilicon/Kconfig
+++ b/drivers/net/ethernet/hisilicon/Kconfig
@@ -26,6 +26,7 @@ config HIX5HD2_GMAC
 config HIP04_ETH
tristate "HISILICON P04 Ethernet support"
select MARVELL_PHY
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
select HNS_MDIO
---help---
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig 
b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index cec147d1d34f..d6902bf6e90f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -16,6 +16,7 @@ if STMMAC_ETH
 config STMMAC_PLATFORM
tristate "STMMAC Platform bus support"
depends on STMMAC_ETH
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
default y
---help---
@@ -41,6 +42,7 @@ config DWMAC_IPQ806X
tristate "QCA IPQ806x DWMAC support"
default ARCH_QCOM
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Support for QCA IPQ806X DWMAC Ethernet.
@@ -54,6 +56,7 @@ config DWMAC_LPC18XX
tristate "NXP LPC18xx/43xx DWMAC support"
default ARCH_LPC18XX
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
---help---
  Support for NXP LPC18xx/43xx DWMAC Ethernet.
@@ -73,6 +76,7 @@ config DWMAC_ROCKCHIP
tristate "Rockchip dwmac support"
default ARCH_ROCKCHIP
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Support for Ethernet controller on Rockchip RK3288 SoC.
@@ -84,6 +88,7 @@ config DWMAC_SOCFPGA
tristate "SOCFPGA dwmac support"
default ARCH_SOCFPGA
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Support for ethernet controller on Altera SOCFPGA
@@ -96,6 +101,7 @@ config DWMAC_STI
tristate "STi GMAC support"
default ARCH_STI
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
---help---
  Support for ethernet controller on STi SOCs.
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index e7f0b7d95b65..ec56cebe929d 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -62,6 +62,7 @@ config TI_CPSW_ALE
 config TI_CPSW
tristate "TI CPSW Switch Support"
depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
+   depends on HAS_IOMEM# For MFD_SYSCON
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
-- 
2.5.0



[RFC 13/15] staging: media: omap4iss: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/staging/media/omap4iss/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/omap4iss/Kconfig 
b/drivers/staging/media/omap4iss/Kconfig
index 46183464ee79..7dea072172aa 100644
--- a/drivers/staging/media/omap4iss/Kconfig
+++ b/drivers/staging/media/omap4iss/Kconfig
@@ -2,6 +2,7 @@ config VIDEO_OMAP4
tristate "OMAP 4 Camera support"
depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && I2C && ARCH_OMAP4
depends on HAS_DMA
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
select VIDEOBUF2_DMA_CONTIG
---help---
-- 
2.5.0



[RFC 09/15] media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/media/platform/Kconfig| 1 +
 drivers/media/platform/exynos4-is/Kconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 201f5c296a95..e5931e434fa2 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -79,6 +79,7 @@ config VIDEO_OMAP3
depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
depends on HAS_DMA && OF
depends on OMAP_IOMMU
+   depends on HAS_IOMEM# For MFD_SYSCON
select ARM_DMA_USE_IOMMU
select VIDEOBUF2_DMA_CONTIG
select MFD_SYSCON
diff --git a/drivers/media/platform/exynos4-is/Kconfig 
b/drivers/media/platform/exynos4-is/Kconfig
index 57d42c6172c5..c4317b99d257 100644
--- a/drivers/media/platform/exynos4-is/Kconfig
+++ b/drivers/media/platform/exynos4-is/Kconfig
@@ -17,6 +17,7 @@ config VIDEO_S5P_FIMC
tristate "S5P/EXYNOS4 FIMC/CAMIF camera interface driver"
depends on I2C
depends on HAS_DMA
+   depends on HAS_IOMEM# For MFD_SYSCON
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
select MFD_SYSCON
-- 
2.5.0



[RFC 00/15] tree-wide: mfd: syscon: Fix unmet ioremap dependency

2016-03-03 Thread Krzysztof Kozlowski
Hi,

Building allyesconfig on ARCH=um fails with:
   drivers/mfd/syscon.c: In function ‘of_syscon_register’:
   drivers/mfd/syscon.c:67:9: error: implicit declaration of function ‘ioremap’ 
[-Werror=implicit-function-declaration]
  base = ioremap(res.start, resource_size(&res));

Since commit c89c0114955a ("mfd: syscon: Set regmap max_register in
of_syscon_register") the syscon depends on HAS_IOMEM because
it uses the ioremap().

However syscon is often directly selected... so first the dependency on
HAS_IOMEM has to be added to all selecting symbols.

Comments are welcomed whether this is appropriate approach.


The last patch "mfd: syscon: Fix build of missing ioremap on UM" should
enter all other to avoid kbuild complains like:

warning: (ST_IRQCHIP && HIP04_ETH && STMMAC_PLATFORM && DWMAC_IPQ806X &&
DWMAC_LPC18XX && DWMAC_ROCKCHIP && DWMAC_SOCFPGA && DWMAC_STI && TI_CPSW
&& PINCTRL_ROCKCHIP && PINCTRL_DOVE && POWER_RESET_KEYSTONE &&
S3C2410_WATCHDOG && VIDEO_OMAP3 && VIDEO_S5P_FIMC && USB_XHCI_MTK &&
RTC_DRV_AT91SAM9 && LPC18XX_DMAMUX && VIDEO_OMAP4 && HWSPINLOCK_QCOM && ATMEL_ST
&& QCOM_GSBI && PHY_HI6220_USB)
selects MFD_SYSCON which has unmet direct dependencies (HAS_IOMEM)


Best regards,
Krzysztof


Krzysztof Kozlowski (15):
  clocksource: atmel: Add missing MFD_SYSCON dependency on HAS_IOMEM
  dmaengine: nxp: Add missing MFD_SYSCON dependency on HAS_IOMEM
  hwspinlock: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM
  irqchip: st: Add missing MFD_SYSCON dependency on HAS_IOMEM
  phy: hi6220: Add missing MFD_SYSCON dependency on HAS_IOMEM
  pinctrl: rockchip: Add missing MFD_SYSCON dependency on HAS_IOMEM
  pinctrl: mvebu: Add missing MFD_SYSCON dependency on HAS_IOMEM
  rtc: at91sam9: Add missing MFD_SYSCON dependency on HAS_IOMEM
  media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM
  net: ethernet: Add missing MFD_SYSCON dependency on HAS_IOMEM
  power: reset: keystone: Add missing MFD_SYSCON dependency on HAS_IOMEM
  soc: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM
  staging: media: omap4iss: Add missing MFD_SYSCON dependency on
HAS_IOMEM
  usb: xhci: mtk: Add missing MFD_SYSCON dependency on HAS_IOMEM
  mfd: syscon: Fix build of missing ioremap on UM

 drivers/clocksource/Kconfig | 1 +
 drivers/dma/Kconfig | 1 +
 drivers/hwspinlock/Kconfig  | 1 +
 drivers/irqchip/Kconfig | 1 +
 drivers/media/platform/Kconfig  | 1 +
 drivers/media/platform/exynos4-is/Kconfig   | 1 +
 drivers/mfd/Kconfig | 1 +
 drivers/net/ethernet/hisilicon/Kconfig  | 1 +
 drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 ++
 drivers/net/ethernet/ti/Kconfig | 1 +
 drivers/phy/Kconfig | 1 +
 drivers/pinctrl/Kconfig | 1 +
 drivers/pinctrl/mvebu/Kconfig   | 1 +
 drivers/power/reset/Kconfig | 1 +
 drivers/rtc/Kconfig | 1 +
 drivers/soc/qcom/Kconfig| 1 +
 drivers/staging/media/omap4iss/Kconfig  | 1 +
 drivers/usb/host/Kconfig| 1 +
 18 files changed, 23 insertions(+)

-- 
2.5.0



Re: [PATCH 2/2] isdn: i4l: move active-isdn drivers to staging

2016-03-03 Thread isdn
Hi Arnd,
I fully agree and ack.
Thanks for the work.
Am 02.03.2016 um 20:06 schrieb Arnd Bergmann:
> The icn, act2000 and pcbit drivers are all for very old hardware,
> and it is highly unlikely that anyone is actually still using them
> on modern kernels, if at all.
> 
> All three drivers apparently are for hardware that predates PCI
> being the common connector, as they are ISA-only and active
> PCI ISDN cards were widely available in the 1990s.
> 
> Looking through the git logs, it I cannot find any indication of a
> patch to any of these drivers that has been tested on real hardware,
> only cleanups or global API changes.
> 
> Signed-off-by: Arnd Bergmann 
> ---
>  Documentation/isdn/00-INDEX |  8 
>  drivers/isdn/Makefile   |  3 ---
>  drivers/isdn/i4l/Kconfig| 10 --
>  drivers/staging/Kconfig |  2 ++
>  drivers/staging/Makefile|  1 +
>  .../staging/i4l/Documentation}/README.act2000   |  0
>  .../isdn => drivers/staging/i4l/Documentation}/README.icn   |  0
>  .../isdn => drivers/staging/i4l/Documentation}/README.pcbit |  0
>  .../isdn => drivers/staging/i4l/Documentation}/README.sc|  0
>  drivers/staging/i4l/Kconfig | 13 
> +
>  drivers/staging/i4l/Makefile|  5 +
>  drivers/staging/i4l/TODO|  3 +++
>  drivers/{isdn => staging/i4l}/act2000/Kconfig   |  0
>  drivers/{isdn => staging/i4l}/act2000/Makefile  |  0
>  drivers/{isdn => staging/i4l}/act2000/act2000.h |  0
>  drivers/{isdn => staging/i4l}/act2000/act2000_isa.c |  0
>  drivers/{isdn => staging/i4l}/act2000/act2000_isa.h |  0
>  drivers/{isdn => staging/i4l}/act2000/capi.c|  0
>  drivers/{isdn => staging/i4l}/act2000/capi.h|  0
>  drivers/{isdn => staging/i4l}/act2000/module.c  |  0
>  drivers/{isdn => staging/i4l}/icn/Kconfig   |  0
>  drivers/{isdn => staging/i4l}/icn/Makefile  |  0
>  drivers/{isdn => staging/i4l}/icn/icn.c |  0
>  drivers/{isdn => staging/i4l}/icn/icn.h |  0
>  drivers/{isdn => staging/i4l}/pcbit/Kconfig |  0
>  drivers/{isdn => staging/i4l}/pcbit/Makefile|  0
>  drivers/{isdn => staging/i4l}/pcbit/callbacks.c |  0
>  drivers/{isdn => staging/i4l}/pcbit/callbacks.h |  0
>  drivers/{isdn => staging/i4l}/pcbit/capi.c  |  0
>  drivers/{isdn => staging/i4l}/pcbit/capi.h  |  0
>  drivers/{isdn => staging/i4l}/pcbit/drv.c   |  0
>  drivers/{isdn => staging/i4l}/pcbit/edss1.c |  0
>  drivers/{isdn => staging/i4l}/pcbit/edss1.h |  0
>  drivers/{isdn => staging/i4l}/pcbit/layer2.c|  0
>  drivers/{isdn => staging/i4l}/pcbit/layer2.h|  0
>  drivers/{isdn => staging/i4l}/pcbit/module.c|  0
>  drivers/{isdn => staging/i4l}/pcbit/pcbit.h |  0
>  37 files changed, 24 insertions(+), 21 deletions(-)
>  rename {Documentation/isdn => 
> drivers/staging/i4l/Documentation}/README.act2000 (100%)
>  rename {Documentation/isdn => drivers/staging/i4l/Documentation}/README.icn 
> (100%)
>  rename {Documentation/isdn => 
> drivers/staging/i4l/Documentation}/README.pcbit (100%)
>  rename {Documentation/isdn => drivers/staging/i4l/Documentation}/README.sc 
> (100%)
>  create mode 100644 drivers/staging/i4l/Kconfig
>  create mode 100644 drivers/staging/i4l/Makefile
>  create mode 100644 drivers/staging/i4l/TODO
>  rename drivers/{isdn => staging/i4l}/act2000/Kconfig (100%)
>  rename drivers/{isdn => staging/i4l}/act2000/Makefile (100%)
>  rename drivers/{isdn => staging/i4l}/act2000/act2000.h (100%)
>  rename drivers/{isdn => staging/i4l}/act2000/act2000_isa.c (100%)
>  rename drivers/{isdn => staging/i4l}/act2000/act2000_isa.h (100%)
>  rename drivers/{isdn => staging/i4l}/act2000/capi.c (100%)
>  rename drivers/{isdn => staging/i4l}/act2000/capi.h (100%)
>  rename drivers/{isdn => staging/i4l}/act2000/module.c (100%)
>  rename drivers/{isdn => staging/i4l}/icn/Kconfig (100%)
>  rename drivers/{isdn => staging/i4l}/icn/Makefile (100%)
>  rename drivers/{isdn => staging/i4l}/icn/icn.c (100%)
>  rename drivers/{isdn => staging/i4l}/icn/icn.h (100%)
>  rename drivers/{isdn => staging/i4l}/pcbit/Kconfig (100%)
>  rename drivers/{isdn => staging/i4l}/pcbit/Makefile (100%)
>  rename drivers/{isdn => staging/i4l}/pcbit/callbacks.c (100%)
>  rename drivers/{isdn => staging/i4l}/pcbit/callbacks.h (100%)
>  rename drivers/{isdn => staging/i4l}/pcbit/capi.c (100%)
>  rename drivers/{isdn => staging/i4l}/pcbit/capi.h (100%)
>  rename drivers/{isdn => staging/i4l}/pcbit/drv.c (100%)
>  re

Re: [V9fs-developer] [PATCH] net/9p: convert to new CQ API

2016-03-03 Thread Christoph Hellwig
New version with the nits fixed below.  Now that checkpath started
a stupid warning about not using tabs for indentation which I've
ignored here and will take up in my usual fights against Joes
idicotic opinions separately..

--
>From 0055e31f24c7b3642ece5ebb998fa63d772dcb1a Mon Sep 17 00:00:00 2001
From: Christoph Hellwig 
Date: Sat, 27 Feb 2016 10:22:40 +0100
Subject: net/9p: convert to new CQ API

Trivial conversion to the new RDMA CQ API.

Signed-off-by: Christoph Hellwig 
---
 net/9p/trans_rdma.c | 86 +++--
 1 file changed, 31 insertions(+), 55 deletions(-)

diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 52b4a2f..1852e38 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -109,14 +109,13 @@ struct p9_trans_rdma {
 /**
  * p9_rdma_context - Keeps track of in-process WR
  *
- * @wc_op: The original WR op for when the CQE completes in error.
  * @busa: Bus address to unmap when the WR completes
  * @req: Keeps track of requests (send)
  * @rc: Keepts track of replies (receive)
  */
 struct p9_rdma_req;
 struct p9_rdma_context {
-   enum ib_wc_opcode wc_op;
+   struct ib_cqe cqe;
dma_addr_t busa;
union {
struct p9_req_t *req;
@@ -284,9 +283,12 @@ p9_cm_event_handler(struct rdma_cm_id *id, struct 
rdma_cm_event *event)
 }
 
 static void
-handle_recv(struct p9_client *client, struct p9_trans_rdma *rdma,
-   struct p9_rdma_context *c, enum ib_wc_status status, u32 byte_len)
+recv_done(struct ib_cq *cq, struct ib_wc *wc)
 {
+   struct p9_client *client = cq->cq_context;
+   struct p9_trans_rdma *rdma = client->trans;
+   struct p9_rdma_context *c =
+   container_of(wc->wr_cqe, struct p9_rdma_context, cqe);
struct p9_req_t *req;
int err = 0;
int16_t tag;
@@ -295,7 +297,7 @@ handle_recv(struct p9_client *client, struct p9_trans_rdma 
*rdma,
ib_dma_unmap_single(rdma->cm_id->device, c->busa, client->msize,
 DMA_FROM_DEVICE);
 
-   if (status != IB_WC_SUCCESS)
+   if (wc->status != IB_WC_SUCCESS)
goto err_out;
 
err = p9_parse_header(c->rc, NULL, NULL, &tag, 1);
@@ -316,21 +318,32 @@ handle_recv(struct p9_client *client, struct 
p9_trans_rdma *rdma,
req->rc = c->rc;
p9_client_cb(client, req, REQ_STATUS_RCVD);
 
+ out:
+   up(&rdma->rq_sem);
+   kfree(c);
return;
 
  err_out:
-   p9_debug(P9_DEBUG_ERROR, "req %p err %d status %d\n", req, err, status);
+   p9_debug(P9_DEBUG_ERROR, "req %p err %d status %d\n",
+   req, err, wc->status);
rdma->state = P9_RDMA_FLUSHING;
client->status = Disconnected;
+   goto out;
 }
 
 static void
-handle_send(struct p9_client *client, struct p9_trans_rdma *rdma,
-   struct p9_rdma_context *c, enum ib_wc_status status, u32 byte_len)
+send_done(struct ib_cq *cq, struct ib_wc *wc)
 {
+   struct p9_client *client = cq->cq_context;
+   struct p9_trans_rdma *rdma = client->trans;
+   struct p9_rdma_context *c =
+   container_of(wc->wr_cqe, struct p9_rdma_context, cqe);
+
ib_dma_unmap_single(rdma->cm_id->device,
c->busa, c->req->tc->size,
DMA_TO_DEVICE);
+   up(&rdma->sq_sem);
+   kfree(c);
 }
 
 static void qp_event_handler(struct ib_event *event, void *context)
@@ -339,42 +352,6 @@ static void qp_event_handler(struct ib_event *event, void 
*context)
 event->event, context);
 }
 
-static void cq_comp_handler(struct ib_cq *cq, void *cq_context)
-{
-   struct p9_client *client = cq_context;
-   struct p9_trans_rdma *rdma = client->trans;
-   int ret;
-   struct ib_wc wc;
-
-   ib_req_notify_cq(rdma->cq, IB_CQ_NEXT_COMP);
-   while ((ret = ib_poll_cq(cq, 1, &wc)) > 0) {
-   struct p9_rdma_context *c = (void *) (unsigned long) wc.wr_id;
-
-   switch (c->wc_op) {
-   case IB_WC_RECV:
-   handle_recv(client, rdma, c, wc.status, wc.byte_len);
-   up(&rdma->rq_sem);
-   break;
-
-   case IB_WC_SEND:
-   handle_send(client, rdma, c, wc.status, wc.byte_len);
-   up(&rdma->sq_sem);
-   break;
-
-   default:
-   pr_err("unexpected completion type, c->wc_op=%d, 
wc.opcode=%d, status=%d\n",
-  c->wc_op, wc.opcode, wc.status);
-   break;
-   }
-   kfree(c);
-   }
-}
-
-static void cq_event_handler(struct ib_event *e, void *v)
-{
-   p9_debug(P9_DEBUG_ERROR, "CQ event %d context %p\n", e->event, v);
-}
-
 static void rdma_destroy_trans(struct p9_trans_rdma *rdma)
 {
if (!rdma)
@@ -387,7 +364,7 @@ static void rdma_destroy_trans(struct p9_trans_r

Re: [PATCH net] vxlan: fix missing options_len update on RX with collect metadata

2016-03-03 Thread Daniel Borkmann

On 03/03/2016 02:21 AM, Cong Wang wrote:

On Tue, Mar 1, 2016 at 5:32 PM, Daniel Borkmann  wrote:

When signalling to metadata consumers that the metadata_dst entry
carries additional GBP extension data for vxlan (TUNNEL_VXLAN_OPT),
the dst's vxlan_metadata information is populated, but options_len
is left to zero. F.e. in ovs, ovs_flow_key_extract() checks for
options_len before extracting the data through ip_tunnel_info_opts_get().

Geneve uses ip_tunnel_info_opts_set() helper in receive path, which
sets options_len internally, vxlan however uses ip_tunnel_info_opts(),
so when filling vxlan_metadata, we do need to update options_len.

Fixes: 4c22279848c5 ("ip-tunnel: Use API to access tunnel metadata options.")
Signed-off-by: Daniel Borkmann 
---
  drivers/net/vxlan.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index b601139..1c32bd1 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1308,8 +1308,10 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct 
sk_buff *skb)
 gbp = (struct vxlanhdr_gbp *)vxh;
 md->gbp = ntohs(gbp->policy_id);

-   if (tun_dst)
+   if (tun_dst) {
 tun_dst->u.tun_info.key.tun_flags |= TUNNEL_VXLAN_OPT;
+   tun_dst->u.tun_info.options_len = sizeof(*md);
+   }



Why not set it in tun_rx_dst() where it is allocated?


Nope, current convention is to only fill options_len when an actual
option was detected on RX, f.e. see ip_tunnel_info_opts_set() in
geneve. Consumers like ovs_flow_key_extract() check for options_len
and not TUNNEL_OPTIONS_PRESENT to copy it via ip_tunnel_info_opts_get()
from there.


Re: net/bluetooth: workqueue destruction WARNING in hci_unregister_dev

2016-03-03 Thread Jiri Slaby
Hi,

On 03/02/2016, 04:45 PM, Tejun Heo wrote:
> On Fri, Feb 19, 2016 at 01:10:00PM +0100, Jiri Slaby wrote:
>>> 1. didn't help, the problem persists. So I haven't applied the patch from 2.
>>
>> FWIW I dumped more info about the wq:
>> wq->name='hci0' pwq=8800390d7600 wq->dfl_pwq=8800390d5200
>> pwq->refcnt=2 pwq->nr_active=0 delayed_works: 
> 
> Can you please print out the same info for all pwq's during shutdown?
> It looks like we're leaking pwq refcnt but I can't spot a place where
> that could happen on an empty pwq.

I have not done that yet, but today, I see:
destroy_workqueue: name='req_hci0' pwq=88002f590300
wq->dfl_pwq=88002f591e00 pwq->refcnt=2 pwq->nr_active=0 delayed_works:
   pwq 12: cpus=0-1 node=0 flags=0x4 nice=-20 active=0/1
 in-flight: 18568:wq_barrier_func

thanks,
-- 
js
suse labs


[PATCH net-next V1 01/10] net/flower: Introduce hardware offload support

2016-03-03 Thread Amir Vadai
This patch is based on a patch made by John Fastabend.
It adds support for offloading cls_flower.
when NETIF_F_HW_TC is on:
  flags = 0   => Rule will be processed twice - by hardware, and if
 still relevant, by software.
  flags = SKIP_HW => Rull will be processed by software only

If hardare fail/not capabale to apply the rule, operation will fail.

Suggested-by: John Fastabend 
Signed-off-by: Amir Vadai 
---
 include/linux/netdevice.h|  2 ++
 include/net/pkt_cls.h| 14 +
 include/uapi/linux/pkt_cls.h |  2 ++
 net/sched/cls_flower.c   | 71 +++-
 4 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index efe7cec..12db9d6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -785,6 +785,7 @@ typedef u16 (*select_queue_fallback_t)(struct net_device 
*dev,
 enum {
TC_SETUP_MQPRIO,
TC_SETUP_CLSU32,
+   TC_SETUP_CLSFLOWER,
 };
 
 struct tc_cls_u32_offload;
@@ -794,6 +795,7 @@ struct tc_to_netdev {
union {
u8 tc;
struct tc_cls_u32_offload *cls_u32;
+   struct tc_cls_flower_offload *cls_flower;
};
 };
 
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index bea14ee..5b4e8f0 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -409,4 +409,18 @@ static inline bool tc_should_offload(struct net_device 
*dev, u32 flags)
return true;
 }
 
+enum tc_fl_command {
+   TC_CLSFLOWER_REPLACE,
+   TC_CLSFLOWER_DESTROY,
+};
+
+struct tc_cls_flower_offload {
+   enum tc_fl_command command;
+   u64 cookie;
+   struct flow_dissector *dissector;
+   struct fl_flow_key *mask;
+   struct fl_flow_key *key;
+   struct tcf_exts *exts;
+};
+
 #endif
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 9874f568..c43c5f7 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -417,6 +417,8 @@ enum {
TCA_FLOWER_KEY_TCP_DST, /* be16 */
TCA_FLOWER_KEY_UDP_SRC, /* be16 */
TCA_FLOWER_KEY_UDP_DST, /* be16 */
+
+   TCA_FLOWER_FLAGS,
__TCA_FLOWER_MAX,
 };
 
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 95b0212..ed3cd5a 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -165,6 +165,52 @@ static void fl_destroy_filter(struct rcu_head *head)
kfree(f);
 }
 
+static void fl_hw_destroy_filter(struct tcf_proto *tp, u64 cookie)
+{
+   struct net_device *dev = tp->q->dev_queue->dev;
+   struct tc_cls_flower_offload offload = {0};
+   struct tc_to_netdev tc;
+
+   if (!tc_should_offload(dev, 0))
+   return;
+
+   offload.command = TC_CLSFLOWER_DESTROY;
+   offload.cookie = cookie;
+
+   tc.type = TC_SETUP_CLSFLOWER;
+   tc.cls_flower = &offload;
+
+   dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol, &tc);
+}
+
+static int fl_hw_replace_filter(struct tcf_proto *tp,
+   struct flow_dissector *dissector,
+   struct fl_flow_key *mask,
+   struct fl_flow_key *key,
+   struct tcf_exts *actions,
+   u64 cookie, u32 flags)
+{
+   struct net_device *dev = tp->q->dev_queue->dev;
+   struct tc_cls_flower_offload offload = {0};
+   struct tc_to_netdev tc;
+
+   if (!tc_should_offload(dev, flags))
+   return 0;
+
+   offload.command = TC_CLSFLOWER_REPLACE;
+   offload.cookie = cookie;
+   offload.dissector = dissector;
+   offload.mask = mask;
+   offload.key = key;
+   offload.exts = actions;
+
+   tc.type = TC_SETUP_CLSFLOWER;
+   tc.cls_flower = &offload;
+
+   return dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol,
+&tc);
+}
+
 static bool fl_destroy(struct tcf_proto *tp, bool force)
 {
struct cls_fl_head *head = rtnl_dereference(tp->root);
@@ -174,6 +220,7 @@ static bool fl_destroy(struct tcf_proto *tp, bool force)
return false;
 
list_for_each_entry_safe(f, next, &head->filters, list) {
+   fl_hw_destroy_filter(tp, (u64)f);
list_del_rcu(&f->list);
call_rcu(&f->rcu, fl_destroy_filter);
}
@@ -454,11 +501,13 @@ static int fl_change(struct net *net, struct sk_buff 
*in_skb,
 u32 handle, struct nlattr **tca,
 unsigned long *arg, bool ovr)
 {
+   struct net_device *dev = tp->q->dev_queue->dev;
struct cls_fl_head *head = rtnl_dereference(tp->root);
struct cls_fl_filter *fold = (struct cls_fl_filter *) *arg;
struct cls_fl_filter *fnew;
struct nlattr *tb[TCA_FLOWER_MAX + 1];
struct fl_flow_mask mask = {};
+   u32 flags = 0

[PATCH net-next V1 00/10] cls_flower hardware offload support

2016-03-03 Thread Amir Vadai
Hi,

Please see changes from V0 at the bottom.

This patchset introduces cls_flower hardware offload support over ConnectX-4
driver, more hardware vendors are welcome to use it too.

This patchset is based on John's infrastructure for tc offloading [2] to add
hardware offload support to the flower filter. It also extends the support to
an additional tc action - skbedit mark operation.
NIC driver that was used is ConnectX-4. Feature is off by default and could be
turned on using ethtool.

Some commands to use this code:

export TC=../iproute2/tc/tc
export ETH=ens9

ethtool  -K ens9 hw-tc-offload on

# add an ingress qdisc
$TC qdisc add dev $ETH ingress

# Drop ICMP (ip_proto 1) packets
$TC filter add dev $ETH protocol ip prio 20 parent : \
flower ip_proto 1 \
dst_mac 7c:fe:90:69:81:62 \
src_mac 7c:fe:90:69:81:56 \
dst_ip 11.11.11.11 \
src_ip 11.11.11.12 \
indev $ETH \
action drop

# Mark (with 0x1234) TCP (ip_proto 6) packets
$TC filter add dev $ETH protocol ip prio 30 parent : \
flower ip_proto 6 \
indev $ETH \
action skbedit mark 0x1234

# A NOP software filter used to count marked packets using "tc show -s"
$TC filter add dev $ETH protocol ip prio 10 parent : \
handle 0x1234 fw action pass

The code was tested and applied on top of commit 3ebeac1 ("Merge branch
'cxgb4-next'")

Changes from V0:
- Use tc_no_actions and tc_for_each_action instead of ifdef CONFIG_NET_CLS_ACT
- Replace ENOTSUPP (and some EINVAL) with EOPNOTSUPP
- Name the flower command enum
- fl_hw_destroy_filter() to return void - nobody uses the return value
- mlx5e_tc_init() and mlx5e_tc_cleanup() to be called from the right places.
- When adding HW rule fails - fail the command
- Rules are added to be processed both by HW and SW unless SKIP_HW is given
- Adding patch 6/10 ("net/mlx5e: Relax ndo_setup_tc handle restriction")

Main changes from the RFC [1]:
- API
  - Using ndo_setup_tc() instead of switchdev
- act_skbedit, act_gact
  - Actions are not serialized to NIC driver, instead using access functions.
- cls_flower
  - prevent double classification by software by not adding
successfuly offloaded filters to the hashtable
  - Fixed some bugs in original RFC with rule delete  
- mlx5
  - Adding flow table to kernel namespace instead of a new namespace
  - s/offload/tc/ in many places
  - no need for a special kconfig since switchdev is not used

Thanks,
Amir

[1] - http://permalink.gmane.org/gmane.linux.network/397064
[2] - http://permalink.gmane.org/gmane.linux.network/397045 
[3] - http://permalink.gmane.org/gmane.linux.network/401226

Amir Vadai (10):
  net/flower: Introduce hardware offload support
  net/flow_dissector: Make dissector_uses_key() and
skb_flow_dissector_target() public
  net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef
  net/act_skbedit: Utility functions for mark action
  net/mlx5_core: Set flow steering dest only for forward rules
  net/mlx5e: Relax ndo_setup_tc handle restriction
  net/mlx5e: Add a new priority for kernel flow tables
  net/mlx5e: Introduce tc offload support
  net/mlx5e: Support offload cls_flower with drop action
  net/mlx5e: Support offload cls_flower with skbedit mark action

 drivers/net/ethernet/mellanox/mlx5/core/Makefile  |   2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |   9 +
 drivers/net/ethernet/mellanox/mlx5/core/en_fs.c   |   4 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |  47 ++-
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c   |   3 +
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c   | 429 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.h   |  51 +++
 drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c  |  29 +-
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |  22 +-
 include/linux/netdevice.h |   2 +
 include/net/act_api.h |  21 +-
 include/net/flow_dissector.h  |  13 +
 include/net/pkt_cls.h |  14 +
 include/net/tc_act/tc_gact.h  |   4 +-
 include/net/tc_act/tc_skbedit.h   |  15 +
 include/uapi/linux/pkt_cls.h  |   2 +
 net/core/flow_dissector.c |  13 -
 net/sched/cls_flower.c|  71 +++-
 18 files changed, 704 insertions(+), 47 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_tc.h

-- 
2.7.0



[PATCH net-next V1 02/10] net/flow_dissector: Make dissector_uses_key() and skb_flow_dissector_target() public

2016-03-03 Thread Amir Vadai
Will be used in a following patch to query if a key is being used, and
what it's value in the target object.

Signed-off-by: Amir Vadai 
---
 include/net/flow_dissector.h | 13 +
 net/core/flow_dissector.c| 13 -
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index 8c8548c..d3d60dc 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -184,4 +184,17 @@ static inline bool flow_keys_have_l4(struct flow_keys 
*keys)
 
 u32 flow_hash_from_keys(struct flow_keys *keys);
 
+static inline bool dissector_uses_key(const struct flow_dissector 
*flow_dissector,
+ enum flow_dissector_key_id key_id)
+{
+   return flow_dissector->used_keys & (1 << key_id);
+}
+
+static inline void *skb_flow_dissector_target(struct flow_dissector 
*flow_dissector,
+ enum flow_dissector_key_id key_id,
+ void *target_container)
+{
+   return ((char *)target_container) + flow_dissector->offset[key_id];
+}
+
 #endif
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 7c7b873..a669dea 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -19,25 +19,12 @@
 #include 
 #include 
 
-static bool dissector_uses_key(const struct flow_dissector *flow_dissector,
-  enum flow_dissector_key_id key_id)
-{
-   return flow_dissector->used_keys & (1 << key_id);
-}
-
 static void dissector_set_key(struct flow_dissector *flow_dissector,
  enum flow_dissector_key_id key_id)
 {
flow_dissector->used_keys |= (1 << key_id);
 }
 
-static void *skb_flow_dissector_target(struct flow_dissector *flow_dissector,
-  enum flow_dissector_key_id key_id,
-  void *target_container)
-{
-   return ((char *) target_container) + flow_dissector->offset[key_id];
-}
-
 void skb_flow_dissector_init(struct flow_dissector *flow_dissector,
 const struct flow_dissector_key *key,
 unsigned int key_count)
-- 
2.7.0



[PATCH net-next V1 05/10] net/mlx5_core: Set flow steering dest only for forward rules

2016-03-03 Thread Amir Vadai
We need to handle flow table entry destinations only if the action
associated with the rule is forwarding (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST).

Fixes: 26a8145390b3 ('net/mlx5_core: Introduce flow steering firmware commands')
Signed-off-by: Amir Vadai 
Signed-off-by: Maor Gottlieb 
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c  | 29 +--
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 18 +-
 2 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c 
b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
index a9894d2..f46f1db 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
@@ -218,19 +218,22 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
  match_value);
memcpy(in_match_value, &fte->val, MLX5_ST_SZ_BYTES(fte_match_param));
 
-   in_dests = MLX5_ADDR_OF(flow_context, in_flow_context, destination);
-   list_for_each_entry(dst, &fte->node.children, node.list) {
-   unsigned int id;
-
-   MLX5_SET(dest_format_struct, in_dests, destination_type,
-dst->dest_attr.type);
-   if (dst->dest_attr.type ==
-   MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE)
-   id = dst->dest_attr.ft->id;
-   else
-   id = dst->dest_attr.tir_num;
-   MLX5_SET(dest_format_struct, in_dests, destination_id, id);
-   in_dests += MLX5_ST_SZ_BYTES(dest_format_struct);
+   if (fte->action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
+   in_dests = MLX5_ADDR_OF(flow_context, in_flow_context, 
destination);
+   list_for_each_entry(dst, &fte->node.children, node.list) {
+   unsigned int id;
+
+   MLX5_SET(dest_format_struct, in_dests, destination_type,
+dst->dest_attr.type);
+   if (dst->dest_attr.type ==
+   MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE) {
+   id = dst->dest_attr.ft->id;
+   } else {
+   id = dst->dest_attr.tir_num;
+   }
+   MLX5_SET(dest_format_struct, in_dests, destination_id, 
id);
+   in_dests += MLX5_ST_SZ_BYTES(dest_format_struct);
+   }
}
memset(out, 0, sizeof(out));
err = mlx5_cmd_exec_check_status(dev, in, inlen, out,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c 
b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 6f68dba..f0e67d2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -360,8 +360,8 @@ static void del_rule(struct fs_node *node)
memcpy(match_value, fte->val, sizeof(fte->val));
fs_get_obj(ft, fg->node.parent);
list_del(&rule->node.list);
-   fte->dests_size--;
-   if (fte->dests_size) {
+   if ((fte->action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) &&
+   --fte->dests_size) {
err = mlx5_cmd_update_fte(dev, ft,
  fg->id, fte);
if (err)
@@ -763,7 +763,8 @@ static struct mlx5_flow_rule *alloc_rule(struct 
mlx5_flow_destination *dest)
return NULL;
 
rule->node.type = FS_TYPE_FLOW_DEST;
-   memcpy(&rule->dest_attr, dest, sizeof(*dest));
+   if (dest)
+   memcpy(&rule->dest_attr, dest, sizeof(*dest));
 
return rule;
 }
@@ -785,8 +786,9 @@ static struct mlx5_flow_rule *add_rule_fte(struct fs_fte 
*fte,
/* Add dest to dests list- added as first element after the head */
tree_init_node(&rule->node, 1, del_rule);
list_add_tail(&rule->node.list, &fte->node.children);
-   fte->dests_size++;
-   if (fte->dests_size == 1)
+   if (dest)
+   fte->dests_size++;
+   if (fte->dests_size == 1 || !dest)
err = mlx5_cmd_create_fte(get_dev(&ft->node),
  ft, fg->id, fte);
else
@@ -802,7 +804,8 @@ static struct mlx5_flow_rule *add_rule_fte(struct fs_fte 
*fte,
 free_rule:
list_del(&rule->node.list);
kfree(rule);
-   fte->dests_size--;
+   if (dest)
+   fte->dests_size--;
return ERR_PTR(err);
 }
 
@@ -996,6 +999,9 @@ mlx5_add_flow_rule(struct mlx5_flow_table *ft,
struct mlx5_flow_group *g;
struct mlx5_flow_rule *rule;
 
+   if ((action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) && !dest)
+   return ERR_PTR(-EINVAL);
+
nested_lock_ref_node(&ft->node, FS_MUTEX_GRANDPARENT);
fs_for_each_fg(g, ft)
if (compare_match_criteria(g->mask.match_criteria_enable,
-- 
2.7.0



[PATCH net-next V1 07/10] net/mlx5e: Add a new priority for kernel flow tables

2016-03-03 Thread Amir Vadai
Move the vlan and main flow tables to use priority 1. This will allow
the upcoming TC offload logic to use a higher priority (0) for the
offload steering table.

Signed-off-by: Amir Vadai 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_fs.c   | 4 ++--
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
index 80d81ab..d00a242 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
@@ -1041,7 +1041,7 @@ static int mlx5e_create_main_flow_table(struct mlx5e_priv 
*priv)
int err;
 
ft->num_groups = 0;
-   ft->t = mlx5_create_flow_table(priv->fts.ns, 0, MLX5E_MAIN_TABLE_SIZE);
+   ft->t = mlx5_create_flow_table(priv->fts.ns, 1, MLX5E_MAIN_TABLE_SIZE);
 
if (IS_ERR(ft->t)) {
err = PTR_ERR(ft->t);
@@ -1150,7 +1150,7 @@ static int mlx5e_create_vlan_flow_table(struct mlx5e_priv 
*priv)
int err;
 
ft->num_groups = 0;
-   ft->t = mlx5_create_flow_table(priv->fts.ns, 0, MLX5E_VLAN_TABLE_SIZE);
+   ft->t = mlx5_create_flow_table(priv->fts.ns, 1, MLX5E_VLAN_TABLE_SIZE);
 
if (IS_ERR(ft->t)) {
err = PTR_ERR(ft->t);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c 
b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index f0e67d2..e848d70 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -73,8 +73,8 @@
 #define BY_PASS_MIN_LEVEL (KENREL_MIN_LEVEL + MLX5_BY_PASS_NUM_PRIOS +\
   LEFTOVERS_MAX_FT)
 
-#define KERNEL_MAX_FT 2
-#define KERNEL_NUM_PRIOS 1
+#define KERNEL_MAX_FT 3
+#define KERNEL_NUM_PRIOS 2
 #define KENREL_MIN_LEVEL 2
 
 struct node_caps {
-- 
2.7.0



[PATCH net-next V1 08/10] net/mlx5e: Introduce tc offload support

2016-03-03 Thread Amir Vadai
Extend ndo_setup_tc() to support ingress tc offloading. Will be used by
later patches to offload tc flower filter.

Feature is off by default and could be enabled by issuing:
 # ethtool  -K eth0 hw-tc-offload on

Offloads flow table is dynamically created when first filter is
added.
Rules are saved in a hash table that is maintained by the consumer (for
example - the flower offload in the next patch).
When last filter is removed and no filters exist in the hash table, the
offload flow table is destroyed.

Signed-off-by: Amir Vadai 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/Makefile  |   2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |   9 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |  38 ++-
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c   | 131 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.h   |  44 
 5 files changed, 222 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_tc.h

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Makefile 
b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
index 11b592d..4fc45ee 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Makefile
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
@@ -6,6 +6,6 @@ mlx5_core-y :=  main.o cmd.o debugfs.o fw.o eq.o uar.o 
pagealloc.o \
 
 mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o eswitch.o \
en_main.o en_fs.o en_ethtool.o en_tx.o en_rx.o \
-   en_txrx.o en_clock.o vxlan.o
+   en_txrx.o en_clock.o vxlan.o en_tc.o
 
 mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) +=  en_dcbnl.o
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h 
b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 9c0e80e..36f3dba 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "wq.h"
 #include "mlx5_core.h"
 
@@ -526,8 +527,16 @@ struct mlx5e_flow_table {
struct mlx5_flow_group  **g;
 };
 
+struct mlx5e_tc_flow_table {
+   struct mlx5_flow_table  *t;
+
+   struct rhashtable_paramsht_params;
+   struct rhashtable   ht;
+};
+
 struct mlx5e_flow_tables {
struct mlx5_flow_namespace  *ns;
+   struct mlx5e_tc_flow_table  tc;
struct mlx5e_flow_table vlan;
struct mlx5e_flow_table main;
 };
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 5e3692f..011c4f6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -30,9 +30,12 @@
  * SOFTWARE.
  */
 
+#include 
+#include 
 #include 
 #include 
 #include "en.h"
+#include "en_tc.h"
 #include "eswitch.h"
 #include "vxlan.h"
 
@@ -1883,6 +1886,17 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 
tc)
 static int mlx5e_ndo_setup_tc(struct net_device *dev, u32 handle,
  __be16 proto, struct tc_to_netdev *tc)
 {
+   struct mlx5e_priv *priv = netdev_priv(dev);
+
+   if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS))
+   goto mqprio;
+
+   switch (tc->type) {
+   default:
+   return -EOPNOTSUPP;
+   }
+
+mqprio:
if (tc->type != TC_SETUP_MQPRIO)
return -EINVAL;
 
@@ -1966,6 +1980,13 @@ static int mlx5e_set_features(struct net_device *netdev,
mlx5e_disable_vlan_filter(priv);
}
 
+   if ((changes & NETIF_F_HW_TC) && !(features & NETIF_F_HW_TC) &&
+   mlx5e_tc_num_filters(priv)) {
+   netdev_err(netdev,
+  "Active offloaded tc filters, can't turn 
hw_tc_offload off\n");
+   return -EINVAL;
+   }
+
return err;
 }
 
@@ -2365,6 +2386,13 @@ static void mlx5e_build_netdev(struct net_device *netdev)
if (!priv->params.lro_en)
netdev->features  &= ~NETIF_F_LRO;
 
+#define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f)
+   if (FT_CAP(flow_modify_en) &&
+   FT_CAP(modify_root) &&
+   FT_CAP(identified_miss_table_mode) &&
+   FT_CAP(flow_table_modify))
+   priv->netdev->hw_features  |= NETIF_F_HW_TC;
+
netdev->features |= NETIF_F_HIGHDMA;
 
netdev->priv_flags   |= IFF_UNICAST_FLT;
@@ -2486,6 +2514,10 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev 
*mdev)
 
mlx5e_vxlan_init(priv);
 
+   err = mlx5e_tc_init(priv);
+   if (err)
+   goto err_destroy_flow_tables;
+
 #ifdef CONFIG_MLX5_CORE_EN_DCB
mlx5e_dcbnl_ieee_setets_core(priv, &priv->params.ets);
 #endif
@@ -2493,7 +2525,7 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev 
*mdev)
err = register_netdev(netdev);
i

[PATCH net-next V1 09/10] net/mlx5e: Support offload cls_flower with drop action

2016-03-03 Thread Amir Vadai
Parse tc_cls_flower_offload into device specific commands and program
the hardware to classify and act accordingly.

For example, to drop ICMP (ip_proto 1) packets from specific smac, dmac,
src_ip, src_ip, arriving to interface ens9:

 # tc qdisc add dev ens9 ingress

 # tc filter add dev ens9 protocol ip parent : \
 flower ip_proto 1 \
 dst_mac 7c:fe:90:69:81:62 src_mac 7c:fe:90:69:81:56 \
 dst_ip 11.11.11.11 src_ip 11.11.11.12 indev ens9 \
 action drop

Signed-off-by: Amir Vadai 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |   7 +
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c   | 297 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.h   |   5 +
 3 files changed, 309 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 011c4f6..9aa9103 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1892,6 +1892,13 @@ static int mlx5e_ndo_setup_tc(struct net_device *dev, 
u32 handle,
goto mqprio;
 
switch (tc->type) {
+   case TC_SETUP_CLSFLOWER:
+   switch (tc->cls_flower->command) {
+   case TC_CLSFLOWER_REPLACE:
+   return mlx5e_configure_flower(priv, proto, 
tc->cls_flower);
+   case TC_CLSFLOWER_DESTROY:
+   return mlx5e_delete_flower(priv, tc->cls_flower);
+   }
default:
return -EOPNOTSUPP;
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 9457173..3aea5da 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -30,6 +30,9 @@
  * SOFTWARE.
  */
 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -94,6 +97,300 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
}
 }
 
+static int parse_cls_flower(struct mlx5e_priv *priv,
+   u32 *match_c, u32 *match_v,
+   struct tc_cls_flower_offload *f)
+{
+   void *headers_c = MLX5_ADDR_OF(fte_match_param, match_c, outer_headers);
+   void *headers_v = MLX5_ADDR_OF(fte_match_param, match_v, outer_headers);
+   u16 addr_type = 0;
+   u8 ip_proto = 0;
+
+   if (f->dissector->used_keys &
+   ~(BIT(FLOW_DISSECTOR_KEY_CONTROL) |
+ BIT(FLOW_DISSECTOR_KEY_BASIC) |
+ BIT(FLOW_DISSECTOR_KEY_ETH_ADDRS) |
+ BIT(FLOW_DISSECTOR_KEY_IPV4_ADDRS) |
+ BIT(FLOW_DISSECTOR_KEY_IPV6_ADDRS) |
+ BIT(FLOW_DISSECTOR_KEY_PORTS))) {
+   netdev_warn(priv->netdev, "Unsupported key used: 0x%x\n",
+   f->dissector->used_keys);
+   return -EOPNOTSUPP;
+   }
+
+   if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CONTROL)) {
+   struct flow_dissector_key_control *key =
+   skb_flow_dissector_target(f->dissector,
+ FLOW_DISSECTOR_KEY_BASIC,
+ f->key);
+   addr_type = key->addr_type;
+   }
+
+   if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_BASIC)) {
+   struct flow_dissector_key_basic *key =
+   skb_flow_dissector_target(f->dissector,
+ FLOW_DISSECTOR_KEY_BASIC,
+ f->key);
+   struct flow_dissector_key_basic *mask =
+   skb_flow_dissector_target(f->dissector,
+ FLOW_DISSECTOR_KEY_BASIC,
+ f->mask);
+   ip_proto = key->ip_proto;
+
+   MLX5_SET(fte_match_set_lyr_2_4, headers_c, ethertype,
+ntohs(mask->n_proto));
+   MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype,
+ntohs(key->n_proto));
+
+   MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_protocol,
+mask->ip_proto);
+   MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
+key->ip_proto);
+   }
+
+   if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
+   struct flow_dissector_key_eth_addrs *key =
+   skb_flow_dissector_target(f->dissector,
+ FLOW_DISSECTOR_KEY_ETH_ADDRS,
+ f->key);
+   struct flow_dissector_key_eth_addrs *mask =
+   skb_flow_dissector_target(f->dissector,
+ FLOW_DISSECTOR_KEY_ETH_ADDRS,
+ 

[PATCH net-next V1 03/10] net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef

2016-03-03 Thread Amir Vadai
Introduce the macros tc_no_actions and tc_for_each_action to make code
clearer.

CC: John Fastabend 
Suggested-by: Jiri Pirko 
Signed-off-by: Amir Vadai 
---
John hi,

I wanted to change ixgbe code to use this, but it is not a trivial change
there, so would prefer you do it.

 include/net/act_api.h| 21 -
 include/net/tc_act/tc_gact.h |  4 ++--
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/include/net/act_api.h b/include/net/act_api.h
index 342be6c..e30856f 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -78,11 +78,6 @@ static inline void tcf_lastuse_update(struct tcf_t *tm)
tm->lastuse = now;
 }
 
-#ifdef CONFIG_NET_CLS_ACT
-
-#define ACT_P_CREATED 1
-#define ACT_P_DELETED 1
-
 struct tc_action {
void*priv;
const struct tc_action_ops  *ops;
@@ -92,6 +87,11 @@ struct tc_action {
struct tcf_hashinfo *hinfo;
 };
 
+#ifdef CONFIG_NET_CLS_ACT
+
+#define ACT_P_CREATED 1
+#define ACT_P_DELETED 1
+
 struct tc_action_ops {
struct list_head head;
charkind[IFNAMSIZ];
@@ -171,5 +171,16 @@ int tcf_action_dump(struct sk_buff *skb, struct list_head 
*, int, int);
 int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
 int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
 int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int);
+
+#define tc_no_actions(_exts) \
+   (list_empty(&(_exts)->actions))
+
+#define tc_for_each_action(_a, _exts) \
+   list_for_each_entry(a, &(_exts)->actions, list)
+#else /* CONFIG_NET_CLS_ACT */
+
+#define tc_no_actions(_exts) false
+#define tc_for_each_action(_a, _exts) while (0)
+
 #endif /* CONFIG_NET_CLS_ACT */
 #endif
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h
index 04a3183..93c520b 100644
--- a/include/net/tc_act/tc_gact.h
+++ b/include/net/tc_act/tc_gact.h
@@ -16,9 +16,9 @@ struct tcf_gact {
 #define to_gact(a) \
container_of(a->priv, struct tcf_gact, common)
 
-#ifdef CONFIG_NET_CLS_ACT
 static inline bool is_tcf_gact_shot(const struct tc_action *a)
 {
+#ifdef CONFIG_NET_CLS_ACT
struct tcf_gact *gact;
 
if (a->ops && a->ops->type != TCA_ACT_GACT)
@@ -28,7 +28,7 @@ static inline bool is_tcf_gact_shot(const struct tc_action *a)
if (gact->tcf_action == TC_ACT_SHOT)
return true;
 
+#endif
return false;
 }
-#endif
 #endif /* __NET_TC_GACT_H */
-- 
2.7.0



[PATCH net-next V1 06/10] net/mlx5e: Relax ndo_setup_tc handle restriction

2016-03-03 Thread Amir Vadai
Restricting handle to TC_H_ROOT breaks the old instantiation of mqprio
to setup a hardware qdisc. This patch relaxes the test, to only check the
type.

Fixes: 08fb1da ("net/mlx5e: Support DCBNL IEEE ETS")
Signed-off-by: Amir Vadai 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 5063c0e..5e3692f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1883,7 +1883,7 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 
tc)
 static int mlx5e_ndo_setup_tc(struct net_device *dev, u32 handle,
  __be16 proto, struct tc_to_netdev *tc)
 {
-   if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO)
+   if (tc->type != TC_SETUP_MQPRIO)
return -EINVAL;
 
return mlx5e_setup_tc(dev, tc->tc);
-- 
2.7.0



[PATCH net-next V1 10/10] net/mlx5e: Support offload cls_flower with skbedit mark action

2016-03-03 Thread Amir Vadai
Introduce offloading of skbedit mark action.

For example, to mark with 0x1234, all TCP (ip_proto 6) packets arriving
to interface ens9:

 # tc qdisc add dev ens9 ingress
 # tc filter add dev ens9 protocol ip parent : \
 flower ip_proto 6 \
 indev ens9 \
 action skbedit mark 0x1234

Signed-off-by: Amir Vadai 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 3 +++
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 519a07f..f293afe 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include "en.h"
+#include "en_tc.h"
 
 static inline bool mlx5e_rx_hw_stamp(struct mlx5e_tstamp *tstamp)
 {
@@ -224,6 +225,8 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 
*cqe,
if (cqe_has_vlan(cqe))
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
   be16_to_cpu(cqe->vlan_info));
+
+   skb->mark = be32_to_cpu(cqe->sop_drop_qpn) & MLX5E_TC_FLOW_ID_MASK;
 }
 
 int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 3aea5da..544c739 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h 
b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h
index 70642f4..d677428 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h
@@ -33,6 +33,8 @@
 #ifndef __MLX5_EN_TC_H__
 #define __MLX5_EN_TC_H__
 
+#define MLX5E_TC_FLOW_ID_MASK 0x
+
 int mlx5e_tc_init(struct mlx5e_priv *priv);
 void mlx5e_tc_cleanup(struct mlx5e_priv *priv);
 
-- 
2.7.0



[PATCH net-next V1 04/10] net/act_skbedit: Utility functions for mark action

2016-03-03 Thread Amir Vadai
Enable device drivers to query the action if is a mark action and what
value to use for marking.

Signed-off-by: Amir Vadai 
---
 include/net/tc_act/tc_skbedit.h | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
index 0df9a0d..4497460 100644
--- a/include/net/tc_act/tc_skbedit.h
+++ b/include/net/tc_act/tc_skbedit.h
@@ -20,6 +20,7 @@
 #define __NET_TC_SKBEDIT_H
 
 #include 
+#include 
 
 struct tcf_skbedit {
struct tcf_common   common;
@@ -32,4 +33,18 @@ struct tcf_skbedit {
 #define to_skbedit(a) \
container_of(a->priv, struct tcf_skbedit, common)
 
+static inline bool is_tcf_skbedit_mark(const struct tc_action *a)
+{
+#ifdef CONFIG_NET_CLS_ACT
+   if (a->ops && a->ops->type == TCA_ACT_SKBEDIT)
+   return to_skbedit(a)->flags == SKBEDIT_F_MARK;
+#endif
+   return false;
+}
+
+static inline u32 tcf_skbedit_mark(const struct tc_action *a)
+{
+   return to_skbedit(a)->mark;
+}
+
 #endif /* __NET_TC_SKBEDIT_H */
-- 
2.7.0



RE: [PATCH] gianfar: Enable eTSEC-106 erratum w/a for MPC8548E Rev2

2016-03-03 Thread Claudiu Manoil
>-Original Message-
>From: Atsushi Nemoto [mailto:nem...@toshiba-tops.co.jp]
>Sent: Thursday, March 03, 2016 2:08 AM
>To: Claudiu Manoil ; netdev@vger.kernel.org
>Subject: [PATCH] gianfar: Enable eTSEC-106 erratum w/a for MPC8548E Rev2
>
>Enable workaround for MPC8548E erratum eTSEC 106,
>"Excess delays when transmitting TOE=1 large frames".
>(see commit 53fad77375ce "gianfar: Enable eTSEC-20 erratum w/a
>for P2020 Rev1")
>
>This erratum was fixed in Rev 3.1.x.
>

(Confirmed with MPC8548E Chip Errata document, rev 9. Thanks.)

Acked-by: Claudiu Manoil 



Re: [PATCH 2/2] mac80211: mesh: convert path table to rhashtable

2016-03-03 Thread Johannes Berg
On Wed, 2016-03-02 at 14:43 -0500, David Miller wrote:
> From: Bob Copeland 
> Date: Wed,  2 Mar 2016 10:09:20 -0500
> 
> > In the time since the mesh path table was implemented as an
> > RCU-traversable, dynamically growing hash table, a generic RCU
> > hashtable implementation was added to the kernel.
> > 
> > Switch the mesh path table over to rhashtable to remove some code
> > and also gain some features like automatic shrinking.
> > 
> > Cc: Thomas Graf 
> > Cc: netdev@vger.kernel.org
> > Signed-off-by: Bob Copeland 
> 
> Johannes, feel free to take both patches via your tree, thanks.

Will do, thanks.

johannes


Re: [PATCH net-next V1 03/10] net/sched: Macro instead of CONFIG_NET_CLS_ACT ifdef

2016-03-03 Thread Jiri Pirko
Thu, Mar 03, 2016 at 10:23:19AM CET, a...@vadai.me wrote:
>Introduce the macros tc_no_actions and tc_for_each_action to make code
>clearer.
>



>@@ -171,5 +171,16 @@ int tcf_action_dump(struct sk_buff *skb, struct list_head 
>*, int, int);
> int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
> int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
> int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int);
>+
>+#define tc_no_actions(_exts) \
>+  (list_empty(&(_exts)->actions))
>+
>+#define tc_for_each_action(_a, _exts) \
>+  list_for_each_entry(a, &(_exts)->actions, list)
>+#else /* CONFIG_NET_CLS_ACT */
>+
>+#define tc_no_actions(_exts) false

This should be "true".


Re: [PATCH net-next V1 01/10] net/flower: Introduce hardware offload support

2016-03-03 Thread Jiri Pirko
Thu, Mar 03, 2016 at 10:23:17AM CET, a...@vadai.me wrote:
>This patch is based on a patch made by John Fastabend.
>It adds support for offloading cls_flower.
>when NETIF_F_HW_TC is on:
>  flags = 0   => Rule will be processed twice - by hardware, and if
> still relevant, by software.
>  flags = SKIP_HW => Rull will be processed by software only
>
>If hardare fail/not capabale to apply the rule, operation will fail.
>
>Suggested-by: John Fastabend 
>Signed-off-by: Amir Vadai 

Acked-by: Jiri Pirko 


Re: [PATCH net-next V1 02/10] net/flow_dissector: Make dissector_uses_key() and skb_flow_dissector_target() public

2016-03-03 Thread Jiri Pirko
Thu, Mar 03, 2016 at 10:23:18AM CET, a...@vadai.me wrote:
>Will be used in a following patch to query if a key is being used, and
>what it's value in the target object.
>
>Signed-off-by: Amir Vadai 

Acked-by: Jiri Pirko 


Re: [PATCH net-next V1 04/10] net/act_skbedit: Utility functions for mark action

2016-03-03 Thread Jiri Pirko
Thu, Mar 03, 2016 at 10:23:20AM CET, a...@vadai.me wrote:
>Enable device drivers to query the action if is a mark action and what
>value to use for marking.
>
>Signed-off-by: Amir Vadai 

Acked-by: Jiri Pirko 


[PATCH] net: fec: Rename "phy-reset-active-low" property

2016-03-03 Thread Bernhard Walle
>From the perspective of RESET, the meaning of the new property
is actually "active high". Thanks for Troy Kisky for pointing
that out.

Since the patch is in linux-next, this patch is incremental and doesn't
replace the original patch.

Signed-off-by: Bernhard Walle 
---
 Documentation/devicetree/bindings/net/fsl-fec.txt | 2 +-
 drivers/net/ethernet/freescale/fec_main.c | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt 
b/Documentation/devicetree/bindings/net/fsl-fec.txt
index a4799ff..b037a9d 100644
--- a/Documentation/devicetree/bindings/net/fsl-fec.txt
+++ b/Documentation/devicetree/bindings/net/fsl-fec.txt
@@ -12,7 +12,7 @@ Optional properties:
   only if property "phy-reset-gpios" is available.  Missing the property
   will have the duration be 1 millisecond.  Numbers greater than 1000 are
   invalid and 1 millisecond will be used instead.
-- phy-reset-active-low : If present then the reset sequence using the GPIO
+- phy-reset-active-high : If present then the reset sequence using the GPIO
   specified in the "phy-reset-gpios" property is reversed (H=reset state,
   L=operation state).
 - phy-supply : regulator that powers the Ethernet PHY.
diff --git a/drivers/net/ethernet/freescale/fec_main.c 
b/drivers/net/ethernet/freescale/fec_main.c
index bad0ba2..37c0815 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3191,7 +3191,7 @@ static int fec_enet_init(struct net_device *ndev)
 static void fec_reset_phy(struct platform_device *pdev)
 {
int err, phy_reset;
-   bool active_low = false;
+   bool active_high = false;
int msec = 1;
struct device_node *np = pdev->dev.of_node;
 
@@ -3207,17 +3207,17 @@ static void fec_reset_phy(struct platform_device *pdev)
if (!gpio_is_valid(phy_reset))
return;
 
-   active_low = of_property_read_bool(np, "phy-reset-active-low");
+   active_high = of_property_read_bool(np, "phy-reset-active-high");
 
err = devm_gpio_request_one(&pdev->dev, phy_reset,
-   active_low ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
+   active_high ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
"phy-reset");
if (err) {
dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
return;
}
msleep(msec);
-   gpio_set_value_cansleep(phy_reset, !active_low);
+   gpio_set_value_cansleep(phy_reset, !active_high);
 }
 #else /* CONFIG_OF */
 static void fec_reset_phy(struct platform_device *pdev)
-- 
2.7.2



Re: [PATCH 6/8] x86: tsc: Always Running Timer (ART) correlated clocksource

2016-03-03 Thread Thomas Gleixner
On Wed, 2 Mar 2016, John Stultz wrote:

Subject: x86: tsc: Always Running ...

Please make that:

Subject: x86/tsc: Always Running ...

>  
> +#else
> +
> +#define detect_art()

Inline stub if at all. Why sits detect_art() under CONFIG_CPU_FREQ while the
rest of the art code is not

Thanks

tglx


[net-next PATCH v2] net_sched: dsmark: use qdisc_dequeue_peeked()

2016-03-03 Thread Kyeong Yoo
This fix is for dsmark similar to commit 3557619f0f6f7496ed453d4825e249
("net_sched: prio: use qdisc_dequeue_peeked")
and makes use of qdisc_dequeue_peeked() instead of direct dequeue() call.

First time, wrr peeks dsmark, which will then peek into sfq.
sfq dequeues an skb and it's stored in sch->gso_skb.
Next time, wrr tries to dequeue from dsmark, which will call sfq dequeue
directly. This results skipping the previously peeked skb.

So changed dsmark dequeue to call qdisc_dequeue_peeked() instead to use
peeked skb if exists.

Signed-off-by: Kyeong Yoo 

diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index f357f34..b204472 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -281,7 +281,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
 
pr_debug("%s(sch %p,[qdisc %p])\n", __func__, sch, p);
 
-   skb = p->q->ops->dequeue(p->q);
+   skb = qdisc_dequeue_peeked(p->q);
if (skb == NULL)
return NULL;



Re: [PATCH net] vxlan: fix missing options_len update on RX with collect metadata

2016-03-03 Thread Thomas Graf
On 03/02/16 at 02:32am, Daniel Borkmann wrote:
> When signalling to metadata consumers that the metadata_dst entry
> carries additional GBP extension data for vxlan (TUNNEL_VXLAN_OPT),
> the dst's vxlan_metadata information is populated, but options_len
> is left to zero. F.e. in ovs, ovs_flow_key_extract() checks for
> options_len before extracting the data through ip_tunnel_info_opts_get().
> 
> Geneve uses ip_tunnel_info_opts_set() helper in receive path, which
> sets options_len internally, vxlan however uses ip_tunnel_info_opts(),
> so when filling vxlan_metadata, we do need to update options_len.
> 
> Fixes: 4c22279848c5 ("ip-tunnel: Use API to access tunnel metadata options.")
> Signed-off-by: Daniel Borkmann 

Acked-by: Thomas Graf 


Re: [RFC 15/15] mfd: syscon: Fix build of missing ioremap on UM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:41 Krzysztof Kozlowski wrote:
> Since commit c89c0114955a ("mfd: syscon: Set regmap max_register in
> of_syscon_register") the syscon uses ioremap so it fails on COMPILE_TEST
> without HAS_IOMEM:
> 
> drivers/mfd/syscon.c: In function ‘of_syscon_register’:
> drivers/mfd/syscon.c:67:9: error: implicit declaration of function ‘ioremap’ 
> [-Werror=implicit-function-declaration]
>   base = ioremap(res.start, resource_size(&res));
>  ^
> drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer 
> without a cast [-Wint-conversion]
>   base = ioremap(res.start, resource_size(&res));
>^
> drivers/mfd/syscon.c:109:2: error: implicit declaration of function ‘iounmap’ 
> [-Werror=implicit-function-declaration]
>   iounmap(base);
> 
> When selecting MFD_SYSCON, depend on HAS_IOMEM to avoid unmet direct
> dependencies.
> 
> Reported-by: kbuild test robot 
> Fixes: c89c0114955a ("mfd: syscon: Set regmap max_register in 
> of_syscon_register")
> Signed-off-by: Krzysztof Kozlowski 
> ---

Thanks for looking into this, the patches all look right to me, but
I fear we are forever playing catch-up here, as the number of syscon users
is only growing, and it's not obvious to the average driver developer
why they have to select this symbol.

Interestingly, when I try to build an allmodconfig kernel for UML,
it seems to reject any driver calling ioremap/iounmap but not
the wrapper functions around that (of_iomap, devm_ioremap,
devm_ioremap_resource, ...) or the actual accessors that make no
sense without ioremap (readl, writel, inb, outb, iowrite32, ...).

I've played with this a bit, and arrived at the patch below, is this
something we want as well?

Arnd

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index aa21dc55eb15..2e5b1e525a1d 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1034,6 +1034,7 @@ config MFD_SUN6I_PRCM
>  
>  config MFD_SYSCON
>   bool "System Controller Register R/W Based on Regmap"
> + depends on HAS_IOMEM
>   select REGMAP_MMIO
>   help
> Select this option to enable accessing system control registers
> 


 arch/um/include/asm/io.h   |1 +
 drivers/char/Kconfig   |3 +++
 drivers/char/mem.c |   16 
 drivers/clocksource/Kconfig|3 +++
 drivers/fmc/Kconfig|1 +
 drivers/fpga/Kconfig   |1 +
 drivers/hwtracing/intel_th/Kconfig |1 +
 drivers/mfd/Kconfig|1 +
 drivers/misc/altera-stapl/Kconfig  |2 +-
 drivers/mtd/chips/Kconfig  |4 
 drivers/mtd/lpddr/Kconfig  |1 +
 drivers/mtd/maps/Kconfig   |3 ++-
 drivers/mtd/nand/Kconfig   |2 +-
 drivers/mtd/spi-nor/Kconfig|1 +
 drivers/net/can/Kconfig|1 +
 drivers/net/hamradio/Kconfig   |9 ++---
 drivers/nvmem/Kconfig  |1 +
 drivers/phy/Kconfig|9 +++--
 drivers/power/reset/Kconfig|4 +++-
 drivers/staging/comedi/Kconfig |6 +-
 drivers/thermal/Kconfig|   11 +--
 include/linux/irq.h|2 ++
 include/linux/mtd/cfi.h|2 ++
 include/linux/mtd/map.h|2 ++
 kernel/resource.c  |2 ++
 lib/Kconfig|7 ++-
 mm/bootmem.c   |4 ++--
 27 files changed, 85 insertions(+), 15 deletions(-)

diff --git a/arch/um/include/asm/io.h b/arch/um/include/asm/io.h
new file mode 100644
index 000..618ff13
--- /dev/null
+++ b/arch/um/include/asm/io.h
@@ -0,0 +1 @@
+/* no IOPORT or IOMEM suport */
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index a043107..f6dc17a 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -8,6 +8,7 @@ source "drivers/tty/Kconfig"
 
 config DEVMEM
bool "/dev/mem virtual device support"
+   depends on HAS_IOMEM
default y
help
  Say Y here if you want to support the /dev/mem device.
@@ -17,6 +18,7 @@ config DEVMEM
 
 config DEVKMEM
bool "/dev/kmem virtual device support"
+   depends on HAS_IOMEM
default y
help
  Say Y here if you want to support the /dev/kmem device. The
@@ -94,6 +96,7 @@ config BFIN_OTP_WRITE_ENABLE
 config PRINTER
tristate "Parallel printer support"
depends on PARPORT
+   depends on HAS_IOPORT
---help---
  If you intend to attach a printer to the parallel port of your Linux
  box (as opposed to using a serial printer; if the connector at the
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 4f6f94c..eedd129 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -91,6 +91,7 @@ void __weak unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
 }
 #endif
 
+#ifdef CONFIG_DEVMEM
 /*
  * This funcion reads the *physical* memory. The f_pos points directly to the
  * memory 

Re: [RFC 01/15] clocksource: atmel: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:27 Krzysztof Kozlowski wrote:
> 
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index c346be650892..5927944b46e0 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -239,6 +239,7 @@ config ATMEL_PIT
>  
>  config ATMEL_ST
> bool
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select CLKSRC_OF
> select MFD_SYSCON
> 

looking at this again, there is no need for the dependency here,
as it is not a user-selectable symbol.

Arnd


Re: [RFC 02/15] dmaengine: nxp: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:28 Krzysztof Kozlowski wrote:
> index c77f214c9466..7fbf96bff280 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -290,6 +290,7 @@ config LPC18XX_DMAMUX
> bool "NXP LPC18xx/43xx DMA MUX for PL080"
> depends on ARCH_LPC18XX || COMPILE_TEST
> depends on OF && AMBA_PL08X
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select MFD_SYSCON
> help
> 

AMBA_PL08X implies HAS_IOMEM, so this is not needed explicitly

Arnd


Re: [RFC 03/15] hwspinlock: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:29 Krzysztof Kozlowski wrote:
> diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig
> index 73a401662853..5ab2d51dc147 100644
> --- a/drivers/hwspinlock/Kconfig
> +++ b/drivers/hwspinlock/Kconfig
> @@ -21,6 +21,7 @@ config HWSPINLOCK_OMAP
>  config HWSPINLOCK_QCOM
> tristate "Qualcomm Hardware Spinlock device"
> depends on ARCH_QCOM
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select HWSPINLOCK
> select MFD_SYSCON
> help
> 

This is only needed if we add "|| COMPILE_TEST", right now the driver
is limited to ARCH_QCOM.

Arnd


Re: [RFC 04/15] irqchip: st: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:30 Krzysztof Kozlowski wrote:
>  config ST_IRQCHIP
> bool
> select REGMAP
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select MFD_SYSCON
> help
>   Enables SysCfg Controlled IRQs on STi based platforms.
> 

Not user visible.

Arnd


Re: [RFC 08/15] rtc: at91sam9: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:34 Krzysztof Kozlowski wrote:
> index 0da40e2e4280..5c530b6b125d 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1302,6 +1302,7 @@ config RTC_DRV_AT91RM9200
>  config RTC_DRV_AT91SAM9
> tristate "AT91SAM9 RTT as RTC"
> depends on ARCH_AT91 || COMPILE_TEST
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select MFD_SYSCON
> help
>   Some AT91SAM9 SoCs provide an RTT (Real Time Timer) block which
> 

This is technically correct, but the entire RTC menu is hidden
inside of 'depends on !UML && !S390', so we won't ever get there
on any configuration that does not use HAS_IOMEM.

If we did, all other RTC drivers would also fail.

Arnd


Re: [RFC 05/15] phy: hi6220: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:31 Krzysztof Kozlowski wrote:
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -225,6 +225,7 @@ config PHY_MT65XX_USB3
>  config PHY_HI6220_USB
> tristate "hi6220 USB PHY support"
> depends on (ARCH_HISI && ARM64) || COMPILE_TEST
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select GENERIC_PHY
> select MFD_SYSCON
> help
> -- 
> 2.5.0
> 

This is indeed required, and seems to be what caused the problem
you saw in the first place.

Arnd


Re: [RFC 09/15] media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:35 Krzysztof Kozlowski wrote:
> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
> index 201f5c296a95..e5931e434fa2 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -79,6 +79,7 @@ config VIDEO_OMAP3
> depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
> depends on HAS_DMA && OF
> depends on OMAP_IOMMU
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select ARM_DMA_USE_IOMMU
> select VIDEOBUF2_DMA_CONTIG

This is only built for OMAP3, so we won't get here without HAS_IOMEM

> select MFD_SYSCON
> diff --git a/drivers/media/platform/exynos4-is/Kconfig 
> b/drivers/media/platform/exynos4-is/Kconfig
> index 57d42c6172c5..c4317b99d257 100644
> --- a/drivers/media/platform/exynos4-is/Kconfig
> +++ b/drivers/media/platform/exynos4-is/Kconfig
> @@ -17,6 +17,7 @@ config VIDEO_S5P_FIMC
> tristate "S5P/EXYNOS4 FIMC/CAMIF camera interface driver"
> depends on I2C
> depends on HAS_DMA
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select VIDEOBUF2_DMA_CONTIG
> select V4L2_MEM2MEM_DEV

This  is guarded by HAS_DMA, which implies HAS_IOMEM afaik.

Arnd


Re: [RFC 10/15] net: ethernet: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:36 Krzysztof Kozlowski wrote:
> The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
> direct dependencies.
> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  drivers/net/ethernet/hisilicon/Kconfig  | 1 +
>  drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 ++
>  drivers/net/ethernet/ti/Kconfig | 1 +
>  3 files changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ethernet/hisilicon/Kconfig 
> b/drivers/net/ethernet/hisilicon/Kconfig
> index 74beb1867230..6a9c91781bf9 100644
> --- a/drivers/net/ethernet/hisilicon/Kconfig
> +++ b/drivers/net/ethernet/hisilicon/Kconfig
> @@ -26,6 +26,7 @@ config HIX5HD2_GMAC
>  config HIP04_ETH
>   tristate "HISILICON P04 Ethernet support"
>   select MARVELL_PHY
> + depends on HAS_IOMEM# For MFD_SYSCON
>   select MFD_SYSCON
>   select HNS_MDIO
>   ---help---

Geert added a HAS_DMA dependency in linux-next, which takes
care of this, although it's still technically correct as well.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig 
> b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> index cec147d1d34f..d6902bf6e90f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> @@ -16,6 +16,7 @@ if STMMAC_ETH
>  config STMMAC_PLATFORM
>   tristate "STMMAC Platform bus support"
>   depends on STMMAC_ETH
> + depends on HAS_IOMEM# For MFD_SYSCON
>   select MFD_SYSCON
>   default y
>   ---help---

NET_VENDOR_STMICRO depends on HAS_IOMEM, so we are good here for the
entire directory.

> diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
> index e7f0b7d95b65..ec56cebe929d 100644
> --- a/drivers/net/ethernet/ti/Kconfig
> +++ b/drivers/net/ethernet/ti/Kconfig
> @@ -62,6 +62,7 @@ config TI_CPSW_ALE
>  config TI_CPSW
>   tristate "TI CPSW Switch Support"
>   depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
> + depends on HAS_IOMEM# For MFD_SYSCON
>   select TI_DAVINCI_CPDMA
>   select TI_DAVINCI_MDIO
>   select TI_CPSW_PHY_SEL
> 


This again is platform specific, so the chagnge is not needed.

Arnd


Re: [RFC 11/15] power: reset: keystone: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:37 Krzysztof Kozlowski wrote:
> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> index 0a6408a39c66..0f34846ae80d 100644
> --- a/drivers/power/reset/Kconfig
> +++ b/drivers/power/reset/Kconfig
> @@ -141,6 +141,7 @@ config POWER_RESET_XGENE
>  config POWER_RESET_KEYSTONE
> bool "Keystone reset driver"
> depends on ARCH_KEYSTONE
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select MFD_SYSCON
> help
>   Reboot support for the KEYSTONE SoCs.
> 

This is platform specific, but we should probably add || COMPILE_TEST
along with the HAS_IOMEM dependency.

Arnd


Re: [RFC 14/15] usb: xhci: mtk: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:03:40 Krzysztof Kozlowski wrote:
> index 8c20ebbc049c..f759a778d606 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -45,6 +45,7 @@ config USB_XHCI_PLATFORM
>  
>  config USB_XHCI_MTK
> tristate "xHCI support for Mediatek MT65xx"
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select MFD_SYSCON
> depends on ARCH_MEDIATEK || COMPILE_TEST
> ---help---
> 

This already has the dependency, as it depends on XHCD_PLATFORM
which depends on HAS_IOMEM.

Arnd


Re: [PATCH 2/6] net: ethernet: renesas: ravb_main: test clock rate to avoid division by 0

2016-03-03 Thread Sergei Shtylyov

Hello.

On 3/3/2016 1:33 AM, Wolfram Sang wrote:


From: Wolfram Sang 

The clk API may return 0 on clk_get_rate, so we should check the result before
using it as a divisor.

Signed-off-by: Wolfram Sang 


Acked-by: Sergei Shtylyov 

MBR, Sergei



[PATCH 0/3] UNIX sockets: POSIX conformance of errno's

2016-03-03 Thread Ed Schouten
Hi there,

While comparing the behavior of the Berkeley sockets API different
operating systems, I noticed that in some places we return different
errno's as what POSIX requires and how other systems work, but also what
we document in our own man pages.

This is the first time I'm sending a patch to the Linux kernel, so if
there's anything wrong with the way I submitted these patches, just let
me know.

Thanks,
Ed

Ed Schouten (3):
  Make listen() on an unbound UNIX socket return EDESTADDRREQ.
  Let open() on a UNIX socket return EOPNOTSUPP.
  Return ENOTCONN when trying to recv() on an unconnected UNIX socket.

 fs/inode.c | 13 -
 net/unix/af_unix.c |  6 +++---
 2 files changed, 15 insertions(+), 4 deletions(-)

-- 
2.5.0



[PATCH 3/3] Return ENOTCONN when trying to recv() on an unconnected UNIX socket.

2016-03-03 Thread Ed Schouten
Both POSIX and our manual pages state that if send() or recv() is called
on an unconnected socket, ENOTCONN should be returned. It looks like our
implementation of send() already does this, but recv() does not.

Reference:
http://pubs.opengroup.org/onlinepubs/009695399/functions/send.html

Signed-off-by: Ed Schouten 
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index d810815..824dd63 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2283,7 +2283,7 @@ static int unix_stream_read_generic(struct 
unix_stream_read_state *state)
unsigned int last_len;
 
if (unlikely(sk->sk_state != TCP_ESTABLISHED)) {
-   err = -EINVAL;
+   err = -ENOTCONN;
goto out;
}
 
-- 
2.5.0



[PATCH 2/3] Let open() on a UNIX socket return EOPNOTSUPP.

2016-03-03 Thread Ed Schouten
The POSIX article on open() is slightly confusing that it states which
error code needs to be returned when opened on a stale FIFO, character
device or block device (ENXIO), but fails to explicitly mention which
code should be returned when trying to open a UNIX socket. This is only
mentioned in a different chapter of the standard (EOPNOTSUPP).

While discussing this matter with the Austin Group, it turns out most
other systems (BSDs, HP-UX, Solaris) do return EOPNOTSUPP. The open()
article has since been extended to require this. Let's go ahead and stay
in sync with the rest.

References:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html
http://austingroupbugs.net/view.php?id=943

Signed-off-by: Ed Schouten 
---
 fs/inode.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/fs/inode.c b/fs/inode.c
index 69b8b52..6e63ca7 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1911,8 +1911,15 @@ void __init inode_init(void)
INIT_HLIST_HEAD(&inode_hashtable[loop]);
 }
 
+static int no_open_sock(struct inode *inode, struct file *file)
+{
+   return -EOPNOTSUPP;
+}
+
 void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev)
 {
+   static const struct file_operations sock_fops = {.open = no_open_sock};
+
inode->i_mode = mode;
if (S_ISCHR(mode)) {
inode->i_fop = &def_chr_fops;
@@ -1923,7 +1930,11 @@ void init_special_inode(struct inode *inode, umode_t 
mode, dev_t rdev)
} else if (S_ISFIFO(mode))
inode->i_fop = &pipefifo_fops;
else if (S_ISSOCK(mode))
-   ;   /* leave it no_open_fops */
+   /*
+* open() on a socket needs to return EOPNOTSUPP,
+* whereas the default inode operations return ENXIO.
+*/
+   inode->i_fop = &sock_fops;
else
printk(KERN_DEBUG "init_special_inode: bogus i_mode (%o) for"
  " inode %s:%lu\n", mode, inode->i_sb->s_id,
-- 
2.5.0



[PATCH 1/3] Make listen() on an unbound UNIX socket return EDESTADDRREQ.

2016-03-03 Thread Ed Schouten
If a UNIX socket does not have an address associated with it, it may
either be that a socket has been created through socket() and is still
in its initial state, or it has connected to a peer (e.g. by using
socketpair()). In both those cases listen() should fail.

Though the condition used to test for condition this is all right, POSIX
requires that two different error codes are returned: EINVAL if already
connected and EDESTADDRREQ if not bound.

Reference:
http://pubs.opengroup.org/onlinepubs/009695399/functions/listen.html

Signed-off-by: Ed Schouten 
---
 net/unix/af_unix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index f75f847..d810815 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -609,9 +609,9 @@ static int unix_listen(struct socket *sock, int backlog)
err = -EOPNOTSUPP;
if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
goto out;   /* Only stream/seqpacket sockets accept */
-   err = -EINVAL;
+   err = unix_peer(sk) == NULL ? -EDESTADDRREQ : -EINVAL;
if (!u->addr)
-   goto out;   /* No listens on an unbound socket */
+   goto out;   /* No listen on a connected or unbound socket */
unix_state_lock(sk);
if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN)
goto out_unlock;
-- 
2.5.0



[PATCH net] net: hns: fix the bug about loopback

2016-03-03 Thread Kejian Yan
It will always be passed if the soc is tested the loopback cases. This
patch will fix this bug.

Signed-off-by: Kejian Yan 
---
 drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c  |  8 +
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 37 
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h |  1 +
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h  |  6 
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c   | 40 ++
 5 files changed, 78 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c 
b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index a0070d0..d4f92ed 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -675,8 +675,12 @@ static int hns_ae_config_loopback(struct hnae_handle 
*handle,
 {
int ret;
struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle);
+   struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);
 
switch (loop) {
+   case MAC_INTERNALLOOP_PHY:
+   ret = 0;
+   break;
case MAC_INTERNALLOOP_SERDES:
ret = hns_mac_config_sds_loopback(vf_cb->mac_cb, en);
break;
@@ -686,6 +690,10 @@ static int hns_ae_config_loopback(struct hnae_handle 
*handle,
default:
ret = -EINVAL;
}
+
+   if (!ret)
+   hns_dsaf_set_inner_lb(mac_cb->dsaf_dev, mac_cb->mac_id, en);
+
return ret;
 }
 
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
index 9439f04..dcf4e8a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
@@ -230,6 +230,30 @@ static void hns_dsaf_mix_def_qid_cfg(struct dsaf_device 
*dsaf_dev)
}
 }
 
+static void hns_dsaf_inner_qid_cfg(struct dsaf_device *dsaf_dev)
+{
+   u16 max_q_per_vf, max_vfn;
+   u32 q_id = 0, q_num_per_port;
+   u32 mac_id;
+
+   if (AE_IS_VER1(dsaf_dev->dsaf_ver))
+   return;
+
+   hns_rcb_get_queue_mode(dsaf_dev->dsaf_mode,
+  HNS_DSAF_COMM_SERVICE_NW_IDX,
+  &max_vfn, &max_q_per_vf);
+   q_num_per_port = max_vfn * max_q_per_vf;
+
+   for (mac_id = 0, q_id = 0; mac_id < DSAF_SERVICE_NW_NUM; mac_id++) {
+   dsaf_set_dev_field(dsaf_dev,
+  DSAFV2_SERDES_LBK_0_REG + 0x4 * mac_id,
+  DSAFV2_SERDES_LBK_QID_M,
+  DSAFV2_SERDES_LBK_QID_S,
+  q_id);
+   q_id += q_num_per_port;
+   }
+}
+
 /**
  * hns_dsaf_sw_port_type_cfg - cfg sw type
  * @dsaf_id: dsa fabric id
@@ -691,6 +715,16 @@ void hns_dsaf_set_promisc_mode(struct dsaf_device 
*dsaf_dev, u32 en)
dsaf_set_dev_bit(dsaf_dev, DSAF_CFG_0_REG, DSAF_CFG_MIX_MODE_S, !!en);
 }
 
+void hns_dsaf_set_inner_lb(struct dsaf_device *dsaf_dev, u32 mac_id, u32 en)
+{
+   if (AE_IS_VER1(dsaf_dev->dsaf_ver) ||
+   dsaf_dev->mac_cb[mac_id].mac_type == HNAE_PORT_DEBUG)
+   return;
+
+   dsaf_set_dev_bit(dsaf_dev, DSAFV2_SERDES_LBK_0_REG + 0x4 * mac_id,
+DSAFV2_SERDES_LBK_EN_B, !!en);
+}
+
 /**
  * hns_dsaf_tbl_stat_en - tbl
  * @dsaf_id: dsa fabric id
@@ -1022,6 +1056,9 @@ static void hns_dsaf_comm_init(struct dsaf_device 
*dsaf_dev)
/* set promisc def queue id */
hns_dsaf_mix_def_qid_cfg(dsaf_dev);
 
+   /* set inner loopback queue id */
+   hns_dsaf_inner_qid_cfg(dsaf_dev);
+
/* in non switch mode, set all port to access mode */
hns_dsaf_sw_port_type_cfg(dsaf_dev, DSAF_SW_PORT_TYPE_NON_VLAN);
 
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
index 40205b9..5fea226 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h
@@ -417,5 +417,6 @@ void hns_dsaf_get_strings(int stringset, u8 *data, int 
port);
 void hns_dsaf_get_regs(struct dsaf_device *ddev, u32 port, void *data);
 int hns_dsaf_get_regs_count(void);
 void hns_dsaf_set_promisc_mode(struct dsaf_device *dsaf_dev, u32 en);
+void hns_dsaf_set_inner_lb(struct dsaf_device *dsaf_dev, u32 mac_id, u32 en);
 
 #endif /* __HNS_DSAF_MAIN_H__ */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index f0c4f9b..3bb044b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -134,6 +134,7 @@
 #define DSAF_XGE_INT_STS_0_REG 0x1C0
 #define DSAF_PPE_INT_STS_0_REG 0x1E0
 #define DSAF_ROCEE_INT_STS_0_REG   0x200
+#define DSAFV2_SERDES_LBK_0_REG 0x220
 #define DSAF_PPE_QID_CFG_0_REG 0x300
 #define DSAF_SW_PORT_TYPE_0_REG

[PATCH net] net: hns: fix the fault about mtu setting

2016-03-03 Thread Kejian Yan
As the User Manual describes, maximum value are 9728 for service ports and
1500 for debug ports, not always 9600. So it needs to be configured to
right value for the different port. The max frame len of ppe needs to be
set to the right as well.

Signed-off-by: Kejian Yan 
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 7 ++-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h | 2 ++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c | 3 +++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h | 2 ++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 5ef0e96..65b8d91 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -467,8 +467,13 @@ int hns_mac_set_mtu(struct hns_mac_cb *mac_cb, u32 new_mtu)
struct mac_driver *drv = hns_mac_get_drv(mac_cb);
u32 buf_size = mac_cb->dsaf_dev->buf_size;
u32 new_frm = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
+   u32 max_frm = AE_IS_VER1(mac_cb->dsaf_dev->dsaf_ver) ?
+   MAC_MAX_MTU : MAC_MAX_MTU_V2;
 
-   if ((new_mtu < MAC_MIN_MTU) || (new_frm > MAC_MAX_MTU) ||
+   if (mac_cb->mac_type == HNAE_PORT_DEBUG)
+   max_frm = MAC_MAX_MTU_DBG;
+
+   if ((new_mtu < MAC_MIN_MTU) || (new_frm > max_frm) ||
(new_frm > HNS_RCB_RING_MAX_BD_PER_PKT * buf_size))
return -EINVAL;
 
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
index 0b05219..fc51e3d 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
@@ -26,7 +26,9 @@ struct dsaf_device;
 
 #define MAC_DEFAULT_MTU(ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN + 
ETH_DATA_LEN)
 #define MAC_MAX_MTU9600
+#define MAC_MAX_MTU_V2 9728
 #define MAC_MIN_MTU68
+#define MAC_MAX_MTU_DBG MAC_DEFAULT_MTU
 
 #define MAC_DEFAULT_PAUSE_TIME 0xff
 
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
index f302ef9..7a61c57 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
@@ -343,6 +343,9 @@ static void hns_ppe_init_hw(struct hns_ppe_cb *ppe_cb)
if (!AE_IS_VER1(dsaf_dev->dsaf_ver)) {
hns_ppe_set_vlan_strip(ppe_cb, 0);
 
+   dsaf_write_dev(ppe_cb, PPE_CFG_MAX_FRAME_LEN_REG,
+  HNS_PPEV2_MAX_FRAME_LEN);
+
/* set default RSS key in h/w */
hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key);
 
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h
index 0f5cb69..e9c0ec2 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h
@@ -30,6 +30,8 @@
 #define HNS_PPEV2_RSS_KEY_SIZE 40 /* in bytes or 320 bits */
 #define HNS_PPEV2_RSS_KEY_NUM (HNS_PPEV2_RSS_KEY_SIZE / sizeof(u32))
 
+#define HNS_PPEV2_MAX_FRAME_LEN 0X980
+
 enum ppe_qid_mode {
PPE_QID_MODE0 = 0, /* fixed queue id mode */
PPE_QID_MODE1, /* switch:128VM non switch:6Port/4VM/4TC */
-- 
1.9.1



Re: [rtc-linux] Re: [RFC 04/15] irqchip: st: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 19:53 GMT+09:00 Arnd Bergmann :
> On Thursday 03 March 2016 17:03:30 Krzysztof Kozlowski wrote:
>>  config ST_IRQCHIP
>> bool
>> select REGMAP
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select MFD_SYSCON
>> help
>>   Enables SysCfg Controlled IRQs on STi based platforms.
>>
>
> Not user visible.

Hmmm... you are right (here and in other patches) but why am I getting
all these errors:
warning: (ST_IRQCHIP && HIP04_ETH && STMMAC_PLATFORM && DWMAC_IPQ806X
&& DWMAC_LPC18XX && DWMAC_ROCKCHIP && DWMAC_SOCFPGA && DWMAC_STI &&
TI_CPSW && PINCTRL_ROCKCHIP && PINCTRL_DOVE && POWER_RESET_KEYSTONE &&
S3C2410_WATCHDOG && VIDEO_OMAP3 && VIDEO_S5P_FIMC && USB_XHCI_MTK &&
RTC_DRV_AT91SAM9 && LPC18XX_DMAMUX && VIDEO_OMAP4 && HWSPINLOCK_QCOM
&& ATMEL_ST && QCOM_GSBI && PHY_HI6220_USB) selects MFD_SYSCON which
has unmet direct dependencies (HAS_IOMEM)
?
(ARCH=um, allyesconfig)
Adding depends here (and in other places) really helps... but it
should not have any impact...

Thanks for comments,
Krzysztof


[PATCH net] bridge: a netlink notification should be sent whenever those attributes change

2016-03-03 Thread Xin Long
Now when we change the attributes of bridge or br_port by netlink,
a relevant netlink notification will be sent, but if we change them
by ioctl or sysfs, no notification will be sent.

we should ensure that whenever those attributes change internally or from
sysfs/ioctl, that a netlink notification is sent out to listeners.

Also, NetworkManager will use this in the future to listen for out-of-band
bridge master attribute updates and incorporate them into the runtime
configuration.

Signed-off-by: Xin Long 
---
 net/bridge/br_ioctl.c| 40 
 net/bridge/br_sysfs_br.c |  2 ++
 net/bridge/br_sysfs_if.c |  4 +++-
 3 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
index 263b4de..f8fc624 100644
--- a/net/bridge/br_ioctl.c
+++ b/net/bridge/br_ioctl.c
@@ -112,7 +112,9 @@ static int add_del_if(struct net_bridge *br, int ifindex, 
int isadd)
 static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
struct net_bridge *br = netdev_priv(dev);
+   struct net_bridge_port *p = NULL;
unsigned long args[4];
+   int ret = -EOPNOTSUPP;
 
if (copy_from_user(args, rq->ifr_data, sizeof(args)))
return -EFAULT;
@@ -182,25 +184,29 @@ static int old_dev_ioctl(struct net_device *dev, struct 
ifreq *rq, int cmd)
if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
return -EPERM;
 
-   return br_set_forward_delay(br, args[1]);
+   ret = br_set_forward_delay(br, args[1]);
+   break;
 
case BRCTL_SET_BRIDGE_HELLO_TIME:
if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
return -EPERM;
 
-   return br_set_hello_time(br, args[1]);
+   ret = br_set_hello_time(br, args[1]);
+   break;
 
case BRCTL_SET_BRIDGE_MAX_AGE:
if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
return -EPERM;
 
-   return br_set_max_age(br, args[1]);
+   ret = br_set_max_age(br, args[1]);
+   break;
 
case BRCTL_SET_AGEING_TIME:
if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
return -EPERM;
 
-   return br_set_ageing_time(br, args[1]);
+   ret = br_set_ageing_time(br, args[1]);
+   break;
 
case BRCTL_GET_PORT_INFO:
{
@@ -240,20 +246,19 @@ static int old_dev_ioctl(struct net_device *dev, struct 
ifreq *rq, int cmd)
return -EPERM;
 
br_stp_set_enabled(br, args[1]);
-   return 0;
+   ret = 0;
+   break;
 
case BRCTL_SET_BRIDGE_PRIORITY:
if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
return -EPERM;
 
br_stp_set_bridge_priority(br, args[1]);
-   return 0;
+   ret = 0;
+   break;
 
case BRCTL_SET_PORT_PRIORITY:
{
-   struct net_bridge_port *p;
-   int ret;
-
if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
return -EPERM;
 
@@ -263,14 +268,11 @@ static int old_dev_ioctl(struct net_device *dev, struct 
ifreq *rq, int cmd)
else
ret = br_stp_set_port_priority(p, args[2]);
spin_unlock_bh(&br->lock);
-   return ret;
+   break;
}
 
case BRCTL_SET_PATH_COST:
{
-   struct net_bridge_port *p;
-   int ret;
-
if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
return -EPERM;
 
@@ -280,8 +282,7 @@ static int old_dev_ioctl(struct net_device *dev, struct 
ifreq *rq, int cmd)
else
ret = br_stp_set_path_cost(p, args[2]);
spin_unlock_bh(&br->lock);
-
-   return ret;
+   break;
}
 
case BRCTL_GET_FDB_ENTRIES:
@@ -289,7 +290,14 @@ static int old_dev_ioctl(struct net_device *dev, struct 
ifreq *rq, int cmd)
   args[2], args[3]);
}
 
-   return -EOPNOTSUPP;
+   if (!ret) {
+   if (p)
+   br_ifinfo_notify(RTM_NEWLINK, p);
+   else
+   netdev_state_change(br->dev);
+   }
+
+   return ret;
 }
 
 static int old_deviceless(struct net *net, void __user *uarg)
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 6b80914..231e093 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -44,6 +44,8 @@ static ssize_t store_bridge_parm(struct device *d,
return -EINVAL;
 
err = (*set)(br, val);
+   if (!err)
+   netdev_state_change(br->dev);
return err ? er

Re: [rtc-linux] Re: [RFC 15/15] mfd: syscon: Fix build of missing ioremap on UM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 19:50 GMT+09:00 Arnd Bergmann :
> On Thursday 03 March 2016 17:03:41 Krzysztof Kozlowski wrote:
>> Since commit c89c0114955a ("mfd: syscon: Set regmap max_register in
>> of_syscon_register") the syscon uses ioremap so it fails on COMPILE_TEST
>> without HAS_IOMEM:
>>
>> drivers/mfd/syscon.c: In function ‘of_syscon_register’:
>> drivers/mfd/syscon.c:67:9: error: implicit declaration of function ‘ioremap’ 
>> [-Werror=implicit-function-declaration]
>>   base = ioremap(res.start, resource_size(&res));
>>  ^
>> drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer 
>> without a cast [-Wint-conversion]
>>   base = ioremap(res.start, resource_size(&res));
>>^
>> drivers/mfd/syscon.c:109:2: error: implicit declaration of function 
>> ‘iounmap’ [-Werror=implicit-function-declaration]
>>   iounmap(base);
>>
>> When selecting MFD_SYSCON, depend on HAS_IOMEM to avoid unmet direct
>> dependencies.
>>
>> Reported-by: kbuild test robot 
>> Fixes: c89c0114955a ("mfd: syscon: Set regmap max_register in 
>> of_syscon_register")
>> Signed-off-by: Krzysztof Kozlowski 
>> ---
>
> Thanks for looking into this, the patches all look right to me, but
> I fear we are forever playing catch-up here, as the number of syscon users
> is only growing, and it's not obvious to the average driver developer
> why they have to select this symbol.

Actually I screwed something because entire MFD menuconfig (including
MFD_SYSCON) is already guarded by if HAS_IOMEM.

I was fixing the problem from the end (the build error) and then hit
these unmet direct dependencies (mentioned this in other mail).

I think this patch 15/15 is not needed.

>
> Interestingly, when I try to build an allmodconfig kernel for UML,
> it seems to reject any driver calling ioremap/iounmap but not
> the wrapper functions around that (of_iomap, devm_ioremap,
> devm_ioremap_resource, ...)

The declaration of devm-like functions is always there. However it
should fail during linking stage (see my other patches like for
thermal, nvram etc. this is still in progress because I did not manage
to build allyesconfig on UML yet).

> or the actual accessors that make no
> sense without ioremap (readl, writel, inb, outb, iowrite32, ...).
>
> I've played with this a bit, and arrived at the patch below, is this
> something we want as well?
>
> Arnd
>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index aa21dc55eb15..2e5b1e525a1d 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -1034,6 +1034,7 @@ config MFD_SUN6I_PRCM
>>
>>  config MFD_SYSCON
>>   bool "System Controller Register R/W Based on Regmap"
>> + depends on HAS_IOMEM
>>   select REGMAP_MMIO
>>   help
>> Select this option to enable accessing system control registers
>>
>
>
>  arch/um/include/asm/io.h   |1 +
>  drivers/char/Kconfig   |3 +++
>  drivers/char/mem.c |   16 
>  drivers/clocksource/Kconfig|3 +++
>  drivers/fmc/Kconfig|1 +
>  drivers/fpga/Kconfig   |1 +
>  drivers/hwtracing/intel_th/Kconfig |1 +
>  drivers/mfd/Kconfig|1 +
>  drivers/misc/altera-stapl/Kconfig  |2 +-
>  drivers/mtd/chips/Kconfig  |4 
>  drivers/mtd/lpddr/Kconfig  |1 +
>  drivers/mtd/maps/Kconfig   |3 ++-
>  drivers/mtd/nand/Kconfig   |2 +-
>  drivers/mtd/spi-nor/Kconfig|1 +
>  drivers/net/can/Kconfig|1 +
>  drivers/net/hamradio/Kconfig   |9 ++---
>  drivers/nvmem/Kconfig  |1 +
>  drivers/phy/Kconfig|9 +++--
>  drivers/power/reset/Kconfig|4 +++-
>  drivers/staging/comedi/Kconfig |6 +-
>  drivers/thermal/Kconfig|   11 +--

For some of these I already started fixing:
https://lkml.org/lkml/2016/3/3/147
http://comments.gmane.org/gmane.linux.kernel/2167664


>  include/linux/irq.h|2 ++
>  include/linux/mtd/cfi.h|2 ++
>  include/linux/mtd/map.h|2 ++
>  kernel/resource.c  |2 ++
>  lib/Kconfig|7 ++-
>  mm/bootmem.c   |4 ++--
>  27 files changed, 85 insertions(+), 15 deletions(-)
>
> diff --git a/arch/um/include/asm/io.h b/arch/um/include/asm/io.h
> new file mode 100644
> index 000..618ff13
> --- /dev/null
> +++ b/arch/um/include/asm/io.h
> @@ -0,0 +1 @@
> +/* no IOPORT or IOMEM suport */
> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> index a043107..f6dc17a 100644
> --- a/drivers/char/Kconfig
> +++ b/drivers/char/Kconfig
> @@ -8,6 +8,7 @@ source "drivers/tty/Kconfig"
>
>  config DEVMEM
> bool "/dev/mem virtual device support"
> +   depends on HAS_IOMEM
> default y
> help
>   Say Y here if you want to support the /dev/mem device.
> @@ -17,6 +18,7 @@ config DEVMEM
>
>

Re: [RFC 08/15] rtc: at91sam9: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Geert Uytterhoeven
On Thu, Mar 3, 2016 at 11:55 AM, Arnd Bergmann  wrote:
> On Thursday 03 March 2016 17:03:34 Krzysztof Kozlowski wrote:
>> index 0da40e2e4280..5c530b6b125d 100644
>> --- a/drivers/rtc/Kconfig
>> +++ b/drivers/rtc/Kconfig
>> @@ -1302,6 +1302,7 @@ config RTC_DRV_AT91RM9200
>>  config RTC_DRV_AT91SAM9
>> tristate "AT91SAM9 RTT as RTC"
>> depends on ARCH_AT91 || COMPILE_TEST
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select MFD_SYSCON
>> help
>>   Some AT91SAM9 SoCs provide an RTT (Real Time Timer) block which
>>
>
> This is technically correct, but the entire RTC menu is hidden
> inside of 'depends on !UML && !S390', so we won't ever get there
> on any configuration that does not use HAS_IOMEM.
>
> If we did, all other RTC drivers would also fail.

So UML has no RTC. Should/can it use RTC_DRV_GENERIC?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [RFC 09/15] media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Geert Uytterhoeven
On Thu, Mar 3, 2016 at 11:57 AM, Arnd Bergmann  wrote:
>> --- a/drivers/media/platform/exynos4-is/Kconfig
>> +++ b/drivers/media/platform/exynos4-is/Kconfig
>> @@ -17,6 +17,7 @@ config VIDEO_S5P_FIMC
>> tristate "S5P/EXYNOS4 FIMC/CAMIF camera interface driver"
>> depends on I2C
>> depends on HAS_DMA
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select VIDEOBUF2_DMA_CONTIG
>> select V4L2_MEM2MEM_DEV
>
> This  is guarded by HAS_DMA, which implies HAS_IOMEM afaik.

No systems around with HV-based DMA?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH net] bridge: a netlink notification should be sent whenever those attributes change

2016-03-03 Thread Nikolay Aleksandrov
On 03/03/2016 01:16 PM, Xin Long wrote:
> Now when we change the attributes of bridge or br_port by netlink,
> a relevant netlink notification will be sent, but if we change them
> by ioctl or sysfs, no notification will be sent.
> 
> we should ensure that whenever those attributes change internally or from
> sysfs/ioctl, that a netlink notification is sent out to listeners.
> 
> Also, NetworkManager will use this in the future to listen for out-of-band
> bridge master attribute updates and incorporate them into the runtime
> configuration.
> 
> Signed-off-by: Xin Long 
> ---
>  net/bridge/br_ioctl.c| 40 
>  net/bridge/br_sysfs_br.c |  2 ++
>  net/bridge/br_sysfs_if.c |  4 +++-
>  3 files changed, 29 insertions(+), 17 deletions(-)
> 
[snip]
>  static int old_deviceless(struct net *net, void __user *uarg)
> diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
> index 6b80914..231e093 100644
> --- a/net/bridge/br_sysfs_br.c
> +++ b/net/bridge/br_sysfs_br.c
> @@ -44,6 +44,8 @@ static ssize_t store_bridge_parm(struct device *d,
>   return -EINVAL;
>  
>   err = (*set)(br, val);
> + if (!err)
> + netdev_state_change(br->dev);

This is incorrect because you don't have rtnl here, bridge device sysfs
options take care of rtnl only on per-option basis and they obtain and 
release it themselves, so you won't have rtnl held when you call
netdev_state_change. While I agree that this is needed, a larger change
would be necessary for br_sysfs_br.c.
Off-topic: I've been looking into factoring out the bond option API and reusing
it here as it already has all of this handled, but I won't have time to finish
it before the next merge window, so if you fix the issue here I'm okay with
this as interim solution.

Cheers,
 Nik

>   return err ? err : len;
>  }
>  
> diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
> index efe415a..0ad8592 100644
> --- a/net/bridge/br_sysfs_if.c
> +++ b/net/bridge/br_sysfs_if.c
> @@ -253,8 +253,10 @@ static ssize_t brport_store(struct kobject *kobj,
>   spin_lock_bh(&p->br->lock);
>   ret = brport_attr->store(p, val);
>   spin_unlock_bh(&p->br->lock);
> - if (ret == 0)
> + if (ret == 0) {
> + br_ifinfo_notify(RTM_NEWLINK, p);
>   ret = count;
> + }
>   }
>   rtnl_unlock();
>   }
> 



Re: [rtc-linux] Re: [RFC 04/15] irqchip: st: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 21:00:57 Krzysztof Kozlowski wrote:
> >
> > Not user visible.
> 
> Hmmm... you are right (here and in other patches) but why am I getting
> all these errors:
> warning: (ST_IRQCHIP && HIP04_ETH && STMMAC_PLATFORM && DWMAC_IPQ806X
> && DWMAC_LPC18XX && DWMAC_ROCKCHIP && DWMAC_SOCFPGA && DWMAC_STI &&
> TI_CPSW && PINCTRL_ROCKCHIP && PINCTRL_DOVE && POWER_RESET_KEYSTONE &&
> S3C2410_WATCHDOG && VIDEO_OMAP3 && VIDEO_S5P_FIMC && USB_XHCI_MTK &&
> RTC_DRV_AT91SAM9 && LPC18XX_DMAMUX && VIDEO_OMAP4 && HWSPINLOCK_QCOM
> && ATMEL_ST && QCOM_GSBI && PHY_HI6220_USB) selects MFD_SYSCON which
> has unmet direct dependencies (HAS_IOMEM)
> ?
> (ARCH=um, allyesconfig)

The problem is that Kconfig will just print any option that
selects the one that has a missing dependency, but doesn't
show which of those are actually enabled.

> Adding depends here (and in other places) really helps... but it
> should not have any impact...

I think patch 5 by itself would have been sufficient.

Arnd


Re: [rtc-linux] Re: [RFC 04/15] irqchip: st: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozłowski
2016-03-03 21:28 GMT+09:00 Arnd Bergmann :
> On Thursday 03 March 2016 21:00:57 Krzysztof Kozlowski wrote:
>> >
>> > Not user visible.
>>
>> Hmmm... you are right (here and in other patches) but why am I getting
>> all these errors:
>> warning: (ST_IRQCHIP && HIP04_ETH && STMMAC_PLATFORM && DWMAC_IPQ806X
>> && DWMAC_LPC18XX && DWMAC_ROCKCHIP && DWMAC_SOCFPGA && DWMAC_STI &&
>> TI_CPSW && PINCTRL_ROCKCHIP && PINCTRL_DOVE && POWER_RESET_KEYSTONE &&
>> S3C2410_WATCHDOG && VIDEO_OMAP3 && VIDEO_S5P_FIMC && USB_XHCI_MTK &&
>> RTC_DRV_AT91SAM9 && LPC18XX_DMAMUX && VIDEO_OMAP4 && HWSPINLOCK_QCOM
>> && ATMEL_ST && QCOM_GSBI && PHY_HI6220_USB) selects MFD_SYSCON which
>> has unmet direct dependencies (HAS_IOMEM)
>> ?
>> (ARCH=um, allyesconfig)
>
> The problem is that Kconfig will just print any option that
> selects the one that has a missing dependency, but doesn't
> show which of those are actually enabled.

Indeed... but apparently putting direct HAS_IOMEM dependency on these
symbols silences the Kconfig warning.

>> Adding depends here (and in other places) really helps... but it
>> should not have any impact...
>
> I think patch 5 by itself would have been sufficient.

Thanks for analysis. Since all patches are independent (and IMHO the
last one is not needed really) so I won't resend the patchset. Instead
let maintainer pick what is meaningful.

Best regards,
Krzysztof


Re: [RFC 11/15] power: reset: keystone: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Sebastian Reichel
Hi,

On Thu, Mar 03, 2016 at 12:00:14PM +0100, Arnd Bergmann wrote:
> On Thursday 03 March 2016 17:03:37 Krzysztof Kozlowski wrote:
> > diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> > index 0a6408a39c66..0f34846ae80d 100644
> > --- a/drivers/power/reset/Kconfig
> > +++ b/drivers/power/reset/Kconfig
> > @@ -141,6 +141,7 @@ config POWER_RESET_XGENE
> >  config POWER_RESET_KEYSTONE
> > bool "Keystone reset driver"
> > depends on ARCH_KEYSTONE
> > +   depends on HAS_IOMEM# For MFD_SYSCON
> > select MFD_SYSCON
> > help
> >   Reboot support for the KEYSTONE SoCs.
> > 
> 
> This is platform specific, but we should probably add || COMPILE_TEST
> along with the HAS_IOMEM dependency.

Sounds sensible. Will you guys send an updated patch?

-- Sebastian


signature.asc
Description: PGP signature


Re: [rtc-linux] Re: [RFC 11/15] power: reset: keystone: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 21:33 GMT+09:00 Sebastian Reichel :
> Hi,
>
> On Thu, Mar 03, 2016 at 12:00:14PM +0100, Arnd Bergmann wrote:
>> On Thursday 03 March 2016 17:03:37 Krzysztof Kozlowski wrote:
>> > diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
>> > index 0a6408a39c66..0f34846ae80d 100644
>> > --- a/drivers/power/reset/Kconfig
>> > +++ b/drivers/power/reset/Kconfig
>> > @@ -141,6 +141,7 @@ config POWER_RESET_XGENE
>> >  config POWER_RESET_KEYSTONE
>> > bool "Keystone reset driver"
>> > depends on ARCH_KEYSTONE
>> > +   depends on HAS_IOMEM# For MFD_SYSCON
>> > select MFD_SYSCON
>> > help
>> >   Reboot support for the KEYSTONE SoCs.
>> >
>>
>> This is platform specific, but we should probably add || COMPILE_TEST
>> along with the HAS_IOMEM dependency.
>
> Sounds sensible. Will you guys send an updated patch?
>

Sure, I'll make some compile tests and send a v2.

Best regards,
Krzysztof


Re: [rtc-linux] Re: [RFC 09/15] media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 19:57 GMT+09:00 Arnd Bergmann :
> On Thursday 03 March 2016 17:03:35 Krzysztof Kozlowski wrote:
>> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
>> index 201f5c296a95..e5931e434fa2 100644
>> --- a/drivers/media/platform/Kconfig
>> +++ b/drivers/media/platform/Kconfig
>> @@ -79,6 +79,7 @@ config VIDEO_OMAP3
>> depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
>> depends on HAS_DMA && OF
>> depends on OMAP_IOMMU
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select ARM_DMA_USE_IOMMU
>> select VIDEOBUF2_DMA_CONTIG
>
> This is only built for OMAP3, so we won't get here without HAS_IOMEM

Indeed.

>
>> select MFD_SYSCON
>> diff --git a/drivers/media/platform/exynos4-is/Kconfig 
>> b/drivers/media/platform/exynos4-is/Kconfig
>> index 57d42c6172c5..c4317b99d257 100644
>> --- a/drivers/media/platform/exynos4-is/Kconfig
>> +++ b/drivers/media/platform/exynos4-is/Kconfig
>> @@ -17,6 +17,7 @@ config VIDEO_S5P_FIMC
>> tristate "S5P/EXYNOS4 FIMC/CAMIF camera interface driver"
>> depends on I2C
>> depends on HAS_DMA
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select VIDEOBUF2_DMA_CONTIG
>> select V4L2_MEM2MEM_DEV
>
> This  is guarded by HAS_DMA, which implies HAS_IOMEM afaik.

Looking at Kconfigs - no, it is not implied (or am I missing
something)... and sometimes dependency on HAS_IOMEM is next to
HAS_DMA.

BR,
Krzysztof


Re: [rtc-linux] [RFC 13/15] staging: media: omap4iss: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 17:03 GMT+09:00 Krzysztof Kozlowski :
> The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
> direct dependencies.
>
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  drivers/staging/media/omap4iss/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/staging/media/omap4iss/Kconfig 
> b/drivers/staging/media/omap4iss/Kconfig
> index 46183464ee79..7dea072172aa 100644
> --- a/drivers/staging/media/omap4iss/Kconfig
> +++ b/drivers/staging/media/omap4iss/Kconfig
> @@ -2,6 +2,7 @@ config VIDEO_OMAP4
> tristate "OMAP 4 Camera support"
> depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && I2C && ARCH_OMAP4
> depends on HAS_DMA
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select MFD_SYSCON
> select VIDEOBUF2_DMA_CONTIG
> ---help---

False alarm, no need for the patch (this depends on ARCH_OMAP4).

Best regards,
Krzysztof


Re: [rtc-linux] [RFC 12/15] soc: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 17:03 GMT+09:00 Krzysztof Kozlowski :
> The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
> direct dependencies.
>
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  drivers/soc/qcom/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
> index 461b387d03cc..24de48134c15 100644
> --- a/drivers/soc/qcom/Kconfig
> +++ b/drivers/soc/qcom/Kconfig
> @@ -4,6 +4,7 @@
>  config QCOM_GSBI
>  tristate "QCOM General Serial Bus Interface"
>  depends on ARCH_QCOM
> +depends on HAS_IOMEM   # For MFD_SYSCON
>  select MFD_SYSCON

False alarm, no need for the patch (this depends on ARCH_QCOM).

Best regards,
Krzysztof


Re: [rtc-linux] [RFC 07/15] pinctrl: mvebu: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 17:03 GMT+09:00 Krzysztof Kozlowski :
> The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
> direct dependencies.
>
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  drivers/pinctrl/mvebu/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pinctrl/mvebu/Kconfig b/drivers/pinctrl/mvebu/Kconfig
> index 170602407c0d..13685923729c 100644
> --- a/drivers/pinctrl/mvebu/Kconfig
> +++ b/drivers/pinctrl/mvebu/Kconfig
> @@ -7,6 +7,7 @@ config PINCTRL_MVEBU
>
>  config PINCTRL_DOVE
> bool
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select PINCTRL_MVEBU
> select MFD_SYSCON

False alarm, no need for the patch (non-selectable symbol)

Best regards,
Krzysztof


Re: [rtc-linux] [RFC 06/15] pinctrl: rockchip: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 17:03 GMT+09:00 Krzysztof Kozlowski :
> The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
> direct dependencies.
>
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  drivers/pinctrl/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
> index fb8200b8e8ec..dc7ab58d4d74 100644
> --- a/drivers/pinctrl/Kconfig
> +++ b/drivers/pinctrl/Kconfig
> @@ -131,6 +131,7 @@ config PINCTRL_MESON
>
>  config PINCTRL_ROCKCHIP
> bool
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select PINMUX

False alarm, no need for the patch (non-selectable symbol)

Best regards,
Krzysztof


Re: [RFC 08/15] rtc: at91sam9: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 13:27:59 Geert Uytterhoeven wrote:
> On Thu, Mar 3, 2016 at 11:55 AM, Arnd Bergmann  wrote:
> > On Thursday 03 March 2016 17:03:34 Krzysztof Kozlowski wrote:
> >> index 0da40e2e4280..5c530b6b125d 100644
> >> --- a/drivers/rtc/Kconfig
> >> +++ b/drivers/rtc/Kconfig
> >> @@ -1302,6 +1302,7 @@ config RTC_DRV_AT91RM9200
> >>  config RTC_DRV_AT91SAM9
> >> tristate "AT91SAM9 RTT as RTC"
> >> depends on ARCH_AT91 || COMPILE_TEST
> >> +   depends on HAS_IOMEM# For MFD_SYSCON
> >> select MFD_SYSCON
> >> help
> >>   Some AT91SAM9 SoCs provide an RTT (Real Time Timer) block which
> >>
> >
> > This is technically correct, but the entire RTC menu is hidden
> > inside of 'depends on !UML && !S390', so we won't ever get there
> > on any configuration that does not use HAS_IOMEM.
> >
> > If we did, all other RTC drivers would also fail.
> 
> So UML has no RTC. Should/can it use RTC_DRV_GENERIC?

I think nothing should use that, even if it could ;-)

Funny enough, RTC_DRV_GENERIC would probably actually work if you
run UML as root and set iopl() to allow port access, but we don't
really want it to mess with the host RTC.

I don't know where UML gets it real time, but it doesn't actually
need much other than calling clock_gettime(CLOCK_REALTIME, ...)
to get the host time. Presumably it uses some variation of that.

Arnd


Re: [rtc-linux] Re: [RFC 09/15] media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 21:40:23 Krzysztof Kozlowski wrote:
> >> select MFD_SYSCON
> >> diff --git a/drivers/media/platform/exynos4-is/Kconfig 
> >> b/drivers/media/platform/exynos4-is/Kconfig
> >> index 57d42c6172c5..c4317b99d257 100644
> >> --- a/drivers/media/platform/exynos4-is/Kconfig
> >> +++ b/drivers/media/platform/exynos4-is/Kconfig
> >> @@ -17,6 +17,7 @@ config VIDEO_S5P_FIMC
> >> tristate "S5P/EXYNOS4 FIMC/CAMIF camera interface driver"
> >> depends on I2C
> >> depends on HAS_DMA
> >> +   depends on HAS_IOMEM# For MFD_SYSCON
> >> select VIDEOBUF2_DMA_CONTIG
> >> select V4L2_MEM2MEM_DEV
> >
> > This  is guarded by HAS_DMA, which implies HAS_IOMEM afaik.
> 
> Looking at Kconfigs - no, it is not implied (or am I missing
> something)... and sometimes dependency on HAS_IOMEM is next to
> HAS_DMA.
> 
> 

Ah, you are right: UML has no DMA and no IOMEM, but s390 can
have IOMEM (if PCI is enabled) and always sets HAS_DMA.

In practice, I think the HAS_DMA symbol is not as well-defined
as it should be, it basically refers to the presence of the dma-mapping.h
API, and that only really makes sense when you also have IOMEM,
so there might be an implied dependency between the two, but it's
not enforced or actually true.

Arnd


[PULL for-4.5] virtio/vhost: minor fixes

2016-03-03 Thread Michael S. Tsirkin
The following changes since commit fc77dbd34c5c99bce46d40a2491937c3bcbd10af:

  Linux 4.5-rc6 (2016-02-28 08:41:20 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus

for you to fetch changes up to e1f33be9186363da7955bcb5f0b03e6685544c50:

  vhost: fix error path in vhost_init_used() (2016-03-02 17:01:49 +0200)


virtio/vhost: minor fixes

This fixes two minor bugs: error handling in vhost,
and capability processing in virtio.

Signed-off-by: Michael S. Tsirkin 


Greg Kurz (1):
  vhost: fix error path in vhost_init_used()

Ladi Prosek (1):
  virtio-pci: read the right virtio_pci_notify_cap field

 drivers/vhost/vhost.c  | 15 +++
 drivers/virtio/virtio_pci_modern.c |  2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)


[PATCH] phy: remove documentation of removed member addr of phy_device structure

2016-03-03 Thread LABBE Corentin
Commit e5a03bfd873c ("phy: Add an mdio_device structure") removed
the addr member of the phy_device structure.
This patch remove the documentation about that member.

Signed-off-by: LABBE Corentin 
---
 include/linux/phy.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index d6f3641..e14569e 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -338,7 +338,6 @@ struct phy_c45_device_ids {
  * suspended: Set to true if this phy has been suspended successfully.
  * state: state of the PHY for management purposes
  * dev_flags: Device-specific flags used by the PHY driver.
- * addr: Bus address of PHY
  * link_timeout: The number of timer firings to wait before the
  * giving up on the current attempt at acquiring a link
  * irq: IRQ number of the PHY's interrupt (-1 if none)
-- 
2.4.10



[PATCH net-next v1 4/4] tipc: make sure required IPv6 addresses are scoped

2016-03-03 Thread Richard Alpe
Make sure the user has provided a scope for multicast and link local
addresses used locally by a UDP bearer.

Signed-off-by: Richard Alpe 
Acked-by: Jon Maloy 
Reviewed-by: Erik Hugne 
---
 net/tipc/udp_media.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 6fe8740..fb2f7ec6 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -310,9 +310,14 @@ err:
 
 #if IS_ENABLED(CONFIG_IPV6)
} else if ((sa_local.ss_family & sa_remote.ss_family) == AF_INET6) {
+   int atype;
struct sockaddr_in6 *ip6;
 
ip6 = (struct sockaddr_in6 *)&sa_local;
+   atype = ipv6_addr_type(&ip6->sin6_addr);
+   if (__ipv6_addr_needs_scope_id(atype) && !ip6->sin6_scope_id)
+   return -EINVAL;
+
local->proto = htons(ETH_P_IPV6);
local->udp_port = ip6->sin6_port;
memcpy(&local->ipv6, &ip6->sin6_addr, sizeof(struct in6_addr));
-- 
2.1.4



[PATCH net-next v1 2/4] tipc: don't check link reset on non existing link

2016-03-03 Thread Richard Alpe
Make sure we have a link before checking if it has been reset or not.

Prior to this patch tipc_link_is_reset() could be called with a non
existing link, resulting in a null pointer dereference.

Signed-off-by: Richard Alpe 
Acked-by: Jon Maloy 
Reviewed-by: Erik Hugne 
---
 net/tipc/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/node.c b/net/tipc/node.c
index cdb7950..590d597 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -843,7 +843,7 @@ void tipc_node_check_dest(struct net *net, u32 onode,
memcpy(&le->maddr, maddr, sizeof(*maddr));
 exit:
tipc_node_write_unlock(n);
-   if (reset && !tipc_link_is_reset(l))
+   if (reset && l && !tipc_link_is_reset(l))
tipc_node_link_down(n, b->identity, false);
tipc_node_put(n);
 }
-- 
2.1.4



[PATCH net-next v1 1/4] tipc: add net device to skb before UDP xmit

2016-03-03 Thread Richard Alpe
Prior to this patch enabling a IPv4 UDP bearer caused a null pointer
dereference in iptunnel_xmit_stats(), when it tried to dereference the
net device from the skb. To resolve this we now point the skb device
to the net device resolved from the routing table.

Fixes: 039f50629b7f (ip_tunnel: Move stats update to iptunnel_xmit())
Signed-off-by: Richard Alpe 
Acked-by: Jon Maloy 
Reviewed-by: Erik Hugne 
---
 net/tipc/udp_media.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index d63a911..f22a5bb1 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -181,6 +181,8 @@ static int tipc_udp_send_msg(struct net *net, struct 
sk_buff *skb,
err = PTR_ERR(rt);
goto tx_error;
}
+
+   skb->dev = rt->dst.dev;
ttl = ip4_dst_hoplimit(&rt->dst);
udp_tunnel_xmit_skb(rt, ub->ubsock->sk, skb, src->ipv4.s_addr,
dst->ipv4.s_addr, 0, ttl, 0, src->udp_port,
-- 
2.1.4



[PATCH net-next v1 3/4] tipc: safely copy UDP netlink data from user

2016-03-03 Thread Richard Alpe
The netlink policy for TIPC_NLA_UDP_LOCAL and TIPC_NLA_UDP_REMOTE
is of type binary with a defined length. This causes the policy
framework to threat the defined length as maximum length.

There is however no protection against a user sending a smaller
amount of data. Prior to this patch this wasn't handled which could
result in a partially incomplete sockaddr_storage struct containing
uninitialized data.

In this patch we use nla_memcpy() when copying the user data. This
ensures a potential gap at the end is cleared out properly.

This was found by Julia with Coccinelle tool.

Reported-by: Daniel Borkmann 
Reported-by: Julia Lawall 
Signed-off-by: Richard Alpe 
Acked-by: Jon Maloy 
Reviewed-by: Erik Hugne 
---
 net/tipc/udp_media.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index f22a5bb1..6fe8740 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -276,7 +276,7 @@ static int parse_options(struct nlattr *attrs[], struct 
udp_bearer *ub,
 struct udp_media_addr *remote)
 {
struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
-   struct sockaddr_storage *sa_local, *sa_remote;
+   struct sockaddr_storage sa_local, sa_remote;
 
if (!attrs[TIPC_NLA_BEARER_UDP_OPTS])
goto err;
@@ -285,41 +285,43 @@ static int parse_options(struct nlattr *attrs[], struct 
udp_bearer *ub,
 tipc_nl_udp_policy))
goto err;
if (opts[TIPC_NLA_UDP_LOCAL] && opts[TIPC_NLA_UDP_REMOTE]) {
-   sa_local = nla_data(opts[TIPC_NLA_UDP_LOCAL]);
-   sa_remote = nla_data(opts[TIPC_NLA_UDP_REMOTE]);
+   nla_memcpy(&sa_local, opts[TIPC_NLA_UDP_LOCAL],
+  sizeof(sa_local));
+   nla_memcpy(&sa_remote, opts[TIPC_NLA_UDP_REMOTE],
+  sizeof(sa_remote));
} else {
 err:
pr_err("Invalid UDP bearer configuration");
return -EINVAL;
}
-   if ((sa_local->ss_family & sa_remote->ss_family) == AF_INET) {
+   if ((sa_local.ss_family & sa_remote.ss_family) == AF_INET) {
struct sockaddr_in *ip4;
 
-   ip4 = (struct sockaddr_in *)sa_local;
+   ip4 = (struct sockaddr_in *)&sa_local;
local->proto = htons(ETH_P_IP);
local->udp_port = ip4->sin_port;
local->ipv4.s_addr = ip4->sin_addr.s_addr;
 
-   ip4 = (struct sockaddr_in *)sa_remote;
+   ip4 = (struct sockaddr_in *)&sa_remote;
remote->proto = htons(ETH_P_IP);
remote->udp_port = ip4->sin_port;
remote->ipv4.s_addr = ip4->sin_addr.s_addr;
return 0;
 
 #if IS_ENABLED(CONFIG_IPV6)
-   } else if ((sa_local->ss_family & sa_remote->ss_family) == AF_INET6) {
+   } else if ((sa_local.ss_family & sa_remote.ss_family) == AF_INET6) {
struct sockaddr_in6 *ip6;
 
-   ip6 = (struct sockaddr_in6 *)sa_local;
+   ip6 = (struct sockaddr_in6 *)&sa_local;
local->proto = htons(ETH_P_IPV6);
local->udp_port = ip6->sin6_port;
-   local->ipv6 = ip6->sin6_addr;
+   memcpy(&local->ipv6, &ip6->sin6_addr, sizeof(struct in6_addr));
ub->ifindex = ip6->sin6_scope_id;
 
-   ip6 = (struct sockaddr_in6 *)sa_remote;
+   ip6 = (struct sockaddr_in6 *)&sa_remote;
remote->proto = htons(ETH_P_IPV6);
remote->udp_port = ip6->sin6_port;
-   remote->ipv6 = ip6->sin6_addr;
+   memcpy(&remote->ipv6, &ip6->sin6_addr, sizeof(struct in6_addr));
return 0;
 #endif
}
-- 
2.1.4



RE: [PATCH net-next v1 1/4] tipc: add net device to skb before UDP xmit

2016-03-03 Thread Xue, Ying
As I just saw, you had submitted the series to net-next. Anyway, this is a very 
good job!

Thanks,
Ying

-Original Message-
From: netdev-ow...@vger.kernel.org [mailto:netdev-ow...@vger.kernel.org] On 
Behalf Of Richard Alpe
Sent: 2016年3月3日 21:21
To: netdev@vger.kernel.org
Cc: tipc-discuss...@lists.sourceforge.net; Richard Alpe
Subject: [PATCH net-next v1 1/4] tipc: add net device to skb before UDP xmit

Prior to this patch enabling a IPv4 UDP bearer caused a null pointer 
dereference in iptunnel_xmit_stats(), when it tried to dereference the net 
device from the skb. To resolve this we now point the skb device to the net 
device resolved from the routing table.

Fixes: 039f50629b7f (ip_tunnel: Move stats update to iptunnel_xmit())
Signed-off-by: Richard Alpe 
Acked-by: Jon Maloy 
Reviewed-by: Erik Hugne 
---
 net/tipc/udp_media.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c index 
d63a911..f22a5bb1 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -181,6 +181,8 @@ static int tipc_udp_send_msg(struct net *net, struct 
sk_buff *skb,
err = PTR_ERR(rt);
goto tx_error;
}
+
+   skb->dev = rt->dst.dev;
ttl = ip4_dst_hoplimit(&rt->dst);
udp_tunnel_xmit_skb(rt, ub->ubsock->sk, skb, src->ipv4.s_addr,
dst->ipv4.s_addr, 0, ttl, 0, src->udp_port,
--
2.1.4



[PATCH] asix: do not free array priv->mdio->irq

2016-03-03 Thread Colin King
From: Colin Ian King 

Used to be allocated and required freeing, but now
priv->mdio->irq is now a fixed sized array and should no longer be
free'd.

Issue detected using static analysis with CoverityScan

Fixes: e7f4dc3536a400 ("mdio: Move allocation of interrupts into core")
Signed-off-by: Colin Ian King 
---
 drivers/net/usb/ax88172a.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c
index 224e7d8..cf77f2d 100644
--- a/drivers/net/usb/ax88172a.c
+++ b/drivers/net/usb/ax88172a.c
@@ -134,7 +134,6 @@ static void ax88172a_remove_mdio(struct usbnet *dev)
 
netdev_info(dev->net, "deregistering mdio bus %s\n", priv->mdio->id);
mdiobus_unregister(priv->mdio);
-   kfree(priv->mdio->irq);
mdiobus_free(priv->mdio);
 }
 
-- 
2.7.0



[net PATCH] net: sched: fix act_ipt for LOG target

2016-03-03 Thread Phil Sutter
From: Phil Sutter 

Before calling the destroy() or target() callbacks, the family parameter
field has to be initialized. Otherwise at least the LOG target will
refuse to work and upon removal oops the kernel.

Cc: Jamal Hadi Salim 
Signed-off-by: Phil Sutter 
---
 net/sched/act_ipt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 89c41a1f35894..350e134cffb32 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -66,6 +66,7 @@ static void ipt_destroy_target(struct xt_entry_target *t)
struct xt_tgdtor_param par = {
.target   = t->u.kernel.target,
.targinfo = t->data,
+   .family   = NFPROTO_IPV4,
};
if (par.target->destroy != NULL)
par.target->destroy(&par);
@@ -219,6 +220,7 @@ static int tcf_ipt(struct sk_buff *skb, const struct 
tc_action *a,
par.hooknum  = ipt->tcfi_hook;
par.target   = ipt->tcfi_t->u.kernel.target;
par.targinfo = ipt->tcfi_t->data;
+   par.family   = NFPROTO_IPV4;
ret = par.target->target(skb, &par);
 
switch (ret) {
-- 
2.7.2



Re: [PATCH net] net: hns: fix the bug about loopback

2016-03-03 Thread Andy Shevchenko
On Thu, 2016-03-03 at 20:02 +0800, Kejian Yan wrote:
> It will always be passed if the soc is tested the loopback cases.
> This
> patch will fix this bug.

Few style related comments.

> @@ -686,6 +690,10 @@ static int hns_ae_config_loopback(struct
> hnae_handle *handle,
>   default:
>   ret = -EINVAL;
>   }
> +
> + if (!ret)
> + hns_dsaf_set_inner_lb(mac_cb->dsaf_dev, mac_cb-
> >mac_id, en);
> +
>   return ret;

if (ret)
 return ret;

whatever();
return 0;

>  }

--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
> @@ -230,6 +230,30 @@ static void hns_dsaf_mix_def_qid_cfg(struct
> dsaf_device *dsaf_dev)
>   }
>  }
>  
> +static void hns_dsaf_inner_qid_cfg(struct dsaf_device *dsaf_dev)
> +{
> + u16 max_q_per_vf, max_vfn;
> + u32 q_id = 0, q_num_per_port;
> + u32 mac_id;
> +
> + if (AE_IS_VER1(dsaf_dev->dsaf_ver))
> + return;
> +
> + hns_rcb_get_queue_mode(dsaf_dev->dsaf_mode,
> +    HNS_DSAF_COMM_SERVICE_NW_IDX,
> +    &max_vfn, &max_q_per_vf);
> + q_num_per_port = max_vfn * max_q_per_vf;
> +
> + for (mac_id = 0, q_id = 0; mac_id < DSAF_SERVICE_NW_NUM; 

q_id is already assigned to 0. Get rid of either.

> mac_id++) {
> + dsaf_set_dev_field(dsaf_dev,
> +    DSAFV2_SERDES_LBK_0_REG + 0x4 *
> mac_id,
> +    DSAFV2_SERDES_LBK_QID_M,
> +    DSAFV2_SERDES_LBK_QID_S,
> +    q_id);
> + q_id += q_num_per_port;
> + }
> +}

 
> +void hns_dsaf_set_inner_lb(struct dsaf_device *dsaf_dev, u32 mac_id,
> u32 en)
> +{
> + if (AE_IS_VER1(dsaf_dev->dsaf_ver) ||
> + dsaf_dev->mac_cb[mac_id].mac_type == HNAE_PORT_DEBUG)
> + return;
> +
> + dsaf_set_dev_bit(dsaf_dev, DSAFV2_SERDES_LBK_0_REG + 0x4 *
> mac_id,

0x4 -> 4 (it's about register width, right?)

> +  DSAFV2_SERDES_LBK_EN_B, !!en);
> +}

>  #define PPEV2_CFG_RSS_TBL_4N3_S  24
>  #define PPEV2_CFG_RSS_TBL_4N3_M  (((1UL << 5) - 1) <<
> PPEV2_CFG_RSS_TBL_4N3_S)
>  
> +#define DSAFV2_SERDES_LBK_EN_B  8
> +#define DSAFV2_SERDES_LBK_QID_S 0
> +#define DSAFV2_SERDES_LBK_QID_M \
> + (((1UL << DSAFV2_SERDES_LBK_EN_B) - 1) <<
> DSAFV2_SERDES_LBK_QID_S)

Why not like above?

#define DSAFV2_SERDES_LBK_QID_M (((1UL << 8) - 1)
<< DSAFV2_SERDES_LBK_QID_S)

> +static void __lb_fill_txt_skb_buff(struct net_device *ndev,
> +    struct sk_buff *skb)
> +{
> + struct hns_nic_priv *priv = netdev_priv(ndev);
> + struct hnae_handle *h = priv->ae_handle;
> + u32 frame_size;
> +
> + frame_size = skb->len;
> + memset(skb->data, 0xFF, frame_size);
> +
> + if ((!AE_IS_VER1(priv->enet_ver)) &&
> + (h->port_type == HNAE_PORT_SERVICE)) {
> + memcpy(skb->data, ndev->dev_addr, 6);

ether_addr_copy() ?

> + skb->data[5] += 0x1f;

This has to be explained.

> + }
> +
> + frame_size &= ~1ul;

And how 1ul is different to plain 1 here?

> + memset(&skb->data[frame_size / 2], 0xAA, frame_size / 2 -
> 1);
> + memset(&skb->data[frame_size / 2 + 10], 0xBE, frame_size / 2
> - 11);
> + memset(&skb->data[frame_size / 2 + 12], 0xAF, frame_size / 2
> - 13);

Magic numbers have to be explained.
Also, what is the logic to overwrite the data if frame_size is big
enough?

> +}
> +

-- 
Andy Shevchenko 
Intel Finland Oy



[PATCH] net/ethoc: do not free array priv->mdio->irq

2016-03-03 Thread Colin King
From: Colin Ian King 

priv->mdio->irq used to be allocated and required freeing, but it
is now a fixed sized array and should no longer be free'd.

Issue detected using static analysis with CoverityScan

Fixes: e7f4dc3536a400 ("mdio: Move allocation of interrupts into core")
Signed-off-by: Colin Ian King 
---
 drivers/net/ethernet/ethoc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 62fa136..41b0106 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -1265,7 +1265,6 @@ static int ethoc_remove(struct platform_device *pdev)
 
if (priv->mdio) {
mdiobus_unregister(priv->mdio);
-   kfree(priv->mdio->irq);
mdiobus_free(priv->mdio);
}
if (priv->clk)
-- 
2.7.0



[PATCH] net: eth: altera: do not free array priv->mdio->irq

2016-03-03 Thread Colin King
From: Colin Ian King 

priv->mdio->irq used to be allocated and required freeing, but it
is now a fixed sized array and should no longer be free'd.

Issue detected using static analysis with CoverityScan

Fixes: e7f4dc3536a400 ("mdio: Move allocation of interrupts into core")
Signed-off-by: Colin Ian King 
---
 drivers/net/ethernet/altera/altera_tse_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/altera/altera_tse_main.c 
b/drivers/net/ethernet/altera/altera_tse_main.c
index 1747285..f749e4d 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -193,7 +193,6 @@ static void altera_tse_mdio_destroy(struct net_device *dev)
priv->mdio->id);
 
mdiobus_unregister(priv->mdio);
-   kfree(priv->mdio->irq);
mdiobus_free(priv->mdio);
priv->mdio = NULL;
 }
-- 
2.7.0



RE: [PATCH] can: rcar_canfd: Add Renesas R-Car CAN FD driver

2016-03-03 Thread Ramesh Shanmugasundaram
Hi Marc,

Sorry for the late response.

> On 03/02/2016 11:08 AM, Ramesh Shanmugasundaram wrote:
>  I see no locking for the tx-path.
> >>>
> >>> I am not sure why locking is needed in tx-path?
> >>
> >> If the tx-path is shared between both channels you need locking as
> >> the networking subsystem may send one frame to each controller at the
> >> same time.
> >
> > Yes. Tx completion interrupt is shared by both channels but the Tx
> > FIFO, echo skbs, head, tail are maintained on a per channel basis.
> > Yes, net subsystem can send one frame to each channel at the same time
> > and the tx completion interrupt handler will traverse each channel &
> > update per channel context accordingly.
> 
> Ok. Which instruction starts the transmit? Please add a comment to the
> code.

Please see

--

+   /* Start Tx: Write 0xff to CFPC to increment the CPU-side
+* pointer for the Common FIFO
+*/
+   rcar_canfd_write(priv, RCANFD_CFPCTR(ch, RCANFD_CFFIFO_IDX), 0xff);

--

> You stop the tx_queue after this, so your code is racy, as the
> interrupt might happen in between.

It is a very good point. Thank you. 
I managed to reproduce this issue once with 50Kbps rate and ignoring -ENOBUFS 
in user space. It also exposed another subtle issue in the echo skb management 
where the tx_done loop pushes the skb before the actual ACK for that index 
happens. Fixed both issues.
As you mentioned, I have introduced a lock to protect this critical section. 
I'll send the updates in the next v2 patch.

Thanks,
Ramesh


[PATCH V3] net: ezchip: adapt driver to little endian architecture

2016-03-03 Thread Lada Trimasova
Since ezchip network driver is written with big endian EZChip platform it
is necessary to add support for little endian architecture.

The first issue is that the order of the bits in a bit field is
implementation specific. So all the bit fields are removed.
Named constants are used to access necessary fields.

And the second one is that network byte order is big endian.
For example, data on ethernet is transmitted with most-significant
octet (byte) first. So in case of little endian architecture
it is important to swap data byte order when we read it from
register. In case of unaligned access we can use "get_unaligned_be32"
and in other case we can use function "ioread32_rep" which reads all
data from register and works either with little endian or big endian
architecture.

And then when we are going to write data to register we need to restore
byte order using the function "put_unaligned_be32" in case of
unaligned access and in other case "iowrite32_rep".

The last little fix is a space between type and pointer to observe
coding style.

Signed-off-by: Lada Trimasova 
Cc: Alexey Brodkin 
Cc: Noam Camus 
Cc: Tal Zilcer 
Cc: Arnd Bergmann 

---
changes v2->v3:
- using ioread32_rep/iowrite32_rep instead of cpu_to_be32/be32_to_cpu
  when reading from FIFO register

changes v1->v2:
- removing all bitfields, using named constants instead
- using put_unaligned_be32/get_unaligned_be32 in case of unaligned access
---
 drivers/net/ethernet/ezchip/nps_enet.c | 222 +++--
 drivers/net/ethernet/ezchip/nps_enet.h | 348 +++--
 2 files changed, 238 insertions(+), 332 deletions(-)

diff --git a/drivers/net/ethernet/ezchip/nps_enet.c 
b/drivers/net/ethernet/ezchip/nps_enet.c
index b102668..1f23845a 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -43,20 +43,21 @@ static void nps_enet_read_rx_fifo(struct net_device *ndev,
bool dst_is_aligned = IS_ALIGNED((unsigned long)dst, sizeof(u32));
 
/* In case dst is not aligned we need an intermediate buffer */
-   if (dst_is_aligned)
-   for (i = 0; i < len; i++, reg++)
-   *reg = nps_enet_reg_get(priv, NPS_ENET_REG_RX_BUF);
+   if (dst_is_aligned) {
+   ioread32_rep(priv->regs_base + NPS_ENET_REG_RX_BUF, reg, len);
+   reg += len;
+   }
else { /* !dst_is_aligned */
for (i = 0; i < len; i++, reg++) {
u32 buf = nps_enet_reg_get(priv, NPS_ENET_REG_RX_BUF);
-   put_unaligned(buf, reg);
+   put_unaligned_be32(buf, reg);
}
}
-
/* copy last bytes (if any) */
if (last) {
-   u32 buf = nps_enet_reg_get(priv, NPS_ENET_REG_RX_BUF);
-   memcpy((u8*)reg, &buf, last);
+   u32 buf;
+   ioread32_rep(priv->regs_base + NPS_ENET_REG_RX_BUF, &buf, 1);
+   memcpy((u8 *)reg, &buf, last);
}
 }
 
@@ -66,26 +67,28 @@ static u32 nps_enet_rx_handler(struct net_device *ndev)
u32 work_done = 0;
struct nps_enet_priv *priv = netdev_priv(ndev);
struct sk_buff *skb;
-   struct nps_enet_rx_ctl rx_ctrl;
+   u32 rx_ctrl_value = nps_enet_reg_get(priv, NPS_ENET_REG_RX_CTL);
+   u32 rx_ctrl_cr = (rx_ctrl_value & RX_CTL_CR_MASK) >> RX_CTL_CR_SHIFT;
+   u32 rx_ctrl_er = (rx_ctrl_value & RX_CTL_ER_MASK) >> RX_CTL_ER_SHIFT;
+   u32 rx_ctrl_crc = (rx_ctrl_value & RX_CTL_CRC_MASK) >> RX_CTL_CRC_SHIFT;
 
-   rx_ctrl.value = nps_enet_reg_get(priv, NPS_ENET_REG_RX_CTL);
-   frame_len = rx_ctrl.nr;
+   frame_len = (rx_ctrl_value & RX_CTL_NR_MASK) >> RX_CTL_NR_SHIFT;
 
/* Check if we got RX */
-   if (!rx_ctrl.cr)
+   if (!rx_ctrl_cr)
return work_done;
 
/* If we got here there is a work for us */
work_done++;
 
/* Check Rx error */
-   if (rx_ctrl.er) {
+   if (rx_ctrl_er) {
ndev->stats.rx_errors++;
err = 1;
}
 
/* Check Rx CRC error */
-   if (rx_ctrl.crc) {
+   if (rx_ctrl_crc) {
ndev->stats.rx_crc_errors++;
ndev->stats.rx_dropped++;
err = 1;
@@ -136,23 +139,24 @@ rx_irq_frame_done:
 static void nps_enet_tx_handler(struct net_device *ndev)
 {
struct nps_enet_priv *priv = netdev_priv(ndev);
-   struct nps_enet_tx_ctl tx_ctrl;
-
-   tx_ctrl.value = nps_enet_reg_get(priv, NPS_ENET_REG_TX_CTL);
+   u32 tx_ctrl_value = nps_enet_reg_get(priv, NPS_ENET_REG_TX_CTL);
+   u32 tx_ctrl_ct = (tx_ctrl_value & TX_CTL_CT_MASK) >> TX_CTL_CT_SHIFT;
+   u32 tx_ctrl_et = (tx_ctrl_value & TX_CTL_ET_MASK) >> TX_CTL_ET_SHIFT;
+   u32 tx_ctrl_nt = (tx_ctrl_value & TX_CTL_NT_MASK) >> TX_CTL_NT_SHIFT;
 
/* Check if we got TX */
-   if (!priv->tx_packet_sent || tx_ctrl.ct)
+   if (!priv->tx_packet_sent || tx_ctrl_ct)
  

Re: [PATCH V3] net: ezchip: adapt driver to little endian architecture

2016-03-03 Thread Arnd Bergmann
On Thursday 03 March 2016 17:07:46 Lada Trimasova wrote:
> From: Lada Trimasova 
> To:   netdev@vger.kernel.org
> CC:   linux-ker...@vger.kernel.org, Lada Trimasova 
> , Alexey Brodkin , 
> Noam Camus , Tal Zilcer , Arnd Bergmann 
> 
> Date: Today 15:07:46
> Since ezchip network driver is written with big endian EZChip platform it
> is necessary to add support for little endian architecture.
> 
> The first issue is that the order of the bits in a bit field is
> implementation specific. So all the bit fields are removed.
> Named constants are used to access necessary fields.
> 
> And the second one is that network byte order is big endian.
> For example, data on ethernet is transmitted with most-significant
> octet (byte) first. So in case of little endian architecture
> it is important to swap data byte order when we read it from
> register. In case of unaligned access we can use "get_unaligned_be32"
> and in other case we can use function "ioread32_rep" which reads all
> data from register and works either with little endian or big endian
> architecture.
> 
> And then when we are going to write data to register we need to restore
> byte order using the function "put_unaligned_be32" in case of
> unaligned access and in other case "iowrite32_rep".
> 
> The last little fix is a space between type and pointer to observe
> coding style.
> 
> Signed-off-by: Lada Trimasova 
> Cc: Alexey Brodkin 
> Cc: Noam Camus 
> Cc: Tal Zilcer 
> Cc: Arnd Bergmann 
> 

Acked-by: Arnd Bergmann 


Re: [PATCH] net/ethoc: do not free array priv->mdio->irq

2016-03-03 Thread Tobias Klauser
On 2016-03-03 at 14:43:34 +0100, Colin King  wrote:
> From: Colin Ian King 
> 
> priv->mdio->irq used to be allocated and required freeing, but it
> is now a fixed sized array and should no longer be free'd.
> 
> Issue detected using static analysis with CoverityScan
> 
> Fixes: e7f4dc3536a400 ("mdio: Move allocation of interrupts into core")
> Signed-off-by: Colin Ian King 

Reviewed-by: Tobias Klauser 


Re: [iproute PATCH 3/3] tc: pedit: Fix retain value for ihl adjustments

2016-03-03 Thread Jamal Hadi Salim

On 16-03-02 12:54 PM, Stephen Hemminger wrote:

On Wed, 2 Mar 2016 11:20:31 +
Phil Sutter  wrote:


+   res = parse_cmd(&argc, &argv, 1, TU32,0x0f,sel,tkey);
goto done;

Please add whitespace after ,



There are a few whitespace issues in that code that would be nice to fix
given the cleanup opportunity.
The patches look good to me. Phil, maybe get rid of that comment at the
top which was worrying about endianness. I think you fixed it.

Acked-by: Jamal Hadi Salim 

Your tests in patch 0 are nice and could go in tests/ directory.
I can send you some of the basic tests i run via the kernel; they look
something of the form:

#
#RFC
#dst MAC starts at -14
#src MAC at -8
#ethertype at -2
#
#
tc filter add dev eth0 parent : protocol ip prio 10 u32 \
match ip src 192.168.1.10/32 flowid 1:2 \
action pedit munge offset -14 u16 set 0x \
munge offset -12 u32 set 0x00010100 \
munge offset -8 u32 set 0x0aaf0100 \
munge offset -4 u32 set 0x0008ec06 pipe \
action mirred egress redirect dev eth1
#
#

These would of course require more of a larger setup to vet
and running tcpdump to check the correct bytes are being
modified.

cheers,
jamal


Re: [iproute PATCH v2 06/20] iproute: TYPE keyword is not optional, fix help text accordingly

2016-03-03 Thread Jamal Hadi Salim

On 16-03-02 01:19 PM, Phil Sutter wrote:

+   fprintf(stderr, "  unreachable | prohibit | blackhole | nat 
}\n");


Dont think nat exists anymore...

cheers,
jamal


Re: [Patch net-next] act_ife: fix a typo in kmemdup() parameters

2016-03-03 Thread Jamal Hadi Salim

On 16-03-02 02:20 PM, Cong Wang wrote:

Cc: Jamal Hadi Salim 
Signed-off-by: Cong Wang 


Thanks Cong.
Acked-by: Jamal Hadi Salim 

cheers,
jamal


Re: [PATCH] asix: do not free array priv->mdio->irq

2016-03-03 Thread Andrew Lunn
On Thu, Mar 03, 2016 at 01:27:56PM +, Colin King wrote:
> From: Colin Ian King 
> 
> Used to be allocated and required freeing, but now
> priv->mdio->irq is now a fixed sized array and should no longer be
> free'd.
> 
> Issue detected using static analysis with CoverityScan
> 
> Fixes: e7f4dc3536a400 ("mdio: Move allocation of interrupts into core")
> Signed-off-by: Colin Ian King 

Reviewed-by: Andrew Lunn 

Thanks
Andrew

> ---
>  drivers/net/usb/ax88172a.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c
> index 224e7d8..cf77f2d 100644
> --- a/drivers/net/usb/ax88172a.c
> +++ b/drivers/net/usb/ax88172a.c
> @@ -134,7 +134,6 @@ static void ax88172a_remove_mdio(struct usbnet *dev)
>  
>   netdev_info(dev->net, "deregistering mdio bus %s\n", priv->mdio->id);
>   mdiobus_unregister(priv->mdio);
> - kfree(priv->mdio->irq);
>   mdiobus_free(priv->mdio);
>  }
>  
> -- 
> 2.7.0
> 


Re: [PATCH] net/ethoc: do not free array priv->mdio->irq

2016-03-03 Thread Andrew Lunn
On Thu, Mar 03, 2016 at 01:43:34PM +, Colin King wrote:
> From: Colin Ian King 
> 
> priv->mdio->irq used to be allocated and required freeing, but it
> is now a fixed sized array and should no longer be free'd.
> 
> Issue detected using static analysis with CoverityScan
> 
> Fixes: e7f4dc3536a400 ("mdio: Move allocation of interrupts into core")
> Signed-off-by: Colin Ian King 

Reviewed-by: Andrew Lunn 

Thanks
Andrew

> ---
>  drivers/net/ethernet/ethoc.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
> index 62fa136..41b0106 100644
> --- a/drivers/net/ethernet/ethoc.c
> +++ b/drivers/net/ethernet/ethoc.c
> @@ -1265,7 +1265,6 @@ static int ethoc_remove(struct platform_device *pdev)
>  
>   if (priv->mdio) {
>   mdiobus_unregister(priv->mdio);
> - kfree(priv->mdio->irq);
>   mdiobus_free(priv->mdio);
>   }
>   if (priv->clk)
> -- 
> 2.7.0
> 


Re: [net PATCH] net: sched: fix act_ipt for LOG target

2016-03-03 Thread Jamal Hadi Salim

On 16-03-03 08:34 AM, Phil Sutter wrote:

From: Phil Sutter 

Before calling the destroy() or target() callbacks, the family parameter
field has to be initialized. Otherwise at least the LOG target will
refuse to work and upon removal oops the kernel.

Cc: Jamal Hadi Salim 
Signed-off-by: Phil Sutter 


Caveat: ipt has not been receiving a lot of love. Thanks for showing
it some love. If indeed you have tested this with the LOG target, then:

Acked-by: Jamal Hadi Salim 

cheers,
jamal



Re: [iproute PATCH 3/3] tc: pedit: Fix retain value for ihl adjustments

2016-03-03 Thread Jamal Hadi Salim

Phil, there is one thing i noticed in your patch - dont think
it is a big deal but you are doing htons on an int
(instead of u16).

cheers,
jamal

On 16-03-03 09:21 AM, Jamal Hadi Salim wrote:

On 16-03-02 12:54 PM, Stephen Hemminger wrote:

On Wed, 2 Mar 2016 11:20:31 +
Phil Sutter  wrote:


+res = parse_cmd(&argc, &argv, 1, TU32,0x0f,sel,tkey);
  goto done;

Please add whitespace after ,



There are a few whitespace issues in that code that would be nice to fix
given the cleanup opportunity.
The patches look good to me. Phil, maybe get rid of that comment at the
top which was worrying about endianness. I think you fixed it.

Acked-by: Jamal Hadi Salim 

Your tests in patch 0 are nice and could go in tests/ directory.
I can send you some of the basic tests i run via the kernel; they look
something of the form:

#
#RFC
#dst MAC starts at -14
#src MAC at -8
#ethertype at -2
#
#
tc filter add dev eth0 parent : protocol ip prio 10 u32 \
match ip src 192.168.1.10/32 flowid 1:2 \
action pedit munge offset -14 u16 set 0x \
munge offset -12 u32 set 0x00010100 \
munge offset -8 u32 set 0x0aaf0100 \
munge offset -4 u32 set 0x0008ec06 pipe \
action mirred egress redirect dev eth1
#
#

These would of course require more of a larger setup to vet
and running tcpdump to check the correct bytes are being
modified.

cheers,
jamal




  1   2   3   >