From patchwork Mon Sep 28 22:34:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 2313124 X-Patchwork-Delegate: ktraynor@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P1QjO1fR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hvBMF6Qyyz1y1S for ; Tue, 29 Sep 2026 18:35:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2A62560740; Tue, 29 Sep 2026 08:35:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1q6PTdiC9txr; Tue, 29 Sep 2026 08:35:16 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp3.osuosl.org 3CE2C6071E Authentication-Results: smtp3.osuosl.org; arc=fail smtp.remote-ip="2605:bc80:3010:104::8cd3:938" ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=fail; t=1790670914; b=eiy5EWvuGv6hI55h91tyGyEg3rYJv0DlzlEZY9y3cZ2+cIh6gYhyhhJcOva18JtkfyUt xC63i0j/ssY4Wtw7RrxdgOpEJFwkzHrBvAtGL/KxXlb9nkSFcI1nMlMJ/nrBp4SktBQKv trmOk8kVt3svZzXqgqX4IR1SxCwOxw2RccXv/X/CkNphG8c6aOrScJBt0btbbqxeLGYl9 6ssqjZhkGQcR/JEI+A7eEgx/PW60lND0Dy6/4tMWIsp+f624CX6lSUG6Gov8Qybz4PQ/4 cY0DDmhjIM+nwirFjKFGNHDfJ7HhReGpPiB/wmRbfWSYogFXWkATR+FXlArw5qTb3Gg== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790670914; h=X-Comment:Received:X-Original-To:Delivered-To:Received:Received: X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level:X-Spam-Status: Received:ARC-Filter:Received-SPF:Received:DKIM-Signature:Received: X-MC-Unique:X-Mimecast-MFC-AGG-ID:Received:Received:To:Date: Message-ID:In-Reply-To:References:MIME-Version:X-Scanned-By: X-Mimecast-Spam-Score:X-Mimecast-MFC-PROC-ID:X-Mimecast-Originator: Subject:X-BeenThere:X-Mailman-Version:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:From: Reply-To:Cc:Content-Type:Content-Transfer-Encoding:Errors-To:Sender; bh=66w0ugk2Norx0Vt9G43UYtozu12Io7JKfgIb26NfOW4=; b=b77GlIWv0p0lRuXyQpfYDBODr/eCjbEBIcrgdeQf0oue6FDTvcyD2v5WlV3oznW+J39t KT2mdq7z3cOSxhgkbbynci/6EdnWs3YsVQdf558uUEhEN9DlcvnMzS2El/PsUuoWvxHYx sVnZTqkeiX5yJ3Kp7zWoxTmtdKWmmIB/X5o2Bbl5ftj3rTQZwwVhDSb0E1/IuSdvCyDXe sfhwrcTwLtGxy8iOl1HeyoBzneOLy0ifZdwbpLshxQobywYwS0YX2eQ50DV9P3crSjtI4 aPUk2tKjltOhgwINNaF2I9ZlfG27l6zEQhpMp8KoDoDXwWB3Ly+l7PPCyDL6Sy/ZGvQ== ARC-Authentication-Results: i=2; smtp3.osuosl.org; dkim=fail reason="signature verification failed" header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P1QjO1fR; arc=fail smtp.remote-ip="2605:bc80:3010:104::8cd3:938" X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P1QjO1fR Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3CE2C6071E; Tue, 29 Sep 2026 08:35:14 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0B25DC05A0; Tue, 29 Sep 2026 08:35:14 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id AE5A9C0566 for ; Tue, 29 Sep 2026 08:35:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 83DEA402B8 for ; Tue, 29 Sep 2026 08:35:12 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Ycz9is_iItKf for ; Tue, 29 Sep 2026 08:35:08 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp2.osuosl.org 95F7C40296 Authentication-Results: smtp2.osuosl.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790670908; b=e0Apw9+cUyFrDqwD6ys4wct6/LFgUkzD1/yLjbDyynHmKGSHa7YT81+fE02lBZapmaf4 Vs52x3jyVTwiass7wgSsqRhXzjzj8ga5DqK+jJomxT5WRPIYL5IrVd+ZdcUIlp6e7CQXH e+CrMjH4RrQi2unMREYsRTVxUtN8popT/M5Gc48kITNbZ//89DJuMtBSqyv4wL/a1Usp5 3FU9WfpgSOiBchin4D9xMWVphbjVIlcWLEjGCwWImphkq5QycIqnWntqjZaJLMIx2Xga0 urY0Z31TcYzAIMj0G+gzUTws2FOucp8sIURY/XTP7E8yQAtAKLHKumFqHaswT9Raq2g== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790670908; h=Received-SPF:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:From:To:Cc:Subject:Date: Message-ID:In-Reply-To:References:MIME-Version:X-Scanned-By: X-Mimecast-Spam-Score:X-Mimecast-MFC-PROC-ID:X-Mimecast-Originator: Content-Transfer-Encoding:content-type; bh=9tN+I4ibSS10ckkp/921ajxsC+HXLajcSWx6vDCObeY=; b=EBhj7b5vFtcDQWwlYC0IBPHEGwP98VVfQL4JgtCFpdj2b8vLmUEmd5O6xt5mVc7HKsbm RNtpg0kk3lLhkkz3zy5z0wwyg2e7owkxB4SjA1NSEzTFJKcdoXIXy/77bBuhjHYZT3tmB 7/2NlWCnhJfZSn5NKyEMP6mbLKVuA4+UHTGdRPIosNjVbkji5jfdRFfzVBP6VE9d++vW2 h+qeAjUGHrpPb/UfvNvzo/cOGBx+I6y3zw7UcKLRI/lps1137E7jJO5Fxoz6+4sESyzDS W1av1j1ftRfTkfC5GwvsziNaqJGuLzvG81UXDeYAE1v1ISX5t01PdG2VWVweUFBdmDw== ARC-Authentication-Results: i=1; smtp2.osuosl.org; dmarc=pass header.from=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P1QjO1fR; arc=none smtp.remote-ip=170.10.133.124 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=david.marchand@redhat.com; receiver= Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P1QjO1fR Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTP id 95F7C40296 for ; Tue, 29 Sep 2026 08:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1790670906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9tN+I4ibSS10ckkp/921ajxsC+HXLajcSWx6vDCObeY=; b=P1QjO1fRRuom59CW3TmL4tPHLEImdBkCOBibtHPL2GKQLszBR/VGv+DE6QqGrwb5ddQNdl Ut0ITRSQFZmMIDnTXJqTZaDThlvvlm8aamdgUYwc6KSzWplVmeiLqp5Jr8SXlJ8qGmkewn MdG8K8lGeil1/rpc77AGBsphigGeDSM= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-W2p002a9O5yduj1qHH8FGA-1; Tue, 29 Sep 2026 04:35:04 -0400 X-MC-Unique: W2p002a9O5yduj1qHH8FGA-1 X-Mimecast-MFC-AGG-ID: W2p002a9O5yduj1qHH8FGA_1790670903 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53DC8195DE7A; Tue, 29 Sep 2026 08:35:03 +0000 (UTC) Received: from dmarchan.redhat.corp (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CDEEE1800576; Tue, 29 Sep 2026 08:35:01 +0000 (UTC) To: dev@openvswitch.org Date: Tue, 29 Sep 2026 10:34:38 +0200 Message-ID: <20260929083446.3428148-4-david.marchand@redhat.com> In-Reply-To: <20260929083446.3428148-1-david.marchand@redhat.com> References: <20260929083446.3428148-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: iWy0zqHy31U-Xu99GqttveckMAoQxLU9y9AUk-e-b1c_1790670903 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [RFC 03/11] netdev-dpdk: Separate ethernet and vhost netdev ops. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Marchand via dev From: David Marchand Reply-To: David Marchand Cc: elibr@nvidia.com, i.maximets@ovn.org Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This is a preparation for separating ethernet and vHost DPDK netdevices. Rename netdev ops specific to ethernet ports, then add specific helpers for ethernet and vHost ports. With this split, the use of the device type becomes unnecessary in some places, but for the rest, rely on the netdev_class. Some notes on the additional cleanups: - a vHost port can not be offloaded, so the helpers related to the dpdk dpif-offload only need to care about is_eth_class(), - dpdk_set_rx_steer_config() is called only from netdev_dpdk_set_config(), so there is no point checking the type, - the construct() op never fails, so make it void, Signed-off-by: David Marchand --- lib/netdev-dpdk.c | 489 ++++++++++++++++++++++++++++------------------ 1 file changed, 304 insertions(+), 185 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 70e02ff670..4c34372389 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -210,11 +210,6 @@ struct netdev_dpdk_sw_stats { uint64_t tx_invalid_hwol_drops; }; -enum dpdk_dev_type { - DPDK_DEV_ETH = 0, - DPDK_DEV_VHOST = 1, -}; - /* Quality of Service */ /* An instance of a QoS configuration. Always associated with a particular @@ -467,7 +462,6 @@ struct netdev_dpdk { int socket_id; int buf_size; int max_packet_len; - enum dpdk_dev_type type; enum netdev_flags flags; int link_reset_cnt; union { @@ -535,7 +529,7 @@ struct netdev_dpdk { /* User input for n_rxq (see dpdk_set_rxq_config). */ int user_n_rxq; /* user_n_rxq + an optional rx steering queue (see - * netdev_dpdk_reconfigure). This field is different from the other + * netdev_dpdk_eth_reconfigure). This field is different from the other * requested_* fields as it may contain a different value than the user * input. */ int requested_n_rxq; @@ -593,8 +587,9 @@ struct netdev_rxq_dpdk { dpdk_port_t port_id; }; -static void netdev_dpdk_destruct(struct netdev *netdev); -static void netdev_dpdk_vhost_destruct(struct netdev *netdev); +static const struct netdev_class netdev_dpdk_class; +static const struct netdev_class netdev_dpdk_vhost_class; +static const struct netdev_class netdev_dpdk_vhost_client_class; static int netdev_dpdk_get_sw_custom_stats(const struct netdev *, struct netdev_custom_stats *); @@ -609,11 +604,23 @@ netdev_dpdk_get_ingress_policer(const struct netdev_dpdk *dev); static void netdev_dpdk_mbuf_dump(const char *prefix, const char *message, const struct rte_mbuf *); +static bool +is_eth_class(const struct netdev_class *class) +{ + return class == &netdev_dpdk_class; +} + +static bool +is_vhost_class(const struct netdev_class *class) +{ + return class == &netdev_dpdk_vhost_class + || class == &netdev_dpdk_vhost_client_class; +} + static bool is_dpdk_class(const struct netdev_class *class) { - return class->destruct == netdev_dpdk_destruct - || class->destruct == netdev_dpdk_vhost_destruct; + return is_eth_class(class) || is_vhost_class(class); } /* DPDK NIC drivers allocate RX buffers at a particular granularity, typically @@ -1046,7 +1053,7 @@ dpdk_watchdog(void *dummy OVS_UNUSED) ovs_mutex_lock(&dpdk_mutex); LIST_FOR_EACH (dev, list_node, &dpdk_list) { ovs_mutex_lock(&dev->mutex); - if (dev->type == DPDK_DEV_ETH) { + if (is_eth_class(dev->up.netdev_class)) { check_link_status(dev); } ovs_mutex_unlock(&dev->mutex); @@ -1464,7 +1471,7 @@ netdev_dpdk_cast(const struct netdev *netdev) } static struct netdev * -netdev_dpdk_alloc(void) +netdev_dpdk_eth_alloc(void) { struct netdev_dpdk *dev; @@ -1494,9 +1501,21 @@ netdev_dpdk_alloc_txq(unsigned int n_txqs) return txqs; } -static int -common_construct(struct netdev *netdev, dpdk_port_t port_no, - enum dpdk_dev_type type, int socket_id) +static struct netdev * +netdev_dpdk_vhost_alloc(void) +{ + struct netdev_dpdk *dev; + + dev = dpdk_rte_mzalloc(sizeof *dev); + if (dev) { + return &dev->up; + } + + return NULL; +} + +static void +common_construct(struct netdev *netdev, dpdk_port_t port_no, int socket_id) OVS_REQUIRES(dpdk_mutex) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); @@ -1511,7 +1530,6 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no, dev->socket_id = socket_id < 0 ? SOCKET0 : socket_id; dev->requested_socket_id = dev->socket_id; dev->port_id = port_no; - dev->type = type; dev->flags = 0; dev->requested_mtu = RTE_ETHER_MTU; dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu); @@ -1561,9 +1579,6 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no, dev->rte_xstats_ids_size = 0; dev->sw_stats = xzalloc(sizeof *dev->sw_stats); - dev->sw_stats->tx_retries = (dev->type == DPDK_DEV_VHOST) ? 0 : UINT64_MAX; - - return 0; } static int @@ -1588,8 +1603,8 @@ vhost_common_construct(struct netdev *netdev) dev->vhost_max_queue_pairs = VHOST_MAX_QUEUE_PAIRS_DEF; - return common_construct(netdev, DPDK_ETH_PORT_ID_INVALID, - DPDK_DEV_VHOST, socket_id); + common_construct(netdev, DPDK_ETH_PORT_ID_INVALID, socket_id); + return 0; } static int @@ -1691,15 +1706,15 @@ netdev_dpdk_vhost_client_construct(struct netdev *netdev) } static int -netdev_dpdk_construct(struct netdev *netdev) +netdev_dpdk_eth_construct(struct netdev *netdev) { - int err; + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); ovs_mutex_lock(&dpdk_mutex); - err = common_construct(netdev, DPDK_ETH_PORT_ID_INVALID, - DPDK_DEV_ETH, SOCKET0); + common_construct(netdev, DPDK_ETH_PORT_ID_INVALID, SOCKET0); + dev->sw_stats->tx_retries = UINT64_MAX; ovs_mutex_unlock(&dpdk_mutex); - return err; + return 0; } static void @@ -1720,7 +1735,7 @@ common_destruct(struct netdev_dpdk *dev) static void dpdk_rx_steer_unconfigure(struct netdev_dpdk *); static void -netdev_dpdk_destruct(struct netdev *netdev) +netdev_dpdk_eth_destruct(struct netdev *netdev) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); @@ -1795,6 +1810,14 @@ netdev_dpdk_destruct(struct netdev *netdev) ovs_mutex_unlock(&dpdk_mutex); } +static void +netdev_dpdk_eth_dealloc(struct netdev *netdev) +{ + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + + rte_free(dev); +} + /* rte_vhost_driver_unregister() can call back destroy_device(), which will * try to acquire 'dpdk_mutex' and possibly 'dev->mutex'. To avoid a * deadlock, none of the mutexes must be held while calling this function. */ @@ -1850,7 +1873,7 @@ out: } static void -netdev_dpdk_dealloc(struct netdev *netdev) +netdev_dpdk_vhost_dealloc(struct netdev *netdev) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); @@ -1957,7 +1980,7 @@ out: } static int -netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args) +netdev_dpdk_eth_get_config(const struct netdev *netdev, struct smap *args) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); @@ -2120,7 +2143,7 @@ static uint64_t netdev_dpdk_last_reset_seq; static atomic_bool netdev_dpdk_pending_reset[RTE_MAX_ETHPORTS]; static void -netdev_dpdk_wait(const struct netdev_class *netdev_class OVS_UNUSED) +netdev_dpdk_eth_wait(const struct netdev_class *netdev_class OVS_UNUSED) { uint64_t last_reset_seq = seq_read(netdev_dpdk_reset_seq); @@ -2132,7 +2155,7 @@ netdev_dpdk_wait(const struct netdev_class *netdev_class OVS_UNUSED) } static void -netdev_dpdk_run(const struct netdev_class *netdev_class OVS_UNUSED) +netdev_dpdk_eth_run(const struct netdev_class *netdev_class OVS_UNUSED) { uint64_t reset_seq = seq_read(netdev_dpdk_reset_seq); @@ -2262,13 +2285,6 @@ dpdk_set_rx_steer_config(struct netdev *netdev, struct netdev_dpdk *dev, netdev_get_name(netdev), arg); } - if (flags && dev->type != DPDK_DEV_ETH) { - VLOG_WARN("%s: options:rx-steering " - "is only supported on ethernet ports", - netdev_get_name(netdev)); - flags = 0; - } - if (flags && dpif_offload_enabled()) { VLOG_WARN("%s: options:rx-steering is incompatible with hw-offload", netdev_get_name(netdev)); @@ -2282,8 +2298,8 @@ dpdk_set_rx_steer_config(struct netdev *netdev, struct netdev_dpdk *dev, } static int -netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, - char **errp) +netdev_dpdk_eth_set_config(struct netdev *netdev, const struct smap *args, + char **errp) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); bool rx_fc_en, tx_fc_en, autoneg, lsc_interrupt_mode; @@ -2530,7 +2546,7 @@ netdev_dpdk_get_numa_id(const struct netdev *netdev) /* Sets the number of tx queues for the dpdk interface. */ static int -netdev_dpdk_set_tx_multiq(struct netdev *netdev, unsigned int n_txq) +netdev_dpdk_eth_set_tx_multiq(struct netdev *netdev, unsigned int n_txq) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); @@ -2549,7 +2565,7 @@ out: } static struct netdev_rxq * -netdev_dpdk_rxq_alloc(void) +netdev_dpdk_eth_rxq_alloc(void) { struct netdev_rxq_dpdk *rx = dpdk_rte_mzalloc(sizeof *rx); @@ -2567,7 +2583,7 @@ netdev_rxq_dpdk_cast(const struct netdev_rxq *rxq) } static int -netdev_dpdk_rxq_construct(struct netdev_rxq *rxq) +netdev_dpdk_eth_rxq_construct(struct netdev_rxq *rxq) { struct netdev_rxq_dpdk *rx = netdev_rxq_dpdk_cast(rxq); struct netdev_dpdk *dev = netdev_dpdk_cast(rxq->netdev); @@ -2585,13 +2601,31 @@ netdev_dpdk_rxq_destruct(struct netdev_rxq *rxq OVS_UNUSED) } static void -netdev_dpdk_rxq_dealloc(struct netdev_rxq *rxq) +netdev_dpdk_eth_rxq_dealloc(struct netdev_rxq *rxq) { struct netdev_rxq_dpdk *rx = netdev_rxq_dpdk_cast(rxq); rte_free(rx); } +static struct netdev_rxq * +netdev_dpdk_vhost_rxq_alloc(void) +{ + return dpdk_rte_mzalloc(sizeof(struct netdev_rxq)); +} + +static int +netdev_dpdk_vhost_rxq_construct(struct netdev_rxq *rxq OVS_UNUSED) +{ + return 0; +} + +static void +netdev_dpdk_vhost_rxq_dealloc(struct netdev_rxq *rxq) +{ + rte_free(rxq); +} + static inline void netdev_dpdk_batch_init_packet_fields(struct dp_packet_batch *batch) { @@ -2976,8 +3010,8 @@ netdev_dpdk_vhost_rxq_enabled(struct netdev_rxq *rxq) } static int -netdev_dpdk_rxq_recv(struct netdev_rxq *rxq, struct dp_packet_batch *batch, - int *qfill) +netdev_dpdk_eth_rxq_recv(struct netdev_rxq *rxq, struct dp_packet_batch *batch, + int *qfill) { struct netdev_rxq_dpdk *rx = netdev_rxq_dpdk_cast(rxq); struct netdev_dpdk *dev = netdev_dpdk_cast(rxq->netdev); @@ -3434,17 +3468,15 @@ netdev_dpdk_eth_send(struct netdev *netdev, int qid, } static int -netdev_dpdk_set_etheraddr__(struct netdev_dpdk *dev, const struct eth_addr mac) +netdev_dpdk_eth_set_etheraddr__(struct netdev_dpdk *dev, + const struct eth_addr mac) OVS_REQUIRES(dev->mutex) { - int err = 0; - - if (dev->type == DPDK_DEV_ETH) { - struct rte_ether_addr ea; + struct rte_ether_addr ea; + int err; - memcpy(ea.addr_bytes, mac.ea, ETH_ADDR_LEN); - err = -rte_eth_dev_default_mac_addr_set(dev->port_id, &ea); - } + memcpy(ea.addr_bytes, mac.ea, ETH_ADDR_LEN); + err = -rte_eth_dev_default_mac_addr_set(dev->port_id, &ea); if (!err) { dev->hwaddr = mac; } else { @@ -3457,14 +3489,14 @@ netdev_dpdk_set_etheraddr__(struct netdev_dpdk *dev, const struct eth_addr mac) } static int -netdev_dpdk_set_etheraddr(struct netdev *netdev, const struct eth_addr mac) +netdev_dpdk_eth_set_etheraddr(struct netdev *netdev, const struct eth_addr mac) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); int err = 0; ovs_mutex_lock(&dev->mutex); if (!eth_addr_equals(dev->hwaddr, mac)) { - err = netdev_dpdk_set_etheraddr__(dev, mac); + err = netdev_dpdk_eth_set_etheraddr__(dev, mac); if (!err) { netdev_change_seq_changed(netdev); } @@ -3475,7 +3507,37 @@ netdev_dpdk_set_etheraddr(struct netdev *netdev, const struct eth_addr mac) } static int -netdev_dpdk_get_etheraddr(const struct netdev *netdev, struct eth_addr *mac) +netdev_dpdk_vhost_set_etheraddr(struct netdev *netdev, + const struct eth_addr mac) +{ + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + + ovs_mutex_lock(&dev->mutex); + if (!eth_addr_equals(dev->hwaddr, mac)) { + dev->hwaddr = mac; + netdev_change_seq_changed(netdev); + } + ovs_mutex_unlock(&dev->mutex); + + return 0; +} + +static int +netdev_dpdk_eth_get_etheraddr(const struct netdev *netdev, + struct eth_addr *mac) +{ + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + + ovs_mutex_lock(&dev->mutex); + *mac = dev->hwaddr; + ovs_mutex_unlock(&dev->mutex); + + return 0; +} + +static int +netdev_dpdk_vhost_get_etheraddr(const struct netdev *netdev, + struct eth_addr *mac) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); @@ -3873,16 +3935,17 @@ netdev_dpdk_convert_xstats(struct netdev_stats *stats, } static int -netdev_dpdk_get_carrier(const struct netdev *netdev, bool *carrier); +netdev_dpdk_eth_get_carrier(const struct netdev *netdev, bool *carrier); static int -netdev_dpdk_get_stats(const struct netdev *netdev, struct netdev_stats *stats) +netdev_dpdk_eth_get_stats(const struct netdev *netdev, + struct netdev_stats *stats) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); struct rte_eth_stats rte_stats; bool gg; - netdev_dpdk_get_carrier(netdev, &gg); + netdev_dpdk_eth_get_carrier(netdev, &gg); ovs_mutex_lock(&dev->mutex); struct rte_eth_xstat *rte_xstats = NULL; @@ -3955,8 +4018,8 @@ out: } static int -netdev_dpdk_get_custom_stats(const struct netdev *netdev, - struct netdev_custom_stats *custom_stats) +netdev_dpdk_eth_get_custom_stats(const struct netdev *netdev, + struct netdev_custom_stats *custom_stats) { uint32_t i; @@ -4055,11 +4118,11 @@ netdev_dpdk_get_sw_custom_stats(const struct netdev *netdev, } static int -netdev_dpdk_get_features(const struct netdev *netdev, - enum netdev_features *current, - enum netdev_features *advertised, - enum netdev_features *supported, - enum netdev_features *peer) +netdev_dpdk_eth_get_features(const struct netdev *netdev, + enum netdev_features *current, + enum netdev_features *advertised, + enum netdev_features *supported, + enum netdev_features *peer) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); struct rte_eth_link link; @@ -4120,8 +4183,8 @@ netdev_dpdk_get_features(const struct netdev *netdev, } static int -netdev_dpdk_get_speed(const struct netdev *netdev, uint32_t *current, - uint32_t *max) +netdev_dpdk_eth_get_speed(const struct netdev *netdev, uint32_t *current, + uint32_t *max) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); struct rte_eth_dev_info dev_info; @@ -4178,7 +4241,7 @@ out: } static int -netdev_dpdk_get_duplex(const struct netdev *netdev, bool *full_duplex) +netdev_dpdk_eth_get_duplex(const struct netdev *netdev, bool *full_duplex) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); int err = 0; @@ -4290,7 +4353,7 @@ netdev_dpdk_get_ifindex(const struct netdev *netdev) } static int -netdev_dpdk_get_carrier(const struct netdev *netdev, bool *carrier) +netdev_dpdk_eth_get_carrier(const struct netdev *netdev, bool *carrier) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); @@ -4322,7 +4385,7 @@ netdev_dpdk_vhost_get_carrier(const struct netdev *netdev, bool *carrier) } static long long int -netdev_dpdk_get_carrier_resets(const struct netdev *netdev) +netdev_dpdk_eth_get_carrier_resets(const struct netdev *netdev) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); long long int carrier_resets; @@ -4335,11 +4398,13 @@ netdev_dpdk_get_carrier_resets(const struct netdev *netdev) } static int -netdev_dpdk_update_flags__(struct netdev_dpdk *dev, - enum netdev_flags off, enum netdev_flags on, - enum netdev_flags *old_flagsp) +netdev_dpdk_eth_update_flags__(struct netdev_dpdk *dev, + enum netdev_flags off, enum netdev_flags on, + enum netdev_flags *old_flagsp) OVS_REQUIRES(dev->mutex) { + struct netdev *netdev = &dev->up; + if ((off | on) & ~(NETDEV_UP | NETDEV_PROMISC)) { return EINVAL; } @@ -4352,48 +4417,83 @@ netdev_dpdk_update_flags__(struct netdev_dpdk *dev, return 0; } - if (dev->type == DPDK_DEV_ETH) { - - if ((dev->flags ^ *old_flagsp) & NETDEV_UP) { - int err; + if ((dev->flags ^ *old_flagsp) & NETDEV_UP) { + int err; - if (dev->flags & NETDEV_UP) { - err = rte_eth_dev_set_link_up(dev->port_id); - } else { - err = rte_eth_dev_set_link_down(dev->port_id); - } - if (err == -ENOTSUP) { - VLOG_INFO("Interface %s does not support link state " - "configuration", netdev_get_name(&dev->up)); - } else if (err < 0) { - VLOG_ERR("Interface %s link change error: %s", - netdev_get_name(&dev->up), rte_strerror(-err)); - dev->flags = *old_flagsp; - return -err; - } + if (dev->flags & NETDEV_UP) { + err = rte_eth_dev_set_link_up(dev->port_id); + } else { + err = rte_eth_dev_set_link_down(dev->port_id); } - - if (dev->flags & NETDEV_PROMISC) { - rte_eth_promiscuous_enable(dev->port_id); + if (err == -ENOTSUP) { + VLOG_INFO("Interface %s does not support link state " + "configuration", netdev_get_name(netdev)); + } else if (err < 0) { + VLOG_ERR("Interface %s link change error: %s", + netdev_get_name(netdev), rte_strerror(-err)); + dev->flags = *old_flagsp; + return -err; } + } - netdev_change_seq_changed(&dev->up); - } else { - /* If DPDK_DEV_VHOST device's NETDEV_UP flag was changed and vhost is - * running then change netdev's change_seq to trigger link state - * update. */ + if (dev->flags & NETDEV_PROMISC) { + rte_eth_promiscuous_enable(dev->port_id); + } - if ((NETDEV_UP & ((*old_flagsp ^ on) | (*old_flagsp ^ off))) - && is_vhost_running(dev)) { - netdev_change_seq_changed(&dev->up); + netdev_change_seq_changed(netdev); - /* Clear statistics if device is getting up. */ - if (NETDEV_UP & on) { - rte_spinlock_lock(&dev->stats_lock); - memset(&dev->stats, 0, sizeof dev->stats); - memset(dev->sw_stats, 0, sizeof *dev->sw_stats); - rte_spinlock_unlock(&dev->stats_lock); - } + return 0; +} + +static int +netdev_dpdk_eth_update_flags(struct netdev *netdev, + enum netdev_flags off, enum netdev_flags on, + enum netdev_flags *old_flagsp) +{ + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + int error; + + ovs_mutex_lock(&dev->mutex); + error = netdev_dpdk_eth_update_flags__(dev, off, on, old_flagsp); + ovs_mutex_unlock(&dev->mutex); + + return error; +} + +static int +netdev_dpdk_vhost_update_flags__(struct netdev_dpdk *dev, + enum netdev_flags off, enum netdev_flags on, + enum netdev_flags *old_flagsp) + OVS_REQUIRES(dev->mutex) +{ + struct netdev *netdev = &dev->up; + + if ((off | on) & ~(NETDEV_UP | NETDEV_PROMISC)) { + return EINVAL; + } + + *old_flagsp = dev->flags; + dev->flags |= on; + dev->flags &= ~off; + + if (dev->flags == *old_flagsp) { + return 0; + } + + /* If vhost device's NETDEV_UP flag was changed and vhost is + * running then change netdev's change_seq to trigger link state + * update. */ + + if ((NETDEV_UP & ((*old_flagsp ^ on) | (*old_flagsp ^ off))) + && is_vhost_running(dev)) { + netdev_change_seq_changed(netdev); + + /* Clear statistics if device is getting up. */ + if (NETDEV_UP & on) { + rte_spinlock_lock(&dev->stats_lock); + memset(&dev->stats, 0, sizeof dev->stats); + memset(dev->sw_stats, 0, sizeof *dev->sw_stats); + rte_spinlock_unlock(&dev->stats_lock); } } @@ -4401,15 +4501,15 @@ netdev_dpdk_update_flags__(struct netdev_dpdk *dev, } static int -netdev_dpdk_update_flags(struct netdev *netdev, - enum netdev_flags off, enum netdev_flags on, - enum netdev_flags *old_flagsp) +netdev_dpdk_vhost_update_flags(struct netdev *netdev, + enum netdev_flags off, enum netdev_flags on, + enum netdev_flags *old_flagsp) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); int error; ovs_mutex_lock(&dev->mutex); - error = netdev_dpdk_update_flags__(dev, off, on, old_flagsp); + error = netdev_dpdk_vhost_update_flags__(dev, off, on, old_flagsp); ovs_mutex_unlock(&dev->mutex); return error; @@ -4506,7 +4606,7 @@ netdev_dpdk_link_speed_to_str__(uint32_t link_speed) } static int -netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) +netdev_dpdk_eth_get_status(const struct netdev *netdev, struct smap *args) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); struct rte_eth_dev_info dev_info; @@ -4605,15 +4705,28 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) } static void -netdev_dpdk_set_admin_state__(struct netdev_dpdk *dev, bool admin_state) +netdev_dpdk_eth_set_admin_state__(struct netdev_dpdk *dev, bool admin_state) OVS_REQUIRES(dev->mutex) { enum netdev_flags old_flags; if (admin_state) { - netdev_dpdk_update_flags__(dev, 0, NETDEV_UP, &old_flags); + netdev_dpdk_eth_update_flags__(dev, 0, NETDEV_UP, &old_flags); } else { - netdev_dpdk_update_flags__(dev, NETDEV_UP, 0, &old_flags); + netdev_dpdk_eth_update_flags__(dev, NETDEV_UP, 0, &old_flags); + } +} + +static void +netdev_dpdk_vhost_set_admin_state__(struct netdev_dpdk *dev, bool admin_state) + OVS_REQUIRES(dev->mutex) +{ + enum netdev_flags old_flags; + + if (admin_state) { + netdev_dpdk_vhost_update_flags__(dev, 0, NETDEV_UP, &old_flags); + } else { + netdev_dpdk_vhost_update_flags__(dev, NETDEV_UP, 0, &old_flags); } } @@ -4639,7 +4752,11 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, int argc, struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); ovs_mutex_lock(&dev->mutex); - netdev_dpdk_set_admin_state__(dev, up); + if (is_eth_class(netdev->netdev_class)) { + netdev_dpdk_eth_set_admin_state__(dev, up); + } else { + netdev_dpdk_vhost_set_admin_state__(dev, up); + } ovs_mutex_unlock(&dev->mutex); netdev_close(netdev); @@ -4654,7 +4771,11 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, int argc, ovs_mutex_lock(&dpdk_mutex); LIST_FOR_EACH (dev, list_node, &dpdk_list) { ovs_mutex_lock(&dev->mutex); - netdev_dpdk_set_admin_state__(dev, up); + if (is_eth_class(dev->up.netdev_class)) { + netdev_dpdk_eth_set_admin_state__(dev, up); + } else { + netdev_dpdk_vhost_set_admin_state__(dev, up); + } ovs_mutex_unlock(&dev->mutex); } ovs_mutex_unlock(&dpdk_mutex); @@ -6199,7 +6320,7 @@ dpdk_rx_steer_unconfigure(struct netdev_dpdk *dev) } static int -netdev_dpdk_reconfigure(struct netdev *netdev) +netdev_dpdk_eth_reconfigure(struct netdev *netdev) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); bool pending_reset; @@ -6266,7 +6387,7 @@ retry: dev->tx_q = NULL; if (!eth_addr_equals(dev->hwaddr, dev->requested_hwaddr)) { - err = netdev_dpdk_set_etheraddr__(dev, dev->requested_hwaddr); + err = netdev_dpdk_eth_set_etheraddr__(dev, dev->requested_hwaddr); if (err) { goto out; } @@ -6285,7 +6406,7 @@ retry: * the requested MAC is kept in sync. * * This is harmless in case requested_hwaddr was - * configured by the user, as netdev_dpdk_set_etheraddr__() + * configured by the user, as netdev_dpdk_eth_set_etheraddr__() * will have succeeded to get to this point. */ dev->requested_hwaddr = dev->hwaddr; @@ -6527,7 +6648,7 @@ netdev_dpdk_get_port_id(struct netdev *netdev) struct netdev_dpdk *dev; int ret = -1; - if (!is_dpdk_class(netdev->netdev_class)) { + if (!is_eth_class(netdev->netdev_class)) { goto out; } @@ -6545,23 +6666,21 @@ netdev_dpdk_flow_api_supported(struct netdev *netdev, bool check_only) struct netdev_dpdk *dev; bool ret = false; - if (!is_dpdk_class(netdev->netdev_class)) { + if (!is_eth_class(netdev->netdev_class)) { goto out; } dev = netdev_dpdk_cast(netdev); ovs_mutex_lock(&dev->mutex); - if (dev->type == DPDK_DEV_ETH) { - if (dev->requested_rx_steer_flags && !check_only) { - VLOG_WARN("%s: rx-steering is mutually exclusive with hw-offload," - " falling back to default rss mode", - netdev_get_name(netdev)); - dev->requested_rx_steer_flags = 0; - netdev_request_reconfigure(netdev); - } - /* TODO: Check if we able to offload some minimal flow. */ - ret = true; + if (dev->requested_rx_steer_flags && !check_only) { + VLOG_WARN("%s: rx-steering is mutually exclusive with hw-offload," + " falling back to default rss mode", + netdev_get_name(netdev)); + dev->requested_rx_steer_flags = 0; + netdev_request_reconfigure(netdev); } + /* TODO: Check if we able to offload some minimal flow. */ + ret = true; ovs_mutex_unlock(&dev->mutex); out: return ret; @@ -6612,7 +6731,7 @@ netdev_dpdk_rte_flow_query_count(struct netdev *netdev, struct netdev_dpdk *dev; int ret; - if (!is_dpdk_class(netdev->netdev_class)) { + if (!is_eth_class(netdev->netdev_class)) { return -1; } @@ -6750,33 +6869,33 @@ parse_vhost_config(const struct smap *ovs_other_config) vhost_postcopy_enabled ? "enabled" : "disabled"); } -static const struct netdev_class dpdk_class = { +static const struct netdev_class netdev_dpdk_class = { .type = "dpdk", .is_pmd = true, .init = netdev_dpdk_class_init, - .run = netdev_dpdk_run, - .wait = netdev_dpdk_wait, - .alloc = netdev_dpdk_alloc, - .construct = netdev_dpdk_construct, - .destruct = netdev_dpdk_destruct, - .dealloc = netdev_dpdk_dealloc, - .get_config = netdev_dpdk_get_config, - .set_config = netdev_dpdk_set_config, + .run = netdev_dpdk_eth_run, + .wait = netdev_dpdk_eth_wait, + .alloc = netdev_dpdk_eth_alloc, + .construct = netdev_dpdk_eth_construct, + .destruct = netdev_dpdk_eth_destruct, + .dealloc = netdev_dpdk_eth_dealloc, + .get_config = netdev_dpdk_eth_get_config, + .set_config = netdev_dpdk_eth_set_config, .get_numa_id = netdev_dpdk_get_numa_id, - .set_tx_multiq = netdev_dpdk_set_tx_multiq, + .set_tx_multiq = netdev_dpdk_eth_set_tx_multiq, .send = netdev_dpdk_eth_send, - .set_etheraddr = netdev_dpdk_set_etheraddr, - .get_etheraddr = netdev_dpdk_get_etheraddr, + .set_etheraddr = netdev_dpdk_eth_set_etheraddr, + .get_etheraddr = netdev_dpdk_eth_get_etheraddr, .get_mtu = netdev_dpdk_get_mtu, .set_mtu = netdev_dpdk_set_mtu, .get_ifindex = netdev_dpdk_get_ifindex, - .get_carrier = netdev_dpdk_get_carrier, - .get_carrier_resets = netdev_dpdk_get_carrier_resets, - .get_stats = netdev_dpdk_get_stats, - .get_custom_stats = netdev_dpdk_get_custom_stats, - .get_features = netdev_dpdk_get_features, - .get_speed = netdev_dpdk_get_speed, - .get_duplex = netdev_dpdk_get_duplex, + .get_carrier = netdev_dpdk_eth_get_carrier, + .get_carrier_resets = netdev_dpdk_eth_get_carrier_resets, + .get_stats = netdev_dpdk_eth_get_stats, + .get_custom_stats = netdev_dpdk_eth_get_custom_stats, + .get_features = netdev_dpdk_eth_get_features, + .get_speed = netdev_dpdk_eth_get_speed, + .get_duplex = netdev_dpdk_eth_get_duplex, .set_policing = netdev_dpdk_set_policing, .get_qos_types = netdev_dpdk_get_qos_types, .get_qos = netdev_dpdk_get_qos, @@ -6788,28 +6907,28 @@ static const struct netdev_class dpdk_class = { .queue_dump_start = netdev_dpdk_queue_dump_start, .queue_dump_next = netdev_dpdk_queue_dump_next, .queue_dump_done = netdev_dpdk_queue_dump_done, - .get_status = netdev_dpdk_get_status, - .update_flags = netdev_dpdk_update_flags, - .reconfigure = netdev_dpdk_reconfigure, - .rxq_alloc = netdev_dpdk_rxq_alloc, - .rxq_construct = netdev_dpdk_rxq_construct, + .get_status = netdev_dpdk_eth_get_status, + .update_flags = netdev_dpdk_eth_update_flags, + .reconfigure = netdev_dpdk_eth_reconfigure, + .rxq_alloc = netdev_dpdk_eth_rxq_alloc, + .rxq_construct = netdev_dpdk_eth_rxq_construct, .rxq_destruct = netdev_dpdk_rxq_destruct, - .rxq_dealloc = netdev_dpdk_rxq_dealloc, - .rxq_recv = netdev_dpdk_rxq_recv, + .rxq_dealloc = netdev_dpdk_eth_rxq_dealloc, + .rxq_recv = netdev_dpdk_eth_rxq_recv, }; -static const struct netdev_class dpdk_vhost_class = { +static const struct netdev_class netdev_dpdk_vhost_class = { .type = "dpdkvhostuser", .is_pmd = true, .init = netdev_dpdk_vhost_class_init, - .alloc = netdev_dpdk_alloc, + .alloc = netdev_dpdk_vhost_alloc, .construct = netdev_dpdk_vhost_construct, .destruct = netdev_dpdk_vhost_destruct, - .dealloc = netdev_dpdk_dealloc, + .dealloc = netdev_dpdk_vhost_dealloc, .get_numa_id = netdev_dpdk_get_numa_id, .send = netdev_dpdk_vhost_send, - .set_etheraddr = netdev_dpdk_set_etheraddr, - .get_etheraddr = netdev_dpdk_get_etheraddr, + .set_etheraddr = netdev_dpdk_vhost_set_etheraddr, + .get_etheraddr = netdev_dpdk_vhost_get_etheraddr, .get_mtu = netdev_dpdk_get_mtu, .set_mtu = netdev_dpdk_set_mtu, .get_ifindex = netdev_dpdk_get_ifindex, @@ -6828,30 +6947,30 @@ static const struct netdev_class dpdk_vhost_class = { .queue_dump_next = netdev_dpdk_queue_dump_next, .queue_dump_done = netdev_dpdk_queue_dump_done, .get_status = netdev_dpdk_vhost_user_get_status, - .update_flags = netdev_dpdk_update_flags, + .update_flags = netdev_dpdk_vhost_update_flags, .reconfigure = netdev_dpdk_vhost_reconfigure, - .rxq_alloc = netdev_dpdk_rxq_alloc, - .rxq_construct = netdev_dpdk_rxq_construct, + .rxq_alloc = netdev_dpdk_vhost_rxq_alloc, + .rxq_construct = netdev_dpdk_vhost_rxq_construct, .rxq_destruct = netdev_dpdk_rxq_destruct, - .rxq_dealloc = netdev_dpdk_rxq_dealloc, + .rxq_dealloc = netdev_dpdk_vhost_rxq_dealloc, .rxq_enabled = netdev_dpdk_vhost_rxq_enabled, .rxq_recv = netdev_dpdk_vhost_rxq_recv, }; -static const struct netdev_class dpdk_vhost_client_class = { +static const struct netdev_class netdev_dpdk_vhost_client_class = { .type = "dpdkvhostuserclient", .is_pmd = true, .init = netdev_dpdk_vhost_class_init, - .alloc = netdev_dpdk_alloc, + .alloc = netdev_dpdk_vhost_alloc, .construct = netdev_dpdk_vhost_client_construct, .destruct = netdev_dpdk_vhost_destruct, - .dealloc = netdev_dpdk_dealloc, + .dealloc = netdev_dpdk_vhost_dealloc, .get_config = netdev_dpdk_vhost_client_get_config, .set_config = netdev_dpdk_vhost_client_set_config, .get_numa_id = netdev_dpdk_get_numa_id, .send = netdev_dpdk_vhost_send, - .set_etheraddr = netdev_dpdk_set_etheraddr, - .get_etheraddr = netdev_dpdk_get_etheraddr, + .set_etheraddr = netdev_dpdk_vhost_set_etheraddr, + .get_etheraddr = netdev_dpdk_vhost_get_etheraddr, .get_mtu = netdev_dpdk_get_mtu, .set_mtu = netdev_dpdk_set_mtu, .get_ifindex = netdev_dpdk_get_ifindex, @@ -6870,12 +6989,12 @@ static const struct netdev_class dpdk_vhost_client_class = { .queue_dump_next = netdev_dpdk_queue_dump_next, .queue_dump_done = netdev_dpdk_queue_dump_done, .get_status = netdev_dpdk_vhost_user_get_status, - .update_flags = netdev_dpdk_update_flags, + .update_flags = netdev_dpdk_vhost_update_flags, .reconfigure = netdev_dpdk_vhost_client_reconfigure, - .rxq_alloc = netdev_dpdk_rxq_alloc, - .rxq_construct = netdev_dpdk_rxq_construct, + .rxq_alloc = netdev_dpdk_vhost_rxq_alloc, + .rxq_construct = netdev_dpdk_vhost_rxq_construct, .rxq_destruct = netdev_dpdk_rxq_destruct, - .rxq_dealloc = netdev_dpdk_rxq_dealloc, + .rxq_dealloc = netdev_dpdk_vhost_rxq_dealloc, .rxq_enabled = netdev_dpdk_vhost_rxq_enabled, .rxq_recv = netdev_dpdk_vhost_rxq_recv, }; @@ -6887,7 +7006,7 @@ netdev_dpdk_register(const struct smap *ovs_other_config) parse_user_mempools_list(ovs_other_config); parse_vhost_config(ovs_other_config); - netdev_register_provider(&dpdk_class); - netdev_register_provider(&dpdk_vhost_class); - netdev_register_provider(&dpdk_vhost_client_class); + netdev_register_provider(&netdev_dpdk_class); + netdev_register_provider(&netdev_dpdk_vhost_class); + netdev_register_provider(&netdev_dpdk_vhost_client_class); }