On 3/16/23 10:15, Eelco Chaudron wrote: > On 1 Mar 2023, at 8:22, Chris Mi wrote: > >> Iterate each registered offload API. It's not a problem for today >> since we only have one implementation. > > See some comments inline below. > > //Eelco > >> Signed-off-by: Chris Mi <c...@nvidia.com> >> Reviewed-by: Roi Dayan <r...@nvidia.com> >> --- >> lib/netdev-offload.c | 35 +++++++++++++++++++++++++++++++++++ >> lib/netdev-offload.h | 5 +++++ >> 2 files changed, 40 insertions(+) >> >> diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c >> index 4592262bd..d6e3e4946 100644 >> --- a/lib/netdev-offload.c >> +++ b/lib/netdev-offload.c >> @@ -256,6 +256,41 @@ meter_offload_del(ofproto_meter_id meter_id, struct >> ofputil_meter_stats *stats) >> return 0; >> } >> >> +int >> +netdev_offload_recv(struct dpif_upcall *upcall, struct ofpbuf *buf, >> + uint32_t handler_id) >> +{ >> + struct netdev_registered_flow_api *rfa; >> + int ret = EAGAIN; >> + >> + CMAP_FOR_EACH (rfa, cmap_node, &netdev_flow_apis) { >> + if (rfa->flow_api->recv) { >> + ret = rfa->flow_api->recv(upcall, buf, handler_id); >> + if (ret) { >> + VLOG_DBG_RL(&rl, "Failed to receive offload packet, %s, " >> + "type: %s", ovs_strerror(ret), >> + rfa->flow_api->type); >> + } else { >> + return ret; > > So how would this work if two or more offloads support this API? > > Only if the first one returns an error (if no packets are waiting, what would > the error be, we might want to exclude the debug message?), the second one is > tried. > > Also what about one starving the other?
I guess, it was my suggestion to keep it simple for now and ignore the possible starvation. :) I'm not really sure if rte_flow will actually have API like this in a near future. We could introduce a different iteration way here when necessary. i.e. have a sequence number and call recv() first on APIs that have older value. But right now it's probably not worth it. What do you think? Not logging on EAGAIN or something like that is a good idea though. Best regards, Ilya Maximets. _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev