mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
net: txgbe: rework service event handling
Convert to use test_and_clear_bit() for link event subtasks. Only re-arm the WX_FLAG_NEED_MODULE_RESET flag when module is absent. Unsupported or invalid modules no longer cause the service task to continuously retry module identification. Additionally, explicitly cancel service_task during device teardown to ensure no pending asynchronous service work survives after the device has entered the DOWN state. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Link: https://patch.msgid.link/20260525100543.27140-4-jiawenwu@trustnetic.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
58ac2f8eb0
commit
f67aead16e
|
|
@ -186,19 +186,15 @@ static void txgbe_get_mac_link(struct wx *wx, int *speed)
|
||||||
*speed = SPEED_UNKNOWN;
|
*speed = SPEED_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int txgbe_set_phy_link(struct wx *wx)
|
void txgbe_set_phy_link(struct wx *wx)
|
||||||
{
|
{
|
||||||
int speed, autoneg, duplex, err;
|
int speed, autoneg, duplex, err;
|
||||||
|
|
||||||
txgbe_get_link_capabilities(wx, &speed, &autoneg, &duplex);
|
txgbe_get_link_capabilities(wx, &speed, &autoneg, &duplex);
|
||||||
|
|
||||||
err = txgbe_set_phy_link_hostif(wx, speed, autoneg, duplex);
|
err = txgbe_set_phy_link_hostif(wx, speed, autoneg, duplex);
|
||||||
if (err) {
|
if (err)
|
||||||
wx_err(wx, "Failed to setup link\n");
|
wx_err(wx, "Failed to setup link\n");
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
|
static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
|
||||||
|
|
@ -362,7 +358,7 @@ int txgbe_identify_module(struct wx *wx)
|
||||||
id->identifier != TXGBE_SFF_IDENTIFIER_QSFP_PLUS &&
|
id->identifier != TXGBE_SFF_IDENTIFIER_QSFP_PLUS &&
|
||||||
id->identifier != TXGBE_SFF_IDENTIFIER_QSFP28) {
|
id->identifier != TXGBE_SFF_IDENTIFIER_QSFP28) {
|
||||||
wx_err(wx, "Invalid module\n");
|
wx_err(wx, "Invalid module\n");
|
||||||
return -ENODEV;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id->transceiver_type == 0xFF)
|
if (id->transceiver_type == 0xFF)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ int txgbe_test_hostif(struct wx *wx);
|
||||||
int txgbe_read_eeprom_hostif(struct wx *wx,
|
int txgbe_read_eeprom_hostif(struct wx *wx,
|
||||||
struct txgbe_hic_i2c_read *buffer,
|
struct txgbe_hic_i2c_read *buffer,
|
||||||
u32 length, u8 *data);
|
u32 length, u8 *data);
|
||||||
int txgbe_set_phy_link(struct wx *wx);
|
void txgbe_set_phy_link(struct wx *wx);
|
||||||
int txgbe_identify_module(struct wx *wx);
|
int txgbe_identify_module(struct wx *wx);
|
||||||
void txgbe_setup_link(struct wx *wx);
|
void txgbe_setup_link(struct wx *wx);
|
||||||
int txgbe_phylink_init_aml(struct txgbe *txgbe);
|
int txgbe_phylink_init_aml(struct txgbe *txgbe);
|
||||||
|
|
|
||||||
|
|
@ -93,31 +93,23 @@ static void txgbe_module_detection_subtask(struct wx *wx)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!test_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags))
|
if (!test_and_clear_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* wait for SFF module ready */
|
/* wait for SFF module ready */
|
||||||
msleep(200);
|
msleep(200);
|
||||||
|
|
||||||
err = txgbe_identify_module(wx);
|
err = txgbe_identify_module(wx);
|
||||||
if (err)
|
if (err == -ENODEV)
|
||||||
return;
|
set_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags);
|
||||||
|
|
||||||
clear_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void txgbe_link_config_subtask(struct wx *wx)
|
static void txgbe_link_config_subtask(struct wx *wx)
|
||||||
{
|
{
|
||||||
int err;
|
if (!test_and_clear_bit(WX_FLAG_NEED_LINK_CONFIG, wx->flags))
|
||||||
|
|
||||||
if (!test_bit(WX_FLAG_NEED_LINK_CONFIG, wx->flags))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err = txgbe_set_phy_link(wx);
|
txgbe_set_phy_link(wx);
|
||||||
if (err)
|
|
||||||
return;
|
|
||||||
|
|
||||||
clear_bit(WX_FLAG_NEED_LINK_CONFIG, wx->flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -233,6 +225,7 @@ static void txgbe_disable_device(struct wx *wx)
|
||||||
wx_napi_disable_all(wx);
|
wx_napi_disable_all(wx);
|
||||||
|
|
||||||
timer_delete_sync(&wx->service_timer);
|
timer_delete_sync(&wx->service_timer);
|
||||||
|
cancel_work_sync(&wx->service_task);
|
||||||
|
|
||||||
if (wx->bus.func < 2)
|
if (wx->bus.func < 2)
|
||||||
wr32m(wx, TXGBE_MIS_PRB_CTL, TXGBE_MIS_PRB_CTL_LAN_UP(wx->bus.func), 0);
|
wr32m(wx, TXGBE_MIS_PRB_CTL, TXGBE_MIS_PRB_CTL_LAN_UP(wx->bus.func), 0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user