From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id 33C242BF1 for ; Mon, 12 Mar 2018 05:17:53 +0100 (CET) Received: by mail-wr0-f196.google.com with SMTP id f14so14252929wre.8 for ; Sun, 11 Mar 2018 21:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=jaicEfEh3mVRM5LRICQPIU7KnHlbucsvAZQjmKI6lwk=; b=qNLsPmkDD7varoEpVg+YjRnGXFXgtpVHFrfjKIcjDpJU2Y2o0M5ic4nVtVNRUSB3o2 mL1DdpYd5NDjHFiWdW2OE5mkziSgFuyhp3/I9R5xLPRkqXZN1Gc100WdOAei2i266/pS CGxIVjkP7m9yc9SOZhReZ1o9RhxMrXvNe7TpwEjfvf38nn06+qG/aVkb3f9g/TV7S8lx nj/uUt1Zmh+RsyNvietomISM+c+C2FFjrE/tPcXO63gz66oNKNjpGEj2L7eSH5DBK4Mp Trdv9TX9DBthmLaYZmOfgfbRAG49bzp2EvqUZqfegVAtf8Phjis2z8B9eS/2yt7pTgg8 eZ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=jaicEfEh3mVRM5LRICQPIU7KnHlbucsvAZQjmKI6lwk=; b=tTyDwi1RDj+KpXHehLY0hSNfvuflANprnkpUafQauLB98JwM9pvCeD/oM5+YTl+KL4 EQDxVt0BmYv7LxAqKW2nniA7Gc0nJoWQFdB2mPuDxwPFDMhBPf9k6ZebUNJsMNJM0GWb rQpHHCjkMqY+BsD7DVaR+ywdDf69wAg8eXzx8nCMA6i2Zzn9HsE8uJ8AwI0OnZr8XyFY rYQmAFja2gW2nHxbJpw5QMEngjdTWv7S+1ih3739P5KbJjbh73HD0yOQpa9LRKC9ssi3 WGfLroBRwSFA9IUFmRNTtOau2D50+432jvbL7pOSy/55sueepdvrkQFJgjVbLnaWgnd/ hUbA== X-Gm-Message-State: AElRT7GoRX5557prZFIp4I1CTTiIr4+uW/PwYFPuM+NpDjcbeC/OXCjd ZHdwlc1uX1fzDmGD0sm7UA5B3JQs X-Google-Smtp-Source: AG47ELu1T2JeGNDKF8dy1ydfw45fNYL0RjDl/AOJ0Ob3ift/xF144QvbFqYrp85lWwyR+NHIfO6c5w== X-Received: by 10.223.176.33 with SMTP id f30mr5288566wra.75.1520828272699; Sun, 11 Mar 2018 21:17:52 -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 t91sm13113866wrc.21.2018.03.11.21.17.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Mar 2018 21:17:52 -0700 (PDT) From: Zijie Pan To: dev@dpdk.org Date: Mon, 12 Mar 2018 05:17:19 +0100 Message-Id: <1520828243-25191-2-git-send-email-zijie.pan@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1520828243-25191-1-git-send-email-zijie.pan@6wind.com> References: <1520828243-25191-1-git-send-email-zijie.pan@6wind.com> X-Mailman-Approved-At: Tue, 13 Mar 2018 13:55:53 +0100 Subject: [dpdk-dev] [PATCH 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: , X-List-Received-Date: Mon, 12 Mar 2018 04:17:53 -0000 add new APIs: - rte_eth_dev_get_module_info - rte_eth_dev_get_module_eeprom Signed-off-by: Zijie Pan --- 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 | 35 +++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev_core.h | 12 ++++++++++++ 5 files changed, 102 insertions(+) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index 1b4fb97..8223722 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 informatin 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..c15a0fa 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 ETH_MODULE_SFF_8079 0x1 +#define ETH_MODULE_SFF_8079_LEN 256 +#define ETH_MODULE_SFF_8472 0x2 +#define ETH_MODULE_SFF_8472_LEN 512 +#define ETH_MODULE_SFF_8636 0x3 +#define ETH_MODULE_SFF_8636_LEN 256 +#define ETH_MODULE_SFF_8436 0x4 +#define 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 0590f0c..b83643d 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -4044,6 +4044,32 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx, } int +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_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 0361533..e8b1d94 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -3262,6 +3262,41 @@ 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); /** + * 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_eth_dev_get_module_info(uint16_t port_id, + struct rte_dev_module_info *modinfo); + +/** + * 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_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 e5681e4..26b5704 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. */ -- 1.7.10.4