Skip to contentSkip to conversation

mctp serial minor fixes

PATCH Applied Jeremy Kerr 2 participants 5 messages Nov 25, 2021 – Nov 26, 2021

Subsystems (3)
lore
Share & tools
lore

Jeremy Kerr

author maintainer
#0 lore raw

v2 cover mctp serial minor fixes

We had a few minor fixes queued for a v4 of the original series, so they're sent here as separate changes.

Cheers,

Jeremy

---
v2:
- fix ordering of cancel_work vs. unregister_netdev.

Jeremy Kerr (3):
mctp: serial: cancel tx work on ldisc close
mctp: serial: enforce fixed MTU
mctp: serial: remove unnecessary ldisc data check

 drivers/net/mctp/mctp-serial.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH v2 1/3 mctp: serial: cancel tx work on ldisc close

We want to ensure that the tx work has finished before returning from the ldisc close op, so do a synchronous cancel.

---
v2:
- cancel work after netdev unregister

---
 drivers/net/mctp/mctp-serial.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/mctp/mctp-serial.c +1 -0
index 9ac0e187f36e..85b407f4df11 100644
@@ -479,6 +479,7 @@ static void mctp_serial_close(struct tty_struct *tty)
 	int idx = dev->idx;
 
 	unregister_netdev(dev->netdev);
+	cancel_work_sync(&dev->tx_work);
 	ida_free(&mctp_serial_ida, idx);
 }
 
Signature · 1 line
2.30.2
author maintainer
#2 lore raw

PATCH v2 2/3 mctp: serial: enforce fixed MTU

In reply to Jeremy Kerr

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.

---
 drivers/net/mctp/mctp-serial.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/mctp/mctp-serial.c +7 -0
index 85b407f4df11..b0e14a63b10d 100644
@@ -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;
Signature · 1 line
2.30.2
author maintainer
#3 lore raw

PATCH v2 3/3 mctp: serial: remove unnecessary ldisc data check

In reply to Jeremy Kerr

Jiri assures me that a ldisc->open with tty->disc_data set should never happen, so this check doesn't do anything.

---
 drivers/net/mctp/mctp-serial.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/mctp/mctp-serial.c +0 -3
index b0e14a63b10d..eaa6fb3224bc 100644
@@ -439,9 +439,6 @@ static int mctp_serial_open(struct tty_struct *tty)
 	if (!tty->ops->write)
 		return -EOPNOTSUPP;
 
-	if (tty->disc_data)
-		return -EEXIST;
-
 	idx = ida_alloc(&mctp_serial_ida, GFP_KERNEL);
 	if (idx < 0)
 		return idx;
Signature · 1 line
2.30.2
#4 lore raw
In reply to Jeremy Kerr
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 25 Nov 2021 14:07:36 +0800 you wrote:

We had a few minor fixes queued for a v4 of the original series, so they're sent here as separate changes.

Cheers,

Jeremy

[...]

Here is the summary with links:
- [net-next,v2,1/3] mctp: serial: cancel tx work on ldisc close

    https://git.kernel.org/netdev/net-next/c/7bd9890f3d74
  - [net-next,v2,2/3] mctp: serial: enforce fixed MTU
    https://git.kernel.org/netdev/net-next/c/d154cd078ac2
  - [net-next,v2,3/3] mctp: serial: remove unnecessary ldisc data check
    https://git.kernel.org/netdev/net-next/c/d1c99f365a1f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html