Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1279836

[PATCH v4 net 5/6] net: mvneta: enable setting custom TX IP checksum limit

From Marcin Wojtas <mw@semihalf.com>
Newsgroups linux.kernel
Subject [PATCH v4 net 5/6] net: mvneta: enable setting custom TX IP checksum limit
Date 2015-11-30 13:30 +0100
Message-ID <qAvKJ-3zm-77@gated-at.bofh.it> (permalink)
References <qAvKG-3zm-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 .../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 5a98c5d..ed622fa 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
 
@@ -3256,6 +3257,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;
@@ -3356,8 +3358,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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
  [PATCH v4 net 2/6] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
  [PATCH v4 net 3/6] net: mvneta: fix bit assignment for RX packet irq enable Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
  [PATCH v4 net 4/6] net: mvneta: fix error path for building skb Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
  [PATCH v4 net 1/6] net: mvneta: add configuration for MBUS windows access protection Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
  [PATCH v4 net 6/6] mvebu: dts: enable IP checksum with jumbo frames for Armada 38x on Port0 Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
  [PATCH v4 net 5/6] net: mvneta: enable setting custom TX IP checksum limit Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
  Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes David Miller <davem@davemloft.net> - 2015-12-02 04:10 +0100
    Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas <mw@semihalf.com> - 2015-12-02 07:10 +0100
    Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes Gregory CLEMENT <gregory.clement@free-electrons.com> - 2015-12-02 09:20 +0100
      Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes David Miller <davem@davemloft.net> - 2015-12-02 21:40 +0100
        Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes Gregory CLEMENT <gregory.clement@free-electrons.com> - 2015-12-03 14:50 +0100

csiph-web