@@ -55,6 +55,7 @@ struct dect_phy_ping_tx_metrics {
5555 uint32_t tx_total_data_amount ;
5656 uint32_t tx_total_ping_req_count ;
5757 uint32_t tx_total_ping_resp_count ;
58+ uint32_t tx_failed_due_to_lbt ;
5859};
5960
6061struct dect_phy_ping_rx_metrics {
@@ -878,7 +879,10 @@ static void dect_phy_ping_client_tx_schedule(uint64_t first_possible_tx)
878879 sched_list_item_conf -> length_slots = cmd_params -> slot_count ;
879880 sched_list_item_conf -> length_subslots = 0 ;
880881
881- sched_list_item_conf -> tx .phy_lbt_period = 0 ;
882+ sched_list_item_conf -> tx .phy_lbt_period = ping_data .client_data .tx_op .lbt_period ;
883+ sched_list_item_conf -> tx .phy_lbt_rssi_threshold_max =
884+ ping_data .client_data .tx_op .lbt_rssi_threshold_max ;
885+
882886 sched_list_item -> priority = DECT_PRIORITY1_TX ;
883887
884888 sched_list_item_conf -> tx .combined_tx_rx_use = true;
@@ -967,7 +971,7 @@ static int dect_phy_ping_client_start(void)
967971
968972 uint64_t time_now = dect_app_modem_time_now ();
969973 uint64_t first_possible_tx =
970- time_now + (2 * US_TO_MODEM_TICKS (current_settings -> scheduler .scheduling_delay_us ));
974+ time_now + (5 * US_TO_MODEM_TICKS (current_settings -> scheduler .scheduling_delay_us ));
971975
972976 /* Sending max amount of data that can be encoded to given slot amount */
973977 int16_t ping_pdu_byte_count =
@@ -988,12 +992,14 @@ static int dect_phy_ping_client_start(void)
988992 header .feedback .format1 .harq_process_number0 = DECT_HARQ_CLIENT ;
989993 }
990994
991- desh_print ("Starting ping client on channel %d: byte count per TX: %d, slots %d, interval "
992- "%d secs,"
993- " mcs %d, count %d, timeout %d msecs, HARQ: %s, expected RSSI level on RX %d." ,
995+ desh_print ("Starting ping client on channel %d:\n"
996+ " byte count per TX: %d, slots %d, interval %d secs,\n"
997+ " mcs %d, LBT period %d, count %d, timeout %d msecs, HARQ: %s,\n"
998+ " expected RSSI level on RX %d." ,
994999 params -> channel , ping_pdu_byte_count , params -> slot_count , params -> interval_secs ,
995- params -> tx_mcs , params -> ping_count , params -> timeout_msecs ,
996- (params -> use_harq ) ? "yes" : "no" , params -> expected_rx_rssi_level );
1000+ params -> tx_mcs , params -> tx_lbt_period_symbols , params -> ping_count ,
1001+ params -> timeout_msecs , (params -> use_harq ) ? "yes" : "no" ,
1002+ params -> expected_rx_rssi_level );
9971003
9981004 uint16_t ping_pdu_payload_byte_count =
9991005 ping_pdu_byte_count - DECT_PHY_PING_TX_DATA_PDU_LEN_WITHOUT_PAYLOAD ;
@@ -1025,9 +1031,10 @@ static int dect_phy_ping_client_start(void)
10251031 ping_data .client_data .tx_op .carrier = params -> channel ;
10261032 ping_data .client_data .tx_op .data_size = ping_pdu_byte_count ;
10271033 ping_data .client_data .tx_op .data = encoded_data_to_send ;
1028- ping_data .client_data .tx_op .lbt_period = 0 ;
1034+ ping_data .client_data .tx_op .lbt_period = params -> tx_lbt_period_symbols *
1035+ NRF_MODEM_DECT_SYMBOL_DURATION ;
10291036 ping_data .client_data .tx_op .lbt_rssi_threshold_max =
1030- current_settings -> rssi_scan . busy_threshold ;
1037+ params -> tx_lbt_rssi_busy_threshold_dbm ;
10311038
10321039 ping_data .client_data .tx_op .network_id = current_settings -> common .network_id ;
10331040 ping_data .client_data .tx_op .phy_header = & ping_data .client_data .tx_phy_header ;
@@ -1238,6 +1245,8 @@ dect_phy_ping_client_report_local_results_and_req_server_results(int64_t *elapse
12381245 ping_data .tx_metrics .tx_total_data_amount );
12391246 desh_print (" tx: ping req count: %d" ,
12401247 ping_data .tx_metrics .tx_total_ping_req_count );
1248+ desh_print (" tx: ping failed due to LBT count: %d" ,
1249+ ping_data .tx_metrics .tx_failed_due_to_lbt );
12411250 desh_print (" rx: ping resp count: %d" ,
12421251 ping_data .rx_metrics .rx_total_ping_resp_count );
12431252 desh_print (" rx: total amount of data: %d bytes" ,
@@ -1710,29 +1719,33 @@ static void dect_phy_ping_thread_fn(void)
17101719 struct dect_phy_common_op_completed_params * params =
17111720 (struct dect_phy_common_op_completed_params * )event .data ;
17121721
1713- if (params -> status != NRF_MODEM_DECT_PHY_SUCCESS ) {
1722+ if (params -> status == NRF_MODEM_DECT_PHY_SUCCESS ) {
1723+ if (dect_phy_ping_handle_is (params -> handle )) {
1724+ dect_phy_ping_mdm_op_completed (params );
1725+ } else if (params -> handle == DECT_HARQ_FEEDBACK_TX_HANDLE ) {
1726+ desh_print ("HARQ feedback sent." );
1727+ }
1728+ } else if (params -> status != NRF_MODEM_DECT_PHY_ERR_OP_CANCELED ) {
17141729 char tmp_str [128 ] = {0 };
17151730
17161731 dect_common_utils_modem_phy_err_to_string (
17171732 params -> status , params -> temperature , tmp_str );
1718-
1719- if (params -> status != NRF_MODEM_DECT_PHY_ERR_OP_CANCELED ) {
1720- if (dect_phy_ping_handle_is (params -> handle )) {
1721- desh_warn ("%s: ping modem operation failed: %s, "
1722- "handle %d" ,
1723- __func__ , tmp_str , params -> handle );
1724- dect_phy_ping_mdm_op_completed (params );
1733+ if (dect_phy_ping_handle_is (params -> handle )) {
1734+ if (params -> status ==
1735+ NRF_MODEM_DECT_PHY_ERR_LBT_CHANNEL_BUSY ) {
1736+ desh_warn ("%s: cannot TX ping due to LBT, "
1737+ "channel was busy" , __func__ );
1738+ ping_data .tx_metrics .tx_failed_due_to_lbt ++ ;
17251739 } else {
1726- desh_error ("%s: operation (handle %d) failed with "
1727- "status : %s" ,
1728- __func__ , params -> handle , tmp_str );
1740+ desh_warn ("%s: ping modem operation "
1741+ "failed : %s, handle %d " ,
1742+ __func__ , tmp_str , params -> handle );
17291743 }
1730- }
1731- } else {
1732- if (dect_phy_ping_handle_is (params -> handle )) {
17331744 dect_phy_ping_mdm_op_completed (params );
1734- } else if (params -> handle == DECT_HARQ_FEEDBACK_TX_HANDLE ) {
1735- desh_print ("HARQ feedback sent." );
1745+ } else {
1746+ desh_error ("%s: operation (handle %d) failed with "
1747+ "status: %s" ,
1748+ __func__ , params -> handle , tmp_str );
17361749 }
17371750 }
17381751 break ;
0 commit comments