From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6615A0C41 for ; Tue, 30 Nov 2021 17:42:14 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF54841170; Tue, 30 Nov 2021 17:42:14 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 00319410F7 for ; Tue, 30 Nov 2021 17:42:12 +0100 (CET) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id CC7953F1B1 for ; Tue, 30 Nov 2021 16:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1638290532; bh=zgVE645Pb4SxDqGmITQtMXsER5SpYLZPkhzYfcZ+JT8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WNiPSDd2rU9bQ6Cvcwzu3twJ412JEWiPZBA1uoKf7OLY0Q63cOCiidX4EYBWE+7mY feF1/TcOiJogitUAbajaaxJefnQ7X72jCaVy8uUjP62EZ4F1RX5WhspNNBIq82dzVR KSyIbOZp3F1Ih1Mw4RLpZCDlbUDzGLj17nciev8VwhMvjWMJr116ISdnApkGWUiwcu EbGFJUT+DChFUlzRG+pcAIjiGpQT1p52oI5H/2Cns7MlutpMZWlx6F303L+NYad5N6 ox3ub97IdlgZIbiAulicEJZmzJV+GtgR4siUBR/FmIM9MxsTDN2X6KTCnaJtLD9PV8 XXsnD9sO60TIA== Received: by mail-ed1-f69.google.com with SMTP id 30-20020a508e5e000000b003f02e458b17so10726847edx.17 for ; Tue, 30 Nov 2021 08:42:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zgVE645Pb4SxDqGmITQtMXsER5SpYLZPkhzYfcZ+JT8=; b=C+1pufz4HzHpQSbbymbY5ddYwsaC6zX+SmV9KGus54LrDWEfBghtMZy1XyGNZF0kCC 0iM5Q6pXuMEQtyUonvPbkM6ocKCvUhQeK6QxZ4Kci9dLGdOSjG5X7TW/H1xz8Ucfdhi5 k+y4tkmx38vdxjOl/1nJcHxSelEmEo3Y/u4CiiLVrVawnwlN22Pcd3reas1bnj0A9vAi jvUOAMGEqetE9U87f3T/QQo/sIbwM5ViPgtLVe720Xf+BClLypDvJWctgU5xxNIOjR2O A7+3ijNb9MSEoObjm056iW3vUY6bduxvvtYI8U9ZNH1IwiOGIn3bkUwTtD+LDREdMJs8 /agQ== X-Gm-Message-State: AOAM532+r020y7826Uj4f7RMWOn9KnH71B57skalZWmB0b2XAUpYr384 1GIOMOd6p7cQY7+Xk1ZvYIK0AT7g5H19VkCVNS4FtSBaqvaMmHPa8pgPRI7AYkJa88TxmYeg8s7 +ZvtSTo8fQSgCSip9en7k/jQR X-Received: by 2002:a05:6402:1453:: with SMTP id d19mr94316edx.388.1638290532220; Tue, 30 Nov 2021 08:42:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwz30RT3mqyO8073UuodlW74vlhgEgKPqCLaXy+UtNOjDDVAi9iIR2y+vQzT0myLdwH2UOLcg== X-Received: by 2002:a05:6402:1453:: with SMTP id d19mr94298edx.388.1638290532069; Tue, 30 Nov 2021 08:42:12 -0800 (PST) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id q17sm11839723edd.10.2021.11.30.08.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:42:11 -0800 (PST) From: christian.ehrhardt@canonical.com To: Dapeng Yu Cc: Qi Zhang , dpdk stable Subject: patch 'net/ice: save rule on switch filter creation' has been queued to stable release 19.11.11 Date: Tue, 30 Nov 2021 17:35:21 +0100 Message-Id: <20211130163605.2460997-117-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> References: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 19.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before December 10th 2021. 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. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/b3f9982494d186a61e5e635a6af675a792ebeb49 Thanks. Christian Ehrhardt --- >From b3f9982494d186a61e5e635a6af675a792ebeb49 Mon Sep 17 00:00:00 2001 From: Dapeng Yu Date: Thu, 4 Nov 2021 16:45:34 +0800 Subject: [PATCH] net/ice: save rule on switch filter creation [ upstream commit 9fda31c3229ca6e036cae80392578ed6e5a51119 ] The VSI number, lookup elements and rule information for creating switch filter are abandoned when switch filter is created in original implementation. This patch saved the abandoned data in RTE flow, it is for future use on replay when handling exception at flow redirect. Signed-off-by: Dapeng Yu Acked-by: Qi Zhang --- drivers/net/ice/ice_switch_filter.c | 78 +++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 20 deletions(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 03493ee464..24ed232e88 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -101,6 +101,27 @@ static struct ice_flow_parser ice_switch_dist_parser_comms; static struct ice_flow_parser ice_switch_perm_parser_os; static struct ice_flow_parser ice_switch_perm_parser_comms; +enum ice_sw_fltr_status { + ICE_SW_FLTR_ADDED, + ICE_SW_FLTR_RMV_FAILED_ON_RIDRECT, + ICE_SW_FLTR_ADD_FAILED_ON_RIDRECT, +}; + +struct ice_switch_filter_conf { + enum ice_sw_fltr_status fltr_status; + + struct ice_rule_query_data sw_query_data; + + /* + * The lookup elements and rule info are saved here when filter creation + * succeeds. + */ + uint16_t vsi_num; + uint16_t lkups_num; + struct ice_adv_lkup_elem *lkups; + struct ice_adv_rule_info rule_info; +}; + static struct ice_pattern_match_item ice_switch_pattern_dist_os[] = { {pattern_ethertype, @@ -247,7 +268,7 @@ ice_switch_create(struct ice_adapter *ad, struct ice_pf *pf = &ad->pf; struct ice_hw *hw = ICE_PF_TO_HW(pf); struct ice_rule_query_data rule_added = {0}; - struct ice_rule_query_data *filter_ptr; + struct ice_switch_filter_conf *filter_conf_ptr; struct ice_adv_lkup_elem *list = ((struct sw_meta *)meta)->list; uint16_t lkups_cnt = @@ -269,18 +290,26 @@ ice_switch_create(struct ice_adapter *ad, } ret = ice_add_adv_rule(hw, list, lkups_cnt, rule_info, &rule_added); if (!ret) { - filter_ptr = rte_zmalloc("ice_switch_filter", - sizeof(struct ice_rule_query_data), 0); - if (!filter_ptr) { + filter_conf_ptr = rte_zmalloc("ice_switch_filter", + sizeof(struct ice_switch_filter_conf), 0); + if (!filter_conf_ptr) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "No memory for ice_switch_filter"); goto error; } - flow->rule = filter_ptr; - rte_memcpy(filter_ptr, - &rule_added, - sizeof(struct ice_rule_query_data)); + + filter_conf_ptr->sw_query_data = rule_added; + + filter_conf_ptr->vsi_num = + ice_get_hw_vsi_num(hw, rule_info->sw_act.vsi_handle); + filter_conf_ptr->lkups = list; + filter_conf_ptr->lkups_num = lkups_cnt; + filter_conf_ptr->rule_info = *rule_info; + + filter_conf_ptr->fltr_status = ICE_SW_FLTR_ADDED; + + flow->rule = filter_conf_ptr; } else { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -288,7 +317,6 @@ ice_switch_create(struct ice_adapter *ad, goto error; } - rte_free(list); rte_free(meta); return 0; @@ -299,6 +327,18 @@ error: return -rte_errno; } +static inline void +ice_switch_filter_rule_free(struct rte_flow *flow) +{ + struct ice_switch_filter_conf *filter_conf_ptr = + (struct ice_switch_filter_conf *)flow->rule; + + if (filter_conf_ptr) + rte_free(filter_conf_ptr->lkups); + + rte_free(filter_conf_ptr); +} + static int ice_switch_destroy(struct ice_adapter *ad, struct rte_flow *flow, @@ -306,20 +346,24 @@ ice_switch_destroy(struct ice_adapter *ad, { struct ice_hw *hw = &ad->hw; int ret; - struct ice_rule_query_data *filter_ptr; + struct ice_switch_filter_conf *filter_conf_ptr; - filter_ptr = (struct ice_rule_query_data *) + filter_conf_ptr = (struct ice_switch_filter_conf *) flow->rule; - if (!filter_ptr) { + if (!filter_conf_ptr || + filter_conf_ptr->fltr_status == ICE_SW_FLTR_ADD_FAILED_ON_RIDRECT) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "no such flow" " create by switch filter"); + + ice_switch_filter_rule_free(flow); + return -rte_errno; } - ret = ice_rem_adv_rule_by_id(hw, filter_ptr); + ret = ice_rem_adv_rule_by_id(hw, &filter_conf_ptr->sw_query_data); if (ret) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -327,16 +371,10 @@ ice_switch_destroy(struct ice_adapter *ad, return -rte_errno; } - rte_free(filter_ptr); + ice_switch_filter_rule_free(flow); return ret; } -static void -ice_switch_filter_rule_free(struct rte_flow *flow) -{ - rte_free(flow->rule); -} - static uint64_t ice_switch_inset_get(const struct rte_flow_item pattern[], struct rte_flow_error *error, -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-30 16:50:12.825159701 +0100 +++ 0117-net-ice-save-rule-on-switch-filter-creation.patch 2021-11-30 16:50:05.942874646 +0100 @@ -1 +1 @@ -From 9fda31c3229ca6e036cae80392578ed6e5a51119 Mon Sep 17 00:00:00 2001 +From b3f9982494d186a61e5e635a6af675a792ebeb49 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 9fda31c3229ca6e036cae80392578ed6e5a51119 ] + @@ -13,2 +14,0 @@ -Cc: stable@dpdk.org - @@ -22 +22 @@ -index 6b0c1bff1e..d5add64c53 100644 +index 03493ee464..24ed232e88 100644 @@ -25,3 +25,3 @@ -@@ -180,6 +180,27 @@ struct sw_meta { - struct ice_adv_rule_info rule_info; - }; +@@ -101,6 +101,27 @@ static struct ice_flow_parser ice_switch_dist_parser_comms; + static struct ice_flow_parser ice_switch_perm_parser_os; + static struct ice_flow_parser ice_switch_perm_parser_comms; @@ -50,4 +50,4 @@ - static struct ice_flow_parser ice_switch_dist_parser; - static struct ice_flow_parser ice_switch_perm_parser; - -@@ -359,7 +380,7 @@ ice_switch_create(struct ice_adapter *ad, + static struct + ice_pattern_match_item ice_switch_pattern_dist_os[] = { + {pattern_ethertype, +@@ -247,7 +268,7 @@ ice_switch_create(struct ice_adapter *ad, @@ -62 +62 @@ -@@ -381,18 +402,26 @@ ice_switch_create(struct ice_adapter *ad, +@@ -269,18 +290,26 @@ ice_switch_create(struct ice_adapter *ad, @@ -96 +96 @@ -@@ -400,7 +429,6 @@ ice_switch_create(struct ice_adapter *ad, +@@ -288,7 +317,6 @@ ice_switch_create(struct ice_adapter *ad, @@ -104 +104 @@ -@@ -411,6 +439,18 @@ error: +@@ -299,6 +327,18 @@ error: @@ -123 +123 @@ -@@ -418,20 +458,24 @@ ice_switch_destroy(struct ice_adapter *ad, +@@ -306,20 +346,24 @@ ice_switch_destroy(struct ice_adapter *ad, @@ -152 +152 @@ -@@ -439,16 +483,10 @@ ice_switch_destroy(struct ice_adapter *ad, +@@ -327,16 +371,10 @@ ice_switch_destroy(struct ice_adapter *ad, @@ -167,2 +167,2 @@ - static bool - ice_switch_parse_pattern(const struct rte_flow_item pattern[], + static uint64_t + ice_switch_inset_get(const struct rte_flow_item pattern[],