e1000_param.c 21 KB

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