{"id":2235034,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2235034/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260508124208.11622-12-przemyslaw.kitszel@intel.com/","project":{"id":46,"url":"http://patchwork.ozlabs.org/api/1.2/projects/46/?format=json","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":"<20260508124208.11622-12-przemyslaw.kitszel@intel.com>","list_archive_url":null,"date":"2026-05-08T12:42:04","name":"[iwl-next,v1,11/15] iavf: use new opcodes to request more than 16 queues","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"59fe3afe8917a975748ca1f85670caa6310b9384","submitter":{"id":85252,"url":"http://patchwork.ozlabs.org/api/1.2/people/85252/?format=json","name":"Przemek Kitszel","email":"przemyslaw.kitszel@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260508124208.11622-12-przemyslaw.kitszel@intel.com/mbox/","series":[{"id":503388,"url":"http://patchwork.ozlabs.org/api/1.2/series/503388/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=503388","date":"2026-05-08T12:41:53","name":"devlink, mlx5, iavf, ice: XLVF for iavf","version":1,"mbox":"http://patchwork.ozlabs.org/series/503388/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2235034/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2235034/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@legolas.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=HPUADpwa;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.138; helo=smtp1.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBq3J6dsJz1yKd\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 23:00:12 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id E830782F11;\n\tFri,  8 May 2026 13:00:07 +0000 (UTC)","from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id mDKRBsUFh9MT; Fri,  8 May 2026 13:00:05 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 6F8E682792;\n\tFri,  8 May 2026 13:00:05 +0000 (UTC)","from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by lists1.osuosl.org (Postfix) with ESMTP id 30DE8317\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 13:00:03 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id 22D27410AA\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 13:00:03 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id icnWIK-WzCAX for <intel-wired-lan@lists.osuosl.org>;\n Fri,  8 May 2026 13:00:01 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [198.175.65.17])\n by smtp4.osuosl.org (Postfix) with ESMTPS id 9E0EE40F70\n for <intel-wired-lan@lists.osuosl.org>; Fri,  8 May 2026 13:00:01 +0000 (UTC)","from fmviesa005.fm.intel.com ([10.60.135.145])\n by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 May 2026 06:00:02 -0700","from irvmail002.ir.intel.com ([10.43.11.120])\n by fmviesa005.fm.intel.com with ESMTP; 08 May 2026 05:59:54 -0700","from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17])\n by irvmail002.ir.intel.com (Postfix) with ESMTP id 3B6EB2FC42;\n Fri,  8 May 2026 13:59:52 +0100 (IST)"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6F8E682792","OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9E0EE40F70"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1778245205;\n\tbh=6aio19pTKV7xJ3PU58xFMQ0yxviiqzOcerFJfK0kn7A=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=HPUADpwai5/8Nf79P4rfTlLPID5PnW+NPN6tG0len0Ov2dOJ6YSRSUmSqhPL8ckoK\n\t 1Nkns6WmvblItYF3qQVQ4Ny7+fH6QYv1Tyg1UQQskJY+SvfrnYRwannwftunEERC0s\n\t T+b0e8r/M11SY4fXXA6sT5qmQT5n3qWL0y0Maixpwck5ZsKtAuOJ1xZgqk4Hkg2Fgn\n\t Z3bB66/kaLwbO9hga/iGn7T+HikDmMi49OtHyVzanBowX1Y+ANiedQssJXbt1gp6yR\n\t 1IIcy/UMp2CIwHGkpoAU6dyj19dzTX6LaMDQnKYvYylxqx0gFD+iDNjn+8BcTETHXu\n\t W9Y2fRKF+NzHw==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.17;\n helo=mgamail.intel.com; envelope-from=przemyslaw.kitszel@intel.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp4.osuosl.org 9E0EE40F70","X-CSE-ConnectionGUID":["dBXOBHdQQNqQjP74BK4OVA==","Sn7WXHuYTLulWvaeJXsD9A=="],"X-CSE-MsgGUID":["0Jd/peijR7WXiH5NVKiqDQ==","seXKWwaIR8y59DnpgFRZMA=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11779\"; a=\"79199981\"","E=Sophos;i=\"6.23,223,1770624000\"; d=\"scan'208\";a=\"79199981\"","E=Sophos;i=\"6.23,223,1770624000\"; d=\"scan'208\";a=\"241730165\""],"X-ExtLoop1":"1","From":"Przemek Kitszel <przemyslaw.kitszel@intel.com>","To":"intel-wired-lan@lists.osuosl.org, Michal Schmidt <mschmidt@redhat.com>,\n Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@resnulli.us>","Cc":"netdev@vger.kernel.org, Simon Horman <horms@kernel.org>,\n Tony Nguyen <anthony.l.nguyen@intel.com>,\n Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,\n bruce.richardson@intel.com,\n Vladimir Medvedkin <vladimir.medvedkin@intel.com>,\n padraig.j.connolly@intel.com, ananth.s@intel.com,\n timothy.miskell@intel.com, Jacob Keller <jacob.e.keller@intel.com>,\n Lukasz Czapnik <lukasz.czapnik@intel.com>,\n Aleksandr Loktionov <aleksandr.loktionov@intel.com>,\n Andrew Lunn <andrew+netdev@lunn.ch>,\n \"David S. Miller\" <davem@davemloft.net>,\n Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>,\n Saeed Mahameed <saeedm@nvidia.com>, Leon Romanovsky <leon@kernel.org>,\n Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,\n Przemek Kitszel <przemyslaw.kitszel@intel.com>","Date":"Fri,  8 May 2026 14:42:04 +0200","Message-Id":"<20260508124208.11622-12-przemyslaw.kitszel@intel.com>","X-Mailer":"git-send-email 2.39.3","In-Reply-To":"<20260508124208.11622-1-przemyslaw.kitszel@intel.com>","References":"<20260508124208.11622-1-przemyslaw.kitszel@intel.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1778245202; x=1809781202;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=+6Fm5Nlok4KSB5kW9pnbyQfnuwTbhWexEntyNbjjdK0=;\n b=IgXHXR0A2mIuw0vVVM+dfQ9RNDc9byVwjRoVvYWZs1GtvCHJRGfq3mhp\n CBVnDQc3dwZBlQbU/THWUM6FI7MJDgnXJHkg1PhT7nsvCmsLHgDnNPp1J\n nzcu/rqgLiHBmP01PEUhUPNFpKUruTuSg7QNt9oNS/gvLGxiWbSlN+Qgc\n 1z6Ip8SZBfQukZJkdRxcEjL2okILKuBwWFWWdvY2284kpZtUQWTYA9snE\n t+H3ShzpXlAmx+fEi3/yXVpL8sLZOwdOBflNqgUbPSNQ4xw9cPv6oJPTU\n QuCSDUOh/uuqwF+M9O88xB6oNHg/vkg2Em0tmzmQOWZPPf5YrQPxG9YAg\n A==;","X-Mailman-Original-Authentication-Results":["smtp4.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com","smtp4.osuosl.org;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.a=rsa-sha256 header.s=Intel header.b=IgXHXR0A"],"Subject":"[Intel-wired-lan] [PATCH iwl-next v1 11/15] iavf: use new opcodes\n to request more than 16 queues","X-BeenThere":"intel-wired-lan@osuosl.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>","List-Unsubscribe":"<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <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 <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>","Errors-To":"intel-wired-lan-bounces@osuosl.org","Sender":"\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"},"content":"From: Ahmed Zaki <ahmed.zaki@intel.com>\n\nThe Virtchnl is using a bit wide filed to enable, disable or configure\nthe device queues. Define new OP codes in order to enable the VF to\nrequest a variable number of queues.\n\nFirst the new capability VIRTCHNL_VF_LARGE_NUM_QPAIRS is defined. Only\nif this cap is negotiated, the VF is allowed to use the new OP codes.\n\nThe VIRTCHNL_OP_GET_MAX_RSS_QREGION is exchanged right after the VF\nresource message is received. This is done similar to the PTP and other\nextended cap exchanges.\n\nEnabling and disabling queues, and mapping queues to vectors is done\nthrough the new VIRTCHNL_OP_ENABLE_QUEUES_V2,\nVIRTCHNL_OP_DISABLE_QUEUES_V2, and VIRTCHNL_OP_MAP_QUEUE_VECTOR messages.\n\nUse the new iavf_request_queues() in the iavf_set_channels().\nIt's not only for elegance, but it enables our brittle handcoded state\nmachine to go through requesting the queues before PF driver reallocates\nqueue-related arrays.\n\nSigned-off-by: Ahmed Zaki <ahmed.zaki@intel.com>\nCo-developed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>\nSigned-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>\n---\n drivers/net/ethernet/intel/iavf/iavf.h        |  11 +\n include/linux/intel/virtchnl.h                | 136 +++++++++++-\n .../net/ethernet/intel/iavf/iavf_ethtool.c    |   7 +-\n drivers/net/ethernet/intel/iavf/iavf_main.c   | 123 ++++++++++-\n .../net/ethernet/intel/iavf/iavf_virtchnl.c   | 202 +++++++++++++++++-\n 5 files changed, 460 insertions(+), 19 deletions(-)","diff":"diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h\nindex 569686d34ff4..541d602149d8 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf.h\n+++ b/drivers/net/ethernet/intel/iavf/iavf.h\n@@ -345,6 +345,7 @@ struct iavf_adapter {\n #define IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS\t\tBIT_ULL(42)\n #define IAVF_FLAG_AQ_GET_PTP_CAPS\t\t\tBIT_ULL(43)\n #define IAVF_FLAG_AQ_SEND_PTP_CMD\t\t\tBIT_ULL(44)\n+#define IAVF_FLAG_AQ_GET_MAX_RSS_QREGION\t\tBIT_ULL(45)\n \n \t/* AQ messages that must be sent after IAVF_FLAG_AQ_GET_CONFIG, in\n \t * order to negotiated extended capabilities.\n@@ -368,12 +369,16 @@ struct iavf_adapter {\n #define IAVF_EXTENDED_CAP_RECV_RXDID\t\t\tBIT_ULL(3)\n #define IAVF_EXTENDED_CAP_SEND_PTP\t\t\tBIT_ULL(4)\n #define IAVF_EXTENDED_CAP_RECV_PTP\t\t\tBIT_ULL(5)\n+#define IAVF_EXTENDED_CAP_SEND_RSS_QREGION\t\tBIT_ULL(6)\n+#define IAVF_EXTENDED_CAP_RECV_RSS_QREGION\t\tBIT_ULL(7)\n \n #define IAVF_EXTENDED_CAPS\t\t\t\t\\\n \t(IAVF_EXTENDED_CAP_SEND_VLAN_V2 |\t\t\\\n \t IAVF_EXTENDED_CAP_RECV_VLAN_V2 |\t\t\\\n \t IAVF_EXTENDED_CAP_SEND_RXDID |\t\t\t\\\n \t IAVF_EXTENDED_CAP_RECV_RXDID |\t\t\t\\\n+\t IAVF_EXTENDED_CAP_SEND_RSS_QREGION |\t\t\\\n+\t IAVF_EXTENDED_CAP_RECV_RSS_QREGION |\t\t\\\n \t IAVF_EXTENDED_CAP_SEND_PTP |\t\t\t\\\n \t IAVF_EXTENDED_CAP_RECV_PTP)\n \n@@ -413,6 +418,8 @@ struct iavf_adapter {\n #define RSS_REG(_a) (!((_a)->vf_res->vf_cap_flags & \\\n \t\t       (VIRTCHNL_VF_OFFLOAD_RSS_AQ | \\\n \t\t\tVIRTCHNL_VF_OFFLOAD_RSS_PF)))\n+#define LARGE_NUM_QPAIRS_SUPPORT(_a) \\\n+\t((_a)->vf_res->vf_cap_flags & VIRTCHNL_VF_LARGE_NUM_QPAIRS)\n #define VLAN_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \\\n \t\t\t  VIRTCHNL_VF_OFFLOAD_VLAN)\n #define VLAN_V2_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \\\n@@ -447,6 +454,7 @@ struct iavf_adapter {\n \tstruct virtchnl_vlan_caps vlan_v2_caps;\n \tu64 supp_rxdids;\n \tstruct iavf_ptp ptp;\n+\tstruct virtchnl_max_rss_qregion max_rss_qregion;\n \tu16 msg_enable;\n \tstruct iavf_eth_stats current_stats;\n \tstruct virtchnl_qos_cap_list *qos_caps;\n@@ -583,13 +591,16 @@ int iavf_send_vf_supported_rxdids_msg(struct iavf_adapter *adapter);\n int iavf_get_vf_supported_rxdids(struct iavf_adapter *adapter);\n int iavf_send_vf_ptp_caps_msg(struct iavf_adapter *adapter);\n int iavf_get_vf_ptp_caps(struct iavf_adapter *adapter);\n+int iavf_send_max_rss_qregion(struct iavf_adapter *adapter);\n+int iavf_get_max_rss_qregion(struct iavf_adapter *adapter);\n void iavf_set_queue_vlan_tag_loc(struct iavf_adapter *adapter);\n u16 iavf_get_num_vlans_added(struct iavf_adapter *adapter);\n void iavf_irq_enable(struct iavf_adapter *adapter, bool flush);\n void iavf_configure_queues(struct iavf_adapter *adapter);\n void iavf_enable_queues(struct iavf_adapter *adapter);\n void iavf_disable_queues(struct iavf_adapter *adapter);\n void iavf_map_queues(struct iavf_adapter *adapter);\n+int iavf_request_queues(struct iavf_adapter *adapter, int num);\n int iavf_add_ether_addrs(struct iavf_adapter *adapter);\n void iavf_del_ether_addrs(struct iavf_adapter *adapter);\n void iavf_mac_add_reject(struct iavf_adapter *adapter);\ndiff --git a/include/linux/intel/virtchnl.h b/include/linux/intel/virtchnl.h\nindex 511c8827c640..622e89847b21 100644\n--- a/include/linux/intel/virtchnl.h\n+++ b/include/linux/intel/virtchnl.h\n@@ -1,5 +1,5 @@\n /* SPDX-License-Identifier: GPL-2.0-only */\n-/* Copyright (c) 2013-2022, Intel Corporation. */\n+/* Copyright (c) 2013-2026, Intel Corporation. */\n \n #ifndef _VIRTCHNL_H_\n #define _VIRTCHNL_H_\n@@ -22,8 +22,7 @@\n  * we must send all messages as \"indirect\", i.e. using an external buffer.\n  *\n  * All the VSI indexes are relative to the VF. Each VF can have maximum of\n- * three VSIs. All the queue indexes are relative to the VSI.  Each VF can\n- * have a maximum of sixteen queues for all of its VSIs.\n+ * three VSIs. All the queue indexes are relative to the VSI.\n  *\n  * The PF is required to return a status code in v_retval for all messages\n  * except RESET_VF, which does not require any response. The returned value\n@@ -147,6 +146,7 @@ enum virtchnl_ops {\n \tVIRTCHNL_OP_DEL_RSS_CFG = 46,\n \tVIRTCHNL_OP_ADD_FDIR_FILTER = 47,\n \tVIRTCHNL_OP_DEL_FDIR_FILTER = 48,\n+\tVIRTCHNL_OP_GET_MAX_RSS_QREGION = 50,\n \tVIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS = 51,\n \tVIRTCHNL_OP_ADD_VLAN_V2 = 52,\n \tVIRTCHNL_OP_DEL_VLAN_V2 = 53,\n@@ -159,7 +159,11 @@ enum virtchnl_ops {\n \tVIRTCHNL_OP_1588_PTP_GET_TIME = 61,\n \t/* opcode 62 - 65 are reserved */\n \tVIRTCHNL_OP_GET_QOS_CAPS = 66,\n-\t/* opcode 68 through 111 are reserved */\n+\t/* opcodes 67 through 106 are reserved */\n+\tVIRTCHNL_OP_ENABLE_QUEUES_V2 = 107,\n+\tVIRTCHNL_OP_DISABLE_QUEUES_V2 = 108,\n+\t/* opcodes 109 and 110 are reserved */\n+\tVIRTCHNL_OP_MAP_QUEUE_VECTOR = 111,\n \tVIRTCHNL_OP_CONFIG_QUEUE_BW = 112,\n \tVIRTCHNL_OP_CONFIG_QUANTA = 113,\n \tVIRTCHNL_OP_MAX,\n@@ -257,6 +261,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);\n #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES\t\tBIT(6)\n /* used to negotiate communicating link speeds in Mbps */\n #define VIRTCHNL_VF_CAP_ADV_LINK_SPEED\t\tBIT(7)\n+#define VIRTCHNL_VF_LARGE_NUM_QPAIRS\t\tBIT(9)\n #define  VIRTCHNL_VF_OFFLOAD_CRC\t\tBIT(10)\n #define VIRTCHNL_VF_OFFLOAD_TC_U32\t\tBIT(11)\n #define VIRTCHNL_VF_OFFLOAD_VLAN_V2\t\tBIT(15)\n@@ -500,6 +505,34 @@ struct virtchnl_queue_select {\n \n VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_select);\n \n+/* VIRTCHNL_OP_GET_MAX_RSS_QREGION\n+ *\n+ * if VIRTCHNL_VF_LARGE_NUM_QPAIRS was negotiated in\n+ * VIRTCHNL_OP_GET_VF_RESOURCES then this op must be supported.\n+ *\n+ * VF sends this message in order to query the max RSS queue region\n+ * size supported by PF, when VIRTCHNL_VF_LARGE_NUM_QPAIRS is enabled.\n+ * This information should be used when configuring the RSS LUT and/or\n+ * configuring queue region based filters.\n+ *\n+ * The maximum RSS queue region is 2^qregion_width. So, a qregion_width of 6\n+ * would inform the VF that the PF supports a maximum RSS queue region of 64.\n+ *\n+ * A queue region represents a range of queues that can be used to configure\n+ * a RSS LUT. For example, if a VF is given 64 queues, but only a max queue\n+ * region size of 16 (i.e. 2^qregion_width = 16) then it will only be able\n+ * to configure the RSS LUT with queue indices from 0 to 15. However, other\n+ * filters can be used to direct packets to queues >15 via specifying a queue\n+ * base/offset and queue region width.\n+ */\n+struct virtchnl_max_rss_qregion {\n+\tu16 vport_id;\n+\tu16 qregion_width;\n+\tu8 pad[4];\n+};\n+\n+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_max_rss_qregion);\n+\n /* VIRTCHNL_OP_ADD_ETH_ADDR\n  * VF sends this message in order to add one or more unicast or multicast\n  * address filters for the specified VSI.\n@@ -1664,6 +1697,70 @@ struct virtchnl_queue_chunk {\n \n VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_queue_chunk);\n \n+/* VIRTCHNL_OP_ENABLE_QUEUES_V2\n+ * VIRTCHNL_OP_DISABLE_QUEUES_V2\n+ *\n+ * These opcodes can be used if VIRTCHNL_VF_LARGE_NUM_QPAIRS was negotiated in\n+ * VIRTCHNL_OP_GET_VF_RESOURCES\n+ *\n+ * VF sends virtchnl_ena_dis_queues struct to specify the queues to be\n+ * enabled/disabled in chunks. Also applicable to single queue RX or\n+ * TX. PF performs requested action and returns status.\n+ */\n+struct virtchnl_del_ena_dis_queues {\n+\tu16 vport_id;\n+\tu16 pad;\n+\tu16 num_chunks;\n+\tu16 rsvd;\n+\tstruct virtchnl_queue_chunk chunks[];\n+};\n+\n+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_del_ena_dis_queues);\n+#define virtchnl_del_ena_dis_queues_LEGACY_SIZEOF\t16\n+\n+/* Virtchannel interrupt throttling rate index */\n+enum virtchnl_itr_idx {\n+\tVIRTCHNL_ITR_IDX_0\t= 0,\n+\tVIRTCHNL_ITR_IDX_1\t= 1,\n+\tVIRTCHNL_ITR_IDX_NO_ITR\t= 3,\n+};\n+\n+/* Queue to vector mapping */\n+struct virtchnl_queue_vector {\n+\tu16 queue_id;\n+\tu16 vector_id;\n+\tu8 pad[4];\n+\n+\t/* see enum virtchnl_itr_idx */\n+\ts32 itr_idx;\n+\n+\t/* see enum virtchnl_queue_type */\n+\ts32 queue_type;\n+};\n+\n+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_queue_vector);\n+\n+/* VIRTCHNL_OP_MAP_QUEUE_VECTOR\n+ *\n+ * This opcode can be used only if VIRTCHNL_VF_LARGE_NUM_QPAIRS was negotiated\n+ * in VIRTCHNL_OP_GET_VF_RESOURCES\n+ *\n+ * VF sends this message to map queues to vectors and ITR index registers.\n+ * External data buffer contains virtchnl_queue_vector_maps structure\n+ * that contains num_qv_maps of virtchnl_queue_vector structures.\n+ * PF maps the requested queue vector maps after validating the queue and vector\n+ * ids and returns a status code.\n+ */\n+struct virtchnl_queue_vector_maps {\n+\tu16 vport_id;\n+\tu16 num_qv_maps;\n+\tu8 pad[4];\n+\tstruct virtchnl_queue_vector qv_maps[];\n+};\n+\n+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_queue_vector_maps);\n+#define virtchnl_queue_vector_maps_LEGACY_SIZEOF\t24\n+\n struct virtchnl_quanta_cfg {\n \tu16 quanta_size;\n \tu16 pad;\n@@ -1696,6 +1793,8 @@ VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_quanta_cfg);\n \t\t __vss(virtchnl_rdma_qvlist_info, __vss_byelem, p, m, c),     \\\n \t\t __vss(virtchnl_qos_cap_list, __vss_byelem, p, m, c),\t      \\\n \t\t __vss(virtchnl_queues_bw_cfg, __vss_byelem, p, m, c),\t      \\\n+\t\t __vss(virtchnl_del_ena_dis_queues, __vss_byelem, p, m, c),   \\\n+\t\t __vss(virtchnl_queue_vector_maps, __vss_byelem, p, m, c),    \\\n \t\t __vss(virtchnl_rss_key, __vss_byone, p, m, c),\t\t      \\\n \t\t __vss(virtchnl_rss_lut, __vss_byone, p, m, c))\n \n@@ -1758,6 +1857,8 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \tcase VIRTCHNL_OP_DISABLE_QUEUES:\n \t\tvalid_len = sizeof(struct virtchnl_queue_select);\n \t\tbreak;\n+\tcase VIRTCHNL_OP_GET_MAX_RSS_QREGION:\n+\t\tbreak;\n \tcase VIRTCHNL_OP_ADD_ETH_ADDR:\n \tcase VIRTCHNL_OP_DEL_ETH_ADDR:\n \t\tvalid_len = virtchnl_ether_addr_list_LEGACY_SIZEOF;\n@@ -1930,7 +2031,32 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \tcase VIRTCHNL_OP_1588_PTP_GET_TIME:\n \t\tvalid_len = sizeof(struct virtchnl_phc_time);\n \t\tbreak;\n-\t/* These are always errors coming from the VF. */\n+\tcase VIRTCHNL_OP_ENABLE_QUEUES_V2:\n+\tcase VIRTCHNL_OP_DISABLE_QUEUES_V2:\n+\t\tvalid_len = sizeof(struct virtchnl_del_ena_dis_queues);\n+\t\tif (msglen >= valid_len) {\n+\t\t\tstruct virtchnl_del_ena_dis_queues *qs =\n+\t\t\t\t(struct virtchnl_del_ena_dis_queues *)msg;\n+\n+\t\t\tif (!qs->num_chunks) {\n+\t\t\t\terr_msg_format = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tvalid_len = virtchnl_struct_size(qs, chunks,\n+\t\t\t\t\t\t\t qs->num_chunks);\n+\t\t}\n+\t\tbreak;\n+\tcase VIRTCHNL_OP_MAP_QUEUE_VECTOR:\n+\t\tvalid_len = virtchnl_queue_vector_maps_LEGACY_SIZEOF;\n+\t\tif (msglen >= valid_len) {\n+\t\t\tstruct virtchnl_queue_vector_maps *v_qp = (void *)msg;\n+\n+\t\t\terr_msg_format = !v_qp->num_qv_maps;\n+\t\t\tvalid_len = virtchnl_struct_size(v_qp, qv_maps,\n+\t\t\t\t\t\t\t v_qp->num_qv_maps);\n+\t\t}\n+\t\tbreak;\n+\t/* These are always errors when coming from the VF. */\n \tcase VIRTCHNL_OP_EVENT:\n \tcase VIRTCHNL_OP_UNKNOWN:\n \tdefault:\ndiff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c\nindex dc2503e3c5ba..ff59d2dd5448 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c\n+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c\n@@ -1744,12 +1744,9 @@ static int iavf_set_channels(struct net_device *netdev,\n \tif (ch->rx_count || ch->tx_count || ch->other_count != NONQ_VECS)\n \t\treturn -EINVAL;\n \n-\tadapter->num_req_queues = num_req;\n-\tadapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;\n-\tadapter->flags |= IAVF_FLAG_RESET_NEEDED;\n-\tiavf_reset_step(adapter);\n \n-\treturn 0;\n+\tadapter->current_op = VIRTCHNL_OP_UNKNOWN;\n+\treturn iavf_request_queues(adapter, num_req);\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c\nindex abc0fe070ee7..b7b4b857f384 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf_main.c\n+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c\n@@ -1758,10 +1758,14 @@ int iavf_config_rss(struct iavf_adapter *adapter)\n  **/\n static void iavf_fill_rss_lut(struct iavf_adapter *adapter)\n {\n-\tu16 i;\n+\tstruct virtchnl_max_rss_qregion *qregion = &adapter->max_rss_qregion;\n+\tint max = adapter->num_active_queues;\n+\n+\tif (LARGE_NUM_QPAIRS_SUPPORT(adapter) && qregion->qregion_width)\n+\t\tmax = min(max, (int)BIT(qregion->qregion_width));\n \n-\tfor (i = 0; i < adapter->rss_lut_size; i++)\n-\t\tadapter->rss_lut[i] = i % adapter->num_active_queues;\n+\tfor (int i = 0; i < adapter->rss_lut_size; i++)\n+\t\tadapter->rss_lut[i] = i % max;\n }\n \n /**\n@@ -2246,6 +2250,10 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)\n \t\tiavf_virtchnl_send_ptp_cmd(adapter);\n \t\treturn IAVF_SUCCESS;\n \t}\n+\tif (adapter->aq_required & IAVF_FLAG_AQ_GET_MAX_RSS_QREGION) {\n+\t\tiavf_get_max_rss_qregion(adapter);\n+\t\treturn 0;\n+\t}\n \tif (adapter->aq_required & IAVF_FLAG_AQ_REQUEST_STATS) {\n \t\tiavf_request_stats(adapter);\n \t\treturn 0;\n@@ -2441,8 +2449,9 @@ static void iavf_init_version_check(struct iavf_adapter *adapter)\n  */\n int iavf_parse_vf_resource_msg(struct iavf_adapter *adapter)\n {\n-\tint i, num_req_queues = adapter->num_req_queues;\n+\tint i, qnum, num_req_queues = adapter->num_req_queues;\n \tstruct iavf_vsi *vsi = &adapter->vsi;\n+\tbool reconfig_rss = false;\n \n \tfor (i = 0; i < adapter->vf_res->num_vsis; i++) {\n \t\tif (adapter->vf_res->vsi_res[i].vsi_type == VIRTCHNL_VSI_SRIOV)\n@@ -2469,21 +2478,58 @@ int iavf_parse_vf_resource_msg(struct iavf_adapter *adapter)\n \n \t\treturn -EAGAIN;\n \t}\n+\tif (!num_req_queues) {\n+\t\tadapter->current_op = VIRTCHNL_OP_UNKNOWN;\n+\t\tqnum = min(adapter->vsi_res->num_queue_pairs,\n+\t\t\t   num_online_cpus());\n+\n+\t\treturn iavf_request_queues(adapter, qnum);\n+\t}\n \tadapter->num_req_queues = 0;\n \tadapter->vsi.id = adapter->vsi_res->vsi_id;\n \n \tadapter->vsi.back = adapter;\n \tadapter->vsi.base_vector = 1;\n \tvsi->netdev = adapter->netdev;\n \tvsi->qs_handle = adapter->vsi_res->qset_handle;\n \tif (adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {\n+\t\tif ((adapter->rss_key &&\n+\t\t     adapter->rss_key_size != adapter->vf_res->rss_key_size) ||\n+\t\t    (adapter->rss_lut &&\n+\t\t     adapter->rss_lut_size != adapter->vf_res->rss_lut_size)) {\n+\t\t\treconfig_rss = true;\n+\t\t}\n \t\tadapter->rss_key_size = adapter->vf_res->rss_key_size;\n \t\tadapter->rss_lut_size = adapter->vf_res->rss_lut_size;\n \t} else {\n \t\tadapter->rss_key_size = IAVF_HKEY_ARRAY_SIZE;\n \t\tadapter->rss_lut_size = IAVF_HLUT_ARRAY_SIZE;\n \t}\n \n+\tif (reconfig_rss) {\n+\t\tu8 *rss_key, *rss_lut;\n+\n+\t\trss_key = krealloc(adapter->rss_key, adapter->rss_key_size,\n+\t\t\t\t   GFP_KERNEL);\n+\t\tif (rss_key)\n+\t\t\tadapter->rss_key = rss_key;\n+\t\trss_lut = krealloc(adapter->rss_lut, adapter->rss_lut_size,\n+\t\t\t\t   GFP_KERNEL);\n+\t\tif (rss_lut)\n+\t\t\tadapter->rss_lut = rss_lut;\n+\t\tif (!rss_lut || !rss_key)\n+\t\t\treturn -ENOMEM;\n+\n+\t\tiavf_init_rss(adapter);\n+\t}\n+\n+\tqnum = min_t(int, IAVF_MAX_REQ_QUEUES, (int)(num_online_cpus()));\n+\tif (LARGE_NUM_QPAIRS_SUPPORT(adapter) &&\n+\t    adapter->vsi_res->num_queue_pairs < qnum) {\n+\t\tadapter->current_op = VIRTCHNL_OP_UNKNOWN;\n+\t\treturn iavf_request_queues(adapter, qnum);\n+\t}\n+\n \treturn 0;\n }\n \n@@ -2609,6 +2655,65 @@ static void iavf_init_recv_offload_vlan_v2_caps(struct iavf_adapter *adapter)\n \tiavf_change_state(adapter, __IAVF_INIT_FAILED);\n }\n \n+/*\n+ * iavf_init_send_max_rss_qregion - part of querying for RSS max queue region\n+ * @adapter: board private structure\n+ *\n+ * Function processes send of the VIRTCHNL_OP_GET_MAX_RSS_QREGION to the PF.\n+ * Must clear IAVF_EXTENDED_CAP_RECV_RSS_QREGION if the message is not sent, e.g.\n+ * due to the PF not negotiating VIRTCHNL_VF_LARGE_NUM_QPAIRS.\n+ */\n+static void iavf_init_send_max_rss_qregion(struct iavf_adapter *adapter)\n+{\n+\tint ret;\n+\n+\tWARN_ON(!(adapter->extended_caps & IAVF_EXTENDED_CAP_SEND_RSS_QREGION));\n+\n+\tret = iavf_send_max_rss_qregion(adapter);\n+\tif (ret == -EOPNOTSUPP) {\n+\t\t/* PF does not support VIRTCHNL_VF_LARGE_NUM_QPAIRS. In this\n+\t\t * case, we did not send the capability exchange message and do\n+\t\t * not expect a response.\n+\t\t */\n+\t\tadapter->extended_caps &= ~IAVF_EXTENDED_CAP_RECV_RSS_QREGION;\n+\t}\n+\n+\t/* We sent the message, so move on to the next step */\n+\tadapter->extended_caps &= ~IAVF_EXTENDED_CAP_SEND_RSS_QREGION;\n+}\n+\n+/**\n+ * iavf_init_recv_max_rss_qregion - part of querying for RSS max queue region\n+ * @adapter: board private structure\n+ *\n+ * Function processes receipt of the RSS max qregion to be used for the LUT.\n+ */\n+static void iavf_init_recv_max_rss_qregion(struct iavf_adapter *adapter)\n+{\n+\tint ret;\n+\n+\tWARN_ON(!(adapter->extended_caps & IAVF_EXTENDED_CAP_RECV_RSS_QREGION));\n+\n+\tmemset(&adapter->max_rss_qregion, 0, sizeof(adapter->max_rss_qregion));\n+\n+\tret = iavf_get_max_rss_qregion(adapter);\n+\tif (ret)\n+\t\tgoto err;\n+\n+\t/* We've processed the PF response to the VIRTCHNL_OP_GET_MAX_RSS_QREGION\n+\t * message we sent previously.\n+\t */\n+\tadapter->extended_caps &= ~IAVF_EXTENDED_CAP_RECV_RSS_QREGION;\n+\treturn;\n+\n+err:\n+\t/* We didn't receive a reply. Make sure we try sending again when\n+\t * __IAVF_INIT_FAILED attempts to recover.\n+\t */\n+\tadapter->extended_caps |= IAVF_EXTENDED_CAP_RECV_RSS_QREGION;\n+\tiavf_change_state(adapter, __IAVF_INIT_FAILED);\n+}\n+\n /**\n  * iavf_init_send_supported_rxdids - part of querying for supported RXDID\n  * formats\n@@ -2757,6 +2862,16 @@ static void iavf_init_process_extended_caps(struct iavf_adapter *adapter)\n \t\treturn;\n \t}\n \n+\t/* Process capability exchange for RSS max qregion */\n+\tif (adapter->extended_caps & IAVF_EXTENDED_CAP_SEND_RSS_QREGION) {\n+\t\tiavf_init_send_max_rss_qregion(adapter);\n+\t\treturn;\n+\t}\n+\tif (adapter->extended_caps & IAVF_EXTENDED_CAP_RECV_RSS_QREGION) {\n+\t\tiavf_init_recv_max_rss_qregion(adapter);\n+\t\treturn;\n+\t}\n+\n \t/* When we reach here, no further extended capabilities exchanges are\n \t * necessary, so we finally transition into __IAVF_INIT_CONFIG_ADAPTER\n \t */\ndiff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c\nindex 9102bc4bddb0..ab1019a91ff7 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c\n+++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c\n@@ -170,6 +170,7 @@ int iavf_send_vf_config_msg(struct iavf_adapter *adapter)\n \t       VIRTCHNL_VF_OFFLOAD_VLAN_V2 |\n \t       VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC |\n \t       VIRTCHNL_VF_OFFLOAD_CRC |\n+\t       VIRTCHNL_VF_LARGE_NUM_QPAIRS |\n \t       VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM |\n \t       VIRTCHNL_VF_OFFLOAD_REQ_QUEUES |\n \t       VIRTCHNL_VF_CAP_PTP |\n@@ -251,28 +252,44 @@ int iavf_send_vf_ptp_caps_msg(struct iavf_adapter *adapter)\n \t\t\t\t(u8 *)&hw_caps, sizeof(hw_caps));\n }\n \n+int iavf_send_max_rss_qregion(struct iavf_adapter *adapter)\n+{\n+\tadapter->aq_required &= ~IAVF_FLAG_AQ_GET_MAX_RSS_QREGION;\n+\n+\tif (!LARGE_NUM_QPAIRS_SUPPORT(adapter))\n+\t\treturn -EOPNOTSUPP;\n+\n+\tiavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_MAX_RSS_QREGION, NULL, 0);\n+\treturn 0;\n+}\n+\n /**\n  * iavf_validate_num_queues\n  * @adapter: adapter structure\n  *\n  * Validate that the number of queues the PF has sent in\n  * VIRTCHNL_OP_GET_VF_RESOURCES is not larger than the VF can handle.\n  **/\n static void iavf_validate_num_queues(struct iavf_adapter *adapter)\n {\n-\tif (adapter->vf_res->num_queue_pairs > IAVF_MAX_REQ_QUEUES) {\n+\tu32 max_req_queues = IAVF_MAX_REQ_QUEUES;\n+\n+\tif (!LARGE_NUM_QPAIRS_SUPPORT(adapter))\n+\t\tmax_req_queues = IAVF_MAX_VSI_QP;\n+\n+\tif (adapter->vf_res->num_queue_pairs > max_req_queues) {\n \t\tstruct virtchnl_vsi_resource *vsi_res;\n \t\tint i;\n \n \t\tdev_info(&adapter->pdev->dev, \"Received %d queues, but can only have a max of %d\\n\",\n \t\t\t adapter->vf_res->num_queue_pairs,\n-\t\t\t IAVF_MAX_REQ_QUEUES);\n+\t\t\t max_req_queues);\n \t\tdev_info(&adapter->pdev->dev, \"Fixing by reducing queues to %d\\n\",\n-\t\t\t IAVF_MAX_REQ_QUEUES);\n-\t\tadapter->vf_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES;\n+\t\t\t max_req_queues);\n+\t\tadapter->vf_res->num_queue_pairs = max_req_queues;\n \t\tfor (i = 0; i < adapter->vf_res->num_vsis; i++) {\n \t\t\tvsi_res = &adapter->vf_res->vsi_res[i];\n-\t\t\tvsi_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES;\n+\t\t\tvsi_res->num_queue_pairs = max_req_queues;\n \t\t}\n \t}\n }\n@@ -371,6 +388,30 @@ int iavf_get_vf_ptp_caps(struct iavf_adapter *adapter)\n \treturn err;\n }\n \n+int iavf_get_max_rss_qregion(struct iavf_adapter *adapter)\n+{\n+\tstruct iavf_arq_event_info event;\n+\tint err;\n+\tu16 len;\n+\n+\tlen = sizeof(struct virtchnl_max_rss_qregion);\n+\tevent.buf_len = len;\n+\tevent.msg_buf = kzalloc(len, GFP_KERNEL);\n+\tif (!event.msg_buf)\n+\t\treturn -ENOMEM;\n+\n+\terr = iavf_poll_virtchnl_msg(&adapter->hw, &event,\n+\t\t\t\t     VIRTCHNL_OP_GET_MAX_RSS_QREGION);\n+\tif (!err)\n+\t\tmemcpy(&adapter->max_rss_qregion, event.msg_buf,\n+\t\t       min(event.msg_len, len));\n+\n+\tadapter->current_op = VIRTCHNL_OP_UNKNOWN;\n+\n+\tkfree(event.msg_buf);\n+\treturn err;\n+}\n+\n static bool iavf_match_vc_op_cb(struct iavf_adapter *adapter, const void *data,\n \t\t\t\tenum virtchnl_ops recv_op)\n {\n@@ -466,6 +507,50 @@ void iavf_configure_queues(struct iavf_adapter *adapter)\n \tkfree(vqci);\n }\n \n+/**\n+ * iavf_enable_disable_queues_v2 - send V2 messages of ENABLE/DISABLE queues ops\n+ * @adapter: private adapter structure\n+ * @enable: true to enable and false to disable the queues\n+ */\n+static void iavf_enable_disable_queues_v2(struct iavf_adapter *adapter, bool enable)\n+{\n+\tenum virtchnl_ops op = VIRTCHNL_OP_ENABLE_QUEUES_V2;\n+\tstruct virtchnl_del_ena_dis_queues *msg;\n+\tu64 flag = IAVF_FLAG_AQ_ENABLE_QUEUES;\n+\tstruct virtchnl_queue_chunk *chunk;\n+\tint len;\n+\n+\tif (!enable) {\n+\t\top = VIRTCHNL_OP_DISABLE_QUEUES_V2;\n+\t\tflag = IAVF_FLAG_AQ_DISABLE_QUEUES;\n+\t}\n+\n+\tadapter->current_op = op;\n+\n+\t/* We need 2 chunks (one Tx and one Rx). */\n+\tlen = virtchnl_struct_size(msg, chunks, 2);\n+\tmsg = kzalloc(len, GFP_KERNEL);\n+\tif (!msg)\n+\t\treturn;\n+\n+\tmsg->vport_id = adapter->vsi_res->vsi_id;\n+\tmsg->num_chunks = 2;\n+\n+\tchunk = &msg->chunks[0];\n+\tchunk->type = VIRTCHNL_QUEUE_TYPE_RX;\n+\tchunk->start_queue_id = 0;\n+\tchunk->num_queues = adapter->num_active_queues;\n+\n+\tchunk++;\n+\tchunk->type = VIRTCHNL_QUEUE_TYPE_TX;\n+\tchunk->start_queue_id = 0;\n+\tchunk->num_queues = adapter->num_active_queues;\n+\n+\tadapter->aq_required &= ~flag;\n+\tiavf_send_pf_msg(adapter, op, (u8 *)msg, len);\n+\tkfree(msg);\n+}\n+\n /**\n  * iavf_enable_queues\n  * @adapter: adapter structure\n@@ -482,6 +567,12 @@ void iavf_enable_queues(struct iavf_adapter *adapter)\n \t\t\tadapter->current_op);\n \t\treturn;\n \t}\n+\n+\tif (adapter->num_active_queues > IAVF_MAX_VSI_QP) {\n+\t\tiavf_enable_disable_queues_v2(adapter, true);\n+\t\treturn;\n+\t}\n+\n \tadapter->current_op = VIRTCHNL_OP_ENABLE_QUEUES;\n \tvqs.vsi_id = adapter->vsi_res->vsi_id;\n \tvqs.tx_queues = BIT(adapter->num_active_queues) - 1;\n@@ -507,15 +598,81 @@ void iavf_disable_queues(struct iavf_adapter *adapter)\n \t\t\tadapter->current_op);\n \t\treturn;\n \t}\n+\n+\tif (LARGE_NUM_QPAIRS_SUPPORT(adapter)) {\n+\t\tiavf_enable_disable_queues_v2(adapter, false);\n+\t\treturn;\n+\t}\n+\n \tadapter->current_op = VIRTCHNL_OP_DISABLE_QUEUES;\n \tvqs.vsi_id = adapter->vsi_res->vsi_id;\n \tvqs.tx_queues = BIT(adapter->num_active_queues) - 1;\n \tvqs.rx_queues = vqs.tx_queues;\n \tadapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_QUEUES;\n \tiavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_QUEUES,\n \t\t\t (u8 *)&vqs, sizeof(vqs));\n }\n \n+static void iavf_map_queue_vector(struct iavf_adapter *adapter)\n+{\n+\tstruct virtchnl_queue_vector_maps *qvmaps;\n+\tint qnum = adapter->num_active_queues;\n+\tstruct virtchnl_queue_vector *qv;\n+\tint len, max_pairs;\n+\t\n+\tmax_pairs = iavf_max_vc_entries(qvmaps, qv_maps) / 2;\n+\tlen = virtchnl_struct_size(qvmaps, qv_maps, 2 * min(qnum, max_pairs));\n+\tqvmaps = kzalloc(len, GFP_KERNEL);\n+\tif (!qvmaps)\n+\t\treturn;\n+\n+\tqvmaps->vport_id = adapter->vsi_res->vsi_id;\n+\tqv = qvmaps->qv_maps;\n+\tfor (int qid = 0, in_msg = 0; qid < qnum; qid++) {\n+\t\tconst bool last = qid + 1 == qnum;\n+\t\tstruct iavf_q_vector *q_vector;\n+\n+\t\tq_vector = adapter->tx_rings[qid].q_vector;\n+\t\tqv->queue_id = qid;\n+\t\tqv->vector_id = NONQ_VECS + q_vector->v_idx;\n+\t\tqv->itr_idx = IAVF_TX_ITR;\n+\t\tqv->queue_type = VIRTCHNL_QUEUE_TYPE_TX;\n+\t\tqv++;\n+\n+\t\tq_vector = adapter->rx_rings[qid].q_vector;\n+\t\tqv->queue_id = qid;\n+\t\tqv->vector_id = NONQ_VECS + q_vector->v_idx;\n+\t\tqv->itr_idx = IAVF_RX_ITR;\n+\t\tqv->queue_type = VIRTCHNL_QUEUE_TYPE_RX;\n+\t\tqv++;\n+\n+\t\tin_msg++;\n+\t\tif (last || in_msg == max_pairs) {\n+\t\t\tint err;\n+\n+\t\t\tqvmaps->num_qv_maps = 2 * in_msg;\n+\t\t\tadapter->current_op = VIRTCHNL_OP_MAP_QUEUE_VECTOR;\n+\t\t\tiavf_send_pf_msg(adapter, VIRTCHNL_OP_MAP_QUEUE_VECTOR,\n+\t\t\t\t\t (u8 *)qvmaps,\n+\t\t\t\t\t virtchnl_struct_size(qvmaps, qv_maps,\n+\t\t\t\t\t \t\t      2 * in_msg));\n+\t\t\terr = iavf_poll_virtchnl_response(adapter,\n+\t\t\t\t\t\t\t  iavf_match_vc_op_cb,\n+\t\t\t\t\t\t\t  (void *)VIRTCHNL_OP_MAP_QUEUE_VECTOR,\n+\t\t\t\t\t\t\t  1000);\n+\t\t\tif (err)\n+\t\t\t\tdev_warn(&adapter->pdev->dev,\n+\t\t\t\t\t \"polling response of mapping queue vectors failed, err: %d\\n\",\n+\t\t\t\t\t err);\n+\n+\t\t\tin_msg = 0;\n+\t\t\tqv = qvmaps->qv_maps;\n+\t\t}\n+\t}\n+\tadapter->aq_required &= ~IAVF_FLAG_AQ_MAP_VECTORS;\n+\tkfree(qvmaps);\n+}\n+\n /**\n  * iavf_map_queues\n  * @adapter: adapter structure\n@@ -537,6 +694,12 @@ void iavf_map_queues(struct iavf_adapter *adapter)\n \t\t\tadapter->current_op);\n \t\treturn;\n \t}\n+\n+\tif (LARGE_NUM_QPAIRS_SUPPORT(adapter)) {\n+\t\tiavf_map_queue_vector(adapter);\n+\t\treturn;\n+\t}\n+\n \tadapter->current_op = VIRTCHNL_OP_CONFIG_IRQ_MAP;\n \n \tq_vectors = adapter->num_msix_vectors - NONQ_VECS;\n@@ -573,6 +736,32 @@ void iavf_map_queues(struct iavf_adapter *adapter)\n \tkfree(vimi);\n }\n \n+/**\n+ * iavf_request_queues - request queues via virtchnl\n+ * @adapter: adapter structure\n+ * @num: number of requested queues\n+ *\n+ * Return: 0 on success, negative on failure.\n+ */\n+int iavf_request_queues(struct iavf_adapter *adapter, int num)\n+{\n+\tstruct virtchnl_vf_res_request vfres = { num };\n+\n+\tif (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {\n+\t\t/* bail because we already have a command pending */\n+\t\tdev_err(&adapter->pdev->dev, \"Cannot request queues, command %d pending\\n\",\n+\t\t\tadapter->current_op);\n+\t\treturn -EBUSY;\n+\t}\n+\n+\tadapter->current_op = VIRTCHNL_OP_REQUEST_QUEUES;\n+\tadapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;\n+\tadapter->num_req_queues = num;\n+\n+\treturn iavf_send_pf_msg(adapter, VIRTCHNL_OP_REQUEST_QUEUES,\n+\t\t\t\t(u8 *)&vfres, sizeof(vfres));\n+}\n+\n /**\n  * iavf_set_mac_addr_type - Set the correct request type from the filter type\n  * @virtchnl_ether_addr: pointer to requested list element\n@@ -2749,20 +2938,23 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,\n \t\tiavf_virtchnl_ptp_get_time(adapter, msg, msglen);\n \t\tbreak;\n \tcase VIRTCHNL_OP_ENABLE_QUEUES:\n+\tcase VIRTCHNL_OP_ENABLE_QUEUES_V2:\n \t\t/* enable transmits */\n \t\tiavf_irq_enable(adapter, true);\n \t\tadapter->flags &= ~IAVF_FLAG_QUEUES_DISABLED;\n \t\tbreak;\n \tcase VIRTCHNL_OP_DISABLE_QUEUES:\n+\tcase VIRTCHNL_OP_DISABLE_QUEUES_V2:\n \t\tiavf_free_all_tx_resources(adapter);\n \t\tiavf_free_all_rx_resources(adapter);\n \t\tif (adapter->state == __IAVF_DOWN_PENDING) {\n \t\t\tiavf_change_state(adapter, __IAVF_DOWN);\n \t\t\twake_up(&adapter->down_waitqueue);\n \t\t}\n \t\tbreak;\n \tcase VIRTCHNL_OP_VERSION:\n \tcase VIRTCHNL_OP_CONFIG_IRQ_MAP:\n+\tcase VIRTCHNL_OP_MAP_QUEUE_VECTOR:\n \t\t/* Don't display an error if we get these out of sequence.\n \t\t * If the firmware needed to get kicked, we'll get these and\n \t\t * it's no problem.\n","prefixes":["iwl-next","v1","11/15"]}