[EXT] Re: [PATCH 1/3] eventdev: add element offset to event vector
Mattias Rönnblom
mattias.ronnblom at ericsson.com
Wed Sep 14 16:55:58 CEST 2022
On 2022-09-14 15:02, Jerin Jacob wrote:
>>>>>> struct rte_event_vector {
>>>>>> uint16_t nb_elem;
>>>>>> - /**< Number of elements in this event vector. */
>>>>>> - uint16_t rsvd : 15;
>>>>>> + /**< Total number of elements in this event vector. */
>>>>>
>>>>> I'm not sure "total" adds anything here. Didn't the old nb_elem also
>>>>> include the total number of elements?
>>>>>
>>>>
>>>> Yes, I added it to clarify that it includes slots that don’t have valid elements.
>>>> I will update the comment to convey that it includes elements before
>>> offset.
>>>>
>>>
>>> The issue is that it doesn't clarify anything. Change the name, or
>>> change the semantics to fit the name, instead of explaining a poor name
>>> in a comment.
>>>
>>
>> Names are always subjective and will confuse someone or the other.
>> But we can do our best to communicate the semantics, how about
>> total_(elements|slots|lanes) and valid_(element|slot|lane)_offset.
>>
>> I will send the next version once we agree upon the naming.
>
> In order to make forward progress, @Mattias Rönnblom Do you have
> specific name suggestions for the next version?
> If not, I suggest to pick total_elements
I may be missing something here, but I would suggest keeping the old
name and old semantics. I.e, nb_elem is the number of elements actually
used. New is only that they may start at index elem_offset, as opposed
to the old always-at-index-0.
Instead of changes like:
- for (i = 0; i < vec->nb_elem; i++) {
+ for (i = vec->elem_offset; i < vec->nb_elem; i++) {
port = mbufs[i]->port;
queue =
You would have:
for (i = 0; i < vec->nb_elem; i++) {
- port = mbufs[i]->port;
+ port = mbufs[i + vec->elem_offset]->port;
queue =
If you for some reason want to have the start index and the end index
(like the patch suggested), you could replace the original nb_elem with
two fields, elem_start (what patch calls elem_offset) and elem_end (what
patch call nb_elem). I think having only an offset and a length is more
straightforward though. In the elem_end case, you will have people
asking themselves if it is the last index used, or the first index not
used (i.e., last index + 1).
More information about the dev
mailing list