2 * Copyright (c) 2016 Intel Corporation.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef _UDP_STREAM_H_
17 #define _UDP_STREAM_H_
20 #include <tle_dring.h>
22 #include <tle_event.h>
41 struct tle_udp_stream {
48 struct tle_stream_cb cb;
50 } rx __rte_cache_aligned;
55 uint32_t nb_elem; /* number of obects per drb. */
56 uint32_t nb_max; /* number of drbs per stream. */
60 struct tle_stream_cb cb;
61 } tx __rte_cache_aligned;
63 struct tle_udp_stream_param prm;
64 } __rte_cache_aligned;
66 #define UDP_STREAM(p) \
67 ((struct tle_udp_stream *)((uintptr_t)(p) - offsetof(struct tle_udp_stream, s)))
69 #define UDP_STREAM_TX_PENDING(s) \
70 ((s)->tx.drb.nb_max != rte_ring_count((s)->tx.drb.r))
72 #define UDP_STREAM_TX_FINISHED(s) \
73 ((s)->tx.drb.nb_max == rte_ring_count((s)->tx.drb.r))
79 #endif /* _UDP_STREAM_H_ */