scsi: qedf: Add fka_period SCSI host attribute to show fip keep alive period.
Expose this information for interested applications. Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
ff34e8e84f
commit
c07c54b0cb
|
@ -8,6 +8,25 @@
|
||||||
*/
|
*/
|
||||||
#include "qedf.h"
|
#include "qedf.h"
|
||||||
|
|
||||||
|
inline bool qedf_is_vport(struct qedf_ctx *qedf)
|
||||||
|
{
|
||||||
|
return qedf->lport->vport != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get base qedf for physical port from vport */
|
||||||
|
static struct qedf_ctx *qedf_get_base_qedf(struct qedf_ctx *qedf)
|
||||||
|
{
|
||||||
|
struct fc_lport *lport;
|
||||||
|
struct fc_lport *base_lport;
|
||||||
|
|
||||||
|
if (!(qedf_is_vport(qedf)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
lport = qedf->lport;
|
||||||
|
base_lport = shost_priv(vport_to_shost(lport->vport));
|
||||||
|
return lport_priv(base_lport);
|
||||||
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
qedf_fcoe_mac_show(struct device *dev,
|
qedf_fcoe_mac_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
|
@ -26,34 +45,34 @@ qedf_fcoe_mac_show(struct device *dev,
|
||||||
return scnprintf(buf, PAGE_SIZE, "%pM\n", fcoe_mac);
|
return scnprintf(buf, PAGE_SIZE, "%pM\n", fcoe_mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
qedf_fka_period_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
struct fc_lport *lport = shost_priv(class_to_shost(dev));
|
||||||
|
struct qedf_ctx *qedf = lport_priv(lport);
|
||||||
|
int fka_period = -1;
|
||||||
|
|
||||||
|
if (qedf_is_vport(qedf))
|
||||||
|
qedf = qedf_get_base_qedf(qedf);
|
||||||
|
|
||||||
|
if (qedf->ctlr.sel_fcf)
|
||||||
|
fka_period = qedf->ctlr.sel_fcf->fka_period;
|
||||||
|
|
||||||
|
return scnprintf(buf, PAGE_SIZE, "%d\n", fka_period);
|
||||||
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR(fcoe_mac, S_IRUGO, qedf_fcoe_mac_show, NULL);
|
static DEVICE_ATTR(fcoe_mac, S_IRUGO, qedf_fcoe_mac_show, NULL);
|
||||||
|
static DEVICE_ATTR(fka_period, S_IRUGO, qedf_fka_period_show, NULL);
|
||||||
|
|
||||||
struct device_attribute *qedf_host_attrs[] = {
|
struct device_attribute *qedf_host_attrs[] = {
|
||||||
&dev_attr_fcoe_mac,
|
&dev_attr_fcoe_mac,
|
||||||
|
&dev_attr_fka_period,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct qed_fcoe_ops *qed_ops;
|
extern const struct qed_fcoe_ops *qed_ops;
|
||||||
|
|
||||||
inline bool qedf_is_vport(struct qedf_ctx *qedf)
|
|
||||||
{
|
|
||||||
return (!(qedf->lport->vport == NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get base qedf for physical port from vport */
|
|
||||||
static struct qedf_ctx *qedf_get_base_qedf(struct qedf_ctx *qedf)
|
|
||||||
{
|
|
||||||
struct fc_lport *lport;
|
|
||||||
struct fc_lport *base_lport;
|
|
||||||
|
|
||||||
if (!(qedf_is_vport(qedf)))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
lport = qedf->lport;
|
|
||||||
base_lport = shost_priv(vport_to_shost(lport->vport));
|
|
||||||
return (struct qedf_ctx *)(lport_priv(base_lport));
|
|
||||||
}
|
|
||||||
|
|
||||||
void qedf_capture_grc_dump(struct qedf_ctx *qedf)
|
void qedf_capture_grc_dump(struct qedf_ctx *qedf)
|
||||||
{
|
{
|
||||||
struct qedf_ctx *base_qedf;
|
struct qedf_ctx *base_qedf;
|
||||||
|
|
Loading…
Reference in New Issue