From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 225CA4302F; Fri, 11 Aug 2023 08:38:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F012840F16; Fri, 11 Aug 2023 08:38:50 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id DDAE340E03 for ; Fri, 11 Aug 2023 08:38:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691735929; x=1723271929; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U9UcVg30L/+UtQLfqLCk7SNtGhlWce/F/IsneBV9lhg=; b=Dtt5A2jrHjP66Tx8XT5zsMmEn4FEPl+2WsEXo5Vg35Mt8faZRgqNC2IB //q/ysWc1tAlnCWQgUW4DkXk1ZKkdivagnMVlHOfQkOpcOMk3aRLhTquX cW3Y3IIRzgkFTxRPtJdzQ0lN7Y2N+BZzlKRJfGSbrQ5kfDEXoTLsRPKhk 1xYRckJDYvUKOc7g22ihcFrYwRhJJM22WjRAW9XRcOloEPSVin80i3XO9 Oxli3yrKcRwr/lq9+yyQ+HO4d8/PPgnUP6fSYWrEj0LceClDZiZT7G6iM S45wYAZ4DBnJpS99n+SiHNnHMFKVfiWCTgLwNR5EPeBlhOo7/CIBAyU4v w==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="435501836" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="435501836" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2023 23:38:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="726143914" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="726143914" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2023 23:38:23 -0700 From: Mingjin Ye To: dev@dpdk.org Cc: qiming.yang@intel.com, yidingx.zhou@intel.com, Mingjin Ye , Simei Su , Wenjun Wu , Yuying Zhang , Beilei Xing , Jingjing Wu , Bruce Richardson , Konstantin Ananyev Subject: [PATCH] net/iavf: support no data path polling mode Date: Fri, 11 Aug 2023 06:27:24 +0000 Message-Id: <20230811062724.189757-1-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721095725.454894-1-mingjinx.ye@intel.com> References: <20230721095725.454894-1-mingjinx.ye@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Currently, during a PF to VF reset due to an action such as changing trust settings on a VF, the DPDK application running with iavf PMD loses connectivity, and the only solution is to reset the DPDK application. Instead of forcing a reset of the DPDK application to restore connectivity, the iavf PMD driver handles the PF to VF reset event normally by performing all necessary steps to bring the VF back online. To minimize downtime, a devargs "no-poll-on-link-down" is introduced in iavf PMD. When this flag is set, the PMD switches to no-poll mode when the link state is down (rx/tx bursts return to 0 immediately). When the link state returns to normal, the PMD switches to normal rx/tx burst state. Signed-off-by: Mingjin Ye --- doc/guides/nics/intel_vf.rst | 3 ++ drivers/net/iavf/iavf.h | 2 ++ drivers/net/iavf/iavf_ethdev.c | 12 +++++++ drivers/net/iavf/iavf_rxtx.c | 29 +++++++++++++++-- drivers/net/iavf/iavf_rxtx.h | 1 + drivers/net/iavf/iavf_rxtx_vec_avx2.c | 29 ++++++++++++++--- drivers/net/iavf/iavf_rxtx_vec_avx512.c | 42 ++++++++++++++++++++++--- drivers/net/iavf/iavf_rxtx_vec_sse.c | 21 ++++++++++++- drivers/net/iavf/iavf_vchnl.c | 20 ++++++++++++ 9 files changed, 147 insertions(+), 12 deletions(-) diff --git a/doc/guides/nics/intel_vf.rst b/doc/guides/nics/intel_vf.rst index d365dbc185..54cfb688b3 100644 --- a/doc/guides/nics/intel_vf.rst +++ b/doc/guides/nics/intel_vf.rst @@ -101,6 +101,9 @@ For more detail on SR-IOV, please refer to the following documents: Set ``devargs`` parameter ``watchdog_period`` to adjust the watchdog period in microseconds, or set it to 0 to disable the watchdog, for example, ``-a 18:01.0,watchdog_period=5000`` or ``-a 18:01.0,watchdog_period=0``. + Enable vf no-poll-on-link-down by setting the ``devargs`` parameter like ``-a 18:01.0,no_poll_on_link_down=1`` when IAVF is backed + by an IntelĀ® E810 device or an IntelĀ® 700 Series Ethernet device. + The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 98861e4242..30b05d25b6 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -305,6 +305,7 @@ struct iavf_devargs { uint8_t proto_xtr[IAVF_MAX_QUEUE_NUM]; uint16_t quanta_size; uint32_t watchdog_period; + uint16_t no_poll_on_link_down; }; struct iavf_security_ctx; @@ -323,6 +324,7 @@ struct iavf_adapter { uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE] __rte_cache_min_aligned; bool stopped; bool closed; + bool no_poll; uint16_t fdir_ref_cnt; struct iavf_devargs devargs; }; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index f2fc5a5621..2fdc845204 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -37,6 +37,7 @@ #define IAVF_PROTO_XTR_ARG "proto_xtr" #define IAVF_QUANTA_SIZE_ARG "quanta_size" #define IAVF_RESET_WATCHDOG_ARG "watchdog_period" +#define IAVF_NO_POLL_ON_LINK_DOWN_ARG "no_poll_on_link_down" uint64_t iavf_timestamp_dynflag; int iavf_timestamp_dynfield_offset = -1; @@ -45,6 +46,7 @@ static const char * const iavf_valid_args[] = { IAVF_PROTO_XTR_ARG, IAVF_QUANTA_SIZE_ARG, IAVF_RESET_WATCHDOG_ARG, + IAVF_NO_POLL_ON_LINK_DOWN_ARG, NULL }; @@ -2237,6 +2239,7 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev) struct rte_kvargs *kvlist; int ret; int watchdog_period = -1; + uint16_t no_poll_on_link_down; if (!devargs) return 0; @@ -2270,6 +2273,15 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev) else ad->devargs.watchdog_period = watchdog_period; + ret = rte_kvargs_process(kvlist, IAVF_NO_POLL_ON_LINK_DOWN_ARG, + &parse_u16, &no_poll_on_link_down); + if (ret) + goto bail; + if (no_poll_on_link_down == 0) + ad->devargs.no_poll_on_link_down = 0; + else + ad->devargs.no_poll_on_link_down = 1; + if (ad->devargs.quanta_size != 0 && (ad->devargs.quanta_size < 256 || ad->devargs.quanta_size > 4096 || ad->devargs.quanta_size & 0x40)) { diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index f7df4665d1..447e306fee 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -770,6 +770,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev, IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); + struct iavf_vsi *vsi = &vf->vsi; struct iavf_tx_queue *txq; const struct rte_memzone *mz; uint32_t ring_size; @@ -843,6 +844,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev, txq->port_id = dev->data->port_id; txq->offloads = offloads; txq->tx_deferred_start = tx_conf->tx_deferred_start; + txq->vsi = vsi; if (iavf_ipsec_crypto_supported(adapter)) txq->ipsec_crypto_pkt_md_offset = @@ -1406,9 +1408,12 @@ iavf_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) uint64_t pkt_flags; const uint32_t *ptype_tbl; + rxq = rx_queue; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + nb_rx = 0; nb_hold = 0; - rxq = rx_queue; rx_id = rxq->rx_tail; rx_ring = rxq->rx_ring; ptype_tbl = rxq->vsi->adapter->ptype_tbl; @@ -1515,9 +1520,12 @@ iavf_recv_pkts_flex_rxd(void *rx_queue, const uint32_t *ptype_tbl; uint64_t ts_ns; + rxq = rx_queue; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + nb_rx = 0; nb_hold = 0; - rxq = rx_queue; rx_id = rxq->rx_tail; rx_ring = rxq->rx_ring; ptype_tbl = rxq->vsi->adapter->ptype_tbl; @@ -1641,6 +1649,9 @@ iavf_recv_scattered_pkts_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts, volatile union iavf_rx_flex_desc *rxdp; const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) { uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000); @@ -1818,6 +1829,9 @@ iavf_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, volatile union iavf_rx_desc *rxdp; const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + while (nb_rx < nb_pkts) { rxdp = &rx_ring[rx_id]; qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len); @@ -1973,6 +1987,9 @@ iavf_rx_scan_hw_ring_flex_rxd(struct iavf_rx_queue *rxq, const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; uint64_t ts_ns; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + rxdp = (volatile union iavf_rx_flex_desc *)&rxq->rx_ring[rxq->rx_tail]; rxep = &rxq->sw_ring[rxq->rx_tail]; @@ -2104,6 +2121,9 @@ iavf_rx_scan_hw_ring(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts, uint1 uint64_t pkt_flags; const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + rxdp = &rxq->rx_ring[rxq->rx_tail]; rxep = &rxq->sw_ring[rxq->rx_tail]; @@ -2281,6 +2301,9 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) struct iavf_rx_queue *rxq = (struct iavf_rx_queue *)rx_queue; uint16_t nb_rx = 0; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + if (!nb_pkts) return 0; @@ -2768,6 +2791,8 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) uint16_t idx; uint16_t slen; + if (!txq->vsi || txq->vsi->adapter->no_poll) + return 0; /* Check if the descriptor ring needs to be cleaned. */ if (txq->nb_free < txq->free_thresh) diff --git a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h index 605ea3f824..d3324e0e6e 100644 --- a/drivers/net/iavf/iavf_rxtx.h +++ b/drivers/net/iavf/iavf_rxtx.h @@ -288,6 +288,7 @@ struct iavf_tx_queue { uint16_t free_thresh; uint16_t rs_thresh; uint8_t rel_mbufs_type; + struct iavf_vsi *vsi; /**< the VSI this queue belongs to */ uint16_t port_id; uint16_t queue_id; diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx2.c b/drivers/net/iavf/iavf_rxtx_vec_avx2.c index c10f24036e..98316bed24 100644 --- a/drivers/net/iavf/iavf_rxtx_vec_avx2.c +++ b/drivers/net/iavf/iavf_rxtx_vec_avx2.c @@ -26,8 +26,7 @@ _iavf_recv_raw_pkts_vec_avx2(struct iavf_rx_queue *rxq, { #define IAVF_DESCS_PER_LOOP_AVX 8 - /* const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; */ - const uint32_t *type_table = rxq->vsi->adapter->ptype_tbl; + const uint32_t *type_table; const __m256i mbuf_init = _mm256_set_epi64x(0, 0, 0, rxq->mbuf_initializer); @@ -36,6 +35,11 @@ _iavf_recv_raw_pkts_vec_avx2(struct iavf_rx_queue *rxq, volatile union iavf_rx_desc *rxdp = rxq->rx_ring + rxq->rx_tail; const int avx_aligned = ((rxq->rx_tail & 1) == 0); + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + + type_table = rxq->vsi->adapter->ptype_tbl; + rte_prefetch0(rxdp); /* nb_pkts has to be floor-aligned to IAVF_DESCS_PER_LOOP_AVX */ @@ -530,12 +534,12 @@ _iavf_recv_raw_pkts_vec_avx2_flex_rxd(struct iavf_rx_queue *rxq, { #define IAVF_DESCS_PER_LOOP_AVX 8 - struct iavf_adapter *adapter = rxq->vsi->adapter; + struct iavf_adapter *adapter; #ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC - uint64_t offloads = adapter->dev_data->dev_conf.rxmode.offloads; + uint64_t offloads; #endif - const uint32_t *type_table = adapter->ptype_tbl; + const uint32_t *type_table; const __m256i mbuf_init = _mm256_set_epi64x(0, 0, 0, rxq->mbuf_initializer); @@ -543,6 +547,15 @@ _iavf_recv_raw_pkts_vec_avx2_flex_rxd(struct iavf_rx_queue *rxq, volatile union iavf_rx_flex_desc *rxdp = (union iavf_rx_flex_desc *)rxq->rx_ring + rxq->rx_tail; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + + adapter = rxq->vsi->adapter; +#ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC + offloads = adapter->dev_data->dev_conf.rxmode.offloads; +#endif + type_table = adapter->ptype_tbl; + rte_prefetch0(rxdp); /* nb_pkts has to be floor-aligned to IAVF_DESCS_PER_LOOP_AVX */ @@ -1774,6 +1787,9 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t flags = IAVF_TX_DESC_CMD_EOP | IAVF_TX_DESC_CMD_ICRC; uint64_t rs = IAVF_TX_DESC_CMD_RS | flags; + if (!txq->vsi || txq->vsi->adapter->no_poll) + return 0; + if (txq->nb_free < txq->free_thresh) iavf_tx_free_bufs(txq); @@ -1834,6 +1850,9 @@ iavf_xmit_pkts_vec_avx2_common(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_tx = 0; struct iavf_tx_queue *txq = (struct iavf_tx_queue *)tx_queue; + if (!txq->vsi || txq->vsi->adapter->no_poll) + return 0; + while (nb_pkts) { uint16_t ret, num; diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx512.c b/drivers/net/iavf/iavf_rxtx_vec_avx512.c index 3e66df5341..8de739434c 100644 --- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c +++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c @@ -45,7 +45,7 @@ _iavf_recv_raw_pkts_vec_avx512(struct iavf_rx_queue *rxq, bool offload) { #ifdef IAVF_RX_PTYPE_OFFLOAD - const uint32_t *type_table = rxq->vsi->adapter->ptype_tbl; + const uint32_t *type_table; #endif const __m256i mbuf_init = _mm256_set_epi64x(0, 0, 0, @@ -53,6 +53,13 @@ _iavf_recv_raw_pkts_vec_avx512(struct iavf_rx_queue *rxq, struct rte_mbuf **sw_ring = &rxq->sw_ring[rxq->rx_tail]; volatile union iavf_rx_desc *rxdp = rxq->rx_ring + rxq->rx_tail; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + +#ifdef IAVF_RX_PTYPE_OFFLOAD + type_table = rxq->vsi->adapter->ptype_tbl; +#endif + rte_prefetch0(rxdp); /* nb_pkts has to be floor-aligned to IAVF_DESCS_PER_LOOP_AVX */ @@ -588,12 +595,12 @@ _iavf_recv_raw_pkts_vec_avx512_flex_rxd(struct iavf_rx_queue *rxq, uint8_t *split_packet, bool offload) { - struct iavf_adapter *adapter = rxq->vsi->adapter; + struct iavf_adapter *adapter; #ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC - uint64_t offloads = adapter->dev_data->dev_conf.rxmode.offloads; + uint64_t offloads; #endif #ifdef IAVF_RX_PTYPE_OFFLOAD - const uint32_t *type_table = adapter->ptype_tbl; + const uint32_t *type_table; #endif const __m256i mbuf_init = _mm256_set_epi64x(0, 0, 0, @@ -602,6 +609,17 @@ _iavf_recv_raw_pkts_vec_avx512_flex_rxd(struct iavf_rx_queue *rxq, volatile union iavf_rx_flex_desc *rxdp = (union iavf_rx_flex_desc *)rxq->rx_ring + rxq->rx_tail; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + + adapter = rxq->vsi->adapter; +#ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC + offloads = adapter->dev_data->dev_conf.rxmode.offloads; +#endif +#ifdef IAVF_RX_PTYPE_OFFLOAD + type_table = adapter->ptype_tbl; +#endif + rte_prefetch0(rxdp); /* nb_pkts has to be floor-aligned to IAVF_DESCS_PER_LOOP_AVX */ @@ -1700,6 +1718,10 @@ iavf_recv_scattered_pkts_vec_avx512_cmn(void *rx_queue, struct rte_mbuf **rx_pkt uint16_t nb_pkts, bool offload) { uint16_t retval = 0; + struct iavf_rx_queue *rxq = rx_queue; + + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; while (nb_pkts > IAVF_VPMD_RX_MAX_BURST) { uint16_t burst = iavf_recv_scattered_burst_vec_avx512(rx_queue, @@ -2303,6 +2325,9 @@ iavf_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t flags = IAVF_TX_DESC_CMD_EOP | IAVF_TX_DESC_CMD_ICRC; uint64_t rs = IAVF_TX_DESC_CMD_RS | flags; + if (!txq->vsi || txq->vsi->adapter->no_poll) + return 0; + if (txq->nb_free < txq->free_thresh) iavf_tx_free_bufs_avx512(txq); @@ -2370,6 +2395,9 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t flags = IAVF_TX_DESC_CMD_EOP | IAVF_TX_DESC_CMD_ICRC; uint64_t rs = IAVF_TX_DESC_CMD_RS | flags; + if (!txq->vsi || txq->vsi->adapter->no_poll) + return 0; + if (txq->nb_free < txq->free_thresh) iavf_tx_free_bufs_avx512(txq); @@ -2432,6 +2460,9 @@ iavf_xmit_pkts_vec_avx512_cmn(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_tx = 0; struct iavf_tx_queue *txq = (struct iavf_tx_queue *)tx_queue; + if (!txq->vsi || txq->vsi->adapter->no_poll) + return 0; + while (nb_pkts) { uint16_t ret, num; @@ -2498,6 +2529,9 @@ iavf_xmit_pkts_vec_avx512_ctx_cmn(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_tx = 0; struct iavf_tx_queue *txq = (struct iavf_tx_queue *)tx_queue; + if (!txq->vsi || txq->vsi->adapter->no_poll) + return 0; + while (nb_pkts) { uint16_t ret, num; diff --git a/drivers/net/iavf/iavf_rxtx_vec_sse.c b/drivers/net/iavf/iavf_rxtx_vec_sse.c index 892bfa4cf3..4007ce6f6f 100644 --- a/drivers/net/iavf/iavf_rxtx_vec_sse.c +++ b/drivers/net/iavf/iavf_rxtx_vec_sse.c @@ -479,7 +479,12 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts, int pos; uint64_t var; __m128i shuf_msk; - const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; + const uint32_t *ptype_tbl; + + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + + ptype_tbl = rxq->vsi->adapter->ptype_tbl; __m128i crc_adjust = _mm_set_epi16( 0, 0, 0, /* ignore non-length fields */ @@ -1198,6 +1203,11 @@ uint16_t iavf_recv_pkts_vec_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { + struct iavf_rx_queue *rxq = rx_queue; + + if (!rxq->vsi) + return 0; + return _recv_raw_pkts_vec_flex_rxd(rx_queue, rx_pkts, nb_pkts, NULL); } @@ -1215,6 +1225,9 @@ iavf_recv_scattered_burst_vec(void *rx_queue, struct rte_mbuf **rx_pkts, uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST] = {0}; unsigned int i = 0; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + /* get some new buffers */ uint16_t nb_bufs = _recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts, split_flags); @@ -1284,6 +1297,9 @@ iavf_recv_scattered_burst_vec_flex_rxd(void *rx_queue, uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST] = {0}; unsigned int i = 0; + if (!rxq->vsi || rxq->vsi->adapter->no_poll) + return 0; + /* get some new buffers */ uint16_t nb_bufs = _recv_raw_pkts_vec_flex_rxd(rxq, rx_pkts, nb_pkts, split_flags); @@ -1437,6 +1453,9 @@ iavf_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_tx = 0; struct iavf_tx_queue *txq = (struct iavf_tx_queue *)tx_queue; + if (!txq->vsi || txq->vsi->adapter->no_poll) + return 0; + while (nb_pkts) { uint16_t ret, num; diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 524732f67d..80dfda5e11 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -263,6 +263,16 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len, if (!vf->link_up) iavf_dev_watchdog_enable(adapter); } + if (adapter->devargs.no_poll_on_link_down) { + if (vf->link_up && adapter->no_poll) { + adapter->no_poll = false; + PMD_DRV_LOG(DEBUG, "VF no poll turned off"); + } + if (!vf->link_up) { + adapter->no_poll = true; + PMD_DRV_LOG(DEBUG, "VF no poll turned on"); + } + } PMD_DRV_LOG(INFO, "Link status update:%s", vf->link_up ? "up" : "down"); break; @@ -465,6 +475,16 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg, if (!vf->link_up) iavf_dev_watchdog_enable(adapter); } + if (adapter->devargs.no_poll_on_link_down) { + if (vf->link_up && adapter->no_poll) { + adapter->no_poll = false; + PMD_DRV_LOG(DEBUG, "VF no poll turned off"); + } + if (!vf->link_up) { + adapter->no_poll = true; + PMD_DRV_LOG(DEBUG, "VF no poll turned on"); + } + } iavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_LSC, NULL, 0); break; case VIRTCHNL_EVENT_PF_DRIVER_CLOSE: -- 2.25.1