get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 75071,
    "url": "http://patches.dpdk.org/api/patches/75071/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1596138614-17409-21-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-21-git-send-email-timothy.mcdaniel@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1596138614-17409-21-git-send-email-timothy.mcdaniel@intel.com",
    "date": "2020-07-30T19:50:07",
    "name": "[20/27] event/dlb: add port_link",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8d5159db54a5c278e94ef181b4e1fb6e5f675064",
    "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-21-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/75071/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/75071/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 EEB6DA052B;\n\tThu, 30 Jul 2020 21:56:50 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0F9111C1AA;\n\tThu, 30 Jul 2020 21:53:55 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by dpdk.org (Postfix) with ESMTP id 869731C0C5\n for <dev@dpdk.org>; Thu, 30 Jul 2020 21:53:21 +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:20 -0700",
            "from txasoft-yocto.an.intel.com ([10.123.72.192])\n by orsmga005.jf.intel.com with ESMTP; 30 Jul 2020 12:53:19 -0700"
        ],
        "IronPort-SDR": [
            "\n ZHPGFSNZNM5dWbW1/ORvmNdwDgUiWseMNX9ndB8WDSfVq7wDVKO/V0oBK8Lj85ZASiaQ1cIuRN\n ek9rhjewZvnQ==",
            "\n uLCyrtYdx7PTYoTYmoZ2U/X//vbv+GNFBogEqIa085WCIR8IdSO71hfK7y39TcFJEoQ/vXAKQi\n HkcvEzMByPoQ=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9698\"; a=\"139672341\"",
            "E=Sophos;i=\"5.75,415,1589266800\"; d=\"scan'208\";a=\"139672341\"",
            "E=Sophos;i=\"5.75,415,1589266800\"; d=\"scan'208\";a=\"465378140\""
        ],
        "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:07 -0500",
        "Message-Id": "<1596138614-17409-21-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 20/27] event/dlb: add port_link",
        "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: Id86dbdd1070e8102bf602765654fe5afde0e0d6c\nSigned-off-by: McDaniel, Timothy <timothy.mcdaniel@intel.com>\n---\n drivers/event/dlb/dlb.c |  303 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 303 insertions(+)",
    "diff": "diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c\nindex 8bbcd03..e601a0e 100644\n--- a/drivers/event/dlb/dlb.c\n+++ b/drivers/event/dlb/dlb.c\n@@ -786,6 +786,29 @@ int dlb_string_to_int(int *result, const char *str)\n \treturn qm_qid;\n }\n \n+static int32_t\n+dlb_hw_create_dir_queue(struct dlb_eventdev *dlb, int32_t qm_port_id)\n+{\n+\tstruct dlb_hw_dev *handle = &dlb->qm_instance;\n+\tstruct dlb_create_dir_queue_args cfg;\n+\tstruct dlb_cmd_response response;\n+\tint32_t ret;\n+\n+\tcfg.response = (uintptr_t)&response;\n+\n+\t/* The directed port is always configured before its queue */\n+\tcfg.port_id = qm_port_id;\n+\n+\tret = dlb_iface_dir_queue_create(handle, &cfg);\n+\tif (ret < 0) {\n+\t\tDLB_LOG_ERR(\"dlb: create DIR event queue error, ret=%d (driver status: %s)\\n\",\n+\t\t\t    ret, dlb_error_strings[response.status]);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn response.id;\n+}\n+\n static inline void\n dlb_hw_do_enqueue(struct dlb_port *qm_port,\n \t\t  bool do_sfence,\n@@ -803,6 +826,42 @@ int dlb_string_to_int(int *result, const char *str)\n \tdlb_pp_write(qm_port->qe4, port_data);\n }\n \n+static int16_t\n+dlb_hw_map_ldb_qid_to_port(struct dlb_hw_dev *handle,\n+\t\t\t   uint32_t qm_port_id,\n+\t\t\t   uint16_t qm_qid,\n+\t\t\t   uint8_t priority)\n+{\n+\tstruct dlb_map_qid_args cfg;\n+\tstruct dlb_cmd_response response;\n+\tint32_t ret;\n+\n+\tif (handle == NULL)\n+\t\treturn -EINVAL;\n+\n+\t/* Build message */\n+\tcfg.response = (uintptr_t)&response;\n+\tcfg.port_id = qm_port_id;\n+\tcfg.qid = qm_qid;\n+\tcfg.priority = EV_TO_DLB_PRIO(priority);\n+\n+\tret = dlb_iface_map_qid(handle, &cfg);\n+\tif (ret < 0) {\n+\t\tDLB_LOG_ERR(\"dlb: map qid error, ret=%d (driver status: %s)\\n\",\n+\t\t\t    ret, dlb_error_strings[response.status]);\n+\t\tDLB_LOG_ERR(\"dlb: device_id=%d grp=%d, qm_port=%d, qm_qid=%d prio=%d\\n\",\n+\t\t\t    handle->device_id,\n+\t\t\t    handle->domain_id, cfg.port_id,\n+\t\t\t    cfg.qid,\n+\t\t\t    cfg.priority);\n+\t} else {\n+\t\tDLB_LOG_DBG(\"dlb: mapped queue %d to qm_port %d\\n\",\n+\t\t\t    qm_qid, qm_port_id);\n+\t}\n+\n+\treturn ret;\n+}\n+\n /* VDEV-only notes:\n  * This function first unmaps all memory mappings and closes the\n  * domain's file descriptor, which causes the driver to reset the\n@@ -1784,6 +1843,249 @@ int dlb_string_to_int(int *result, const char *str)\n \treturn 0;\n }\n \n+static int\n+dlb_event_queue_join_ldb(struct dlb_eventdev *dlb,\n+\t\t\t struct dlb_eventdev_port *ev_port,\n+\t\t\t struct dlb_eventdev_queue *ev_queue,\n+\t\t\t uint8_t priority)\n+{\n+\tint first_avail = -1;\n+\tint ret, i;\n+\n+\tfor (i = 0; i < DLB_MAX_NUM_QIDS_PER_LDB_CQ; i++) {\n+\t\tif (ev_port->link[i].valid) {\n+\t\t\tif (ev_port->link[i].queue_id == ev_queue->id &&\n+\t\t\t    ev_port->link[i].priority == priority) {\n+\t\t\t\tif (ev_port->link[i].mapped)\n+\t\t\t\t\treturn 0; /* already mapped */\n+\t\t\t\tfirst_avail = i;\n+\t\t\t}\n+\t\t} else {\n+\t\t\tif (first_avail == -1)\n+\t\t\t\tfirst_avail = i;\n+\t\t}\n+\t}\n+\tif (first_avail == -1) {\n+\t\tDLB_LOG_ERR(\"dlb: qm_port %d has no available QID slots.\\n\",\n+\t\t\t    ev_port->qm_port.id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tret = dlb_hw_map_ldb_qid_to_port(&dlb->qm_instance,\n+\t\t\t\t\t ev_port->qm_port.id,\n+\t\t\t\t\t ev_queue->qm_queue.id,\n+\t\t\t\t\t priority);\n+\n+\tif (!ret)\n+\t\tev_port->link[first_avail].mapped = true;\n+\n+\treturn ret;\n+}\n+\n+static int\n+dlb_eventdev_dir_queue_setup(struct dlb_eventdev *dlb,\n+\t\t\t     struct dlb_eventdev_queue *ev_queue,\n+\t\t\t     struct dlb_eventdev_port *ev_port)\n+{\n+\tint32_t qm_qid;\n+\n+\tqm_qid = dlb_hw_create_dir_queue(dlb, ev_port->qm_port.id);\n+\n+\tif (qm_qid < 0) {\n+\t\tDLB_LOG_ERR(\"Failed to create the DIR queue\\n\");\n+\t\treturn qm_qid;\n+\t}\n+\n+\tdlb->qm_dir_to_ev_queue_id[qm_qid] = ev_queue->id;\n+\n+\tev_queue->qm_queue.id = qm_qid;\n+\n+\treturn 0;\n+}\n+\n+static int\n+dlb_do_port_link(struct rte_eventdev *dev,\n+\t\t struct dlb_eventdev_queue *ev_queue,\n+\t\t struct dlb_eventdev_port *ev_port,\n+\t\t uint8_t prio)\n+{\n+\tstruct dlb_eventdev *dlb = dlb_pmd_priv(dev);\n+\tint err;\n+\n+\t/* Don't link until start time. */\n+\tif (dlb->run_state == DLB_RUN_STATE_STOPPED)\n+\t\treturn 0;\n+\n+\tif (ev_queue->qm_queue.is_directed)\n+\t\terr = dlb_eventdev_dir_queue_setup(dlb, ev_queue, ev_port);\n+\telse\n+\t\terr = dlb_event_queue_join_ldb(dlb, ev_port, ev_queue, prio);\n+\n+\tif (err) {\n+\t\tDLB_LOG_ERR(\"port link failure for %s ev_q %d, ev_port %d\\n\",\n+\t\t\t    ev_queue->qm_queue.is_directed ? \"DIR\" : \"LDB\",\n+\t\t\t    ev_queue->id, ev_port->id);\n+\n+\t\trte_errno = err;\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+dlb_validate_port_link(struct dlb_eventdev_port *ev_port,\n+\t\t       uint8_t queue_id,\n+\t\t       bool link_exists,\n+\t\t       int index)\n+{\n+\tstruct dlb_eventdev *dlb = ev_port->dlb;\n+\tstruct dlb_eventdev_queue *ev_queue;\n+\tbool port_is_dir, queue_is_dir;\n+\n+\tif (queue_id > dlb->num_queues) {\n+\t\trte_errno = -EINVAL;\n+\t\treturn -1;\n+\t}\n+\n+\tev_queue = &dlb->ev_queues[queue_id];\n+\n+\tif (!ev_queue->setup_done &&\n+\t    ev_queue->qm_queue.config_state != DLB_PREV_CONFIGURED) {\n+\t\trte_errno = -EINVAL;\n+\t\treturn -1;\n+\t}\n+\n+\tport_is_dir = ev_port->qm_port.is_directed;\n+\tqueue_is_dir = ev_queue->qm_queue.is_directed;\n+\n+\tif (port_is_dir != queue_is_dir) {\n+\t\tDLB_LOG_ERR(\"%s queue %u can't link to %s port %u\\n\",\n+\t\t\t    queue_is_dir ? \"DIR\" : \"LDB\", ev_queue->id,\n+\t\t\t    port_is_dir ? \"DIR\" : \"LDB\", ev_port->id);\n+\n+\t\trte_errno = -EINVAL;\n+\t\treturn -1;\n+\t}\n+\n+\t/* Check if there is space for the requested link */\n+\tif (!link_exists && index == -1) {\n+\t\tDLB_LOG_ERR(\"no space for new link\\n\");\n+\t\trte_errno = -ENOSPC;\n+\t\treturn -1;\n+\t}\n+\n+\t/* Check if the directed port is already linked */\n+\tif (ev_port->qm_port.is_directed && ev_port->num_links > 0 &&\n+\t    !link_exists) {\n+\t\tDLB_LOG_ERR(\"Can't link DIR port %d to >1 queues\\n\",\n+\t\t\t    ev_port->id);\n+\t\trte_errno = -EINVAL;\n+\t\treturn -1;\n+\t}\n+\n+\t/* Check if the directed queue is already linked */\n+\tif (ev_queue->qm_queue.is_directed && ev_queue->num_links > 0 &&\n+\t    !link_exists) {\n+\t\tDLB_LOG_ERR(\"Can't link DIR queue %d to >1 ports\\n\",\n+\t\t\t    ev_queue->id);\n+\t\trte_errno = -EINVAL;\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+dlb_eventdev_port_link(struct rte_eventdev *dev, void *event_port,\n+\t\t       const uint8_t queues[], const uint8_t priorities[],\n+\t\t       uint16_t nb_links)\n+\n+{\n+\tstruct dlb_eventdev_port *ev_port = event_port;\n+\tstruct dlb_eventdev *dlb;\n+\tint i, j;\n+\n+\tRTE_SET_USED(dev);\n+\n+\tif (!ev_port) {\n+\t\tDLB_LOG_ERR(\"dlb: evport not setup\\n\");\n+\t\trte_errno = -EINVAL;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!ev_port->setup_done &&\n+\t    ev_port->qm_port.config_state != DLB_PREV_CONFIGURED) {\n+\t\tDLB_LOG_ERR(\"dlb: evport not setup\\n\");\n+\t\trte_errno = -EINVAL;\n+\t\treturn 0;\n+\t}\n+\n+\t/* Note: rte_event_port_link() ensures the PMD won't receive a NULL\n+\t * queues pointer.\n+\t */\n+\tif (nb_links == 0) {\n+\t\tDLB_LOG_DBG(\"dlb: nb_links is 0\\n\");\n+\t\treturn 0; /* Ignore and return success */\n+\t}\n+\n+\tdlb = ev_port->dlb;\n+\n+\tDLB_LOG_DBG(\"Linking %u queues to %s port %d\\n\",\n+\t\t    nb_links,\n+\t\t    ev_port->qm_port.is_directed ? \"DIR\" : \"LDB\",\n+\t\t    ev_port->id);\n+\n+\tfor (i = 0; i < nb_links; i++) {\n+\t\tstruct dlb_eventdev_queue *ev_queue;\n+\t\tuint8_t queue_id, prio;\n+\t\tbool found = false;\n+\t\tint index = -1;\n+\n+\t\tqueue_id = queues[i];\n+\t\tprio = priorities[i];\n+\n+\t\t/* Check if the link already exists. */\n+\t\tfor (j = 0; j < DLB_MAX_NUM_QIDS_PER_LDB_CQ; j++)\n+\t\t\tif (ev_port->link[j].valid) {\n+\t\t\t\tif (ev_port->link[j].queue_id == queue_id) {\n+\t\t\t\t\tfound = true;\n+\t\t\t\t\tindex = j;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tif (index == -1)\n+\t\t\t\t\tindex = j;\n+\t\t\t}\n+\n+\t\t/* could not link */\n+\t\tif (index == -1)\n+\t\t\tbreak;\n+\n+\t\t/* Check if already linked at the requested priority */\n+\t\tif (found && ev_port->link[j].priority == prio)\n+\t\t\tcontinue;\n+\n+\t\tif (dlb_validate_port_link(ev_port, queue_id, found, index))\n+\t\t\tbreak; /* return index of offending queue */\n+\n+\t\tev_queue = &dlb->ev_queues[queue_id];\n+\n+\t\tif (dlb_do_port_link(dev, ev_queue, ev_port, prio))\n+\t\t\tbreak; /* return index of offending queue */\n+\n+\t\tev_queue->num_links++;\n+\n+\t\tev_port->link[index].queue_id = queue_id;\n+\t\tev_port->link[index].priority = prio;\n+\t\tev_port->link[index].valid = true;\n+\t\t/* Entry already exists?  If so, then must be prio change */\n+\t\tif (!found)\n+\t\t\tev_port->num_links++;\n+\t}\n+\treturn i;\n+}\n+\n static void\n dlb_eventdev_port_default_conf_get(struct rte_eventdev *dev,\n \t\t\t\t   uint8_t port_id,\n@@ -2254,6 +2556,7 @@ static int dlb_num_dir_queues_setup(struct dlb_eventdev *dlb)\n \t\t.queue_setup      = dlb_eventdev_queue_setup,\n \t\t.port_def_conf    = dlb_eventdev_port_default_conf_get,\n \t\t.port_setup       = dlb_eventdev_port_setup,\n+\t\t.port_link        = dlb_eventdev_port_link,\n \t};\n \n \t/* Expose PMD's eventdev interface */\n",
    "prefixes": [
        "20/27"
    ]
}