linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes
@ 2015-11-26 18:08 Marcin Wojtas
  2015-11-26 18:08 ` [PATCH v2 net 1/6] net: mvneta: add configuration for MBUS windows access protection Marcin Wojtas
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-26 18:08 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev
  Cc: davem, linux, sebastian.hesselbarth, andrew, jason,
	thomas.petazzoni, gregory.clement, simon.guinot, nadavh, alior,
	xswang, myair, nitroshift, mw, jaz, tn

Hi,

According to David's remark I split the original patchset into two. First
one, which I submit is a list of fixes, all stable-CC'ed.

On the occasion two new bugs were fixed - wrong define in one of registers
and, more important, an error path in mvneta_rx() after failing of skb
build.

I'm looking forward to the comments or remarks.

Best regards,
Marcin Wojtas

Changes from v1:
* update MBUS windows access protection register once, after whole loop
* add fixing value of MVNETA_RXQ_INTR_ENABLE_ALL_MASK
* add fixing error path for skb_build()
* add possibility of setting custom TX IP checksum limit in DT property

Marcin Wojtas (6):
  net: mvneta: add configuration for MBUS windows access protection
  net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG
  net: mvneta: fix bit assignment for RX packet irq enable
  net: mvneta: fix error path for building skb
  net: mvneta: enable setting custom TX IP checksum limit
  net: mvneta: enable IP checksum with jumbo frames for Armada 38x on
    Port0

 .../bindings/net/marvell-armada-370-neta.txt       |  6 ++++
 arch/arm/boot/dts/armada-38x.dtsi                  |  1 +
 drivers/net/ethernet/marvell/mvneta.c              | 34 ++++++++++++++++++----
 3 files changed, 35 insertions(+), 6 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 net 1/6] net: mvneta: add configuration for MBUS windows access protection
  2015-11-26 18:08 [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas
@ 2015-11-26 18:08 ` Marcin Wojtas
  2015-11-26 18:25   ` Thomas Petazzoni
  2015-11-26 18:08 ` [PATCH v2 net 2/6] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG Marcin Wojtas
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-26 18:08 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev
  Cc: davem, linux, sebastian.hesselbarth, andrew, jason,
	thomas.petazzoni, gregory.clement, simon.guinot, nadavh, alior,
	xswang, myair, nitroshift, mw, jaz, tn, stable

This commit adds missing configuration of MBUS windows access protection
in mvneta_conf_mbus_windows function - a dedicated variable for that
purpose remained there unused since v3.8 initial mvneta support. Because
of that the register contents were inherited from the bootloader.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: <stable@vger.kernel.org> # v3.8+
Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network
unit")
---
 drivers/net/ethernet/marvell/mvneta.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index e84c7f2..c4327b9 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -62,6 +62,7 @@
 #define MVNETA_WIN_SIZE(w)                      (0x2204 + ((w) << 3))
 #define MVNETA_WIN_REMAP(w)                     (0x2280 + ((w) << 2))
 #define MVNETA_BASE_ADDR_ENABLE                 0x2290
+#define MVNETA_ACCESS_PROTECT_ENABLE		0x2294
 #define MVNETA_PORT_CONFIG                      0x2400
 #define      MVNETA_UNI_PROMISC_MODE            BIT(0)
 #define      MVNETA_DEF_RXQ(q)                  ((q) << 1)
@@ -3188,9 +3189,11 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
 
 		win_enable &= ~(1 << i);
 		win_protect |= 3 << (2 * i);
+
 	}
 
 	mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, win_enable);
