net: hns3: modify firmware version display format
This patch modifies firmware version display format in hclge(vf)_cmd_init() and hns3_get_drvinfo(). Also, adds some optimizations for firmware version display format. Signed-off-by: Yufeng Mo <moyufeng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d659f9f60f
commit
923713730d
|
@ -179,6 +179,15 @@ struct hnae3_vector_info {
|
|||
#define HNAE3_RING_GL_RX 0
|
||||
#define HNAE3_RING_GL_TX 1
|
||||
|
||||
#define HNAE3_FW_VERSION_BYTE3_SHIFT 24
|
||||
#define HNAE3_FW_VERSION_BYTE3_MASK GENMASK(31, 24)
|
||||
#define HNAE3_FW_VERSION_BYTE2_SHIFT 16
|
||||
#define HNAE3_FW_VERSION_BYTE2_MASK GENMASK(23, 16)
|
||||
#define HNAE3_FW_VERSION_BYTE1_SHIFT 8
|
||||
#define HNAE3_FW_VERSION_BYTE1_MASK GENMASK(15, 8)
|
||||
#define HNAE3_FW_VERSION_BYTE0_SHIFT 0
|
||||
#define HNAE3_FW_VERSION_BYTE0_MASK GENMASK(7, 0)
|
||||
|
||||
struct hnae3_ring_chain_node {
|
||||
struct hnae3_ring_chain_node *next;
|
||||
u32 tqp_index;
|
||||
|
|
|
@ -527,6 +527,7 @@ static void hns3_get_drvinfo(struct net_device *netdev,
|
|||
{
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
struct hnae3_handle *h = priv->ae_handle;
|
||||
u32 fw_version;
|
||||
|
||||
if (!h->ae_algo->ops->get_fw_version) {
|
||||
netdev_err(netdev, "could not get fw version!\n");
|
||||
|
@ -545,8 +546,18 @@ static void hns3_get_drvinfo(struct net_device *netdev,
|
|||
sizeof(drvinfo->bus_info));
|
||||
drvinfo->bus_info[ETHTOOL_BUSINFO_LEN - 1] = '\0';
|
||||
|
||||
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "0x%08x",
|
||||
priv->ae_handle->ae_algo->ops->get_fw_version(h));
|
||||
fw_version = priv->ae_handle->ae_algo->ops->get_fw_version(h);
|
||||
|
||||
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
|
||||
"%lu.%lu.%lu.%lu",
|
||||
hnae3_get_field(fw_version, HNAE3_FW_VERSION_BYTE3_MASK,
|
||||
HNAE3_FW_VERSION_BYTE3_SHIFT),
|
||||
hnae3_get_field(fw_version, HNAE3_FW_VERSION_BYTE2_MASK,
|
||||
HNAE3_FW_VERSION_BYTE2_SHIFT),
|
||||
hnae3_get_field(fw_version, HNAE3_FW_VERSION_BYTE1_MASK,
|
||||
HNAE3_FW_VERSION_BYTE1_SHIFT),
|
||||
hnae3_get_field(fw_version, HNAE3_FW_VERSION_BYTE0_MASK,
|
||||
HNAE3_FW_VERSION_BYTE0_SHIFT));
|
||||
}
|
||||
|
||||
static u32 hns3_get_link(struct net_device *netdev)
|
||||
|
|
|
@ -419,7 +419,15 @@ int hclge_cmd_init(struct hclge_dev *hdev)
|
|||
}
|
||||
hdev->fw_version = version;
|
||||
|
||||
dev_info(&hdev->pdev->dev, "The firmware version is %08x\n", version);
|
||||
dev_info(&hdev->pdev->dev, "The firmware version is %lu.%lu.%lu.%lu\n",
|
||||
hnae3_get_field(version, HNAE3_FW_VERSION_BYTE3_MASK,
|
||||
HNAE3_FW_VERSION_BYTE3_SHIFT),
|
||||
hnae3_get_field(version, HNAE3_FW_VERSION_BYTE2_MASK,
|
||||
HNAE3_FW_VERSION_BYTE2_SHIFT),
|
||||
hnae3_get_field(version, HNAE3_FW_VERSION_BYTE1_MASK,
|
||||
HNAE3_FW_VERSION_BYTE1_SHIFT),
|
||||
hnae3_get_field(version, HNAE3_FW_VERSION_BYTE0_MASK,
|
||||
HNAE3_FW_VERSION_BYTE0_SHIFT));
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -405,7 +405,15 @@ int hclgevf_cmd_init(struct hclgevf_dev *hdev)
|
|||
}
|
||||
hdev->fw_version = version;
|
||||
|
||||
dev_info(&hdev->pdev->dev, "The firmware version is %08x\n", version);
|
||||
dev_info(&hdev->pdev->dev, "The firmware version is %lu.%lu.%lu.%lu\n",
|
||||
hnae3_get_field(version, HNAE3_FW_VERSION_BYTE3_MASK,
|
||||
HNAE3_FW_VERSION_BYTE3_SHIFT),
|
||||
hnae3_get_field(version, HNAE3_FW_VERSION_BYTE2_MASK,
|
||||
HNAE3_FW_VERSION_BYTE2_SHIFT),
|
||||
hnae3_get_field(version, HNAE3_FW_VERSION_BYTE1_MASK,
|
||||
HNAE3_FW_VERSION_BYTE1_SHIFT),
|
||||
hnae3_get_field(version, HNAE3_FW_VERSION_BYTE0_MASK,
|
||||
HNAE3_FW_VERSION_BYTE0_SHIFT));
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue