Netdev List
 help / color / mirror / Atom feed
* [PATCH 07/13] ARM: dts: dra72-evm: Add CAN support
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

The board has 2 CAN ports but only the first one can be used.
Enable the first CAN port.

The second one cannot be used without hardware modification
so we don't enable the second port.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/dra72-evm.dts | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/dra72-evm.dts b/arch/arm/boot/dts/dra72-evm.dts
index 5147023..e5b7172 100644
--- a/arch/arm/boot/dts/dra72-evm.dts
+++ b/arch/arm/boot/dts/dra72-evm.dts
@@ -19,6 +19,29 @@
 	};
 };
 
+&dra7_pmx_core {
+	dcan1_pins_default: dcan1_pins_default {
+		pinctrl-single,pins = <
+			0x3d4	(PIN_INPUT | MUX_MODE0)		/* dcan1_tx */
+			0x418	(PIN_INPUT | MUX_MODE1)		/* wakeup0.dcan1_rx */
+		>;
+	};
+
+	dcan1_pins_sleep: dcan1_pins_sleep {
+		pinctrl-single,pins = <
+			0x3d4	(PIN_INPUT | MUX_MODE15)	/* dcan1_tx.off */
+			0x418	(PIN_INPUT | MUX_MODE15)	/* wakeup0.off */
+		>;
+	};
+};
+
 &uart1 {
 	status = "okay";
 };
+
+&dcan1 {
+	status = "ok";
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&dcan1_pins_default>;
+	pinctrl-1 = <&dcan1_pins_sleep>;
+};
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH 04/13] ARM: dts: dra7: Add syscon regmap for CORE CONTROL area
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros, Tomi Valkeinen
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

Display and DCAN drivers use syscon regmap to access some registers
in the CORE control area. Add the syscon regmap node for this
area.

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index d678152..370009e 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -200,6 +200,11 @@
 			ti,hwmods = "counter_32k";
 		};
 
+		dra7_ctrl_core: ctrl_core@4a002000 {
+			compatible = "syscon";
+			reg = <0x4a002000 0x6d0>;
+		};
+
 		dra7_ctrl_general: tisyscon@4a002e00 {
 			compatible = "syscon";
 			reg = <0x4a002e00 0x7c>;
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH 02/13] net: can: c_can: Add syscon/regmap RAMINIT mechanism
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

Some TI SoCs like DRA7 have a RAMINIT register specification
different from the other AMxx SoCs and as expected by the
existing driver.

To add more insanity, this register is shared with other
IPs like DSS, PCIe and PWM.

Provides a more generic mechanism to specify the RAMINIT
register location and START/DONE bit position and use the
syscon/regmap framework to access the register.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 .../devicetree/bindings/net/can/c_can.txt          |   7 ++
 drivers/net/can/c_can/c_can.h                      |  11 ++-
 drivers/net/can/c_can/c_can_platform.c             | 106 +++++++++++++++------
 3 files changed, 95 insertions(+), 29 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/c_can.txt b/Documentation/devicetree/bindings/net/can/c_can.txt
index 8f1ae81..0856209 100644
--- a/Documentation/devicetree/bindings/net/can/c_can.txt
+++ b/Documentation/devicetree/bindings/net/can/c_can.txt
@@ -13,6 +13,13 @@ Optional properties:
 - ti,hwmods		: Must be "d_can<n>" or "c_can<n>", n being the
 			  instance number
 
+- raminit-syscon	: Handle to system control region that contains the
+			  RAMINIT register. If specified, the second memory resource
+			  in the reg property must index into the RAMINIT
+			  register within the syscon region
+- raminit-start-bit	: Bit posistion of START bit in the RAMINIT register
+- raminit-done-bit	: Bit position of DONE bit in the RAMINIT register
+
 Note: "ti,hwmods" field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
 Future plan is to migrate hwmod data base contents into device tree
diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
index 99ad1aa..bf68822 100644
--- a/drivers/net/can/c_can/c_can.h
+++ b/drivers/net/can/c_can/c_can.h
@@ -169,6 +169,14 @@ enum c_can_dev_id {
 	BOSCH_D_CAN,
 };
 
