@@ -2577,7 +2577,7 @@ static int check_missing_comp_in_queue(struct ena_adapter *adapter,
25772577 tx_buf = & tx_ring -> tx_buffer_info [i ];
25782578 last_jiffies = tx_buf -> last_jiffies ;
25792579 if (unlikely (last_jiffies &&
2580- time_is_before_jiffies (last_jiffies + TX_TIMEOUT ))) {
2580+ time_is_before_jiffies (last_jiffies + adapter -> missing_tx_completion_to ))) {
25812581 if (!tx_buf -> print_once )
25822582 netif_notice (adapter , tx_err , adapter -> netdev ,
25832583 "Found a Tx that wasn't completed on time, qid %d, index %d.\n" ,
@@ -2586,10 +2586,11 @@ static int check_missing_comp_in_queue(struct ena_adapter *adapter,
25862586 tx_buf -> print_once = 1 ;
25872587 missed_tx ++ ;
25882588
2589- if (unlikely (missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS )) {
2589+ if (unlikely (missed_tx > adapter -> missing_tx_completion_threshold )) {
25902590 netif_err (adapter , tx_err , adapter -> netdev ,
25912591 "The number of lost tx completions is above the threshold (%d > %d). Reset the device\n" ,
2592- missed_tx , MAX_NUM_OF_TIMEOUTED_PACKETS );
2592+ missed_tx ,
2593+ adapter -> missing_tx_completion_threshold );
25932594 set_bit (ENA_FLAG_TRIGGER_RESET , & adapter -> flags );
25942595 return - EIO ;
25952596 }
@@ -2613,6 +2614,9 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter)
26132614 if (test_bit (ENA_FLAG_TRIGGER_RESET , & adapter -> flags ))
26142615 return ;
26152616
2617+ if (adapter -> missing_tx_completion_to == ENA_HW_HINTS_NO_TIMEOUT )
2618+ return ;
2619+
26162620 budget = ENA_MONITORED_TX_QUEUES ;
26172621
26182622 for (i = adapter -> last_monitored_tx_qid ; i < adapter -> num_queues ; i ++ ) {
@@ -2690,8 +2694,11 @@ static void check_for_missing_keep_alive(struct ena_adapter *adapter)
26902694 if (!adapter -> wd_state )
26912695 return ;
26922696
2693- keep_alive_expired = round_jiffies (adapter -> last_keep_alive_jiffies
2694- + ENA_DEVICE_KALIVE_TIMEOUT );
2697+ if (adapter -> keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT )
2698+ return ;
2699+
2700+ keep_alive_expired = round_jiffies (adapter -> last_keep_alive_jiffies +
2701+ adapter -> keep_alive_timeout );
26952702 if (unlikely (time_is_before_jiffies (keep_alive_expired ))) {
26962703 netif_err (adapter , drv , adapter -> netdev ,
26972704 "Keep alive watchdog timeout.\n" );
@@ -2714,6 +2721,44 @@ static void check_for_admin_com_state(struct ena_adapter *adapter)
27142721 }
27152722}
27162723
2724+ static void ena_update_hints (struct ena_adapter * adapter ,
2725+ struct ena_admin_ena_hw_hints * hints )
2726+ {
2727+ struct net_device * netdev = adapter -> netdev ;
2728+
2729+ if (hints -> admin_completion_tx_timeout )
2730+ adapter -> ena_dev -> admin_queue .completion_timeout =
2731+ hints -> admin_completion_tx_timeout * 1000 ;
2732+
2733+ if (hints -> mmio_read_timeout )
2734+ /* convert to usec */
2735+ adapter -> ena_dev -> mmio_read .reg_read_to =
2736+ hints -> mmio_read_timeout * 1000 ;
2737+
2738+ if (hints -> missed_tx_completion_count_threshold_to_reset )
2739+ adapter -> missing_tx_completion_threshold =
2740+ hints -> missed_tx_completion_count_threshold_to_reset ;
2741+
2742+ if (hints -> missing_tx_completion_timeout ) {
2743+ if (hints -> missing_tx_completion_timeout == ENA_HW_HINTS_NO_TIMEOUT )
2744+ adapter -> missing_tx_completion_to = ENA_HW_HINTS_NO_TIMEOUT ;
2745+ else
2746+ adapter -> missing_tx_completion_to =
2747+ msecs_to_jiffies (hints -> missing_tx_completion_timeout );
2748+ }
2749+
2750+ if (hints -> netdev_wd_timeout )
2751+ netdev -> watchdog_timeo = msecs_to_jiffies (hints -> netdev_wd_timeout );
2752+
2753+ if (hints -> driver_watchdog_timeout ) {
2754+ if (hints -> driver_watchdog_timeout == ENA_HW_HINTS_NO_TIMEOUT )
2755+ adapter -> keep_alive_timeout = ENA_HW_HINTS_NO_TIMEOUT ;
2756+ else
2757+ adapter -> keep_alive_timeout =
2758+ msecs_to_jiffies (hints -> driver_watchdog_timeout );
2759+ }
2760+ }
2761+
27172762static void ena_update_host_info (struct ena_admin_host_info * host_info ,
27182763 struct net_device * netdev )
27192764{
@@ -3136,6 +3181,11 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
31363181 INIT_WORK (& adapter -> reset_task , ena_fw_reset_device );
31373182
31383183 adapter -> last_keep_alive_jiffies = jiffies ;
3184+ adapter -> keep_alive_timeout = ENA_DEVICE_KALIVE_TIMEOUT ;
3185+ adapter -> missing_tx_completion_to = TX_TIMEOUT ;
3186+ adapter -> missing_tx_completion_threshold = MAX_NUM_OF_TIMEOUTED_PACKETS ;
3187+
3188+ ena_update_hints (adapter , & get_feat_ctx .hw_hints );
31393189
31403190 setup_timer (& adapter -> timer_service , ena_timer_service ,
31413191 (unsigned long )adapter );
@@ -3337,6 +3387,7 @@ static void ena_notification(void *adapter_data,
33373387 struct ena_admin_aenq_entry * aenq_e )
33383388{
33393389 struct ena_adapter * adapter = (struct ena_adapter * )adapter_data ;
3390+ struct ena_admin_ena_hw_hints * hints ;
33403391
33413392 WARN (aenq_e -> aenq_common_desc .group != ENA_ADMIN_NOTIFICATION ,
33423393 "Invalid group(%x) expected %x\n" ,
@@ -3354,6 +3405,11 @@ static void ena_notification(void *adapter_data,
33543405 case ENA_ADMIN_RESUME :
33553406 queue_work (ena_wq , & adapter -> resume_io_task );
33563407 break ;
3408+ case ENA_ADMIN_UPDATE_HINTS :
3409+ hints = (struct ena_admin_ena_hw_hints * )
3410+ (& aenq_e -> inline_data_w4 );
3411+ ena_update_hints (adapter , hints );
3412+ break ;
33573413 default :
33583414 netif_err (adapter , drv , adapter -> netdev ,
33593415 "Invalid aenq notification link state %d\n" ,
0 commit comments