From patchwork Fri Oct 7 11:16:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 1687356 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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=AjYySDSw; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MkQjx4jVZz20Zg for ; Fri, 7 Oct 2022 22:16:37 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C931E41185; Fri, 7 Oct 2022 11:16:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C931E41185 Authentication-Results: smtp2.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=AjYySDSw X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G3RISOG5mfKX; Fri, 7 Oct 2022 11:16:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 610BE414E6; Fri, 7 Oct 2022 11:16:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 610BE414E6 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 26327C007F; Fri, 7 Oct 2022 11:16:30 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 88B28C002D for ; Fri, 7 Oct 2022 11:16:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 707AB61127 for ; Fri, 7 Oct 2022 11:16:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 707AB61127 Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AjYySDSw X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TgzLhsfGBkn7 for ; Fri, 7 Oct 2022 11:16:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org A69D16111C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id A69D16111C for ; Fri, 7 Oct 2022 11:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665141386; 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=0aN0/mVKES9eVDIocyEuRnZ9koUWZJsZ7WbEwGLVbzY=; b=AjYySDSweHcXiA8OI19aKHtjzroM7I/IXi5TsMaYoS7La0yfZ4hP+zm2rbo5ZgizioN8aS R8J0RWDlkXGU83/WrDUoa2us4DLryRkBLkQ9OHh/fzq7cJTExzeXT1Qcsnf5SAg7ukt4L1 oh5Ng+bOprfFQjs5Fx1xIu/Z2EF72Q4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-533-Zx_ot6qUMKWFmv6zvkmZTw-1; Fri, 07 Oct 2022 07:16:25 -0400 X-MC-Unique: Zx_ot6qUMKWFmv6zvkmZTw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3934395E3A7; Fri, 7 Oct 2022 11:16:25 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A4D92024CBB; Fri, 7 Oct 2022 11:16:23 +0000 (UTC) From: David Marchand To: dev@openvswitch.org Date: Fri, 7 Oct 2022 13:16:11 +0200 Message-Id: <20221007111613.1695524-2-david.marchand@redhat.com> In-Reply-To: <20221007111613.1695524-1-david.marchand@redhat.com> References: <20221007111613.1695524-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: maxime.coquelin@redhat.com Subject: [ovs-dev] [PATCH dpdk-latest v2 1/3] netdev-dpdk: Report device bus specific information. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 22.11 dropped direct access to bus specific structures. Instead, a new API has been added. Report bus name and device bus specific information. The difference looks like: -driver_name=mlx5_pci, if_descr="DPDK 21.11.0 mlx5_pci" +driver_name=mlx5_pci, if_descr="DPDK 22.11.0-rc0 mlx5_pci" -pci-device_id="0x1019" -pci-vendor_id="0x15b3" +bus_info="bus_name=pci, vendor_id=15b3, device_id=1019" Signed-off-by: David Marchand Acked-by: Sunil Pai G --- lib/netdev-dpdk.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 0dd655507b..fb4b3282dc 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -26,9 +26,10 @@ #include #include -#include +#include #include #include +#include #include #include #include @@ -3639,6 +3640,7 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); struct rte_eth_dev_info dev_info; + const char *bus_info; uint32_t link_speed; uint32_t dev_flags; @@ -3651,19 +3653,8 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) rte_eth_dev_info_get(dev->port_id, &dev_info); link_speed = dev->link.link_speed; dev_flags = *dev_info.dev_flags; + bus_info = rte_dev_bus_info(dev_info.device); ovs_mutex_unlock(&dev->mutex); - const struct rte_bus *bus; - const struct rte_pci_device *pci_dev; - uint16_t vendor_id = RTE_PCI_ANY_ID; - uint16_t device_id = RTE_PCI_ANY_ID; - bus = rte_bus_find_by_device(dev_info.device); - if (bus && !strcmp(bus->name, "pci")) { - pci_dev = RTE_DEV_TO_PCI(dev_info.device); - if (pci_dev) { - vendor_id = pci_dev->id.vendor_id; - device_id = pci_dev->id.device_id; - } - } ovs_mutex_unlock(&dpdk_mutex); smap_add_format(args, "port_no", DPDK_PORT_ID_FMT, dev->port_id); @@ -3687,8 +3678,10 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD); smap_add_format(args, "if_descr", "%s %s", rte_version(), dev_info.driver_name); - smap_add_format(args, "pci-vendor_id", "0x%x", vendor_id); - smap_add_format(args, "pci-device_id", "0x%x", device_id); + smap_add_format(args, "bus_info", "bus_name=%s%s%s", + rte_bus_name(rte_dev_bus(dev_info.device)), + bus_info != NULL ? ", " : "", + bus_info != NULL ? bus_info : ""); /* Not all link speeds are defined in the OpenFlow specs e.g. 25 Gbps. * In that case the speed will not be reported as part of the usual