37 #ifndef EM_EVENT_INLINE_H_
38 #define EM_EVENT_INLINE_H_
45 static inline odp_event_t
46 event_em2odp(em_event_t event)
49 evhdl_t evhdl = {.event =
event};
51 return (odp_event_t)(uintptr_t)evhdl.evptr;
60 static inline em_event_t
61 event_odp2em(odp_event_t odp_event)
70 evhdl_t evhdl = {.event = (em_event_t)(uintptr_t)odp_event};
77 events_em2odp(
const em_event_t events[],
78 odp_event_t odp_events[],
const unsigned int num)
83 for (
unsigned int i = 0; i < num; i++)
84 odp_events[i] = (odp_event_t)(uintptr_t)evhdls[i].evptr;
94 events_odp2em(
const odp_event_t odp_events[],
95 em_event_t events[],
const unsigned int num)
105 for (
unsigned int i = 0; i < num; i++)
106 evhdls[i].event = (em_event_t)(uintptr_t)odp_events[i];
114 events_em2pkt(
const em_event_t events[],
115 odp_packet_t odp_pkts[],
const unsigned int num)
120 for (
unsigned int i = 0; i < num; i++)
121 odp_pkts[i] = odp_packet_from_event((odp_event_t)(uintptr_t)evhdls[i].evptr);
134 static inline odp_packet_t *
135 events_em2pkt_inplace(em_event_t events[],
const unsigned int num)
139 odp_packet_t *
const pkts = (odp_packet_t *)events;
142 for (
unsigned int i = 0; i < num; i++)
143 pkts[i] = odp_packet_from_event((odp_event_t)(uintptr_t)evhdls[i].evptr);
160 eventpkt_to_hdr(em_event_t pkt_event)
162 odp_event_t odp_event = event_em2odp(pkt_event);
163 odp_packet_t odp_pkt = odp_packet_from_event(odp_event);
164 event_hdr_t *ev_hdr = odp_packet_user_area(odp_pkt);
181 eventbuf_to_hdr(em_event_t buf_event)
183 odp_event_t odp_event = event_em2odp(buf_event);
184 odp_buffer_t odp_buf = odp_buffer_from_event(odp_event);
185 event_hdr_t *ev_hdr = odp_buffer_user_area(odp_buf);
202 eventvec_to_hdr(em_event_t vector_event)
204 odp_event_t odp_event = event_em2odp(vector_event);
205 odp_packet_vector_t odp_pktvec = odp_packet_vector_from_event(odp_event);
206 event_hdr_t *ev_hdr = odp_packet_vector_user_area(odp_pktvec);
217 event_to_hdr(em_event_t event)
219 odp_event_t odp_event = event_em2odp(event);
220 odp_packet_t odp_pkt;
221 odp_buffer_t odp_buf;
222 odp_timeout_t odp_tmo;
223 odp_packet_vector_t odp_pktvec;
226 odp_event_type_t evtype = odp_event_type(odp_event);
229 case ODP_EVENT_PACKET:
230 odp_pkt = odp_packet_from_event(odp_event);
231 ev_hdr = odp_packet_user_area(odp_pkt);
233 case ODP_EVENT_BUFFER:
234 odp_buf = odp_buffer_from_event(odp_event);
235 ev_hdr = odp_buffer_user_area(odp_buf);
237 case ODP_EVENT_PACKET_VECTOR:
238 odp_pktvec = odp_packet_vector_from_event(odp_event);
239 ev_hdr = odp_packet_vector_user_area(odp_pktvec);
241 case ODP_EVENT_TIMEOUT:
242 odp_tmo = odp_timeout_from_event(odp_event);
243 ev_hdr = odp_timeout_user_area(odp_tmo);
247 EM_ESCOPE_EVENT_TO_HDR,
248 "Unexpected odp event type:%u", evtype);
250 __builtin_unreachable();
268 event_to_hdr_multi(
const em_event_t events[],
event_hdr_t *ev_hdrs[],
271 for (
int i = 0; i < num; i++)
272 ev_hdrs[i] = event_to_hdr(events[i]);
276 static inline em_event_t