From mboxrd@z Thu Jan 1 00:00:00 1970 From: Declan Doherty Subject: [PATCH v6 4/8] ethdev: Add port representor device flag Date: Wed, 28 Mar 2018 14:54:29 +0100 Message-ID: <20180328135433.20203-5-declan.doherty@intel.com> References: <20180328135433.20203-1-declan.doherty@intel.com> Cc: Alex Rosenbaum , Ferruh Yigit , Thomas Monjalon , Shahaf Shuler , Qi Zhang , Alejandro Lucero , Andrew Rybchenko , Mohammad Abdul Awal , Remy Horton , John McNamara , Rony Efraim , Wu@dpdk.org, Jingjing , Lu@dpdk.org, Wenzhuo , Vincent JArdin , Yuanhan Liu , Richardson@dpdk.org, Bruce , Ananyev@dpdk.org, Konstantin , Wang@dpdk.org, Zhihong , Declan Doherty To: dev@dpdk.org Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 1988F5F19 for ; Wed, 28 Mar 2018 16:03:00 +0200 (CEST) In-Reply-To: <20180328135433.20203-1-declan.doherty@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add new device flag to specify that ethdev port is a port representor. Extend rte_eth_dev_info structure to expose device flags to user which enable applications to discover if a port is a representor port. Signed-off-by: Declan Doherty --- lib/librte_ether/rte_ethdev.c | 1 + lib/librte_ether/rte_ethdev.h | 9 ++++++--- lib/librte_ether/rte_ethdev_representor.h | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index c719f84a3..163246433 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -2399,6 +2399,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) dev_info->nb_rx_queues = dev->data->nb_rx_queues; dev_info->nb_tx_queues = dev->data->nb_tx_queues; dev_info->switch_id = dev->data->switch_id; + dev_info->dev_flags = dev->data->dev_flags; } int diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index dced4fc41..226acc8b1 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -996,6 +996,7 @@ struct rte_eth_dev_info { const char *driver_name; /**< Device Driver name. */ unsigned int if_index; /**< Index to bound host interface, or 0 if none. Use if_indextoname() to translate into an interface name. */ + uint32_t dev_flags; /**< Device flags */ uint32_t min_rx_bufsize; /**< Minimum size of RX buffer. */ uint32_t max_rx_pktlen; /**< Maximum configurable length of RX pkt. */ uint16_t max_rx_queues; /**< Maximum number of RX queues. */ @@ -1229,11 +1230,13 @@ struct rte_eth_dev_owner { }; /** Device supports link state interrupt */ -#define RTE_ETH_DEV_INTR_LSC 0x0002 +#define RTE_ETH_DEV_INTR_LSC 0x0002 /** Device is a bonded slave */ -#define RTE_ETH_DEV_BONDED_SLAVE 0x0004 +#define RTE_ETH_DEV_BONDED_SLAVE 0x0004 /** Device supports device removal interrupt */ -#define RTE_ETH_DEV_INTR_RMV 0x0008 +#define RTE_ETH_DEV_INTR_RMV 0x0008 +/** Device is port representor */ +#define RTE_ETH_DEV_REPRESENTOR 0x0010 /** * @warning diff --git a/lib/librte_ether/rte_ethdev_representor.h b/lib/librte_ether/rte_ethdev_representor.h index cbc1f2855..f3726d0ba 100644 --- a/lib/librte_ether/rte_ethdev_representor.h +++ b/lib/librte_ether/rte_ethdev_representor.h @@ -22,6 +22,9 @@ eth_dev_representor_port_init(struct rte_eth_dev *ethdev, void *init_params) /** representor inherits the switch id of it's base device */ ethdev->data->switch_id = base_ethdev->data->switch_id; + /** Set device flags to specify that device is a representor port */ + ethdev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR; + return 0; } -- 2.14.3