Skip to content

Commit

Permalink
Apply P4-OVS changes to main branch
Browse files Browse the repository at this point in the history
Signed-off-by: Derek G Foster <[email protected]>
  • Loading branch information
ffoulkes authored and satish153 committed Dec 26, 2023
1 parent 5c38104 commit 8866f8c
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*.so
*.suo
**/*.sym
**/*.pc
*~
*,cover
.#*
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc.
# Copyright (c) 2021 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -202,6 +203,7 @@ OVS_CHECK_LINUX_SCTP_CT
OVS_CHECK_LINUX_VIRTIO_TYPES
OVS_CHECK_DPDK
OVS_CHECK_PRAGMA_MESSAGE
OVS_CHECK_P4OVS
AC_SUBST([CFLAGS])
AC_SUBST([OVS_CFLAGS])
AC_SUBST([OVS_LDFLAGS])
Expand Down
12 changes: 12 additions & 0 deletions lib/dpif-netlink-rtnl.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017 Red Hat, Inc.
* Copyright (c) 2021 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -377,6 +378,17 @@ dpif_netlink_rtnl_create(const struct netdev_tunnel_config *tnl_cfg,
/* tunnel unique info */
switch (type) {
case OVS_VPORT_TYPE_VXLAN:
nl_msg_put_u8(&request, IFLA_VXLAN_TTL, tnl_cfg->ttl);
nl_msg_put_u32(&request, IFLA_VXLAN_ID, tnl_cfg->vni);
if (tnl_cfg->ipv6_dst.__in6_u.__u6_addr32[0] == 0) {
nl_msg_put_be32(&request, IFLA_VXLAN_GROUP,
tnl_cfg->ipv6_dst.__in6_u.__u6_addr32[3]);
}
if (tnl_cfg->ipv6_src.__in6_u.__u6_addr32[0] == 0) {
nl_msg_put_be32(&request, IFLA_VXLAN_LOCAL,
tnl_cfg->ipv6_src.__in6_u.__u6_addr32[3]);
}

nl_msg_put_u8(&request, IFLA_VXLAN_LEARNING, 0);
nl_msg_put_u8(&request, IFLA_VXLAN_COLLECT_METADATA, 1);
nl_msg_put_u8(&request, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, 1);
Expand Down
7 changes: 5 additions & 2 deletions lib/netdev-vport.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2010, 2011, 2012, 2013, 2014, 2017 Nicira, Inc.
* Copyright (c) 2016 Red Hat, Inc.
* Copyright (c) 2021 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -712,8 +713,10 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args, char **errp)
if (!strcmp(node->value, "false")) {
tnl_cfg.dont_fragment = false;
}
} else if (!strcmp(node->key, "key") ||
!strcmp(node->key, "in_key") ||
} else if (!strcmp(node->key, "key") && strcmp(node->value, "flow")) {
/* Add VNI to tunnel config if the value is not flow */
tnl_cfg.vni = atoi(node->value);
} else if (!strcmp(node->key, "in_key") ||
!strcmp(node->key, "out_key") ||
!strcmp(node->key, "packet_type")) {
/* Handled separately below. */
Expand Down
3 changes: 3 additions & 0 deletions lib/netdev.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
* Copyright (c) 2021 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -158,6 +159,8 @@ struct netdev_tunnel_config {
#define SRV6_MAX_SEGS 6
struct in6_addr srv6_segs[SRV6_MAX_SEGS];
enum netdev_srv6_flowlabel srv6_flowlabel;

uint32_t vni;
};

void netdev_run(void);
Expand Down
1 change: 0 additions & 1 deletion lib/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <stdlib.h>
#include <string.h>
#include "compiler.h"
#include "util.h"
#include "openvswitch/util.h"
#if defined(__aarch64__) && __GNUC__ >= 6
#include <arm_neon.h>
Expand Down
21 changes: 21 additions & 0 deletions m4/ovs_check_p4ovs.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dnl OVS_CHECK_P4OVS - Process P4 options.

dnl Copyright(c) 2021-2022 Intel Corporation.
dnl SPDX-License-Identifier: Apache 2.0

AC_DEFUN([OVS_CHECK_P4OVS], [
AC_ARG_WITH([p4ovs],
[AC_HELP_STRING([--with-p4ovs], [Build with P4 support])],
[have_p4ovs=true])
AC_MSG_CHECKING([whether P4OVS is enabled])
if test "$have_p4ovs" != true || test "$with_p4ovs" = no; then
AC_MSG_RESULT([no])
P4OVS_VALID=false
else
AC_MSG_RESULT([yes])
P4OVS_VALID=true
AC_DEFINE([P4OVS], [1], [System includes P4 support.])
fi
dnl export automake conditional
AM_CONDITIONAL([P4OVS], test "$P4OVS_VALID" = true)
])
27 changes: 25 additions & 2 deletions vswitchd/automake.mk
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
sbin_PROGRAMS += vswitchd/ovs-vswitchd
# vswitchd
man_MANS += vswitchd/ovs-vswitchd.8
CLEANFILES += \
vswitchd/ovs-vswitchd.8

vswitchd_ovs_vswitchd_SOURCES = \
vswitchd_sources = \
vswitchd/bridge.c \
vswitchd/bridge.h \
vswitchd/ovs-vswitchd.c \
vswitchd/system-stats.c \
vswitchd/system-stats.h

if P4OVS
# Build a static library instead of an executable.
lib_LTLIBRARIES += vswitchd/libvswitchd.la

vswitchd_libvswitchd_la_CPPFLAGS = $(AM_CPPFLAGS)

vswitchd_libvswitchd_la_SOURCES = \
$(vswitchd_sources)

vswitchd_libvswitchd_la_LIBADD = \
ofproto/libofproto.la \
lib/libsflow.la \
lib/libopenvswitch.la
else
sbin_PROGRAMS += vswitchd/ovs-vswitchd

vswitchd_ovs_vswitchd_SOURCES = \
$(vswitchd_sources)

vswitchd_ovs_vswitchd_LDADD = \
ofproto/libofproto.la \
lib/libsflow.la \
lib/libopenvswitch.la

vswitchd_ovs_vswitchd_LDFLAGS = $(AM_LDFLAGS) $(DPDK_vswitchd_LDFLAGS)
endif

MAN_ROOTS += vswitchd/ovs-vswitchd.8.in

# vswitch schema and IDL
Expand Down

0 comments on commit 8866f8c

Please sign in to comment.