All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarod Wilson <jarod@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jarod Wilson <jarod@redhat.com>,
	netdev@vger.kernel.org, linux-s390@vger.kernel.org,
	Ursula Braun <ubraun@linux.vnet.ibm.com>
Subject: [PATCH net-next v2 8/9] s390/net: use net core MTU range checking
Date: Thu, 20 Oct 2016 13:55:23 -0400	[thread overview]
Message-ID: <20161020175524.6184-9-jarod@redhat.com> (raw)
In-Reply-To: <20161020175524.6184-1-jarod@redhat.com>

ctcm:
- min_mtu = 576, max_mtu = 65527

netiucv:
- min_mtu = 576, max_mtu = 65535

qeth:
- min_mtu = 64, max_mtu = 65535

CC: netdev@vger.kernel.org
CC: linux-s390@vger.kernel.org
CC: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 drivers/s390/net/ctcm_main.c      |  5 ++---
 drivers/s390/net/netiucv.c        | 24 ++----------------------
 drivers/s390/net/qeth_core_main.c |  4 ----
 drivers/s390/net/qeth_l2_main.c   |  2 ++
 drivers/s390/net/qeth_l3_main.c   |  2 ++
 5 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index ad17fc5..ac65f12 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -1032,9 +1032,6 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu)
 	struct ctcm_priv *priv;
 	int max_bufsize;
 
-	if (new_mtu < 576 || new_mtu > 65527)
-		return -EINVAL;
-
 	priv = dev->ml_priv;
 	max_bufsize = priv->channel[CTCM_READ]->max_bufsize;
 
@@ -1123,6 +1120,8 @@ void static ctcm_dev_setup(struct net_device *dev)
 	dev->type = ARPHRD_SLIP;
 	dev->tx_queue_len = 100;
 	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
+	dev->min_mtu = 576;
+	dev->max_mtu = 65527;
 }
 
 /*
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 2f0f391..2981024 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -1428,27 +1428,6 @@ static struct net_device_stats *netiucv_stats (struct net_device * dev)
 	return &priv->stats;
 }
 
-/**
- * netiucv_change_mtu
- * @dev: Pointer to interface struct.
- * @new_mtu: The new MTU to use for this interface.
- *
- * Sets MTU of an interface.
- *
- * Returns 0 on success, -EINVAL if MTU is out of valid range.
- *         (valid range is 576 .. NETIUCV_MTU_MAX).
- */
-static int netiucv_change_mtu(struct net_device * dev, int new_mtu)
-{
-	IUCV_DBF_TEXT(trace, 3, __func__);
-	if (new_mtu < 576 || new_mtu > NETIUCV_MTU_MAX) {
-		IUCV_DBF_TEXT(setup, 2, "given MTU out of valid range\n");
-		return -EINVAL;
-	}
-	dev->mtu = new_mtu;
-	return 0;
-}
-
 /*
  * attributes in sysfs
  */
