e1000_param.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:19k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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