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