DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ARP.hpp
Go to the documentation of this file.
1
8#ifndef DPDKLIBS_INCLUDE_DPDKLIBS_ARP_ARP_HPP_
9#define DPDKLIBS_INCLUDE_DPDKLIBS_ARP_ARP_HPP_
10
12#include <cstdint>
13#include <rte_mbuf.h>
14
15namespace dunedaq {
16namespace dpdklibs {
17namespace arp {
18
19// RARP and ARP opcodes
20enum
21{
27};
28
29// Queue flags
30enum
31{
32 CLEAR_FAST_ALLOC_FLAG = 0x00000001, // < Clear the TX fast alloc flag
33 DO_TX_FLUSH = 0x00000002 // Do a TX Flush by sending all of the pkts in the queue
34};
35
36// ethSwap(u16_t * to, u16_t * from) - Swap two 16 bit values
37inline void
38uint16Swap(void* t, void* f)
39{
40 uint16_t* d = (uint16_t*)t;
41 uint16_t* s = (uint16_t*)f;
42 uint16_t v;
43 v = *d;
44 *d = *s;
45 *s = v;
46}
47
48// ethAddrSwap( u16_t * to, u16_t * from ) - Swap two ethernet addresses
49inline void
50ethAddrSwap(void* t, void* f)
51{
52 uint16_t* d = (uint16_t*)t;
53 uint16_t* s = (uint16_t*)f;
54 uint16Swap(d++, s++);
55 uint16Swap(d++, s++);
56 uint16Swap(d, s);
57}
58
59// inetAddrSwap( void * t, void * f ) - Swap two IPv4 addresses
60inline void
61inetAddrSwap(void* t, void* f)
62{
63 uint32_t* d = (uint32_t*)t;
64 uint32_t* s = (uint32_t*)f;
65 uint32_t v;
66 v = *d;
67 *d = *s;
68 *s = v;
69}
70
71/* inetAddrCopy( void * t, void * f ) - Copy IPv4 address */
72inline void
73inetAddrCopy(void* t, void* f)
74{
75 uint32_t* d = (uint32_t*)t;
76 uint32_t* s = (uint32_t*)f;
77
78 *d = *s;
79}
80
81// Send GARP
82void
83pktgen_send_garp(struct rte_mbuf* m, uint32_t port_id, rte_be32_t binary_ip_address);
84
85// Reply to ARP
86void
87pktgen_process_arp(struct rte_mbuf* m, uint32_t pid, rte_be32_t binary_ip_address);
88
89} // namespace arp
90} // namespace dpdklibs
91} // namespace dunedaq
92
93#endif // DPDKLIBS_INCLUDE_DPDKLIBS_ARP_ARP_HPP_
void inetAddrCopy(void *t, void *f)
Definition ARP.hpp:73
void ethAddrSwap(void *t, void *f)
Definition ARP.hpp:50
void pktgen_send_garp(struct rte_mbuf *m, uint32_t port_id, rte_be32_t binary_ip_address)
Definition ARP.cpp:23
void uint16Swap(void *t, void *f)
Definition ARP.hpp:38
void pktgen_process_arp(struct rte_mbuf *m, uint32_t pid, rte_be32_t binary_ip_address)
Definition ARP.cpp:78
void inetAddrSwap(void *t, void *f)
Definition ARP.hpp:61
The DUNE-DAQ namespace.
default char v[0]