From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 018C9235 for ; Tue, 21 Nov 2017 14:28:29 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id AB04E20CB2; Tue, 21 Nov 2017 08:28:28 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 21 Nov 2017 08:28:28 -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=fm1; bh=WzShKXXTfY0altC0d OKEQN9vA3XAma3tzyPNSvASQK8=; b=kdc2XUm/lEdyFcIwHNG555JhPR85AZQ8J BBDSqzmcvebQmPosGuAfK7i5f4Ub98Q4zx/r4uHMAckADU3vHXrI2tJX4DVP8Exn O5spa1J3D+PWzqyVrAcZjEfkto1hwddlE6Ij9hZkYpEjcglIY+1RrCbRcxt/4I+E pCpidolHlZ8r3Ny8dbNAxnfMA6da/rvUIgAihiG16nFHLkMeva4nNwzad4lYil// o9CLnZRBf+mQdFkN+VZn0xGKy1fTGOLvmFUGUsfKnV7vTL07VSYwveiWaA+9f8VY /oL7d1I01fqS+esHJoCWTuUTgQ41q6pEvZSNJ04pdMOyXiPrG004w== 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=WzShKXXTfY0altC0dOKEQN9vA3XAma3tzyPNSvASQK8=; b=PQHEWMGo hb401I/sHW1ozsiC6/9J9v6K21USiyqPyMjMBL/DvOAfLnRIQoWjJoz/idFzMGRM tNRNxoTYFERLYb+B7Sgl0Xla0KxqR18eyydqsz4HAGLDhpHzW6zRXno5CB29JLB4 CDNsCnUwXIChLSwFCdGg/nUUZV9Dipuh7z0kOJ8zGs65V2TI01bn0Fof9tNuV2Cr S/LZKSjjsEmNqJ3cCoHQcho5PqQrQNhufrqPUVTPECq5HNniALrNG2nMyild+q+Q zUbkpP7PKK4DHD0iArRAPis0wDa1fldDgn+bVcJnXbw05AYbYK0NT/cbJKIro/Ld F87LnfJcgqyFCQ== X-ME-Sender: Received: from localhost.localdomain (unknown [180.158.62.0]) by mail.messagingengine.com (Postfix) with ESMTPA id CB5A224810; Tue, 21 Nov 2017 08:28:25 -0500 (EST) From: Yuanhan Liu To: Wenzhuo Lu Cc: Cristian Dumitrescu , dpdk stable Date: Tue, 21 Nov 2017 21:18:05 +0800 Message-Id: <1511270333-31002-143-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511270333-31002-1-git-send-email-yliu@fridaylinux.org> References: <1511270333-31002-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/i40e: fix not supporting NULL TM profile' has been queued to stable release 17.08.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: Tue, 21 Nov 2017 13:28:29 -0000 Hi, FYI, your patch has been queued to stable release 17.08.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 11/24/17. So please shout if anyone has objections. Thanks. --yliu --- >>From cc3355ab5cca439926fcd0c9cc581e24a8f2441b Mon Sep 17 00:00:00 2001 From: Wenzhuo Lu Date: Tue, 17 Oct 2017 13:50:38 +0800 Subject: [PATCH] net/i40e: fix not supporting NULL TM profile [ upstream commit 70039fe684bf4c547e7ce12510afd8d80fb0bbbe ] It's by design that APP can add a TM node without shaper profile. But i40e doesn't support it currently. Fixes: 03a249b62bbd ("net/i40e: support adding TM node") Fixes: cac29c3c00a4 ("net/i40e: support committing TM hierarchy") Signed-off-by: Wenzhuo Lu Acked-by: Cristian Dumitrescu --- drivers/net/i40e/i40e_tm.c | 47 +++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index d46a972..f4d1cb8 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -480,7 +480,7 @@ i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id, struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); enum i40e_tm_node_type node_type = I40E_TM_NODE_TYPE_MAX; enum i40e_tm_node_type parent_node_type = I40E_TM_NODE_TYPE_MAX; - struct i40e_tm_shaper_profile *shaper_profile; + struct i40e_tm_shaper_profile *shaper_profile = NULL; struct i40e_tm_node *tm_node; struct i40e_tm_node *parent_node; uint16_t tc_nb = 0; @@ -509,12 +509,15 @@ i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id, } /* check the shaper profile id */ - shaper_profile = i40e_shaper_profile_search(dev, - params->shaper_profile_id); - if (!shaper_profile) { - error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; - error->message = "shaper profile not exist"; - return -EINVAL; + if (params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE) { + shaper_profile = i40e_shaper_profile_search( + dev, params->shaper_profile_id); + if (!shaper_profile) { + error->type = + RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; + error->message = "shaper profile not exist"; + return -EINVAL; + } } /* root node if not have a parent */ @@ -551,7 +554,8 @@ i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id, pf->tm_conf.root = tm_node; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -633,7 +637,8 @@ i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->parent->reference_count++; /* increase the reference counter of the shaper profile */ - shaper_profile->reference_count++; + if (shaper_profile) + shaper_profile->reference_count++; return 0; } @@ -680,14 +685,16 @@ i40e_node_delete(struct rte_eth_dev *dev, uint32_t node_id, /* root node */ if (node_type == I40E_TM_NODE_TYPE_PORT) { - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; rte_free(tm_node); pf->tm_conf.root = NULL; return 0; } /* TC or queue node */ - tm_node->shaper_profile->reference_count--; + if (tm_node->shaper_profile) + tm_node->shaper_profile->reference_count--; tm_node->parent->reference_count--; if (node_type == I40E_TM_NODE_TYPE_TC) { TAILQ_REMOVE(&pf->tm_conf.tc_list, tm_node, node); @@ -895,11 +902,15 @@ i40e_hierarchy_commit(struct rte_eth_dev *dev, * If the port has a max bandwidth, the TCs should have none. */ /* port */ - bw = pf->tm_conf.root->shaper_profile->profile.peak.rate; + if (pf->tm_conf.root->shaper_profile) + bw = pf->tm_conf.root->shaper_profile->profile.peak.rate; + else + bw = 0; if (bw) { /* check if any TC has a max bandwidth */ TAILQ_FOREACH(tm_node, tc_list, node) { - if (tm_node->shaper_profile->profile.peak.rate) { + if (tm_node->shaper_profile && + tm_node->shaper_profile->profile.peak.rate) { error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; error->message = "no port and TC max bandwidth" " in parallel"; @@ -943,7 +954,10 @@ i40e_hierarchy_commit(struct rte_eth_dev *dev, } tc_map &= ~BIT_ULL(i); - bw = tm_node->shaper_profile->profile.peak.rate; + if (tm_node->shaper_profile) + bw = tm_node->shaper_profile->profile.peak.rate; + else + bw = 0; if (!bw) continue; @@ -954,7 +968,10 @@ i40e_hierarchy_commit(struct rte_eth_dev *dev, } TAILQ_FOREACH(tm_node, queue_list, node) { - bw = tm_node->shaper_profile->profile.peak.rate; + if (tm_node->shaper_profile) + bw = tm_node->shaper_profile->profile.peak.rate; + else + bw = 0; if (bw) { error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS; error->message = "not support queue QoS"; -- 2.7.4