From e09b41010ba33a20a87472ee821fa407a5b8da36 Mon Sep 17 00:00:00 2001 From: José Pekkarinen Date: Mon, 11 Apr 2016 10:41:07 +0300 Subject: These changes are the raw update to linux-4.4.6-rt14. Kernel sources are taken from kernel.org, and rt patch from the rt wiki download page. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During the rebasing, the following patch collided: Force tick interrupt and get rid of softirq magic(I70131fb85). Collisions have been removed because its logic was found on the source already. Change-Id: I7f57a4081d9deaa0d9ccfc41a6c8daccdee3b769 Signed-off-by: José Pekkarinen --- kernel/drivers/target/tcm_fc/tcm_fc.h | 3 +- kernel/drivers/target/tcm_fc/tfc_cmd.c | 18 +--- kernel/drivers/target/tcm_fc/tfc_conf.c | 160 +++++++------------------------- kernel/drivers/target/tcm_fc/tfc_io.c | 6 -- kernel/drivers/target/tcm_fc/tfc_sess.c | 6 -- 5 files changed, 39 insertions(+), 154 deletions(-) (limited to 'kernel/drivers/target/tcm_fc') diff --git a/kernel/drivers/target/tcm_fc/tcm_fc.h b/kernel/drivers/target/tcm_fc/tcm_fc.h index 881deb3d4..39909dade 100644 --- a/kernel/drivers/target/tcm_fc/tcm_fc.h +++ b/kernel/drivers/target/tcm_fc/tcm_fc.h @@ -80,8 +80,8 @@ struct ft_node_auth { * Node ACL for FC remote port session. */ struct ft_node_acl { - struct ft_node_auth node_auth; struct se_node_acl se_node_acl; + struct ft_node_auth node_auth; }; struct ft_lun { @@ -157,7 +157,6 @@ int ft_queue_status(struct se_cmd *); int ft_queue_data_in(struct se_cmd *); int ft_write_pending(struct se_cmd *); int ft_write_pending_status(struct se_cmd *); -u32 ft_get_task_tag(struct se_cmd *); int ft_get_cmd_state(struct se_cmd *); void ft_queue_tm_resp(struct se_cmd *); void ft_aborted_task(struct se_cmd *); diff --git a/kernel/drivers/target/tcm_fc/tfc_cmd.c b/kernel/drivers/target/tcm_fc/tfc_cmd.c index edcafa449..064d6dfb5 100644 --- a/kernel/drivers/target/tcm_fc/tfc_cmd.c +++ b/kernel/drivers/target/tcm_fc/tfc_cmd.c @@ -30,18 +30,12 @@ #include #include #include -#include -#include -#include -#include #include #include #include #include #include -#include -#include #include "tcm_fc.h" @@ -247,15 +241,6 @@ int ft_write_pending(struct se_cmd *se_cmd) return 0; } -u32 ft_get_task_tag(struct se_cmd *se_cmd) -{ - struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); - - if (cmd->aborted) - return ~0; - return fc_seq_exch(cmd->seq)->rxid; -} - int ft_get_cmd_state(struct se_cmd *se_cmd) { return 0; @@ -269,7 +254,7 @@ static void ft_recv_seq(struct fc_seq *sp, struct fc_frame *fp, void *arg) struct ft_cmd *cmd = arg; struct fc_frame_header *fh; - if (unlikely(IS_ERR(fp))) { + if (IS_ERR(fp)) { /* XXX need to find cmd if queued */ cmd->seq = NULL; cmd->aborted = true; @@ -568,6 +553,7 @@ static void ft_send_work(struct work_struct *work) } fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); + cmd->se_cmd.tag = fc_seq_exch(cmd->seq)->rxid; /* * Use a single se_cmd->cmd_kref as we expect to release se_cmd * directly from ft_check_stop_free callback in response path. diff --git a/kernel/drivers/target/tcm_fc/tfc_conf.c b/kernel/drivers/target/tcm_fc/tfc_conf.c index 65dce1345..85aeaa0ad 100644 --- a/kernel/drivers/target/tcm_fc/tfc_conf.c +++ b/kernel/drivers/target/tcm_fc/tfc_conf.c @@ -34,22 +34,13 @@ #include #include #include -#include -#include -#include -#include #include #include #include -#include -#include -#include #include "tcm_fc.h" -static const struct target_core_fabric_ops ft_fabric_ops; - static LIST_HEAD(ft_wwn_list); DEFINE_MUTEX(ft_lport_lock); @@ -138,55 +129,51 @@ static ssize_t ft_wwn_store(void *arg, const char *buf, size_t len) * ACL auth ops. */ -static ssize_t ft_nacl_show_port_name( - struct se_node_acl *se_nacl, - char *page) +static ssize_t ft_nacl_port_name_show(struct config_item *item, char *page) { + struct se_node_acl *se_nacl = acl_to_nacl(item); struct ft_node_acl *acl = container_of(se_nacl, struct ft_node_acl, se_node_acl); return ft_wwn_show(&acl->node_auth.port_name, page); } -static ssize_t ft_nacl_store_port_name( - struct se_node_acl *se_nacl, - const char *page, - size_t count) +static ssize_t ft_nacl_port_name_store(struct config_item *item, + const char *page, size_t count) { + struct se_node_acl *se_nacl = acl_to_nacl(item); struct ft_node_acl *acl = container_of(se_nacl, struct ft_node_acl, se_node_acl); return ft_wwn_store(&acl->node_auth.port_name, page, count); } -TF_NACL_BASE_ATTR(ft, port_name, S_IRUGO | S_IWUSR); - -static ssize_t ft_nacl_show_node_name( - struct se_node_acl *se_nacl, - char *page) +static ssize_t ft_nacl_node_name_show(struct config_item *item, + char *page) { + struct se_node_acl *se_nacl = acl_to_nacl(item); struct ft_node_acl *acl = container_of(se_nacl, struct ft_node_acl, se_node_acl); return ft_wwn_show(&acl->node_auth.node_name, page); } -static ssize_t ft_nacl_store_node_name( - struct se_node_acl *se_nacl, - const char *page, - size_t count) +static ssize_t ft_nacl_node_name_store(struct config_item *item, + const char *page, size_t count) { + struct se_node_acl *se_nacl = acl_to_nacl(item); struct ft_node_acl *acl = container_of(se_nacl, struct ft_node_acl, se_node_acl); return ft_wwn_store(&acl->node_auth.node_name, page, count); } -TF_NACL_BASE_ATTR(ft, node_name, S_IRUGO | S_IWUSR); +CONFIGFS_ATTR(ft_nacl_, node_name); +CONFIGFS_ATTR(ft_nacl_, port_name); static struct configfs_attribute *ft_nacl_base_attrs[] = { - &ft_nacl_port_name.attr, - &ft_nacl_node_name.attr, + &ft_nacl_attr_port_name, + &ft_nacl_attr_node_name, NULL, }; @@ -198,48 +185,17 @@ static struct configfs_attribute *ft_nacl_base_attrs[] = { * Add ACL for an initiator. The ACL is named arbitrarily. * The port_name and/or node_name are attributes. */ -static struct se_node_acl *ft_add_acl( - struct se_portal_group *se_tpg, - struct config_group *group, - const char *name) +static int ft_init_nodeacl(struct se_node_acl *nacl, const char *name) { - struct ft_node_acl *acl; - struct ft_tpg *tpg; + struct ft_node_acl *acl = + container_of(nacl, struct ft_node_acl, se_node_acl); u64 wwpn; - u32 q_depth; - - pr_debug("add acl %s\n", name); - tpg = container_of(se_tpg, struct ft_tpg, se_tpg); if (ft_parse_wwn(name, &wwpn, 1) < 0) - return ERR_PTR(-EINVAL); + return -EINVAL; - acl = kzalloc(sizeof(struct ft_node_acl), GFP_KERNEL); - if (!acl) - return ERR_PTR(-ENOMEM); acl->node_auth.port_name = wwpn; - - q_depth = 32; /* XXX bogus default - get from tpg? */ - return core_tpg_add_initiator_node_acl(&tpg->se_tpg, - &acl->se_node_acl, name, q_depth); -} - -static void ft_del_acl(struct se_node_acl *se_acl) -{ - struct se_portal_group *se_tpg = se_acl->se_tpg; - struct ft_tpg *tpg; - struct ft_node_acl *acl = container_of(se_acl, - struct ft_node_acl, se_node_acl); - - pr_debug("del acl %s\n", - config_item_name(&se_acl->acl_group.cg_item)); - - tpg = container_of(se_tpg, struct ft_tpg, se_tpg); - pr_debug("del acl %p se_acl %p tpg %p se_tpg %p\n", - acl, se_acl, tpg, &tpg->se_tpg); - - core_tpg_del_initiator_node_acl(&tpg->se_tpg, se_acl, 1); - kfree(acl); + return 0; } struct ft_node_acl *ft_acl_get(struct ft_tpg *tpg, struct fc_rport_priv *rdata) @@ -249,7 +205,7 @@ struct ft_node_acl *ft_acl_get(struct ft_tpg *tpg, struct fc_rport_priv *rdata) struct se_portal_group *se_tpg = &tpg->se_tpg; struct se_node_acl *se_acl; - spin_lock_irq(&se_tpg->acl_node_lock); + mutex_lock(&se_tpg->acl_node_mutex); list_for_each_entry(se_acl, &se_tpg->acl_node_list, acl_list) { acl = container_of(se_acl, struct ft_node_acl, se_node_acl); pr_debug("acl %p port_name %llx\n", @@ -263,33 +219,10 @@ struct ft_node_acl *ft_acl_get(struct ft_tpg *tpg, struct fc_rport_priv *rdata) break; } } - spin_unlock_irq(&se_tpg->acl_node_lock); + mutex_unlock(&se_tpg->acl_node_mutex); return found; } -static struct se_node_acl *ft_tpg_alloc_fabric_acl(struct se_portal_group *se_tpg) -{ - struct ft_node_acl *acl; - - acl = kzalloc(sizeof(*acl), GFP_KERNEL); - if (!acl) { - pr_err("Unable to allocate struct ft_node_acl\n"); - return NULL; - } - pr_debug("acl %p\n", acl); - return &acl->se_node_acl; -} - -static void ft_tpg_release_fabric_acl(struct se_portal_group *se_tpg, - struct se_node_acl *se_acl) -{ - struct ft_node_acl *acl = container_of(se_acl, - struct ft_node_acl, se_node_acl); - - pr_debug("acl %p\n", acl); - kfree(acl); -} - /* * local_port port_group (tpg) ops. */ @@ -337,8 +270,7 @@ static struct se_portal_group *ft_add_tpg( return NULL; } - ret = core_tpg_register(&ft_fabric_ops, wwn, &tpg->se_tpg, - tpg, TRANSPORT_TPG_TYPE_NORMAL); + ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_FCP); if (ret < 0) { destroy_workqueue(wq); kfree(tpg); @@ -448,21 +380,24 @@ static void ft_del_wwn(struct se_wwn *wwn) kfree(ft_wwn); } -static ssize_t ft_wwn_show_attr_version( - struct target_fabric_configfs *tf, - char *page) +static ssize_t ft_wwn_version_show(struct config_item *item, char *page) { return sprintf(page, "TCM FC " FT_VERSION " on %s/%s on " ""UTS_RELEASE"\n", utsname()->sysname, utsname()->machine); } -TF_WWN_ATTR_RO(ft, version); +CONFIGFS_ATTR_RO(ft_wwn_, version); static struct configfs_attribute *ft_wwn_attrs[] = { - &ft_wwn_version.attr, + &ft_wwn_attr_version, NULL, }; +static inline struct ft_tpg *ft_tpg(struct se_portal_group *se_tpg) +{ + return container_of(se_tpg, struct ft_tpg, se_tpg); +} + static char *ft_get_fabric_name(void) { return "fc"; @@ -470,25 +405,16 @@ static char *ft_get_fabric_name(void) static char *ft_get_fabric_wwn(struct se_portal_group *se_tpg) { - struct ft_tpg *tpg = se_tpg->se_tpg_fabric_ptr; - - return tpg->lport_wwn->name; + return ft_tpg(se_tpg)->lport_wwn->name; } static u16 ft_get_tag(struct se_portal_group *se_tpg) { - struct ft_tpg *tpg = se_tpg->se_tpg_fabric_ptr; - /* * This tag is used when forming SCSI Name identifier in EVPD=1 0x83 * to represent the SCSI Target Port. */ - return tpg->index; -} - -static u32 ft_get_default_depth(struct se_portal_group *se_tpg) -{ - return 1; + return ft_tpg(se_tpg)->index; } static int ft_check_false(struct se_portal_group *se_tpg) @@ -502,28 +428,20 @@ static void ft_set_default_node_attr(struct se_node_acl *se_nacl) static u32 ft_tpg_get_inst_index(struct se_portal_group *se_tpg) { - struct ft_tpg *tpg = se_tpg->se_tpg_fabric_ptr; - - return tpg->index; + return ft_tpg(se_tpg)->index; } static const struct target_core_fabric_ops ft_fabric_ops = { .module = THIS_MODULE, .name = "fc", + .node_acl_size = sizeof(struct ft_node_acl), .get_fabric_name = ft_get_fabric_name, - .get_fabric_proto_ident = fc_get_fabric_proto_ident, .tpg_get_wwn = ft_get_fabric_wwn, .tpg_get_tag = ft_get_tag, - .tpg_get_default_depth = ft_get_default_depth, - .tpg_get_pr_transport_id = fc_get_pr_transport_id, - .tpg_get_pr_transport_id_len = fc_get_pr_transport_id_len, - .tpg_parse_pr_out_transport_id = fc_parse_pr_out_transport_id, .tpg_check_demo_mode = ft_check_false, .tpg_check_demo_mode_cache = ft_check_false, .tpg_check_demo_mode_write_protect = ft_check_false, .tpg_check_prod_mode_write_protect = ft_check_false, - .tpg_alloc_fabric_acl = ft_tpg_alloc_fabric_acl, - .tpg_release_fabric_acl = ft_tpg_release_fabric_acl, .tpg_get_inst_index = ft_tpg_get_inst_index, .check_stop_free = ft_check_stop_free, .release_cmd = ft_release_cmd, @@ -534,7 +452,6 @@ static const struct target_core_fabric_ops ft_fabric_ops = { .write_pending = ft_write_pending, .write_pending_status = ft_write_pending_status, .set_default_node_attributes = ft_set_default_node_attr, - .get_task_tag = ft_get_task_tag, .get_cmd_state = ft_get_cmd_state, .queue_data_in = ft_queue_data_in, .queue_status = ft_queue_status, @@ -548,12 +465,7 @@ static const struct target_core_fabric_ops ft_fabric_ops = { .fabric_drop_wwn = &ft_del_wwn, .fabric_make_tpg = &ft_add_tpg, .fabric_drop_tpg = &ft_del_tpg, - .fabric_post_link = NULL, - .fabric_pre_unlink = NULL, - .fabric_make_np = NULL, - .fabric_drop_np = NULL, - .fabric_make_nodeacl = &ft_add_acl, - .fabric_drop_nodeacl = &ft_del_acl, + .fabric_init_nodeacl = &ft_init_nodeacl, .tfc_wwn_attrs = ft_wwn_attrs, .tfc_tpg_nacl_base_attrs = ft_nacl_base_attrs, diff --git a/kernel/drivers/target/tcm_fc/tfc_io.c b/kernel/drivers/target/tcm_fc/tfc_io.c index 583e755d8..847c1aa6f 100644 --- a/kernel/drivers/target/tcm_fc/tfc_io.c +++ b/kernel/drivers/target/tcm_fc/tfc_io.c @@ -39,17 +39,11 @@ #include #include #include -#include -#include -#include -#include #include #include #include #include -#include -#include #include "tcm_fc.h" diff --git a/kernel/drivers/target/tcm_fc/tfc_sess.c b/kernel/drivers/target/tcm_fc/tfc_sess.c index ccee7e332..7b934eac9 100644 --- a/kernel/drivers/target/tcm_fc/tfc_sess.c +++ b/kernel/drivers/target/tcm_fc/tfc_sess.c @@ -32,16 +32,10 @@ #include #include #include -#include -#include -#include -#include #include #include #include -#include -#include #include "tcm_fc.h" -- cgit 1.2.3-korg