get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 31770,
    "url": "http://patches.dpdk.org/api/patches/31770/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1512015636-31878-3-git-send-email-gage.eads@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": "<1512015636-31878-3-git-send-email-gage.eads@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1512015636-31878-3-git-send-email-gage.eads@intel.com",
    "date": "2017-11-30T04:20:36",
    "name": "[dpdk-dev,2/2] event/sw: simplify credit scheme",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "31623850653b1a064c0eb01c4129a73bd89e9593",
    "submitter": {
        "id": 586,
        "url": "http://patches.dpdk.org/api/people/586/?format=api",
        "name": "Eads, Gage",
        "email": "gage.eads@intel.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1512015636-31878-3-git-send-email-gage.eads@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/31770/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/31770/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 C77D43258;\n\tThu, 30 Nov 2017 05:20:54 +0100 (CET)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 012D8324A\n\tfor <dev@dpdk.org>; Thu, 30 Nov 2017 05:20:51 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Nov 2017 20:20:51 -0800",
            "from txasoft-yocto.an.intel.com (HELO txasoft-yocto.an.intel.com.)\n\t([10.123.72.111])\n\tby fmsmga002.fm.intel.com with ESMTP; 29 Nov 2017 20:20:50 -0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.45,339,1508828400\"; d=\"scan'208\";\n\ta=\"1250152212\"",
        "From": "Gage Eads <gage.eads@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com,\n\tbruce.richardson@intel.com, hemant.agrawal@nxp.com, nipun.gupta@nxp.com, \n\tsantosh.shukla@caviumnetworks.com",
        "Date": "Wed, 29 Nov 2017 22:20:36 -0600",
        "Message-Id": "<1512015636-31878-3-git-send-email-gage.eads@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1512015636-31878-1-git-send-email-gage.eads@intel.com>",
        "References": "<1512015636-31878-1-git-send-email-gage.eads@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 2/2] event/sw: simplify credit scheme",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/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 commit modifies the sw PMD credit scheme such that credits are\nconsumed when enqueueing a NEW event and released when an event is\nreleased -- typically, the beginning and end of a pipeline. Workers that\nsimply forward events do not interact with the credit pool.\n\nSigned-off-by: Gage Eads <gage.eads@intel.com>\n---\n drivers/event/sw/sw_evdev_worker.c | 38 +++++++++++++++++++-------------------\n 1 file changed, 19 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/drivers/event/sw/sw_evdev_worker.c b/drivers/event/sw/sw_evdev_worker.c\nindex 93cd29b..766c836 100644\n--- a/drivers/event/sw/sw_evdev_worker.c\n+++ b/drivers/event/sw/sw_evdev_worker.c\n@@ -85,6 +85,7 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)\n \tstruct sw_port *p = port;\n \tstruct sw_evdev *sw = (void *)p->sw;\n \tuint32_t sw_inflights = rte_atomic32_read(&sw->inflights);\n+\tuint32_t credit_update_quanta = sw->credit_update_quanta;\n \tint new = 0;\n \n \tif (num > PORT_ENQUEUE_MAX_BURST_SIZE)\n@@ -98,7 +99,6 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)\n \n \tif (p->inflight_credits < new) {\n \t\t/* check if event enqueue brings port over max threshold */\n-\t\tuint32_t credit_update_quanta = sw->credit_update_quanta;\n \t\tif (sw_inflights + credit_update_quanta > sw->nb_events_limit)\n \t\t\treturn 0;\n \n@@ -109,7 +109,6 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)\n \t\t\treturn 0;\n \t}\n \n-\tuint32_t completions = 0;\n \tfor (i = 0; i < num; i++) {\n \t\tint op = ev[i].op;\n \t\tint outstanding = p->outstanding_releases > 0;\n@@ -126,21 +125,16 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)\n \t\t * correct usage of the API), providing very high correct\n \t\t * prediction rate.\n \t\t */\n-\t\tif ((new_ops[i] & QE_FLAG_COMPLETE) && outstanding) {\n+\t\tif ((new_ops[i] & QE_FLAG_COMPLETE) && outstanding)\n \t\t\tp->outstanding_releases--;\n-\t\t\tcompletions++;\n-\t\t}\n \n \t\t/* error case: branch to avoid touching p->stats */\n-\t\tif (unlikely(invalid_qid)) {\n+\t\tif (unlikely(invalid_qid && op != RTE_EVENT_OP_RELEASE)) {\n \t\t\tp->stats.rx_dropped++;\n \t\t\tp->inflight_credits++;\n \t\t}\n \t}\n \n-\t/* handle directed port forward and release credits */\n-\tp->inflight_credits -= completions * p->is_directed;\n-\n \t/* returns number of events actually enqueued */\n \tuint32_t enq = enqueue_burst_with_ops(p->rx_worker_ring, ev, i,\n \t\t\t\t\t     new_ops);\n@@ -153,6 +147,13 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)\n \t\tp->avg_pkt_ticks += burst_pkt_ticks / NUM_SAMPLES;\n \t\tp->last_dequeue_ticks = 0;\n \t}\n+\n+\t/* Replenish credits if enough releases are performed */\n+\tif (p->inflight_credits >= credit_update_quanta * 2) {\n+\t\trte_atomic32_sub(&sw->inflights, credit_update_quanta);\n+\t\tp->inflight_credits -= credit_update_quanta;\n+\t}\n+\n \treturn enq;\n }\n \n@@ -168,16 +169,22 @@ sw_event_dequeue_burst(void *port, struct rte_event *ev, uint16_t num,\n {\n \tRTE_SET_USED(wait);\n \tstruct sw_port *p = (void *)port;\n-\tstruct sw_evdev *sw = (void *)p->sw;\n \tstruct rte_event_ring *ring = p->cq_worker_ring;\n-\tuint32_t credit_update_quanta = sw->credit_update_quanta;\n \n \t/* check that all previous dequeues have been released */\n-\tif (p->implicit_release && !p->is_directed) {\n+\tif (p->implicit_release) {\n+\t\tstruct sw_evdev *sw = (void *)p->sw;\n+\t\tuint32_t credit_update_quanta = sw->credit_update_quanta;\n \t\tuint16_t out_rels = p->outstanding_releases;\n \t\tuint16_t i;\n \t\tfor (i = 0; i < out_rels; i++)\n \t\t\tsw_event_release(p, i);\n+\n+\t\t/* Replenish credits if enough releases are performed */\n+\t\tif (p->inflight_credits >= credit_update_quanta * 2) {\n+\t\t\trte_atomic32_sub(&sw->inflights, credit_update_quanta);\n+\t\t\tp->inflight_credits -= credit_update_quanta;\n+\t\t}\n \t}\n \n \t/* returns number of events actually dequeued */\n@@ -188,8 +195,6 @@ sw_event_dequeue_burst(void *port, struct rte_event *ev, uint16_t num,\n \t\tgoto end;\n \t}\n \n-\t/* only add credits for directed ports - LB ports send RELEASEs */\n-\tp->inflight_credits += ndeq * p->is_directed;\n \tp->outstanding_releases += ndeq;\n \tp->last_dequeue_burst_sz = ndeq;\n \tp->last_dequeue_ticks = rte_get_timer_cycles();\n@@ -197,11 +202,6 @@ sw_event_dequeue_burst(void *port, struct rte_event *ev, uint16_t num,\n \tp->total_polls++;\n \n end:\n-\tif (p->inflight_credits >= credit_update_quanta * 2 &&\n-\t\t\tp->inflight_credits > credit_update_quanta + ndeq) {\n-\t\trte_atomic32_sub(&sw->inflights, credit_update_quanta);\n-\t\tp->inflight_credits -= credit_update_quanta;\n-\t}\n \treturn ndeq;\n }\n \n",
    "prefixes": [
        "dpdk-dev",
        "2/2"
    ]
}