Skip to content

Commit

Permalink
Merge branch 'main' into default-ovs-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ffoulkes authored Apr 16, 2024
2 parents c9c7f22 + 78bf19b commit bd1dcff
Show file tree
Hide file tree
Showing 16 changed files with 133 additions and 133 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
path: recipe

- name: Install dpdk-sde
uses: robinraju/release-downloader@v1.9
uses: robinraju/release-downloader@v1.10
with:
repository: ${{ env.SDE_REPOSITORY }}
tag: ${{ env.SDE_TAG }}
Expand All @@ -57,7 +57,7 @@ jobs:
rm $SDE_FILENAME
- name: Install stratum-deps
uses: robinraju/release-downloader@v1.9
uses: robinraju/release-downloader@v1.10
with:
repository: ${{ env.DEPS_REPOSITORY }}
tag: ${{ env.DEPS_TAG }}
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
path: recipe

- name: Install dpdk-sde
uses: robinraju/release-downloader@v1.9
uses: robinraju/release-downloader@v1.10
with:
repository: ${{ env.SDE_REPOSITORY }}
tag: ${{ env.SDE_TAG }}
Expand All @@ -103,7 +103,7 @@ jobs:
rm $SDE_FILENAME
- name: Install stratum-deps
uses: robinraju/release-downloader@v1.9
uses: robinraju/release-downloader@v1.10
with:
repository: ${{ env.DEPS_REPOSITORY }}
tag: ${{ env.DEPS_TAG }}
Expand Down
7 changes: 4 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Copyright 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

load("//bazel:rules.bzl", "krnlmon_cc_library")

package(default_visibility = ["//visibility:public"])

load("//bazel:defs.bzl", "TARGET_DEFINES")
Expand All @@ -23,7 +25,7 @@ cc_shared_library(
],
)

cc_library(
krnlmon_cc_library(
name = "krnlmon_main",
srcs = ["krnlmon_main.cc"],
hdrs = ["krnlmon_main.h"],
Expand All @@ -33,10 +35,9 @@ cc_library(
],
)

cc_library(
krnlmon_cc_library(
name = "krnlmon_options",
srcs = ["krnlmon_options.h"],
defines = TARGET_DEFINES,
)

cc_binary(
Expand Down
8 changes: 8 additions & 0 deletions bazel/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ TARGET_DEFINES = select(
},
no_match_error = NO_MATCH_ERROR,
)

LNW_DEFINES = select(
{
"//flags:lnw_v2": ["LNW_V2"],
"//flags:lnw_v3": ["LNW_V3"],
"//conditions:default": [],
},
)
4 changes: 2 additions & 2 deletions bazel/rules/library_rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:defs.bzl", "cc_library")
load("//bazel:defs.bzl", "TARGET_DEFINES")
load("//bazel:defs.bzl", "LNW_DEFINES", "TARGET_DEFINES")

def krnlmon_cc_library(
name,
Expand All @@ -31,7 +31,7 @@ def krnlmon_cc_library(
hdrs = hdrs,
# alwayslink = alwayslink,
copts = copts,
defines = TARGET_DEFINES + defines,
defines = TARGET_DEFINES + LNW_DEFINES + defines,
include_prefix = include_prefix,
includes = includes,
strip_include_prefix = strip_include_prefix,
Expand Down
28 changes: 28 additions & 0 deletions bazel/rules/lnw_version_flag.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# //bazel/rules:lnw_version_flag.bzl

# Copyright 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

# Defines a build_setting rule for the Linux Networking version.
# Used to define the //flags:lnw_version command-line flag.

# https://github.com/bazelbuild/examples/tree/HEAD/configurations/basic_build_setting

LinuxNetworkingVersion = provider(doc = "", fields = ["version"])

valid_versions = [2, 3]

def _impl(ctx):
raw_value = ctx.build_setting_value
if raw_value not in valid_versions:
msg = str(ctx.label) + ": lnw_version accepts values {" + \
",".join([str(x) for x in valid_versions]) + \
"} but was set to " + str(raw_value)
fail(msg)

return LinuxNetworkingVersion(version = raw_value)

lnw_version_flag = rule(
implementation = _impl,
build_setting = config.int(flag = True),
)
26 changes: 26 additions & 0 deletions flags/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package(default_visibility = ["//visibility:public"])

load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("//bazel:rules/lnw_version_flag.bzl", "lnw_version_flag")

# Define "--//flags:ovs" command-line flag
bool_flag(
Expand Down Expand Up @@ -36,3 +37,28 @@ config_setting(
"target": "es2k",
},
)

lnw_version_flag(
name = "lnw_version",
build_setting_default = 3,
)

config_setting(
name = "lnw_v2",
define_values = {
"target": "es2k",
},
flag_values = {
"lnw_version": "2",
},
)

config_setting(
name = "lnw_v3",
define_values = {
"target": "es2k",
},
flag_values = {
"lnw_version": "3",
},
)
1 change: 1 addition & 0 deletions switchapi/es2k/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ target_sources(switchapi_o PRIVATE
switch_neighbor.c
switch_nhop.c
switch_pd_fdb.c
switch_pd_lag.h
switch_pd_p4_name_mapping.h
switch_pd_tunnel.c
switch_pd_utils.c
Expand Down
1 change: 0 additions & 1 deletion switchapi/es2k/lnw_v2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
target_sources(switchapi_o PRIVATE
switch_pd_p4_name_routing.h
switch_pd_routing.c
switch_pd_routing.h
switch_pd_lag.c
switch_pd_lag.h
)
Expand Down
2 changes: 1 addition & 1 deletion switchapi/es2k/lnw_v2/switch_pd_routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

#include "switch_pd_routing.h"
#include "switchapi/es2k/switch_pd_routing.h"

#include "switchapi/es2k/switch_pd_p4_name_mapping.h"
#include "switchapi/es2k/switch_pd_utils.h"
Expand Down
105 changes: 0 additions & 105 deletions switchapi/es2k/lnw_v2/switch_pd_routing.h

This file was deleted.

1 change: 0 additions & 1 deletion switchapi/es2k/lnw_v3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
target_sources(switchapi_o PRIVATE
switch_pd_p4_name_routing.h
switch_pd_routing.c
switch_pd_routing.h
switch_pd_lag.c
switch_pd_lag.h
)
Expand Down
2 changes: 1 addition & 1 deletion switchapi/es2k/lnw_v3/switch_pd_routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

#include "switch_pd_routing.h"
#include "switchapi/es2k/switch_pd_routing.h"

#include "switchapi/es2k/switch_pd_p4_name_mapping.h"
#include "switchapi/es2k/switch_pd_utils.h"
Expand Down
6 changes: 1 addition & 5 deletions switchapi/es2k/switch_lag.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@

#include "switchapi/switch_lag.h"

#include "switch_pd_lag.h"
#include "switch_pd_utils.h"
#ifdef LNW_V2
#include "lnw_v2/switch_pd_lag.h"
#else
#include "lnw_v3/switch_pd_lag.h"
#endif
#include "switchapi/switch_base_types.h"
#include "switchapi/switch_device.h"
#include "switchapi/switch_internal.h"
Expand Down
37 changes: 37 additions & 0 deletions switchapi/es2k/switch_pd_lag.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2024 Intel Corporation.
* SPDX-License_Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Proxy for the version-specific switch_pd_lag.h files.
//
// This header file encapsulates the knowledge that there are different
// versions of the header file.
//
// Note that it must use a different include guard than the files it
// includes.

#ifndef __SWITCH_PD_LAG_WRAPPER_H__
#define __SWITCH_PD_LAG_WRAPPER_H__

#if defined(LNW_V2)
#include "lnw_v2/switch_pd_lag.h"
#elif defined(LNW_V3)
#include "lnw_v3/switch_pd_lag.h"
#else
#error "Undefined or missing LNW conditional!"
#endif

#endif // __SWITCH_PD_LAG_WRAPPER_H__
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
#ifndef __SWITCH_PD_ROUTING_H__
#define __SWITCH_PD_ROUTING_H__

#include "switchapi/es2k/lnw_v3/switch_pd_p4_name_routing.h"
#if defined(LNW_V2)
#include "lnw_v2/switch_pd_p4_name_routing.h"
#elif defined(LNW_V3)
#include "lnw_v3/switch_pd_p4_name_routing.h"
#endif

#include "switchapi/switch_base_types.h"
#include "switchapi/switch_handle.h"
#include "switchapi/switch_l3.h"
Expand Down Expand Up @@ -59,9 +64,15 @@ switch_status_t switch_pd_nexthop_table_entry(
switch_device_t device, const switch_pd_routing_info_t* api_nexthop_pd_info,
bool entry_add);

#if defined(LNW_V2)
switch_status_t switch_pd_neighbor_table_entry(
switch_device_t device,
const switch_pd_routing_info_t* api_neighbor_pd_info, bool entry_add);
#elif defined(LNW_V3)
switch_status_t switch_pd_ecmp_nexthop_table_entry(
switch_device_t device, const switch_pd_routing_info_t* api_nexthop_pd_info,
bool entry_add);
#endif

switch_status_t switch_pd_rmac_table_entry(switch_device_t device,
switch_rmac_entry_t* rmac_entry,
Expand Down
Loading

0 comments on commit bd1dcff

Please sign in to comment.