From patchwork Thu Jul 18 01:38:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Wang X-Patchwork-Id: 56664 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0AD8E2BD5; Thu, 18 Jul 2019 03:53:27 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 5F95F2BD5; Thu, 18 Jul 2019 03:53:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 18:53:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,276,1559545200"; d="scan'208";a="319498117" Received: from npg-dpdk-cvl-yingwang-117d94.sh.intel.com ([10.67.117.94]) by orsmga004.jf.intel.com with ESMTP; 17 Jul 2019 18:53:22 -0700 From: Wang Ying A To: qi.z.zhang@intel.com Cc: qiming.yang@intel.com, dev@dpdk.org, ying.a.wang@intel.com, stable@dpdk.org Date: Thu, 18 Jul 2019 09:38:41 +0800 Message-Id: <1563413923-404004-2-git-send-email-ying.a.wang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1563413923-404004-1-git-send-email-ying.a.wang@intel.com> References: <1563413923-404004-1-git-send-email-ying.a.wang@intel.com> Subject: [dpdk-dev] [PATCH 1/3] net/ice: fix flow get inputset check 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" ice_get_flow_field should not set error if item->type is RTE_FLOW_ITEM_TYPE_VOID. This patch fixes this issue. Fixes: d76116a4678f ("net/ice: add generic flow API") Cc: stable@dpdk.org Signed-off-by: Wang Ying A Signed-off-by: Wang Ying A Acked-by: Qi Zhang --- drivers/net/ice/ice_generic_flow.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index c2931a1..464f6ec 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -465,7 +465,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[], case RTE_FLOW_ITEM_TYPE_NVGRE: nvgre_spec = item->spec; nvgre_mask = item->mask; - /* Check if VXLAN item is used to describe protocol. + /* Check if NVGRE item is used to describe protocol. * If yes, both spec and mask should be NULL. * If no, both spec and mask shouldn't be NULL. */ @@ -480,6 +480,8 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[], is_tunnel = 1; break; + case RTE_FLOW_ITEM_TYPE_VOID: + break; default: rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, From patchwork Thu Jul 18 01:38:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Wang X-Patchwork-Id: 56666 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 736575B3C; Thu, 18 Jul 2019 03:53:30 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id D99502BAB; Thu, 18 Jul 2019 03:53:28 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 18:53:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,276,1559545200"; d="scan'208";a="319498125" Received: from npg-dpdk-cvl-yingwang-117d94.sh.intel.com ([10.67.117.94]) by orsmga004.jf.intel.com with ESMTP; 17 Jul 2019 18:53:26 -0700 From: Wang Ying A To: qi.z.zhang@intel.com Cc: qiming.yang@intel.com, dev@dpdk.org, ying.a.wang@intel.com, stable@dpdk.org Date: Thu, 18 Jul 2019 09:38:42 +0800 Message-Id: <1563413923-404004-3-git-send-email-ying.a.wang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1563413923-404004-1-git-send-email-ying.a.wang@intel.com> References: <1563413923-404004-1-git-send-email-ying.a.wang@intel.com> Subject: [dpdk-dev] [PATCH 2/3] net/ice: fix flow action validation 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" Action is a list. We should check each element of the action rather than the first one. This patch fixes this issue. Fixes: d76116a4678f ("net/ice: add generic flow API") Cc: stable@dpdk.org Signed-off-by: Wang Ying A Signed-off-by: Wang Ying A Signed-off-by: Wang Ying A Acked-by: Qiming Yang Reviewed-by: Xiaolong Ye --- drivers/net/ice/ice_generic_flow.c | 39 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 464f6ec..2c57276 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -517,28 +517,31 @@ static int ice_flow_valid_action(struct rte_eth_dev *dev, { const struct rte_flow_action_queue *act_q; uint16_t queue; - - switch (actions->type) { - case RTE_FLOW_ACTION_TYPE_QUEUE: - act_q = actions->conf; - queue = act_q->index; - if (queue >= dev->data->nb_rx_queues) { + const struct rte_flow_action *action; + for (action = actions; action->type != + RTE_FLOW_ACTION_TYPE_END; action++) { + switch (action->type) { + case RTE_FLOW_ACTION_TYPE_QUEUE: + act_q = action->conf; + queue = act_q->index; + if (queue >= dev->data->nb_rx_queues) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + actions, "Invalid queue ID for" + " switch filter."); + return -rte_errno; + } + break; + case RTE_FLOW_ACTION_TYPE_DROP: + case RTE_FLOW_ACTION_TYPE_VOID: + break; + default: rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - actions, "Invalid queue ID for" - " switch filter."); + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "Invalid action."); return -rte_errno; } - break; - case RTE_FLOW_ACTION_TYPE_DROP: - break; - default: - rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, actions, - "Invalid action."); - return -rte_errno; } - return 0; } From patchwork Thu Jul 18 01:38:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Wang X-Patchwork-Id: 56667 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D446C2BAB; Thu, 18 Jul 2019 03:53:34 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 9504D2BAB; Thu, 18 Jul 2019 03:53:32 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 18:53:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,276,1559545200"; d="scan'208";a="319498133" Received: from npg-dpdk-cvl-yingwang-117d94.sh.intel.com ([10.67.117.94]) by orsmga004.jf.intel.com with ESMTP; 17 Jul 2019 18:53:29 -0700 From: Wang Ying A To: qi.z.zhang@intel.com Cc: qiming.yang@intel.com, dev@dpdk.org, ying.a.wang@intel.com, stable@dpdk.org Date: Thu, 18 Jul 2019 09:38:43 +0800 Message-Id: <1563413923-404004-4-git-send-email-ying.a.wang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1563413923-404004-1-git-send-email-ying.a.wang@intel.com> References: <1563413923-404004-1-git-send-email-ying.a.wang@intel.com> Subject: [dpdk-dev] [PATCH 3/3] net/ice: add flow ipv6 tc support 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" When set flow ipv6 tc rule, ice_get_flow_field will set error. This patch fixes this issue. Fixes: d76116a4678f ("net/ice: add generic flow API") Cc: stable@dpdk.org Signed-off-by: Wang Ying A Signed-off-by: Wang Ying A --- drivers/net/ice/ice_generic_flow.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 2c57276..5725bff 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -282,8 +282,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[], if (!(ipv6_spec && ipv6_mask)) break; - if (ipv6_mask->hdr.payload_len || - ipv6_mask->hdr.vtc_flow) { + if (ipv6_mask->hdr.payload_len) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -317,6 +316,11 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[], input_set |= ICE_INSET_IPV6_PROTO; if (ipv6_mask->hdr.hop_limits == UINT8_MAX) input_set |= ICE_INSET_IPV6_HOP_LIMIT; + if ((ipv6_mask->hdr.vtc_flow & + rte_cpu_to_be_32(RTE_IPV6_HDR_TC_MASK)) + == rte_cpu_to_be_32 + (RTE_IPV6_HDR_TC_MASK)) + input_set |= ICE_INSET_IPV6_TOS; } break; @@ -486,7 +490,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[], rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, - "Invalid mask no exist"); + "Invalid pattern"); break; } }