get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 75077,
    "url": "http://patches.dpdk.org/api/patches/75077/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1596138614-17409-28-git-send-email-timothy.mcdaniel@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": "<1596138614-17409-28-git-send-email-timothy.mcdaniel@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1596138614-17409-28-git-send-email-timothy.mcdaniel@intel.com",
    "date": "2020-07-30T19:50:14",
    "name": "[27/27] event/dlb: add eventdev_stop and eventdev_close",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ce2901666493b72264f86da6042f62b9f8c1b1cf",
    "submitter": {
        "id": 826,
        "url": "http://patches.dpdk.org/api/people/826/?format=api",
        "name": "Timothy McDaniel",
        "email": "timothy.mcdaniel@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/1596138614-17409-28-git-send-email-timothy.mcdaniel@intel.com/mbox/",
    "series": [
        {
            "id": 11425,
            "url": "http://patches.dpdk.org/api/series/11425/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11425",
            "date": "2020-07-30T19:49:47",
            "name": "Add Intel DLM PMD to 20.11",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/11425/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/75077/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/75077/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 4E744A052B;\n\tThu, 30 Jul 2020 21:57:51 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E87811C1D4;\n\tThu, 30 Jul 2020 21:54:09 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by dpdk.org (Postfix) with ESMTP id 230C61C0D2\n for <dev@dpdk.org>; Thu, 30 Jul 2020 21:53:25 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 30 Jul 2020 12:53:25 -0700",
            "from txasoft-yocto.an.intel.com ([10.123.72.192])\n by orsmga005.jf.intel.com with ESMTP; 30 Jul 2020 12:53:25 -0700"
        ],
        "IronPort-SDR": [
            "\n iu24ymUEj+Sgtj5yIYVMBvHOMead+9NVywJz94fOV9U2N+AIvBtK04qUggmTOre3pmrC8zb75j\n /szRKrK91fhQ==",
            "\n POh97FfR7XYKLtAy6FpWBVMyTWmS7rto/AMR1TYacS7FxTiAdoguDX060Zi8WkHqviA2MDl0ri\n gbqC5Im/f7Zw=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9698\"; a=\"139672365\"",
            "E=Sophos;i=\"5.75,415,1589266800\"; d=\"scan'208\";a=\"139672365\"",
            "E=Sophos;i=\"5.75,415,1589266800\"; d=\"scan'208\";a=\"465378181\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "\"McDaniel, Timothy\" <timothy.mcdaniel@intel.com>",
        "To": "jerinj@marvell.com",
        "Cc": "mattias.ronnblom@ericsson.com, dev@dpdk.org, gage.eads@intel.com,\n harry.van.haaren@intel.com,\n \"McDaniel, Timothy\" <timothy.mcdaniel@intel.com>",
        "Date": "Thu, 30 Jul 2020 14:50:14 -0500",
        "Message-Id": "<1596138614-17409-28-git-send-email-timothy.mcdaniel@intel.com>",
        "X-Mailer": "git-send-email 1.7.10",
        "In-Reply-To": "<1596138614-17409-1-git-send-email-timothy.mcdaniel@intel.com>",
        "References": "<1593232671-5690-0-git-send-email-timothy.mcdaniel@intel.com>\n <1596138614-17409-1-git-send-email-timothy.mcdaniel@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 27/27] event/dlb: add eventdev_stop and\n\teventdev_close",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: \"McDaniel, Timothy\" <timothy.mcdaniel@intel.com>\n\nChange-Id: Iff64ba83ead496b3dedeaf323ee09bce1f631a6f\nSigned-off-by: McDaniel, Timothy <timothy.mcdaniel@intel.com>\n---\n drivers/event/dlb/dlb.c |  263 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 263 insertions(+)",
    "diff": "diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c\nindex 5adc95e..1498bdd 100644\n--- a/drivers/event/dlb/dlb.c\n+++ b/drivers/event/dlb/dlb.c\n@@ -303,6 +303,23 @@ int dlb_string_to_int(int *result, const char *str)\n \t\t\t\t\tconst struct rte_event events[],\n \t\t\t\t\tuint16_t num);\n \n+void\n+dlb_free_qe_mem(struct dlb_port *qm_port)\n+{\n+\tif (qm_port == NULL)\n+\t\treturn;\n+\n+\tif (qm_port->qe4) {\n+\t\trte_free(qm_port->qe4);\n+\t\tqm_port->qe4 = NULL;\n+\t}\n+\n+\tif (qm_port->consume_qe) {\n+\t\trte_free(qm_port->consume_qe);\n+\t\tqm_port->consume_qe = NULL;\n+\t}\n+}\n+\n int\n dlb_init_qe_mem(struct dlb_port *qm_port, char *mz_name)\n {\n@@ -1856,6 +1873,250 @@ static inline void dlb_issue_int_arm_hcw(struct dlb_port *qm_port)\n \treturn 0;\n }\n \n+static void\n+dlb_flush_port(struct rte_eventdev *dev, int port_id)\n+{\n+\tstruct dlb_eventdev *dlb = dlb_pmd_priv(dev);\n+\teventdev_stop_flush_t flush;\n+\tstruct rte_event ev;\n+\tuint8_t dev_id;\n+\tvoid *arg;\n+\tint i;\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 (rte_event_dequeue_burst(dev_id, port_id, &ev, 1, 0)) {\n+\t\tif (flush)\n+\t\t\tflush(dev_id, ev, arg);\n+\n+\t\tif (dlb->ev_ports[port_id].qm_port.is_directed)\n+\t\t\tcontinue;\n+\n+\t\tev.op = RTE_EVENT_OP_RELEASE;\n+\n+\t\trte_event_enqueue_burst(dev_id, port_id, &ev, 1);\n+\t}\n+\n+\t/* Enqueue any additional outstanding releases */\n+\tev.op = RTE_EVENT_OP_RELEASE;\n+\n+\tfor (i = dlb->ev_ports[port_id].outstanding_releases; i > 0; i--)\n+\t\trte_event_enqueue_burst(dev_id, port_id, &ev, 1);\n+}\n+\n+static uint32_t\n+dlb_get_ldb_queue_depth(struct dlb_eventdev *dlb,\n+\t\t\tstruct dlb_eventdev_queue *queue)\n+{\n+\tstruct dlb_hw_dev *handle = &dlb->qm_instance;\n+\tstruct dlb_get_ldb_queue_depth_args cfg;\n+\tstruct dlb_cmd_response response;\n+\tint ret;\n+\n+\tcfg.queue_id = queue->qm_queue.id;\n+\tcfg.response = (uintptr_t)&response;\n+\n+\tret = dlb_iface_get_ldb_queue_depth(handle, &cfg);\n+\tif (ret < 0) {\n+\t\tDLB_LOG_ERR(\"dlb: get_ldb_queue_depth ret=%d (driver status: %s)\\n\",\n+\t\t\t    ret, dlb_error_strings[response.status]);\n+\t\treturn ret;\n+\t}\n+\n+\treturn response.id;\n+}\n+\n+static uint32_t\n+dlb_get_dir_queue_depth(struct dlb_eventdev *dlb,\n+\t\t\tstruct dlb_eventdev_queue *queue)\n+{\n+\tstruct dlb_hw_dev *handle = &dlb->qm_instance;\n+\tstruct dlb_get_dir_queue_depth_args cfg;\n+\tstruct dlb_cmd_response response;\n+\tint ret;\n+\n+\tcfg.queue_id = queue->qm_queue.id;\n+\tcfg.response = (uintptr_t)&response;\n+\n+\tret = dlb_iface_get_dir_queue_depth(handle, &cfg);\n+\tif (ret < 0) {\n+\t\tDLB_LOG_ERR(\"dlb: get_dir_queue_depth ret=%d (driver status: %s)\\n\",\n+\t\t\t    ret, dlb_error_strings[response.status]);\n+\t\treturn ret;\n+\t}\n+\n+\treturn response.id;\n+}\n+\n+uint32_t\n+dlb_get_queue_depth(struct dlb_eventdev *dlb,\n+\t\t    struct dlb_eventdev_queue *queue)\n+{\n+\tif (queue->qm_queue.is_directed)\n+\t\treturn dlb_get_dir_queue_depth(dlb, queue);\n+\telse\n+\t\treturn dlb_get_ldb_queue_depth(dlb, queue);\n+}\n+\n+static bool\n+dlb_queue_is_empty(struct dlb_eventdev *dlb,\n+\t\t   struct dlb_eventdev_queue *queue)\n+{\n+\treturn dlb_get_queue_depth(dlb, queue) == 0;\n+}\n+\n+static bool\n+dlb_linked_queues_empty(struct dlb_eventdev *dlb)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < dlb->num_queues; i++) {\n+\t\tif (dlb->ev_queues[i].num_links == 0)\n+\t\t\tcontinue;\n+\t\tif (!dlb_queue_is_empty(dlb, &dlb->ev_queues[i]))\n+\t\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n+static bool\n+dlb_queues_empty(struct dlb_eventdev *dlb)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < dlb->num_queues; i++) {\n+\t\tif (!dlb_queue_is_empty(dlb, &dlb->ev_queues[i]))\n+\t\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n+void\n+dlb_drain(struct rte_eventdev *dev)\n+{\n+\tstruct dlb_eventdev *dlb = dlb_pmd_priv(dev);\n+\tstruct dlb_eventdev_port *ev_port = NULL;\n+\tuint8_t dev_id;\n+\tint i;\n+\n+\tdev_id = dev->data->dev_id;\n+\n+\twhile (!dlb_linked_queues_empty(dlb)) {\n+\t\t/* Flush all the ev_ports, which will drain all their connected\n+\t\t * queues.\n+\t\t */\n+\t\tfor (i = 0; i < dlb->num_ports; i++)\n+\t\t\tdlb_flush_port(dev, i);\n+\t}\n+\n+\t/* The queues are empty, but there may be events left in the ports. */\n+\tfor (i = 0; i < dlb->num_ports; i++)\n+\t\tdlb_flush_port(dev, i);\n+\n+\t/* If the domain's queues are empty, we're done. */\n+\tif (dlb_queues_empty(dlb))\n+\t\treturn;\n+\n+\t/* Else, there must be at least one unlinked load-balanced queue.\n+\t * Select a load-balanced port with which to drain the unlinked\n+\t * queue(s).\n+\t */\n+\tfor (i = 0; i < dlb->num_ports; i++) {\n+\t\tev_port = &dlb->ev_ports[i];\n+\n+\t\tif (!ev_port->qm_port.is_directed)\n+\t\t\tbreak;\n+\t}\n+\n+\tif (i == dlb->num_ports) {\n+\t\tDLB_LOG_ERR(\"internal error: no LDB ev_ports\\n\");\n+\t\treturn;\n+\t}\n+\n+\trte_errno = 0;\n+\trte_event_port_unlink(dev_id, ev_port->id, NULL, 0);\n+\n+\tif (rte_errno) {\n+\t\tDLB_LOG_ERR(\"internal error: failed to unlink ev_port %d\\n\",\n+\t\t\t    ev_port->id);\n+\t\treturn;\n+\t}\n+\n+\tfor (i = 0; i < dlb->num_queues; i++) {\n+\t\tuint8_t qid, prio;\n+\t\tint ret;\n+\n+\t\tif (dlb_queue_is_empty(dlb, &dlb->ev_queues[i]))\n+\t\t\tcontinue;\n+\n+\t\tqid = i;\n+\t\tprio = 0;\n+\n+\t\t/* Link the ev_port to the queue */\n+\t\tret = rte_event_port_link(dev_id, ev_port->id, &qid, &prio, 1);\n+\t\tif (ret != 1) {\n+\t\t\tDLB_LOG_ERR(\"internal error: failed to link ev_port %d to queue %d\\n\",\n+\t\t\t\t    ev_port->id, qid);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\t/* Flush the queue */\n+\t\twhile (!dlb_queue_is_empty(dlb, &dlb->ev_queues[i]))\n+\t\t\tdlb_flush_port(dev, ev_port->id);\n+\n+\t\t/* Drain any extant events in the ev_port. */\n+\t\tdlb_flush_port(dev, ev_port->id);\n+\n+\t\t/* Unlink the ev_port from the queue */\n+\t\tret = rte_event_port_unlink(dev_id, ev_port->id, &qid, 1);\n+\t\tif (ret != 1) {\n+\t\t\tDLB_LOG_ERR(\"internal error: failed to unlink ev_port %d to queue %d\\n\",\n+\t\t\t\t    ev_port->id, qid);\n+\t\t\treturn;\n+\t\t}\n+\t}\n+}\n+\n+static void\n+dlb_eventdev_stop(struct rte_eventdev *dev)\n+{\n+\tstruct dlb_eventdev *dlb = dlb_pmd_priv(dev);\n+\n+\trte_spinlock_lock(&dlb->qm_instance.resource_lock);\n+\n+\tif (dlb->run_state == DLB_RUN_STATE_STOPPED) {\n+\t\tDLB_LOG_DBG(\"Internal error: already stopped\\n\");\n+\t\trte_spinlock_unlock(&dlb->qm_instance.resource_lock);\n+\t\treturn;\n+\t} else if (dlb->run_state != DLB_RUN_STATE_STARTED) {\n+\t\tDLB_LOG_ERR(\"Internal error: bad state %d for dev_stop\\n\",\n+\t\t\t    (int)dlb->run_state);\n+\t\trte_spinlock_unlock(&dlb->qm_instance.resource_lock);\n+\t\treturn;\n+\t}\n+\n+\tdlb->run_state = DLB_RUN_STATE_STOPPING;\n+\n+\trte_spinlock_unlock(&dlb->qm_instance.resource_lock);\n+\n+\tdlb_drain(dev);\n+\n+\tdlb->run_state = DLB_RUN_STATE_STOPPED;\n+}\n+\n+static int\n+dlb_eventdev_close(struct rte_eventdev *dev)\n+{\n+\tdlb_hw_reset_sched_domain(dev, false);\n+\n+\treturn 0;\n+}\n+\n+\n static inline int\n dlb_check_enqueue_sw_credits(struct dlb_eventdev *dlb,\n \t\t\t     struct dlb_eventdev_port *ev_port)\n@@ -3710,6 +3971,8 @@ static int dlb_num_dir_queues_setup(struct dlb_eventdev *dlb)\n \t\t.dev_infos_get    = dlb_eventdev_info_get,\n \t\t.dev_configure    = dlb_eventdev_configure,\n \t\t.dev_start        = dlb_eventdev_start,\n+\t\t.dev_stop         = dlb_eventdev_stop,\n+\t\t.dev_close        = dlb_eventdev_close,\n \t\t.queue_def_conf   = dlb_eventdev_queue_default_conf_get,\n \t\t.queue_setup      = dlb_eventdev_queue_setup,\n \t\t.queue_release    = dlb_eventdev_queue_release,\n",
    "prefixes": [
        "27/27"
    ]
}