]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
idpf: fix LAN memory regions command on some NVMs
authorLarysa Zaremba <larysa.zaremba@intel.com>
Tue, 7 Oct 2025 11:46:22 +0000 (13:46 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 17 Dec 2025 18:38:00 +0000 (10:38 -0800)
IPU SDK versions 1.9 through 2.0.5 require send buffer to contain a single
empty memory region. Set number of regions to 1 and use appropriate send
buffer size to satisfy this requirement.

Fixes: 6aa53e861c1a ("idpf: implement get LAN MMIO memory regions")
Suggested-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c

index 44cd4b466c481d8b20dea767628826d9bbea401f..5bbe7d9294c141eb882a2acba6a6cf2b4b9d9897 100644 (file)
@@ -1016,6 +1016,9 @@ static int idpf_send_get_lan_memory_regions(struct idpf_adapter *adapter)
        struct idpf_vc_xn_params xn_params = {
                .vc_op = VIRTCHNL2_OP_GET_LAN_MEMORY_REGIONS,
                .recv_buf.iov_len = IDPF_CTLQ_MAX_BUF_LEN,
+               .send_buf.iov_len =
+                       sizeof(struct virtchnl2_get_lan_memory_regions) +
+                       sizeof(struct virtchnl2_mem_region),
                .timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
        };
        int num_regions, size;
@@ -1028,6 +1031,8 @@ static int idpf_send_get_lan_memory_regions(struct idpf_adapter *adapter)
                return -ENOMEM;
 
        xn_params.recv_buf.iov_base = rcvd_regions;
+       rcvd_regions->num_memory_regions = cpu_to_le16(1);
+       xn_params.send_buf.iov_base = rcvd_regions;
        reply_sz = idpf_vc_xn_exec(adapter, &xn_params);
        if (reply_sz < 0)
                return reply_sz;