diff options
Diffstat (limited to 'drivers/infiniband/ulp/srpt/ib_srpt.c')
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 78 |
1 files changed, 34 insertions, 44 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 47c4022fda76..2e2fe818ca9f 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -43,9 +43,7 @@ | |||
43 | #include <linux/atomic.h> | 43 | #include <linux/atomic.h> |
44 | #include <scsi/scsi_proto.h> | 44 | #include <scsi/scsi_proto.h> |
45 | #include <scsi/scsi_tcq.h> | 45 | #include <scsi/scsi_tcq.h> |
46 | #include <target/configfs_macros.h> | ||
47 | #include <target/target_core_base.h> | 46 | #include <target/target_core_base.h> |
48 | #include <target/target_core_fabric_configfs.h> | ||
49 | #include <target/target_core_fabric.h> | 47 | #include <target/target_core_fabric.h> |
50 | #include "ib_srpt.h" | 48 | #include "ib_srpt.h" |
51 | 49 | ||
@@ -3546,20 +3544,19 @@ static void srpt_cleanup_nodeacl(struct se_node_acl *se_nacl) | |||
3546 | spin_unlock_irq(&sport->port_acl_lock); | 3544 | spin_unlock_irq(&sport->port_acl_lock); |
3547 | } | 3545 | } |
3548 | 3546 | ||
3549 | static ssize_t srpt_tpg_attrib_show_srp_max_rdma_size( | 3547 | static ssize_t srpt_tpg_attrib_srp_max_rdma_size_show(struct config_item *item, |
3550 | struct se_portal_group *se_tpg, | 3548 | char *page) |
3551 | char *page) | ||
3552 | { | 3549 | { |
3550 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3553 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3551 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3554 | 3552 | ||
3555 | return sprintf(page, "%u\n", sport->port_attrib.srp_max_rdma_size); | 3553 | return sprintf(page, "%u\n", sport->port_attrib.srp_max_rdma_size); |
3556 | } | 3554 | } |
3557 | 3555 | ||
3558 | static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size( | 3556 | static ssize_t srpt_tpg_attrib_srp_max_rdma_size_store(struct config_item *item, |
3559 | struct se_portal_group *se_tpg, | 3557 | const char *page, size_t count) |
3560 | const char *page, | ||
3561 | size_t count) | ||
3562 | { | 3558 | { |
3559 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3563 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3560 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3564 | unsigned long val; | 3561 | unsigned long val; |
3565 | int ret; | 3562 | int ret; |
@@ -3584,22 +3581,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size( | |||
3584 | return count; | 3581 | return count; |
3585 | } | 3582 | } |
3586 | 3583 | ||
3587 | TF_TPG_ATTRIB_ATTR(srpt, srp_max_rdma_size, S_IRUGO | S_IWUSR); | 3584 | static ssize_t srpt_tpg_attrib_srp_max_rsp_size_show(struct config_item *item, |
3588 | 3585 | char *page) | |
3589 | static ssize_t srpt_tpg_attrib_show_srp_max_rsp_size( | ||
3590 | struct se_portal_group *se_tpg, | ||
3591 | char *page) | ||
3592 | { | 3586 | { |
3587 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3593 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3588 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3594 | 3589 | ||
3595 | return sprintf(page, "%u\n", sport->port_attrib.srp_max_rsp_size); | 3590 | return sprintf(page, "%u\n", sport->port_attrib.srp_max_rsp_size); |
3596 | } | 3591 | } |
3597 | 3592 | ||
3598 | static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size( | 3593 | static ssize_t srpt_tpg_attrib_srp_max_rsp_size_store(struct config_item *item, |
3599 | struct se_portal_group *se_tpg, | 3594 | const char *page, size_t count) |
3600 | const char *page, | ||
3601 | size_t count) | ||
3602 | { | 3595 | { |
3596 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3603 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3597 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3604 | unsigned long val; | 3598 | unsigned long val; |
3605 | int ret; | 3599 | int ret; |
@@ -3624,22 +3618,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size( | |||
3624 | return count; | 3618 | return count; |
3625 | } | 3619 | } |
3626 | 3620 | ||
3627 | TF_TPG_ATTRIB_ATTR(srpt, srp_max_rsp_size, S_IRUGO | S_IWUSR); | 3621 | static ssize_t srpt_tpg_attrib_srp_sq_size_show(struct config_item *item, |
3628 | 3622 | char *page) | |
3629 | static ssize_t srpt_tpg_attrib_show_srp_sq_size( | ||
3630 | struct se_portal_group *se_tpg, | ||
3631 | char *page) | ||
3632 | { | 3623 | { |
3624 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3633 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3625 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3634 | 3626 | ||
3635 | return sprintf(page, "%u\n", sport->port_attrib.srp_sq_size); | 3627 | return sprintf(page, "%u\n", sport->port_attrib.srp_sq_size); |
3636 | } | 3628 | } |
3637 | 3629 | ||
3638 | static ssize_t srpt_tpg_attrib_store_srp_sq_size( | 3630 | static ssize_t srpt_tpg_attrib_srp_sq_size_store(struct config_item *item, |
3639 | struct se_portal_group *se_tpg, | 3631 | const char *page, size_t count) |
3640 | const char *page, | ||
3641 | size_t count) | ||
3642 | { | 3632 | { |
3633 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3643 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3634 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3644 | unsigned long val; | 3635 | unsigned long val; |
3645 | int ret; | 3636 | int ret; |
@@ -3664,29 +3655,29 @@ static ssize_t srpt_tpg_attrib_store_srp_sq_size( | |||
3664 | return count; | 3655 | return count; |
3665 | } | 3656 | } |
3666 | 3657 | ||
3667 | TF_TPG_ATTRIB_ATTR(srpt, srp_sq_size, S_IRUGO | S_IWUSR); | 3658 | CONFIGFS_ATTR(srpt_tpg_attrib_, srp_max_rdma_size); |
3659 | CONFIGFS_ATTR(srpt_tpg_attrib_, srp_max_rsp_size); | ||
3660 | CONFIGFS_ATTR(srpt_tpg_attrib_, srp_sq_size); | ||
3668 | 3661 | ||
3669 | static struct configfs_attribute *srpt_tpg_attrib_attrs[] = { | 3662 | static struct configfs_attribute *srpt_tpg_attrib_attrs[] = { |
3670 | &srpt_tpg_attrib_srp_max_rdma_size.attr, | 3663 | &srpt_tpg_attrib_attr_srp_max_rdma_size, |
3671 | &srpt_tpg_attrib_srp_max_rsp_size.attr, | 3664 | &srpt_tpg_attrib_attr_srp_max_rsp_size, |
3672 | &srpt_tpg_attrib_srp_sq_size.attr, | 3665 | &srpt_tpg_attrib_attr_srp_sq_size, |
3673 | NULL, | 3666 | NULL, |
3674 | }; | 3667 | }; |
3675 | 3668 | ||
3676 | static ssize_t srpt_tpg_show_enable( | 3669 | static ssize_t srpt_tpg_enable_show(struct config_item *item, char *page) |
3677 | struct se_portal_group *se_tpg, | ||
3678 | char *page) | ||
3679 | { | 3670 | { |
3671 | struct se_portal_group *se_tpg = to_tpg(item); | ||
3680 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3672 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3681 | 3673 | ||
3682 | return snprintf(page, PAGE_SIZE, "%d\n", (sport->enabled) ? 1: 0); | 3674 | return snprintf(page, PAGE_SIZE, "%d\n", (sport->enabled) ? 1: 0); |
3683 | } | 3675 | } |
3684 | 3676 | ||
3685 | static ssize_t srpt_tpg_store_enable( | 3677 | static ssize_t srpt_tpg_enable_store(struct config_item *item, |
3686 | struct se_portal_group *se_tpg, | 3678 | const char *page, size_t count) |
3687 | const char *page, | ||
3688 | size_t count) | ||
3689 | { | 3679 | { |
3680 | struct se_portal_group *se_tpg = to_tpg(item); | ||
3690 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3681 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3691 | unsigned long tmp; | 3682 | unsigned long tmp; |
3692 | int ret; | 3683 | int ret; |
@@ -3709,10 +3700,10 @@ static ssize_t srpt_tpg_store_enable( | |||
3709 | return count; | 3700 | return count; |
3710 | } | 3701 | } |
3711 | 3702 | ||
3712 | TF_TPG_BASE_ATTR(srpt, enable, S_IRUGO | S_IWUSR); | 3703 | CONFIGFS_ATTR(srpt_tpg_, enable); |
3713 | 3704 | ||
3714 | static struct configfs_attribute *srpt_tpg_attrs[] = { | 3705 | static struct configfs_attribute *srpt_tpg_attrs[] = { |
3715 | &srpt_tpg_enable.attr, | 3706 | &srpt_tpg_attr_enable, |
3716 | NULL, | 3707 | NULL, |
3717 | }; | 3708 | }; |
3718 | 3709 | ||
@@ -3782,16 +3773,15 @@ static void srpt_drop_tport(struct se_wwn *wwn) | |||
3782 | pr_debug("drop_tport(%s\n", config_item_name(&sport->port_wwn.wwn_group.cg_item)); | 3773 | pr_debug("drop_tport(%s\n", config_item_name(&sport->port_wwn.wwn_group.cg_item)); |
3783 | } | 3774 | } |
3784 | 3775 | ||
3785 | static ssize_t srpt_wwn_show_attr_version(struct target_fabric_configfs *tf, | 3776 | static ssize_t srpt_wwn_version_show(struct config_item *item, char *buf) |
3786 | char *buf) | ||
3787 | { | 3777 | { |
3788 | return scnprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION); | 3778 | return scnprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION); |
3789 | } | 3779 | } |
3790 | 3780 | ||
3791 | TF_WWN_ATTR_RO(srpt, version); | 3781 | CONFIGFS_ATTR_RO(srpt_wwn_, version); |
3792 | 3782 | ||
3793 | static struct configfs_attribute *srpt_wwn_attrs[] = { | 3783 | static struct configfs_attribute *srpt_wwn_attrs[] = { |
3794 | &srpt_wwn_version.attr, | 3784 | &srpt_wwn_attr_version, |
3795 | NULL, | 3785 | NULL, |
3796 | }; | 3786 | }; |
3797 | 3787 | ||