Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/831543/?format=api
{ "id": 831543, "url": "http://patchwork.ozlabs.org/api/patches/831543/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171027150656.68250-7-alice.michael@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": "<20171027150656.68250-7-alice.michael@intel.com>", "list_archive_url": null, "date": "2017-10-27T15:06:54", "name": "[next,S81-V3,7/9] i40e: add helper conversion function for link_speed", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "98309307a28ce0ae149ec4c32c1a164ad275bd3a", "submitter": { "id": 71123, "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api", "name": "Michael, Alice", "email": "alice.michael@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/20171027150656.68250-7-alice.michael@intel.com/mbox/", "series": [ { "id": 10681, "url": "http://patchwork.ozlabs.org/api/series/10681/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=10681", "date": "2017-10-27T15:06:48", "name": "[next,S81-V3,1/9] i40e: display priority_xon and priority_xoff stats", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/10681/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/831543/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/831543/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 3yP0614XGWz9t5R\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 10:12:57 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 0F57C8A41C;\n\tFri, 27 Oct 2017 23:12:56 +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 V35XwUq7LWco; Fri, 27 Oct 2017 23:12:52 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 62E538A414;\n\tFri, 27 Oct 2017 23:12:52 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 5ABF81CEF3D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:47 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 506728A0A9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:47 +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 uFSW7-cvmu0A for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:44 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 6072D8A0DD\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:43 +0000 (UTC)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Oct 2017 16:12:42 -0700", "from unknown (HELO localhost.jf.intel.com) ([10.166.16.121])\n\tby fmsmga002.fm.intel.com with ESMTP; 27 Oct 2017 16:12:42 -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.44,306,1505804400\"; d=\"scan'208\";\n\ta=\"1236400572\"", "From": "Alice Michael <alice.michael@intel.com>", "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org", "Date": "Fri, 27 Oct 2017 11:06:54 -0400", "Message-Id": "<20171027150656.68250-7-alice.michael@intel.com>", "X-Mailer": "git-send-email 2.9.5", "In-Reply-To": "<20171027150656.68250-1-alice.michael@intel.com>", "References": "<20171027150656.68250-1-alice.michael@intel.com>", "Subject": "[Intel-wired-lan] [next PATCH S81-V3 7/9] i40e: add helper\n\tconversion function for link_speed", "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": "From: Jacob Keller <jacob.e.keller@intel.com>\n\nWe introduced the virtchnl interface in order to have an interface for\ntalking to a virtual device driver which was host-driver agnostic. This\ninterface has its own definitions, including one for link speed.\n\nThe host driver has to talk to the virtchnl interface using these new\ndefinitions in order to remain compatible. Today, the i40e link_speed\nenumerations are value-exact matches for the virtchnl interface, so it\nwas originally decided to simply use a typecast.\n\nHowever, this is unsafe, and makes it easier for future drivers to\ncontinue this unsafe practice. There is nothing guaranteeing these\nvalues are exact, and the type-cast would hide any compiler warning\nwhich indicates the problem.\n\nRather than rely on this type cast, introduce a helper function which\ncan convert the AdminQ link speed definition into a virtchnl\ndefinition. This can then be used by host driver implementations in\norder to safely convert to the interface recognized by the virtual\nfunctions.\n\nIf the link speed is not able to be represented by the virtchnl\ndefinitions we'll report UNKNOWN which is the safest result.\n\nThis will ensure that should the driver specific link_speeds actual bit\ndefinitions change, we do not report them incorrectly according to the\nVF.\n\nAdditionally, this provides a better pattern for future drivers to copy,\nas it is more likely a future device may not use the exact same bit-wise\ndefinition as the current virtchnl interface.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_prototype.h | 31 ++++++++++++++++++++++\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 +--\n 2 files changed, 33 insertions(+), 2 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h\nindex 3bb6659..e70bebc 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h\n@@ -343,6 +343,37 @@ static inline struct i40e_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)\n \treturn i40e_ptype_lookup[ptype];\n }\n \n+/**\n+ * i40e_virtchnl_link_speed - Convert AdminQ link_speed to virtchnl definition\n+ * @link_speed: the speed to convert\n+ *\n+ * Returns the link_speed in terms of the virtchnl interface, for use in\n+ * converting link_speed as reported by the AdminQ into the format used for\n+ * talking to virtchnl devices. If we can't represent the link speed properly,\n+ * report LINK_SPEED_UNKNOWN.\n+ **/\n+static inline enum virtchnl_link_speed\n+i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)\n+{\n+\tswitch (link_speed) {\n+\tcase I40E_LINK_SPEED_100MB:\n+\t\treturn VIRTCHNL_LINK_SPEED_100MB;\n+\tcase I40E_LINK_SPEED_1GB:\n+\t\treturn VIRTCHNL_LINK_SPEED_1GB;\n+\tcase I40E_LINK_SPEED_10GB:\n+\t\treturn VIRTCHNL_LINK_SPEED_10GB;\n+\tcase I40E_LINK_SPEED_40GB:\n+\t\treturn VIRTCHNL_LINK_SPEED_40GB;\n+\tcase I40E_LINK_SPEED_20GB:\n+\t\treturn VIRTCHNL_LINK_SPEED_20GB;\n+\tcase I40E_LINK_SPEED_25GB:\n+\t\treturn VIRTCHNL_LINK_SPEED_25GB;\n+\tcase I40E_LINK_SPEED_UNKNOWN:\n+\tdefault:\n+\t\treturn VIRTCHNL_LINK_SPEED_UNKNOWN;\n+\t}\n+}\n+\n /* prototype for functions used for SW locks */\n \n /* i40e_common for VF drivers*/\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 5c5113c..bfba60f 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -81,12 +81,12 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf)\n \tif (vf->link_forced) {\n \t\tpfe.event_data.link_event.link_status = vf->link_up;\n \t\tpfe.event_data.link_event.link_speed =\n-\t\t\t(vf->link_up ? I40E_LINK_SPEED_40GB : 0);\n+\t\t\t(vf->link_up ? VIRTCHNL_LINK_SPEED_40GB : 0);\n \t} else {\n \t\tpfe.event_data.link_event.link_status =\n \t\t\tls->link_info & I40E_AQ_LINK_UP;\n \t\tpfe.event_data.link_event.link_speed =\n-\t\t\t(enum virtchnl_link_speed)ls->link_speed;\n+\t\t\ti40e_virtchnl_link_speed(ls->link_speed);\n \t}\n \ti40e_aq_send_msg_to_vf(hw, abs_vf_id, VIRTCHNL_OP_EVENT,\n \t\t\t 0, (u8 *)&pfe, sizeof(pfe), NULL);\n", "prefixes": [ "next", "S81-V3", "7/9" ] }