From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 252C07E10 for ; Sun, 28 Sep 2014 05:44:32 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 27 Sep 2014 20:48:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,612,1406617200"; d="scan'208";a="580123456" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 27 Sep 2014 20:51:01 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 27 Sep 2014 20:51:01 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 27 Sep 2014 20:51:00 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.230]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.204]) with mapi id 14.03.0195.001; Sun, 28 Sep 2014 11:50:59 +0800 From: "Zhang, Helin" To: "Ding, HengX" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] ethdev: The users could get device types now Thread-Index: AQHP2sxCcPW85ys7+0GCtVqYtc+PkZwV6SJA Date: Sun, 28 Sep 2014 03:50:58 +0000 Message-ID: References: <1411874836-3274-1-git-send-email-hengx.ding@intel.com> In-Reply-To: <1411874836-3274-1-git-send-email-hengx.ding@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] ethdev: The users could get device types now 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: Sun, 28 Sep 2014 03:44:33 -0000 Acked-by: Helin Zhang > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ding Heng > Sent: Sunday, September 28, 2014 11:27 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] ethdev: The users could get device types now >=20 > As different PMDs support different features, application may want to kno= w > the NIC type of a port, then decide how to use that port. > Add a new field in struct rte_eth_dev, users are able to get device type = now. >=20 > Signed-off-by: Ding Heng > --- > lib/librte_ether/rte_ethdev.c | 32 ++++++++++++++++++++++++++++++++ > lib/librte_ether/rte_ethdev.h | 20 ++++++++++++++++++++ > 2 files changed, 52 insertions(+) >=20 > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.= c index > fd1010a..490ea3a 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -235,6 +235,38 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv, > if (diag =3D=3D 0) > return (0); >=20 > + /* Define the device type */ > + if (strcmp(eth_drv->pci_drv.name, "rte_i40e_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_I40E; > + else if (strcmp(eth_drv->pci_drv.name, "rte_i40evf_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_I40E_VF; > + else if (strcmp(eth_drv->pci_drv.name, "rte_em_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_EM; > + else if (strcmp(eth_drv->pci_drv.name, "rte_igb_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_IGB; > + else if (strcmp(eth_drv->pci_drv.name, "rte_igbvf_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_IGB_VF; > + else if (strcmp(eth_drv->pci_drv.name, "rte_ixgbe_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_IXGBE; > + else if (strcmp(eth_drv->pci_drv.name, "rte_ixgbevf_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_IXGBE_VF; > + else if (strcmp(eth_drv->pci_drv.name, "eth_bond") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_BOND; > + else if (strcmp(eth_drv->pci_drv.name, "eth_ring") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_RING; > + else if (strcmp(eth_drv->pci_drv.name, "rte_virtio_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_VIRTIO; > + else if (strcmp(eth_drv->pci_drv.name, "rte_vmxnet3_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_VMXNET3; > + else if (strcmp(eth_drv->pci_drv.name, "eth_xenvirt") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_XENVIRT; > + else if (strcmp(eth_drv->pci_drv.name, "rte_max_pmd") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_MAX; > + else if (strcmp(eth_drv->pci_drv.name, "eth_pcap") =3D=3D 0) > + eth_dev->dev_type =3D ETH_DEV_PCAP; > + else > + eth_dev->dev_type =3D ETH_DEV_UNKNOWN; > + > PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=3D0x%u > device_id=3D0x%x)" > " failed\n", pci_drv->name, > (unsigned) pci_dev->id.vendor_id, > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.= h index > 50df654..83a7ea5 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -268,6 +268,25 @@ enum rte_eth_rx_mq_mode { > ETH_MQ_RX_VMDQ_DCB_RSS, /**< Enable both VMDQ and DCB in > VMDq */ }; >=20 > +/*Device type*/ > +enum rte_eth_dev_type { > + ETH_DEV_UNKNOWN =3D 0, > + ETH_DEV_EM, > + ETH_DEV_IGB, > + ETH_DEV_IGB_VF, > + ETH_DEV_IXGBE, > + ETH_DEV_IXGBE_VF, > + ETH_DEV_I40E, > + ETH_DEV_I40E_VF, > + ETH_DEV_BOND, > + ETH_DEV_PCAP, > + ETH_DEV_RING, > + ETH_DEV_VIRTIO, > + ETH_DEV_VMXNET3, > + ETH_DEV_XENVIRT, > + ETH_DEV_MAX > +}; > + > /** > * for rx mq mode backward compatible > */ > @@ -1487,6 +1506,7 @@ struct rte_eth_dev { > struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */ > struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */ > struct rte_eth_dev_cb_list callbacks; /**< User application callbacks *= / > + enum rte_eth_dev_type dev_type; /**< Device type info. */ > }; >=20 > struct rte_eth_dev_sriov { > -- > 1.9.3