[PATCH net v2] net: spacemit: k1-emac: program frame size registers for jumbo frames
Yixun Lan
dlan at gentoo.org
Mon Jan 26 18:05:26 PST 2026
Hi Tomas,
On 18:14 Mon 26 Jan , Tomas Hlavacek wrote:
> The driver allows changing MTU up to 4K via emac_change_mtu() and
> allocates appropriately sized DMA buffers, but it never programs the
> MAC_MAXIMUM_FRAME_SIZE and MAC_RECEIVE_JABBER_SIZE registers.
>
> This causes the MAC hardware to reject frames larger than the default
> 1518 bytes, even when larger buffers are allocated. Frames exceeding
> the default size trigger jabber errors and are discarded.
>
> Fixes: bfec6d7f2001 ("net: spacemit: Add K1 Ethernet MAC")
> Cc: stable at vger.kernel.org
> Signed-off-by: Tomas Hlavacek <tmshlvck at gmail.com>
> ---
> v2: Added Fixes tag and Cc stable.
>
> drivers/net/ethernet/spacemit/k1_emac.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/spacemit/k1_emac.c b/drivers/net/ethernet/spacemit/k1_emac.c
> index 220eb5ce7583..31b1bdb2827e 100644
> --- a/drivers/net/ethernet/spacemit/k1_emac.c
> +++ b/drivers/net/ethernet/spacemit/k1_emac.c
> @@ -228,6 +228,12 @@ static void emac_init_hw(struct emac_priv *priv)
> DEFAULT_TX_THRESHOLD);
> emac_wr(priv, MAC_RECEIVE_PACKET_START_THRESHOLD, DEFAULT_RX_THRESHOLD);
>
> + /* Set maximum frame size and jabber size based on configured buffer
> + * size.
> + */
> + emac_wr(priv, MAC_MAXIMUM_FRAME_SIZE, priv->dma_buf_sz);
> + emac_wr(priv, MAC_RECEIVE_JABBER_SIZE, priv->dma_buf_sz);
> +
I'm no expert here, but just notice there is additional MAC_TRANSMIT_JABBER_SIZE
register which is no need to set? or is the problem on receive side only?
> /* Configure flow control (enabled in emac_adjust_link() later) */
> emac_set_mac_addr_reg(priv, fc_dest_addr, MAC_FC_SOURCE_ADDRESS_HIGH);
> emac_wr(priv, MAC_FC_PAUSE_HIGH_THRESHOLD, DEFAULT_FC_FIFO_HIGH);
> --
> 2.52.0
>
--
Yixun Lan (dlan)
More information about the linux-riscv
mailing list