get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/57870/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 57870,
    "url": "http://patches.dpdk.org/api/patches/57870/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190823144602.58213-6-jasvinder.singh@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20190823144602.58213-6-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190823144602.58213-6-jasvinder.singh@intel.com",
    "date": "2019-08-23T14:45:52",
    "name": "[05/15] sched: modify pipe functions for config flexibility",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a99095e9639432774f2e0f063e8fa24312e46c0b",
    "submitter": {
        "id": 285,
        "url": "http://patches.dpdk.org/api/people/285/?format=api",
        "name": "Jasvinder Singh",
        "email": "jasvinder.singh@intel.com"
    },
    "delegate": {
        "id": 10018,
        "url": "http://patches.dpdk.org/api/users/10018/?format=api",
        "username": "cristian_dumitrescu",
        "first_name": "Cristian",
        "last_name": "Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190823144602.58213-6-jasvinder.singh@intel.com/mbox/",
    "series": [
        {
            "id": 6115,
            "url": "http://patches.dpdk.org/api/series/6115/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6115",
            "date": "2019-08-23T14:45:47",
            "name": "sched: subport level configuration of pipe nodes",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/6115/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/57870/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/57870/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 997811C02C;\n\tFri, 23 Aug 2019 16:46:22 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 08FE21BF08\n\tfor <dev@dpdk.org>; Fri, 23 Aug 2019 16:46:09 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t23 Aug 2019 07:46:09 -0700",
            "from silpixa00381635.ir.intel.com (HELO\n\tsilpixa00381635.ger.corp.intel.com) ([10.237.223.4])\n\tby orsmga001.jf.intel.com with ESMTP; 23 Aug 2019 07:46:08 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.64,421,1559545200\"; d=\"scan'208\";a=\"263211260\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com,\n\tLukasz Krakowiak <lukaszx.krakowiak@intel.com>",
        "Date": "Fri, 23 Aug 2019 15:45:52 +0100",
        "Message-Id": "<20190823144602.58213-6-jasvinder.singh@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190823144602.58213-1-jasvinder.singh@intel.com>",
        "References": "<20190823144602.58213-1-jasvinder.singh@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 05/15] sched: modify pipe functions for config\n\tflexibility",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Modify pipe level functions to allow different subports of the same\nport to have different configuration in terms of number of pipes,\npipe queue sizes, etc.\n\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\nSigned-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>\n---\n lib/librte_sched/rte_sched.c | 95 +++++++++++++++++++++++++-----------\n lib/librte_sched/rte_sched.h |  5 +-\n 2 files changed, 70 insertions(+), 30 deletions(-)",
    "diff": "diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c\nindex 1491cb695..6bafbd8fe 100644\n--- a/lib/librte_sched/rte_sched.c\n+++ b/lib/librte_sched/rte_sched.c\n@@ -648,9 +648,9 @@ rte_sched_subport_config_qsize(struct rte_sched_subport *subport)\n }\n \n static void\n-rte_sched_port_log_pipe_profile(struct rte_sched_port *port, uint32_t i)\n+rte_sched_port_log_pipe_profile(struct rte_sched_subport *subport, uint32_t i)\n {\n-\tstruct rte_sched_pipe_profile *p = port->pipe_profiles + i;\n+\tstruct rte_sched_pipe_profile *p = subport->pipe_profiles + i;\n \n \tRTE_LOG(DEBUG, SCHED, \"Low level config for pipe profile %u:\\n\"\n \t\t\"\tToken bucket: period = %u, credits per period = %u, size = %u\\n\"\n@@ -699,7 +699,7 @@ rte_sched_time_ms_to_bytes(uint32_t time_ms, uint32_t rate)\n }\n \n static void\n-rte_sched_pipe_profile_convert(struct rte_sched_port *port,\n+rte_sched_pipe_profile_convert(struct rte_sched_subport *subport,\n \tstruct rte_sched_pipe_params *src,\n \tstruct rte_sched_pipe_profile *dst,\n \tuint32_t rate)\n@@ -728,7 +728,7 @@ rte_sched_pipe_profile_convert(struct rte_sched_port *port,\n \t\t\t\t\t\trate);\n \n \tfor (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)\n-\t\tif (port->qsize[i])\n+\t\tif (subport->qsize[i])\n \t\t\tdst->tc_credits_per_period[i]\n \t\t\t\t= rte_sched_time_ms_to_bytes(src->tc_period,\n \t\t\t\t\tsrc->tc_rate[i]);\n@@ -756,6 +756,30 @@ rte_sched_pipe_profile_convert(struct rte_sched_port *port,\n \tdst->wrr_cost[3] = (uint8_t) wrr_cost[3];\n }\n \n+static void\n+rte_sched_subport_config_pipe_profile_table(struct rte_sched_subport *subport,\n+\tstruct rte_sched_subport_params *params, uint32_t rate)\n+{\n+\tuint32_t i;\n+\n+\tfor (i = 0; i < subport->n_pipe_profiles; i++) {\n+\t\tstruct rte_sched_pipe_params *src = params->pipe_profiles + i;\n+\t\tstruct rte_sched_pipe_profile *dst = subport->pipe_profiles + i;\n+\n+\t\trte_sched_pipe_profile_convert(subport, src, dst, rate);\n+\t\trte_sched_port_log_pipe_profile(subport, i);\n+\t}\n+\n+\tsubport->pipe_tc_be_rate_max = 0;\n+\tfor (i = 0; i < subport->n_pipe_profiles; i++) {\n+\t\tstruct rte_sched_pipe_params *src = params->pipe_profiles + i;\n+\t\tuint32_t pipe_tc_be_rate = src->tc_rate[RTE_SCHED_TRAFFIC_CLASS_BE];\n+\n+\t\tif (subport->pipe_tc_be_rate_max < pipe_tc_be_rate)\n+\t\t\tsubport->pipe_tc_be_rate_max = pipe_tc_be_rate;\n+\t}\n+}\n+\n static int\n rte_sched_subport_check_params(struct rte_sched_subport_params *params,\n \tuint32_t n_max_pipes_per_subport,\n@@ -1200,6 +1224,9 @@ rte_sched_subport_config(struct rte_sched_port *port,\n \t\t(s->memory + rte_sched_subport_get_array_base(params,\n \t\tport->n_max_pipe_profiles, e_RTE_SCHED_SUBPORT_ARRAY_QUEUE_ARRAY));\n \n+\t/* Pipe profile table */\n+\trte_sched_subport_config_pipe_profile_table(s, params, port->rate);\n+\n \t/* Bitmap */\n \tn_subport_pipe_queues = rte_sched_subport_pipe_queues(s);\n \tbmp_mem_size = rte_bitmap_get_memory_footprint(n_subport_pipe_queues);\n@@ -1242,6 +1269,7 @@ rte_sched_pipe_config(struct rte_sched_port *port,\n \tstruct rte_sched_subport *s;\n \tstruct rte_sched_pipe *p;\n \tstruct rte_sched_pipe_profile *params;\n+\tuint32_t n_subports = subport_id + 1;\n \tuint32_t deactivate, profile, i;\n \n \t/* Check user parameters */\n@@ -1257,34 +1285,32 @@ rte_sched_pipe_config(struct rte_sched_port *port,\n \tif (subport_id >= port->n_subports_per_port) {\n \t\tRTE_LOG(ERR, SCHED,\n \t\t\t\"%s: Incorrect value for parameter subport id\\n\", __func__);\n+\n+\t\trte_sched_free_memory(port, n_subports);\n \t\treturn -EINVAL;\n \t}\n \n-\tif (pipe_id >= port->n_pipes_per_subport) {\n+\ts = port->subports[subport_id];\n+\tif (pipe_id >= s->n_pipes_per_subport) {\n \t\tRTE_LOG(ERR, SCHED,\n \t\t\t\"%s: Incorrect value for parameter pipe id\\n\", __func__);\n+\n+\t\trte_sched_free_memory(port, n_subports);\n \t\treturn -EINVAL;\n \t}\n \n-\tif (!deactivate && profile >= port->n_pipe_profiles) {\n+\tif (!deactivate && profile >= s->n_pipe_profiles) {\n \t\tRTE_LOG(ERR, SCHED,\n \t\t\t\"%s: Incorrect value for parameter pipe profile\\n\", __func__);\n-\t\treturn -EINVAL;\n-\t}\n \n-\t/* Check that subport configuration is valid */\n-\ts = port->subport + subport_id;\n-\tif (s->tb_period == 0) {\n-\t\tRTE_LOG(ERR, SCHED,\n-\t\t\t\"%s: Subport configuration invalid\\n\", __func__);\n+\t\trte_sched_free_memory(port, n_subports);\n \t\treturn -EINVAL;\n \t}\n \n-\tp = port->pipe + (subport_id * port->n_pipes_per_subport + pipe_id);\n-\n \t/* Handle the case when pipe already has a valid configuration */\n+\tp = s->pipe + pipe_id;\n \tif (p->tb_time) {\n-\t\tparams = port->pipe_profiles + p->profile;\n+\t\tparams = s->pipe_profiles + p->profile;\n \n \t\tdouble subport_tc_be_rate =\n \t\t\t(double) s->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE]\n@@ -1314,7 +1340,7 @@ rte_sched_pipe_config(struct rte_sched_port *port,\n \n \t/* Apply the new pipe configuration */\n \tp->profile = profile;\n-\tparams = port->pipe_profiles + p->profile;\n+\tparams = s->pipe_profiles + p->profile;\n \n \t/* Token Bucket (TB) */\n \tp->tb_time = port->time;\n@@ -1324,7 +1350,7 @@ rte_sched_pipe_config(struct rte_sched_port *port,\n \tp->tc_time = port->time + params->tc_period;\n \n \tfor (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)\n-\t\tif (port->qsize[i])\n+\t\tif (s->qsize[i])\n \t\t\tp->tc_credits[i] = params->tc_credits_per_period[i];\n \n \t{\n@@ -1355,9 +1381,11 @@ rte_sched_pipe_config(struct rte_sched_port *port,\n \n int\n rte_sched_port_pipe_profile_add(struct rte_sched_port *port,\n+\tuint32_t subport_id,\n \tstruct rte_sched_pipe_params *params,\n \tuint32_t *pipe_profile_id)\n {\n+\tstruct rte_sched_subport *s;\n \tstruct rte_sched_pipe_profile *pp;\n \tuint32_t i;\n \tint status;\n@@ -1369,40 +1397,49 @@ rte_sched_port_pipe_profile_add(struct rte_sched_port *port,\n \t\treturn -EINVAL;\n \t}\n \n+\t/* Subport id not exceeds the max limit */\n+\tif (subport_id > port->n_subports_per_port) {\n+\t\tRTE_LOG(ERR, SCHED,\n+\t\t\t\"%s: Incorrect value for subport id\\n\", __func__);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\ts = port->subports[subport_id];\n+\n \t/* Pipe profiles not exceeds the max limit */\n-\tif (port->n_pipe_profiles >= port->n_max_pipe_profiles) {\n+\tif (s->n_pipe_profiles >= port->n_max_pipe_profiles) {\n \t\tRTE_LOG(ERR, SCHED,\n \t\t\t\"%s: Number of pipe profiles exceeds the max limit\\n\", __func__);\n \t\treturn -EINVAL;\n \t}\n \n \t/* Pipe params */\n-\tstatus = pipe_profile_check(params, port->rate, &port->qsize[0]);\n+\tstatus = pipe_profile_check(params, port->rate, &s->qsize[0]);\n \tif (status != 0) {\n \t\tRTE_LOG(ERR, SCHED,\n \t\t\t\"%s: Pipe profile check failed(%d)\\n\", __func__, status);\n \t\treturn -EINVAL;\n \t}\n \n-\tpp = &port->pipe_profiles[port->n_pipe_profiles];\n-\trte_sched_pipe_profile_convert(port, params, pp, port->rate);\n+\tpp = &s->pipe_profiles[s->n_pipe_profiles];\n+\trte_sched_pipe_profile_convert(s, params, pp, port->rate);\n \n \t/* Pipe profile not exists */\n-\tfor (i = 0; i < port->n_pipe_profiles; i++)\n-\t\tif (memcmp(port->pipe_profiles + i, pp, sizeof(*pp)) == 0) {\n+\tfor (i = 0; i < s->n_pipe_profiles; i++)\n+\t\tif (memcmp(s->pipe_profiles + i, pp, sizeof(*pp)) == 0) {\n \t\t\tRTE_LOG(ERR, SCHED,\n \t\t\t\t\"%s: Pipe profile doesn't exist\\n\", __func__);\n \t\t\treturn -EINVAL;\n \t\t}\n \n \t/* Pipe profile commit */\n-\t*pipe_profile_id = port->n_pipe_profiles;\n-\tport->n_pipe_profiles++;\n+\t*pipe_profile_id = s->n_pipe_profiles;\n+\ts->n_pipe_profiles++;\n \n-\tif (port->pipe_tc_be_rate_max < params->tc_rate[RTE_SCHED_TRAFFIC_CLASS_BE])\n-\t\tport->pipe_tc_be_rate_max = params->tc_rate[RTE_SCHED_TRAFFIC_CLASS_BE];\n+\tif (s->pipe_tc_be_rate_max < params->tc_rate[RTE_SCHED_TRAFFIC_CLASS_BE])\n+\t\ts->pipe_tc_be_rate_max = params->tc_rate[RTE_SCHED_TRAFFIC_CLASS_BE];\n \n-\trte_sched_port_log_pipe_profile(port, *pipe_profile_id);\n+\trte_sched_port_log_pipe_profile(s, *pipe_profile_id);\n \n \treturn 0;\n }\ndiff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h\nindex 48be702bc..56e9fbfa7 100644\n--- a/lib/librte_sched/rte_sched.h\n+++ b/lib/librte_sched/rte_sched.h\n@@ -308,6 +308,8 @@ rte_sched_port_free(struct rte_sched_port *port);\n  *\n  * @param port\n  *   Handle to port scheduler instance\n+ * @param subport_id\n+ *   Subport ID\n  * @param params\n  *   Pipe profile parameters\n  * @param pipe_profile_id\n@@ -318,6 +320,7 @@ rte_sched_port_free(struct rte_sched_port *port);\n __rte_experimental\n int\n rte_sched_port_pipe_profile_add(struct rte_sched_port *port,\n+\tuint32_t subport_id,\n \tstruct rte_sched_pipe_params *params,\n \tuint32_t *pipe_profile_id);\n \n@@ -348,7 +351,7 @@ rte_sched_subport_config(struct rte_sched_port *port,\n  * @param pipe_id\n  *   Pipe ID within subport\n  * @param pipe_profile\n- *   ID of port-level pre-configured pipe profile\n+ *   ID of subport-level pre-configured pipe profile\n  * @return\n  *   0 upon success, error code otherwise\n  */\n",
    "prefixes": [
        "05/15"
    ]
}