From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 5D8E81B783 for ; Wed, 7 Feb 2018 10:00:27 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 146B020E1C; Wed, 7 Feb 2018 04:00:27 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 07 Feb 2018 04:00:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=UlZHROF7CP1vylpGd mf/OloKAw56S/LaqNTZvsqCrhw=; b=ZWuyy6lhYyy2v+f0sPYV5ZwLfMwOEWu0t d6e5Z6IGlKUSRFjtNXsswowbxb7FqvROhfucjQsT02lAq/IJ2PQsm0l9RMf048IU G2F4zHFddrHnxqBcla/RQQON+SjYJ1rghQ9FnTzWhpuC5VSzU2RUEH7N5eyAZU5n idxBWAARjqB4XoQ1mFyuZthOX+klBiBhMF2nFXxX7O1TbxeCuQjUUneF+SabUCjb do6ZvGFu/Cs1Or60fO2dRiXFj7tj9gRpt160mmyUCMFzcaszJczgpIX3fmestP26 +dR5MUceMPegmU+AY06KSbca1xeUHMCHugog3OXC3fC2ZSRvxrObw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=UlZHROF7CP1vylpGdmf/OloKAw56S/LaqNTZvsqCrhw=; b=lXgfSXL3 3qeCYH7x+cYchNH447zehXWw3JMzENOCv18Yt/t84IaIWmF/Pz4Bgu973midJoUv slBz0mCuHeRrzSqT/ExarOzbxxmUViRu6gCe3gx29VyISKLStY7lFSfoJfX2peMD xheoy8GalNi0FmPeHNxIKuVxn7csXKe9PkazQRiZtSnknyz7DVa/6Q+EDLFjWoyk uJl7UhkEwPbtUnTMDWnEH6suG0VkzRdwGTev/DIM4QFGCu+rUNLXaOpiVIO2MEmb Fu0O7+l2Z+cy+KroZL016TLa4HoTwP1S5sAQmRkmcAaRc1xbBIubbGmUuk4q4ccV RlfVM5pZvrSt/w== X-ME-Sender: Received: from localhost.localdomain (unknown [182.84.161.100]) by mail.messagingengine.com (Postfix) with ESMTPA id 7187D24736; Wed, 7 Feb 2018 04:00:23 -0500 (EST) From: Yuanhan Liu To: Kirill Rybalchenko Cc: Andrey Chilikin , Beilei Xing , dpdk stable Date: Wed, 7 Feb 2018 16:57:18 +0800 Message-Id: <1517993838-26692-24-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517993838-26692-1-git-send-email-yliu@fridaylinux.org> References: <1517993838-26692-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/i40e: fix multiple DDP packages conflict' has been queued to LTS release 17.11.1 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: , X-List-Received-Date: Wed, 07 Feb 2018 09:00:27 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/09/18. So please shout if anyone has objections. Thanks. --yliu --- >>From fb4c79d4062f110201af15040d8cd78373881582 Mon Sep 17 00:00:00 2001 From: Kirill Rybalchenko Date: Thu, 1 Feb 2018 12:43:05 +0000 Subject: [PATCH] net/i40e: fix multiple DDP packages conflict [ upstream commit b1ec717bfff5cede471261078f3e2dce156553f4 ] Should be not possible to load conflicting DDP profiles. Only DDP profiles of the same group (not 0) can be loaded together. If DDP profile group is 0, it is exclusive, i.e. it cannot be loaded with any other DDP profile. If DDP profile groups are different, these profiles cannot be loaded together. Fixes: b319712f53c8 ("net/i40e: extended list of operations for DDP processing") Signed-off-by: Kirill Rybalchenko Acked-by: Andrey Chilikin Acked-by: Beilei Xing --- drivers/net/i40e/rte_pmd_i40e.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index c2e2466..f726a9c 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -1525,7 +1525,14 @@ i40e_check_profile_info(uint16_t port, uint8_t *profile_info_sec) struct rte_pmd_i40e_profile_info *pinfo, *p; uint32_t i; int ret; + static const uint32_t group_mask = 0x00ff0000; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + + sizeof(struct i40e_profile_section_header)); + if (pinfo->track_id == 0) { + PMD_DRV_LOG(INFO, "Read-only profile."); + return 0; + } buff = rte_zmalloc("pinfo_list", (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM + 4), 0); @@ -1544,8 +1551,6 @@ i40e_check_profile_info(uint16_t port, uint8_t *profile_info_sec) return -1; } p_list = (struct rte_pmd_i40e_profile_list *)buff; - pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + - sizeof(struct i40e_profile_section_header)); for (i = 0; i < p_list->p_count; i++) { p = &p_list->p_info[i]; if (pinfo->track_id == p->track_id) { @@ -1554,6 +1559,23 @@ i40e_check_profile_info(uint16_t port, uint8_t *profile_info_sec) return 1; } } + for (i = 0; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; + if ((p->track_id & group_mask) == 0) { + PMD_DRV_LOG(INFO, "Profile of the group 0 exists."); + rte_free(buff); + return 2; + } + } + for (i = 0; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; + if ((pinfo->track_id & group_mask) != + (p->track_id & group_mask)) { + PMD_DRV_LOG(INFO, "Profile of different group exists."); + rte_free(buff); + return 3; + } + } rte_free(buff); return 0; @@ -1573,6 +1595,7 @@ rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff, uint8_t *profile_info_sec; int is_exist; enum i40e_status_code status = I40E_SUCCESS; + static const uint32_t type_mask = 0xff000000; if (op != RTE_PMD_I40E_PKG_OP_WR_ADD && op != RTE_PMD_I40E_PKG_OP_WR_ONLY && @@ -1624,6 +1647,10 @@ rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff, return -EINVAL; } + /* force read-only track_id for type 0 */ + if ((track_id & type_mask) == 0) + track_id = 0; + /* Find profile segment */ profile_seg_hdr = i40e_find_segment_in_package(SEGMENT_TYPE_I40E, pkg_hdr); @@ -1657,12 +1684,17 @@ rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff, if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) { if (is_exist) { - PMD_DRV_LOG(ERR, "Profile already exists."); + if (is_exist == 1) + PMD_DRV_LOG(ERR, "Profile already exists."); + else if (is_exist == 2) + PMD_DRV_LOG(ERR, "Profile of group 0 already exists."); + else if (is_exist == 3) + PMD_DRV_LOG(ERR, "Profile of different group already exists"); rte_free(profile_info_sec); return -EEXIST; } } else if (op == RTE_PMD_I40E_PKG_OP_WR_DEL) { - if (!is_exist) { + if (is_exist != 1) { PMD_DRV_LOG(ERR, "Profile does not exist."); rte_free(profile_info_sec); return -EACCES; -- 2.7.4