mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
dpif-netlink: Support rtnetlink port creation.
In order to be able to add those tunnels, we need to add code to create the tunnels and add them as NETDEV vports. And when there is no support to create them, we need to fallback to compatibility code and add them as tunnel vports. When removing those tunnels, we need to remove the interfaces as well, and detecting the right type might be important, at least to distinguish the tunnel vports that we should remove and the interfaces that we shouldn't. Co-authored-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Eric Garver <e@erig.me> Signed-off-by: Joe Stringer <joe@ovn.org>
This commit is contained in:
committed by
Joe Stringer
parent
20c57607b3
commit
c4e087530e
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "dpif-provider.h"
|
||||
#include "dpif-netlink-rtnl.h"
|
||||
#include "openvswitch/dynamic-string.h"
|
||||
#include "flow.h"
|
||||
#include "fat-rwlock.h"
|
||||
@@ -784,7 +785,7 @@ get_vport_type(const struct dpif_netlink_vport *vport)
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
static enum ovs_vport_type
|
||||
enum ovs_vport_type
|
||||
netdev_to_ovs_vport_type(const char *type)
|
||||
{
|
||||
if (!strcmp(type, "tap") || !strcmp(type, "system")) {
|
||||
@@ -947,8 +948,34 @@ dpif_netlink_port_add_compat(struct dpif_netlink *dpif, struct netdev *netdev,
|
||||
|
||||
}
|
||||
|
||||
static int OVS_UNUSED
|
||||
dpif_netlink_rtnl_port_create_and_add(struct dpif_netlink *dpif,
|
||||
struct netdev *netdev,
|
||||
odp_port_t *port_nop)
|
||||
OVS_REQ_WRLOCK(dpif->upcall_lock)
|
||||
{
|
||||
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
|
||||
char namebuf[NETDEV_VPORT_NAME_BUFSIZE];
|
||||
const char *name;
|
||||
int error;
|
||||
|
||||
error = dpif_netlink_rtnl_port_create(netdev);
|
||||
if (error) {
|
||||
if (error != EOPNOTSUPP) {
|
||||
VLOG_INFO_RL(&rl, "Failed to create %s with rtnetlink: %s",
|
||||
netdev_get_name(netdev), ovs_strerror(error));
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf);
|
||||
error = dpif_netlink_port_add__(dpif, name, OVS_VPORT_TYPE_NETDEV, NULL,
|
||||
port_nop);
|
||||
if (error) {
|
||||
dpif_netlink_rtnl_port_destroy(name, netdev_get_type(netdev));
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
dpif_netlink_port_add(struct dpif *dpif_, struct netdev *netdev,
|
||||
|
Reference in New Issue
Block a user