+/* Out of band RAMINIT register access via syscon regmap */
+struct c_can_raminit {
+	struct regmap *syscon;	/* for raminit ctrl. reg. access */
+	unsigned int reg;	/* register index within syscon */
+	u8 start_bit;	/* START bit position in raminit reg. */
+	u8 done_bit;	/* DONE bit position in raminit reg. */
+};
+
 /* c_can private data structure */
 struct c_can_priv {
 	struct can_priv can;	/* must be the first member */
@@ -186,8 +194,7 @@ struct c_can_priv {
 	const u16 *regs;
 	void *priv;		/* for board-specific data */
 	enum c_can_dev_id type;
-	u32 __iomem *raminit_ctrlreg;
-	int instance;
+	struct c_can_raminit raminit_sys;	/* RAMINIT via syscon regmap */
 	void (*raminit) (const struct c_can_priv *priv, bool enable);
 	u32 comm_rcv_high;
 	u32 rxmasked;
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index b144e71..e7ec3b6 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -32,6 +32,8 @@
 #include <linux/clk.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
 #include <linux/can/dev.h>
 
@@ -72,48 +74,59 @@ static void c_can_plat_write_reg_aligned_to_32bit(const struct c_can_priv *priv,
 	writew(val, priv->base + 2 * priv->regs[index]);
 }
 
-static void c_can_hw_raminit_wait_ti(const struct c_can_priv *priv, u32 mask,
-				  u32 val)
+static void c_can_hw_raminit_wait_syscon(const struct c_can_priv *priv,
+					 u32 mask, u32 val)
 {
 	int timeout = 0;
+	const struct c_can_raminit *raminit = &priv->raminit_sys;
+	u32 ctrl;
+
 	/* We look only at the bits of our instance. */
 	val &= mask;
-	while ((readl(priv->raminit_ctrlreg) & mask) != val) {
+	do {
 		udelay(1);
 		timeout++;
 
+		regmap_read(raminit->syscon, raminit->reg, &ctrl);
 		if (timeout == 1000) {
 			dev_err(&priv->dev->dev, "%s: time out\n", __func__);
 			break;
 		}
-	}
+	} while ((ctrl & mask) != val);
 }
 
-static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)
+static void c_can_hw_raminit_syscon(const struct c_can_priv *priv, bool enable)
 {
-	u32 mask = CAN_RAMINIT_ALL_MASK(priv->instance);
+	u32 mask;
 	u32 ctrl;
+	const struct c_can_raminit *raminit = &priv->raminit_sys;
 
 	spin_lock(&raminit_lock);
 
-	ctrl = readl(priv->raminit_ctrlreg);
+	mask = 1 << raminit->start_bit | 1 << raminit->done_bit;
+	regmap_read(raminit->syscon, raminit->reg, &ctrl);
+
 	/* We clear the done and start bit first. The start bit is
 	 * looking at the 0 -> transition, but is not self clearing;
 	 * And we clear the init done bit as well.
+	 * NOTE: DONE must be written with 1 to clear it.
 	 */
-	ctrl &= ~CAN_RAMINIT_START_MASK(priv->instance);
-	ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
-	writel(ctrl, priv->raminit_ctrlreg);
-	ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance);
-	c_can_hw_raminit_wait_ti(priv, mask, ctrl);
+	ctrl &= ~(1 << raminit->start_bit);
+	ctrl |= 1 << raminit->done_bit;
+	regmap_write(raminit->syscon, raminit->reg, ctrl);
+
+	ctrl &= ~(1 << raminit->done_bit);
+	c_can_hw_raminit_wait_syscon(priv, mask, ctrl);
 
 	if (enable) {
 		/* Set start bit and wait for the done bit. */
-		ctrl |= CAN_RAMINIT_START_MASK(priv->instance);
-		writel(ctrl, priv->raminit_ctrlreg);
-		ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
-		c_can_hw_raminit_wait_ti(priv, mask, ctrl);
+		ctrl |= 1 << raminit->start_bit;
+		regmap_write(raminit->syscon, raminit->reg, ctrl);
+
+		ctrl |= 1 << raminit->done_bit;
+		c_can_hw_raminit_wait_syscon(priv, mask, ctrl);
 	}
+
 	spin_unlock(&raminit_lock);
 }
 
@@ -202,6 +215,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
 	struct resource *mem, *res;
 	int irq;
 	struct clk *clk;
+	struct device_node *np = pdev->dev.of_node;
+	u32 val;
 
 	if (pdev->dev.of_node) {
 		match = of_match_device(c_can_of_table, &pdev->dev);
@@ -271,11 +286,6 @@ static int c_can_plat_probe(struct platform_device *pdev)
 		priv->read_reg32 = d_can_plat_read_reg32;
 		priv->write_reg32 = d_can_plat_write_reg32;
 
-		if (pdev->dev.of_node)
-			priv->instance = of_alias_get_id(pdev->dev.of_node, "d_can");
-		else
-			priv->instance = pdev->id;
-
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 		/* Not all D_CAN modules have a separate register for the D_CAN
 		 * RAM initialization. Use default RAM init bit in D_CAN module
@@ -286,12 +296,54 @@ static int c_can_plat_probe(struct platform_device *pdev)
 			break;
 		}
 
-		priv->raminit_ctrlreg = devm_ioremap(&pdev->dev, res->start,
-						     resource_size(res));
-		if (!priv->raminit_ctrlreg || priv->instance < 0)
-			dev_info(&pdev->dev, "control memory is not used for raminit\n");
-		else
-			priv->raminit = c_can_hw_raminit_ti;
+		/* If separate RAMINIT register is specified access
+		 * it using syscon regmap. Mostly for TI platforms.
+		 */
+		ret = -EINVAL;
+		if (!np) {
+			dev_err(&pdev->dev,
+				"separate RAMINIT reg. not supported on non DT\n");
+			goto exit_free_device;
+		}
+
+		priv->raminit_sys.syscon = syscon_regmap_lookup_by_phandle(np,
+									   "raminit-syscon");
+		if (IS_ERR(priv->raminit_sys.syscon)) {
+			dev_err(&pdev->dev,
+				"couldn't get syscon regmap for RAMINIT reg.\n");
+			goto exit_free_device;
+		}
+
+		priv->raminit_sys.reg = res->start;
+		if (of_property_read_u32(np, "raminit-start-bit",
+					 &val)) {
+			dev_err(&pdev->dev,
+				"missing raminit-start-bit property\n");
+			goto exit_free_device;
+		}
+
+		if (val > 31) {
+			dev_err(&pdev->dev,
+				"invalid raminit-start-bit property\n");
+			goto exit_free_device;
+		}
+
+		priv->raminit_sys.start_bit = val;
+		if (of_property_read_u32(np, "raminit-done-bit",
+					 &val)) {
+			dev_err(&pdev->dev,
+				"missing raminit-done-bit property\n");
+			goto exit_free_device;
+		}
+
+		if (val > 31) {
+			dev_err(&pdev->dev,
+				"invalid raminit-done-bit property\n");
+			goto exit_free_device;
+		}
+
+		priv->raminit_sys.done_bit = val;
+		priv->raminit = c_can_hw_raminit_syscon;
 		break;
 	default:
 		ret = -EINVAL;
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH 01/13] can: c_can_platform: Fix c_can_hw_raminit_ti() and add timeout
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

Pass the correct 'mask' and 'value' bits to c_can_hw_raminit_wait_ti().
They seem to have been swapped in the usage instances.

