Skip to content

Commit 2e95e08

Browse files
bijudaskuba-moo
authored andcommitted
ravb: Add rx_max_buf_size to struct ravb_hw_info
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>
1 parent 23144a9 commit 2e95e08

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

drivers/net/ethernet/renesas/ravb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,7 @@ struct ravb_hw_info {
10101010
int stats_len;
10111011
size_t max_rx_len;
10121012
u32 tsrq;
1013+
u32 rx_max_buf_size;
10131014
unsigned aligned_tx: 1;
10141015

10151016
/* hardware features */

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2188,6 +2188,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
21882188
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
21892189
.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
21902190
.tsrq = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
2191+
.rx_max_buf_size = SZ_2K,
21912192
.internal_delay = 1,
21922193
.tx_counters = 1,
21932194
.multi_irqs = 1,
@@ -2212,6 +2213,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
22122213
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
22132214
.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
22142215
.tsrq = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
2216+
.rx_max_buf_size = SZ_2K,
22152217
.aligned_tx = 1,
22162218
.gptp = 1,
22172219
.nc_queue = 1,
@@ -2229,6 +2231,7 @@ static const struct ravb_hw_info gbeth_hw_info = {
22292231
.emac_init = ravb_emac_init_gbeth,
22302232
.max_rx_len = ALIGN(GBETH_RX_BUFF_MAX, RAVB_ALIGN),
22312233
.tsrq = TCCR_TSRQ0,
2234+
.rx_max_buf_size = SZ_8K,
22322235
.aligned_tx = 1,
22332236
.tx_counters = 1,
22342237
.half_duplex = 1,
@@ -2452,7 +2455,7 @@ static int ravb_probe(struct platform_device *pdev)
24522455
}
24532456
clk_prepare_enable(priv->refclk);
24542457

2455-
ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
2458+
ndev->max_mtu = info->rx_max_buf_size - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
24562459
ndev->min_mtu = ETH_MIN_MTU;
24572460

24582461
/* FIXME: R-Car Gen2 has 4byte alignment restriction for tx buffer

0 commit comments

Comments
 (0)