Skip to content

Commit 3df9dd0

Browse files
Karan Tilak Kumarmartinkpetersen
authored andcommitted
scsi: fnic: Add and improve log messages
Add link related log messages in fnic_fcs.c, Improve log message in fnic_fcs.c, Add log message in vnic_dev.c. Reviewed-by: Sesidhar Baddela <[email protected]> Reviewed-by: Arulprabhu Ponnusamy <[email protected]> Signed-off-by: Karan Tilak Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ca008ae commit 3df9dd0

File tree

4 files changed

+49
-34
lines changed

4 files changed

+49
-34
lines changed

drivers/scsi/fnic/fnic.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,17 @@ do { \
144144
} while (0); \
145145
} while (0)
146146

147-
#define FNIC_MAIN_DBG(kern_level, host, fmt, args...) \
147+
#define FNIC_MAIN_DBG(kern_level, host, fnic_num, fmt, args...) \
148148
FNIC_CHECK_LOGGING(FNIC_MAIN_LOGGING, \
149-
shost_printk(kern_level, host, fmt, ##args);)
149+
shost_printk(kern_level, host, \
150+
"fnic<%d>: %s: %d: " fmt, fnic_num,\
151+
__func__, __LINE__, ##args);)
150152

151-
#define FNIC_FCS_DBG(kern_level, host, fmt, args...) \
153+
#define FNIC_FCS_DBG(kern_level, host, fnic_num, fmt, args...) \
152154
FNIC_CHECK_LOGGING(FNIC_FCS_LOGGING, \
153-
shost_printk(kern_level, host, fmt, ##args);)
155+
shost_printk(kern_level, host, \
156+
"fnic<%d>: %s: %d: " fmt, fnic_num,\
157+
__func__, __LINE__, ##args);)
154158

155159
#define FNIC_SCSI_DBG(kern_level, host, fmt, args...) \
156160
FNIC_CHECK_LOGGING(FNIC_SCSI_LOGGING, \

drivers/scsi/fnic/fnic_fcs.c

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ void fnic_handle_link(struct work_struct *work)
6363
atomic64_set(&fnic->fnic_stats.misc_stats.current_port_speed,
6464
new_port_speed);
6565
if (old_port_speed != new_port_speed)
66-
FNIC_MAIN_DBG(KERN_INFO, fnic->lport->host,
67-
"Current vnic speed set to : %llu\n",
66+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
67+
"Current vnic speed set to: %llu\n",
6868
new_port_speed);
6969

7070
switch (vnic_dev_port_speed(fnic->vdev)) {
@@ -102,6 +102,8 @@ void fnic_handle_link(struct work_struct *work)
102102
fnic_fc_trace_set_data(fnic->lport->host->host_no,
103103
FNIC_FC_LE, "Link Status: DOWN->DOWN",
104104
strlen("Link Status: DOWN->DOWN"));
105+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
106+
"down->down\n");
105107
} else {
106108
if (old_link_down_cnt != fnic->link_down_cnt) {
107109
/* UP -> DOWN -> UP */
@@ -113,7 +115,7 @@ void fnic_handle_link(struct work_struct *work)
113115
"Link Status:UP_DOWN_UP",
114116
strlen("Link_Status:UP_DOWN_UP")
115117
);
116-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
118+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
117119
"link down\n");
118120
fcoe_ctlr_link_down(&fnic->ctlr);
119121
if (fnic->config.flags & VFCF_FIP_CAPABLE) {
@@ -128,8 +130,8 @@ void fnic_handle_link(struct work_struct *work)
128130
fnic_fcoe_send_vlan_req(fnic);
129131
return;
130132
}
131-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
132-
"link up\n");
133+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
134+
"up->down->up: Link up\n");
133135
fcoe_ctlr_link_up(&fnic->ctlr);
134136
} else {
135137
/* UP -> UP */
@@ -138,6 +140,8 @@ void fnic_handle_link(struct work_struct *work)
138140
fnic->lport->host->host_no, FNIC_FC_LE,
139141
"Link Status: UP_UP",
140142
strlen("Link Status: UP_UP"));
143+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
144+
"up->up\n");
141145
}
142146
}
143147
} else if (fnic->link_status) {
@@ -153,21 +157,23 @@ void fnic_handle_link(struct work_struct *work)
153157
return;
154158
}
155159

156-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link up\n");
160+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
161+
"down->up: Link up\n");
157162
fnic_fc_trace_set_data(fnic->lport->host->host_no, FNIC_FC_LE,
158163
"Link Status: DOWN_UP", strlen("Link Status: DOWN_UP"));
159164
fcoe_ctlr_link_up(&fnic->ctlr);
160165
} else {
161166
/* UP -> DOWN */
162167
fnic->lport->host_stats.link_failure_count++;
163168
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
164-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link down\n");
169+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
170+
"up->down: Link down\n");
165171
fnic_fc_trace_set_data(
166172
fnic->lport->host->host_no, FNIC_FC_LE,
167173
"Link Status: UP_DOWN",
168174
strlen("Link Status: UP_DOWN"));
169175
if (fnic->config.flags & VFCF_FIP_CAPABLE) {
170-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
176+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
171177
"deleting fip-timer during link-down\n");
172178
del_timer_sync(&fnic->fip_timer);
173179
}
@@ -270,12 +276,12 @@ void fnic_handle_event(struct work_struct *work)
270276
spin_lock_irqsave(&fnic->fnic_lock, flags);
271277
break;
272278
case FNIC_EVT_START_FCF_DISC:
273-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
279+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
274280
"Start FCF Discovery\n");
275281
fnic_fcoe_start_fcf_disc(fnic);
276282
break;
277283
default:
278-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
284+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
279285
"Unknown event 0x%x\n", fevt->event);
280286
break;
281287
}
@@ -370,7 +376,7 @@ static void fnic_fcoe_send_vlan_req(struct fnic *fnic)
370376
fnic->set_vlan(fnic, 0);
371377

372378
if (printk_ratelimit())
373-
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host,
379+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
374380
"Sending VLAN request...\n");
375381

376382
skb = dev_alloc_skb(sizeof(struct fip_vlan));
@@ -423,12 +429,12 @@ static void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct sk_buff *skb)
423429
u64 sol_time;
424430
unsigned long flags;
425431

426-
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host,
432+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
427433
"Received VLAN response...\n");
428434

429435
fiph = (struct fip_header *) skb->data;
430436

431-
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host,
437+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
432438
"Received VLAN response... OP 0x%x SUB_OP 0x%x\n",
433439
ntohs(fiph->fip_op), fiph->fip_subcode);
434440

@@ -463,7 +469,7 @@ static void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct sk_buff *skb)
463469
if (list_empty(&fnic->vlans)) {
464470
/* retry from timer */
465471
atomic64_inc(&fnic_stats->vlan_stats.resp_withno_vlanID);
466-
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host,
472+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
467473
"No VLAN descriptors in FIP VLAN response\n");
468474
spin_unlock_irqrestore(&fnic->vlans_lock, flags);
469475
goto out;
@@ -721,7 +727,8 @@ void fnic_update_mac_locked(struct fnic *fnic, u8 *new)
721727
new = ctl;
722728
if (ether_addr_equal(data, new))
723729
return;
724-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "update_mac %pM\n", new);
730+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
731+
"update_mac %pM\n", new);
725732
if (!is_zero_ether_addr(data) && !ether_addr_equal(data, ctl))
726733
vnic_dev_del_addr(fnic->vdev, data);
727734
memcpy(data, new, ETH_ALEN);
@@ -763,8 +770,9 @@ void fnic_set_port_id(struct fc_lport *lport, u32 port_id, struct fc_frame *fp)
763770
u8 *mac;
764771
int ret;
765772

766-
FNIC_FCS_DBG(KERN_DEBUG, lport->host, "set port_id %x fp %p\n",
767-
port_id, fp);
773+
FNIC_FCS_DBG(KERN_DEBUG, lport->host, fnic->fnic_num,
774+
"set port_id 0x%x fp 0x%p\n",
775+
port_id, fp);
768776

