From: Jeremy Kerr <jk@codeconstruct.com.au>
To: netdev@vger.kernel.org
Cc: Jiri Slaby <jirislaby@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Matt Johnston <matt@codeconstruct.com.au>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 2/3] mctp: serial: enforce fixed MTU
Date: Tue, 23 Nov 2021 20:50:41 +0800 [thread overview]
Message-ID: <20211123125042.2564114-3-jk@codeconstruct.com.au> (raw)
In-Reply-To: <20211123125042.2564114-1-jk@codeconstruct.com.au>
The current serial driver requires a maximum MTU of 68, and it doesn't
make sense to set a MTU below the MCTP-required baseline (of 68) either.
This change sets the min_mtu & max_mtu of the mctp netdev, essentially
disallowing changes. By using these instead of a ndo_change_mtu op, we
get the netlink extacks reported too.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
drivers/net/mctp/mctp-serial.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/mctp/mctp-serial.c b/drivers/net/mctp/mctp-serial.c
index c958d773a82a..5687ad3220cd 100644
--- a/drivers/net/mctp/mctp-serial.c
+++ b/drivers/net/mctp/mctp-serial.c
@@ -410,7 +410,14 @@ static const struct net_device_ops mctp_serial_netdev_ops = {
static void mctp_serial_setup(struct net_device *ndev)
{
ndev->type = ARPHRD_MCTP;
+
+ /* we limit at the fixed MTU, which is also the MCTP-standard
+ * baseline MTU, so is also our minimum
+ */
ndev->mtu = MCTP_SERIAL_MTU;
+ ndev->max_mtu = MCTP_SERIAL_MTU;
+ ndev->min_mtu = MCTP_SERIAL_MTU;
+
ndev->hard_header_len = 0;
ndev->addr_len = 0;
ndev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
--
2.33.0
next prev parent reply other threads:[~2021-11-23 12:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 12:50 [PATCH net-next 0/3] mctp serial minor fixes Jeremy Kerr
2021-11-23 12:50 ` [PATCH net-next 1/3] mctp: serial: cancel tx work on ldisc close Jeremy Kerr
2021-11-24 5:36 ` Jiri Slaby
2021-11-24 6:35 ` Jiri Slaby
2021-11-24 6:38 ` Jeremy Kerr
2021-11-25 5:43 ` Jiri Slaby
2021-11-25 5:55 ` Jeremy Kerr
2021-11-23 12:50 ` Jeremy Kerr [this message]
2021-11-23 12:50 ` [PATCH net-next 3/3] mctp: serial: remove unnecessary ldisc data check Jeremy Kerr
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=20211123125042.2564114-3-jk@codeconstruct.com.au \
--to=jk@codeconstruct.com.au \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kuba@kernel.org \
--cc=matt@codeconstruct.com.au \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).