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

Function kni_process_tx

lib/ff_dpdk_kni.c:136–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136static int
137kni_process_tx(uint16_t port_id, __rte_unused uint16_t queue_id,
138 struct rte_mbuf **pkts_burst, unsigned count)
139{
140 /* read packet from kni ring(phy port) and transmit to kni */
141 uint16_t nb_tx, nb_to_tx, nb_kni_tx = 0;
142 nb_tx = rte_ring_dequeue_burst(kni_rp[port_id], (void **)pkts_burst, count, NULL);
143
144 /*
145 * The total ratelimit forwarded to the kernel, may a few more packets being sent, but it doesn’t matter,
146 * If there are too many processes, there is also the possibility that the control packet will be ratelimited.
147 */
148 if (ff_global_cfg.kni.kernel_packets_ratelimit) {
149 if (likely(kni_rate_limt.kernel_packets < (uint64_t)ff_global_cfg.kni.kernel_packets_ratelimit)) {
150 nb_to_tx = nb_tx;
151 } else {
152 nb_to_tx = 0;
153 }
154 kni_rate_limt.kernel_packets += nb_tx;
155 } else {
156 nb_to_tx = nb_tx;
157 }
158
159 nb_kni_tx = rte_eth_tx_burst(kni_stat[port_id]->port_id, 0, pkts_burst, nb_to_tx);
160
161 if(nb_kni_tx < nb_tx) {
162 uint16_t i;
163 for(i = nb_kni_tx; i < nb_tx; ++i)
164 rte_pktmbuf_free(pkts_burst[i]);
165
166 kni_stat[port_id]->rx_dropped += (nb_tx - nb_kni_tx);
167 }
168
169 kni_stat[port_id]->rx_packets += nb_kni_tx;
170 return 0;
171}
172
173static int
174kni_process_rx(uint16_t port_id, uint16_t queue_id,

Callers 1

ff_kni_processFunction · 0.85

Calls 3

rte_ring_dequeue_burstFunction · 0.85
rte_eth_tx_burstFunction · 0.85
rte_pktmbuf_freeFunction · 0.85

Tested by

no test coverage detected