From: Pascal Mazon Date: Wed, 15 Mar 2017 14:48:16 +0000 (+0100) Subject: net/tap: add speed capabilities X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=4a25714ad9ab85200b959904e70570f7f26f1baa;p=dpdk.git net/tap: add speed capabilities Tap PMD is flexible, it supports any speed. Signed-off-by: Pascal Mazon Reviewed-by: Ferruh Yigit --- diff --git a/doc/guides/nics/features/tap.ini b/doc/guides/nics/features/tap.ini index b805777532..6c07352088 100644 --- a/doc/guides/nics/features/tap.ini +++ b/doc/guides/nics/features/tap.ini @@ -10,6 +10,7 @@ Promiscuous mode = Y Allmulticast mode = Y Basic stats = Y MTU update = Y +Speed capabilities = Y Unicast MAC filter = Y Other kdrv = Y ARMv7 = Y diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index b14bbabb84..c531febfc6 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -407,6 +407,40 @@ tap_dev_configure(struct rte_eth_dev *dev __rte_unused) return 0; } +static uint32_t +tap_dev_speed_capa(void) +{ + uint32_t speed = pmd_link.link_speed; + uint32_t capa = 0; + + if (speed >= ETH_SPEED_NUM_10M) + capa |= ETH_LINK_SPEED_10M; + if (speed >= ETH_SPEED_NUM_100M) + capa |= ETH_LINK_SPEED_100M; + if (speed >= ETH_SPEED_NUM_1G) + capa |= ETH_LINK_SPEED_1G; + if (speed >= ETH_SPEED_NUM_5G) + capa |= ETH_LINK_SPEED_2_5G; + if (speed >= ETH_SPEED_NUM_5G) + capa |= ETH_LINK_SPEED_5G; + if (speed >= ETH_SPEED_NUM_10G) + capa |= ETH_LINK_SPEED_10G; + if (speed >= ETH_SPEED_NUM_20G) + capa |= ETH_LINK_SPEED_20G; + if (speed >= ETH_SPEED_NUM_25G) + capa |= ETH_LINK_SPEED_25G; + if (speed >= ETH_SPEED_NUM_40G) + capa |= ETH_LINK_SPEED_40G; + if (speed >= ETH_SPEED_NUM_50G) + capa |= ETH_LINK_SPEED_50G; + if (speed >= ETH_SPEED_NUM_56G) + capa |= ETH_LINK_SPEED_56G; + if (speed >= ETH_SPEED_NUM_100G) + capa |= ETH_LINK_SPEED_100G; + + return capa; +} + static void tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -419,6 +453,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_tx_queues = internals->nb_queues; dev_info->min_rx_bufsize = 0; dev_info->pci_dev = NULL; + dev_info->speed_capa = tap_dev_speed_capa(); } static void