RDMA: Simplify get firmware interface
There is a need to forward FW version to user space application through RDMA netlink. In order to make it safe, there is need to declare nla_policy and limit the size of FW string. The new define IB_FW_VERSION_NAME_MAX will limit the size of FW version string. That define was chosen to be equal to ETHTOOL_FWVERS_LEN, because many drivers anyway are limited by that value indirectly. The introduction of this define allows us to remove the string size from get_fw_str function signature. Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
This commit is contained in:

committed by
Leon Romanovsky

parent
ac50525374
commit
9abb0d1bbd
@@ -1336,8 +1336,7 @@ static int iwch_port_immutable(struct ib_device *ibdev, u8 port_num,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void get_dev_fw_ver_str(struct ib_device *ibdev, char *str,
|
||||
size_t str_len)
|
||||
static void get_dev_fw_ver_str(struct ib_device *ibdev, char *str)
|
||||
{
|
||||
struct iwch_dev *iwch_dev = to_iwch_dev(ibdev);
|
||||
struct ethtool_drvinfo info;
|
||||
@@ -1345,7 +1344,7 @@ static void get_dev_fw_ver_str(struct ib_device *ibdev, char *str,
|
||||
|
||||
pr_debug("%s dev 0x%p\n", __func__, iwch_dev);
|
||||
lldev->ethtool_ops->get_drvinfo(lldev, &info);
|
||||
snprintf(str, str_len, "%s", info.fw_version);
|
||||
snprintf(str, IB_FW_VERSION_NAME_MAX, "%s", info.fw_version);
|
||||
}
|
||||
|
||||
int iwch_register_device(struct iwch_dev *dev)
|
||||
|
Reference in New Issue
Block a user