Lines Matching +full:rx +full:- +full:shared

1 /* SPDX-License-Identifier: BSD-3-Clause */
215 * iavf_register - iflib callback to obtain the shared context pointer
219 * is used by iflib to obtain a pointer to the shared context structure which
222 * @returns a pointer to the iavf shared context structure.
231 * iavf_allocate_pci_resources - Allocate PCI resources
236 * @returns zero or a non-zero error code on failure
245 * iavf_if_attach_pre - Begin attaching the device to the driver
251 * @returns zero or a non-zero error code on failure.
267 vsi = &sc->vsi; in iavf_if_attach_pre()
268 vsi->back = sc; in iavf_if_attach_pre()
269 sc->dev = sc->osdep.dev = dev; in iavf_if_attach_pre()
270 hw = &sc->hw; in iavf_if_attach_pre()
272 vsi->dev = dev; in iavf_if_attach_pre()
273 vsi->hw = &sc->hw; in iavf_if_attach_pre()
274 vsi->num_vlans = 0; in iavf_if_attach_pre()
275 vsi->ctx = ctx; in iavf_if_attach_pre()
276 sc->media = iflib_get_media(ctx); in iavf_if_attach_pre()
277 vsi->ifp = iflib_get_ifp(ctx); in iavf_if_attach_pre()
278 vsi->shared = scctx = iflib_get_softc_ctx(ctx); in iavf_if_attach_pre()
283 snprintf(sc->vc_mtx_name, sizeof(sc->vc_mtx_name), in iavf_if_attach_pre()
285 mtx_init(&sc->vc_mtx, sc->vc_mtx_name, NULL, MTX_DEF); in iavf_if_attach_pre()
287 /* Do PCI setup - map BAR0, etc */ in iavf_if_attach_pre()
295 iavf_dbg_init(sc, "Allocated PCI resources and MSI-X vectors\n"); in iavf_if_attach_pre()
354 iflib_set_mac(ctx, hw->mac.addr); in iavf_if_attach_pre()
360 scctx->isc_ntxqsets_max = scctx->isc_nrxqsets_max = in iavf_if_attach_pre()
361 sc->vsi_res->num_queue_pairs; in iavf_if_attach_pre()
362 if (vsi->enable_head_writeback) { in iavf_if_attach_pre()
363 scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] in iavf_if_attach_pre()
365 scctx->isc_txrx = &iavf_txrx_hwb; in iavf_if_attach_pre()
367 scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] in iavf_if_attach_pre()
369 scctx->isc_txrx = &iavf_txrx_dwb; in iavf_if_attach_pre()
371 scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] in iavf_if_attach_pre()
373 scctx->isc_msix_bar = pci_msix_table_bar(dev); in iavf_if_attach_pre()
374 scctx->isc_tx_nsegments = IAVF_MAX_TX_SEGS; in iavf_if_attach_pre()
375 scctx->isc_tx_tso_segments_max = IAVF_MAX_TSO_SEGS; in iavf_if_attach_pre()
376 scctx->isc_tx_tso_size_max = IAVF_TSO_SIZE; in iavf_if_attach_pre()
377 scctx->isc_tx_tso_segsize_max = IAVF_MAX_DMA_SEG_SIZE; in iavf_if_attach_pre()
378 scctx->isc_rss_table_size = IAVF_RSS_VSI_LUT_SIZE; in iavf_if_attach_pre()
379 scctx->isc_capabilities = scctx->isc_capenable = IAVF_CAPS; in iavf_if_attach_pre()
380 scctx->isc_tx_csum_flags = CSUM_OFFLOAD; in iavf_if_attach_pre()
388 taskqueue_free(sc->vc_tq); in iavf_if_attach_pre()
390 free(sc->vf_res, M_IAVF); in iavf_if_attach_pre()
401 * iavf_vc_task - task used to process VC messages
418 * iavf_setup_vc_tq - Setup task queues
422 * is done in a separate non-iflib taskqueue so that the iflib context lock
430 device_t dev = sc->dev; in iavf_setup_vc_tq()
433 TASK_INIT(&sc->vc_task, 0, iavf_vc_task, sc); in iavf_setup_vc_tq()
435 sc->vc_tq = taskqueue_create_fast("iavf_vc", M_NOWAIT, in iavf_setup_vc_tq()
436 taskqueue_thread_enqueue, &sc->vc_tq); in iavf_setup_vc_tq()
437 if (!sc->vc_tq) { in iavf_setup_vc_tq()
441 error = taskqueue_start_threads(&sc->vc_tq, 1, PI_NET, "%s vc", in iavf_setup_vc_tq()
446 taskqueue_free(sc->vc_tq); in iavf_setup_vc_tq()
454 * iavf_if_attach_post - Finish attaching the device to the driver
459 * Rx queues are setup belongs here.
461 * @returns zero or a non-zero error code on failure
477 vsi = &sc->vsi; in iavf_if_attach_post()
478 hw = &sc->hw; in iavf_if_attach_post()
481 vsi->num_rx_queues = vsi->shared->isc_nrxqsets; in iavf_if_attach_post()
482 vsi->num_tx_queues = vsi->shared->isc_ntxqsets; in iavf_if_attach_post()
490 bzero(&sc->vsi.eth_stats, sizeof(struct iavf_eth_stats)); in iavf_if_attach_post()
493 atomic_store_rel_32(&sc->queues_enabled, 0); in iavf_if_attach_post()
494 iavf_set_state(&sc->state, IAVF_STATE_INITIALIZED); in iavf_if_attach_post()
505 * iavf_if_detach - Detach a device from the driver
521 struct iavf_hw *hw = &sc->hw; in iavf_if_detach()
522 device_t dev = sc->dev; in iavf_if_detach()
527 iavf_clear_state(&sc->state, IAVF_STATE_INITIALIZED); in iavf_if_detach()
530 taskqueue_free(sc->vc_tq); in iavf_if_detach()
534 ifmedia_removeall(sc->media); in iavf_if_detach()
537 status = iavf_shutdown_adminq(&sc->hw); in iavf_if_detach()
544 free(sc->vf_res, M_IAVF); in iavf_if_detach()
545 sc->vf_res = NULL; in iavf_if_detach()
554 * iavf_if_shutdown - called by iflib to handle shutdown
568 * iavf_if_suspend - called by iflib to handle suspend
582 * iavf_if_resume - called by iflib to handle resume
596 * iavf_vc_sleep_wait - Sleep for a response from a VC message
615 &sc->vc_mtx, PRI_MAX, "iavf_vc", IAVF_AQ_TIMEOUT); in iavf_vc_sleep_wait()
621 * iavf_send_vc_msg_sleep - Send a virtchnl message and wait for a response
636 if_ctx_t ctx = sc->vsi.ctx; in iavf_send_vc_msg_sleep()
652 device_printf(sc->dev, "%b timed out\n", op, IAVF_FLAGS); in iavf_send_vc_msg_sleep()
660 * iavf_send_vc_msg - Send a virtchnl message to the PF
681 * iavf_init_queues - initialize Tx and Rx queues
684 * Refresh the Tx and Rx ring contents and update the tail pointers for each
690 struct iavf_tx_queue *tx_que = vsi->tx_queues; in iavf_init_queues()
691 struct iavf_rx_queue *rx_que = vsi->rx_queues; in iavf_init_queues()
695 mbuf_sz = iflib_get_rx_mbuf_sz(vsi->ctx); in iavf_init_queues()
698 for (int i = 0; i < vsi->num_tx_queues; i++, tx_que++) in iavf_init_queues()
701 for (int i = 0; i < vsi->num_rx_queues; i++, rx_que++) { in iavf_init_queues()
702 rxr = &rx_que->rxr; in iavf_init_queues()
704 rxr->mbuf_sz = mbuf_sz; in iavf_init_queues()
705 wr32(vsi->hw, rxr->tail, 0); in iavf_init_queues()
710 * iavf_if_init - Initialize device for operation
723 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_init()
724 struct iavf_hw *hw = &sc->hw; in iavf_if_init()
728 device_t dev = sc->dev; in iavf_if_init()
737 device_printf(sc->dev, "%s: VF reset failed\n", in iavf_if_init()
742 iavf_dbg_info(sc, "ASQ is not alive, re-initializing AQ\n"); in iavf_if_init()
766 if (!cmp_etheraddr(hw->mac.addr, tmpaddr) && in iavf_if_init()
768 error = iavf_del_mac_filter(sc, hw->mac.addr); in iavf_if_init()
772 bcopy(tmpaddr, hw->mac.addr, ETH_ALEN); in iavf_if_init()
775 error = iavf_add_mac_filter(sc, hw->mac.addr, 0); in iavf_if_init()
778 iflib_set_mac(ctx, hw->mac.addr); in iavf_if_init()
795 if (vsi->enable_head_writeback) in iavf_if_init()
806 iavf_set_state(&sc->state, IAVF_STATE_RUNNING); in iavf_if_init()
810 * iavf_if_msix_intr_assign - Assign MSI-X interrupts
812 * @msix: the number of MSI-X vectors available
814 * Called by iflib to assign MSI-X interrupt vectors to queues. Assigns and
815 * sets up vectors for each Tx and Rx queue, as well as the administrative
824 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_msix_intr_assign()
825 struct iavf_rx_queue *rx_que = vsi->rx_queues; in iavf_if_msix_intr_assign()
826 struct iavf_tx_queue *tx_que = vsi->tx_queues; in iavf_if_msix_intr_assign()
830 MPASS(vsi->shared->isc_nrxqsets > 0); in iavf_if_msix_intr_assign()
831 MPASS(vsi->shared->isc_ntxqsets > 0); in iavf_if_msix_intr_assign()
835 err = iflib_irq_alloc_generic(ctx, &vsi->irq, rid, IFLIB_INTR_ADMIN, in iavf_if_msix_intr_assign()
838 iflib_irq_free(ctx, &vsi->irq); in iavf_if_msix_intr_assign()
845 for (i = 0, vector = 1; i < vsi->shared->isc_nrxqsets; i++, vector++, rx_que++) { in iavf_if_msix_intr_assign()
849 err = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, in iavf_if_msix_intr_assign()
850 IFLIB_INTR_RXTX, iavf_msix_que, rx_que, rx_que->rxr.me, buf); in iavf_if_msix_intr_assign()
853 "Failed to allocate queue RX int vector %d, err: %d\n", i, err); in iavf_if_msix_intr_assign()
854 vsi->num_rx_queues = i + 1; in iavf_if_msix_intr_assign()
857 rx_que->msix = vector; in iavf_if_msix_intr_assign()
862 for (i = 0; i < vsi->shared->isc_ntxqsets; i++, tx_que++) { in iavf_if_msix_intr_assign()
865 &vsi->rx_queues[i % vsi->shared->isc_nrxqsets].que_irq, in iavf_if_msix_intr_assign()
866 IFLIB_INTR_TX, tx_que, tx_que->txr.me, buf); in iavf_if_msix_intr_assign()
868 tx_que->msix = (i % vsi->shared->isc_nrxqsets) + 1; in iavf_if_msix_intr_assign()
873 iflib_irq_free(ctx, &vsi->irq); in iavf_if_msix_intr_assign()
874 rx_que = vsi->rx_queues; in iavf_if_msix_intr_assign()
875 for (i = 0; i < vsi->num_rx_queues; i++, rx_que++) in iavf_if_msix_intr_assign()
876 iflib_irq_free(ctx, &rx_que->que_irq); in iavf_if_msix_intr_assign()
881 * iavf_if_enable_intr - Enable all interrupts for a device
890 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_enable_intr()
896 * iavf_if_disable_intr - Disable all interrupts for a device
905 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_disable_intr()
911 * iavf_if_rx_queue_intr_enable - Enable one Rx queue interrupt
913 * @rxqid: Rx queue index
915 * Enables the interrupt associated with a specified Rx queue.
923 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_rx_queue_intr_enable()
924 struct iavf_hw *hw = vsi->hw; in iavf_if_rx_queue_intr_enable()
925 struct iavf_rx_queue *rx_que = &vsi->rx_queues[rxqid]; in iavf_if_rx_queue_intr_enable()
927 iavf_enable_queue_irq(hw, rx_que->msix - 1); in iavf_if_rx_queue_intr_enable()
932 * iavf_if_tx_queue_intr_enable - Enable one Tx queue interrupt
944 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_tx_queue_intr_enable()
945 struct iavf_hw *hw = vsi->hw; in iavf_if_tx_queue_intr_enable()
946 struct iavf_tx_queue *tx_que = &vsi->tx_queues[txqid]; in iavf_if_tx_queue_intr_enable()
948 iavf_enable_queue_irq(hw, tx_que->msix - 1); in iavf_if_tx_queue_intr_enable()
953 * iavf_if_tx_queues_alloc - Allocate Tx queue memory
965 * @returns zero or a non-zero error code on failure
971 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_tx_queues_alloc()
972 if_softc_ctx_t scctx = vsi->shared; in iavf_if_tx_queues_alloc()
976 MPASS(scctx->isc_ntxqsets > 0); in iavf_if_tx_queues_alloc()
978 MPASS(scctx->isc_ntxqsets == ntxqsets); in iavf_if_tx_queues_alloc()
981 if (!(vsi->tx_queues = in iavf_if_tx_queues_alloc()
987 for (i = 0, que = vsi->tx_queues; i < ntxqsets; i++, que++) { in iavf_if_tx_queues_alloc()
988 struct tx_ring *txr = &que->txr; in iavf_if_tx_queues_alloc()
990 txr->me = i; in iavf_if_tx_queues_alloc()
991 que->vsi = vsi; in iavf_if_tx_queues_alloc()
993 if (!vsi->enable_head_writeback) { in iavf_if_tx_queues_alloc()
995 if (!(txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_IAVF, M_NOWAIT))) { in iavf_if_tx_queues_alloc()
1001 for (j = 0; j < scctx->isc_ntxd[0]; j++) in iavf_if_tx_queues_alloc()
1002 txr->tx_rsq[j] = QIDX_INVALID; in iavf_if_tx_queues_alloc()
1005 txr->tail = IAVF_QTX_TAIL1(txr->me); in iavf_if_tx_queues_alloc()
1006 txr->tx_base = (struct iavf_tx_desc *)vaddrs[i * ntxqs]; in iavf_if_tx_queues_alloc()
1007 txr->tx_paddr = paddrs[i * ntxqs]; in iavf_if_tx_queues_alloc()
1008 txr->que = que; in iavf_if_tx_queues_alloc()
1018 * iavf_if_rx_queues_alloc - Allocate Rx queue memory
1022 * @nrxqs: number of Rx queues per group (should always be 1)
1023 * @nrxqsets: the number of Rx queues to allocate
1025 * Called by iflib to allocate driver memory for a number of Rx queues.
1026 * Allocates memory for the drivers private Rx queue data structure, and saves
1029 * @returns zero or a non-zero error code on failure
1035 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_rx_queues_alloc()
1040 if_softc_ctx_t scctx = vsi->shared; in iavf_if_rx_queues_alloc()
1041 MPASS(scctx->isc_nrxqsets > 0); in iavf_if_rx_queues_alloc()
1043 MPASS(scctx->isc_nrxqsets == nrxqsets); in iavf_if_rx_queues_alloc()
1047 if (!(vsi->rx_queues = in iavf_if_rx_queues_alloc()
1050 device_printf(iflib_get_dev(ctx), "Unable to allocate RX ring memory\n"); in iavf_if_rx_queues_alloc()
1055 for (i = 0, que = vsi->rx_queues; i < nrxqsets; i++, que++) { in iavf_if_rx_queues_alloc()
1056 struct rx_ring *rxr = &que->rxr; in iavf_if_rx_queues_alloc()
1058 rxr->me = i; in iavf_if_rx_queues_alloc()
1059 que->vsi = vsi; in iavf_if_rx_queues_alloc()
1062 rxr->tail = IAVF_QRX_TAIL1(rxr->me); in iavf_if_rx_queues_alloc()
1063 rxr->rx_base = (union iavf_rx_desc *)vaddrs[i * nrxqs]; in iavf_if_rx_queues_alloc()
1064 rxr->rx_paddr = paddrs[i * nrxqs]; in iavf_if_rx_queues_alloc()
1065 rxr->que = que; in iavf_if_rx_queues_alloc()
1075 * iavf_if_queues_free - Free driver queue memory
1079 * Tx and Rx queues.
1090 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_queues_free()
1092 if (!vsi->enable_head_writeback) { in iavf_if_queues_free()
1096 for (i = 0, que = vsi->tx_queues; i < vsi->shared->isc_ntxqsets; i++, que++) { in iavf_if_queues_free()
1097 struct tx_ring *txr = &que->txr; in iavf_if_queues_free()
1098 if (txr->tx_rsq != NULL) { in iavf_if_queues_free()
1099 free(txr->tx_rsq, M_IAVF); in iavf_if_queues_free()
1100 txr->tx_rsq = NULL; in iavf_if_queues_free()
1105 if (vsi->tx_queues != NULL) { in iavf_if_queues_free()
1106 free(vsi->tx_queues, M_IAVF); in iavf_if_queues_free()
1107 vsi->tx_queues = NULL; in iavf_if_queues_free()
1109 if (vsi->rx_queues != NULL) { in iavf_if_queues_free()
1110 free(vsi->rx_queues, M_IAVF); in iavf_if_queues_free()
1111 vsi->rx_queues = NULL; in iavf_if_queues_free()
1116 * iavf_check_aq_errors - Check for AdminQ errors
1131 struct iavf_hw *hw = &sc->hw; in iavf_check_aq_errors()
1132 device_t dev = sc->dev; in iavf_check_aq_errors()
1136 oldreg = reg = rd32(hw, hw->aq.arq.len); in iavf_check_aq_errors()
1161 wr32(hw, hw->aq.arq.len, reg); in iavf_check_aq_errors()
1163 oldreg = reg = rd32(hw, hw->aq.asq.len); in iavf_check_aq_errors()
1180 wr32(hw, hw->aq.asq.len, reg); in iavf_check_aq_errors()
1186 * iavf_process_adminq - Process adminq responses from the PF
1200 struct iavf_hw *hw = &sc->hw; in iavf_process_adminq()
1205 if (iavf_test_state(&sc->state, IAVF_STATE_RESET_PENDING)) { in iavf_process_adminq()
1217 event.msg_buf = sc->aq_buffer; in iavf_process_adminq()
1231 iavf_vc_completion(sc, v_msg->v_opcode, in iavf_process_adminq()
1232 v_msg->v_retval, event.msg_buf, event.msg_len); in iavf_process_adminq()
1238 /* Re-enable admin queue interrupt cause */ in iavf_process_adminq()
1247 * iavf_if_update_admin_status - Administrative status task
1258 struct iavf_hw *hw = &sc->hw; in iavf_if_update_admin_status()
1266 * Otherwise, re-enable the Admin Queue interrupt. in iavf_if_update_admin_status()
1275 * iavf_if_multi_set - Set multicast address filters
1290 * iavf_if_mtu_set - Set the device MTU
1302 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_mtu_set()
1306 device_printf(sc->dev, "mtu %d is not in valid range [%d-%d]\n", in iavf_if_mtu_set()
1311 vsi->shared->isc_max_frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + in iavf_if_mtu_set()
1318 * iavf_if_media_status - Report current media status
1333 * iavf_if_media_change - Change the current media settings
1347 * iavf_if_promisc_set - Set device promiscuous mode
1364 * iavf_if_timer - Periodic timer called by iflib
1378 struct iavf_hw *hw = &sc->hw; in iavf_if_timer()
1401 * iavf_if_vlan_register - Register a VLAN
1411 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_vlan_register()
1417 if (vsi->num_vlans == 0) in iavf_if_vlan_register()
1422 ++vsi->num_vlans; in iavf_if_vlan_register()
1428 * iavf_if_vlan_unregister - Unregister a VLAN
1438 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_vlan_unregister()
1441 if ((vtag == 0) || (vtag > 4095) || (vsi->num_vlans == 0)) /* Invalid */ in iavf_if_vlan_unregister()
1445 vsi->num_vlans -= i; in iavf_if_vlan_unregister()
1448 if (vsi->num_vlans == 0) in iavf_if_vlan_unregister()
1456 * iavf_if_get_counter - Get network statistic counters
1468 struct iavf_vsi *vsi = &sc->vsi; in iavf_if_get_counter()
1473 return (vsi->ipackets); in iavf_if_get_counter()
1475 return (vsi->ierrors); in iavf_if_get_counter()
1477 return (vsi->opackets); in iavf_if_get_counter()
1479 return (vsi->oerrors); in iavf_if_get_counter()
1484 return (vsi->ibytes); in iavf_if_get_counter()
1486 return (vsi->obytes); in iavf_if_get_counter()
1488 return (vsi->imcasts); in iavf_if_get_counter()
1490 return (vsi->omcasts); in iavf_if_get_counter()
1492 return (vsi->iqdrops); in iavf_if_get_counter()
1494 return (vsi->oqdrops); in iavf_if_get_counter()
1496 return (vsi->noproto); in iavf_if_get_counter()
1502 /* iavf_if_needs_restart - Tell iflib when the driver needs to be reinitialized
1522 * iavf_free_pci_resources - Free PCI resources
1531 struct iavf_vsi *vsi = &sc->vsi; in iavf_free_pci_resources()
1532 struct iavf_rx_queue *rx_que = vsi->rx_queues; in iavf_free_pci_resources()
1533 device_t dev = sc->dev; in iavf_free_pci_resources()
1540 iflib_irq_free(vsi->ctx, &vsi->irq); in iavf_free_pci_resources()
1542 for (int i = 0; i < vsi->num_rx_queues; i++, rx_que++) in iavf_free_pci_resources()
1543 iflib_irq_free(vsi->ctx, &rx_que->que_irq); in iavf_free_pci_resources()
1546 if (sc->pci_mem != NULL) in iavf_free_pci_resources()
1548 rman_get_rid(sc->pci_mem), sc->pci_mem); in iavf_free_pci_resources()
1552 * iavf_setup_interface - Setup the device interface
1561 struct iavf_vsi *vsi = &sc->vsi; in iavf_setup_interface()
1562 if_ctx_t ctx = vsi->ctx; in iavf_setup_interface()
1567 vsi->shared->isc_max_frame_size = in iavf_setup_interface()
1573 ifmedia_add(sc->media, IFM_ETHER | IFM_AUTO, 0, NULL); in iavf_setup_interface()
1574 ifmedia_set(sc->media, IFM_ETHER | IFM_AUTO); in iavf_setup_interface()
1578 * iavf_msix_adminq - Admin Queue interrupt handler
1581 * Interrupt handler for the non-queue interrupt causes. Primarily this will
1591 struct iavf_hw *hw = &sc->hw; in iavf_msix_adminq()
1594 ++sc->admin_irq; in iavf_msix_adminq()
1596 if (!iavf_test_state(&sc->state, IAVF_STATE_INITIALIZED)) in iavf_msix_adminq()
1602 * they can be re-enabled in iavf_msix_adminq()
1611 taskqueue_enqueue(sc->vc_tq, &sc->vc_task); in iavf_msix_adminq()
1621 * iavf_enable_intr - Enable device interrupts
1629 struct iavf_hw *hw = vsi->hw; in iavf_enable_intr()
1630 struct iavf_rx_queue *que = vsi->rx_queues; in iavf_enable_intr()
1633 for (int i = 0; i < vsi->num_rx_queues; i++, que++) in iavf_enable_intr()
1634 iavf_enable_queue_irq(hw, que->rxr.me); in iavf_enable_intr()
1638 * iavf_disable_intr - Disable device interrupts
1648 struct iavf_hw *hw = vsi->hw; in iavf_disable_intr()
1649 struct iavf_rx_queue *que = vsi->rx_queues; in iavf_disable_intr()
1651 for (int i = 0; i < vsi->num_rx_queues; i++, que++) in iavf_disable_intr()
1652 iavf_disable_queue_irq(hw, que->rxr.me); in iavf_disable_intr()
1656 * iavf_enable_queue_irq - Enable IRQ register for a queue interrupt
1674 * iavf_disable_queue_irq - Disable IRQ register for a queue interrupt
1689 * iavf_configure_itr - Get initial ITR values from tunable values.
1702 * iavf_set_queue_rx_itr - Update Rx ITR value
1703 * @que: Rx queue to update
1705 * Provide a update to the queue RX interrupt moderation value.
1710 struct iavf_vsi *vsi = que->vsi; in iavf_set_queue_rx_itr()
1711 struct iavf_hw *hw = vsi->hw; in iavf_set_queue_rx_itr()
1712 struct rx_ring *rxr = &que->rxr; in iavf_set_queue_rx_itr()
1715 if (rxr->bytes == 0) in iavf_set_queue_rx_itr()
1719 if (rxr->itr != vsi->rx_itr_setting) { in iavf_set_queue_rx_itr()
1720 rxr->itr = vsi->rx_itr_setting; in iavf_set_queue_rx_itr()
1722 que->rxr.me), rxr->itr); in iavf_set_queue_rx_itr()
1727 * iavf_msix_que - Main Rx queue interrupt handler
1728 * @arg: void pointer to the Rx queue
1730 * Main MSI-X interrupt handler for Rx queue interrupts
1732 * @returns FILTER_SCHEDULE_THREAD if the main thread for Rx needs to run,
1739 struct iavf_sc *sc = rx_que->vsi->back; in iavf_msix_que()
1741 ++rx_que->irqs; in iavf_msix_que()
1743 if (!iavf_test_state(&sc->state, IAVF_STATE_RUNNING)) in iavf_msix_que()
1752 * iavf_update_link_status - Update iflib Link status
1761 struct iavf_vsi *vsi = &sc->vsi; in iavf_update_link_status()
1764 if (sc->link_up){ in iavf_update_link_status()
1765 if (vsi->link_active == FALSE) { in iavf_update_link_status()
1766 vsi->link_active = TRUE; in iavf_update_link_status()
1769 iflib_link_state_change(vsi->ctx, LINK_STATE_UP, baudrate); in iavf_update_link_status()
1772 if (vsi->link_active == TRUE) { in iavf_update_link_status()
1773 vsi->link_active = FALSE; in iavf_update_link_status()
1774 iflib_link_state_change(vsi->ctx, LINK_STATE_DOWN, 0); in iavf_update_link_status()
1780 * iavf_stop - Stop the interface
1785 * Tx/Rx LAN queues.
1790 iavf_clear_state(&sc->state, IAVF_STATE_RUNNING); in iavf_stop()
1792 iavf_disable_intr(&sc->vsi); in iavf_stop()
1798 * iavf_if_stop - iflib stop handler
1812 * iavf_del_mac_filter - Delete a MAC filter
1829 f->flags |= IAVF_FILTER_DEL; in iavf_del_mac_filter()
1834 * iavf_init_tx_rsqs - Initialize Report Status array
1843 if_softc_ctx_t scctx = vsi->shared; in iavf_init_tx_rsqs()
1847 for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) { in iavf_init_tx_rsqs()
1848 struct tx_ring *txr = &tx_que->txr; in iavf_init_tx_rsqs()
1850 txr->tx_rs_cidx = txr->tx_rs_pidx; in iavf_init_tx_rsqs()
1854 * off-by-one error when calculating how many descriptors are in iavf_init_tx_rsqs()
1857 txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; in iavf_init_tx_rsqs()
1859 for (j = 0; j < scctx->isc_ntxd[0]; j++) in iavf_init_tx_rsqs()
1860 txr->tx_rsq[j] = QIDX_INVALID; in iavf_init_tx_rsqs()
1865 * iavf_init_tx_cidx - Initialize Tx cidx values
1874 if_softc_ctx_t scctx = vsi->shared; in iavf_init_tx_cidx()
1878 for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) { in iavf_init_tx_cidx()
1879 struct tx_ring *txr = &tx_que->txr; in iavf_init_tx_cidx()
1881 txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; in iavf_init_tx_cidx()
1886 * iavf_add_device_sysctls - Add device sysctls for configuration
1894 struct iavf_vsi *vsi = &sc->vsi; in iavf_add_device_sysctls()
1895 device_t dev = sc->dev; in iavf_add_device_sysctls()
1907 sc, 0, iavf_sysctl_queue_interrupt_table, "A", "View MSI-X indices for TX/RX queues"); in iavf_add_device_sysctls()
1926 * iavf_add_queues_sysctls - Add per-queue sysctls
1930 * Add sysctls for each Tx and Rx queue.
1945 vsi_list = SYSCTL_CHILDREN(vsi->vsi_node); in iavf_add_queues_sysctls()
1948 for (int q = 0; q < vsi->num_rx_queues; q++) { in iavf_add_queues_sysctls()
1952 OID_AUTO, queue_namebuf, CTLFLAG_RD, NULL, "RX Queue #"); in iavf_add_queues_sysctls()
1955 rx_que = &(vsi->rx_queues[q]); in iavf_add_queues_sysctls()
1956 rxr = &(rx_que->rxr); in iavf_add_queues_sysctls()
1959 CTLFLAG_RD, &(rx_que->irqs), in iavf_add_queues_sysctls()
1960 "irqs on this queue (both Tx and Rx)"); in iavf_add_queues_sysctls()
1963 CTLFLAG_RD, &(rxr->rx_packets), in iavf_add_queues_sysctls()
1966 CTLFLAG_RD, &(rxr->rx_bytes), in iavf_add_queues_sysctls()
1969 CTLFLAG_RD, &(rxr->desc_errs), in iavf_add_queues_sysctls()
1970 "Queue Rx Descriptor Errors"); in iavf_add_queues_sysctls()
1972 CTLFLAG_RD, &(rxr->itr), 0, in iavf_add_queues_sysctls()
1973 "Queue Rx ITR Interval"); in iavf_add_queues_sysctls()
1975 for (int q = 0; q < vsi->num_tx_queues; q++) { in iavf_add_queues_sysctls()
1982 tx_que = &(vsi->tx_queues[q]); in iavf_add_queues_sysctls()
1983 txr = &(tx_que->txr); in iavf_add_queues_sysctls()
1986 CTLFLAG_RD, &(tx_que->tso), in iavf_add_queues_sysctls()
1989 CTLFLAG_RD, &(txr->mss_too_small), in iavf_add_queues_sysctls()
1992 CTLFLAG_RD, &(txr->tx_packets), in iavf_add_queues_sysctls()
1995 CTLFLAG_RD, &(txr->tx_bytes), in iavf_add_queues_sysctls()
1998 CTLFLAG_RD, &(txr->itr), 0, in iavf_add_queues_sysctls()
2004 * iavf_driver_is_detaching - Check if the driver is detaching/unloading
2015 * detach-based race conditions as it is possible for a thread to race with
2021 return (!iavf_test_state(&sc->state, IAVF_STATE_INITIALIZED) || in iavf_driver_is_detaching()
2022 iflib_in_detach(sc->vsi.ctx)); in iavf_driver_is_detaching()
2026 * iavf_sysctl_queue_interrupt_table - Sysctl for displaying Tx queue mapping
2032 * Print out mapping of TX queue indexes and Rx queue indexes to MSI-X vectors.
2040 struct iavf_vsi *vsi = &sc->vsi; in iavf_sysctl_queue_interrupt_table()
2041 device_t dev = sc->dev; in iavf_sysctl_queue_interrupt_table()
2060 for (int i = 0; i < vsi->num_rx_queues; i++) { in iavf_sysctl_queue_interrupt_table()
2061 rx_que = &vsi->rx_queues[i]; in iavf_sysctl_queue_interrupt_table()
2062 sbuf_printf(buf, "(rxq %3d): %d\n", i, rx_que->msix); in iavf_sysctl_queue_interrupt_table()
2064 for (int i = 0; i < vsi->num_tx_queues; i++) { in iavf_sysctl_queue_interrupt_table()
2065 tx_que = &vsi->tx_queues[i]; in iavf_sysctl_queue_interrupt_table()
2066 sbuf_printf(buf, "(txq %3d): %d\n", i, tx_que->msix); in iavf_sysctl_queue_interrupt_table()
2081 * iavf_sysctl_vf_reset - Request a VF reset
2103 if ((error) || (req->newptr == NULL)) in iavf_sysctl_vf_reset()
2108 if (CTX_ACTIVE(sc->vsi.ctx)) in iavf_sysctl_vf_reset()
2109 iflib_request_reset(sc->vsi.ctx); in iavf_sysctl_vf_reset()
2116 * iavf_sysctl_vflr_reset - Trigger a PCIe FLR for the device
2130 device_t dev = sc->dev; in iavf_sysctl_vflr_reset()
2139 if ((error) || (req->newptr == NULL)) in iavf_sysctl_vflr_reset()
2147 else if (CTX_ACTIVE(sc->vsi.ctx)) in iavf_sysctl_vflr_reset()
2148 iflib_request_reset(sc->vsi.ctx); in iavf_sysctl_vflr_reset()