net/axgbe: support reading FW version

Added support for fw_version_get API

Signed-off-by: Selwin Sebastian <selwin.sebastian@amd.com>
Acked-by: Somalapuram Amaranath <asomalap@amd.com>
This commit is contained in:
Selwin Sebastian 2021-01-06 13:30:58 +05:30 committed by Ferruh Yigit
parent 38d632cbdc
commit ff70acdf42
4 changed files with 33 additions and 0 deletions

View File

@ -18,6 +18,7 @@ CRC offload = Y
L3 checksum offload = Y
L4 checksum offload = Y
Basic stats = Y
FW version = Y
Linux UIO = Y
x86-32 = Y
x86-64 = Y

View File

@ -267,6 +267,7 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
.timesync_adjust_time = axgbe_timesync_adjust_time,
.timesync_read_time = axgbe_timesync_read_time,
.timesync_write_time = axgbe_timesync_write_time,
.fw_version_get = axgbe_dev_fw_version_get,
};
static int axgbe_phy_reset(struct axgbe_port *pdata)

View File

@ -613,6 +613,34 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
return 0;
}
int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
char *fw_version, size_t fw_size)
{
struct axgbe_port *pdata;
struct axgbe_hw_features *hw_feat;
int ret;
pdata = (struct axgbe_port *)eth_dev->data->dev_private;
hw_feat = &pdata->hw_feat;
if (fw_version == NULL)
return -EINVAL;
ret = snprintf(fw_version, fw_size, "%d.%d.%d",
AXGMAC_GET_BITS(hw_feat->version, MAC_VR, USERVER),
AXGMAC_GET_BITS(hw_feat->version, MAC_VR, DEVID),
AXGMAC_GET_BITS(hw_feat->version, MAC_VR, SNPSVER));
if (ret < 0)
return -EINVAL;
ret += 1; /* add the size of '\0' */
if (fw_size < (size_t)ret)
return ret;
else
return 0;
}
static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
unsigned int queue)
{

View File

@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);
int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
char *fw_version, size_t fw_size);
uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,