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