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 7CA22A04B7; Wed, 14 Oct 2020 10:45:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6AFF51DD25; Wed, 14 Oct 2020 10:43:29 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 283B61DD2A for ; Wed, 14 Oct 2020 10:43:25 +0200 (CEST) IronPort-SDR: s3MQtb7c6u5AnX0yaEULYZSbLdu4EuGyIiKAyXF0kWwTVGgWYBVRUFLw6jaBQ84LYRpPbE0kX/ 63+bSMitedaQ== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="163432234" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="163432234" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 01:43:25 -0700 IronPort-SDR: 2uuTz/Sq4mlcwJe5X49TEbBaRGjEl2BABkVetDGjQfKQEEKUiVpSHx7iYMu8Jc9SeoBiWcd3zM oCUM/6bBaHFg== X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="299864587" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 01:43:22 -0700 From: SimonX Lu To: dev@dpdk.org Cc: jia.guo@intel.com, haiyue.wang@intel.com, qiming.yang@intel.com, beilei.xing@intel.com, orika@nvidia.com, Simon Lu Date: Wed, 14 Oct 2020 08:41:29 +0000 Message-Id: <20201014084131.72035-7-simonx.lu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201014084131.72035-1-simonx.lu@intel.com> References: <20201014084131.72035-1-simonx.lu@intel.com> Subject: [dpdk-dev] [PATCH v1 6/8] net/i40e: add mirror rule config and export add/del rule APIs 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: Simon Lu define i40e_mirror_rule_conf structure that is used for set mirror flow rule to i40e register, and export add/del mirror rule APIs. Signed-off-by: Simon Lu --- drivers/net/i40e/i40e_ethdev.c | 13 +++++-------- drivers/net/i40e/i40e_ethdev.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 943cfe71d..472a642b9 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -332,12 +332,6 @@ static int i40e_dev_sync_phy_type(struct i40e_hw *hw); static void i40e_configure_registers(struct i40e_hw *hw); static void i40e_hw_init(struct rte_eth_dev *dev); static int i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi); -static enum i40e_status_code i40e_aq_del_mirror_rule(struct i40e_hw *hw, - uint16_t seid, - uint16_t rule_type, - uint16_t *entries, - uint16_t count, - uint16_t rule_id); static int i40e_mirror_rule_set(struct rte_eth_dev *dev, struct rte_eth_mirror_conf *mirror_conf, uint8_t sw_id, uint8_t on); @@ -1744,6 +1738,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) /* initialize RSS rule list */ TAILQ_INIT(&pf->rss_config_list); + /* initialize mirror filter list */ + TAILQ_INIT(&pf->mirror_filter_list); + /* initialize Traffic Manager configuration */ i40e_tm_conf_init(dev); @@ -10993,7 +10990,7 @@ i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi) * Add a mirror rule for a given veb. * **/ -static enum i40e_status_code +enum i40e_status_code i40e_aq_add_mirror_rule(struct i40e_hw *hw, uint16_t seid, uint16_t dst_id, uint16_t rule_type, uint16_t *entries, @@ -11044,7 +11041,7 @@ i40e_aq_add_mirror_rule(struct i40e_hw *hw, * Delete a mirror rule for a given veb. * **/ -static enum i40e_status_code +enum i40e_status_code i40e_aq_del_mirror_rule(struct i40e_hw *hw, uint16_t seid, uint16_t rule_type, uint16_t *entries, uint16_t count, uint16_t rule_id) diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 1466998aa..95c2b4e2c 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1065,6 +1065,30 @@ struct i40e_rss_filter { struct i40e_rte_flow_rss_conf rss_filter_info; }; +/** + * Mirror rule configuration + */ +struct i40e_mirror_rule_conf { + uint8_t rule_type; + uint16_t rule_id; /* the rule id assigned by firmware */ + uint16_t dst_vsi_seid; /* destination vsi for this mirror rule. */ + uint16_t num_entries; + /** + * the info stores depend on the rule type. + * If type is I40E_MIRROR_TYPE_VLAN, vlan ids are stored here. + * If type is I40E_MIRROR_TYPE_VPORT_*, vsi's seid are stored. + */ + uint16_t entries[I40E_MIRROR_MAX_ENTRIES_PER_RULE]; +}; + +TAILQ_HEAD(i40e_mirror_filter_list, i40e_mirror_filter); + +/* Mirror rule list structure */ +struct i40e_mirror_filter { + TAILQ_ENTRY(i40e_mirror_filter) next; + struct i40e_mirror_rule_conf conf; +}; + struct i40e_vf_msg_cfg { /* maximal VF message during a statistic period */ uint32_t max_msg; @@ -1135,6 +1159,7 @@ struct i40e_pf { struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */ struct i40e_rte_flow_rss_conf rss_info; /* RSS info */ struct i40e_rss_conf_list rss_config_list; /* RSS rule list */ + struct i40e_mirror_filter_list mirror_filter_list; struct i40e_queue_regions queue_region; /* queue region info */ struct i40e_fc_conf fc_conf; /* Flow control conf */ struct i40e_mirror_rule_list mirror_list; @@ -1299,6 +1324,7 @@ union i40e_filter_t { struct rte_eth_tunnel_filter_conf tunnel_filter; struct i40e_tunnel_filter_conf consistent_tunnel_filter; struct i40e_rte_flow_rss_conf rss_conf; + struct i40e_mirror_rule_conf mirror_conf; }; typedef int (*parse_filter_t)(struct rte_eth_dev *dev, @@ -1457,6 +1483,14 @@ int i40e_config_rss_filter(struct i40e_pf *pf, int i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params); int i40e_vf_representor_uninit(struct rte_eth_dev *ethdev); +enum i40e_status_code i40e_aq_add_mirror_rule(struct i40e_hw *hw, + uint16_t seid, uint16_t dst_id, + uint16_t rule_type, uint16_t *entries, + uint16_t count, uint16_t *rule_id); +enum i40e_status_code i40e_aq_del_mirror_rule(struct i40e_hw *hw, + uint16_t seid, uint16_t rule_type, uint16_t *entries, + uint16_t count, uint16_t rule_id); + #define I40E_DEV_TO_PCI(eth_dev) \ RTE_DEV_TO_PCI((eth_dev)->device) -- 2.17.1