All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v3] net: macb: remove change_mtu callback
@ 2024-03-11 15:43 thomas.perrot
  2024-03-11 23:17 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: thomas.perrot @ 2024-03-11 15:43 UTC (permalink / raw)
  To: Nicolas Ferre, Claudiu Beznea, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Thomas Perrot

From: Thomas Perrot <thomas.perrot@bootlin.com>

Because it doesn't allow MTU changes when the interface is up, although
it is not necessary.

This callback has been added to add in a first implementation of the Jumbo
support [1],since it has been reworked and moved to the probe [2].

With this patch the core will set the MTU, regardless of if the interface
is up or not.

[1] commit a5898ea09aad ("net: macb: Add change_mtu callback with
    jumbo support")
[2] commit 44770e1180de ("ethernet: use core min/max MTU checking")

Fixes: 44770e1180de ("ethernet: use core min/max MTU checking")
Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
---

Changes since v3:
 - Update prefix
 - Rebase on net
 - Add tag Fixes

Changes since v2:
 - Update the commit message.

 drivers/net/ethernet/cadence/macb_main.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 898debfd4db3..0532215e5236 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3017,16 +3017,6 @@ static int macb_close(struct net_device *dev)
 	return 0;
 }

-static int macb_change_mtu(struct net_device *dev, int new_mtu)
-{
-	if (netif_running(dev))
-		return -EBUSY;
-
-	dev->mtu = new_mtu;
-
-	return 0;
-}
-
 static int macb_set_mac_addr(struct net_device *dev, void *addr)
 {
 	int err;
@@ -3897,7 +3887,6 @@ static const struct net_device_ops macb_netdev_ops = {
 	.ndo_get_stats		= macb_get_stats,
 	.ndo_eth_ioctl		= macb_ioctl,
 	.ndo_validate_addr	= eth_validate_addr,
-	.ndo_change_mtu		= macb_change_mtu,
 	.ndo_set_mac_address	= macb_set_mac_addr,
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	.ndo_poll_controller	= macb_poll_controller,
--
2.44.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] net: macb: remove change_mtu callback
  2024-03-11 15:43 [PATCH net v3] net: macb: remove change_mtu callback thomas.perrot
@ 2024-03-11 23:17 ` Jakub Kicinski
  2024-03-13 13:39   ` Thomas Perrot
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2024-03-11 23:17 UTC (permalink / raw)
  To: thomas.perrot
  Cc: Nicolas Ferre, Claudiu Beznea, David S . Miller, Eric Dumazet,
	Paolo Abeni, netdev, linux-kernel

On Mon, 11 Mar 2024 16:43:15 +0100 thomas.perrot@bootlin.com wrote:
> Because it doesn't allow MTU changes when the interface is up, although
> it is not necessary.
> 
> This callback has been added to add in a first implementation of the Jumbo
> support [1],since it has been reworked and moved to the probe [2].
> 
> With this patch the core will set the MTU, regardless of if the interface
> is up or not.
> 
> [1] commit a5898ea09aad ("net: macb: Add change_mtu callback with
>     jumbo support")
> [2] commit 44770e1180de ("ethernet: use core min/max MTU checking")
> 
> Fixes: 44770e1180de ("ethernet: use core min/max MTU checking")

static void macb_init_rx_buffer_size(struct macb *bp, size_t size)
{
	if (!macb_is_gem(bp)) {
		bp->rx_buffer_size = MACB_RX_BUFFER_SIZE;
	} else {
		bp->rx_buffer_size = size;

where size is:

	size_t bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + NET_IP_ALIGN;

I guess you tested this on a platform where !macb_is_gem(bp) ?
Otherwise the buffer size seems to be based on MTU and the proposed
change won't be correct.
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] net: macb: remove change_mtu callback
  2024-03-11 23:17 ` Jakub Kicinski
@ 2024-03-13 13:39   ` Thomas Perrot
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Perrot @ 2024-03-13 13:39 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Nicolas Ferre, Claudiu Beznea, David S . Miller, Eric Dumazet,
	Paolo Abeni, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]

Hello,

On Mon, 2024-03-11 at 16:17 -0700, Jakub Kicinski wrote:
> On Mon, 11 Mar 2024 16:43:15 +0100 thomas.perrot@bootlin.com wrote:
> > Because it doesn't allow MTU changes when the interface is up,
> > although
> > it is not necessary.
> > 
> > This callback has been added to add in a first implementation of
> > the Jumbo
> > support [1],since it has been reworked and moved to the probe [2].
> > 
> > With this patch the core will set the MTU, regardless of if the
> > interface
> > is up or not.
> > 
> > [1] commit a5898ea09aad ("net: macb: Add change_mtu callback with
> >     jumbo support")
> > [2] commit 44770e1180de ("ethernet: use core min/max MTU checking")
> > 
> > Fixes: 44770e1180de ("ethernet: use core min/max MTU checking")
> 
> static void macb_init_rx_buffer_size(struct macb *bp, size_t size)
> {
> 	if (!macb_is_gem(bp)) {
> 		bp->rx_buffer_size = MACB_RX_BUFFER_SIZE;
> 	} else {
> 		bp->rx_buffer_size = size;
> 
> where size is:
> 
> 	size_t bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN +
> NET_IP_ALIGN;
> 
> I guess you tested this on a platform where !macb_is_gem(bp) ?

Thank you for your review, indeed that won’t be correct on GEM in when
the MTU used to initialize the RX buffer is lower than the new MTU.

So, I will suggest another patch with an acceptable solution.

Kind regards,
Thomas Perrot

> Otherwise the buffer size seems to be based on MTU and the proposed
> change won't be correct.

-- 
Thomas Perrot, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-13 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 15:43 [PATCH net v3] net: macb: remove change_mtu callback thomas.perrot
2024-03-11 23:17 ` Jakub Kicinski
2024-03-13 13:39   ` Thomas Perrot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.