DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::dpdklibs Namespace Reference

Namespaces

namespace  arp
namespace  cyclicdatagenerator
namespace  ealutils
namespace  ifaceutils
namespace  nicreader
namespace  nicsender
namespace  opmon
namespace  sender
namespace  udp
namespace  wibeth

Classes

class  BorrowedPoolMap
struct  IfaceXstats
struct  IpAddr
struct  MempoolDeleter
class  SourceConcept
class  SourceModel

Typedefs

using unique_mempool = std::unique_ptr<rte_mempool, MempoolDeleter>

Functions

unique_mempool take_mempool_ownership (std::unique_ptr< rte_mempool > &&legacy)
struct rte_flow * generate_ipv4_flow (uint16_t port_id, uint16_t rx_q, uint32_t src_ip, uint32_t src_mask, uint32_t dest_ip, uint32_t dest_mask, struct rte_flow_error *error)
struct rte_flow * generate_drop_flow (uint16_t port_id, struct rte_flow_error *error)
struct rte_flow * generate_arp_flow (uint16_t port_id, uint16_t rx_q, struct rte_flow_error *error)
std::shared_ptr< SourceConcept > createSourceModel (const appmodel::DataMoveCallbackConf *conf)

Variables

static constexpr uint32_t MAX_PATTERN_NUM = 3
static constexpr uint32_t MAX_ACTION_NUM = 2

Typedef Documentation

◆ unique_mempool

using dunedaq::dpdklibs::unique_mempool = std::unique_ptr<rte_mempool, MempoolDeleter>

Definition at line 42 of file DpdkMempool.hpp.

Function Documentation

◆ createSourceModel()

std::shared_ptr< SourceConcept > dunedaq::dpdklibs::createSourceModel ( const appmodel::DataMoveCallbackConf * conf)

Definition at line 32 of file CreateSource.hpp.

33{
34
35 auto datatype = conf->get_data_type();
36 TLOG() << "Choosing specializations for SourceModel for output connection "
37 << " [uid:" << conf->UID() << " , data_type:" << datatype << ']';
38
39 if (datatype.find("WIBEthFrame") != std::string::npos) {
40 // Create Model
41 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DUNEWIBEthTypeAdapter>>();
42
43 // For callback acquisition later (lazy)
44 source_model->set_sink_config(conf);
45
46 // Return with setup model
47 return source_model;
48
49 } else if (datatype.find("TDEEthFrame") != std::string::npos) {
50
51 // Create Model
52 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::TDEEthTypeAdapter>>();
53
54 // Disable DAQ protocol checks
55 source_model->disable_daq_protocol_checks();
56
57 // For callback acquisition later (lazy)
58 source_model->set_sink_config(conf);
59
60 return source_model;
61
62 } else if (datatype.find("DAPHNEEthFrame") != std::string::npos) {
63 // WIB2 specific char arrays
64 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DAPHNEEthTypeAdapter>>();
65
66 // For callback acquisition later (lazy)
67 source_model->set_sink_config(conf);
68
69 return source_model;
70 } else if (datatype.find("DAPHNEEthStreamFrame") != std::string::npos) {
71 // WIB2 specific char arrays
72 auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter>>();
73
74 // For callback acquisition later (lazy)
75 source_model->set_sink_config(conf);
76
77 return source_model;
78 }
79
80 return nullptr;
81}
const std::string & get_data_type() const
Get "data_type" attribute value. Name of the output data type. Should be defined via a call to DUNE_D...
const std::string & UID() const noexcept
#define TLOG(...)
Definition macro.hpp:21

◆ generate_arp_flow()

struct rte_flow * dunedaq::dpdklibs::generate_arp_flow ( uint16_t port_id,
uint16_t rx_q,
struct rte_flow_error * error )

Definition at line 170 of file FlowControl.cpp.

171{
172 struct rte_flow_attr attr;
173 struct rte_flow_item pattern[MAX_PATTERN_NUM];
174 struct rte_flow_action action[MAX_ACTION_NUM];
175 struct rte_flow* flow = NULL;
176 struct rte_flow_action_queue queue = { .index = rx_q };
177 int res;
178
179 memset(pattern, 0, sizeof(pattern));
180 memset(action, 0, sizeof(action));
181
182 // Set the rule attribute, only ingress packets will be checked.
183 memset(&attr, 0, sizeof(struct rte_flow_attr));
184 attr.ingress = 1;
185 attr.egress = 0;
186 attr.priority = 1; // TODO the higher the lower?
187
188 // Action -> queue steering
189 action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;
190 action[0].conf = &queue;
191 action[1].type = RTE_FLOW_ACTION_TYPE_END;
192
193 // Rule prep
194 struct rte_flow_item_eth item_eth_mask = {};
195 struct rte_flow_item_eth item_eth_spec = {};
196 // Rule marker
197 item_eth_spec.hdr.ether_type = RTE_BE16(RTE_ETHER_TYPE_ARP);
198 item_eth_mask.hdr.ether_type = RTE_BE16(0xFFFF);
199 // Rule pattern
200 pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
201 pattern[0].mask = &item_eth_mask;
202 pattern[0].spec = &item_eth_spec;
203 pattern[1].type = RTE_FLOW_ITEM_TYPE_END;
204
205 // Validate the rule and create it.
206 res = rte_flow_validate(port_id, &attr, pattern, action, error);
207 if (not res) {
208 flow = rte_flow_create(port_id, &attr, pattern, action, error);
209 }
210
211 return flow;
212}
CIB Buffer std::string descriptor Message from std::string descriptor CIB process error

◆ generate_drop_flow()

