@@ -5416,7 +5416,7 @@ lpfc_bsg_set_ras_config(struct bsg_job *job)
5416
5416
struct lpfc_ras_fwlog * ras_fwlog = & phba -> ras_fwlog ;
5417
5417
struct fc_bsg_reply * bsg_reply = job -> reply ;
5418
5418
uint8_t action = 0 , log_level = 0 ;
5419
- int rc = 0 ;
5419
+ int rc = 0 , action_status = 0 ;
5420
5420
5421
5421
if (job -> request_len <
5422
5422
sizeof (struct fc_bsg_request ) +
@@ -5449,16 +5449,25 @@ lpfc_bsg_set_ras_config(struct bsg_job *job)
5449
5449
lpfc_ras_stop_fwlog (phba );
5450
5450
} else {
5451
5451
/*action = LPFC_RASACTION_START_LOGGING*/
5452
- if (ras_fwlog -> ras_active == true) {
5453
- rc = - EINPROGRESS ;
5454
- goto ras_job_error ;
5455
- }
5452
+
5453
+ /* Even though FW-logging is active re-initialize
5454
+ * FW-logging with new log-level. Return status
5455
+ * "Logging already Running" to caller.
5456
+ **/
5457
+ if (ras_fwlog -> ras_active )
5458
+ action_status = - EINPROGRESS ;
5456
5459
5457
5460
/* Enable logging */
5458
5461
rc = lpfc_sli4_ras_fwlog_init (phba , log_level ,
5459
5462
LPFC_RAS_ENABLE_LOGGING );
5460
- if (rc )
5463
+ if (rc ) {
5461
5464
rc = - EINVAL ;
5465
+ goto ras_job_error ;
5466
+ }
5467
+
5468
+ /* Check if FW-logging is re-initialized */
5469
+ if (action_status == - EINPROGRESS )
5470
+ rc = action_status ;
5462
5471
}
5463
5472
ras_job_error :
5464
5473
/* make error code available to userspace */
@@ -5487,8 +5496,7 @@ lpfc_bsg_get_ras_lwpd(struct bsg_job *job)
5487
5496
struct lpfc_hba * phba = vport -> phba ;
5488
5497
struct lpfc_ras_fwlog * ras_fwlog = & phba -> ras_fwlog ;
5489
5498
struct fc_bsg_reply * bsg_reply = job -> reply ;
5490
- uint32_t lwpd_offset = 0 ;
5491
- uint64_t wrap_value = 0 ;
5499
+ u32 * lwpd_ptr = NULL ;
5492
5500
int rc = 0 ;
5493
5501
5494
5502
rc = lpfc_check_fwlog_support (phba );
@@ -5508,11 +5516,12 @@ lpfc_bsg_get_ras_lwpd(struct bsg_job *job)
5508
5516
ras_reply = (struct lpfc_bsg_get_ras_lwpd * )
5509
5517
bsg_reply -> reply_data .vendor_reply .vendor_rsp ;
5510
5518
5511
- lwpd_offset = * ((uint32_t * )ras_fwlog -> lwpd .virt ) & 0xffffffff ;
5512
- ras_reply -> offset = be32_to_cpu (lwpd_offset );
5519
+ /* Get lwpd offset */
5520
+ lwpd_ptr = (uint32_t * )(ras_fwlog -> lwpd .virt );
5521
+ ras_reply -> offset = be32_to_cpu (* lwpd_ptr & 0xffffffff );
5513
5522
5514
- wrap_value = * (( uint64_t * ) ras_fwlog -> lwpd . virt );
5515
- ras_reply -> wrap_count = be32_to_cpu (( wrap_value >> 32 ) & 0xffffffff );
5523
+ /* Get wrap count */
5524
+ ras_reply -> wrap_count = be32_to_cpu (* ( ++ lwpd_ptr ) & 0xffffffff );
5516
5525
5517
5526
ras_job_error :
5518
5527
/* make error code available to userspace */
@@ -5539,9 +5548,8 @@ lpfc_bsg_get_ras_fwlog(struct bsg_job *job)
5539
5548
struct fc_bsg_request * bsg_request = job -> request ;
5540
5549
struct fc_bsg_reply * bsg_reply = job -> reply ;
5541
5550
struct lpfc_bsg_get_fwlog_req * ras_req ;
5542
- uint32_t rd_offset , rd_index , offset , pending_wlen ;
5543
- uint32_t boundary = 0 , align_len = 0 , write_len = 0 ;
5544
- void * dest , * src , * fwlog_buff ;
5551
+ u32 rd_offset , rd_index , offset ;
5552
+ void * src , * fwlog_buff ;
5545
5553
struct lpfc_ras_fwlog * ras_fwlog = NULL ;
5546
5554
struct lpfc_dmabuf * dmabuf , * next ;
5547
5555
int rc = 0 ;
@@ -5581,38 +5589,16 @@ lpfc_bsg_get_ras_fwlog(struct bsg_job *job)
5581
5589
5582
5590
rd_index = (rd_offset / LPFC_RAS_MAX_ENTRY_SIZE );
5583
5591
offset = (rd_offset % LPFC_RAS_MAX_ENTRY_SIZE );
5584
- pending_wlen = ras_req -> read_size ;
5585
- dest = fwlog_buff ;
5586
5592
5587
5593
list_for_each_entry_safe (dmabuf , next ,
5588
5594
& ras_fwlog -> fwlog_buff_list , list ) {
5589
5595
5590
5596
if (dmabuf -> buffer_tag < rd_index )
5591
5597
continue ;
5592
5598
5593
- /* Align read to buffer size */
5594
- if (offset ) {
5595
- boundary = ((dmabuf -> buffer_tag + 1 ) *
5596
- LPFC_RAS_MAX_ENTRY_SIZE );
5597
-
5598
- align_len = (boundary - offset );
5599
- write_len = min_t (u32 , align_len ,
5600
- LPFC_RAS_MAX_ENTRY_SIZE );
5601
- } else {
5602
- write_len = min_t (u32 , pending_wlen ,
5603
- LPFC_RAS_MAX_ENTRY_SIZE );
5604
- align_len = 0 ;
5605
- boundary = 0 ;
5606
- }
5607
5599
src = dmabuf -> virt + offset ;
5608
- memcpy (dest , src , write_len );
5609
-
5610
- pending_wlen -= write_len ;
5611
- if (!pending_wlen )
5612
- break ;
5613
-
5614
- dest += write_len ;
5615
- offset = (offset + write_len ) % LPFC_RAS_MAX_ENTRY_SIZE ;
5600
+ memcpy (fwlog_buff , src , ras_req -> read_size );
5601
+ break ;
5616
5602
}
5617
5603
5618
5604
bsg_reply -> reply_payload_rcv_len =
0 commit comments