Re: [PATCH net-next v9 7/8] net: bcmgenet: allow the MTU to be changed
From: Nicolai Buchwitz
Date: Fri Nov 27 2026 - 05:23:32 EST
Hi Daniel,
On 26.11.2026 13:15, Daniel Machon wrote:
[...]
+static int bcmgenet_change_mtu(struct net_device *dev, int new_mtu)
+{
+ struct bcmgenet_priv *priv = netdev_priv(dev);
+ unsigned int old_mtu = dev->mtu;
+ struct bcmgenet_dma_set set;
+ int ret;
+
+ /* A failed resume left the datapath down, nothing to reprogram */
+ if (!netif_running(dev) || !priv->tx_cbs) {
+ WRITE_ONCE(dev->mtu, new_mtu);
+ priv->rx_buf_len = bcmgenet_rx_buf_len(new_mtu);
+ return 0;
+ }
+
+ /* Below ETH_DATA_LEN everything is floored, so there is nothing to
+ * reprogram and rx_buf_len stays as the receive path reads it.
+ */
+ if (max_t(unsigned int, old_mtu, ETH_DATA_LEN) ==
+ max_t(unsigned int, new_mtu, ETH_DATA_LEN)) {
+ WRITE_ONCE(dev->mtu, new_mtu);
+ return 0;
+ }
What about a similar check for MTUs above ETH_DATA_LEN? AFAICT, there are
ranges where you don't need to do a full replacement of the buffers, yet
you still do.
Makes sense. I will add this in the next version!
[...]
Thanks,
Nicolai