@@ -1986,12 +1965,13 @@ static const struct net_device_ops netiucv_netdev_ops = {
 	.ndo_stop		= netiucv_close,
 	.ndo_get_stats		= netiucv_stats,
 	.ndo_start_xmit		= netiucv_tx,
-	.ndo_change_mtu	   	= netiucv_change_mtu,
 };
 
 static void netiucv_setup_netdevice(struct net_device *dev)
 {
 	dev->mtu	         = NETIUCV_MTU_DEFAULT;
+	dev->min_mtu		 = 576;
+	dev->max_mtu		 = NETIUCV_MTU_MAX;
 	dev->destructor          = netiucv_free_netdevice;
 	dev->hard_header_len     = NETIUCV_HDRLEN;
 	dev->addr_len            = 0;
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 20cf296..e335583 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -4202,10 +4202,6 @@ int qeth_change_mtu(struct net_device *dev, int new_mtu)
 	sprintf(dbf_text, "%8x", new_mtu);
 	QETH_CARD_TEXT(card, 4, dbf_text);
 
-	if (new_mtu < 64)
-		return -EINVAL;
-	if (new_mtu > 65535)
-		return -EINVAL;
 	if ((!qeth_is_supported(card, IPA_IP_FRAGMENTATION)) &&
 	    (!qeth_mtu_is_valid(card, new_mtu)))
 		return -EINVAL;
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index bb27058..9c921c28 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -1107,6 +1107,8 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
 	card->dev->ml_priv = card;
 	card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
 	card->dev->mtu = card->info.initial_mtu;
+	card->dev->min_mtu = 64;
+	card->dev->max_mtu = ETH_MAX_MTU;
 	card->dev->netdev_ops = &qeth_l2_netdev_ops;
 	card->dev->ethtool_ops =
 		(card->info.type != QETH_CARD_TYPE_OSN) ?
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 272d9e7..ac37d05 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -3140,6 +3140,8 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
 	card->dev->ml_priv = card;
 	card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
 	card->dev->mtu = card->info.initial_mtu;
+	card->dev->min_mtu = 64;
+	card->dev->max_mtu = ETH_MAX_MTU;
 	card->dev->ethtool_ops = &qeth_l3_ethtool_ops;
 	card->dev->features |=	NETIF_F_HW_VLAN_CTAG_TX |
 				NETIF_F_HW_VLAN_CTAG_RX |
-- 
2.10.0

  parent reply	other threads:[~2016-10-20 17:56 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19  2:33 [PATCH net-next 0/6] net: use core MTU range checking everywhere Jarod Wilson
2016-10-19  2:33 ` [PATCH net-next 1/6] net: use core MTU range checking in USB NIC drivers Jarod Wilson
2016-10-19  2:33 ` [PATCH net-next 2/6] net: use core MTU range checking in wireless drivers Jarod Wilson
2016-10-19  7:38   ` Johannes Berg
2016-10-19 14:27     ` Jarod Wilson
2016-10-19 14:28       ` Johannes Berg
2016-10-19  2:33 ` [PATCH net-next 3/6] net: use core MTU range checking in WAN drivers Jarod Wilson
2016-10-21 12:04   ` Krzysztof Hałasa
2016-10-19  2:33 ` [PATCH net-next 4/6] net: use core MTU range checking in core net infra Jarod Wilson
2016-10-19 12:17   ` Jiri Benc
2016-10-19 14:51     ` Jarod Wilson
2016-10-19 13:55   ` Sabrina Dubroca
2016-10-19 14:40     ` Jarod Wilson
2016-10-19 15:28       ` Sabrina Dubroca
2016-10-19 15:46         ` Jarod Wilson
2016-10-19  2:33 ` [PATCH net-next 5/6] net: use core MTU range checking in virt drivers Jarod Wilson
2016-10-19 13:06   ` Aaron Conole
2016-10-19 13:06   ` Aaron Conole
2016-10-19 13:59   ` Michael S. Tsirkin
2016-10-19 13:59     ` Michael S. Tsirkin
2016-10-19 14:03     ` Michael S. Tsirkin
2016-10-19 14:03       ` Michael S. Tsirkin
2016-10-19 14:17       ` Jarod Wilson
2016-10-19 14:17       ` Jarod Wilson
2016-10-19 14:15     ` Jarod Wilson
2016-10-19 14:15     ` Jarod Wilson
2016-10-19 14:07   ` Haiyang Zhang
2016-10-19 14:07     ` Haiyang Zhang via Virtualization
2016-10-19 14:23     ` Jarod Wilson
2016-10-19 14:23     ` Jarod Wilson
2016-10-19 14:23       ` Jarod Wilson
2016-10-19 22:21   ` Shrikrishna Khare
2016-10-19 22:21   ` Shrikrishna Khare
2016-10-19  2:33 ` Jarod Wilson
2016-10-19  2:33 ` [PATCH net-next 6/6] net: use core MTU range checking in misc drivers Jarod Wilson
2016-10-19 14:37   ` Robin Holt
2016-10-19 16:05   ` Sabrina Dubroca
2016-10-19 22:38     ` Stefan Richter
2016-10-20  3:16       ` Jarod Wilson
     [not found]         ` <20161020031641.GJ18569-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-22  9:36           ` Stefan Richter
2016-10-22  9:36             ` Stefan Richter
2016-10-22 18:51             ` Stefan Richter
2016-10-19 19:10 ` [PATCH net-next 0/6] net: use core MTU range checking everywhere David Miller
2016-10-19 19:29   ` Jarod Wilson
2016-10-20 17:55 ` [PATCH net-next v2 0/9] " Jarod Wilson
2016-10-20 17:55   ` [PATCH net-next v2 1/9] ethernet: use net core MTU range checking in more drivers Jarod Wilson
2016-10-20 17:55     ` Jarod Wilson
2016-10-20 17:55   ` [PATCH net-next v2 2/9] net: use core MTU range checking in USB NIC drivers Jarod Wilson
2016-10-20 17:55   ` [PATCH net-next v2 3/9] net: use core MTU range checking in wireless drivers Jarod Wilson
2016-10-20 18:22     ` Johannes Berg
2016-10-20 18:38       ` David Miller
2016-10-20 17:55   ` [PATCH net-next v2 4/9] net: use core MTU range checking in WAN drivers Jarod Wilson
2016-10-20 17:55   ` [PATCH net-next v2 5/9] net: use core MTU range checking in core net infra Jarod Wilson
2016-10-20 17:55   ` [PATCH net-next v2 6/9] net: use core MTU range checking in virt drivers Jarod Wilson
2016-10-20 17:55     ` Jarod Wilson
2016-10-20 18:05     ` Haiyang Zhang via Virtualization
2016-10-20 18:05     ` Haiyang Zhang
2016-10-20 18:05       ` Haiyang Zhang
2016-10-20 20:12       ` Kershner, David A
2016-10-20 20:12         ` Kershner, David A
2016-10-20 20:23     ` Michael S. Tsirkin
2016-10-21  2:37       ` Jarod Wilson
2016-10-21  2:37         ` Jarod Wilson
2016-10-21  3:36         ` Michael S. Tsirkin
2016-10-21  3:36           ` Michael S. Tsirkin
2016-10-21 13:24           ` Aaron Conole
2016-10-21 13:24             ` Aaron Conole
2016-10-20 20:23     ` Michael S. Tsirkin
2016-10-21 10:09     ` Wei Liu
2016-10-21 10:09     ` Wei Liu
2016-10-20 17:55   ` [PATCH net-next v2 7/9] net: use core MTU range checking in misc drivers Jarod Wilson
2016-10-20 17:55     ` Jarod Wilson
2016-10-21  6:52     ` Rémi Denis-Courmont
2016-10-21  6:52       ` Rémi Denis-Courmont
2016-10-21 16:22     ` Sebastian Reichel
2016-10-21 16:22       ` Sebastian Reichel
     [not found]     ` <20161020175524.6184-8-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-22  7:17       ` [net-next,v2,7/9] " Sven Eckelmann
2016-10-22  7:17         ` Sven Eckelmann
2016-10-22 19:16     ` [PATCH net-next v2 7/9] " Stefan Richter
2016-10-22 19:16       ` Stefan Richter
2016-10-22 19:27       ` Stefan Richter
2016-10-23  1:18         ` Jarod Wilson
2016-10-23 14:29           ` [PATCH net-next 1/2] firewire: net: fix maximum possible MTU Stefan Richter
2016-10-23 14:30             ` [PATCH net-next 2/2] firewire: net: set initial MTU = 1500 unconditionally, fix IPv6 on some CardBus cards Stefan Richter
2016-10-23 14:30               ` Stefan Richter
2016-10-24  1:50               ` Jarod Wilson
2016-10-24 12:26                 ` [PATCH net-next 2/2 v2] " Stefan Richter
2016-10-24 12:26                   ` Stefan Richter
2016-10-25  3:05                   ` Jarod Wilson
2016-10-26 21:29               ` [PATCH net-next 2/2] " David Miller
2016-10-26 21:29                 ` David Miller
2016-10-29 20:16               ` [PATCH net-next] firewire: net: really fix maximum possible MTU Stefan Richter
2016-10-30  3:01                 ` David Miller
2016-10-24  1:50             ` [PATCH net-next 1/2] firewire: net: " Jarod Wilson
2016-10-26 21:29             ` David Miller
2016-10-26 21:29               ` David Miller
2016-10-20 17:55   ` Jarod Wilson [this message]
2016-10-20 17:55   ` [PATCH net-next v2 9/9] ipv4/6: use core net MTU range checking Jarod Wilson
2016-10-20 18:53   ` [PATCH net-next v2 0/9] net: use core MTU range checking everywhere David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161020175524.6184-9-jarod@redhat.com \
    --to=jarod@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ubraun@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.