linux-old/drivers/net/e1000/e1000_param.c
<<
>>
Prefs
   1/*******************************************************************************
   2
   3  
   4  Copyright(c) 1999 - 2004 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) \
  59static const int __devinitdata X[E1000_MAX_NIC + 1] = E1000_PARAM_INIT; \
  60MODULE_PARM(X, "1-" __MODULE_STRING(E1000_MAX_NIC) "i"); \
  61MODULE_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 and newer
  67 *
  68 * Default Value: 256
  69 */
  70
  71E1000_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 and newer
  77 *
  78 * Default Value: 256
  79 */
  80
  81E1000_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
  94E1000_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
 106E1000_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
 123E1000_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
 136E1000_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 and newer -based NICs
 144 *
 145 * Default Value: 1
 146 */
 147
 148E1000_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
 157E1000_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
 166E1000_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
 173 */
 174
 175E1000_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
 184E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
 185
 186/* Interrupt Throttle Rate (interrupts/sec)
 187 *
 188 * Valid Range: 100-100000 (0=off, 1=dynamic)
 189 *
 190 * Default Value: 1
 191 */
 192
 193E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
 194
 195#define AUTONEG_ADV_DEFAULT  0x2F
 196#define AUTONEG_ADV_MASK     0x2F
 197#define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL
 198
 199#define DEFAULT_RDTR                   0
 200#define MAX_RXDELAY               0xFFFF
 201#define MIN_RXDELAY                    0
 202
 203#define DEFAULT_RADV                 128
 204#define MAX_RXABSDELAY            0xFFFF
 205#define MIN_RXABSDELAY                 0
 206
 207#define DEFAULT_TIDV                  64
 208#define MAX_TXDELAY               0xFFFF
 209#define MIN_TXDELAY                    0
 210
 211#define DEFAULT_TADV                  64
 212#define MAX_TXABSDELAY            0xFFFF
 213#define MIN_TXABSDELAY                 0
 214
 215#define DEFAULT_ITR                    1
 216#define MAX_ITR                   100000
 217#define MIN_ITR                      100
 218
 219struct e1000_option {
 220        enum { enable_option, range_option, list_option } type;
 221        char *name;
 222        char *err;
 223        int  def;
 224        union {
 225                struct { /* range_option info */
 226                        int min;
 227                        int max;
 228                } r;
 229                struct { /* list_option info */
 230                        int nr;
 231                        struct e1000_opt_list { int i; char *str; } *p;
 232                } l;
 233        } arg;
 234};
 235
 236static int __devinit
 237e1000_validate_option(int *value, struct e1000_option *opt)
 238{
 239        if(*value == OPTION_UNSET) {
 240                *value = opt->def;
 241                return 0;
 242        }
 243
 244        switch (opt->type) {
 245        case enable_option:
 246                switch (*value) {
 247                case OPTION_ENABLED:
 248                        printk(KERN_INFO "%s Enabled\n", opt->name);
 249                        return 0;
 250                case OPTION_DISABLED:
 251                        printk(KERN_INFO "%s Disabled\n", opt->name);
 252                        return 0;
 253                }
 254                break;
 255        case range_option:
 256                if(*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
 257                        printk(KERN_INFO "%s set to %i\n", opt->name, *value);
 258                        return 0;
 259                }
 260                break;
 261        case list_option: {
 262                int i;
 263                struct e1000_opt_list *ent;
 264
 265                for(i = 0; i < opt->arg.l.nr; i++) {
 266                        ent = &opt->arg.l.p[i];
 267                        if(*value == ent->i) {
 268                                if(ent->str[0] != '\0')
 269                                        printk(KERN_INFO "%s\n", ent->str);
 270                                return 0;
 271                        }
 272                }
 273        }
 274                break;
 275        default:
 276                BUG();
 277        }
 278
 279        printk(KERN_INFO "Invalid %s specified (%i) %s\n",
 280               opt->name, *value, opt->err);
 281        *value = opt->def;
 282        return -1;
 283}
 284
 285static void e1000_check_fiber_options(struct e1000_adapter *adapter);
 286static void e1000_check_copper_options(struct e1000_adapter *adapter);
 287
 288/**
 289 * e1000_check_options - Range Checking for Command Line Parameters
 290 * @adapter: board private structure
 291 *
 292 * This routine checks all command line parameters for valid user
 293 * input.  If an invalid value is given, or if no user specified
 294 * value exists, a default value is used.  The final value is stored
 295 * in a variable in the adapter structure.
 296 **/
 297
 298void __devinit
 299e1000_check_options(struct e1000_adapter *adapter)
 300{
 301        int bd = adapter->bd_number;
 302        if(bd >= E1000_MAX_NIC) {
 303                printk(KERN_NOTICE
 304                       "Warning: no configuration for board #%i\n", bd);
 305                printk(KERN_NOTICE "Using defaults for all values\n");
 306                bd = E1000_MAX_NIC;
 307        }
 308
 309        { /* Transmit Descriptor Count */
 310                struct e1000_option opt = {
 311                        .type = range_option,
 312                        .name = "Transmit Descriptors",
 313                        .err  = "using default of "
 314                                __MODULE_STRING(E1000_DEFAULT_TXD),
 315                        .def  = E1000_DEFAULT_TXD,
 316                        .arg  = { .r = { .min = E1000_MIN_TXD }}
 317                };
 318                struct e1000_desc_ring *tx_ring = &adapter->tx_ring;
 319                e1000_mac_type mac_type = adapter->hw.mac_type;
 320                opt.arg.r.max = mac_type < e1000_82544 ?
 321                        E1000_MAX_TXD : E1000_MAX_82544_TXD;
 322
 323                tx_ring->count = TxDescriptors[bd];
 324                e1000_validate_option(&tx_ring->count, &opt);
 325                E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE);
 326        }
 327        { /* Receive Descriptor Count */
 328                struct e1000_option opt = {
 329                        .type = range_option,
 330                        .name = "Receive Descriptors",
 331                        .err  = "using default of "
 332                                __MODULE_STRING(E1000_DEFAULT_RXD),
 333                        .def  = E1000_DEFAULT_RXD,
 334                        .arg  = { .r = { .min = E1000_MIN_RXD }}
 335                };
 336                struct e1000_desc_ring *rx_ring = &adapter->rx_ring;
 337                e1000_mac_type mac_type = adapter->hw.mac_type;
 338                opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
 339                        E1000_MAX_82544_RXD;
 340
 341                rx_ring->count = RxDescriptors[bd];
 342                e1000_validate_option(&rx_ring->count, &opt);
 343                E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE);
 344        }
 345        { /* Checksum Offload Enable/Disable */
 346                struct e1000_option opt = {
 347                        .type = enable_option,
 348                        .name = "Checksum Offload",
 349                        .err  = "defaulting to Enabled",
 350                        .def  = OPTION_ENABLED
 351                };
 352
 353                int rx_csum = XsumRX[bd];
 354                e1000_validate_option(&rx_csum, &opt);
 355                adapter->rx_csum = rx_csum;
 356        }
 357        { /* Flow Control */
 358
 359                struct e1000_opt_list fc_list[] =
 360                        {{ e1000_fc_none,    "Flow Control Disabled" },
 361                         { e1000_fc_rx_pause,"Flow Control Receive Only" },
 362                         { e1000_fc_tx_pause,"Flow Control Transmit Only" },
 363                         { e1000_fc_full,    "Flow Control Enabled" },
 364                         { e1000_fc_default, "Flow Control Hardware Default" }};
 365
 366                struct e1000_option opt = {
 367                        .type = list_option,
 368                        .name = "Flow Control",
 369                        .err  = "reading default settings from EEPROM",
 370                        .def  = e1000_fc_default,
 371                        .arg  = { .l = { .nr = ARRAY_SIZE(fc_list),
 372                                         .p = fc_list }}
 373                };
 374
 375                int fc = FlowControl[bd];
 376                e1000_validate_option(&fc, &opt);
 377                adapter->hw.fc = adapter->hw.original_fc = fc;
 378        }
 379        { /* Transmit Interrupt Delay */
 380                struct e1000_option opt = {
 381                        .type = range_option,
 382                        .name = "Transmit Interrupt Delay",
 383                        .err  = "using default of " __MODULE_STRING(DEFAULT_TIDV),
 384                        .def  = DEFAULT_TIDV,
 385                        .arg  = { .r = { .min = MIN_TXDELAY,
 386                                         .max = MAX_TXDELAY }}
 387                };
 388
 389                adapter->tx_int_delay = TxIntDelay[bd];
 390                e1000_validate_option(&adapter->tx_int_delay, &opt);
 391        }
 392        { /* Transmit Absolute Interrupt Delay */
 393                struct e1000_option opt = {
 394                        .type = range_option,
 395                        .name = "Transmit Absolute Interrupt Delay",
 396                        .err  = "using default of " __MODULE_STRING(DEFAULT_TADV),
 397                        .def  = DEFAULT_TADV,
 398                        .arg  = { .r = { .min = MIN_TXABSDELAY,
 399                                         .max = MAX_TXABSDELAY }}
 400                };
 401
 402                adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
 403                e1000_validate_option(&adapter->tx_abs_int_delay, &opt);
 404        }
 405        { /* Receive Interrupt Delay */
 406                struct e1000_option opt = {
 407                        .type = range_option,
 408                        .name = "Receive Interrupt Delay",
 409                        .err  = "using default of " __MODULE_STRING(DEFAULT_RDTR),
 410                        .def  = DEFAULT_RDTR,
 411                        .arg  = { .r = { .min = MIN_RXDELAY,
 412                                         .max = MAX_RXDELAY }}
 413                };
 414
 415                adapter->rx_int_delay = RxIntDelay[bd];
 416                e1000_validate_option(&adapter->rx_int_delay, &opt);
 417        }
 418        { /* Receive Absolute Interrupt Delay */
 419                struct e1000_option opt = {
 420                        .type = range_option,
 421                        .name = "Receive Absolute Interrupt Delay",
 422                        .err  = "using default of " __MODULE_STRING(DEFAULT_RADV),
 423                        .def  = DEFAULT_RADV,
 424                        .arg  = { .r = { .min = MIN_RXABSDELAY,
 425                                         .max = MAX_RXABSDELAY }}
 426                };
 427
 428                adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
 429                e1000_validate_option(&adapter->rx_abs_int_delay, &opt);
 430        }
 431        { /* Interrupt Throttling Rate */
 432                struct e1000_option opt = {
 433                        .type = range_option,
 434                        .name = "Interrupt Throttling Rate (ints/sec)",
 435                        .err  = "using default of " __MODULE_STRING(DEFAULT_ITR),
 436                        .def  = DEFAULT_ITR,
 437                        .arg  = { .r = { .min = MIN_ITR,
 438                                         .max = MAX_ITR }}
 439                };
 440
 441                adapter->itr = InterruptThrottleRate[bd];
 442                switch(adapter->itr) {
 443                case -1:
 444                        adapter->itr = 1;
 445                        break;
 446                case 0:
 447                        printk(KERN_INFO "%s turned off\n", opt.name);
 448                        break;
 449                case 1:
 450                        printk(KERN_INFO "%s set to dynamic mode\n", opt.name);
 451                        break;
 452                default:
 453                        e1000_validate_option(&adapter->itr, &opt);
 454                        break;
 455                }
 456        }
 457
 458        switch(adapter->hw.media_type) {
 459        case e1000_media_type_fiber:
 460        case e1000_media_type_internal_serdes:
 461                e1000_check_fiber_options(adapter);
 462                break;
 463        case e1000_media_type_copper:
 464                e1000_check_copper_options(adapter);
 465                break;
 466        default:
 467                BUG();
 468        }
 469}
 470
 471/**
 472 * e1000_check_fiber_options - Range Checking for Link Options, Fiber Version
 473 * @adapter: board private structure
 474 *
 475 * Handles speed and duplex options on fiber adapters
 476 **/
 477
 478static void __devinit
 479e1000_check_fiber_options(struct e1000_adapter *adapter)
 480{
 481        int bd = adapter->bd_number;
 482        bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
 483
 484        if((Speed[bd] != OPTION_UNSET)) {
 485                printk(KERN_INFO "Speed not valid for fiber adapters, "
 486                       "parameter ignored\n");
 487        }
 488        if((Duplex[bd] != OPTION_UNSET)) {
 489                printk(KERN_INFO "Duplex not valid for fiber adapters, "
 490                       "parameter ignored\n");
 491        }
 492        if((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) {
 493                printk(KERN_INFO "AutoNeg other than Full/1000 is "
 494                       "not valid for fiber adapters, parameter ignored\n");
 495        }
 496}
 497
 498/**
 499 * e1000_check_copper_options - Range Checking for Link Options, Copper Version
 500 * @adapter: board private structure
 501 *
 502 * Handles speed and duplex options on copper adapters
 503 **/
 504
 505static void __devinit
 506e1000_check_copper_options(struct e1000_adapter *adapter)
 507{
 508        int speed, dplx;
 509        int bd = adapter->bd_number;
 510        bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
 511
 512        { /* Speed */
 513                struct e1000_opt_list speed_list[] = {{          0, "" },
 514                                                      {   SPEED_10, "" },
 515                                                      {  SPEED_100, "" },
 516                                                      { SPEED_1000, "" }};
 517
 518                struct e1000_option opt = {
 519                        .type = list_option,
 520                        .name = "Speed",
 521                        .err  = "parameter ignored",
 522                        .def  = 0,
 523                        .arg  = { .l = { .nr = ARRAY_SIZE(speed_list),
 524                                         .p = speed_list }}
 525                };
 526
 527                speed = Speed[bd];
 528                e1000_validate_option(&speed, &opt);
 529        }
 530        { /* Duplex */
 531                struct e1000_opt_list dplx_list[] = {{           0, "" },
 532                                                     { HALF_DUPLEX, "" },
 533                                                     { FULL_DUPLEX, "" }};
 534
 535                struct e1000_option opt = {
 536                        .type = list_option,
 537                        .name = "Duplex",
 538                        .err  = "parameter ignored",
 539                        .def  = 0,
 540                        .arg  = { .l = { .nr = ARRAY_SIZE(dplx_list),
 541                                         .p = dplx_list }}
 542                };
 543
 544                dplx = Duplex[bd];
 545                e1000_validate_option(&dplx, &opt);
 546        }
 547
 548        if(AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) {
 549                printk(KERN_INFO
 550                       "AutoNeg specified along with Speed or Duplex, "
 551                       "parameter ignored\n");
 552                adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
 553        } else { /* Autoneg */
 554                struct e1000_opt_list an_list[] =
 555                        #define AA "AutoNeg advertising "
 556                        {{ 0x01, AA "10/HD" },
 557                         { 0x02, AA "10/FD" },
 558                         { 0x03, AA "10/FD, 10/HD" },
 559                         { 0x04, AA "100/HD" },
 560                         { 0x05, AA "100/HD, 10/HD" },
 561                         { 0x06, AA "100/HD, 10/FD" },
 562                         { 0x07, AA "100/HD, 10/FD, 10/HD" },
 563                         { 0x08, AA "100/FD" },
 564                         { 0x09, AA "100/FD, 10/HD" },
 565                         { 0x0a, AA "100/FD, 10/FD" },
 566                         { 0x0b, AA "100/FD, 10/FD, 10/HD" },
 567                         { 0x0c, AA "100/FD, 100/HD" },
 568                         { 0x0d, AA "100/FD, 100/HD, 10/HD" },
 569                         { 0x0e, AA "100/FD, 100/HD, 10/FD" },
 570                         { 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" },
 571                         { 0x20, AA "1000/FD" },
 572                         { 0x21, AA "1000/FD, 10/HD" },
 573                         { 0x22, AA "1000/FD, 10/FD" },
 574                         { 0x23, AA "1000/FD, 10/FD, 10/HD" },
 575                         { 0x24, AA "1000/FD, 100/HD" },
 576                         { 0x25, AA "1000/FD, 100/HD, 10/HD" },
 577                         { 0x26, AA "1000/FD, 100/HD, 10/FD" },
 578                         { 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" },
 579                         { 0x28, AA "1000/FD, 100/FD" },
 580                         { 0x29, AA "1000/FD, 100/FD, 10/HD" },
 581                         { 0x2a, AA "1000/FD, 100/FD, 10/FD" },
 582                         { 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" },
 583                         { 0x2c, AA "1000/FD, 100/FD, 100/HD" },
 584                         { 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" },
 585                         { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" },
 586                         { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }};
 587
 588                struct e1000_option opt = {
 589                        .type = list_option,
 590                        .name = "AutoNeg",
 591                        .err  = "parameter ignored",
 592                        .def  = AUTONEG_ADV_DEFAULT,
 593                        .arg  = { .l = { .nr = ARRAY_SIZE(an_list),
 594                                         .p = an_list }}
 595                };
 596
 597                int an = AutoNeg[bd];
 598                e1000_validate_option(&an, &opt);
 599                adapter->hw.autoneg_advertised = an;
 600        }
 601
 602        switch (speed + dplx) {
 603        case 0:
 604                adapter->hw.autoneg = adapter->fc_autoneg = 1;
 605                if(Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET)
 606                        printk(KERN_INFO
 607                               "Speed and duplex autonegotiation enabled\n");
 608                break;
 609        case HALF_DUPLEX:
 610                printk(KERN_INFO "Half Duplex specified without Speed\n");
 611                printk(KERN_INFO "Using Autonegotiation at Half Duplex only\n");
 612                adapter->hw.autoneg = adapter->fc_autoneg = 1;
 613                adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
 614                                                 ADVERTISE_100_HALF;
 615                break;
 616        case FULL_DUPLEX:
 617                printk(KERN_INFO "Full Duplex specified without Speed\n");
 618                printk(KERN_INFO "Using Autonegotiation at Full Duplex only\n");
 619                adapter->hw.autoneg = adapter->fc_autoneg = 1;
 620                adapter->hw.autoneg_advertised = ADVERTISE_10_FULL |
 621                                                 ADVERTISE_100_FULL |
 622                                                 ADVERTISE_1000_FULL;
 623                break;
 624        case SPEED_10:
 625                printk(KERN_INFO "10 Mbps Speed specified without Duplex\n");
 626                printk(KERN_INFO "Using Autonegotiation at 10 Mbps only\n");
 627                adapter->hw.autoneg = adapter->fc_autoneg = 1;
 628                adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
 629                                                 ADVERTISE_10_FULL;
 630                break;
 631        case SPEED_10 + HALF_DUPLEX:
 632                printk(KERN_INFO "Forcing to 10 Mbps Half Duplex\n");
 633                adapter->hw.autoneg = adapter->fc_autoneg = 0;
 634                adapter->hw.forced_speed_duplex = e1000_10_half;
 635                adapter->hw.autoneg_advertised = 0;
 636                break;
 637        case SPEED_10 + FULL_DUPLEX:
 638                printk(KERN_INFO "Forcing to 10 Mbps Full Duplex\n");
 639                adapter->hw.autoneg = adapter->fc_autoneg = 0;
 640                adapter->hw.forced_speed_duplex = e1000_10_full;
 641                adapter->hw.autoneg_advertised = 0;
 642                break;
 643        case SPEED_100:
 644                printk(KERN_INFO "100 Mbps Speed specified without Duplex\n");
 645                printk(KERN_INFO "Using Autonegotiation at 100 Mbps only\n");
 646                adapter->hw.autoneg = adapter->fc_autoneg = 1;
 647                adapter->hw.autoneg_advertised = ADVERTISE_100_HALF |
 648                                                 ADVERTISE_100_FULL;
 649                break;
 650        case SPEED_100 + HALF_DUPLEX:
 651                printk(KERN_INFO "Forcing to 100 Mbps Half Duplex\n");
 652                adapter->hw.autoneg = adapter->fc_autoneg = 0;
 653                adapter->hw.forced_speed_duplex = e1000_100_half;
 654                adapter->hw.autoneg_advertised = 0;
 655                break;
 656        case SPEED_100 + FULL_DUPLEX:
 657                printk(KERN_INFO "Forcing to 100 Mbps Full Duplex\n");
 658                adapter->hw.autoneg = adapter->fc_autoneg = 0;
 659                adapter->hw.forced_speed_duplex = e1000_100_full;
 660                adapter->hw.autoneg_advertised = 0;
 661                break;
 662        case SPEED_1000:
 663                printk(KERN_INFO "1000 Mbps Speed specified without Duplex\n");
 664                printk(KERN_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        case SPEED_1000 + HALF_DUPLEX:
 670                printk(KERN_INFO "Half Duplex is not supported at 1000 Mbps\n");
 671                printk(KERN_INFO
 672                       "Using Autonegotiation at 1000 Mbps Full Duplex only\n");
 673                adapter->hw.autoneg = adapter->fc_autoneg = 1;
 674                adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
 675                break;
 676        case SPEED_1000 + FULL_DUPLEX:
 677                printk(KERN_INFO
 678                       "Using Autonegotiation at 1000 Mbps Full Duplex only\n");
 679                adapter->hw.autoneg = adapter->fc_autoneg = 1;
 680                adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
 681                break;
 682        default:
 683                BUG();
 684        }
 685
 686        /* Speed, AutoNeg and MDI/MDI-X must all play nice */
 687        if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) {
 688                printk(KERN_INFO "Speed, AutoNeg and MDI-X specifications are "
 689                       "incompatible. Setting MDI-X to a compatible value.\n");
 690        }
 691}
 692
 693
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.