TI's RAMINIT DONE mechanism is buggy and may not always be
set after the START bit is set. So add a timeout mechanism to
c_can_hw_raminit_wait_ti().

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/net/can/c_can/c_can_platform.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index 109cb44..b144e71 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -75,10 +75,18 @@ static void c_can_plat_write_reg_aligned_to_32bit(const struct c_can_priv *priv,
 static void c_can_hw_raminit_wait_ti(const struct c_can_priv *priv, u32 mask,
 				  u32 val)
 {
+	int timeout = 0;
 	/* We look only at the bits of our instance. */
 	val &= mask;
-	while ((readl(priv->raminit_ctrlreg) & mask) != val)
+	while ((readl(priv->raminit_ctrlreg) & mask) != val) {
 		udelay(1);
+		timeout++;
+
+		if (timeout == 1000) {
+			dev_err(&priv->dev->dev, "%s: time out\n", __func__);
+			break;
+		}
+	}
 }
 
 static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)
@@ -97,14 +105,14 @@ static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)
 	ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
 	writel(ctrl, priv->raminit_ctrlreg);
 	ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance);
-	c_can_hw_raminit_wait_ti(priv, ctrl, mask);
+	c_can_hw_raminit_wait_ti(priv, mask, ctrl);
 
 	if (enable) {
 		/* Set start bit and wait for the done bit. */
 		ctrl |= CAN_RAMINIT_START_MASK(priv->instance);
 		writel(ctrl, priv->raminit_ctrlreg);
 		ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
-		c_can_hw_raminit_wait_ti(priv, ctrl, mask);
+		c_can_hw_raminit_wait_ti(priv, mask, ctrl);
 	}
 	spin_unlock(&raminit_lock);
 }
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH 00/13] net: can: Add can support for TI platforms
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros

Hi,

Some hardware (TI am43xx) has a buggy RAMINIT DONE mechanism and it might
not always set the DONE bit. This will result in a lockup in c_can_hw_raminit_wait_ti(),
so patch 1 adds a timeout mechanism there.

There is a non compliancy within TI platforms with respect to the
layout of the RAMINIT register. The patches 2 and 3 address this issue
and make a flexible but standard way of defining the RAMINIT hardware register
layout in the device tree. The RAMINIT register is accessed using the syscon
regmap framework.

The patches 4 to 13 add adaptation details for am43xx and dra7x Socs and
EVMs.

cheers,
-roger

---

Afzal Mohammed (1):
  arm: dts: am4372: Add dcan nodes

Dave Gerlach (1):
  ARM: dts: am437x-gp-evm: Add pinctrl sleep states for dcan pins

Mugunthan V N (1):
  arm: dts: am437x-gp: Add dcan support

Roger Quadros (10):
  can: c_can_platform: Fix c_can_hw_raminit_ti() and add timeout
  net: can: c_can: Add syscon/regmap RAMINIT mechanism
  net: can: c_can: Add support for START pulse in RAMINIT sequence
  ARM: dts: dra7: Add syscon regmap for CORE CONTROL area
  ARM: dts: DRA7: Add DCAN nodes
  ARM: dts: dra7-evm: Add CAN support
  ARM: dts: dra72-evm: Add CAN support
  ARM: dts: AM43xx: Add aliases to d_can nodes
  ARM: dts: am4372: Add control module syscon node
  ARM: dts: am4372: Add dcan raminit bits

 .../devicetree/bindings/net/can/c_can.txt          |  10 ++
 arch/arm/boot/dts/am4372.dtsi                      |  35 ++++++
 arch/arm/boot/dts/am437x-gp-evm.dts                |  42 ++++++++
 arch/arm/boot/dts/dra7-evm.dts                     |  21 ++++
 arch/arm/boot/dts/dra7.dtsi                        |  35 ++++++
 arch/arm/boot/dts/dra72-evm.dts                    |  23 ++++
 drivers/net/can/c_can/c_can.h                      |  12 ++-
 drivers/net/can/c_can/c_can_platform.c             | 120 ++++++++++++++++-----
 8 files changed, 270 insertions(+), 28 deletions(-)

-- 
1.8.3.2

^ permalink raw reply

* [PATCH 13/13] ARM: dts: am4372: Add dcan raminit bits
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

Add RAMINIT specific bits into the DCAN nodes.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/am4372.dtsi | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index d38a0ed..33d27cd 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -899,7 +899,10 @@
 			clocks = <&dcan0_fck>;
 			clock-names = "fck";
 			reg = <0x481cc000 0x2000
-				0x44e10644 0x4>;
+				0x644 0x4>; /* index to RAMINIT reg within syscon */
+			raminit-syscon = <&am43xx_control_module>;
+			raminit-start-bit = <0>;
+			raminit-done-bit = <8>;
 			interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
 		};
@@ -910,7 +913,10 @@
 			clocks = <&dcan1_fck>;
 			clock-names = "fck";
 			reg = <0x481d0000 0x2000
-				0x44e10644 0x4>;
+				0x644 0x4>; /* index to RAMINIT reg within syscon */
+			raminit-syscon = <&am43xx_control_module>;
+			raminit-start-bit = <1>;
+			raminit-done-bit = <9>;
 			interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
 		};
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 12/13] ARM: dts: am4372: Add control module syscon node
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

Use syscon regmap to expose the Control module register space.
This register space is shared between many users e.g. DCAN, USB, display, etc.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/am4372.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index a705e50..d38a0ed 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -59,6 +59,11 @@
 		cache-level = <2>;
 	};
 
+	am43xx_control_module: control_module@4a002000 {
+		compatible = "syscon";
+		reg = <0x44e10000 0x7f4>;
+	};
+
 	am43xx_pinmux: pinmux@44e10800 {
 		compatible = "pinctrl-single";
 		reg = <0x44e10800 0x31c>;
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 10/13] arm: dts: am437x-gp: Add dcan support
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

From: Mugunthan V N <mugunthanvnm@ti.com>

