get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 54295,
    "url": "http://patches.dpdk.org/api/patches/54295/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190604054248.68510-20-leyi.rong@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": "<20190604054248.68510-20-leyi.rong@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190604054248.68510-20-leyi.rong@intel.com",
    "date": "2019-06-04T05:42:18",
    "name": "[19/49] net/ice/base: separate out control queue lock creation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d447a2b1b658f26e158ad14a326e28a85ea83c34",
    "submitter": {
        "id": 1204,
        "url": "http://patches.dpdk.org/api/people/1204/?format=api",
        "name": "Leyi Rong",
        "email": "leyi.rong@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190604054248.68510-20-leyi.rong@intel.com/mbox/",
    "series": [
        {
            "id": 4879,
            "url": "http://patches.dpdk.org/api/series/4879/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4879",
            "date": "2019-06-04T05:41:59",
            "name": "shared code update",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4879/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/54295/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/54295/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 487841BB42;\n\tTue,  4 Jun 2019 07:44:43 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id DE1071BA59\n\tfor <dev@dpdk.org>; Tue,  4 Jun 2019 07:44:14 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t03 Jun 2019 22:44:14 -0700",
            "from lrong-srv-03.sh.intel.com ([10.67.119.177])\n\tby fmsmga008.fm.intel.com with ESMTP; 03 Jun 2019 22:44:13 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Leyi Rong <leyi.rong@intel.com>",
        "To": "qi.z.zhang@intel.com",
        "Cc": "dev@dpdk.org, Leyi Rong <leyi.rong@intel.com>,\n\tJacob Keller <jacob.e.keller@intel.com>,\n\tPaul M Stillwell Jr <paul.m.stillwell.jr@intel.com>",
        "Date": "Tue,  4 Jun 2019 13:42:18 +0800",
        "Message-Id": "<20190604054248.68510-20-leyi.rong@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190604054248.68510-1-leyi.rong@intel.com>",
        "References": "<20190604054248.68510-1-leyi.rong@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 19/49] net/ice/base: separate out control queue\n\tlock creation",
        "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": "The ice_init_all_ctrlq and ice_shutdown_all_ctrlq functions create and\ndestroy the locks used to protect the send and receive process of each\ncontrol queue.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nSigned-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>\nSigned-off-by: Leyi Rong <leyi.rong@intel.com>\n---\n drivers/net/ice/base/ice_common.c   |   6 +-\n drivers/net/ice/base/ice_common.h   |   2 +\n drivers/net/ice/base/ice_controlq.c | 112 +++++++++++++++++++++-------\n 3 files changed, 91 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c\nindex c1af24322..5b4a13a41 100644\n--- a/drivers/net/ice/base/ice_common.c\n+++ b/drivers/net/ice/base/ice_common.c\n@@ -853,7 +853,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw)\n \tice_get_itr_intrl_gran(hw);\n \n \n-\tstatus = ice_init_all_ctrlq(hw);\n+\tstatus = ice_create_all_ctrlq(hw);\n \tif (status)\n \t\tgoto err_unroll_cqinit;\n \n@@ -981,7 +981,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw)\n \tice_free(hw, hw->port_info);\n \thw->port_info = NULL;\n err_unroll_cqinit:\n-\tice_shutdown_all_ctrlq(hw);\n+\tice_destroy_all_ctrlq(hw);\n \treturn status;\n }\n \n@@ -1010,7 +1010,7 @@ void ice_deinit_hw(struct ice_hw *hw)\n \n \t/* Attempt to disable FW logging before shutting down control queues */\n \tice_cfg_fw_log(hw, false);\n-\tice_shutdown_all_ctrlq(hw);\n+\tice_destroy_all_ctrlq(hw);\n \n \t/* Clear VSI contexts if not already cleared */\n \tice_clear_all_vsi_ctx(hw);\ndiff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h\nindex 58f22b0d3..4cd87fc1e 100644\n--- a/drivers/net/ice/base/ice_common.h\n+++ b/drivers/net/ice/base/ice_common.h\n@@ -25,8 +25,10 @@ void ice_deinit_hw(struct ice_hw *hw);\n enum ice_status ice_check_reset(struct ice_hw *hw);\n enum ice_status ice_reset(struct ice_hw *hw, enum ice_reset_req req);\n \n+enum ice_status ice_create_all_ctrlq(struct ice_hw *hw);\n enum ice_status ice_init_all_ctrlq(struct ice_hw *hw);\n void ice_shutdown_all_ctrlq(struct ice_hw *hw);\n+void ice_destroy_all_ctrlq(struct ice_hw *hw);\n enum ice_status\n ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,\n \t\t  struct ice_rq_event_info *e, u16 *pending);\ndiff --git a/drivers/net/ice/base/ice_controlq.c b/drivers/net/ice/base/ice_controlq.c\nindex 90dec0156..6d893e2f2 100644\n--- a/drivers/net/ice/base/ice_controlq.c\n+++ b/drivers/net/ice/base/ice_controlq.c\n@@ -283,7 +283,7 @@ ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)\n  * @cq: pointer to the specific Control queue\n  *\n  * This is the main initialization routine for the Control Send Queue\n- * Prior to calling this function, drivers *MUST* set the following fields\n+ * Prior to calling this function, the driver *MUST* set the following fields\n  * in the cq->structure:\n  *     - cq->num_sq_entries\n  *     - cq->sq_buf_size\n@@ -342,7 +342,7 @@ static enum ice_status ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)\n  * @cq: pointer to the specific Control queue\n  *\n  * The main initialization routine for the Admin Receive (Event) Queue.\n- * Prior to calling this function, drivers *MUST* set the following fields\n+ * Prior to calling this function, the driver *MUST* set the following fields\n  * in the cq->structure:\n  *     - cq->num_rq_entries\n  *     - cq->rq_buf_size\n@@ -535,14 +535,8 @@ static enum ice_status ice_init_check_adminq(struct ice_hw *hw)\n \treturn ICE_SUCCESS;\n \n init_ctrlq_free_rq:\n-\tif (cq->rq.count) {\n-\t\tice_shutdown_rq(hw, cq);\n-\t\tice_destroy_lock(&cq->rq_lock);\n-\t}\n-\tif (cq->sq.count) {\n-\t\tice_shutdown_sq(hw, cq);\n-\t\tice_destroy_lock(&cq->sq_lock);\n-\t}\n+\tice_shutdown_rq(hw, cq);\n+\tice_shutdown_sq(hw, cq);\n \treturn status;\n }\n \n@@ -551,12 +545,14 @@ static enum ice_status ice_init_check_adminq(struct ice_hw *hw)\n  * @hw: pointer to the hardware structure\n  * @q_type: specific Control queue type\n  *\n- * Prior to calling this function, drivers *MUST* set the following fields\n+ * Prior to calling this function, the driver *MUST* set the following fields\n  * in the cq->structure:\n  *     - cq->num_sq_entries\n  *     - cq->num_rq_entries\n  *     - cq->rq_buf_size\n  *     - cq->sq_buf_size\n+ *\n+ * NOTE: this function does not initialize the controlq locks\n  */\n static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)\n {\n@@ -582,8 +578,6 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)\n \t    !cq->rq_buf_size || !cq->sq_buf_size) {\n \t\treturn ICE_ERR_CFG;\n \t}\n-\tice_init_lock(&cq->sq_lock);\n-\tice_init_lock(&cq->rq_lock);\n \n \t/* setup SQ command write back timeout */\n \tcq->sq_cmd_timeout = ICE_CTL_Q_SQ_CMD_TIMEOUT;\n@@ -591,7 +585,7 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)\n \t/* allocate the ATQ */\n \tret_code = ice_init_sq(hw, cq);\n \tif (ret_code)\n-\t\tgoto init_ctrlq_destroy_locks;\n+\t\treturn ret_code;\n \n \t/* allocate the ARQ */\n \tret_code = ice_init_rq(hw, cq);\n@@ -603,9 +597,6 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)\n \n init_ctrlq_free_sq:\n \tice_shutdown_sq(hw, cq);\n-init_ctrlq_destroy_locks:\n-\tice_destroy_lock(&cq->sq_lock);\n-\tice_destroy_lock(&cq->rq_lock);\n \treturn ret_code;\n }\n \n@@ -613,12 +604,14 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)\n  * ice_init_all_ctrlq - main initialization routine for all control queues\n  * @hw: pointer to the hardware structure\n  *\n- * Prior to calling this function, drivers *MUST* set the following fields\n+ * Prior to calling this function, the driver MUST* set the following fields\n  * in the cq->structure for all control queues:\n  *     - cq->num_sq_entries\n  *     - cq->num_rq_entries\n  *     - cq->rq_buf_size\n  *     - cq->sq_buf_size\n+ *\n+ * NOTE: this function does not initialize the controlq locks.\n  */\n enum ice_status ice_init_all_ctrlq(struct ice_hw *hw)\n {\n@@ -637,10 +630,48 @@ enum ice_status ice_init_all_ctrlq(struct ice_hw *hw)\n \treturn ice_init_ctrlq(hw, ICE_CTL_Q_MAILBOX);\n }\n \n+/**\n+ * ice_init_ctrlq_locks - Initialize locks for a control queue\n+ * @cq: pointer to the control queue\n+ *\n+ * Initializes the send and receive queue locks for a given control queue.\n+ */\n+static void ice_init_ctrlq_locks(struct ice_ctl_q_info *cq)\n+{\n+\tice_init_lock(&cq->sq_lock);\n+\tice_init_lock(&cq->rq_lock);\n+}\n+\n+/**\n+ * ice_create_all_ctrlq - main initialization routine for all control queues\n+ * @hw: pointer to the hardware structure\n+ *\n+ * Prior to calling this function, the driver *MUST* set the following fields\n+ * in the cq->structure for all control queues:\n+ *     - cq->num_sq_entries\n+ *     - cq->num_rq_entries\n+ *     - cq->rq_buf_size\n+ *     - cq->sq_buf_size\n+ *\n+ * This function creates all the control queue locks and then calls\n+ * ice_init_all_ctrlq. It should be called once during driver load. If the\n+ * driver needs to re-initialize control queues at run time it should call\n+ * ice_init_all_ctrlq instead.\n+ */\n+enum ice_status ice_create_all_ctrlq(struct ice_hw *hw)\n+{\n+\tice_init_ctrlq_locks(&hw->adminq);\n+\tice_init_ctrlq_locks(&hw->mailboxq);\n+\n+\treturn ice_init_all_ctrlq(hw);\n+}\n+\n /**\n  * ice_shutdown_ctrlq - shutdown routine for any control queue\n  * @hw: pointer to the hardware structure\n  * @q_type: specific Control queue type\n+ *\n+ * NOTE: this function does not destroy the control queue locks.\n  */\n static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)\n {\n@@ -659,19 +690,17 @@ static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)\n \t\treturn;\n \t}\n \n-\tif (cq->sq.count) {\n-\t\tice_shutdown_sq(hw, cq);\n-\t\tice_destroy_lock(&cq->sq_lock);\n-\t}\n-\tif (cq->rq.count) {\n-\t\tice_shutdown_rq(hw, cq);\n-\t\tice_destroy_lock(&cq->rq_lock);\n-\t}\n+\tice_shutdown_sq(hw, cq);\n+\tice_shutdown_rq(hw, cq);\n }\n \n /**\n  * ice_shutdown_all_ctrlq - shutdown routine for all control queues\n  * @hw: pointer to the hardware structure\n+ *\n+ * NOTE: this function does not destroy the control queue locks. The driver\n+ * may call this at runtime to shutdown and later restart control queues, such\n+ * as in response to a reset event.\n  */\n void ice_shutdown_all_ctrlq(struct ice_hw *hw)\n {\n@@ -681,6 +710,37 @@ void ice_shutdown_all_ctrlq(struct ice_hw *hw)\n \tice_shutdown_ctrlq(hw, ICE_CTL_Q_MAILBOX);\n }\n \n+/**\n+ * ice_destroy_ctrlq_locks - Destroy locks for a control queue\n+ * @cq: pointer to the control queue\n+ *\n+ * Destroys the send and receive queue locks for a given control queue.\n+ */\n+static void\n+ice_destroy_ctrlq_locks(struct ice_ctl_q_info *cq)\n+{\n+\tice_destroy_lock(&cq->sq_lock);\n+\tice_destroy_lock(&cq->rq_lock);\n+}\n+\n+/**\n+ * ice_destroy_all_ctrlq - exit routine for all control queues\n+ * @hw: pointer to the hardware structure\n+ *\n+ * This function shuts down all the control queues and then destroys the\n+ * control queue locks. It should be called once during driver unload. The\n+ * driver should call ice_shutdown_all_ctrlq if it needs to shut down and\n+ * reinitialize control queues, such as in response to a reset event.\n+ */\n+void ice_destroy_all_ctrlq(struct ice_hw *hw)\n+{\n+\t/* shut down all the control queues first */\n+\tice_shutdown_all_ctrlq(hw);\n+\n+\tice_destroy_ctrlq_locks(&hw->adminq);\n+\tice_destroy_ctrlq_locks(&hw->mailboxq);\n+}\n+\n /**\n  * ice_clean_sq - cleans Admin send queue (ATQ)\n  * @hw: pointer to the hardware structure\n",
    "prefixes": [
        "19/49"
    ]
}