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

Function burst_packets

dpdk/drivers/event/sw/sw_evdev_selftest.c:667–775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665}
666
667static int
668burst_packets(struct test *t)
669{
670 /************** CONFIG ****************/
671 uint32_t i;
672 int err;
673 int ret;
674
675 /* Create instance with 2 ports and 2 queues */
676 if (init(t, 2, 2) < 0 ||
677 create_ports(t, 2) < 0 ||
678 create_atomic_qids(t, 2) < 0) {
679 printf("%d: Error initializing device\n", __LINE__);
680 return -1;
681 }
682
683 /* CQ mapping to QID */
684 ret = rte_event_port_link(evdev, t->port[0], &t->qid[0], NULL, 1);
685 if (ret != 1) {
686 printf("%d: error mapping lb qid0\n", __LINE__);
687 return -1;
688 }
689 ret = rte_event_port_link(evdev, t->port[1], &t->qid[1], NULL, 1);
690 if (ret != 1) {
691 printf("%d: error mapping lb qid1\n", __LINE__);
692 return -1;
693 }
694
695 if (rte_event_dev_start(evdev) < 0) {
696 printf("%d: Error with start call\n", __LINE__);
697 return -1;
698 }
699
700 /************** FORWARD ****************/
701 const uint32_t rx_port = 0;
702 const uint32_t NUM_PKTS = 2;
703
704 for (i = 0; i < NUM_PKTS; i++) {
705 struct rte_mbuf *arp = rte_gen_arp(0, t->mbuf_pool);
706 if (!arp) {
707 printf("%d: error generating pkt\n", __LINE__);
708 return -1;
709 }
710
711 struct rte_event ev = {
712 .op = RTE_EVENT_OP_NEW,
713 .queue_id = i % 2,
714 .flow_id = i % 3,
715 .mbuf = arp,
716 };
717 /* generate pkt and enqueue */
718 err = rte_event_enqueue_burst(evdev, t->port[rx_port], &ev, 1);
719 if (err != 1) {
720 printf("%d: Failed to enqueue\n", __LINE__);
721 return -1;
722 }
723 }
724 rte_service_run_iter_on_app_lcore(t->service_id, 1);

Callers 1

test_sw_eventdevFunction · 0.85

Calls 14

rte_event_port_linkFunction · 0.85
rte_event_dev_startFunction · 0.85
rte_event_enqueue_burstFunction · 0.85
test_event_dev_stats_getFunction · 0.85
rte_event_dev_dumpFunction · 0.85
rte_event_dequeue_burstFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
initFunction · 0.70
create_portsFunction · 0.70
create_atomic_qidsFunction · 0.70
rte_gen_arpFunction · 0.70

Tested by

no test coverage detected