Commit 4bdd439f authored by Ioana Radulescu's avatar Ioana Radulescu Committed by Greg Kroah-Hartman

staging: fsl-dpaa2/eth: Add firmware version

Include firmware version in the driver information exported
through ethtool.
Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0f4c295f
...@@ -76,10 +76,22 @@ static char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = { ...@@ -76,10 +76,22 @@ static char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = {
static void dpaa2_eth_get_drvinfo(struct net_device *net_dev, static void dpaa2_eth_get_drvinfo(struct net_device *net_dev,
struct ethtool_drvinfo *drvinfo) struct ethtool_drvinfo *drvinfo)
{ {
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
u16 fw_major, fw_minor;
int err;
strlcpy(drvinfo->driver, KBUILD_MODNAME, sizeof(drvinfo->driver)); strlcpy(drvinfo->driver, KBUILD_MODNAME, sizeof(drvinfo->driver));
strlcpy(drvinfo->version, dpaa2_eth_drv_version, strlcpy(drvinfo->version, dpaa2_eth_drv_version,
sizeof(drvinfo->version)); sizeof(drvinfo->version));
strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
err = dpni_get_api_version(priv->mc_io, 0, &fw_major, &fw_minor);
if (!err)
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
"%u.%u", fw_major, fw_minor);
else
strlcpy(drvinfo->fw_version, "N/A",
sizeof(drvinfo->fw_version));
strlcpy(drvinfo->bus_info, dev_name(net_dev->dev.parent->parent), strlcpy(drvinfo->bus_info, dev_name(net_dev->dev.parent->parent),
sizeof(drvinfo->bus_info)); sizeof(drvinfo->bus_info));
} }
......
...@@ -538,4 +538,9 @@ struct dpni_rsp_get_taildrop { ...@@ -538,4 +538,9 @@ struct dpni_rsp_get_taildrop {
__le32 threshold; __le32 threshold;
}; };
struct dpni_rsp_get_api_version {
u16 major;
u16 minor;
};
#endif /* _FSL_DPNI_CMD_H */ #endif /* _FSL_DPNI_CMD_H */
...@@ -1594,3 +1594,35 @@ int dpni_get_taildrop(struct fsl_mc_io *mc_io, ...@@ -1594,3 +1594,35 @@ int dpni_get_taildrop(struct fsl_mc_io *mc_io,
return 0; return 0;
} }
/**
* dpni_get_api_version() - Get Data Path Network Interface API version
* @mc_io: Pointer to MC portal's I/O object
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
* @major_ver: Major version of data path network interface API
* @minor_ver: Minor version of data path network interface API
*
* Return: '0' on Success; Error code otherwise.
*/
int dpni_get_api_version(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 *major_ver,
u16 *minor_ver)
{
struct dpni_rsp_get_api_version *rsp_params;
struct mc_command cmd = { 0 };
int err;
cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_API_VERSION,
cmd_flags, 0);
err = mc_send_command(mc_io, &cmd);
if (err)
return err;
rsp_params = (struct dpni_rsp_get_api_version *)cmd.params;
*major_ver = le16_to_cpu(rsp_params->major);
*minor_ver = le16_to_cpu(rsp_params->minor);
return 0;
}
...@@ -829,4 +829,9 @@ struct dpni_rule_cfg { ...@@ -829,4 +829,9 @@ struct dpni_rule_cfg {
u8 key_size; u8 key_size;
}; };
int dpni_get_api_version(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 *major_ver,
u16 *minor_ver);
#endif /* __FSL_DPNI_H */ #endif /* __FSL_DPNI_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment