📄 e1000_param.c
字号:
};#ifdef module_param_array if (num_TxIntDelay > bd) {#endif adapter->tx_int_delay = TxIntDelay[bd]; e1000_validate_option(&adapter->tx_int_delay, &opt, adapter);#ifdef module_param_array } else { adapter->tx_int_delay = opt.def; }#endif } { /* Transmit Absolute Interrupt Delay */ struct e1000_option opt = { .type = range_option, .name = "Transmit Absolute Interrupt Delay", .err = "using default of " __MODULE_STRING(DEFAULT_TADV), .def = DEFAULT_TADV, .arg = { .r = { .min = MIN_TXABSDELAY, .max = MAX_TXABSDELAY }} };#ifdef module_param_array if (num_TxAbsIntDelay > bd) {#endif adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; e1000_validate_option(&adapter->tx_abs_int_delay, &opt, adapter);#ifdef module_param_array } else { adapter->tx_abs_int_delay = opt.def; }#endif } { /* Receive Interrupt Delay */ struct e1000_option opt = { .type = range_option, .name = "Receive Interrupt Delay", .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), .def = DEFAULT_RDTR, .arg = { .r = { .min = MIN_RXDELAY, .max = MAX_RXDELAY }} };#ifdef module_param_array if (num_RxIntDelay > bd) {#endif adapter->rx_int_delay = RxIntDelay[bd]; e1000_validate_option(&adapter->rx_int_delay, &opt, adapter);#ifdef module_param_array } else { adapter->rx_int_delay = opt.def; }#endif } { /* Receive Absolute Interrupt Delay */ struct e1000_option opt = { .type = range_option, .name = "Receive Absolute Interrupt Delay", .err = "using default of " __MODULE_STRING(DEFAULT_RADV), .def = DEFAULT_RADV, .arg = { .r = { .min = MIN_RXABSDELAY, .max = MAX_RXABSDELAY }} };#ifdef module_param_array if (num_RxAbsIntDelay > bd) {#endif adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; e1000_validate_option(&adapter->rx_abs_int_delay, &opt, adapter);#ifdef module_param_array } else { adapter->rx_abs_int_delay = opt.def; }#endif } { /* Interrupt Throttling Rate */ struct e1000_option opt = { .type = range_option, .name = "Interrupt Throttling Rate (ints/sec)", .err = "using default of " __MODULE_STRING(DEFAULT_ITR), .def = DEFAULT_ITR, .arg = { .r = { .min = MIN_ITR, .max = MAX_ITR }} };#ifdef module_param_array if (num_InterruptThrottleRate > bd) {#endif adapter->itr = InterruptThrottleRate[bd]; switch (adapter->itr) { case 0: DPRINTK(PROBE, INFO, "%s turned off\n", opt.name); break; case 1: DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", opt.name); break; default: e1000_validate_option(&adapter->itr, &opt, adapter); break; }#ifdef module_param_array } else { adapter->itr = opt.def; }#endif } { /* Smart Power Down */ struct e1000_option opt = { .type = enable_option, .name = "PHY Smart Power Down", .err = "defaulting to Disabled", .def = OPTION_DISABLED };#ifdef module_param_array if (num_SmartPowerDownEnable > bd) {#endif int spd = SmartPowerDownEnable[bd]; e1000_validate_option(&spd, &opt, adapter); adapter->smart_power_down = spd;#ifdef module_param_array } else { adapter->smart_power_down = opt.def; }#endif } { /* Kumeran Lock Loss Workaround */ struct e1000_option opt = { .type = enable_option, .name = "Kumeran Lock Loss Workaround", .err = "defaulting to Enabled", .def = OPTION_ENABLED };#ifdef module_param_array if (num_KumeranLockLoss > bd) {#endif int kmrn_lock_loss = KumeranLockLoss[bd]; e1000_validate_option(&kmrn_lock_loss, &opt, adapter); adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss;#ifdef module_param_array } else { adapter->hw.kmrn_lock_loss_workaround_disabled = !opt.def; }#endif } switch (adapter->hw.media_type) { case e1000_media_type_fiber: case e1000_media_type_internal_serdes: e1000_check_fiber_options(adapter); break; case e1000_media_type_copper: e1000_check_copper_options(adapter); break; default: BUG(); }}/** * e1000_check_fiber_options - Range Checking for Link Options, Fiber Version * @adapter: board private structure * * Handles speed and duplex options on fiber adapters **/static void __devinite1000_check_fiber_options(struct e1000_adapter *adapter){ int bd = adapter->bd_number;#ifndef module_param_array bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd; if ((Speed[bd] != OPTION_UNSET)) {#else if (num_Speed > bd) {#endif DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " "parameter ignored\n"); }#ifndef module_param_array if ((Duplex[bd] != OPTION_UNSET)) {#else if (num_Duplex > bd) {#endif DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " "parameter ignored\n"); }#ifndef module_param_array if ((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) {#else if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {#endif DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " "not valid for fiber adapters, " "parameter ignored\n"); }}/** * e1000_check_copper_options - Range Checking for Link Options, Copper Version * @adapter: board private structure * * Handles speed and duplex options on copper adapters **/static void __devinite1000_check_copper_options(struct e1000_adapter *adapter){ int speed, dplx, an; int bd = adapter->bd_number;#ifndef module_param_array bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;#endif { /* Speed */ struct e1000_opt_list speed_list[] = {{ 0, "" }, { SPEED_10, "" }, { SPEED_100, "" }, { SPEED_1000, "" }}; struct e1000_option opt = { .type = list_option, .name = "Speed", .err = "parameter ignored", .def = 0, .arg = { .l = { .nr = ARRAY_SIZE(speed_list), .p = speed_list }} };#ifdef module_param_array if (num_Speed > bd) {#endif speed = Speed[bd]; e1000_validate_option(&speed, &opt, adapter);#ifdef module_param_array } else { speed = opt.def; }#endif } { /* Duplex */ struct e1000_opt_list dplx_list[] = {{ 0, "" }, { HALF_DUPLEX, "" }, { FULL_DUPLEX, "" }}; struct e1000_option opt = { .type = list_option, .name = "Duplex", .err = "parameter ignored", .def = 0, .arg = { .l = { .nr = ARRAY_SIZE(dplx_list), .p = dplx_list }} }; if (e1000_check_phy_reset_block(&adapter->hw)) { DPRINTK(PROBE, INFO, "Link active due to SoL/IDER Session. " "Speed/Duplex/AutoNeg parameter ignored.\n"); return; }#ifdef module_param_array if (num_Duplex > bd) {#endif dplx = Duplex[bd]; e1000_validate_option(&dplx, &opt, adapter);#ifdef module_param_array } else { dplx = opt.def; }#endif }#ifdef module_param_array if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {#else if (AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) {#endif DPRINTK(PROBE, INFO, "AutoNeg specified along with Speed or Duplex, " "parameter ignored\n"); adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; } else { /* Autoneg */ struct e1000_opt_list an_list[] = #define AA "AutoNeg advertising " {{ 0x01, AA "10/HD" }, { 0x02, AA "10/FD" }, { 0x03, AA "10/FD, 10/HD" }, { 0x04, AA "100/HD" }, { 0x05, AA "100/HD, 10/HD" }, { 0x06, AA "100/HD, 10/FD" }, { 0x07, AA "100/HD, 10/FD, 10/HD" }, { 0x08, AA "100/FD" }, { 0x09, AA "100/FD, 10/HD" }, { 0x0a, AA "100/FD, 10/FD" }, { 0x0b, AA "100/FD, 10/FD, 10/HD" }, { 0x0c, AA "100/FD, 100/HD" }, { 0x0d, AA "100/FD, 100/HD, 10/HD" }, { 0x0e, AA "100/FD, 100/HD, 10/FD" }, { 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" }, { 0x20, AA "1000/FD" }, { 0x21, AA "1000/FD, 10/HD" }, { 0x22, AA "1000/FD, 10/FD" }, { 0x23, AA "1000/FD, 10/FD, 10/HD" }, { 0x24, AA "1000/FD, 100/HD" }, { 0x25, AA "1000/FD, 100/HD, 10/HD" }, { 0x26, AA "1000/FD, 100/HD, 10/FD" }, { 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" }, { 0x28, AA "1000/FD, 100/FD" }, { 0x29, AA "1000/FD, 100/FD, 10/HD" }, { 0x2a, AA "1000/FD, 100/FD, 10/FD" }, { 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" }, { 0x2c, AA "1000/FD, 100/FD, 100/HD" }, { 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" }, { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" }, { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }}; struct e1000_option opt = { .type = list_option, .name = "AutoNeg", .err = "parameter ignored", .def = AUTONEG_ADV_DEFAULT, .arg = { .l = { .nr = ARRAY_SIZE(an_list), .p = an_list }} };#ifdef module_param_array if (num_AutoNeg > bd) {#endif an = AutoNeg[bd]; e1000_validate_option(&an, &opt, adapter);#ifdef module_param_array } else { an = opt.def; }#endif adapter->hw.autoneg_advertised = an; } switch (speed + dplx) { case 0: adapter->hw.autoneg = adapter->fc_autoneg = 1;#ifdef module_param_array if ((num_Speed > bd) && (speed != 0 || dplx != 0))#else if (Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET)#endif DPRINTK(PROBE, INFO, "Speed and duplex autonegotiation enabled\n"); break; case HALF_DUPLEX: DPRINTK(PROBE, INFO, "Half Duplex specified without Speed\n"); DPRINTK(PROBE, INFO, "Using Autonegotiation at " "Half Duplex only\n"); adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_10_HALF | ADVERTISE_100_HALF; break; case FULL_DUPLEX: DPRINTK(PROBE, INFO, "Full Duplex specified without Speed\n"); DPRINTK(PROBE, INFO, "Using Autonegotiation at " "Full Duplex only\n"); adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_10_FULL | ADVERTISE_100_FULL | ADVERTISE_1000_FULL; break; case SPEED_10: DPRINTK(PROBE, INFO, "10 Mbps Speed specified " "without Duplex\n"); DPRINTK(PROBE, INFO, "Using Autonegotiation at 10 Mbps only\n"); adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_10_HALF | ADVERTISE_10_FULL; break; case SPEED_10 + HALF_DUPLEX: DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Half Duplex\n"); adapter->hw.autoneg = adapter->fc_autoneg = 0; adapter->hw.forced_speed_duplex = e1000_10_half; adapter->hw.autoneg_advertised = 0; break; case SPEED_10 + FULL_DUPLEX: DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Full Duplex\n"); adapter->hw.autoneg = adapter->fc_autoneg = 0; adapter->hw.forced_speed_duplex = e1000_10_full; adapter->hw.autoneg_advertised = 0; break; case SPEED_100: DPRINTK(PROBE, INFO, "100 Mbps Speed specified " "without Duplex\n"); DPRINTK(PROBE, INFO, "Using Autonegotiation at " "100 Mbps only\n"); adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_100_HALF | ADVERTISE_100_FULL; break; case SPEED_100 + HALF_DUPLEX: DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Half Duplex\n"); adapter->hw.autoneg = adapter->fc_autoneg = 0; adapter->hw.forced_speed_duplex = e1000_100_half; adapter->hw.autoneg_advertised = 0; break; case SPEED_100 + FULL_DUPLEX: DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Full Duplex\n"); adapter->hw.autoneg = adapter->fc_autoneg = 0; adapter->hw.forced_speed_duplex = e1000_100_full; adapter->hw.autoneg_advertised = 0; break; case SPEED_1000: DPRINTK(PROBE, INFO, "1000 Mbps Speed specified without " "Duplex\n"); DPRINTK(PROBE, INFO, "Using Autonegotiation at 1000 Mbps " "Full Duplex only\n"); adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; break; case SPEED_1000 + HALF_DUPLEX: DPRINTK(PROBE, INFO, "Half Duplex is not supported at 1000 Mbps\n"); DPRINTK(PROBE, INFO, "Using Autonegotiation at 1000 Mbps " "Full Duplex only\n"); adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; break; case SPEED_1000 + FULL_DUPLEX: DPRINTK(PROBE, INFO, "Using Autonegotiation at 1000 Mbps Full Duplex only\n"); adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; break; default: BUG(); } /* Speed, AutoNeg and MDI/MDI-X must all play nice */ if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) { DPRINTK(PROBE, INFO, "Speed, AutoNeg and MDI-X specifications are " "incompatible. Setting MDI-X to a compatible value.\n"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -