aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Wojtas <mw@semihalf.com>2015-11-30 07:27:45 -0500
committerDavid S. Miller <davem@davemloft.net>2015-12-02 23:35:05 -0500
commit9110ee07762a8f04835878863be2449362c63508 (patch)
treec648dc126b37d0b47ff022c8fb82ac80e2248f39
parent26c17a179f3f64f92de6e837c14279a6431a7ab6 (diff)
net: mvneta: enable setting custom TX IP checksum limit
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt6
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c19
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 f5a8ca29aff0..aeea50c84e92 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:
8- phy-mode: See ethernet.txt file in the same directory 8- phy-mode: See ethernet.txt file in the same directory
9- clocks: a pointer to the reference clock for this device. 9- clocks: a pointer to the reference clock for this device.
10 10
11Optional properties:
12- tx-csum-limit: maximum mtu supported by port that allow TX checksum.
13 Value is presented in bytes. If not used, by default 1600B is set for
14 "marvell,armada-370-neta" and 9800B for others.
15
11Example: 16Example:
12 17
13ethernet@d0070000 { 18ethernet@d0070000 {
@@ -15,6 +20,7 @@ ethernet@d0070000 {
15 reg = <0xd0070000 0x2500>; 20 reg = <0xd0070000 0x2500>;
16 interrupts = <8>; 21 interrupts = <8>;
17 clocks = <&gate_clk 4>; 22 clocks = <&gate_clk 4>;
23 tx-csum-limit = <9800>
18 status = "okay"; 24 status = "okay";
19 phy = <&phy0>; 25 phy = <&phy0>;
20 phy-mode = "rgmii-id"; 26 phy-mode = "rgmii-id";
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 5a98c5d61a2b..ed622fa29dfa 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -243,6 +243,7 @@
243#define MVNETA_VLAN_TAG_LEN 4 243#define MVNETA_VLAN_TAG_LEN 4
244 244
245#define MVNETA_CPU_D_CACHE_LINE_SIZE 32 245#define MVNETA_CPU_D_CACHE_LINE_SIZE 32
246#define MVNETA_TX_CSUM_DEF_SIZE 1600
246#define MVNETA_TX_CSUM_MAX_SIZE 9800 247#define MVNETA_TX_CSUM_MAX_SIZE 9800
247#define MVNETA_ACC_MODE_EXT 1 248#define MVNETA_ACC_MODE_EXT 1
248 249
@@ -3256,6 +3257,7 @@ static int mvneta_probe(struct platform_device *pdev)
3256 char hw_mac_addr[ETH_ALEN]; 3257 char hw_mac_addr[ETH_ALEN];
3257 const char *mac_from; 3258 const char *mac_from;
3258 const char *managed; 3259 const char *managed;
3260 int tx_csum_limit;
3259 int phy_mode; 3261 int phy_mode;
3260 int err; 3262 int err;
3261 int cpu; 3263 int cpu;
@@ -3356,8 +3358,21 @@ static int mvneta_probe(struct platform_device *pdev)
3356 } 3358 }
3357 } 3359 }
3358 3360
3359 if (of_device_is_compatible(dn, "marvell,armada-370-neta")) 3361 if (!of_property_read_u32(dn, "tx-csum-limit", &tx_csum_limit)) {
3360 pp->tx_csum_limit = 1600; 3362 if (tx_csum_limit < 0 ||
3363 tx_csum_limit > MVNETA_TX_CSUM_MAX_SIZE) {
3364 tx_csum_limit = MVNETA_TX_CSUM_DEF_SIZE;
3365 dev_info(&pdev->dev,
3366 "Wrong TX csum limit in DT, set to %dB\n",
3367 MVNETA_TX_CSUM_DEF_SIZE);
3368 }
3369 } else if (of_device_is_compatible(dn, "marvell,armada-370-neta")) {
3370 tx_csum_limit = MVNETA_TX_CSUM_DEF_SIZE;
3371 } else {
3372 tx_csum_limit = MVNETA_TX_CSUM_MAX_SIZE;
3373 }
3374
3375 pp->tx_csum_limit = tx_csum_limit;
3361 3376
3362 pp->tx_ring_size = MVNETA_MAX_TXD; 3377 pp->tx_ring_size = MVNETA_MAX_TXD;
3363 pp->rx_ring_size = MVNETA_MAX_RXD; 3378 pp->rx_ring_size = MVNETA_MAX_RXD;