From patchwork Wed Aug 12 00:56:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao1, Wei" X-Patchwork-Id: 75443 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E9102A04E4; Wed, 12 Aug 2020 03:23:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D8AB41C0B4; Wed, 12 Aug 2020 03:23:51 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 1F0941C022; Wed, 12 Aug 2020 03:23:49 +0200 (CEST) IronPort-SDR: g8qjaGHs1SyNEEvkwukv/lOlSlunCsw0JyjM2uvBlTEtnJExDScdLOpk9nIEAfhqQkm978DRQ2 XPvio7x2tSKA== X-IronPort-AV: E=McAfee;i="6000,8403,9710"; a="238704449" X-IronPort-AV: E=Sophos;i="5.76,302,1592895600"; d="scan'208";a="238704449" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2020 18:23:49 -0700 IronPort-SDR: JhbypZxfsw/GpeLzSrrNImtW2HhoDyEuvSbWL2nTTLXSLnA3Bz1vK88le99Xzow5sR+/mDDK4H N0/vN/UY+0IQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,302,1592895600"; d="scan'208";a="327034317" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([172.16.182.123]) by fmsmga002.fm.intel.com with ESMTP; 11 Aug 2020 18:23:47 -0700 From: Wei Zhao To: dev@dpdk.org Cc: stable@dpdk.org, qi.z.zhang@intel.com, nannan.lu@intel.com, Wei Zhao Date: Wed, 12 Aug 2020 08:56:46 +0800 Message-Id: <20200812005646.58732-1-wei.zhao1@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200810024123.23387-1-wei.zhao1@intel.com> References: <20200810024123.23387-1-wei.zhao1@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2] net/ice: fix VF index check for DCF 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" The vf index in rte_flow command need to check in order that larger the actual number. Also change some error log for wrong action. Fixes: 829c3106812d ("net/ice: enable switch flow on DCF") Cc: stable@dpdk.org Signed-off-by: Wei Zhao Tested-by: Nannan Lu --- v2: change error log --- drivers/net/ice/ice_switch_filter.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index c4b00b6a2..0e0267c04 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1405,6 +1405,16 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad, case RTE_FLOW_ACTION_TYPE_VF: rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI; act_vf = action->conf; + + if (act_vf->id >= ad->real_hw.num_vfs && + !act_vf->original) { + rte_flow_error_set(error, + EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, + actions, + "Invalid vf id"); + return -rte_errno; + } + if (act_vf->original) rule_info->sw_act.vsi_handle = ad->real_hw.avf.bus.func; @@ -1415,7 +1425,7 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad, rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, actions, - "Invalid action type or queue number"); + "Invalid action type"); return -rte_errno; } } @@ -1667,12 +1677,8 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad, else ret = ice_switch_parse_action(pf, actions, error, &rule_info); - if (ret) { - rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_HANDLE, NULL, - "Invalid input action"); + if (ret) goto error; - } if (meta) { *meta = sw_meta_ptr;