All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com, jasvinder.singh@intel.com,
	jingjing.wu@intel.com, Wenzhuo Lu <wenzhuo.lu@intel.com>
Subject: [PATCH v2 14/20] net/ixgbe: support deleting TM shaper profile
Date: Mon, 19 Jun 2017 13:43:50 +0800	[thread overview]
Message-ID: <1497851036-96016-15-git-send-email-wenzhuo.lu@intel.com> (raw)
In-Reply-To: <1497851036-96016-1-git-send-email-wenzhuo.lu@intel.com>

Add the support of the Traffic Management API,
rte_tm_shaper_profile_delete.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ixgbe/ixgbe_tm.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c
index 89e795a..b3b1acf 100644
--- a/drivers/net/ixgbe/ixgbe_tm.c
+++ b/drivers/net/ixgbe/ixgbe_tm.c
@@ -42,10 +42,14 @@ static int ixgbe_shaper_profile_add(struct rte_eth_dev *dev,
 				    uint32_t shaper_profile_id,
 				    struct rte_tm_shaper_params *profile,
 				    struct rte_tm_error *error);
+static int ixgbe_shaper_profile_del(struct rte_eth_dev *dev,
+				    uint32_t shaper_profile_id,
+				    struct rte_tm_error *error);
 
 const struct rte_tm_ops ixgbe_tm_ops = {
 	.capabilities_get = ixgbe_tm_capabilities_get,
 	.shaper_profile_add = ixgbe_shaper_profile_add,
+	.shaper_profile_delete = ixgbe_shaper_profile_del,
 };
 
 int
@@ -247,3 +251,36 @@ static int ixgbe_shaper_profile_add(struct rte_eth_dev *dev,
 
 	return 0;
 }
+
+static int
+ixgbe_shaper_profile_del(struct rte_eth_dev *dev,
+			 uint32_t shaper_profile_id,
+			 struct rte_tm_error *error)
+{
+	struct ixgbe_tm_conf *tm_conf =
+		IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);
+	struct ixgbe_tm_shaper_profile *shaper_profile;
+
+	if (!error)
+		return -EINVAL;
+
+	shaper_profile = ixgbe_shaper_profile_search(dev, shaper_profile_id);
+
+	if (!shaper_profile) {
+		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
+		error->message = "profile ID not exist";
+		return -EINVAL;
+	}
+
+	/* don't delete a profile if it's used by one or several nodes */
+	if (shaper_profile->reference_count) {
+		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE;
+		error->message = "profile in use";
+		return -EINVAL;
+	}
+
+	TAILQ_REMOVE(&tm_conf->shaper_profile_list, shaper_profile, node);
+	rte_free(shaper_profile);
+
+	return 0;
+}
-- 
1.9.3

  parent reply	other threads:[~2017-06-19  5:43 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-27  8:17 [PATCH 00/20] traffic manager on i40e and ixgbe Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 01/20] net/i40e: support getting TM ops Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 02/20] net/i40e: support getting TM capability Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 03/20] net/i40e: support adding TM shaper profile Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 04/20] net/i40e: support deleting " Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 05/20] net/i40e: support adding TM node Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 06/20] net/i40e: support deleting " Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 07/20] net/i40e: support getting TM node type Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 08/20] net/i40e: support getting TM level capability Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 09/20] net/i40e: support getting TM node capability Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 10/20] net/i40e: support committing TM hierarchy Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 11/20] net/ixgbe: support getting TM ops Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 12/20] net/ixgbe: support getting TM capability Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 13/20] net/ixgbe: support adding TM shaper profile Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 14/20] net/ixgbe: support deleting " Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 15/20] net/ixgbe: support adding TM node Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 16/20] net/ixgbe: support deleting " Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 17/20] net/ixgbe: support getting TM node type Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 18/20] net/ixgbe: support getting TM level capability Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 19/20] net/ixgbe: support getting TM node capability Wenzhuo Lu
2017-05-27  8:17 ` [PATCH 20/20] net/ixgbe: support committing TM hierarchy Wenzhuo Lu
2017-06-08 11:19 ` [PATCH 00/20] traffic manager on i40e and ixgbe Ferruh Yigit
2017-06-08 12:52   ` Thomas Monjalon
2017-06-19  5:43 ` [PATCH v2 " Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 01/20] net/i40e: support getting TM ops Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 02/20] net/i40e: support getting TM capability Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 03/20] net/i40e: support adding TM shaper profile Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 04/20] net/i40e: support deleting " Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 05/20] net/i40e: support adding TM node Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 06/20] net/i40e: support deleting " Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 07/20] net/i40e: support getting TM node type Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 08/20] net/i40e: support getting TM level capability Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 09/20] net/i40e: support getting TM node capability Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 10/20] net/i40e: support committing TM hierarchy Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 11/20] net/ixgbe: support getting TM ops Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 12/20] net/ixgbe: support getting TM capability Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 13/20] net/ixgbe: support adding TM shaper profile Wenzhuo Lu
2017-06-19  5:43   ` Wenzhuo Lu [this message]
2017-06-19  5:43   ` [PATCH v2 15/20] net/ixgbe: support adding TM node Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 16/20] net/ixgbe: support deleting " Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 17/20] net/ixgbe: support getting TM node type Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 18/20] net/ixgbe: support getting TM level capability Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 19/20] net/ixgbe: support getting TM node capability Wenzhuo Lu
2017-06-19  5:43   ` [PATCH v2 20/20] net/ixgbe: support committing TM hierarchy Wenzhuo Lu
2017-06-29  4:23 ` [PATCH v3 00/20] traffic manager on i40e and ixgbe Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 01/20] net/i40e: support getting TM ops Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 02/20] net/i40e: support getting TM capability Wenzhuo Lu
2017-07-09 19:31     ` Thomas Monjalon
2017-07-10 11:17       ` Dumitrescu, Cristian
2017-06-29  4:23   ` [PATCH v3 03/20] net/i40e: support adding TM shaper profile Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 04/20] net/i40e: support deleting " Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 05/20] net/i40e: support adding TM node Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 06/20] net/i40e: support deleting " Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 07/20] net/i40e: support getting TM node type Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 08/20] net/i40e: support getting TM level capability Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 09/20] net/i40e: support getting TM node capability Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 10/20] net/i40e: support committing TM hierarchy Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 11/20] net/ixgbe: support getting TM ops Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 12/20] net/ixgbe: support getting TM capability Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 13/20] net/ixgbe: support adding TM shaper profile Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 14/20] net/ixgbe: support deleting " Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 15/20] net/ixgbe: support adding TM node Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 16/20] net/ixgbe: support deleting " Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 17/20] net/ixgbe: support getting TM node type Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 18/20] net/ixgbe: support getting TM level capability Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 19/20] net/ixgbe: support getting TM node capability Wenzhuo Lu
2017-06-29  4:23   ` [PATCH v3 20/20] net/ixgbe: support committing TM hierarchy Wenzhuo Lu
2017-07-04 15:11   ` [PATCH v3 00/20] traffic manager on i40e and ixgbe Dumitrescu, Cristian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497851036-96016-15-git-send-email-wenzhuo.lu@intel.com \
    --to=wenzhuo.lu@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=jasvinder.singh@intel.com \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.