From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7A3AFA0093 for ; Tue, 19 May 2020 15:13:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5F6881D8E9; Tue, 19 May 2020 15:13:26 +0200 (CEST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 2ADC21D8D1 for ; Tue, 19 May 2020 15:13:25 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id i15so15806157wrx.10 for ; Tue, 19 May 2020 06:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8cpTCe1kYFcNXh7FMpQ3HYRfLk47dImuwhi2X/WFrmk=; b=KVATA7gyNlURdHdO4wCcCh7rUIZXb2lp2ywXO7YHklgGEcXody+K32suzjygTGkOvk n/anHzIdIZ3X5j7Ug9dy10lgmmEhGo6dEKEbrMtauku7zHGNFUZzkk6xatHNrw129brc UHMq5N8aq8cD87lARenO2O2gC5shvYMHuGn+NnBNEQSG5Mh5gT1fMTKpo/bMtNhHPhWZ szNri+7EDMUW45pX/1mzbdoxeD7HHSgz0EDHzD+UPVg633F4DZJYgO+TCHdSKTeF6BH0 yCMZV5MAw9OJnSnI+7yD6KXY8yhaD5Zdw63i2Fp8Kksz+vsJi10O8axeBb1w0qsHsrCj 5WMA== 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:mime-version:content-transfer-encoding; bh=8cpTCe1kYFcNXh7FMpQ3HYRfLk47dImuwhi2X/WFrmk=; b=D3E02KW1YwAHUSB832MMiV9zvzlybz0FlWVPcdss2XMuL1NJLkdOI+Lywgxozh1Xco ToDmWndAJxmKQFmxlrFB+uk5VfKgh8iTzFtDzeaZXJpj5xmojfS4kvXA9gyvYLAlw1Zk bSVRjn5VB5Tvnl1SMHmig1UdfnkBiy2xI7f4ZubG1lLolPoq3MbRKxH5Z+w56xuBrusf 7bTH7dg/kqVkOOTl9Hr4X3KInu03MvsqI6slS0F7IOUDRuPAnrKA9j+j2Fu1DZYVZfZH TAG0vcXhMHrNwOy5d9cVKBa6NBKWmxlh2w4FDz70dJ/US05q5kWtQM6sJA98NV0DR7P7 3C3A== X-Gm-Message-State: AOAM533ui7xoeq2XNHsk53JGXUo9nCZtHBp0V3PQzabkDjwfhG5Fq9ym JkQAqjpHxRHyFsXWAFMmURU+p/lnIZwFIOz/ X-Google-Smtp-Source: ABdhPJySkeSBtMM4v7DQDVrgs32a1CFQfteEPKT2tlgVoNtJ+pCb8xp2Qn+3oJQ4VRosYLy66lAvyA== X-Received: by 2002:adf:df8a:: with SMTP id z10mr25741430wrl.344.1589894004870; Tue, 19 May 2020 06:13:24 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id g187sm3902313wmf.30.2020.05.19.06.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:13:24 -0700 (PDT) From: luca.boccassi@gmail.com To: Bing Zhao Cc: Viacheslav Ovsiienko , dpdk stable Date: Tue, 19 May 2020 14:04:39 +0100 Message-Id: <20200519130549.112823-144-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519130549.112823-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> <20200519130549.112823-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix actions validation on root table' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From ecd69bfb766fc75c0ef16824a1d9389603f94b98 Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Wed, 29 Apr 2020 20:54:20 +0800 Subject: [PATCH] net/mlx5: fix actions validation on root table [ upstream commit 0ba70e439ee44c222cccf6bef6460db31611dfaa ] The maximal supported header modifications number of a single modify context on the root table cannot be queried from firmware directly. It is a fixed value of 16 in the latest releases. In the validation stage, PMD driver should ensure that no more than 16 header modify actions exist in a single context. In some old firmware releases, the supported value is 8. PMD driver should try its best to create the flow. Firmware will return error and refuse to create the flow if the actions number exceeds the maximal value. Fixes: 72a944dba163 ("net/mlx5: fix header modify action validation") Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.h | 12 +++++++----- drivers/net/mlx5/mlx5_flow_dv.c | 17 +++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 4e38d3fa5a..f8046119ec 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -402,14 +402,16 @@ struct mlx5_flow_dv_tag_resource { /* * Number of modification commands. - * If extensive metadata registers are supported, the maximal actions amount is - * 16 and 8 otherwise on root table. The validation could also be done in the - * lower driver layer. - * On non-root table, there is no limitation, but 32 is enough right now. + * The maximal actions amount in FW is some constant, and it is 16 in the + * latest releases. In some old releases, it will be limited to 8. + * Since there is no interface to query the capacity, the maximal value should + * be used to allow PMD to create the flow. The validation will be done in the + * lower driver layer or FW. A failure will be returned if exceeds the maximal + * supported actions number on the root table. + * On non-root tables, there is no limitation, but 32 is enough right now. */ #define MLX5_MAX_MODIFY_NUM 32 #define MLX5_ROOT_TBL_MODIFY_NUM 16 -#define MLX5_ROOT_TBL_MODIFY_NUM_NO_MREG 8 /* Modify resource structure */ struct mlx5_flow_dv_modify_hdr_resource { diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 8d326f0229..8ed29adaaa 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -3485,21 +3485,18 @@ flow_dv_validate_action_port_id(struct rte_eth_dev *dev, * @return * Max number of modify header actions device can support. */ -static unsigned int -flow_dv_modify_hdr_action_max(struct rte_eth_dev *dev, uint64_t flags) +static inline unsigned int +flow_dv_modify_hdr_action_max(struct rte_eth_dev *dev __rte_unused, + uint64_t flags) { /* - * There's no way to directly query the max cap. Although it has to be - * acquried by iterative trial, it is a safe assumption that more - * actions are supported by FW if extensive metadata register is - * supported. (Only in the root table) + * There's no way to directly query the max capacity from FW. + * The maximal value on root table should be assumed to be supported. */ if (!(flags & MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL)) return MLX5_MAX_MODIFY_NUM; else - return mlx5_flow_ext_mreg_supported(dev) ? - MLX5_ROOT_TBL_MODIFY_NUM : - MLX5_ROOT_TBL_MODIFY_NUM_NO_MREG; + return MLX5_ROOT_TBL_MODIFY_NUM; } /** @@ -5083,7 +5080,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, dev_conf->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY && mlx5_flow_ext_mreg_supported(dev)) rw_act_num += MLX5_ACT_NUM_SET_TAG; - if ((uint32_t)rw_act_num >= + if ((uint32_t)rw_act_num > flow_dv_modify_hdr_action_max(dev, is_root)) { return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 14:04:50.301757595 +0100 +++ 0144-net-mlx5-fix-actions-validation-on-root-table.patch 2020-05-19 14:04:44.464652868 +0100 @@ -1,8 +1,10 @@ -From 0ba70e439ee44c222cccf6bef6460db31611dfaa Mon Sep 17 00:00:00 2001 +From ecd69bfb766fc75c0ef16824a1d9389603f94b98 Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Wed, 29 Apr 2020 20:54:20 +0800 Subject: [PATCH] net/mlx5: fix actions validation on root table +[ upstream commit 0ba70e439ee44c222cccf6bef6460db31611dfaa ] + The maximal supported header modifications number of a single modify context on the root table cannot be queried from firmware directly. It is a fixed value of 16 in the latest releases. In the validation @@ -14,7 +16,6 @@ maximal value. Fixes: 72a944dba163 ("net/mlx5: fix header modify action validation") -Cc: stable@dpdk.org Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko @@ -24,10 +25,10 @@ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h -index 2a1f59698c..75b82885c1 100644 +index 4e38d3fa5a..f8046119ec 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h -@@ -415,14 +415,16 @@ struct mlx5_flow_dv_tag_resource { +@@ -402,14 +402,16 @@ struct mlx5_flow_dv_tag_resource { /* * Number of modification commands. @@ -50,10 +51,10 @@ /* Modify resource structure */ struct mlx5_flow_dv_modify_hdr_resource { diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c -index 2fdd40319c..18d9d302e3 100644 +index 8d326f0229..8ed29adaaa 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c -@@ -3640,21 +3640,18 @@ flow_dv_validate_action_port_id(struct rte_eth_dev *dev, +@@ -3485,21 +3485,18 @@ flow_dv_validate_action_port_id(struct rte_eth_dev *dev, * @return * Max number of modify header actions device can support. */ @@ -81,7 +82,7 @@ } /** -@@ -5347,7 +5344,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -5083,7 +5080,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, dev_conf->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY && mlx5_flow_ext_mreg_supported(dev)) rw_act_num += MLX5_ACT_NUM_SET_TAG;