Chinaunix首页 | 论坛 | 博客
  • 博客访问: 14035
  • 博文数量: 6
  • 博客积分: 110
  • 博客等级: 入伍新兵
  • 技术积分: 75
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-20 12:37
文章分类

全部博文(6)

文章存档

2014年(1)

2011年(5)

我的朋友

分类: LINUX

2011-03-20 13:04:58


1
  1. /**
  2.  * ixgbe_probe - Device Initialization Routine
  3.  * @pdev: PCI device information struct
  4.  * @ent: entry in ixgbe_pci_tbl
  5.  *
  6.  * Returns 0 on success, negative on failure
  7.  *
  8.  * ixgbe_probe initializes an adapter identified by a pci_dev structure.
  9.  * The OS initialization, configuring of the adapter private structure,
  10.  * and a hardware reset occur.
  11.  **/
  12. static int __devinit ixgbe_probe(struct pci_dev *pdev,
  13.                  const struct pci_device_id *ent)
  14. {
  15.     struct net_device *netdev;
  16.     struct ixgbe_adapter *adapter = NULL;
  17.     struct ixgbe_hw *hw = NULL;
  18.     static int cards_found;
  19.     int i, err, pci_using_dac;
  20. #ifdef HAVE_TX_MQ         // 多队列发送
  21.     unsigned int indices;
  22. #endif
  23.     u8 part_str[IXGBE_PBANUM_LENGTH];
  24.     enum ixgbe_mac_type mac_type = ixgbe_mac_unknown;
  25. #ifdef IXGBE_FCOE
  26.     u16 device_caps;
  27. #endif

  28.     err = pci_enable_device_mem(pdev);
  29.     if (err)
  30.         return err;

  31.     if (!dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64)) &&
  32.      !dma_set_coherent_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64))) {
  33.         pci_using_dac = 1;// dac? 
  34. // netdevice.h
  35. // #define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
  36.     } else {
  37.         err = dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(32));
  38.         if (err) {
  39.             err = dma_set_coherent_mask(pci_dev_to_dev(pdev),
  40.              DMA_BIT_MASK(32));
  41.             if (err) {
  42.                 dev_err(pci_dev_to_dev(pdev), "No usable DMA "
  43.                  "configuration, aborting\n");
  44.                 goto err_dma;
  45.             }
  46.         }
  47.         pci_using_dac = 0;
  48.     }

  49.     err = pci_request_selected_regions(pdev, pci_select_bars(pdev,
  50.                      IORESOURCE_MEM), ixgbe_driver_name);
  51.     if (err) {
  52.         dev_err(pci_dev_to_dev(pdev),
  53.             "pci_request_selected_regions failed 0x%x\n", err);
  54.         goto err_pci_reg;
  55.     }

  56.     /*
  57.      * The mac_type is needed before we have the adapter is set up
  58.      * so rather than maintain two devID -> MAC tables we dummy up
  59.      * an ixgbe_hw stuct and use ixgbe_set_mac_type.
  60.      */
  61.     hw = vmalloc(sizeof(struct ixgbe_hw));
  62.     if (!hw) {
  63.         printk(KERN_INFO "Unable to allocate memory for early mac "
  64.             "check\n");
  65.     } else {
  66.         hw->vendor_id = pdev->vendor;
  67.         hw->device_id = pdev->device;
  68.         ixgbe_set_mac_type(hw);
  69.         mac_type = hw->mac.type;
  70.         vfree(hw);
  71.     }

  72.     /*
  73.      * Workaround of Silicon errata on 82598. Disable LOs in the PCI switch
  74.      * port to which the 82598 is connected to prevent duplicate
  75.      * completions caused by LOs. We need the mac type so that we only
  76.      * do this on 82598 devices, ixgbe_set_mac_type does this for us if
  77.      * we set it's device ID.
  78.      */
  79.     if (mac_type == ixgbe_mac_82598EB)
  80.         pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S);

  81.     pci_enable_pcie_error_reporting(pdev);

  82.     pci_set_master(pdev);

  83. #ifdef HAVE_TX_MQ
  84.     indices = num_possible_cpus();// 支持HT,可能是num_online_cpu()的两倍,尽管bios没有开启HT
  85.     if (mac_type == ixgbe_mac_unknown)
  86.         indices = max_t(unsigned int, IXGBE_MAX_RSS_INDICES,
  87.                 IXGBE_MAX_FDIR_INDICES);
  88.     else if (mac_type == ixgbe_mac_82598EB)
  89.         indices = min_t(unsigned int, indices, IXGBE_MAX_RSS_INDICES);
  90.     else
  91.         indices = min_t(unsigned int, indices, IXGBE_MAX_FDIR_INDICES);
  92.     indices = max_t(unsigned int, indices, IXGBE_MAX_DCB_INDICES);
  93. #ifdef IXGBE_FCOE
  94.     indices += min_t(unsigned int, num_possible_cpus(),
  95.              IXGBE_MAX_FCOE_INDICES);
  96. #endif
  97.     netdev = alloc_etherdev_mq(sizeof(struct ixgbe_adapter), indices);
  98. #else
  99.     netdev = alloc_etherdev(sizeof(struct ixgbe_adapter));
  100. #endif
  101.     if (!netdev) {
  102.         err = -ENOMEM;
  103.         goto err_alloc_etherdev;
  104.     }

  105.     SET_NETDEV_DEV(netdev, &pdev->dev);

  106.     adapter = netdev_priv(netdev);
  107.     pci_set_drvdata(pdev, adapter);

  108.     adapter->netdev = netdev;
  109.     adapter->pdev = pdev;
  110.     hw = &adapter->hw;
  111.     hw->back = adapter;
  112.     adapter->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1;
  113. // msg_enable的作用?
  114. // ixgbe_ethtool_ops
  115. // .get_msglevel           = ixgbe_get_msglevel,
  116. // .set_msglevel           = ixgbe_set_msglevel,

  117. #ifdef HAVE_DEVICE_NUMA_NODE // NUMA暂时放过
  118.     DPRINTK(TX_ERR, INFO, "my (original) node was: %d\n",
  119.      dev_to_node(&pdev->dev));
  120. #endif /* HAVE_DEVICE_NUMA_NODE */

  121. #ifdef HAVE_PCI_ERS
  122.     /*
  123.      * call save state here in standalone driver because it relies on
  124.      * adapter struct to exist, and needs to call netdev_priv
  125.      */
  126.     pci_save_state(pdev);

  127. #endif
  128.     hw->hw_addr = ioremap(pci_resource_start(pdev, 0),
  129.              pci_resource_len(pdev, 0)); // 可以使用内存地址访问寄存器了
  130.     if (!hw->hw_addr) {
  131.         err = -EIO;
  132.         goto err_ioremap;
  133.     }

  134.     ixgbe_assign_netdev_ops(netdev);

  135.     strcpy(netdev->name, pci_name(pdev));

  136.     adapter->bd_number = cards_found;// 网卡芯片数量

  137.     /* setup the private structure */
  138.     err = ixgbe_sw_init(adapter); // 这个下次再细看
  139.     if (err)
  140.         goto err_sw_init;

  141.     /* Make it possible the adapter to be woken up via WOL */
  142.     // wol没有细看
  143.     if (adapter->hw.mac.type == ixgbe_mac_82599EB)
  144.         IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0);


  145.     /*
  146.      * If we have a fan, this is as early we know, warn if we
  147.      * have had a failure.
  148.      */ // 风扇相关的功能?
  149.     if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
  150.         u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP);
  151.         if (esdp & IXGBE_ESDP_SDP1)
  152.             DPRINTK(PROBE, CRIT,
  153.                 "Fan has stopped, replace the adapter\n");
  154.     }

  155.     /* reset_hw fills in the perm_addr as well */
  156.     hw->phy.reset_if_overtemp = true;
  157.     err = hw->mac.ops.reset_hw(hw); // mac的reset做了些什么
  158.     hw->phy.reset_if_overtemp = false; // 为什么又该为false
  159.     if (err == IXGBE_ERR_SFP_NOT_PRESENT &&
  160.      hw->mac.type == ixgbe_mac_82598EB) {
  161.         err = 0;
  162.     } else if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
  163.         DPRINTK(PROBE, ERR, "failed to load because an "
  164.          "unsupported SFP+ module type was detected.\n"
  165.          "Reload the driver after installing a "
  166.          "supported module.\n");
  167.         goto err_sw_init;
  168.     } else if (err) {
  169.         DPRINTK(PROBE, ERR, "HW Init failed: %d\n", err);
  170.         goto err_sw_init;
  171.     }

  172.     /*
  173.      * check_options must be called before setup_link to set up
  174.      * hw->fc completely
  175.      */
  176.     ixgbe_check_options(adapter);// 检查insmod时传入的参数

  177.     DPRINTK(TX_ERR, INFO, "my (preferred) node is: %d\n", adapter->node);

  178.     if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) // 虚拟化不看了
  179.         ixgbe_probe_vf(adapter);

  180. #ifdef MAX_SKB_FRAGS // 定义了,但具体是多少呢?
  181. #ifdef NETIF_F_HW_VLAN_TX
  182.     netdev->features = NETIF_F_SG |   // sg具体到代码是指什么?支持skb的frags、dma_maps?
  183.              NETIF_F_IP_CSUM |        // 网卡计算IP校验和?还是软件计算?
  184.              NETIF_F_HW_VLAN_TX |     // /* Transmit VLAN hw acceleration */
  185.              NETIF_F_HW_VLAN_RX |     // /* Receive VLAN hw acceleration */
  186.              NETIF_F_HW_VLAN_FILTER;  // /* Receive filtering on VLAN */

  187. #else
  188.     netdev->features = NETIF_F_SG | NETIF_F_IP_CSUM;

  189. #endif
  190. #ifdef NETIF_F_IPV6_CSUM
  191.     netdev->features |= NETIF_F_IPV6_CSUM;
  192. #endif
  193. #ifdef NETIF_F_TSO
  194.     netdev->features |= NETIF_F_TSO;
  195. #ifdef NETIF_F_TSO6
  196.     netdev->features |= NETIF_F_TSO6;
  197. #endif /* NETIF_F_TSO6 */
  198. #endif /* NETIF_F_TSO */
  199. #ifdef NETIF_F_GRO
  200.     netdev->features |= NETIF_F_GRO;
  201. #endif /* NETIF_F_GRO */

  202.     if (adapter->hw.mac.type == ixgbe_mac_82599EB)
  203.         netdev->features |= NETIF_F_SCTP_CSUM;

  204. #ifdef HAVE_NETDEV_VLAN_FEATURES
  205. #ifdef NETIF_F_TSO
  206.     netdev->vlan_features |= NETIF_F_TSO;
  207. #ifdef NETIF_F_TSO6
  208.     netdev->vlan_features |= NETIF_F_TSO6;
  209. #endif /* NETIF_F_TSO6 */
  210. #endif /* NETIF_F_TSO */
  211.     netdev->vlan_features |= NETIF_F_IP_CSUM;
  212. #ifdef NETIF_F_IPV6_CSUM
  213.     netdev->vlan_features |= NETIF_F_IPV6_CSUM;
  214. #endif
  215.     netdev->vlan_features |= NETIF_F_SG;

  216. #endif /* HAVE_NETDEV_VLAN_FEATURES */
  217. #ifdef NETIF_F_NTUPLE
  218.     /*
  219.      * If perfect filters were enabled in check_options(), enable them
  220.      * on the netdevice too.
  221.      */
  222.     if (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)
  223.         netdev->features |= NETIF_F_NTUPLE;
  224. #endif /* NETIF_F_NTUPLE */
  225.     if (adapter->flags & IXGBE_FLAG_VMDQ_ENABLED)
  226.         adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED;
  227.     if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
  228.         adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED;
  229.     if (adapter->flags & IXGBE_FLAG_VMDQ_ENABLED) {
  230.         adapter->flags &= ~(IXGBE_FLAG_FDIR_HASH_CAPABLE
  231.                  | IXGBE_FLAG_FDIR_PERFECT_CAPABLE);
  232. #ifdef NETIF_F_NTUPLE
  233.         /* clear n-tuple support in the netdev unconditionally */
  234.         netdev->features &= ~NETIF_F_NTUPLE;
  235. #endif /* NETIF_F_NTUPLE */
  236.     }

  237.     if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) {
  238.         netdev->features |= NETIF_F_LRO;
  239.         adapter->flags2 &= ~IXGBE_FLAG2_SWLRO_ENABLED;
  240.         if (adapter->rx_itr_setting == 0 ||
  241.          adapter->rx_itr_setting > IXGBE_MAX_RSC_INT_RATE) {
  242.             adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED;
  243.             DPRINTK(PROBE, INFO,
  244.              "InterruptThrottleRate set too high, disabling RSC\n");
  245.         } else {
  246.             adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
  247.         }
  248.     } else {
  249. #ifndef IXGBE_NO_LRO
  250.         netdev->features |= NETIF_F_LRO;
  251.         adapter->flags2 |= IXGBE_FLAG2_SWLRO_ENABLED;
  252. #endif
  253.         adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED;
  254.     }
  255. #ifdef CONFIG_DCB
  256.     netdev->dcbnl_ops = &dcbnl_ops;
  257. #endif

  258. #ifdef IXGBE_FCOE  // FCOE Fiber Connect over Ethernet
  259. #ifdef NETIF_F_FSO
  260.     if (adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) {
  261.         ixgbe_get_device_caps(hw, &device_caps);
  262.         if (device_caps & IXGBE_DEVICE_CAPS_FCOE_OFFLOADS) {
  263.             adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
  264.             adapter->flags &= ~IXGBE_FLAG_FCOE_CAPABLE;
  265.             DPRINTK(PROBE, INFO, "FCoE offload feature "
  266.                 "is not available. Disabling FCoE "
  267.                 "offload feature\n");
  268.         }
  269. #ifndef HAVE_NETDEV_OPS_FCOE_ENABLE
  270.         else {
  271.             adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
  272.             adapter->ring_feature[RING_F_FCOE].indices =
  273.              IXGBE_FCRETA_SIZE;
  274.             netdev->features |= NETIF_F_FSO;
  275.             netdev->features |= NETIF_F_FCOE_CRC;
  276.             netdev->features |= NETIF_F_FCOE_MTU;
  277.             netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
  278.             DPRINTK(PROBE, INFO, "Enabling FCoE offload "
  279.                 "feature\n");
  280.         }
  281. #endif /* HAVE_NETDEV_OPS_FCOE_ENABLE */
  282.     }
  283. #ifdef HAVE_NETDEV_VLAN_FEATURES
  284.     if (adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) {
  285.         netdev->vlan_features |= NETIF_F_FSO;
  286.         netdev->vlan_features |= NETIF_F_FCOE_CRC;
  287.         netdev->vlan_features |= NETIF_F_FCOE_MTU;
  288.     }
  289. #endif /* HAVE_NETDEV_VLAN_FEATURES */
  290. #endif /* NETIF_F_FSO */
  291. #endif /* IXGBE_FCOE */
  292.     if (pci_using_dac) {
  293.         netdev->features |= NETIF_F_HIGHDMA;
  294. #ifdef HAVE_NETDEV_VLAN_FEATURES
  295.         netdev->vlan_features |= NETIF_F_HIGHDMA;
  296. #endif /* HAVE_NETDEV_VLAN_FEATURES */
  297.     }

  298. #endif /* MAX_SKB_FRAGS */
  299.     /* make sure the EEPROM is good */
  300.     if (hw->eeprom.ops.validate_checksum &&
  301.      (hw->eeprom.ops.validate_checksum(hw, NULL) < 0)) {
  302.         DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
  303.         err = -EIO;
  304.         goto err_sw_init;
  305.     }

  306.     memcpy(netdev->dev_addr, hw->mac.perm_addr, netdev->addr_len);
  307. #ifdef ETHTOOL_GPERMADDR
  308.     memcpy(netdev->perm_addr, hw->mac.perm_addr, netdev->addr_len);

  309.     if (ixgbe_validate_mac_addr(netdev->perm_addr)) {
  310.         DPRINTK(PROBE, INFO, "invalid MAC address\n");
  311.         err = -EIO;
  312.         goto err_sw_init;
  313.     }
  314. #else
  315.     if (ixgbe_validate_mac_addr(netdev->dev_addr)) {
  316.         DPRINTK(PROBE, INFO, "invalid MAC address\n");
  317.         err = -EIO;
  318.         goto err_sw_init;
  319.     }
  320. #endif

  321.     /* power down the optics */
  322.     if (hw->phy.multispeed_fiber)
  323.         ixgbe_disable_tx_laser(hw);

  324.     setup_timer(&adapter->service_timer, &ixgbe_service_timer,
  325.      (unsigned long) adapter);
  326.     // 用于启动ixgbe_service_task

  1.     INIT_WORK(&adapter->service_task, ixgbe_service_task);
  2.     // 后台操作都放在ixgbe_service_task
  3.     clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state);

     // 在这里获取msix中断号
  1.     err = ixgbe_init_interrupt_scheme(adapter);
  2.     if (err)
  3.         goto err_sw_init;

  4.     /* WOL not supported for all but the following */
  5.     adapter->wol = 0;
  6.     switch (pdev->device) {
  7.     case IXGBE_DEV_ID_82599_SFP:
  8.         /* Only this subdevice supports WOL */
  9.         if (pdev->subsystem_device == IXGBE_SUBDEV_ID_82599_SFP)
  10.             adapter->wol = (IXGBE_WUFC_MAG | IXGBE_WUFC_EX |
  11.              IXGBE_WUFC_MC | IXGBE_WUFC_BC);
  12.         break;
  13.     case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
  14.         /* All except this subdevice support WOL */
  15.         if (pdev->subsystem_device != IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ)
  16.             adapter->wol = (IXGBE_WUFC_MAG | IXGBE_WUFC_EX |
  17.              IXGBE_WUFC_MC | IXGBE_WUFC_BC);
  18.         break;
  19.     case IXGBE_DEV_ID_82599_KX4:
  20.         adapter->wol = (IXGBE_WUFC_MAG | IXGBE_WUFC_EX |
  21.          IXGBE_WUFC_MC | IXGBE_WUFC_BC);
  22.         break;
  23.     }
  24.     device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);

  25.     /* save off EEPROM version number */
  26.     ixgbe_read_eeprom(hw, 0x29, &adapter->eeprom_version);

  27.     /* reset the hardware with the new settings */
  28.     err = hw->mac.ops.start_hw(hw);
  29.     if (err == IXGBE_ERR_EEPROM_VERSION) {
  30.         /* We are running on a pre-production device, log a warning */
  31.         DPRINTK(PROBE, INFO, "This device is a pre-production adapter/"
  32.          "LOM. Please be aware there may be issues associated "
  33.          "with your hardware. If you are experiencing problems "
  34.          "please contact your Intel or hardware representative "
  35.          "who provided you with this hardware.\n");
  36.     }
  37.     /* pick up the PCI bus settings for reporting later */
  38.     if (hw->mac.ops.get_bus_info)
  39.         hw->mac.ops.get_bus_info(hw);


  40.     strcpy(netdev->name, "eth%d");
  41.     err = register_netdev(netdev);    // 注册net_device
  42.     if (err)
  43.         goto err_register;

  44.     adapter->netdev_registered = true;
  45.     /* carrier off reporting is important to ethtool even BEFORE open */
  46.     netif_carrier_off(netdev);
  47.     /* keep stopping all the transmit queues for older kernels */
  48.     netif_tx_stop_all_queues(netdev);

  49.     if (adapter->flags & IXGBE_FLAG_DCA_CAPABLE) {
  50.         err = dca_add_requester(&pdev->dev);
  51.         switch (err) {
  52.         case 0:
  53.             adapter->flags |= IXGBE_FLAG_DCA_ENABLED;
  54.             ixgbe_setup_dca(adapter);
  55.             break;
  56.         /* -19 is returned from the kernel when no provider is found */
  57.         case -19:
  58.             DPRINTK(PROBE, INFO, "No DCA provider found. Please "
  59.              "start ioatdma for DCA functionality.\n");
  60.             break;
  61.         default:
  62.             DPRINTK(PROBE, INFO, "DCA registration failed: %d\n",
  63.              err);
  64.             break;
  65.         }
  66.     }

  67.     /* print all messages at the end so that we use our eth%d name */
  68.     /* print bus type/speed/width info */
  69.     DPRINTK(PROBE, INFO, "(PCI Express:%s:%s) ",
  70.         (hw->bus.speed == ixgbe_bus_speed_5000 ? "5.0Gb/s" :
  71.          hw->bus.speed == ixgbe_bus_speed_2500 ? "2.5Gb/s" :
  72.          "Unknown"),
  73.         (hw->bus.width == ixgbe_bus_width_pcie_x8 ? "Width x8" :
  74.          hw->bus.width == ixgbe_bus_width_pcie_x4 ? "Width x4" :
  75.          hw->bus.width == ixgbe_bus_width_pcie_x1 ? "Width x1" :
  76.          "Unknown"));

  77.     /* print the MAC address */
  78.     for (i = 0; i < 6; i++)
  79.         printk("%2.2x%c", netdev->dev_addr[i], i == 5 ? '\n' : ':');

  80.     /* Frist try to read PBA as a string */
  81.     err = ixgbe_read_pba_string(hw, part_str, IXGBE_PBANUM_LENGTH);
  82.     if (err)
  83.         strcpy(part_str, "Unknown");
  84.     if (ixgbe_is_sfp(hw) && hw->phy.sfp_type != ixgbe_sfp_type_not_present)
  85.         DPRINTK(PROBE, INFO, "MAC: %d, PHY: %d, SFP+: %d, PBA No: %s\n",
  86.          hw->mac.type, hw->phy.type, hw->phy.sfp_type,
  87.          part_str);
  88.     else
  89.         DPRINTK(PROBE, INFO, "MAC: %d, PHY: %d, PBA No: %s\n",
  90.          hw->mac.type, hw->phy.type, part_str);

  91.     if (((hw->bus.speed == ixgbe_bus_speed_2500) &&
  92.      (hw->bus.width <= ixgbe_bus_width_pcie_x4)) ||
  93.      (hw->bus.width <= ixgbe_bus_width_pcie_x2)) {
  94.         DPRINTK(PROBE, WARNING, "PCI-Express bandwidth available for "
  95.             "this card is not sufficient for optimal "
  96.             "performance.\n");
  97.         DPRINTK(PROBE, WARNING, "For optimal performance a x8 "
  98.             "PCI-Express slot is required.\n");
  99.     }

  100. #ifdef NETIF_F_GRO
  101.     if (adapter->netdev->features & NETIF_F_GRO)
  102.         DPRINTK(PROBE, INFO, "GRO is enabled\n");
  103.     else if (adapter->flags2 & IXGBE_FLAG2_SWLRO_ENABLED)
  104. #else
  105.     if (adapter->flags2 & IXGBE_FLAG2_SWLRO_ENABLED)
  106. #endif
  107.         DPRINTK(PROBE, INFO, "Internal LRO is enabled \n");
  108.     else
  109.         DPRINTK(PROBE, INFO, "LRO is disabled \n");

  110.     if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
  111.         DPRINTK(PROBE, INFO, "HW RSC is enabled \n");
  112. #ifdef CONFIG_PCI_IOV
  113.     if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
  114.         DPRINTK(PROBE, INFO, "IOV is enabled with %d VFs\n",
  115.             adapter->num_vfs);
  116.         for (i = 0; i < adapter->num_vfs; i++)
  117.             ixgbe_vf_configuration(pdev, (i | 0x10000000));
  118.     }
  119. #endif

  120. #if defined(HAVE_NETDEV_STORAGE_ADDRESS) && defined(NETDEV_HW_ADDR_T_SAN)
  121.     /* add san mac addr to netdev */
  122.     ixgbe_add_sanmac_netdev(netdev);

  123. #endif /* (HAVE_NETDEV_STORAGE_ADDRESS) && (NETDEV_HW_ADDR_T_SAN) */
  124.     DPRINTK(PROBE, INFO, "Intel(R) 10 Gigabit Network Connection\n");
  125.     cards_found++;
  126.     return 0;

  127. err_register:
  128.     ixgbe_clear_interrupt_scheme(adapter);
  129.     ixgbe_release_hw_control(adapter);
  130. err_sw_init:
  131.     if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
  132.         ixgbe_disable_sriov(adapter);
  133.     adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP;
  134.     iounmap(hw->hw_addr);
  135. err_ioremap:
  136.     free_netdev(netdev);
  137. err_alloc_etherdev:
  138.     pci_release_selected_regions(pdev,
  139.                  pci_select_bars(pdev, IORESOURCE_MEM));
  140. err_pci_reg:
  141. err_dma:

  142.     pci_disable_device(pdev);
  143.     return err;
  144. }
阅读(1581) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~