aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fnic/fnic_fcs.c
diff options
context:
space:
mode:
authorHiral Shah <hishah@cisco.com>2014-04-18 15:28:19 -0400
committerChristoph Hellwig <hch@lst.de>2014-05-19 07:33:00 -0400
commitabb14148c0f850e7201efc3e7aea1762f993606b (patch)
tree8cc508236684996a2d036c84c6372b407dd7cac1 /drivers/scsi/fnic/fnic_fcs.c
parent668186637e013f41bb3b275fa1a3b993b4da2ccb (diff)
fnic: fnic Control Path Trace Utility
Fnic Ctlr Path Trace utility is a tracing functionality built directly into fnic driver to trace the control path frames like discovery, FLOGI request/reply, PLOGI request/reply, link event etc. It will be one trace file for all fnics. It will help us to debug and resolve the discovery and initialization related issues in more convenient way. This trace information includes time stamp, Host Number, Frame type, Frame Length and Frame. By default,64 pages are allocated but we can change the number of allocated pages by module parameter fnic_fc_trace_max_page. Each entry is of 256 byte and available entries are depends on allocated number of pages. We can turn on or off the fnic control path trace functionality by module paramter fc_trace_enable and/or reset the trace contain by module paramter fc_trace_clear. Signed-off-by: Hiral Shah <hishah@cisco.com> Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/fnic/fnic_fcs.c')
-rw-r--r--drivers/scsi/fnic/fnic_fcs.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
index 1711cd59dece..1b948f633fc5 100644
--- a/drivers/scsi/fnic/fnic_fcs.c
+++ b/drivers/scsi/fnic/fnic_fcs.c
@@ -66,19 +66,35 @@ void fnic_handle_link(struct work_struct *work)
66 fnic->link_down_cnt = vnic_dev_link_down_cnt(fnic->vdev); 66 fnic->link_down_cnt = vnic_dev_link_down_cnt(fnic->vdev);
67 67
68 if (old_link_status == fnic->link_status) { 68 if (old_link_status == fnic->link_status) {
69 if (!fnic->link_status) 69 if (!fnic->link_status) {
70 /* DOWN -> DOWN */ 70 /* DOWN -> DOWN */
71 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 71 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
72 else { 72 fnic_fc_trace_set_data(fnic->lport->host->host_no,
73 FNIC_FC_LE, "Link Status: DOWN->DOWN",
74 strlen("Link Status: DOWN->DOWN"));
75 } else {
73 if (old_link_down_cnt != fnic->link_down_cnt) { 76 if (old_link_down_cnt != fnic->link_down_cnt) {
74 /* UP -> DOWN -> UP */ 77 /* UP -> DOWN -> UP */
75 fnic->lport->host_stats.link_failure_count++; 78 fnic->lport->host_stats.link_failure_count++;
76 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 79 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
80 fnic_fc_trace_set_data(
81 fnic->lport->host->host_no,
82 FNIC_FC_LE,
83 "Link Status:UP_DOWN_UP",
84 strlen("Link_Status:UP_DOWN_UP")
85 );
77 FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, 86 FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
78 "link down\n"); 87 "link down\n");
79 fcoe_ctlr_link_down(&fnic->ctlr); 88 fcoe_ctlr_link_down(&fnic->ctlr);
80 if (fnic->config.flags & VFCF_FIP_CAPABLE) { 89 if (fnic->config.flags & VFCF_FIP_CAPABLE) {
81 /* start FCoE VLAN discovery */ 90 /* start FCoE VLAN discovery */
91 fnic_fc_trace_set_data(
92 fnic->lport->host->host_no,
93 FNIC_FC_LE,
94 "Link Status: UP_DOWN_UP_VLAN",
95 strlen(
96 "Link Status: UP_DOWN_UP_VLAN")
97 );
82 fnic_fcoe_send_vlan_req(fnic); 98 fnic_fcoe_send_vlan_req(fnic);
83 return; 99 return;
84 } 100 }
@@ -88,22 +104,36 @@ void fnic_handle_link(struct work_struct *work)
88 } else 104 } else
89 /* UP -> UP */ 105 /* UP -> UP */
90 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 106 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
107 fnic_fc_trace_set_data(
108 fnic->lport->host->host_no, FNIC_FC_LE,
109 "Link Status: UP_UP",
110 strlen("Link Status: UP_UP"));
91 } 111 }
92 } else if (fnic->link_status) { 112 } else if (fnic->link_status) {
93 /* DOWN -> UP */ 113 /* DOWN -> UP */
94 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 114 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
95 if (fnic->config.flags & VFCF_FIP_CAPABLE) { 115 if (fnic->config.flags & VFCF_FIP_CAPABLE) {
96 /* start FCoE VLAN discovery */ 116 /* start FCoE VLAN discovery */
117 fnic_fc_trace_set_data(
118 fnic->lport->host->host_no,
119 FNIC_FC_LE, "Link Status: DOWN_UP_VLAN",
120 strlen("Link Status: DOWN_UP_VLAN"));
97 fnic_fcoe_send_vlan_req(fnic); 121 fnic_fcoe_send_vlan_req(fnic);
98 return; 122 return;
99 } 123 }
100 FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link up\n"); 124 FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link up\n");
125 fnic_fc_trace_set_data(fnic->lport->host->host_no, FNIC_FC_LE,
126 "Link Status: DOWN_UP", strlen("Link Status: DOWN_UP"));
101 fcoe_ctlr_link_up(&fnic->ctlr); 127 fcoe_ctlr_link_up(&fnic->ctlr);
102 } else { 128 } else {
103 /* UP -> DOWN */ 129 /* UP -> DOWN */
104 fnic->lport->host_stats.link_failure_count++; 130 fnic->lport->host_stats.link_failure_count++;
105 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 131 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
106 FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link down\n"); 132 FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link down\n");
133 fnic_fc_trace_set_data(
134 fnic->lport->host->host_no, FNIC_FC_LE,
135 "Link Status: UP_DOWN",
136 strlen("Link Status: UP_DOWN"));
107 fcoe_ctlr_link_down(&fnic->ctlr); 137 fcoe_ctlr_link_down(&fnic->ctlr);
108 } 138 }
109 139
@@ -611,6 +641,10 @@ static inline int fnic_import_rq_eth_pkt(struct fnic *fnic, struct sk_buff *skb)
611 "using UCSM\n"); 641 "using UCSM\n");
612 goto drop; 642 goto drop;
613 } 643 }
644 if ((fnic_fc_trace_set_data(fnic->lport->host->host_no,
645 FNIC_FC_RECV|0x80, (char *)skb->data, skb->len)) != 0) {
646 printk(KERN_ERR "fnic ctlr frame trace error!!!");
647 }
614 skb_queue_tail(&fnic->fip_frame_queue, skb); 648 skb_queue_tail(&fnic->fip_frame_queue, skb);
615 queue_work(fnic_fip_queue, &fnic->fip_frame_work); 649 queue_work(fnic_fip_queue, &fnic->fip_frame_work);
616 return 1; /* let caller know packet was used */ 650 return 1; /* let caller know packet was used */
@@ -839,6 +873,10 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
839 } 873 }
840 fr_dev(fp) = fnic->lport; 874 fr_dev(fp) = fnic->lport;
841 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 875 spin_unlock_irqrestore(&fnic->fnic_lock, flags);
876 if ((fnic_fc_trace_set_data(fnic->lport->host->host_no, FNIC_FC_RECV,
877 (char *)skb->data, skb->len)) != 0) {
878 printk(KERN_ERR "fnic ctlr frame trace error!!!");
879 }
842 880
843 skb_queue_tail(&fnic->frame_queue, skb); 881 skb_queue_tail(&fnic->frame_queue, skb);
844 queue_work(fnic_event_queue, &fnic->frame_work); 882 queue_work(fnic_event_queue, &fnic->frame_work);
@@ -946,6 +984,15 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
946 vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q); 984 vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);
947 vlan_hdr->h_vlan_encapsulated_proto = eth_hdr->h_proto; 985 vlan_hdr->h_vlan_encapsulated_proto = eth_hdr->h_proto;
948 vlan_hdr->h_vlan_TCI = htons(fnic->vlan_id); 986 vlan_hdr->h_vlan_TCI = htons(fnic->vlan_id);
987 if ((fnic_fc_trace_set_data(fnic->lport->host->host_no,
988 FNIC_FC_SEND|0x80, (char *)eth_hdr, skb->len)) != 0) {
989 printk(KERN_ERR "fnic ctlr frame trace error!!!");
990 }
991 } else {
992 if ((fnic_fc_trace_set_data(fnic->lport->host->host_no,
993 FNIC_FC_SEND|0x80, (char *)skb->data, skb->len)) != 0) {
994 printk(KERN_ERR "fnic ctlr frame trace error!!!");
995 }
949 } 996 }
950 997
951 pa = pci_map_single(fnic->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); 998 pa = pci_map_single(fnic->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
@@ -1018,6 +1065,11 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp)
1018 1065
1019 pa = pci_map_single(fnic->pdev, eth_hdr, tot_len, PCI_DMA_TODEVICE); 1066 pa = pci_map_single(fnic->pdev, eth_hdr, tot_len, PCI_DMA_TODEVICE);
1020 1067
1068 if ((fnic_fc_trace_set_data(fnic->lport->host->host_no, FNIC_FC_SEND,
1069 (char *)eth_hdr, tot_len)) != 0) {
1070 printk(KERN_ERR "fnic ctlr frame trace error!!!");
1071 }
1072
1021 spin_lock_irqsave(&fnic->wq_lock[0], flags); 1073 spin_lock_irqsave(&fnic->wq_lock[0], flags);
1022 1074
1023 if (!vnic_wq_desc_avail(wq)) { 1075 if (!vnic_wq_desc_avail(wq)) {