]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ravb: Add rx_max_buf_size to struct ravb_hw_info
authorBiju Das <biju.das.jz@bp.renesas.com>
Tue, 12 Oct 2021 16:36:01 +0000 (17:36 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 13 Oct 2021 16:08:55 +0000 (09:08 -0700)
R-Car AVB-DMAC has maximum 2K size on RX buffer, whereas on RZ/G2L
it is 8K. We need to allow for changing the MTU within the limit
of the maximum size of a descriptor.

Add a rx_max_buf_size variable to struct ravb_hw_info to handle
this difference.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/renesas/ravb.h
drivers/net/ethernet/renesas/ravb_main.c

index 5dc1324786e023d380513c592e6aa81c96fcf89f..b147c4a0dc0b15df512d910152ece583f3596db1 100644 (file)
@@ -1010,6 +1010,7 @@ struct ravb_hw_info {
        int stats_len;
        size_t max_rx_len;
        u32 tsrq;
+       u32 rx_max_buf_size;
        unsigned aligned_tx: 1;
 
        /* hardware features */
index 0e3cda1140e54a81ccc4b388e32df1b421127524..fe3449fb413545115bda680d3bdf2038d5d58d1f 100644 (file)
@@ -2188,6 +2188,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
        .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
        .max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
        .tsrq = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
+       .rx_max_buf_size = SZ_2K,
        .internal_delay = 1,
        .tx_counters = 1,
        .multi_irqs = 1,
@@ -2212,6 +2213,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
        .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
        .max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
        .tsrq = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
+       .rx_max_buf_size = SZ_2K,
        .aligned_tx = 1,
        .gptp = 1,
        .nc_queue = 1,
@@ -2229,6 +2231,7 @@ static const struct ravb_hw_info gbeth_hw_info = {
        .emac_init = ravb_emac_init_gbeth,
        .max_rx_len = ALIGN(GBETH_RX_BUFF_MAX, RAVB_ALIGN),
        .tsrq = TCCR_TSRQ0,
+       .rx_max_buf_size = SZ_8K,
        .aligned_tx = 1,
        .tx_counters = 1,
        .half_duplex = 1,
@@ -2452,7 +2455,7 @@ static int ravb_probe(struct platform_device *pdev)
        }
        clk_prepare_enable(priv->refclk);
 
-       ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
+       ndev->max_mtu = info->rx_max_buf_size - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
        ndev->min_mtu = ETH_MIN_MTU;
 
        /* FIXME: R-Car Gen2 has 4byte alignment restriction for tx buffer