[PATCH 13/13] net/ionic: optimize device start operation

Stephen Hemminger stephen at networkplumber.org
Sat Feb 3 05:28:09 CET 2024


On Fri, 2 Feb 2024 11:32:38 -0800
Andrew Boyer <andrew.boyer at amd.com> wrote:

> +	memset(ctx, 0, sizeof(*ctx));
> +	ctx->pending_work = true;
> +	ctx->cmd.q_init.opcode = IONIC_CMD_Q_INIT;
> +	ctx->cmd.q_init.type = q->type;
> +	ctx->cmd.q_init.ver = lif->qtype_info[q->type].version;
> +	ctx->cmd.q_init.index = rte_cpu_to_le_32(q->index);
> +	ctx->cmd.q_init.flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA);
> +	ctx->cmd.q_init.intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE);
> +	ctx->cmd.q_init.ring_size = rte_log2_u32(q->num_descs);
> +	ctx->cmd.q_init.cq_ring_base = rte_cpu_to_le_64(cq->base_pa);
> +	ctx->cmd.q_init.sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa);
> +

memset followed by assignment is technically slower than structure
initialization because it requires two writes to the data.
But the optimizer may in some cases figure that out.


More information about the dev mailing list