[Intel-wired-lan] [PATCH iwl-next v1 1/2] i40e: Add read alternate indirect command
Simon Horman
horms at kernel.org
Sat Jan 13 16:07:11 UTC 2024
On Fri, Jan 12, 2024 at 10:59:44AM +0100, Jedrzej Jagielski wrote:
> From: Przemyslaw R Karpinski <przemyslaw.r.karpinski at intel.com>
>
> Introduce implementation of 0x0903 Admin Queue command.
> This indirect command reads a block of data from the alternate structure
> of memory. The command defines the number of Dwords to be read and the
> starting address inside the alternate structure.
>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov at intel.com>
> Signed-off-by: Przemyslaw R Karpinski <przemyslaw.r.karpinski at intel.com>
> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski at intel.com>
...
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
> index de6ca6295742..93971c9c98cc 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_common.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
> @@ -4375,6 +4375,46 @@ static int i40e_aq_alternate_read(struct i40e_hw *hw,
> return status;
> }
>
> +/**
> + * i40e_aq_alternate_read_indirect
> + * @hw: pointer to the hardware structure
> + * @addr: address of the alternate structure field
> + * @dw_count: number of alternate structure fields to read
> + * @buffer: pointer to the command buffer
> + *
> + * Read 'dw_count' dwords from alternate structure starting at 'addr' and
> + * place them in 'buffer'. The buffer should be allocated by caller.
> + *
> + **/
> +int i40e_aq_alternate_read_indirect(struct i40e_hw *hw, u32 addr, u32 dw_count,
> + void *buffer)
> +{
> + struct i40e_aqc_alternate_ind_read_write *cmd_resp;
> + struct i40e_aq_desc desc;
> + int status;
> +
> + if (!buffer)
> + return -EINVAL;
> +
> + cmd_resp = (struct i40e_aqc_alternate_ind_read_write *)&desc.params.raw;
> +
> + i40e_fill_default_direct_cmd_desc(&desc,
> + i40e_aqc_opc_alternate_read_indirect);
> +
> + desc.flags |= cpu_to_le16(I40E_AQ_FLAG_RD);
> + desc.flags |= cpu_to_le16(I40E_AQ_FLAG_BUF);
> + if (dw_count > I40E_AQ_LARGE_BUF / 4)
> + desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
nit: Maybe the cast to (u16) can be dropped?
It isn't present in usage of I40E_AQ_FLAG_LB a few lines further up.
> +
> + cmd_resp->address = cpu_to_le32(addr);
> + cmd_resp->length = cpu_to_le32(dw_count);
> +
> + status = i40e_asq_send_command(hw, &desc, buffer,
> + lower_16_bits(4 * dw_count), NULL);
> +
> + return status;
> +}
> +
> /**
> * i40e_aq_suspend_port_tx
> * @hw: pointer to the hardware structure
...
More information about the Intel-wired-lan
mailing list