From: Antoine Tenart <atenart@kernel.org>
To: davem@davemloft.net, kuba@kernel.org, pshelar@ovn.org,
dsahern@kernel.org
Cc: Antoine Tenart <atenart@kernel.org>,
netdev@vger.kernel.org, dev@openvswitch.org, ltomasbo@redhat.com,
echaudro@redhat.com
Subject: [PATCH net-next] openvswitch: allow linking a VRF to an OVS bridge
Date: Mon, 20 Sep 2021 17:34:54 +0200 [thread overview]
Message-ID: <20210920153454.433252-1-atenart@kernel.org> (raw)
VRF devices are prevented from being added to upper devices since commit
1017e0987117 ("vrf: prevent adding upper devices") as they set the
IFF_NO_RX_HANDLER flag. However attaching a VRF to an OVS bridge is a
valid use case[1].
Allow a VRF device to be attached to an OVS bridge by having an OVS
specific tweak. This approach allows not to change a valid logic
elsewhere and the IFF_NO_RX_HANDLER limitation still applies for non-OVS
upper devices, even after a VRF was unlinked from an OVS bridge.
(Patch not sent as a fix as the commit introducing the limitation is not
recent).
[1] https://ltomasbo.wordpress.com/2021/06/25/openstack-networking-with-evpn/
Signed-off-by: Antoine Tenart <atenart@kernel.org>
---
Hi all,
I thought about other ways to fix this but did not want to add yet
another flag, nor to add specific logic outside of net/openvswitch/. A
custom netdev_rx_handler_register having priv_flags as a parameter could
also have been added, but again that seemed a bit invasive.
There might be questions about the setup in which a VRF is linked to an
OVS bridge; I cc'ed Luis Tomás who wrote the article.
Thanks,
Antoine
net/openvswitch/vport-netdev.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
index 8e1a88f13622..e76b2477d384 100644
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -75,6 +75,7 @@ static struct net_device *get_dpdev(const struct datapath *dp)
struct vport *ovs_netdev_link(struct vport *vport, const char *name)
{
+ unsigned int saved_flags;
int err;
vport->dev = dev_get_by_name(ovs_dp_get_net(vport->dp), name);
@@ -98,8 +99,17 @@ struct vport *ovs_netdev_link(struct vport *vport, const char *name)
if (err)
goto error_unlock;
+ /* While IFF_NO_RX_HANDLER is rightly set for l3 masters (VRF) as they
+ * don't work with upper devices, they can be attached to OVS bridges.
+ */
+ saved_flags = vport->dev->priv_flags;
+ if (netif_is_l3_master(vport->dev))
+ vport->dev->priv_flags &= ~IFF_NO_RX_HANDLER;
+
err = netdev_rx_handler_register(vport->dev, netdev_frame_hook,
vport);
+ vport->dev->priv_flags = saved_flags;
+
if (err)
goto error_master_upper_dev_unlink;
--
2.31.1
next reply other threads:[~2021-09-20 15:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-20 15:34 Antoine Tenart [this message]
2021-09-20 15:45 ` [PATCH net-next] openvswitch: allow linking a VRF to an OVS bridge David Ahern
2021-09-21 8:12 ` Luis Tomas Bolivar
2021-09-21 11:20 ` Luis Tomas Bolivar
2021-09-21 11:40 ` Antoine Tenart
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=20210920153454.433252-1-atenart@kernel.org \
--to=atenart@kernel.org \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=dsahern@kernel.org \
--cc=echaudro@redhat.com \
--cc=kuba@kernel.org \
--cc=ltomasbo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@ovn.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