2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00
ovs/lib/netdev-afxdp.h
David Marchand b561bbdc27 netdev-afxdp: Postpone libbpf logging helper registration.
When using net/af_xdp DPDK driver along OVS native AF_XDP support,
confusing logs are reported, like:

netdev_dpdk|INFO|Device 'net_af_xdpp0,iface=ovs-p0' attached to DPDK
dpif_netdev|INFO|PMD thread on numa_id: 0, core id: 11 created.
dpif_netdev|INFO|There are 1 pmd threads on numa node 0
dpdk|INFO|Device with port_id=0 already stopped
dpdk(pmd-c11/id:22)|INFO|PMD thread uses DPDK lcore 1.
netdev_dpdk|WARN|Rx checksum offload is not supported on port 0
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(6)
	.xdp_run_config
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(7)
	xdp_metadata
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(7)
	xdp_metadata
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(7)
	xdp_metadata

This comes from the fact that netdev-afxdp unconditionnally registers a
helper for logging libbpf messages.
Making both net/af_xdp and netdev-afxdp work at the same time seems
difficult, so at least, ensure that netdev-afxdp won't register this
helper unless a netdev is actually allocated.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:40:11 +00:00

88 lines
2.7 KiB
C

/*
* Copyright (c) 2018, 2019 Nicira, 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_AFXDP_H
#define NETDEV_AFXDP_H 1
#ifdef HAVE_AF_XDP
#include <stdint.h>
#include <stdbool.h>
/* These functions are Linux AF_XDP specific, so they should be used directly
* only by Linux-specific code. */
enum afxdp_mode {
OVS_AF_XDP_MODE_UNSPEC,
OVS_AF_XDP_MODE_BEST_EFFORT,
OVS_AF_XDP_MODE_NATIVE_ZC,
OVS_AF_XDP_MODE_NATIVE,
OVS_AF_XDP_MODE_GENERIC,
OVS_AF_XDP_MODE_MAX,
};
struct dp_packet;
struct dp_packet_batch;
struct netdev;
struct netdev_afxdp_tx_lock;
struct netdev_custom_stats;
struct netdev_rxq;
struct netdev_stats;
struct smap;
struct xdp_umem;
struct xsk_socket_info;
int netdev_afxdp_rxq_construct(struct netdev_rxq *rxq_);
void netdev_afxdp_rxq_destruct(struct netdev_rxq *rxq_);
int netdev_afxdp_construct(struct netdev *netdev_);
void netdev_afxdp_destruct(struct netdev *netdev_);
int netdev_afxdp_verify_mtu_size(const struct netdev *netdev, int mtu);
int netdev_afxdp_rxq_recv(struct netdev_rxq *rxq_,
struct dp_packet_batch *batch,
int *qfill);
int netdev_afxdp_batch_send(struct netdev *netdev_, int qid,
struct dp_packet_batch *batch,
bool concurrent_txq);
int netdev_afxdp_set_config(struct netdev *netdev, const struct smap *args,
char **errp);
int netdev_afxdp_get_config(const struct netdev *netdev, struct smap *args);
int netdev_afxdp_get_stats(const struct netdev *netdev_,
struct netdev_stats *stats);
int netdev_afxdp_get_status(const struct netdev *netdev, struct smap *args);
int netdev_afxdp_get_custom_stats(const struct netdev *netdev,
struct netdev_custom_stats *custom_stats);
void free_afxdp_buf(struct dp_packet *p);
int netdev_afxdp_reconfigure(struct netdev *netdev);
void signal_remove_xdp(struct netdev *netdev);
#else /* !HAVE_AF_XDP */
#include "openvswitch/compiler.h"
struct dp_packet;
static inline void
free_afxdp_buf(struct dp_packet *p OVS_UNUSED)
{
/* Nothing. */
}
#endif /* HAVE_AF_XDP */
#endif /* netdev-afxdp.h */