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 E9415A0562; Tue, 31 Mar 2020 04:49:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A1B031C05C; Tue, 31 Mar 2020 04:49:26 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id ECEBE2B8B for ; Tue, 31 Mar 2020 04:49:23 +0200 (CEST) IronPort-SDR: gz6gxH3NuQW8snwhDgAaO2ihalXtXZbTMxWj6r3rG2Z1Ht9KtxhYMbpVOw8MuMNdW5yY/OGrzK IFYPPnoMdcQw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2020 19:49:22 -0700 IronPort-SDR: TOkFCUqUk1vvxDCqXyGWJxto9Ig8C8xOWRWF8PZ8yI/8mqsjqIRMm2ZsOcLh3r9S+4yHsmSkqn xZOg6nQl07yg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,326,1580803200"; d="scan'208";a="422146859" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by orsmga005.jf.intel.com with ESMTP; 30 Mar 2020 19:49:20 -0700 Date: Tue, 31 Mar 2020 10:45:56 +0800 From: Ye Xiaolong To: Beilei Xing Cc: dev@dpdk.org, haiyue.wang@intel.com, qiming.yang@intel.com, qi.z.zhang@intel.com Message-ID: <20200331024556.GG29805@intel.com> References: <1585586271-9296-1-git-send-email-beilei.xing@intel.com> <1585589933-4247-1-git-send-email-beilei.xing@intel.com> <1585589933-4247-2-git-send-email-beilei.xing@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1585589933-4247-2-git-send-email-beilei.xing@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2 1/2] net/ice: support flow redirect function 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" On 03/31, Beilei Xing wrote: >Add a new ops "redirect" to flow engine, it's used to implement the >function that redirect a flow's destination. Currently only support >VSI-Redirect which will be used by DCF for handling VF-VSI mapping >table change. >A new API "ice_flow_redirect" is exposed, current usage is: it could >be called when there's VF-VSI mapping table change caused by VF reset. > >Signed-off-by: Beilei Xing >Signed-off-by: Qi Zhang >--- > drivers/net/ice/ice_generic_flow.c | 22 ++++++++++++++++++++++ > drivers/net/ice/ice_generic_flow.h | 21 +++++++++++++++++++++ > 2 files changed, 43 insertions(+) > >diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c >index a1648ee..823ff0e 100644 >--- a/drivers/net/ice/ice_generic_flow.c >+++ b/drivers/net/ice/ice_generic_flow.c >@@ -1961,3 +1961,25 @@ ice_flow_query(struct rte_eth_dev *dev, > } > return ret; > } >+ >+int >+ice_flow_redirect(struct ice_adapter *ad, >+ struct ice_flow_redirect *rd) No need to split into 2 lines. >+{ >+ struct ice_pf *pf = &ad->pf; >+ struct rte_flow *p_flow; >+ void *temp; >+ int ret; >+ >+ TAILQ_FOREACH_SAFE(p_flow, &pf->flow_list, node, temp) { >+ if (!p_flow->engine->redirect) >+ continue; >+ ret = p_flow->engine->redirect(ad, p_flow, rd); >+ if (ret) { >+ PMD_DRV_LOG(ERR, "Failed to redirect flows"); >+ return ret; >+ } >+ } >+ >+ return 0; >+} >diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h >index adc30ee..ede6ec8 100644 >--- a/drivers/net/ice/ice_generic_flow.h >+++ b/drivers/net/ice/ice_generic_flow.h >@@ -417,6 +417,20 @@ struct ice_pattern_match_item { > void *meta; > }; > >+enum ice_flow_redirect_type { >+ ICE_FLOW_REDIRECT_VSI, >+}; >+ >+struct ice_flow_redirect { >+ enum ice_flow_redirect_type type; >+ union { >+ struct { >+ uint16_t vsi_handle; >+ uint16_t new_vsi_num; >+ }; >+ }; >+}; >+ > typedef int (*engine_init_t)(struct ice_adapter *ad); > typedef void (*engine_uninit_t)(struct ice_adapter *ad); > typedef int (*engine_create_t)(struct ice_adapter *ad, >@@ -430,6 +444,9 @@ typedef int (*engine_query_t)(struct ice_adapter *ad, > struct rte_flow *flow, > struct rte_flow_query_count *count, > struct rte_flow_error *error); >+typedef int(*engine_redirect_t)(struct ice_adapter *ad, >+ struct rte_flow *flow, >+ struct ice_flow_redirect *redirect); > typedef void (*engine_free_t) (struct rte_flow *flow); > typedef int (*parse_pattern_action_t)(struct ice_adapter *ad, > struct ice_pattern_match_item *array, >@@ -447,6 +464,7 @@ struct ice_flow_engine { > engine_create_t create; > engine_destroy_t destroy; > engine_query_t query_count; >+ engine_redirect_t redirect; > engine_free_t free; > enum ice_flow_engine_type type; > }; >@@ -485,4 +503,7 @@ ice_search_pattern_match_item(const struct rte_flow_item pattern[], > struct ice_pattern_match_item *array, > uint32_t array_len, > struct rte_flow_error *error); >+int >+ice_flow_redirect(struct ice_adapter *ad, >+ struct ice_flow_redirect *rd); Ditto > #endif >-- >2.7.4 > Applied to next-net-intel with above fixes.