Commit 3df9dd0d authored by Karan Tilak Kumar's avatar Karan Tilak Kumar Committed by Martin K. Petersen

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: default avatarSesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: default avatarArulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: default avatarKaran Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20231211173617.932990-4-kartilak@cisco.comSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent ca008aee
...@@ -144,13 +144,17 @@ do { \ ...@@ -144,13 +144,17 @@ do { \
} while (0); \ } while (0); \
} while (0) } while (0)
#define FNIC_MAIN_DBG(kern_level, host, fmt, args...) \ #define FNIC_MAIN_DBG(kern_level, host, fnic_num, fmt, args...) \
FNIC_CHECK_LOGGING(FNIC_MAIN_LOGGING, \ FNIC_CHECK_LOGGING(FNIC_MAIN_LOGGING, \
shost_printk(kern_level, host, fmt, ##args);) shost_printk(kern_level, host, \
"fnic<%d>: %s: %d: " fmt, fnic_num,\
__func__, __LINE__, ##args);)
#define FNIC_FCS_DBG(kern_level, host, fmt, args...) \ #define FNIC_FCS_DBG(kern_level, host, fnic_num, fmt, args...) \
FNIC_CHECK_LOGGING(FNIC_FCS_LOGGING, \ FNIC_CHECK_LOGGING(FNIC_FCS_LOGGING, \
shost_printk(kern_level, host, fmt, ##args);) shost_printk(kern_level, host, \
"fnic<%d>: %s: %d: " fmt, fnic_num,\
__func__, __LINE__, ##args);)
#define FNIC_SCSI_DBG(kern_level, host, fmt, args...) \ #define FNIC_SCSI_DBG(kern_level, host, fmt, args...) \
FNIC_CHECK_LOGGING(FNIC_SCSI_LOGGING, \ FNIC_CHECK_LOGGING(FNIC_SCSI_LOGGING, \
......
...@@ -63,8 +63,8 @@ void fnic_handle_link(struct work_struct *work) ...@@ -63,8 +63,8 @@ void fnic_handle_link(struct work_struct *work)
atomic64_set(&fnic->fnic_stats.misc_stats.current_port_speed, atomic64_set(&fnic->fnic_stats.misc_stats.current_port_speed,
new_port_speed); new_port_speed);
if (old_port_speed != new_port_speed) if (old_port_speed != new_port_speed)
FNIC_MAIN_DBG(KERN_INFO, fnic->lport->host, FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"Current vnic speed set to : %llu\n", "Current vnic speed set to: %llu\n",
new_port_speed); new_port_speed);
switch (vnic_dev_port_speed(fnic->vdev)) { switch (vnic_dev_port_speed(fnic->vdev)) {
...@@ -102,6 +102,8 @@ void fnic_handle_link(struct work_struct *work) ...@@ -102,6 +102,8 @@ void fnic_handle_link(struct work_struct *work)
fnic_fc_trace_set_data(fnic->lport->host->host_no, fnic_fc_trace_set_data(fnic->lport->host->host_no,
FNIC_FC_LE, "Link Status: DOWN->DOWN", FNIC_FC_LE, "Link Status: DOWN->DOWN",
strlen("Link Status: DOWN->DOWN")); strlen("Link Status: DOWN->DOWN"));
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"down->down\n");
} else { } else {
if (old_link_down_cnt != fnic->link_down_cnt) { if (old_link_down_cnt != fnic->link_down_cnt) {
/* UP -> DOWN -> UP */ /* UP -> DOWN -> UP */
...@@ -113,7 +115,7 @@ void fnic_handle_link(struct work_struct *work) ...@@ -113,7 +115,7 @@ void fnic_handle_link(struct work_struct *work)
"Link Status:UP_DOWN_UP", "Link Status:UP_DOWN_UP",
strlen("Link_Status:UP_DOWN_UP") strlen("Link_Status:UP_DOWN_UP")
); );
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"link down\n"); "link down\n");
fcoe_ctlr_link_down(&fnic->ctlr); fcoe_ctlr_link_down(&fnic->ctlr);
if (fnic->config.flags & VFCF_FIP_CAPABLE) { if (fnic->config.flags & VFCF_FIP_CAPABLE) {
...@@ -128,8 +130,8 @@ void fnic_handle_link(struct work_struct *work) ...@@ -128,8 +130,8 @@ void fnic_handle_link(struct work_struct *work)
fnic_fcoe_send_vlan_req(fnic); fnic_fcoe_send_vlan_req(fnic);
return; return;
} }
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"link up\n"); "up->down->up: Link up\n");
fcoe_ctlr_link_up(&fnic->ctlr); fcoe_ctlr_link_up(&fnic->ctlr);
} else { } else {
/* UP -> UP */ /* UP -> UP */
...@@ -138,6 +140,8 @@ void fnic_handle_link(struct work_struct *work) ...@@ -138,6 +140,8 @@ void fnic_handle_link(struct work_struct *work)
fnic->lport->host->host_no, FNIC_FC_LE, fnic->lport->host->host_no, FNIC_FC_LE,
"Link Status: UP_UP", "Link Status: UP_UP",
strlen("Link Status: UP_UP")); strlen("Link Status: UP_UP"));
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"up->up\n");
} }
} }
} else if (fnic->link_status) { } else if (fnic->link_status) {
...@@ -153,7 +157,8 @@ void fnic_handle_link(struct work_struct *work) ...@@ -153,7 +157,8 @@ void fnic_handle_link(struct work_struct *work)
return; return;
} }
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link up\n"); FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"down->up: Link up\n");
fnic_fc_trace_set_data(fnic->lport->host->host_no, FNIC_FC_LE, fnic_fc_trace_set_data(fnic->lport->host->host_no, FNIC_FC_LE,
"Link Status: DOWN_UP", strlen("Link Status: DOWN_UP")); "Link Status: DOWN_UP", strlen("Link Status: DOWN_UP"));
fcoe_ctlr_link_up(&fnic->ctlr); fcoe_ctlr_link_up(&fnic->ctlr);
...@@ -161,13 +166,14 @@ void fnic_handle_link(struct work_struct *work) ...@@ -161,13 +166,14 @@ void fnic_handle_link(struct work_struct *work)
/* UP -> DOWN */ /* UP -> DOWN */
fnic->lport->host_stats.link_failure_count++; fnic->lport->host_stats.link_failure_count++;
spin_unlock_irqrestore(&fnic->fnic_lock, flags); spin_unlock_irqrestore(&fnic->fnic_lock, flags);
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link down\n"); FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"up->down: Link down\n");
fnic_fc_trace_set_data( fnic_fc_trace_set_data(
fnic->lport->host->host_no, FNIC_FC_LE, fnic->lport->host->host_no, FNIC_FC_LE,
"Link Status: UP_DOWN", "Link Status: UP_DOWN",
strlen("Link Status: UP_DOWN")); strlen("Link Status: UP_DOWN"));
if (fnic->config.flags & VFCF_FIP_CAPABLE) { if (fnic->config.flags & VFCF_FIP_CAPABLE) {
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"deleting fip-timer during link-down\n"); "deleting fip-timer during link-down\n");
del_timer_sync(&fnic->fip_timer); del_timer_sync(&fnic->fip_timer);
} }
...@@ -270,12 +276,12 @@ void fnic_handle_event(struct work_struct *work) ...@@ -270,12 +276,12 @@ void fnic_handle_event(struct work_struct *work)
spin_lock_irqsave(&fnic->fnic_lock, flags); spin_lock_irqsave(&fnic->fnic_lock, flags);
break; break;
case FNIC_EVT_START_FCF_DISC: case FNIC_EVT_START_FCF_DISC:
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"Start FCF Discovery\n"); "Start FCF Discovery\n");
fnic_fcoe_start_fcf_disc(fnic); fnic_fcoe_start_fcf_disc(fnic);
break; break;
default: default:
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"Unknown event 0x%x\n", fevt->event); "Unknown event 0x%x\n", fevt->event);
break; break;
} }
...@@ -370,7 +376,7 @@ static void fnic_fcoe_send_vlan_req(struct fnic *fnic) ...@@ -370,7 +376,7 @@ static void fnic_fcoe_send_vlan_req(struct fnic *fnic)
fnic->set_vlan(fnic, 0); fnic->set_vlan(fnic, 0);
if (printk_ratelimit()) if (printk_ratelimit())
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"Sending VLAN request...\n"); "Sending VLAN request...\n");
skb = dev_alloc_skb(sizeof(struct fip_vlan)); 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) ...@@ -423,12 +429,12 @@ static void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct sk_buff *skb)
u64 sol_time; u64 sol_time;
unsigned long flags; unsigned long flags;
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"Received VLAN response...\n"); "Received VLAN response...\n");
fiph = (struct fip_header *) skb->data; fiph = (struct fip_header *) skb->data;
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"Received VLAN response... OP 0x%x SUB_OP 0x%x\n", "Received VLAN response... OP 0x%x SUB_OP 0x%x\n",
ntohs(fiph->fip_op), fiph->fip_subcode); ntohs(fiph->fip_op), fiph->fip_subcode);
...@@ -463,7 +469,7 @@ static void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct sk_buff *skb) ...@@ -463,7 +469,7 @@ static void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct sk_buff *skb)
if (list_empty(&fnic->vlans)) { if (list_empty(&fnic->vlans)) {
/* retry from timer */ /* retry from timer */
atomic64_inc(&fnic_stats->vlan_stats.resp_withno_vlanID); atomic64_inc(&fnic_stats->vlan_stats.resp_withno_vlanID);
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"No VLAN descriptors in FIP VLAN response\n"); "No VLAN descriptors in FIP VLAN response\n");
spin_unlock_irqrestore(&fnic->vlans_lock, flags); spin_unlock_irqrestore(&fnic->vlans_lock, flags);
goto out; goto out;
...@@ -721,7 +727,8 @@ void fnic_update_mac_locked(struct fnic *fnic, u8 *new) ...@@ -721,7 +727,8 @@ void fnic_update_mac_locked(struct fnic *fnic, u8 *new)
new = ctl; new = ctl;
if (ether_addr_equal(data, new)) if (ether_addr_equal(data, new))
return; return;
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "update_mac %pM\n", new); FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"update_mac %pM\n", new);
if (!is_zero_ether_addr(data) && !ether_addr_equal(data, ctl)) if (!is_zero_ether_addr(data) && !ether_addr_equal(data, ctl))
vnic_dev_del_addr(fnic->vdev, data); vnic_dev_del_addr(fnic->vdev, data);
memcpy(data, new, ETH_ALEN); 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) ...@@ -763,8 +770,9 @@ void fnic_set_port_id(struct fc_lport *lport, u32 port_id, struct fc_frame *fp)
u8 *mac; u8 *mac;
int ret; int ret;
FNIC_FCS_DBG(KERN_DEBUG, lport->host, "set port_id %x fp %p\n", FNIC_FCS_DBG(KERN_DEBUG, lport->host, fnic->fnic_num,
port_id, fp); "set port_id 0x%x fp 0x%p\n",
port_id, fp);
/* /*
* If we're clearing the FC_ID, change to use the ctl_src_addr. * 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) ...@@ -790,10 +798,9 @@ void fnic_set_port_id(struct fc_lport *lport, u32 port_id, struct fc_frame *fp)
if (fnic->state == FNIC_IN_ETH_MODE || fnic->state == FNIC_IN_FC_MODE) if (fnic->state == FNIC_IN_ETH_MODE || fnic->state == FNIC_IN_FC_MODE)
fnic->state = FNIC_IN_ETH_TRANS_FC_MODE; fnic->state = FNIC_IN_ETH_TRANS_FC_MODE;
else { else {
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_ERR, fnic->lport->host, fnic->fnic_num,
"Unexpected fnic state %s while" "Unexpected fnic state: %s processing FLOGI response",
" processing flogi resp\n", fnic_state_to_str(fnic->state));
fnic_state_to_str(fnic->state));
spin_unlock_irq(&fnic->fnic_lock); spin_unlock_irq(&fnic->fnic_lock);
return; return;
} }
...@@ -870,7 +877,7 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc ...@@ -870,7 +877,7 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
skb_trim(skb, bytes_written); skb_trim(skb, bytes_written);
if (!fcs_ok) { if (!fcs_ok) {
atomic64_inc(&fnic_stats->misc_stats.frame_errors); atomic64_inc(&fnic_stats->misc_stats.frame_errors);
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"fcs error. dropping packet.\n"); "fcs error. dropping packet.\n");
goto drop; goto drop;
} }
...@@ -886,7 +893,7 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc ...@@ -886,7 +893,7 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
if (!fcs_ok || packet_error || !fcoe_fc_crc_ok || fcoe_enc_error) { if (!fcs_ok || packet_error || !fcoe_fc_crc_ok || fcoe_enc_error) {
atomic64_inc(&fnic_stats->misc_stats.frame_errors); atomic64_inc(&fnic_stats->misc_stats.frame_errors);
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"fnic rq_cmpl fcoe x%x fcsok x%x" "fnic rq_cmpl fcoe x%x fcsok x%x"
" pkterr x%x fcoe_fc_crc_ok x%x, fcoe_enc_err" " pkterr x%x fcoe_fc_crc_ok x%x, fcoe_enc_err"
" x%x\n", " x%x\n",
...@@ -967,7 +974,7 @@ int fnic_alloc_rq_frame(struct vnic_rq *rq) ...@@ -967,7 +974,7 @@ int fnic_alloc_rq_frame(struct vnic_rq *rq)
len = FC_FRAME_HEADROOM + FC_MAX_FRAME + FC_FRAME_TAILROOM; len = FC_FRAME_HEADROOM + FC_MAX_FRAME + FC_FRAME_TAILROOM;
skb = dev_alloc_skb(len); skb = dev_alloc_skb(len);
if (!skb) { if (!skb) {
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"Unable to allocate RQ sk_buff\n"); "Unable to allocate RQ sk_buff\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -1341,12 +1348,12 @@ void fnic_handle_fip_timer(struct fnic *fnic) ...@@ -1341,12 +1348,12 @@ void fnic_handle_fip_timer(struct fnic *fnic)
} }
vlan = list_first_entry(&fnic->vlans, struct fcoe_vlan, list); vlan = list_first_entry(&fnic->vlans, struct fcoe_vlan, list);
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"fip_timer: vlan %d state %d sol_count %d\n", "fip_timer: vlan %d state %d sol_count %d\n",
vlan->vid, vlan->state, vlan->sol_count); vlan->vid, vlan->state, vlan->sol_count);
switch (vlan->state) { switch (vlan->state) {
case FIP_VLAN_USED: case FIP_VLAN_USED:
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"FIP VLAN is selected for FC transaction\n"); "FIP VLAN is selected for FC transaction\n");
spin_unlock_irqrestore(&fnic->vlans_lock, flags); spin_unlock_irqrestore(&fnic->vlans_lock, flags);
break; break;
...@@ -1365,7 +1372,7 @@ void fnic_handle_fip_timer(struct fnic *fnic) ...@@ -1365,7 +1372,7 @@ void fnic_handle_fip_timer(struct fnic *fnic)
* no response on this vlan, remove from the list. * no response on this vlan, remove from the list.
* Try the next vlan * Try the next vlan
*/ */
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"Dequeue this VLAN ID %d from list\n", "Dequeue this VLAN ID %d from list\n",
vlan->vid); vlan->vid);
list_del(&vlan->list); list_del(&vlan->list);
...@@ -1375,7 +1382,7 @@ void fnic_handle_fip_timer(struct fnic *fnic) ...@@ -1375,7 +1382,7 @@ void fnic_handle_fip_timer(struct fnic *fnic)
/* we exhausted all vlans, restart vlan disc */ /* we exhausted all vlans, restart vlan disc */
spin_unlock_irqrestore(&fnic->vlans_lock, spin_unlock_irqrestore(&fnic->vlans_lock,
flags); flags);
FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, fnic->fnic_num,
"fip_timer: vlan list empty, " "fip_timer: vlan list empty, "
"trigger vlan disc\n"); "trigger vlan disc\n");
fnic_event_enq(fnic, FNIC_EVT_START_VLAN_DISC); fnic_event_enq(fnic, FNIC_EVT_START_VLAN_DISC);
......
...@@ -210,7 +210,7 @@ static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *host) ...@@ -210,7 +210,7 @@ static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *host)
spin_unlock_irqrestore(&fnic->fnic_lock, flags); spin_unlock_irqrestore(&fnic->fnic_lock, flags);
if (ret) { if (ret) {
FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host, FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"fnic: Get vnic stats failed" "fnic: Get vnic stats failed"
" 0x%x", ret); " 0x%x", ret);
return stats; return stats;
...@@ -322,7 +322,7 @@ static void fnic_reset_host_stats(struct Scsi_Host *host) ...@@ -322,7 +322,7 @@ static void fnic_reset_host_stats(struct Scsi_Host *host)
spin_unlock_irqrestore(&fnic->fnic_lock, flags); spin_unlock_irqrestore(&fnic->fnic_lock, flags);
if (ret) { if (ret) {
FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host, FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
"fnic: Reset vnic stats failed" "fnic: Reset vnic stats failed"
" 0x%x", ret); " 0x%x", ret);
return; return;
......
...@@ -143,6 +143,10 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev, ...@@ -143,6 +143,10 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
vdev->res[type].vaddr = (char __iomem *)bar->vaddr + bar_offset; vdev->res[type].vaddr = (char __iomem *)bar->vaddr + bar_offset;
} }
pr_info("res_type_wq: %d res_type_rq: %d res_type_cq: %d res_type_intr_ctrl: %d\n",
vdev->res[RES_TYPE_WQ].count, vdev->res[RES_TYPE_RQ].count,
vdev->res[RES_TYPE_CQ].count, vdev->res[RES_TYPE_INTR_CTRL].count);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment