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

Function ff_kni_enqueue

lib/ff_dpdk_kni.c:502–535  ·  view source on GitHub ↗

enqueue the packet, and own it */

Source from the content-addressed store, hash-verified

500
501/* enqueue the packet, and own it */
502int
503ff_kni_enqueue(enum FilterReturn filter, uint16_t port_id, struct rte_mbuf *pkt)
504{
505 if (filter >= FILTER_ARP) {
506 if (ff_global_cfg.kni.console_packets_ratelimit) {
507 kni_rate_limt.console_packets++;
508 if (kni_rate_limt.console_packets > (uint64_t)ff_global_cfg.kni.console_packets_ratelimit) {
509 goto error;
510 }
511 }
512 } else {
513 if (ff_global_cfg.kni.general_packets_ratelimit) {
514 kni_rate_limt.gerneal_packets++;
515 if (kni_rate_limt.gerneal_packets > (uint64_t)ff_global_cfg.kni.general_packets_ratelimit) {
516 goto error;
517 }
518 }
519 }
520
521 int ret = rte_ring_enqueue(kni_rp[port_id], pkt);
522 if (ret < 0) {
523 goto error;
524 }
525
526 return 0;
527
528error:
529 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
530 kni_stat[port_id]->rx_dropped++;
531 }
532 rte_pktmbuf_free(pkt);
533
534 return -1;
535}
536

Callers 1

ff_dpdk_if.cFile · 0.85

Calls 3

rte_ring_enqueueFunction · 0.85
rte_eal_process_typeFunction · 0.85
rte_pktmbuf_freeFunction · 0.85

Tested by

no test coverage detected