• Home
  • Raw
  • Download

Lines Matching refs:adapter

83 static void igbvf_receive_skb(struct igbvf_adapter *adapter,  in igbvf_receive_skb()  argument
91 if ((adapter->flags & IGBVF_FLAG_RX_LB_VLAN_BSWAP) && in igbvf_receive_skb()
96 if (test_bit(vid, adapter->active_vlans)) in igbvf_receive_skb()
100 napi_gro_receive(&adapter->rx_ring->napi, skb); in igbvf_receive_skb()
103 static inline void igbvf_rx_checksum_adv(struct igbvf_adapter *adapter, in igbvf_rx_checksum_adv() argument
110 (adapter->flags & IGBVF_FLAG_RX_CSUM_DISABLED)) in igbvf_rx_checksum_adv()
117 adapter->hw_csum_err++; in igbvf_rx_checksum_adv()
125 adapter->hw_csum_good++; in igbvf_rx_checksum_adv()
136 struct igbvf_adapter *adapter = rx_ring->adapter; in igbvf_alloc_rx_buffers() local
137 struct net_device *netdev = adapter->netdev; in igbvf_alloc_rx_buffers()
138 struct pci_dev *pdev = adapter->pdev; in igbvf_alloc_rx_buffers()
148 if (adapter->rx_ps_hdr_size) in igbvf_alloc_rx_buffers()
149 bufsz = adapter->rx_ps_hdr_size; in igbvf_alloc_rx_buffers()
151 bufsz = adapter->rx_buffer_len; in igbvf_alloc_rx_buffers()
156 if (adapter->rx_ps_hdr_size && !buffer_info->page_dma) { in igbvf_alloc_rx_buffers()
160 adapter->alloc_rx_buff_failed++; in igbvf_alloc_rx_buffers()
184 adapter->alloc_rx_buff_failed++; in igbvf_alloc_rx_buffers()
202 if (adapter->rx_ps_hdr_size) { in igbvf_alloc_rx_buffers()
231 writel(i, adapter->hw.hw_addr + rx_ring->tail); in igbvf_alloc_rx_buffers()
244 static bool igbvf_clean_rx_irq(struct igbvf_adapter *adapter, in igbvf_clean_rx_irq() argument
247 struct igbvf_ring *rx_ring = adapter->rx_ring; in igbvf_clean_rx_irq()
248 struct net_device *netdev = adapter->netdev; in igbvf_clean_rx_irq()
249 struct pci_dev *pdev = adapter->pdev; in igbvf_clean_rx_irq()
279 if (hlen > adapter->rx_ps_hdr_size) in igbvf_clean_rx_irq()
280 hlen = adapter->rx_ps_hdr_size; in igbvf_clean_rx_irq()
289 if (!adapter->rx_ps_hdr_size) { in igbvf_clean_rx_irq()
291 adapter->rx_buffer_len, in igbvf_clean_rx_irq()
300 adapter->rx_ps_hdr_size, in igbvf_clean_rx_irq()
317 if ((adapter->rx_buffer_len > (PAGE_SIZE / 2)) || in igbvf_clean_rx_irq()
351 igbvf_rx_checksum_adv(adapter, staterr, skb); in igbvf_clean_rx_irq()
355 igbvf_receive_skb(adapter, netdev, skb, staterr, in igbvf_clean_rx_irq()
380 adapter->total_rx_packets += total_packets; in igbvf_clean_rx_irq()
381 adapter->total_rx_bytes += total_bytes; in igbvf_clean_rx_irq()
387 static void igbvf_put_txbuf(struct igbvf_adapter *adapter, in igbvf_put_txbuf() argument
392 dma_unmap_page(&adapter->pdev->dev, in igbvf_put_txbuf()
397 dma_unmap_single(&adapter->pdev->dev, in igbvf_put_txbuf()
417 int igbvf_setup_tx_resources(struct igbvf_adapter *adapter, in igbvf_setup_tx_resources() argument
420 struct pci_dev *pdev = adapter->pdev; in igbvf_setup_tx_resources()
437 tx_ring->adapter = adapter; in igbvf_setup_tx_resources()
444 dev_err(&adapter->pdev->dev, in igbvf_setup_tx_resources()
456 int igbvf_setup_rx_resources(struct igbvf_adapter *adapter, in igbvf_setup_rx_resources() argument
459 struct pci_dev *pdev = adapter->pdev; in igbvf_setup_rx_resources()
481 rx_ring->adapter = adapter; in igbvf_setup_rx_resources()
488 dev_err(&adapter->pdev->dev, in igbvf_setup_rx_resources()
499 struct igbvf_adapter *adapter = tx_ring->adapter; in igbvf_clean_tx_ring() local
510 igbvf_put_txbuf(adapter, buffer_info); in igbvf_clean_tx_ring()
522 writel(0, adapter->hw.hw_addr + tx_ring->head); in igbvf_clean_tx_ring()
523 writel(0, adapter->hw.hw_addr + tx_ring->tail); in igbvf_clean_tx_ring()
534 struct pci_dev *pdev = tx_ring->adapter->pdev; in igbvf_free_tx_resources()
553 struct igbvf_adapter *adapter = rx_ring->adapter; in igbvf_clean_rx_ring() local
555 struct pci_dev *pdev = adapter->pdev; in igbvf_clean_rx_ring()
566 if (adapter->rx_ps_hdr_size) { in igbvf_clean_rx_ring()
568 adapter->rx_ps_hdr_size, in igbvf_clean_rx_ring()
572 adapter->rx_buffer_len, in igbvf_clean_rx_ring()
605 writel(0, adapter->hw.hw_addr + rx_ring->head); in igbvf_clean_rx_ring()
606 writel(0, adapter->hw.hw_addr + rx_ring->tail); in igbvf_clean_rx_ring()
618 struct pci_dev *pdev = rx_ring->adapter->pdev; in igbvf_free_rx_resources()
644 static enum latency_range igbvf_update_itr(struct igbvf_adapter *adapter, in igbvf_update_itr() argument
714 static void igbvf_set_itr(struct igbvf_adapter *adapter) in igbvf_set_itr() argument
718 adapter->tx_ring->itr_range = in igbvf_set_itr()
719 igbvf_update_itr(adapter, in igbvf_set_itr()
720 adapter->tx_ring->itr_val, in igbvf_set_itr()
721 adapter->total_tx_packets, in igbvf_set_itr()
722 adapter->total_tx_bytes); in igbvf_set_itr()
725 if (adapter->requested_itr == 3 && in igbvf_set_itr()
726 adapter->tx_ring->itr_range == lowest_latency) in igbvf_set_itr()
727 adapter->tx_ring->itr_range = low_latency; in igbvf_set_itr()
729 new_itr = igbvf_range_to_itr(adapter->tx_ring->itr_range); in igbvf_set_itr()
731 if (new_itr != adapter->tx_ring->itr_val) { in igbvf_set_itr()
732 u32 current_itr = adapter->tx_ring->itr_val; in igbvf_set_itr()
740 adapter->tx_ring->itr_val = new_itr; in igbvf_set_itr()
742 adapter->tx_ring->set_itr = 1; in igbvf_set_itr()
745 adapter->rx_ring->itr_range = in igbvf_set_itr()
746 igbvf_update_itr(adapter, adapter->rx_ring->itr_val, in igbvf_set_itr()
747 adapter->total_rx_packets, in igbvf_set_itr()
748 adapter->total_rx_bytes); in igbvf_set_itr()
749 if (adapter->requested_itr == 3 && in igbvf_set_itr()
750 adapter->rx_ring->itr_range == lowest_latency) in igbvf_set_itr()
751 adapter->rx_ring->itr_range = low_latency; in igbvf_set_itr()
753 new_itr = igbvf_range_to_itr(adapter->rx_ring->itr_range); in igbvf_set_itr()
755 if (new_itr != adapter->rx_ring->itr_val) { in igbvf_set_itr()
756 u32 current_itr = adapter->rx_ring->itr_val; in igbvf_set_itr()
761 adapter->rx_ring->itr_val = new_itr; in igbvf_set_itr()
763 adapter->rx_ring->set_itr = 1; in igbvf_set_itr()
775 struct igbvf_adapter *adapter = tx_ring->adapter; in igbvf_clean_tx_irq() local
776 struct net_device *netdev = adapter->netdev; in igbvf_clean_tx_irq()
820 igbvf_put_txbuf(adapter, buffer_info); in igbvf_clean_tx_irq()
842 !(test_bit(__IGBVF_DOWN, &adapter->state))) { in igbvf_clean_tx_irq()
844 ++adapter->restart_queue; in igbvf_clean_tx_irq()
856 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_msix_other() local
857 struct e1000_hw *hw = &adapter->hw; in igbvf_msix_other()
859 adapter->int_counter1++; in igbvf_msix_other()
862 if (!test_bit(__IGBVF_DOWN, &adapter->state)) in igbvf_msix_other()
863 mod_timer(&adapter->watchdog_timer, jiffies + 1); in igbvf_msix_other()
865 ew32(EIMS, adapter->eims_other); in igbvf_msix_other()
873 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_intr_msix_tx() local
874 struct e1000_hw *hw = &adapter->hw; in igbvf_intr_msix_tx()
875 struct igbvf_ring *tx_ring = adapter->tx_ring; in igbvf_intr_msix_tx()
879 adapter->hw.hw_addr + tx_ring->itr_register); in igbvf_intr_msix_tx()
880 adapter->tx_ring->set_itr = 0; in igbvf_intr_msix_tx()
883 adapter->total_tx_bytes = 0; in igbvf_intr_msix_tx()
884 adapter->total_tx_packets = 0; in igbvf_intr_msix_tx()
901 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_intr_msix_rx() local
903 adapter->int_counter0++; in igbvf_intr_msix_rx()
908 if (adapter->rx_ring->set_itr) { in igbvf_intr_msix_rx()
909 writel(adapter->rx_ring->itr_val, in igbvf_intr_msix_rx()
910 adapter->hw.hw_addr + adapter->rx_ring->itr_register); in igbvf_intr_msix_rx()
911 adapter->rx_ring->set_itr = 0; in igbvf_intr_msix_rx()
914 if (napi_schedule_prep(&adapter->rx_ring->napi)) { in igbvf_intr_msix_rx()
915 adapter->total_rx_bytes = 0; in igbvf_intr_msix_rx()
916 adapter->total_rx_packets = 0; in igbvf_intr_msix_rx()
917 __napi_schedule(&adapter->rx_ring->napi); in igbvf_intr_msix_rx()
925 static void igbvf_assign_vector(struct igbvf_adapter *adapter, int rx_queue, in igbvf_assign_vector() argument
928 struct e1000_hw *hw = &adapter->hw; in igbvf_assign_vector()
948 adapter->rx_ring[rx_queue].eims_value = BIT(msix_vector); in igbvf_assign_vector()
963 adapter->tx_ring[tx_queue].eims_value = BIT(msix_vector); in igbvf_assign_vector()
975 static void igbvf_configure_msix(struct igbvf_adapter *adapter) in igbvf_configure_msix() argument
978 struct e1000_hw *hw = &adapter->hw; in igbvf_configure_msix()
979 struct igbvf_ring *tx_ring = adapter->tx_ring; in igbvf_configure_msix()
980 struct igbvf_ring *rx_ring = adapter->rx_ring; in igbvf_configure_msix()
983 adapter->eims_enable_mask = 0; in igbvf_configure_msix()
985 igbvf_assign_vector(adapter, IGBVF_NO_QUEUE, 0, vector++); in igbvf_configure_msix()
986 adapter->eims_enable_mask |= tx_ring->eims_value; in igbvf_configure_msix()
988 igbvf_assign_vector(adapter, 0, IGBVF_NO_QUEUE, vector++); in igbvf_configure_msix()
989 adapter->eims_enable_mask |= rx_ring->eims_value; in igbvf_configure_msix()
998 adapter->eims_enable_mask = GENMASK(vector - 1, 0); in igbvf_configure_msix()
999 adapter->eims_other = BIT(vector - 1); in igbvf_configure_msix()
1003 static void igbvf_reset_interrupt_capability(struct igbvf_adapter *adapter) in igbvf_reset_interrupt_capability() argument
1005 if (adapter->msix_entries) { in igbvf_reset_interrupt_capability()
1006 pci_disable_msix(adapter->pdev); in igbvf_reset_interrupt_capability()
1007 kfree(adapter->msix_entries); in igbvf_reset_interrupt_capability()
1008 adapter->msix_entries = NULL; in igbvf_reset_interrupt_capability()
1019 static void igbvf_set_interrupt_capability(struct igbvf_adapter *adapter) in igbvf_set_interrupt_capability() argument
1025 adapter->msix_entries = kcalloc(3, sizeof(struct msix_entry), in igbvf_set_interrupt_capability()
1027 if (adapter->msix_entries) { in igbvf_set_interrupt_capability()
1029 adapter->msix_entries[i].entry = i; in igbvf_set_interrupt_capability()
1031 err = pci_enable_msix_range(adapter->pdev, in igbvf_set_interrupt_capability()
1032 adapter->msix_entries, 3, 3); in igbvf_set_interrupt_capability()
1037 dev_err(&adapter->pdev->dev, in igbvf_set_interrupt_capability()
1039 igbvf_reset_interrupt_capability(adapter); in igbvf_set_interrupt_capability()
1050 static int igbvf_request_msix(struct igbvf_adapter *adapter) in igbvf_request_msix() argument
1052 struct net_device *netdev = adapter->netdev; in igbvf_request_msix()
1056 sprintf(adapter->tx_ring->name, "%s-tx-0", netdev->name); in igbvf_request_msix()
1057 sprintf(adapter->rx_ring->name, "%s-rx-0", netdev->name); in igbvf_request_msix()
1059 memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ); in igbvf_request_msix()
1060 memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ); in igbvf_request_msix()
1063 err = request_irq(adapter->msix_entries[vector].vector, in igbvf_request_msix()
1064 igbvf_intr_msix_tx, 0, adapter->tx_ring->name, in igbvf_request_msix()
1069 adapter->tx_ring->itr_register = E1000_EITR(vector); in igbvf_request_msix()
1070 adapter->tx_ring->itr_val = adapter->current_itr; in igbvf_request_msix()
1073 err = request_irq(adapter->msix_entries[vector].vector, in igbvf_request_msix()
1074 igbvf_intr_msix_rx, 0, adapter->rx_ring->name, in igbvf_request_msix()
1079 adapter->rx_ring->itr_register = E1000_EITR(vector); in igbvf_request_msix()
1080 adapter->rx_ring->itr_val = adapter->current_itr; in igbvf_request_msix()
1083 err = request_irq(adapter->msix_entries[vector].vector, in igbvf_request_msix()
1088 igbvf_configure_msix(adapter); in igbvf_request_msix()
1098 static int igbvf_alloc_queues(struct igbvf_adapter *adapter) in igbvf_alloc_queues() argument
1100 struct net_device *netdev = adapter->netdev; in igbvf_alloc_queues()
1102 adapter->tx_ring = kzalloc(sizeof(struct igbvf_ring), GFP_KERNEL); in igbvf_alloc_queues()
1103 if (!adapter->tx_ring) in igbvf_alloc_queues()
1106 adapter->rx_ring = kzalloc(sizeof(struct igbvf_ring), GFP_KERNEL); in igbvf_alloc_queues()
1107 if (!adapter->rx_ring) { in igbvf_alloc_queues()
1108 kfree(adapter->tx_ring); in igbvf_alloc_queues()
1112 netif_napi_add(netdev, &adapter->rx_ring->napi, igbvf_poll, 64); in igbvf_alloc_queues()
1124 static int igbvf_request_irq(struct igbvf_adapter *adapter) in igbvf_request_irq() argument
1129 if (adapter->msix_entries) in igbvf_request_irq()
1130 err = igbvf_request_msix(adapter); in igbvf_request_irq()
1135 dev_err(&adapter->pdev->dev, in igbvf_request_irq()
1141 static void igbvf_free_irq(struct igbvf_adapter *adapter) in igbvf_free_irq() argument
1143 struct net_device *netdev = adapter->netdev; in igbvf_free_irq()
1146 if (adapter->msix_entries) { in igbvf_free_irq()
1148 free_irq(adapter->msix_entries[vector].vector, netdev); in igbvf_free_irq()
1156 static void igbvf_irq_disable(struct igbvf_adapter *adapter) in igbvf_irq_disable() argument
1158 struct e1000_hw *hw = &adapter->hw; in igbvf_irq_disable()
1162 if (adapter->msix_entries) in igbvf_irq_disable()
1170 static void igbvf_irq_enable(struct igbvf_adapter *adapter) in igbvf_irq_enable() argument
1172 struct e1000_hw *hw = &adapter->hw; in igbvf_irq_enable()
1174 ew32(EIAC, adapter->eims_enable_mask); in igbvf_irq_enable()
1175 ew32(EIAM, adapter->eims_enable_mask); in igbvf_irq_enable()
1176 ew32(EIMS, adapter->eims_enable_mask); in igbvf_irq_enable()
1187 struct igbvf_adapter *adapter = rx_ring->adapter; in igbvf_poll() local
1188 struct e1000_hw *hw = &adapter->hw; in igbvf_poll()
1191 igbvf_clean_rx_irq(adapter, &work_done, budget); in igbvf_poll()
1200 if (adapter->requested_itr & 3) in igbvf_poll()
1201 igbvf_set_itr(adapter); in igbvf_poll()
1203 if (!test_bit(__IGBVF_DOWN, &adapter->state)) in igbvf_poll()
1204 ew32(EIMS, adapter->rx_ring->eims_value); in igbvf_poll()
1216 static void igbvf_set_rlpml(struct igbvf_adapter *adapter) in igbvf_set_rlpml() argument
1219 struct e1000_hw *hw = &adapter->hw; in igbvf_set_rlpml()
1221 max_frame_size = adapter->max_frame_size + VLAN_TAG_SIZE; in igbvf_set_rlpml()
1233 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_vlan_rx_add_vid() local
1234 struct e1000_hw *hw = &adapter->hw; in igbvf_vlan_rx_add_vid()
1239 dev_err(&adapter->pdev->dev, "Failed to add vlan id %d\n", vid); in igbvf_vlan_rx_add_vid()
1246 set_bit(vid, adapter->active_vlans); in igbvf_vlan_rx_add_vid()
1253 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_vlan_rx_kill_vid() local
1254 struct e1000_hw *hw = &adapter->hw; in igbvf_vlan_rx_kill_vid()
1259 dev_err(&adapter->pdev->dev, in igbvf_vlan_rx_kill_vid()
1267 clear_bit(vid, adapter->active_vlans); in igbvf_vlan_rx_kill_vid()
1271 static void igbvf_restore_vlan(struct igbvf_adapter *adapter) in igbvf_restore_vlan() argument
1275 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) in igbvf_restore_vlan()
1276 igbvf_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid); in igbvf_restore_vlan()
1285 static void igbvf_configure_tx(struct igbvf_adapter *adapter) in igbvf_configure_tx() argument
1287 struct e1000_hw *hw = &adapter->hw; in igbvf_configure_tx()
1288 struct igbvf_ring *tx_ring = adapter->tx_ring; in igbvf_configure_tx()
1321 adapter->txd_cmd = E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_IFCS; in igbvf_configure_tx()
1324 adapter->txd_cmd |= E1000_ADVTXD_DCMD_RS; in igbvf_configure_tx()
1331 static void igbvf_setup_srrctl(struct igbvf_adapter *adapter) in igbvf_setup_srrctl() argument
1333 struct e1000_hw *hw = &adapter->hw; in igbvf_setup_srrctl()
1344 srrctl |= ALIGN(adapter->rx_buffer_len, 1024) >> in igbvf_setup_srrctl()
1347 if (adapter->rx_buffer_len < 2048) { in igbvf_setup_srrctl()
1348 adapter->rx_ps_hdr_size = 0; in igbvf_setup_srrctl()
1351 adapter->rx_ps_hdr_size = 128; in igbvf_setup_srrctl()
1352 srrctl |= adapter->rx_ps_hdr_size << in igbvf_setup_srrctl()
1366 static void igbvf_configure_rx(struct igbvf_adapter *adapter) in igbvf_configure_rx() argument
1368 struct e1000_hw *hw = &adapter->hw; in igbvf_configure_rx()
1369 struct igbvf_ring *rx_ring = adapter->rx_ring; in igbvf_configure_rx()
1397 igbvf_set_rlpml(adapter); in igbvf_configure_rx()
1414 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_set_multi() local
1415 struct e1000_hw *hw = &adapter->hw; in igbvf_set_multi()
1449 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_set_uni() local
1450 struct e1000_hw *hw = &adapter->hw; in igbvf_set_uni()
1492 static void igbvf_configure(struct igbvf_adapter *adapter) in igbvf_configure() argument
1494 igbvf_set_rx_mode(adapter->netdev); in igbvf_configure()
1496 igbvf_restore_vlan(adapter); in igbvf_configure()
1498 igbvf_configure_tx(adapter); in igbvf_configure()
1499 igbvf_setup_srrctl(adapter); in igbvf_configure()
1500 igbvf_configure_rx(adapter); in igbvf_configure()
1501 igbvf_alloc_rx_buffers(adapter->rx_ring, in igbvf_configure()
1502 igbvf_desc_unused(adapter->rx_ring)); in igbvf_configure()
1513 static void igbvf_reset(struct igbvf_adapter *adapter) in igbvf_reset() argument
1515 struct e1000_mac_info *mac = &adapter->hw.mac; in igbvf_reset()
1516 struct net_device *netdev = adapter->netdev; in igbvf_reset()
1517 struct e1000_hw *hw = &adapter->hw; in igbvf_reset()
1523 dev_err(&adapter->pdev->dev, "PF still resetting\n"); in igbvf_reset()
1529 if (is_valid_ether_addr(adapter->hw.mac.addr)) { in igbvf_reset()
1530 memcpy(netdev->dev_addr, adapter->hw.mac.addr, in igbvf_reset()
1532 memcpy(netdev->perm_addr, adapter->hw.mac.addr, in igbvf_reset()
1536 adapter->last_reset = jiffies; in igbvf_reset()
1539 int igbvf_up(struct igbvf_adapter *adapter) in igbvf_up() argument
1541 struct e1000_hw *hw = &adapter->hw; in igbvf_up()
1544 igbvf_configure(adapter); in igbvf_up()
1546 clear_bit(__IGBVF_DOWN, &adapter->state); in igbvf_up()
1548 napi_enable(&adapter->rx_ring->napi); in igbvf_up()
1549 if (adapter->msix_entries) in igbvf_up()
1550 igbvf_configure_msix(adapter); in igbvf_up()
1554 igbvf_irq_enable(adapter); in igbvf_up()
1558 mod_timer(&adapter->watchdog_timer, jiffies + 1); in igbvf_up()
1563 void igbvf_down(struct igbvf_adapter *adapter) in igbvf_down() argument
1565 struct net_device *netdev = adapter->netdev; in igbvf_down()
1566 struct e1000_hw *hw = &adapter->hw; in igbvf_down()
1572 set_bit(__IGBVF_DOWN, &adapter->state); in igbvf_down()
1589 napi_disable(&adapter->rx_ring->napi); in igbvf_down()
1591 igbvf_irq_disable(adapter); in igbvf_down()
1593 del_timer_sync(&adapter->watchdog_timer); in igbvf_down()
1596 igbvf_update_stats(adapter); in igbvf_down()
1598 adapter->link_speed = 0; in igbvf_down()
1599 adapter->link_duplex = 0; in igbvf_down()
1601 igbvf_reset(adapter); in igbvf_down()
1602 igbvf_clean_tx_ring(adapter->tx_ring); in igbvf_down()
1603 igbvf_clean_rx_ring(adapter->rx_ring); in igbvf_down()
1606 void igbvf_reinit_locked(struct igbvf_adapter *adapter) in igbvf_reinit_locked() argument
1609 while (test_and_set_bit(__IGBVF_RESETTING, &adapter->state)) in igbvf_reinit_locked()
1611 igbvf_down(adapter); in igbvf_reinit_locked()
1612 igbvf_up(adapter); in igbvf_reinit_locked()
1613 clear_bit(__IGBVF_RESETTING, &adapter->state); in igbvf_reinit_locked()
1624 static int igbvf_sw_init(struct igbvf_adapter *adapter) in igbvf_sw_init() argument
1626 struct net_device *netdev = adapter->netdev; in igbvf_sw_init()
1629 adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN; in igbvf_sw_init()
1630 adapter->rx_ps_hdr_size = 0; in igbvf_sw_init()
1631 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; in igbvf_sw_init()
1632 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; in igbvf_sw_init()
1634 adapter->tx_int_delay = 8; in igbvf_sw_init()
1635 adapter->tx_abs_int_delay = 32; in igbvf_sw_init()
1636 adapter->rx_int_delay = 0; in igbvf_sw_init()
1637 adapter->rx_abs_int_delay = 8; in igbvf_sw_init()
1638 adapter->requested_itr = 3; in igbvf_sw_init()
1639 adapter->current_itr = IGBVF_START_ITR; in igbvf_sw_init()
1642 adapter->ei->init_ops(&adapter->hw); in igbvf_sw_init()
1644 rc = adapter->hw.mac.ops.init_params(&adapter->hw); in igbvf_sw_init()
1648 rc = adapter->hw.mbx.ops.init_params(&adapter->hw); in igbvf_sw_init()
1652 igbvf_set_interrupt_capability(adapter); in igbvf_sw_init()
1654 if (igbvf_alloc_queues(adapter)) in igbvf_sw_init()
1657 spin_lock_init(&adapter->tx_queue_lock); in igbvf_sw_init()
1660 igbvf_irq_disable(adapter); in igbvf_sw_init()
1662 spin_lock_init(&adapter->stats_lock); in igbvf_sw_init()
1663 spin_lock_init(&adapter->hw.mbx_lock); in igbvf_sw_init()
1665 set_bit(__IGBVF_DOWN, &adapter->state); in igbvf_sw_init()
1669 static void igbvf_initialize_last_counter_stats(struct igbvf_adapter *adapter) in igbvf_initialize_last_counter_stats() argument
1671 struct e1000_hw *hw = &adapter->hw; in igbvf_initialize_last_counter_stats()
1673 adapter->stats.last_gprc = er32(VFGPRC); in igbvf_initialize_last_counter_stats()
1674 adapter->stats.last_gorc = er32(VFGORC); in igbvf_initialize_last_counter_stats()
1675 adapter->stats.last_gptc = er32(VFGPTC); in igbvf_initialize_last_counter_stats()
1676 adapter->stats.last_gotc = er32(VFGOTC); in igbvf_initialize_last_counter_stats()
1677 adapter->stats.last_mprc = er32(VFMPRC); in igbvf_initialize_last_counter_stats()
1678 adapter->stats.last_gotlbc = er32(VFGOTLBC); in igbvf_initialize_last_counter_stats()
1679 adapter->stats.last_gptlbc = er32(VFGPTLBC); in igbvf_initialize_last_counter_stats()
1680 adapter->stats.last_gorlbc = er32(VFGORLBC); in igbvf_initialize_last_counter_stats()
1681 adapter->stats.last_gprlbc = er32(VFGPRLBC); in igbvf_initialize_last_counter_stats()
1683 adapter->stats.base_gprc = er32(VFGPRC); in igbvf_initialize_last_counter_stats()
1684 adapter->stats.base_gorc = er32(VFGORC); in igbvf_initialize_last_counter_stats()
1685 adapter->stats.base_gptc = er32(VFGPTC); in igbvf_initialize_last_counter_stats()
1686 adapter->stats.base_gotc = er32(VFGOTC); in igbvf_initialize_last_counter_stats()
1687 adapter->stats.base_mprc = er32(VFMPRC); in igbvf_initialize_last_counter_stats()
1688 adapter->stats.base_gotlbc = er32(VFGOTLBC); in igbvf_initialize_last_counter_stats()
1689 adapter->stats.base_gptlbc = er32(VFGPTLBC); in igbvf_initialize_last_counter_stats()
1690 adapter->stats.base_gorlbc = er32(VFGORLBC); in igbvf_initialize_last_counter_stats()
1691 adapter->stats.base_gprlbc = er32(VFGPRLBC); in igbvf_initialize_last_counter_stats()
1708 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_open() local
1709 struct e1000_hw *hw = &adapter->hw; in igbvf_open()
1713 if (test_bit(__IGBVF_TESTING, &adapter->state)) in igbvf_open()
1717 err = igbvf_setup_tx_resources(adapter, adapter->tx_ring); in igbvf_open()
1722 err = igbvf_setup_rx_resources(adapter, adapter->rx_ring); in igbvf_open()
1731 igbvf_configure(adapter); in igbvf_open()
1733 err = igbvf_request_irq(adapter); in igbvf_open()
1738 clear_bit(__IGBVF_DOWN, &adapter->state); in igbvf_open()
1740 napi_enable(&adapter->rx_ring->napi); in igbvf_open()
1745 igbvf_irq_enable(adapter); in igbvf_open()
1749 mod_timer(&adapter->watchdog_timer, jiffies + 1); in igbvf_open()
1754 igbvf_free_rx_resources(adapter->rx_ring); in igbvf_open()
1756 igbvf_free_tx_resources(adapter->tx_ring); in igbvf_open()
1758 igbvf_reset(adapter); in igbvf_open()
1776 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_close() local
1778 WARN_ON(test_bit(__IGBVF_RESETTING, &adapter->state)); in igbvf_close()
1779 igbvf_down(adapter); in igbvf_close()
1781 igbvf_free_irq(adapter); in igbvf_close()
1783 igbvf_free_tx_resources(adapter->tx_ring); in igbvf_close()
1784 igbvf_free_rx_resources(adapter->rx_ring); in igbvf_close()
1798 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_set_mac() local
1799 struct e1000_hw *hw = &adapter->hw; in igbvf_set_mac()
1824 if (current_counter < adapter->stats.last_##name) \
1825 adapter->stats.name += 0x100000000LL; \
1826 adapter->stats.last_##name = current_counter; \
1827 adapter->stats.name &= 0xFFFFFFFF00000000LL; \
1828 adapter->stats.name |= current_counter; \
1835 void igbvf_update_stats(struct igbvf_adapter *adapter) in igbvf_update_stats() argument
1837 struct e1000_hw *hw = &adapter->hw; in igbvf_update_stats()
1838 struct pci_dev *pdev = adapter->pdev; in igbvf_update_stats()
1843 if (adapter->link_speed == 0) in igbvf_update_stats()
1846 if (test_bit(__IGBVF_RESETTING, &adapter->state)) in igbvf_update_stats()
1863 adapter->netdev->stats.multicast = adapter->stats.mprc; in igbvf_update_stats()
1866 static void igbvf_print_link_info(struct igbvf_adapter *adapter) in igbvf_print_link_info() argument
1868 dev_info(&adapter->pdev->dev, "Link is Up %d Mbps %s Duplex\n", in igbvf_print_link_info()
1869 adapter->link_speed, in igbvf_print_link_info()
1870 adapter->link_duplex == FULL_DUPLEX ? "Full" : "Half"); in igbvf_print_link_info()
1873 static bool igbvf_has_link(struct igbvf_adapter *adapter) in igbvf_has_link() argument
1875 struct e1000_hw *hw = &adapter->hw; in igbvf_has_link()
1880 if (test_bit(__IGBVF_DOWN, &adapter->state)) in igbvf_has_link()
1892 if (ret_val && time_after(jiffies, adapter->last_reset + (10 * HZ))) in igbvf_has_link()
1893 schedule_work(&adapter->reset_task); in igbvf_has_link()
1904 struct igbvf_adapter *adapter = from_timer(adapter, t, watchdog_timer); in igbvf_watchdog() local
1907 schedule_work(&adapter->watchdog_task); in igbvf_watchdog()
1912 struct igbvf_adapter *adapter = container_of(work, in igbvf_watchdog_task() local
1915 struct net_device *netdev = adapter->netdev; in igbvf_watchdog_task()
1916 struct e1000_mac_info *mac = &adapter->hw.mac; in igbvf_watchdog_task()
1917 struct igbvf_ring *tx_ring = adapter->tx_ring; in igbvf_watchdog_task()
1918 struct e1000_hw *hw = &adapter->hw; in igbvf_watchdog_task()
1922 link = igbvf_has_link(adapter); in igbvf_watchdog_task()
1926 mac->ops.get_link_up_info(&adapter->hw, in igbvf_watchdog_task()
1927 &adapter->link_speed, in igbvf_watchdog_task()
1928 &adapter->link_duplex); in igbvf_watchdog_task()
1929 igbvf_print_link_info(adapter); in igbvf_watchdog_task()
1936 adapter->link_speed = 0; in igbvf_watchdog_task()
1937 adapter->link_duplex = 0; in igbvf_watchdog_task()
1938 dev_info(&adapter->pdev->dev, "Link is Down\n"); in igbvf_watchdog_task()
1945 igbvf_update_stats(adapter); in igbvf_watchdog_task()
1955 adapter->tx_timeout_count++; in igbvf_watchdog_task()
1956 schedule_work(&adapter->reset_task); in igbvf_watchdog_task()
1961 ew32(EICS, adapter->rx_ring->eims_value); in igbvf_watchdog_task()
1964 if (!test_bit(__IGBVF_DOWN, &adapter->state)) in igbvf_watchdog_task()
1965 mod_timer(&adapter->watchdog_timer, in igbvf_watchdog_task()
2130 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_maybe_stop_tx() local
2133 if (igbvf_desc_unused(adapter->tx_ring) >= size) in igbvf_maybe_stop_tx()
2145 if (igbvf_desc_unused(adapter->tx_ring) < size) in igbvf_maybe_stop_tx()
2150 ++adapter->restart_queue; in igbvf_maybe_stop_tx()
2157 static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter, in igbvf_tx_map_adv() argument
2162 struct pci_dev *pdev = adapter->pdev; in igbvf_tx_map_adv()
2223 igbvf_put_txbuf(adapter, buffer_info); in igbvf_tx_map_adv()
2229 static inline void igbvf_tx_queue_adv(struct igbvf_adapter *adapter, in igbvf_tx_queue_adv() argument
2275 tx_desc->read.cmd_type_len |= cpu_to_le32(adapter->txd_cmd); in igbvf_tx_queue_adv()
2285 writel(i, adapter->hw.hw_addr + tx_ring->tail); in igbvf_tx_queue_adv()
2292 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_xmit_frame_ring_adv() local
2299 if (test_bit(__IGBVF_DOWN, &adapter->state)) { in igbvf_xmit_frame_ring_adv()
2346 count = igbvf_tx_map_adv(adapter, tx_ring, skb); in igbvf_xmit_frame_ring_adv()
2349 igbvf_tx_queue_adv(adapter, tx_ring, tx_flags, count, in igbvf_xmit_frame_ring_adv()
2365 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_xmit_frame() local
2368 if (test_bit(__IGBVF_DOWN, &adapter->state)) { in igbvf_xmit_frame()
2373 tx_ring = &adapter->tx_ring[0]; in igbvf_xmit_frame()
2385 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_tx_timeout() local
2388 adapter->tx_timeout_count++; in igbvf_tx_timeout()
2389 schedule_work(&adapter->reset_task); in igbvf_tx_timeout()
2394 struct igbvf_adapter *adapter; in igbvf_reset_task() local
2396 adapter = container_of(work, struct igbvf_adapter, reset_task); in igbvf_reset_task()
2398 igbvf_reinit_locked(adapter); in igbvf_reset_task()
2410 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_change_mtu() local
2413 while (test_and_set_bit(__IGBVF_RESETTING, &adapter->state)) in igbvf_change_mtu()
2416 adapter->max_frame_size = max_frame; in igbvf_change_mtu()
2418 igbvf_down(adapter); in igbvf_change_mtu()
2429 adapter->rx_buffer_len = 1024; in igbvf_change_mtu()
2431 adapter->rx_buffer_len = 2048; in igbvf_change_mtu()
2434 adapter->rx_buffer_len = 16384; in igbvf_change_mtu()
2436 adapter->rx_buffer_len = PAGE_SIZE / 2; in igbvf_change_mtu()
2442 adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN + in igbvf_change_mtu()
2450 igbvf_up(adapter); in igbvf_change_mtu()
2452 igbvf_reset(adapter); in igbvf_change_mtu()
2454 clear_bit(__IGBVF_RESETTING, &adapter->state); in igbvf_change_mtu()
2470 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_suspend() local
2475 WARN_ON(test_bit(__IGBVF_RESETTING, &adapter->state)); in igbvf_suspend()
2476 igbvf_down(adapter); in igbvf_suspend()
2477 igbvf_free_irq(adapter); in igbvf_suspend()
2487 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_resume() local
2493 err = igbvf_request_irq(adapter); in igbvf_resume()
2498 igbvf_reset(adapter); in igbvf_resume()
2501 igbvf_up(adapter); in igbvf_resume()
2520 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_netpoll() local
2522 disable_irq(adapter->pdev->irq); in igbvf_netpoll()
2524 igbvf_clean_tx_irq(adapter->tx_ring); in igbvf_netpoll()
2526 enable_irq(adapter->pdev->irq); in igbvf_netpoll()
2542 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_io_error_detected() local
2550 igbvf_down(adapter); in igbvf_io_error_detected()
2567 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_io_slot_reset() local
2576 igbvf_reset(adapter); in igbvf_io_slot_reset()
2592 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_io_resume() local
2595 if (igbvf_up(adapter)) { in igbvf_io_resume()
2605 static void igbvf_print_device_info(struct igbvf_adapter *adapter) in igbvf_print_device_info() argument
2607 struct e1000_hw *hw = &adapter->hw; in igbvf_print_device_info()
2608 struct net_device *netdev = adapter->netdev; in igbvf_print_device_info()
2609 struct pci_dev *pdev = adapter->pdev; in igbvf_print_device_info()
2621 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_set_features() local
2624 adapter->flags &= ~IGBVF_FLAG_RX_CSUM_DISABLED; in igbvf_set_features()
2626 adapter->flags |= IGBVF_FLAG_RX_CSUM_DISABLED; in igbvf_set_features()
2697 struct igbvf_adapter *adapter; in igbvf_probe() local
2735 adapter = netdev_priv(netdev); in igbvf_probe()
2736 hw = &adapter->hw; in igbvf_probe()
2737 adapter->netdev = netdev; in igbvf_probe()
2738 adapter->pdev = pdev; in igbvf_probe()
2739 adapter->ei = ei; in igbvf_probe()
2740 adapter->pba = ei->pba; in igbvf_probe()
2741 adapter->flags = ei->flags; in igbvf_probe()
2742 adapter->hw.back = adapter; in igbvf_probe()
2743 adapter->hw.mac.type = ei->mac; in igbvf_probe()
2744 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); in igbvf_probe()
2755 adapter->hw.hw_addr = ioremap(pci_resource_start(pdev, 0), in igbvf_probe()
2758 if (!adapter->hw.hw_addr) in igbvf_probe()
2762 err = ei->get_variants(adapter); in igbvf_probe()
2768 err = igbvf_sw_init(adapter); in igbvf_probe()
2779 adapter->bd_number = cards_found++; in igbvf_probe()
2828 else if (is_zero_ether_addr(adapter->hw.mac.addr)) in igbvf_probe()
2831 memcpy(netdev->dev_addr, adapter->hw.mac.addr, in igbvf_probe()
2840 memcpy(adapter->hw.mac.addr, netdev->dev_addr, in igbvf_probe()
2844 timer_setup(&adapter->watchdog_timer, igbvf_watchdog, 0); in igbvf_probe()
2846 INIT_WORK(&adapter->reset_task, igbvf_reset_task); in igbvf_probe()
2847 INIT_WORK(&adapter->watchdog_task, igbvf_watchdog_task); in igbvf_probe()
2850 adapter->rx_ring->count = 1024; in igbvf_probe()
2851 adapter->tx_ring->count = 1024; in igbvf_probe()
2854 igbvf_reset(adapter); in igbvf_probe()
2857 if (adapter->hw.mac.type == e1000_vfadapt_i350) in igbvf_probe()
2858 adapter->flags |= IGBVF_FLAG_RX_LB_VLAN_BSWAP; in igbvf_probe()
2869 igbvf_print_device_info(adapter); in igbvf_probe()
2871 igbvf_initialize_last_counter_stats(adapter); in igbvf_probe()
2876 netif_napi_del(&adapter->rx_ring->napi); in igbvf_probe()
2877 kfree(adapter->tx_ring); in igbvf_probe()
2878 kfree(adapter->rx_ring); in igbvf_probe()
2880 igbvf_reset_interrupt_capability(adapter); in igbvf_probe()
2882 iounmap(adapter->hw.hw_addr); in igbvf_probe()
2905 struct igbvf_adapter *adapter = netdev_priv(netdev); in igbvf_remove() local
2906 struct e1000_hw *hw = &adapter->hw; in igbvf_remove()
2911 set_bit(__IGBVF_DOWN, &adapter->state); in igbvf_remove()
2912 del_timer_sync(&adapter->watchdog_timer); in igbvf_remove()
2914 cancel_work_sync(&adapter->reset_task); in igbvf_remove()
2915 cancel_work_sync(&adapter->watchdog_task); in igbvf_remove()
2919 igbvf_reset_interrupt_capability(adapter); in igbvf_remove()
2924 netif_napi_del(&adapter->rx_ring->napi); in igbvf_remove()
2925 kfree(adapter->tx_ring); in igbvf_remove()
2926 kfree(adapter->rx_ring); in igbvf_remove()