Skip to content

Commit bfde626

Browse files
author
Paolo Abeni
committed
Merge branch 'fix-maximum-tx-rx-frame-sizes-in-ravb-driver'
Paul Barker says: ==================== Fix maximum TX/RX frame sizes in ravb driver These patches fix a couple of bugs in the maximum supported TX/RX frame sizes in the ravb driver. * For the GbEth IP, we were advertising a maximum TX frame size/MTU that was larger that the maximum the hardware can transmit. * For the R-Car AVB IP, we were unnecessarily setting the maximum RX frame size/MRU based on the MTU, which by default is smaller than the maximum the hardware can receive. For the R-Car AVB IP, the maximum TX frame size should be 2047 (not 2048), but additional work will be required to validate that change so it is not included in this series. Changes v2->v3: * Pick up Reviewed-by tag and suggested comment improvement from Niklas. Changes v1->v2: * Rebase on net tree as these are both bugfixes. * Pick up Reviewed-by tags. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 675faf5 + ec82347 commit bfde626

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
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: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,16 @@ static void ravb_emac_init_gbeth(struct net_device *ndev)
555555

556556
static void ravb_emac_init_rcar(struct net_device *ndev)
557557
{
558-
/* Receive frame limit set register */
559-
ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR);
558+
struct ravb_private *priv = netdev_priv(ndev);
559+
560+
/* Set receive frame length
561+
*
562+
* The length set here describes the frame from the destination address
563+
* up to and including the CRC data. However only the frame data,
564+
* excluding the CRC, are transferred to memory. To allow for the
565+
* largest frames add the CRC length to the maximum Rx descriptor size.
566+
*/
567+
ravb_write(ndev, priv->info->rx_max_frame_size + ETH_FCS_LEN, RFLR);
560568

561569
/* EMAC Mode: PAUSE prohibition; Duplex; RX Checksum; TX; RX */
562570
ravb_write(ndev, ECMR_ZPF | ECMR_DM |
@@ -2674,6 +2682,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
26742682
.net_features = NETIF_F_RXCSUM,
26752683
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
26762684
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
2685+
.tx_max_frame_size = SZ_2K,
26772686
.rx_max_frame_size = SZ_2K,
26782687
.rx_buffer_size = SZ_2K +
26792688
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
@@ -2696,6 +2705,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
26962705
.net_features = NETIF_F_RXCSUM,
26972706
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
26982707
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
2708+
.tx_max_frame_size = SZ_2K,
26992709
.rx_max_frame_size = SZ_2K,
27002710
.rx_buffer_size = SZ_2K +
27012711
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
@@ -2721,6 +2731,7 @@ static const struct ravb_hw_info ravb_gen4_hw_info = {
27212731
.net_features = NETIF_F_RXCSUM,
27222732
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
27232733
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
2734+
.tx_max_frame_size = SZ_2K,
27242735
.rx_max_frame_size = SZ_2K,
27252736
.rx_buffer_size = SZ_2K +
27262737
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
@@ -2770,6 +2781,7 @@ static const struct ravb_hw_info gbeth_hw_info = {
27702781
.net_features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM,
27712782
.stats_len = ARRAY_SIZE(ravb_gstrings_stats_gbeth),
27722783
.tccr_mask = TCCR_TSRQ0,
2784+
.tx_max_frame_size = 1522,
27732785
.rx_max_frame_size = SZ_8K,
27742786
.rx_buffer_size = SZ_2K,
27752787
.rx_desc_size = sizeof(struct ravb_rx_desc),
@@ -2981,7 +2993,7 @@ static int ravb_probe(struct platform_device *pdev)
29812993
priv->avb_link_active_low =
29822994
of_property_read_bool(np, "renesas,ether-link-active-low");
29832995

2984-
ndev->max_mtu = info->rx_max_frame_size -
2996+
ndev->max_mtu = info->tx_max_frame_size -
29852997
(ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
29862998
ndev->min_mtu = ETH_MIN_MTU;
29872999

0 commit comments

Comments
 (0)