Lines Matching full:adapter
98 static void ixgbevf_write_eitr(struct ixgbevf_adapter *adapter, int v_idx,
117 * @adapter: pointer to adapter struct
123 static void ixgbevf_set_ivar(struct ixgbevf_adapter *adapter, s8 direction, in ixgbevf_set_ivar() argument
127 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_set_ivar()
146 static void ixgbevf_unmap_and_free_tx_resource(struct ixgbevf_adapter *adapter, in ixgbevf_unmap_and_free_tx_resource() argument
152 dma_unmap_page(&adapter->pdev->dev, in ixgbevf_unmap_and_free_tx_resource()
157 dma_unmap_single(&adapter->pdev->dev, in ixgbevf_unmap_and_free_tx_resource()
188 * @adapter: board private structure
191 static bool ixgbevf_clean_tx_irq(struct ixgbevf_adapter *adapter, in ixgbevf_clean_tx_irq() argument
194 struct net_device *netdev = adapter->netdev; in ixgbevf_clean_tx_irq()
195 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_clean_tx_irq()
231 ixgbevf_unmap_and_free_tx_resource(adapter, in ixgbevf_clean_tx_irq()
257 !test_bit(__IXGBEVF_DOWN, &adapter->state)) { in ixgbevf_clean_tx_irq()
259 ++adapter->restart_queue; in ixgbevf_clean_tx_irq()
263 !test_bit(__IXGBEVF_DOWN, &adapter->state)) { in ixgbevf_clean_tx_irq()
265 ++adapter->restart_queue; in ixgbevf_clean_tx_irq()
272 (!test_bit(__IXGBEVF_DOWN, &adapter->state))) { in ixgbevf_clean_tx_irq()
297 struct ixgbevf_adapter *adapter = q_vector->adapter; in ixgbevf_receive_skb() local
301 if (is_vlan && test_bit(tag, adapter->active_vlans)) in ixgbevf_receive_skb()
304 if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) in ixgbevf_receive_skb()
312 * @adapter: address of board private structure
316 static inline void ixgbevf_rx_checksum(struct ixgbevf_adapter *adapter, in ixgbevf_rx_checksum() argument
322 if (!(adapter->flags & IXGBE_FLAG_RX_CSUM_ENABLED)) in ixgbevf_rx_checksum()
328 adapter->hw_csum_rx_error++; in ixgbevf_rx_checksum()
336 adapter->hw_csum_rx_error++; in ixgbevf_rx_checksum()
342 adapter->hw_csum_rx_good++; in ixgbevf_rx_checksum()
347 * @adapter: address of board private structure
349 static void ixgbevf_alloc_rx_buffers(struct ixgbevf_adapter *adapter, in ixgbevf_alloc_rx_buffers() argument
353 struct pci_dev *pdev = adapter->pdev; in ixgbevf_alloc_rx_buffers()
367 (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)) { in ixgbevf_alloc_rx_buffers()
371 adapter->alloc_rx_page_failed++; in ixgbevf_alloc_rx_buffers()
388 skb = netdev_alloc_skb(adapter->netdev, in ixgbevf_alloc_rx_buffers()
392 adapter->alloc_rx_buff_failed++; in ixgbevf_alloc_rx_buffers()
412 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { in ixgbevf_alloc_rx_buffers()
431 ixgbevf_release_rx_desc(&adapter->hw, rx_ring, i); in ixgbevf_alloc_rx_buffers()
435 static inline void ixgbevf_irq_enable_queues(struct ixgbevf_adapter *adapter, in ixgbevf_irq_enable_queues() argument
439 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_irq_enable_queues()
459 struct ixgbevf_adapter *adapter = q_vector->adapter; in ixgbevf_clean_rx_irq() local
460 struct pci_dev *pdev = adapter->pdev; in ixgbevf_clean_rx_irq()
483 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { in ixgbevf_clean_rx_irq()
488 adapter->rx_hdr_split++; in ixgbevf_clean_rx_irq()
539 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { in ixgbevf_clean_rx_irq()
548 adapter->non_eop_descs++; in ixgbevf_clean_rx_irq()
558 ixgbevf_rx_checksum(adapter, staterr, skb); in ixgbevf_clean_rx_irq()
573 skb->protocol = eth_type_trans(skb, adapter->netdev); in ixgbevf_clean_rx_irq()
582 ixgbevf_alloc_rx_buffers(adapter, rx_ring, in ixgbevf_clean_rx_irq()
598 ixgbevf_alloc_rx_buffers(adapter, rx_ring, cleaned_count); in ixgbevf_clean_rx_irq()
620 struct ixgbevf_adapter *adapter = q_vector->adapter; in ixgbevf_clean_rxonly() local
625 r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); in ixgbevf_clean_rxonly()
626 rx_ring = &(adapter->rx_ring[r_idx]); in ixgbevf_clean_rxonly()
633 if (adapter->itr_setting & 1) in ixgbevf_clean_rxonly()
635 if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) in ixgbevf_clean_rxonly()
636 ixgbevf_irq_enable_queues(adapter, rx_ring->v_idx); in ixgbevf_clean_rxonly()
654 struct ixgbevf_adapter *adapter = q_vector->adapter; in ixgbevf_clean_rxonly_many() local
664 r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); in ixgbevf_clean_rxonly_many()
666 rx_ring = &(adapter->rx_ring[r_idx]); in ixgbevf_clean_rxonly_many()
669 r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, in ixgbevf_clean_rxonly_many()
674 if (!netif_running(adapter->netdev)) in ixgbevf_clean_rxonly_many()
678 r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); in ixgbevf_clean_rxonly_many()
679 rx_ring = &(adapter->rx_ring[r_idx]); in ixgbevf_clean_rxonly_many()
684 if (adapter->itr_setting & 1) in ixgbevf_clean_rxonly_many()
686 if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) in ixgbevf_clean_rxonly_many()
687 ixgbevf_irq_enable_queues(adapter, enable_mask); in ixgbevf_clean_rxonly_many()
696 * @adapter: board private structure
701 static void ixgbevf_configure_msix(struct ixgbevf_adapter *adapter) in ixgbevf_configure_msix() argument
704 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_configure_msix()
708 q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; in ixgbevf_configure_msix()
715 q_vector = adapter->q_vector[v_idx]; in ixgbevf_configure_msix()
718 adapter->num_rx_queues); in ixgbevf_configure_msix()
721 j = adapter->rx_ring[r_idx].reg_idx; in ixgbevf_configure_msix()
722 ixgbevf_set_ivar(adapter, 0, j, v_idx); in ixgbevf_configure_msix()
724 adapter->num_rx_queues, in ixgbevf_configure_msix()
728 adapter->num_tx_queues); in ixgbevf_configure_msix()
731 j = adapter->tx_ring[r_idx].reg_idx; in ixgbevf_configure_msix()
732 ixgbevf_set_ivar(adapter, 1, j, v_idx); in ixgbevf_configure_msix()
734 adapter->num_tx_queues, in ixgbevf_configure_msix()
740 q_vector->eitr = (adapter->eitr_param >> 1); in ixgbevf_configure_msix()
743 q_vector->eitr = adapter->eitr_param; in ixgbevf_configure_msix()
745 ixgbevf_write_eitr(adapter, v_idx, q_vector->eitr); in ixgbevf_configure_msix()
748 ixgbevf_set_ivar(adapter, -1, 1, v_idx); in ixgbevf_configure_msix()
765 * @adapter: pointer to adapter
779 static u8 ixgbevf_update_itr(struct ixgbevf_adapter *adapter, in ixgbevf_update_itr() argument
802 if (bytes_perint > adapter->eitr_low) in ixgbevf_update_itr()
806 if (bytes_perint > adapter->eitr_high) in ixgbevf_update_itr()
808 else if (bytes_perint <= adapter->eitr_low) in ixgbevf_update_itr()
812 if (bytes_perint <= adapter->eitr_high) in ixgbevf_update_itr()
823 * @adapter: pointer to adapter struct
831 static void ixgbevf_write_eitr(struct ixgbevf_adapter *adapter, int v_idx, in ixgbevf_write_eitr() argument
834 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_write_eitr()
849 struct ixgbevf_adapter *adapter = q_vector->adapter; in ixgbevf_set_itr_msix() local
855 r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); in ixgbevf_set_itr_msix()
857 tx_ring = &(adapter->tx_ring[r_idx]); in ixgbevf_set_itr_msix()
858 ret_itr = ixgbevf_update_itr(adapter, q_vector->eitr, in ixgbevf_set_itr_msix()
866 r_idx = find_next_bit(q_vector->txr_idx, adapter->num_tx_queues, in ixgbevf_set_itr_msix()
870 r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); in ixgbevf_set_itr_msix()
872 rx_ring = &(adapter->rx_ring[r_idx]); in ixgbevf_set_itr_msix()
873 ret_itr = ixgbevf_update_itr(adapter, q_vector->eitr, in ixgbevf_set_itr_msix()
881 r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, in ixgbevf_set_itr_msix()
909 ixgbevf_write_eitr(adapter, v_idx, itr_reg); in ixgbevf_set_itr_msix()
916 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_msix_mbx() local
917 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_msix_mbx()
932 mod_timer(&adapter->watchdog_timer, in ixgbevf_msix_mbx()
959 struct ixgbevf_adapter *adapter = q_vector->adapter; in ixgbevf_msix_clean_tx() local
966 r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); in ixgbevf_msix_clean_tx()
968 tx_ring = &(adapter->tx_ring[r_idx]); in ixgbevf_msix_clean_tx()
971 ixgbevf_clean_tx_irq(adapter, tx_ring); in ixgbevf_msix_clean_tx()
972 r_idx = find_next_bit(q_vector->txr_idx, adapter->num_tx_queues, in ixgbevf_msix_clean_tx()
976 if (adapter->itr_setting & 1) in ixgbevf_msix_clean_tx()
990 struct ixgbevf_adapter *adapter = q_vector->adapter; in ixgbevf_msix_clean_rx() local
991 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_msix_clean_rx()
996 r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); in ixgbevf_msix_clean_rx()
998 rx_ring = &(adapter->rx_ring[r_idx]); in ixgbevf_msix_clean_rx()
1001 r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, in ixgbevf_msix_clean_rx()
1008 r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); in ixgbevf_msix_clean_rx()
1009 rx_ring = &(adapter->rx_ring[r_idx]); in ixgbevf_msix_clean_rx()
1048 * @adapter: board private structure to initialize
1056 static int ixgbevf_map_rings_to_vectors(struct ixgbevf_adapter *adapter) in ixgbevf_map_rings_to_vectors() argument
1061 int rxr_remaining = adapter->num_rx_queues; in ixgbevf_map_rings_to_vectors()
1062 int txr_remaining = adapter->num_tx_queues; in ixgbevf_map_rings_to_vectors()
1067 q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; in ixgbevf_map_rings_to_vectors()
1073 if (q_vectors == adapter->num_rx_queues + adapter->num_tx_queues) { in ixgbevf_map_rings_to_vectors()
1075 map_vector_to_rxq(adapter, v_start, rxr_idx); in ixgbevf_map_rings_to_vectors()
1078 map_vector_to_txq(adapter, v_start, txr_idx); in ixgbevf_map_rings_to_vectors()
1091 map_vector_to_rxq(adapter, i, rxr_idx); in ixgbevf_map_rings_to_vectors()
1099 map_vector_to_txq(adapter, i, txr_idx); in ixgbevf_map_rings_to_vectors()
1111 * @adapter: board private structure
1116 static int ixgbevf_request_msix_irqs(struct ixgbevf_adapter *adapter) in ixgbevf_request_msix_irqs() argument
1118 struct net_device *netdev = adapter->netdev; in ixgbevf_request_msix_irqs()
1124 q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; in ixgbevf_request_msix_irqs()
1132 handler = SET_HANDLER(adapter->q_vector[vector]); in ixgbevf_request_msix_irqs()
1135 sprintf(adapter->name[vector], "%s-%s-%d", in ixgbevf_request_msix_irqs()
1138 sprintf(adapter->name[vector], "%s-%s-%d", in ixgbevf_request_msix_irqs()
1141 sprintf(adapter->name[vector], "%s-%s-%d", in ixgbevf_request_msix_irqs()
1147 err = request_irq(adapter->msix_entries[vector].vector, in ixgbevf_request_msix_irqs()
1148 handler, 0, adapter->name[vector], in ixgbevf_request_msix_irqs()
1149 adapter->q_vector[vector]); in ixgbevf_request_msix_irqs()
1151 hw_dbg(&adapter->hw, in ixgbevf_request_msix_irqs()
1158 sprintf(adapter->name[vector], "%s:mbx", netdev->name); in ixgbevf_request_msix_irqs()
1159 err = request_irq(adapter->msix_entries[vector].vector, in ixgbevf_request_msix_irqs()
1160 &ixgbevf_msix_mbx, 0, adapter->name[vector], netdev); in ixgbevf_request_msix_irqs()
1162 hw_dbg(&adapter->hw, in ixgbevf_request_msix_irqs()
1171 free_irq(adapter->msix_entries[--vector].vector, in ixgbevf_request_msix_irqs()
1172 &(adapter->q_vector[i])); in ixgbevf_request_msix_irqs()
1173 pci_disable_msix(adapter->pdev); in ixgbevf_request_msix_irqs()
1174 kfree(adapter->msix_entries); in ixgbevf_request_msix_irqs()
1175 adapter->msix_entries = NULL; in ixgbevf_request_msix_irqs()
1179 static inline void ixgbevf_reset_q_vectors(struct ixgbevf_adapter *adapter) in ixgbevf_reset_q_vectors() argument
1181 int i, q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; in ixgbevf_reset_q_vectors()
1184 struct ixgbevf_q_vector *q_vector = adapter->q_vector[i]; in ixgbevf_reset_q_vectors()
1189 q_vector->eitr = adapter->eitr_param; in ixgbevf_reset_q_vectors()
1195 * @adapter: board private structure
1200 static int ixgbevf_request_irq(struct ixgbevf_adapter *adapter) in ixgbevf_request_irq() argument
1204 err = ixgbevf_request_msix_irqs(adapter); in ixgbevf_request_irq()
1207 hw_dbg(&adapter->hw, in ixgbevf_request_irq()
1213 static void ixgbevf_free_irq(struct ixgbevf_adapter *adapter) in ixgbevf_free_irq() argument
1215 struct net_device *netdev = adapter->netdev; in ixgbevf_free_irq()
1218 q_vectors = adapter->num_msix_vectors; in ixgbevf_free_irq()
1222 free_irq(adapter->msix_entries[i].vector, netdev); in ixgbevf_free_irq()
1226 free_irq(adapter->msix_entries[i].vector, in ixgbevf_free_irq()
1227 adapter->q_vector[i]); in ixgbevf_free_irq()
1230 ixgbevf_reset_q_vectors(adapter); in ixgbevf_free_irq()
1235 * @adapter: board private structure
1237 static inline void ixgbevf_irq_disable(struct ixgbevf_adapter *adapter) in ixgbevf_irq_disable() argument
1240 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_irq_disable()
1246 for (i = 0; i < adapter->num_msix_vectors; i++) in ixgbevf_irq_disable()
1247 synchronize_irq(adapter->msix_entries[i].vector); in ixgbevf_irq_disable()
1252 * @adapter: board private structure
1254 static inline void ixgbevf_irq_enable(struct ixgbevf_adapter *adapter, in ixgbevf_irq_enable() argument
1257 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_irq_enable()
1267 ixgbevf_irq_enable_queues(adapter, qmask); in ixgbevf_irq_enable()
1275 * @adapter: board private structure
1279 static void ixgbevf_configure_tx(struct ixgbevf_adapter *adapter) in ixgbevf_configure_tx() argument
1282 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_configure_tx()
1286 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbevf_configure_tx()
1287 struct ixgbevf_ring *ring = &adapter->tx_ring[i]; in ixgbevf_configure_tx()
1297 adapter->tx_ring[i].head = IXGBE_VFTDH(j); in ixgbevf_configure_tx()
1298 adapter->tx_ring[i].tail = IXGBE_VFTDT(j); in ixgbevf_configure_tx()
1310 static void ixgbevf_configure_srrctl(struct ixgbevf_adapter *adapter, int index) in ixgbevf_configure_srrctl() argument
1313 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_configure_srrctl()
1316 rx_ring = &adapter->rx_ring[index]; in ixgbevf_configure_srrctl()
1320 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { in ixgbevf_configure_srrctl()
1348 * @adapter: board private structure
1352 static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter) in ixgbevf_configure_rx() argument
1355 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_configure_rx()
1356 struct net_device *netdev = adapter->netdev; in ixgbevf_configure_rx()
1364 if (adapter->flags & IXGBE_FLAG_RX_PS_CAPABLE) in ixgbevf_configure_rx()
1365 adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; in ixgbevf_configure_rx()
1367 adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; in ixgbevf_configure_rx()
1369 if (adapter->flags & IXGBE_FLAG_RX_1BUF_CAPABLE) in ixgbevf_configure_rx()
1370 adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; in ixgbevf_configure_rx()
1372 adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; in ixgbevf_configure_rx()
1376 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { in ixgbevf_configure_rx()
1393 rdlen = adapter->rx_ring[0].count * sizeof(union ixgbe_adv_rx_desc); in ixgbevf_configure_rx()
1396 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbevf_configure_rx()
1397 rdba = adapter->rx_ring[i].dma; in ixgbevf_configure_rx()
1398 j = adapter->rx_ring[i].reg_idx; in ixgbevf_configure_rx()
1405 adapter->rx_ring[i].head = IXGBE_VFRDH(j); in ixgbevf_configure_rx()
1406 adapter->rx_ring[i].tail = IXGBE_VFRDT(j); in ixgbevf_configure_rx()
1407 adapter->rx_ring[i].rx_buf_len = rx_buf_len; in ixgbevf_configure_rx()
1409 ixgbevf_configure_srrctl(adapter, j); in ixgbevf_configure_rx()
1415 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_vlan_rx_add_vid() local
1416 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_vlan_rx_add_vid()
1421 set_bit(vid, adapter->active_vlans); in ixgbevf_vlan_rx_add_vid()
1428 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_vlan_rx_kill_vid() local
1429 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_vlan_rx_kill_vid()
1434 clear_bit(vid, adapter->active_vlans); in ixgbevf_vlan_rx_kill_vid()
1439 static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter) in ixgbevf_restore_vlan() argument
1443 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) in ixgbevf_restore_vlan()
1444 ixgbevf_vlan_rx_add_vid(adapter->netdev, vid); in ixgbevf_restore_vlan()
1449 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_write_uc_addr_list() local
1450 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_write_uc_addr_list()
1485 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_set_rx_mode() local
1486 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_set_rx_mode()
1495 static void ixgbevf_napi_enable_all(struct ixgbevf_adapter *adapter) in ixgbevf_napi_enable_all() argument
1499 int q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; in ixgbevf_napi_enable_all()
1503 q_vector = adapter->q_vector[q_idx]; in ixgbevf_napi_enable_all()
1514 static void ixgbevf_napi_disable_all(struct ixgbevf_adapter *adapter) in ixgbevf_napi_disable_all() argument
1518 int q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; in ixgbevf_napi_disable_all()
1521 q_vector = adapter->q_vector[q_idx]; in ixgbevf_napi_disable_all()
1528 static void ixgbevf_configure(struct ixgbevf_adapter *adapter) in ixgbevf_configure() argument
1530 struct net_device *netdev = adapter->netdev; in ixgbevf_configure()
1535 ixgbevf_restore_vlan(adapter); in ixgbevf_configure()
1537 ixgbevf_configure_tx(adapter); in ixgbevf_configure()
1538 ixgbevf_configure_rx(adapter); in ixgbevf_configure()
1539 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbevf_configure()
1540 struct ixgbevf_ring *ring = &adapter->rx_ring[i]; in ixgbevf_configure()
1541 ixgbevf_alloc_rx_buffers(adapter, ring, ring->count); in ixgbevf_configure()
1543 writel(ring->next_to_use, adapter->hw.hw_addr + ring->tail); in ixgbevf_configure()
1548 static inline void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter, in ixgbevf_rx_desc_queue_enable() argument
1551 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_rx_desc_queue_enable()
1552 int j = adapter->rx_ring[rxr].reg_idx; in ixgbevf_rx_desc_queue_enable()
1566 ixgbevf_release_rx_desc(&adapter->hw, &adapter->rx_ring[rxr], in ixgbevf_rx_desc_queue_enable()
1567 (adapter->rx_ring[rxr].count - 1)); in ixgbevf_rx_desc_queue_enable()
1570 static void ixgbevf_save_reset_stats(struct ixgbevf_adapter *adapter) in ixgbevf_save_reset_stats() argument
1573 if (adapter->stats.vfgprc || adapter->stats.vfgptc) { in ixgbevf_save_reset_stats()
1574 adapter->stats.saved_reset_vfgprc += adapter->stats.vfgprc - in ixgbevf_save_reset_stats()
1575 adapter->stats.base_vfgprc; in ixgbevf_save_reset_stats()
1576 adapter->stats.saved_reset_vfgptc += adapter->stats.vfgptc - in ixgbevf_save_reset_stats()
1577 adapter->stats.base_vfgptc; in ixgbevf_save_reset_stats()
1578 adapter->stats.saved_reset_vfgorc += adapter->stats.vfgorc - in ixgbevf_save_reset_stats()
1579 adapter->stats.base_vfgorc; in ixgbevf_save_reset_stats()
1580 adapter->stats.saved_reset_vfgotc += adapter->stats.vfgotc - in ixgbevf_save_reset_stats()
1581 adapter->stats.base_vfgotc; in ixgbevf_save_reset_stats()
1582 adapter->stats.saved_reset_vfmprc += adapter->stats.vfmprc - in ixgbevf_save_reset_stats()
1583 adapter->stats.base_vfmprc; in ixgbevf_save_reset_stats()
1587 static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter) in ixgbevf_init_last_counter_stats() argument
1589 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_init_last_counter_stats()
1591 adapter->stats.last_vfgprc = IXGBE_READ_REG(hw, IXGBE_VFGPRC); in ixgbevf_init_last_counter_stats()
1592 adapter->stats.last_vfgorc = IXGBE_READ_REG(hw, IXGBE_VFGORC_LSB); in ixgbevf_init_last_counter_stats()
1593 adapter->stats.last_vfgorc |= in ixgbevf_init_last_counter_stats()
1595 adapter->stats.last_vfgptc = IXGBE_READ_REG(hw, IXGBE_VFGPTC); in ixgbevf_init_last_counter_stats()
1596 adapter->stats.last_vfgotc = IXGBE_READ_REG(hw, IXGBE_VFGOTC_LSB); in ixgbevf_init_last_counter_stats()
1597 adapter->stats.last_vfgotc |= in ixgbevf_init_last_counter_stats()
1599 adapter->stats.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC); in ixgbevf_init_last_counter_stats()
1601 adapter->stats.base_vfgprc = adapter->stats.last_vfgprc; in ixgbevf_init_last_counter_stats()
1602 adapter->stats.base_vfgorc = adapter->stats.last_vfgorc; in ixgbevf_init_last_counter_stats()
1603 adapter->stats.base_vfgptc = adapter->stats.last_vfgptc; in ixgbevf_init_last_counter_stats()
1604 adapter->stats.base_vfgotc = adapter->stats.last_vfgotc; in ixgbevf_init_last_counter_stats()
1605 adapter->stats.base_vfmprc = adapter->stats.last_vfmprc; in ixgbevf_init_last_counter_stats()
1608 static int ixgbevf_up_complete(struct ixgbevf_adapter *adapter) in ixgbevf_up_complete() argument
1610 struct net_device *netdev = adapter->netdev; in ixgbevf_up_complete()
1611 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_up_complete()
1613 int num_rx_rings = adapter->num_rx_queues; in ixgbevf_up_complete()
1616 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbevf_up_complete()
1617 j = adapter->tx_ring[i].reg_idx; in ixgbevf_up_complete()
1624 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbevf_up_complete()
1625 j = adapter->tx_ring[i].reg_idx; in ixgbevf_up_complete()
1632 j = adapter->rx_ring[i].reg_idx; in ixgbevf_up_complete()
1641 ixgbevf_rx_desc_queue_enable(adapter, i); in ixgbevf_up_complete()
1644 ixgbevf_configure_msix(adapter); in ixgbevf_up_complete()
1653 clear_bit(__IXGBEVF_DOWN, &adapter->state); in ixgbevf_up_complete()
1654 ixgbevf_napi_enable_all(adapter); in ixgbevf_up_complete()
1659 ixgbevf_save_reset_stats(adapter); in ixgbevf_up_complete()
1660 ixgbevf_init_last_counter_stats(adapter); in ixgbevf_up_complete()
1664 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; in ixgbevf_up_complete()
1665 adapter->link_check_timeout = jiffies; in ixgbevf_up_complete()
1666 mod_timer(&adapter->watchdog_timer, jiffies); in ixgbevf_up_complete()
1670 int ixgbevf_up(struct ixgbevf_adapter *adapter) in ixgbevf_up() argument
1673 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_up()
1675 ixgbevf_configure(adapter); in ixgbevf_up()
1677 err = ixgbevf_up_complete(adapter); in ixgbevf_up()
1682 ixgbevf_irq_enable(adapter, true, true); in ixgbevf_up()
1689 * @adapter: board private structure
1692 static void ixgbevf_clean_rx_ring(struct ixgbevf_adapter *adapter, in ixgbevf_clean_rx_ring() argument
1695 struct pci_dev *pdev = adapter->pdev; in ixgbevf_clean_rx_ring()
1742 writel(0, adapter->hw.hw_addr + rx_ring->head); in ixgbevf_clean_rx_ring()
1744 writel(0, adapter->hw.hw_addr + rx_ring->tail); in ixgbevf_clean_rx_ring()
1749 * @adapter: board private structure
1752 static void ixgbevf_clean_tx_ring(struct ixgbevf_adapter *adapter, in ixgbevf_clean_tx_ring() argument
1766 ixgbevf_unmap_and_free_tx_resource(adapter, tx_buffer_info); in ixgbevf_clean_tx_ring()
1778 writel(0, adapter->hw.hw_addr + tx_ring->head); in ixgbevf_clean_tx_ring()
1780 writel(0, adapter->hw.hw_addr + tx_ring->tail); in ixgbevf_clean_tx_ring()
1785 * @adapter: board private structure
1787 static void ixgbevf_clean_all_rx_rings(struct ixgbevf_adapter *adapter) in ixgbevf_clean_all_rx_rings() argument
1791 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbevf_clean_all_rx_rings()
1792 ixgbevf_clean_rx_ring(adapter, &adapter->rx_ring[i]); in ixgbevf_clean_all_rx_rings()
1797 * @adapter: board private structure
1799 static void ixgbevf_clean_all_tx_rings(struct ixgbevf_adapter *adapter) in ixgbevf_clean_all_tx_rings() argument
1803 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbevf_clean_all_tx_rings()
1804 ixgbevf_clean_tx_ring(adapter, &adapter->tx_ring[i]); in ixgbevf_clean_all_tx_rings()
1807 void ixgbevf_down(struct ixgbevf_adapter *adapter) in ixgbevf_down() argument
1809 struct net_device *netdev = adapter->netdev; in ixgbevf_down()
1810 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_down()
1815 set_bit(__IXGBEVF_DOWN, &adapter->state); in ixgbevf_down()
1824 ixgbevf_irq_disable(adapter); in ixgbevf_down()
1826 ixgbevf_napi_disable_all(adapter); in ixgbevf_down()
1828 del_timer_sync(&adapter->watchdog_timer); in ixgbevf_down()
1832 while (adapter->flags & IXGBE_FLAG_IN_WATCHDOG_TASK) in ixgbevf_down()
1836 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbevf_down()
1837 j = adapter->tx_ring[i].reg_idx; in ixgbevf_down()
1845 if (!pci_channel_offline(adapter->pdev)) in ixgbevf_down()
1846 ixgbevf_reset(adapter); in ixgbevf_down()
1848 ixgbevf_clean_all_tx_rings(adapter); in ixgbevf_down()
1849 ixgbevf_clean_all_rx_rings(adapter); in ixgbevf_down()
1852 void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter) in ixgbevf_reinit_locked() argument
1854 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_reinit_locked()
1858 while (test_and_set_bit(__IXGBEVF_RESETTING, &adapter->state)) in ixgbevf_reinit_locked()
1869 ixgbevf_down(adapter); in ixgbevf_reinit_locked()
1870 ixgbevf_up(adapter); in ixgbevf_reinit_locked()
1873 clear_bit(__IXGBEVF_RESETTING, &adapter->state); in ixgbevf_reinit_locked()
1876 void ixgbevf_reset(struct ixgbevf_adapter *adapter) in ixgbevf_reset() argument
1878 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_reset()
1879 struct net_device *netdev = adapter->netdev; in ixgbevf_reset()
1886 if (is_valid_ether_addr(adapter->hw.mac.addr)) { in ixgbevf_reset()
1887 memcpy(netdev->dev_addr, adapter->hw.mac.addr, in ixgbevf_reset()
1889 memcpy(netdev->perm_addr, adapter->hw.mac.addr, in ixgbevf_reset()
1894 static void ixgbevf_acquire_msix_vectors(struct ixgbevf_adapter *adapter, in ixgbevf_acquire_msix_vectors() argument
1912 err = pci_enable_msix(adapter->pdev, adapter->msix_entries, in ixgbevf_acquire_msix_vectors()
1927 hw_dbg(&adapter->hw, in ixgbevf_acquire_msix_vectors()
1929 kfree(adapter->msix_entries); in ixgbevf_acquire_msix_vectors()
1930 adapter->msix_entries = NULL; in ixgbevf_acquire_msix_vectors()
1937 adapter->num_msix_vectors = vectors; in ixgbevf_acquire_msix_vectors()
1943 * @adapter: board private structure to initialize
1952 static void ixgbevf_set_num_queues(struct ixgbevf_adapter *adapter) in ixgbevf_set_num_queues() argument
1955 adapter->num_rx_queues = 1; in ixgbevf_set_num_queues()
1956 adapter->num_tx_queues = 1; in ixgbevf_set_num_queues()
1957 adapter->num_rx_pools = adapter->num_rx_queues; in ixgbevf_set_num_queues()
1958 adapter->num_rx_queues_per_pool = 1; in ixgbevf_set_num_queues()
1963 * @adapter: board private structure to initialize
1969 static int ixgbevf_alloc_queues(struct ixgbevf_adapter *adapter) in ixgbevf_alloc_queues() argument
1973 adapter->tx_ring = kcalloc(adapter->num_tx_queues, in ixgbevf_alloc_queues()
1975 if (!adapter->tx_ring) in ixgbevf_alloc_queues()
1978 adapter->rx_ring = kcalloc(adapter->num_rx_queues, in ixgbevf_alloc_queues()
1980 if (!adapter->rx_ring) in ixgbevf_alloc_queues()
1983 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbevf_alloc_queues()
1984 adapter->tx_ring[i].count = adapter->tx_ring_count; in ixgbevf_alloc_queues()
1985 adapter->tx_ring[i].queue_index = i; in ixgbevf_alloc_queues()
1986 adapter->tx_ring[i].reg_idx = i; in ixgbevf_alloc_queues()
1989 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbevf_alloc_queues()
1990 adapter->rx_ring[i].count = adapter->rx_ring_count; in ixgbevf_alloc_queues()
1991 adapter->rx_ring[i].queue_index = i; in ixgbevf_alloc_queues()
1992 adapter->rx_ring[i].reg_idx = i; in ixgbevf_alloc_queues()
1998 kfree(adapter->tx_ring); in ixgbevf_alloc_queues()
2005 * @adapter: board private structure to initialize
2010 static int ixgbevf_set_interrupt_capability(struct ixgbevf_adapter *adapter) in ixgbevf_set_interrupt_capability() argument
2021 v_budget = min(adapter->num_rx_queues + adapter->num_tx_queues, in ixgbevf_set_interrupt_capability()
2025 * mean we disable MSI-X capabilities of the adapter. */ in ixgbevf_set_interrupt_capability()
2026 adapter->msix_entries = kcalloc(v_budget, in ixgbevf_set_interrupt_capability()
2028 if (!adapter->msix_entries) { in ixgbevf_set_interrupt_capability()
2034 adapter->msix_entries[vector].entry = vector; in ixgbevf_set_interrupt_capability()
2036 ixgbevf_acquire_msix_vectors(adapter, v_budget); in ixgbevf_set_interrupt_capability()
2044 * @adapter: board private structure to initialize
2049 static int ixgbevf_alloc_q_vectors(struct ixgbevf_adapter *adapter) in ixgbevf_alloc_q_vectors() argument
2056 num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; in ixgbevf_alloc_q_vectors()
2057 napi_vectors = adapter->num_rx_queues; in ixgbevf_alloc_q_vectors()
2064 q_vector->adapter = adapter; in ixgbevf_alloc_q_vectors()
2066 q_vector->eitr = adapter->eitr_param; in ixgbevf_alloc_q_vectors()
2068 netif_napi_add(adapter->netdev, &q_vector->napi, in ixgbevf_alloc_q_vectors()
2070 adapter->q_vector[q_idx] = q_vector; in ixgbevf_alloc_q_vectors()
2078 q_vector = adapter->q_vector[q_idx]; in ixgbevf_alloc_q_vectors()
2081 adapter->q_vector[q_idx] = NULL; in ixgbevf_alloc_q_vectors()
2088 * @adapter: board private structure to initialize
2094 static void ixgbevf_free_q_vectors(struct ixgbevf_adapter *adapter) in ixgbevf_free_q_vectors() argument
2099 num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; in ixgbevf_free_q_vectors()
2100 napi_vectors = adapter->num_rx_queues; in ixgbevf_free_q_vectors()
2103 struct ixgbevf_q_vector *q_vector = adapter->q_vector[q_idx]; in ixgbevf_free_q_vectors()
2105 adapter->q_vector[q_idx] = NULL; in ixgbevf_free_q_vectors()
2114 * @adapter: board private structure
2117 static void ixgbevf_reset_interrupt_capability(struct ixgbevf_adapter *adapter) in ixgbevf_reset_interrupt_capability() argument
2119 pci_disable_msix(adapter->pdev); in ixgbevf_reset_interrupt_capability()
2120 kfree(adapter->msix_entries); in ixgbevf_reset_interrupt_capability()
2121 adapter->msix_entries = NULL; in ixgbevf_reset_interrupt_capability()
2126 * @adapter: board private structure to initialize
2129 static int ixgbevf_init_interrupt_scheme(struct ixgbevf_adapter *adapter) in ixgbevf_init_interrupt_scheme() argument
2134 ixgbevf_set_num_queues(adapter); in ixgbevf_init_interrupt_scheme()
2136 err = ixgbevf_set_interrupt_capability(adapter); in ixgbevf_init_interrupt_scheme()
2138 hw_dbg(&adapter->hw, in ixgbevf_init_interrupt_scheme()
2143 err = ixgbevf_alloc_q_vectors(adapter); in ixgbevf_init_interrupt_scheme()
2145 hw_dbg(&adapter->hw, "Unable to allocate memory for queue " in ixgbevf_init_interrupt_scheme()
2150 err = ixgbevf_alloc_queues(adapter); in ixgbevf_init_interrupt_scheme()
2156 hw_dbg(&adapter->hw, "Multiqueue %s: Rx Queue count = %u, " in ixgbevf_init_interrupt_scheme()
2158 (adapter->num_rx_queues > 1) ? "Enabled" : in ixgbevf_init_interrupt_scheme()
2159 "Disabled", adapter->num_rx_queues, adapter->num_tx_queues); in ixgbevf_init_interrupt_scheme()
2161 set_bit(__IXGBEVF_DOWN, &adapter->state); in ixgbevf_init_interrupt_scheme()
2165 ixgbevf_free_q_vectors(adapter); in ixgbevf_init_interrupt_scheme()
2167 ixgbevf_reset_interrupt_capability(adapter); in ixgbevf_init_interrupt_scheme()
2175 * @adapter: board private structure to initialize
2177 * ixgbevf_sw_init initializes the Adapter private data structure.
2181 static int __devinit ixgbevf_sw_init(struct ixgbevf_adapter *adapter) in ixgbevf_sw_init() argument
2183 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_sw_init()
2184 struct pci_dev *pdev = adapter->pdev; in ixgbevf_sw_init()
2202 dev_hw_addr_random(adapter->netdev, hw->mac.addr); in ixgbevf_sw_init()
2212 adapter->eitr_param = 20000; in ixgbevf_sw_init()
2213 adapter->itr_setting = 1; in ixgbevf_sw_init()
2216 adapter->eitr_low = 10; in ixgbevf_sw_init()
2217 adapter->eitr_high = 20; in ixgbevf_sw_init()
2220 adapter->tx_ring_count = IXGBEVF_DEFAULT_TXD; in ixgbevf_sw_init()
2221 adapter->rx_ring_count = IXGBEVF_DEFAULT_RXD; in ixgbevf_sw_init()
2224 adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED; in ixgbevf_sw_init()
2226 set_bit(__IXGBEVF_DOWN, &adapter->state); in ixgbevf_sw_init()
2256 * @adapter: board private structure
2258 void ixgbevf_update_stats(struct ixgbevf_adapter *adapter) in ixgbevf_update_stats() argument
2260 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_update_stats()
2262 UPDATE_VF_COUNTER_32bit(IXGBE_VFGPRC, adapter->stats.last_vfgprc, in ixgbevf_update_stats()
2263 adapter->stats.vfgprc); in ixgbevf_update_stats()
2264 UPDATE_VF_COUNTER_32bit(IXGBE_VFGPTC, adapter->stats.last_vfgptc, in ixgbevf_update_stats()
2265 adapter->stats.vfgptc); in ixgbevf_update_stats()
2267 adapter->stats.last_vfgorc, in ixgbevf_update_stats()
2268 adapter->stats.vfgorc); in ixgbevf_update_stats()
2270 adapter->stats.last_vfgotc, in ixgbevf_update_stats()
2271 adapter->stats.vfgotc); in ixgbevf_update_stats()
2272 UPDATE_VF_COUNTER_32bit(IXGBE_VFMPRC, adapter->stats.last_vfmprc, in ixgbevf_update_stats()
2273 adapter->stats.vfmprc); in ixgbevf_update_stats()
2278 * @data: pointer to adapter cast into an unsigned long
2282 struct ixgbevf_adapter *adapter = (struct ixgbevf_adapter *)data; in ixgbevf_watchdog() local
2283 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_watchdog()
2292 if (test_bit(__IXGBEVF_DOWN, &adapter->state)) in ixgbevf_watchdog()
2296 for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { in ixgbevf_watchdog()
2297 struct ixgbevf_q_vector *qv = adapter->q_vector[i]; in ixgbevf_watchdog()
2305 schedule_work(&adapter->watchdog_task); in ixgbevf_watchdog()
2314 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_tx_timeout() local
2317 schedule_work(&adapter->reset_task); in ixgbevf_tx_timeout()
2322 struct ixgbevf_adapter *adapter; in ixgbevf_reset_task() local
2323 adapter = container_of(work, struct ixgbevf_adapter, reset_task); in ixgbevf_reset_task()
2326 if (test_bit(__IXGBEVF_DOWN, &adapter->state) || in ixgbevf_reset_task()
2327 test_bit(__IXGBEVF_RESETTING, &adapter->state)) in ixgbevf_reset_task()
2330 adapter->tx_timeout_count++; in ixgbevf_reset_task()
2332 ixgbevf_reinit_locked(adapter); in ixgbevf_reset_task()
2341 struct ixgbevf_adapter *adapter = container_of(work, in ixgbevf_watchdog_task() local
2344 struct net_device *netdev = adapter->netdev; in ixgbevf_watchdog_task()
2345 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_watchdog_task()
2346 u32 link_speed = adapter->link_speed; in ixgbevf_watchdog_task()
2347 bool link_up = adapter->link_up; in ixgbevf_watchdog_task()
2349 adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK; in ixgbevf_watchdog_task()
2358 adapter->link_up = link_up; in ixgbevf_watchdog_task()
2359 adapter->link_speed = link_speed; in ixgbevf_watchdog_task()
2362 schedule_work(&adapter->reset_task); in ixgbevf_watchdog_task()
2371 adapter->link_up = link_up; in ixgbevf_watchdog_task()
2372 adapter->link_speed = link_speed; in ixgbevf_watchdog_task()
2376 hw_dbg(&adapter->hw, "NIC Link is Up, %u Gbps\n", in ixgbevf_watchdog_task()
2383 adapter->link_up = false; in ixgbevf_watchdog_task()
2384 adapter->link_speed = 0; in ixgbevf_watchdog_task()
2386 hw_dbg(&adapter->hw, "NIC Link is Down\n"); in ixgbevf_watchdog_task()
2392 ixgbevf_update_stats(adapter); in ixgbevf_watchdog_task()
2396 if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) in ixgbevf_watchdog_task()
2397 mod_timer(&adapter->watchdog_timer, in ixgbevf_watchdog_task()
2400 adapter->flags &= ~IXGBE_FLAG_IN_WATCHDOG_TASK; in ixgbevf_watchdog_task()
2405 * @adapter: board private structure
2410 void ixgbevf_free_tx_resources(struct ixgbevf_adapter *adapter, in ixgbevf_free_tx_resources() argument
2413 struct pci_dev *pdev = adapter->pdev; in ixgbevf_free_tx_resources()
2415 ixgbevf_clean_tx_ring(adapter, tx_ring); in ixgbevf_free_tx_resources()
2428 * @adapter: board private structure
2432 static void ixgbevf_free_all_tx_resources(struct ixgbevf_adapter *adapter) in ixgbevf_free_all_tx_resources() argument
2436 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbevf_free_all_tx_resources()
2437 if (adapter->tx_ring[i].desc) in ixgbevf_free_all_tx_resources()
2438 ixgbevf_free_tx_resources(adapter, in ixgbevf_free_all_tx_resources()
2439 &adapter->tx_ring[i]); in ixgbevf_free_all_tx_resources()
2445 * @adapter: board private structure
2450 int ixgbevf_setup_tx_resources(struct ixgbevf_adapter *adapter, in ixgbevf_setup_tx_resources() argument
2453 struct pci_dev *pdev = adapter->pdev; in ixgbevf_setup_tx_resources()
2478 hw_dbg(&adapter->hw, "Unable to allocate memory for the transmit " in ixgbevf_setup_tx_resources()
2485 * @adapter: board private structure
2493 static int ixgbevf_setup_all_tx_resources(struct ixgbevf_adapter *adapter) in ixgbevf_setup_all_tx_resources() argument
2497 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbevf_setup_all_tx_resources()
2498 err = ixgbevf_setup_tx_resources(adapter, &adapter->tx_ring[i]); in ixgbevf_setup_all_tx_resources()
2501 hw_dbg(&adapter->hw, in ixgbevf_setup_all_tx_resources()
2511 * @adapter: board private structure
2516 int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *adapter, in ixgbevf_setup_rx_resources() argument
2519 struct pci_dev *pdev = adapter->pdev; in ixgbevf_setup_rx_resources()
2525 hw_dbg(&adapter->hw, in ixgbevf_setup_rx_resources()
2539 hw_dbg(&adapter->hw, in ixgbevf_setup_rx_resources()
2557 * @adapter: board private structure
2565 static int ixgbevf_setup_all_rx_resources(struct ixgbevf_adapter *adapter) in ixgbevf_setup_all_rx_resources() argument
2569 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbevf_setup_all_rx_resources()
2570 err = ixgbevf_setup_rx_resources(adapter, &adapter->rx_ring[i]); in ixgbevf_setup_all_rx_resources()
2573 hw_dbg(&adapter->hw, in ixgbevf_setup_all_rx_resources()
2582 * @adapter: board private structure
2587 void ixgbevf_free_rx_resources(struct ixgbevf_adapter *adapter, in ixgbevf_free_rx_resources() argument
2590 struct pci_dev *pdev = adapter->pdev; in ixgbevf_free_rx_resources()
2592 ixgbevf_clean_rx_ring(adapter, rx_ring); in ixgbevf_free_rx_resources()
2605 * @adapter: board private structure
2609 static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter) in ixgbevf_free_all_rx_resources() argument
2613 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbevf_free_all_rx_resources()
2614 if (adapter->rx_ring[i].desc) in ixgbevf_free_all_rx_resources()
2615 ixgbevf_free_rx_resources(adapter, in ixgbevf_free_all_rx_resources()
2616 &adapter->rx_ring[i]); in ixgbevf_free_all_rx_resources()
2633 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_open() local
2634 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_open()
2638 if (test_bit(__IXGBEVF_TESTING, &adapter->state)) in ixgbevf_open()
2642 ixgbevf_reset(adapter); in ixgbevf_open()
2643 /* if adapter is still stopped then PF isn't up and in ixgbevf_open()
2654 err = ixgbevf_setup_all_tx_resources(adapter); in ixgbevf_open()
2659 err = ixgbevf_setup_all_rx_resources(adapter); in ixgbevf_open()
2663 ixgbevf_configure(adapter); in ixgbevf_open()
2670 ixgbevf_map_rings_to_vectors(adapter); in ixgbevf_open()
2672 err = ixgbevf_up_complete(adapter); in ixgbevf_open()
2678 err = ixgbevf_request_irq(adapter); in ixgbevf_open()
2682 ixgbevf_irq_enable(adapter, true, true); in ixgbevf_open()
2687 ixgbevf_down(adapter); in ixgbevf_open()
2689 ixgbevf_free_irq(adapter); in ixgbevf_open()
2691 ixgbevf_free_all_rx_resources(adapter); in ixgbevf_open()
2693 ixgbevf_free_all_tx_resources(adapter); in ixgbevf_open()
2694 ixgbevf_reset(adapter); in ixgbevf_open()
2714 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_close() local
2716 ixgbevf_down(adapter); in ixgbevf_close()
2717 ixgbevf_free_irq(adapter); in ixgbevf_close()
2719 ixgbevf_free_all_tx_resources(adapter); in ixgbevf_close()
2720 ixgbevf_free_all_rx_resources(adapter); in ixgbevf_close()
2725 static int ixgbevf_tso(struct ixgbevf_adapter *adapter, in ixgbevf_tso() argument
2753 adapter->hw_tso_ctxt++; in ixgbevf_tso()
2760 adapter->hw_tso6_ctxt++; in ixgbevf_tso()
2813 static bool ixgbevf_tx_csum(struct ixgbevf_adapter *adapter, in ixgbevf_tx_csum() argument
2873 adapter->hw_csum_tx_good++; in ixgbevf_tx_csum()
2885 static int ixgbevf_tx_map(struct ixgbevf_adapter *adapter, in ixgbevf_tx_map() argument
2890 struct pci_dev *pdev = adapter->pdev; in ixgbevf_tx_map()
2909 tx_buffer_info->dma = dma_map_single(&adapter->pdev->dev, in ixgbevf_tx_map()
2939 skb_frag_dma_map(&adapter->pdev->dev, frag, in ixgbevf_tx_map()
2984 ixgbevf_unmap_and_free_tx_resource(adapter, tx_buffer_info); in ixgbevf_tx_map()
2990 static void ixgbevf_tx_queue(struct ixgbevf_adapter *adapter, in ixgbevf_tx_queue() argument
3050 writel(i, adapter->hw.hw_addr + tx_ring->tail); in ixgbevf_tx_queue()
3056 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in __ixgbevf_maybe_stop_tx() local
3071 ++adapter->restart_queue; in __ixgbevf_maybe_stop_tx()
3085 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_xmit_frame() local
3095 tx_ring = &adapter->tx_ring[r_idx]; in ixgbevf_xmit_frame()
3114 adapter->tx_busy++; in ixgbevf_xmit_frame()
3122 tso = ixgbevf_tso(adapter, tx_ring, skb, tx_flags, &hdr_len); in ixgbevf_xmit_frame()
3130 else if (ixgbevf_tx_csum(adapter, tx_ring, skb, tx_flags) && in ixgbevf_xmit_frame()
3134 ixgbevf_tx_queue(adapter, tx_ring, tx_flags, in ixgbevf_xmit_frame()
3135 ixgbevf_tx_map(adapter, tx_ring, skb, tx_flags, first), in ixgbevf_xmit_frame()
3152 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_set_mac() local
3153 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_set_mac()
3177 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_change_mtu() local
3178 struct ixgbe_hw *hw = &adapter->hw; in ixgbevf_change_mtu()
3183 if (adapter->hw.mac.type == ixgbe_mac_X540_vf) in ixgbevf_change_mtu()
3190 hw_dbg(&adapter->hw, "changing MTU from %d to %d\n", in ixgbevf_change_mtu()
3200 ixgbevf_reinit_locked(adapter); in ixgbevf_change_mtu()
3208 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_shutdown() local
3213 ixgbevf_down(adapter); in ixgbevf_shutdown()
3214 ixgbevf_free_irq(adapter); in ixgbevf_shutdown()
3215 ixgbevf_free_all_tx_resources(adapter); in ixgbevf_shutdown()
3216 ixgbevf_free_all_rx_resources(adapter); in ixgbevf_shutdown()
3229 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_get_stats() local
3235 ixgbevf_update_stats(adapter); in ixgbevf_get_stats()
3237 stats->multicast = adapter->stats.vfmprc - adapter->stats.base_vfmprc; in ixgbevf_get_stats()
3239 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbevf_get_stats()
3240 ring = &adapter->rx_ring[i]; in ixgbevf_get_stats()
3250 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbevf_get_stats()
3251 ring = &adapter->tx_ring[i]; in ixgbevf_get_stats()
3267 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_set_features() local
3270 adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED; in ixgbevf_set_features()
3272 adapter->flags &= ~IXGBE_FLAG_RX_CSUM_ENABLED; in ixgbevf_set_features()
3306 * ixgbevf_probe initializes an adapter identified by a pci_dev structure.
3307 * The OS initialization, configuring of the adapter private structure,
3314 struct ixgbevf_adapter *adapter = NULL; in ixgbevf_probe() local
3363 adapter = netdev_priv(netdev); in ixgbevf_probe()
3365 adapter->netdev = netdev; in ixgbevf_probe()
3366 adapter->pdev = pdev; in ixgbevf_probe()
3367 hw = &adapter->hw; in ixgbevf_probe()
3368 hw->back = adapter; in ixgbevf_probe()
3369 adapter->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1; in ixgbevf_probe()
3373 * adapter struct to exist, and needs to call netdev_priv in ixgbevf_probe()
3386 adapter->bd_number = cards_found; in ixgbevf_probe()
3395 adapter->flags &= ~IXGBE_FLAG_RX_PS_CAPABLE; in ixgbevf_probe()
3396 adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; in ixgbevf_probe()
3397 adapter->flags |= IXGBE_FLAG_RX_1BUF_CAPABLE; in ixgbevf_probe()
3400 err = ixgbevf_sw_init(adapter); in ixgbevf_probe()
3426 memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); in ixgbevf_probe()
3427 memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); in ixgbevf_probe()
3435 init_timer(&adapter->watchdog_timer); in ixgbevf_probe()
3436 adapter->watchdog_timer.function = ixgbevf_watchdog; in ixgbevf_probe()
3437 adapter->watchdog_timer.data = (unsigned long)adapter; in ixgbevf_probe()
3439 INIT_WORK(&adapter->reset_task, ixgbevf_reset_task); in ixgbevf_probe()
3440 INIT_WORK(&adapter->watchdog_task, ixgbevf_watchdog_task); in ixgbevf_probe()
3442 err = ixgbevf_init_interrupt_scheme(adapter); in ixgbevf_probe()
3456 adapter->netdev_registered = true; in ixgbevf_probe()
3460 ixgbevf_init_last_counter_stats(adapter); in ixgbevf_probe()
3481 ixgbevf_reset_interrupt_capability(adapter); in ixgbevf_probe()
3505 struct ixgbevf_adapter *adapter = netdev_priv(netdev); in ixgbevf_remove() local
3507 set_bit(__IXGBEVF_DOWN, &adapter->state); in ixgbevf_remove()
3509 del_timer_sync(&adapter->watchdog_timer); in ixgbevf_remove()
3511 cancel_work_sync(&adapter->reset_task); in ixgbevf_remove()
3512 cancel_work_sync(&adapter->watchdog_task); in ixgbevf_remove()
3514 if (adapter->netdev_registered) { in ixgbevf_remove()
3516 adapter->netdev_registered = false; in ixgbevf_remove()
3519 ixgbevf_reset_interrupt_capability(adapter); in ixgbevf_remove()
3521 iounmap(adapter->hw.hw_addr); in ixgbevf_remove()
3524 hw_dbg(&adapter->hw, "Remove complete\n"); in ixgbevf_remove()
3526 kfree(adapter->tx_ring); in ixgbevf_remove()
3527 kfree(adapter->rx_ring); in ixgbevf_remove()
3580 struct ixgbevf_adapter *adapter = hw->back; in ixgbevf_get_hw_dev_name() local
3581 return adapter->netdev->name; in ixgbevf_get_hw_dev_name()