git: 2f1d9ab96214 - main - e1000: Correct 82542 flow-control mode handling
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Aug 2026 00:41:58 UTC
The branch main has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=2f1d9ab96214db2ec6ce30c44b55a89a7eaa8f6a
commit 2f1d9ab96214db2ec6ce30c44b55a89a7eaa8f6a
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-10 00:40:16 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-10 00:41:49 +0000
e1000: Correct 82542 flow-control mode handling
The 82542-specific setup routine unconditionally reads the NVM
default, overwriting a flow-control mode selected by software. It
also removes transmit PAUSE support from all 82542 revisions even
though the hardware restriction applies only to rev 2.0.
Resolve the NVM default only when requested, scope the transmit
restriction to rev 2.0, and replace integer bit masking of the enum
with explicit valid mode transitions. This restores the behavior
from before the Intel shared-code split and resolves -Wassign-enum.
Reported by: glebius
MFC after: 2 weeks
---
sys/dev/e1000/e1000_82542.c | 39 ++++++++++++++++++++++++++++++++-------
1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/sys/dev/e1000/e1000_82542.c b/sys/dev/e1000/e1000_82542.c
index e8de9086d05d..0656c6408b30 100644
--- a/sys/dev/e1000/e1000_82542.c
+++ b/sys/dev/e1000/e1000_82542.c
@@ -317,18 +317,43 @@ static s32 e1000_init_hw_82542(struct e1000_hw *hw)
static s32 e1000_setup_link_82542(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
- s32 ret_val;
+ s32 ret_val = E1000_SUCCESS;
DEBUGFUNC("e1000_setup_link_82542");
- ret_val = e1000_set_default_fc_generic(hw);
- if (ret_val)
- goto out;
+ if (hw->fc.requested_mode == e1000_fc_default) {
+ ret_val = e1000_set_default_fc_generic(hw);
+ if (ret_val)
+ goto out;
+ }
- hw->fc.requested_mode &= ~e1000_fc_tx_pause;
+ /* 82542 rev 2.0 cannot transmit PAUSE frames. */
+ if (hw->revision_id == E1000_REVISION_2) {
+ switch (hw->fc.requested_mode) {
+ case e1000_fc_tx_pause:
+ hw->fc.requested_mode = e1000_fc_none;
+ break;
+ case e1000_fc_full:
+ hw->fc.requested_mode = e1000_fc_rx_pause;
+ break;
+ default:
+ break;
+ }
+ }
- if (mac->report_tx_early)
- hw->fc.requested_mode &= ~e1000_fc_rx_pause;
+ /* Early transmit reporting is incompatible with receiving PAUSE. */
+ if (mac->report_tx_early) {
+ switch (hw->fc.requested_mode) {
+ case e1000_fc_rx_pause:
+ hw->fc.requested_mode = e1000_fc_none;
+ break;
+ case e1000_fc_full:
+ hw->fc.requested_mode = e1000_fc_tx_pause;
+ break;
+ default:
+ break;
+ }
+ }
/*
* Save off the requested flow control mode for use later. Depending