Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c969ef4e authored by Tushar Dave's avatar Tushar Dave Committed by Jeff Kirsher
Browse files

i40evf: Use le32_to_cpu before evaluating HW desc fields



i40e hardware descriptor fields are in little-endian format. Driver
must use le32_to_cpu while evaluating these fields otherwise on
big-endian arch we end up evaluating incorrect values, cause errors
like:
i40evf 0000:03:0a.0: Expected response 24 from PF, received 402653184
i40evf 0000:03:0a.1: Expected response 7 from PF, received 117440512

Signed-off-by: default avatarTushar Dave <tushar.n.dave@oracle.com>
Reviewed-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent eb23039f
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -1957,8 +1957,8 @@ static void i40evf_adminq_task(struct work_struct *work)
		container_of(work, struct i40evf_adapter, adminq_task);
	struct i40e_hw *hw = &adapter->hw;
	struct i40e_arq_event_info event;
	struct virtchnl_msg *v_msg;
	i40e_status ret;
	enum virtchnl_ops v_op;
	i40e_status ret, v_ret;
	u32 val, oldval;
	u16 pending;

@@ -1970,15 +1970,15 @@ static void i40evf_adminq_task(struct work_struct *work)
	if (!event.msg_buf)
		goto out;

	v_msg = (struct virtchnl_msg *)&event.desc;
	do {
		ret = i40evf_clean_arq_element(hw, &event, &pending);
		if (ret || !v_msg->v_opcode)
		v_op = (enum virtchnl_ops)le32_to_cpu(event.desc.cookie_high);
		v_ret = (i40e_status)le32_to_cpu(event.desc.cookie_low);

		if (ret || !v_op)
			break; /* No event to process or error cleaning ARQ */

		i40evf_virtchnl_completion(adapter, v_msg->v_opcode,
					   (i40e_status)v_msg->v_retval,
					   event.msg_buf,
		i40evf_virtchnl_completion(adapter, v_op, v_ret, event.msg_buf,
					   event.msg_len);
		if (pending != 0)
			memset(event.msg_buf, 0, I40EVF_MAX_AQ_BUF_SIZE);