From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id CBFA8567C for ; Mon, 6 Mar 2017 15:38:36 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2017 06:38:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,254,1484035200"; d="scan'208";a="64753825" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 06 Mar 2017 06:38:34 -0800 Received: from fmsmsx113.amr.corp.intel.com ([169.254.13.172]) by fmsmsx104.amr.corp.intel.com ([169.254.3.29]) with mapi id 14.03.0248.002; Mon, 6 Mar 2017 06:38:26 -0800 From: "Wiles, Keith" To: Pascal Mazon CC: "dev@dpdk.org" Thread-Topic: [PATCH 2/6] net/tap: add speed capabilities Thread-Index: AQHSlAMplxepzJyP2Eyvdg9cUBk8a6GDw1eAgASeNQCAAAsoAA== Date: Mon, 6 Mar 2017 14:38:25 +0000 Message-ID: References: <0e99fe0868cca2bfbc03a7f99ca3dbfb9a9d42ea.1488534161.git.pascal.mazon@6wind.com> <20170306145828.624dcf4a@paques.dev.6wind.com> In-Reply-To: <20170306145828.624dcf4a@paques.dev.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: <8419D90D607D3242BB4524C506D72385@intel.com> 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: Mon, 06 Mar 2017 14:38:37 -0000 > On Mar 6, 2017, at 7:58 AM, Pascal Mazon wrote: >=20 > On Fri, 3 Mar 2017 15:27:12 +0000 > "Wiles, Keith" wrote: >=20 >>=20 >>> 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_unused) 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; >>=20 >> In the real world the NIC may only support 50G an not say 10M, so in >> that case 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 developer the issue here. I do not want someone >> copying the code and thinking is i correct for a real device. >>=20 >=20 > That's true for actual hardware. But tap is completely virtual, so > actually it could support any speed (it is limited by userland-kernel > communication speed). >=20 > What speed would you rather have the tap PMD report as capable of? This note was a very minor picky point and you can ignore my comment here. = It is not worth the time to deal with and you have better things to do :-) >=20 > Best regards, > Pascal >=20 >>> + >>> + 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 >>=20 >> Regards, >> Keith >>=20 >=20 Regards, Keith