struct rte_flow * dunedaq::dpdklibs::generate_drop_flow ( uint16_t port_id,
struct rte_flow_error * error )

Definition at line 117 of file FlowControl.cpp.

118{
119 struct rte_flow_attr attr;
120 struct rte_flow_item pattern[MAX_PATTERN_NUM];
121 struct rte_flow_action action[MAX_ACTION_NUM];
122 struct rte_flow* flow = NULL;
123 int res;
124
125 memset(pattern, 0, sizeof(pattern));
126 memset(action, 0, sizeof(action));
127
128 // Set the rule attribute, only ingress packets will be checked.
129 memset(&attr, 0, sizeof(struct rte_flow_attr));
130 attr.ingress = 1;
131 attr.egress = 0;
132 attr.priority = 1; // TODO the higher the lower?
133
134 /*
135 * create the action sequence.
136 * one action only, Drop the packet
137 */
138 action[0].type = RTE_FLOW_ACTION_TYPE_DROP;
139 action[1].type = RTE_FLOW_ACTION_TYPE_END;
140
141 /*
142 * set the first level of the pattern (ETH).
143 * since in this example we just want to get the
144 * ipv4 we set this level to allow all.
145 */
146
147 // Set this level to allow all.
148 pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
149
150 /*
151 * setting the second level of the pattern (IP).
152 * in this example this is the level we care about
153 * so we set it according to the parameters.
154 */
155
156 // The final level must be always type end.
157 pattern[1].type = RTE_FLOW_ITEM_TYPE_END;
158
159 // Validate the rule and create it.
160 res = rte_flow_validate(port_id, &attr, pattern, action, error);
161 if (not res) {
162 flow = rte_flow_create(port_id, &attr, pattern, action, error);
163 }
164
165 return flow;
166}

◆ generate_ipv4_flow()

struct rte_flow * dunedaq::dpdklibs::generate_ipv4_flow ( uint16_t port_id,
uint16_t rx_q,
uint32_t src_ip,
uint32_t src_mask,
uint32_t dest_ip,
uint32_t dest_mask,
struct rte_flow_error * error )

create a flow rule that sends packets with matching src and dest ip to selected queue.

Parameters
port_idThe selected port.
rx_qThe selected target queue.
src_ipThe src ip value to match the input packet.
src_maskThe mask to apply to the src ip.
dest_ipThe dest ip value to match the input packet.
dest_maskThe mask to apply to the dest ip.
[out]errorPerform verbose error reporting if not NULL.
Returns
A flow if the rule could be created else return NULL.

Definition at line 42 of file FlowControl.cpp.

49{
50 // Declaring structs being used.
51 struct rte_flow_attr attr;
52 struct rte_flow_item pattern[MAX_PATTERN_NUM];
53 struct rte_flow_action action[MAX_ACTION_NUM];
54 struct rte_flow* flow = NULL;
55 struct rte_flow_action_queue queue = { .index = rx_q };
56 struct rte_flow_item_ipv4 ip_spec;
57 struct rte_flow_item_ipv4 ip_mask;
58
59 int res;
60
61 memset(pattern, 0, sizeof(pattern));
62 memset(action, 0, sizeof(action));
63
64 // Set the rule attribute, only ingress packets will be checked.
65 memset(&attr, 0, sizeof(struct rte_flow_attr));
66 attr.ingress = 1;
67
68 /*
69 * create the action sequence.
70 * one action only, move packet to queue
71 */
72 action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;
73 action[0].conf = &queue;
74 action[1].type = RTE_FLOW_ACTION_TYPE_END;
75
76 /*
77 * set the first level of the pattern (ETH).
78 * since in this example we just want to get the
79 * ipv4 we set this level to allow all.
80 */
81
82 // Set this level to allow all.
83
84 /*
85 * setting the second level of the pattern (IP).
86 * in this example this is the level we care about
87 * so we set it according to the parameters.
88 */
89
90 // Setting the second level of the pattern.
91 memset(&ip_spec, 0, sizeof(struct rte_flow_item_ipv4));
92 memset(&ip_mask, 0, sizeof(struct rte_flow_item_ipv4));
93 ip_spec.hdr.dst_addr = htonl(dest_ip);
94 ip_mask.hdr.dst_addr = 0;
95 ip_spec.hdr.src_addr = htonl(src_ip);
96 ip_mask.hdr.src_addr = src_mask;
97
98 pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
99
100 pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4;
101 pattern[1].spec = &ip_spec;
102 pattern[1].mask = &ip_mask;
103
104 pattern[2].type = RTE_FLOW_ITEM_TYPE_END;
105
106 // Validate the rule and create it.
107 res = rte_flow_validate(port_id, &attr, pattern, action, error);
108 if (not res) {
109 flow = rte_flow_create(port_id, &attr, pattern, action, error);
110 }
111
112 return flow;
113}

◆ take_mempool_ownership()

unique_mempool dunedaq::dpdklibs::take_mempool_ownership ( std::unique_ptr< rte_mempool > && legacy)

Definition at line 26 of file DpdkMempool.cpp.

27{
28 return unique_mempool(legacy.release());
29}
std::unique_ptr< rte_mempool, MempoolDeleter > unique_mempool

Variable Documentation

◆ MAX_ACTION_NUM

uint32_t dunedaq::dpdklibs::MAX_ACTION_NUM = 2
staticconstexpr

Definition at line 19 of file FlowControl.hpp.

◆ MAX_PATTERN_NUM

uint32_t dunedaq::dpdklibs::MAX_PATTERN_NUM = 3
staticconstexpr

Definition at line 18 of file FlowControl.hpp.