+	mvreg_write(pp, MVNETA_ACCESS_PROTECT_ENABLE, win_protect);
 }
 
 /* Power up the port */
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 net 2/6] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG
  2015-11-26 18:08 [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas
  2015-11-26 18:08 ` [PATCH v2 net 1/6] net: mvneta: add configuration for MBUS windows access protection Marcin Wojtas
@ 2015-11-26 18:08 ` Marcin Wojtas
  2015-11-26 18:27   ` Thomas Petazzoni
  2015-11-26 18:08 ` [PATCH v2 net 3/6] net: mvneta: fix bit assignment for RX packet irq enable Marcin Wojtas
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-26 18:08 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev
  Cc: davem, linux, sebastian.hesselbarth, andrew, jason,
	thomas.petazzoni, gregory.clement, simon.guinot, nadavh, alior,
	xswang, myair, nitroshift, mw, jaz, tn, stable

MVNETA_RXQ_HW_BUF_ALLOC bit which controls enabling hardware buffer
allocation was mistakenly set as BIT(1). This commit fixes the assignment.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: <stable@vger.kernel.org> # v3.8+
Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network
unit")
---
 drivers/net/ethernet/marvell/mvneta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index c4327b9..d78edbb 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -36,7 +36,7 @@
 
 /* Registers */
 #define MVNETA_RXQ_CONFIG_REG(q)                (0x1400 + ((q) << 2))
-#define      MVNETA_RXQ_HW_BUF_ALLOC            BIT(1)
+#define      MVNETA_RXQ_HW_BUF_ALLOC            BIT(0)
 #define      MVNETA_RXQ_PKT_OFFSET_ALL_MASK     (0xf    << 8)
 #define      MVNETA_RXQ_PKT_OFFSET_MASK(offs)   ((offs) << 8)
 #define MVNETA_RXQ_THRESHOLD_REG(q)             (0x14c0 + ((q) << 2))
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 net 3/6] net: mvneta: fix bit assignment for RX packet irq enable
  2015-11-26 18:08 [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas
  2015-11-26 18:08 ` [PATCH v2 net 1/6] net: mvneta: add configuration for MBUS windows access protection Marcin Wojtas
  2015-11-26 18:08 ` [PATCH v2 net 2/6] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG Marcin Wojtas
@ 2015-11-26 18:08 ` Marcin Wojtas
  2015-11-26 18:08 ` [PATCH v2 net 4/6] net: mvneta: fix error path for building skb Marcin Wojtas
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-26 18:08 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev
  Cc: davem, linux, sebastian.hesselbarth, andrew, jason,
	thomas.petazzoni, gregory.clement, simon.guinot, nadavh, alior,
	xswang, myair, nitroshift, mw, jaz, tn, stable

A value originally defined in the driver was inappropriate. Even though
the ingress was somehow working, writing MVNETA_RXQ_INTR_ENABLE_ALL_MASK
to MVNETA_INTR_ENABLE didn't make any effect, because the bits [31:16]
are reserved and read-only.

This commit updates MVNETA_RXQ_INTR_ENABLE_ALL_MASK to be compliant with
the controller's documentation.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Cc: <stable@vger.kernel.org> # v3.8+
Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network
unit")
---
 drivers/net/ethernet/marvell/mvneta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index d78edbb..0c3d923 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -160,7 +160,7 @@
 
 #define MVNETA_INTR_ENABLE                       0x25b8
 #define      MVNETA_TXQ_INTR_ENABLE_ALL_MASK     0x0000ff00
-#define      MVNETA_RXQ_INTR_ENABLE_ALL_MASK     0xff000000  // note: neta says it's 0x000000FF
+#define      MVNETA_RXQ_INTR_ENABLE_ALL_MASK     0x000000ff
 
 #define MVNETA_RXQ_CMD                           0x2680
 #define      MVNETA_RXQ_DISABLE_SHIFT            8
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 net 4/6] net: mvneta: fix error path for building skb
  2015-11-26 18:08 [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas
                   ` (2 preceding siblings ...)
  2015-11-26 18:08 ` [PATCH v2 net 3/6] net: mvneta: fix bit assignment for RX packet irq enable Marcin Wojtas
@ 2015-11-26 18:08 ` Marcin Wojtas
  2015-11-26 18:38   ` Simon Guinot
  2015-11-26 18:08 ` [PATCH v2 net 5/6] net: mvneta: enable setting custom TX IP checksum limit Marcin Wojtas
  2015-11-26 18:08 ` [PATCH v2 net 6/6] net: mvneta: enable IP checksum with jumbo frames for Armada 38x on Port0 Marcin Wojtas
  5 siblings, 1 reply; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-26 18:08 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev
  Cc: davem, linux, sebastian.hesselbarth, andrew, jason,
	thomas.petazzoni, gregory.clement, simon.guinot, nadavh, alior,
	xswang, myair, nitroshift, mw, jaz, tn, stable

In the actual RX processing, there is same error path for both descriptor
ring refilling and building skb fails. This is not correct, because after
successful refill, the ring is already updated with newly allocated
buffer. Then, in case of build_skb() fail, hitherto code left the original
buffer unmapped.

This patch fixes above situation by swapping error check of skb build with
DMA-unmap of original buffer.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Cc: <stable@vger.kernel.org> # v4.2+
Fixes a84e32894191 ("net: mvneta: fix refilling for Rx DMA buffers")
---
 drivers/net/ethernet/marvell/mvneta.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 0c3d923..62cf971 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -1580,12 +1580,16 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo,
 		}
 
 		skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size);
-		if (!skb)
-			goto err_drop_frame;
 
+		/* After refill old buffer has to be unmapped regardless
+		 * the skb is successfully built or not.
+		 */
 		dma_unmap_single(dev->dev.parent, phys_addr,
 				 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
 
+		if (!skb)
+			goto err_drop_frame;
+
 		rcvd_pkts++;
 		rcvd_bytes += rx_bytes;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 net 5/6] net: mvneta: enable setting custom TX IP checksum limit
  2015-11-26 18:08 [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas
                   ` (3 preceding siblings ...)
  2015-11-26 18:08 ` [PATCH v2 net 4/6] net: mvneta: fix error path for building skb Marcin Wojtas
@ 2015-11-26 18:08 ` Marcin Wojtas
  2015-11-26 18:08 ` [PATCH v2 net 6/6] net: mvneta: enable IP checksum with jumbo frames for Armada 38x on Port0 Marcin Wojtas
  5 siblings, 0 replies; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-26 18:08 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev
  Cc: davem, linux, sebastian.hesselbarth, andrew, jason,
	thomas.petazzoni, gregory.clement, simon.guinot, nadavh, alior,
	xswang, myair, nitroshift, mw, jaz, tn, stable

Since Armada 38x SoC can support IP checksum for jumbo frames only on
a single port, it means that this feature should be enabled per-port,
rather than for the whole SoC.

This patch enables setting custom TX IP checksum limit by adding new
optional property to the mvneta device tree node. If not used, by
default 1600B is set for "marvell,armada-370-neta" and 9800B for other
strings, which ensures backward compatibility. Binding documentation
is updated accordingly.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Cc: <stable@vger.kernel.org> # v3.18+
---
 .../bindings/net/marvell-armada-370-neta.txt          |  6 ++++++
 drivers/net/ethernet/marvell/mvneta.c                 | 19 +++++++++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
index f5a8ca2..aeea50c 100644
--- a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
+++ b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
@@ -8,6 +8,11 @@ Required properties:
 - phy-mode: See ethernet.txt file in the same directory
 - clocks: a pointer to the reference clock for this device.
 
+Optional properties:
+- tx-csum-limit: maximum mtu supported by port that allow TX checksum.
+  Value is presented in bytes. If not used, by default 1600B is set for
+  "marvell,armada-370-neta" and 9800B for others.
+
 Example:
 
 ethernet@d0070000 {
@@ -15,6 +20,7 @@ ethernet@d0070000 {
 	reg = <0xd0070000 0x2500>;
 	interrupts = <8>;
 	clocks = <&gate_clk 4>;
+	tx-csum-limit = <9800>
 	status = "okay";
 	phy = <&phy0>;
 	phy-mode = "rgmii-id";
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 62cf971..32d6f28 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -243,6 +243,7 @@
 #define MVNETA_VLAN_TAG_LEN             4
 
 #define MVNETA_CPU_D_CACHE_LINE_SIZE    32
+#define MVNETA_TX_CSUM_DEF_SIZE		1600
 #define MVNETA_TX_CSUM_MAX_SIZE		9800
 #define MVNETA_ACC_MODE_EXT		1
 
@@ -3257,6 +3258,7 @@ static int mvneta_probe(struct platform_device *pdev)
 	char hw_mac_addr[ETH_ALEN];
 	const char *mac_from;
 	const char *managed;
+	int tx_csum_limit;
 	int phy_mode;
 	int err;
 	int cpu;
@@ -3357,8 +3359,21 @@ static int mvneta_probe(struct platform_device *pdev)
 		}
 	}
 
-	if (of_device_is_compatible(dn, "marvell,armada-370-neta"))
-		pp->tx_csum_limit = 1600;
+	if (!of_property_read_u32(dn, "tx-csum-limit", &tx_csum_limit)) {
+		if (tx_csum_limit < 0 ||
+		    tx_csum_limit > MVNETA_TX_CSUM_MAX_SIZE) {
+			tx_csum_limit = MVNETA_TX_CSUM_DEF_SIZE;
+			dev_info(&pdev->dev,
+				 "Wrong TX csum limit in DT, set to %dB\n",
+				 MVNETA_TX_CSUM_DEF_SIZE);
+		}
+	} else if (of_device_is_compatible(dn, "marvell,armada-370-neta")) {
+		tx_csum_limit = MVNETA_TX_CSUM_DEF_SIZE;
+	} else {
+		tx_csum_limit = MVNETA_TX_CSUM_MAX_SIZE;
+	}
+
+	pp->tx_csum_limit = tx_csum_limit;
 
 	pp->tx_ring_size = MVNETA_MAX_TXD;
 	pp->rx_ring_size = MVNETA_MAX_RXD;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 net 6/6] net: mvneta: enable IP checksum with jumbo frames for Armada 38x on Port0
  2015-11-26 18:08 [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas
                   ` (4 preceding siblings ...)
  2015-11-26 18:08 ` [PATCH v2 net 5/6] net: mvneta: enable setting custom TX IP checksum limit Marcin Wojtas
@ 2015-11-26 18:08 ` Marcin Wojtas
  2015-11-26 18:33   ` Thomas Petazzoni
  5 siblings, 1 reply; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-26 18:08 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev
  Cc: davem, linux, sebastian.hesselbarth, andrew, jason,
	thomas.petazzoni, gregory.clement, simon.guinot, nadavh, alior,
	xswang, myair, nitroshift, mw, jaz, tn, stable

The Ethernet controller found in the Armada 38x SoC's family support
TCP/IP checksumming with frame sizes larger than 1600 bytes, however
only on port 0.

This commit enables it by setting 'tx-csum-limit' to 9800B in
'ethernet@70000' node.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Cc: <stable@vger.kernel.org> # v3.18+
---
 arch/arm/boot/dts/armada-38x.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index c6a0e9d..e8b7f67 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -498,6 +498,7 @@
 				reg = <0x70000 0x4000>;
 				interrupts-extended = <&mpic 8>;
 				clocks = <&gateclk 4>;
+				tx-csum-limit = <9800>;
 				status = "disabled";
 			};
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 net 1/6] net: mvneta: add configuration for MBUS windows access protection
  2015-11-26 18:08 ` [PATCH v2 net 1/6] net: mvneta: add configuration for MBUS windows access protection Marcin Wojtas
@ 2015-11-26 18:25   ` Thomas Petazzoni
  2015-11-26 18:31     ` Marcin Wojtas
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2015-11-26 18:25 UTC (permalink / raw)
  To: Marcin Wojtas
  Cc: linux-kernel, linux-arm-kernel, netdev, davem, linux,
	sebastian.hesselbarth, andrew, jason, gregory.clement,
	simon.guinot, nadavh, alior, xswang, myair, nitroshift, jaz, tn,
	stable

Marcin,

On Thu, 26 Nov 2015 19:08:08 +0100, Marcin Wojtas wrote:
> This commit adds missing configuration of MBUS windows access protection
> in mvneta_conf_mbus_windows function - a dedicated variable for that
> purpose remained there unused since v3.8 initial mvneta support. Because
> of that the register contents were inherited from the bootloader.
> 
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Cc: <stable@vger.kernel.org> # v3.8+
> Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network
> unit")

Is this actually fixing a user visible problem? If not, then I am not
sure it qualifies for stable.

> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index e84c7f2..c4327b9 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -62,6 +62,7 @@
>  #define MVNETA_WIN_SIZE(w)                      (0x2204 + ((w) << 3))
>  #define MVNETA_WIN_REMAP(w)                     (0x2280 + ((w) << 2))
>  #define MVNETA_BASE_ADDR_ENABLE                 0x2290
> +#define MVNETA_ACCESS_PROTECT_ENABLE		0x2294

Spaces are used for indentation in the definitions of all other
constants in this driver, so I think you should stick with this
convention, at least to remain consistent.

>  #define MVNETA_PORT_CONFIG                      0x2400
>  #define      MVNETA_UNI_PROMISC_MODE            BIT(0)
>  #define      MVNETA_DEF_RXQ(q)                  ((q) << 1)
> @@ -3188,9 +3189,11 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
>  
>  		win_enable &= ~(1 << i);
>  		win_protect |= 3 << (2 * i);
> +

Unneeded change.

>  	}
>  
>  	mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, win_enable);
> +	mvreg_write(pp, MVNETA_ACCESS_PROTECT_ENABLE, win_protect);
>  }

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 net 2/6] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG
  2015-11-26 18:08 ` [PATCH v2 net 2/6] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG Marcin Wojtas
