diff options
author | Harish Zunjarrao <harish.zunjarrao@qlogic.com> | 2013-10-18 09:01:41 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-12-16 13:57:50 -0500 |
commit | 3e0f65b34cc972d462c32769cd85b4eee6949139 (patch) | |
tree | 44429cd4d590dc94a404b89e8178f368f7823806 /drivers/scsi/scsi_transport_iscsi.c | |
parent | b867cda44e78888e9482a3eec822b653715a519e (diff) |
[SCSI] iscsi_transport: Additional parameters for network settings
Added support to display and update additional network parameters
through iscsiadm.
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_iscsi.c')
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 340 |
1 files changed, 337 insertions, 3 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 63a6ca49d4e5..9477f84c83a6 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -305,20 +305,71 @@ show_##type##_##name(struct device *dev, struct device_attribute *attr, \ | |||
305 | iscsi_iface_attr_show(type, name, ISCSI_NET_PARAM, param) \ | 305 | iscsi_iface_attr_show(type, name, ISCSI_NET_PARAM, param) \ |
306 | static ISCSI_IFACE_ATTR(type, name, S_IRUGO, show_##type##_##name, NULL); | 306 | static ISCSI_IFACE_ATTR(type, name, S_IRUGO, show_##type##_##name, NULL); |
307 | 307 | ||
308 | /* generic read only ipvi4 attribute */ | 308 | #define iscsi_iface_attr(type, name, param) \ |
309 | iscsi_iface_attr_show(type, name, ISCSI_IFACE_PARAM, param) \ | ||
310 | static ISCSI_IFACE_ATTR(type, name, S_IRUGO, show_##type##_##name, NULL); | ||
311 | |||
312 | /* generic read only ipv4 attribute */ | ||
309 | iscsi_iface_net_attr(ipv4_iface, ipaddress, ISCSI_NET_PARAM_IPV4_ADDR); | 313 | iscsi_iface_net_attr(ipv4_iface, ipaddress, ISCSI_NET_PARAM_IPV4_ADDR); |
310 | iscsi_iface_net_attr(ipv4_iface, gateway, ISCSI_NET_PARAM_IPV4_GW); | 314 | iscsi_iface_net_attr(ipv4_iface, gateway, ISCSI_NET_PARAM_IPV4_GW); |
311 | iscsi_iface_net_attr(ipv4_iface, subnet, ISCSI_NET_PARAM_IPV4_SUBNET); | 315 | iscsi_iface_net_attr(ipv4_iface, subnet, ISCSI_NET_PARAM_IPV4_SUBNET); |
312 | iscsi_iface_net_attr(ipv4_iface, bootproto, ISCSI_NET_PARAM_IPV4_BOOTPROTO); | 316 | iscsi_iface_net_attr(ipv4_iface, bootproto, ISCSI_NET_PARAM_IPV4_BOOTPROTO); |
317 | iscsi_iface_net_attr(ipv4_iface, dhcp_dns_address_en, | ||
318 | ISCSI_NET_PARAM_IPV4_DHCP_DNS_ADDR_EN); | ||
319 | iscsi_iface_net_attr(ipv4_iface, dhcp_slp_da_info_en, | ||
320 | ISCSI_NET_PARAM_IPV4_DHCP_SLP_DA_EN); | ||
321 | iscsi_iface_net_attr(ipv4_iface, tos_en, ISCSI_NET_PARAM_IPV4_TOS_EN); | ||
322 | iscsi_iface_net_attr(ipv4_iface, tos, ISCSI_NET_PARAM_IPV4_TOS); | ||
323 | iscsi_iface_net_attr(ipv4_iface, grat_arp_en, | ||
324 | ISCSI_NET_PARAM_IPV4_GRAT_ARP_EN); | ||
325 | iscsi_iface_net_attr(ipv4_iface, dhcp_alt_client_id_en, | ||
326 | ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID_EN); | ||
327 | iscsi_iface_net_attr(ipv4_iface, dhcp_alt_client_id, | ||
328 | ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID); | ||
329 | iscsi_iface_net_attr(ipv4_iface, dhcp_req_vendor_id_en, | ||
330 | ISCSI_NET_PARAM_IPV4_DHCP_REQ_VENDOR_ID_EN); | ||
331 | iscsi_iface_net_attr(ipv4_iface, dhcp_use_vendor_id_en, | ||
332 | ISCSI_NET_PARAM_IPV4_DHCP_USE_VENDOR_ID_EN); | ||
333 | iscsi_iface_net_attr(ipv4_iface, dhcp_vendor_id, | ||
334 | ISCSI_NET_PARAM_IPV4_DHCP_VENDOR_ID); | ||
335 | iscsi_iface_net_attr(ipv4_iface, dhcp_learn_iqn_en, | ||
336 | ISCSI_NET_PARAM_IPV4_DHCP_LEARN_IQN_EN); | ||
337 | iscsi_iface_net_attr(ipv4_iface, fragment_disable, | ||
338 | ISCSI_NET_PARAM_IPV4_FRAGMENT_DISABLE); | ||
339 | iscsi_iface_net_attr(ipv4_iface, incoming_forwarding_en, | ||
340 | ISCSI_NET_PARAM_IPV4_IN_FORWARD_EN); | ||
341 | iscsi_iface_net_attr(ipv4_iface, ttl, ISCSI_NET_PARAM_IPV4_TTL); | ||
313 | 342 | ||
314 | /* generic read only ipv6 attribute */ | 343 | /* generic read only ipv6 attribute */ |
315 | iscsi_iface_net_attr(ipv6_iface, ipaddress, ISCSI_NET_PARAM_IPV6_ADDR); | 344 | iscsi_iface_net_attr(ipv6_iface, ipaddress, ISCSI_NET_PARAM_IPV6_ADDR); |
316 | iscsi_iface_net_attr(ipv6_iface, link_local_addr, ISCSI_NET_PARAM_IPV6_LINKLOCAL); | 345 | iscsi_iface_net_attr(ipv6_iface, link_local_addr, |
346 | ISCSI_NET_PARAM_IPV6_LINKLOCAL); | ||
317 | iscsi_iface_net_attr(ipv6_iface, router_addr, ISCSI_NET_PARAM_IPV6_ROUTER); | 347 | iscsi_iface_net_attr(ipv6_iface, router_addr, ISCSI_NET_PARAM_IPV6_ROUTER); |
318 | iscsi_iface_net_attr(ipv6_iface, ipaddr_autocfg, | 348 | iscsi_iface_net_attr(ipv6_iface, ipaddr_autocfg, |
319 | ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG); | 349 | ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG); |
320 | iscsi_iface_net_attr(ipv6_iface, link_local_autocfg, | 350 | iscsi_iface_net_attr(ipv6_iface, link_local_autocfg, |
321 | ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG); | 351 | ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG); |
352 | iscsi_iface_net_attr(ipv6_iface, link_local_state, | ||
353 | ISCSI_NET_PARAM_IPV6_LINKLOCAL_STATE); | ||
354 | iscsi_iface_net_attr(ipv6_iface, router_state, | ||
355 | ISCSI_NET_PARAM_IPV6_ROUTER_STATE); | ||
356 | iscsi_iface_net_attr(ipv6_iface, grat_neighbor_adv_en, | ||
357 | ISCSI_NET_PARAM_IPV6_GRAT_NEIGHBOR_ADV_EN); | ||
358 | iscsi_iface_net_attr(ipv6_iface, mld_en, ISCSI_NET_PARAM_IPV6_MLD_EN); | ||
359 | iscsi_iface_net_attr(ipv6_iface, flow_label, ISCSI_NET_PARAM_IPV6_FLOW_LABEL); | ||
360 | iscsi_iface_net_attr(ipv6_iface, traffic_class, | ||
361 | ISCSI_NET_PARAM_IPV6_TRAFFIC_CLASS); | ||
362 | iscsi_iface_net_attr(ipv6_iface, hop_limit, ISCSI_NET_PARAM_IPV6_HOP_LIMIT); | ||
363 | iscsi_iface_net_attr(ipv6_iface, nd_reachable_tmo, | ||
364 | ISCSI_NET_PARAM_IPV6_ND_REACHABLE_TMO); | ||
365 | iscsi_iface_net_attr(ipv6_iface, nd_rexmit_time, | ||
366 | ISCSI_NET_PARAM_IPV6_ND_REXMIT_TIME); | ||
367 | iscsi_iface_net_attr(ipv6_iface, nd_stale_tmo, | ||
368 | ISCSI_NET_PARAM_IPV6_ND_STALE_TMO); | ||
369 | iscsi_iface_net_attr(ipv6_iface, dup_addr_detect_cnt, | ||
370 | ISCSI_NET_PARAM_IPV6_DUP_ADDR_DETECT_CNT); | ||
371 | iscsi_iface_net_attr(ipv6_iface, router_adv_link_mtu, | ||
372 | ISCSI_NET_PARAM_IPV6_RTR_ADV_LINK_MTU); | ||
322 | 373 | ||
323 | /* common read only iface attribute */ | 374 | /* common read only iface attribute */ |
324 | iscsi_iface_net_attr(iface, enabled, ISCSI_NET_PARAM_IFACE_ENABLE); | 375 | iscsi_iface_net_attr(iface, enabled, ISCSI_NET_PARAM_IFACE_ENABLE); |
@@ -327,6 +378,40 @@ iscsi_iface_net_attr(iface, vlan_priority, ISCSI_NET_PARAM_VLAN_PRIORITY); | |||
327 | iscsi_iface_net_attr(iface, vlan_enabled, ISCSI_NET_PARAM_VLAN_ENABLED); | 378 | iscsi_iface_net_attr(iface, vlan_enabled, ISCSI_NET_PARAM_VLAN_ENABLED); |
328 | iscsi_iface_net_attr(iface, mtu, ISCSI_NET_PARAM_MTU); | 379 | iscsi_iface_net_attr(iface, mtu, ISCSI_NET_PARAM_MTU); |
329 | iscsi_iface_net_attr(iface, port, ISCSI_NET_PARAM_PORT); | 380 | iscsi_iface_net_attr(iface, port, ISCSI_NET_PARAM_PORT); |
381 | iscsi_iface_net_attr(iface, ipaddress_state, ISCSI_NET_PARAM_IPADDR_STATE); | ||
382 | iscsi_iface_net_attr(iface, delayed_ack_en, ISCSI_NET_PARAM_DELAYED_ACK_EN); | ||
383 | iscsi_iface_net_attr(iface, tcp_nagle_disable, | ||
384 | ISCSI_NET_PARAM_TCP_NAGLE_DISABLE); | ||
385 | iscsi_iface_net_attr(iface, tcp_wsf_disable, ISCSI_NET_PARAM_TCP_WSF_DISABLE); | ||
386 | iscsi_iface_net_attr(iface, tcp_wsf, ISCSI_NET_PARAM_TCP_WSF); | ||
387 | iscsi_iface_net_attr(iface, tcp_timer_scale, ISCSI_NET_PARAM_TCP_TIMER_SCALE); | ||
388 | iscsi_iface_net_attr(iface, tcp_timestamp_en, ISCSI_NET_PARAM_TCP_TIMESTAMP_EN); | ||
389 | iscsi_iface_net_attr(iface, cache_id, ISCSI_NET_PARAM_CACHE_ID); | ||
390 | iscsi_iface_net_attr(iface, redirect_en, ISCSI_NET_PARAM_REDIRECT_EN); | ||
391 | |||
392 | /* common iscsi specific settings attributes */ | ||
393 | iscsi_iface_attr(iface, def_taskmgmt_tmo, ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO); | ||
394 | iscsi_iface_attr(iface, header_digest, ISCSI_IFACE_PARAM_HDRDGST_EN); | ||
395 | iscsi_iface_attr(iface, data_digest, ISCSI_IFACE_PARAM_DATADGST_EN); | ||
396 | iscsi_iface_attr(iface, immediate_data, ISCSI_IFACE_PARAM_IMM_DATA_EN); | ||
397 | iscsi_iface_attr(iface, initial_r2t, ISCSI_IFACE_PARAM_INITIAL_R2T_EN); | ||
398 | iscsi_iface_attr(iface, data_seq_in_order, | ||
399 | ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN); | ||
400 | iscsi_iface_attr(iface, data_pdu_in_order, ISCSI_IFACE_PARAM_PDU_INORDER_EN); | ||
401 | iscsi_iface_attr(iface, erl, ISCSI_IFACE_PARAM_ERL); | ||
402 | iscsi_iface_attr(iface, max_recv_dlength, ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH); | ||
403 | iscsi_iface_attr(iface, first_burst_len, ISCSI_IFACE_PARAM_FIRST_BURST); | ||
404 | iscsi_iface_attr(iface, max_outstanding_r2t, ISCSI_IFACE_PARAM_MAX_R2T); | ||
405 | iscsi_iface_attr(iface, max_burst_len, ISCSI_IFACE_PARAM_MAX_BURST); | ||
406 | iscsi_iface_attr(iface, chap_auth, ISCSI_IFACE_PARAM_CHAP_AUTH_EN); | ||
407 | iscsi_iface_attr(iface, bidi_chap, ISCSI_IFACE_PARAM_BIDI_CHAP_EN); | ||
408 | iscsi_iface_attr(iface, discovery_auth_optional, | ||
409 | ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL); | ||
410 | iscsi_iface_attr(iface, discovery_logout, | ||
411 | ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN); | ||
412 | iscsi_iface_attr(iface, strict_login_comp_en, | ||
413 | ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN); | ||
414 | iscsi_iface_attr(iface, initiator_name, ISCSI_IFACE_PARAM_INITIATOR_NAME); | ||
330 | 415 | ||
331 | static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, | 416 | static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, |
332 | struct attribute *attr, int i) | 417 | struct attribute *attr, int i) |
@@ -335,6 +420,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, | |||
335 | struct iscsi_iface *iface = iscsi_dev_to_iface(dev); | 420 | struct iscsi_iface *iface = iscsi_dev_to_iface(dev); |
336 | struct iscsi_transport *t = iface->transport; | 421 | struct iscsi_transport *t = iface->transport; |
337 | int param; | 422 | int param; |
423 | int param_type; | ||
338 | 424 | ||
339 | if (attr == &dev_attr_iface_enabled.attr) | 425 | if (attr == &dev_attr_iface_enabled.attr) |
340 | param = ISCSI_NET_PARAM_IFACE_ENABLE; | 426 | param = ISCSI_NET_PARAM_IFACE_ENABLE; |
@@ -348,6 +434,60 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, | |||
348 | param = ISCSI_NET_PARAM_MTU; | 434 | param = ISCSI_NET_PARAM_MTU; |
349 | else if (attr == &dev_attr_iface_port.attr) | 435 | else if (attr == &dev_attr_iface_port.attr) |
350 | param = ISCSI_NET_PARAM_PORT; | 436 | param = ISCSI_NET_PARAM_PORT; |
437 | else if (attr == &dev_attr_iface_ipaddress_state.attr) | ||
438 | param = ISCSI_NET_PARAM_IPADDR_STATE; | ||
439 | else if (attr == &dev_attr_iface_delayed_ack_en.attr) | ||
440 | param = ISCSI_NET_PARAM_DELAYED_ACK_EN; | ||
441 | else if (attr == &dev_attr_iface_tcp_nagle_disable.attr) | ||
442 | param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE; | ||
443 | else if (attr == &dev_attr_iface_tcp_wsf_disable.attr) | ||
444 | param = ISCSI_NET_PARAM_TCP_WSF_DISABLE; | ||
445 | else if (attr == &dev_attr_iface_tcp_wsf.attr) | ||
446 | param = ISCSI_NET_PARAM_TCP_WSF; | ||
447 | else if (attr == &dev_attr_iface_tcp_timer_scale.attr) | ||
448 | param = ISCSI_NET_PARAM_TCP_TIMER_SCALE; | ||
449 | else if (attr == &dev_attr_iface_tcp_timestamp_en.attr) | ||
450 | param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN; | ||
451 | else if (attr == &dev_attr_iface_cache_id.attr) | ||
452 | param = ISCSI_NET_PARAM_CACHE_ID; | ||
453 | else if (attr == &dev_attr_iface_redirect_en.attr) | ||
454 | param = ISCSI_NET_PARAM_REDIRECT_EN; | ||
455 | else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) | ||
456 | param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO; | ||
457 | else if (attr == &dev_attr_iface_header_digest.attr) | ||
458 | param = ISCSI_IFACE_PARAM_HDRDGST_EN; | ||
459 | else if (attr == &dev_attr_iface_data_digest.attr) | ||
460 | param = ISCSI_IFACE_PARAM_DATADGST_EN; | ||
461 | else if (attr == &dev_attr_iface_immediate_data.attr) | ||
462 | param = ISCSI_IFACE_PARAM_IMM_DATA_EN; | ||
463 | else if (attr == &dev_attr_iface_initial_r2t.attr) | ||
464 | param = ISCSI_IFACE_PARAM_INITIAL_R2T_EN; | ||
465 | else if (attr == &dev_attr_iface_data_seq_in_order.attr) | ||
466 | param = ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN; | ||
467 | else if (attr == &dev_attr_iface_data_pdu_in_order.attr) | ||
468 | param = ISCSI_IFACE_PARAM_PDU_INORDER_EN; | ||
469 | else if (attr == &dev_attr_iface_erl.attr) | ||
470 | param = ISCSI_IFACE_PARAM_ERL; | ||
471 | else if (attr == &dev_attr_iface_max_recv_dlength.attr) | ||
472 | param = ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH; | ||
473 | else if (attr == &dev_attr_iface_first_burst_len.attr) | ||
474 | param = ISCSI_IFACE_PARAM_FIRST_BURST; | ||
475 | else if (attr == &dev_attr_iface_max_outstanding_r2t.attr) | ||
476 | param = ISCSI_IFACE_PARAM_MAX_R2T; | ||
477 | else if (attr == &dev_attr_iface_max_burst_len.attr) | ||
478 | param = ISCSI_IFACE_PARAM_MAX_BURST; | ||
479 | else if (attr == &dev_attr_iface_chap_auth.attr) | ||
480 | param = ISCSI_IFACE_PARAM_CHAP_AUTH_EN; | ||
481 | else if (attr == &dev_attr_iface_bidi_chap.attr) | ||
482 | param = ISCSI_IFACE_PARAM_BIDI_CHAP_EN; | ||
483 | else if (attr == &dev_attr_iface_discovery_auth_optional.attr) | ||
484 | param = ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL; | ||
485 | else if (attr == &dev_attr_iface_discovery_logout.attr) | ||
486 | param = ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN; | ||
487 | else if (attr == &dev_attr_iface_strict_login_comp_en.attr) | ||
488 | param = ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN; | ||
489 | else if (attr == &dev_attr_iface_initiator_name.attr) | ||
490 | param = ISCSI_IFACE_PARAM_INITIATOR_NAME; | ||
351 | else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { | 491 | else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { |
352 | if (attr == &dev_attr_ipv4_iface_ipaddress.attr) | 492 | if (attr == &dev_attr_ipv4_iface_ipaddress.attr) |
353 | param = ISCSI_NET_PARAM_IPV4_ADDR; | 493 | param = ISCSI_NET_PARAM_IPV4_ADDR; |
@@ -357,6 +497,42 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, | |||
357 | param = ISCSI_NET_PARAM_IPV4_SUBNET; | 497 | param = ISCSI_NET_PARAM_IPV4_SUBNET; |
358 | else if (attr == &dev_attr_ipv4_iface_bootproto.attr) | 498 | else if (attr == &dev_attr_ipv4_iface_bootproto.attr) |
359 | param = ISCSI_NET_PARAM_IPV4_BOOTPROTO; | 499 | param = ISCSI_NET_PARAM_IPV4_BOOTPROTO; |
500 | else if (attr == | ||
501 | &dev_attr_ipv4_iface_dhcp_dns_address_en.attr) | ||
502 | param = ISCSI_NET_PARAM_IPV4_DHCP_DNS_ADDR_EN; | ||
503 | else if (attr == | ||
504 | &dev_attr_ipv4_iface_dhcp_slp_da_info_en.attr) | ||
505 | param = ISCSI_NET_PARAM_IPV4_DHCP_SLP_DA_EN; | ||
506 | else if (attr == &dev_attr_ipv4_iface_tos_en.attr) | ||
507 | param = ISCSI_NET_PARAM_IPV4_TOS_EN; | ||
508 | else if (attr == &dev_attr_ipv4_iface_tos.attr) | ||
509 | param = ISCSI_NET_PARAM_IPV4_TOS; | ||
510 | else if (attr == &dev_attr_ipv4_iface_grat_arp_en.attr) | ||
511 | param = ISCSI_NET_PARAM_IPV4_GRAT_ARP_EN; | ||
512 | else if (attr == | ||
513 | &dev_attr_ipv4_iface_dhcp_alt_client_id_en.attr) | ||
514 | param = ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID_EN; | ||
515 | else if (attr == &dev_attr_ipv4_iface_dhcp_alt_client_id.attr) | ||
516 | param = ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID; | ||
517 | else if (attr == | ||
518 | &dev_attr_ipv4_iface_dhcp_req_vendor_id_en.attr) | ||
519 | param = ISCSI_NET_PARAM_IPV4_DHCP_REQ_VENDOR_ID_EN; | ||
520 | else if (attr == | ||
521 | &dev_attr_ipv4_iface_dhcp_use_vendor_id_en.attr) | ||
522 | param = ISCSI_NET_PARAM_IPV4_DHCP_USE_VENDOR_ID_EN; | ||
523 | else if (attr == &dev_attr_ipv4_iface_dhcp_vendor_id.attr) | ||
524 | param = ISCSI_NET_PARAM_IPV4_DHCP_VENDOR_ID; | ||
525 | else if (attr == | ||
526 | &dev_attr_ipv4_iface_dhcp_learn_iqn_en.attr) | ||
527 | param = ISCSI_NET_PARAM_IPV4_DHCP_LEARN_IQN_EN; | ||
528 | else if (attr == | ||
529 | &dev_attr_ipv4_iface_fragment_disable.attr) | ||
530 | param = ISCSI_NET_PARAM_IPV4_FRAGMENT_DISABLE; | ||
531 | else if (attr == | ||
532 | &dev_attr_ipv4_iface_incoming_forwarding_en.attr) | ||
533 | param = ISCSI_NET_PARAM_IPV4_IN_FORWARD_EN; | ||
534 | else if (attr == &dev_attr_ipv4_iface_ttl.attr) | ||
535 | param = ISCSI_NET_PARAM_IPV4_TTL; | ||
360 | else | 536 | else |
361 | return 0; | 537 | return 0; |
362 | } else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) { | 538 | } else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) { |
@@ -370,6 +546,31 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, | |||
370 | param = ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG; | 546 | param = ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG; |
371 | else if (attr == &dev_attr_ipv6_iface_link_local_autocfg.attr) | 547 | else if (attr == &dev_attr_ipv6_iface_link_local_autocfg.attr) |
372 | param = ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG; | 548 | param = ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG; |
549 | else if (attr == &dev_attr_ipv6_iface_link_local_state.attr) | ||
550 | param = ISCSI_NET_PARAM_IPV6_LINKLOCAL_STATE; | ||
551 | else if (attr == &dev_attr_ipv6_iface_router_state.attr) | ||
552 | param = ISCSI_NET_PARAM_IPV6_ROUTER_STATE; | ||
553 | else if (attr == | ||
554 | &dev_attr_ipv6_iface_grat_neighbor_adv_en.attr) | ||
555 | param = ISCSI_NET_PARAM_IPV6_GRAT_NEIGHBOR_ADV_EN; | ||
556 | else if (attr == &dev_attr_ipv6_iface_mld_en.attr) | ||
557 | param = ISCSI_NET_PARAM_IPV6_MLD_EN; | ||
558 | else if (attr == &dev_attr_ipv6_iface_flow_label.attr) | ||
559 | param = ISCSI_NET_PARAM_IPV6_FLOW_LABEL; | ||
560 | else if (attr == &dev_attr_ipv6_iface_traffic_class.attr) | ||
561 | param = ISCSI_NET_PARAM_IPV6_TRAFFIC_CLASS; | ||
562 | else if (attr == &dev_attr_ipv6_iface_hop_limit.attr) | ||
563 | param = ISCSI_NET_PARAM_IPV6_HOP_LIMIT; | ||
564 | else if (attr == &dev_attr_ipv6_iface_nd_reachable_tmo.attr) | ||
565 | param = ISCSI_NET_PARAM_IPV6_ND_REACHABLE_TMO; | ||
566 | else if (attr == &dev_attr_ipv6_iface_nd_rexmit_time.attr) | ||
567 | param = ISCSI_NET_PARAM_IPV6_ND_REXMIT_TIME; | ||
568 | else if (attr == &dev_attr_ipv6_iface_nd_stale_tmo.attr) | ||
569 | param = ISCSI_NET_PARAM_IPV6_ND_STALE_TMO; | ||
570 | else if (attr == &dev_attr_ipv6_iface_dup_addr_detect_cnt.attr) | ||
571 | param = ISCSI_NET_PARAM_IPV6_DUP_ADDR_DETECT_CNT; | ||
572 | else if (attr == &dev_attr_ipv6_iface_router_adv_link_mtu.attr) | ||
573 | param = ISCSI_NET_PARAM_IPV6_RTR_ADV_LINK_MTU; | ||
373 | else | 574 | else |
374 | return 0; | 575 | return 0; |
375 | } else { | 576 | } else { |
@@ -377,7 +578,32 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, | |||
377 | return 0; | 578 | return 0; |
378 | } | 579 | } |
379 | 580 | ||
380 | return t->attr_is_visible(ISCSI_NET_PARAM, param); | 581 | switch (param) { |
582 | case ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO: | ||
583 | case ISCSI_IFACE_PARAM_HDRDGST_EN: | ||
584 | case ISCSI_IFACE_PARAM_DATADGST_EN: | ||
585 | case ISCSI_IFACE_PARAM_IMM_DATA_EN: | ||
586 | case ISCSI_IFACE_PARAM_INITIAL_R2T_EN: | ||
587 | case ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN: | ||
588 | case ISCSI_IFACE_PARAM_PDU_INORDER_EN: | ||
589 | case ISCSI_IFACE_PARAM_ERL: | ||
590 | case ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH: | ||
591 | case ISCSI_IFACE_PARAM_FIRST_BURST: | ||
592 | case ISCSI_IFACE_PARAM_MAX_R2T: | ||
593 | case ISCSI_IFACE_PARAM_MAX_BURST: | ||
594 | case ISCSI_IFACE_PARAM_CHAP_AUTH_EN: | ||
595 | case ISCSI_IFACE_PARAM_BIDI_CHAP_EN: | ||
596 | case ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL: | ||
597 | case ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN: | ||
598 | case ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN: | ||
599 | case ISCSI_IFACE_PARAM_INITIATOR_NAME: | ||
600 | param_type = ISCSI_IFACE_PARAM; | ||
601 | break; | ||
602 | default: | ||
603 | param_type = ISCSI_NET_PARAM; | ||
604 | } | ||
605 | |||
606 | return t->attr_is_visible(param_type, param); | ||
381 | } | 607 | } |
382 | 608 | ||
383 | static struct attribute *iscsi_iface_attrs[] = { | 609 | static struct attribute *iscsi_iface_attrs[] = { |
@@ -396,6 +622,59 @@ static struct attribute *iscsi_iface_attrs[] = { | |||
396 | &dev_attr_ipv6_iface_link_local_autocfg.attr, | 622 | &dev_attr_ipv6_iface_link_local_autocfg.attr, |
397 | &dev_attr_iface_mtu.attr, | 623 | &dev_attr_iface_mtu.attr, |
398 | &dev_attr_iface_port.attr, | 624 | &dev_attr_iface_port.attr, |
625 | &dev_attr_iface_ipaddress_state.attr, | ||
626 | &dev_attr_iface_delayed_ack_en.attr, | ||
627 | &dev_attr_iface_tcp_nagle_disable.attr, | ||
628 | &dev_attr_iface_tcp_wsf_disable.attr, | ||
629 | &dev_attr_iface_tcp_wsf.attr, | ||
630 | &dev_attr_iface_tcp_timer_scale.attr, | ||
631 | &dev_attr_iface_tcp_timestamp_en.attr, | ||
632 | &dev_attr_iface_cache_id.attr, | ||
633 | &dev_attr_iface_redirect_en.attr, | ||
634 | &dev_attr_iface_def_taskmgmt_tmo.attr, | ||
635 | &dev_attr_iface_header_digest.attr, | ||
636 | &dev_attr_iface_data_digest.attr, | ||
637 | &dev_attr_iface_immediate_data.attr, | ||
638 | &dev_attr_iface_initial_r2t.attr, | ||
639 | &dev_attr_iface_data_seq_in_order.attr, | ||
640 | &dev_attr_iface_data_pdu_in_order.attr, | ||
641 | &dev_attr_iface_erl.attr, | ||
642 | &dev_attr_iface_max_recv_dlength.attr, | ||
643 | &dev_attr_iface_first_burst_len.attr, | ||
644 | &dev_attr_iface_max_outstanding_r2t.attr, | ||
645 | &dev_attr_iface_max_burst_len.attr, | ||
646 | &dev_attr_iface_chap_auth.attr, | ||
647 | &dev_attr_iface_bidi_chap.attr, | ||
648 | &dev_attr_iface_discovery_auth_optional.attr, | ||
649 | &dev_attr_iface_discovery_logout.attr, | ||
650 | &dev_attr_iface_strict_login_comp_en.attr, | ||
651 | &dev_attr_iface_initiator_name.attr, | ||
652 | &dev_attr_ipv4_iface_dhcp_dns_address_en.attr, | ||
653 | &dev_attr_ipv4_iface_dhcp_slp_da_info_en.attr, | ||
654 | &dev_attr_ipv4_iface_tos_en.attr, | ||
655 | &dev_attr_ipv4_iface_tos.attr, | ||
656 | &dev_attr_ipv4_iface_grat_arp_en.attr, | ||
657 | &dev_attr_ipv4_iface_dhcp_alt_client_id_en.attr, | ||
658 | &dev_attr_ipv4_iface_dhcp_alt_client_id.attr, | ||
659 | &dev_attr_ipv4_iface_dhcp_req_vendor_id_en.attr, | ||
660 | &dev_attr_ipv4_iface_dhcp_use_vendor_id_en.attr, | ||
661 | &dev_attr_ipv4_iface_dhcp_vendor_id.attr, | ||
662 | &dev_attr_ipv4_iface_dhcp_learn_iqn_en.attr, | ||
663 | &dev_attr_ipv4_iface_fragment_disable.attr, | ||
664 | &dev_attr_ipv4_iface_incoming_forwarding_en.attr, | ||
665 | &dev_attr_ipv4_iface_ttl.attr, | ||
666 | &dev_attr_ipv6_iface_link_local_state.attr, | ||
667 | &dev_attr_ipv6_iface_router_state.attr, | ||
668 | &dev_attr_ipv6_iface_grat_neighbor_adv_en.attr, | ||
669 | &dev_attr_ipv6_iface_mld_en.attr, | ||
670 | &dev_attr_ipv6_iface_flow_label.attr, | ||
671 | &dev_attr_ipv6_iface_traffic_class.attr, | ||
672 | &dev_attr_ipv6_iface_hop_limit.attr, | ||
673 | &dev_attr_ipv6_iface_nd_reachable_tmo.attr, | ||
674 | &dev_attr_ipv6_iface_nd_rexmit_time.attr, | ||
675 | &dev_attr_ipv6_iface_nd_stale_tmo.attr, | ||
676 | &dev_attr_ipv6_iface_dup_addr_detect_cnt.attr, | ||
677 | &dev_attr_ipv6_iface_router_adv_link_mtu.attr, | ||
399 | NULL, | 678 | NULL, |
400 | }; | 679 | }; |
401 | 680 | ||
@@ -404,6 +683,61 @@ static struct attribute_group iscsi_iface_group = { | |||
404 | .is_visible = iscsi_iface_attr_is_visible, | 683 | .is_visible = iscsi_iface_attr_is_visible, |
405 | }; | 684 | }; |
406 | 685 | ||
686 | /* convert iscsi_ipaddress_state values to ascii string name */ | ||
687 | static const struct { | ||
688 | enum iscsi_ipaddress_state value; | ||
689 | char *name; | ||
690 | } iscsi_ipaddress_state_names[] = { | ||
691 | {ISCSI_IPDDRESS_STATE_UNCONFIGURED, "Unconfigured" }, | ||
692 | {ISCSI_IPDDRESS_STATE_ACQUIRING, "Acquiring" }, | ||
693 | {ISCSI_IPDDRESS_STATE_TENTATIVE, "Tentative" }, | ||
694 | {ISCSI_IPDDRESS_STATE_VALID, "Valid" }, | ||
695 | {ISCSI_IPDDRESS_STATE_DISABLING, "Disabling" }, | ||
696 | {ISCSI_IPDDRESS_STATE_INVALID, "Invalid" }, | ||
697 | {ISCSI_IPDDRESS_STATE_DEPRECATED, "Deprecated" }, | ||
698 | }; | ||
699 | |||
700 | char *iscsi_get_ipaddress_state_name(enum iscsi_ipaddress_state port_state) | ||
701 | { | ||
702 | int i; | ||
703 | char *state = NULL; | ||
704 | |||
705 | for (i = 0; i < ARRAY_SIZE(iscsi_ipaddress_state_names); i++) { | ||
706 | if (iscsi_ipaddress_state_names[i].value == port_state) { | ||
707 | state = iscsi_ipaddress_state_names[i].name; | ||
708 | break; | ||
709 | } | ||
710 | } | ||
711 | return state; | ||
712 | } | ||
713 | EXPORT_SYMBOL_GPL(iscsi_get_ipaddress_state_name); | ||
714 | |||
715 | /* convert iscsi_router_state values to ascii string name */ | ||
716 | static const struct { | ||
717 | enum iscsi_router_state value; | ||
718 | char *name; | ||
719 | } iscsi_router_state_names[] = { | ||
720 | {ISCSI_ROUTER_STATE_UNKNOWN, "Unknown" }, | ||
721 | {ISCSI_ROUTER_STATE_ADVERTISED, "Advertised" }, | ||
722 | {ISCSI_ROUTER_STATE_MANUAL, "Manual" }, | ||
723 | {ISCSI_ROUTER_STATE_STALE, "Stale" }, | ||
724 | }; | ||
725 | |||
726 | char *iscsi_get_router_state_name(enum iscsi_router_state router_state) | ||
727 | { | ||
728 | int i; | ||
729 | char *state = NULL; | ||
730 | |||
731 | for (i = 0; i < ARRAY_SIZE(iscsi_router_state_names); i++) { | ||
732 | if (iscsi_router_state_names[i].value == router_state) { | ||
733 | state = iscsi_router_state_names[i].name; | ||
734 | break; | ||
735 | } | ||
736 | } | ||
737 | return state; | ||
738 | } | ||
739 | EXPORT_SYMBOL_GPL(iscsi_get_router_state_name); | ||
740 | |||
407 | struct iscsi_iface * | 741 | struct iscsi_iface * |
408 | iscsi_create_iface(struct Scsi_Host *shost, struct iscsi_transport *transport, | 742 | iscsi_create_iface(struct Scsi_Host *shost, struct iscsi_transport *transport, |
409 | uint32_t iface_type, uint32_t iface_num, int dd_size) | 743 | uint32_t iface_type, uint32_t iface_num, int dd_size) |