Rename the function lan966x_fdma_get_max_mtu to lan966x_get_max_mtu because it doesn't have anything to do with fdma. Because of this rename, the function is moved also in a different file. Signed-off-by: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx> --- .../ethernet/microchip/lan966x/lan966x_fdma.c | 22 +------------------ .../ethernet/microchip/lan966x/lan966x_main.c | 19 ++++++++++++++++ .../ethernet/microchip/lan966x/lan966x_main.h | 2 ++ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c index 1dc4e6ace8b56..e0b9cd289994f 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c @@ -661,25 +661,6 @@ int lan966x_fdma_xmit(struct sk_buff *skb, __be32 *ifh, struct net_device *dev) return err; } -static int lan966x_fdma_get_max_mtu(struct lan966x *lan966x) -{ - int max_mtu = 0; - int i; - - for (i = 0; i < lan966x->num_phys_ports; ++i) { - int mtu; - - if (!lan966x->ports[i]) - continue; - - mtu = lan966x->ports[i]->dev->mtu; - if (mtu > max_mtu) - max_mtu = mtu; - } - - return max_mtu; -} - static int lan966x_qsys_sw_status(struct lan966x *lan966x) { return lan_rd(lan966x, QSYS_SW_STATUS(CPU_PORT)); @@ -749,8 +730,7 @@ int lan966x_fdma_change_mtu(struct lan966x *lan966x) int err; u32 val; - max_mtu = lan966x_fdma_get_max_mtu(lan966x); - max_mtu += IFH_LEN_BYTES; + max_mtu = lan966x_get_max_mtu(lan966x); if (round_up(max_mtu, PAGE_SIZE) / PAGE_SIZE - 1 == lan966x->rx.page_order) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index 6fd857880d3fe..4fa8c07039d9f 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -379,6 +379,25 @@ static netdev_tx_t lan966x_port_xmit(struct sk_buff *skb, return err; } +int lan966x_get_max_mtu(struct lan966x *lan966x) +{ + int max_mtu = 0; + int i; + + for (i = 0; i < lan966x->num_phys_ports; ++i) { + int mtu; + + if (!lan966x->ports[i]) + continue; + + mtu = lan966x->ports[i]->dev->mtu; + if (mtu > max_mtu) + max_mtu = mtu; + } + + return max_mtu + IFH_LEN_BYTES; +} + static int lan966x_port_change_mtu(struct net_device *dev, int new_mtu) { struct lan966x_port *port = netdev_priv(dev); diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h index 9656071b8289e..e05036841f825 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h @@ -333,6 +333,8 @@ void lan966x_unregister_notifier_blocks(void); bool lan966x_hw_offload(struct lan966x *lan966x, u32 port, struct sk_buff *skb); +int lan966x_get_max_mtu(struct lan966x *lan966x); + void lan966x_ifh_get_src_port(void *ifh, u64 *src_port); void lan966x_ifh_get_timestamp(void *ifh, u64 *timestamp); -- 2.38.0