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 CE8C5A04A5; Wed, 17 Jun 2020 08:39:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 88DF11BE85; Wed, 17 Jun 2020 08:39:16 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 530254F9C; Wed, 17 Jun 2020 08:39:12 +0200 (CEST) IronPort-SDR: GYl+Js9fuque6U0/OXWCUVC73f9mJ3hMHO116jNTcWHkcCUHW9CSvYwjLUpOSnMDvVtzWiSonx c+zswxKoQ9fw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 23:39:12 -0700 IronPort-SDR: 9Wepwvcn3bXalWsnBxpcw1+sKIh+qUCM34c6nuI+0EQhg6i966DvBNBlF8i88Nx99xJAPbPxYq sTOloKHf5Arg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,521,1583222400"; d="scan'208";a="450130154" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([172.16.182.123]) by orsmga005.jf.intel.com with ESMTP; 16 Jun 2020 23:39:10 -0700 From: Wei Zhao To: dev@dpdk.org Cc: stable@dpdk.org, qi.z.zhang@intel.com, Wei Zhao Date: Wed, 17 Jun 2020 14:14:27 +0800 Message-Id: <20200617061429.6447-3-wei.zhao1@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200617061429.6447-1-wei.zhao1@intel.com> References: <20200605074031.16231-1-wei.zhao1@intel.com> <20200617061429.6447-1-wei.zhao1@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/4] net/ice: add redirect support for VSI list rule 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" This patch enable redirect switch rule of vsi list type. Fixes: 397b4b3c5095 ("net/ice: enable flow redirect on switch") Cc: stable@dpdk.org Signed-off-by: Wei Zhao --- drivers/net/ice/ice_switch_filter.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index a5dd1f7ab..3c0c36bce 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1662,6 +1662,9 @@ ice_switch_redirect(struct ice_adapter *ad, uint16_t lkups_cnt; int ret; + if (rdata->vsi_handle != rd->vsi_handle) + return 0; + sw = hw->switch_info; if (!sw->recp_list[rdata->rid].recp_created) return -EINVAL; @@ -1673,25 +1676,32 @@ ice_switch_redirect(struct ice_adapter *ad, LIST_FOR_EACH_ENTRY(list_itr, list_head, ice_adv_fltr_mgmt_list_entry, list_entry) { rinfo = list_itr->rule_info; - if (rinfo.fltr_rule_id == rdata->rule_id && + if ((rinfo.fltr_rule_id == rdata->rule_id && rinfo.sw_act.fltr_act == ICE_FWD_TO_VSI && - rinfo.sw_act.vsi_handle == rd->vsi_handle) { + rinfo.sw_act.vsi_handle == rd->vsi_handle) || + (rinfo.fltr_rule_id == rdata->rule_id && + rinfo.sw_act.fltr_act == ICE_FWD_TO_VSI_LIST)){ lkups_cnt = list_itr->lkups_cnt; lkups_dp = (struct ice_adv_lkup_elem *) ice_memdup(hw, list_itr->lkups, sizeof(*list_itr->lkups) * lkups_cnt, ICE_NONDMA_TO_NONDMA); + if (!lkups_dp) { PMD_DRV_LOG(ERR, "Failed to allocate memory."); return -EINVAL; } + if (rinfo.sw_act.fltr_act == ICE_FWD_TO_VSI_LIST) { + rinfo.sw_act.vsi_handle = rd->vsi_handle; + rinfo.sw_act.fltr_act = ICE_FWD_TO_VSI; + } break; } } if (!lkups_dp) - return 0; + return -EINVAL; /* Remove the old rule */ ret = ice_rem_adv_rule(hw, list_itr->lkups, -- 2.19.1