From: Simon Horman <horms@kernel.org>
To: subash.a.kasiviswanathan@oss.qualcomm.com
Cc: netdev-bot+sashiko@kernel.org, sean.tranchetti@oss.qualcomm.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v5 5/5] net: qualcomm: rmnet: Resize endpoints with dev_set_mtu() and restore on failure
Date: Mon, 23 Nov 2026 14:33:39 +0000 [thread overview]
Message-ID: <20261123143339.GC31322@horms.kernel.org> (raw)
In-Reply-To: <000101dd79d0$1e2a73c0$5a7f5b40$@oss.qualcomm.com>
On Sat, Nov 21, 2026 at 08:51:04AM -0700, subash.a.kasiviswanathan@oss.qualcomm.com wrote:
> > -----Original Message-----
> > From: netdev-bot+sashiko@kernel.org <netdev-bot+sashiko@kernel.org>
> > Sent: Saturday, November 21, 2026 12:04 AM
> > To: subash.a.kasiviswanathan@oss.qualcomm.com
> > Cc: sean.tranchetti@oss.qualcomm.com; andrew+netdev@lunn.ch;
> > davem@davemloft.net; edumazet@kernel.org; kuba@kernel.org;
> > pabeni@redhat.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH net v5 5/5] net: qualcomm: rmnet: Resize endpoints with
> > dev_set_mtu() and restore on failure
> >
> > Thank you for your contribution! Sashiko AI review found 2 potential
> > issue(s) to consider.
> >
> > Critical: 0 · High: 0 · Medium: 1 · Low: 1
> >
> > If you believe none of the issues are legitimate, please reply to each
> > issue of Medium severity or higher and explain why the AI is wrong.
> > If any of them are legitimate and you plan to respin, please let patchwork
> > know by including "pw-bot: cr" as a separate line at the end of your reply
> > (one such reply per series is enough).
> >
> > - [Medium] rmnet_vnd_update_dev_mtu()
> > (drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:447-473) now
> > shrinks…
> > - [Low] The commit message opens with "When the real device MTU or the
> > data format requires a smaller MTU, existing endpoints are shrunk by…
> >
> > --
> >
> > net: qualcomm: rmnet: Resize endpoints with dev_set_mtu() and restore on
> > failure
> >
> > This commit changes rmnet_vnd_update_dev_mtu() so it shrinks existing
> > endpoints with dev_set_mtu() instead of calling the ndo directly. As a
> > result, MTU notifiers and link notifications are now delivered. If resizing
> > an endpoint fails, the endpoints already resized are put back to their
> > saved MTU, and the original error is returned.
> >
> > > When the real device MTU or the data format requires a smaller MTU,
> > > existing endpoints are shrunk by writing dev->mtu directly. No MTU
> > > notifiers run and userspace gets no link notification.
> >
> > [Severity: Low]
> > Is the part about the real device MTU accurate?
> >
> > rmnet_vnd_update_dev_mtu() has only two callers, rmnet_newlink() and
> > rmnet_changelink(). The changelink call only happens when
> > IFLA_RMNET_FLAGS
> > is present, which means a data format change.
> >
> > When the real device MTU changes, rmnet_config_notify_cb() only validates
> > the new value and vetoes it if needed:
> >
> > drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:rmnet_config_notify_
> > cb() {
> > ...
> > case NETDEV_CHANGEMTU:
> > if (rmnet_vnd_validate_real_dev_mtu(real_dev))
> > return NOTIFY_BAD;
> > ...
> > }
> >
> > So endpoints are never shrunk on that path, either before or after this
> > patch.
> >
> > Could the commit message be limited to the data format case? As written,
> > it suggests this fix also covers the real device MTU path.
> >
> > > diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> > b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> > > index 8bf87c5ecb43b..dce436e4c6305 100644
> > > --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> > > +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> > > @@ -433,24 +433,42 @@ int rmnet_vnd_validate_real_dev_mtu(struct
> > net_device *real_dev)
> >
> > [ ... ]
> >
> > > hash_for_each_safe(port->muxed_ep, bkt_ep, tmp_ep, ep, hlnode) {
> > > - if (ep->egress_dev->mtu <= new_mtu)
> > > + ep->saved_mtu = ep->egress_dev->mtu;
> > > + if (ep->saved_mtu <= new_mtu)
> > > continue;
> > >
> > > - err = rmnet_vnd_change_mtu(ep->egress_dev, new_mtu);
> > > - if (err)
> > > - return err;
> > > + err = dev_set_mtu(ep->egress_dev, new_mtu);
> > > + if (err) {
> > > + fail_ep = ep;
> > > + break;
> > > + }
> > > }
> > >
> > > - return 0;
> > > + if (!err)
> > > + return 0;
> > > +
> > > + /* Restore the endpoints which were already resized. Failures here
> > > + * are ignored since the original error is the one to report.
> > > + */
> > > + hash_for_each_safe(port->muxed_ep, bkt_ep, tmp_ep, ep, hlnode) {
> > > + if (ep == fail_ep)
> > > + break;
> > > +
> > > + if (ep->egress_dev->mtu != ep->saved_mtu)
> > > + dev_set_mtu(ep->egress_dev, ep->saved_mtu);
> >
> > [Severity: Medium]
> > Does this restore undo everything the earlier dev_set_mtu() calls did?
> >
> > Now that the shrink goes through dev_set_mtu(), netif_set_mtu_ext() runs
> > the NETDEV_PRECHANGEMTU and NETDEV_CHANGEMTU notifier chains for
> > each
> > endpoint.
> >
> > A PRECHANGEMTU notifier can now veto the shrink. For example,
> > team_device_event() does this:
> >
> > drivers/net/team/team_core.c:team_device_event() {
> > ...
> > case NETDEV_PRECHANGEMTU:
> > /* Forbid to change mtu of underlaying device */
> > if (!port->team->port_mtu_change_allowed)
> > return NOTIFY_BAD;
> > ...
> > }
> >
> > Before this patch, the direct rmnet_vnd_change_mtu() call could not fail
> > here, because new_mtu < ep mtu <= real_dev->mtu - old headroom. So a
> > newlink or changelink with IFLA_RMNET_FLAGS that used to succeed can now
> > return an error.
> >
> > If the veto happens on a later endpoint, the CHANGEMTU notifiers have
> > already run on the earlier ones. If the temporary new_mtu was below
> > IPV6_MIN_MTU, addrconf_notify() tore down IPv6 on those endpoints:
> >
> > net/ipv6/addrconf.c:addrconf_notify() {
> > ...
> > case NETDEV_CHANGEMTU:
> > /* if MTU under IPV6_MIN_MTU stop IPv6 on this interface.
> > */
> > if (dev->mtu < IPV6_MIN_MTU) {
> > addrconf_ifdown(dev, dev != net->loopback_dev);
> > break;
> > }
> > ...
> > }
> >
> > In the same way, inetdev_event() falls through to inetdev_destroy() when
> > the MTU is below the IPv4 minimum.
> >
> > Restoring saved_mtu only creates a new, empty inet6_dev or in_device. The
> > configured addresses, routes and per-device sysctls are still lost, even
> > though the request returned an error.
> >
> > For example, take a real_dev MTU of 1284 with no checksum offload (4 bytes
> > of headroom). Endpoint A has a lower mux_id, has IPv6 configured and is at
> > 1280. Endpoint B has a higher mux_id, is a team port and is also at 1280. A
> > changelink that sets CKSUMV5 (8 bytes of headroom) gives new_mtu = 1276:
> >
> > dev_set_mtu(A, 1276) -> addrconf_ifdown(A, true)
> > dev_set_mtu(B, 1276) -> vetoed by team_device_event(), -EPERM
> > dev_set_mtu(A, 1280) -> A comes back with no IPv6 addresses
> >
> > Userspace also gets a shrink-then-grow pair of RTM_NEWLINK events for A,
> > for a request that failed.
> >
> > The commit message says a failed request "does not leave some of them
> > shrunk". That holds for the MTU values but not for the L3 state.
> >
> > Is this partial rollback intended? If so, should the commit message
> > mention the new veto failures and the lost L3 state on endpoints that were
> > already resized?
> >
> > > + }
> > > +
> > > + return err;
> > > }
> >
>
> Yes, partial rollback is expected here. The comment above the rollback logic already mentions that - "Failures here
> are ignored".
I assume that the motivation for taking this approach is that both avoiding
the need for rollback and performing a full rollback is somewhere between
difficult and impossible.
If so, I think the trade-off made in this patch is reasonable.
next prev parent reply other threads:[~2026-11-23 14:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 6:07 [PATCH net v5 0/5] net: qualcomm: rmnet: Update MTU handling during format changes Subash Abhinov Kasiviswanathan
2026-11-17 6:07 ` [PATCH net v5 1/5] net: qualcomm: rmnet: Account for V5 checksum header in headroom Subash Abhinov Kasiviswanathan
2026-11-17 6:07 ` [PATCH net v5 2/5] net: qualcomm: rmnet: Size the first device from the requested data format Subash Abhinov Kasiviswanathan
2026-11-21 7:04 ` netdev-bot+sashiko
2026-11-17 6:07 ` [PATCH net v5 3/5] net: qualcomm: rmnet: Fix MTU underflow and clamp to the maximum packet size Subash Abhinov Kasiviswanathan
2026-11-21 7:04 ` netdev-bot+sashiko
2026-11-23 14:41 ` Simon Horman
2026-11-17 6:07 ` [PATCH net v5 4/5] net: qualcomm: rmnet: Publish data format and mux_id only after the MTU update Subash Abhinov Kasiviswanathan
2026-11-17 6:07 ` [PATCH net v5 5/5] net: qualcomm: rmnet: Resize endpoints with dev_set_mtu() and restore on failure Subash Abhinov Kasiviswanathan
2026-11-21 7:04 ` netdev-bot+sashiko
2026-11-21 15:51 ` subash.a.kasiviswanathan
2026-11-23 14:33 ` Simon Horman [this message]
2026-11-23 14:35 ` Simon Horman
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=20261123143339.GC31322@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sean.tranchetti@oss.qualcomm.com \
--cc=subash.a.kasiviswanathan@oss.qualcomm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox