@@ -210,8 +210,6 @@ lib_libopenvswitch_la_SOURCES = \
lib/namemap.c \
lib/netdev-dpdk.h \
lib/netdev-dummy.c \
- lib/netdev-offload.c \
- lib/netdev-offload.h \
lib/netdev-provider.h \
lib/netdev-vport.c \
lib/netdev-vport.h \
@@ -475,12 +473,12 @@ lib_libopenvswitch_la_SOURCES += \
lib/dpif-netlink-rtnl.c \
lib/dpif-netlink-rtnl.h \
lib/dpif-offload-tc.c \
+ lib/dpif-offload-tc-netdev.c \
+ lib/dpif-offload-tc-private.h \
lib/if-notifier.c \
lib/netdev-linux.c \
lib/netdev-linux.h \
lib/netdev-linux-private.h \
- lib/netdev-offload-tc.c \
- lib/netdev-offload-tc.h \
lib/netlink-conntrack.c \
lib/netlink-conntrack.h \
lib/netlink-notifier.c \
@@ -508,10 +506,9 @@ if DPDK_NETDEV
lib_libopenvswitch_la_SOURCES += \
lib/dpdk.c \
lib/dpif-offload-dpdk.c \
+ lib/dpif-offload-dpdk-netdev.c \
lib/dpif-offload-dpdk-private.h \
- lib/netdev-dpdk.c \
- lib/netdev-offload-dpdk.c \
- lib/netdev-offload-dpdk.h
+ lib/netdev-dpdk.c
else
lib_libopenvswitch_la_SOURCES += \
lib/dpdk-stub.c
@@ -30,7 +30,6 @@
#include "dp-packet.h"
#include "netdev.h"
-#include "netdev-offload.h"
/* Each AVX512 register (zmm register in assembly notation) can contain up to
* 512 bits, which is equivalent to 8 uint64_t variables. This is the maximum
@@ -59,7 +59,6 @@
#include "mov-avg.h"
#include "mpsc-queue.h"
#include "netdev.h"
-#include "netdev-offload-dpdk.h"
#include "netdev-provider.h"
#include "netdev-vport.h"
#include "netlink.h"
@@ -39,7 +39,6 @@
#include "fat-rwlock.h"
#include "flow.h"
#include "netdev-linux.h"
-#include "netdev-offload.h"
#include "netdev-provider.h"
#include "netdev-vport.h"
#include "netdev.h"
similarity index 99%
rename from lib/netdev-offload-dpdk.c
rename to lib/dpif-offload-dpdk-netdev.c
@@ -27,7 +27,6 @@
#include "dpif-netdev.h"
#include "dpif-offload.h"
#include "dpif-offload-dpdk-private.h"
-#include "netdev-offload-dpdk.h"
#include "netdev-provider.h"
#include "netdev-vport.h"
#include "odp-util.h"
@@ -22,8 +22,8 @@ struct dpif_offload_dpdk;
struct netdev;
/* DPIF offload dpdk implementation-specific functions. These should only be
- * used by the associated netdev offload provider, i.e., netdev-offload-dpdk.
- */
+ * used by the associated netdev offload provider, i.e.,
+ * dpif-offload-dpdk-netdev. */
unsigned int dpdk_offload_thread_id(void);
void dpif_offload_dpdk_flow_unreference(struct dpif_offload_dpdk *offload,
unsigned pmd_id, void *flow_reference);
@@ -36,4 +36,38 @@ void dpif_offload_dpdk_traverse_ports(
const struct dpif_offload_dpdk *offload,
bool (*cb)(struct netdev *, odp_port_t, void *), void *aux);
+
+/* dpif-offload-dpdk-netdev specific offload functions. These should only be
+ * used by the associated dpif offload provider, i.e., dpif-offload-dpdk. */
+int netdev_offload_dpdk_init(struct netdev *,
+ unsigned int offload_thread_count);
+void netdev_offload_dpdk_uninit(struct netdev *);
+int netdev_offload_dpdk_flow_flush(struct dpif_offload_dpdk *,
+ struct netdev *);
+uint64_t netdev_offload_dpdk_flow_get_n_offloaded(
+ struct netdev *, unsigned int offload_thread_count);
+uint64_t netdev_offload_dpdk_flow_get_n_offloaded_by_thread(
+ struct netdev *, unsigned int tid);
+int netdev_offload_dpdk_hw_miss_packet_recover(struct dpif_offload_dpdk *,
+ struct netdev *,
+ unsigned pmd_id,
+ struct dp_packet *,
+ void **flow_reference);
+int netdev_offload_dpdk_flow_put(struct dpif_offload_dpdk *,
+ unsigned pmd_id, void *flow_reference,
+ struct netdev *, struct match *,
+ struct nlattr *actions, size_t actions_len,
+ const ovs_u128 *ufid, odp_port_t orig_in_port,
+ void **previous_flow_reference,
+ struct dpif_flow_stats *);
+int netdev_offload_dpdk_flow_del(struct dpif_offload_dpdk *,
+ struct netdev *, unsigned pmd_id,
+ const ovs_u128 *ufid,
+ void *flow_reference,
+ struct dpif_flow_stats *);
+int netdev_offload_dpdk_flow_get(struct netdev *, struct match *,
+ struct nlattr **actions, const ovs_u128 *ufid,
+ struct dpif_flow_stats *,
+ struct dpif_flow_attrs *, struct ofpbuf *buf);
+
#endif /* DPIF_OFFLOAD_DPDK_PRIVATE_H */
@@ -23,7 +23,6 @@
#include "id-fpool.h"
#include "mov-avg.h"
#include "mpsc-queue.h"
-#include "netdev-offload-dpdk.h"
#include "netdev-provider.h"
#include "netdev-vport.h"
#include "util.h"
similarity index 99%
rename from lib/netdev-offload-tc.c
rename to lib/dpif-offload-tc-netdev.c
@@ -31,7 +31,6 @@
#include "openvswitch/util.h"
#include "openvswitch/vlog.h"
#include "netdev-linux.h"
-#include "netdev-offload-tc.h"
#include "netdev-provider.h"
#include "netdev-vport.h"
#include "netlink.h"
@@ -42,6 +41,7 @@
#include "unaligned.h"
#include "util.h"
#include "dpif-offload.h"
+#include "dpif-offload-tc-private.h"
#include "dpif-provider.h"
VLOG_DEFINE_THIS_MODULE(netdev_offload_tc);
similarity index 96%
rename from lib/netdev-offload-tc.h
rename to lib/dpif-offload-tc-private.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
- #ifndef NETDEV_OFFLOAD_TC_H
- #define NETDEV_OFFLOAD_TC_H
+ #ifndef DPIF_OFFLOAD_TC_PRIVATE_H
+ #define DPIF_OFFLOAD_TC_PRIVATE_H
/* Forward declarations of private structures. */
struct dpif_offload;
@@ -73,4 +73,4 @@ uint64_t dpif_offload_tc_flow_get_n_offloaded(const struct dpif_offload *);
odp_port_t dpif_offload_tc_get_port_id_by_ifindex(const struct dpif_offload *,
int ifindex);
-#endif /* NETDEV_OFFLOAD_TC_H */
+#endif /* DPIF_OFFLOAD_TC_PRIVATE_H */
@@ -19,8 +19,7 @@
#include "dpif-offload.h"
#include "dpif-offload-provider.h"
-#include "netdev-offload.h"
-#include "netdev-offload-tc.h"
+#include "dpif-offload-tc-private.h"
#include "netdev-provider.h"
#include "netdev-vport.h"
#include "odp-util.h"
@@ -30,7 +30,6 @@
#include "dpif-offload.h"
#include "dpif-offload-provider.h"
#include "flow.h"
-#include "netdev-offload.h"
#include "netdev-provider.h"
#include "netdev.h"
#include "netlink.h"
deleted file mode 100644
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2025 Red Hat, Inc.
- *
- * 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.
- */
-
- #ifndef NETDEV_OFFLOAD_DPDK_H
- #define NETDEV_OFFLOAD_DPDK_H
-
-/* Forward declarations of private structures. */
-struct dpif_offload_dpdk;
-struct netdev;
-
-/* Netdev-specific offload functions. These should only be used by the
- * associated dpif offload provider. */
-int netdev_offload_dpdk_init(struct netdev *,
- unsigned int offload_thread_count);
-void netdev_offload_dpdk_uninit(struct netdev *);
-int netdev_offload_dpdk_flow_flush(struct dpif_offload_dpdk *,
- struct netdev *);
-uint64_t netdev_offload_dpdk_flow_get_n_offloaded(
- struct netdev *, unsigned int offload_thread_count);
-uint64_t netdev_offload_dpdk_flow_get_n_offloaded_by_thread(
- struct netdev *, unsigned int tid);
-int netdev_offload_dpdk_hw_miss_packet_recover(struct dpif_offload_dpdk *,
- struct netdev *,
- unsigned pmd_id,
- struct dp_packet *,
- void **flow_reference);
-int netdev_offload_dpdk_flow_put(struct dpif_offload_dpdk *,
- unsigned pmd_id, void *flow_reference,
- struct netdev *, struct match *,
- struct nlattr *actions, size_t actions_len,
- const ovs_u128 *ufid,
- odp_port_t orig_in_port,
- void **previous_flow_reference,
- struct dpif_flow_stats *);
-int netdev_offload_dpdk_flow_del(struct dpif_offload_dpdk *, struct netdev *,
- unsigned pmd_id, const ovs_u128 *ufid,
- void *flow_reference,
- struct dpif_flow_stats *);
-int netdev_offload_dpdk_flow_get(struct netdev *, struct match *,
- struct nlattr **actions, const ovs_u128 *ufid,
- struct dpif_flow_stats *,
- struct dpif_flow_attrs *, struct ofpbuf *buf);
-
-#endif /* NETDEV_OFFLOAD_DPDK_H */
deleted file mode 100644
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2008 - 2014, 2016, 2017 Nicira, Inc.
- * Copyright (c) 2019 Samsung Electronics Co.,Ltd.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "netdev-offload.h"
-#include "netdev-provider.h"
-#include "openvswitch/vlog.h"
-
-VLOG_DEFINE_THIS_MODULE(netdev_offload);
-
-/*
- * Get the value of the hw info parameter specified by type.
- * Returns the value on success (>= 0). Returns -1 on failure.
- */
-int
-netdev_get_hw_info(struct netdev *netdev, int type)
-{
- int val = -1;
-
- switch (type) {
- case HW_INFO_TYPE_OOR:
- val = netdev->hw_info.oor;
- break;
- case HW_INFO_TYPE_PEND_COUNT:
- val = netdev->hw_info.pending_count;
- break;
- case HW_INFO_TYPE_OFFL_COUNT:
- val = netdev->hw_info.offload_count;
- break;
- default:
- break;
- }
-
- return val;
-}
-
-/*
- * Set the value of the hw info parameter specified by type.
- */
-void
-netdev_set_hw_info(struct netdev *netdev, int type, int val)
-{
- switch (type) {
- case HW_INFO_TYPE_OOR:
- if (val == 0) {
- VLOG_DBG("Offload rebalance: netdev: %s is not OOR", netdev->name);
- }
- netdev->hw_info.oor = val;
- break;
- case HW_INFO_TYPE_PEND_COUNT:
- netdev->hw_info.pending_count = val;
- break;
- case HW_INFO_TYPE_OFFL_COUNT:
- netdev->hw_info.offload_count = val;
- break;
- default:
- break;
- }
-}
deleted file mode 100644
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
- * Copyright (c) 2019 Samsung Electronics Co.,Ltd.
- *
- * 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.
- */
-
-#ifndef NETDEV_OFFLOAD_H
-#define NETDEV_OFFLOAD_H 1
-
-#include "openvswitch/netdev.h"
-#include "ovs-atomic.h"
-#include "ovs-rcu.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Offload-capable (HW) netdev information */
-struct netdev_hw_info {
- bool oor; /* Out of Offload Resources ? */
- /* Is hw_miss_packet_postprocess() supported.*/
- atomic_bool postprocess_api_supported;
- int offload_count; /* Offloaded flow count */
- int pending_count; /* Pending (non-offloaded) flow count */
- OVSRCU_TYPE(void *) offload_data; /* Offload metadata. */
-};
-
-enum hw_info_type {
- HW_INFO_TYPE_OOR = 1, /* OOR state */
- HW_INFO_TYPE_PEND_COUNT = 2, /* Pending(non-offloaded) flow count */
- HW_INFO_TYPE_OFFL_COUNT = 3 /* Offloaded flow count */
-};
-
-int netdev_get_hw_info(struct netdev *, int);
-void netdev_set_hw_info(struct netdev *, int, int);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* netdev-offload.h */
@@ -21,7 +21,6 @@
#include "connectivity.h"
#include "netdev.h"
-#include "netdev-offload.h"
#include "openvswitch/list.h"
#include "ovs-numa.h"
#include "ovs-rcu.h"
@@ -2454,3 +2454,53 @@ netdev_get_block_id(struct netdev *netdev)
? class->get_block_id(netdev)
: 0);
}
+
+/*
+ * Get the value of the hw info parameter specified by type.
+ * Returns the value on success (>= 0). Returns -1 on failure.
+ */
+int
+netdev_get_hw_info(struct netdev *netdev, int type)
+{
+ int val = -1;
+
+ switch (type) {
+ case HW_INFO_TYPE_OOR:
+ val = netdev->hw_info.oor;
+ break;
+ case HW_INFO_TYPE_PEND_COUNT:
+ val = netdev->hw_info.pending_count;
+ break;
+ case HW_INFO_TYPE_OFFL_COUNT:
+ val = netdev->hw_info.offload_count;
+ break;
+ default:
+ break;
+ }
+
+ return val;
+}
+
+/*
+ * Set the value of the hw info parameter specified by type.
+ */
+void
+netdev_set_hw_info(struct netdev *netdev, int type, int val)
+{
+ switch (type) {
+ case HW_INFO_TYPE_OOR:
+ if (val == 0) {
+ VLOG_DBG("Offload rebalance: netdev: %s is not OOR", netdev->name);
+ }
+ netdev->hw_info.oor = val;
+ break;
+ case HW_INFO_TYPE_PEND_COUNT:
+ netdev->hw_info.pending_count = val;
+ break;
+ case HW_INFO_TYPE_OFFL_COUNT:
+ netdev->hw_info.offload_count = val;
+ break;
+ default:
+ break;
+ }
+}
@@ -19,6 +19,8 @@
#include "openvswitch/netdev.h"
#include "openvswitch/types.h"
+#include "ovs-atomic.h"
+#include "ovs-rcu.h"
#include "packets.h"
#include "flow.h"
@@ -392,6 +394,25 @@ int netdev_get_addrs(const char dev[], struct in6_addr **paddr,
struct in6_addr **pmask, int *n_in6);
#endif
+/* Offload-capable (HW) netdev information. */
+struct netdev_hw_info {
+ bool oor; /* Out of Offload Resources (OOR)? */
+ /* Is hw_miss_packet_postprocess() supported.*/
+ atomic_bool postprocess_api_supported;
+ int offload_count; /* Offloaded flow count. */
+ int pending_count; /* Pending (non-offloaded) flow count. */
+ OVSRCU_TYPE(void *) offload_data; /* Offload metadata. */
+};
+
+enum hw_info_type {
+ HW_INFO_TYPE_OOR = 1, /* Out of Offload Resources (OOR) state. */
+ HW_INFO_TYPE_PEND_COUNT = 2, /* Pending(non-offloaded) flow count. */
+ HW_INFO_TYPE_OFFL_COUNT = 3 /* Offloaded flow count. */
+};
+
+int netdev_get_hw_info(struct netdev *, int type);
+void netdev_set_hw_info(struct netdev *, int type, int val);
+
#ifdef __cplusplus
}
#endif
@@ -2977,7 +2977,7 @@ csum_update_flag(struct tc_flower *flower,
* is ICMPv6 and tcp checksum if its tcp.
*
* This section of the code must be kept in sync with the pre-check
- * function in netdev-offload-tc.c, tc_will_add_l4_checksum(). */
+ * function in dpif-offload-tc-netdev.c, tc_will_add_l4_checksum(). */
switch (htype) {
case TCA_PEDIT_KEY_EX_HDR_TYPE_IP4:
@@ -39,7 +39,6 @@
#include "mac-learning.h"
#include "mcast-snooping.h"
#include "netdev.h"
-#include "netdev-offload.h"
#include "nx-match.h"
#include "odp-execute.h"
#include "ofproto/bond.h"
This patch simply renames the netdev-offload-tc|dpdk.c files to the corresponding dpif-offload-tc|dpdk-netdev.c files. This makes it clearer that offload is now controlled through the new dpif-offload provider framework. It does not rename all individual functions or data structures, as that would be too large a change with no real benefit. In addition, the netdev_set|get_hw_info() APIs were moved from netdev-offload.c to netdev.c, allowing the netdev-offload.c file to be removed. The same applies to the definitions previously located in netdev-offload.h. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> --- lib/automake.mk | 11 +-- lib/dpif-netdev-avx512.c | 1 - lib/dpif-netdev.c | 1 - lib/dpif-netlink.c | 1 - ...load-dpdk.c => dpif-offload-dpdk-netdev.c} | 1 - lib/dpif-offload-dpdk-private.h | 38 +++++++++- lib/dpif-offload-dpdk.c | 1 - ...-offload-tc.c => dpif-offload-tc-netdev.c} | 2 +- ...offload-tc.h => dpif-offload-tc-private.h} | 6 +- lib/dpif-offload-tc.c | 3 +- lib/dpif.c | 1 - lib/netdev-offload-dpdk.h | 57 -------------- lib/netdev-offload.c | 74 ------------------- lib/netdev-offload.h | 52 ------------- lib/netdev-provider.h | 1 - lib/netdev.c | 50 +++++++++++++ lib/netdev.h | 21 ++++++ lib/tc.c | 2 +- vswitchd/bridge.c | 1 - 19 files changed, 117 insertions(+), 207 deletions(-) rename lib/{netdev-offload-dpdk.c => dpif-offload-dpdk-netdev.c} (99%) rename lib/{netdev-offload-tc.c => dpif-offload-tc-netdev.c} (99%) rename lib/{netdev-offload-tc.h => dpif-offload-tc-private.h} (96%) delete mode 100644 lib/netdev-offload-dpdk.h delete mode 100644 lib/netdev-offload.c delete mode 100644 lib/netdev-offload.h