get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 523545,
    "url": "http://patchwork.ozlabs.org/api/patches/523545/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1443463964-148204-10-git-send-email-catherine.sullivan@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1443463964-148204-10-git-send-email-catherine.sullivan@intel.com>",
    "list_archive_url": null,
    "date": "2015-09-28T18:12:38",
    "name": "[next,S16,09/15] i40e/i40evf: grab the AQ spinlocks before clearing registers",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "0d74cca0085cdc26fe49be932935b4e85519481e",
    "submitter": {
        "id": 13931,
        "url": "http://patchwork.ozlabs.org/api/people/13931/?format=api",
        "name": "Catherine Sullivan",
        "email": "catherine.sullivan@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1443463964-148204-10-git-send-email-catherine.sullivan@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/523545/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/523545/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id F35211402D4\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Sep 2015 04:15:04 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id A42B3954BE;\n\tMon, 28 Sep 2015 18:15:04 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id L5ViChU7tJCF; Mon, 28 Sep 2015 18:15:03 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 12385954C0;\n\tMon, 28 Sep 2015 18:15:03 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id E7F201CE9AE\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Sep 2015 18:14:59 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id E39A632E47\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Sep 2015 18:14:59 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id epyn0r4ALfTH for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Sep 2015 18:14:55 +0000 (UTC)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby silver.osuosl.org (Postfix) with ESMTP id 2F8083325B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Sep 2015 18:14:55 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga101.jf.intel.com with ESMTP; 28 Sep 2015 11:14:28 -0700",
            "from catheri1-tigger.jf.intel.com ([134.134.176.92])\n\tby FMSMGA003.fm.intel.com with ESMTP; 28 Sep 2015 11:14:28 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.17,603,1437462000\"; d=\"scan'208\";a=\"569972204\"",
        "From": "Catherine Sullivan <catherine.sullivan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon, 28 Sep 2015 14:12:38 -0400",
        "Message-Id": "<1443463964-148204-10-git-send-email-catherine.sullivan@intel.com>",
        "X-Mailer": "git-send-email 1.9.3",
        "In-Reply-To": "<1443463964-148204-1-git-send-email-catherine.sullivan@intel.com>",
        "References": "<1443463964-148204-1-git-send-email-catherine.sullivan@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S16 09/15] i40e/i40evf: grab the AQ\n\tspinlocks before clearing registers",
        "X-BeenThere": "intel-wired-lan@lists.osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>",
        "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>",
        "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>"
    },
    "content": "From: Shannon Nelson <shannon.nelson@intel.com>\n\nMake sure we have the spinlocks before we clear the ARQ and ASQ management\nregisters.  Also, widen the locked portion and make a sanity check earlier\nin the send function to be sure we're working with safe register values.\n\nSigned-off-by: Shannon Nelson <shannon.nelson@intel.com>\nChange-ID: I34b56044b33461ed780f3d2de8d62826cdf933f9\n---\n drivers/net/ethernet/intel/i40e/i40e_adminq.c   | 45 +++++++++++++------------\n drivers/net/ethernet/intel/i40evf/i40e_adminq.c | 45 +++++++++++++------------\n 2 files changed, 46 insertions(+), 44 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c\nindex a41945a..22c7f50 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c\n@@ -482,8 +482,12 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw)\n {\n \ti40e_status ret_code = 0;\n \n-\tif (hw->aq.asq.count == 0)\n-\t\treturn I40E_ERR_NOT_READY;\n+\tmutex_lock(&hw->aq.asq_mutex);\n+\n+\tif (hw->aq.asq.count == 0) {\n+\t\tret_code = I40E_ERR_NOT_READY;\n+\t\tgoto shutdown_asq_out;\n+\t}\n \n \t/* Stop firmware AdminQ processing */\n \twr32(hw, hw->aq.asq.head, 0);\n@@ -492,16 +496,13 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw)\n \twr32(hw, hw->aq.asq.bal, 0);\n \twr32(hw, hw->aq.asq.bah, 0);\n \n-\t/* make sure lock is available */\n-\tmutex_lock(&hw->aq.asq_mutex);\n-\n \thw->aq.asq.count = 0; /* to indicate uninitialized queue */\n \n \t/* free ring buffers */\n \ti40e_free_asq_bufs(hw);\n \n+shutdown_asq_out:\n \tmutex_unlock(&hw->aq.asq_mutex);\n-\n \treturn ret_code;\n }\n \n@@ -515,8 +516,12 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw)\n {\n \ti40e_status ret_code = 0;\n \n-\tif (hw->aq.arq.count == 0)\n-\t\treturn I40E_ERR_NOT_READY;\n+\tmutex_lock(&hw->aq.arq_mutex);\n+\n+\tif (hw->aq.arq.count == 0) {\n+\t\tret_code = I40E_ERR_NOT_READY;\n+\t\tgoto shutdown_arq_out;\n+\t}\n \n \t/* Stop firmware AdminQ processing */\n \twr32(hw, hw->aq.arq.head, 0);\n@@ -525,16 +530,13 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw)\n \twr32(hw, hw->aq.arq.bal, 0);\n \twr32(hw, hw->aq.arq.bah, 0);\n \n-\t/* make sure lock is available */\n-\tmutex_lock(&hw->aq.arq_mutex);\n-\n \thw->aq.arq.count = 0; /* to indicate uninitialized queue */\n \n \t/* free ring buffers */\n \ti40e_free_arq_bufs(hw);\n \n+shutdown_arq_out:\n \tmutex_unlock(&hw->aq.arq_mutex);\n-\n \treturn ret_code;\n }\n \n@@ -751,21 +753,23 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,\n \tu16  retval = 0;\n \tu32  val = 0;\n \n+\tmutex_lock(&hw->aq.asq_mutex);\n+\n \thw->aq.asq_last_status = I40E_AQ_RC_OK;\n \n-\tval = rd32(hw, hw->aq.asq.head);\n-\tif (val >= hw->aq.num_asq_entries) {\n+\tif (hw->aq.asq.count == 0) {\n \t\ti40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,\n-\t\t\t   \"AQTX: head overrun at %d\\n\", val);\n+\t\t\t   \"AQTX: Admin queue not initialized.\\n\");\n \t\tstatus = I40E_ERR_QUEUE_EMPTY;\n-\t\tgoto asq_send_command_exit;\n+\t\tgoto asq_send_command_error;\n \t}\n \n-\tif (hw->aq.asq.count == 0) {\n+\tval = rd32(hw, hw->aq.asq.head);\n+\tif (val >= hw->aq.num_asq_entries) {\n \t\ti40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,\n-\t\t\t   \"AQTX: Admin queue not initialized.\\n\");\n+\t\t\t   \"AQTX: head overrun at %d\\n\", val);\n \t\tstatus = I40E_ERR_QUEUE_EMPTY;\n-\t\tgoto asq_send_command_exit;\n+\t\tgoto asq_send_command_error;\n \t}\n \n \tdetails = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use);\n@@ -790,8 +794,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,\n \tdesc->flags &= ~cpu_to_le16(details->flags_dis);\n \tdesc->flags |= cpu_to_le16(details->flags_ena);\n \n-\tmutex_lock(&hw->aq.asq_mutex);\n-\n \tif (buff_size > hw->aq.asq_buf_size) {\n \t\ti40e_debug(hw,\n \t\t\t   I40E_DEBUG_AQ_MESSAGE,\n@@ -915,7 +917,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,\n \n asq_send_command_error:\n \tmutex_unlock(&hw->aq.asq_mutex);\n-asq_send_command_exit:\n \treturn status;\n }\n \ndiff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c\nindex 7b5993b..97a9af2 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c\n@@ -469,8 +469,12 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw)\n {\n \ti40e_status ret_code = 0;\n \n-\tif (hw->aq.asq.count == 0)\n-\t\treturn I40E_ERR_NOT_READY;\n+\tmutex_lock(&hw->aq.asq_mutex);\n+\n+\tif (hw->aq.asq.count == 0) {\n+\t\tret_code = I40E_ERR_NOT_READY;\n+\t\tgoto shutdown_asq_out;\n+\t}\n \n \t/* Stop firmware AdminQ processing */\n \twr32(hw, hw->aq.asq.head, 0);\n@@ -479,16 +483,13 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw)\n \twr32(hw, hw->aq.asq.bal, 0);\n \twr32(hw, hw->aq.asq.bah, 0);\n \n-\t/* make sure lock is available */\n-\tmutex_lock(&hw->aq.asq_mutex);\n-\n \thw->aq.asq.count = 0; /* to indicate uninitialized queue */\n \n \t/* free ring buffers */\n \ti40e_free_asq_bufs(hw);\n \n+shutdown_asq_out:\n \tmutex_unlock(&hw->aq.asq_mutex);\n-\n \treturn ret_code;\n }\n \n@@ -502,8 +503,12 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw)\n {\n \ti40e_status ret_code = 0;\n \n-\tif (hw->aq.arq.count == 0)\n-\t\treturn I40E_ERR_NOT_READY;\n+\tmutex_lock(&hw->aq.arq_mutex);\n+\n+\tif (hw->aq.arq.count == 0) {\n+\t\tret_code = I40E_ERR_NOT_READY;\n+\t\tgoto shutdown_arq_out;\n+\t}\n \n \t/* Stop firmware AdminQ processing */\n \twr32(hw, hw->aq.arq.head, 0);\n@@ -512,16 +517,13 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw)\n \twr32(hw, hw->aq.arq.bal, 0);\n \twr32(hw, hw->aq.arq.bah, 0);\n \n-\t/* make sure lock is available */\n-\tmutex_lock(&hw->aq.arq_mutex);\n-\n \thw->aq.arq.count = 0; /* to indicate uninitialized queue */\n \n \t/* free ring buffers */\n \ti40e_free_arq_bufs(hw);\n \n+shutdown_arq_out:\n \tmutex_unlock(&hw->aq.arq_mutex);\n-\n \treturn ret_code;\n }\n \n@@ -684,21 +686,23 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw,\n \tu16  retval = 0;\n \tu32  val = 0;\n \n+\tmutex_lock(&hw->aq.asq_mutex);\n+\n \thw->aq.asq_last_status = I40E_AQ_RC_OK;\n \n-\tval = rd32(hw, hw->aq.asq.head);\n-\tif (val >= hw->aq.num_asq_entries) {\n+\tif (hw->aq.asq.count == 0) {\n \t\ti40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,\n-\t\t\t   \"AQTX: head overrun at %d\\n\", val);\n+\t\t\t   \"AQTX: Admin queue not initialized.\\n\");\n \t\tstatus = I40E_ERR_QUEUE_EMPTY;\n-\t\tgoto asq_send_command_exit;\n+\t\tgoto asq_send_command_error;\n \t}\n \n-\tif (hw->aq.asq.count == 0) {\n+\tval = rd32(hw, hw->aq.asq.head);\n+\tif (val >= hw->aq.num_asq_entries) {\n \t\ti40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,\n-\t\t\t   \"AQTX: Admin queue not initialized.\\n\");\n+\t\t\t   \"AQTX: head overrun at %d\\n\", val);\n \t\tstatus = I40E_ERR_QUEUE_EMPTY;\n-\t\tgoto asq_send_command_exit;\n+\t\tgoto asq_send_command_error;\n \t}\n \n \tdetails = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use);\n@@ -723,8 +727,6 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw,\n \tdesc->flags &= ~cpu_to_le16(details->flags_dis);\n \tdesc->flags |= cpu_to_le16(details->flags_ena);\n \n-\tmutex_lock(&hw->aq.asq_mutex);\n-\n \tif (buff_size > hw->aq.asq_buf_size) {\n \t\ti40e_debug(hw,\n \t\t\t   I40E_DEBUG_AQ_MESSAGE,\n@@ -849,7 +851,6 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw,\n \n asq_send_command_error:\n \tmutex_unlock(&hw->aq.asq_mutex);\n-asq_send_command_exit:\n \treturn status;\n }\n \n",
    "prefixes": [
        "next",
        "S16",
        "09/15"
    ]
}