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

Function main_telemetry_loop

dpdk/examples/l3fwd-power/main.c:1077–1194  ·  view source on GitHub ↗

main processing loop */

Source from the content-addressed store, hash-verified

1075
1076/* main processing loop */
1077static int
1078main_telemetry_loop(__rte_unused void *dummy)
1079{
1080 struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
1081 unsigned int lcore_id;
1082 uint64_t prev_tsc, diff_tsc, cur_tsc, prev_tel_tsc;
1083 int i, j, nb_rx;
1084 uint16_t portid, queueid;
1085 struct lcore_conf *qconf;
1086 struct lcore_rx_queue *rx_queue;
1087 uint64_t ep_nep[2] = {0}, fp_nfp[2] = {0};
1088 uint64_t poll_count;
1089 enum busy_rate br;
1090
1091 const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
1092 US_PER_S * BURST_TX_DRAIN_US;
1093
1094 poll_count = 0;
1095 prev_tsc = 0;
1096 prev_tel_tsc = 0;
1097
1098 lcore_id = rte_lcore_id();
1099 qconf = &lcore_conf[lcore_id];
1100
1101 if (qconf->n_rx_queue == 0) {
1102 RTE_LOG(INFO, L3FWD_POWER, "lcore %u has nothing to do\n",
1103 lcore_id);
1104 return 0;
1105 }
1106
1107 RTE_LOG(INFO, L3FWD_POWER, "entering main telemetry loop on lcore %u\n",
1108 lcore_id);
1109
1110 for (i = 0; i < qconf->n_rx_queue; i++) {
1111 portid = qconf->rx_queue_list[i].port_id;
1112 queueid = qconf->rx_queue_list[i].queue_id;
1113 RTE_LOG(INFO, L3FWD_POWER, " -- lcoreid=%u portid=%u "
1114 "rxqueueid=%" PRIu16 "\n", lcore_id, portid, queueid);
1115 }
1116
1117 while (!is_done()) {
1118
1119 cur_tsc = rte_rdtsc();
1120 /*
1121 * TX burst queue drain
1122 */
1123 diff_tsc = cur_tsc - prev_tsc;
1124 if (unlikely(diff_tsc > drain_tsc)) {
1125 for (i = 0; i < qconf->n_tx_port; ++i) {
1126 portid = qconf->tx_port_id[i];
1127 rte_eth_tx_buffer_flush(portid,
1128 qconf->tx_queue_id[portid],
1129 qconf->tx_buffer[portid]);
1130 }
1131 prev_tsc = cur_tsc;
1132 }
1133
1134 /*

Callers

nothing calls this directly

Calls 9

rte_get_tsc_hzFunction · 0.85
rte_lcore_idFunction · 0.85
is_doneFunction · 0.85
rte_eth_tx_buffer_flushFunction · 0.85
rte_eth_rx_burstFunction · 0.85
l3fwd_simple_forwardFunction · 0.70
rte_rdtscFunction · 0.50
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected