Commit 642a0b37 authored by Chad Dupuis's avatar Chad Dupuis Committed by David S. Miller

qedf: Add support for populating ethernet TLVs.

This patch adds callbacks for providing the ethernet protocol driver TLVs.
Signed-off-by: default avatarChad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d25b859c
......@@ -383,11 +383,16 @@ struct qedf_ctx {
u32 flogi_failed;
/* Used for fc statistics */
struct mutex stats_mutex;
u64 input_requests;
u64 output_requests;
u64 control_requests;
u64 packet_aborts;
u64 alloc_failures;
u8 lun_resets;
u8 target_resets;
u8 task_set_fulls;
u8 busy;
};
struct io_bdt {
......@@ -496,6 +501,7 @@ extern int qedf_post_io_req(struct qedf_rport *fcport,
extern void qedf_process_seq_cleanup_compl(struct qedf_ctx *qedf,
struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
extern int qedf_send_flogi(struct qedf_ctx *qedf);
extern void qedf_get_protocol_tlv_data(void *dev, void *data);
extern void qedf_fp_io_handler(struct work_struct *work);
#define FCOE_WORD_TO_BYTE 4
......
......@@ -439,7 +439,6 @@ qedf_dbg_offload_stats_open(struct inode *inode, struct file *file)
return single_open(file, qedf_offload_stats_show, qedf);
}
const struct file_operations qedf_dbg_fops[] = {
qedf_dbg_fileops(qedf, fp_int),
qedf_dbg_fileops_seq(qedf, io_trace),
......
......@@ -1200,6 +1200,12 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
fcport->retry_delay_timestamp =
jiffies + (qualifier * HZ / 10);
}
/* Record stats */
if (io_req->cdb_status ==
SAM_STAT_TASK_SET_FULL)
qedf->task_set_fulls++;
else
qedf->busy++;
}
}
if (io_req->fcp_resid)
......@@ -1866,6 +1872,11 @@ static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd,
goto reset_tmf_err;
}
if (tm_flags == FCP_TMF_LUN_RESET)
qedf->lun_resets++;
else if (tm_flags == FCP_TMF_TGT_RESET)
qedf->target_resets++;
/* Initialize rest of io_req fields */
io_req->sc_cmd = sc_cmd;
io_req->fcport = fcport;
......
......@@ -566,6 +566,7 @@ static struct qed_fcoe_cb_ops qedf_cb_ops = {
{
.link_update = qedf_link_update,
.dcbx_aen = qedf_dcbx_handler,
.get_protocol_tlv_data = qedf_get_protocol_tlv_data,
}
};
......@@ -1746,6 +1747,8 @@ static struct fc_host_statistics *qedf_fc_get_host_stats(struct Scsi_Host
goto out;
}
mutex_lock(&qedf->stats_mutex);
/* Query firmware for offload stats */
qed_ops->get_stats(qedf->cdev, fw_fcoe_stats);
......@@ -1779,6 +1782,7 @@ static struct fc_host_statistics *qedf_fc_get_host_stats(struct Scsi_Host
qedf_stats->fcp_packet_aborts += qedf->packet_aborts;
qedf_stats->fcp_frame_alloc_failures += qedf->alloc_failures;
mutex_unlock(&qedf->stats_mutex);
kfree(fw_fcoe_stats);
out:
return qedf_stats;
......@@ -2948,6 +2952,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
qedf->stop_io_on_error = false;
pci_set_drvdata(pdev, qedf);
init_completion(&qedf->fipvlan_compl);
mutex_init(&qedf->stats_mutex);
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO,
"QLogic FastLinQ FCoE Module qedf %s, "
......@@ -3392,6 +3397,88 @@ static void qedf_remove(struct pci_dev *pdev)
__qedf_remove(pdev, QEDF_MODE_NORMAL);
}
/*
* Protocol TLV handler
*/
void qedf_get_protocol_tlv_data(void *dev, void *data)
{
struct qedf_ctx *qedf = dev;
struct qed_mfw_tlv_fcoe *fcoe = data;
struct fc_lport *lport = qedf->lport;
struct Scsi_Host *host = lport->host;
struct fc_host_attrs *fc_host = shost_to_fc_host(host);
struct fc_host_statistics *hst;
/* Force a refresh of the fc_host stats including offload stats */
hst = qedf_fc_get_host_stats(host);
fcoe->qos_pri_set = true;
fcoe->qos_pri = 3; /* Hard coded to 3 in driver */
fcoe->ra_tov_set = true;
fcoe->ra_tov = lport->r_a_tov;
fcoe->ed_tov_set = true;
fcoe->ed_tov = lport->e_d_tov;
fcoe->npiv_state_set = true;
fcoe->npiv_state = 1; /* NPIV always enabled */
fcoe->num_npiv_ids_set = true;
fcoe->num_npiv_ids = fc_host->npiv_vports_inuse;
/* Certain attributes we only want to set if we've selected an FCF */
if (qedf->ctlr.sel_fcf) {
fcoe->switch_name_set = true;
u64_to_wwn(qedf->ctlr.sel_fcf->switch_name, fcoe->switch_name);
}
fcoe->port_state_set = true;
/* For qedf we're either link down or fabric attach */
if (lport->link_up)
fcoe->port_state = QED_MFW_TLV_PORT_STATE_FABRIC;
else
fcoe->port_state = QED_MFW_TLV_PORT_STATE_OFFLINE;
fcoe->link_failures_set = true;
fcoe->link_failures = (u16)hst->link_failure_count;
fcoe->fcoe_txq_depth_set = true;
fcoe->fcoe_rxq_depth_set = true;
fcoe->fcoe_rxq_depth = FCOE_PARAMS_NUM_TASKS;
fcoe->fcoe_txq_depth = FCOE_PARAMS_NUM_TASKS;
fcoe->fcoe_rx_frames_set = true;
fcoe->fcoe_rx_frames = hst->rx_frames;
fcoe->fcoe_tx_frames_set = true;
fcoe->fcoe_tx_frames = hst->tx_frames;
fcoe->fcoe_rx_bytes_set = true;
fcoe->fcoe_rx_bytes = hst->fcp_input_megabytes * 1000000;
fcoe->fcoe_tx_bytes_set = true;
fcoe->fcoe_tx_bytes = hst->fcp_output_megabytes * 1000000;
fcoe->crc_count_set = true;
fcoe->crc_count = hst->invalid_crc_count;
fcoe->tx_abts_set = true;
fcoe->tx_abts = hst->fcp_packet_aborts;
fcoe->tx_lun_rst_set = true;
fcoe->tx_lun_rst = qedf->lun_resets;
fcoe->abort_task_sets_set = true;
fcoe->abort_task_sets = qedf->packet_aborts;
fcoe->scsi_busy_set = true;
fcoe->scsi_busy = qedf->busy;
fcoe->scsi_tsk_full_set = true;
fcoe->scsi_tsk_full = qedf->task_set_fulls;
}
/*
* Module Init/Remove
*/
......
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