Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/48352/?format=api
http://patches.dpdk.org/api/patches/48352/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/154333208456.44971.4368617596098355843.stgit@dbuild/", "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": "<154333208456.44971.4368617596098355843.stgit@dbuild>", "list_archive_url": "https://inbox.dpdk.org/dev/154333208456.44971.4368617596098355843.stgit@dbuild", "date": "2018-11-27T15:21:25", "name": "[1/3] lib/librte_meter: add RFC4115 trTCM meter support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "92c68d1b465fb0effb23712e17c6aea32688ec3c", "submitter": { "id": 672, "url": "http://patches.dpdk.org/api/people/672/?format=api", "name": "Eelco Chaudron", "email": "echaudro@redhat.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/154333208456.44971.4368617596098355843.stgit@dbuild/mbox/", "series": [ { "id": 2581, "url": "http://patches.dpdk.org/api/series/2581/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2581", "date": "2018-11-27T15:20:44", "name": "lib/librte_meter: add RFC4115 trTCM meter support", "version": 1, "mbox": "http://patches.dpdk.org/series/2581/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/48352/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/48352/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 648521B46C;\n\tTue, 27 Nov 2018 16:21:30 +0100 (CET)", "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id 612E81B46C\n\tfor <dev@dpdk.org>; Tue, 27 Nov 2018 16:21:28 +0100 (CET)", "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id BBF76308213E;\n\tTue, 27 Nov 2018 15:21:27 +0000 (UTC)", "from localhost.localdomain (ovpn-116-193.ams2.redhat.com\n\t[10.36.116.193])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 1229F608E0;\n\tTue, 27 Nov 2018 15:21:26 +0000 (UTC)" ], "From": "Eelco Chaudron <echaudro@redhat.com>", "To": "cristian.dumitrescu@intel.com", "Cc": "dev@dpdk.org", "Date": "Tue, 27 Nov 2018 15:21:25 +0000", "Message-Id": "<154333208456.44971.4368617596098355843.stgit@dbuild>", "In-Reply-To": "<154333204294.44971.12989297399338053044.stgit@dbuild>", "References": "<154333204294.44971.12989297399338053044.stgit@dbuild>", "User-Agent": "StGit/unknown-version", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.13", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.42]); Tue, 27 Nov 2018 15:21:27 +0000 (UTC)", "Subject": "[dpdk-dev] [PATCH 1/3] lib/librte_meter: add RFC4115 trTCM meter\n\tsupport", "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": "This patch adds support for RFC4115 trTCM meters.\n\nSigned-off-by: Eelco Chaudron <echaudro@redhat.com>\n---\n lib/librte_meter/rte_meter.c | 40 +++++++++\n lib/librte_meter/rte_meter.h | 193 +++++++++++++++++++++++++++++++++++++++---\n 2 files changed, 217 insertions(+), 16 deletions(-)", "diff": "diff --git a/lib/librte_meter/rte_meter.c b/lib/librte_meter/rte_meter.c\nindex 473f69aba..aeeac69fe 100644\n--- a/lib/librte_meter/rte_meter.c\n+++ b/lib/librte_meter/rte_meter.c\n@@ -110,3 +110,43 @@ rte_meter_trtcm_config(struct rte_meter_trtcm *m,\n \n \treturn 0;\n }\n+\n+int\n+rte_meter_trtcm_rfc4115_profile_config(struct rte_meter_trtcm_profile *p,\n+\tstruct rte_meter_trtcm_params *params)\n+{\n+\tuint64_t hz = rte_get_tsc_hz();\n+\n+\t/* Check input parameters */\n+\tif ((p == NULL) ||\n+\t\t(params == NULL) ||\n+\t\t(params->cir != 0 && params->cbs == 0) ||\n+\t\t(params->eir != 0 && params->ebs == 0))\n+\t\treturn -EINVAL;\n+\n+\t/* Initialize trTCM run-time structure */\n+\tp->cbs = params->cbs;\n+\tp->ebs = params->ebs;\n+\trte_meter_get_tb_params(hz, params->cir, &p->cir_period,\n+\t\t&p->cir_bytes_per_period);\n+\trte_meter_get_tb_params(hz, params->eir, &p->eir_period,\n+\t\t&p->eir_bytes_per_period);\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_meter_trtcm_rfc4115_config(struct rte_meter_trtcm *m,\n+\tstruct rte_meter_trtcm_profile *p)\n+{\n+\t/* Check input parameters */\n+\tif ((m == NULL) || (p == NULL))\n+\t\treturn -EINVAL;\n+\n+\t/* Initialize trTCM run-time structure */\n+\tm->time_tc = m->time_te = rte_get_tsc_cycles();\n+\tm->tc = p->cbs;\n+\tm->te = p->ebs;\n+\n+\treturn 0;\n+}\ndiff --git a/lib/librte_meter/rte_meter.h b/lib/librte_meter/rte_meter.h\nindex 58a051583..ff1ca3f77 100644\n--- a/lib/librte_meter/rte_meter.h\n+++ b/lib/librte_meter/rte_meter.h\n@@ -16,6 +16,7 @@ extern \"C\" {\n * Traffic metering algorithms:\n * 1. Single Rate Three Color Marker (srTCM): defined by IETF RFC 2697\n * 2. Two Rate Three Color Marker (trTCM): defined by IETF RFC 2698\n+ * 3. Two Rate Three Color Marker (trTCM): defined by IETF RFC 4115\n *\n ***/\n \n@@ -43,14 +44,25 @@ struct rte_meter_srtcm_params {\n \tuint64_t ebs; /**< Excess Burst Size (EBS). Measured in bytes. */\n };\n \n-/** trTCM parameters per metered traffic flow. The CIR, PIR, CBS and PBS parameters\n-only count bytes of IP packets and do not include link specific headers. PIR has to\n-be greater than or equal to CIR. Both CBS or EBS have to be greater than zero. */\n+/** trTCM parameters per metered traffic flow. The CIR, PIR/EIT, CBS and PBS/EBS\n+parameters only count bytes of IP packets and do not include link specific\n+headers.\n+\n+- For RFC2698 operations PIR has to be greater than or equal to CIR. Both CBS\n+ or EBS have to be greater than zero.\n+- For RFC4115 operations CBS and EBS need to be greater than zero if CIR and\n+ EIR are none-zero respectively.*/\n struct rte_meter_trtcm_params {\n \tuint64_t cir; /**< Committed Information Rate (CIR). Measured in bytes per second. */\n-\tuint64_t pir; /**< Peak Information Rate (PIR). Measured in bytes per second. */\n-\tuint64_t cbs; /**< Committed Burst Size (CBS). Measured in byes. */\n-\tuint64_t pbs; /**< Peak Burst Size (PBS). Measured in bytes. */\n+\tunion {\n+\t\tuint64_t pir; /**< Peak Information Rate (PIR). Measured in bytes per second. */\n+\t\tuint64_t eir; /**< Excess Information Rate (EIR). Measured in bytes per second. */\n+\t};\n+\tuint64_t cbs; /**< Committed Burst Size (CBS). Measured in bytes. */\n+\tunion {\n+\t\tuint64_t pbs; /**< Peak Burst Size (PBS). Measured in bytes. */\n+\t\tuint64_t ebs; /**< Excess Burst Size (EBS). Measured in bytes. */\n+\t};\n };\n \n /**\n@@ -98,6 +110,19 @@ rte_meter_srtcm_profile_config(struct rte_meter_srtcm_profile *p,\n int\n rte_meter_trtcm_profile_config(struct rte_meter_trtcm_profile *p,\n \tstruct rte_meter_trtcm_params *params);\n+/**\n+ * trTCM RFC 4115 profile configuration\n+ *\n+ * @param p\n+ * Pointer to pre-allocated trTCM profile data structure\n+ * @param params\n+ * trTCM profile parameters\n+ * @return\n+ * 0 upon success, error code otherwise\n+ */\n+int\n+rte_meter_trtcm_rfc4115_profile_config(struct rte_meter_trtcm_profile *p,\n+\tstruct rte_meter_trtcm_params *params);\n \n /**\n * srTCM configuration per metered traffic flow\n@@ -127,6 +152,20 @@ int\n rte_meter_trtcm_config(struct rte_meter_trtcm *m,\n \tstruct rte_meter_trtcm_profile *p);\n \n+/**\n+ * trTCM RFC 4115 configuration per metered traffic flow\n+ *\n+ * @param m\n+ * Pointer to pre-allocated trTCM data structure\n+ * @param p\n+ * trTCM profile. Needs to be valid.\n+ * @return\n+ * 0 upon success, error code otherwise\n+ */\n+int\n+rte_meter_trtcm_rfc4115_config(struct rte_meter_trtcm *m,\n+\tstruct rte_meter_trtcm_profile *p);\n+\n /**\n * srTCM color blind traffic metering\n *\n@@ -213,6 +252,49 @@ rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,\n \tuint32_t pkt_len,\n \tenum rte_meter_color pkt_color);\n \n+/**\n+ * trTCM RFC4115 color blind traffic metering\n+ *\n+ * @param m\n+ * Handle to trTCM instance\n+ * @param p\n+ * trTCM profile specified at trTCM object creation time\n+ * @param time\n+ * Current CPU time stamp (measured in CPU cycles)\n+ * @param pkt_len\n+ * Length of the current IP packet (measured in bytes)\n+ * @return\n+ * Color assigned to the current IP packet\n+ */\n+static inline enum rte_meter_color\n+rte_meter_trtcm_rfc4115_color_blind_check(struct rte_meter_trtcm *m,\n+\tstruct rte_meter_trtcm_profile *p,\n+\tuint64_t time,\n+\tuint32_t pkt_len);\n+\n+/**\n+ * trTCM RFC4115 color aware traffic metering\n+ *\n+ * @param m\n+ * Handle to trTCM instance\n+ * @param p\n+ * trTCM profile specified at trTCM object creation time\n+ * @param time\n+ * Current CPU time stamp (measured in CPU cycles)\n+ * @param pkt_len\n+ * Length of the current IP packet (measured in bytes)\n+ * @param pkt_color\n+ * Input color of the current IP packet\n+ * @return\n+ * Color assigned to the current IP packet\n+ */\n+static inline enum rte_meter_color\n+rte_meter_trtcm_rfc4115_color_aware_check(struct rte_meter_trtcm *m,\n+\tstruct rte_meter_trtcm_profile *p,\n+\tuint64_t time,\n+\tuint32_t pkt_len,\n+\tenum rte_meter_color pkt_color);\n+\n /*\n * Inline implementation of run-time methods\n *\n@@ -239,16 +321,28 @@ struct rte_meter_srtcm {\n struct rte_meter_trtcm_profile {\n \tuint64_t cbs;\n \t/**< Upper limit for C token bucket */\n-\tuint64_t pbs;\n-\t/**< Upper limit for P token bucket */\n+\tunion {\n+\t\tuint64_t pbs;\n+\t\t/**< Upper limit for P token bucket */\n+\t\tuint64_t ebs;\n+\t\t/**< Upper limit for E token bucket */\n+\t};\n \tuint64_t cir_period;\n \t/**< Number of CPU cycles for one update of C token bucket */\n \tuint64_t cir_bytes_per_period;\n \t/**< Number of bytes to add to C token bucket on each update */\n-\tuint64_t pir_period;\n-\t/**< Number of CPU cycles for one update of P token bucket */\n-\tuint64_t pir_bytes_per_period;\n-\t/**< Number of bytes to add to P token bucket on each update */\n+\tunion {\n+\t\tuint64_t pir_period;\n+\t\t/**< Number of CPU cycles for one update of P token bucket */\n+\t\tuint64_t eir_period;\n+\t\t/**< Number of CPU cycles for one update of E token bucket */\n+\t};\n+\tunion {\n+\t\tuint64_t pir_bytes_per_period;\n+\t\t/**< Number of bytes to add to P token bucket on each update */\n+\t\tuint64_t eir_bytes_per_period;\n+\t\t/**< Number of bytes to add to E token bucket on each update */\n+\t};\n };\n \n /**\n@@ -258,12 +352,20 @@ struct rte_meter_trtcm_profile {\n struct rte_meter_trtcm {\n \tuint64_t time_tc;\n \t/**< Time of latest update of C token bucket */\n-\tuint64_t time_tp;\n-\t/**< Time of latest update of E token bucket */\n+\tunion {\n+\t\tuint64_t time_tp;\n+\t\t/**< Time of latest update of P token bucket */\n+\t\tuint64_t time_te;\n+\t\t/**< Time of latest update of E token bucket */\n+\t};\n \tuint64_t tc;\n \t/**< Number of bytes currently available in committed(C) token bucket */\n-\tuint64_t tp;\n-\t/**< Number of bytes currently available in the peak(P) token bucket */\n+\tunion {\n+\t\tuint64_t tp;\n+\t\t/**< Number of bytes currently available in the peak(P) token bucket */\n+\t\tuint64_t te;\n+\t\t/**< Number of bytes currently available in the excess(E) token bucket */\n+\t};\n };\n \n static inline enum rte_meter_color\n@@ -434,6 +536,65 @@ rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,\n \treturn e_RTE_METER_GREEN;\n }\n \n+static inline enum rte_meter_color\n+rte_meter_trtcm_rfc4115_color_blind_check(struct rte_meter_trtcm *m,\n+\tstruct rte_meter_trtcm_profile *p,\n+\tuint64_t time,\n+\tuint32_t pkt_len)\n+{\n+\treturn rte_meter_trtcm_rfc4115_color_aware_check(m, p, time, pkt_len,\n+\t\t\t\t\t\t\t e_RTE_METER_GREEN);\n+}\n+\n+static inline enum rte_meter_color\n+rte_meter_trtcm_rfc4115_color_aware_check(struct rte_meter_trtcm *m,\n+\tstruct rte_meter_trtcm_profile *p,\n+\tuint64_t time,\n+\tuint32_t pkt_len,\n+\tenum rte_meter_color pkt_color)\n+{\n+\tuint64_t time_diff_tc, time_diff_te, n_periods_tc, n_periods_te, tc, te;\n+\n+\t/* Bucket update */\n+\ttime_diff_tc = time - m->time_tc;\n+\ttime_diff_te = time - m->time_te;\n+\tn_periods_tc = time_diff_tc / p->cir_period;\n+\tn_periods_te = time_diff_te / p->eir_period;\n+\tm->time_tc += n_periods_tc * p->cir_period;\n+\tm->time_te += n_periods_te * p->eir_period;\n+\n+\ttc = m->tc + n_periods_tc * p->cir_bytes_per_period;\n+\tif (tc > p->cbs)\n+\t\ttc = p->cbs;\n+\n+\tte = m->te + n_periods_te * p->eir_bytes_per_period;\n+\tif (te > p->ebs)\n+\t\tte = p->ebs;\n+\n+\t/* Color logic */\n+\tif (pkt_color == e_RTE_METER_GREEN) {\n+\t\tif (tc >= pkt_len) {\n+\t\t\tm->tc = tc - pkt_len;\n+\t\t\tm->te = te;\n+\t\t\treturn e_RTE_METER_GREEN;\n+\t\t} else if (te >= pkt_len) {\n+\t\t\tm->tc = tc;\n+\t\t\tm->te = te - pkt_len;\n+\t\t\treturn e_RTE_METER_YELLOW;\n+\t\t}\n+\t} else if (pkt_color == e_RTE_METER_YELLOW && te >= pkt_len) {\n+\t\tm->tc = tc;\n+\t\tm->te = te - pkt_len;\n+\t\treturn e_RTE_METER_YELLOW;\n+\t}\n+\n+\t/* If we end up here the color is RED */\n+\tm->tc = tc;\n+\tm->te = te;\n+\treturn e_RTE_METER_RED;\n+}\n+\n+\n #ifdef __cplusplus\n }\n #endif\n", "prefixes": [ "1/3" ] }{ "id": 48352, "url": "