From patchwork Mon Aug 10 02:41:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao1, Wei" X-Patchwork-Id: 75326 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 4E94EA04C1; Mon, 10 Aug 2020 05:08:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5CDCE2A5D; Mon, 10 Aug 2020 05:07:59 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id C82232142; Mon, 10 Aug 2020 05:07:57 +0200 (CEST) IronPort-SDR: jKLc7QI/IyZcrpj2YA8pmd8C0717kHbFgPZkxPECfwCTV1UdnpX9AygkVG1lKYRdTaZRv9Um2z NwxhcU025+ZA== X-IronPort-AV: E=McAfee;i="6000,8403,9708"; a="141333489" X-IronPort-AV: E=Sophos;i="5.75,456,1589266800"; d="scan'208";a="141333489" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2020 20:07:56 -0700 IronPort-SDR: py215iT90dJKNeYA3EvrFd+wuHJH9JTDcDJ9vmhgZ0B7Amr6YpLKAA5m6gzA9Q1WhhoEhxg/yV TH49yxsJt6OQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,456,1589266800"; d="scan'208";a="468890109" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([172.16.182.123]) by orsmga005.jf.intel.com with ESMTP; 09 Aug 2020 20:07:54 -0700 From: Wei Zhao To: dev@dpdk.org Cc: stable@dpdk.org, qi.z.zhang@intel.com, nannan.lu@intel.com, Wei Zhao Date: Mon, 10 Aug 2020 10:41:23 +0800 Message-Id: <20200810024123.23387-1-wei.zhao1@intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] 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. Fixes: 829c3106812d ("net/ice: enable switch flow on DCF") Cc: stable@dpdk.org Signed-off-by: Wei Zhao --- drivers/net/ice/ice_switch_filter.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index c4b00b6a2..e7e03d96b 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; @@ -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;