From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 02FFBA0577; Tue, 14 Apr 2020 08:26:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 74F551C126; Tue, 14 Apr 2020 08:25:26 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 105701C10C for ; Tue, 14 Apr 2020 08:25:23 +0200 (CEST) IronPort-SDR: OcfeTQCFd0Zr2/pTnJcCEKWIadwsAWxFG8ygQR89om/0RCh7flTxuDtVAwRooMG5tQgLVks/HO t7K4kzCCdQfA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2020 23:25:23 -0700 IronPort-SDR: 9eNZZ+eYnAXJoqbINdqcCJaAd4u0vEjLqpwk4j51dPLoLRQKCkWH1KBRMn2ihcU3TmX7SCsTm/ AjCvnesLisjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,381,1580803200"; d="scan'208";a="426956345" Received: from dpdk-lrong-srv-04.sh.intel.com ([10.67.119.221]) by orsmga005.jf.intel.com with ESMTP; 13 Apr 2020 23:25:22 -0700 From: Leyi Rong To: jingjing.wu@intel.com, qi.z.zhang@intel.com, beilei.xing@intel.com, xiaolong.ye@intel.com Cc: dev@dpdk.org, Leyi Rong Date: Tue, 14 Apr 2020 14:15:12 +0800 Message-Id: <20200414061517.86124-7-leyi.rong@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200414061517.86124-1-leyi.rong@intel.com> References: <20200316074603.10998-1-leyi.rong@intel.com> <20200414061517.86124-1-leyi.rong@intel.com> Subject: [dpdk-dev] [PATCH v4 06/11] net/iavf: add flow director enabled switch value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The commit adds fdir_enabled flag into iavf_rx_queue structure to identify if fdir id is active. Rx data path can be benefit if fdir id parsing is not needed, especially in vector path. Signed-off-by: Leyi Rong --- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_rxtx.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index fdb31b929..17ceff734 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -144,6 +144,7 @@ struct iavf_adapter { bool tx_vec_allowed; const uint32_t *ptype_tbl; bool stopped; + uint16_t fdir_ref_cnt; }; /* IAVF_DEV_PRIVATE_TO */ diff --git a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h index 290dd68c1..dd5544ee2 100644 --- a/drivers/net/iavf/iavf_rxtx.h +++ b/drivers/net/iavf/iavf_rxtx.h @@ -103,6 +103,7 @@ struct iavf_rx_queue { uint16_t port_id; /* device port ID */ uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */ + uint8_t fdir_enabled; /* 0 if FDIR disabled, 1 when enabled */ uint16_t queue_id; /* Rx queue index */ uint16_t rx_buf_len; /* The packet buffer size */ uint16_t rx_hdr_len; /* The header buffer size */ @@ -490,6 +491,35 @@ void iavf_dump_tx_descriptor(const struct iavf_tx_queue *txq, tx_desc->cmd_type_offset_bsz); } +#define FDIR_PROC_ENABLE_PER_QUEUE(ad, on) do { \ + int i; \ + for (i = 0; i < (ad)->eth_dev->data->nb_rx_queues; i++) { \ + struct iavf_rx_queue *rxq = (ad)->eth_dev->data->rx_queues[i]; \ + if (!rxq) \ + continue; \ + rxq->fdir_enabled = on; \ + } \ + PMD_DRV_LOG(DEBUG, "FDIR processing on RX set to %d", on); \ +} while (0) + +/* Enable/disable flow director Rx processing in data path. */ +static inline +void iavf_fdir_rx_proc_enable(struct iavf_adapter *ad, bool on) +{ + if (on) { + /* enable flow director processing */ + if (ad->fdir_ref_cnt++ == 0) + FDIR_PROC_ENABLE_PER_QUEUE(ad, on); + } else { + if (ad->fdir_ref_cnt >= 1) { + ad->fdir_ref_cnt--; + + if (ad->fdir_ref_cnt == 0) + FDIR_PROC_ENABLE_PER_QUEUE(ad, on); + } + } +} + #ifdef RTE_LIBRTE_IAVF_DEBUG_DUMP_DESC #define IAVF_DUMP_RX_DESC(rxq, desc, rx_id) \ iavf_dump_rx_descriptor(rxq, desc, rx_id) -- 2.17.1