From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data. Date: Mon, 31 Aug 2015 16:07:51 +0200 Message-ID: <3040981.rvdZqrEcfG@xps13> References: <1440690041-32391-2-git-send-email-bernard.iremonger@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Bernard Iremonger Return-path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by dpdk.org (Postfix) with ESMTP id A86C991C8 for ; Mon, 31 Aug 2015 16:09:02 +0200 (CEST) Received: by wiclp12 with SMTP id lp12so771237wic.1 for ; Mon, 31 Aug 2015 07:09:02 -0700 (PDT) In-Reply-To: <1440690041-32391-2-git-send-email-bernard.iremonger@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2015-08-27 16:40, Bernard Iremonger: > add dev_flags to rte_eth_dev, add macros for dev_flags. > add numa_node to rte_eth_dev_data. > use dev_type to distinguish between vdev's and pdev's. > remove unused RTE_ETH_DEV_MAX. > > Signed-off-by: Bernard Iremonger [...] > @@ -424,7 +425,10 @@ rte_eth_dev_socket_id(uint8_t port_id) > { > if (!rte_eth_dev_is_valid_port(port_id)) > return -1; > - return rte_eth_devices[port_id].pci_dev->numa_node; > + if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI) > + return rte_eth_devices[port_id].pci_dev->numa_node; > + else > + return rte_eth_devices[port_id].data->numa_node; Clearly not the way to go. We should remove the special cases (PCI, PDEV, VDEV) instead of adding more checks.