769777
/*
770778
* If we're clearing the FC_ID, change to use the ctl_src_addr.
@@ -790,10 +798,9 @@ void fnic_set_port_id(struct fc_lport *lport, u32 port_id, struct fc_frame *fp)
790798
if (fnic->state == FNIC_IN_ETH_MODE || fnic->state == FNIC_IN_FC_MODE)
791799
fnic->state = FNIC_IN_ETH_TRANS_FC_MODE;
792800
else {
793-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
794-
"Unexpected fnic state %s while"
795-
" processing flogi resp\n",
796-
fnic_state_to_str(fnic->state));
801+
FNIC_FCS_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num,
802+
"Unexpected fnic state: %s processing FLOGI response",
803+
fnic_state_to_str(fnic->state));
797804
spin_unlock_irq(&fnic->fnic_lock);
798805
return;
799806
}
@@ -870,7 +877,7 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
870877
skb_trim(skb, bytes_written);
871878
if (!fcs_ok) {
872879
atomic64_inc(&fnic_stats->misc_stats.frame_errors);
873-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
880+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
874881
"fcs error. dropping packet.\n");
875882
goto drop;
876883
}
@@ -886,7 +893,7 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
886893

887894
if (!fcs_ok || packet_error || !fcoe_fc_crc_ok || fcoe_enc_error) {
888895
atomic64_inc(&fnic_stats->misc_stats.frame_errors);
889-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
896+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
890897
"fnic rq_cmpl fcoe x%x fcsok x%x"
891898
" pkterr x%x fcoe_fc_crc_ok x%x, fcoe_enc_err"
892899
" x%x\n",
@@ -967,7 +974,7 @@ int fnic_alloc_rq_frame(struct vnic_rq *rq)
967974
len = FC_FRAME_HEADROOM + FC_MAX_FRAME + FC_FRAME_TAILROOM;
968975
skb = dev_alloc_skb(len);
969976
if (!skb) {
970-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
977+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
971978
"Unable to allocate RQ sk_buff\n");
972979
return -ENOMEM;
973980
}
@@ -1341,12 +1348,12 @@ void fnic_handle_fip_timer(struct fnic *fnic)
13411348
}
13421349

13431350
vlan = list_first_entry(&fnic->vlans, struct fcoe_vlan, list);
1344-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
1351+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
13451352
"fip_timer: vlan %d state %d sol_count %d\n",
13461353
vlan->vid, vlan->state, vlan->sol_count);
13471354
switch (vlan->state) {
13481355
case FIP_VLAN_USED:
1349-
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
1356+
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
13501357
"FIP VLAN is selected for FC transaction\n");
13511358
spin_unlock_irqrestore(&fnic->vlans_lock, flags);
13521359
break;
@@ -1365,7 +1372,7 @@ void fnic_handle_fip_timer(struct fnic *fnic)
13651372
* no response on this vlan, remove from the list.
13661373
* Try the next vlan
13671374
*/
1368-
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host,
1375+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
13691376
"Dequeue this VLAN ID %d from list\n",
13701377
vlan->vid);
13711378
list_del(&vlan->list);
@@ -1375,7 +1382,7 @@ void fnic_handle_fip_timer(struct fnic *fnic)
13751382
/* we exhausted all vlans, restart vlan disc */
13761383
spin_unlock_irqrestore(&fnic->vlans_lock,
13771384
flags);
1378-
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host,
1385+
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
13791386
"fip_timer: vlan list empty, "
13801387
"trigger vlan disc\n");
13811388
fnic_event_enq(fnic, FNIC_EVT_START_VLAN_DISC);

drivers/scsi/fnic/fnic_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *host)
210210
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
211211

212212
if (ret) {
213-
FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host,
213+
FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
214214
"fnic: Get vnic stats failed"
215215
" 0x%x", ret);
216216
return stats;
@@ -322,7 +322,7 @@ static void fnic_reset_host_stats(struct Scsi_Host *host)
322322
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
323323

324324
if (ret) {
325-
FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host,
325+
FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
326326
"fnic: Reset vnic stats failed"
327327
" 0x%x", ret);
328328
return;

drivers/scsi/fnic/vnic_dev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
143143
vdev->res[type].vaddr = (char __iomem *)bar->vaddr + bar_offset;
144144
}
145145

146+
pr_info("res_type_wq: %d res_type_rq: %d res_type_cq: %d res_type_intr_ctrl: %d\n",
147+
vdev->res[RES_TYPE_WQ].count, vdev->res[RES_TYPE_RQ].count,
148+
vdev->res[RES_TYPE_CQ].count, vdev->res[RES_TYPE_INTR_CTRL].count);
149+
146150
return 0;
147151
}
148152

0 commit comments

Comments
 (0)