1 #![allow(
2 dead_code,
3 non_snake_case,
4 non_camel_case_types,
5 non_upper_case_globals
6 )]
7
8 #[repr(C)]
9 #[derive(Default)]
10 pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
11 impl<T> __IncompleteArrayField<T> {
12 #[inline]
new() -> Self13 pub const fn new() -> Self {
14 __IncompleteArrayField(::std::marker::PhantomData, [])
15 }
16 #[inline]
as_ptr(&self) -> *const T17 pub fn as_ptr(&self) -> *const T {
18 self as *const _ as *const T
19 }
20 #[inline]
as_mut_ptr(&mut self) -> *mut T21 pub fn as_mut_ptr(&mut self) -> *mut T {
22 self as *mut _ as *mut T
23 }
24 #[inline]
as_slice(&self, len: usize) -> &[T]25 pub unsafe fn as_slice(&self, len: usize) -> &[T] {
26 ::std::slice::from_raw_parts(self.as_ptr(), len)
27 }
28 #[inline]
as_mut_slice(&mut self, len: usize) -> &mut [T]29 pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
30 ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
31 }
32 }
33 impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result34 fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
35 fmt.write_str("__IncompleteArrayField")
36 }
37 }
38 pub const RTE_CACHE_LINE_SIZE: u32 = 64;
39 pub const RTE_LIBRTE_IP_FRAG_MAX_FRAG: u32 = 4;
40 pub const IP_LAST_FRAG_IDX: _bindgen_ty_1 = _bindgen_ty_1::IP_LAST_FRAG_IDX;
41 pub const IP_FIRST_FRAG_IDX: _bindgen_ty_1 = _bindgen_ty_1::IP_FIRST_FRAG_IDX;
42 pub const IP_MIN_FRAG_NUM: _bindgen_ty_1 = _bindgen_ty_1::IP_MIN_FRAG_NUM;
43 pub const IP_MAX_FRAG_NUM: _bindgen_ty_1 = _bindgen_ty_1::IP_MAX_FRAG_NUM;
44 #[repr(u32)]
45 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
46 pub enum _bindgen_ty_1 {
47 ///< index of last fragment
48 IP_LAST_FRAG_IDX = 0,
49 ///< index of first fragment
50 IP_FIRST_FRAG_IDX = 1,
51 ///< minimum number of fragments
52 IP_MIN_FRAG_NUM = 2,
53 IP_MAX_FRAG_NUM = 4,
54 }
55 /// @internal fragmented mbuf
56 #[repr(C)]
57 #[derive(Debug, Copy, Clone)]
58 pub struct ip_frag {
59 ///< offset into the packet
60 pub ofs: u16,
61 ///< length of fragment
62 pub len: u16,
63 ///< fragment mbuf
64 pub mb: *mut rte_mbuf,
65 }
66 #[test]
bindgen_test_layout_ip_frag()67 fn bindgen_test_layout_ip_frag() {
68 const UNINIT: ::std::mem::MaybeUninit<ip_frag> =
69 ::std::mem::MaybeUninit::uninit();
70 let ptr = UNINIT.as_ptr();
71 assert_eq!(
72 ::std::mem::size_of::<ip_frag>(),
73 16usize,
74 concat!("Size of: ", stringify!(ip_frag))
75 );
76 assert_eq!(
77 ::std::mem::align_of::<ip_frag>(),
78 8usize,
79 concat!("Alignment of ", stringify!(ip_frag))
80 );
81 assert_eq!(
82 unsafe { ::std::ptr::addr_of!((*ptr).ofs) as usize - ptr as usize },
83 0usize,
84 concat!(
85 "Offset of field: ",
86 stringify!(ip_frag),
87 "::",
88 stringify!(ofs)
89 )
90 );
91 assert_eq!(
92 unsafe { ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize },
93 2usize,
94 concat!(
95 "Offset of field: ",
96 stringify!(ip_frag),
97 "::",
98 stringify!(len)
99 )
100 );
101 assert_eq!(
102 unsafe { ::std::ptr::addr_of!((*ptr).mb) as usize - ptr as usize },
103 8usize,
104 concat!(
105 "Offset of field: ",
106 stringify!(ip_frag),
107 "::",
108 stringify!(mb)
109 )
110 );
111 }
112 impl Default for ip_frag {
default() -> Self113 fn default() -> Self {
114 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
115 unsafe {
116 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
117 s.assume_init()
118 }
119 }
120 }
121 /// @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram.
122 #[repr(C)]
123 #[derive(Debug, Default, Copy, Clone)]
124 pub struct ip_frag_key {
125 ///< src address, first 8 bytes used for IPv4
126 pub src_dst: [u64; 4usize],
127 ///< dst address
128 pub id: u32,
129 ///< src/dst key length
130 pub key_len: u32,
131 }
132 #[test]
bindgen_test_layout_ip_frag_key()133 fn bindgen_test_layout_ip_frag_key() {
134 const UNINIT: ::std::mem::MaybeUninit<ip_frag_key> =
135 ::std::mem::MaybeUninit::uninit();
136 let ptr = UNINIT.as_ptr();
137 assert_eq!(
138 ::std::mem::size_of::<ip_frag_key>(),
139 40usize,
140 concat!("Size of: ", stringify!(ip_frag_key))
141 );
142 assert_eq!(
143 ::std::mem::align_of::<ip_frag_key>(),
144 8usize,
145 concat!("Alignment of ", stringify!(ip_frag_key))
146 );
147 assert_eq!(
148 unsafe { ::std::ptr::addr_of!((*ptr).src_dst) as usize - ptr as usize },
149 0usize,
150 concat!(
151 "Offset of field: ",
152 stringify!(ip_frag_key),
153 "::",
154 stringify!(src_dst)
155 )
156 );
157 assert_eq!(
158 unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize },
159 32usize,
160 concat!(
161 "Offset of field: ",
162 stringify!(ip_frag_key),
163 "::",
164 stringify!(id)
165 )
166 );
167 assert_eq!(
168 unsafe { ::std::ptr::addr_of!((*ptr).key_len) as usize - ptr as usize },
169 36usize,
170 concat!(
171 "Offset of field: ",
172 stringify!(ip_frag_key),
173 "::",
174 stringify!(key_len)
175 )
176 );
177 }
178 /// @internal Fragmented packet to reassemble.
179 /// First two entries in the frags[] array are for the last and first fragments.
180 #[repr(C)]
181 #[repr(align(64))]
182 #[derive(Copy, Clone)]
183 pub struct ip_frag_pkt {
184 ///< LRU list
185 pub lru: ip_frag_pkt__bindgen_ty_1,
186 ///< fragmentation key
187 pub key: ip_frag_key,
188 ///< creation timestamp
189 pub start: u64,
190 ///< expected reassembled size
191 pub total_size: u32,
192 ///< size of fragments received
193 pub frag_size: u32,
194 ///< index of next entry to fill
195 pub last_idx: u32,
196 ///< fragments
197 pub frags: [ip_frag; 4usize],
198 }
199 #[repr(C)]
200 #[derive(Debug, Copy, Clone)]
201 pub struct ip_frag_pkt__bindgen_ty_1 {
202 pub tqe_next: *mut ip_frag_pkt,
203 pub tqe_prev: *mut *mut ip_frag_pkt,
204 }
205 #[test]
bindgen_test_layout_ip_frag_pkt__bindgen_ty_1()206 fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() {
207 const UNINIT: ::std::mem::MaybeUninit<ip_frag_pkt__bindgen_ty_1> =
208 ::std::mem::MaybeUninit::uninit();
209 let ptr = UNINIT.as_ptr();
210 assert_eq!(
211 ::std::mem::size_of::<ip_frag_pkt__bindgen_ty_1>(),
212 16usize,
213 concat!("Size of: ", stringify!(ip_frag_pkt__bindgen_ty_1))
214 );
215 assert_eq!(
216 ::std::mem::align_of::<ip_frag_pkt__bindgen_ty_1>(),
217 8usize,
218 concat!("Alignment of ", stringify!(ip_frag_pkt__bindgen_ty_1))
219 );
220 assert_eq!(
221 unsafe {
222 ::std::ptr::addr_of!((*ptr).tqe_next) as usize - ptr as usize
223 },
224 0usize,
225 concat!(
226 "Offset of field: ",
227 stringify!(ip_frag_pkt__bindgen_ty_1),
228 "::",
229 stringify!(tqe_next)
230 )
231 );
232 assert_eq!(
233 unsafe {
234 ::std::ptr::addr_of!((*ptr).tqe_prev) as usize - ptr as usize
235 },
236 8usize,
237 concat!(
238 "Offset of field: ",
239 stringify!(ip_frag_pkt__bindgen_ty_1),
240 "::",
241 stringify!(tqe_prev)
242 )
243 );
244 }
245 impl Default for ip_frag_pkt__bindgen_ty_1 {
default() -> Self246 fn default() -> Self {
247 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
248 unsafe {
249 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
250 s.assume_init()
251 }
252 }
253 }
254 #[test]
bindgen_test_layout_ip_frag_pkt()255 fn bindgen_test_layout_ip_frag_pkt() {
256 const UNINIT: ::std::mem::MaybeUninit<ip_frag_pkt> =
257 ::std::mem::MaybeUninit::uninit();
258 let ptr = UNINIT.as_ptr();
259 assert_eq!(
260 ::std::mem::size_of::<ip_frag_pkt>(),
261 192usize,
262 concat!("Size of: ", stringify!(ip_frag_pkt))
263 );
264 assert_eq!(
265 ::std::mem::align_of::<ip_frag_pkt>(),
266 64usize,
267 concat!("Alignment of ", stringify!(ip_frag_pkt))
268 );
269 assert_eq!(
270 unsafe { ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize },
271 0usize,
272 concat!(
273 "Offset of field: ",
274 stringify!(ip_frag_pkt),
275 "::",
276 stringify!(lru)
277 )
278 );
279 assert_eq!(
280 unsafe { ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize },
281 16usize,
282 concat!(
283 "Offset of field: ",
284 stringify!(ip_frag_pkt),
285 "::",
286 stringify!(key)
287 )
288 );
289 assert_eq!(
290 unsafe { ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize },
291 56usize,
292 concat!(
293 "Offset of field: ",
294 stringify!(ip_frag_pkt),
295 "::",
296 stringify!(start)
297 )
298 );
299 assert_eq!(
300 unsafe {
301 ::std::ptr::addr_of!((*ptr).total_size) as usize - ptr as usize
302 },
303 64usize,
304 concat!(
305 "Offset of field: ",
306 stringify!(ip_frag_pkt),
307 "::",
308 stringify!(total_size)
309 )
310 );
311 assert_eq!(
312 unsafe {
313 ::std::ptr::addr_of!((*ptr).frag_size) as usize - ptr as usize
314 },
315 68usize,
316 concat!(
317 "Offset of field: ",
318 stringify!(ip_frag_pkt),
319 "::",
320 stringify!(frag_size)
321 )
322 );
323 assert_eq!(
324 unsafe {
325 ::std::ptr::addr_of!((*ptr).last_idx) as usize - ptr as usize
326 },
327 72usize,
328 concat!(
329 "Offset of field: ",
330 stringify!(ip_frag_pkt),
331 "::",
332 stringify!(last_idx)
333 )
334 );
335 assert_eq!(
336 unsafe { ::std::ptr::addr_of!((*ptr).frags) as usize - ptr as usize },
337 80usize,
338 concat!(
339 "Offset of field: ",
340 stringify!(ip_frag_pkt),
341 "::",
342 stringify!(frags)
343 )
344 );
345 }
346 impl Default for ip_frag_pkt {
default() -> Self347 fn default() -> Self {
348 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
349 unsafe {
350 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
351 s.assume_init()
352 }
353 }
354 }
355 #[repr(C)]
356 #[derive(Debug, Copy, Clone)]
357 pub struct ip_pkt_list {
358 pub tqh_first: *mut ip_frag_pkt,
359 pub tqh_last: *mut *mut ip_frag_pkt,
360 }
361 #[test]
bindgen_test_layout_ip_pkt_list()362 fn bindgen_test_layout_ip_pkt_list() {
363 const UNINIT: ::std::mem::MaybeUninit<ip_pkt_list> =
364 ::std::mem::MaybeUninit::uninit();
365 let ptr = UNINIT.as_ptr();
366 assert_eq!(
367 ::std::mem::size_of::<ip_pkt_list>(),
368 16usize,
369 concat!("Size of: ", stringify!(ip_pkt_list))
370 );
371 assert_eq!(
372 ::std::mem::align_of::<ip_pkt_list>(),
373 8usize,
374 concat!("Alignment of ", stringify!(ip_pkt_list))
375 );
376 assert_eq!(
377 unsafe {
378 ::std::ptr::addr_of!((*ptr).tqh_first) as usize - ptr as usize
379 },
380 0usize,
381 concat!(
382 "Offset of field: ",
383 stringify!(ip_pkt_list),
384 "::",
385 stringify!(tqh_first)
386 )
387 );
388 assert_eq!(
389 unsafe {
390 ::std::ptr::addr_of!((*ptr).tqh_last) as usize - ptr as usize
391 },
392 8usize,
393 concat!(
394 "Offset of field: ",
395 stringify!(ip_pkt_list),
396 "::",
397 stringify!(tqh_last)
398 )
399 );
400 }
401 impl Default for ip_pkt_list {
default() -> Self402 fn default() -> Self {
403 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
404 unsafe {
405 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
406 s.assume_init()
407 }
408 }
409 }
410 /// fragmentation table statistics
411 #[repr(C)]
412 #[repr(align(64))]
413 #[derive(Copy, Clone)]
414 pub struct ip_frag_tbl_stat {
415 ///< total # of find/insert attempts.
416 pub find_num: u64,
417 ///< # of add ops.
418 pub add_num: u64,
419 ///< # of del ops.
420 pub del_num: u64,
421 ///< # of reuse (del/add) ops.
422 pub reuse_num: u64,
423 ///< total # of add failures.
424 pub fail_total: u64,
425 ///< # of 'no space' add failures.
426 pub fail_nospace: u64,
427 }
428 #[test]
bindgen_test_layout_ip_frag_tbl_stat()429 fn bindgen_test_layout_ip_frag_tbl_stat() {
430 const UNINIT: ::std::mem::MaybeUninit<ip_frag_tbl_stat> =
431 ::std::mem::MaybeUninit::uninit();
432 let ptr = UNINIT.as_ptr();
433 assert_eq!(
434 ::std::mem::size_of::<ip_frag_tbl_stat>(),
435 64usize,
436 concat!("Size of: ", stringify!(ip_frag_tbl_stat))
437 );
438 assert_eq!(
439 ::std::mem::align_of::<ip_frag_tbl_stat>(),
440 64usize,
441 concat!("Alignment of ", stringify!(ip_frag_tbl_stat))
442 );
443 assert_eq!(
444 unsafe {
445 ::std::ptr::addr_of!((*ptr).find_num) as usize - ptr as usize
446 },
447 0usize,
448 concat!(
449 "Offset of field: ",
450 stringify!(ip_frag_tbl_stat),
451 "::",
452 stringify!(find_num)
453 )
454 );
455 assert_eq!(
456 unsafe { ::std::ptr::addr_of!((*ptr).add_num) as usize - ptr as usize },
457 8usize,
458 concat!(
459 "Offset of field: ",
460 stringify!(ip_frag_tbl_stat),
461 "::",
462 stringify!(add_num)
463 )
464 );
465 assert_eq!(
466 unsafe { ::std::ptr::addr_of!((*ptr).del_num) as usize - ptr as usize },
467 16usize,
468 concat!(
469 "Offset of field: ",
470 stringify!(ip_frag_tbl_stat),
471 "::",
472 stringify!(del_num)
473 )
474 );
475 assert_eq!(
476 unsafe {
477 ::std::ptr::addr_of!((*ptr).reuse_num) as usize - ptr as usize
478 },
479 24usize,
480 concat!(
481 "Offset of field: ",
482 stringify!(ip_frag_tbl_stat),
483 "::",
484 stringify!(reuse_num)
485 )
486 );
487 assert_eq!(
488 unsafe {
489 ::std::ptr::addr_of!((*ptr).fail_total) as usize - ptr as usize
490 },
491 32usize,
492 concat!(
493 "Offset of field: ",
494 stringify!(ip_frag_tbl_stat),
495 "::",
496 stringify!(fail_total)
497 )
498 );
499 assert_eq!(
500 unsafe {
501 ::std::ptr::addr_of!((*ptr).fail_nospace) as usize - ptr as usize
502 },
503 40usize,
504 concat!(
505 "Offset of field: ",
506 stringify!(ip_frag_tbl_stat),
507 "::",
508 stringify!(fail_nospace)
509 )
510 );
511 }
512 impl Default for ip_frag_tbl_stat {
default() -> Self513 fn default() -> Self {
514 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
515 unsafe {
516 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
517 s.assume_init()
518 }
519 }
520 }
521 /// fragmentation table
522 #[repr(C)]
523 #[repr(align(64))]
524 pub struct rte_ip_frag_tbl {
525 ///< ttl for table entries.
526 pub max_cycles: u64,
527 ///< hash value mask.
528 pub entry_mask: u32,
529 ///< max entries allowed.
530 pub max_entries: u32,
531 ///< entries in use.
532 pub use_entries: u32,
533 ///< hash assocaitivity.
534 pub bucket_entries: u32,
535 ///< total size of the table.
536 pub nb_entries: u32,
537 ///< num of associativity lines.
538 pub nb_buckets: u32,
539 ///< last used entry.
540 pub last: *mut ip_frag_pkt,
541 ///< LRU list for table entries.
542 pub lru: ip_pkt_list,
543 pub __bindgen_padding_0: u64,
544 ///< statistics counters.
545 pub stat: ip_frag_tbl_stat,
546 ///< hash table.
547 pub pkt: __IncompleteArrayField<ip_frag_pkt>,
548 }
549 #[test]
bindgen_test_layout_rte_ip_frag_tbl()550 fn bindgen_test_layout_rte_ip_frag_tbl() {
551 const UNINIT: ::std::mem::MaybeUninit<rte_ip_frag_tbl> =
552 ::std::mem::MaybeUninit::uninit();
553 let ptr = UNINIT.as_ptr();
554 assert_eq!(
555 ::std::mem::size_of::<rte_ip_frag_tbl>(),
556 128usize,
557 concat!("Size of: ", stringify!(rte_ip_frag_tbl))
558 );
559 assert_eq!(
560 ::std::mem::align_of::<rte_ip_frag_tbl>(),
561 64usize,
562 concat!("Alignment of ", stringify!(rte_ip_frag_tbl))
563 );
564 assert_eq!(
565 unsafe {
566 ::std::ptr::addr_of!((*ptr).max_cycles) as usize - ptr as usize
567 },
568 0usize,
569 concat!(
570 "Offset of field: ",
571 stringify!(rte_ip_frag_tbl),
572 "::",
573 stringify!(max_cycles)
574 )
575 );
576 assert_eq!(
577 unsafe {
578 ::std::ptr::addr_of!((*ptr).entry_mask) as usize - ptr as usize
579 },
580 8usize,
581 concat!(
582 "Offset of field: ",
583 stringify!(rte_ip_frag_tbl),
584 "::",
585 stringify!(entry_mask)
586 )
587 );
588 assert_eq!(
589 unsafe {
590 ::std::ptr::addr_of!((*ptr).max_entries) as usize - ptr as usize
591 },
592 12usize,
593 concat!(
594 "Offset of field: ",
595 stringify!(rte_ip_frag_tbl),
596 "::",
597 stringify!(max_entries)
598 )
599 );
600 assert_eq!(
601 unsafe {
602 ::std::ptr::addr_of!((*ptr).use_entries) as usize - ptr as usize
603 },
604 16usize,
605 concat!(
606 "Offset of field: ",
607 stringify!(rte_ip_frag_tbl),
608 "::",
609 stringify!(use_entries)
610 )
611 );
612 assert_eq!(
613 unsafe {
614 ::std::ptr::addr_of!((*ptr).bucket_entries) as usize - ptr as usize
615 },
616 20usize,
617 concat!(
618 "Offset of field: ",
619 stringify!(rte_ip_frag_tbl),
620 "::",
621 stringify!(bucket_entries)
622 )
623 );
624 assert_eq!(
625 unsafe {
626 ::std::ptr::addr_of!((*ptr).nb_entries) as usize - ptr as usize
627 },
628 24usize,
629 concat!(
630 "Offset of field: ",
631 stringify!(rte_ip_frag_tbl),
632 "::",
633 stringify!(nb_entries)
634 )
635 );
636 assert_eq!(
637 unsafe {
638 ::std::ptr::addr_of!((*ptr).nb_buckets) as usize - ptr as usize
639 },
640 28usize,
641 concat!(
642 "Offset of field: ",
643 stringify!(rte_ip_frag_tbl),
644 "::",
645 stringify!(nb_buckets)
646 )
647 );
648 assert_eq!(
649 unsafe { ::std::ptr::addr_of!((*ptr).last) as usize - ptr as usize },
650 32usize,
651 concat!(
652 "Offset of field: ",
653 stringify!(rte_ip_frag_tbl),
654 "::",
655 stringify!(last)
656 )
657 );
658 assert_eq!(
659 unsafe { ::std::ptr::addr_of!((*ptr).lru) as usize - ptr as usize },
660 40usize,
661 concat!(
662 "Offset of field: ",
663 stringify!(rte_ip_frag_tbl),
664 "::",
665 stringify!(lru)
666 )
667 );
668 assert_eq!(
669 unsafe { ::std::ptr::addr_of!((*ptr).stat) as usize - ptr as usize },
670 64usize,
671 concat!(
672 "Offset of field: ",
673 stringify!(rte_ip_frag_tbl),
674 "::",
675 stringify!(stat)
676 )
677 );
678 assert_eq!(
679 unsafe { ::std::ptr::addr_of!((*ptr).pkt) as usize - ptr as usize },
680 128usize,
681 concat!(
682 "Offset of field: ",
683 stringify!(rte_ip_frag_tbl),
684 "::",
685 stringify!(pkt)
686 )
687 );
688 }
689 impl Default for rte_ip_frag_tbl {
default() -> Self690 fn default() -> Self {
691 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
692 unsafe {
693 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
694 s.assume_init()
695 }
696 }
697 }
698 ///< fragment mbuf
699 #[repr(C)]
700 #[derive(Debug, Default, Copy, Clone)]
701 pub struct rte_mbuf {
702 pub _address: u8,
703 }
704