i40e: Split and refactor i40e_nvm_version_str()
authorIvan Vecera <ivecera@redhat.com>
Fri, 13 Oct 2023 17:07:52 +0000 (19:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Oct 2023 13:33:41 +0000 (14:33 +0100)
commit7aabde397683263fd8aa146f97cc0846372e0719
tree670420867e771fdab9c60c79d6648e0378794950
parent9e479d64dc58f11792f638ea2e8eff3304edaabf
i40e: Split and refactor i40e_nvm_version_str()

The function formats NVM version string according adapter's
EETrackID value. If this value OEM specific (0xffffffff) then
the reported version is with format:
"<gen>.<snap>.<release>"
and in other case
"<nvm_maj>.<nvm_min> <eetrackid> <cvid_maj>.<cvid_bld>.<cvid_min>"

These versions are reported in the subsequent patch in this series
that implements devlink .info_get but separately.

So split the function into separate ones, refactor it to use them
and remove ugly static string buffer.
Additionally convert NVM/OEM version mask macros to use GENMASK and
use FIELD_GET/FIELD_PREP for them in i40e_nvm_version_str() and
i40e_get_oem_version(). This makes code more readable and allows
us to remove related shift macros.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/i40e/i40e_main.c