MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lsi_main_loop

Function lsi_main_loop

dpdk/examples/link_status_interrupt/main.c:196–291  ·  view source on GitHub ↗

main processing loop */

Source from the content-addressed store, hash-verified

194
195/* main processing loop */
196static void
197lsi_main_loop(void)
198{
199 struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
200 struct rte_mbuf *m;
201 unsigned lcore_id;
202 unsigned sent;
203 uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc;
204 unsigned i, j, portid, nb_rx;
205 struct lcore_queue_conf *qconf;
206 const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S *
207 BURST_TX_DRAIN_US;
208 struct rte_eth_dev_tx_buffer *buffer;
209
210 prev_tsc = 0;
211 timer_tsc = 0;
212
213 lcore_id = rte_lcore_id();
214 qconf = &lcore_queue_conf[lcore_id];
215
216 if (qconf->n_rx_port == 0) {
217 RTE_LOG(INFO, LSI, "lcore %u has nothing to do\n", lcore_id);
218 return;
219 }
220
221 RTE_LOG(INFO, LSI, "entering main loop on lcore %u\n", lcore_id);
222
223 for (i = 0; i < qconf->n_rx_port; i++) {
224
225 portid = qconf->rx_port_list[i];
226 RTE_LOG(INFO, LSI, " -- lcoreid=%u portid=%u\n", lcore_id,
227 portid);
228 }
229
230 while (1) {
231
232 /* Draining TX queue in its main loop. 8< */
233 cur_tsc = rte_rdtsc();
234
235 /*
236 * TX burst queue drain
237 */
238 diff_tsc = cur_tsc - prev_tsc;
239 if (unlikely(diff_tsc > drain_tsc)) {
240
241 for (i = 0; i < qconf->n_rx_port; i++) {
242
243 portid = lsi_dst_ports[qconf->rx_port_list[i]];
244 buffer = tx_buffer[portid];
245
246 sent = rte_eth_tx_buffer_flush(portid, 0, buffer);
247 if (sent)
248 port_statistics[portid].tx += sent;
249
250 }
251
252 /* if timer is enabled */
253 if (timer_period > 0) {

Callers 1

lsi_launch_one_lcoreFunction · 0.85

Calls 8

rte_get_tsc_hzFunction · 0.85
rte_lcore_idFunction · 0.85
rte_eth_tx_buffer_flushFunction · 0.85
rte_get_main_lcoreFunction · 0.85
rte_eth_rx_burstFunction · 0.85
lsi_simple_forwardFunction · 0.85
print_statsFunction · 0.70
rte_rdtscFunction · 0.50

Tested by

no test coverage detected