e1000_param.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. /*******************************************************************************
  2. Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
  3. This program is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published by the Free
  5. Software Foundation; either version 2 of the License, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc., 59
  13. Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. The full GNU General Public License is included in this distribution in the
  15. file called LICENSE.
  16. Contact Information:
  17. Linux NICS <linux.nics@intel.com>
  18. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  19. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  20. *******************************************************************************/
  21. #include "e1000.h"
  22. /* This is the only thing that needs to be changed to adjust the
  23. * maximum number of ports that the driver can manage.
  24. */
  25. #define E1000_MAX_NIC 32
  26. #define OPTION_UNSET -1
  27. #define OPTION_DISABLED 0
  28. #define OPTION_ENABLED 1
  29. /* All parameters are treated the same, as an integer array of values.
  30. * This macro just reduces the need to repeat the same declaration code
  31. * over and over (plus this helps to avoid typo bugs).
  32. */
  33. #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
  34. /* Module Parameters are always initialized to -1, so that the driver
  35. * can tell the difference between no user specified value or the
  36. * user asking for the default value.
  37. * The true default values are loaded in when e1000_check_options is called.
  38. *
  39. * This is a GCC extension to ANSI C.
  40. * See the item "Labeled Elements in Initializers" in the section
  41. * "Extensions to the C Language Family" of the GCC documentation.
  42. */
  43. #define E1000_PARAM(X, desc) \
  44. static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
  45. static int num_##X = 0; \
  46. module_param_array_named(X, X, int, &num_##X, 0); \
  47. MODULE_PARM_DESC(X, desc);
  48. /* Transmit Descriptor Count
  49. *
  50. * Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
  51. * Valid Range: 80-4096 for 82544 and newer
  52. *
  53. * Default Value: 256
  54. */
  55. E1000_PARAM(TxDescriptors, "Number of transmit descriptors");
  56. /* Receive Descriptor Count
  57. *
  58. * Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
  59. * Valid Range: 80-4096 for 82544 and newer
  60. *
  61. * Default Value: 256
  62. */
  63. E1000_PARAM(RxDescriptors, "Number of receive descriptors");
  64. /* User Specified Speed Override
  65. *
  66. * Valid Range: 0, 10, 100, 1000
  67. * - 0 - auto-negotiate at all supported speeds
  68. * - 10 - only link at 10 Mbps
  69. * - 100 - only link at 100 Mbps
  70. * - 1000 - only link at 1000 Mbps
  71. *
  72. * Default Value: 0
  73. */
  74. E1000_PARAM(Speed, "Speed setting");
  75. /* User Specified Duplex Override
  76. *
  77. * Valid Range: 0-2
  78. * - 0 - auto-negotiate for duplex
  79. * - 1 - only link at half duplex
  80. * - 2 - only link at full duplex
  81. *
  82. * Default Value: 0
  83. */
  84. E1000_PARAM(Duplex, "Duplex setting");
  85. /* Auto-negotiation Advertisement Override
  86. *
  87. * Valid Range: 0x01-0x0F, 0x20-0x2F (copper); 0x20 (fiber)
  88. *
  89. * The AutoNeg value is a bit mask describing which speed and duplex
  90. * combinations should be advertised during auto-negotiation.
  91. * The supported speed and duplex modes are listed below
  92. *
  93. * Bit 7 6 5 4 3 2 1 0
  94. * Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10
  95. * Duplex Full Full Half Full Half
  96. *
  97. * Default Value: 0x2F (copper); 0x20 (fiber)
  98. */
  99. E1000_PARAM(AutoNeg, "Advertised auto-negotiation setting");
  100. /* User Specified Flow Control Override
  101. *
  102. * Valid Range: 0-3
  103. * - 0 - No Flow Control
  104. * - 1 - Rx only, respond to PAUSE frames but do not generate them
  105. * - 2 - Tx only, generate PAUSE frames but ignore them on receive
  106. * - 3 - Full Flow Control Support
  107. *
  108. * Default Value: Read flow control settings from the EEPROM
  109. */
  110. E1000_PARAM(FlowControl, "Flow Control setting");
  111. /* XsumRX - Receive Checksum Offload Enable/Disable
  112. *
  113. * Valid Range: 0, 1
  114. * - 0 - disables all checksum offload
  115. * - 1 - enables receive IP/TCP/UDP checksum offload
  116. * on 82543 and newer -based NICs
  117. *
  118. * Default Value: 1
  119. */
  120. E1000_PARAM(XsumRX, "Disable or enable Receive Checksum offload");
  121. /* Transmit Interrupt Delay in units of 1.024 microseconds
  122. *
  123. * Valid Range: 0-65535
  124. *
  125. * Default Value: 64
  126. */
  127. E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay");
  128. /* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
  129. *
  130. * Valid Range: 0-65535
  131. *
  132. * Default Value: 0
  133. */
  134. E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay");
  135. /* Receive Interrupt Delay in units of 1.024 microseconds
  136. *
  137. * Valid Range: 0-65535
  138. *
  139. * Default Value: 0
  140. */
  141. E1000_PARAM(RxIntDelay, "Receive Interrupt Delay");
  142. /* Receive Absolute Interrupt Delay in units of 1.024 microseconds
  143. *
  144. * Valid Range: 0-65535
  145. *
  146. * Default Value: 128
  147. */
  148. E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
  149. /* Interrupt Throttle Rate (interrupts/sec)
  150. *
  151. * Valid Range: 100-100000 (0=off, 1=dynamic)
  152. *
  153. * Default Value: 8000
  154. */
  155. E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
  156. /* Enable Smart Power Down of the PHY
  157. *
  158. * Valid Range: 0, 1
  159. *
  160. * Default Value: 0 (disabled)
  161. */
  162. E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
  163. /* Enable Kumeran Lock Loss workaround
  164. *
  165. * Valid Range: 0, 1
  166. *
  167. * Default Value: 1 (enabled)
  168. */
  169. E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
  170. #define AUTONEG_ADV_DEFAULT 0x2F
  171. #define AUTONEG_ADV_MASK 0x2F
  172. #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL
  173. #define DEFAULT_RDTR 0
  174. #define MAX_RXDELAY 0xFFFF
  175. #define MIN_RXDELAY 0
  176. #define DEFAULT_RADV 128
  177. #define MAX_RXABSDELAY 0xFFFF
  178. #define MIN_RXABSDELAY 0
  179. #define DEFAULT_TIDV 64
  180. #define MAX_TXDELAY 0xFFFF
  181. #define MIN_TXDELAY 0
  182. #define DEFAULT_TADV 64
  183. #define MAX_TXABSDELAY 0xFFFF
  184. #define MIN_TXABSDELAY 0
  185. #define DEFAULT_ITR 8000
  186. #define MAX_ITR 100000
  187. #define MIN_ITR 100
  188. struct e1000_option {
  189. enum { enable_option, range_option, list_option } type;
  190. char *name;
  191. char *err;
  192. int def;
  193. union {
  194. struct { /* range_option info */
  195. int min;
  196. int max;
  197. } r;
  198. struct { /* list_option info */
  199. int nr;
  200. struct e1000_opt_list { int i; char *str; } *p;
  201. } l;
  202. } arg;
  203. };
  204. static int __devinit
  205. e1000_validate_option(int *value, struct e1000_option *opt,
  206. struct e1000_adapter *adapter)
  207. {
  208. if (*value == OPTION_UNSET) {
  209. *value = opt->def;
  210. return 0;
  211. }
  212. switch (opt->type) {
  213. case enable_option:
  214. switch (*value) {
  215. case OPTION_ENABLED:
  216. DPRINTK(PROBE, INFO, "%s Enabled\n", opt->name);
  217. return 0;
  218. case OPTION_DISABLED:
  219. DPRINTK(PROBE, INFO, "%s Disabled\n", opt->name);
  220. return 0;
  221. }
  222. break;
  223. case range_option:
  224. if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
  225. DPRINTK(PROBE, INFO,
  226. "%s set to %i\n", opt->name, *value);
  227. return 0;
  228. }
  229. break;
  230. case list_option: {
  231. int i;
  232. struct e1000_opt_list *ent;
  233. for (i = 0; i < opt->arg.l.nr; i++) {
  234. ent = &opt->arg.l.p[i];
  235. if (*value == ent->i) {
  236. if (ent->str[0] != '\0')
  237. DPRINTK(PROBE, INFO, "%s\n", ent->str);
  238. return 0;
  239. }
  240. }
  241. }
  242. break;
  243. default:
  244. BUG();
  245. }
  246. DPRINTK(PROBE, INFO, "Invalid %s value specified (%i) %s\n",
  247. opt->name, *value, opt->err);
  248. *value = opt->def;
  249. return -1;
  250. }
  251. static void e1000_check_fiber_options(struct e1000_adapter *adapter);
  252. static void e1000_check_copper_options(struct e1000_adapter *adapter);
  253. /**
  254. * e1000_check_options - Range Checking for Command Line Parameters
  255. * @adapter: board private structure
  256. *
  257. * This routine checks all command line parameters for valid user
  258. * input. If an invalid value is given, or if no user specified
  259. * value exists, a default value is used. The final value is stored
  260. * in a variable in the adapter structure.
  261. **/
  262. void __devinit
  263. e1000_check_options(struct e1000_adapter *adapter)
  264. {
  265. int bd = adapter->bd_number;
  266. if (bd >= E1000_MAX_NIC) {
  267. DPRINTK(PROBE, NOTICE,
  268. "Warning: no configuration for board #%i\n", bd);
  269. DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
  270. bd = E1000_MAX_NIC;
  271. }
  272. { /* Transmit Descriptor Count */
  273. struct e1000_option opt = {
  274. .type = range_option,
  275. .name = "Transmit Descriptors",
  276. .err = "using default of "
  277. __MODULE_STRING(E1000_DEFAULT_TXD),
  278. .def = E1000_DEFAULT_TXD,
  279. .arg = { .r = { .min = E1000_MIN_TXD }}
  280. };
  281. struct e1000_tx_ring *tx_ring = adapter->tx_ring;
  282. int i;
  283. e1000_mac_type mac_type = adapter->hw.mac_type;
  284. opt.arg.r.max = mac_type < e1000_82544 ?
  285. E1000_MAX_TXD : E1000_MAX_82544_TXD;
  286. tx_ring->count = TxDescriptors[bd];
  287. e1000_validate_option(&tx_ring->count, &opt, adapter);
  288. E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE);
  289. for (i = 0; i < adapter->num_tx_queues; i++)
  290. tx_ring[i].count = tx_ring->count;
  291. }
  292. { /* Receive Descriptor Count */
  293. struct e1000_option opt = {
  294. .type = range_option,
  295. .name = "Receive Descriptors",
  296. .err = "using default of "
  297. __MODULE_STRING(E1000_DEFAULT_RXD),
  298. .def = E1000_DEFAULT_RXD,
  299. .arg = { .r = { .min = E1000_MIN_RXD }}
  300. };
  301. struct e1000_rx_ring *rx_ring = adapter->rx_ring;
  302. int i;
  303. e1000_mac_type mac_type = adapter->hw.mac_type;
  304. opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
  305. E1000_MAX_82544_RXD;
  306. rx_ring->count = RxDescriptors[bd];
  307. e1000_validate_option(&rx_ring->count, &opt, adapter);
  308. E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE);
  309. for (i = 0; i < adapter->num_rx_queues; i++)
  310. rx_ring[i].count = rx_ring->count;
  311. }
  312. { /* Checksum Offload Enable/Disable */
  313. struct e1000_option opt = {
  314. .type = enable_option,
  315. .name = "Checksum Offload",
  316. .err = "defaulting to Enabled",
  317. .def = OPTION_ENABLED
  318. };
  319. int rx_csum = XsumRX[bd];
  320. e1000_validate_option(&rx_csum, &opt, adapter);
  321. adapter->rx_csum = rx_csum;
  322. }
  323. { /* Flow Control */
  324. struct e1000_opt_list fc_list[] =
  325. {{ e1000_fc_none, "Flow Control Disabled" },
  326. { e1000_fc_rx_pause,"Flow Control Receive Only" },
  327. { e1000_fc_tx_pause,"Flow Control Transmit Only" },
  328. { e1000_fc_full, "Flow Control Enabled" },
  329. { e1000_fc_default, "Flow Control Hardware Default" }};
  330. struct e1000_option opt = {
  331. .type = list_option,
  332. .name = "Flow Control",
  333. .err = "reading default settings from EEPROM",
  334. .def = e1000_fc_default,
  335. .arg = { .l = { .nr = ARRAY_SIZE(fc_list),
  336. .p = fc_list }}
  337. };
  338. int fc = FlowControl[bd];
  339. e1000_validate_option(&fc, &opt, adapter);
  340. adapter->hw.fc = adapter->hw.original_fc = fc;
  341. }
  342. { /* Transmit Interrupt Delay */
  343. struct e1000_option opt = {
  344. .type = range_option,
  345. .name = "Transmit Interrupt Delay",
  346. .err = "using default of " __MODULE_STRING(DEFAULT_TIDV),
  347. .def = DEFAULT_TIDV,
  348. .arg = { .r = { .min = MIN_TXDELAY,
  349. .max = MAX_TXDELAY }}
  350. };
  351. adapter->tx_int_delay = TxIntDelay[bd];
  352. e1000_validate_option(&adapter->tx_int_delay, &opt, adapter);
  353. }
  354. { /* Transmit Absolute Interrupt Delay */
  355. struct e1000_option opt = {
  356. .type = range_option,
  357. .name = "Transmit Absolute Interrupt Delay",
  358. .err = "using default of " __MODULE_STRING(DEFAULT_TADV),
  359. .def = DEFAULT_TADV,
  360. .arg = { .r = { .min = MIN_TXABSDELAY,
  361. .max = MAX_TXABSDELAY }}
  362. };
  363. adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
  364. e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
  365. adapter);
  366. }
  367. { /* Receive Interrupt Delay */
  368. struct e1000_option opt = {
  369. .type = range_option,
  370. .name = "Receive Interrupt Delay",
  371. .err = "using default of " __MODULE_STRING(DEFAULT_RDTR),
  372. .def = DEFAULT_RDTR,
  373. .arg = { .r = { .min = MIN_RXDELAY,
  374. .max = MAX_RXDELAY }}
  375. };
  376. adapter->rx_int_delay = RxIntDelay[bd];
  377. e1000_validate_option(&adapter->rx_int_delay, &opt, adapter);
  378. }
  379. { /* Receive Absolute Interrupt Delay */
  380. struct e1000_option opt = {
  381. .type = range_option,
  382. .name = "Receive Absolute Interrupt Delay",
  383. .err = "using default of " __MODULE_STRING(DEFAULT_RADV),
  384. .def = DEFAULT_RADV,
  385. .arg = { .r = { .min = MIN_RXABSDELAY,
  386. .max = MAX_RXABSDELAY }}
  387. };
  388. adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
  389. e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
  390. adapter);
  391. }
  392. { /* Interrupt Throttling Rate */
  393. struct e1000_option opt = {
  394. .type = range_option,
  395. .name = "Interrupt Throttling Rate (ints/sec)",
  396. .err = "using default of " __MODULE_STRING(DEFAULT_ITR),
  397. .def = DEFAULT_ITR,
  398. .arg = { .r = { .min = MIN_ITR,
  399. .max = MAX_ITR }}
  400. };
  401. adapter->itr = InterruptThrottleRate[bd];
  402. switch (adapter->itr) {
  403. case 0:
  404. DPRINTK(PROBE, INFO, "%s turned off\n", opt.name);
  405. break;
  406. case 1:
  407. DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
  408. opt.name);
  409. break;
  410. default:
  411. e1000_validate_option(&adapter->itr, &opt, adapter);
  412. break;
  413. }
  414. }
  415. { /* Smart Power Down */
  416. struct e1000_option opt = {
  417. .type = enable_option,
  418. .name = "PHY Smart Power Down",
  419. .err = "defaulting to Disabled",
  420. .def = OPTION_DISABLED
  421. };
  422. int spd = SmartPowerDownEnable[bd];
  423. e1000_validate_option(&spd, &opt, adapter);
  424. adapter->smart_power_down = spd;
  425. }
  426. { /* Kumeran Lock Loss Workaround */
  427. struct e1000_option opt = {
  428. .type = enable_option,
  429. .name = "Kumeran Lock Loss Workaround",
  430. .err = "defaulting to Enabled",
  431. .def = OPTION_ENABLED
  432. };
  433. int kmrn_lock_loss = KumeranLockLoss[bd];
  434. e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
  435. adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss;
  436. }
  437. switch (adapter->hw.media_type) {
  438. case e1000_media_type_fiber:
  439. case e1000_media_type_internal_serdes:
  440. e1000_check_fiber_options(adapter);
  441. break;
  442. case e1000_media_type_copper:
  443. e1000_check_copper_options(adapter);
  444. break;
  445. default:
  446. BUG();
  447. }
  448. }
  449. /**
  450. * e1000_check_fiber_options - Range Checking for Link Options, Fiber Version
  451. * @adapter: board private structure
  452. *
  453. * Handles speed and duplex options on fiber adapters
  454. **/
  455. static void __devinit
  456. e1000_check_fiber_options(struct e1000_adapter *adapter)
  457. {
  458. int bd = adapter->bd_number;
  459. bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
  460. if ((Speed[bd] != OPTION_UNSET)) {
  461. DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
  462. "parameter ignored\n");
  463. }
  464. if ((Duplex[bd] != OPTION_UNSET)) {
  465. DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
  466. "parameter ignored\n");
  467. }
  468. if ((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) {
  469. DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is "
  470. "not valid for fiber adapters, "
  471. "parameter ignored\n");
  472. }
  473. }
  474. /**
  475. * e1000_check_copper_options - Range Checking for Link Options, Copper Version
  476. * @adapter: board private structure
  477. *
  478. * Handles speed and duplex options on copper adapters
  479. **/
  480. static void __devinit
  481. e1000_check_copper_options(struct e1000_adapter *adapter)
  482. {
  483. int speed, dplx, an;
  484. int bd = adapter->bd_number;
  485. bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
  486. { /* Speed */
  487. struct e1000_opt_list speed_list[] = {{ 0, "" },
  488. { SPEED_10, "" },
  489. { SPEED_100, "" },
  490. { SPEED_1000, "" }};
  491. struct e1000_option opt = {
  492. .type = list_option,
  493. .name = "Speed",
  494. .err = "parameter ignored",
  495. .def = 0,
  496. .arg = { .l = { .nr = ARRAY_SIZE(speed_list),
  497. .p = speed_list }}
  498. };
  499. speed = Speed[bd];
  500. e1000_validate_option(&speed, &opt, adapter);
  501. }
  502. { /* Duplex */
  503. struct e1000_opt_list dplx_list[] = {{ 0, "" },
  504. { HALF_DUPLEX, "" },
  505. { FULL_DUPLEX, "" }};
  506. struct e1000_option opt = {
  507. .type = list_option,
  508. .name = "Duplex",
  509. .err = "parameter ignored",
  510. .def = 0,
  511. .arg = { .l = { .nr = ARRAY_SIZE(dplx_list),
  512. .p = dplx_list }}
  513. };
  514. if (e1000_check_phy_reset_block(&adapter->hw)) {
  515. DPRINTK(PROBE, INFO,
  516. "Link active due to SoL/IDER Session. "
  517. "Speed/Duplex/AutoNeg parameter ignored.\n");
  518. return;
  519. }
  520. dplx = Duplex[bd];
  521. e1000_validate_option(&dplx, &opt, adapter);
  522. }
  523. if (AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) {
  524. DPRINTK(PROBE, INFO,
  525. "AutoNeg specified along with Speed or Duplex, "
  526. "parameter ignored\n");
  527. adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
  528. } else { /* Autoneg */
  529. struct e1000_opt_list an_list[] =
  530. #define AA "AutoNeg advertising "
  531. {{ 0x01, AA "10/HD" },
  532. { 0x02, AA "10/FD" },
  533. { 0x03, AA "10/FD, 10/HD" },
  534. { 0x04, AA "100/HD" },
  535. { 0x05, AA "100/HD, 10/HD" },
  536. { 0x06, AA "100/HD, 10/FD" },
  537. { 0x07, AA "100/HD, 10/FD, 10/HD" },
  538. { 0x08, AA "100/FD" },
  539. { 0x09, AA "100/FD, 10/HD" },
  540. { 0x0a, AA "100/FD, 10/FD" },
  541. { 0x0b, AA "100/FD, 10/FD, 10/HD" },
  542. { 0x0c, AA "100/FD, 100/HD" },
  543. { 0x0d, AA "100/FD, 100/HD, 10/HD" },
  544. { 0x0e, AA "100/FD, 100/HD, 10/FD" },
  545. { 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" },
  546. { 0x20, AA "1000/FD" },
  547. { 0x21, AA "1000/FD, 10/HD" },
  548. { 0x22, AA "1000/FD, 10/FD" },
  549. { 0x23, AA "1000/FD, 10/FD, 10/HD" },
  550. { 0x24, AA "1000/FD, 100/HD" },
  551. { 0x25, AA "1000/FD, 100/HD, 10/HD" },
  552. { 0x26, AA "1000/FD, 100/HD, 10/FD" },
  553. { 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" },
  554. { 0x28, AA "1000/FD, 100/FD" },
  555. { 0x29, AA "1000/FD, 100/FD, 10/HD" },
  556. { 0x2a, AA "1000/FD, 100/FD, 10/FD" },
  557. { 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" },
  558. { 0x2c, AA "1000/FD, 100/FD, 100/HD" },
  559. { 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" },
  560. { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" },
  561. { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }};
  562. struct e1000_option opt = {
  563. .type = list_option,
  564. .name = "AutoNeg",
  565. .err = "parameter ignored",
  566. .def = AUTONEG_ADV_DEFAULT,
  567. .arg = { .l = { .nr = ARRAY_SIZE(an_list),
  568. .p = an_list }}
  569. };
  570. an = AutoNeg[bd];
  571. e1000_validate_option(&an, &opt, adapter);
  572. adapter->hw.autoneg_advertised = an;
  573. }
  574. switch (speed + dplx) {
  575. case 0:
  576. adapter->hw.autoneg = adapter->fc_autoneg = 1;
  577. if (Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET)
  578. DPRINTK(PROBE, INFO,
  579. "Speed and duplex autonegotiation enabled\n");
  580. break;
  581. case HALF_DUPLEX:
  582. DPRINTK(PROBE, INFO, "Half Duplex specified without Speed\n");
  583. DPRINTK(PROBE, INFO, "Using Autonegotiation at "
  584. "Half Duplex only\n");
  585. adapter->hw.autoneg = adapter->fc_autoneg = 1;
  586. adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
  587. ADVERTISE_100_HALF;
  588. break;
  589. case FULL_DUPLEX:
  590. DPRINTK(PROBE, INFO, "Full Duplex specified without Speed\n");
  591. DPRINTK(PROBE, INFO, "Using Autonegotiation at "
  592. "Full Duplex only\n");
  593. adapter->hw.autoneg = adapter->fc_autoneg = 1;
  594. adapter->hw.autoneg_advertised = ADVERTISE_10_FULL |
  595. ADVERTISE_100_FULL |
  596. ADVERTISE_1000_FULL;
  597. break;
  598. case SPEED_10:
  599. DPRINTK(PROBE, INFO, "10 Mbps Speed specified "
  600. "without Duplex\n");
  601. DPRINTK(PROBE, INFO, "Using Autonegotiation at 10 Mbps only\n");
  602. adapter->hw.autoneg = adapter->fc_autoneg = 1;
  603. adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
  604. ADVERTISE_10_FULL;
  605. break;
  606. case SPEED_10 + HALF_DUPLEX:
  607. DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Half Duplex\n");
  608. adapter->hw.autoneg = adapter->fc_autoneg = 0;
  609. adapter->hw.forced_speed_duplex = e1000_10_half;
  610. adapter->hw.autoneg_advertised = 0;
  611. break;
  612. case SPEED_10 + FULL_DUPLEX:
  613. DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Full Duplex\n");
  614. adapter->hw.autoneg = adapter->fc_autoneg = 0;
  615. adapter->hw.forced_speed_duplex = e1000_10_full;
  616. adapter->hw.autoneg_advertised = 0;
  617. break;
  618. case SPEED_100:
  619. DPRINTK(PROBE, INFO, "100 Mbps Speed specified "
  620. "without Duplex\n");
  621. DPRINTK(PROBE, INFO, "Using Autonegotiation at "
  622. "100 Mbps only\n");
  623. adapter->hw.autoneg = adapter->fc_autoneg = 1;
  624. adapter->hw.autoneg_advertised = ADVERTISE_100_HALF |
  625. ADVERTISE_100_FULL;
  626. break;
  627. case SPEED_100 + HALF_DUPLEX:
  628. DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Half Duplex\n");
  629. adapter->hw.autoneg = adapter->fc_autoneg = 0;
  630. adapter->hw.forced_speed_duplex = e1000_100_half;
  631. adapter->hw.autoneg_advertised = 0;
  632. break;
  633. case SPEED_100 + FULL_DUPLEX:
  634. DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Full Duplex\n");
  635. adapter->hw.autoneg = adapter->fc_autoneg = 0;
  636. adapter->hw.forced_speed_duplex = e1000_100_full;
  637. adapter->hw.autoneg_advertised = 0;
  638. break;
  639. case SPEED_1000:
  640. DPRINTK(PROBE, INFO, "1000 Mbps Speed specified without "
  641. "Duplex\n");
  642. DPRINTK(PROBE, INFO,
  643. "Using Autonegotiation at 1000 Mbps "
  644. "Full Duplex only\n");
  645. adapter->hw.autoneg = adapter->fc_autoneg = 1;
  646. adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
  647. break;
  648. case SPEED_1000 + HALF_DUPLEX:
  649. DPRINTK(PROBE, INFO,
  650. "Half Duplex is not supported at 1000 Mbps\n");
  651. DPRINTK(PROBE, INFO,
  652. "Using Autonegotiation at 1000 Mbps "
  653. "Full Duplex only\n");
  654. adapter->hw.autoneg = adapter->fc_autoneg = 1;
  655. adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
  656. break;
  657. case SPEED_1000 + FULL_DUPLEX:
  658. DPRINTK(PROBE, INFO,
  659. "Using Autonegotiation at 1000 Mbps Full Duplex only\n");
  660. adapter->hw.autoneg = adapter->fc_autoneg = 1;
  661. adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
  662. break;
  663. default:
  664. BUG();
  665. }
  666. /* Speed, AutoNeg and MDI/MDI-X must all play nice */
  667. if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) {
  668. DPRINTK(PROBE, INFO,
  669. "Speed, AutoNeg and MDI-X specifications are "
  670. "incompatible. Setting MDI-X to a compatible value.\n");
  671. }
  672. }