[dpdk-dev] [PATCH v6 08/10] examples/l2fwd-event: add eventdev main loop
Pavan Nikhilesh Bhagavatula
pbhagavatula at marvell.com
Tue Oct 22 19:02:58 CEST 2019
<snip>
>> >> + /* Read packet from eventdev */
>> >> + if (!rte_event_dequeue_burst(event_d_id, port_id,
>> >&ev, 1, 0))
>> >> + continue;
>> >Is not this unlikely `nb_burst == 0`
>> >
>>
>> Not necessarily refer
>> https://urldefense.proofpoint.com/v2/url?u=https-
>3A__mails.dpdk.org_archives_dev_2018-
>2DJuly_108610.html&d=DwIFAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=E3Sg
>YMjtKCMVsB-fmvgGV3o-
>g_fjLhk5Pupi9ijohpc&m=HyS43be9AB6KIroLm8d2EK4M6_lE_fZua3CTxY
>5vbiU&s=FcZlWlkbhYkrQ3HApkxAX6A17gyHQZ0cYoDeG3KkwTw&e=
>
>Thanks for the article and links it is helpful. Following the article
>suggestion, should not the code be enhanced for execute code rather
>than continue?
>
Do you mean there would be a difference between the below cases?
void case1() {
while (1) {
if (!(random() & 0x1))
continue;
}
}
void case2() {
while (1) {
uint8_t is_one = random() & 0x1;
if (is_one == 0)
continue;
}
}
AFAIK both the above cases compile to the same asm.
>snipped
>> >> + /* Read packet from eventdev */
>> >> + nb_rx = rte_event_dequeue_burst(event_d_id,
>> >port_id, ev,
>> >> + deq_len, 0);
>> >> + if (nb_rx == 0)
>> >Can we use `unlikely`?
>>
>> Not necessarily refer
>> https://urldefense.proofpoint.com/v2/url?u=https-
>3A__mails.dpdk.org_archives_dev_2018-
>2DJuly_108610.html&d=DwIFAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=E3Sg
>YMjtKCMVsB-fmvgGV3o-
>g_fjLhk5Pupi9ijohpc&m=HyS43be9AB6KIroLm8d2EK4M6_lE_fZua3CTxY
>5vbiU&s=FcZlWlkbhYkrQ3HApkxAX6A17gyHQZ0cYoDeG3KkwTw&e=
>Same as above.
>
>>
>> >> + continue;
>> >> +
>> >> + for (i = 0; i < nb_rx; i++) {
>> >> + l2fwd_event_fwd(rsrc, &ev[i], tx_q_id,
>> >timer_period,
>> >> + flags);
>> >> + }
>> >> +
>> >> + if (flags & L2FWD_EVENT_TX_ENQ) {
>> >> + nb_tx =
>> >rte_event_enqueue_burst(event_d_id, port_id,
>> >> + ev, nb_rx);
>> >> + while (nb_tx < nb_rx && !rsrc->force_quit)
>> >> + nb_tx +=
>> >> rte_event_enqueue_burst(event_d_id,
>> >> + port_id, ev + nb_tx,
>> >> + nb_rx - nb_tx);
>> >Can we use `continue` as we do not transmit from the same worker
>int
>> >his case?
>>
>> I'm not sure I follow what you meant here. We are trying to transmit
>the work
>> present on the worker till we succeed, if we do a continue then we
>would loose
>> the untransmitted packets.
>Maybe I mistook the L2FWD against ETHDEV_EVENT flags. As per my
>current understanding L2FWD_EVENT_TX_ENQ uses extra queue stage
>for single-event-enqueue for TX adapter, while
>L2FWD_EVENT_TX_DIRECT allows the worker to do transmit via port.
>May be this is wrong expectation.
>
The above is understanding is correct. I just don't see how a continue out of
the while loop would help.
In the above case we are going to retry enqueue(TX_ENQ) or transmit(TX_DIRECT)
until we succeed.
>>
>> @see examples/eventdev_pipeline/pipeline_worker_generic.c +109
>I will check the same and get back as required.
>
>>
>> >> + }
>> >> +
>> >snipped
More information about the dev
mailing list