@ 2015-11-26 18:27   ` Thomas Petazzoni
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2015-11-26 18:27 UTC (permalink / raw)
  To: Marcin Wojtas
  Cc: linux-kernel, linux-arm-kernel, netdev, davem, linux,
	sebastian.hesselbarth, andrew, jason, gregory.clement,
	simon.guinot, nadavh, alior, xswang, myair, nitroshift, jaz, tn,
	stable

Dear Marcin Wojtas,

On Thu, 26 Nov 2015 19:08:09 +0100, Marcin Wojtas wrote:
> MVNETA_RXQ_HW_BUF_ALLOC bit which controls enabling hardware buffer
> allocation was mistakenly set as BIT(1). This commit fixes the assignment.
> 
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Cc: <stable@vger.kernel.org> # v3.8+
> Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network
> unit")
> ---
>  drivers/net/ethernet/marvell/mvneta.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

What is the user-visible impact of this bug? Indeed, the code is wrong,
but things were working fine until now.

So I am not questioning that this patch should be merged, but only
questioning whether the stable tag is appropriate.

Same questions for your patch 3/6.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 net 1/6] net: mvneta: add configuration for MBUS windows access protection
  2015-11-26 18:25   ` Thomas Petazzoni
@ 2015-11-26 18:31     ` Marcin Wojtas
  0 siblings, 0 replies; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-26 18:31 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: linux-kernel, linux-arm-kernel, netdev, David S. Miller,
	Russell King - ARM Linux, Sebastian Hesselbarth, Andrew Lunn,
	Jason Cooper, Gregory Clément, Simon Guinot, nadavh,
	Lior Amsalem, Evan Wang, Yair Mahalalel, nitroshift,
	Grzegorz Jaszczyk, Tomasz Nowicki, stable

Hi Thomas,

2015-11-26 19:25 GMT+01:00 Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>:
> Marcin,
>
> On Thu, 26 Nov 2015 19:08:08 +0100, Marcin Wojtas wrote:
>> This commit adds missing configuration of MBUS windows access protection
>> in mvneta_conf_mbus_windows function - a dedicated variable for that
>> purpose remained there unused since v3.8 initial mvneta support. Because
>> of that the register contents were inherited from the bootloader.
>>
>> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
>> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
>> Cc: <stable@vger.kernel.org> # v3.8+
>> Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network
>> unit")
>
> Is this actually fixing a user visible problem? If not, then I am not
> sure it qualifies for stable.

Indeed, it's not fixing a visible thing, unless you resume from
suspend to ram. However, the original driver declares and updates
'win_protect ' variable, which have remained unused for past 3 years:)
If you think it's not worth cc'ing stable despite that, I will remove
the notification.

>
>> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
>> index e84c7f2..c4327b9 100644
>> --- a/drivers/net/ethernet/marvell/mvneta.c
>> +++ b/drivers/net/ethernet/marvell/mvneta.c
>> @@ -62,6 +62,7 @@
>>  #define MVNETA_WIN_SIZE(w)                      (0x2204 + ((w) << 3))
>>  #define MVNETA_WIN_REMAP(w)                     (0x2280 + ((w) << 2))
>>  #define MVNETA_BASE_ADDR_ENABLE                 0x2290
>> +#define MVNETA_ACCESS_PROTECT_ENABLE         0x2294
>
> Spaces are used for indentation in the definitions of all other
> constants in this driver, so I think you should stick with this
> convention, at least to remain consistent.
>

Ok.

>>  #define MVNETA_PORT_CONFIG                      0x2400
>>  #define      MVNETA_UNI_PROMISC_MODE            BIT(0)
>>  #define      MVNETA_DEF_RXQ(q)                  ((q) << 1)
>> @@ -3188,9 +3189,11 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
>>
>>               win_enable &= ~(1 << i);
>>               win_protect |= 3 << (2 * i);
>> +
>
> Unneeded change.
>

Indeed, my mistake.

Thanks,
Marcin

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 net 6/6] net: mvneta: enable IP checksum with jumbo frames for Armada 38x on Port0
  2015-11-26 18:08 ` [PATCH v2 net 6/6] net: mvneta: enable IP checksum with jumbo frames for Armada 38x on Port0 Marcin Wojtas
@ 2015-11-26 18:33   ` Thomas Petazzoni
  2015-11-26 18:41     ` Marcin Wojtas
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2015-11-26 18:33 UTC (permalink / raw)
  To: Marcin Wojtas
  Cc: linux-kernel, linux-arm-kernel, netdev, davem, linux,
	sebastian.hesselbarth, andrew, jason, gregory.clement,
	simon.guinot, nadavh, alior, xswang, myair, nitroshift, jaz, tn,
	stable

Marcin,

On Thu, 26 Nov 2015 19:08:13 +0100, Marcin Wojtas wrote:
> The Ethernet controller found in the Armada 38x SoC's family support
> TCP/IP checksumming with frame sizes larger than 1600 bytes, however
> only on port 0.
> 
> This commit enables it by setting 'tx-csum-limit' to 9800B in
> 'ethernet@70000' node.
> 
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> Cc: <stable@vger.kernel.org> # v3.18+

This and the previous patch is not a fix, and has no business going in
stable. It is enabling a better functionality, but it is clearly not a
fix.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 net 4/6] net: mvneta: fix error path for building skb
  2015-11-26 18:08 ` [PATCH v2 net 4/6] net: mvneta: fix error path for building skb Marcin Wojtas
@ 2015-11-26 18:38   ` Simon Guinot
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Guinot @ 2015-11-26 18:38 UTC (permalink / raw)
  To: Marcin Wojtas
  Cc: linux-kernel, linux-arm-kernel, netdev, thomas.petazzoni, andrew,
	linux, jason, myair, jaz, xswang, nadavh, alior, stable, tn,
	gregory.clement, nitroshift, davem, sebastian.hesselbarth

