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 8814A3DC for ; Fri, 3 Mar 2017 16:27:14 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2017 07:27:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,237,1484035200"; d="scan'208";a="71846590" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga005.fm.intel.com with ESMTP; 03 Mar 2017 07:27:13 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 3 Mar 2017 07:27:12 -0800 Received: from fmsmsx113.amr.corp.intel.com ([169.254.13.17]) by FMSMSX155.amr.corp.intel.com ([169.254.5.163]) with mapi id 14.03.0248.002; Fri, 3 Mar 2017 07:27:12 -0800 From: "Wiles, Keith" To: Pascal Mazon CC: "dev@dpdk.org" Thread-Topic: [PATCH 2/6] net/tap: add speed capabilities Thread-Index: AQHSlAMplxepzJyP2Eyvdg9cUBk8a6GDw1eA Date: Fri, 3 Mar 2017 15:27:12 +0000 Message-ID: References: <0e99fe0868cca2bfbc03a7f99ca3dbfb9a9d42ea.1488534161.git.pascal.mazon@6wind.com> In-Reply-To: <0e99fe0868cca2bfbc03a7f99ca3dbfb9a9d42ea.1488534161.git.pascal.mazon@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.49.209] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 2/6] net/tap: add speed capabilities 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: Fri, 03 Mar 2017 15:27:15 -0000 > On Mar 3, 2017, at 3:46 AM, Pascal Mazon wrote: >=20 > Tap PMD is flexible, it supports any speed. >=20 > Signed-off-by: Pascal Mazon > --- > doc/guides/nics/features/tap.ini | 1 + > drivers/net/tap/rte_eth_tap.c | 35 +++++++++++++++++++++++++++++++++++ > 2 files changed, 36 insertions(+) >=20 > diff --git a/doc/guides/nics/features/tap.ini b/doc/guides/nics/features/= tap.ini > index d9b47a003654..dad5a0561087 100644 > --- a/doc/guides/nics/features/tap.ini > +++ b/doc/guides/nics/features/tap.ini > @@ -9,6 +9,7 @@ Jumbo frame =3D Y > Promiscuous mode =3D Y > Allmulticast mode =3D Y > Basic stats =3D Y > +Speed capabilities =3D Y > Unicast MAC filter =3D Y > Other kdrv =3D Y > ARMv7 =3D Y > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.= c > index 994c8be701c8..6670dfbb35ce 100644 > --- a/drivers/net/tap/rte_eth_tap.c > +++ b/drivers/net/tap/rte_eth_tap.c > @@ -351,6 +351,40 @@ tap_dev_configure(struct rte_eth_dev *dev __rte_unus= ed) > return 0; > } >=20 > +static uint32_t > +tap_dev_speed_capa(void) > +{ > + uint32_t speed =3D pmd_link.link_speed; > + uint32_t capa =3D 0; > + > + if (speed >=3D ETH_SPEED_NUM_10M) > + capa |=3D ETH_LINK_SPEED_10M; > + if (speed >=3D ETH_SPEED_NUM_100M) > + capa |=3D ETH_LINK_SPEED_100M; > + if (speed >=3D ETH_SPEED_NUM_1G) > + capa |=3D ETH_LINK_SPEED_1G; > + if (speed >=3D ETH_SPEED_NUM_5G) > + capa |=3D ETH_LINK_SPEED_2_5G; > + if (speed >=3D ETH_SPEED_NUM_5G) > + capa |=3D ETH_LINK_SPEED_5G; > + if (speed >=3D ETH_SPEED_NUM_10G) > + capa |=3D ETH_LINK_SPEED_10G; > + if (speed >=3D ETH_SPEED_NUM_20G) > + capa |=3D ETH_LINK_SPEED_20G; > + if (speed >=3D ETH_SPEED_NUM_25G) > + capa |=3D ETH_LINK_SPEED_25G; > + if (speed >=3D ETH_SPEED_NUM_40G) > + capa |=3D ETH_LINK_SPEED_40G; > + if (speed >=3D ETH_SPEED_NUM_50G) > + capa |=3D ETH_LINK_SPEED_50G; > + if (speed >=3D ETH_SPEED_NUM_56G) > + capa |=3D ETH_LINK_SPEED_56G; > + if (speed >=3D ETH_SPEED_NUM_100G) > + capa |=3D ETH_LINK_SPEED_100G; In the real world the NIC may only support 50G an not say 10M, so in that c= ase this code would be wrong as it would set all of the speeds up to 50G. I= do not think the code should be changed, but I add a comment to tell the d= eveloper the issue here. I do not want someone copying the code and thinkin= g is i correct for a real device. > + > + return capa; > +} > + > static void > tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > { > @@ -363,6 +397,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_= dev_info *dev_info) > dev_info->max_tx_queues =3D internals->nb_queues; > dev_info->min_rx_bufsize =3D 0; > dev_info->pci_dev =3D NULL; > + dev_info->speed_capa =3D tap_dev_speed_capa(); > } >=20 > static void > --=20 > 2.8.0.rc0 >=20 Regards, Keith