Add DCAN support for AM437x GP EVM with both DCAN instances.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 arch/arm/boot/dts/am437x-gp-evm.dts | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
index e7ac47f..6d03baa 100644
--- a/arch/arm/boot/dts/am437x-gp-evm.dts
+++ b/arch/arm/boot/dts/am437x-gp-evm.dts
@@ -254,6 +254,20 @@
 			0x238 (PIN_OUTPUT_PULLUP | MUX_MODE7)
 		>;
 	};
+
+	dcan0_default: dcan0_default_pins {
+		pinctrl-single,pins = <
+			0x178 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* uart1_ctsn.d_can0_tx */
+			0x17c (PIN_INPUT_PULLUP | MUX_MODE2) /* uart1_rtsn.d_can0_rx */
+		>;
+	};
+
+	dcan1_default: dcan1_default_pins {
+		pinctrl-single,pins = <
+			0x180 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* uart1_rxd.d_can1_tx */
+			0x184 (PIN_INPUT_PULLUP | MUX_MODE2) /* uart1_txd.d_can1_rx */
+		>;
+	};
 };
 
 &i2c0 {
@@ -511,3 +525,15 @@
 		};
 	};
 };
+
+&dcan0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&dcan0_default>;
+	status = "okay";
+};
+
+&dcan1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&dcan1_default>;
+	status = "okay";
+};
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 06/13] ARM: dts: dra7-evm: Add CAN support
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

The board has 2 CAN ports but only the first one can be used.
Enable the first CAN port.

The second one cannot be used without hardware modification
so we don't enable the second port.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/boot/dts/dra7-evm.dts | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
index e03fbf3..d6b9b27 100644
--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -171,6 +171,20 @@
 			0xd0	(PIN_OUTPUT | MUX_MODE0)	/* gpmc_be0n_cle */
 		>;
 	};
+
+	dcan1_pins_default: dcan1_pins_default {
+		pinctrl-single,pins = <
+			0x3d4	(PIN_INPUT | MUX_MODE0)		/* dcan1_tx */
+			0x3d8	(PIN_INPUT | MUX_MODE0)		/* dcan1_rx */
+		>;
+	};
+
+	dcan1_pins_sleep: dcan1_pins_sleep {
+		pinctrl-single,pins = <
+			0x3d4	(PIN_INPUT | MUX_MODE15)	/* dcan1_tx */
+			0x3d8	(PIN_INPUT | MUX_MODE15)	/* dcan1_rx */
+		>;
+	};
 };
 
 &i2c1 {
@@ -529,3 +543,10 @@
 	ti,no-reset-on-init;
 	ti,no-idle-on-init;
 };
+
+&dcan1 {
+	status = "ok";
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&dcan1_pins_default>;
+	pinctrl-1 = <&dcan1_pins_sleep>;
+};
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 05/13] ARM: dts: DRA7: Add DCAN nodes
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

The SoC supports 2 DCAN nodes. Add them.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 370009e..4ce1a4f 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -34,6 +34,8 @@
 		serial3 = &uart4;
 		serial4 = &uart5;
 		serial5 = &uart6;
+		d_can0 = &dcan1;
+		d_can1 = &dcan2;
 	};
 
 	timer {
@@ -1267,6 +1269,34 @@
 			ti,irqs-skip = <10 133 139 140>;
 			ti,irqs-safe-map = <0>;
 		};
+
+		dcan1: d_can@481cc000 {
+			compatible = "bosch,d_can";
+			ti,hwmods = "dcan1";
+			reg = <0x4ae3c000 0x2000>,
+			      <0x558 0x4>; /* index to RAMINIT reg within syscon */
+			raminit-syscon = <&dra7_ctrl_core>;
+			raminit-start-bit = <3>;
+			raminit-done-bit = <1>;
+			raminit-pulse;
+			interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&dcan1_sys_clk_mux>;
+			status = "disabled";
+		};
+
+		dcan2: d_can@481d0000 {
+			compatible = "bosch,d_can";
+			ti,hwmods = "dcan2";
+			reg = <0x48480000 0x2000>,
+			      <0x558 0x4>; /* index to RAMINIT reg within syscon */
+			raminit-syscon = <&dra7_ctrl_core>;
+			raminit-start-bit = <5>;
+			raminit-done-bit = <2>;
+			raminit-pulse;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&sys_clkin1>;
+			status = "disabled";
+		};
 	};
 };
 
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 03/13] net: can: c_can: Add support for START pulse in RAMINIT sequence
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
  To: wg, mkl, tony
  Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
	balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>

Some SoCs e.g. (TI DRA7xx) need a START pulse to start the
RAMINIT sequence i.e. START bit must be set and cleared before
checking for the DONE bit status. Add a new DT property "raminit-pulse"
to specify if this mechanism must be used for RAMINIT.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 Documentation/devicetree/bindings/net/can/c_can.txt | 3 +++
 drivers/net/can/c_can/c_can.h                       | 1 +
 drivers/net/can/c_can/c_can_platform.c              | 8 ++++++++
 3 files changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/can/c_can.txt b/Documentation/devicetree/bindings/net/can/c_can.txt
index 0856209..2f0a6bb 100644
--- a/Documentation/devicetree/bindings/net/can/c_can.txt
+++ b/Documentation/devicetree/bindings/net/can/c_can.txt
@@ -19,6 +19,9 @@ Optional properties:
 			  register within the syscon region
 - raminit-start-bit	: Bit posistion of START bit in the RAMINIT register
 - raminit-done-bit	: Bit position of DONE bit in the RAMINIT register
+- raminit-pulse		: Property must exist if START pulse is needed for RAMINIT
+			  sequence i.e. START bit will be set and cleared before
+			  checking for DONE bit.
 
 Note: "ti,hwmods" field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
