]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: ravb: Fix maximum TX frame size for GbEth devices
authorPaul Barker <paul.barker.ct@bp.renesas.com>
Wed, 18 Sep 2024 08:18:38 +0000 (09:18 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 24 Sep 2024 09:55:13 +0000 (11:55 +0200)
The datasheets for all SoCs using the GbEth IP specify a maximum
transmission frame size of 1.5 kByte. I've confirmed through internal
discussions that support for 1522 byte frames has been validated, which
allows us to support the default MTU of 1500 bytes after reserving space
for the Ethernet header, frame checksums and an optional VLAN tag.

Fixes: 2e95e08ac009 ("ravb: Add rx_max_buf_size to struct ravb_hw_info")
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/renesas/ravb.h
drivers/net/ethernet/renesas/ravb_main.c

index 9893c91af1050fa1fb6fd3133941f37700212224..a7de5cf6b31743992185240c194eeec376a51e25 100644 (file)
@@ -1052,6 +1052,7 @@ struct ravb_hw_info {
        netdev_features_t net_features;
        int stats_len;
        u32 tccr_mask;
+       u32 tx_max_frame_size;
        u32 rx_max_frame_size;
        u32 rx_buffer_size;
        u32 rx_desc_size;
index c7ec23688d56a45a8eca65012bc22322c31d53e3..e73cdba58516554b262d60176867d846eb80fd5d 100644 (file)
@@ -2674,6 +2674,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
        .net_features = NETIF_F_RXCSUM,
        .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
        .tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
+       .tx_max_frame_size = SZ_2K,
        .rx_max_frame_size = SZ_2K,
        .rx_buffer_size = SZ_2K +
                          SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
@@ -2696,6 +2697,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
        .net_features = NETIF_F_RXCSUM,
        .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
        .tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
+       .tx_max_frame_size = SZ_2K,
        .rx_max_frame_size = SZ_2K,
        .rx_buffer_size = SZ_2K +
                          SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
@@ -2721,6 +2723,7 @@ static const struct ravb_hw_info ravb_gen4_hw_info = {
        .net_features = NETIF_F_RXCSUM,
        .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
        .tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
+       .tx_max_frame_size = SZ_2K,
        .rx_max_frame_size = SZ_2K,
        .rx_buffer_size = SZ_2K +
                          SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
@@ -2770,6 +2773,7 @@ static const struct ravb_hw_info gbeth_hw_info = {
        .net_features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM,
        .stats_len = ARRAY_SIZE(ravb_gstrings_stats_gbeth),
        .tccr_mask = TCCR_TSRQ0,
+       .tx_max_frame_size = 1522,
        .rx_max_frame_size = SZ_8K,
        .rx_buffer_size = SZ_2K,
        .rx_desc_size = sizeof(struct ravb_rx_desc),
@@ -2981,7 +2985,7 @@ static int ravb_probe(struct platform_device *pdev)
        priv->avb_link_active_low =
                of_property_read_bool(np, "renesas,ether-link-active-low");
 
-       ndev->max_mtu = info->rx_max_frame_size -
+       ndev->max_mtu = info->tx_max_frame_size -
                (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
        ndev->min_mtu = ETH_MIN_MTU;