Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/612423/?format=api
{ "id": 612423, "url": "http://patchwork.ozlabs.org/api/patches/612423/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1461118677-28142-2-git-send-email-kys@microsoft.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": "<1461118677-28142-2-git-send-email-kys@microsoft.com>", "list_archive_url": null, "date": "2016-04-20T02:17:57", "name": "[net-next,V5,2/2] intel: ixgbevf: Support Windows hosts (Hyper-V)", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "0330b6a38940ae2344eb2be4828b080add215ad9", "submitter": { "id": 13352, "url": "http://patchwork.ozlabs.org/api/people/13352/?format=api", "name": "KY Srinivasan", "email": "kys@microsoft.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/1461118677-28142-2-git-send-email-kys@microsoft.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/612423/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/612423/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\tby ozlabs.org (Postfix) with ESMTP id 3qqNLZ1gP7z9sRB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Apr 2016 10:39:34 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 3A58A8BC90;\n\tWed, 20 Apr 2016 00:39:33 +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 sTQZbcQR4Vji; Wed, 20 Apr 2016 00:39:24 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 34F9C8BD2E;\n\tWed, 20 Apr 2016 00:39:23 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id C44ED1C1F31\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 20 Apr 2016 00:39:20 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id C03F587731\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 20 Apr 2016 00:39:20 +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 Qkj0PRoCk_r7 for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 20 Apr 2016 00:39:19 +0000 (UTC)", "from p3plsmtps2ded04.prod.phx3.secureserver.net\n\t(p3plsmtps2ded04.prod.phx3.secureserver.net [208.109.80.198])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 6FF8287568\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 20 Apr 2016 00:39:19 +0000 (UTC)", "from linuxonhyperv.com ([72.167.245.219])\n\tby : HOSTING RELAY : with SMTP\n\tid sg7taBq9bfrN0sg7tavQdI; Tue, 19 Apr 2016 17:36:18 -0700", "by linuxonhyperv.com (Postfix, from userid 507)\n\tid A6D251904AA; Tue, 19 Apr 2016 19:17:58 -0700 (PDT)" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "x-originating-ip": "72.167.245.219", "From": "\"K. Y. Srinivasan\" <kys@microsoft.com>", "To": "davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tdevel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com,\n\tjasowang@redhat.com, eli@mellanox.com, jackm@mellanox.com,\n\tyevgenyp@mellanox.com, john.ronciak@intel.com,\n\tintel-wired-lan@lists.osuosl.org, alexander.duyck@gmail.com", "Date": "Tue, 19 Apr 2016 19:17:57 -0700", "Message-Id": "<1461118677-28142-2-git-send-email-kys@microsoft.com>", "X-Mailer": "git-send-email 1.7.4.1", "In-Reply-To": "<1461118677-28142-1-git-send-email-kys@microsoft.com>", "References": "<1461118655-28103-1-git-send-email-kys@microsoft.com>\n\t<1461118677-28142-1-git-send-email-kys@microsoft.com>", "X-CMAE-Envelope": "MS4wfNMLUkn7qR5xCh4MvJt2te9QjZxWuzKyyONOUWvsMLsRpz/gXjeZ7hnHvz5CZodSFyk6VC0pdf1OByakxNMykpxtvBXnhQuw64RsPxhCwGmnwJq0zqVC\n\tSmKQaL937n0sbQg/ah5Rwh194D2jPX8Adnf+VL8b0lnYk9/TFtwfjlcAmYgWV/MhZ1BtepthaJFBpCjNZUGBnk7e/6EJCFbXs/DrDefrVUpx+o87pE5oMqcX\n\tvzc2Z3EL6rszwwbPvsLBjPBKFelwEKkpb4lYD0UiLyco/9ICzPWYoSEu02j5E/DxGqJQIMjbsCPv4VFC6dKtRP9jAvH/lyuLFt5/m7VqWBf1sen/b9DVvD/y\n\tjZs0vHQe7VKUyntMBSn1c5BZ44mP4fe1AYHAqxg9yBUnBW85+ivM1Xk8BwzWJLJ7b4jjTv56SajbBHcYHNZYMJyPbx5oZu3tEsz44/P9Ku0hs4SKkO6Egp4d\n\tvBWrYyCnCQILVuHkORphCaGFZNmwkm8icNbWJcAooFulPYeFziqzhgAoa805vbQoWKdjfhTTkkPlgFpFqi4kB9ENHyeMb//9ADJhOwpPKDAAWI/4bCy/7Hxf\n\tPJreVhdlS09+fDK7kMvaY5umYRpo6XbZqDQk3hRTi9n5rQ==", "Subject": "[Intel-wired-lan] [PATCH net-next V5 2/2] intel: ixgbevf: Support\n\tWindows hosts (Hyper-V)", "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": "On Hyper-V, the VF/PF communication is a via software mediated path\nas opposed to the hardware mailbox. Make the necessary\nadjustments to support Hyper-V.\n\nSigned-off-by: K. Y. Srinivasan <kys@microsoft.com>\n---\n\tV2: Addressed most of the comments from\n\t Alexander Duyck <alexander.duyck@gmail.com>\n\t and Rustad, Mark D <mark.d.rustad@intel.com>.\n\n\tV3: Addressed additional comments from\n\t Alexander Duyck <alexander.duyck@gmail.com>\n\n\tV4: Addressed kbuild errors reported by:\n\t kbuild test robot <lkp@intel.com>\n\n\tV5: Addressed additional comments from\n\t Alexander Duyck <alexander.duyck@gmail.com>\n\n drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 12 ++\n drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 31 +++-\n drivers/net/ethernet/intel/ixgbevf/mbx.c | 12 ++\n drivers/net/ethernet/intel/ixgbevf/vf.c | 216 +++++++++++++++++++++\n drivers/net/ethernet/intel/ixgbevf/vf.h | 2 +\n 5 files changed, 266 insertions(+), 7 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h\nindex 5ac60ee..3296d27 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h\n+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h\n@@ -460,9 +460,13 @@ enum ixbgevf_state_t {\n \n enum ixgbevf_boards {\n \tboard_82599_vf,\n+\tboard_82599_vf_hv,\n \tboard_X540_vf,\n+\tboard_X540_vf_hv,\n \tboard_X550_vf,\n+\tboard_X550_vf_hv,\n \tboard_X550EM_x_vf,\n+\tboard_X550EM_x_vf_hv,\n };\n \n enum ixgbevf_xcast_modes {\n@@ -477,6 +481,13 @@ extern const struct ixgbevf_info ixgbevf_X550_vf_info;\n extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_info;\n extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops;\n \n+\n+extern const struct ixgbevf_info ixgbevf_82599_vf_hv_info;\n+extern const struct ixgbevf_info ixgbevf_X540_vf_hv_info;\n+extern const struct ixgbevf_info ixgbevf_X550_vf_hv_info;\n+extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_hv_info;\n+extern const struct ixgbe_mbx_operations ixgbevf_hv_mbx_ops;\n+\n /* needed by ethtool.c */\n extern const char ixgbevf_driver_name[];\n extern const char ixgbevf_driver_version[];\n@@ -494,6 +505,7 @@ void ixgbevf_free_rx_resources(struct ixgbevf_ring *);\n void ixgbevf_free_tx_resources(struct ixgbevf_ring *);\n void ixgbevf_update_stats(struct ixgbevf_adapter *adapter);\n int ethtool_ioctl(struct ifreq *ifr);\n+bool ixgbevf_on_hyperv(struct ixgbe_hw *hw);\n \n extern void ixgbevf_write_eitr(struct ixgbevf_q_vector *q_vector);\n \ndiff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c\nindex 007cbe0..c4bb480 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c\n+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c\n@@ -62,10 +62,14 @@ static char ixgbevf_copyright[] =\n \t\"Copyright (c) 2009 - 2015 Intel Corporation.\";\n \n static const struct ixgbevf_info *ixgbevf_info_tbl[] = {\n-\t[board_82599_vf] = &ixgbevf_82599_vf_info,\n-\t[board_X540_vf] = &ixgbevf_X540_vf_info,\n-\t[board_X550_vf] = &ixgbevf_X550_vf_info,\n-\t[board_X550EM_x_vf] = &ixgbevf_X550EM_x_vf_info,\n+\t[board_82599_vf]\t= &ixgbevf_82599_vf_info,\n+\t[board_82599_vf_hv]\t= &ixgbevf_82599_vf_hv_info,\n+\t[board_X540_vf]\t\t= &ixgbevf_X540_vf_info,\n+\t[board_X540_vf_hv]\t= &ixgbevf_X540_vf_hv_info,\n+\t[board_X550_vf]\t\t= &ixgbevf_X550_vf_info,\n+\t[board_X550_vf_hv]\t= &ixgbevf_X550_vf_hv_info,\n+\t[board_X550EM_x_vf]\t= &ixgbevf_X550EM_x_vf_info,\n+\t[board_X550EM_x_vf_hv]\t= &ixgbevf_X550EM_x_vf_hv_info,\n };\n \n /* ixgbevf_pci_tbl - PCI Device ID Table\n@@ -78,9 +82,13 @@ static const struct ixgbevf_info *ixgbevf_info_tbl[] = {\n */\n static const struct pci_device_id ixgbevf_pci_tbl[] = {\n \t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF), board_82599_vf },\n+\t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF_HV), board_82599_vf_hv },\n \t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540_VF), board_X540_vf },\n+\t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540_VF_HV), board_X540_vf_hv },\n \t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550_VF), board_X550_vf },\n+\t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550_VF_HV), board_X550_vf_hv },\n \t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_VF), board_X550EM_x_vf },\n+\t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_VF_HV), board_X550EM_x_vf_hv},\n \t/* required last entry */\n \t{0, }\n };\n@@ -1795,7 +1803,10 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter)\n \t\tixgbevf_setup_vfmrqc(adapter);\n \n \t/* notify the PF of our intent to use this size of frame */\n-\tixgbevf_rlpml_set_vf(hw, netdev->mtu + ETH_HLEN + ETH_FCS_LEN);\n+\tif (!ixgbevf_on_hyperv(hw))\n+\t\tixgbevf_rlpml_set_vf(hw, netdev->mtu + ETH_HLEN + ETH_FCS_LEN);\n+\telse\n+\t\tixgbevf_hv_rlpml_set_vf(hw, netdev->mtu + ETH_HLEN + ETH_FCS_LEN);\n \n \t/* Setup the HW Rx Head and Tail Descriptor Pointers and\n \t * the Base and Length of the Rx Descriptor Ring\n@@ -2056,7 +2067,10 @@ static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter)\n \tspin_lock_bh(&adapter->mbx_lock);\n \n \twhile (api[idx] != ixgbe_mbox_api_unknown) {\n-\t\terr = ixgbevf_negotiate_api_version(hw, api[idx]);\n+\t\tif (!ixgbevf_on_hyperv(hw))\n+\t\t\terr = ixgbevf_negotiate_api_version(hw, api[idx]);\n+\t\telse\n+\t\t\terr = ixgbevf_hv_negotiate_api_version(hw, api[idx]);\n \t\tif (!err)\n \t\t\tbreak;\n \t\tidx++;\n@@ -3727,7 +3741,10 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)\n \tnetdev->mtu = new_mtu;\n \n \t/* notify the PF of our intent to use this size of frame */\n-\tixgbevf_rlpml_set_vf(hw, max_frame);\n+\tif (!ixgbevf_on_hyperv(hw))\n+\t\tixgbevf_rlpml_set_vf(hw, max_frame);\n+\telse\n+\t\tixgbevf_hv_rlpml_set_vf(hw, max_frame);\n \n \treturn 0;\n }\ndiff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.c b/drivers/net/ethernet/intel/ixgbevf/mbx.c\nindex dc68fea..298a0da 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/mbx.c\n+++ b/drivers/net/ethernet/intel/ixgbevf/mbx.c\n@@ -346,3 +346,15 @@ const struct ixgbe_mbx_operations ixgbevf_mbx_ops = {\n \t.check_for_rst\t= ixgbevf_check_for_rst_vf,\n };\n \n+/**\n+ * Mailbox operations when running on Hyper-V.\n+ * On Hyper-V, PF/VF communiction is not through the\n+ * hardware mailbox; this communication is through\n+ * a software mediated path.\n+ * Most mail box operations are noop while running on\n+ * Hyper-V.\n+ */\n+const struct ixgbe_mbx_operations ixgbevf_hv_mbx_ops = {\n+\t.init_params\t= ixgbevf_init_mbx_params_vf,\n+\t.check_for_rst\t= ixgbevf_check_for_rst_vf,\n+};\ndiff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c\nindex 4d613a4..7208956 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/vf.c\n+++ b/drivers/net/ethernet/intel/ixgbevf/vf.c\n@@ -27,6 +27,13 @@\n #include \"vf.h\"\n #include \"ixgbevf.h\"\n \n+/*\n+ * On Hyper-V, to reset, we need to read from this offset\n+ * from the PCI config space. This is the mechanism used on\n+ * Hyper-V to support PF/VF communication.\n+ */\n+#define IXGBE_HV_RESET_OFFSET 0x201\n+\n /**\n * ixgbevf_start_hw_vf - Prepare hardware for Tx/Rx\n * @hw: pointer to hardware structure\n@@ -126,6 +133,27 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw)\n }\n \n /**\n+ * Hyper-V variant; the VF/PF communication is through the PCI\n+ * config space.\n+ */\n+static s32 ixgbevf_hv_reset_hw_vf(struct ixgbe_hw *hw)\n+{\n+#if IS_ENABLED(CONFIG_PCI_MMCONFIG)\n+\tstruct ixgbevf_adapter *adapter = hw->back;\n+\tint i;\n+\n+\tfor (i = 0; i < 6; i++)\n+\t\tpci_read_config_byte(adapter->pdev,\n+\t\t\t\t (i + IXGBE_HV_RESET_OFFSET),\n+\t\t\t\t &hw->mac.perm_addr[i]);\n+\treturn 0;\n+#else\n+\tpr_err(\"PCI_MMCONFIG needs to be enabled for Hyper-V\\n\");\n+\treturn -EOPNOTSUPP;\n+#endif\n+}\n+\n+/**\n * ixgbevf_stop_hw_vf - Generic stop Tx/Rx units\n * @hw: pointer to hardware structure\n *\n@@ -258,6 +286,11 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)\n \treturn ret_val;\n }\n \n+static s32 ixgbevf_hv_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)\n+{\n+\treturn -EOPNOTSUPP;\n+}\n+\n /**\n * ixgbevf_get_reta_locked - get the RSS redirection table (RETA) contents.\n * @adapter: pointer to the port handle\n@@ -416,6 +449,26 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,\n \treturn ret_val;\n }\n \n+/**\n+ * ixgbevf_hv_set_rar_vf - set device MAC address Hyper-V variant\n+ * @hw: pointer to hardware structure\n+ * @index: Receive address register to write\n+ * @addr: Address to put into receive address register\n+ * @vmdq: Unused in this implementation\n+ *\n+ * We don't really allow setting the device MAC address. However,\n+ * if the address being set is the permanent MAC address we will\n+ * permit that.\n+ **/\n+static s32 ixgbevf_hv_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,\n+\t\t\t\t u32 vmdq)\n+{\n+\tif (ether_addr_equal(addr, hw->mac.perm_addr))\n+\t\treturn 0;\n+\n+\treturn -EOPNOTSUPP;\n+}\n+\n static void ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw,\n \t\t\t\t u32 *msg, u16 size)\n {\n@@ -473,6 +526,15 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,\n }\n \n /**\n+ * Hyper-V variant - just a stub.\n+ */\n+static s32 ixgbevf_hv_update_mc_addr_list_vf(struct ixgbe_hw *hw,\n+\t\t\t\t\t struct net_device *netdev)\n+{\n+\treturn -EOPNOTSUPP;\n+}\n+\n+/**\n * ixgbevf_update_xcast_mode - Update Multicast mode\n * @hw: pointer to the HW structure\n * @netdev: pointer to net device structure\n@@ -513,6 +575,15 @@ static s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw,\n }\n \n /**\n+ * Hyper-V variant - just a stub.\n+ */\n+static s32 ixgbevf_hv_update_xcast_mode(struct ixgbe_hw *hw,\n+\t\t\t\t\tstruct net_device *netdev, int xcast_mode)\n+{\n+\treturn -EOPNOTSUPP;\n+}\n+\n+/**\n * ixgbevf_set_vfta_vf - Set/Unset VLAN filter table address\n * @hw: pointer to the HW structure\n * @vlan: 12 bit VLAN ID\n@@ -551,6 +622,15 @@ mbx_err:\n }\n \n /**\n+ * Hyper-V variant - just a stub.\n+ */\n+static s32 ixgbevf_hv_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,\n+\t\t\t\t bool vlan_on)\n+{\n+\treturn -EOPNOTSUPP;\n+}\n+\n+/**\n * ixgbevf_setup_mac_link_vf - Setup MAC link settings\n * @hw: pointer to hardware structure\n * @speed: Unused in this implementation\n@@ -656,6 +736,67 @@ out:\n }\n \n /**\n+ * Hyper-V variant; there is no mailbox communication.\n+ */\n+static s32 ixgbevf_hv_check_mac_link_vf(struct ixgbe_hw *hw,\n+\t\t\t\t\tixgbe_link_speed *speed,\n+\t\t\t\t\tbool *link_up,\n+\t\t\t\t\tbool autoneg_wait_to_complete)\n+{\n+\tstruct ixgbe_mbx_info *mbx = &hw->mbx;\n+\tstruct ixgbe_mac_info *mac = &hw->mac;\n+\tu32 links_reg;\n+\n+\t/* If we were hit with a reset drop the link */\n+\tif (!mbx->ops.check_for_rst(hw) || !mbx->timeout)\n+\t\tmac->get_link_status = true;\n+\n+\tif (!mac->get_link_status)\n+\t\tgoto out;\n+\n+\t/* if link status is down no point in checking to see if pf is up */\n+\tlinks_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);\n+\tif (!(links_reg & IXGBE_LINKS_UP))\n+\t\tgoto out;\n+\n+\t/* for SFP+ modules and DA cables on 82599 it can take up to 500usecs\n+\t * before the link status is correct\n+\t */\n+\tif (mac->type == ixgbe_mac_82599_vf) {\n+\t\tint i;\n+\n+\t\tfor (i = 0; i < 5; i++) {\n+\t\t\tudelay(100);\n+\t\t\tlinks_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);\n+\n+\t\t\tif (!(links_reg & IXGBE_LINKS_UP))\n+\t\t\t\tgoto out;\n+\t\t}\n+\t}\n+\n+\tswitch (links_reg & IXGBE_LINKS_SPEED_82599) {\n+\tcase IXGBE_LINKS_SPEED_10G_82599:\n+\t\t*speed = IXGBE_LINK_SPEED_10GB_FULL;\n+\t\tbreak;\n+\tcase IXGBE_LINKS_SPEED_1G_82599:\n+\t\t*speed = IXGBE_LINK_SPEED_1GB_FULL;\n+\t\tbreak;\n+\tcase IXGBE_LINKS_SPEED_100_82599:\n+\t\t*speed = IXGBE_LINK_SPEED_100_FULL;\n+\t\tbreak;\n+\t}\n+\n+\t/* if we passed all the tests above then the link is up and we no\n+\t * longer need to check for link\n+\t */\n+\tmac->get_link_status = false;\n+\n+out:\n+\t*link_up = !mac->get_link_status;\n+\treturn 0;\n+}\n+\n+/**\n * ixgbevf_rlpml_set_vf - Set the maximum receive packet length\n * @hw: pointer to the HW structure\n * @max_size: value to assign to max frame size\n@@ -670,6 +811,25 @@ void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)\n }\n \n /**\n+ * ixgbevf_hv_rlpml_set_vf - Set the maximum receive packet length\n+ * @hw: pointer to the HW structure\n+ * @max_size: value to assign to max frame size\n+ * Hyper-V variant.\n+ **/\n+void ixgbevf_hv_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)\n+{\n+\tu32 reg;\n+\n+\t/* If we are on Hyper-V, we implement\n+\t * this functionality differently.\n+\t */\n+\treg = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(0));\n+\t/* CRC == 4 */\n+\treg |= ((max_size + 4) | IXGBE_RXDCTL_RLPML_EN);\n+\tIXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(0), reg);\n+}\n+\n+/**\n * ixgbevf_negotiate_api_version - Negotiate supported API version\n * @hw: pointer to the HW structure\n * @api: integer containing requested API version\n@@ -703,6 +863,22 @@ int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api)\n \treturn err;\n }\n \n+/**\n+ * ixgbevf_hv_negotiate_api_version - Negotiate supported API version\n+ * @hw: pointer to the HW structure\n+ * @api: integer containing requested API version\n+ * Hyper-V version - only ixgbe_mbox_api_10 supported.\n+ **/\n+int ixgbevf_hv_negotiate_api_version(struct ixgbe_hw *hw, int api)\n+{\n+\t/* Hyper-V only supports api version ixgbe_mbox_api_10\n+\t */\n+\tif (api != ixgbe_mbox_api_10)\n+\t\treturn IXGBE_ERR_INVALID_ARGUMENT;\n+\n+\treturn 0;\n+}\n+\n int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,\n \t\t unsigned int *default_tc)\n {\n@@ -776,22 +952,62 @@ static const struct ixgbe_mac_operations ixgbevf_mac_ops = {\n \t.set_vfta\t\t= ixgbevf_set_vfta_vf,\n };\n \n+static const struct ixgbe_mac_operations ixgbevf_hv_mac_ops = {\n+\t.init_hw\t\t= ixgbevf_init_hw_vf,\n+\t.reset_hw\t\t= ixgbevf_hv_reset_hw_vf,\n+\t.start_hw\t\t= ixgbevf_start_hw_vf,\n+\t.get_mac_addr\t\t= ixgbevf_get_mac_addr_vf,\n+\t.stop_adapter\t\t= ixgbevf_stop_hw_vf,\n+\t.setup_link\t\t= ixgbevf_setup_mac_link_vf,\n+\t.check_link\t\t= ixgbevf_hv_check_mac_link_vf,\n+\t.set_rar\t\t= ixgbevf_hv_set_rar_vf,\n+\t.update_mc_addr_list\t= ixgbevf_hv_update_mc_addr_list_vf,\n+\t.update_xcast_mode\t= ixgbevf_hv_update_xcast_mode,\n+\t.set_uc_addr\t\t= ixgbevf_hv_set_uc_addr_vf,\n+\t.set_vfta\t\t= ixgbevf_hv_set_vfta_vf,\n+};\n+\n const struct ixgbevf_info ixgbevf_82599_vf_info = {\n \t.mac = ixgbe_mac_82599_vf,\n \t.mac_ops = &ixgbevf_mac_ops,\n };\n \n+const struct ixgbevf_info ixgbevf_82599_vf_hv_info = {\n+\t.mac = ixgbe_mac_82599_vf,\n+\t.mac_ops = &ixgbevf_hv_mac_ops,\n+};\n+\n const struct ixgbevf_info ixgbevf_X540_vf_info = {\n \t.mac = ixgbe_mac_X540_vf,\n \t.mac_ops = &ixgbevf_mac_ops,\n };\n \n+const struct ixgbevf_info ixgbevf_X540_vf_hv_info = {\n+\t.mac = ixgbe_mac_X540_vf,\n+\t.mac_ops = &ixgbevf_hv_mac_ops,\n+};\n+\n const struct ixgbevf_info ixgbevf_X550_vf_info = {\n \t.mac = ixgbe_mac_X550_vf,\n \t.mac_ops = &ixgbevf_mac_ops,\n };\n \n+const struct ixgbevf_info ixgbevf_X550_vf_hv_info = {\n+\t.mac = ixgbe_mac_X550_vf,\n+\t.mac_ops = &ixgbevf_hv_mac_ops,\n+};\n+\n const struct ixgbevf_info ixgbevf_X550EM_x_vf_info = {\n \t.mac = ixgbe_mac_X550EM_x_vf,\n \t.mac_ops = &ixgbevf_mac_ops,\n };\n+\n+const struct ixgbevf_info ixgbevf_X550EM_x_vf_hv_info = {\n+\t.mac = ixgbe_mac_X550EM_x_vf,\n+\t.mac_ops = &ixgbevf_hv_mac_ops,\n+};\n+\n+bool ixgbevf_on_hyperv(struct ixgbe_hw *hw)\n+{\n+\treturn hw->mbx.ops.check_for_msg == NULL;\n+}\ndiff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h\nindex ef9f773..658883e 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/vf.h\n+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h\n@@ -208,7 +208,9 @@ static inline u32 ixgbe_read_reg_array(struct ixgbe_hw *hw, u32 reg,\n #define IXGBE_READ_REG_ARRAY(h, r, o) ixgbe_read_reg_array(h, r, o)\n \n void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);\n+void ixgbevf_hv_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);\n int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);\n+int ixgbevf_hv_negotiate_api_version(struct ixgbe_hw *hw, int api);\n int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,\n \t\t unsigned int *default_tc);\n int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *reta, int num_rx_queues);\n", "prefixes": [ "net-next", "V5", "2/2" ] }