Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/824594/?format=api
{ "id": 824594, "url": "http://patchwork.ozlabs.org/api/patches/824594/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171011214943.7076-2-alan.brady@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": "<20171011214943.7076-2-alan.brady@intel.com>", "list_archive_url": null, "date": "2017-10-11T21:49:43", "name": "[v2,2/2,net-next] i40e/i40evf: don't trust VF to reset itself", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "8e55132fa37b199caf90feaa882c4c2ecf93ccbc", "submitter": { "id": 69551, "url": "http://patchwork.ozlabs.org/api/people/69551/?format=api", "name": "Alan Brady", "email": "alan.brady@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/20171011214943.7076-2-alan.brady@intel.com/mbox/", "series": [ { "id": 7702, "url": "http://patchwork.ozlabs.org/api/series/7702/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=7702", "date": "2017-10-11T21:49:42", "name": "[v2,1/2,net-next] i40e: fix link reporting", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/7702/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/824594/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/824594/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" ], "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 3yC75S1VKdz9sRq\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 12 Oct 2017 08:53:16 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id A6680826DB;\n\tWed, 11 Oct 2017 21:53:14 +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 qaeb7YeXDgI2; Wed, 11 Oct 2017 21:53:10 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id A763089066;\n\tWed, 11 Oct 2017 21:53:09 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 421871BFB44\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 11 Oct 2017 21:53:07 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 37D0387AFE\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 11 Oct 2017 21:53:07 +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 vFMV6IZpwtwJ for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 11 Oct 2017 21:53:05 +0000 (UTC)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 6240188209\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 11 Oct 2017 21:53:05 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Oct 2017 14:53:05 -0700", "from dev1-atbrady.jf.intel.com ([10.165.248.38])\n\tby FMSMGA003.fm.intel.com with ESMTP; 11 Oct 2017 14:53:04 -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.43,362,1503385200\"; d=\"scan'208\";a=\"909052883\"", "From": "Alan Brady <alan.brady@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 11 Oct 2017 14:49:43 -0700", "Message-Id": "<20171011214943.7076-2-alan.brady@intel.com>", "X-Mailer": "git-send-email 2.14.2", "In-Reply-To": "<20171011214943.7076-1-alan.brady@intel.com>", "References": "<20171011214943.7076-1-alan.brady@intel.com>", "Subject": "[Intel-wired-lan] [PATCH v2 2/2 net-next] i40e/i40evf: don't trust\n\tVF to reset itself", "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>", "MIME-Version": "1.0", "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 using 'ethtool -L' on a VF to change number of requested queues\nfrom PF, we shouldn't trust the VF to reset itself after making the\nrequest. Doing it that way opens the door for a potentially malicious\nVF to do nasty things to the PF which should never be the case.\n\nThis makes it such that after VF makes a successful request, PF will\nthen reset the VF to institute required changes. Only if the request\nfails will PF send a message back to VF letting it know the request was\nunsuccessful.\n\nTesting-hints:\nThere should be no real functional changes. This is simply hardening\nagainst a potentially malicious VF.\n\nv2: remove extra commit tags\n\nSigned-off-by: Alan Brady <alan.brady@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 9 +++++++--\n drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 7 +++----\n include/linux/avf/virtchnl.h | 4 ++--\n 3 files changed, 12 insertions(+), 8 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex ce0981e2f605..f8a794b72462 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -2045,8 +2045,9 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)\n * @msglen: msg length\n *\n * VFs get a default number of queues but can use this message to request a\n- * different number. Will respond with either the number requested or the\n- * maximum we can support.\n+ * different number. If the request is successful, PF will reset the VF and\n+ * return 0. If unsuccessful, PF will send message informing VF of number of\n+ * available queues and return result of sending VF a message.\n **/\n static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg, int msglen)\n {\n@@ -2077,7 +2078,11 @@ static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg, int msglen)\n \t\t\t pf->queues_left);\n \t\tvfres->num_queue_pairs = pf->queues_left + cur_pairs;\n \t} else {\n+\t\t/* successful request */\n \t\tvf->num_req_queues = req_pairs;\n+\t\ti40e_vc_notify_vf_reset(vf);\n+\t\ti40e_reset_vf(vf, false);\n+\t\treturn 0;\n \t}\n \n \treturn i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_REQUEST_QUEUES, 0,\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c\nindex 2bb81c39d85f..46c8b8a3907c 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c\n@@ -407,6 +407,7 @@ int i40evf_request_queues(struct i40evf_adapter *adapter, int num)\n \tvfres.num_queue_pairs = num;\n \n \tadapter->current_op = VIRTCHNL_OP_REQUEST_QUEUES;\n+\tadapter->flags |= I40EVF_FLAG_REINIT_ITR_NEEDED;\n \treturn i40evf_send_pf_msg(adapter, VIRTCHNL_OP_REQUEST_QUEUES,\n \t\t\t\t (u8 *)&vfres, sizeof(vfres));\n }\n@@ -1098,15 +1099,13 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,\n \tcase VIRTCHNL_OP_REQUEST_QUEUES: {\n \t\tstruct virtchnl_vf_res_request *vfres =\n \t\t\t(struct virtchnl_vf_res_request *)msg;\n-\t\tif (vfres->num_queue_pairs == adapter->num_req_queues) {\n-\t\t\tadapter->flags |= I40EVF_FLAG_REINIT_ITR_NEEDED;\n-\t\t\ti40evf_schedule_reset(adapter);\n-\t\t} else {\n+\t\tif (vfres->num_queue_pairs != adapter->num_req_queues) {\n \t\t\tdev_info(&adapter->pdev->dev,\n \t\t\t\t \"Requested %d queues, PF can support %d\\n\",\n \t\t\t\t adapter->num_req_queues,\n \t\t\t\t vfres->num_queue_pairs);\n \t\t\tadapter->num_req_queues = 0;\n+\t\t\tadapter->flags &= ~I40EVF_FLAG_REINIT_ITR_NEEDED;\n \t\t}\n \t\t}\n \t\tbreak;\ndiff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h\nindex 60e5d90cb18a..3ce61342fa31 100644\n--- a/include/linux/avf/virtchnl.h\n+++ b/include/linux/avf/virtchnl.h\n@@ -333,8 +333,8 @@ struct virtchnl_vsi_queue_config_info {\n * additional queues must be negotiated. This is a best effort request as it\n * is possible the PF does not have enough queues left to support the request.\n * If the PF cannot support the number requested it will respond with the\n- * maximum number it is able to support; otherwise it will respond with the\n- * number requested.\n+ * maximum number it is able to support. If the request is successful, PF will\n+ * then reset the VF to institute required changes.\n */\n \n /* VF resource request */\n", "prefixes": [ "v2", "2/2", "net-next" ] }