[-- Attachment #1: Type: text/plain, Size: 1860 bytes --]

On Thu, Nov 26, 2015 at 07:08:11PM +0100, Marcin Wojtas wrote:
> In the actual RX processing, there is same error path for both descriptor
> ring refilling and building skb fails. This is not correct, because after
> successful refill, the ring is already updated with newly allocated
> buffer. Then, in case of build_skb() fail, hitherto code left the original
> buffer unmapped.
> 
> This patch fixes above situation by swapping error check of skb build with
> DMA-unmap of original buffer.
> 
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> Cc: <stable@vger.kernel.org> # v4.2+
> Fixes a84e32894191 ("net: mvneta: fix refilling for Rx DMA buffers")
> ---
>  drivers/net/ethernet/marvell/mvneta.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 

Acked-by: Simon Guinot <simon.guinot@sequanux.org>

Thanks,

Simon

> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 0c3d923..62cf971 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -1580,12 +1580,16 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo,
>  		}
>  
>  		skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size);
> -		if (!skb)
> -			goto err_drop_frame;
>  
> +		/* After refill old buffer has to be unmapped regardless
> +		 * the skb is successfully built or not.
> +		 */
>  		dma_unmap_single(dev->dev.parent, phys_addr,
>  				 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
>  
> +		if (!skb)
> +			goto err_drop_frame;
> +
>  		rcvd_pkts++;
>  		rcvd_bytes += rx_bytes;
>  
> -- 
> 1.8.3.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 net 6/6] net: mvneta: enable IP checksum with jumbo frames for Armada 38x on Port0
  2015-11-26 18:33   ` Thomas Petazzoni
@ 2015-11-26 18:41     ` Marcin Wojtas
  0 siblings, 0 replies; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-26 18:41 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: linux-kernel, linux-arm-kernel, netdev, David S. Miller,
	Russell King - ARM Linux, Sebastian Hesselbarth, Andrew Lunn,
	Jason Cooper, Gregory Clément, Simon Guinot, nadavh,
	Lior Amsalem, Evan Wang, Yair Mahalalel, nitroshift,
	Grzegorz Jaszczyk, Tomasz Nowicki, stable