index bf68822..85b5ad0 100644
--- a/drivers/net/can/c_can/c_can.h
+++ b/drivers/net/can/c_can/c_can.h
@@ -175,6 +175,7 @@ struct c_can_raminit {
 	unsigned int reg;	/* register index within syscon */
 	u8 start_bit;	/* START bit position in raminit reg. */
 	u8 done_bit;	/* DONE bit position in raminit reg. */
+	bool needs_pulse;	/* If set, sets and clears START bit (pulse) */
 };
 
 /* c_can private data structure */
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index e7ec3b6..bc09695 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -123,6 +123,12 @@ static void c_can_hw_raminit_syscon(const struct c_can_priv *priv, bool enable)
 		ctrl |= 1 << raminit->start_bit;
 		regmap_write(raminit->syscon, raminit->reg, ctrl);
 
+		/* clear START bit if start pulse is needed */
+		if (raminit->needs_pulse) {
+			ctrl &= ~(1 << raminit->start_bit);
+			regmap_write(raminit->syscon, raminit->reg, ctrl);
+		}
+
 		ctrl |= 1 << raminit->done_bit;
 		c_can_hw_raminit_wait_syscon(priv, mask, ctrl);
 	}
@@ -343,6 +349,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
 		}
 
 		priv->raminit_sys.done_bit = val;
+		priv->raminit_sys.needs_pulse = of_property_read_bool(np,
+								      "raminit-pulse");
 		priv->raminit = c_can_hw_raminit_syscon;
 		break;
 	default:
-- 
1.8.3.2


^ permalink raw reply related

* Re: [PATCH net-next] netfilter: create audit records for ebtables replaces
From: Richard Guy Briggs @ 2014-09-08 14:02 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: pablo, kaber, kadlec, stephen, davem, netfilter-devel, bridge,
	netdev, linux-audit
In-Reply-To: <1409907015-6145-1-git-send-email-nicolas.dichtel@6wind.com>

On 14/09/05, Nicolas Dichtel wrote:
> This is already done for x_tables (family AF_INET and AF_INET6), let's do it
> for AF_BRIDGE also.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

ACK.

> ---
>  net/bridge/netfilter/ebtables.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
> index 6d69631b9f4d..4ba0c5c78778 100644
> --- a/net/bridge/netfilter/ebtables.c
> +++ b/net/bridge/netfilter/ebtables.c
> @@ -26,6 +26,7 @@
>  #include <asm/uaccess.h>
>  #include <linux/smp.h>
>  #include <linux/cpumask.h>
> +#include <linux/audit.h>
>  #include <net/sock.h>
>  /* needed for logical [in,out]-dev filtering */
>  #include "../br_private.h"
> @@ -1126,6 +1127,20 @@ static int do_replace(struct net *net, const void __user *user,
>  	}
>  
>  	ret = do_replace_finish(net, &tmp, newinfo);
> +#ifdef CONFIG_AUDIT
> +	if (audit_enabled) {
> +		struct audit_buffer *ab;
> +
> +		ab = audit_log_start(current->audit_context, GFP_KERNEL,
> +				     AUDIT_NETFILTER_CFG);
> +		if (ab) {
> +			audit_log_format(ab, "table=%s family=%u entries=%u",
> +					 tmp.name, AF_BRIDGE,
> +					 tmp.nentries);
> +			audit_log_end(ab);
> +		}
> +	}
> +#endif
>  	if (ret == 0)
>  		return ret;
>  free_entries:
> -- 
> 1.9.0
> 
> --
> Linux-audit mailing list
> Linux-audit@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-audit

- RGB

--
Richard Guy Briggs <rbriggs@redhat.com>
Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat
Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545

^ permalink raw reply

* Re: [PATCH net-next v2 2/2] Re-check for a VIO_DESC_READY data descriptor after short udelay()
From: Sowmini Varadhan @ 2014-09-08 14:03 UTC (permalink / raw)
  To: David L Stevens; +Cc: David Miller, netdev, raghuram.kothakota
In-Reply-To: <540DB314.3090809@oracle.com>

On (09/08/14 09:45), David L Stevens wrote:

First off, please don't drop email ids from the original email. 
I've re-added Raghuram Kothakota to fix that initial omission.

Second, this thread originally came up with your suggestion that
we shold move the wmb() down one line. I looked at this, and consulted
a few folks, all of whom agree that that is probably incorrect. 

As Bob Picco pointed out to me:
" Placing the wmb() after probably won't have any negative consequences
  BUT could. Suppose the compiler reorders the stores and the d->hdr.state
  store occurs before another part of the descriptor. We HV trap,
  and the trap doesn't flush the store buffer. The consumer could then
  see VIO_DESC_READY before the cookies arrray is updated. It would depend
  on how many cache lines are spanned by vio_net_desc and the store buffer
  organization."
thus I would be cautious about doing that.

> I'm no mb expert, and I know of no symptoms, but it appears to be saying that
> load reordering could result in a race where the READY flag could be set with
> old data in other descriptor fields due to loading them in a different order --
> something it says wmb() on another CPU explicitly does not prevent.

Please see the explanation that I, and Raghuram offered.
The wmb() assures that the stores of the cookie state are
ordered correctly by the consumer. The next store is for VIO_DESC_READY
and the consumer will not proceed to read cookie state until this
is visible. Thus no rmb() is needed. 

On its side, the consumer resets the hdr.state to DONE after it
consumes the cookies, and the DRING_STOPPLED announcement further
informs the producer that the descriptor is available. 

Hope that helps. If you think there is some sequence where this
is insufficient, please explain with details.

>
> The particular case would be adding to the ring at the same time the
> other side
> is removing from the ring, so no locks or LDC traffic would affect it.
> 
> So, it appears to me we have a missing rmb() that is needed and I
> don't know what
> leads you to believe it isn't.
> 
> 							+-DLS

^ permalink raw reply

* Re: [patch net-next 00/13] introduce rocker switch driver with openvswitch hardware accelerated datapath
From: Thomas Graf @ 2014-09-08 13:54 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, nhorman, andy, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, jhs, sfeldma, f.fainelli, roopa,
	linville, dev, jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a,
	buytenh, aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye
