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 6B275A04B9; Mon, 7 Sep 2020 11:26:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D93781C0DC; Mon, 7 Sep 2020 11:26:39 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0278D1C0CA for ; Mon, 7 Sep 2020 11:26:37 +0200 (CEST) IronPort-SDR: svIMmD6mNtmfXuj20G3n+EMSA9hxL8jeg6L8Akb8dc+6CyKg8Mn8rSNV+ZE2Egiz9aFw4XrdJT G/aDSFTNkufw== X-IronPort-AV: E=McAfee;i="6000,8403,9736"; a="157241152" X-IronPort-AV: E=Sophos;i="5.76,401,1592895600"; d="scan'208";a="157241152" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2020 02:26:37 -0700 IronPort-SDR: YyFMpUm8XrpdlPCs6yVW/IDkzMuh6eMy+JwszLDPMnQXm0Y4mgYn2ZEvG6JOY8qtJGT9a+eIO+ 9cMc2PY+akaA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,401,1592895600"; d="scan'208";a="406783293" Received: from unknown (HELO intel.sh.intel.com) ([10.239.255.60]) by fmsmga001.fm.intel.com with ESMTP; 07 Sep 2020 02:26:35 -0700 From: Junyu Jiang To: dev@dpdk.org Cc: Qi Zhang , Qiming Yang , Guinan Sun Date: Mon, 7 Sep 2020 09:17:08 +0000 Message-Id: <20200907091711.5980-3-junyux.jiang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200907091711.5980-1-junyux.jiang@intel.com> References: <20200826075501.50052-1-guinanx.sun@intel.com> <20200907091711.5980-1-junyux.jiang@intel.com> Subject: [dpdk-dev] [PATCH v2 2/5] net/ice: 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" From: Guinan Sun The commit adds fdir_enabled flag into ice_adapter 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: Guinan Sun --- drivers/net/ice/ice_ethdev.h | 2 ++ drivers/net/ice/ice_fdir_filter.c | 9 ++++++++- drivers/net/ice/ice_rxtx.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 393dfeab1..df0d65d8d 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -285,6 +285,7 @@ struct ice_fdir_filter_conf { struct rte_flow_action_count act_count; uint64_t input_set; + uint32_t mark_flag; }; #define ICE_MAX_FDIR_FILTER_NUM (1024 * 16) @@ -464,6 +465,7 @@ struct ice_adapter { bool is_safe_mode; struct ice_devargs devargs; enum ice_pkg_type active_pkg_type; /* loaded ddp package type */ + uint16_t fdir_ref_cnt; }; struct ice_vsi_vlan_pvid_info { diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 745d7291a..e496c4d0a 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -1329,6 +1329,9 @@ ice_fdir_create_filter(struct ice_adapter *ad, goto free_counter; } + if (filter->mark_flag == 1) + ice_fdir_rx_proc_enable(ad, 1); + rte_memcpy(entry, filter, sizeof(*entry)); ret = ice_fdir_entry_insert(pf, entry, &key); if (ret) { @@ -1401,6 +1404,10 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, } ice_fdir_cnt_update(pf, filter->input.flow_type, is_tun, false); + + if (filter->mark_flag == 1) + ice_fdir_rx_proc_enable(ad, 0); + flow->rule = NULL; rte_free(filter); @@ -1573,7 +1580,7 @@ ice_fdir_parse_action(struct ice_adapter *ad, break; case RTE_FLOW_ACTION_TYPE_MARK: mark_num++; - + filter->mark_flag = 1; mark_spec = actions->conf; filter->input.fltr_id = mark_spec->id; filter->input.fdid_prio = ICE_FXD_FLTR_QW1_FDID_PRI_ONE; diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index e21ba152d..69d6e0b8b 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -70,6 +70,7 @@ struct ice_rx_queue { uint8_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 reg_idx; /* RX queue register index */ uint8_t drop_en; /* if not 0, set register bit */ @@ -245,4 +246,33 @@ uint16_t ice_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, int ice_fdir_programming(struct ice_pf *pf, struct ice_fltr_desc *fdir_desc); int ice_tx_done_cleanup(void *txq, uint32_t free_cnt); +#define FDIR_PROC_ENABLE_PER_QUEUE(ad, on) do { \ + int i; \ + for (i = 0; i < (ad)->eth_dev->data->nb_rx_queues; i++) { \ + struct ice_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 ice_fdir_rx_proc_enable(struct ice_adapter *ad, bool on) +{ + if (on) { + /* enable flow director processing */ + FDIR_PROC_ENABLE_PER_QUEUE(ad, on); + ad->fdir_ref_cnt++; + } else { + if (ad->fdir_ref_cnt >= 1) { + ad->fdir_ref_cnt--; + + if (ad->fdir_ref_cnt == 0) + FDIR_PROC_ENABLE_PER_QUEUE(ad, on); + } + } +} + #endif /* _ICE_RXTX_H_ */ -- 2.17.1