Commit bfde6265 authored by Paolo Abeni's avatar Paolo Abeni

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/20240918081839.259-1-paul.barker.ct@bp.renesas.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 675faf5a ec823471
...@@ -1052,6 +1052,7 @@ struct ravb_hw_info { ...@@ -1052,6 +1052,7 @@ struct ravb_hw_info {
netdev_features_t net_features; netdev_features_t net_features;
int stats_len; int stats_len;
u32 tccr_mask; u32 tccr_mask;
u32 tx_max_frame_size;
u32 rx_max_frame_size; u32 rx_max_frame_size;
u32 rx_buffer_size; u32 rx_buffer_size;
u32 rx_desc_size; u32 rx_desc_size;
......
...@@ -555,8 +555,16 @@ static void ravb_emac_init_gbeth(struct net_device *ndev) ...@@ -555,8 +555,16 @@ static void ravb_emac_init_gbeth(struct net_device *ndev)
static void ravb_emac_init_rcar(struct net_device *ndev) static void ravb_emac_init_rcar(struct net_device *ndev)
{ {
/* Receive frame limit set register */ struct ravb_private *priv = netdev_priv(ndev);
ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR);
/* Set receive frame length
*
* The length set here describes the frame from the destination address
* up to and including the CRC data. However only the frame data,
* excluding the CRC, are transferred to memory. To allow for the
* largest frames add the CRC length to the maximum Rx descriptor size.
*/
ravb_write(ndev, priv->info->rx_max_frame_size + ETH_FCS_LEN, RFLR);
/* EMAC Mode: PAUSE prohibition; Duplex; RX Checksum; TX; RX */ /* EMAC Mode: PAUSE prohibition; Duplex; RX Checksum; TX; RX */
ravb_write(ndev, ECMR_ZPF | ECMR_DM | ravb_write(ndev, ECMR_ZPF | ECMR_DM |
...@@ -2674,6 +2682,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = { ...@@ -2674,6 +2682,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
.net_features = NETIF_F_RXCSUM, .net_features = NETIF_F_RXCSUM,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats), .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3, .tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
.tx_max_frame_size = SZ_2K,
.rx_max_frame_size = SZ_2K, .rx_max_frame_size = SZ_2K,
.rx_buffer_size = SZ_2K + .rx_buffer_size = SZ_2K +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
...@@ -2696,6 +2705,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = { ...@@ -2696,6 +2705,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
.net_features = NETIF_F_RXCSUM, .net_features = NETIF_F_RXCSUM,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats), .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3, .tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
.tx_max_frame_size = SZ_2K,
.rx_max_frame_size = SZ_2K, .rx_max_frame_size = SZ_2K,
.rx_buffer_size = SZ_2K + .rx_buffer_size = SZ_2K +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
...@@ -2721,6 +2731,7 @@ static const struct ravb_hw_info ravb_gen4_hw_info = { ...@@ -2721,6 +2731,7 @@ static const struct ravb_hw_info ravb_gen4_hw_info = {
.net_features = NETIF_F_RXCSUM, .net_features = NETIF_F_RXCSUM,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats), .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3, .tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
.tx_max_frame_size = SZ_2K,
.rx_max_frame_size = SZ_2K, .rx_max_frame_size = SZ_2K,
.rx_buffer_size = SZ_2K + .rx_buffer_size = SZ_2K +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
...@@ -2770,6 +2781,7 @@ static const struct ravb_hw_info gbeth_hw_info = { ...@@ -2770,6 +2781,7 @@ static const struct ravb_hw_info gbeth_hw_info = {
.net_features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM, .net_features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats_gbeth), .stats_len = ARRAY_SIZE(ravb_gstrings_stats_gbeth),
.tccr_mask = TCCR_TSRQ0, .tccr_mask = TCCR_TSRQ0,
.tx_max_frame_size = 1522,
.rx_max_frame_size = SZ_8K, .rx_max_frame_size = SZ_8K,
.rx_buffer_size = SZ_2K, .rx_buffer_size = SZ_2K,
.rx_desc_size = sizeof(struct ravb_rx_desc), .rx_desc_size = sizeof(struct ravb_rx_desc),
...@@ -2981,7 +2993,7 @@ static int ravb_probe(struct platform_device *pdev) ...@@ -2981,7 +2993,7 @@ static int ravb_probe(struct platform_device *pdev)
priv->avb_link_active_low = priv->avb_link_active_low =
of_property_read_bool(np, "renesas,ether-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); (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
ndev->min_mtu = ETH_MIN_MTU; ndev->min_mtu = ETH_MIN_MTU;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment