@@ -158,6 +158,11 @@ static struct dect_phy_ping_data {
158
158
static struct dect_phy_ping_harq_tx_process_info
159
159
harq_processes [DECT_PHY_PING_HARQ_TX_PROCESS_COUNT ];
160
160
161
+ struct dect_phy_ping_harq_tx_payload_data_evt {
162
+ enum dect_harq_user harq_user ;
163
+ uint32_t phy_handle ;
164
+ };
165
+
161
166
/**************************************************************************************************/
162
167
163
168
static void dect_phy_ping_rx_on_pcc_crc_failure (void );
@@ -288,10 +293,11 @@ static bool dect_phy_ping_harq_process_init(enum dect_phy_common_role role,
288
293
void dect_phy_ping_harq_process_round_start (enum dect_harq_user harq_user )
289
294
{
290
295
if (harq_processes [harq_user ].process_in_use ) {
291
- desh_warn ("Previous HARQ still on going and starting new round "
296
+ desh_warn ("Previous HARQ retx still ongoing and starting new round "
292
297
"- no response to prev data?" );
293
298
}
294
299
harq_processes [harq_user ].process_in_use = true;
300
+ harq_processes [harq_user ].rtx_ongoing = false;
295
301
harq_processes [harq_user ].last_redundancy_version = 0 ;
296
302
}
297
303
@@ -309,6 +315,7 @@ void dect_phy_ping_harq_store_tx_payload_data_scheduler_cb(
309
315
struct dect_phy_api_scheduler_list_item * ctrl_sche_list_item =
310
316
& (harq_processes [harq_data -> harq_user ].sche_list_item );
311
317
enum dect_harq_user harq_user = harq_data -> harq_user ;
318
+ struct dect_phy_ping_harq_tx_payload_data_evt ping_harq_evt_data ;
312
319
313
320
__ASSERT_NO_MSG (harq_user == DECT_HARQ_CLIENT ); /* Only DECT_HARQ_CLIENT supported */
314
321
__ASSERT_NO_MSG (in_sche_list_item -> sched_config .tx .encoded_payload_pdu_size <=
@@ -317,8 +324,24 @@ void dect_phy_ping_harq_store_tx_payload_data_scheduler_cb(
317
324
dect_phy_api_scheduler_list_item_mem_copy (ctrl_sche_list_item , in_sche_list_item );
318
325
dect_phy_api_scheduler_list_item_dealloc (in_sche_list_item );
319
326
320
- dect_phy_ping_msgq_data_op_add (DECT_PHY_PING_EVENT_HARQ_PAYLOAD_STORED , (void * )& harq_user ,
321
- sizeof (enum dect_harq_user ));
327
+ ping_harq_evt_data .phy_handle = ctrl_sche_list_item -> phy_op_handle ;
328
+ ping_harq_evt_data .harq_user = harq_user ;
329
+
330
+ dect_phy_ping_msgq_data_op_add (DECT_PHY_PING_EVENT_HARQ_PAYLOAD_STORED ,
331
+ (void * )& ping_harq_evt_data ,
332
+ sizeof (struct dect_phy_ping_harq_tx_payload_data_evt ));
333
+ }
334
+
335
+ static void dect_phy_ping_client_retx_complete_cb (
336
+ struct dect_phy_common_op_completed_params * params , uint64_t tx_frame_time )
337
+ {
338
+ if (params -> status == DECT_SCHEDULER_DELAYED_ERROR || params -> status ==
339
+ DECT_SCHEDULER_SCHEDULER_FATAL_MEM_ALLOC_ERROR ) {
340
+ desh_error ("DECT_HARQ_CLIENT: retransmit failed - scheduler error: %d\n" ,
341
+ params -> status );
342
+ } else if (params -> status != NRF_MODEM_DECT_PHY_SUCCESS ) {
343
+ desh_error ("DECT_HARQ_CLIENT: retransmit failed - error %d\n" , params -> status );
344
+ }
322
345
}
323
346
324
347
void dect_phy_ping_harq_client_nak_handle (void )
@@ -360,20 +383,22 @@ void dect_phy_ping_harq_client_nak_handle(void)
360
383
struct dect_phy_settings * current_settings = dect_common_settings_ref_get ();
361
384
362
385
first_possible_tx =
363
- time_now + US_TO_MODEM_TICKS (current_settings -> scheduler .scheduling_delay_us );
386
+ time_now + ( 2 * US_TO_MODEM_TICKS (current_settings -> scheduler .scheduling_delay_us ) );
364
387
365
388
/* Overwrite handle, complete_cb, tx/rx timing and redundancy version to header */
366
389
new_sched_list_item -> phy_op_handle = DECT_PHY_PING_CLIENT_RE_TX_HANDLE ;
367
- new_sched_list_item_conf -> cb_op_completed = NULL ;
368
390
new_sched_list_item_conf -> frame_time = first_possible_tx ;
391
+ new_sched_list_item_conf -> tx .combined_tx_rx_use = true;
369
392
new_sched_list_item_conf -> tx .combined_rx_op .duration =
370
393
MAX (remaining_time , MS_TO_MODEM_TICKS (100 ));
371
394
372
395
/* Only one timer and we don't want to have separate callback for completion */
373
396
new_sched_list_item_conf -> interval_mdm_ticks = 0 ;
374
397
new_sched_list_item_conf -> interval_count_left = 0 ;
375
398
new_sched_list_item_conf -> cb_op_to_mdm_with_interval_count_completed = NULL ;
376
- new_sched_list_item_conf -> cb_op_completed = NULL ;
399
+
400
+ /* ... except for completion failures that happens already in a scheduler */
401
+ new_sched_list_item_conf -> cb_op_completed = dect_phy_ping_client_retx_complete_cb ;
377
402
378
403
struct dect_phy_header_type2_format0_t * header =
379
404
(void * )& (new_sched_list_item_conf -> tx .phy_header );
@@ -388,6 +413,10 @@ void dect_phy_ping_harq_client_nak_handle(void)
388
413
dect_phy_api_scheduler_list_item_dealloc (new_sched_list_item );
389
414
} else {
390
415
harq_processes [DECT_HARQ_CLIENT ].rtx_ongoing = true;
416
+ harq_processes [DECT_HARQ_CLIENT ].last_redundancy_version =
417
+ redundancy_version ;
418
+ desh_print ("PCC: DECT_HARQ_CLIENT: retransmit scheduled, redundancy version %d" ,
419
+ redundancy_version );
391
420
}
392
421
}
393
422
@@ -1523,11 +1552,12 @@ void dect_phy_ping_mdm_op_completed(
1523
1552
!harq_processes [DECT_HARQ_CLIENT ].rtx_ongoing ) {
1524
1553
desh_warn ("ping timeout for seq_nbr %d" ,
1525
1554
ping_data .client_data .tx_next_seq_nbr - 1 );
1555
+ dect_phy_ping_harq_process_round_end (DECT_HARQ_CLIENT );
1526
1556
}
1527
1557
if (ping_data .client_data .tx_scheduler_intervals_done &&
1528
1558
!harq_processes [DECT_HARQ_CLIENT ].rtx_ongoing &&
1529
- ping_data .cmd_params . ping_count = =
1530
- ping_data .tx_metrics . tx_total_ping_req_count ) {
1559
+ ping_data .tx_metrics . tx_total_ping_req_count > =
1560
+ ping_data .cmd_params . ping_count ) {
1531
1561
dect_phy_ping_client_report_local_results_and_req_server_results (
1532
1562
NULL );
1533
1563
}
@@ -1568,7 +1598,8 @@ void dect_phy_ping_mdm_op_completed(
1568
1598
1569
1599
first_possible_start =
1570
1600
time_now +
1571
- US_TO_MODEM_TICKS (current_settings -> scheduler .scheduling_delay_us );
1601
+ (2 * US_TO_MODEM_TICKS (
1602
+ current_settings -> scheduler .scheduling_delay_us ));
1572
1603
1573
1604
dect_phy_ping_server_data_on_going_rx_count_decrease ();
1574
1605
@@ -1646,6 +1677,8 @@ static void dect_phy_ping_thread_fn(void)
1646
1677
dect_phy_ping_mdm_op_completed (params );
1647
1678
} else if (params -> handle == DECT_HARQ_FEEDBACK_TX_HANDLE ) {
1648
1679
desh_print ("HARQ feedback sent." );
1680
+ } else if (params -> handle == DECT_HARQ_FEEDBACK_RX_HANDLE ) {
1681
+ desh_print ("HARQ feedback RX completed." );
1649
1682
}
1650
1683
} else if (params -> status != NRF_MODEM_DECT_PHY_ERR_OP_CANCELED ) {
1651
1684
char tmp_str [128 ] = {0 };
@@ -1840,6 +1873,9 @@ static void dect_phy_ping_thread_fn(void)
1840
1873
DECT_PHY_PING_CLIENT_RX_HANDLE );
1841
1874
dect_phy_ping_harq_client_nak_handle ();
1842
1875
}
1876
+ } else {
1877
+ desh_warn ("PCC: DECT_HARQ_CLIENT: HARQ resp received "
1878
+ "but no HARQ process in use." );
1843
1879
}
1844
1880
} else {
1845
1881
desh_warn ("Unsupported process nbr %d received in HARQ feedback" ,
@@ -1905,9 +1941,12 @@ static void dect_phy_ping_thread_fn(void)
1905
1941
break ;
1906
1942
}
1907
1943
case DECT_PHY_PING_EVENT_HARQ_PAYLOAD_STORED : {
1908
- enum dect_harq_user * harq_user = (enum dect_harq_user * )event .data ;
1944
+ struct dect_phy_ping_harq_tx_payload_data_evt * evt_data =
1945
+ (struct dect_phy_ping_harq_tx_payload_data_evt * )event .data ;
1909
1946
1910
- dect_phy_ping_harq_process_round_start (* harq_user );
1947
+ if (evt_data -> phy_handle != DECT_PHY_PING_CLIENT_RE_TX_HANDLE ) {
1948
+ dect_phy_ping_harq_process_round_start (evt_data -> harq_user );
1949
+ }
1911
1950
break ;
1912
1951
}
1913
1952
@@ -2198,7 +2237,7 @@ static int dect_phy_ping_rx_pdc_data_handle(struct dect_phy_data_rcv_common_para
2198
2237
desh_print ("Server results received." );
2199
2238
dect_phy_ping_cmd_done ();
2200
2239
} else if (pdu .header .message_type == DECT_MAC_MESSAGE_TYPE_PING_HARQ_FEEDBACK ) {
2201
- desh_print ("HARQ feedback received." );
2240
+ desh_print ("PDU for HARQ feedback received." );
2202
2241
} else {
2203
2242
desh_warn ("type %d" , pdu .header .message_type );
2204
2243
}
0 commit comments