| 1643 | #endif /* RTE_LIB_EVENTDEV */ |
| 1644 | |
| 1645 | static int |
| 1646 | test_expiry_with_event_timer(const struct pdcp_test_conf *ul_conf) |
| 1647 | { |
| 1648 | #ifdef RTE_LIB_EVENTDEV |
| 1649 | const enum rte_security_pdcp_sn_size sn_size = ul_conf->entity.pdcp_xfrm.sn_size; |
| 1650 | struct rte_mbuf *m1 = NULL, *out_mb[1] = {0}; |
| 1651 | uint16_t n = 0, nb_err = 0, nb_try = 5; |
| 1652 | struct rte_pdcp_entity *pdcp_entity; |
| 1653 | struct pdcp_test_conf dl_conf; |
| 1654 | int ret = TEST_FAILED, nb_out; |
| 1655 | struct rte_event event; |
| 1656 | |
| 1657 | const int start_count = 0; |
| 1658 | struct rte_event_timer evtim = { |
| 1659 | .ev.op = RTE_EVENT_OP_NEW, |
| 1660 | .ev.queue_id = TEST_EV_QUEUE_ID, |
| 1661 | .ev.sched_type = RTE_SCHED_TYPE_ATOMIC, |
| 1662 | .ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL, |
| 1663 | .ev.event_type = RTE_EVENT_TYPE_TIMER, |
| 1664 | .state = RTE_EVENT_TIMER_NOT_ARMED, |
| 1665 | .timeout_ticks = 1, |
| 1666 | }; |
| 1667 | |
| 1668 | if (ul_conf->entity.pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK) |
| 1669 | return TEST_SKIPPED; |
| 1670 | |
| 1671 | /* Create configuration for actual testing */ |
| 1672 | uplink_to_downlink_convert(ul_conf, &dl_conf); |
| 1673 | dl_conf.entity.pdcp_xfrm.hfn = pdcp_hfn_from_count_get(start_count, sn_size); |
| 1674 | dl_conf.entity.sn = pdcp_sn_from_count_get(start_count, sn_size); |
| 1675 | dl_conf.entity.t_reordering.args = &evtim; |
| 1676 | dl_conf.entity.t_reordering.timer = testsuite_params.timdev; |
| 1677 | dl_conf.entity.t_reordering.start = event_timer_start_cb; |
| 1678 | |
| 1679 | pdcp_entity = test_entity_create(&dl_conf, &ret); |
| 1680 | if (pdcp_entity == NULL) |
| 1681 | return ret; |
| 1682 | |
| 1683 | evtim.ev.event_ptr = pdcp_entity; |
| 1684 | |
| 1685 | /* Send packet with SN > RX_DELIV to create a gap */ |
| 1686 | m1 = generate_packet_for_dl_with_sn(*ul_conf, start_count + 1); |
| 1687 | ASSERT_TRUE_OR_GOTO(m1 != NULL, exit, "Could not allocate buffer for packet\n"); |
| 1688 | |
| 1689 | /* Buffered packets after insert [NULL, m1] */ |
| 1690 | n = test_process_packets(pdcp_entity, dl_conf.entity.dev_id, &m1, 1, out_mb, &nb_err); |
| 1691 | ASSERT_TRUE_OR_GOTO(nb_err == 0, exit, "Error occurred during packet buffering\n"); |
| 1692 | ASSERT_TRUE_OR_GOTO(n == 0, exit, "Packet was not buffered as expected\n"); |
| 1693 | |
| 1694 | m1 = NULL; /* Packet was moved to PDCP lib */ |
| 1695 | |
| 1696 | n = rte_event_dequeue_burst(testsuite_params.evdev, TEST_EV_PORT_ID, &event, 1, 0); |
| 1697 | while (n != 1) { |
| 1698 | rte_delay_us(testsuite_params.min_resolution_ns / 1000); |
| 1699 | n = rte_event_dequeue_burst(testsuite_params.evdev, TEST_EV_PORT_ID, &event, 1, 0); |
| 1700 | ASSERT_TRUE_OR_GOTO(nb_try > 0, exit, |
| 1701 | "Dequeued unexpected timer expiry event: %i\n", n); |
| 1702 | nb_try--; |
nothing calls this directly
no test coverage detected