From patchwork Mon Oct 9 14:44:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?N=C3=A9lio_Laranjeiro?= X-Patchwork-Id: 29978 X-Patchwork-Delegate: ferruh.yigit@amd.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 0281E1B2A5; Mon, 9 Oct 2017 16:46:02 +0200 (CEST) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 0F6E31B224 for ; Mon, 9 Oct 2017 16:45:45 +0200 (CEST) Received: by mail-wm0-f50.google.com with SMTP id u138so24261255wmu.4 for ; Mon, 09 Oct 2017 07:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=dKT1ewVEH2DArqMEJU8Qz73Whh68W1oaL3cixfFhL9o=; b=kZxzx3bDlM8LC6CMNwm8XAyEFmATfym7JtHHRMuN6x4d5VPLR6y4inf5F/JvV2H/KI vAZghrQ/qZBCeU9exC8kO4gq0lWydaJ5KQVnPULyenkQpNAl+D5GNgIk7Mpc1PCN2UcJ CUf0OqpzR0IjYrE+SSYkVtWGWLWl9/QF4Zw8VKfeUwAk0t1A/kTDpy4X2ibK1LbrAET/ IGgYDpehhxX9T3ZxhJpH7m1VfOMvu1Avo9CQq2cYMrXN7XStBfFiOyx22GhIswpemfgV NnT199inBmAlM+35ZdRoN8A7ggQKdYxwO0axN1LK4d8o+MDbCkzIqlliUc5xeHf48F+a izcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=dKT1ewVEH2DArqMEJU8Qz73Whh68W1oaL3cixfFhL9o=; b=DjVHSnmWothYbYA7D6C7n97PJU/UlZ4cKn53SyEWPqOYsMU9UySGtdzXPryvKDWHTc jguUX/m1mLT56YrhHBchgsrd47Taq4tjsdH84uUtQDMihKoamI4PX/+T7kB0Akt/Kfg/ BdSDodebRewVCVqhdZyI53TlMMjpmOoDiQCcBTVnPd/F7ODYvWFD0cit5+SHTkOWnhDx mPKhFeRBGZBINvRa3jmzYoZFj6sr+OYok0k4mEujAjsGlWfIaA3VzGWnLV1u794dkSrX CEbSS1xTn9HQFeK1R2tYySC84GH9Ea0BI3UL1ToVubgtjCBlYnOg0XF7eWPmkun12/oI zkag== X-Gm-Message-State: AMCzsaVAU+SQkv31BX6kS5HMLBVUkqU/Moi0+L27v+N4G5mn9W/sx4se Acsc6MEK3V0OzndN1rTd/uoQGvppXw== X-Google-Smtp-Source: AOwi7QC5AcJSLKNmo11e3c4z6fJ5pKsTdh7IKpZmc0GcTzW2Rs4KaljCv8YWFCLOFIvVbzdO3k/rgQ== X-Received: by 10.28.93.145 with SMTP id r139mr7953266wmb.72.1507560344561; Mon, 09 Oct 2017 07:45:44 -0700 (PDT) Received: from ping.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id x15sm6791495wma.32.2017.10.09.07.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 07:45:44 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: adrien.mazarguil@6wind.com, yskoh@mellanox.com, ferruh.yigit@intel.com Date: Mon, 9 Oct 2017 16:44:59 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 23/30] net/mlx5: process flows actions before of items 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" In case the pattern contains an RSS actions, the RSS configuration to use is the one provided by the user. To make the correct conversion from DPDK RSS hash fields to Verbs ones according to the users requests the actions must be processed first. Signed-off-by: Nelio Laranjeiro Acked-by: Yongseok Koh --- drivers/net/mlx5/mlx5_flow.c | 90 ++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 13bd250..6a58194 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -484,51 +484,6 @@ priv_flow_convert(struct priv *priv, "only ingress is supported"); return -rte_errno; } - for (; items->type != RTE_FLOW_ITEM_TYPE_END; ++items) { - const struct mlx5_flow_items *token = NULL; - unsigned int i; - int err; - - if (items->type == RTE_FLOW_ITEM_TYPE_VOID) - continue; - for (i = 0; - cur_item->items && - cur_item->items[i] != RTE_FLOW_ITEM_TYPE_END; - ++i) { - if (cur_item->items[i] == items->type) { - token = &mlx5_flow_items[items->type]; - break; - } - } - if (!token) - goto exit_item_not_supported; - cur_item = token; - err = mlx5_flow_item_validate(items, - (const uint8_t *)cur_item->mask, - cur_item->mask_sz); - if (err) - goto exit_item_not_supported; - if (flow->ibv_attr && cur_item->convert) { - err = cur_item->convert(items, - (cur_item->default_mask ? - cur_item->default_mask : - cur_item->mask), - flow); - if (err) - goto exit_item_not_supported; - } else if (items->type == RTE_FLOW_ITEM_TYPE_VXLAN) { - if (flow->inner) { - rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ITEM, - items, - "cannot recognize multiple" - " VXLAN encapsulations"); - return -rte_errno; - } - flow->inner = 1; - } - flow->offset += cur_item->dst_sz; - } for (; actions->type != RTE_FLOW_ACTION_TYPE_END; ++actions) { if (actions->type == RTE_FLOW_ACTION_TYPE_VOID) { continue; @@ -644,6 +599,51 @@ priv_flow_convert(struct priv *priv, NULL, "no valid action"); return -rte_errno; } + for (; items->type != RTE_FLOW_ITEM_TYPE_END; ++items) { + const struct mlx5_flow_items *token = NULL; + unsigned int i; + int err; + + if (items->type == RTE_FLOW_ITEM_TYPE_VOID) + continue; + for (i = 0; + cur_item->items && + cur_item->items[i] != RTE_FLOW_ITEM_TYPE_END; + ++i) { + if (cur_item->items[i] == items->type) { + token = &mlx5_flow_items[items->type]; + break; + } + } + if (!token) + goto exit_item_not_supported; + cur_item = token; + err = mlx5_flow_item_validate(items, + (const uint8_t *)cur_item->mask, + cur_item->mask_sz); + if (err) + goto exit_item_not_supported; + if (flow->ibv_attr && cur_item->convert) { + err = cur_item->convert(items, + (cur_item->default_mask ? + cur_item->default_mask : + cur_item->mask), + flow); + if (err) + goto exit_item_not_supported; + } else if (items->type == RTE_FLOW_ITEM_TYPE_VXLAN) { + if (flow->inner) { + rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, + items, + "cannot recognize multiple" + " VXLAN encapsulations"); + return -rte_errno; + } + flow->inner = 1; + } + flow->offset += cur_item->dst_sz; + } return 0; exit_item_not_supported: rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM,