Commit 4af1f9a4 authored by Larysa Zaremba's avatar Larysa Zaremba Committed by Tony Nguyen
Browse files

idpf: fix LAN memory regions command on some NVMs



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: 6aa53e86 ("idpf: implement get LAN MMIO memory regions")
Suggested-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: default avatarLarysa Zaremba <larysa.zaremba@intel.com>
Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 6daa2893
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;