Thomas,


2015-11-26 19:33 GMT+01:00 Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>:
> Marcin,
>
> On Thu, 26 Nov 2015 19:08:13 +0100, Marcin Wojtas wrote:
>> The Ethernet controller found in the Armada 38x SoC's family support
>> TCP/IP checksumming with frame sizes larger than 1600 bytes, however
>> only on port 0.
>>
>> This commit enables it by setting 'tx-csum-limit' to 9800B in
>> 'ethernet@70000' node.
>>
>> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
>> Cc: <stable@vger.kernel.org> # v3.18+
>
> This and the previous patch is not a fix, and has no business going in
> stable. It is enabling a better functionality, but it is clearly not a
> fix.
>

Ok. I thought that patches enabling tx_csum_limit were adding a sort
of regression, but I can agree to your interpretation. In such case I
will leave stable notification only for patch #4.

Thanks,
Marcin

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes
@ 2015-11-27 15:44 Marcin Wojtas
  0 siblings, 0 replies; 14+ messages in thread
From: Marcin Wojtas @ 2015-11-27 15:44 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev
  Cc: davem, linux, sebastian.hesselbarth, andrew, jason,
	thomas.petazzoni, gregory.clement, simon.guinot, nadavh, alior,
	xswang, myair, nitroshift, mw, jaz, tn

Hi,

I updated the mvneta fixes patchset with minor corrections suggested by
Thomas Petazzoni.

I will be greatful for a feedback.

Best regards,
Marcin Wojtas

Changes from v2:
* Style fixes in patch updating mbus protection
* Remove redundant stable notifications except for patch 4/6

Changes from v1:
* update MBUS windows access protection register once, after whole loop
* add fixing value of MVNETA_RXQ_INTR_ENABLE_ALL_MASK
* add fixing error path for skb_build()
* add possibility of setting custom TX IP checksum limit in DT property

Marcin Wojtas (6):
  net: mvneta: add configuration for MBUS windows access protection
  net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG
  net: mvneta: fix bit assignment for RX packet irq enable
  net: mvneta: fix error path for building skb
  net: mvneta: enable setting custom TX IP checksum limit
  net: mvneta: enable IP checksum with jumbo frames for Armada 38x on
    Port0

 .../bindings/net/marvell-armada-370-neta.txt       |  6 ++++
 arch/arm/boot/dts/armada-38x.dtsi                  |  1 +
 drivers/net/ethernet/marvell/mvneta.c              | 33 ++++++++++++++++++----
 3 files changed, 34 insertions(+), 6 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-11-27 15:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-26 18:08 [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas
2015-11-26 18:08 ` [PATCH v2 net 1/6] net: mvneta: add configuration for MBUS windows access protection Marcin Wojtas
2015-11-26 18:25   ` Thomas Petazzoni
2015-11-26 18:31     ` Marcin Wojtas
2015-11-26 18:08 ` [PATCH v2 net 2/6] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG Marcin Wojtas
2015-11-26 18:27   ` Thomas Petazzoni
2015-11-26 18:08 ` [PATCH v2 net 3/6] net: mvneta: fix bit assignment for RX packet irq enable Marcin Wojtas
2015-11-26 18:08 ` [PATCH v2 net 4/6] net: mvneta: fix error path for building skb Marcin Wojtas
2015-11-26 18:38   ` Simon Guinot
2015-11-26 18:08 ` [PATCH v2 net 5/6] net: mvneta: enable setting custom TX IP checksum limit Marcin Wojtas
2015-11-26 18:08 ` [PATCH v2 net 6/6] net: mvneta: enable IP checksum with jumbo frames for Armada 38x on Port0 Marcin Wojtas
2015-11-26 18:33   ` Thomas Petazzoni
2015-11-26 18:41     ` Marcin Wojtas
2015-11-27 15:44 [PATCH v2 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).