From patchwork Wed Apr 25 09:13:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijie Pan X-Patchwork-Id: 38864 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D24632BF2; Wed, 25 Apr 2018 11:14:19 +0200 (CEST) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id 7B52D2C52 for ; Wed, 25 Apr 2018 11:14:18 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id q3-v6so42566684wrj.6 for ; Wed, 25 Apr 2018 02:14:18 -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=CGTcDjmOBwyMlkjFGNwFHCqptAdE0pR5+Poq+DgVlV4=; b=Tj09PVluk86wVOsQdn93Ie54qXLbkZQdFg29880CCVmkZiHXUAIlFvITX77XCwQMFD 2i4m61DHyN9xN75YUfIhk9rJsgMotz95mVlS5iLm+Pd2o7rdbaEXauVpbqnKM41JzMyb uv4KyQOb/UBFHXHtmRAj2cCP3KStZn3G8CDljS7y4/Kp5tbVgLdoIv4XjuXGUXusVvG0 FwsFJWQKecsnUoJXFZW/L1gcScfUDBkwNTht0DaKgWaIqtkKSoK0mFIfne7UWs4RSpwq rUaKPuHLtPK8vJS+VTWHuUZQS0XhwRiLBx2gznBsF7SPahwH8/bbc7iVxAEvprJNpDJQ wwrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CGTcDjmOBwyMlkjFGNwFHCqptAdE0pR5+Poq+DgVlV4=; b=ARme4+Fbn9tBdj5belZWRbNjq5B5wZGd4eljxBK/GExGxn7wCBel6zCMcNLbZz5wvC na4HOV+z+EJ3+eu8Y0rg3mvjQlPReP8TkQlWW4TKYThv27wTe/3HNbKG0ynlC1su9APd eMyMQQ+YaqYET2wjZ7PYDRdIY+ZM3Ec5/a2aUB7KxwhO3dP0q13OfszPOMTPQLfcH2l3 u7yplcJh63aniaHO/RTNkSNZs3pRxIL4Uw4xNawHktdnOHwkMRdLhCMUvi6F6RFBOVq+ SUxFacvHe7ejiNzWEyiEDJv6IaZQuagfUZLeqDxJ7mspE9kMh0Oe+s3Wn//mBtGpvzfV OvXw== X-Gm-Message-State: ALQs6tCgxhG5b/qy/Kqi9Ltlydrd2khP2O+5l+/v43wnh/saaceqTrs5 E40AIQS8RMcsnz2Qu7BjmuplyfEqvTs= X-Google-Smtp-Source: AIpwx4+9THyBkS22tMbqH4AxfO6AQfTTvQkv0fEaGapAkomLBPCYvArUBNwUwhGLIwXJi6sLXO4wYQ== X-Received: by 2002:adf:9205:: with SMTP id 5-v6mr23342915wrj.282.1524647657946; Wed, 25 Apr 2018 02:14:17 -0700 (PDT) Received: from cougar.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 80sm17689208wmk.46.2018.04.25.02.14.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 02:14:17 -0700 (PDT) From: Zijie Pan To: dev@dpdk.org Cc: remy.horton@intel.com, ferruh.yigit@intel.com, thomas@monjalon.net, john.mcnamara@intel.com, marko.kovacevic@intel.com Date: Wed, 25 Apr 2018 11:13:40 +0200 Message-Id: <1524647624-23005-2-git-send-email-zijie.pan@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1524647624-23005-1-git-send-email-zijie.pan@6wind.com> References: <1524563176-7795-1-git-send-email-zijie.pan@6wind.com> <1524647624-23005-1-git-send-email-zijie.pan@6wind.com> Subject: [dpdk-dev] [PATCH v5 1/5] ethdev: add access to eeprom 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" add new APIs: - rte_eth_dev_get_module_info - rte_eth_dev_get_module_eeprom Signed-off-by: Zijie Pan Acked-by: Remy Horton --- Cc: remy.horton@intel.com Cc: john.mcnamara@intel.com Cc: marko.kovacevic@intel.com Cc: thomas@monjalon.net doc/guides/nics/features.rst | 11 ++++++++ lib/librte_ether/rte_dev_info.h | 18 +++++++++++++ lib/librte_ether/rte_ethdev.c | 26 +++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 43 +++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev_core.h | 12 +++++++++ lib/librte_ether/rte_ethdev_version.map | 2 ++ 6 files changed, 112 insertions(+) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index 1b4fb97..bb183e2 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -749,6 +749,17 @@ Supports getting/setting device eeprom data. ``rte_eth_dev_set_eeprom()``. +.. _nic_features_module_eeprom_dump: + +Module EEPROM dump +------------------ + +Supports getting information and data of plugin module eeprom. + +* **[implements] eth_dev_ops**: ``get_module_info``, ``get_module_eeprom``. +* **[related] API**: ``rte_eth_dev_get_module_info()``, ``rte_eth_dev_get_module_eeprom()``. + + .. _nic_features_register_dump: Registers dump diff --git a/lib/librte_ether/rte_dev_info.h b/lib/librte_ether/rte_dev_info.h index 6b68584..02bdbed 100644 --- a/lib/librte_ether/rte_dev_info.h +++ b/lib/librte_ether/rte_dev_info.h @@ -28,4 +28,22 @@ struct rte_dev_eeprom_info { uint32_t magic; /**< Device-specific key, such as device-id */ }; +/** + * Placeholder for accessing plugin module eeprom + */ +struct rte_dev_module_info { + uint32_t type; /**< Type of plugin module eeprom */ + uint32_t eeprom_len; /**< Length of plugin module eeprom */ +}; + +/* EEPROM Standards for plug in modules */ +#define RTE_ETH_MODULE_SFF_8079 0x1 +#define RTE_ETH_MODULE_SFF_8079_LEN 256 +#define RTE_ETH_MODULE_SFF_8472 0x2 +#define RTE_ETH_MODULE_SFF_8472_LEN 512 +#define RTE_ETH_MODULE_SFF_8636 0x3 +#define RTE_ETH_MODULE_SFF_8636_LEN 256 +#define RTE_ETH_MODULE_SFF_8436 0x4 +#define RTE_ETH_MODULE_SFF_8436_LEN 256 + #endif /* _RTE_DEV_INFO_H_ */ diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 7821a88..10bc19c 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -3947,6 +3947,32 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx, return eth_err(port_id, (*dev->dev_ops->set_eeprom)(dev, info)); } +int __rte_experimental +rte_eth_dev_get_module_info(uint16_t port_id, + struct rte_dev_module_info *modinfo) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_info, -ENOTSUP); + return (*dev->dev_ops->get_module_info)(dev, modinfo); +} + +int __rte_experimental +rte_eth_dev_get_module_eeprom(uint16_t port_id, + struct rte_dev_eeprom_info *info) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_eeprom, -ENOTSUP); + return (*dev->dev_ops->get_module_eeprom)(dev, info); +} + int rte_eth_dev_get_dcb_info(uint16_t port_id, struct rte_eth_dcb_info *dcb_info) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 7e4e57b..b39ccc4 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -3311,6 +3311,49 @@ int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, int rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info); /** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Retrieve the type and size of plugin module EEPROM + * + * @param port_id + * The port identifier of the Ethernet device. + * @param modinfo + * The type and size of plugin module EEPROM. + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-ENODEV) if *port_id* invalid. + * - (-EIO) if device is removed. + * - others depends on the specific operations implementation. + */ +int __rte_experimental +rte_eth_dev_get_module_info(uint16_t port_id, + struct rte_dev_module_info *modinfo); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Retrieve the data of plugin module EEPROM + * + * @param port_id + * The port identifier of the Ethernet device. + * @param info + * The template includes the plugin module EEPROM attributes, and the + * buffer for return plugin module EEPROM data. + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + * - (-ENODEV) if *port_id* invalid. + * - (-EIO) if device is removed. + * - others depends on the specific operations implementation. + */ +int __rte_experimental +rte_eth_dev_get_module_eeprom(uint16_t port_id, + struct rte_dev_eeprom_info *info); + +/** * Set the list of multicast addresses to filter on an Ethernet device. * * @param port_id diff --git a/lib/librte_ether/rte_ethdev_core.h b/lib/librte_ether/rte_ethdev_core.h index 55eb2b0..ec623c2 100644 --- a/lib/librte_ether/rte_ethdev_core.h +++ b/lib/librte_ether/rte_ethdev_core.h @@ -337,6 +337,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev, + struct rte_dev_module_info *modinfo); +/**< @internal Retrieve type and size of plugin module eeprom */ + +typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev, + struct rte_dev_eeprom_info *info); +/**< @internal Retrieve plugin module eeprom data */ + typedef int (*eth_l2_tunnel_eth_type_conf_t) (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel); /**< @internal config l2 tunnel ether type */ @@ -467,6 +475,10 @@ struct eth_dev_ops { eth_get_eeprom_t get_eeprom; /**< Get eeprom data. */ eth_set_eeprom_t set_eeprom; /**< Set eeprom. */ + eth_get_module_info_t get_module_info; + /** Get plugin module eeprom attribute. */ + eth_get_module_eeprom_t get_module_eeprom; + /** Get plugin module eeprom data. */ eth_filter_ctrl_t filter_ctrl; /**< common filter control. */ diff --git a/lib/librte_ether/rte_ethdev_version.map b/lib/librte_ether/rte_ethdev_version.map index 8fe0788..b8e7566 100644 --- a/lib/librte_ether/rte_ethdev_version.map +++ b/lib/librte_ether/rte_ethdev_version.map @@ -208,6 +208,8 @@ EXPERIMENTAL { rte_eth_dev_count_avail; rte_eth_dev_count_total; + rte_eth_dev_get_module_info; + rte_eth_dev_get_module_eeprom; rte_eth_dev_is_removed; rte_eth_dev_owner_delete; rte_eth_dev_owner_get;