From mboxrd@z Thu Jan 1 00:00:00 1970 From: Igor Russkikh Subject: [PATCH v6 20/22] net/atlantic: implement EEPROM get/set Date: Fri, 12 Oct 2018 11:09:51 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" , Pavel Belous To: "dev@dpdk.org" Return-path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0074.outbound.protection.outlook.com [104.47.32.74]) by dpdk.org (Postfix) with ESMTP id DEA5A1B5AF for ; Fri, 12 Oct 2018 13:09:52 +0200 (CEST) In-Reply-To: Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Pavel Belous Add support for EEPROM reading/writing. Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- doc/guides/nics/features/atlantic.ini | 1 + drivers/net/atlantic/atl_ethdev.c | 47 +++++++++++++++++++++++++++++++= ++++ 2 files changed, 48 insertions(+) diff --git a/doc/guides/nics/features/atlantic.ini b/doc/guides/nics/featur= es/atlantic.ini index 66949b816284..f09a75691a28 100644 --- a/doc/guides/nics/features/atlantic.ini +++ b/doc/guides/nics/features/atlantic.ini @@ -29,6 +29,7 @@ Basic stats =3D Y Extended stats =3D Y Stats per queue =3D Y FW version =3D Y +EEPROM dump =3D Y Linux UIO =3D Y ARMv8 =3D Y x86-32 =3D Y diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_e= thdev.c index 6ebc02864cfe..824e624dd772 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -62,6 +62,13 @@ static void atl_vlan_strip_queue_set(struct rte_eth_dev = *dev, static int atl_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type, uint16_t tpid); =20 +/* EEPROM */ +static int atl_dev_get_eeprom_length(struct rte_eth_dev *dev); +static int atl_dev_get_eeprom(struct rte_eth_dev *dev, + struct rte_dev_eeprom_info *eeprom); +static int atl_dev_set_eeprom(struct rte_eth_dev *dev, + struct rte_dev_eeprom_info *eeprom); + /* Flow control */ static int atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); @@ -259,6 +266,11 @@ static const struct eth_dev_ops atl_eth_dev_ops =3D { .rx_descriptor_status =3D atl_dev_rx_descriptor_status, .tx_descriptor_status =3D atl_dev_tx_descriptor_status, =20 + /* EEPROM */ + .get_eeprom_length =3D atl_dev_get_eeprom_length, + .get_eeprom =3D atl_dev_get_eeprom, + .set_eeprom =3D atl_dev_set_eeprom, + /* Flow Control */ .flow_ctrl_get =3D atl_flow_ctrl_get, .flow_ctrl_set =3D atl_flow_ctrl_set, @@ -1076,6 +1088,41 @@ atl_dev_interrupt_handler(void *param) atl_dev_interrupt_action(dev, dev->intr_handle); } =20 +#define SFP_EEPROM_SIZE 0xff + +static int +atl_dev_get_eeprom_length(struct rte_eth_dev *dev __rte_unused) +{ + return SFP_EEPROM_SIZE; +} + +static int +atl_dev_get_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *ee= prom) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->get_eeprom =3D=3D NULL) + return -ENOTSUP; + + if (eeprom->length !=3D SFP_EEPROM_SIZE || eeprom->data =3D=3D NULL) + return -EINVAL; + + return hw->aq_fw_ops->get_eeprom(hw, eeprom->data, eeprom->length); +} + +static int +atl_dev_set_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *ee= prom) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->set_eeprom =3D=3D NULL) + return -ENOTSUP; + + if (eeprom->length !=3D SFP_EEPROM_SIZE || eeprom->data =3D=3D NULL) + return -EINVAL; + + return hw->aq_fw_ops->set_eeprom(hw, eeprom->data, eeprom->length); +} =20 static int atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf= ) --=20 2.7.4