In-Reply-To: <1409736300-12303-1-git-send-email-jiri@resnulli.us>

On 09/03/14 at 11:24am, Jiri Pirko wrote:
> This patchset can be divided into 3 main sections:
> - introduce switchdev api for implementing switch drivers
> - add hardware acceleration bits into openvswitch datapath, This uses
>   previously mentioned switchdev api
> - introduce rocker switch driver which implements switchdev api

Jiri, Scott,

Enclosed is the GOOG doc which outlines some details on my particular
interests [0]. It includes several diagrams which might help to
understand the overall arch. It is highly related to John's work as
well. Please let me know if something does not align with the model
you have in mind.

Summary:
The full virtual tunnel endpoint flow offload attempts to offload full
flows to the hardware and utilize the embedded switch on the host NIC
to empower the eSwitch with the required flexibility of the software
driven network. In this model, the guest (VM or LXC) attaches through a
SR-IOV VF which serves as the primary path. A slow path / software path
is provided via the CPU which can route packets back into the VF by
tagging packets with forwarding metadata and sending the frame back to
the NIC.

[0] https://docs.google.com/document/d/195waUliu7G5YYVuXHmLmHgJ38DFSte321WPq0oaFhyU/edit?usp=sharing
(Publicly accessible and open for comments)

^ permalink raw reply

* Re: [PATCH net-next v2 2/2] Re-check for a VIO_DESC_READY data descriptor after short udelay()
From: David L Stevens @ 2014-09-08 13:45 UTC (permalink / raw)
  To: Sowmini Varadhan, David Miller; +Cc: netdev
In-Reply-To: <20140906210253.GA5710@oracle.com>

Sowmini,

On 09/06/2014 05:02 PM, Sowmini Varadhan wrote:

> Stared at this a bit over the last two days, checked
> the documentation, discussed with dls offline - looks like 
> (a) the rmb() thing was mostly a red-herring/fud 
> (b) we do need the wmb()

	I don't think this has anything to do with your patch, but my (new) concern with the
wmb() and no matching rmb() is this text from Documentation/memory-barrier.txt:

> SMP BARRIER PAIRING
> -------------------
> 
> When dealing with CPU-CPU interactions, certain types of memory barrier should
> always be paired.  A lack of appropriate pairing is almost certainly an error.

I'm no mb expert, and I know of no symptoms, but it appears to be saying that
load reordering could result in a race where the READY flag could be set with
old data in other descriptor fields due to loading them in a different order --
something it says wmb() on another CPU explicitly does not prevent.

The particular case would be adding to the ring at the same time the other side
is removing from the ring, so no locks or LDC traffic would affect it.

So, it appears to me we have a missing rmb() that is needed and I don't know what
leads you to believe it isn't.

							+-DLS

^ permalink raw reply

* RE: [PATCH V2 net] core: Don't attempt to load the "" driver.
From: David Laight @ 2014-09-08 13:23 UTC (permalink / raw)
  To: 'David Miller'; +Cc: netdev@vger.kernel.org
In-Reply-To: <20140905.143241.114624370748725493.davem@davemloft.net>

From: David Miller
> From: David Laight <David.Laight@ACULAB.COM>
> Date: Wed, 3 Sep 2014 08:55:21 +0000
> 
> > Requests like 'ifconfig ""' cause dev_load(net, "") be called, since
> > request_module("") return 0 (success) this generates the error message:
> > "Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and
> alias netdev- instead."
> >
> > Since dev_load() doesn't have to work, just ignore such names.
> >
> > Signed-off-by: David Laight <david.laight@aculab.com>
> > ---
> >
> > V2: Added sign off.
> >
> > If you search for the above error message, you'll find a lot of complaints.
> > While the applications shouldn't be calling an SIOCxxx ioctl with ifr_name[0] == 0
> > the kernel shouldn't be tracing the error either.
> >
> > Due to the complaints from users, this might be a backport candidate.
> 
> I have to say that I don't like this.
> 
> Why is request_module("") signalled with success unconditionally?
> A module didn't get loaded, so semantically this behavior makes
> no sense at all.
> 
> I would rather than simply request_module() signal an error in this
> case, and then _NOBODY_ has to have all of this duplicated logic to
> check for name[0]=='\0' throughout all of the call chains leading to
> request_module().

Maybe, but the SIOCxxx ioctl code is only doing a speculative module load.
Possibly it should error out the ioctl request earlier if ifr_name is "",
but maybe it is sometimes valid?

In this case you also want to stop the attempt to load "netdev-".
Hmmm... that really sucks...
This whole 'try to load the module' path should be predicated on
'interface not found'.
I presume that the locking rules prohibit the module load attempt
at that time.
Maybe the ioctl code should do a retry if it gets the 'interface not found'
error - instead of assuming that the module needs loading.

At the moment I think that if you run 'ifconfig eth0' it will try to
load "netdev-eth0" and "eth0" (maybe without the unit suffix) before
attempting to do anything else.

I didn't do any 'software archaeology' on the SIOCxxx ioctl code.

	David

^ permalink raw reply

* Re: [PATCH net-next v2] r8169:add support for RTL8168H and RTL8107E
From: Ivan Vecera @ 2014-09-08 13:00 UTC (permalink / raw)
  To: Chun-Hao Lin, netdev; +Cc: nic_swsd, linux-kernel, romieu
In-Reply-To: <1408470844-30038-1-git-send-email-hau@realtek.com>

On 19.8.2014 19:54, Chun-Hao Lin wrote:
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 91652e7..c8375f6 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -52,6 +52,10 @@
>   #define FIRMWARE_8106E_2	"rtl_nic/rtl8106e-2.fw"
>   #define FIRMWARE_8168G_2	"rtl_nic/rtl8168g-2.fw"
>   #define FIRMWARE_8168G_3	"rtl_nic/rtl8168g-3.fw"
> +#define FIRMWARE_8168H_1	"rtl_nic/rtl8168h-1.fw"
> +#define FIRMWARE_8168H_2	"rtl_nic/rtl8168h-2.fw"
> +#define FIRMWARE_8107E_1	"rtl_nic/rtl8107e-1.fw"
> +#define FIRMWARE_8107E_2	"rtl_nic/rtl8107e-2.fw"

