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 255A8A0521; Tue, 3 Nov 2020 09:29:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 08075C7EC; Tue, 3 Nov 2020 09:29:42 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 87285C748 for ; Tue, 3 Nov 2020 09:29:39 +0100 (CET) IronPort-SDR: g4gd0QxeGvhsJIuNQOuiSEuiPPi205fzXh0qPynTcFMHRX9nKdDC2zrXcoFP3DPoElgvsNXToQ mSiuhASMG9Pg== X-IronPort-AV: E=McAfee;i="6000,8403,9793"; a="169122321" X-IronPort-AV: E=Sophos;i="5.77,447,1596524400"; d="scan'208";a="169122321" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 00:29:38 -0800 IronPort-SDR: 7NhNGV8BxIjo8E6kZN8F+wVV/tRhs40tEft4QNVnqRiK7MuaOOTTCEQCoiVZ0TBeemtH9DKURL NtuF4VN9e5TA== X-IronPort-AV: E=Sophos;i="5.77,447,1596524400"; d="scan'208";a="470711365" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 00:29:36 -0800 From: Steve Yang To: dev@dpdk.org Cc: jia.guo@intel.com, haiyue.wang@intel.com, qiming.yang@intel.com, beilei.xing@intel.com, orika@nvidia.com, murphyx.yang@intel.com, Steve Yang Date: Tue, 3 Nov 2020 08:28:04 +0000 Message-Id: <20201103082809.41149-2-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201103082809.41149-1-stevex.yang@intel.com> References: <20201014084131.72035-1-simonx.lu@intel.com> <20201103082809.41149-1-stevex.yang@intel.com> Subject: [dpdk-dev] [RFC v2 1/6] net/i40e: add mirror rule config and 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" Define i40e_mirror_rule_conf structure that is used for set mirror flow rule to i40e register, and relocate the mirror related MACORs to header file. Signed-off-by: Steve Yang --- 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 f54769c29..b17c05eda 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -329,12 +329,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); @@ -1742,6 +1736,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); @@ -10223,7 +10220,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, @@ -10274,7 +10271,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 ea59a3e60..290a54daa 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1075,6 +1075,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; @@ -1145,6 +1169,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; @@ -1310,6 +1335,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, @@ -1460,6 +1486,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