From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 854F637B4 for ; Thu, 9 Mar 2017 15:36:55 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 09 Mar 2017 06:36:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,268,1486454400"; d="scan'208";a="58155080" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga002.jf.intel.com with ESMTP; 09 Mar 2017 06:36:54 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 9 Mar 2017 06:36:54 -0800 Received: from fmsmsx113.amr.corp.intel.com ([169.254.13.172]) by FMSMSX155.amr.corp.intel.com ([169.254.5.163]) with mapi id 14.03.0248.002; Thu, 9 Mar 2017 06:36:53 -0800 From: "Wiles, Keith" To: "Yigit, Ferruh" CC: Pascal Mazon , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 2/6] net/tap: add speed capabilities Thread-Index: AQHSl2BeXlLAHx3teUqrlBEDH/g7A6GNF1SAgAAFNYA= Date: Thu, 9 Mar 2017 14:36:53 +0000 Message-ID: References: <1488904298-31395-3-git-send-email-pascal.mazon@6wind.com> <1c44b4be-943a-2911-f91b-f61ebf0eb258@intel.com> In-Reply-To: <1c44b4be-943a-2911-f91b-f61ebf0eb258@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.5.117] Content-Type: text/plain; charset="us-ascii" Content-ID: <1D2640C6A9969E4085EAF67D88C01342@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 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: Thu, 09 Mar 2017 14:36:56 -0000 > On Mar 9, 2017, at 8:18 AM, Yigit, Ferruh wrote: >=20 > On 3/7/2017 4:31 PM, Pascal Mazon wrote: >> 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 1e46ee36efa2..ef525a3f0826 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_unu= sed) >> return 0; >> } >>=20 >> +static uint32_t >> +tap_dev_speed_capa(void) >> +{ >> + uint32_t speed =3D pmd_link.link_speed; >=20 > link_speed is already hardcoded into PMD, so there is nothing to detect > here. Would it be different if PMD directly return pmd_link.link_speed? The link speed is passed into the PMD via the command line, which means it = can change per run. >=20 >> + 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 > I would prefer switch here [1], but functionally both are same, it is > your call. >=20 > [1] > switch (speed) { > case ETH_SPEED_NUM_100G: > capa |=3D ETH_LINK_SPEED_100G > /* fallthrough */ > case ETH_SPEED_NUM_56G: > capa |=3D ETH_LINK_SPEED_56G > /* fallthrough */ > ... > }; >=20 >=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 Regards, Keith