Where are these new firmware files ^^^^ located? They are missing at 
git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

Ivan

^ permalink raw reply

* Re: [PATCH] btrfs: remove the wrong comments
From: Li RongQing @ 2014-09-08 12:40 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1410179466-25409-1-git-send-email-roy.qing.li@gmail.com>

sorry, please drop it, I send to wrong maillist.

^ permalink raw reply

* [PATCH] btrfs: remove the wrong comments
From: roy.qing.li @ 2014-09-08 12:31 UTC (permalink / raw)
  To: netdev

From: Li RongQing <roy.qing.li@gmail.com> 

This comments became wrong after c3c532[bdi: add helper function for
doing init and register of a bdi for a file system], so remove them.

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 fs/btrfs/disk-io.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index d0ed9e6..ce8b8b6 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1703,10 +1703,6 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
 	return ret;
 }
 
-/*
- * If this fails, caller must call bdi_destroy() to get rid of the
- * bdi again.
- */
 static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
 {
 	int err;
-- 
1.7.10.4

^ permalink raw reply related

* Re: [PATCH net] ipv6: refresh rt6i_genid in ip6_pol_route()
From: Nicolas Dichtel @ 2014-09-08 12:16 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, therbert, alexander.h.duyck, netdev
In-Reply-To: <1410172092.11872.85.camel@edumazet-glaptop2.roam.corp.google.com>

Le 08/09/2014 12:28, Eric Dumazet a écrit :
> On Mon, 2014-09-08 at 10:11 +0200, Nicolas Dichtel wrote:
>> Le 08/09/2014 07:07, Eric Dumazet a écrit :
>>> On Sun, 2014-09-07 at 21:59 -0700, David Miller wrote:
>>>> From: Eric Dumazet <eric.dumazet@gmail.com>
>>>> Date: Sun, 07 Sep 2014 21:43:54 -0700
>>>>
>>>>> On Sun, 2014-09-07 at 21:27 -0700, David Miller wrote:
>>>>>> From: Eric Dumazet <eric.dumazet@gmail.com>
>>>>>> Date: Sun, 07 Sep 2014 21:18:25 -0700
>>>>>>
>>>>>>> On Sun, 2014-09-07 at 15:54 -0700, David Miller wrote:
>>>>>>>
>>>>>>>> This might be broken.
>>>>>>>>
>>>>>>>> We are dealing here with persistent entries in the ipv6 routine trie.
>>>>>>>>
>>>>>>>> If you just bump the genid on the next person to look it up, other
>>>>>>>> sockets and cached entities might not have validated the route yet,
>>>>>>>> and now will falsely see the route as valid.  We have to ensure that
>>>>>>>> they too drop this route and perform a relookup.
>>>>>>>
>>>>>>> I am confused, I thought it was the role of the cookie.
>>>>>>>
>>>>>>> (Ie socket has to store its own cookie to be able to validate a route)
>>>>>>>
>>>>>>> Before 6f3118b571b8 patch, how was this done anyway ?
>>>>>>>
>>>>>>> If persistent routes cannot refresh the genid, then they are useless ?
>>>>>>
>>>>>> I just speak about the genid aspect.
>>>>>>
>>>>>> I understand that cookie (via node->fn_sernum) invalidates the path
>>>>>> in the fib_trie, but the genid protects against other circumstances
>>>>>> (matching IPSEC rule, f.e.)
>>>>>>
>>>>>> You have to make sure all other sockets did a full route lookup
>>>>>> (including IPSEC) before you can safely adjust the genid.
>>>>>>
>>>>>> I could be wrong, recheck my analysis please :-)
>>>>>
>>>>> So this whole genid protection can not work, unless we make sure a
>>>>> socket cannot share a route with another socket.
>>>>>
>>>>> This means we have to clone all routes.
>>>>
>>>> I'm willing to revert the change in question if you think that's the
>>>> sanest way forward.
>>>>
>>>> The bug fix for more obscure use cases (IPSEC) if pointless if it
>>>> breaks more common things (TCP input route caching).
>>>
>>> Lets wait for Nicolas and/or Hannes input, they might have some ideas...
>>
>> The initial problem was in SCTP. Here is the thread after the v1 patch:
>> http://patchwork.ozlabs.org/patch/182235/
>>
>> Before the patch, SCTP stored the IPv6 route in its cache and if an IPsec
>> rules was inserted after that operation, SCTP never invalidated the cached
>> route to use a new xfrm route.
>
> This thread mentions output route.
Yes, it was the target.

>
> The problem I currently have with IPv6 early demux is for input routes.
It's clearly a regression.

^ permalink raw reply

* [PATCH net-next] netfilter: create audit records for ebtables replaces
From: Nicolas Dichtel @ 2014-09-08 12:11 UTC (permalink / raw)
  To: pablo, kaber, kadlec, stephen, davem, netfilter-devel, bridge,
	netdev, linux-audit
  Cc: nicolas.dichtel
In-Reply-To: <20140907160728.GA4589@salvia>

This is already done for x_tables (family AF_INET and AF_INET6), let's do it
for AF_BRIDGE also.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---

v2: move audit chunks to do_replace_finish()

 net/bridge/netfilter/ebtables.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 6d69631b9f4d..d9a8c05d995d 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -26,6 +26,7 @@
 #include <asm/uaccess.h>
 #include <linux/smp.h>
 #include <linux/cpumask.h>
+#include <linux/audit.h>
 #include <net/sock.h>
 /* needed for logical [in,out]-dev filtering */
 #include "../br_private.h"
