Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229672/?format=api
{ "id": 2229672, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229672/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260428143716.9653-4-marcin.szycik@linux.intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/1.1/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": "" }, "msgid": "<20260428143716.9653-4-marcin.szycik@linux.intel.com>", "date": "2026-04-28T14:37:16", "name": "[iwl-next,3/3] virtchnl, iavf, ice, i40e: add extended generic VF capability flags", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "bc499f7b6a24b29165685eeea4a4602a957ec465", "submitter": { "id": 82782, "url": "http://patchwork.ozlabs.org/api/1.1/people/82782/?format=api", "name": "Marcin Szycik", "email": "marcin.szycik@linux.intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260428143716.9653-4-marcin.szycik@linux.intel.com/mbox/", "series": [ { "id": 501879, "url": "http://patchwork.ozlabs.org/api/1.1/series/501879/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=501879", "date": "2026-04-28T14:37:14", "name": "virtchnl: add extended VF capability flags", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501879/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229672/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229672/checks/", "tags": {}, "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=sfY4V2Z5;\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 4g4l1q6m0Xz1xrS\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 01:37:51 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 4761883BC0;\n\tTue, 28 Apr 2026 15:37:49 +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 gKQyoxQWpR0a; Tue, 28 Apr 2026 15:37:47 +0000 (UTC)", "from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 8B1778382F;\n\tTue, 28 Apr 2026 15:37:47 +0000 (UTC)", "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n by lists1.osuosl.org (Postfix) with ESMTP id D7F121B8\n for <intel-wired-lan@lists.osuosl.org>; Tue, 28 Apr 2026 15:37:46 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id C53598382D\n for <intel-wired-lan@lists.osuosl.org>; Tue, 28 Apr 2026 15:37:46 +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 0dG1Vofmsj7y for <intel-wired-lan@lists.osuosl.org>;\n Tue, 28 Apr 2026 15:37:45 +0000 (UTC)", "from mgamail.intel.com (mgamail.intel.com [192.198.163.15])\n by smtp1.osuosl.org (Postfix) with ESMTPS id 3BBC08236B\n for <intel-wired-lan@lists.osuosl.org>; Tue, 28 Apr 2026 15:37:45 +0000 (UTC)", "from fmviesa003.fm.intel.com ([10.60.135.143])\n by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Apr 2026 08:37:45 -0700", "from irvmail002.ir.intel.com ([10.43.11.120])\n by fmviesa003.fm.intel.com with ESMTP; 28 Apr 2026 08:37:42 -0700", "from gond.igk.intel.com (gond.igk.intel.com [10.123.220.52])\n by irvmail002.ir.intel.com (Postfix) with ESMTP id 642A3312C3;\n Tue, 28 Apr 2026 16:37:41 +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 8B1778382F", "OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3BBC08236B" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1777390667;\n\tbh=uuFZgw0mJdifU6kaNsN4Q7gVpb3fsZn+E4BKg9kLdII=;\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=sfY4V2Z5BcpmcQcxNucIrZvSouZZJIuEdooccBiuDSab/GML3scgAzrbcFaseTP8C\n\t sgj+erVJssePCQbA94k640jpsA8yd0/U9d6g6ed9S/yBU0LMMPDL+RsmDywnW62VEq\n\t uvs5g9FIB+C1xuG6zf5rBpH5yD/04qOxoxBrBknXa6u1A6V7PCEKB9Ji358VfyW0Ew\n\t zEZFvaY7+qDyenwvZJYM7N5foT9DwHv4g3cPHwglWwsxWtARp5d+ceKrcBaAqIb8CB\n\t afZk2F271str4zSiwrNWIRsNODCwyHx/I+9OAj1tIKZB7FRFclaNUFutUuxIxONnZn\n\t yoMyY+TZ70Row==", "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.15;\n helo=mgamail.intel.com; envelope-from=marcin.szycik@linux.intel.com;\n receiver=<UNKNOWN>", "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp1.osuosl.org 3BBC08236B", "X-CSE-ConnectionGUID": [ "PotZ+uPwSHmpSmedXPHIDw==", "4vZsTqtzRVW7vhaXyBEDjA==" ], "X-CSE-MsgGUID": [ "cpiEm013SxC1uIq/em233Q==", "I6yUkJA8SAiYi/lduNbHrQ==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11770\"; a=\"78415122\"", "E=Sophos;i=\"6.23,204,1770624000\"; d=\"scan'208\";a=\"78415122\"" ], "X-ExtLoop1": "1", "From": "Marcin Szycik <marcin.szycik@linux.intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Cc": "netdev@vger.kernel.org, paul.greenwalt@intel.com,\n jacob.e.keller@intel.com,\n Marcin Szycik <marcin.szycik@linux.intel.com>,\n Przemek Kitszel <przemyslaw.kitszel@intel.com>", "Date": "Tue, 28 Apr 2026 16:37:16 +0200", "Message-ID": "<20260428143716.9653-4-marcin.szycik@linux.intel.com>", "X-Mailer": "git-send-email 2.49.0", "In-Reply-To": "<20260428143716.9653-1-marcin.szycik@linux.intel.com>", "References": "<20260428143716.9653-1-marcin.szycik@linux.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=1777390665; x=1808926665;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=iDyuzVdhzoWktc6lJ5s6rwHPmOtA+aBIGReixZ0Jh04=;\n b=H8nKAr15q+reKiWIbiarApXS6XOH7kZ8ZPXTvfmFzKdxRa6zt6KYziF+\n aN/52uEZ/lJFyukH+VFjsLPZQrR/zIvup8EcH1GObM/2khKteFm0OZnCy\n Mk9od6SJ9drAP+HLn9K6zKkUkqJ6xdBTv0iFyQr74QGK5PZJ0jV2UhR9H\n I5rIatlRv4p5NK8CncxWW5b8EGkMVpl/Rwt22f8T9wB2HDOSexbg8pHUB\n /L32TKASJyber4K6MQK1Dx14ZqExh1cx0SyLQI0JEjqzw840EvyEHMNi4\n 63BcWkv97gOKLTor90+8Tbzt5ZR168F55dOvaXP3GfJUZZ7ClIOGATdV+\n A==;", "X-Mailman-Original-Authentication-Results": [ "smtp1.osuosl.org;\n dmarc=none (p=none dis=none)\n header.from=linux.intel.com", "smtp1.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=H8nKAr15" ], "Subject": "[Intel-wired-lan] [PATCH iwl-next 3/3] virtchnl, iavf, ice,\n i40e: add extended generic VF capability flags", "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": "VF capability flags in struct virtchnl_vf_resource::vf_cap_flags have\nall been used up, preventing new flags from being added. Note that\ndespite not all bits being defined here, they are used by out-of-tree\nreleases of Intel drivers, therefore cannot be taken.\n\nvirtchnl message size and structure must remain unchanged to not break\nreverse compatibility, therefore the existing virtchnl structure cannot\nbe extended with additional fields (e.g. flags2). vf_cap_flags type\ncannot be changed to a larger one for the same reason.\n\nBit 2 of vf_cap_flags was reserved for exactly this case. Its presence\nin message initially sent from VF shall now signal that there are more\ncapability flags to be parsed. If the PF driver acknowledges that via\nVIRTCHNL_OP_GET_VF_RESOURCES response, the VF will send a separate\nmessage: VIRTCHNL_OP_GET_VF_CAPS2, containing more capability flags.\nNote: this mechanism is similar for VIRTCHNL_OP_1588_PTP_GET_CAPS.\n\nThe new message supports flexible size, so more flags can be added\nwithout any architectural changes. Care was taken to ensure that no\nout-of-bounds reads happen in case the bitmap is shorter in one of the\ndrivers.\n\nThe new message includes the original 32 bits too, for consistency and\nmore straightforward parsing.\n\nSigned-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>\nReviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>\nReviewed-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/iavf/iavf.h | 19 ++-\n .../net/ethernet/intel/ice/virt/virtchnl.h | 2 +\n include/linux/intel/virtchnl.h | 55 ++++++-\n .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 84 +++++++++++\n drivers/net/ethernet/intel/iavf/iavf_main.c | 60 ++++++++\n .../net/ethernet/intel/iavf/iavf_virtchnl.c | 138 +++++++++++++++++-\n .../net/ethernet/intel/ice/virt/allowlist.c | 6 +\n .../net/ethernet/intel/ice/virt/virtchnl.c | 86 +++++++++++\n 8 files changed, 444 insertions(+), 6 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h\nindex 64576cba3a01..5d812b0a52a3 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf.h\n+++ b/drivers/net/ethernet/intel/iavf/iavf.h\n@@ -343,6 +343,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_VF_CAP_CAPS2\t\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@@ -350,7 +351,9 @@ struct iavf_adapter {\n #define IAVF_FLAG_AQ_EXTENDED_CAPS\t\t\t\\\n \t(IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS |\t\\\n \t IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS |\t\t\\\n-\t IAVF_FLAG_AQ_GET_PTP_CAPS)\n+\t IAVF_FLAG_AQ_GET_PTP_CAPS |\t\t\t\\\n+\t IAVF_FLAG_AQ_GET_VF_CAP_CAPS2 |\t\t\\\n+\t 0)\n \n \t/* flags for processing extended capability messages during\n \t * __IAVF_INIT_EXTENDED_CAPS. Each capability exchange requires\n@@ -366,6 +369,8 @@ 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_CAPS2\t\t\tBIT_ULL(6)\n+#define IAVF_EXTENDED_CAP_RECV_CAPS2\t\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@@ -373,7 +378,10 @@ struct iavf_adapter {\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_PTP |\t\t\t\\\n-\t IAVF_EXTENDED_CAP_RECV_PTP)\n+\t IAVF_EXTENDED_CAP_RECV_PTP |\t\t\t\\\n+\t IAVF_EXTENDED_CAP_SEND_CAPS2 |\t\t\t\\\n+\t IAVF_EXTENDED_CAP_RECV_CAPS2 |\t\t\t\\\n+\t 0)\n \n \t/* Lock to prevent possible clobbering of\n \t * current_netdev_promisc_flags\n@@ -430,6 +438,7 @@ struct iavf_adapter {\n #define IAVF_RXDID_ALLOWED(a)\t\t\t\t\t\t\\\n \ttest_bit(VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC, (a)->vf_cap_flags)\n #define IAVF_PTP_ALLOWED(a) test_bit(VIRTCHNL_VF_CAP_PTP, (a)->vf_cap_flags)\n+#define IAVF_CAPS2_ALLOWED(a) test_bit(VIRTCHNL_VF_CAPS2, (a)->vf_cap_flags)\n \tstruct virtchnl_vf_resource *vf_res; /* incl. all VSIs */\n \tstruct virtchnl_vsi_resource *vsi_res; /* our LAN VSI */\n \tstruct virtchnl_version_info pf_version;\n@@ -439,7 +448,9 @@ struct iavf_adapter {\n \tu64 supp_rxdids;\n \tstruct iavf_ptp ptp;\n \n-\t/* Mirrors vf_res->vf_cap_flags */\n+\t/* Negotiated via VIRTCHNL_OP_GET_VF_CAPS2. First 32 bits mirror\n+\t * vf_res->vf_cap_flags.\n+\t */\n \tDECLARE_BITMAP(vf_cap_flags, VIRTCHNL_VF_CAPS_MAX);\n \n \tu16 msg_enable;\n@@ -578,6 +589,8 @@ 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_vf_caps2_msg(struct iavf_adapter *adapter);\n+int iavf_get_vf_caps2(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);\ndiff --git a/drivers/net/ethernet/intel/ice/virt/virtchnl.h b/drivers/net/ethernet/intel/ice/virt/virtchnl.h\nindex f7f909424098..5b51a5a73708 100644\n--- a/drivers/net/ethernet/intel/ice/virt/virtchnl.h\n+++ b/drivers/net/ethernet/intel/ice/virt/virtchnl.h\n@@ -78,6 +78,8 @@ struct ice_virtchnl_ops {\n \tint (*get_ptp_cap)(struct ice_vf *vf,\n \t\t\t const struct virtchnl_ptp_caps *msg);\n \tint (*get_phc_time)(struct ice_vf *vf);\n+\tint (*get_vf_caps2)(struct ice_vf *vf,\n+\t\t\t const struct virtchnl_vf_caps2 *msg);\n };\n \n #ifdef CONFIG_PCI_IOV\ndiff --git a/include/linux/intel/virtchnl.h b/include/linux/intel/virtchnl.h\nindex 577b0549b437..edaca5ec8fd8 100644\n--- a/include/linux/intel/virtchnl.h\n+++ b/include/linux/intel/virtchnl.h\n@@ -162,6 +162,8 @@ enum virtchnl_ops {\n \t/* opcode 68 through 111 are reserved */\n \tVIRTCHNL_OP_CONFIG_QUEUE_BW = 112,\n \tVIRTCHNL_OP_CONFIG_QUANTA = 113,\n+\t/* opcode 114 through 135 are reserved */\n+\tVIRTCHNL_OP_GET_VF_CAPS2 = 136,\n \tVIRTCHNL_OP_MAX,\n };\n \n@@ -244,13 +246,14 @@ struct virtchnl_vsi_resource {\n \n VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);\n \n-/* VF capability flags */\n+/* Base (first 32) + extended VF capability flags */\n enum virtchnl_vf_caps_bitnr {\n \t/* Inclusive of base mode L2 offloads including TX/RX Checksum\n \t * offloading and TSO for non-tunnelled packets.\n \t */\n \tVIRTCHNL_VF_OFFLOAD_L2 = 0,\n \tVIRTCHNL_VF_OFFLOAD_RDMA = 1,\n+\tVIRTCHNL_VF_CAPS2 = 2,\n \tVIRTCHNL_VF_OFFLOAD_RSS_AQ = 3,\n \tVIRTCHNL_VF_OFFLOAD_RSS_REG = 4,\n \tVIRTCHNL_VF_OFFLOAD_WB_ON_ITR = 5,\n@@ -275,6 +278,8 @@ enum virtchnl_vf_caps_bitnr {\n \tVIRTCHNL_VF_OFFLOAD_QOS = 29,\n \tVIRTCHNL_VF_CAP_PTP = 31,\n \n+\t/* Flags greater than 31 are only available via virtchnl_vf_caps2 */\n+\n \tVIRTCHNL_VF_CAPS_MAX /* must be last */\n };\n \n@@ -284,7 +289,14 @@ struct virtchnl_vf_resource {\n \tu16 max_vectors;\n \tu16 max_mtu;\n \n+\t/* If both sides support VIRTCHNL_VF_CAPS2, extended flags, along with\n+\t * flags from this structure will be sent in VIRTCHNL_OP_GET_VF_CAPS2.\n+\t * Drivers should store capabilities negotiated this way in a bitmap,\n+\t * instead of directly reading flags from this structure, in order to\n+\t * have a unified interface for checking capabilities.\n+\t */\n \tu32 vf_cap_flags;\n+\n \tu32 rss_key_size;\n \tu32 rss_lut_size;\n \n@@ -1572,6 +1584,32 @@ struct virtchnl_ptp_caps {\n \n VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_ptp_caps);\n \n+/**\n+ * virtchnl_vf_caps2 - generic extended capability flags\n+ *\n+ * VF sends this message to negotiate an extended set of capability flags if\n+ * VIRTCHNL_VF_CAPS2 is set in virtchnl_vf_resource::vf_cap_flags.\n+ *\n+ * On send, VF sets what capabilities it requests. On reply, PF indicates what\n+ * has been enabled for this VF. The PF shall not set bits which were not\n+ * requested by the VF.\n+ *\n+ * Defines capabilities available to the VF, including the 32 original ones from\n+ * vf_cap_flags on the same positions, plus the ones that didn't fit there.\n+ * Drivers should construct a bitmap from this message, instead of checking the\n+ * first 32 bits sent in VIRTCHNL_OP_GET_VF_RESOURCES, for consistency.\n+ *\n+ * The VF sends VIRTCHNL_OP_GET_VF_CAPS2 and fills the vf_cap_flags bitmap,\n+ * indicating what capabilities it is requesting. The PF responds with the same\n+ * message, indicating what is enabled for the VF.\n+ */\n+struct virtchnl_vf_caps2 {\n+\tu32 flags_len;\n+\tu32 vf_cap_flags[] __counted_by(flags_len);\n+};\n+\n+VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_vf_caps2);\n+\n /**\n * struct virtchnl_phc_time - Contains the 64bits of PHC clock time in ns.\n * @time: PHC time in nanoseconds\n@@ -1929,6 +1967,21 @@ 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+\tcase VIRTCHNL_OP_GET_VF_CAPS2: {\n+\t\tstruct virtchnl_vf_caps2 *caps2 =\n+\t\t\t(struct virtchnl_vf_caps2 *)msg;\n+\n+\t\t/* Require at least 1 element */\n+\t\tif (msglen < struct_size(caps2, vf_cap_flags, 1) ||\n+\t\t msglen != struct_size(caps2, vf_cap_flags,\n+\t\t\t\t\t caps2->flags_len)) {\n+\t\t\terr_msg_format = true;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tvalid_len = struct_size(caps2, vf_cap_flags, caps2->flags_len);\n+\t\t}\n+\t\tbreak;\n \t/* These are always errors coming from the VF. */\n \tcase VIRTCHNL_OP_EVENT:\n \tcase VIRTCHNL_OP_UNKNOWN:\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 519f18dacd4a..9c233c3176c3 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -2149,6 +2149,11 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)\n \n \tbitmap_zero(vf->driver_caps, VIRTCHNL_VF_CAPS_MAX);\n \tif (VF_IS_V11(&vf->vf_ver)) {\n+\t\t/* VIRTCHNL_OP_GET_VF_RESOURCES only sends the first 32 flags.\n+\t\t * If VIRTCHNL_VF_CAPS2 (bit 2) is set, then there are more\n+\t\t * flags. A complete set (including the first 32) is then sent\n+\t\t * via VIRTCHNL_OP_GET_VF_CAPS2.\n+\t\t */\n \t\tbitmap_from_arr32(vf->driver_caps, (u32 *)msg,\n \t\t\t\t BITS_PER_TYPE(u32));\n \t} else {\n@@ -2218,6 +2223,10 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)\n \tif (test_bit(VIRTCHNL_VF_OFFLOAD_ADQ, vf->driver_caps))\n \t\tvfres->vf_cap_flags |= BIT(VIRTCHNL_VF_OFFLOAD_ADQ);\n \n+\t/* Indicate that VF can send more flags in VIRTCHNL_OP_GET_VF_CAPS2 */\n+\tif (test_bit(VIRTCHNL_VF_CAPS2, vf->driver_caps))\n+\t\tvfres->vf_cap_flags |= BIT(VIRTCHNL_VF_CAPS2);\n+\n \tvfres->num_vsis = num_vsis;\n \tvfres->num_queue_pairs = vf->num_queue_pairs;\n \tvfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf;\n@@ -4192,6 +4201,78 @@ static int i40e_vc_del_qch_msg(struct i40e_vf *vf, u8 *msg)\n \t\t\t\t aq_ret);\n }\n \n+/**\n+ * i40e_vc_get_vf_caps2 - parse extended capability flags\n+ * @vf: pointer to the VF info\n+ * @msg: pointer to the msg buffer\n+ *\n+ * Called from the VF to negotiate extended capability flag set if\n+ * VIRTCHNL_VF_CAPS2 was set in vf_cap_flags. The PF responds with the\n+ * intersection of its supported flags and the VF's requested flags.\n+ *\n+ * Return: 0 on success, negative on failure\n+ **/\n+static int i40e_vc_get_vf_caps2(struct i40e_vf *vf, u8 *msg)\n+{\n+\tstruct virtchnl_vf_caps2 *vf_msg = (struct virtchnl_vf_caps2 *)msg;\n+\tDECLARE_BITMAP(msg_caps, VIRTCHNL_VF_CAPS_MAX);\n+\tstruct virtchnl_vf_caps2 *caps2;\n+\tunsigned int nbits;\n+\tint aq_ret = 0;\n+\tint err;\n+\n+\tcaps2 = kzalloc_flex(*caps2, vf_cap_flags,\n+\t\t\t BITS_TO_U32(VIRTCHNL_VF_CAPS_MAX));\n+\tif (!caps2)\n+\t\treturn -ENOMEM;\n+\n+\tif (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {\n+\t\taq_ret = -EINVAL;\n+\t\tgoto send_msg;\n+\t}\n+\n+\tif (!test_bit(VIRTCHNL_VF_CAPS2, vf->driver_caps)) {\n+\t\taq_ret = -EINVAL;\n+\t\tgoto send_msg;\n+\t}\n+\n+\tcaps2->flags_len = BITS_TO_U32(VIRTCHNL_VF_CAPS_MAX);\n+\n+\t/* Set extended feature flags. The first 32 bits should be already set\n+\t * in VIRTCHNL_OP_GET_VF_RESOURCES\n+\t */\n+\n+\t/* Make sure to not read after msg bitmap or local bitmap. The remaining\n+\t * bits (if any) should be unset, since one side doesn't know about\n+\t * them, therefore cannot support these capabilities.\n+\t */\n+\tnbits = min_t(unsigned int, VIRTCHNL_VF_CAPS_MAX,\n+\t\t BITS_PER_TYPE(u32) * vf_msg->flags_len);\n+\tbitmap_zero(msg_caps, VIRTCHNL_VF_CAPS_MAX);\n+\tbitmap_from_arr32(msg_caps, vf_msg->vf_cap_flags, nbits);\n+\n+\t/* Note that msg->vf_cap_flags cannot be directly used, because then\n+\t * we'd need to limit the operation range to nbits. If the local caps\n+\t * is larger and has some flags set after nbits, then they would be\n+\t * incorrectly left set.\n+\t */\n+\tbitmap_and(vf->driver_caps, vf->driver_caps, msg_caps,\n+\t\t VIRTCHNL_VF_CAPS_MAX);\n+\n+\tbitmap_to_arr32(caps2->vf_cap_flags, vf->driver_caps,\n+\t\t\tVIRTCHNL_VF_CAPS_MAX);\n+\n+send_msg:\n+\terr = i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_GET_VF_CAPS2, aq_ret,\n+\t\t\t\t (u8 *)caps2,\n+\t\t\t\t struct_size(caps2, vf_cap_flags,\n+\t\t\t\t\t\t caps2->flags_len));\n+\n+\tkfree(caps2);\n+\n+\treturn err;\n+}\n+\n /**\n * i40e_vc_process_vf_msg\n * @pf: pointer to the PF structure\n@@ -4316,6 +4397,9 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,\n \tcase VIRTCHNL_OP_DEL_CLOUD_FILTER:\n \t\tret = i40e_vc_del_cloud_filter(vf, msg);\n \t\tbreak;\n+\tcase VIRTCHNL_OP_GET_VF_CAPS2:\n+\t\tret = i40e_vc_get_vf_caps2(vf, msg);\n+\t\tbreak;\n \tcase VIRTCHNL_OP_UNKNOWN:\n \tdefault:\n \t\tdev_err(&pf->pdev->dev, \"Unsupported opcode %d from VF %d\\n\",\ndiff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c\nindex ce2b61e56f9d..bb9d4b8c4b9b 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf_main.c\n+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c\n@@ -2038,6 +2038,8 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)\n \t\treturn iavf_send_vf_supported_rxdids_msg(adapter);\n \tif (adapter->aq_required & IAVF_FLAG_AQ_GET_PTP_CAPS)\n \t\treturn iavf_send_vf_ptp_caps_msg(adapter);\n+\tif (adapter->aq_required & IAVF_FLAG_AQ_GET_VF_CAP_CAPS2)\n+\t\treturn iavf_send_vf_caps2_msg(adapter);\n \tif (adapter->aq_required & IAVF_FLAG_AQ_DISABLE_QUEUES) {\n \t\tiavf_disable_queues(adapter);\n \t\treturn 0;\n@@ -2675,6 +2677,55 @@ static void iavf_init_recv_ptp_caps(struct iavf_adapter *adapter)\n \tiavf_change_state(adapter, __IAVF_INIT_FAILED);\n }\n \n+/**\n+ * iavf_init_send_flags2_caps - part of negotiating CAPS2 capabilities\n+ * @adapter: board private structure\n+ *\n+ * Send VIRTCHNL_OP_GET_VF_CAPS2 message to the PF. Clear\n+ * IAVF_EXTENDED_CAP_RECV_CAPS2 if the message is not sent, e.g. due to PF not\n+ * negotiating VIRTCHNL_VF_CAPS2.\n+ */\n+static void iavf_init_send_flags2_caps(struct iavf_adapter *adapter)\n+{\n+\tWARN_ON(!(adapter->extended_caps & IAVF_EXTENDED_CAP_SEND_CAPS2));\n+\n+\tif (iavf_send_vf_caps2_msg(adapter) == -EOPNOTSUPP) {\n+\t\t/* PF does not support VIRTCHNL_VF_CAPS2. In this case, we\n+\t\t * did not send the capability exchange message and do not\n+\t\t * expect a response.\n+\t\t */\n+\t\tadapter->extended_caps &= ~IAVF_EXTENDED_CAP_RECV_CAPS2;\n+\t}\n+\n+\t/* We sent the message, so move on to the next step */\n+\tadapter->extended_caps &= ~IAVF_EXTENDED_CAP_SEND_CAPS2;\n+}\n+\n+/**\n+ * iavf_init_recv_flags2_caps - part of negotiating CAPS2 capabilities\n+ * @adapter: board private structure\n+ *\n+ * Process receipt of VIRTCHNL_VF_CAPS2 message from PF.\n+ */\n+static void iavf_init_recv_flags2_caps(struct iavf_adapter *adapter)\n+{\n+\tWARN_ON(!(adapter->extended_caps & IAVF_EXTENDED_CAP_RECV_CAPS2));\n+\n+\tif (iavf_get_vf_caps2(adapter))\n+\t\tgoto err;\n+\n+\t/* We've processed the PF response to VIRTCHNL_OP_GET_VF_CAPS2 */\n+\tadapter->extended_caps &= ~IAVF_EXTENDED_CAP_RECV_CAPS2;\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_SEND_CAPS2;\n+\tiavf_change_state(adapter, __IAVF_INIT_FAILED);\n+}\n+\n /**\n * iavf_init_process_extended_caps - Part of driver startup\n * @adapter: board private structure\n@@ -2717,6 +2768,15 @@ static void iavf_init_process_extended_caps(struct iavf_adapter *adapter)\n \t\treturn;\n \t}\n \n+\t/* Process capability exchange for CAPS2 */\n+\tif (adapter->extended_caps & IAVF_EXTENDED_CAP_SEND_CAPS2) {\n+\t\tiavf_init_send_flags2_caps(adapter);\n+\t\treturn;\n+\t} else if (adapter->extended_caps & IAVF_EXTENDED_CAP_RECV_CAPS2) {\n+\t\tiavf_init_recv_flags2_caps(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 38be4caf77f0..4509a1501928 100644\n--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c\n+++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c\n@@ -172,7 +172,8 @@ int iavf_send_vf_config_msg(struct iavf_adapter *adapter)\n \t BIT(VIRTCHNL_VF_OFFLOAD_FDIR_PF) |\n \t BIT(VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF) |\n \t BIT(VIRTCHNL_VF_CAP_ADV_LINK_SPEED) |\n-\t BIT(VIRTCHNL_VF_OFFLOAD_QOS);\n+\t BIT(VIRTCHNL_VF_OFFLOAD_QOS) |\n+\t BIT(VIRTCHNL_VF_CAPS2);\n \n \tadapter->current_op = VIRTCHNL_OP_GET_VF_RESOURCES;\n \tadapter->aq_required &= ~IAVF_FLAG_AQ_GET_CONFIG;\n@@ -245,6 +246,52 @@ 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+/**\n+ * iavf_send_vf_caps2_msg - send request for second capability flags set\n+ * @adapter: adapter structure\n+ *\n+ * Send VIRTCHNL_OP_GET_VF_CAPS2 to the PF with the VF's desired flags2\n+ * bitmap. The PF responds with the intersection of the flags it supports.\n+ *\n+ * Return: 0 on success, -EOPNOTSUPP if CAPS2 was not negotiated, other error\n+ * code on failure\n+ */\n+int iavf_send_vf_caps2_msg(struct iavf_adapter *adapter)\n+{\n+\tDECLARE_BITMAP(msg_caps, VIRTCHNL_VF_CAPS_MAX);\n+\tstruct virtchnl_vf_caps2 *caps2;\n+\tint err;\n+\n+\tadapter->aq_required &= ~IAVF_FLAG_AQ_GET_VF_CAP_CAPS2;\n+\n+\tif (!IAVF_CAPS2_ALLOWED(adapter))\n+\t\treturn -EOPNOTSUPP;\n+\n+\tcaps2 = kzalloc_flex(*caps2, vf_cap_flags,\n+\t\t\t BITS_TO_U32(VIRTCHNL_VF_CAPS_MAX));\n+\tif (!caps2)\n+\t\treturn -ENOMEM;\n+\n+\tcaps2->flags_len = BITS_TO_U32(VIRTCHNL_VF_CAPS_MAX);\n+\n+\t/* Copy from the local bitmap (should have only first 32 bits set) and\n+\t * set extended feature flags to send.\n+\t */\n+\tbitmap_copy(msg_caps, adapter->vf_cap_flags, VIRTCHNL_VF_CAPS_MAX);\n+\n+\tbitmap_to_arr32(caps2->vf_cap_flags, msg_caps, VIRTCHNL_VF_CAPS_MAX);\n+\n+\tadapter->current_op = VIRTCHNL_OP_GET_VF_CAPS2;\n+\n+\terr = iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_VF_CAPS2, (u8 *)caps2,\n+\t\t\t struct_size(caps2, vf_cap_flags,\n+\t\t\t\t\t caps2->flags_len));\n+\n+\tkfree(caps2);\n+\n+\treturn err;\n+}\n+\n /**\n * iavf_validate_num_queues\n * @adapter: adapter structure\n@@ -296,7 +343,7 @@ int iavf_get_vf_config(struct iavf_adapter *adapter)\n \terr = iavf_poll_virtchnl_msg(hw, &event, VIRTCHNL_OP_GET_VF_RESOURCES);\n \tmemcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len));\n \n-\t/* mirror to the extended bitmap */\n+\t/* mirror the first 32 bits to the extended bitmap */\n \tbitmap_from_arr32(adapter->vf_cap_flags, &adapter->vf_res->vf_cap_flags,\n \t\t\t BITS_PER_TYPE(u32));\n \n@@ -369,6 +416,78 @@ int iavf_get_vf_ptp_caps(struct iavf_adapter *adapter)\n \treturn err;\n }\n \n+/**\n+ * iavf_process_caps2 - store received extended caps in adapter\n+ * @adapter: adapter structure\n+ * @caps2: received extended capabilities message\n+ *\n+ * Return: 0 on success, negative on failure\n+ */\n+static int iavf_process_caps2(struct iavf_adapter *adapter,\n+\t\t\t struct virtchnl_vf_caps2 *caps2)\n+{\n+\tunsigned int nbits;\n+\n+\tif (caps2->flags_len == 0)\n+\t\treturn -EINVAL;\n+\n+\t/* Make sure to not read after msg bitmap or local bitmap. The remaining\n+\t * bits (if any) should be unset, since one side doesn't know about\n+\t * them, therefore cannot support these capabilities.\n+\t */\n+\tnbits = min_t(unsigned int, VIRTCHNL_VF_CAPS_MAX,\n+\t\t BITS_PER_TYPE(u32) * caps2->flags_len);\n+\n+\tbitmap_zero(adapter->vf_cap_flags, VIRTCHNL_VF_CAPS_MAX);\n+\tbitmap_from_arr32(adapter->vf_cap_flags, caps2->vf_cap_flags, nbits);\n+\t/* Assume the first 32 bits were already written to\n+\t * adapter->vf_res->vf_cap_flags in VIRTCHNL_OP_GET_VF_RESOURCES. Driver\n+\t * should not use these anyway.\n+\t */\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * iavf_get_vf_caps2 - receive second capability flags from PF\n+ * @adapter: adapter structure\n+ *\n+ * Poll the admin queue for a response to VIRTCHNL_OP_GET_VF_CAPS2 and process\n+ * the negotiated flags.\n+ *\n+ * Return: 0 on success, negative on failure\n+ */\n+int iavf_get_vf_caps2(struct iavf_adapter *adapter)\n+{\n+\tstruct iavf_arq_event_info event;\n+\tstruct virtchnl_vf_caps2 *caps2;\n+\tint err;\n+\n+\t/* Actual length might be larger if PF knows more flags, but we don't\n+\t * care about them since they should be unset after the negotiation.\n+\t * Even if they were somehow not, VF has no way to store them.\n+\t */\n+\tevent.buf_len = struct_size(caps2, vf_cap_flags, VIRTCHNL_VF_CAPS_MAX);\n+\n+\tevent.msg_buf = kzalloc(event.buf_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_VF_CAPS2);\n+\tif (err)\n+\t\tgoto free_msg_buf;\n+\n+\tcaps2 = (struct virtchnl_vf_caps2 *)event.msg_buf;\n+\n+\terr = iavf_process_caps2(adapter, caps2);\n+\n+free_msg_buf:\n+\tkfree(event.msg_buf);\n+\n+\treturn err;\n+}\n+\n /**\n * iavf_configure_queues\n * @adapter: adapter structure\n@@ -2707,6 +2826,21 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,\n \tcase VIRTCHNL_OP_1588_PTP_GET_TIME:\n \t\tiavf_virtchnl_ptp_get_time(adapter, msg, msglen);\n \t\tbreak;\n+\tcase VIRTCHNL_OP_GET_VF_CAPS2: {\n+\t\tstruct virtchnl_vf_caps2 *caps2 =\n+\t\t\t(struct virtchnl_vf_caps2 *)msg;\n+\n+\t\t/* Require at least 1 element */\n+\t\tif (msglen < struct_size(caps2, vf_cap_flags, 1) ||\n+\t\t msglen != struct_size(caps2, vf_cap_flags,\n+\t\t\t\t\t caps2->flags_len))\n+\t\t\treturn;\n+\n+\t\tif (iavf_process_caps2(adapter, caps2))\n+\t\t\tdev_warn(&adapter->pdev->dev,\n+\t\t\t\t \"Invalid extended flags received from PF\\n\");\n+\t\t}\n+\t\tbreak;\n \tcase VIRTCHNL_OP_ENABLE_QUEUES:\n \t\t/* enable transmits */\n \t\tiavf_irq_enable(adapter, true);\ndiff --git a/drivers/net/ethernet/intel/ice/virt/allowlist.c b/drivers/net/ethernet/intel/ice/virt/allowlist.c\nindex eb3d3b4e65a9..a5c27489a7ff 100644\n--- a/drivers/net/ethernet/intel/ice/virt/allowlist.c\n+++ b/drivers/net/ethernet/intel/ice/virt/allowlist.c\n@@ -90,6 +90,11 @@ static const u32 ptp_allowlist_opcodes[] = {\n \tVIRTCHNL_OP_1588_PTP_GET_TIME,\n };\n \n+/* VIRTCHNL_VF_CAPS2 */\n+static const u32 caps2_allowlist_opcodes[] = {\n+\tVIRTCHNL_OP_GET_VF_CAPS2,\n+};\n+\n static const u32 tc_allowlist_opcodes[] = {\n \tVIRTCHNL_OP_GET_QOS_CAPS, VIRTCHNL_OP_CONFIG_QUEUE_BW,\n \tVIRTCHNL_OP_CONFIG_QUANTA,\n@@ -117,6 +122,7 @@ static const struct allowlist_opcode_info allowlist_opcodes[] = {\n \tALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_VLAN_V2, vlan_v2_allowlist_opcodes),\n \tALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_QOS, tc_allowlist_opcodes),\n \tALLOW_ITEM(VIRTCHNL_VF_CAP_PTP, ptp_allowlist_opcodes),\n+\tALLOW_ITEM(VIRTCHNL_VF_CAPS2, caps2_allowlist_opcodes),\n };\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ice/virt/virtchnl.c b/drivers/net/ethernet/intel/ice/virt/virtchnl.c\nindex f15e8c82d52d..37bf02cd4d41 100644\n--- a/drivers/net/ethernet/intel/ice/virt/virtchnl.c\n+++ b/drivers/net/ethernet/intel/ice/virt/virtchnl.c\n@@ -267,6 +267,11 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)\n \n \tbitmap_zero(vf->driver_caps, VIRTCHNL_VF_CAPS_MAX);\n \tif (VF_IS_V11(&vf->vf_ver)) {\n+\t\t/* VIRTCHNL_OP_GET_VF_RESOURCES only sends the first 32 flags.\n+\t\t * If VIRTCHNL_VF_CAPS2 (bit 2) is set, then there are more\n+\t\t * flags. A complete set (including the first 32) is then sent\n+\t\t * via VIRTCHNL_OP_GET_VF_CAPS2.\n+\t\t */\n \t\tbitmap_from_arr32(vf->driver_caps, (u32 *)msg,\n \t\t\t\t BITS_PER_TYPE(u32));\n \t} else {\n@@ -333,6 +338,10 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)\n \tif (test_bit(VIRTCHNL_VF_CAP_PTP, vf->driver_caps))\n \t\tvfres->vf_cap_flags |= BIT(VIRTCHNL_VF_CAP_PTP);\n \n+\t/* Indicate that VF can send more flags in VIRTCHNL_OP_GET_VF_CAPS2 */\n+\tif (test_bit(VIRTCHNL_VF_CAPS2, vf->driver_caps))\n+\t\tvfres->vf_cap_flags |= BIT(VIRTCHNL_VF_CAPS2);\n+\n \tvfres->num_vsis = 1;\n \t/* Tx and Rx queue are equal for VF */\n \tvfres->num_queue_pairs = vsi->num_txq;\n@@ -2453,6 +2462,78 @@ static int ice_vc_dis_vlan_insertion_v2_msg(struct ice_vf *vf, u8 *msg)\n \t\t\t\t v_ret, NULL, 0);\n }\n \n+/**\n+ * ice_vc_get_vf_caps2 - handle VIRTCHNL_OP_GET_VF_CAPS2\n+ * @vf: pointer to VF\n+ * @msg: pointer to the message buffer\n+ *\n+ * Called from the VF to negotiate extended capability flag set if\n+ * VIRTCHNL_VF_CAPS2 was set in vf_cap_flags. The PF responds with the\n+ * intersection of its supported flags and the VF's requested flags.\n+ *\n+ * Return: 0 on success, negative on failure\n+ */\n+static int ice_vc_get_vf_caps2(struct ice_vf *vf,\n+\t\t\t const struct virtchnl_vf_caps2 *msg)\n+{\n+\tenum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;\n+\tDECLARE_BITMAP(msg_caps, VIRTCHNL_VF_CAPS_MAX);\n+\tstruct virtchnl_vf_caps2 *caps2;\n+\tunsigned int nbits;\n+\tint err;\n+\n+\tcaps2 = kzalloc_flex(*caps2, vf_cap_flags,\n+\t\t\t BITS_TO_U32(VIRTCHNL_VF_CAPS_MAX));\n+\tif (!caps2)\n+\t\treturn -ENOMEM;\n+\n+\tif (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) {\n+\t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n+\t\tgoto send_msg;\n+\t}\n+\n+\tif (!test_bit(VIRTCHNL_VF_CAPS2, vf->driver_caps)) {\n+\t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n+\t\tgoto send_msg;\n+\t}\n+\n+\tcaps2->flags_len = BITS_TO_U32(VIRTCHNL_VF_CAPS_MAX);\n+\n+\t/* Set extended feature flags. The first 32 bits should be already set\n+\t * in VIRTCHNL_OP_GET_VF_RESOURCES\n+\t */\n+\n+\t/* Make sure to not read after msg bitmap or local bitmap. The remaining\n+\t * bits (if any) should be unset, since one side doesn't know about\n+\t * them, therefore cannot support these capabilities.\n+\t */\n+\tnbits = min_t(unsigned int, VIRTCHNL_VF_CAPS_MAX,\n+\t\t BITS_PER_TYPE(u32) * msg->flags_len);\n+\tbitmap_zero(msg_caps, VIRTCHNL_VF_CAPS_MAX);\n+\tbitmap_from_arr32(msg_caps, msg->vf_cap_flags, nbits);\n+\n+\t/* Note that msg->vf_cap_flags cannot be directly used, because then\n+\t * we'd need to limit the operation range to nbits. If the local caps\n+\t * is larger and has some flags set after nbits, then they would be\n+\t * incorrectly left set.\n+\t */\n+\tbitmap_and(vf->driver_caps, vf->driver_caps, msg_caps,\n+\t\t VIRTCHNL_VF_CAPS_MAX);\n+\n+\tbitmap_to_arr32(caps2->vf_cap_flags, vf->driver_caps,\n+\t\t\tVIRTCHNL_VF_CAPS_MAX);\n+\n+send_msg:\n+\terr = ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_GET_VF_CAPS2, v_ret,\n+\t\t\t\t (u8 *)caps2,\n+\t\t\t\t struct_size(caps2, vf_cap_flags,\n+\t\t\t\t\t\tcaps2->flags_len));\n+\n+\tkfree(caps2);\n+\n+\treturn err;\n+}\n+\n static int ice_vc_get_ptp_cap(struct ice_vf *vf,\n \t\t\t const struct virtchnl_ptp_caps *msg)\n {\n@@ -2544,6 +2625,7 @@ static const struct ice_virtchnl_ops ice_virtchnl_dflt_ops = {\n \t.cfg_q_quanta = ice_vc_cfg_q_quanta,\n \t.get_ptp_cap = ice_vc_get_ptp_cap,\n \t.get_phc_time = ice_vc_get_phc_time,\n+\t.get_vf_caps2 = ice_vc_get_vf_caps2,\n \t/* If you add a new op here please make sure to add it to\n \t * ice_virtchnl_repr_ops as well.\n \t */\n@@ -2681,6 +2763,7 @@ static const struct ice_virtchnl_ops ice_virtchnl_repr_ops = {\n \t.cfg_q_quanta = ice_vc_cfg_q_quanta,\n \t.get_ptp_cap = ice_vc_get_ptp_cap,\n \t.get_phc_time = ice_vc_get_phc_time,\n+\t.get_vf_caps2 = ice_vc_get_vf_caps2,\n };\n \n /**\n@@ -2924,6 +3007,9 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event,\n \tcase VIRTCHNL_OP_1588_PTP_GET_TIME:\n \t\terr = ops->get_phc_time(vf);\n \t\tbreak;\n+\tcase VIRTCHNL_OP_GET_VF_CAPS2:\n+\t\terr = ops->get_vf_caps2(vf, (const void *)msg);\n+\t\tbreak;\n \tcase VIRTCHNL_OP_UNKNOWN:\n \tdefault:\n \t\tdev_err(dev, \"Unsupported opcode %d from VF %d\\n\", v_opcode,\n", "prefixes": [ "iwl-next", "3/3" ] }