From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id BBDE78D8C for ; Thu, 26 Apr 2018 12:49:34 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2018 03:49:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,330,1520924400"; d="scan'208";a="53809275" Received: from dwdohert-ws.ir.intel.com ([163.33.210.60]) by orsmga002.jf.intel.com with ESMTP; 26 Apr 2018 03:49:26 -0700 From: Declan Doherty To: dev@dpdk.org Cc: Adrien Mazarguil , Ferruh Yigit , Thomas Monjalon , Shahaf Shuler , Konstantin Ananyev , Declan Doherty Date: Thu, 26 Apr 2018 11:40:58 +0100 Message-Id: <20180426104105.18342-3-declan.doherty@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180426104105.18342-1-declan.doherty@intel.com> References: <20180416130605.6509-1-declan.doherty@intel.com> <20180426104105.18342-1-declan.doherty@intel.com> Subject: [dpdk-dev] [PATCH v8 2/9] ethdev: add switch identifier parameter to port X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Apr 2018 10:49:35 -0000 Introduces a new port attribute to ethdev port's which denotes the switch domain a port belongs to. By default all port's switch identifiers are set to RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID. Ports which supported the concept of switch domains can be configured with the same switch domain id. Signed-off-by: Declan Doherty --- app/test-pmd/config.c | 12 ++++++++++++ lib/librte_ether/rte_ethdev.h | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 216a7eb4e..26f416100 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -517,6 +517,18 @@ port_infos_display(portid_t port_id) printf("Min possible number of TXDs per queue: %hu\n", dev_info.tx_desc_lim.nb_min); printf("TXDs number alignment: %hu\n", dev_info.tx_desc_lim.nb_align); + + /* Show switch info only if valid switch domain and port id is set */ + if (dev_info.switch_info.domain_id != + RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID) { + if (dev_info.switch_info.name) + printf("Switch name: %s\n", dev_info.switch_info.name); + + printf("Switch domain Id: %u\n", + dev_info.switch_info.domain_id); + printf("Switch Port Id: %u\n", + dev_info.switch_info.port_id); + } } void diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index efd84bb7b..06d9b288b 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1026,6 +1026,28 @@ struct rte_eth_dev_portconf { uint16_t nb_queues; /**< Device-preferred number of queues */ }; +/** + * Default values for switch domain id when ethdev does not support switch + * domain definitions. + */ +#define RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID (0) + +/** + * Ethernet device associated switch information + */ +struct rte_eth_switch_info { + const char *name; /**< switch name */ + uint16_t domain_id; /**< switch domain id */ + uint16_t port_id; + /**< + * mapping to the devices physical switch port as enumerated from the + * perspective of the embedded interconnect/switch. For SR-IOV enabled + * device this may correspond to the VF_ID of each virtual function, + * but each driver should explicitly define the mapping of switch + * port identifier to that physical interconnect/switch + */ +}; + /** * Ethernet device information */ @@ -1073,6 +1095,11 @@ struct rte_eth_dev_info { struct rte_eth_dev_portconf default_txportconf; /** Generic device capabilities (RTE_ETH_DEV_CAPA_). */ uint64_t dev_capa; + /** + * Switching information for ports on a device with a + * embedded managed interconnect/switch. + */ + struct rte_eth_switch_info switch_info; }; /** -- 2.14.3