Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292887
b: refs/heads/master
c: 3254dbe
h: refs/heads/master
i:
  292885: 88928e3
  292883: c82be97
  292879: d40b21c
v: v3
  • Loading branch information
Vikas Chaudhary authored and James Bottomley committed Feb 19, 2012
1 parent be12872 commit 1967a6c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aeddde2978f8931740032880134039fb937bb07c
refs/heads/master: 3254dbe9d95e1a6eb04f00e8164d14a06f6e485a
4 changes: 4 additions & 0 deletions trunk/drivers/scsi/qla4xxx/ql4_fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ struct qla_flt_region {
#define FW_ADDSTATE_DHCPv4_LEASE_EXPIRED 0x0008
#define FW_ADDSTATE_LINK_UP 0x0010
#define FW_ADDSTATE_ISNS_SVC_ENABLED 0x0020
#define FW_ADDSTATE_LINK_SPEED_10MBPS 0x0100
#define FW_ADDSTATE_LINK_SPEED_100MBPS 0x0200
#define FW_ADDSTATE_LINK_SPEED_1GBPS 0x0400
#define FW_ADDSTATE_LINK_SPEED_10GBPS 0x0800

#define MBOX_CMD_GET_DATABASE_ENTRY_DEFAULTS 0x006B
#define IPV6_DEFAULT_DDB_ENTRY 0x0001
Expand Down
47 changes: 47 additions & 0 deletions trunk/drivers/scsi/qla4xxx/ql4_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ static umode_t ql4_attr_is_visible(int param_type, int param)
case ISCSI_HOST_PARAM_HWADDRESS:
case ISCSI_HOST_PARAM_IPADDRESS:
case ISCSI_HOST_PARAM_INITIATOR_NAME:
case ISCSI_HOST_PARAM_PORT_STATE:
case ISCSI_HOST_PARAM_PORT_SPEED:
return S_IRUGO;
default:
return 0;
Expand Down Expand Up @@ -548,6 +550,43 @@ static enum blk_eh_timer_return qla4xxx_eh_cmd_timed_out(struct scsi_cmnd *sc)
return ret;
}

static void qla4xxx_set_port_speed(struct Scsi_Host *shost)
{
struct scsi_qla_host *ha = to_qla_host(shost);
struct iscsi_cls_host *ihost = shost_priv(shost);
uint32_t speed = ISCSI_PORT_SPEED_UNKNOWN;

qla4xxx_get_firmware_state(ha);

switch (ha->addl_fw_state & 0x0F00) {
case FW_ADDSTATE_LINK_SPEED_10MBPS:
speed = ISCSI_PORT_SPEED_10MBPS;
break;
case FW_ADDSTATE_LINK_SPEED_100MBPS:
speed = ISCSI_PORT_SPEED_100MBPS;
break;
case FW_ADDSTATE_LINK_SPEED_1GBPS:
speed = ISCSI_PORT_SPEED_1GBPS;
break;
case FW_ADDSTATE_LINK_SPEED_10GBPS:
speed = ISCSI_PORT_SPEED_10GBPS;
break;
}
ihost->port_speed = speed;
}

static void qla4xxx_set_port_state(struct Scsi_Host *shost)
{
struct scsi_qla_host *ha = to_qla_host(shost);
struct iscsi_cls_host *ihost = shost_priv(shost);
uint32_t state = ISCSI_PORT_STATE_DOWN;

if (test_bit(AF_LINK_UP, &ha->flags))
state = ISCSI_PORT_STATE_UP;

ihost->port_state = state;
}

static int qla4xxx_host_get_param(struct Scsi_Host *shost,
enum iscsi_host_param param, char *buf)
{
Expand All @@ -564,6 +603,14 @@ static int qla4xxx_host_get_param(struct Scsi_Host *shost,
case ISCSI_HOST_PARAM_INITIATOR_NAME:
len = sprintf(buf, "%s\n", ha->name_string);
break;
case ISCSI_HOST_PARAM_PORT_STATE:
qla4xxx_set_port_state(shost);
len = sprintf(buf, "%s\n", iscsi_get_port_state_name(shost));
break;
case ISCSI_HOST_PARAM_PORT_SPEED:
qla4xxx_set_port_speed(shost);
len = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost));
break;
default:
return -ENOSYS;
}
Expand Down

0 comments on commit 1967a6c

Please sign in to comment.