/* * Module parameter information and variables
*/ staticint ql4xdisablesysfsboot = 1;
module_param(ql4xdisablesysfsboot, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(ql4xdisablesysfsboot, " Set to disable exporting boot targets to sysfs.\n" "\t\t 0 - Export boot targets\n" "\t\t 1 - Do not export boot targets (Default)");
int ql4xdontresethba;
module_param(ql4xdontresethba, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(ql4xdontresethba, " Don't reset the HBA for driver recovery.\n" "\t\t 0 - It will reset HBA (Default)\n" "\t\t 1 - It will NOT reset HBA");
int ql4xextended_error_logging;
module_param(ql4xextended_error_logging, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(ql4xextended_error_logging, " Option to enable extended error logging.\n" "\t\t 0 - no logging (Default)\n" "\t\t 2 - debug logging");
int ql4xenablemsix = 1;
module_param(ql4xenablemsix, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(ql4xenablemsix, " Set to enable MSI or MSI-X interrupt mechanism.\n" "\t\t 0 = enable INTx interrupt mechanism.\n" "\t\t 1 = enable MSI-X interrupt mechanism (Default).\n" "\t\t 2 = enable MSI interrupt mechanism.");
#define QL4_DEF_QDEPTH 32 staticint ql4xmaxqdepth = QL4_DEF_QDEPTH;
module_param(ql4xmaxqdepth, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(ql4xmaxqdepth, " Maximum queue depth to report for target devices.\n" "\t\t Default: 32.");
int ql4xmdcapmask = 0;
module_param(ql4xmdcapmask, int, S_IRUGO);
MODULE_PARM_DESC(ql4xmdcapmask, " Set the Minidump driver capture mask level.\n" "\t\t Default is 0 (firmware default capture mask)\n" "\t\t Can be set to 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF");
int ql4xenablemd = 1;
module_param(ql4xenablemd, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(ql4xenablemd, " Set to enable minidump.\n" "\t\t 0 - disable minidump\n" "\t\t 1 - enable minidump (Default)");
static umode_t qla4_attr_is_visible(int param_type, int param)
{ switch (param_type) { case ISCSI_HOST_PARAM: switch (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;
} case ISCSI_PARAM: switch (param) { case ISCSI_PARAM_PERSISTENT_ADDRESS: case ISCSI_PARAM_PERSISTENT_PORT: case ISCSI_PARAM_CONN_ADDRESS: case ISCSI_PARAM_CONN_PORT: case ISCSI_PARAM_TARGET_NAME: case ISCSI_PARAM_TPGT: case ISCSI_PARAM_TARGET_ALIAS: case ISCSI_PARAM_MAX_BURST: case ISCSI_PARAM_MAX_R2T: case ISCSI_PARAM_FIRST_BURST: case ISCSI_PARAM_MAX_RECV_DLENGTH: case ISCSI_PARAM_MAX_XMIT_DLENGTH: case ISCSI_PARAM_IFACE_NAME: case ISCSI_PARAM_CHAP_OUT_IDX: case ISCSI_PARAM_CHAP_IN_IDX: case ISCSI_PARAM_USERNAME: case ISCSI_PARAM_PASSWORD: case ISCSI_PARAM_USERNAME_IN: case ISCSI_PARAM_PASSWORD_IN: case ISCSI_PARAM_AUTO_SND_TGT_DISABLE: case ISCSI_PARAM_DISCOVERY_SESS: case ISCSI_PARAM_PORTAL_TYPE: case ISCSI_PARAM_CHAP_AUTH_EN: case ISCSI_PARAM_DISCOVERY_LOGOUT_EN: case ISCSI_PARAM_BIDI_CHAP_EN: case ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL: case ISCSI_PARAM_DEF_TIME2WAIT: case ISCSI_PARAM_DEF_TIME2RETAIN: case ISCSI_PARAM_HDRDGST_EN: case ISCSI_PARAM_DATADGST_EN: case ISCSI_PARAM_INITIAL_R2T_EN: case ISCSI_PARAM_IMM_DATA_EN: case ISCSI_PARAM_PDU_INORDER_EN: case ISCSI_PARAM_DATASEQ_INORDER_EN: case ISCSI_PARAM_MAX_SEGMENT_SIZE: case ISCSI_PARAM_TCP_TIMESTAMP_STAT: case ISCSI_PARAM_TCP_WSF_DISABLE: case ISCSI_PARAM_TCP_NAGLE_DISABLE: case ISCSI_PARAM_TCP_TIMER_SCALE: case ISCSI_PARAM_TCP_TIMESTAMP_EN: case ISCSI_PARAM_TCP_XMIT_WSF: case ISCSI_PARAM_TCP_RECV_WSF: case ISCSI_PARAM_IP_FRAGMENT_DISABLE: case ISCSI_PARAM_IPV4_TOS: case ISCSI_PARAM_IPV6_TC: case ISCSI_PARAM_IPV6_FLOW_LABEL: case ISCSI_PARAM_IS_FW_ASSIGNED_IPV6: case ISCSI_PARAM_KEEPALIVE_TMO: case ISCSI_PARAM_LOCAL_PORT: case ISCSI_PARAM_ISID: case ISCSI_PARAM_TSID: case ISCSI_PARAM_DEF_TASKMGMT_TMO: case ISCSI_PARAM_ERL: case ISCSI_PARAM_STATSN: case ISCSI_PARAM_EXP_STATSN: case ISCSI_PARAM_DISCOVERY_PARENT_IDX: case ISCSI_PARAM_DISCOVERY_PARENT_TYPE: case ISCSI_PARAM_LOCAL_IPADDR: return S_IRUGO; default: return 0;
} case ISCSI_NET_PARAM: switch (param) { case ISCSI_NET_PARAM_IPV4_ADDR: case ISCSI_NET_PARAM_IPV4_SUBNET: case ISCSI_NET_PARAM_IPV4_GW: case ISCSI_NET_PARAM_IPV4_BOOTPROTO: case ISCSI_NET_PARAM_IFACE_ENABLE: case ISCSI_NET_PARAM_IPV6_LINKLOCAL: case ISCSI_NET_PARAM_IPV6_ADDR: case ISCSI_NET_PARAM_IPV6_ROUTER: case ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG: case ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG: case ISCSI_NET_PARAM_VLAN_ID: case ISCSI_NET_PARAM_VLAN_PRIORITY: case ISCSI_NET_PARAM_VLAN_ENABLED: case ISCSI_NET_PARAM_MTU: case ISCSI_NET_PARAM_PORT: case ISCSI_NET_PARAM_IPADDR_STATE: case ISCSI_NET_PARAM_IPV6_LINKLOCAL_STATE: case ISCSI_NET_PARAM_IPV6_ROUTER_STATE: case ISCSI_NET_PARAM_DELAYED_ACK_EN: case ISCSI_NET_PARAM_TCP_NAGLE_DISABLE: case ISCSI_NET_PARAM_TCP_WSF_DISABLE: case ISCSI_NET_PARAM_TCP_WSF: case ISCSI_NET_PARAM_TCP_TIMER_SCALE: case ISCSI_NET_PARAM_TCP_TIMESTAMP_EN: case ISCSI_NET_PARAM_CACHE_ID: case ISCSI_NET_PARAM_IPV4_DHCP_DNS_ADDR_EN: case ISCSI_NET_PARAM_IPV4_DHCP_SLP_DA_EN: case ISCSI_NET_PARAM_IPV4_TOS_EN: case ISCSI_NET_PARAM_IPV4_TOS: case ISCSI_NET_PARAM_IPV4_GRAT_ARP_EN: case ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID_EN: case ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID: case ISCSI_NET_PARAM_IPV4_DHCP_REQ_VENDOR_ID_EN: case ISCSI_NET_PARAM_IPV4_DHCP_USE_VENDOR_ID_EN: case ISCSI_NET_PARAM_IPV4_DHCP_VENDOR_ID: case ISCSI_NET_PARAM_IPV4_DHCP_LEARN_IQN_EN: case ISCSI_NET_PARAM_IPV4_FRAGMENT_DISABLE: case ISCSI_NET_PARAM_IPV4_IN_FORWARD_EN: case ISCSI_NET_PARAM_REDIRECT_EN: case ISCSI_NET_PARAM_IPV4_TTL: case ISCSI_NET_PARAM_IPV6_GRAT_NEIGHBOR_ADV_EN: case ISCSI_NET_PARAM_IPV6_MLD_EN: case ISCSI_NET_PARAM_IPV6_FLOW_LABEL: case ISCSI_NET_PARAM_IPV6_TRAFFIC_CLASS: case ISCSI_NET_PARAM_IPV6_HOP_LIMIT: case ISCSI_NET_PARAM_IPV6_ND_REACHABLE_TMO: case ISCSI_NET_PARAM_IPV6_ND_REXMIT_TIME: case ISCSI_NET_PARAM_IPV6_ND_STALE_TMO: case ISCSI_NET_PARAM_IPV6_DUP_ADDR_DETECT_CNT: case ISCSI_NET_PARAM_IPV6_RTR_ADV_LINK_MTU: return S_IRUGO; default: return 0;
} case ISCSI_IFACE_PARAM: switch (param) { case ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO: case ISCSI_IFACE_PARAM_HDRDGST_EN: case ISCSI_IFACE_PARAM_DATADGST_EN: case ISCSI_IFACE_PARAM_IMM_DATA_EN: case ISCSI_IFACE_PARAM_INITIAL_R2T_EN: case ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN: case ISCSI_IFACE_PARAM_PDU_INORDER_EN: case ISCSI_IFACE_PARAM_ERL: case ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH: case ISCSI_IFACE_PARAM_FIRST_BURST: case ISCSI_IFACE_PARAM_MAX_R2T: case ISCSI_IFACE_PARAM_MAX_BURST: case ISCSI_IFACE_PARAM_CHAP_AUTH_EN: case ISCSI_IFACE_PARAM_BIDI_CHAP_EN: case ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL: case ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN: case ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN: case ISCSI_IFACE_PARAM_INITIATOR_NAME: return S_IRUGO; default: return 0;
} case ISCSI_FLASHNODE_PARAM: switch (param) { case ISCSI_FLASHNODE_IS_FW_ASSIGNED_IPV6: case ISCSI_FLASHNODE_PORTAL_TYPE: case ISCSI_FLASHNODE_AUTO_SND_TGT_DISABLE: case ISCSI_FLASHNODE_DISCOVERY_SESS: case ISCSI_FLASHNODE_ENTRY_EN: case ISCSI_FLASHNODE_HDR_DGST_EN: case ISCSI_FLASHNODE_DATA_DGST_EN: case ISCSI_FLASHNODE_IMM_DATA_EN: case ISCSI_FLASHNODE_INITIAL_R2T_EN: case ISCSI_FLASHNODE_DATASEQ_INORDER: case ISCSI_FLASHNODE_PDU_INORDER: case ISCSI_FLASHNODE_CHAP_AUTH_EN: case ISCSI_FLASHNODE_SNACK_REQ_EN: case ISCSI_FLASHNODE_DISCOVERY_LOGOUT_EN: case ISCSI_FLASHNODE_BIDI_CHAP_EN: case ISCSI_FLASHNODE_DISCOVERY_AUTH_OPTIONAL: case ISCSI_FLASHNODE_ERL: case ISCSI_FLASHNODE_TCP_TIMESTAMP_STAT: case ISCSI_FLASHNODE_TCP_NAGLE_DISABLE: case ISCSI_FLASHNODE_TCP_WSF_DISABLE: case ISCSI_FLASHNODE_TCP_TIMER_SCALE: case ISCSI_FLASHNODE_TCP_TIMESTAMP_EN: case ISCSI_FLASHNODE_IP_FRAG_DISABLE: case ISCSI_FLASHNODE_MAX_RECV_DLENGTH: case ISCSI_FLASHNODE_MAX_XMIT_DLENGTH: case ISCSI_FLASHNODE_FIRST_BURST: case ISCSI_FLASHNODE_DEF_TIME2WAIT: case ISCSI_FLASHNODE_DEF_TIME2RETAIN: case ISCSI_FLASHNODE_MAX_R2T: case ISCSI_FLASHNODE_KEEPALIVE_TMO: case ISCSI_FLASHNODE_ISID: case ISCSI_FLASHNODE_TSID: case ISCSI_FLASHNODE_PORT: case ISCSI_FLASHNODE_MAX_BURST: case ISCSI_FLASHNODE_DEF_TASKMGMT_TMO: case ISCSI_FLASHNODE_IPADDR: case ISCSI_FLASHNODE_ALIAS: case ISCSI_FLASHNODE_REDIRECT_IPADDR: case ISCSI_FLASHNODE_MAX_SEGMENT_SIZE: case ISCSI_FLASHNODE_LOCAL_PORT: case ISCSI_FLASHNODE_IPV4_TOS: case ISCSI_FLASHNODE_IPV6_TC: case ISCSI_FLASHNODE_IPV6_FLOW_LABEL: case ISCSI_FLASHNODE_NAME: case ISCSI_FLASHNODE_TPGT: case ISCSI_FLASHNODE_LINK_LOCAL_IPV6: case ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX: case ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE: case ISCSI_FLASHNODE_TCP_XMIT_WSF: case ISCSI_FLASHNODE_TCP_RECV_WSF: case ISCSI_FLASHNODE_CHAP_OUT_IDX: case ISCSI_FLASHNODE_USERNAME: case ISCSI_FLASHNODE_PASSWORD: case ISCSI_FLASHNODE_STATSN: case ISCSI_FLASHNODE_EXP_STATSN: case ISCSI_FLASHNODE_IS_BOOT_TGT: return S_IRUGO; default: return 0;
}
}
return 0;
}
/** * qla4xxx_create_chap_list - Create CHAP list from FLASH * @ha: pointer to adapter structure * * Read flash and make a list of CHAP entries, during login when a CHAP entry * is received, it will be checked in this list. If entry exist then the CHAP * entry index is set in the DDB. If CHAP entry does not exist in this list * then a new entry is added in FLASH in CHAP table and the index obtained is * used in the DDB.
**/ staticvoid qla4xxx_create_chap_list(struct scsi_qla_host *ha)
{ int rval = 0;
uint8_t *chap_flash_data = NULL;
uint32_t offset;
dma_addr_t chap_dma;
uint32_t chap_size = 0;
if (is_qla40XX(ha))
chap_size = MAX_CHAP_ENTRIES_40XX * sizeof(struct ql4_chap_table); else/* Single region contains CHAP info for both * ports which is divided into half for each port.
*/
chap_size = ha->hw.flt_chap_size / 2;
chap_flash_data = dma_alloc_coherent(&ha->pdev->dev, chap_size,
&chap_dma, GFP_KERNEL); if (!chap_flash_data) {
ql4_printk(KERN_ERR, ha, "No memory for chap_flash_data\n"); return;
}
if (ha->chap_list == NULL)
ha->chap_list = vmalloc(chap_size); if (ha->chap_list == NULL) {
ql4_printk(KERN_ERR, ha, "No memory for ha->chap_list\n"); goto exit_chap_list;
}
/** * qla4xxx_find_free_chap_index - Find the first free chap index * @ha: pointer to adapter structure * @chap_index: CHAP index to be returned * * Find the first free chap index available in the chap table * * Note: Caller should acquire the chap lock before getting here.
**/ staticint qla4xxx_find_free_chap_index(struct scsi_qla_host *ha,
uint16_t *chap_index)
{ int i, rval; int free_index = -1; int max_chap_entries = 0; struct ql4_chap_table *chap_table;
if (chap_tbl_idx > max_chap_entries) {
ret = -EINVAL; goto exit_delete_chap;
}
/* Check if chap index is in use.
* If chap is in use don't delet chap entry */
ret = qla4xxx_is_chap_active(shost, chap_tbl_idx); if (ret) {
ql4_printk(KERN_INFO, ha, "CHAP entry %d is in use, cannot " "delete from flash\n", chap_tbl_idx);
ret = -EBUSY; goto exit_delete_chap;
}
chap_size = sizeof(struct ql4_chap_table); if (is_qla40XX(ha))
offset = FLASH_CHAP_OFFSET | (chap_tbl_idx * chap_size); else {
offset = FLASH_RAW_ACCESS_ADDR + (ha->hw.flt_region_chap << 2); /* flt_chap_size is CHAP table size for both ports * so divide it by 2 to calculate the offset for second port
*/ if (ha->port_num == 1)
offset += (ha->hw.flt_chap_size / 2);
offset += (chap_tbl_idx * chap_size);
}
ret = qla4xxx_get_flash(ha, chap_dma, offset, chap_size); if (ret != QLA_SUCCESS) {
ret = -EINVAL; goto exit_delete_chap;
}
DEBUG2(ql4_printk(KERN_INFO, ha, "Chap Cookie: x%x\n",
__le16_to_cpu(chap_table->cookie)));
if (__le16_to_cpu(chap_table->cookie) != CHAP_VALID_COOKIE) {
ql4_printk(KERN_ERR, ha, "No valid chap entry found\n"); goto exit_delete_chap;
}
chap_table->cookie = cpu_to_le16(0xFFFF);
offset = FLASH_CHAP_OFFSET |
(chap_tbl_idx * sizeof(struct ql4_chap_table));
ret = qla4xxx_set_flash(ha, chap_dma, offset, chap_size,
FLASH_OPT_RMW_COMMIT); if (ret == QLA_SUCCESS && ha->chap_list) {
mutex_lock(&ha->chap_sem); /* Update ha chap_list cache */
memcpy((struct ql4_chap_table *)ha->chap_list + chap_tbl_idx,
chap_table, sizeof(struct ql4_chap_table));
mutex_unlock(&ha->chap_sem);
} if (ret != QLA_SUCCESS)
ret = -EINVAL;
/** * qla4xxx_set_chap_entry - Make chap entry with given information * @shost: pointer to host * @data: chap info - credentials, index and type to make chap entry * @len: length of data * * Add or update chap entry with the given information
**/ staticint qla4xxx_set_chap_entry(struct Scsi_Host *shost, void *data, int len)
{ struct scsi_qla_host *ha = to_qla_host(shost); struct iscsi_chap_rec chap_rec; struct ql4_chap_table *chap_entry = NULL; struct iscsi_param_info *param_info; struct nlattr *attr; int max_chap_entries = 0; int type; int rem = len; int rc = 0; int size;
mutex_lock(&ha->chap_sem); if (chap_rec.chap_tbl_idx < max_chap_entries) {
rc = qla4xxx_get_chap_by_index(ha, chap_rec.chap_tbl_idx,
&chap_entry); if (!rc) { if (!(type == qla4xxx_get_chap_type(chap_entry))) {
ql4_printk(KERN_INFO, ha, "Type mismatch for CHAP entry %d\n",
chap_rec.chap_tbl_idx);
rc = -EINVAL; goto exit_unlock_chap;
}
/* If chap index is in use then don't modify it */
rc = qla4xxx_is_chap_active(shost,
chap_rec.chap_tbl_idx); if (rc) {
ql4_printk(KERN_INFO, ha, "CHAP entry %d is in use\n",
chap_rec.chap_tbl_idx);
rc = -EBUSY; goto exit_unlock_chap;
}
}
} else {
rc = qla4xxx_find_free_chap_index(ha, &chap_rec.chap_tbl_idx); if (rc) {
ql4_printk(KERN_INFO, ha, "CHAP entry not available\n");
rc = -EBUSY; goto exit_unlock_chap;
}
}
ql_iscsi_stats = dma_alloc_coherent(&ha->pdev->dev, stats_size,
&iscsi_stats_dma, GFP_KERNEL); if (!ql_iscsi_stats) {
ql4_printk(KERN_ERR, ha, "Unable to allocate memory for iscsi stats\n");
ret = -ENOMEM; goto exit_host_stats;
}
ql4_printk(KERN_INFO, ha, "%s: Get host stats done\n",
__func__); return ret;
}
staticint qla4xxx_get_iface_param(struct iscsi_iface *iface, enum iscsi_param_type param_type, int param, char *buf)
{ struct Scsi_Host *shost = iscsi_iface_to_shost(iface); struct scsi_qla_host *ha = to_qla_host(shost); int ival; char *pval = NULL; int len = -ENOSYS;
if (param_type == ISCSI_NET_PARAM) { switch (param) { case ISCSI_NET_PARAM_IPV4_ADDR:
len = sprintf(buf, "%pI4\n", &ha->ip_config.ip_address); break; case ISCSI_NET_PARAM_IPV4_SUBNET:
len = sprintf(buf, "%pI4\n",
&ha->ip_config.subnet_mask); break; case ISCSI_NET_PARAM_IPV4_GW:
len = sprintf(buf, "%pI4\n", &ha->ip_config.gateway); break; case ISCSI_NET_PARAM_IFACE_ENABLE: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
OP_STATE(ha->ip_config.ipv4_options,
IPOPT_IPV4_PROTOCOL_ENABLE, pval);
} else {
OP_STATE(ha->ip_config.ipv6_options,
IPV6_OPT_IPV6_PROTOCOL_ENABLE, pval);
}
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
len = sprintf(buf, "%s\n",
(ha->ip_config.tcp_options &
TCPOPT_DHCP_ENABLE) ? "dhcp" : "static"); break; case ISCSI_NET_PARAM_IPV6_ADDR: if (iface->iface_num == 0)
len = sprintf(buf, "%pI6\n",
&ha->ip_config.ipv6_addr0); if (iface->iface_num == 1)
len = sprintf(buf, "%pI6\n",
&ha->ip_config.ipv6_addr1); break; case ISCSI_NET_PARAM_IPV6_LINKLOCAL:
len = sprintf(buf, "%pI6\n",
&ha->ip_config.ipv6_link_local_addr); break; case ISCSI_NET_PARAM_IPV6_ROUTER:
len = sprintf(buf, "%pI6\n",
&ha->ip_config.ipv6_default_router_addr); break; case ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG:
pval = (ha->ip_config.ipv6_addl_options &
IPV6_ADDOPT_NEIGHBOR_DISCOVERY_ADDR_ENABLE) ? "nd" : "static";
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG:
pval = (ha->ip_config.ipv6_addl_options &
IPV6_ADDOPT_AUTOCONFIG_LINK_LOCAL_ADDR) ? "auto" : "static";
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_VLAN_ID: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4)
ival = ha->ip_config.ipv4_vlan_tag &
ISCSI_MAX_VLAN_ID; else
ival = ha->ip_config.ipv6_vlan_tag &
ISCSI_MAX_VLAN_ID;
len = sprintf(buf, "%d\n", ival); break; case ISCSI_NET_PARAM_VLAN_PRIORITY: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4)
ival = (ha->ip_config.ipv4_vlan_tag >> 13) &
ISCSI_MAX_VLAN_PRIORITY; else
ival = (ha->ip_config.ipv6_vlan_tag >> 13) &
ISCSI_MAX_VLAN_PRIORITY;
len = sprintf(buf, "%d\n", ival); break; case ISCSI_NET_PARAM_VLAN_ENABLED: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
OP_STATE(ha->ip_config.ipv4_options,
IPOPT_VLAN_TAGGING_ENABLE, pval);
} else {
OP_STATE(ha->ip_config.ipv6_options,
IPV6_OPT_VLAN_TAGGING_ENABLE, pval);
}
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_MTU:
len = sprintf(buf, "%d\n", ha->ip_config.eth_mtu_size); break; case ISCSI_NET_PARAM_PORT: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4)
len = sprintf(buf, "%d\n",
ha->ip_config.ipv4_port); else
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_port); break; case ISCSI_NET_PARAM_IPADDR_STATE: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
pval = iscsi_get_ipaddress_state_name(
ha->ip_config.ipv4_addr_state);
} else { if (iface->iface_num == 0)
pval = iscsi_get_ipaddress_state_name(
ha->ip_config.ipv6_addr0_state); elseif (iface->iface_num == 1)
pval = iscsi_get_ipaddress_state_name(
ha->ip_config.ipv6_addr1_state);
}
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV6_LINKLOCAL_STATE:
pval = iscsi_get_ipaddress_state_name(
ha->ip_config.ipv6_link_local_state);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV6_ROUTER_STATE:
pval = iscsi_get_router_state_name(
ha->ip_config.ipv6_default_router_state);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_DELAYED_ACK_EN: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
OP_STATE(~ha->ip_config.tcp_options,
TCPOPT_DELAYED_ACK_DISABLE, pval);
} else {
OP_STATE(~ha->ip_config.ipv6_tcp_options,
IPV6_TCPOPT_DELAYED_ACK_DISABLE, pval);
}
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_TCP_NAGLE_DISABLE: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
OP_STATE(~ha->ip_config.tcp_options,
TCPOPT_NAGLE_ALGO_DISABLE, pval);
} else {
OP_STATE(~ha->ip_config.ipv6_tcp_options,
IPV6_TCPOPT_NAGLE_ALGO_DISABLE, pval);
}
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_TCP_WSF_DISABLE: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
OP_STATE(~ha->ip_config.tcp_options,
TCPOPT_WINDOW_SCALE_DISABLE, pval);
} else {
OP_STATE(~ha->ip_config.ipv6_tcp_options,
IPV6_TCPOPT_WINDOW_SCALE_DISABLE,
pval);
}
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_TCP_WSF: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4)
len = sprintf(buf, "%d\n",
ha->ip_config.tcp_wsf); else
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_tcp_wsf); break; case ISCSI_NET_PARAM_TCP_TIMER_SCALE: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4)
ival = (ha->ip_config.tcp_options &
TCPOPT_TIMER_SCALE) >> 1; else
ival = (ha->ip_config.ipv6_tcp_options &
IPV6_TCPOPT_TIMER_SCALE) >> 1;
len = sprintf(buf, "%d\n", ival); break; case ISCSI_NET_PARAM_TCP_TIMESTAMP_EN: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
OP_STATE(ha->ip_config.tcp_options,
TCPOPT_TIMESTAMP_ENABLE, pval);
} else {
OP_STATE(ha->ip_config.ipv6_tcp_options,
IPV6_TCPOPT_TIMESTAMP_EN, pval);
}
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_CACHE_ID: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4)
len = sprintf(buf, "%d\n",
ha->ip_config.ipv4_cache_id); else
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_cache_id); break; case ISCSI_NET_PARAM_IPV4_DHCP_DNS_ADDR_EN:
OP_STATE(ha->ip_config.tcp_options,
TCPOPT_DNS_SERVER_IP_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_DHCP_SLP_DA_EN:
OP_STATE(ha->ip_config.tcp_options,
TCPOPT_SLP_DA_INFO_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_TOS_EN:
OP_STATE(ha->ip_config.ipv4_options,
IPOPT_IPV4_TOS_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_TOS:
len = sprintf(buf, "%d\n", ha->ip_config.ipv4_tos); break; case ISCSI_NET_PARAM_IPV4_GRAT_ARP_EN:
OP_STATE(ha->ip_config.ipv4_options,
IPOPT_GRAT_ARP_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID_EN:
OP_STATE(ha->ip_config.ipv4_options, IPOPT_ALT_CID_EN,
pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID:
pval = (ha->ip_config.ipv4_alt_cid_len) ?
(char *)ha->ip_config.ipv4_alt_cid : "";
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_DHCP_REQ_VENDOR_ID_EN:
OP_STATE(ha->ip_config.ipv4_options,
IPOPT_REQ_VID_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_DHCP_USE_VENDOR_ID_EN:
OP_STATE(ha->ip_config.ipv4_options,
IPOPT_USE_VID_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_DHCP_VENDOR_ID:
pval = (ha->ip_config.ipv4_vid_len) ?
(char *)ha->ip_config.ipv4_vid : "";
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_DHCP_LEARN_IQN_EN:
OP_STATE(ha->ip_config.ipv4_options,
IPOPT_LEARN_IQN_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_FRAGMENT_DISABLE:
OP_STATE(~ha->ip_config.ipv4_options,
IPOPT_FRAGMENTATION_DISABLE, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_IN_FORWARD_EN:
OP_STATE(ha->ip_config.ipv4_options,
IPOPT_IN_FORWARD_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_REDIRECT_EN: if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
OP_STATE(ha->ip_config.ipv4_options,
IPOPT_ARP_REDIRECT_EN, pval);
} else {
OP_STATE(ha->ip_config.ipv6_options,
IPV6_OPT_REDIRECT_EN, pval);
}
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV4_TTL:
len = sprintf(buf, "%d\n", ha->ip_config.ipv4_ttl); break; case ISCSI_NET_PARAM_IPV6_GRAT_NEIGHBOR_ADV_EN:
OP_STATE(ha->ip_config.ipv6_options,
IPV6_OPT_GRAT_NEIGHBOR_ADV_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV6_MLD_EN:
OP_STATE(ha->ip_config.ipv6_addl_options,
IPV6_ADDOPT_MLD_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_NET_PARAM_IPV6_FLOW_LABEL:
len = sprintf(buf, "%u\n", ha->ip_config.ipv6_flow_lbl); break; case ISCSI_NET_PARAM_IPV6_TRAFFIC_CLASS:
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_traffic_class); break; case ISCSI_NET_PARAM_IPV6_HOP_LIMIT:
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_hop_limit); break; case ISCSI_NET_PARAM_IPV6_ND_REACHABLE_TMO:
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_nd_reach_time); break; case ISCSI_NET_PARAM_IPV6_ND_REXMIT_TIME:
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_nd_rexmit_timer); break; case ISCSI_NET_PARAM_IPV6_ND_STALE_TMO:
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_nd_stale_timeout); break; case ISCSI_NET_PARAM_IPV6_DUP_ADDR_DETECT_CNT:
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_dup_addr_detect_count); break; case ISCSI_NET_PARAM_IPV6_RTR_ADV_LINK_MTU:
len = sprintf(buf, "%d\n",
ha->ip_config.ipv6_gw_advrt_mtu); break; default:
len = -ENOSYS;
}
} elseif (param_type == ISCSI_IFACE_PARAM) { switch (param) { case ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO:
len = sprintf(buf, "%d\n", ha->ip_config.def_timeout); break; case ISCSI_IFACE_PARAM_HDRDGST_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_HEADER_DIGEST_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_DATADGST_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_DATA_DIGEST_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_IMM_DATA_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_IMMEDIATE_DATA_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_INITIAL_R2T_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_INITIAL_R2T_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_DATA_SEQ_INORDER_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_PDU_INORDER_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_DATA_PDU_INORDER_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_ERL:
len = sprintf(buf, "%d\n",
(ha->ip_config.iscsi_options &
ISCSIOPTS_ERL)); break; case ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH:
len = sprintf(buf, "%u\n",
ha->ip_config.iscsi_max_pdu_size *
BYTE_UNITS); break; case ISCSI_IFACE_PARAM_FIRST_BURST:
len = sprintf(buf, "%u\n",
ha->ip_config.iscsi_first_burst_len *
BYTE_UNITS); break; case ISCSI_IFACE_PARAM_MAX_R2T:
len = sprintf(buf, "%d\n",
ha->ip_config.iscsi_max_outstnd_r2t); break; case ISCSI_IFACE_PARAM_MAX_BURST:
len = sprintf(buf, "%u\n",
ha->ip_config.iscsi_max_burst_len *
BYTE_UNITS); break; case ISCSI_IFACE_PARAM_CHAP_AUTH_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_CHAP_AUTH_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_BIDI_CHAP_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_BIDI_CHAP_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_DISCOVERY_AUTH_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_DISCOVERY_LOGOUT_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN:
OP_STATE(ha->ip_config.iscsi_options,
ISCSIOPTS_STRICT_LOGIN_COMP_EN, pval);
len = sprintf(buf, "%s\n", pval); break; case ISCSI_IFACE_PARAM_INITIATOR_NAME:
len = sprintf(buf, "%s\n", ha->ip_config.iscsi_name); break; default:
len = -ENOSYS;
}
}
switch (param) { case ISCSI_HOST_PARAM_HWADDRESS:
len = sysfs_format_mac(buf, ha->my_mac, MAC_ADDR_LEN); break; case ISCSI_HOST_PARAM_IPADDRESS:
len = sprintf(buf, "%pI4\n", &ha->ip_config.ip_address); break; 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;
}
return len;
}
staticvoid qla4xxx_create_ipv4_iface(struct scsi_qla_host *ha)
{ if (ha->iface_ipv4) return;
/* IPv4 */
ha->iface_ipv4 = iscsi_create_iface(ha->host,
&qla4xxx_iscsi_transport,
ISCSI_IFACE_TYPE_IPV4, 0, 0); if (!ha->iface_ipv4)
ql4_printk(KERN_ERR, ha, "Could not create IPv4 iSCSI " "iface0.\n");
}
staticvoid qla4xxx_create_ipv6_iface(struct scsi_qla_host *ha)
{ if (!ha->iface_ipv6_0) /* IPv6 iface-0 */
ha->iface_ipv6_0 = iscsi_create_iface(ha->host,
&qla4xxx_iscsi_transport,
ISCSI_IFACE_TYPE_IPV6, 0,
0); if (!ha->iface_ipv6_0)
ql4_printk(KERN_ERR, ha, "Could not create IPv6 iSCSI " "iface0.\n");
if (!ha->iface_ipv6_1) /* IPv6 iface-1 */
ha->iface_ipv6_1 = iscsi_create_iface(ha->host,
&qla4xxx_iscsi_transport,
ISCSI_IFACE_TYPE_IPV6, 1,
0); if (!ha->iface_ipv6_1)
ql4_printk(KERN_ERR, ha, "Could not create IPv6 iSCSI " "iface1.\n");
}
staticvoid qla4xxx_create_ifaces(struct scsi_qla_host *ha)
{ if (ha->ip_config.ipv4_options & IPOPT_IPV4_PROTOCOL_ENABLE)
qla4xxx_create_ipv4_iface(ha);
if (ha->ip_config.ipv6_options & IPV6_OPT_IPV6_PROTOCOL_ENABLE)
qla4xxx_create_ipv6_iface(ha);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.