examples/mi-conf: account for MCTP header in route MTU
authorJeremy Kerr <jk@codeconstruct.com.au>
Mon, 24 Oct 2022 10:26:41 +0000 (18:26 +0800)
committerJeremy Kerr <jk@codeconstruct.com.au>
Mon, 24 Oct 2022 10:28:08 +0000 (18:28 +0800)
The NVMe specs don't include the MCTP header when referring to the MCTP
MTUs; we need to do so when setting the Linux route MTU.

This change uses the header-included value when setting the route MTU
via mctpd over dbus.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
examples/mi-conf.c

index cdded52088cc17dec59ef538dc21b959c6212868..00dbc26f00a7cacd3e289b2915e60d814852b3cc 100644 (file)
@@ -92,6 +92,13 @@ int set_local_mtu(sd_bus *bus, unsigned int net, uint8_t eid, uint32_t mtu)
                return -1;
        }
 
+       /* The NVMe-MI interfaces refer to their MTU as *not* including the
+        * 4-byte MCTP header, whereas the MCTP specs *do* include it. When
+        * we're setting the route MTU, we're using to the MCTP-style MTU,
+        * which needs the extra four bytes included
+        */
+       mtu += 4;
+
        rc = sd_bus_call_method(bus, MCTP_DBUS_NAME, ep_path,
                                MCTP_DBUS_EP_IFACE, "SetMTU", &err, &resp,
                                "u", mtu);