Skip to content

Commit 510f3e5

Browse files
committed
[ena] Add descriptive messages for any admin queue command failures
Signed-off-by: Michael Brown <[email protected]>
1 parent 3538e9c commit 510f3e5

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

src/drivers/net/ena.c

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,11 @@ static int ena_set_aenq_config ( struct ena_nic *ena, uint32_t enabled ) {
371371
feature->aenq.enabled = cpu_to_le32 ( enabled );
372372

373373
/* Issue request */
374-
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 )
374+
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 ) {
375+
DBGC ( ena, "ENA %p could not set AENQ configuration: %s\n",
376+
ena, strerror ( rc ) );
375377
return rc;
378+
}
376379

377380
return 0;
378381
}
@@ -468,8 +471,11 @@ static int ena_create_sq ( struct ena_nic *ena, struct ena_sq *sq,
468471
req->create_sq.address = cpu_to_le64 ( virt_to_bus ( sq->sqe.raw ) );
469472

470473
/* Issue request */
471-
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 )
474+
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 ) {
475+
DBGC ( ena, "ENA %p could not create %s SQ: %s\n",
476+
ena, ena_direction ( sq->direction ), strerror ( rc ) );
472477
goto err_admin;
478+
}
473479

474480
/* Parse response */
475481
sq->id = le16_to_cpu ( rsp->create_sq.id );
@@ -520,8 +526,12 @@ static int ena_destroy_sq ( struct ena_nic *ena, struct ena_sq *sq ) {
520526
req->destroy_sq.direction = sq->direction;
521527

522528
/* Issue request */
523-
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 )
529+
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 ) {
530+
DBGC ( ena, "ENA %p could not destroy %s SQ%d: %s\n",
531+
ena, ena_direction ( sq->direction ), sq->id,
532+
strerror ( rc ) );
524533
return rc;
534+
}
525535

526536
/* Free submission queue entries */
527537
free_phys ( sq->sqe.raw, sq->len );
@@ -561,8 +571,8 @@ static int ena_create_cq ( struct ena_nic *ena, struct ena_cq *cq ) {
561571

562572
/* Issue request */
563573
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 ) {
564-
DBGC ( ena, "ENA %p CQ%d creation failed (broken firmware?)\n",
565-
ena, cq->id );
574+
DBGC ( ena, "ENA %p could not create CQ (broken firmware?): "
575+
"%s\n", ena, strerror ( rc ) );
566576
goto err_admin;
567577
}
568578

@@ -609,8 +619,11 @@ static int ena_destroy_cq ( struct ena_nic *ena, struct ena_cq *cq ) {
609619
req->destroy_cq.id = cpu_to_le16 ( cq->id );
610620

611621
/* Issue request */
612-
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 )
622+
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 ) {
623+
DBGC ( ena, "ENA %p could not destroy CQ%d: %s\n",
624+
ena, cq->id, strerror ( rc ) );
613625
return rc;
626+
}
614627

615628
/* Free completion queue entries */
616629
free_phys ( cq->cqe.raw, cq->len );
@@ -683,8 +696,11 @@ static int ena_get_device_attributes ( struct net_device *netdev ) {
683696
req->get_feature.id = ENA_DEVICE_ATTRIBUTES;
684697

685698
/* Issue request */
686-
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 )
699+
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 ) {
700+
DBGC ( ena, "ENA %p could not get device attributes: %s\n",
701+
ena, strerror ( rc ) );
687702
return rc;
703+
}
688704

689705
/* Parse response */
690706
feature = &rsp->get_feature.feature;
@@ -717,8 +733,11 @@ static int ena_set_host_attributes ( struct ena_nic *ena ) {
717733
feature->host.info = cpu_to_le64 ( virt_to_bus ( ena->info ) );
718734

719735
/* Issue request */
720-
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 )
736+
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 ) {
737+
DBGC ( ena, "ENA %p could not set host attributes: %s\n",
738+
ena, strerror ( rc ) );
721739
return rc;
740+
}
722741

723742
return 0;
724743
}
@@ -747,8 +766,11 @@ static int ena_get_stats ( struct ena_nic *ena ) {
747766
req->get_stats.device = ENA_DEVICE_MINE;
748767

749768
/* Issue request */
750-
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 )
769+
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 ) {
770+
DBGC ( ena, "ENA %p could not get statistics: %s\n",
771+
ena, strerror ( rc ) );
751772
return rc;
773+
}
752774

753775
/* Parse response */
754776
stats = &rsp->get_stats;

0 commit comments

Comments
 (0)