get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41142,
    "url": "http://patches.dpdk.org/api/patches/41142/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180614135130.30849-3-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": "<20180614135130.30849-3-gage.eads@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180614135130.30849-3-gage.eads@intel.com",
    "date": "2018-06-14T13:51:30",
    "name": "[v2,2/2] event/sw: support device stop flush callback",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f0dfd3b46ec4ebde6b93be0983bfccc44a62c091",
    "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/20180614135130.30849-3-gage.eads@intel.com/mbox/",
    "series": [
        {
            "id": 129,
            "url": "http://patches.dpdk.org/api/series/129/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=129",
            "date": "2018-06-14T13:51:28",
            "name": "Improve service stop support",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/129/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41142/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/41142/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 50C401E2A3;\n\tThu, 14 Jun 2018 15:51:58 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id E0CEE1DFF7\n\tfor <dev@dpdk.org>; Thu, 14 Jun 2018 15:51:55 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t14 Jun 2018 06:51:55 -0700",
            "from txasoft-yocto.an.intel.com ([10.123.72.192])\n\tby orsmga005.jf.intel.com with ESMTP; 14 Jun 2018 06:51:54 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,222,1526367600\"; d=\"scan'208\";a=\"232574712\"",
        "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, nikhil.rao@intel.com,\n\terik.g.carrillo@intel.com, abhinandan.gujjar@intel.com",
        "Date": "Thu, 14 Jun 2018 08:51:30 -0500",
        "Message-Id": "<20180614135130.30849-3-gage.eads@intel.com>",
        "X-Mailer": "git-send-email 2.13.6",
        "In-Reply-To": "<20180614135130.30849-1-gage.eads@intel.com>",
        "References": "<20180531135557.7544-1-gage.eads@intel.com>\n\t<20180614135130.30849-1-gage.eads@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 2/2] event/sw: support device stop flush\n\tcallback",
        "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://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": "<https://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 also adds a flush callback test to the sw eventdev's selftest\nsuite.\n\nSigned-off-by: Gage Eads <gage.eads@intel.com>\nAcked-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n drivers/event/sw/sw_evdev.c          | 114 ++++++++++++++++++++++++++++++++++-\n drivers/event/sw/sw_evdev_selftest.c |  81 ++++++++++++++++++++++++-\n 2 files changed, 192 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c\nindex 10f0e1ad4..331c518ff 100644\n--- a/drivers/event/sw/sw_evdev.c\n+++ b/drivers/event/sw/sw_evdev.c\n@@ -361,9 +361,99 @@ sw_init_qid_iqs(struct sw_evdev *sw)\n \t}\n }\n \n+static int\n+sw_qids_empty(struct sw_evdev *sw)\n+{\n+\tunsigned int i, j;\n+\n+\tfor (i = 0; i < sw->qid_count; i++) {\n+\t\tfor (j = 0; j < SW_IQS_MAX; j++) {\n+\t\t\tif (iq_count(&sw->qids[i].iq[j]))\n+\t\t\t\treturn 0;\n+\t\t}\n+\t}\n+\n+\treturn 1;\n+}\n+\n+static int\n+sw_ports_empty(struct sw_evdev *sw)\n+{\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < sw->port_count; i++) {\n+\t\tif ((rte_event_ring_count(sw->ports[i].rx_worker_ring)) ||\n+\t\t     rte_event_ring_count(sw->ports[i].cq_worker_ring))\n+\t\t\treturn 0;\n+\t}\n+\n+\treturn 1;\n+}\n+\n+static void\n+sw_drain_ports(struct rte_eventdev *dev)\n+{\n+\tstruct sw_evdev *sw = sw_pmd_priv(dev);\n+\teventdev_stop_flush_t flush;\n+\tunsigned int i;\n+\tuint8_t dev_id;\n+\tvoid *arg;\n+\n+\tflush = dev->dev_ops->dev_stop_flush;\n+\tdev_id = dev->data->dev_id;\n+\targ = dev->data->dev_stop_flush_arg;\n+\n+\tfor (i = 0; i < sw->port_count; i++) {\n+\t\tstruct rte_event ev;\n+\n+\t\twhile (rte_event_dequeue_burst(dev_id, i, &ev, 1, 0)) {\n+\t\t\tif (flush)\n+\t\t\t\tflush(dev_id, ev, arg);\n+\n+\t\t\tev.op = RTE_EVENT_OP_RELEASE;\n+\t\t\trte_event_enqueue_burst(dev_id, i, &ev, 1);\n+\t\t}\n+\t}\n+}\n+\n+static void\n+sw_drain_queue(struct rte_eventdev *dev, struct sw_iq *iq)\n+{\n+\tstruct sw_evdev *sw = sw_pmd_priv(dev);\n+\teventdev_stop_flush_t flush;\n+\tuint8_t dev_id;\n+\tvoid *arg;\n+\n+\tflush = dev->dev_ops->dev_stop_flush;\n+\tdev_id = dev->data->dev_id;\n+\targ = dev->data->dev_stop_flush_arg;\n+\n+\twhile (iq_count(iq) > 0) {\n+\t\tstruct rte_event ev;\n+\n+\t\tiq_dequeue_burst(sw, iq, &ev, 1);\n+\n+\t\tif (flush)\n+\t\t\tflush(dev_id, ev, arg);\n+\t}\n+}\n+\n+static void\n+sw_drain_queues(struct rte_eventdev *dev)\n+{\n+\tstruct sw_evdev *sw = sw_pmd_priv(dev);\n+\tunsigned int i, j;\n+\n+\tfor (i = 0; i < sw->qid_count; i++) {\n+\t\tfor (j = 0; j < SW_IQS_MAX; j++)\n+\t\t\tsw_drain_queue(dev, &sw->qids[i].iq[j]);\n+\t}\n+}\n+\n static void\n-sw_clean_qid_iqs(struct sw_evdev *sw)\n+sw_clean_qid_iqs(struct rte_eventdev *dev)\n {\n+\tstruct sw_evdev *sw = sw_pmd_priv(dev);\n \tint i, j;\n \n \t/* Release the IQ memory of all configured qids */\n@@ -729,10 +819,30 @@ static void\n sw_stop(struct rte_eventdev *dev)\n {\n \tstruct sw_evdev *sw = sw_pmd_priv(dev);\n-\tsw_clean_qid_iqs(sw);\n+\tint32_t runstate;\n+\n+\t/* Stop the scheduler if it's running */\n+\trunstate = rte_service_runstate_get(sw->service_id);\n+\tif (runstate == 1)\n+\t\trte_service_runstate_set(sw->service_id, 0);\n+\n+\twhile (rte_service_may_be_active(sw->service_id))\n+\t\trte_pause();\n+\n+\t/* Flush all events out of the device */\n+\twhile (!(sw_qids_empty(sw) && sw_ports_empty(sw))) {\n+\t\tsw_event_schedule(dev);\n+\t\tsw_drain_ports(dev);\n+\t\tsw_drain_queues(dev);\n+\t}\n+\n+\tsw_clean_qid_iqs(dev);\n \tsw_xstats_uninit(sw);\n \tsw->started = 0;\n \trte_smp_wmb();\n+\n+\tif (runstate == 1)\n+\t\trte_service_runstate_set(sw->service_id, 1);\n }\n \n static int\ndiff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c\nindex 78d30e07a..c40912db5 100644\n--- a/drivers/event/sw/sw_evdev_selftest.c\n+++ b/drivers/event/sw/sw_evdev_selftest.c\n@@ -28,6 +28,7 @@\n #define MAX_PORTS 16\n #define MAX_QIDS 16\n #define NUM_PACKETS (1<<18)\n+#define DEQUEUE_DEPTH 128\n \n static int evdev;\n \n@@ -147,7 +148,7 @@ init(struct test *t, int nb_queues, int nb_ports)\n \t\t\t.nb_event_ports = nb_ports,\n \t\t\t.nb_event_queue_flows = 1024,\n \t\t\t.nb_events_limit = 4096,\n-\t\t\t.nb_event_port_dequeue_depth = 128,\n+\t\t\t.nb_event_port_dequeue_depth = DEQUEUE_DEPTH,\n \t\t\t.nb_event_port_enqueue_depth = 128,\n \t};\n \tint ret;\n@@ -2807,6 +2808,78 @@ holb(struct test *t) /* test to check we avoid basic head-of-line blocking */\n \treturn -1;\n }\n \n+static void\n+flush(uint8_t dev_id __rte_unused, struct rte_event event, void *arg)\n+{\n+\t*((uint8_t *) arg) += (event.u64 == 0xCA11BACC) ? 1 : 0;\n+}\n+\n+static int\n+dev_stop_flush(struct test *t) /* test to check we can properly flush events */\n+{\n+\tconst struct rte_event new_ev = {\n+\t\t.op = RTE_EVENT_OP_NEW,\n+\t\t.u64 = 0xCA11BACC,\n+\t\t.queue_id = 0\n+\t};\n+\tstruct rte_event ev = new_ev;\n+\tuint8_t count = 0;\n+\tint i;\n+\n+\tif (init(t, 1, 1) < 0 ||\n+\t    create_ports(t, 1) < 0 ||\n+\t    create_atomic_qids(t, 1) < 0) {\n+\t\tprintf(\"%d: Error initializing device\\n\", __LINE__);\n+\t\treturn -1;\n+\t}\n+\n+\t/* Link the queue so *_start() doesn't error out */\n+\tif (rte_event_port_link(evdev, t->port[0], NULL, NULL, 0) != 1) {\n+\t\tprintf(\"%d: Error linking queue to port\\n\", __LINE__);\n+\t\tgoto err;\n+\t}\n+\n+\tif (rte_event_dev_start(evdev) < 0) {\n+\t\tprintf(\"%d: Error with start call\\n\", __LINE__);\n+\t\tgoto err;\n+\t}\n+\n+\tfor (i = 0; i < DEQUEUE_DEPTH + 1; i++) {\n+\t\tif (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) {\n+\t\t\tprintf(\"%d: Error enqueuing events\\n\", __LINE__);\n+\t\t\tgoto err;\n+\t\t}\n+\t}\n+\n+\t/* Schedule the events from the port to the IQ. At least one event\n+\t * should be remaining in the queue.\n+\t */\n+\trte_service_run_iter_on_app_lcore(t->service_id, 1);\n+\n+\tif (rte_event_dev_stop_flush_callback_register(evdev, flush, &count)) {\n+\t\tprintf(\"%d: Error installing the flush callback\\n\", __LINE__);\n+\t\tgoto err;\n+\t}\n+\n+\tcleanup(t);\n+\n+\tif (count == 0) {\n+\t\tprintf(\"%d: Error executing the flush callback\\n\", __LINE__);\n+\t\tgoto err;\n+\t}\n+\n+\tif (rte_event_dev_stop_flush_callback_register(evdev, NULL, NULL)) {\n+\t\tprintf(\"%d: Error uninstalling the flush callback\\n\", __LINE__);\n+\t\tgoto err;\n+\t}\n+\n+\treturn 0;\n+err:\n+\trte_event_dev_dump(evdev, stdout);\n+\tcleanup(t);\n+\treturn -1;\n+}\n+\n static int\n worker_loopback_worker_fn(void *arg)\n {\n@@ -3211,6 +3284,12 @@ test_sw_eventdev(void)\n \t\tprintf(\"ERROR - Head-of-line-blocking test FAILED.\\n\");\n \t\tgoto test_fail;\n \t}\n+\tprintf(\"*** Running Stop Flush test...\\n\");\n+\tret = dev_stop_flush(t);\n+\tif (ret != 0) {\n+\t\tprintf(\"ERROR - Stop Flush test FAILED.\\n\");\n+\t\tgoto test_fail;\n+\t}\n \tif (rte_lcore_count() >= 3) {\n \t\tprintf(\"*** Running Worker loopback test...\\n\");\n \t\tret = worker_loopback(t, 0);\n",
    "prefixes": [
        "v2",
        "2/2"
    ]
}