@@ -416,6 +416,32 @@ hwrm_update_token(struct bnxt *bp, u16 seq_id, enum bnxt_hwrm_wait_state state)
416
416
netdev_err (bp -> dev , "Invalid hwrm seq id %d\n" , seq_id );
417
417
}
418
418
419
+ static void hwrm_req_dbg (struct bnxt * bp , struct input * req )
420
+ {
421
+ u32 ring = le16_to_cpu (req -> cmpl_ring );
422
+ u32 type = le16_to_cpu (req -> req_type );
423
+ u32 tgt = le16_to_cpu (req -> target_id );
424
+ u32 seq = le16_to_cpu (req -> seq_id );
425
+ char opt [32 ] = "\n" ;
426
+
427
+ if (unlikely (ring != (u16 )BNXT_HWRM_NO_CMPL_RING ))
428
+ snprintf (opt , 16 , " ring %d\n" , ring );
429
+
430
+ if (unlikely (tgt != BNXT_HWRM_TARGET ))
431
+ snprintf (opt + strlen (opt ) - 1 , 16 , " tgt 0x%x\n" , tgt );
432
+
433
+ netdev_dbg (bp -> dev , "sent hwrm req_type 0x%x seq id 0x%x%s" ,
434
+ type , seq , opt );
435
+ }
436
+
437
+ #define hwrm_err (bp , ctx , fmt , ...) \
438
+ do { \
439
+ if ((ctx)->flags & BNXT_HWRM_CTX_SILENT) \
440
+ netdev_dbg((bp)->dev, fmt, __VA_ARGS__); \
441
+ else \
442
+ netdev_err((bp)->dev, fmt, __VA_ARGS__); \
443
+ } while (0)
444
+
419
445
static int __hwrm_send (struct bnxt * bp , struct bnxt_hwrm_ctx * ctx )
420
446
{
421
447
u32 doorbell_offset = BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER ;
@@ -436,8 +462,11 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
436
462
memset (ctx -> resp , 0 , PAGE_SIZE );
437
463
438
464
req_type = le16_to_cpu (ctx -> req -> req_type );
439
- if (BNXT_NO_FW_ACCESS (bp ) && req_type != HWRM_FUNC_RESET )
465
+ if (BNXT_NO_FW_ACCESS (bp ) && req_type != HWRM_FUNC_RESET ) {
466
+ netdev_dbg (bp -> dev , "hwrm req_type 0x%x skipped, FW channel down\n" ,
467
+ req_type );
440
468
goto exit ;
469
+ }
441
470
442
471
if (msg_len > BNXT_HWRM_MAX_REQ_LEN &&
443
472
msg_len > bp -> hwrm_max_ext_req_len ) {
@@ -490,6 +519,8 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
490
519
/* Ring channel doorbell */
491
520
writel (1 , bp -> bar0 + doorbell_offset );
492
521
522
+ hwrm_req_dbg (bp , ctx -> req );
523
+
493
524
if (!pci_is_enabled (bp -> pdev )) {
494
525
rc = - ENODEV ;
495
526
goto exit ;
@@ -531,9 +562,8 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
531
562
}
532
563
533
564
if (READ_ONCE (token -> state ) != BNXT_HWRM_COMPLETE ) {
534
- if (!(ctx -> flags & BNXT_HWRM_CTX_SILENT ))
535
- netdev_err (bp -> dev , "Resp cmpl intr err msg: 0x%x\n" ,
536
- le16_to_cpu (ctx -> req -> req_type ));
565
+ hwrm_err (bp , ctx , "Resp cmpl intr err msg: 0x%x\n" ,
566
+ req_type );
537
567
goto exit ;
538
568
}
539
569
len = le16_to_cpu (READ_ONCE (ctx -> resp -> resp_len ));
@@ -565,7 +595,7 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
565
595
if (resp_seq != seen_out_of_seq ) {
566
596
netdev_warn (bp -> dev , "Discarding out of seq response: 0x%x for msg {0x%x 0x%x}\n" ,
567
597
le16_to_cpu (resp_seq ),
568
- le16_to_cpu ( ctx -> req -> req_type ) ,
598
+ req_type ,
569
599
le16_to_cpu (ctx -> req -> seq_id ));
570
600
seen_out_of_seq = resp_seq ;
571
601
}
@@ -585,11 +615,9 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
585
615
586
616
if (i >= tmo_count ) {
587
617
timeout_abort :
588
- if (!(ctx -> flags & BNXT_HWRM_CTX_SILENT ))
589
- netdev_err (bp -> dev , "Error (timeout: %u) msg {0x%x 0x%x} len:%d\n" ,
590
- hwrm_total_timeout (i ),
591
- le16_to_cpu (ctx -> req -> req_type ),
592
- le16_to_cpu (ctx -> req -> seq_id ), len );
618
+ hwrm_err (bp , ctx , "Error (timeout: %u) msg {0x%x 0x%x} len:%d\n" ,
619
+ hwrm_total_timeout (i ), req_type ,
620
+ le16_to_cpu (ctx -> req -> seq_id ), len );
593
621
goto exit ;
594
622
}
595
623
@@ -604,12 +632,9 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
604
632
}
605
633
606
634
if (j >= HWRM_VALID_BIT_DELAY_USEC ) {
607
- if (!(ctx -> flags & BNXT_HWRM_CTX_SILENT ))
608
- netdev_err (bp -> dev , "Error (timeout: %u) msg {0x%x 0x%x} len:%d v:%d\n" ,
609
- hwrm_total_timeout (i ),
610
- le16_to_cpu (ctx -> req -> req_type ),
611
- le16_to_cpu (ctx -> req -> seq_id ), len ,
612
- * valid );
635
+ hwrm_err (bp , ctx , "Error (timeout: %u) msg {0x%x 0x%x} len:%d v:%d\n" ,
636
+ hwrm_total_timeout (i ), req_type ,
637
+ le16_to_cpu (ctx -> req -> seq_id ), len , * valid );
613
638
goto exit ;
614
639
}
615
640
}
@@ -620,11 +645,12 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
620
645
*/
621
646
* valid = 0 ;
622
647
rc = le16_to_cpu (ctx -> resp -> error_code );
623
- if (rc && !(ctx -> flags & BNXT_HWRM_CTX_SILENT )) {
624
- netdev_err (bp -> dev , "hwrm req_type 0x%x seq id 0x%x error 0x%x\n" ,
625
- le16_to_cpu (ctx -> resp -> req_type ),
626
- le16_to_cpu (ctx -> resp -> seq_id ), rc );
627
- }
648
+ if (rc == HWRM_ERR_CODE_BUSY && !(ctx -> flags & BNXT_HWRM_CTX_SILENT ))
649
+ netdev_warn (bp -> dev , "FW returned busy, hwrm req_type 0x%x\n" ,
650
+ req_type );
651
+ else if (rc )
652
+ hwrm_err (bp , ctx , "hwrm req_type 0x%x seq id 0x%x error 0x%x\n" ,
653
+ req_type , token -> seq_id , rc );
628
654
rc = __hwrm_to_stderr (rc );
629
655
exit :
630
656
if (token )
0 commit comments