From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 3D8B9376D for ; Tue, 1 Sep 2015 14:03:56 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 01 Sep 2015 05:03:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,448,1437462000"; d="scan'208";a="759937883" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.208.62]) by orsmga001.jf.intel.com with SMTP; 01 Sep 2015 05:03:49 -0700 Received: by (sSMTP sendmail emulation); Tue, 01 Sep 2015 13:03:49 +0025 Date: Tue, 1 Sep 2015 13:03:49 +0100 From: Bruce Richardson To: "Iremonger, Bernard" Message-ID: <20150901120348.GA10552@bricha3-MOBL3> References: <1440690041-32391-2-git-send-email-bernard.iremonger@intel.com> <3040981.rvdZqrEcfG@xps13> <8CEF83825BEC744B83065625E567D7C219F49A14@IRSMSX108.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8CEF83825BEC744B83065625E567D7C219F49A14@IRSMSX108.ger.corp.intel.com> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [RFC PATCH 1/6] librte_ether: add fields from rte_pci_driver to rte_eth_dev and rte_eth_dev_data. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2015 12:03:56 -0000 On Tue, Sep 01, 2015 at 11:38:31AM +0000, Iremonger, Bernard wrote: > Hi THomas, > > > > > > @@ -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. > > The dev_type field is not new, just using it now to distinguish between PCI and non PCI devices. > > I have moved some of the RTE_PCI_DRV flags to a new dev_flags field in struct rte_eth_dev{}, > These flags are independent of the driver type (PCI or non PCI). > Do you have view on this new dev_flags field and macros? > > Regards, > > Bernard. > Just to give my 2c. The branch in the snippet above should not exist. Each PMD should set the data numa_node and the flags fields appropriately at initialization, either directly or by copying in the relevant data from the interface specific structure e.g. pci. The ethdev should never need to check the device type here, it should always just read data->numa_node. /Bruce