Skip to content

Commit 03b1b69

Browse files
LorenzoBianconikuba-moo
authored andcommitted
net: airoha: Introduce airoha_dev_change_mtu callback
Add airoha_dev_change_mtu callback to update the MTU of a running device. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250304-airoha-eth-rx-sg-v1-3-283ebc61120e@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent e12182d commit 03b1b69

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/net/ethernet/airoha/airoha_eth.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,20 @@ static void airoha_dev_get_stats64(struct net_device *dev,
17051705
} while (u64_stats_fetch_retry(&port->stats.syncp, start));
17061706
}
17071707

1708+
static int airoha_dev_change_mtu(struct net_device *dev, int mtu)
1709+
{
1710+
struct airoha_gdm_port *port = netdev_priv(dev);
1711+
struct airoha_eth *eth = port->qdma->eth;
1712+
u32 len = ETH_HLEN + mtu + ETH_FCS_LEN;
1713+
1714+
airoha_fe_rmw(eth, REG_GDM_LEN_CFG(port->id),
1715+
GDM_LONG_LEN_MASK,
1716+
FIELD_PREP(GDM_LONG_LEN_MASK, len));
1717+
WRITE_ONCE(dev->mtu, mtu);
1718+
1719+
return 0;
1720+
}
1721+
17081722
static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb,
17091723
struct net_device *sb_dev)
17101724
{
@@ -2400,6 +2414,7 @@ static const struct net_device_ops airoha_netdev_ops = {
24002414
.ndo_init = airoha_dev_init,
24012415
.ndo_open = airoha_dev_open,
24022416
.ndo_stop = airoha_dev_stop,
2417+
.ndo_change_mtu = airoha_dev_change_mtu,
24032418
.ndo_select_queue = airoha_dev_select_queue,
24042419
.ndo_start_xmit = airoha_dev_xmit,
24052420
.ndo_get_stats64 = airoha_dev_get_stats64,

0 commit comments

Comments
 (0)