[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <52cc5ddb-cea3-4502-936e-4f8a6d45b09a@intel.com>
Date: Tue, 20 Jan 2026 11:36:53 -0800
From: Tony Nguyen <anthony.l.nguyen@...el.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <davem@...emloft.net>, <pabeni@...hat.com>, <edumazet@...gle.com>,
<andrew+netdev@...n.ch>, <netdev@...r.kernel.org>, Madhu Chittim
<madhu.chittim@...el.com>, <joshua.a.hay@...el.com>, Milena Olech
<milena.olech@...el.com>, Aleksandr Loktionov
<aleksandr.loktionov@...el.com>, Samuel Salin <Samuel.salin@...el.com>
Subject: Re: [PATCH net-next 01/10] idpf: introduce local idpf structure to
store virtchnl queue chunks
On 1/17/2026 6:25 PM, Jakub Kicinski wrote:
> On Thu, 15 Jan 2026 15:47:38 -0800 Tony Nguyen wrote:
>> +/**
>> + * idpf_queue_id_reg_chunk - individual queue ID and register chunk
>
> missing the word struct
Oof, will fix this.
>> + * @qtail_reg_start: queue tail register offset
>> + * @qtail_reg_spacing: queue tail register spacing
>> + * @type: queue type of the queues in the chunk
>> + * @start_queue_id: starting queue ID in the chunk
>> + * @num_queues: number of queues in the chunk
>> + */
>> +struct idpf_queue_id_reg_chunk {
>> + u64 qtail_reg_start;
>> + u32 qtail_reg_spacing;
>> + u32 type;
>> + u32 start_queue_id;
>> + u32 num_queues;
>> +};
>> +
>> +/**
>> + * idpf_queue_id_reg_info - struct to store the queue ID and register chunk
>
> ditto
This as well.
>
>> + * info received over the mailbox
>> + * @num_chunks: number of chunks
>> + * @queue_chunks: array of chunks
>> + */
>> +struct idpf_queue_id_reg_info {
>> + u16 num_chunks;
>> + struct idpf_queue_id_reg_chunk *queue_chunks;
>> +};
>
>> +static int
>> +idpf_vport_init_queue_reg_chunks(struct idpf_vport_config *vport_config,
>> + struct virtchnl2_queue_reg_chunks *schunks)
>> +{
>> + struct idpf_queue_id_reg_info *q_info = &vport_config->qid_reg_info;
>> + u16 num_chunks = le16_to_cpu(schunks->num_chunks);
>> +
>> + kfree(q_info->queue_chunks);
>> +
>> + q_info->num_chunks = num_chunks;
>
> AI review complains that this is set before the alloc, so if alloc
> fails the struct is in inconsistent state. I didn't check if this is
> defensive programming or the callers handle this error correctly.
> But seems easy to fix, so maybe let's?
Yep, will make the change.
Also, we'll adjust the other two in this series that the AI review
commented on as well.
Thanks,
Tony
>> + q_info->queue_chunks = kcalloc(num_chunks, sizeof(*q_info->queue_chunks),
>> + GFP_KERNEL);
>> + if (!q_info->queue_chunks)
>> + return -ENOMEM;
>> +
>> + for (u16 i = 0; i < num_chunks; i++) {
>> + struct idpf_queue_id_reg_chunk *dchunk = &q_info->queue_chunks[i];
>> + struct virtchnl2_queue_reg_chunk *schunk = &schunks->chunks[i];
>> +
>> + dchunk->qtail_reg_start = le64_to_cpu(schunk->qtail_reg_start);
>> + dchunk->qtail_reg_spacing = le32_to_cpu(schunk->qtail_reg_spacing);
>> + dchunk->type = le32_to_cpu(schunk->type);
>> + dchunk->start_queue_id = le32_to_cpu(schunk->start_queue_id);
>> + dchunk->num_queues = le32_to_cpu(schunk->num_queues);
>> + }
>> +
Powered by blists - more mailing lists