[RTnet-developers] [PATCH 5/6] e1000e: add ForceSpeedDuplex module parameter
Brought to you by:
bet-frogger,
kiszka
|
From: Arnout V. (Essensium/Mind) <ar...@mi...> - 2011-10-06 20:37:19
|
From: "Arnout Vandecappelle (Essensium/Mind)" <ar...@mi...>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <ar...@mi...>
---
drivers/experimental/e1000e/hw.h | 2 +-
drivers/experimental/e1000e/netdev.c | 5 ++++
drivers/experimental/e1000e/param.c | 40 ++++++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 1 deletions(-)
diff --git a/drivers/experimental/e1000e/hw.h b/drivers/experimental/e1000e/hw.h
index 11f3b7c..0c5ddb3 100644
--- a/drivers/experimental/e1000e/hw.h
+++ b/drivers/experimental/e1000e/hw.h
@@ -810,7 +810,7 @@ struct e1000_mac_info {
u16 mta_reg_count;
u16 rar_entry_count;
- u8 forced_speed_duplex;
+ u32 forced_speed_duplex;
bool arc_subsystem_valid;
bool autoneg;
diff --git a/drivers/experimental/e1000e/netdev.c b/drivers/experimental/e1000e/netdev.c
index bf2b916..d005956 100644
--- a/drivers/experimental/e1000e/netdev.c
+++ b/drivers/experimental/e1000e/netdev.c
@@ -5055,6 +5055,11 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
adapter->hw.fc.current_mode = e1000_fc_default;
adapter->hw.phy.autoneg_advertised = 0x2f;
+ if (adapter->hw.mac.forced_speed_duplex != 0) {
+ adapter->hw.mac.autoneg = false;
+ adapter->hw.phy.autoneg_advertised = adapter->hw.mac.forced_speed_duplex;
+ }
+
/* ring size defaults */
adapter->rx_ring->count = 256;
adapter->tx_ring->count = 256;
diff --git a/drivers/experimental/e1000e/param.c b/drivers/experimental/e1000e/param.c
index bb20552..a57ddb8 100644
--- a/drivers/experimental/e1000e/param.c
+++ b/drivers/experimental/e1000e/param.c
@@ -64,6 +64,22 @@ unsigned int copybreak = COPYBREAK_DEFAULT;
/*
+ * Force speed and duplex.
+ *
+ * Valid Values:
+ * 0x00: Auto-negotiate (default)
+ * 0x01: 10Mbps Half-Duplex
+ * 0x02: 10Mbps Full-Duplex
+ * 0x04: 100Mbps Half-Duplex
+ * 0x08: 100Mbps Full-Duplex
+ * 0x20: 1000Mbps Full-Duplex
+ *
+ * Note: although these values are the same as the flags for advertising, it
+ * is not valid to specify multiple flags.
+ */
+E1000_PARAM(ForceSpeedDuplex, "Forced Speed and Duplex");
+
+/*
* Transmit Interrupt Delay in units of 1.024 microseconds
* Tx interrupt delay needs to typically be set to something non zero
*
@@ -247,6 +263,30 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
e_notice("Using defaults for all values\n");
}
+ { /* Force speed and duplex */
+ struct e1000_opt_list fsd_list[] =
+ {{ ADVERTISE_10_HALF, "10 Mbps Half-Duplex" },
+ { ADVERTISE_10_FULL, "10 Mbps Full-Duplex" },
+ { ADVERTISE_100_HALF, "100 Mbps Half-Duplex" },
+ { ADVERTISE_100_FULL, "100 Mbps Full-Duplex" },
+ { ADVERTISE_1000_FULL, "1000 Mbps Full-Duplex" }};
+ const struct e1000_option opt = {
+ .type = list_option,
+ .name = "Forced Speed and Duplex",
+ .err = "defaulting to Auto-Negotiate",
+ .def = 0,
+ .arg = { .l = { .nr = ARRAY_SIZE(fsd_list),
+ .p = fsd_list } }
+ };
+ if (num_ForceSpeedDuplex > bd) {
+ adapter->hw.mac.forced_speed_duplex = ForceSpeedDuplex[bd];
+ e1000_validate_option(&adapter->hw.mac.forced_speed_duplex, &opt,
+ adapter);
+ } else {
+ adapter->hw.mac.forced_speed_duplex = opt.def;
+ }
+ }
+
{ /* Transmit Interrupt Delay */
const struct e1000_option opt = {
.type = range_option,
--
1.7.6.3
|