enqueue the packet, and own it */
| 500 | |
| 501 | /* enqueue the packet, and own it */ |
| 502 | int |
| 503 | ff_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 | |
| 528 | error: |
| 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 |
no test coverage detected