From: Tomasz Duszynski <tdu@semihalf.com>
To: dev@dpdk.org
Cc: mw@semihalf.com, dima@marvell.com, nsamsono@marvell.com,
jck@semihalf.com, jianbo.liu@arm.com,
Tomasz Duszynski <tdu@semihalf.com>
Subject: [dpdk-dev] [PATCH v3 3/8] net/mrvl: add egress scheduler/rate limiter support
Date: Thu, 15 Mar 2018 08:51:59 +0100 [thread overview]
Message-ID: <1521100324-26558-4-git-send-email-tdu@semihalf.com> (raw)
In-Reply-To: <1521100324-26558-1-git-send-email-tdu@semihalf.com>
Add egress scheduler and egress rate limiter support.
Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
drivers/net/mrvl/mrvl_ethdev.c | 6 +-
drivers/net/mrvl/mrvl_qos.c | 141 +++++++++++++++++++++++++++++++++++++++--
drivers/net/mrvl/mrvl_qos.h | 19 ++++++
3 files changed, 161 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index d1faa3d..7e00dbd 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -320,6 +320,11 @@ mrvl_dev_configure(struct rte_eth_dev *dev)
if (ret < 0)
return ret;
+ ret = mrvl_configure_txqs(priv, dev->data->port_id,
+ dev->data->nb_tx_queues);
+ if (ret < 0)
+ return ret;
+
priv->ppio_params.outqs_params.num_outqs = dev->data->nb_tx_queues;
priv->ppio_params.maintain_stats = 1;
priv->nb_rx_queues = dev->data->nb_rx_queues;
@@ -1537,7 +1542,6 @@ mrvl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
dev->data->tx_queues[idx] = txq;
priv->ppio_params.outqs_params.outqs_params[idx].size = desc;
- priv->ppio_params.outqs_params.outqs_params[idx].weight = 1;
return 0;
}
diff --git a/drivers/net/mrvl/mrvl_qos.c b/drivers/net/mrvl/mrvl_qos.c
index 0205157..e9c4531 100644
--- a/drivers/net/mrvl/mrvl_qos.c
+++ b/drivers/net/mrvl/mrvl_qos.c
@@ -36,12 +36,19 @@
#define MRVL_TOK_PCP "pcp"
#define MRVL_TOK_PORT "port"
#define MRVL_TOK_RXQ "rxq"
-#define MRVL_TOK_SP "SP"
#define MRVL_TOK_TC "tc"
#define MRVL_TOK_TXQ "txq"
#define MRVL_TOK_VLAN "vlan"
#define MRVL_TOK_VLAN_IP "vlan/ip"
-#define MRVL_TOK_WEIGHT "weight"
+
+/* egress specific configuration tokens */
+#define MRVL_TOK_BURST_SIZE "burst_size"
+#define MRVL_TOK_RATE_LIMIT "rate_limit"
+#define MRVL_TOK_RATE_LIMIT_ENABLE "rate_limit_enable"
+#define MRVL_TOK_SCHED_MODE "sched_mode"
+#define MRVL_TOK_SCHED_MODE_SP "sp"
+#define MRVL_TOK_SCHED_MODE_WRR "wrr"
+#define MRVL_TOK_WRR_WEIGHT "wrr_weight"
/* policer specific configuration tokens */
#define MRVL_TOK_PLCR_ENABLE "policer_enable"
@@ -119,12 +126,69 @@ get_outq_cfg(struct rte_cfgfile *file, int port, int outq,
if (rte_cfgfile_num_sections(file, sec_name, strlen(sec_name)) <= 0)
return 0;
+ /* Read scheduling mode */
+ entry = rte_cfgfile_get_entry(file, sec_name, MRVL_TOK_SCHED_MODE);
+ if (entry) {
+ if (!strncmp(entry, MRVL_TOK_SCHED_MODE_SP,
+ strlen(MRVL_TOK_SCHED_MODE_SP))) {
+ cfg->port[port].outq[outq].sched_mode =
+ PP2_PPIO_SCHED_M_SP;
+ } else if (!strncmp(entry, MRVL_TOK_SCHED_MODE_WRR,
+ strlen(MRVL_TOK_SCHED_MODE_WRR))) {
+ cfg->port[port].outq[outq].sched_mode =
+ PP2_PPIO_SCHED_M_WRR;
+ } else {
+ RTE_LOG(ERR, PMD, "Unknown token: %s\n", entry);
+ return -1;
+ }
+ }
+
+ /* Read wrr weight */
+ if (cfg->port[port].outq[outq].sched_mode == PP2_PPIO_SCHED_M_WRR) {
+ entry = rte_cfgfile_get_entry(file, sec_name,
+ MRVL_TOK_WRR_WEIGHT);
+ if (entry) {
+ if (get_val_securely(entry, &val) < 0)
+ return -1;
+ cfg->port[port].outq[outq].weight = val;
+ }
+ }
+
+ /*
+ * There's no point in setting rate limiting for specific outq as
+ * global port rate limiting has priority.
+ */
+ if (cfg->port[port].rate_limit_enable) {
+ RTE_LOG(WARNING, PMD, "Port %d rate limiting already enabled\n",
+ port);
+ return 0;
+ }
+
entry = rte_cfgfile_get_entry(file, sec_name,
- MRVL_TOK_WEIGHT);
+ MRVL_TOK_RATE_LIMIT_ENABLE);
if (entry) {
if (get_val_securely(entry, &val) < 0)
return -1;
- cfg->port[port].outq[outq].weight = (uint8_t)val;
+ cfg->port[port].outq[outq].rate_limit_enable = val;
+ }
+
+ if (!cfg->port[port].outq[outq].rate_limit_enable)
+ return 0;
+
+ /* Read CBS (in kB) */
+ entry = rte_cfgfile_get_entry(file, sec_name, MRVL_TOK_BURST_SIZE);
+ if (entry) {
+ if (get_val_securely(entry, &val) < 0)
+ return -1;
+ cfg->port[port].outq[outq].rate_limit_params.cbs = val;
+ }
+
+ /* Read CIR (in kbps) */
+ entry = rte_cfgfile_get_entry(file, sec_name, MRVL_TOK_RATE_LIMIT);
+ if (entry) {
+ if (get_val_securely(entry, &val) < 0)
+ return -1;
+ cfg->port[port].outq[outq].rate_limit_params.cir = val;
}
return 0;
@@ -484,6 +548,36 @@ mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
}
}
+ /*
+ * Read per-port rate limiting. Setting that will
+ * disable per-queue rate limiting.
+ */
+ entry = rte_cfgfile_get_entry(file, sec_name,
+ MRVL_TOK_RATE_LIMIT_ENABLE);
+ if (entry) {
+ if (get_val_securely(entry, &val) < 0)
+ return -1;
+ (*cfg)->port[n].rate_limit_enable = val;
+ }
+
+ if ((*cfg)->port[n].rate_limit_enable) {
+ entry = rte_cfgfile_get_entry(file, sec_name,
+ MRVL_TOK_BURST_SIZE);
+ if (entry) {
+ if (get_val_securely(entry, &val) < 0)
+ return -1;
+ (*cfg)->port[n].rate_limit_params.cbs = val;
+ }
+
+ entry = rte_cfgfile_get_entry(file, sec_name,
+ MRVL_TOK_RATE_LIMIT);
+ if (entry) {
+ if (get_val_securely(entry, &val) < 0)
+ return -1;
+ (*cfg)->port[n].rate_limit_params.cir = val;
+ }
+ }
+
entry = rte_cfgfile_get_entry(file, sec_name,
MRVL_TOK_MAPPING_PRIORITY);
if (entry) {
@@ -730,6 +824,45 @@ mrvl_configure_rxqs(struct mrvl_priv *priv, uint16_t portid,
}
/**
+ * Configure TX Queues in a given port.
+ *
+ * Sets up TX queues egress scheduler and limiter.
+ *
+ * @param priv Port's private data
+ * @param portid DPDK port ID
+ * @param max_queues Maximum number of queues to configure.
+ * @returns 0 in case of success, negative value otherwise.
+ */
+int
+mrvl_configure_txqs(struct mrvl_priv *priv, uint16_t portid,
+ uint16_t max_queues)
+{
+ /* We need only a subset of configuration. */
+ struct port_cfg *port_cfg = &mrvl_qos_cfg->port[portid];
+ int i;
+
+ if (mrvl_qos_cfg == NULL)
+ return 0;
+
+ priv->ppio_params.rate_limit_enable = port_cfg->rate_limit_enable;
+ if (port_cfg->rate_limit_enable)
+ priv->ppio_params.rate_limit_params =
+ port_cfg->rate_limit_params;
+
+ for (i = 0; i < max_queues; i++) {
+ struct pp2_ppio_outq_params *params =
+ &priv->ppio_params.outqs_params.outqs_params[i];
+
+ params->sched_mode = port_cfg->outq[i].sched_mode;
+ params->weight = port_cfg->outq[i].weight;
+ params->rate_limit_enable = port_cfg->outq[i].rate_limit_enable;
+ params->rate_limit_params = port_cfg->outq[i].rate_limit_params;
+ }
+
+ return 0;
+}
+
+/**
* Start QoS mapping.
*
* Finalize QoS table configuration and initialize it in SDK. It can be done
diff --git a/drivers/net/mrvl/mrvl_qos.h b/drivers/net/mrvl/mrvl_qos.h
index bcf5bd3..fa9ddec 100644
--- a/drivers/net/mrvl/mrvl_qos.h
+++ b/drivers/net/mrvl/mrvl_qos.h
@@ -20,6 +20,8 @@
/* QoS config. */
struct mrvl_qos_cfg {
struct port_cfg {
+ int rate_limit_enable;
+ struct pp2_ppio_rate_limit_params rate_limit_params;
struct {
uint8_t inq[MRVL_PP2_RXQ_MAX];
uint8_t dscp[MRVL_CP_PER_TC];
@@ -30,7 +32,10 @@ struct mrvl_qos_cfg {
enum pp2_ppio_color color;
} tc[MRVL_PP2_TC_MAX];
struct {
+ enum pp2_ppio_outq_sched_mode sched_mode;
uint8_t weight;
+ int rate_limit_enable;
+ struct pp2_ppio_rate_limit_params rate_limit_params;
} outq[MRVL_PP2_RXQ_MAX];
enum pp2_cls_qos_tbl_type mapping_priority;
uint16_t inqs;
@@ -74,6 +79,20 @@ mrvl_configure_rxqs(struct mrvl_priv *priv, uint16_t portid,
uint16_t max_queues);
/**
+ * Configure TX Queues in a given port.
+ *
+ * Sets up TX queues egress scheduler and limiter.
+ *
+ * @param priv Port's private data
+ * @param portid DPDK port ID
+ * @param max_queues Maximum number of queues to configure.
+ * @returns 0 in case of success, negative value otherwise.
+ */
+int
+mrvl_configure_txqs(struct mrvl_priv *priv, uint16_t portid,
+ uint16_t max_queues);
+
+/**
* Start QoS mapping.
*
* Finalize QoS table configuration and initialize it in SDK. It can be done
--
2.7.4
next prev parent reply other threads:[~2018-03-15 7:52 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 14:14 [dpdk-dev] [PATCH 0/8] net/mrvl: add new features to PMD Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 1/8] net/mrvl: fix crash when port is closed without starting Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 2/8] net/mrvl: add ingress policer support Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 3/8] net/mrvl: add egress scheduler/rate limiter support Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 4/8] net/mrvl: document policer/scheduler/rate limiter usage Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 5/8] net/mrvl: add classifier support Tomasz Duszynski
2018-03-07 11:07 ` Ferruh Yigit
2018-03-07 11:16 ` Tomasz Duszynski
2018-03-07 11:24 ` Ferruh Yigit
2018-03-08 13:23 ` Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 6/8] net/mrvl: add extended statistics Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 7/8] net/mrvl: add Rx flow control Tomasz Duszynski
2018-02-21 14:14 ` [dpdk-dev] [PATCH 8/8] net/mrvl: add Tx queue start/stop Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 0/8] net/mrvl: add new features to PMD Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 1/8] net/mrvl: fix crash when port is closed without starting Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 2/8] net/mrvl: add ingress policer support Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 3/8] net/mrvl: add egress scheduler/rate limiter support Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 4/8] net/mrvl: document policer/scheduler/rate limiter usage Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 5/8] net/mrvl: add classifier support Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 6/8] net/mrvl: add extended statistics Tomasz Duszynski
2018-03-14 17:21 ` Ferruh Yigit
2018-03-15 7:09 ` Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 7/8] net/mrvl: add Rx flow control Tomasz Duszynski
2018-03-12 8:42 ` [dpdk-dev] [PATCH v2 8/8] net/mrvl: add Tx queue start/stop Tomasz Duszynski
2018-03-15 7:51 ` [dpdk-dev] [PATCH v3 0/8] net/mrvl: add new features to PMD Tomasz Duszynski
2018-03-15 7:51 ` [dpdk-dev] [PATCH v3 1/8] net/mrvl: fix crash when port is closed without starting Tomasz Duszynski
2018-03-15 7:51 ` [dpdk-dev] [PATCH v3 2/8] net/mrvl: add ingress policer support Tomasz Duszynski
2018-03-15 7:51 ` Tomasz Duszynski [this message]
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 4/8] net/mrvl: document policer/scheduler/rate limiter usage Tomasz Duszynski
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 5/8] net/mrvl: add classifier support Tomasz Duszynski
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 6/8] net/mrvl: add extended statistics Tomasz Duszynski
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 7/8] net/mrvl: add Rx flow control Tomasz Duszynski
2018-03-15 7:52 ` [dpdk-dev] [PATCH v3 8/8] net/mrvl: add Tx queue start/stop Tomasz Duszynski
2018-03-15 15:09 ` [dpdk-dev] [PATCH v3 0/8] net/mrvl: add new features to PMD Ferruh Yigit
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=1521100324-26558-4-git-send-email-tdu@semihalf.com \
--to=tdu@semihalf.com \
--cc=dev@dpdk.org \
--cc=dima@marvell.com \
--cc=jck@semihalf.com \
--cc=jianbo.liu@arm.com \
--cc=mw@semihalf.com \
--cc=nsamsono@marvell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).