[PATCH 13/13] net/ionic: optimize device start operation
Boyer, Andrew
Andrew.Boyer at amd.com
Mon Feb 5 14:21:43 CET 2024
> On Feb 2, 2024, at 11:28 PM, Stephen Hemminger <stephen at networkplumber.org> wrote:
>
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> 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.
Thanks for looking. Since DPDK requires C11 now, and I see other users of compound literals in lib/, I'll respin this to use that instead.
(The internet says unset fields are implicitly initialized to zero, hopefully that's correct.)
It makes the diff a lot cleaner, too.
Thanks,
Andrew
More information about the dev
mailing list