Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174904591
D60376.id188742.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D60376.id188742.diff
View Options
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -544,6 +544,7 @@
static void em_enable_vectors_82574(if_ctx_t);
+static void em_sysctl_request_reinit(struct e1000_softc *);
static int em_set_flowcntl(SYSCTL_HANDLER_ARGS);
static int em_sysctl_eee(SYSCTL_HANDLER_ARGS);
static int igb_sysctl_dmac(SYSCTL_HANDLER_ARGS);
@@ -1223,6 +1224,7 @@
CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
em_sysctl_print_fw_version, "A",
"Prints FW/NVM Versions");
+ sc->fc = e1000_fc_full;
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fc",
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
em_set_flowcntl, "I", "Flow Control");
@@ -5095,10 +5097,7 @@
roundup2(hw->mac.max_frame_size, 1024);
hw->fc.low_water = hw->fc.high_water - 1500;
- if (sc->fc) /* locally set flow control value? */
- hw->fc.requested_mode = sc->fc;
- else
- hw->fc.requested_mode = e1000_fc_full;
+ hw->fc.requested_mode = sc->fc;
if (hw->mac.type == e1000_80003es2lan)
hw->fc.pause_time = 0xFFFF;
@@ -5111,7 +5110,10 @@
switch (hw->mac.type) {
case e1000_pchlan:
/* Workaround: no TX flow ctrl for PCH */
- hw->fc.requested_mode = e1000_fc_rx_pause;
+ if (hw->fc.requested_mode == e1000_fc_full)
+ hw->fc.requested_mode = e1000_fc_rx_pause;
+ else if (hw->fc.requested_mode == e1000_fc_tx_pause)
+ hw->fc.requested_mode = e1000_fc_none;
hw->fc.pause_time = 0xFFFF; /* override */
if (if_getmtu(ifp) > ETHERMTU) {
hw->fc.high_water = 0x3500;
@@ -8533,34 +8535,35 @@
static int
em_set_flowcntl(SYSCTL_HANDLER_ARGS)
{
- int error;
- static int input = 3; /* default is full */
+ int error, input;
struct e1000_softc *sc = (struct e1000_softc *) arg1;
+ input = sc->fc;
error = sysctl_handle_int(oidp, &input, 0, req);
if ((error) || (req->newptr == NULL))
return (error);
- if (input == sc->fc) /* no change? */
- return (error);
-
switch (input) {
case e1000_fc_rx_pause:
case e1000_fc_tx_pause:
case e1000_fc_full:
case e1000_fc_none:
- sc->hw.fc.requested_mode = input;
- sc->fc = input;
break;
default:
- /* Do nothing */
- return (error);
+ return (EINVAL);
}
- sc->hw.fc.current_mode = sc->hw.fc.requested_mode;
- e1000_force_mac_fc(&sc->hw);
- return (error);
+ if (input == sc->fc) /* no change? */
+ return (0);
+
+ /*
+ * The mode is advertised to the link partner and also decides the
+ * pause thresholds and per-queue drop, so it takes a reinit to apply.
+ */
+ sc->fc = input;
+ em_sysctl_request_reinit(sc);
+ return (0);
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 7, 9:24 PM (8 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40312357
Default Alt Text
D60376.id188742.diff (2 KB)
Attached To
Mode
D60376: e1000: Fix the flow control sysctl
Attached
Detach File
Event Timeline
Log In to Comment