From patchwork Fri Sep 8 13:20:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Weglicki, MichalX" X-Patchwork-Id: 811592 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xpdZG13nDz9s7p for ; Fri, 8 Sep 2017 23:33:41 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2DE08A95; Fri, 8 Sep 2017 13:33:36 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 767D1A92 for ; Fri, 8 Sep 2017 13:33:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 0DBA21D7 for ; Fri, 8 Sep 2017 13:33:34 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 08 Sep 2017 06:33:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,361,1500966000"; d="scan'208";a="133205762" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 08 Sep 2017 06:33:33 -0700 Received: from silpixa00389819.ir.intel.com (silpixa00389819.ir.intel.com [10.237.219.152]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id v88DXW7A024601; Fri, 8 Sep 2017 14:33:32 +0100 From: Michal Weglicki To: dev@openvswitch.org Date: Fri, 8 Sep 2017 14:20:12 +0100 Message-Id: <1504876813-105276-1-git-send-email-michalx.weglicki@intel.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v3 1/2] netdev-dpdk: extend netdev_dpdk_get_status to include if_type and if_descr X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This commit extends netdev_dpdk_get_status API to include additional driver-related information: if_type and if_descr. Signed-off-by: Przemyslaw Szczerbik Signed-off-by: Michal Weglicki --- v2-v3: Code rebase. --- lib/netdev-dpdk.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index f58e9be..14301dc 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "dirs.h" #include "dp-packet.h" @@ -156,6 +157,11 @@ typedef uint8_t dpdk_port_t; #define VHOST_ENQ_RETRY_NUM 8 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ) +/* ifType value '6' is used for all ethernet-like interfaces, regardless of +* speed or link-layer encapsulation in use. +* Cf. IETF RFC 3635 Section 3.2.4. */ +#define IF_TYPE_ETHERNETCSMACD 6 + static const struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, @@ -2446,6 +2452,11 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) dev_info.max_hash_mac_addrs); smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs); smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools); + /* Once DPDK library supports retrieving ifType we should get this value + * directly from DPDK rather than hardcoding it. */ + smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD); + smap_add_format(args, "if_descr", "%s %s", rte_version(), + dev_info.driver_name); if (dev_info.pci_dev) { smap_add_format(args, "pci-vendor_id", "0x%u",