Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/657052/?format=api
{ "id": 657052, "url": "http://patchwork.ozlabs.org/api/patches/657052/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160809000819.27627-1-jacob.e.keller@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": "<20160809000819.27627-1-jacob.e.keller@intel.com>", "list_archive_url": null, "date": "2016-08-09T00:08:19", "name": "[v2,2/2] fm10k: don't re-map queues when a mailbox message suffices", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e3d977b0a91a9d6d2b8451f88d6adc5506df60a9", "submitter": { "id": 9784, "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api", "name": "Jacob Keller", "email": "jacob.e.keller@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/20160809000819.27627-1-jacob.e.keller@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/657052/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/657052/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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\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 3s7ZPR6CD1z9svs\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 9 Aug 2016 10:08:27 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 3F79E890F6;\n\tTue, 9 Aug 2016 00:08:26 +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 xhR2+0oD72Ox; Tue, 9 Aug 2016 00:08:24 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 72BEF88B53;\n\tTue, 9 Aug 2016 00:08:24 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id E0A181C2E23\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 9 Aug 2016 00:08:22 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id DA8AF30141\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 9 Aug 2016 00:08:22 +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 6kZlzhRc5ole for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 9 Aug 2016 00:08:22 +0000 (UTC)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby silver.osuosl.org (Postfix) with ESMTP id DF5022FCD9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 9 Aug 2016 00:08:21 +0000 (UTC)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga102.fm.intel.com with ESMTP; 08 Aug 2016 17:08:22 -0700", "from jekeller-desk.amr.corp.intel.com ([134.134.3.116])\n\tby fmsmga001.fm.intel.com with ESMTP; 08 Aug 2016 17:08:21 -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.28,492,1464678000\"; d=\"scan'208\";\n\ta=\"1021967000\"", "From": "Jacob Keller <jacob.e.keller@intel.com>", "To": "Intel Wired LAN <intel-wired-lan@lists.osuosl.org>", "Date": "Mon, 8 Aug 2016 17:08:19 -0700", "Message-Id": "<20160809000819.27627-1-jacob.e.keller@intel.com>", "X-Mailer": "git-send-email 2.9.2.701.gf965a18", "Subject": "[Intel-wired-lan] [PATCH v2 2/2] fm10k: don't re-map queues when a\n\tmailbox message suffices", "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": "When the PF assigns a new MAC address to a VF it uses the base address\nregisters to store the MAC address. This allows a VF which loads after\nthis setup the ability to get the initial address without having to wait\nfor a mailbox message. Unfortunately to do this, the PF must take queue\nownership away from the VF, which can cause fault errors when there is\nalready an active VF driver.\n\nThis queue ownership assignment causes race condition between the PF and\nthe VF such that potentially a VF can cause FUM fault errors due to\nnormal PF/VF driver behavior.\n\nIt is not safe to simply allow the PF to write the base address\nregisters without taking queue ownership back as the PF must also\ndisable the queues, and this would impact active VF use. The current\ncode is safe because the queue ownership will prevent the VF from\nactually writing but does trigger the FUM fault.\n\nWe can do better by simply avoiding the register write process when\na mailbox message suffices. If the message can be sent over the mailbox,\nthen we will not perform the queue ownership assignment and we won't\nupdate the base address to be the same as the MAC address.\n\nWe do still have to write the TXQCTL registers in order to update the\nVID of the queue. This is necessary because the TXQCTL register is\nread-only from the VF, and thus the VF cannot do this for itself. This\nregister does not need to wait for the Tx queue to be disabled and is\nsafe for the PF to write during normal VF operation, so we move this\nwrite to the top of the function above the mailbox message. Without\nthis, the TXQCTL register would be misconfigured and cause the VF to Tx\nhang.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 46 ++++++++++++++++++-----------\n 1 file changed, 29 insertions(+), 17 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c\nindex 682299dd0ce4..23fb319fd2a0 100644\n--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c\n+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c\n@@ -867,10 +867,6 @@ static s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,\n \tvf_q_idx = fm10k_vf_queue_index(hw, vf_idx);\n \tqmap_idx = qmap_stride * vf_idx;\n \n-\t/* MAP Tx queue back to 0 temporarily, and disable it */\n-\tfm10k_write_reg(hw, FM10K_TQMAP(qmap_idx), 0);\n-\tfm10k_write_reg(hw, FM10K_TXDCTL(vf_q_idx), 0);\n-\n \t/* Determine correct default VLAN ID. The FM10K_VLAN_OVERRIDE bit is\n \t * used here to indicate to the VF that it will not have privilege to\n \t * write VLAN_TABLE. All policy is enforced on the PF but this allows\n@@ -886,9 +882,35 @@ static s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,\n \tfm10k_tlv_attr_put_mac_vlan(msg, FM10K_MAC_VLAN_MSG_DEFAULT_MAC,\n \t\t\t\t vf_info->mac, vf_vid);\n \n-\t/* load onto outgoing mailbox, ignore any errors on enqueue */\n-\tif (vf_info->mbx.ops.enqueue_tx)\n-\t\tvf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);\n+\t/* Configure Queue control register with new VLAN ID. The TXQCTL\n+\t * register is RO from the VF, so the PF must do this even in the\n+\t * case of notifying the VF of a new VID via the mailbox.\n+\t */\n+\ttxqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &\n+\t\t FM10K_TXQCTL_VID_MASK;\n+\ttxqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |\n+\t\t FM10K_TXQCTL_VF | vf_idx;\n+\n+\tfor (i = 0; i < queues_per_pool; i++)\n+\t\tfm10k_write_reg(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);\n+\n+\t/* try loading a message onto outgoing mailbox first */\n+\tif (vf_info->mbx.ops.enqueue_tx) {\n+\t\terr = vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);\n+\t\tif (err != FM10K_MBX_ERR_NO_MBX)\n+\t\t\treturn err;\n+\t\terr = 0;\n+\t}\n+\n+\t/* If we aren't connected to a mailbox, this is most likely because\n+\t * the VF driver is not running. It should thus be safe to re-map\n+\t * queues and use the registers to pass the MAC address so that the VF\n+\t * driver gets correct information during its initialization.\n+\t */\n+\n+\t/* MAP Tx queue back to 0 temporarily, and disable it */\n+\tfm10k_write_reg(hw, FM10K_TQMAP(qmap_idx), 0);\n+\tfm10k_write_reg(hw, FM10K_TXDCTL(vf_q_idx), 0);\n \n \t/* verify ring has disabled before modifying base address registers */\n \ttxdctl = fm10k_read_reg(hw, FM10K_TXDCTL(vf_q_idx));\n@@ -927,16 +949,6 @@ static s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,\n \t\t\t\t\t\t FM10K_TDLEN_ITR_SCALE_SHIFT);\n \n err_out:\n-\t/* configure Queue control register */\n-\ttxqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &\n-\t\t FM10K_TXQCTL_VID_MASK;\n-\ttxqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |\n-\t\t FM10K_TXQCTL_VF | vf_idx;\n-\n-\t/* assign VLAN ID */\n-\tfor (i = 0; i < queues_per_pool; i++)\n-\t\tfm10k_write_reg(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);\n-\n \t/* restore the queue back to VF ownership */\n \tfm10k_write_reg(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);\n \treturn err;\n", "prefixes": [ "v2", "2/2" ] }