@@ -1058,6 +1059,20 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
 	vfree(table);
 
 	vfree(counterstmp);
+
+#ifdef CONFIG_AUDIT
+	if (audit_enabled) {
+		struct audit_buffer *ab;
+
+		ab = audit_log_start(current->audit_context, GFP_KERNEL,
+				     AUDIT_NETFILTER_CFG);
+		if (ab) {
+			audit_log_format(ab, "table=%s family=%u entries=%u",
+					 repl->name, AF_BRIDGE, repl->nentries);
+			audit_log_end(ab);
+		}
+	}
+#endif
 	return ret;
 
 free_unlock:
-- 
1.9.0

^ permalink raw reply related

* Re: [PATCH net-next 3/5] sit: Add gro callbacks to sit offload
From: Eric Dumazet @ 2014-09-08 11:55 UTC (permalink / raw)
  To: Tom Herbert; +Cc: davem, netdev
In-Reply-To: <1410153989-23837-4-git-send-email-therbert@google.com>

On Sun, 2014-09-07 at 22:26 -0700, Tom Herbert wrote:
> Add ip6_gro_receive and inet_gro_complete to ip6_offload to
> support GRO.
> 
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
>  net/ipv6/ip6_offload.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
> index 5bcda33..12a686f 100644
> --- a/net/ipv6/ip6_offload.c
> +++ b/net/ipv6/ip6_offload.c
> @@ -314,6 +314,8 @@ static const struct net_offload sit_offload = {
>  	.callbacks = {
>  		.gso_send_check = ipv6_gso_send_check,
>  		.gso_segment	= ipv6_gso_segment,
> +		.gro_receive	= ipv6_gro_receive,
> +		.gro_complete	= ipv6_gro_complete,
>  	},
>  };
>  

changelog has typos : It should be :

Add ip6_gro_receive and ip6_gro_complete to sit_offload to
support GRO.

^ permalink raw reply

* Re: [PATCH][net-next] openvswitch: change the data type of error status to atomic_long_t
From: Li RongQing @ 2014-09-08 11:23 UTC (permalink / raw)
  To: David Miller; +Cc: Pravin Shelar, netdev
In-Reply-To: <20140907.161720.168413856991894569.davem@davemloft.net>

On Mon, Sep 8, 2014 at 7:17 AM, David Miller <davem@davemloft.net> wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> Date: Sun, 7 Sep 2014 17:24:11 +0800
>
>> 2.  I did not find that tx_dropped/tx_error/.. is protected by spin
>> lock under net dir,
>> sometime tx_dropped is atomic_long_t; sometime it is percpu variable;
>> sometime it is
>> u64,but does not need to protect.
>
> If it is only modified in ->ndo_start_xmit() then it is protected by
> the per-queue TX lock, as ->ndo_start_xmit() is always invoked with
> it held (except in LLTX drivers of course).


But reading tx_dropped is in process context, and maybe break by interrupt or
soft interrupt,  and no lock protect, or not the same lock protect.

-Roy

^ permalink raw reply

* Re: [PATCH net] net: fix skb_page_frag_refill() kerneldoc
From: Eric Dumazet @ 2014-09-08 11:22 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: David Miller, netdev
In-Reply-To: <540D8D3C.9080202@cogentembedded.com>

On Mon, 2014-09-08 at 15:04 +0400, Sergei Shtylyov wrote:
> Hello.
> 
> On 9/8/2014 3:00 PM, Eric Dumazet wrote:
> 
> > From: Eric Dumazet <edumazet@google.com>
> 
> > In commit d9b2938aabf7 ("net: attempt a single high order allocation)
> > I forgot to update kerneldoc, as @prio parameter was renamed to @gfp
> 
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > ---
> >   net/core/sock.c |    2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> > diff --git a/net/core/sock.c b/net/core/sock.c
> > index d372b4bd3f99..9c3f823e76a9 100644
> > --- a/net/core/sock.c
> > +++ b/net/core/sock.c
> > @@ -1866,7 +1866,7 @@ EXPORT_SYMBOL(sock_alloc_send_skb);
> >    * skb_page_frag_refill - check that a page_frag contains enough room
> >    * @sz: minimum size of the fragment we want to get
> >    * @pfrag: pointer to page_frag
> > - * @prio: priority for memory allocation
> > + * @gfp: priority for memory allocation
> 
>     'gfp' is not priority, it's just flags.

This is the usual wording for this in net/core

I changed the name of the argument, not its meaning.

$ scripts/kernel-doc net/core/sock.c >/dev/null
Warning(net/core/sock.c:1874): No description found for parameter 'gfp'
Warning(net/core/sock.c:1874): Excess function parameter 'prio'
description in 'skb_page_frag_refill'

Feel free to submit a net-next patch to change net/core occurrences.

Thanks

^ permalink raw reply

* Re: [PATCH net] net: fix skb_page_frag_refill() kerneldoc
From: Sergei Shtylyov @ 2014-09-08 11:04 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: netdev
In-Reply-To: <1410174000.11872.94.camel@edumazet-glaptop2.roam.corp.google.com>

Hello.

On 9/8/2014 3:00 PM, Eric Dumazet wrote:

> From: Eric Dumazet <edumazet@google.com>

> In commit d9b2938aabf7 ("net: attempt a single high order allocation)
> I forgot to update kerneldoc, as @prio parameter was renamed to @gfp

> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>   net/core/sock.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/net/core/sock.c b/net/core/sock.c
> index d372b4bd3f99..9c3f823e76a9 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -1866,7 +1866,7 @@ EXPORT_SYMBOL(sock_alloc_send_skb);
>    * skb_page_frag_refill - check that a page_frag contains enough room
>    * @sz: minimum size of the fragment we want to get
>    * @pfrag: pointer to page_frag
> - * @prio: priority for memory allocation
> + * @gfp: priority for memory allocation

    'gfp' is not priority, it's just flags.

WBR, Sergei

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox