Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] qla4xxx: Add VLAN support

Add support to set VLAN and show vlan settings in sysfs

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
[Patch updated to new defines]
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Vikas Chaudhary and committed by
James Bottomley
6ac73e8c 5431ae26

+61 -2
+2
drivers/scsi/qla4xxx/ql4_fw.h
··· 484 484 #define TCPOPT_DHCP_ENABLE 0x0200 485 485 uint16_t ipv4_ip_opts; /* 34-35 */ 486 486 #define IPOPT_IPV4_PROTOCOL_ENABLE 0x8000 487 + #define IPOPT_VLAN_TAGGING_ENABLE 0x2000 487 488 488 489 uint16_t iscsi_max_pdu_size; /* 36-37 */ 489 490 uint8_t ipv4_tos; /* 38 */ ··· 536 535 uint16_t ipv6_port; /* 204-205 */ 537 536 uint16_t ipv6_opts; /* 206-207 */ 538 537 #define IPV6_OPT_IPV6_PROTOCOL_ENABLE 0x8000 538 + #define IPV6_OPT_VLAN_TAGGING_ENABLE 0x2000 539 539 540 540 uint16_t ipv6_addtl_opts; /* 208-209 */ 541 541 #define IPV6_ADDOPT_NEIGHBOR_DISCOVERY_ADDR_ENABLE 0x0002 /* Pri ACB
+4
drivers/scsi/qla4xxx/ql4_mbx.c
··· 351 351 min(sizeof(ha->ip_config.gateway), 352 352 sizeof(init_fw_cb->ipv4_gw_addr))); 353 353 354 + ha->ip_config.ipv4_vlan_tag = be16_to_cpu(init_fw_cb->ipv4_vlan_tag); 355 + 354 356 if (is_ipv6_enabled(ha)) { 355 357 /* Save IPv6 Address */ 356 358 ha->ip_config.ipv6_link_local_state = ··· 380 378 init_fw_cb->ipv6_dflt_rtr_addr, 381 379 min(sizeof(ha->ip_config.ipv6_default_router_addr), 382 380 sizeof(init_fw_cb->ipv6_dflt_rtr_addr))); 381 + ha->ip_config.ipv6_vlan_tag = 382 + be16_to_cpu(init_fw_cb->ipv6_vlan_tag); 383 383 } 384 384 } 385 385
+55 -2
drivers/scsi/qla4xxx/ql4_os.c
··· 185 185 case ISCSI_NET_PARAM_IPV6_ROUTER: 186 186 case ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG: 187 187 case ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG: 188 + case ISCSI_NET_PARAM_VLAN_ID: 189 + case ISCSI_NET_PARAM_VLAN_PRIORITY: 190 + case ISCSI_NET_PARAM_VLAN_ENABLED: 188 191 return S_IRUGO; 189 192 default: 190 193 return 0; ··· 260 257 (ha->ip_config.ipv6_addl_options & 261 258 IPV6_ADDOPT_AUTOCONFIG_LINK_LOCAL_ADDR) ? 262 259 "auto" : "static"); 260 + break; 261 + case ISCSI_NET_PARAM_VLAN_ID: 262 + if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) 263 + len = sprintf(buf, "%d\n", 264 + (ha->ip_config.ipv4_vlan_tag & 265 + ISCSI_MAX_VLAN_ID)); 266 + else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) 267 + len = sprintf(buf, "%d\n", 268 + (ha->ip_config.ipv6_vlan_tag & 269 + ISCSI_MAX_VLAN_ID)); 270 + break; 271 + case ISCSI_NET_PARAM_VLAN_PRIORITY: 272 + if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) 273 + len = sprintf(buf, "%d\n", 274 + ((ha->ip_config.ipv4_vlan_tag >> 13) & 275 + ISCSI_MAX_VLAN_PRIORITY)); 276 + else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) 277 + len = sprintf(buf, "%d\n", 278 + ((ha->ip_config.ipv6_vlan_tag >> 13) & 279 + ISCSI_MAX_VLAN_PRIORITY)); 280 + break; 281 + case ISCSI_NET_PARAM_VLAN_ENABLED: 282 + if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) 283 + len = sprintf(buf, "%s\n", 284 + (ha->ip_config.ipv4_options & 285 + IPOPT_VLAN_TAGGING_ENABLE) ? 286 + "enabled" : "disabled"); 287 + else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) 288 + len = sprintf(buf, "%s\n", 289 + (ha->ip_config.ipv6_options & 290 + IPV6_OPT_VLAN_TAGGING_ENABLE) ? 291 + "enabled" : "disabled"); 263 292 break; 264 293 default: 265 294 len = -ENOSYS; ··· 514 479 case ISCSI_NET_PARAM_VLAN_ID: 515 480 if (iface_param->len != sizeof(init_fw_cb->ipv6_vlan_tag)) 516 481 break; 517 - init_fw_cb->ipv6_vlan_tag = *(uint16_t *)iface_param->value; 482 + init_fw_cb->ipv6_vlan_tag = 483 + cpu_to_be16(*(uint16_t *)iface_param->value); 484 + break; 485 + case ISCSI_NET_PARAM_VLAN_ENABLED: 486 + if (iface_param->value[0] == ISCSI_VLAN_ENABLE) 487 + init_fw_cb->ipv6_opts |= 488 + cpu_to_le16(IPV6_OPT_VLAN_TAGGING_ENABLE); 489 + else 490 + init_fw_cb->ipv6_opts &= 491 + cpu_to_le16(~IPV6_OPT_VLAN_TAGGING_ENABLE); 518 492 break; 519 493 default: 520 494 ql4_printk(KERN_ERR, ha, "Unknown IPv6 param = %d\n", ··· 574 530 case ISCSI_NET_PARAM_VLAN_ID: 575 531 if (iface_param->len != sizeof(init_fw_cb->ipv4_vlan_tag)) 576 532 break; 577 - init_fw_cb->ipv4_vlan_tag = *(uint16_t *)iface_param->value; 533 + init_fw_cb->ipv4_vlan_tag = 534 + cpu_to_be16(*(uint16_t *)iface_param->value); 535 + break; 536 + case ISCSI_NET_PARAM_VLAN_ENABLED: 537 + if (iface_param->value[0] == ISCSI_VLAN_ENABLE) 538 + init_fw_cb->ipv4_ip_opts |= 539 + cpu_to_le16(IPOPT_VLAN_TAGGING_ENABLE); 540 + else 541 + init_fw_cb->ipv4_ip_opts &= 542 + cpu_to_le16(~IPOPT_VLAN_TAGGING_ENABLE); 578 543 break; 579 544 default: 580 545 ql4_printk(KERN_ERR, ha, "Unknown IPv4 param = %d\n",