From: Jakub Kicinski <kuba@kernel.org>
To: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: netdev@vger.kernel.org,
Horatiu Vultur <horatiu.vultur@microchip.com>,
linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net 2/2] net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP
Date: Mon, 28 Dec 2020 14:26:53 -0800 [thread overview]
Message-ID: <20201228142653.2987e42d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20201223144533.4145-3-rasmus.villemoes@prevas.dk>
On Wed, 23 Dec 2020 15:45:33 +0100 Rasmus Villemoes wrote:
> It's not true that switchdev_port_obj_notify() only inspects the
> ->handled field of "struct switchdev_notifier_port_obj_info" if
> call_switchdev_blocking_notifiers() returns 0 - there's a WARN_ON()
> triggering for a non-zero return combined with ->handled not being
> true. But the real problem here is that -EOPNOTSUPP is not being
> properly handled.
>
> The wrapper functions switchdev_handle_port_obj_add() et al change a
> return value of -EOPNOTSUPP to 0, and the treatment of ->handled in
> switchdev_port_obj_notify() seems to be designed to change that back
> to -EOPNOTSUPP in case nobody actually acted on the notifier (i.e.,
> everybody returned -EOPNOTSUPP).
>
> Currently, as soon as some device down the stack passes the check_cb()
> check, ->handled gets set to true, which means that
> switchdev_port_obj_notify() cannot actually ever return -EOPNOTSUPP.
>
> This, for example, means that the detection of hardware offload
> support in the MRP code is broken - br_mrp_set_ring_role() always ends
> up setting mrp->ring_role_offloaded to 1, despite not a single
> mainline driver implementing any of the SWITCHDEV_OBJ_ID*_MRP. So
> since the MRP code thinks the generation of MRP test frames has been
> offloaded, no such frames are actually put on the wire.
>
> So, continue to set ->handled true if any callback returns success or
> any error distinct from -EOPNOTSUPP. But if all the callbacks return
> -EOPNOTSUPP, make sure that ->handled stays false, so the logic in
> switchdev_port_obj_notify() can propagate that information.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Please make sure you CC the folks who may have something to say about
this - Jiri, Ivan, Ido, Florian, etc.
next prev parent reply other threads:[~2020-12-28 23:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-23 14:45 [PATCH net 0/2] MRP without hardware offload? Rasmus Villemoes
2020-12-23 14:45 ` [PATCH net 1/2] net: mrp: fix definitions of MRP test packets Rasmus Villemoes
2020-12-23 17:59 ` Horatiu Vultur
2020-12-23 18:41 ` Andrew Lunn
2020-12-23 19:22 ` Horatiu Vultur
2020-12-28 22:24 ` Jakub Kicinski
2021-01-03 13:29 ` Horatiu Vultur
2021-01-19 15:42 ` Rasmus Villemoes
2021-01-19 17:45 ` Jakub Kicinski
2020-12-23 14:45 ` [PATCH net 2/2] net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP Rasmus Villemoes
2020-12-28 22:26 ` Jakub Kicinski [this message]
2020-12-23 18:14 ` [PATCH net 0/2] MRP without hardware offload? Horatiu Vultur
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=20201228142653.2987e42d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=horatiu.vultur@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rasmus.villemoes@prevas.dk \
/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).