get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 781904,
    "url": "http://patchwork.ozlabs.org/api/patches/781904/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170628152226.25369-4-gedwards@ddn.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": "<20170628152226.25369-4-gedwards@ddn.com>",
    "list_archive_url": null,
    "date": "2017-06-28T15:22:26",
    "name": "[3/3] igb: do not drop PF mailbox lock after read of VF message",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "8171dca00558b6a3933875bb0d49e40099efcc88",
    "submitter": {
        "id": 71885,
        "url": "http://patchwork.ozlabs.org/api/people/71885/?format=api",
        "name": "Greg Edwards",
        "email": "gedwards@ddn.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/20170628152226.25369-4-gedwards@ddn.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/781904/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/781904/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3wyYhM2Z4sz9s76\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 29 Jun 2017 06:06:11 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id E0F39834D2;\n\tWed, 28 Jun 2017 20:06:09 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id qygwNnJOVIQ9; Wed, 28 Jun 2017 20:06:08 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 2296283541;\n\tWed, 28 Jun 2017 20:06:05 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id EE2561C0DE5\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 28 Jun 2017 15:28:21 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E994586BC4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 28 Jun 2017 15:28:21 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id U+sx+D7hOKlG for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 28 Jun 2017 15:28:19 +0000 (UTC)",
            "from legacy.ddn.com (legacy.ddn.com [64.47.133.206])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 4E99986D0E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 28 Jun 2017 15:28:19 +0000 (UTC)",
            "from LAX-EX-CAHT1.datadirect.datadirectnet.com (10.8.103.81) by\n\tLAX-EX-CAHT2.datadirect.datadirectnet.com (10.8.103.82) with\n\tMicrosoft SMTP\n\tServer (TLS) id 14.3.319.2; Wed, 28 Jun 2017 08:23:00 -0700",
            "from psuche.colorado.datadirectnet.com (10.8.30.130) by\n\tLAX-EX-CAHT1.datadirect.datadirectnet.com (10.8.103.81) with\n\tMicrosoft SMTP\n\tServer (TLS) id 14.3.319.2; Wed, 28 Jun 2017 08:22:59 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "from auto-whitelisted by SQLgrey-1.7.6",
        "From": "Greg Edwards <gedwards@ddn.com>",
        "To": "<intel-wired-lan@lists.osuosl.org>",
        "Date": "Wed, 28 Jun 2017 09:22:26 -0600",
        "Message-ID": "<20170628152226.25369-4-gedwards@ddn.com>",
        "X-Mailer": "git-send-email 2.9.4",
        "In-Reply-To": "<20170628152226.25369-1-gedwards@ddn.com>",
        "References": "<20170628152226.25369-1-gedwards@ddn.com>",
        "MIME-Version": "1.0",
        "X-Originating-IP": "[10.8.30.130]",
        "X-Mailman-Approved-At": "Wed, 28 Jun 2017 20:06:03 +0000",
        "Cc": "Greg Edwards <gedwards@ddn.com>",
        "Subject": "[Intel-wired-lan] [PATCH 3/3] igb: do not drop PF mailbox lock\n\tafter read of VF message",
        "X-BeenThere": "intel-wired-lan@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.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "When the PF receives a mailbox message from the VF, it grabs the mailbox\nlock, reads the VF message from the mailbox, ACKs the message and drops\nthe lock.\n\nWhile the PF is performing the action for the VF message, nothing\nprevents another VF message from being posted to the mailbox.  The\ncurrent code handles this condition by just dropping any new VF messages\nwithout processing them.  This results in a mailbox timeout in the VM\nfor posted messages waiting for an ACK, and the VF is reset by the\nigbvf_watchdog_task in the VM.\n\nGiven the right sequence of VF messages and mailbox timeouts, this\ncondition can go on ad infinitum.\n\nModify the PF mailbox read method to take an 'unlock' argument that\noptionally leaves the mailbox locked by the PF after reading the VF\nmessage.  This ensures another VF message is not posted to the mailbox\nuntil after the PF has completed processing the VF message and written\nits reply.\n\nSigned-off-by: Greg Edwards <gedwards@ddn.com>\n---\n drivers/net/ethernet/intel/igb/e1000_hw.h  |  3 ++-\n drivers/net/ethernet/intel/igb/e1000_mbx.c | 18 ++++++++++++------\n drivers/net/ethernet/intel/igb/e1000_mbx.h |  3 ++-\n drivers/net/ethernet/intel/igb/igb_main.c  | 14 ++++++++++----\n 4 files changed, 26 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h\nindex 6076f258a0a5..6ea9f702ba0f 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_hw.h\n+++ b/drivers/net/ethernet/intel/igb/e1000_hw.h\n@@ -491,7 +491,8 @@ struct e1000_fc_info {\n \n struct e1000_mbx_operations {\n \ts32 (*init_params)(struct e1000_hw *hw);\n-\ts32 (*read)(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id);\n+\ts32 (*read)(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id,\n+\t\t    bool unlock);\n \ts32 (*write)(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id);\n \ts32 (*read_posted)(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id);\n \ts32 (*write_posted)(struct e1000_hw *hw, u32 *msg, u16 size,\ndiff --git a/drivers/net/ethernet/intel/igb/e1000_mbx.c b/drivers/net/ethernet/intel/igb/e1000_mbx.c\nindex 6aa44723507b..bffd58f7b2a1 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_mbx.c\n+++ b/drivers/net/ethernet/intel/igb/e1000_mbx.c\n@@ -32,7 +32,8 @@\n  *\n  *  returns SUCCESS if it successfully read message from buffer\n  **/\n-s32 igb_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)\n+s32 igb_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id,\n+\t\t bool unlock)\n {\n \tstruct e1000_mbx_info *mbx = &hw->mbx;\n \ts32 ret_val = -E1000_ERR_MBX;\n@@ -42,7 +43,7 @@ s32 igb_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)\n \t\tsize = mbx->size;\n \n \tif (mbx->ops.read)\n-\t\tret_val = mbx->ops.read(hw, msg, size, mbx_id);\n+\t\tret_val = mbx->ops.read(hw, msg, size, mbx_id, unlock);\n \n \treturn ret_val;\n }\n@@ -222,7 +223,7 @@ static s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size,\n \tret_val = igb_poll_for_msg(hw, mbx_id);\n \n \tif (!ret_val)\n-\t\tret_val = mbx->ops.read(hw, msg, size, mbx_id);\n+\t\tret_val = mbx->ops.read(hw, msg, size, mbx_id, true);\n out:\n \treturn ret_val;\n }\n@@ -423,13 +424,14 @@ static s32 igb_write_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,\n  *  @msg: The message buffer\n  *  @size: Length of buffer\n  *  @vf_number: the VF index\n+ *  @unlock: unlock the mailbox when done?\n  *\n  *  This function copies a message from the mailbox buffer to the caller's\n  *  memory buffer.  The presumption is that the caller knows that there was\n  *  a message due to a VF request so no polling for message is needed.\n  **/\n static s32 igb_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,\n-\t\t\t   u16 vf_number)\n+\t\t\t   u16 vf_number, bool unlock)\n {\n \ts32 ret_val;\n \tu16 i;\n@@ -443,8 +445,12 @@ static s32 igb_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,\n \tfor (i = 0; i < size; i++)\n \t\tmsg[i] = array_rd32(E1000_VMBMEM(vf_number), i);\n \n-\t/* Acknowledge the message and release buffer */\n-\twr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_ACK);\n+\t/* Acknowledge the message and release mailbox lock (or not) */\n+\tif (unlock)\n+\t\twr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_ACK);\n+\telse\n+\t\twr32(E1000_P2VMAILBOX(vf_number),\n+\t\t     E1000_P2VMAILBOX_ACK | E1000_P2VMAILBOX_PFU);\n \n \t/* update stats */\n \thw->mbx.stats.msgs_rx++;\ndiff --git a/drivers/net/ethernet/intel/igb/e1000_mbx.h b/drivers/net/ethernet/intel/igb/e1000_mbx.h\nindex a98c5dc60afd..a62b08e1572e 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_mbx.h\n+++ b/drivers/net/ethernet/intel/igb/e1000_mbx.h\n@@ -67,7 +67,8 @@\n \n #define E1000_PF_CONTROL_MSG\t0x0100 /* PF control message */\n \n-s32 igb_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id);\n+s32 igb_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id,\n+\t\t bool unlock);\n s32 igb_write_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id);\n s32 igb_check_for_msg(struct e1000_hw *hw, u16 mbx_id);\n s32 igb_check_for_ack(struct e1000_hw *hw, u16 mbx_id);\ndiff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c\nindex 1cf74aa4ebd9..c046b37ad9eb 100644\n--- a/drivers/net/ethernet/intel/igb/igb_main.c\n+++ b/drivers/net/ethernet/intel/igb/igb_main.c\n@@ -6664,32 +6664,33 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)\n \tstruct vf_data_storage *vf_data = &adapter->vf_data[vf];\n \ts32 retval;\n \n-\tretval = igb_read_mbx(hw, msgbuf, E1000_VFMAILBOX_SIZE, vf);\n+\tretval = igb_read_mbx(hw, msgbuf, E1000_VFMAILBOX_SIZE, vf, false);\n \n \tif (retval) {\n \t\t/* if receive failed revoke VF CTS stats and restart init */\n \t\tdev_err(&pdev->dev, \"Error receiving message from VF\\n\");\n \t\tvf_data->flags &= ~IGB_VF_FLAG_CTS;\n \t\tif (!time_after(jiffies, vf_data->last_nack + (2 * HZ)))\n-\t\t\treturn;\n+\t\t\tgoto unlock;\n \t\tgoto out;\n \t}\n \n \t/* this is a message we already processed, do nothing */\n \tif (msgbuf[0] & (E1000_VT_MSGTYPE_ACK | E1000_VT_MSGTYPE_NACK))\n-\t\treturn;\n+\t\tgoto unlock;\n \n \t/* until the vf completes a reset it should not be\n \t * allowed to start any configuration.\n \t */\n \tif (msgbuf[0] == E1000_VF_RESET) {\n+\t\t/* unlocks mailbox */\n \t\tigb_vf_reset_msg(adapter, vf);\n \t\treturn;\n \t}\n \n \tif (!(vf_data->flags & IGB_VF_FLAG_CTS)) {\n \t\tif (!time_after(jiffies, vf_data->last_nack + (2 * HZ)))\n-\t\t\treturn;\n+\t\t\tgoto unlock;\n \t\tretval = -1;\n \t\tgoto out;\n \t}\n@@ -6730,7 +6731,12 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)\n \telse\n \t\tmsgbuf[0] |= E1000_VT_MSGTYPE_ACK;\n \n+\t/* unlocks mailbox */\n \tigb_write_mbx(hw, msgbuf, 1, vf);\n+\treturn;\n+\n+unlock:\n+\tigb_unlock_mbx(hw, vf);\n }\n \n static void igb_msg_task(struct igb_adapter *adapter)\n",
    "prefixes": [
        "3/3"
    ]
}