Debian Codegraph @

src/tsn_thread.c

raw symbols SCIP
1 // SPDX-License-Identifier: BSD-2-Clausecxx . . $ `<file>/src/tsn_thread.c`/
2 /*
3 * Copyright (C) 2021-2025 Linutronix GmbH
4 * Author Kurt Kanzenbach <[email protected]>
5 */
6
7 #include <endian.h>
8 #include <errno.h>
9 #include <pthread.h>
10 #include <signal.h>
11 #include <stdint.h>
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <string.h>
15 #include <unistd.h>
16
17 #include <arpa/inet.h>
18
19 #include <linux/if_ether.h>
20 #include <linux/if_link.h>
21 #include <linux/if_packet.h>
22 #include <linux/if_vlan.h>
23
24 #include "app_config.h"cxx . . $ `<file>/build/app_config.h`/
25
26 #include "config.h"cxx . . $ `<file>/src/config.h`/
27 #include "log.h"cxx . . $ `<file>/src/log.h`/
28 #include "net.h"cxx . . $ `<file>/src/net.h`/
29 #include "net_def.h"cxx . . $ `<file>/src/net_def.h`/
30 #include "packet.h"cxx . . $ `<file>/src/packet.h`/
31 #include "security.h"cxx . . $ `<file>/src/security.h`/
32 #include "stat.h"cxx . . $ `<file>/src/stat.h`/
33 #include "thread.h"cxx . . $ `<file>/src/thread.h`/
34 #include "tsn_thread.h"cxx . . $ `<file>/src/tsn_thread.h`/
35 #include "tx_time.h"cxx . . $ `<file>/src/tx_time.h`/
36 #include "utils.h"cxx . . $ `<file>/src/utils.h`/
37 #include "workload.h"cxx . . $ `<file>/src/workload.h`/
38 #include "xdp.h"cxx . . $ `<file>/src/xdp.h`/
39
40 static void tsn_initialize_framescxx . . $ tsn_initialize_frames(e1a9c3903a216417).(struct thread_contextcxx . . $ thread_context# *thread_context, unsigned char *frame_data,
41 size_t num_frames, const unsigned char *source,
42 const unsigned char *destination)
43 {
44 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config = thread_context->confcxx . . $ thread_context#conf.;
45 size_t i;
46
47 for (i = 0; i < num_frames; ++i) {
48 unsigned char *frame = frame_idxcxx . . $ frame_idx(9d0786fb5198b4b4).(frame_data, i);
49 size_t frame_length = MAX_FRAME_SIZEcxx . . $ `src/thread.h:23:9`!;
50
51 /*
52 * In case both AF_XDP and Tx Launch Time or Tx HW Timestamp are enabled the payload
53 * starts at: frame_data + sizeof(struct xsk_tx_metadata)
54 */
55 #if defined(HAVE_XDP_TX_TIMEcxx . . $ `build/app_config.h:17:9`!) || defined(TX_TIMESTAMP)
56 if (tsn_config->xdp_enabledcxx . . $ traffic_class_config#xdp_enabled. &&
57 (tsn_config->tx_time_enabledcxx . . $ traffic_class_config#tx_time_enabled. || tsn_config->tx_hwtstamp_enabledcxx . . $ traffic_class_config#tx_hwtstamp_enabled.)) {
58 frame += sizeof(struct xsk_tx_metadatacxx . . $ xsk_tx_metadata#);
59 frame_length -= sizeof(struct xsk_tx_metadatacxx . . $ xsk_tx_metadata#);
60 }
61 #endif
62
63 initialize_profinet_framecxx . . $ initialize_profinet_frame(305659cd59e50ce5).(tsn_config->security_modecxx . . $ traffic_class_config#security_mode., frame, frame_length, source,
64 destination, tsn_config->payload_patterncxx . . $ traffic_class_config#payload_pattern.,
65 tsn_config->payload_pattern_lengthcxx . . $ traffic_class_config#payload_pattern_length.,
66 tsn_config->vidcxx . . $ traffic_class_config#vid. | tsn_config->pcpcxx . . $ traffic_class_config#pcp. << VLAN_PCP_SHIFTcxx . . $ `src/net_def.h:26:9`!,
67 thread_context->frame_idcxx . . $ thread_context#frame_id.);
68 }
69 }
70
71 static int tsn_send_messagescxx . . $ tsn_send_messages(80bab491920559ba).(struct thread_contextcxx . . $ thread_context# *thread_context, int socket_fd,
72 struct sockaddr_llcxx . . $ sockaddr_ll# *destination, unsigned char *frame_data,
73 size_t num_frames, uint64_tcxx . . $ uint64_t# duration)
74 {
75 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config = thread_context->confcxx . . $ thread_context#conf.;
76 struct packet_send_requestcxx . . $ packet_send_request# send_req = {
77 .traffic_class = thread_context->traffic_classcxx . . $ thread_context#traffic_class.,
78 .socket_fd = socket_fd,
79 .destination = destination,
80 .frame_data = frame_data,
81 .num_frames = num_frames,
82 .frame_length = tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length.,
83 .duration = duration,
84 .tx_time_offset = tsn_config->tx_time_offset_nscxx . . $ traffic_class_config#tx_time_offset_ns.,
85 .meta_data_offset = thread_context->meta_data_offsetcxx . . $ thread_context#meta_data_offset.,
86 .mirror_enabled = tsn_config->rx_mirror_enabledcxx . . $ traffic_class_config#rx_mirror_enabled.,
87 .tx_time_enabled = tsn_config->tx_time_enabledcxx . . $ traffic_class_config#tx_time_enabled.,
88 };
89
90 return packet_send_messagescxx . . $ packet_send_messages(db4d6f7226235983).(thread_context->packet_contextcxx . . $ thread_context#packet_context., &send_req);
91 }
92
93 static int tsn_send_framescxx . . $ tsn_send_frames(53779637f63d9f2f).(struct thread_contextcxx . . $ thread_context# *thread_context, unsigned char *frame_data,
94 size_t num_frames, int socket_fd, struct sockaddr_llcxx . . $ sockaddr_ll# *destination,
95 uint64_tcxx . . $ uint64_t# duration)
96 {
97 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config = thread_context->confcxx . . $ thread_context#conf.;
98 int len, i;
99
100 /* Send it */
101 len = tsn_send_messagescxx . . $ tsn_send_messages(80bab491920559ba).(thread_context, socket_fd, destination, frame_data, num_frames,
102 duration);
103
104 for (i = 0; i < len; i++) {
105 uint64_tcxx . . $ uint64_t# sequence_counter;
106
107 sequence_counter = get_sequence_countercxx . . $ get_sequence_counter(9512b04a879eebb0).(frame_data + i * tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length.,
108 thread_context->meta_data_offsetcxx . . $ thread_context#meta_data_offset.,
109 tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.);
110
111 stat_frame_sentcxx . . $ stat_frame_sent(ca48c151307d73b6).(thread_context->frame_typecxx . . $ thread_context#frame_type., sequence_counter);
112 }
113
114 return len;
115 }
116
117 static int tsn_gen_and_send_framescxx . . $ tsn_gen_and_send_frames(38122402ce3c681d).(struct thread_contextcxx . . $ thread_context# *thread_context, int socket_fd,
118 struct sockaddr_llcxx . . $ sockaddr_ll# *destination, uint64_tcxx . . $ uint64_t# wakeup_time,
119 uint64_tcxx . . $ uint64_t# sequence_counter_begin, uint64_tcxx . . $ uint64_t# duration)
120 {
121 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config = thread_context->confcxx . . $ thread_context#conf.;
122 struct timespeccxx . . $ timespec# tx_time = {};
123 int len, i;
124
125 clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(app_configcxx . . $ app_config..application_clock_idcxx . . $ application_config#application_clock_id., &tx_time);
126
127 for (i = 0; i < tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.; i++) {
128 struct prepare_frame_configcxx . . $ prepare_frame_config# frame_config;
129 int err;
130
131 frame_config.modecxx . . $ prepare_frame_config#mode. = tsn_config->security_modecxx . . $ traffic_class_config#security_mode.;
132 frame_config.security_contextcxx . . $ prepare_frame_config#security_context. = thread_context->tx_security_contextcxx . . $ thread_context#tx_security_context.;
133 frame_config.iv_prefixcxx . . $ prepare_frame_config#iv_prefix. = (const unsigned char *)tsn_config->security_iv_prefixcxx . . $ traffic_class_config#security_iv_prefix.;
134 frame_config.payload_patterncxx . . $ prepare_frame_config#payload_pattern. = thread_context->payload_patterncxx . . $ thread_context#payload_pattern.;
135 frame_config.payload_pattern_lengthcxx . . $ prepare_frame_config#payload_pattern_length. = thread_context->payload_pattern_lengthcxx . . $ thread_context#payload_pattern_length.;
136 frame_config.frame_datacxx . . $ prepare_frame_config#frame_data. = frame_idxcxx . . $ frame_idx(9d0786fb5198b4b4).(thread_context->tx_frame_datacxx . . $ thread_context#tx_frame_data., i);
137 frame_config.frame_lengthcxx . . $ prepare_frame_config#frame_length. = tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length.;
138 frame_config.num_frames_per_cyclecxx . . $ prepare_frame_config#num_frames_per_cycle. = tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.;
139 frame_config.sequence_countercxx . . $ prepare_frame_config#sequence_counter. = sequence_counter_begin + i;
140 frame_config.tx_timestampcxx . . $ prepare_frame_config#tx_timestamp. = ts_to_nscxx . . $ ts_to_ns(3d5e857b70563169).(&tx_time);
141 frame_config.meta_data_offsetcxx . . $ prepare_frame_config#meta_data_offset. = thread_context->meta_data_offsetcxx . . $ thread_context#meta_data_offset.;
142
143 err = prepare_frame_for_txcxx . . $ prepare_frame_for_tx(f7c7fe1588440d5a).(&frame_config);
144 if (err)
145 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: Failed to prepare frame for Tx!\n",
146 thread_context->traffic_classcxx . . $ thread_context#traffic_class.);
147 }
148
149 /* Send them */
150 len = tsn_send_messagescxx . . $ tsn_send_messages(80bab491920559ba).(thread_context, socket_fd, destination,
151 thread_context->tx_frame_datacxx . . $ thread_context#tx_frame_data., tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.,
152 duration);
153
154 for (i = 0; i < len; i++)
155 stat_frame_sentcxx . . $ stat_frame_sent(ca48c151307d73b6).(thread_context->frame_typecxx . . $ thread_context#frame_type., sequence_counter_begin + i);
156
157 return len;
158 }
159
160 static void tsn_gen_and_send_xdp_framescxx . . $ tsn_gen_and_send_xdp_frames(cee47f915e8bd974).(struct thread_contextcxx . . $ thread_context# *thread_context,
161 struct xdp_socketcxx . . $ xdp_socket# *xsk, uint64_tcxx . . $ uint64_t# sequence_counter,
162 uint64_tcxx . . $ uint64_t# wakeup_time, uint64_tcxx . . $ uint64_t# duration,
163 uint32_tcxx . . $ uint32_t# *frame_number)
164 {
165 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config = thread_context->confcxx . . $ thread_context#conf.;
166 struct xdp_tx_timecxx . . $ xdp_tx_time# tx_time = {
167 .traffic_class = thread_context->traffic_classcxx . . $ thread_context#traffic_class.,
168 .tx_time_offset = tsn_config->tx_time_offset_nscxx . . $ traffic_class_config#tx_time_offset_ns.,
169 .num_frames_per_cycle = tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.,
170 .sequence_counter_begin = sequence_counter,
171 .duration = duration,
172 };
173 struct xdp_gen_configcxx . . $ xdp_gen_config# xdp = {
174 .mode = tsn_config->security_modecxx . . $ traffic_class_config#security_mode.,
175 .security_context = thread_context->tx_security_contextcxx . . $ thread_context#tx_security_context.,
176 .iv_prefix = (const unsigned char *)tsn_config->security_iv_prefixcxx . . $ traffic_class_config#security_iv_prefix.,
177 .payload_pattern = thread_context->payload_patterncxx . . $ thread_context#payload_pattern.,
178 .payload_pattern_length = thread_context->payload_pattern_lengthcxx . . $ thread_context#payload_pattern_length.,
179 .frame_length = tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length.,
180 .num_frames_per_cycle = tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.,
181 .frame_number = frame_number,
182 .sequence_counter_begin = sequence_counter,
183 .meta_data_offset = thread_context->meta_data_offsetcxx . . $ thread_context#meta_data_offset.,
184 .frame_type = thread_context->frame_typecxx . . $ thread_context#frame_type.,
185 .tx_time = tsn_config->tx_time_enabledcxx . . $ traffic_class_config#tx_time_enabled. ? &tx_time : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
186 };
187
188 xdp_gen_and_send_framescxx . . $ xdp_gen_and_send_frames(312660e902b5d61d).(xsk, &xdp);
189 }
190
191 static void *tsn_tx_thread_routinecxx . . $ tsn_tx_thread_routine(9f162e79bfc6c74).(void *data)
192 {
193 struct thread_contextcxx . . $ thread_context# *thread_context = data;
194 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config = thread_context->confcxx . . $ thread_context#conf.;
195 size_t received_frames_length = MAX_FRAME_SIZEcxx . . $ `src/thread.h:23:9`! * tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.;
196 struct security_contextcxx . . $ security_context# *security_context = thread_context->tx_security_contextcxx . . $ thread_context#tx_security_context.;
197 const long long cycle_time_ns = app_configcxx . . $ app_config..application_base_cycle_time_nscxx . . $ application_config#application_base_cycle_time_ns.;
198 unsigned char *received_frames = thread_context->rx_frame_datacxx . . $ thread_context#rx_frame_data.;
199 const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mirror_enabled = tsn_config->rx_mirror_enabledcxx . . $ traffic_class_config#rx_mirror_enabled.;
200 struct sockaddr_llcxx . . $ sockaddr_ll# destination;
201 unsigned char source[ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!];
202 uint64_tcxx . . $ uint64_t# sequence_counter = 0;
203 struct timespeccxx . . $ timespec# wakeup_time;
204 unsigned int if_index;
205 uint32_tcxx . . $ uint32_t# link_speed;
206 int ret, socket_fd;
207 uint64_tcxx . . $ uint64_t# duration;
208
209 socket_fd = thread_context->socket_fdcxx . . $ thread_context#socket_fd.;
210
211 ret = get_interface_mac_addresscxx . . $ get_interface_mac_address(6007bd5416c53f30).(tsn_config->interfacecxx . . $ traffic_class_config#interface., source, ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!);
212 if (ret < 0) {
213 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: Failed to get Source MAC address!\n",
214 thread_context->traffic_classcxx . . $ thread_context#traffic_class.);
215 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
216 }
217
218 ret = get_interface_link_speedcxx . . $ get_interface_link_speed(6974107818eeb505).(tsn_config->interfacecxx . . $ traffic_class_config#interface., &link_speed);
219 if (ret) {
220 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: Failed to get link speed!\n",
221 thread_context->traffic_classcxx . . $ thread_context#traffic_class.);
222 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
223 }
224
225 if_index = if_nametoindexcxx . . $ if_nametoindex(c61c63047ce273de).(tsn_config->interfacecxx . . $ traffic_class_config#interface.);
226 if (!if_index) {
227 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: if_nametoindex() failed!\n",
228 thread_context->traffic_classcxx . . $ thread_context#traffic_class.);
229 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
230 }
231
232 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&destination, '\0', sizeof(destination));
233 destination.sll_familycxx . . $ sockaddr_ll#sll_family. = PF_PACKETcxx . . $ `<external>/8962547315054503424/socket.h:61:9`!;
234 destination.sll_ifindexcxx . . $ sockaddr_ll#sll_ifindex. = if_index;
235 destination.sll_halencxx . . $ sockaddr_ll#sll_halen. = ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!;
236 memcpycxx . . $ memcpy(cc817cb175f282d).(destination.sll_addrcxx . . $ sockaddr_ll#sll_addr., tsn_config->l2_destinationcxx . . $ traffic_class_config#l2_destination., ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!);
237
238 duration = tx_time_get_frame_durationcxx . . $ tx_time_get_frame_duration(b831a5b42b98fcd).(link_speed, tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length.);
239
240 tsn_initialize_framescxx . . $ tsn_initialize_frames(e1a9c3903a216417).(thread_context, thread_context->tx_frame_datacxx . . $ thread_context#tx_frame_data.,
241 tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle., source, tsn_config->l2_destinationcxx . . $ traffic_class_config#l2_destination.);
242
243 prepare_opensslcxx . . $ prepare_openssl(180fdc1b6a791d79).(security_context);
244 tsn_initialize_framescxx . . $ tsn_initialize_frames(e1a9c3903a216417).(thread_context, thread_context->payload_patterncxx . . $ thread_context#payload_pattern., 1, source,
245 tsn_config->l2_destinationcxx . . $ traffic_class_config#l2_destination.);
246 thread_context->payload_patterncxx . . $ thread_context#payload_pattern. +=
247 sizeof(struct vlan_ethernet_headercxx . . $ vlan_ethernet_header#) + sizeof(struct profinet_secure_headercxx . . $ profinet_secure_header#);
248 thread_context->payload_pattern_lengthcxx . . $ thread_context#payload_pattern_length. =
249 tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length. - sizeof(struct vlan_ethernet_headercxx . . $ vlan_ethernet_header#) -
250 sizeof(struct profinet_secure_headercxx . . $ profinet_secure_header#) - sizeof(struct security_checksumcxx . . $ security_checksum#);
251
252 ret = get_thread_start_timecxx . . $ get_thread_start_time(72e9d11157e5bc5a).(app_configcxx . . $ app_config..application_tx_base_offset_nscxx . . $ application_config#application_tx_base_offset_ns., &wakeup_time);
253 if (ret) {
254 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: Failed to calculate thread start time: %s!\n",
255 thread_context->traffic_classcxx . . $ thread_context#traffic_class., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
256 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
257 }
258
259 while (!thread_context->stopcxx . . $ thread_context#stop.) {
260 if (!thread_context->is_firstcxx . . $ thread_context#is_first.) {
261 struct timespeccxx . . $ timespec# timeout;
262
263 clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(CLOCK_MONOTONICcxx . . $ `<external>/89459239771508533/time.h:48:10`!, &timeout);
264 timeout.tv_seccxx . . $ timespec#tv_sec.++;
265
266 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&thread_context->data_mutexcxx . . $ thread_context#data_mutex.);
267 ret = pthread_cond_timedwaitcxx . . $ pthread_cond_timedwait(d8fcb9edac03ad51).(&thread_context->data_cond_varcxx . . $ thread_context#data_cond_var.,
268 &thread_context->data_mutexcxx . . $ thread_context#data_mutex., &timeout);
269 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&thread_context->data_mutexcxx . . $ thread_context#data_mutex.);
270
271 /* In case of shutdown a signal may be missing. */
272 if (ret == ETIMEDOUTcxx . . $ `<external>/17922322188510340118/errno.h:94:9`!)
273 continue;
274 } else {
275 /* Wait until next period */
276 increment_periodcxx . . $ increment_period(4d7c74d32dea27cd).(&wakeup_time, cycle_time_ns);
277
278 do {
279 ret = clock_nanosleepcxx . . $ clock_nanosleep(99dc002056e22615).(app_configcxx . . $ app_config..application_clock_idcxx . . $ application_config#application_clock_id.,
280 TIMER_ABSTIMEcxx . . $ `<external>/89459239771508533/time.h:69:10`!, &wakeup_time, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
281 } while (ret == EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!);
282
283 if (ret) {
284 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: clock_nanosleep() failed: %s\n",
285 thread_context->traffic_classcxx . . $ thread_context#traffic_class., strerrorcxx . . $ strerror(ff224f080444ee45).(ret));
286 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
287 }
288 }
289
290 /*
291 * Send TsnFrames, two possibilites:
292 * a) Generate it, or
293 * b) Use received ones if mirror enabled
294 */
295 if (!mirror_enabled) {
296 tsn_gen_and_send_framescxx . . $ tsn_gen_and_send_frames(38122402ce3c681d).(thread_context, socket_fd, &destination,
297 ts_to_nscxx . . $ ts_to_ns(3d5e857b70563169).(&wakeup_time), sequence_counter, duration);
298
299 sequence_counter += tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.;
300 } else {
301 size_t len, num_frames;
302
303 ring_buffer_fetchcxx . . $ ring_buffer_fetch(e8bf408057bf6314).(thread_context->mirror_buffercxx . . $ thread_context#mirror_buffer., received_frames,
304 received_frames_length, &len);
305
306 /* Len should be a multiple of frame size */
307 num_frames = len / tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length.;
308 tsn_send_framescxx . . $ tsn_send_frames(53779637f63d9f2f).(thread_context, received_frames, num_frames, socket_fd,
309 &destination, duration);
310 }
311
312 /* Signal next Tx thread */
313 if (thread_context->nextcxx . . $ thread_context#next.) {
314 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&thread_context->nextcxx . . $ thread_context#next.->data_mutexcxx . . $ thread_context#data_mutex.);
315 pthread_cond_signalcxx . . $ pthread_cond_signal(98095c34a2b0149d).(&thread_context->nextcxx . . $ thread_context#next.->data_cond_varcxx . . $ thread_context#data_cond_var.);
316 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&thread_context->nextcxx . . $ thread_context#next.->data_mutexcxx . . $ thread_context#data_mutex.);
317 }
318
319 if (thread_context->is_lastcxx . . $ thread_context#is_last.)
320 stat_updatecxx . . $ stat_update(49f6e7a06ebc5aa8).();
321 }
322
323 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
324 }
325
326 /*
327 * This Tx thread routine differs to the standard one in terms of the sending
328 * interface. This one uses the AF_XDP user space interface.
329 */
330 static void *tsn_xdp_tx_thread_routinecxx . . $ tsn_xdp_tx_thread_routine(9f162e79bfc6c74).(void *data)
331 {
332 struct thread_contextcxx . . $ thread_context# *thread_context = data;
333 struct security_contextcxx . . $ security_context# *security_context = thread_context->tx_security_contextcxx . . $ thread_context#tx_security_context.;
334 const long long cycle_time_ns = app_configcxx . . $ app_config..application_base_cycle_time_nscxx . . $ application_config#application_base_cycle_time_ns.;
335 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config = thread_context->confcxx . . $ thread_context#conf.;
336 const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mirror_enabled = tsn_config->rx_mirror_enabledcxx . . $ traffic_class_config#rx_mirror_enabled.;
337 uint32_tcxx . . $ uint32_t# frame_number = XSK_RING_PROD__DEFAULT_NUM_DESCScxx . . $ `src/xdp.h:30:9`!;
338 size_t num_frames = tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.;
339 unsigned char source[ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!];
340 uint64_tcxx . . $ uint64_t# sequence_counter = 0;
341 struct timespeccxx . . $ timespec# wakeup_time;
342 unsigned char *frame_data;
343 struct xdp_socketcxx . . $ xdp_socket# *xsk;
344 uint32_tcxx . . $ uint32_t# link_speed;
345 uint64_tcxx . . $ uint64_t# duration;
346 int ret;
347
348 xsk = thread_context->xskcxx . . $ thread_context#xsk.;
349 xsk->tx_hwtscxx . . $ xdp_socket#tx_hwts..rttcxx . . $ xdp_tx_hwts#rtt. = &round_trip_contextscxx . . $ round_trip_contexts.[thread_context->frame_typecxx . . $ thread_context#frame_type.];
350 xsk->tx_hwtscxx . . $ xdp_socket#tx_hwts..frames_per_cyclecxx . . $ xdp_tx_hwts#frames_per_cycle. = tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.;
351
352 ret = get_interface_mac_addresscxx . . $ get_interface_mac_address(6007bd5416c53f30).(tsn_config->interfacecxx . . $ traffic_class_config#interface., source, ETH_ALENcxx . . $ `<external>/15209105680615352250/if_ether.h:32:9`!);
353 if (ret < 0) {
354 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: Failed to get Source MAC address!\n",
355 thread_context->traffic_classcxx . . $ thread_context#traffic_class.);
356 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
357 }
358
359 ret = get_interface_link_speedcxx . . $ get_interface_link_speed(6974107818eeb505).(tsn_config->interfacecxx . . $ traffic_class_config#interface., &link_speed);
360 if (ret) {
361 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: Failed to get link speed!\n",
362 thread_context->traffic_classcxx . . $ thread_context#traffic_class.);
363 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
364 }
365
366 duration = tx_time_get_frame_durationcxx . . $ tx_time_get_frame_duration(b831a5b42b98fcd).(link_speed, tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length.);
367
368 /* First half of umem area is for Rx, the second half is for Tx. */
369 frame_data = xsk_umem__get_datacxx . . $ xsk_umem__get_data(c096771c57425568).(xsk->umemcxx . . $ xdp_socket#umem..buffercxx . . $ xsk_umem_info#buffer.,
370 XDP_FRAME_SIZEcxx . . $ `src/xdp.h:34:9`! * XSK_RING_PROD__DEFAULT_NUM_DESCScxx . . $ `src/xdp.h:30:9`!);
371
372 /* Initialize all Tx frames */
373 tsn_initialize_framescxx . . $ tsn_initialize_frames(e1a9c3903a216417).(thread_context, frame_data, XSK_RING_CONS__DEFAULT_NUM_DESCScxx . . $ `src/xdp.h:29:9`!, source,
374 tsn_config->l2_destinationcxx . . $ traffic_class_config#l2_destination.);
375
376 prepare_opensslcxx . . $ prepare_openssl(180fdc1b6a791d79).(security_context);
377 tsn_initialize_framescxx . . $ tsn_initialize_frames(e1a9c3903a216417).(thread_context, thread_context->payload_patterncxx . . $ thread_context#payload_pattern., 1, source,
378 tsn_config->l2_destinationcxx . . $ traffic_class_config#l2_destination.);
379 thread_context->payload_patterncxx . . $ thread_context#payload_pattern. +=
380 sizeof(struct vlan_ethernet_headercxx . . $ vlan_ethernet_header#) + sizeof(struct profinet_secure_headercxx . . $ profinet_secure_header#);
381 thread_context->payload_pattern_lengthcxx . . $ thread_context#payload_pattern_length. =
382 tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length. - sizeof(struct vlan_ethernet_headercxx . . $ vlan_ethernet_header#) -
383 sizeof(struct profinet_secure_headercxx . . $ profinet_secure_header#) - sizeof(struct security_checksumcxx . . $ security_checksum#);
384
385 ret = get_thread_start_timecxx . . $ get_thread_start_time(72e9d11157e5bc5a).(app_configcxx . . $ app_config..application_tx_base_offset_nscxx . . $ application_config#application_tx_base_offset_ns., &wakeup_time);
386 if (ret) {
387 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: Failed to calculate thread start time: %s!\n",
388 thread_context->traffic_classcxx . . $ thread_context#traffic_class., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
389 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
390 }
391
392 while (!thread_context->stopcxx . . $ thread_context#stop.) {
393 if (!thread_context->is_firstcxx . . $ thread_context#is_first.) {
394 struct timespeccxx . . $ timespec# timeout;
395
396 clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(CLOCK_MONOTONICcxx . . $ `<external>/89459239771508533/time.h:48:10`!, &timeout);
397 timeout.tv_seccxx . . $ timespec#tv_sec.++;
398
399 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&thread_context->data_mutexcxx . . $ thread_context#data_mutex.);
400 ret = pthread_cond_timedwaitcxx . . $ pthread_cond_timedwait(d8fcb9edac03ad51).(&thread_context->data_cond_varcxx . . $ thread_context#data_cond_var.,
401 &thread_context->data_mutexcxx . . $ thread_context#data_mutex., &timeout);
402 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&thread_context->data_mutexcxx . . $ thread_context#data_mutex.);
403
404 /* In case of shutdown a signal may be missing. */
405 if (ret == ETIMEDOUTcxx . . $ `<external>/17922322188510340118/errno.h:94:9`!)
406 continue;
407 } else {
408 /* Wait until next period */
409 increment_periodcxx . . $ increment_period(4d7c74d32dea27cd).(&wakeup_time, cycle_time_ns);
410
411 do {
412 ret = clock_nanosleepcxx . . $ clock_nanosleep(99dc002056e22615).(app_configcxx . . $ app_config..application_clock_idcxx . . $ application_config#application_clock_id.,
413 TIMER_ABSTIMEcxx . . $ `<external>/89459239771508533/time.h:69:10`!, &wakeup_time, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
414 } while (ret == EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!);
415
416 if (ret) {
417 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sTx: clock_nanosleep() failed: %s\n",
418 thread_context->traffic_classcxx . . $ thread_context#traffic_class., strerrorcxx . . $ strerror(ff224f080444ee45).(ret));
419 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
420 }
421 }
422
423 /*
424 * Send TsnFrames, two possibilites:
425 * a) Generate it, or
426 * b) Use received ones if mirror enabled
427 */
428 if (!mirror_enabled) {
429 tsn_gen_and_send_xdp_framescxx . . $ tsn_gen_and_send_xdp_frames(cee47f915e8bd974).(thread_context, xsk, sequence_counter,
430 ts_to_nscxx . . $ ts_to_ns(3d5e857b70563169).(&wakeup_time), duration,
431 &frame_number);
432 sequence_counter += num_frames;
433 } else {
434 unsigned int received;
435 uint64_tcxx . . $ uint64_t# i;
436
437 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&thread_context->xdp_data_mutexcxx . . $ thread_context#xdp_data_mutex.);
438
439 received = thread_context->received_framescxx . . $ thread_context#received_frames.;
440
441 sequence_counter = thread_context->rx_sequence_countercxx . . $ thread_context#rx_sequence_counter. - received;
442
443 /* Increment workload outlier count if workload did not finish. */
444 if (tsn_config->rx_workload_enabledcxx . . $ traffic_class_config#rx_workload_enabled.) {
445 if (thread_context->workloadcxx . . $ thread_context#workload.->workload_donecxx . . $ workload_config#workload_done. == 0 &&
446 sequence_counter) {
447 stat_inc_workload_outliercxx . . $ stat_inc_workload_outlier(163d8b1aefebb495).(thread_context->frame_typecxx . . $ thread_context#frame_type.);
448 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "Workload did not finish!\n");
449 } else
450 thread_context->workloadcxx . . $ thread_context#workload.->workload_donecxx . . $ workload_config#workload_done. = 0;
451 }
452
453 /*
454 * The XDP receiver stored the frames within the umem area and populated the
455 * Tx ring. Now, the Tx ring can be committed to the kernel. Furthermore,
456 * already transmitted frames from last cycle can be recycled for Rx.
457 */
458
459 xsk_ring_prod__submitcxx . . $ xsk_ring_prod__submit(9991f52d60245542).(&xsk->txcxx . . $ xdp_socket#tx., received);
460
461 if (received > 0) {
462 if (tsn_config->tx_hwtstamp_enabledcxx . . $ traffic_class_config#tx_hwtstamp_enabled.) {
463 /*
464 * Once-per-cycle: record TX SW timestamp for the first
465 * packet in this cycle and count all frames
466 */
467 stat_frames_sent_batchcxx . . $ stat_frames_sent_batch(1b9110cae93061b5).(thread_context->frame_typecxx . . $ thread_context#frame_type.,
468 sequence_counter, received);
469 } else {
470 for (i = sequence_counter; i < sequence_counter + received;
471 ++i)
472 stat_frame_sentcxx . . $ stat_frame_sent(ca48c151307d73b6).(thread_context->frame_typecxx . . $ thread_context#frame_type., i);
473 }
474 }
475
476 xsk->outstanding_txcxx . . $ xdp_socket#outstanding_tx. += received;
477 thread_context->received_framescxx . . $ thread_context#received_frames. = 0;
478
479 xdp_complete_txcxx . . $ xdp_complete_tx(5f53ef6b518fdd5d).(xsk);
480
481 #ifdef TX_TIMESTAMP
482 if (received > 0 && tsn_config->tx_hwtstamp_enabled) {
483 /*
484 * TX HW timestamp becomes available in the next cycle
485 * after the packet is transmitted.
486 * This is one cycle later than SW timestamp tracked
487 * using sequence_counter
488 */
489 xsk->tx_hwts.seq_lagged = sequence_counter;
490 }
491 #endif
492
493 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&thread_context->xdp_data_mutexcxx . . $ thread_context#xdp_data_mutex.);
494 }
495
496 /* Signal next Tx thread */
497 if (thread_context->nextcxx . . $ thread_context#next.) {
498 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&thread_context->nextcxx . . $ thread_context#next.->data_mutexcxx . . $ thread_context#data_mutex.);
499 pthread_cond_signalcxx . . $ pthread_cond_signal(98095c34a2b0149d).(&thread_context->nextcxx . . $ thread_context#next.->data_cond_varcxx . . $ thread_context#data_cond_var.);
500 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&thread_context->nextcxx . . $ thread_context#next.->data_mutexcxx . . $ thread_context#data_mutex.);
501 }
502
503 if (thread_context->is_lastcxx . . $ thread_context#is_last.)
504 stat_updatecxx . . $ stat_update(49f6e7a06ebc5aa8).();
505 }
506
507 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
508 }
509
510 static void *tsn_rx_thread_routinecxx . . $ tsn_rx_thread_routine(9f162e79bfc6c74).(void *data)
511 {
512 struct thread_contextcxx . . $ thread_context# *thread_context = data;
513 const uint64_tcxx . . $ uint64_t# cycle_time_ns = app_configcxx . . $ app_config..application_base_cycle_time_nscxx . . $ application_config#application_base_cycle_time_ns.;
514 struct timespeccxx . . $ timespec# wakeup_time;
515 int socket_fd, ret;
516
517 socket_fd = thread_context->socket_fdcxx . . $ thread_context#socket_fd.;
518
519 prepare_opensslcxx . . $ prepare_openssl(180fdc1b6a791d79).(thread_context->rx_security_contextcxx . . $ thread_context#rx_security_context.);
520
521 ret = get_thread_start_timecxx . . $ get_thread_start_time(72e9d11157e5bc5a).(app_configcxx . . $ app_config..application_rx_base_offset_nscxx . . $ application_config#application_rx_base_offset_ns., &wakeup_time);
522 if (ret) {
523 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sRx: Failed to calculate thread start time: %s!\n",
524 thread_context->traffic_classcxx . . $ thread_context#traffic_class., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
525 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
526 }
527
528 while (!thread_context->stopcxx . . $ thread_context#stop.) {
529 struct packet_receive_requestcxx . . $ packet_receive_request# recv_req = {
530 .traffic_class = thread_context->traffic_classcxx . . $ thread_context#traffic_class.,
531 .socket_fd = socket_fd,
532 .receive_function = receive_profinet_framecxx . . $ receive_profinet_frame(ddfd8079f1f43689).,
533 .data = thread_context,
534 };
535
536 /* Wait until next period. */
537 increment_periodcxx . . $ increment_period(4d7c74d32dea27cd).(&wakeup_time, cycle_time_ns);
538
539 do {
540 ret = clock_nanosleepcxx . . $ clock_nanosleep(99dc002056e22615).(app_configcxx . . $ app_config..application_clock_idcxx . . $ application_config#application_clock_id., TIMER_ABSTIMEcxx . . $ `<external>/89459239771508533/time.h:69:10`!,
541 &wakeup_time, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
542 } while (ret == EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!);
543
544 if (ret) {
545 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sRx: clock_nanosleep() failed: %s\n",
546 thread_context->traffic_classcxx . . $ thread_context#traffic_class., strerrorcxx . . $ strerror(ff224f080444ee45).(ret));
547 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
548 }
549
550 /* Receive Tsn frames. */
551 packet_receive_messagescxx . . $ packet_receive_messages(dec9d97ca532b11c).(thread_context->packet_contextcxx . . $ thread_context#packet_context., &recv_req);
552 }
553
554 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
555 }
556
557 static void *tsn_xdp_rx_thread_routinecxx . . $ tsn_xdp_rx_thread_routine(9f162e79bfc6c74).(void *data)
558 {
559 struct thread_contextcxx . . $ thread_context# *thread_context = data;
560 const long long cycle_time_ns = app_configcxx . . $ app_config..application_base_cycle_time_nscxx . . $ application_config#application_base_cycle_time_ns.;
561 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config = thread_context->confcxx . . $ thread_context#conf.;
562 const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mirror_enabled = tsn_config->rx_mirror_enabledcxx . . $ traffic_class_config#rx_mirror_enabled.;
563 const size_t frame_length = tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length.;
564 struct xdp_socketcxx . . $ xdp_socket# *xsk = thread_context->xskcxx . . $ thread_context#xsk.;
565 struct timespeccxx . . $ timespec# wakeup_time;
566 uint32_tcxx . . $ uint32_t# link_speed;
567 uint64_tcxx . . $ uint64_t# duration;
568 int ret;
569
570 prepare_opensslcxx . . $ prepare_openssl(180fdc1b6a791d79).(thread_context->rx_security_contextcxx . . $ thread_context#rx_security_context.);
571
572 ret = get_thread_start_timecxx . . $ get_thread_start_time(72e9d11157e5bc5a).(app_configcxx . . $ app_config..application_rx_base_offset_nscxx . . $ application_config#application_rx_base_offset_ns., &wakeup_time);
573 if (ret) {
574 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sRx: Failed to calculate thread start time: %s!\n",
575 thread_context->traffic_classcxx . . $ thread_context#traffic_class., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
576 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
577 }
578
579 ret = get_interface_link_speedcxx . . $ get_interface_link_speed(6974107818eeb505).(tsn_config->interfacecxx . . $ traffic_class_config#interface., &link_speed);
580 if (ret) {
581 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sRx: Failed to get link speed!\n",
582 thread_context->traffic_classcxx . . $ thread_context#traffic_class.);
583 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
584 }
585
586 duration = tx_time_get_frame_durationcxx . . $ tx_time_get_frame_duration(b831a5b42b98fcd).(link_speed, tsn_config->frame_lengthcxx . . $ traffic_class_config#frame_length.);
587
588 while (!thread_context->stopcxx . . $ thread_context#stop.) {
589 struct xdp_tx_timecxx . . $ xdp_tx_time# tx_time = {
590 .tx_time_offset = tsn_config->tx_time_offset_nscxx . . $ traffic_class_config#tx_time_offset_ns.,
591 .duration = duration,
592 .num_frames_per_cycle = tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.,
593 .sequence_counter_begin = 0,
594 .traffic_class = thread_context->traffic_classcxx . . $ thread_context#traffic_class.,
595 };
596 unsigned int received;
597
598 /* Wait until next period */
599 increment_periodcxx . . $ increment_period(4d7c74d32dea27cd).(&wakeup_time, cycle_time_ns);
600
601 do {
602 ret = clock_nanosleepcxx . . $ clock_nanosleep(99dc002056e22615).(app_configcxx . . $ app_config..application_clock_idcxx . . $ application_config#application_clock_id., TIMER_ABSTIMEcxx . . $ `<external>/89459239771508533/time.h:69:10`!,
603 &wakeup_time, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
604 } while (ret == EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!);
605
606 if (ret) {
607 log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%sRx: clock_nanosleep() failed: %s\n",
608 thread_context->traffic_classcxx . . $ thread_context#traffic_class., strerrorcxx . . $ strerror(ff224f080444ee45).(ret));
609 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
610 }
611
612 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&thread_context->xdp_data_mutexcxx . . $ thread_context#xdp_data_mutex.);
613 received = xdp_receive_framescxx . . $ xdp_receive_frames(a8ae63e30c683a9b).(xsk, frame_length, mirror_enabled,
614 receive_profinet_framecxx . . $ receive_profinet_frame(ddfd8079f1f43689)., thread_context, &tx_time);
615 thread_context->received_framescxx . . $ thread_context#received_frames. = received;
616 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&thread_context->xdp_data_mutexcxx . . $ thread_context#xdp_data_mutex.);
617
618 if (thread_context->confcxx . . $ thread_context#conf.->rx_workload_enabledcxx . . $ traffic_class_config#rx_workload_enabled. && mirror_enabled) {
619 /* Run workload if we received frames or prewarm is enabled */
620 if (received || thread_context->confcxx . . $ thread_context#conf.->rx_workload_prewarmcxx . . $ traffic_class_config#rx_workload_prewarm.) {
621 thread_context->workloadcxx . . $ thread_context#workload.->workload_runcxx . . $ workload_config#workload_run. = 1;
622 pthread_cond_signalcxx . . $ pthread_cond_signal(98095c34a2b0149d).(&(thread_context->workloadcxx . . $ thread_context#workload.->workload_condcxx . . $ workload_config#workload_cond.));
623 }
624 }
625 }
626
627 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
628 }
629
630 int tsn_threads_createcxx . . $ tsn_threads_create(8542e1c024f3ff56).(struct thread_contextcxx . . $ thread_context# *thread_context)
631 {
632 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config = thread_context->confcxx . . $ thread_context#conf.;
633 char thread_name[128];
634 int ret;
635
636 if (thread_context->frame_typecxx . . $ thread_context#frame_type. == TSN_HIGH_FRAME_TYPEcxx . . $ TSN_HIGH_FRAME_TYPE. &&
637 !config_is_traffic_class_activecxx . . $ config_is_traffic_class_active(c5f7da30cbc0f4e9).("TsnHigh")) {
638 ret = 0;
639 goto out;
640 }
641 if (thread_context->frame_typecxx . . $ thread_context#frame_type. == TSN_LOW_FRAME_TYPEcxx . . $ TSN_LOW_FRAME_TYPE. &&
642 !config_is_traffic_class_activecxx . . $ config_is_traffic_class_active(c5f7da30cbc0f4e9).("TsnLow")) {
643 ret = 0;
644 goto out;
645 }
646
647 /* For XDP the frames are stored in a umem area. That memory is part of the socket. */
648 if (!tsn_config->xdp_enabledcxx . . $ traffic_class_config#xdp_enabled.) {
649 thread_context->packet_contextcxx . . $ thread_context#packet_context. = packet_initcxx . . $ packet_init(6f6262789a319935).(tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.);
650 if (!thread_context->packet_contextcxx . . $ thread_context#packet_context.) {
651 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to allocate Tsn packet context!\n");
652 ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
653 goto err_packet;
654 }
655
656 thread_context->tx_frame_datacxx . . $ thread_context#tx_frame_data. =
657 calloccxx . . $ calloc(63a7bf2941bfcd7a).(tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle., MAX_FRAME_SIZEcxx . . $ `src/thread.h:23:9`!);
658 if (!thread_context->tx_frame_datacxx . . $ thread_context#tx_frame_data.) {
659 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to allocate TsnTxFrameData!\n");
660 ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
661 goto err_tx;
662 }
663
664 thread_context->rx_frame_datacxx . . $ thread_context#rx_frame_data. =
665 calloccxx . . $ calloc(63a7bf2941bfcd7a).(tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle., MAX_FRAME_SIZEcxx . . $ `src/thread.h:23:9`!);
666 if (!thread_context->rx_frame_datacxx . . $ thread_context#rx_frame_data.) {
667 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to allocate TsnRxFrameData!\n");
668 ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
669 goto err_rx;
670 }
671 }
672
673 thread_context->payload_patterncxx . . $ thread_context#payload_pattern. = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, MAX_FRAME_SIZEcxx . . $ `src/thread.h:23:9`!);
674 if (!thread_context->payload_patterncxx . . $ thread_context#payload_pattern.) {
675 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to allocate TsnPayloadPattern!\n");
676 ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
677 goto err_payload;
678 }
679 thread_context->payload_pattern_lengthcxx . . $ thread_context#payload_pattern_length. = MAX_FRAME_SIZEcxx . . $ `src/thread.h:23:9`!;
680
681 /* For XDP a AF_XDP socket is allocated. Otherwise a Linux raw socket is used. */
682 if (tsn_config->xdp_enabledcxx . . $ traffic_class_config#xdp_enabled.) {
683 thread_context->socket_fdcxx . . $ thread_context#socket_fd. = 0;
684 thread_context->xskcxx . . $ thread_context#xsk. = xdp_open_socketcxx . . $ xdp_open_socket(ec858eaaf043e631).(
685 tsn_config->interfacecxx . . $ traffic_class_config#interface., app_configcxx . . $ app_config..application_xdp_programcxx . . $ application_config#application_xdp_program.,
686 tsn_config->rx_queuecxx . . $ traffic_class_config#rx_queue., tsn_config->xdp_skb_modecxx . . $ traffic_class_config#xdp_skb_mode., tsn_config->xdp_zc_modecxx . . $ traffic_class_config#xdp_zc_mode.,
687 tsn_config->xdp_wakeup_modecxx . . $ traffic_class_config#xdp_wakeup_mode., tsn_config->xdp_busy_poll_modecxx . . $ traffic_class_config#xdp_busy_poll_mode.,
688 tsn_config->tx_time_enabledcxx . . $ traffic_class_config#tx_time_enabled., tsn_config->tx_hwtstamp_enabledcxx . . $ traffic_class_config#tx_hwtstamp_enabled.);
689 if (!thread_context->xskcxx . . $ thread_context#xsk.) {
690 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to create Tsn Xdp socket!\n");
691 ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
692 goto err_socket;
693 }
694 } else {
695 thread_context->xskcxx . . $ thread_context#xsk. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
696 thread_context->socket_fdcxx . . $ thread_context#socket_fd. = thread_context->create_socketcxx . . $ thread_context#create_socket.();
697 if (thread_context->socket_fdcxx . . $ thread_context#socket_fd. < 0) {
698 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to create TSN Socket!\n");
699 ret = -errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!;
700 goto err_socket;
701 }
702 }
703
704 init_mutexcxx . . $ init_mutex(4f83bfebf4bb9c8b).(&thread_context->data_mutexcxx . . $ thread_context#data_mutex.);
705 init_mutexcxx . . $ init_mutex(4f83bfebf4bb9c8b).(&thread_context->xdp_data_mutexcxx . . $ thread_context#xdp_data_mutex.);
706 init_condition_variablecxx . . $ init_condition_variable(23b56462c1e1452f).(&thread_context->data_cond_varcxx . . $ thread_context#data_cond_var.);
707
708 /* Same as above. For XDP the umem area is used. */
709 if (tsn_config->rx_mirror_enabledcxx . . $ traffic_class_config#rx_mirror_enabled. && !tsn_config->xdp_enabledcxx . . $ traffic_class_config#xdp_enabled.) {
710 /* Per period the expectation is: TsnNumFramesPerCycle * MAX_FRAME */
711 thread_context->mirror_buffercxx . . $ thread_context#mirror_buffer. =
712 ring_buffer_allocatecxx . . $ ring_buffer_allocate(a00a27d6b402ebff).(MAX_FRAME_SIZEcxx . . $ `src/thread.h:23:9`! * tsn_config->num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.);
713 if (!thread_context->mirror_buffercxx . . $ thread_context#mirror_buffer.) {
714 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to allocate Tsn Mirror RingBuffer!\n");
715 ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
716 goto err_buffer;
717 }
718 }
719
720 if (tsn_config->security_modecxx . . $ traffic_class_config#security_mode. != SECURITY_MODE_NONEcxx . . $ SECURITY_MODE_NONE.) {
721 thread_context->tx_security_contextcxx . . $ thread_context#tx_security_context. = security_initcxx . . $ security_init(5357658aae651c5a).(
722 tsn_config->security_algorithmcxx . . $ traffic_class_config#security_algorithm., (unsigned char *)tsn_config->security_keycxx . . $ traffic_class_config#security_key.);
723 if (!thread_context->tx_security_contextcxx . . $ thread_context#tx_security_context.) {
724 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to initialize Tx security context!\n");
725 ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
726 goto err_tx_sec;
727 }
728
729 thread_context->rx_security_contextcxx . . $ thread_context#rx_security_context. = security_initcxx . . $ security_init(5357658aae651c5a).(
730 tsn_config->security_algorithmcxx . . $ traffic_class_config#security_algorithm., (unsigned char *)tsn_config->security_keycxx . . $ traffic_class_config#security_key.);
731 if (!thread_context->rx_security_contextcxx . . $ thread_context#rx_security_context.) {
732 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to initialize Rx security context!\n");
733 ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
734 goto err_rx_sec;
735 }
736 } else {
737 thread_context->tx_security_contextcxx . . $ thread_context#tx_security_context. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
738 thread_context->rx_security_contextcxx . . $ thread_context#rx_security_context. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
739 }
740
741 snprintfcxx . . $ snprintf(ea502d73e74c754c).(thread_name, sizeof(thread_name), "%sTxThread", thread_context->traffic_classcxx . . $ thread_context#traffic_class.);
742
743 ret = create_rt_threadcxx . . $ create_rt_thread(670ec5a211ade64c).(&thread_context->tx_task_idcxx . . $ thread_context#tx_task_id., thread_name,
744 tsn_config->tx_thread_prioritycxx . . $ traffic_class_config#tx_thread_priority., tsn_config->tx_thread_cpucxx . . $ traffic_class_config#tx_thread_cpu.,
745 tsn_config->xdp_enabledcxx . . $ traffic_class_config#xdp_enabled. ? tsn_xdp_tx_thread_routinecxx . . $ tsn_xdp_tx_thread_routine(9f162e79bfc6c74).
746 : tsn_tx_thread_routinecxx . . $ tsn_tx_thread_routine(9f162e79bfc6c74).,
747 thread_context);
748 if (ret) {
749 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to create Tsn Tx Thread!\n");
750 goto err_thread;
751 }
752
753 snprintfcxx . . $ snprintf(ea502d73e74c754c).(thread_name, sizeof(thread_name), "%sRxThread", thread_context->traffic_classcxx . . $ thread_context#traffic_class.);
754
755 ret = create_rt_threadcxx . . $ create_rt_thread(670ec5a211ade64c).(&thread_context->rx_task_idcxx . . $ thread_context#rx_task_id., thread_name,
756 tsn_config->rx_thread_prioritycxx . . $ traffic_class_config#rx_thread_priority., tsn_config->rx_thread_cpucxx . . $ traffic_class_config#rx_thread_cpu.,
757 tsn_config->xdp_enabledcxx . . $ traffic_class_config#xdp_enabled. ? tsn_xdp_rx_thread_routinecxx . . $ tsn_xdp_rx_thread_routine(9f162e79bfc6c74).
758 : tsn_rx_thread_routinecxx . . $ tsn_rx_thread_routine(9f162e79bfc6c74).,
759 thread_context);
760 if (ret) {
761 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to create Tsn Rx Thread!\n");
762 goto err_thread_rx;
763 }
764
765 /* Create workload thread for execution after network RX */
766 if (tsn_config->rx_workload_enabledcxx . . $ traffic_class_config#rx_workload_enabled.) {
767 thread_context->workloadcxx . . $ thread_context#workload. = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct workload_configcxx . . $ workload_config#));
768
769 if (!thread_context->workloadcxx . . $ thread_context#workload.) {
770 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to allocate workload!\n");
771 ret = -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!;
772 goto err_thread_wl;
773 }
774
775 workload_context_initcxx . . $ workload_context_init(40f8e18c2538f155).(
776 thread_context, tsn_config->workload_filecxx . . $ traffic_class_config#workload_file., tsn_config->workload_functioncxx . . $ traffic_class_config#workload_function.,
777 tsn_config->workload_argumentscxx . . $ traffic_class_config#workload_arguments., tsn_config->workload_setup_functioncxx . . $ traffic_class_config#workload_setup_function.,
778 tsn_config->workload_setup_argumentscxx . . $ traffic_class_config#workload_setup_arguments., thread_context->frame_typecxx . . $ thread_context#frame_type.);
779 ret = create_rt_threadcxx . . $ create_rt_thread(670ec5a211ade64c).(
780 &thread_context->workloadcxx . . $ thread_context#workload.->workload_task_idcxx . . $ workload_config#workload_task_id., tsn_config->workload_functioncxx . . $ traffic_class_config#workload_function.,
781 tsn_config->workload_thread_prioritycxx . . $ traffic_class_config#workload_thread_priority., tsn_config->workload_thread_cpucxx . . $ traffic_class_config#workload_thread_cpu.,
782 &workload_thread_routinecxx . . $ workload_thread_routine(9f162e79bfc6c74)., thread_context);
783 if (ret) {
784 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to create Tsn Workload Thread!\n");
785 goto err_thread_wl;
786 }
787 }
788
789 thread_context->meta_data_offsetcxx . . $ thread_context#meta_data_offset. =
790 get_meta_data_offsetcxx . . $ get_meta_data_offset(16cb9e606c8e3615).(thread_context->frame_typecxx . . $ thread_context#frame_type., tsn_config->security_modecxx . . $ traffic_class_config#security_mode.);
791
792 return 0;
793
794 err_thread_wl:
795 thread_context->stopcxx . . $ thread_context#stop. = 1;
796 freecxx . . $ free(5d22bdacc48458e8).(thread_context->workloadcxx . . $ thread_context#workload.);
797 pthread_joincxx . . $ pthread_join(269902cf949f12c5).(thread_context->rx_task_idcxx . . $ thread_context#rx_task_id., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
798 err_thread_rx:
799 thread_context->stopcxx . . $ thread_context#stop. = 1;
800 pthread_joincxx . . $ pthread_join(269902cf949f12c5).(thread_context->tx_task_idcxx . . $ thread_context#tx_task_id., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
801 err_thread:
802 security_exitcxx . . $ security_exit(180fdc1b6a791d79).(thread_context->rx_security_contextcxx . . $ thread_context#rx_security_context.);
803 err_rx_sec:
804 security_exitcxx . . $ security_exit(180fdc1b6a791d79).(thread_context->tx_security_contextcxx . . $ thread_context#tx_security_context.);
805 err_tx_sec:
806 ring_buffer_freecxx . . $ ring_buffer_free(8f2cd700b00968de).(thread_context->mirror_buffercxx . . $ thread_context#mirror_buffer.);
807 err_buffer:
808 if (thread_context->socket_fdcxx . . $ thread_context#socket_fd.)
809 closecxx . . $ close(7864480464b09eea).(thread_context->socket_fdcxx . . $ thread_context#socket_fd.);
810 if (thread_context->xskcxx . . $ thread_context#xsk.)
811 xdp_close_socketcxx . . $ xdp_close_socket(fc530d27d072e0f5).(thread_context->xskcxx . . $ thread_context#xsk., tsn_config->interfacecxx . . $ traffic_class_config#interface.,
812 tsn_config->xdp_skb_modecxx . . $ traffic_class_config#xdp_skb_mode.);
813 err_socket:
814 freecxx . . $ free(5d22bdacc48458e8).(thread_context->payload_patterncxx . . $ thread_context#payload_pattern.);
815 err_payload:
816 freecxx . . $ free(5d22bdacc48458e8).(thread_context->rx_frame_datacxx . . $ thread_context#rx_frame_data.);
817 err_rx:
818 freecxx . . $ free(5d22bdacc48458e8).(thread_context->tx_frame_datacxx . . $ thread_context#tx_frame_data.);
819 err_tx:
820 packet_freecxx . . $ packet_free(b20c0f701b2a2d37).(thread_context->packet_contextcxx . . $ thread_context#packet_context.);
821 err_packet:
822 out:
823 return ret;
824 }
825
826 static void tsn_threads_freecxx . . $ tsn_threads_free(f7c2ab51214b7176).(struct thread_contextcxx . . $ thread_context# *thread_context)
827 {
828 const struct traffic_class_configcxx . . $ traffic_class_config# *tsn_config;
829
830 if (!thread_context)
831 return;
832
833 tsn_config = thread_context->confcxx . . $ thread_context#conf.;
834
835 if (thread_context->payload_patterncxx . . $ thread_context#payload_pattern.) {
836 thread_context->payload_patterncxx . . $ thread_context#payload_pattern. -=
837 sizeof(struct vlan_ethernet_headercxx . . $ vlan_ethernet_header#) + sizeof(struct profinet_secure_headercxx . . $ profinet_secure_header#);
838 freecxx . . $ free(5d22bdacc48458e8).(thread_context->payload_patterncxx . . $ thread_context#payload_pattern.);
839 }
840
841 security_exitcxx . . $ security_exit(180fdc1b6a791d79).(thread_context->tx_security_contextcxx . . $ thread_context#tx_security_context.);
842 security_exitcxx . . $ security_exit(180fdc1b6a791d79).(thread_context->rx_security_contextcxx . . $ thread_context#rx_security_context.);
843
844 ring_buffer_freecxx . . $ ring_buffer_free(8f2cd700b00968de).(thread_context->mirror_buffercxx . . $ thread_context#mirror_buffer.);
845
846 packet_freecxx . . $ packet_free(b20c0f701b2a2d37).(thread_context->packet_contextcxx . . $ thread_context#packet_context.);
847 freecxx . . $ free(5d22bdacc48458e8).(thread_context->tx_frame_datacxx . . $ thread_context#tx_frame_data.);
848 freecxx . . $ free(5d22bdacc48458e8).(thread_context->rx_frame_datacxx . . $ thread_context#rx_frame_data.);
849
850 if (thread_context->socket_fdcxx . . $ thread_context#socket_fd. > 0)
851 closecxx . . $ close(7864480464b09eea).(thread_context->socket_fdcxx . . $ thread_context#socket_fd.);
852
853 if (thread_context->xskcxx . . $ thread_context#xsk.)
854 xdp_close_socketcxx . . $ xdp_close_socket(fc530d27d072e0f5).(thread_context->xskcxx . . $ thread_context#xsk., tsn_config->interfacecxx . . $ traffic_class_config#interface.,
855 tsn_config->xdp_skb_modecxx . . $ traffic_class_config#xdp_skb_mode.);
856
857 if (thread_context->workloadcxx . . $ thread_context#workload. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && thread_context->workloadcxx . . $ thread_context#workload.->workload_task_idcxx . . $ workload_config#workload_task_id.)
858 workload_thread_freecxx . . $ workload_thread_free(f7c2ab51214b7176).(thread_context);
859 }
860
861 static void tsn_threads_wait_for_finishcxx . . $ tsn_threads_wait_for_finish(f7c2ab51214b7176).(struct thread_contextcxx . . $ thread_context# *thread_context)
862 {
863 if (!thread_context)
864 return;
865
866 if (thread_context->workloadcxx . . $ thread_context#workload. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && thread_context->workloadcxx . . $ thread_context#workload.->workload_task_idcxx . . $ workload_config#workload_task_id.)
867 pthread_joincxx . . $ pthread_join(269902cf949f12c5).(thread_context->workloadcxx . . $ thread_context#workload.->workload_task_idcxx . . $ workload_config#workload_task_id., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
868 if (thread_context->rx_task_idcxx . . $ thread_context#rx_task_id.)
869 pthread_joincxx . . $ pthread_join(269902cf949f12c5).(thread_context->rx_task_idcxx . . $ thread_context#rx_task_id., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
870 if (thread_context->tx_task_idcxx . . $ thread_context#tx_task_id.)
871 pthread_joincxx . . $ pthread_join(269902cf949f12c5).(thread_context->tx_task_idcxx . . $ thread_context#tx_task_id., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
872 }
873
874 int tsn_low_threads_createcxx . . $ tsn_low_threads_create(8542e1c024f3ff56).(struct thread_contextcxx . . $ thread_context# *tsn_thread_context)
875 {
876 tsn_thread_context->confcxx . . $ thread_context#conf. = &app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[TSN_LOW_FRAME_TYPEcxx . . $ TSN_LOW_FRAME_TYPE.];
877 tsn_thread_context->frame_typecxx . . $ thread_context#frame_type. = TSN_LOW_FRAME_TYPEcxx . . $ TSN_LOW_FRAME_TYPE.;
878 tsn_thread_context->traffic_classcxx . . $ thread_context#traffic_class. = stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(TSN_LOW_FRAME_TYPEcxx . . $ TSN_LOW_FRAME_TYPE.);
879 tsn_thread_context->create_socketcxx . . $ thread_context#create_socket. = create_tsn_low_socketcxx . . $ create_tsn_low_socket(b126dc7c1de90089).;
880 tsn_thread_context->frame_idcxx . . $ thread_context#frame_id. =
881 app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[TSN_LOW_FRAME_TYPEcxx . . $ TSN_LOW_FRAME_TYPE.].security_modecxx . . $ traffic_class_config#security_mode. == SECURITY_MODE_NONEcxx . . $ SECURITY_MODE_NONE.
882 ? TSN_LOW_FRAMEIDcxx . . $ `src/net_def.h:43:9`!
883 : TSN_LOW_SEC_FRAMEIDcxx . . $ `src/net_def.h:44:9`!;
884
885 return tsn_threads_createcxx . . $ tsn_threads_create(8542e1c024f3ff56).(tsn_thread_context);
886 }
887
888 void tsn_low_threads_freecxx . . $ tsn_low_threads_free(f7c2ab51214b7176).(struct thread_contextcxx . . $ thread_context# *thread_context)
889 {
890 tsn_threads_freecxx . . $ tsn_threads_free(f7c2ab51214b7176).(thread_context);
891 }
892
893 void tsn_low_threads_wait_for_finishcxx . . $ tsn_low_threads_wait_for_finish(f7c2ab51214b7176).(struct thread_contextcxx . . $ thread_context# *thread_context)
894 {
895 tsn_threads_wait_for_finishcxx . . $ tsn_threads_wait_for_finish(f7c2ab51214b7176).(thread_context);
896 }
897
898 int tsn_high_threads_createcxx . . $ tsn_high_threads_create(8542e1c024f3ff56).(struct thread_contextcxx . . $ thread_context# *tsn_thread_context)
899 {
900 tsn_thread_context->confcxx . . $ thread_context#conf. = &app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[TSN_HIGH_FRAME_TYPEcxx . . $ TSN_HIGH_FRAME_TYPE.];
901 tsn_thread_context->frame_typecxx . . $ thread_context#frame_type. = TSN_HIGH_FRAME_TYPEcxx . . $ TSN_HIGH_FRAME_TYPE.;
902 tsn_thread_context->traffic_classcxx . . $ thread_context#traffic_class. = stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(TSN_HIGH_FRAME_TYPEcxx . . $ TSN_HIGH_FRAME_TYPE.);
903 tsn_thread_context->create_socketcxx . . $ thread_context#create_socket. = create_tsn_high_socketcxx . . $ create_tsn_high_socket(b126dc7c1de90089).;
904 tsn_thread_context->frame_idcxx . . $ thread_context#frame_id. =
905 app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[TSN_HIGH_FRAME_TYPEcxx . . $ TSN_HIGH_FRAME_TYPE.].security_modecxx . . $ traffic_class_config#security_mode. == SECURITY_MODE_NONEcxx . . $ SECURITY_MODE_NONE.
906 ? TSN_HIGH_FRAMEIDcxx . . $ `src/net_def.h:41:9`!
907 : TSN_HIGH_SEC_FRAMEIDcxx . . $ `src/net_def.h:42:9`!;
908
909 return tsn_threads_createcxx . . $ tsn_threads_create(8542e1c024f3ff56).(tsn_thread_context);
910 }
911
912 void tsn_high_threads_freecxx . . $ tsn_high_threads_free(f7c2ab51214b7176).(struct thread_contextcxx . . $ thread_context# *thread_context)
913 {
914 tsn_threads_freecxx . . $ tsn_threads_free(f7c2ab51214b7176).(thread_context);
915 }
916
917 void tsn_high_threads_wait_for_finishcxx . . $ tsn_high_threads_wait_for_finish(f7c2ab51214b7176).(struct thread_contextcxx . . $ thread_context# *thread_context)
918 {
919 tsn_threads_wait_for_finishcxx . . $ tsn_threads_wait_for_finish(f7c2ab51214b7176).(thread_context);
920 }