Skip to content

Commit 1d63864

Browse files
pbrkrPaolo Abeni
authored andcommitted
net: ravb: Fix maximum TX frame size for GbEth devices
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: 2e95e08 ("ravb: Add rx_max_buf_size to struct ravb_hw_info") Reviewed-by: Niklas Söderlund <[email protected]> Reviewed-by: Sergey Shtylyov <[email protected]> Signed-off-by: Paul Barker <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 675faf5 commit 1d63864

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

drivers/net/ethernet/renesas/ravb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ struct ravb_hw_info {
10521052
netdev_features_t net_features;
10531053
int stats_len;
10541054
u32 tccr_mask;
1055+
u32 tx_max_frame_size;
10551056
u32 rx_max_frame_size;
10561057
u32 rx_buffer_size;
10571058
u32 rx_desc_size;

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2674,6 +2674,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
26742674
.net_features = NETIF_F_RXCSUM,
26752675
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
26762676
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
2677+
.tx_max_frame_size = SZ_2K,
26772678
.rx_max_frame_size = SZ_2K,
26782679
.rx_buffer_size = SZ_2K +
26792680
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
@@ -2696,6 +2697,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
26962697
.net_features = NETIF_F_RXCSUM,
26972698
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
26982699
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
2700+
.tx_max_frame_size = SZ_2K,
26992701
.rx_max_frame_size = SZ_2K,
27002702
.rx_buffer_size = SZ_2K +
27012703
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
@@ -2721,6 +2723,7 @@ static const struct ravb_hw_info ravb_gen4_hw_info = {
27212723
.net_features = NETIF_F_RXCSUM,
27222724
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
27232725
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
2726+
.tx_max_frame_size = SZ_2K,
27242727
.rx_max_frame_size = SZ_2K,
27252728
.rx_buffer_size = SZ_2K +
27262729
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
@@ -2770,6 +2773,7 @@ static const struct ravb_hw_info gbeth_hw_info = {
27702773
.net_features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM,
27712774
.stats_len = ARRAY_SIZE(ravb_gstrings_stats_gbeth),
27722775
.tccr_mask = TCCR_TSRQ0,
2776+
.tx_max_frame_size = 1522,
27732777
.rx_max_frame_size = SZ_8K,
27742778
.rx_buffer_size = SZ_2K,
27752779
.rx_desc_size = sizeof(struct ravb_rx_desc),
@@ -2981,7 +2985,7 @@ static int ravb_probe(struct platform_device *pdev)
29812985
priv->avb_link_active_low =
29822986
of_property_read_bool(np, "renesas,ether-link-active-low");
29832987

2984-
ndev->max_mtu = info->rx_max_frame_size -
2988+
ndev->max_mtu = info->tx_max_frame_size -
29852989
(ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
29862990
ndev->min_mtu = ETH_MIN_MTU;
29872991

0 commit comments

Comments
 (0)