Skip to content

Commit 7e08c4f

Browse files
author
Shruti Parab
committed
bnxt_en: Refactor bnxt_get_module_eeprom_by_page()
JIRA: https://issues.redhat.com/browse/RHEL-76565 commit 1b64544 Author: Michael Chan <michael.chan@broadcom.com> Date: Mon Mar 10 11:31:28 2025 -0700 bnxt_en: Refactor bnxt_get_module_eeprom_by_page() In preparation for adding .set_module_eeprom_by_page(), extract the common error checking done in bnxt_get_module_eeprom_by_page() into a new common function that can be re-used for .set_module_eeprom_by_page(). Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20250310183129.3154117-7-michael.chan@broadcom.com Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Shruti Parab <shruti.parab@broadcom.com>
1 parent dfa7eb4 commit 7e08c4f

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4550,11 +4550,11 @@ static int bnxt_get_module_status(struct bnxt *bp, struct netlink_ext_ack *extac
45504550
return -EINVAL;
45514551
}
45524552

4553-
static int bnxt_get_module_eeprom_by_page(struct net_device *dev,
4554-
const struct ethtool_module_eeprom *page_data,
4555-
struct netlink_ext_ack *extack)
4553+
static int
4554+
bnxt_mod_eeprom_by_page_precheck(struct bnxt *bp,
4555+
const struct ethtool_module_eeprom *page_data,
4556+
struct netlink_ext_ack *extack)
45564557
{
4557-
struct bnxt *bp = netdev_priv(dev);
45584558
int rc;
45594559

45604560
if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
@@ -4576,6 +4576,19 @@ static int bnxt_get_module_eeprom_by_page(struct net_device *dev,
45764576
NL_SET_ERR_MSG_MOD(extack, "Firmware not capable for bank selection");
45774577
return -EINVAL;
45784578
}
4579+
return 0;
4580+
}
4581+
4582+
static int bnxt_get_module_eeprom_by_page(struct net_device *dev,
4583+
const struct ethtool_module_eeprom *page_data,
4584+
struct netlink_ext_ack *extack)
4585+
{
4586+
struct bnxt *bp = netdev_priv(dev);
4587+
int rc;
4588+
4589+
rc = bnxt_mod_eeprom_by_page_precheck(bp, page_data, extack);
4590+
if (rc)
4591+
return rc;
45794592

45804593
rc = bnxt_read_sfp_module_eeprom_info(bp, page_data->i2c_address << 1,
45814594
page_data->page, page_data->bank,

0 commit comments

Comments
 (0)