From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 0F9A25590 for ; Mon, 14 Mar 2016 22:57:28 +0100 (CET) Received: by mail-wm0-f53.google.com with SMTP id p65so1796778wmp.0 for ; Mon, 14 Mar 2016 14:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JlLHOnKSIFgEfFNgQ1bVzZrfjEY8D8TpRJtpdIshSmY=; b=d6o3pZ0U+gsfhcgbmJwuDvTmF0Gnh7BioQcrq0Sq860TjdA7ipBXfsgqZ9OgJfmSRF IjE/++qM6+lnI49M9TVG+J7izXg+oLZhGtMyX7O+IBp63Jpjl1RbTBQ44czvsCq7BeVu aoKEtu24aMI07hqCFTDrwvLNTRVHtapU/H/+IfQx4TnX9DK0/UfxfQ5BBPHKJZLfugCx kmJgD9KYRAQSoy6eY2NMV6F1P/XGLSK35oNwavpof2gvT1Jk7yNhFH/WOe1vH9kyvwDI Rvg+mHIP+kO/bIRSx2mMZ7HKUZ1l8VoFRwGZPyHlRTi4MgNQPyZIq7kEti+iMgeN+dPf mKcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JlLHOnKSIFgEfFNgQ1bVzZrfjEY8D8TpRJtpdIshSmY=; b=lgLuKHemkWieWKkCWfdVH//+FJf/t2VazR0kBzpzF6Zfm9Jm9+PUra7nKbNbfZPtYw Vv/BsGvoXNF5bSSOnDVxRies7yvaCkwNmQGcamR7iquipZPRYUIjv+V+DokTX7/+eiZs R8Yjv5gWBNUtfemofCQUAhqCBZY9tbR9A7vLL29OEryJo9dI/+3DbVQpe5I5Y/zIRjro rO1IWczhkhXL+j25iLLYNUfg5/aXgJCnI6R9evLkwF3KL53+eVAt1/jyzPd41OG+F3fb EU53tTE4MIWbGBM6NyaPqrTQBnSjEZFwsGYGY9U+EZfDHZEyG8uMuqNj7KTB+uamMcXI GIEg== X-Gm-Message-State: AD7BkJK04lCypg54zVDGYa9MaMNpb7CeYIyiNedxovhwM/DHM0Y/OCDh1oNPSHHYeBugXmCp X-Received: by 10.28.179.84 with SMTP id c81mr19866282wmf.13.1457992647923; Mon, 14 Mar 2016 14:57:27 -0700 (PDT) Received: from XPS13.localdomain (91.111.75.86.rev.sfr.net. [86.75.111.91]) by smtp.gmail.com with ESMTPSA id w133sm17918804wmd.3.2016.03.14.14.57.25 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Mar 2016 14:57:27 -0700 (PDT) From: Thomas Monjalon To: marcdevel@gmail.com, bruce.richardson@intel.com, declan.doherty@intel.com, konstantin.ananyev@intel.com, wenzhuo.lu@intel.com, helin.zhang@intel.com, jing.d.chen@intel.com, harish.patil@qlogic.com, rahul.lakkireddy@chelsio.com, johndale@cisco.com, vido@cesnet.cz, adrien.mazarguil@6wind.com, alejandro.lucero@netronome.com Cc: dev@dpdk.org Date: Mon, 14 Mar 2016 22:55:43 +0100 Message-Id: <1457992546-32230-6-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457992546-32230-1-git-send-email-thomas.monjalon@6wind.com> References: <1456793151-1475-1-git-send-email-marcdevel@gmail.com> <1457992546-32230-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-dev] [PATCH v10 5/8] ethdev: add speed capabilities 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: Mon, 14 Mar 2016 21:57:28 -0000 From: Marc Sune The speed capabilities of a device can be retrieved with rte_eth_dev_info_get(). The new field speed_capa is initialized in the drivers without taking care of device characteristics in this patch. When the capabilities of a driver are accurate, the table in overview.rst must be filled. Signed-off-by: Marc Sune --- doc/guides/nics/overview.rst | 1 + doc/guides/rel_notes/release_16_04.rst | 8 ++++++++ drivers/net/bnx2x/bnx2x_ethdev.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 4 ++++ drivers/net/e1000/igb_ethdev.c | 4 ++++ drivers/net/fm10k/fm10k_ethdev.c | 4 ++++ drivers/net/i40e/i40e_ethdev.c | 8 ++++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++++++ drivers/net/mlx4/mlx4.c | 2 ++ drivers/net/mlx5/mlx5_ethdev.c | 3 +++ drivers/net/nfp/nfp_net.c | 2 ++ lib/librte_ether/rte_ethdev.h | 21 +++++++++++++++++++++ 13 files changed, 67 insertions(+) diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst index 2d4f014..893da5f 100644 --- a/doc/guides/nics/overview.rst +++ b/doc/guides/nics/overview.rst @@ -88,6 +88,7 @@ Most of these differences are summarized below. ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = link status X X X X link status event X X + speed capabilities Rx interrupt X X X X queue start/stop X X X X X X MTU update X diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index b729b67..fd24a6f 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -47,6 +47,11 @@ This section should contain new features added in this release. Sample format: A new function ``rte_pktmbuf_alloc_bulk()`` has been added to allow the user to allocate a bulk of mbufs. +* **Added device link speed capabilities.** + + The structure ``rte_eth_dev_info`` has now a ``speed_capa`` bitmap, which + allows the application to know the supported speeds of each device. + * **Virtio 1.0.** Enabled virtio 1.0 support for virtio pmd driver. @@ -208,6 +213,9 @@ This section should contain API changes. Sample format: * Add a short 1-2 sentence description of the API change. Use fixed width quotes for ``rte_function_names`` or ``rte_struct_names``. Use the past tense. +* The ethdev structure ``rte_eth_dev_info`` was changed to support device + speed capabilities. + * The functions ``rte_eth_dev_udp_tunnel_add`` and ``rte_eth_dev_udp_tunnel_delete`` have been renamed into ``rte_eth_dev_udp_tunnel_port_add`` and ``rte_eth_dev_udp_tunnel_port_delete``. diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index f109900..b86784e 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -347,6 +347,7 @@ bnx2x_dev_infos_get(struct rte_eth_dev *dev, __rte_unused struct rte_eth_dev_inf dev_info->min_rx_bufsize = BNX2X_MIN_RX_BUF_SIZE; dev_info->max_rx_pktlen = BNX2X_MAX_RX_PKT_LEN; dev_info->max_mac_addrs = BNX2X_MAX_MAC_ADDRS; + dev_info->speed_capa = ETH_LINK_SPEED_10G | ETH_LINK_SPEED_20G; } static void diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 97ef152..05b954d 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -171,6 +171,7 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, device_info->rx_desc_lim = cxgbe_desc_lim; device_info->tx_desc_lim = cxgbe_desc_lim; + device_info->speed_capa = ETH_LINK_SPEED_10G | ETH_LINK_SPEED_40G; } static void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 84845e7..dddffff 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1023,6 +1023,10 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .nb_min = E1000_MIN_RING_DESC, .nb_align = EM_TXD_ALIGN, }; + + dev_info->speed_capa = ETH_LINK_SPEED_10M_HD | ETH_LINK_SPEED_10M | + ETH_LINK_SPEED_100M_HD | ETH_LINK_SPEED_100M | + ETH_LINK_SPEED_1G; } /* return 0 means link status changed, -1 means not changed */ diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index b4c8982..743fe1b 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -1910,6 +1910,10 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_desc_lim = rx_desc_lim; dev_info->tx_desc_lim = tx_desc_lim; + + dev_info->speed_capa = ETH_LINK_SPEED_10M_HD | ETH_LINK_SPEED_10M | + ETH_LINK_SPEED_100M_HD | ETH_LINK_SPEED_100M | + ETH_LINK_SPEED_1G; } static void diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 378faf2..4d8c6bf 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1333,6 +1333,10 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, .nb_min = FM10K_MIN_TX_DESC, .nb_align = FM10K_MULT_TX_DESC, }; + + dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_2_5G | + ETH_LINK_SPEED_10G | ETH_LINK_SPEED_25G | + ETH_LINK_SPEED_40G; } static int diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 17b58a8..3b2a4ae 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2265,6 +2265,7 @@ static void i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_vsi *vsi = pf->main_vsi; dev_info->max_rx_queues = vsi->nb_qps; @@ -2336,6 +2337,13 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_queues += dev_info->vmdq_queue_num; dev_info->max_tx_queues += dev_info->vmdq_queue_num; } + + if (i40e_is_40G_device(hw->device_id)) + /* For XL710 */ + dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G; + else + /* For X710 */ + dev_info->speed_capa = ETH_LINK_SPEED_10G | ETH_LINK_SPEED_40G; } static int diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 1fa17b5..1c108a0 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2891,6 +2891,14 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->hash_key_size = IXGBE_HKEY_MAX_INDEX * sizeof(uint32_t); dev_info->reta_size = ixgbe_reta_size_get(hw->mac.type); dev_info->flow_type_rss_offloads = IXGBE_RSS_OFFLOAD_ALL; + + dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G; + if (hw->mac.type == ixgbe_mac_X540 || + hw->mac.type == ixgbe_mac_X540_vf || + hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550_vf) { + dev_info->speed_capa |= ETH_LINK_SPEED_100M; + } } static void diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index f41817b..7397cbf 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -4264,6 +4264,8 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) 0); if (priv_get_ifname(priv, &ifname) == 0) info->if_index = if_nametoindex(ifname); + info->speed_capa = ETH_LINK_SPEED_10G | ETH_LINK_SPEED_40G | + ETH_LINK_SPEED_56G; priv_unlock(priv); } diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 1159fa3..7494f69 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -523,6 +523,9 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) * size if it is not fixed. * The API should be updated to solve this problem. */ info->reta_size = priv->ind_table_max_size; + info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G | + ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G | + ETH_LINK_SPEED_50G; priv_unlock(priv); } diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 059b554..be1a364 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -1071,6 +1071,8 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->reta_size = NFP_NET_CFG_RSS_ITBL_SZ; dev_info->hash_key_size = NFP_NET_CFG_RSS_KEY_SZ; + + dev_info->speed_capa = ETH_LINK_SPEED_50G; } static uint32_t diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index b68e017..017e24b 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -242,6 +242,23 @@ struct rte_eth_stats { }; /** + * Device supported speeds bitmap flags + */ +#define ETH_LINK_SPEED_10M_HD (1 << 1) /**< 10 Mbps half-duplex */ +#define ETH_LINK_SPEED_10M (1 << 2) /**< 10 Mbps full-duplex */ +#define ETH_LINK_SPEED_100M_HD (1 << 3) /**< 100 Mbps half-duplex */ +#define ETH_LINK_SPEED_100M (1 << 4) /**< 100 Mbps full-duplex */ +#define ETH_LINK_SPEED_1G (1 << 5) /**< 1 Gbps */ +#define ETH_LINK_SPEED_2_5G (1 << 6) /**< 2.5 Gbps */ +#define ETH_LINK_SPEED_5G (1 << 7) /**< 5 Gbps */ +#define ETH_LINK_SPEED_10G (1 << 8) /**< 10 Gbps */ +#define ETH_LINK_SPEED_20G (1 << 9) /**< 20 Gbps */ +#define ETH_LINK_SPEED_25G (1 << 10) /**< 25 Gbps */ +#define ETH_LINK_SPEED_40G (1 << 11) /**< 40 Gbps */ +#define ETH_LINK_SPEED_50G (1 << 12) /**< 50 Gbps */ +#define ETH_LINK_SPEED_56G (1 << 13) /**< 56 Gbps */ + +/** * Ethernet numeric link speeds in Mbps */ #define ETH_LINK_SPEED_AUTONEG 0 /**< Auto-negotiate link speed. */ @@ -850,6 +867,9 @@ struct rte_eth_conf { #define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000080 /**< Used for tunneling packet. */ #define DEV_TX_OFFLOAD_QINQ_INSERT 0x00000100 +/** + * Ethernet device information + */ struct rte_eth_dev_info { struct rte_pci_device *pci_dev; /**< Device PCI information. */ const char *driver_name; /**< Device Driver name. */ @@ -878,6 +898,7 @@ struct rte_eth_dev_info { uint16_t vmdq_pool_base; /**< First ID of VMDQ pools. */ struct rte_eth_desc_lim rx_desc_lim; /**< RX descriptors limits */ struct rte_eth_desc_lim tx_desc_lim; /**< TX descriptors limits */ + uint32_t speed_capa; /**< Supported speeds bitmap (ETH_LINK_SPEED_). */ }; /** -- 2.7.0