From patchwork Thu Nov 7 07:34:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simei Su X-Patchwork-Id: 62631 X-Patchwork-Delegate: xiaolong.ye@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 F201AA034E; Thu, 7 Nov 2019 08:34:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A7FC41E91A; Thu, 7 Nov 2019 08:34:50 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 2780F1E916 for ; Thu, 7 Nov 2019 08:34:48 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2019 23:34:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,277,1569308400"; d="scan'208";a="212961948" Received: from npg-dpdk-cvl-simeisu-118d193.sh.intel.com ([10.67.110.183]) by fmsmga001.fm.intel.com with ESMTP; 06 Nov 2019 23:34:46 -0800 From: Simei Su To: qi.z.zhang@intel.com, xiaolong.ye@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, simei.su@intel.com Date: Thu, 7 Nov 2019 15:34:43 +0800 Message-Id: <1573112083-36798-1-git-send-email-simei.su@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/ice: add error cases with a wrong package 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" If the switch/fdir/hash module can't resolve a correct parser, it should return error. Fixes: 47d460d63233 ("net/ice: rework switch filter") Fixes: efc16c621415 ("net/ice: support flow director GTPU tunnel") Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS") Signed-off-by: Simei Su Acked-by: Qi Zhang Acked-by: Xiaolong Ye --- drivers/net/ice/ice_fdir_filter.c | 4 +++- drivers/net/ice/ice_hash.c | 2 ++ drivers/net/ice/ice_switch_filter.c | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index fbbc41f..baaa7fa 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -863,8 +863,10 @@ if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) parser = &ice_fdir_parser_comms; - else + else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT) parser = &ice_fdir_parser_os; + else + return -EINVAL; return ice_register_parser(parser, ad); } diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index 3381b45..8dc3146 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -242,6 +242,8 @@ struct ice_hash_match_type ice_hash_type_list[] = { parser = &ice_hash_parser_os; else if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) parser = &ice_hash_parser_comms; + else + return -EINVAL; return ice_register_parser(parser, ad); } diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 4be87c2..2406102 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1122,8 +1122,10 @@ struct sw_meta { if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) dist_parser = &ice_switch_dist_parser_comms; - else + else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT) dist_parser = &ice_switch_dist_parser_os; + else + return -EINVAL; if (ad->devargs.pipe_mode_support) ret = ice_register_parser(perm_parser, ad);