e1000_param.c 21 KB

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