* [PATCH] target_core_mib.h move
@ 2011-01-17 20:00 Fubo Chen
2011-01-17 20:51 ` Christoph Hellwig
0 siblings, 1 reply; 9+ messages in thread
From: Fubo Chen @ 2011-01-17 20:00 UTC (permalink / raw)
To: linux-scsi; +Cc: Nicholas A. Bellinger
target_core_mib.h move from drivers/target to include/target.
Otherwise my driver not build.
Signed-off-by: Fubo Chen <fubo.chen@gmail.com>
diff --git a/drivers/target/target_core_mib.h b/drivers/target/target_core_mib.h
deleted file mode 100644
index 2772046..0000000
--- a/drivers/target/target_core_mib.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef TARGET_CORE_MIB_H
-#define TARGET_CORE_MIB_H
-
-typedef enum {
- SCSI_INST_INDEX,
- SCSI_DEVICE_INDEX,
- SCSI_AUTH_INTR_INDEX,
- SCSI_INDEX_TYPE_MAX
-} scsi_index_t;
-
-struct scsi_index_table {
- spinlock_t lock;
- u32 scsi_mib_index[SCSI_INDEX_TYPE_MAX];
-} ____cacheline_aligned;
-
-/* SCSI Port stats */
-struct scsi_port_stats {
- u64 cmd_pdus;
- u64 tx_data_octets;
- u64 rx_data_octets;
-} ____cacheline_aligned;
-
-extern int init_scsi_target_mib(void);
-extern void remove_scsi_target_mib(void);
-extern void init_scsi_index_table(void);
-extern u32 scsi_get_new_index(scsi_index_t);
-
-#endif /*** TARGET_CORE_MIB_H ***/
diff --git a/include/target/target_core_base.h
b/include/target/target_core_base.h
index 07fdfb6..2ede15f 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -8,7 +8,7 @@
#include <scsi/scsi_cmnd.h>
#include <net/sock.h>
#include <net/tcp.h>
-#include "target_core_mib.h"
+#include <target/target_core_mib.h>
#define TARGET_CORE_MOD_VERSION "v4.0.0-rc6"
#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT))
diff --git a/include/target/target_core_mib.h b/include/target/target_core_mib.h
new file mode 100644
index 0000000..2772046
--- /dev/null
+++ b/include/target/target_core_mib.h
@@ -0,0 +1,28 @@
+#ifndef TARGET_CORE_MIB_H
+#define TARGET_CORE_MIB_H
+
+typedef enum {
+ SCSI_INST_INDEX,
+ SCSI_DEVICE_INDEX,
+ SCSI_AUTH_INTR_INDEX,
+ SCSI_INDEX_TYPE_MAX
+} scsi_index_t;
+
+struct scsi_index_table {
+ spinlock_t lock;
+ u32 scsi_mib_index[SCSI_INDEX_TYPE_MAX];
+} ____cacheline_aligned;
+
+/* SCSI Port stats */
+struct scsi_port_stats {
+ u64 cmd_pdus;
+ u64 tx_data_octets;
+ u64 rx_data_octets;
+} ____cacheline_aligned;
+
+extern int init_scsi_target_mib(void);
+extern void remove_scsi_target_mib(void);
+extern void init_scsi_index_table(void);
+extern u32 scsi_get_new_index(scsi_index_t);
+
+#endif /*** TARGET_CORE_MIB_H ***/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] target_core_mib.h move
2011-01-17 20:00 [PATCH] target_core_mib.h move Fubo Chen
@ 2011-01-17 20:51 ` Christoph Hellwig
2011-01-17 22:32 ` Nicholas A. Bellinger
2011-01-18 16:58 ` Fubo Chen
0 siblings, 2 replies; 9+ messages in thread
From: Christoph Hellwig @ 2011-01-17 20:51 UTC (permalink / raw)
To: Fubo Chen; +Cc: linux-scsi, Nicholas A. Bellinger
On Mon, Jan 17, 2011 at 09:00:02PM +0100, Fubo Chen wrote:
> target_core_mib.h move from drivers/target to include/target.
> Otherwise my driver not build.
>
> Signed-off-by: Fubo Chen <fubo.chen@gmail.com>
Why does the driver need to poke into the target MIB code directly?
Can you post the driver?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] target_core_mib.h move
2011-01-17 20:51 ` Christoph Hellwig
@ 2011-01-17 22:32 ` Nicholas A. Bellinger
2011-01-18 16:58 ` Fubo Chen
1 sibling, 0 replies; 9+ messages in thread
From: Nicholas A. Bellinger @ 2011-01-17 22:32 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Fubo Chen, linux-scsi
On Mon, 2011-01-17 at 15:51 -0500, Christoph Hellwig wrote:
> On Mon, Jan 17, 2011 at 09:00:02PM +0100, Fubo Chen wrote:
> > target_core_mib.h move from drivers/target to include/target.
> > Otherwise my driver not build.
> >
> > Signed-off-by: Fubo Chen <fubo.chen@gmail.com>
>
> Why does the driver need to poke into the target MIB code directly?
>
> Can you post the driver?
>
I assume this is for an old out-of-tree version of iscsi_target_mod.ko..
Fubo, if you want to test and ship mainline target code please use what
will be tagged as .38-rc1 in lio-core-2.6.git/linus-38-rc1 with the
offical LIO-Target iSCSI fabric module. Otherwise please do not send
target patches to linux-scsi for compat with old out-of-tree LIO iSCSI
fabric module code.
Thanks!
--nab
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] target_core_mib.h move
2011-01-17 20:51 ` Christoph Hellwig
2011-01-17 22:32 ` Nicholas A. Bellinger
@ 2011-01-18 16:58 ` Fubo Chen
2011-01-18 20:12 ` Nicholas A. Bellinger
1 sibling, 1 reply; 9+ messages in thread
From: Fubo Chen @ 2011-01-18 16:58 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-scsi, Nicholas A. Bellinger
On Mon, Jan 17, 2011 at 9:51 PM, Christoph Hellwig <hch@infradead.org> wrote:
> On Mon, Jan 17, 2011 at 09:00:02PM +0100, Fubo Chen wrote:
>> target_core_mib.h move from drivers/target to include/target.
>> Otherwise my driver not build.
>>
>> Signed-off-by: Fubo Chen <fubo.chen@gmail.com>
>
> Why does the driver need to poke into the target MIB code directly?
I should ask you why.
> Can you post the driver?
Compiler says:
$ make M=drivers/target modules
CC [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.o
In file included from drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c:15:0:
include/target/target_core_base.h:11:29: fatal error:
target_core_mib.h: No such file or directory
compilation terminated.
make[2]: *** [drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.o] Error 1
make[1]: *** [drivers/target/tcm_mvsas_tgt] Error 2
make: *** [_module_drivers/target] Error 2
for this driver:
---
drivers/target/Kbuild | 1 +
drivers/target/Kconfig | 2 +
drivers/target/tcm_mvsas_tgt/Kbuild | 3 +
drivers/target/tcm_mvsas_tgt/Kconfig | 6 +
drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_base.h | 31 ++
.../target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.c | 298 ++++++++++++++++++++
.../target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c | 272 ++++++++++++++++++
.../target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.h | 39 +++
8 files changed, 652 insertions(+), 0 deletions(-)
create mode 100644 drivers/target/Kbuild
create mode 100644 drivers/target/tcm_mvsas_tgt/Kbuild
create mode 100644 drivers/target/tcm_mvsas_tgt/Kconfig
create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_base.h
create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.c
create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c
create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.h
diff --git a/drivers/target/Kbuild b/drivers/target/Kbuild
new file mode 100644
index 0000000..a997c81
--- /dev/null
+++ b/drivers/target/Kbuild
@@ -0,0 +1 @@
+obj-$(CONFIG_TCM_MVSAS_TGT) += tcm_mvsas_tgt/
diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
index 2fac3be..85dcc60 100644
--- a/drivers/target/Kconfig
+++ b/drivers/target/Kconfig
@@ -29,4 +29,6 @@ config TCM_PSCSI
Say Y here to enable the TCM/pSCSI subsystem plugin for non-buffered
passthrough access to Linux/SCSI device
+source drivers/target/mvsas_tgt/Kconfig
+
endif
diff --git a/drivers/target/tcm_mvsas_tgt/Kbuild
b/drivers/target/tcm_mvsas_tgt/Kbuild
new file mode 100644
index 0000000..1c179d7
--- /dev/null
+++ b/drivers/target/tcm_mvsas_tgt/Kbuild
@@ -0,0 +1,3 @@
+tcm_mvsas_tgt-objs := tcm_mvsas_tgt_fabric.o \
+ tcm_mvsas_tgt_configfs.o
+obj-$(CONFIG_TCM_MVSAS_TGT) += tcm_mvsas_tgt.o
diff --git a/drivers/target/tcm_mvsas_tgt/Kconfig
b/drivers/target/tcm_mvsas_tgt/Kconfig
new file mode 100644
index 0000000..4e505fb
--- /dev/null
+++ b/drivers/target/tcm_mvsas_tgt/Kconfig
@@ -0,0 +1,6 @@
+config TCM_MVSAS_TGT
+ tristate "TCM_MVSAS_TGT fabric module"
+ depends on TARGET_CORE && CONFIGFS_FS
+ default n
+ ---help---
+ Say Y here to enable the TCM_MVSAS_TGT fabric module
diff --git a/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_base.h
b/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_base.h
new file mode 100644
index 0000000..44d1a03
--- /dev/null
+++ b/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_base.h
@@ -0,0 +1,31 @@
+#define TCM_MVSAS_TGT_VERSION "v0.1"
+#define TCM_MVSAS_TGT_NAMELEN 32
+
+struct tcm_mvsas_tgt_nacl {
+ /* Binary World Wide unique Port Name for SAS Initiator port */
+ u64 iport_wwpn;
+ /* ASCII formatted WWPN for Sas Initiator port */
+ char iport_name[TCM_MVSAS_TGT_NAMELEN];
+ /* Returned by tcm_mvsas_tgt_make_nodeacl() */
+ struct se_node_acl se_node_acl;
+};
+
+struct tcm_mvsas_tgt_tpg {
+ /* SAS port target portal group tag for TCM */
+ u16 tport_tpgt;
+ /* Pointer back to tcm_mvsas_tgt_tport */
+ struct tcm_mvsas_tgt_tport *tport;
+ /* Returned by tcm_mvsas_tgt_make_tpg() */
+ struct se_portal_group se_tpg;
+};
+
+struct tcm_mvsas_tgt_tport {
+ /* SCSI protocol the tport is providing */
+ u8 tport_proto_id;
+ /* Binary World Wide unique Port Name for SAS Target port */
+ u64 tport_wwpn;
+ /* ASCII formatted WWPN for SAS Target port */
+ char tport_name[TCM_MVSAS_TGT_NAMELEN];
+ /* Returned by tcm_mvsas_tgt_make_tport() */
+ struct se_wwn tport_wwn;
+};
diff --git a/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.c
b/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.c
new file mode 100644
index 0000000..7a4e938
--- /dev/null
+++ b/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.c
@@ -0,0 +1,298 @@
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/version.h>
+#include <generated/utsrelease.h>
+#include <linux/utsname.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/kthread.h>
+#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/configfs.h>
+#include <linux/ctype.h>
+#include <asm/unaligned.h>
+
+#include <target/target_core_base.h>
+#include <target/target_core_transport.h>
+#include <target/target_core_fabric_ops.h>
+#include <target/target_core_fabric_configfs.h>
+#include <target/target_core_fabric_lib.h>
+#include <target/target_core_device.h>
+#include <target/target_core_tpg.h>
+#include <target/target_core_configfs.h>
+#include <target/target_core_base.h>
+#include <target/configfs_macros.h>
+
+#include <tcm_mvsas_tgt_base.h>
+#include <tcm_mvsas_tgt_fabric.h>
+
+/* Local pointer to allocated TCM configfs fabric module */
+struct target_fabric_configfs *tcm_mvsas_tgt_fabric_configfs;
+
+static struct se_node_acl *tcm_mvsas_tgt_make_nodeacl(
+ struct se_portal_group *se_tpg,
+ struct config_group *group,
+ const char *name)
+{
+ struct se_node_acl *se_nacl, *se_nacl_new;
+ struct tcm_mvsas_tgt_nacl *nacl;
+ u64 wwpn = 0;
+ u32 nexus_depth;
+
+ /* tcm_mvsas_tgt_parse_wwn(name, &wwpn, 1) < 0)
+ return ERR_PTR(-EINVAL); */
+ se_nacl_new = tcm_mvsas_tgt_alloc_fabric_acl(se_tpg);
+ if (!(se_nacl_new))
+ return ERR_PTR(-ENOMEM);
+//#warning FIXME: Hardcoded nexus depth in tcm_mvsas_tgt_make_nodeacl()
+ nexus_depth = 1;
+ /*
+ * se_nacl_new may be released by core_tpg_add_initiator_node_acl()
+ * when converting a NodeACL from demo mode -> explict
+ */
+ se_nacl = core_tpg_add_initiator_node_acl(se_tpg, se_nacl_new,
+ name, nexus_depth);
+ if (IS_ERR(se_nacl)) {
+ tcm_mvsas_tgt_release_fabric_acl(se_tpg, se_nacl_new);
+ return se_nacl;
+ }
+ /*
+ * Locate our struct tcm_mvsas_tgt_nacl and set the FC Nport WWPN
+ */
+ nacl = container_of(se_nacl, struct tcm_mvsas_tgt_nacl, se_node_acl);
+ nacl->iport_wwpn = wwpn;
+ /* tcm_mvsas_tgt_format_wwn(&nacl->iport_name[0],
TCM_MVSAS_TGT_NAMELEN, wwpn); */
+
+ return se_nacl;
+}
+
+static void tcm_mvsas_tgt_drop_nodeacl(struct se_node_acl *se_acl)
+{
+ struct tcm_mvsas_tgt_nacl *nacl = container_of(se_acl,
+ struct tcm_mvsas_tgt_nacl, se_node_acl);
+ kfree(nacl);
+}
+
+static struct se_portal_group *tcm_mvsas_tgt_make_tpg(
+ struct se_wwn *wwn,
+ struct config_group *group,
+ const char *name)
+{
+ struct tcm_mvsas_tgt_tport*tport = container_of(wwn,
+ struct tcm_mvsas_tgt_tport, tport_wwn);
+
+ struct tcm_mvsas_tgt_tpg *tpg;
+ unsigned long tpgt;
+ int ret;
+
+ if (strstr(name, "tpgt_") != name)
+ return ERR_PTR(-EINVAL);
+ if (strict_strtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)
+ return ERR_PTR(-EINVAL);
+
+ tpg = kzalloc(sizeof(struct tcm_mvsas_tgt_tpg), GFP_KERNEL);
+ if (!(tpg)) {
+ printk(KERN_ERR "Unable to allocate struct tcm_mvsas_tgt_tpg");
+ return ERR_PTR(-ENOMEM);
+ }
+ tpg->tport = tport;
+ tpg->tport_tpgt = tpgt;
+
+ ret = core_tpg_register(&tcm_mvsas_tgt_fabric_configfs->tf_ops, wwn,
+ &tpg->se_tpg, (void *)tpg,
+ TRANSPORT_TPG_TYPE_NORMAL);
+ if (ret < 0) {
+ kfree(tpg);
+ return NULL;
+ }
+ return &tpg->se_tpg;
+}
+
+static void tcm_mvsas_tgt_drop_tpg(struct se_portal_group *se_tpg)
+{
+ struct tcm_mvsas_tgt_tpg *tpg = container_of(se_tpg,
+ struct tcm_mvsas_tgt_tpg, se_tpg);
+
+ core_tpg_deregister(se_tpg);
+ kfree(tpg);
+}
+
+static struct se_wwn *tcm_mvsas_tgt_make_tport(
+ struct target_fabric_configfs *tf,
+ struct config_group *group,
+ const char *name)
+{
+ struct tcm_mvsas_tgt_tport *tport;
+ u64 wwpn = 0;
+
+ /* if (tcm_mvsas_tgt_parse_wwn(name, &wwpn, 1) < 0)
+ return ERR_PTR(-EINVAL); */
+
+ tport = kzalloc(sizeof(struct tcm_mvsas_tgt_tport), GFP_KERNEL);
+ if (!(tport)) {
+ printk(KERN_ERR "Unable to allocate struct tcm_mvsas_tgt_tport");
+ return ERR_PTR(-ENOMEM);
+ }
+ tport->tport_wwpn = wwpn;
+ /* tcm_mvsas_tgt_format_wwn(&tport->tport_name[0],
TCM_MVSAS_TGT__NAMELEN, wwpn); */
+
+ return &tport->tport_wwn;
+}
+
+static void tcm_mvsas_tgt_drop_tport(struct se_wwn *wwn)
+{
+ struct tcm_mvsas_tgt_tport *tport = container_of(wwn,
+ struct tcm_mvsas_tgt_tport, tport_wwn);
+ kfree(tport);
+}
+
+static ssize_t tcm_mvsas_tgt_wwn_show_attr_version(
+ struct target_fabric_configfs *tf,
+ char *page)
+{
+ return sprintf(page, "TCM_MVSAS_TGT fabric module %s on %s/%s"
+ "on "UTS_RELEASE"\n", TCM_MVSAS_TGT_VERSION, utsname()->sysname,
+ utsname()->machine);
+}
+
+TF_WWN_ATTR_RO(tcm_mvsas_tgt, version);
+
+static struct configfs_attribute *tcm_mvsas_tgt_wwn_attrs[] = {
+ &tcm_mvsas_tgt_wwn_version.attr,
+ NULL,
+};
+
+static struct target_core_fabric_ops tcm_mvsas_tgt_ops = {
+ .get_fabric_name = tcm_mvsas_tgt_get_fabric_name,
+ .get_fabric_proto_ident = tcm_mvsas_tgt_get_fabric_proto_ident,
+ .tpg_get_wwn = tcm_mvsas_tgt_get_fabric_wwn,
+ .tpg_get_tag = tcm_mvsas_tgt_get_tag,
+ .tpg_get_default_depth = tcm_mvsas_tgt_get_default_depth,
+ .tpg_get_pr_transport_id = tcm_mvsas_tgt_get_pr_transport_id,
+ .tpg_get_pr_transport_id_len = tcm_mvsas_tgt_get_pr_transport_id_len,
+ .tpg_parse_pr_out_transport_id = tcm_mvsas_tgt_parse_pr_out_transport_id,
+ .tpg_check_demo_mode = tcm_mvsas_tgt_check_false,
+ .tpg_check_demo_mode_cache = tcm_mvsas_tgt_check_true,
+ .tpg_check_demo_mode_write_protect = tcm_mvsas_tgt_check_true,
+ .tpg_check_prod_mode_write_protect = tcm_mvsas_tgt_check_false,
+ .tpg_alloc_fabric_acl = tcm_mvsas_tgt_alloc_fabric_acl,
+ .tpg_release_fabric_acl = tcm_mvsas_tgt_release_fabric_acl,
+ .tpg_get_inst_index = tcm_mvsas_tgt_tpg_get_inst_index,
+ .release_cmd_to_pool = tcm_mvsas_tgt_release_cmd,
+ .release_cmd_direct = tcm_mvsas_tgt_release_cmd,
+ .shutdown_session = tcm_mvsas_tgt_shutdown_session,
+ .close_session = tcm_mvsas_tgt_close_session,
+ .stop_session = tcm_mvsas_tgt_stop_session,
+ .fall_back_to_erl0 = tcm_mvsas_tgt_reset_nexus,
+ .sess_logged_in = tcm_mvsas_tgt_sess_logged_in,
+ .sess_get_index = tcm_mvsas_tgt_sess_get_index,
+ .sess_get_initiator_sid = NULL,
+ .write_pending = tcm_mvsas_tgt_write_pending,
+ .write_pending_status = tcm_mvsas_tgt_write_pending_status,
+ .set_default_node_attributes = tcm_mvsas_tgt_set_default_node_attrs,
+ .get_task_tag = tcm_mvsas_tgt_get_task_tag,
+ .get_cmd_state = tcm_mvsas_tgt_get_cmd_state,
+ .new_cmd_failure = tcm_mvsas_tgt_new_cmd_failure,
+ .queue_data_in = tcm_mvsas_tgt_queue_data_in,
+ .queue_status = tcm_mvsas_tgt_queue_status,
+ .queue_tm_rsp = tcm_mvsas_tgt_queue_tm_rsp,
+ .get_fabric_sense_len = tcm_mvsas_tgt_get_fabric_sense_len,
+ .set_fabric_sense_len = tcm_mvsas_tgt_set_fabric_sense_len,
+ .is_state_remove = tcm_mvsas_tgt_is_state_remove,
+ .pack_lun = tcm_mvsas_tgt_pack_lun,
+ /*
+ * Setup function pointers for generic logic in target_core_fabric_configfs.c
+ */
+ .fabric_make_wwn = tcm_mvsas_tgt_make_tport,
+ .fabric_drop_wwn = tcm_mvsas_tgt_drop_tport,
+ .fabric_make_tpg = tcm_mvsas_tgt_make_tpg,
+ .fabric_drop_tpg = tcm_mvsas_tgt_drop_tpg,
+ .fabric_post_link = NULL,
+ .fabric_pre_unlink = NULL,
+ .fabric_make_np = NULL,
+ .fabric_drop_np = NULL,
+ .fabric_make_nodeacl = tcm_mvsas_tgt_make_nodeacl,
+ .fabric_drop_nodeacl = tcm_mvsas_tgt_drop_nodeacl,
+};
+
+static int tcm_mvsas_tgt_register_configfs(void)
+{
+ struct target_fabric_configfs *fabric;
+ int ret;
+
+ printk(KERN_INFO "TCM_MVSAS_TGT fabric module %s on %s/%s"
+ " on "UTS_RELEASE"\n",TCM_MVSAS_TGT_VERSION, utsname()->sysname,
+ utsname()->machine);
+ /*
+ * Register the top level struct config_item_type with TCM core
+ */
+ fabric = target_fabric_configfs_init(THIS_MODULE, "mvsas_tgt");
+ if (!(fabric)) {
+ printk(KERN_ERR "target_fabric_configfs_init() failed\n");
+ return -ENOMEM;
+ }
+ /*
+ * Setup fabric->tf_ops from our local tcm_mvsas_tgt_ops
+ */
+ fabric->tf_ops = tcm_mvsas_tgt_ops;
+ /*
+ * Setup default attribute lists for various fabric->tf_cit_tmpl
+ */
+ TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = tcm_mvsas_tgt_wwn_attrs;
+ TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = NULL;
+ /*
+ * Register the fabric for use within TCM
+ */
+ ret = target_fabric_configfs_register(fabric);
+ if (ret < 0) {
+ printk(KERN_ERR "target_fabric_configfs_register() failed"
+ " for TCM_MVSAS_TGT\n");
+ return ret;
+ }
+ /*
+ * Setup our local pointer to *fabric
+ */
+ tcm_mvsas_tgt_fabric_configfs = fabric;
+ printk(KERN_INFO "TCM_MVSAS_TGT[0] - Set fabric ->
tcm_mvsas_tgt_fabric_configfs\n");
+ return 0;
+};
+
+static void tcm_mvsas_tgt_deregister_configfs(void)
+{
+ if (!(tcm_mvsas_tgt_fabric_configfs))
+ return;
+
+ target_fabric_configfs_deregister(tcm_mvsas_tgt_fabric_configfs);
+ tcm_mvsas_tgt_fabric_configfs = NULL;
+ printk(KERN_INFO "TCM_MVSAS_TGT[0] - Cleared
tcm_mvsas_tgt_fabric_configfs\n");
+};
+
+static int __init tcm_mvsas_tgt_init(void)
+{
+ int ret;
+
+ ret = tcm_mvsas_tgt_register_configfs();
+ if (ret < 0)
+ return ret;
+
+ return 0;
+};
+
+static void tcm_mvsas_tgt_exit(void)
+{
+ tcm_mvsas_tgt_deregister_configfs();
+};
+
+#ifdef MODULE
+MODULE_DESCRIPTION("TCM_MVSAS_TGT series fabric driver");
+MODULE_LICENSE("GPL");
+module_init(tcm_mvsas_tgt_init);
+module_exit(tcm_mvsas_tgt_exit);
+#endif
diff --git a/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c
b/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c
new file mode 100644
index 0000000..36c92cc
--- /dev/null
+++ b/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c
@@ -0,0 +1,272 @@
+#include <linux/slab.h>
+#include <linux/kthread.h>
+#include <linux/types.h>
+#include <linux/list.h>
+#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/ctype.h>
+#include <asm/unaligned.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/libfc.h>
+
+#include <target/target_core_base.h>
+#include <target/target_core_transport.h>
+#include <target/target_core_fabric_ops.h>
+#include <target/target_core_fabric_lib.h>
+#include <target/target_core_device.h>
+#include <target/target_core_tpg.h>
+#include <target/target_core_configfs.h>
+#include <tcm_mvsas_tgt_base.h>
+#include <tcm_mvsas_tgt_fabric.h>
+
+int tcm_mvsas_tgt_check_true(struct se_portal_group *se_tpg)
+{
+ return 1;
+}
+
+int tcm_mvsas_tgt_check_false(struct se_portal_group *se_tpg)
+{
+ return 0;
+}
+
+char *tcm_mvsas_tgt_get_fabric_name(void)
+{
+ return "mvsas_tgt";
+}
+
+u8 tcm_mvsas_tgt_get_fabric_proto_ident(struct se_portal_group *se_tpg)
+{
+ struct tcm_mvsas_tgt_tpg *tpg = container_of(se_tpg,
+ struct tcm_mvsas_tgt_tpg, se_tpg);
+ struct tcm_mvsas_tgt_tport *tport = tpg->tport;
+ u8 proto_id;
+
+ switch (tport->tport_proto_id) {
+ case SCSI_PROTOCOL_SAS:
+ default:
+ proto_id = sas_get_fabric_proto_ident(se_tpg);
+ break;
+ }
+
+ return proto_id;
+}
+
+char *tcm_mvsas_tgt_get_fabric_wwn(struct se_portal_group *se_tpg)
+{
+ struct tcm_mvsas_tgt_tpg *tpg = container_of(se_tpg,
+ struct tcm_mvsas_tgt_tpg, se_tpg);
+ struct tcm_mvsas_tgt_tport *tport = tpg->tport;
+
+ return &tport->tport_name[0];
+}
+
+u16 tcm_mvsas_tgt_get_tag(struct se_portal_group *se_tpg)
+{
+ struct tcm_mvsas_tgt_tpg *tpg = container_of(se_tpg,
+ struct tcm_mvsas_tgt_tpg, se_tpg);
+ return tpg->tport_tpgt;
+}
+
+u32 tcm_mvsas_tgt_get_default_depth(struct se_portal_group *se_tpg)
+{
+ return 1;
+}
+
+u32 tcm_mvsas_tgt_get_pr_transport_id(
+ struct se_portal_group *se_tpg,
+ struct se_node_acl *se_nacl,
+ struct t10_pr_registration *pr_reg,
+ int *format_code,
+ unsigned char *buf)
+{
+ struct tcm_mvsas_tgt_tpg *tpg = container_of(se_tpg,
+ struct tcm_mvsas_tgt_tpg, se_tpg);
+ struct tcm_mvsas_tgt_tport *tport = tpg->tport;
+ int ret = 0;
+
+ switch (tport->tport_proto_id) {
+ case SCSI_PROTOCOL_SAS:
+ default:
+ ret = sas_get_pr_transport_id(se_tpg, se_nacl, pr_reg,
+ format_code, buf);
+ break;
+ }
+
+ return ret;
+}
+
+u32 tcm_mvsas_tgt_get_pr_transport_id_len(
+ struct se_portal_group *se_tpg,
+ struct se_node_acl *se_nacl,
+ struct t10_pr_registration *pr_reg,
+ int *format_code)
+{
+ struct tcm_mvsas_tgt_tpg *tpg = container_of(se_tpg,
+ struct tcm_mvsas_tgt_tpg, se_tpg);
+ struct tcm_mvsas_tgt_tport *tport = tpg->tport;
+ int ret = 0;
+
+ switch (tport->tport_proto_id) {
+ case SCSI_PROTOCOL_SAS:
+ default:
+ ret = sas_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,
+ format_code);
+ break;
+ }
+
+ return ret;
+}
+
+char *tcm_mvsas_tgt_parse_pr_out_transport_id(
+ struct se_portal_group *se_tpg,
+ const char *buf,
+ u32 *out_tid_len,
+ char **port_nexus_ptr)
+{
+ struct tcm_mvsas_tgt_tpg *tpg = container_of(se_tpg,
+ struct tcm_mvsas_tgt_tpg, se_tpg);
+ struct tcm_mvsas_tgt_tport *tport = tpg->tport;
+ char *tid = NULL;
+
+ switch (tport->tport_proto_id) {
+ case SCSI_PROTOCOL_SAS:
+ default:
+ tid = sas_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,
+ port_nexus_ptr);
+ }
+
+ return tid;
+}
+
+struct se_node_acl *tcm_mvsas_tgt_alloc_fabric_acl(struct
se_portal_group *se_tpg)
+{
+ struct tcm_mvsas_tgt_nacl *nacl;
+
+ nacl = kzalloc(sizeof(struct tcm_mvsas_tgt_nacl), GFP_KERNEL);
+ if (!(nacl)) {
+ printk(KERN_ERR "Unable to alocate struct tcm_mvsas_tgt_nacl\n");
+ return NULL;
+ }
+
+ return &nacl->se_node_acl;
+}
+
+void tcm_mvsas_tgt_release_fabric_acl(
+ struct se_portal_group *se_tpg,
+ struct se_node_acl *se_nacl)
+{
+ struct tcm_mvsas_tgt_nacl *nacl = container_of(se_nacl,
+ struct tcm_mvsas_tgt_nacl, se_node_acl);
+ kfree(nacl);
+}
+
+u32 tcm_mvsas_tgt_tpg_get_inst_index(struct se_portal_group *se_tpg)
+{
+ return 1;
+}
+
+void tcm_mvsas_tgt_release_cmd(struct se_cmd *se_cmd)
+{
+ return;
+}
+
+int tcm_mvsas_tgt_shutdown_session(struct se_session *se_sess)
+{
+ return 0;
+}
+
+void tcm_mvsas_tgt_close_session(struct se_session *se_sess)
+{
+ return;
+}
+
+void tcm_mvsas_tgt_stop_session(struct se_session *se_sess, int
sess_sleep , int conn_sleep)
+{
+ return;
+}
+
+void tcm_mvsas_tgt_reset_nexus(struct se_session *se_sess)
+{
+ return;
+}
+
+int tcm_mvsas_tgt_sess_logged_in(struct se_session *se_sess)
+{
+ return 0;
+}
+
+u32 tcm_mvsas_tgt_sess_get_index(struct se_session *se_sess)
+{
+ return 0;
+}
+
+int tcm_mvsas_tgt_write_pending(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+int tcm_mvsas_tgt_write_pending_status(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+void tcm_mvsas_tgt_set_default_node_attrs(struct se_node_acl *nacl)
+{
+ return;
+}
+
+u32 tcm_mvsas_tgt_get_task_tag(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+int tcm_mvsas_tgt_get_cmd_state(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+void tcm_mvsas_tgt_new_cmd_failure(struct se_cmd *se_cmd)
+{
+ return;
+}
+
+int tcm_mvsas_tgt_queue_data_in(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+int tcm_mvsas_tgt_queue_status(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+int tcm_mvsas_tgt_queue_tm_rsp(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+u16 tcm_mvsas_tgt_set_fabric_sense_len(struct se_cmd *se_cmd, u32 sense_length)
+{
+ return 0;
+}
+
+u16 tcm_mvsas_tgt_get_fabric_sense_len(void)
+{
+ return 0;
+}
+
+int tcm_mvsas_tgt_is_state_remove(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+u64 tcm_mvsas_tgt_pack_lun(unsigned int lun)
+{
+ WARN_ON(lun >= 256);
+ /* Caller wants this byte-swapped */
+ return cpu_to_le64((lun & 0xff) << 8);
+}
+
diff --git a/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.h
b/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.h
new file mode 100644
index 0000000..fb1a021
--- /dev/null
+++ b/drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.h
@@ -0,0 +1,39 @@
+int tcm_mvsas_tgt_check_true(struct se_portal_group *);
+int tcm_mvsas_tgt_check_false(struct se_portal_group *);
+char *tcm_mvsas_tgt_get_fabric_name(void);
+u8 tcm_mvsas_tgt_get_fabric_proto_ident(struct se_portal_group *);
+char *tcm_mvsas_tgt_get_fabric_wwn(struct se_portal_group *);
+u16 tcm_mvsas_tgt_get_tag(struct se_portal_group *);
+u32 tcm_mvsas_tgt_get_default_depth(struct se_portal_group *);
+u32 tcm_mvsas_tgt_get_pr_transport_id(struct se_portal_group *,
+ struct se_node_acl *, struct t10_pr_registration *,
+ int *, unsigned char *);
+u32 tcm_mvsas_tgt_get_pr_transport_id_len(struct se_portal_group *,
+ struct se_node_acl *, struct t10_pr_registration *,
+ int *);
+char *tcm_mvsas_tgt_parse_pr_out_transport_id(struct se_portal_group *,
+ const char *, u32 *, char **);
+struct se_node_acl *tcm_mvsas_tgt_alloc_fabric_acl(struct se_portal_group *);
+void tcm_mvsas_tgt_release_fabric_acl(struct se_portal_group *,
+ struct se_node_acl *);
+u32 tcm_mvsas_tgt_tpg_get_inst_index(struct se_portal_group *);
+void tcm_mvsas_tgt_release_cmd(struct se_cmd *);
+int tcm_mvsas_tgt_shutdown_session(struct se_session *);
+void tcm_mvsas_tgt_close_session(struct se_session *);
+void tcm_mvsas_tgt_stop_session(struct se_session *, int, int);
+void tcm_mvsas_tgt_reset_nexus(struct se_session *);
+int tcm_mvsas_tgt_sess_logged_in(struct se_session *);
+u32 tcm_mvsas_tgt_sess_get_index(struct se_session *);
+int tcm_mvsas_tgt_write_pending(struct se_cmd *);
+int tcm_mvsas_tgt_write_pending_status(struct se_cmd *);
+void tcm_mvsas_tgt_set_default_node_attrs(struct se_node_acl *);
+u32 tcm_mvsas_tgt_get_task_tag(struct se_cmd *);
+int tcm_mvsas_tgt_get_cmd_state(struct se_cmd *);
+void tcm_mvsas_tgt_new_cmd_failure(struct se_cmd *);
+int tcm_mvsas_tgt_queue_data_in(struct se_cmd *);
+int tcm_mvsas_tgt_queue_status(struct se_cmd *);
+int tcm_mvsas_tgt_queue_tm_rsp(struct se_cmd *);
+u16 tcm_mvsas_tgt_set_fabric_sense_len(struct se_cmd *, u32);
+u16 tcm_mvsas_tgt_get_fabric_sense_len(void);
+int tcm_mvsas_tgt_is_state_remove(struct se_cmd *);
+u64 tcm_mvsas_tgt_pack_lun(unsigned int);
--
1.7.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] target_core_mib.h move
2011-01-18 16:58 ` Fubo Chen
@ 2011-01-18 20:12 ` Nicholas A. Bellinger
2011-01-18 20:15 ` Christoph Hellwig
2011-01-18 21:02 ` Nicholas A. Bellinger
0 siblings, 2 replies; 9+ messages in thread
From: Nicholas A. Bellinger @ 2011-01-18 20:12 UTC (permalink / raw)
To: Fubo Chen; +Cc: Christoph Hellwig, linux-scsi
On Tue, 2011-01-18 at 17:58 +0100, Fubo Chen wrote:
> On Mon, Jan 17, 2011 at 9:51 PM, Christoph Hellwig <hch@infradead.org> wrote:
> > On Mon, Jan 17, 2011 at 09:00:02PM +0100, Fubo Chen wrote:
> >> target_core_mib.h move from drivers/target to include/target.
> >> Otherwise my driver not build.
> >>
> >> Signed-off-by: Fubo Chen <fubo.chen@gmail.com>
> >
> > Why does the driver need to poke into the target MIB code directly?
>
> I should ask you why.
>
> > Can you post the driver?
>
> Compiler says:
>
> $ make M=drivers/target modules
> CC [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.o
> In file included from drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c:15:0:
> include/target/target_core_base.h:11:29: fatal error:
> target_core_mib.h: No such file or directory
> compilation terminated.
> make[2]: *** [drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.o] Error 1
> make[1]: *** [drivers/target/tcm_mvsas_tgt] Error 2
> make: *** [_module_drivers/target] Error 2
>
> for this driver:
>
> ---
> drivers/target/Kbuild | 1 +
> drivers/target/Kconfig | 2 +
> drivers/target/tcm_mvsas_tgt/Kbuild | 3 +
> drivers/target/tcm_mvsas_tgt/Kconfig | 6 +
> drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_base.h | 31 ++
> .../target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.c | 298 ++++++++++++++++++++
> .../target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c | 272 ++++++++++++++++++
> .../target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.h | 39 +++
> 8 files changed, 652 insertions(+), 0 deletions(-)
> create mode 100644 drivers/target/Kbuild
> create mode 100644 drivers/target/tcm_mvsas_tgt/Kbuild
> create mode 100644 drivers/target/tcm_mvsas_tgt/Kconfig
> create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_base.h
> create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.c
> create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c
> create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.h
>
> diff --git a/drivers/target/Kbuild b/drivers/target/Kbuild
> new file mode 100644
> index 0000000..a997c81
> --- /dev/null
> +++ b/drivers/target/Kbuild
> @@ -0,0 +1 @@
> +obj-$(CONFIG_TCM_MVSAS_TGT) += tcm_mvsas_tgt/
> diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
> index 2fac3be..85dcc60 100644
> --- a/drivers/target/Kconfig
> +++ b/drivers/target/Kconfig
> @@ -29,4 +29,6 @@ config TCM_PSCSI
> Say Y here to enable the TCM/pSCSI subsystem plugin for non-buffered
> passthrough access to Linux/SCSI device
>
> +source drivers/target/mvsas_tgt/Kconfig
> +
> endif
> diff --git a/drivers/target/tcm_mvsas_tgt/Kbuild
> b/drivers/target/tcm_mvsas_tgt/Kbuild
> new file mode 100644
> index 0000000..1c179d7
> --- /dev/null
> +++ b/drivers/target/tcm_mvsas_tgt/Kbuild
> @@ -0,0 +1,3 @@
> +tcm_mvsas_tgt-objs := tcm_mvsas_tgt_fabric.o \
> + tcm_mvsas_tgt_configfs.o
> +obj-$(CONFIG_TCM_MVSAS_TGT) += tcm_mvsas_tgt.o
I think this fabric module was generated with an older version of
Documentation/target/tcm_mod_builder.py, right..?
After doing a quick 'tcm_mod_builder.py -m tcm_mvsas_tgt -p SAS' with
mainline code, the newly generated tcm_mvsas_tgt.ko builds as expected..
[nab@hera lio-core-2.6.git]$ make
drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt.ko
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CC [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.o
CC [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.o
LD [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt.o
MODPOST 2 modules
CC drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt.mod.o
LD [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt.ko
The bit missing from the top of your Kbuild is:
EXTRA_CFLAGS += -I$(srctree)/drivers/target/ -I$(srctree)/include/ -I$(srctree)/drivers/scsi/ -I$(srctree)/include/scsi/ -I$(srctree)/drivers/target/tcm_mvsas_tgt
FYI, depending upon the age of the tcm_mod_builder.py in question , you
may want to consider re-generating the fabric module skeleton with the
latest code.
Thanks!
--nab
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] target_core_mib.h move
2011-01-18 20:12 ` Nicholas A. Bellinger
@ 2011-01-18 20:15 ` Christoph Hellwig
2011-01-18 21:02 ` Nicholas A. Bellinger
1 sibling, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2011-01-18 20:15 UTC (permalink / raw)
To: Nicholas A. Bellinger; +Cc: Fubo Chen, Christoph Hellwig, linux-scsi
On Tue, Jan 18, 2011 at 12:12:43PM -0800, Nicholas A. Bellinger wrote:
> EXTRA_CFLAGS += -I$(srctree)/drivers/target/ -I$(srctree)/include/ -I$(srctree)/drivers/scsi/ -I$(srctree)/include/scsi/ -I$(srctree)/drivers/target/tcm_mvsas_tgt
>
> FYI, depending upon the age of the tcm_mod_builder.py in question , you
> may want to consider re-generating the fabric module skeleton with the
> latest code.
This shouldn't be nessecary. Except for special cases driver should
never need special include paths. I still don't see why the mib header
should be needed by drivers, but if it is it needs to move under
include/.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] target_core_mib.h move
2011-01-18 20:12 ` Nicholas A. Bellinger
2011-01-18 20:15 ` Christoph Hellwig
@ 2011-01-18 21:02 ` Nicholas A. Bellinger
2011-01-22 14:49 ` Fubo Chen
1 sibling, 1 reply; 9+ messages in thread
From: Nicholas A. Bellinger @ 2011-01-18 21:02 UTC (permalink / raw)
To: Fubo Chen; +Cc: Christoph Hellwig, linux-scsi
On Tue, 2011-01-18 at 12:12 -0800, Nicholas A. Bellinger wrote:
> On Tue, 2011-01-18 at 17:58 +0100, Fubo Chen wrote:
> > On Mon, Jan 17, 2011 at 9:51 PM, Christoph Hellwig <hch@infradead.org> wrote:
> > > On Mon, Jan 17, 2011 at 09:00:02PM +0100, Fubo Chen wrote:
> > >> target_core_mib.h move from drivers/target to include/target.
> > >> Otherwise my driver not build.
> > >>
> > >> Signed-off-by: Fubo Chen <fubo.chen@gmail.com>
> > >
> > > Why does the driver need to poke into the target MIB code directly?
> >
> > I should ask you why.
> >
> > > Can you post the driver?
> >
> > Compiler says:
> >
> > $ make M=drivers/target modules
> > CC [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.o
> > In file included from drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c:15:0:
> > include/target/target_core_base.h:11:29: fatal error:
> > target_core_mib.h: No such file or directory
> > compilation terminated.
> > make[2]: *** [drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.o] Error 1
> > make[1]: *** [drivers/target/tcm_mvsas_tgt] Error 2
> > make: *** [_module_drivers/target] Error 2
> >
> > for this driver:
> >
> > ---
> > drivers/target/Kbuild | 1 +
> > drivers/target/Kconfig | 2 +
> > drivers/target/tcm_mvsas_tgt/Kbuild | 3 +
> > drivers/target/tcm_mvsas_tgt/Kconfig | 6 +
> > drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_base.h | 31 ++
> > .../target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.c | 298 ++++++++++++++++++++
> > .../target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c | 272 ++++++++++++++++++
> > .../target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.h | 39 +++
> > 8 files changed, 652 insertions(+), 0 deletions(-)
> > create mode 100644 drivers/target/Kbuild
> > create mode 100644 drivers/target/tcm_mvsas_tgt/Kbuild
> > create mode 100644 drivers/target/tcm_mvsas_tgt/Kconfig
> > create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_base.h
> > create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.c
> > create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.c
> > create mode 100644 drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.h
> >
> > diff --git a/drivers/target/Kbuild b/drivers/target/Kbuild
> > new file mode 100644
> > index 0000000..a997c81
> > --- /dev/null
> > +++ b/drivers/target/Kbuild
> > @@ -0,0 +1 @@
> > +obj-$(CONFIG_TCM_MVSAS_TGT) += tcm_mvsas_tgt/
> > diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
> > index 2fac3be..85dcc60 100644
> > --- a/drivers/target/Kconfig
> > +++ b/drivers/target/Kconfig
> > @@ -29,4 +29,6 @@ config TCM_PSCSI
> > Say Y here to enable the TCM/pSCSI subsystem plugin for non-buffered
> > passthrough access to Linux/SCSI device
> >
> > +source drivers/target/mvsas_tgt/Kconfig
> > +
> > endif
> > diff --git a/drivers/target/tcm_mvsas_tgt/Kbuild
> > b/drivers/target/tcm_mvsas_tgt/Kbuild
> > new file mode 100644
> > index 0000000..1c179d7
> > --- /dev/null
> > +++ b/drivers/target/tcm_mvsas_tgt/Kbuild
> > @@ -0,0 +1,3 @@
> > +tcm_mvsas_tgt-objs := tcm_mvsas_tgt_fabric.o \
> > + tcm_mvsas_tgt_configfs.o
> > +obj-$(CONFIG_TCM_MVSAS_TGT) += tcm_mvsas_tgt.o
>
> I think this fabric module was generated with an older version of
> Documentation/target/tcm_mod_builder.py, right..?
>
> After doing a quick 'tcm_mod_builder.py -m tcm_mvsas_tgt -p SAS' with
> mainline code, the newly generated tcm_mvsas_tgt.ko builds as expected..
>
> [nab@hera lio-core-2.6.git]$ make
> drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt.ko
> CHK include/linux/version.h
> CHK include/generated/utsrelease.h
> CALL scripts/checksyscalls.sh
> CC [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_fabric.o
> CC [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt_configfs.o
> LD [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt.o
> MODPOST 2 modules
> CC drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt.mod.o
> LD [M] drivers/target/tcm_mvsas_tgt/tcm_mvsas_tgt.ko
>
> The bit missing from the top of your Kbuild is:
>
> EXTRA_CFLAGS += -I$(srctree)/drivers/target/ -I$(srctree)/include/ -I$(srctree)/drivers/scsi/ -I$(srctree)/include/scsi/ -I$(srctree)/drivers/target/tcm_mvsas_tgt
>
> FYI, depending upon the age of the tcm_mod_builder.py in question , you
> may want to consider re-generating the fabric module skeleton with the
> latest code.
>
Hi again Fubo,
If you want to re-generate your driver, please make sure to grab the
patch for tcm_mod_builder.py merged into lio-core-2.6.git that
uses /Makefile instead of /Kbuild filenames here:
target: Convert tcm_mod_builder.py from Kbuild -> Makefile
http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=commitdiff;h=3103722a1cf759d475b9ecd9cdb0df523dbf09ab
Thanks!
--nab
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] target_core_mib.h move
2011-01-18 21:02 ` Nicholas A. Bellinger
@ 2011-01-22 14:49 ` Fubo Chen
2011-01-22 23:19 ` Nicholas A. Bellinger
0 siblings, 1 reply; 9+ messages in thread
From: Fubo Chen @ 2011-01-22 14:49 UTC (permalink / raw)
To: Nicholas A. Bellinger; +Cc: Christoph Hellwig, linux-scsi
On Tue, Jan 18, 2011 at 10:02 PM, Nicholas A. Bellinger
<nab@linux-iscsi.org> wrote:
>
> Hi again Fubo,
>
> If you want to re-generate your driver, please make sure to grab the
> patch for tcm_mod_builder.py merged into lio-core-2.6.git that
> uses /Makefile instead of /Kbuild filenames here:
>
> target: Convert tcm_mod_builder.py from Kbuild -> Makefile
> http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=commitdiff;h=3103722a1cf759d475b9ecd9cdb0df523dbf09ab
>
> Thanks!
>
> --nab
Thank You for all help !!
But why sparse confused ? I get this:
$ make C=2 M=drivers/target modules
CHECK drivers/target/target_core_configfs.c
drivers/target/target_core_configfs.c:3131:54: warning: Using plain
integer as NULL pointer
drivers/target/target_core_configfs.c:3145:50: warning: Using plain
integer as NULL pointer
drivers/target/target_core_configfs.c:3212:42: warning: Using plain
integer as NULL pointer
CC [M] drivers/target/target_core_configfs.o
CHECK drivers/target/target_core_device.c
drivers/target/target_core_device.c:354:5: warning: context imbalance
in 'core_update_device_list_for_node' - wrong count at exit
drivers/target/target_core_device.c:590:13: warning: context imbalance
in 'core_release_port' - unexpected unlock
drivers/target/target_core_device.c:800:36: warning: context imbalance
in 'se_clear_dev_ports' - unexpected unlock
CC [M] drivers/target/target_core_device.o
CHECK drivers/target/target_core_fabric_configfs.c
CC [M] drivers/target/target_core_fabric_configfs.o
CHECK drivers/target/target_core_fabric_lib.c
drivers/target/target_core_fabric_lib.c:47:4: warning: symbol
'sas_get_fabric_proto_ident' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:57:5: warning: symbol
'sas_get_pr_transport_id' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:88:5: warning: symbol
'sas_get_pr_transport_id_len' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:109:6: warning: symbol
'sas_parse_pr_out_transport_id' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:133:4: warning: symbol
'fc_get_fabric_proto_ident' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:139:5: warning: symbol
'fc_get_pr_transport_id_len' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:153:5: warning: symbol
'fc_get_pr_transport_id' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:190:6: warning: symbol
'fc_parse_pr_out_transport_id' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:212:4: warning: symbol
'iscsi_get_fabric_proto_ident' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:222:5: warning: symbol
'iscsi_get_pr_transport_id' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:318:5: warning: symbol
'iscsi_get_pr_transport_id_len' was not declared. Should it be static?
drivers/target/target_core_fabric_lib.c:364:6: warning: symbol
'iscsi_parse_pr_out_transport_id' was not declared. Should it be
static?
CC [M] drivers/target/target_core_fabric_lib.o
CHECK drivers/target/target_core_hba.c
CC [M] drivers/target/target_core_hba.o
CHECK drivers/target/target_core_pr.c
drivers/target/target_core_pr.c:2003:25: warning: incorrect type in
assignment (different address spaces)
drivers/target/target_core_pr.c:2003:25: expected void [noderef]
<asn:1>*iov_base
drivers/target/target_core_pr.c:2003:25: got unsigned char *
drivers/target/target_core_pr.c:2011:36: warning: incorrect type in
argument 2 (different address spaces)
drivers/target/target_core_pr.c:2011:36: expected struct iovec
const [noderef] <asn:1>*<noident>
drivers/target/target_core_pr.c:2011:36: got struct iovec *
CC [M] drivers/target/target_core_pr.o
CHECK drivers/target/target_core_alua.c
drivers/target/target_core_alua.c:647:25: warning: incorrect type in
assignment (different address spaces)
drivers/target/target_core_alua.c:647:25: expected void [noderef]
<asn:1>*iov_base
drivers/target/target_core_alua.c:647:25: got unsigned char *
drivers/target/target_core_alua.c:652:36: warning: incorrect type in
argument 2 (different address spaces)
drivers/target/target_core_alua.c:652:36: expected struct iovec
const [noderef] <asn:1>*<noident>
drivers/target/target_core_alua.c:652:36: got struct iovec *
CC [M] drivers/target/target_core_alua.o
CHECK drivers/target/target_core_scdb.c
CC [M] drivers/target/target_core_scdb.o
CHECK drivers/target/target_core_tmr.c
CC [M] drivers/target/target_core_tmr.o
CHECK drivers/target/target_core_tpg.c
CC [M] drivers/target/target_core_tpg.o
CHECK drivers/target/target_core_transport.c
drivers/target/target_core_transport.c:4373:12: warning: function
'transport_calc_sg_num' with external linkage has definition
drivers/target/target_core_transport.c:194:19: warning: symbol
'se_mem_cache' was not declared. Should it be static?
CC [M] drivers/target/target_core_transport.o
CHECK drivers/target/target_core_cdb.c
drivers/target/target_core_cdb.c:1030:1: warning: symbol
'transport_emulate_control_cdb' was not declared. Should it be static?
CC [M] drivers/target/target_core_cdb.o
CHECK drivers/target/target_core_ua.c
CC [M] drivers/target/target_core_ua.o
CHECK drivers/target/target_core_rd.c
CC [M] drivers/target/target_core_rd.o
CHECK drivers/target/target_core_mib.c
drivers/target/target_core_mib.c:70:13: warning: context imbalance in
'locate_hba_start' - wrong count at exit
drivers/target/target_core_mib.c:86:13: warning: context imbalance in
'locate_hba_stop' - unexpected unlock
drivers/target/target_core_mib.c:98:13: warning: context imbalance in
'scsi_inst_seq_start' - wrong count at exit
drivers/target/target_core_mib.c:114:13: warning: context imbalance in
'scsi_inst_seq_stop' - unexpected unlock
drivers/target/target_core_mib.c:577:13: warning: context imbalance in
'scsi_auth_intr_seq_start' - wrong count at exit
drivers/target/target_core_mib.c:589:13: warning: context imbalance in
'scsi_auth_intr_seq_stop' - unexpected unlock
drivers/target/target_core_mib.c:702:13: warning: context imbalance in
'scsi_att_intr_port_seq_start' - wrong count at exit
drivers/target/target_core_mib.c:714:13: warning: context imbalance in
'scsi_att_intr_port_seq_stop' - unexpected unlock
CC [M] drivers/target/target_core_mib.o
LD [M] drivers/target/target_core_mod.o
CHECK drivers/target/target_core_iblock.c
drivers/target/target_core_iblock.c:136:24: warning: Using plain
integer as NULL pointer
drivers/target/target_core_iblock.c:145:24: warning: Using plain
integer as NULL pointer
CC [M] drivers/target/target_core_iblock.o
CHECK drivers/target/target_core_file.c
drivers/target/target_core_file.c:144:25: warning: incorrect type in
argument 1 (different address spaces)
drivers/target/target_core_file.c:144:25: expected char const
[noderef] <asn:1>*<noident>
drivers/target/target_core_file.c:144:25: got unsigned char *<noident>
drivers/target/target_core_file.c:304:33: warning: incorrect type in
assignment (different address spaces)
drivers/target/target_core_file.c:304:33: expected void [noderef]
<asn:1>*iov_base
drivers/target/target_core_file.c:304:33: got void *
drivers/target/target_core_file.c:309:33: warning: incorrect type in
argument 2 (different address spaces)
drivers/target/target_core_file.c:309:33: expected struct iovec
const [noderef] <asn:1>*<noident>
drivers/target/target_core_file.c:309:33: got struct iovec *
drivers/target/target_core_file.c:354:33: warning: incorrect type in
assignment (different address spaces)
drivers/target/target_core_file.c:354:33: expected void [noderef]
<asn:1>*iov_base
drivers/target/target_core_file.c:354:33: got void *
drivers/target/target_core_file.c:359:34: warning: incorrect type in
argument 2 (different address spaces)
drivers/target/target_core_file.c:359:34: expected struct iovec
const [noderef] <asn:1>*<noident>
drivers/target/target_core_file.c:359:34: got struct iovec *
CC [M] drivers/target/target_core_file.o
CHECK drivers/target/target_core_pscsi.c
drivers/target/target_core_pscsi.c:453:17: warning: context imbalance
in 'pscsi_create_type_disk' - unexpected unlock
drivers/target/target_core_pscsi.c:499:17: warning: context imbalance
in 'pscsi_create_type_rom' - unexpected unlock
drivers/target/target_core_pscsi.c:521:25: warning: context imbalance
in 'pscsi_create_type_other' - unexpected unlock
drivers/target/target_core_pscsi.c:544:25: warning: context imbalance
in 'pscsi_create_virtdevice' - different lock contexts for basic block
CC [M] drivers/target/target_core_pscsi.o
Building modules, stage 2.
MODPOST 4 modules
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
CC drivers/target/target_core_file.mod.o
LD [M] drivers/target/target_core_file.ko
CC drivers/target/target_core_iblock.mod.o
LD [M] drivers/target/target_core_iblock.ko
LD [M] drivers/target/target_core_mod.ko
CC drivers/target/target_core_pscsi.mod.o
LD [M] drivers/target/target_core_pscsi.ko
My patch:
diff --git a/include/target/target_core_base.h
b/include/target/target_core_base.h
index 07fdfb6..4139bf0 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -225,7 +225,7 @@ struct t10_alua_lu_gp {
} ____cacheline_aligned;
struct t10_alua_lu_gp_member {
- int lu_gp_assoc:1;
+ int lu_gp_assoc;
atomic_t lu_gp_mem_ref_cnt;
spinlock_t lu_gp_mem_lock;
struct t10_alua_lu_gp *lu_gp;
@@ -257,7 +257,7 @@ struct t10_alua_tg_pt_gp {
} ____cacheline_aligned;
struct t10_alua_tg_pt_gp_member {
- int tg_pt_gp_assoc:1;
+ int tg_pt_gp_assoc;
atomic_t tg_pt_gp_mem_ref_cnt;
spinlock_t tg_pt_gp_mem_lock;
struct t10_alua_tg_pt_gp *tg_pt_gp;
@@ -322,7 +322,7 @@ struct t10_pr_registration {
int pr_res_type;
int pr_res_scope;
/* Used for fabric initiator WWPNs using a ISID */
- int isid_present_at_reg:1;
+ int isid_present_at_reg;
u32 pr_res_mapped_lun;
u32 pr_aptpl_target_lun;
u32 pr_res_generation;
@@ -404,7 +404,7 @@ struct se_transport_task {
unsigned long long t_task_lba;
int t_tasks_failed;
int t_tasks_fua;
- int t_tasks_bidi:1;
+ int t_tasks_bidi;
u32 t_task_cdbs;
u32 t_tasks_check;
u32 t_tasks_no;
@@ -456,7 +456,7 @@ struct se_task {
u8 task_flags;
int task_error_status;
int task_state_flags;
- int task_padded_sg:1;
+ int task_padded_sg;
unsigned long long task_lba;
u32 task_no;
u32 task_sectors;
@@ -569,7 +569,7 @@ struct se_ua {
struct se_node_acl {
char initiatorname[TRANSPORT_IQN_LEN];
/* Used to signal demo mode created ACL, disabled by default */
- int dynamic_node_acl:1;
+ int dynamic_node_acl;
u32 queue_depth;
u32 acl_index;
u64 num_cmds;
@@ -622,7 +622,7 @@ struct se_lun_acl {
} ____cacheline_aligned;
struct se_dev_entry {
- int def_pr_registered:1;
+ int def_pr_registered;
/* See transport_lunflags_table */
u32 lun_flags;
u32 deve_cmds;
diff --git a/include/target/target_core_fabric_ops.h
b/include/target/target_core_fabric_ops.h
index f3ac12b..997c45f 100644
--- a/include/target/target_core_fabric_ops.h
+++ b/include/target/target_core_fabric_ops.h
@@ -8,7 +8,7 @@ struct target_core_fabric_ops {
* for scatterlist chaining using transport_do_task_sg_link(),
* disabled by default
*/
- int task_sg_chaining:1;
+ int task_sg_chaining;
char *(*get_fabric_name)(void);
u8 (*get_fabric_proto_ident)(struct se_portal_group *);
char *(*tpg_get_wwn)(struct se_portal_group *);
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] target_core_mib.h move
2011-01-22 14:49 ` Fubo Chen
@ 2011-01-22 23:19 ` Nicholas A. Bellinger
0 siblings, 0 replies; 9+ messages in thread
From: Nicholas A. Bellinger @ 2011-01-22 23:19 UTC (permalink / raw)
To: Fubo Chen; +Cc: Christoph Hellwig, linux-scsi
On Sat, 2011-01-22 at 15:49 +0100, Fubo Chen wrote:
> On Tue, Jan 18, 2011 at 10:02 PM, Nicholas A. Bellinger
> <nab@linux-iscsi.org> wrote:
> >
> > Hi again Fubo,
> >
> > If you want to re-generate your driver, please make sure to grab the
> > patch for tcm_mod_builder.py merged into lio-core-2.6.git that
> > uses /Makefile instead of /Kbuild filenames here:
> >
> > target: Convert tcm_mod_builder.py from Kbuild -> Makefile
> > http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=commitdiff;h=3103722a1cf759d475b9ecd9cdb0df523dbf09ab
> >
> > Thanks!
> >
> > --nab
>
> Thank You for all help !!
>
> But why sparse confused ? I get this:
>
> $ make C=2 M=drivers/target modules
> CHECK drivers/target/target_core_configfs.c
> drivers/target/target_core_configfs.c:3131:54: warning: Using plain
> integer as NULL pointer
> drivers/target/target_core_configfs.c:3145:50: warning: Using plain
> integer as NULL pointer
> drivers/target/target_core_configfs.c:3212:42: warning: Using plain
> integer as NULL pointer
> CC [M] drivers/target/target_core_configfs.o
> CHECK drivers/target/target_core_device.c
> drivers/target/target_core_device.c:354:5: warning: context imbalance
> in 'core_update_device_list_for_node' - wrong count at exit
> drivers/target/target_core_device.c:590:13: warning: context imbalance
> in 'core_release_port' - unexpected unlock
> drivers/target/target_core_device.c:800:36: warning: context imbalance
> in 'se_clear_dev_ports' - unexpected unlock
> CC [M] drivers/target/target_core_device.o
> CHECK drivers/target/target_core_fabric_configfs.c
> CC [M] drivers/target/target_core_fabric_configfs.o
> CHECK drivers/target/target_core_fabric_lib.c
> drivers/target/target_core_fabric_lib.c:47:4: warning: symbol
> 'sas_get_fabric_proto_ident' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:57:5: warning: symbol
> 'sas_get_pr_transport_id' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:88:5: warning: symbol
> 'sas_get_pr_transport_id_len' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:109:6: warning: symbol
> 'sas_parse_pr_out_transport_id' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:133:4: warning: symbol
> 'fc_get_fabric_proto_ident' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:139:5: warning: symbol
> 'fc_get_pr_transport_id_len' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:153:5: warning: symbol
> 'fc_get_pr_transport_id' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:190:6: warning: symbol
> 'fc_parse_pr_out_transport_id' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:212:4: warning: symbol
> 'iscsi_get_fabric_proto_ident' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:222:5: warning: symbol
> 'iscsi_get_pr_transport_id' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:318:5: warning: symbol
> 'iscsi_get_pr_transport_id_len' was not declared. Should it be static?
> drivers/target/target_core_fabric_lib.c:364:6: warning: symbol
> 'iscsi_parse_pr_out_transport_id' was not declared. Should it be
> static?
> CC [M] drivers/target/target_core_fabric_lib.o
> CHECK drivers/target/target_core_hba.c
> CC [M] drivers/target/target_core_hba.o
> CHECK drivers/target/target_core_pr.c
> drivers/target/target_core_pr.c:2003:25: warning: incorrect type in
> assignment (different address spaces)
> drivers/target/target_core_pr.c:2003:25: expected void [noderef]
> <asn:1>*iov_base
> drivers/target/target_core_pr.c:2003:25: got unsigned char *
> drivers/target/target_core_pr.c:2011:36: warning: incorrect type in
> argument 2 (different address spaces)
> drivers/target/target_core_pr.c:2011:36: expected struct iovec
> const [noderef] <asn:1>*<noident>
> drivers/target/target_core_pr.c:2011:36: got struct iovec *
> CC [M] drivers/target/target_core_pr.o
> CHECK drivers/target/target_core_alua.c
> drivers/target/target_core_alua.c:647:25: warning: incorrect type in
> assignment (different address spaces)
> drivers/target/target_core_alua.c:647:25: expected void [noderef]
> <asn:1>*iov_base
> drivers/target/target_core_alua.c:647:25: got unsigned char *
> drivers/target/target_core_alua.c:652:36: warning: incorrect type in
> argument 2 (different address spaces)
> drivers/target/target_core_alua.c:652:36: expected struct iovec
> const [noderef] <asn:1>*<noident>
> drivers/target/target_core_alua.c:652:36: got struct iovec *
> CC [M] drivers/target/target_core_alua.o
> CHECK drivers/target/target_core_scdb.c
> CC [M] drivers/target/target_core_scdb.o
> CHECK drivers/target/target_core_tmr.c
> CC [M] drivers/target/target_core_tmr.o
> CHECK drivers/target/target_core_tpg.c
> CC [M] drivers/target/target_core_tpg.o
> CHECK drivers/target/target_core_transport.c
> drivers/target/target_core_transport.c:4373:12: warning: function
> 'transport_calc_sg_num' with external linkage has definition
> drivers/target/target_core_transport.c:194:19: warning: symbol
> 'se_mem_cache' was not declared. Should it be static?
> CC [M] drivers/target/target_core_transport.o
> CHECK drivers/target/target_core_cdb.c
> drivers/target/target_core_cdb.c:1030:1: warning: symbol
> 'transport_emulate_control_cdb' was not declared. Should it be static?
> CC [M] drivers/target/target_core_cdb.o
> CHECK drivers/target/target_core_ua.c
> CC [M] drivers/target/target_core_ua.o
> CHECK drivers/target/target_core_rd.c
> CC [M] drivers/target/target_core_rd.o
> CHECK drivers/target/target_core_mib.c
> drivers/target/target_core_mib.c:70:13: warning: context imbalance in
> 'locate_hba_start' - wrong count at exit
> drivers/target/target_core_mib.c:86:13: warning: context imbalance in
> 'locate_hba_stop' - unexpected unlock
> drivers/target/target_core_mib.c:98:13: warning: context imbalance in
> 'scsi_inst_seq_start' - wrong count at exit
> drivers/target/target_core_mib.c:114:13: warning: context imbalance in
> 'scsi_inst_seq_stop' - unexpected unlock
> drivers/target/target_core_mib.c:577:13: warning: context imbalance in
> 'scsi_auth_intr_seq_start' - wrong count at exit
> drivers/target/target_core_mib.c:589:13: warning: context imbalance in
> 'scsi_auth_intr_seq_stop' - unexpected unlock
> drivers/target/target_core_mib.c:702:13: warning: context imbalance in
> 'scsi_att_intr_port_seq_start' - wrong count at exit
> drivers/target/target_core_mib.c:714:13: warning: context imbalance in
> 'scsi_att_intr_port_seq_stop' - unexpected unlock
> CC [M] drivers/target/target_core_mib.o
> LD [M] drivers/target/target_core_mod.o
> CHECK drivers/target/target_core_iblock.c
> drivers/target/target_core_iblock.c:136:24: warning: Using plain
> integer as NULL pointer
> drivers/target/target_core_iblock.c:145:24: warning: Using plain
> integer as NULL pointer
> CC [M] drivers/target/target_core_iblock.o
> CHECK drivers/target/target_core_file.c
> drivers/target/target_core_file.c:144:25: warning: incorrect type in
> argument 1 (different address spaces)
> drivers/target/target_core_file.c:144:25: expected char const
> [noderef] <asn:1>*<noident>
> drivers/target/target_core_file.c:144:25: got unsigned char *<noident>
> drivers/target/target_core_file.c:304:33: warning: incorrect type in
> assignment (different address spaces)
> drivers/target/target_core_file.c:304:33: expected void [noderef]
> <asn:1>*iov_base
> drivers/target/target_core_file.c:304:33: got void *
> drivers/target/target_core_file.c:309:33: warning: incorrect type in
> argument 2 (different address spaces)
> drivers/target/target_core_file.c:309:33: expected struct iovec
> const [noderef] <asn:1>*<noident>
> drivers/target/target_core_file.c:309:33: got struct iovec *
> drivers/target/target_core_file.c:354:33: warning: incorrect type in
> assignment (different address spaces)
> drivers/target/target_core_file.c:354:33: expected void [noderef]
> <asn:1>*iov_base
> drivers/target/target_core_file.c:354:33: got void *
> drivers/target/target_core_file.c:359:34: warning: incorrect type in
> argument 2 (different address spaces)
> drivers/target/target_core_file.c:359:34: expected struct iovec
> const [noderef] <asn:1>*<noident>
> drivers/target/target_core_file.c:359:34: got struct iovec *
> CC [M] drivers/target/target_core_file.o
> CHECK drivers/target/target_core_pscsi.c
> drivers/target/target_core_pscsi.c:453:17: warning: context imbalance
> in 'pscsi_create_type_disk' - unexpected unlock
> drivers/target/target_core_pscsi.c:499:17: warning: context imbalance
> in 'pscsi_create_type_rom' - unexpected unlock
> drivers/target/target_core_pscsi.c:521:25: warning: context imbalance
> in 'pscsi_create_type_other' - unexpected unlock
> drivers/target/target_core_pscsi.c:544:25: warning: context imbalance
> in 'pscsi_create_virtdevice' - different lock contexts for basic block
> CC [M] drivers/target/target_core_pscsi.o
> Building modules, stage 2.
> MODPOST 4 modules
> WARNING: modpost: Found 1 section mismatch(es).
> To see full details build your kernel with:
> 'make CONFIG_DEBUG_SECTION_MISMATCH=y'
> CC drivers/target/target_core_file.mod.o
> LD [M] drivers/target/target_core_file.ko
> CC drivers/target/target_core_iblock.mod.o
> LD [M] drivers/target/target_core_iblock.ko
> LD [M] drivers/target/target_core_mod.ko
> CC drivers/target/target_core_pscsi.mod.o
> LD [M] drivers/target/target_core_pscsi.ko
>
>
>
Hi Fubo,
The patch to convert 'int var:1' to 'bool var:1' in target_core_base.h
and fix one of the specific sparse warning was commited from Dan
Carpenter into linus-38-rc1:
http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=commitdiff;h=daf0bd7aa57e14b903c81761b421e1130f12b7d1
While most of the other sparse warnings above appear to be false
positives AFAICT, there are additional two patches that have been pushed
into the new lio-core-2.6.git/linus-38-rc2, and will be hitting the list
shortly.
Thanks for your head-ups on the sparse fixes, and please let us know if
you see any other items that need to be considered.
Best Regards,
--nab
>
> My patch:
>
> diff --git a/include/target/target_core_base.h
> b/include/target/target_core_base.h
> index 07fdfb6..4139bf0 100644
> --- a/include/target/target_core_base.h
> +++ b/include/target/target_core_base.h
> @@ -225,7 +225,7 @@ struct t10_alua_lu_gp {
> } ____cacheline_aligned;
>
> struct t10_alua_lu_gp_member {
> - int lu_gp_assoc:1;
> + int lu_gp_assoc;
> atomic_t lu_gp_mem_ref_cnt;
> spinlock_t lu_gp_mem_lock;
> struct t10_alua_lu_gp *lu_gp;
> @@ -257,7 +257,7 @@ struct t10_alua_tg_pt_gp {
> } ____cacheline_aligned;
>
> struct t10_alua_tg_pt_gp_member {
> - int tg_pt_gp_assoc:1;
> + int tg_pt_gp_assoc;
> atomic_t tg_pt_gp_mem_ref_cnt;
> spinlock_t tg_pt_gp_mem_lock;
> struct t10_alua_tg_pt_gp *tg_pt_gp;
> @@ -322,7 +322,7 @@ struct t10_pr_registration {
> int pr_res_type;
> int pr_res_scope;
> /* Used for fabric initiator WWPNs using a ISID */
> - int isid_present_at_reg:1;
> + int isid_present_at_reg;
> u32 pr_res_mapped_lun;
> u32 pr_aptpl_target_lun;
> u32 pr_res_generation;
> @@ -404,7 +404,7 @@ struct se_transport_task {
> unsigned long long t_task_lba;
> int t_tasks_failed;
> int t_tasks_fua;
> - int t_tasks_bidi:1;
> + int t_tasks_bidi;
> u32 t_task_cdbs;
> u32 t_tasks_check;
> u32 t_tasks_no;
> @@ -456,7 +456,7 @@ struct se_task {
> u8 task_flags;
> int task_error_status;
> int task_state_flags;
> - int task_padded_sg:1;
> + int task_padded_sg;
> unsigned long long task_lba;
> u32 task_no;
> u32 task_sectors;
> @@ -569,7 +569,7 @@ struct se_ua {
> struct se_node_acl {
> char initiatorname[TRANSPORT_IQN_LEN];
> /* Used to signal demo mode created ACL, disabled by default */
> - int dynamic_node_acl:1;
> + int dynamic_node_acl;
> u32 queue_depth;
> u32 acl_index;
> u64 num_cmds;
> @@ -622,7 +622,7 @@ struct se_lun_acl {
> } ____cacheline_aligned;
>
> struct se_dev_entry {
> - int def_pr_registered:1;
> + int def_pr_registered;
> /* See transport_lunflags_table */
> u32 lun_flags;
> u32 deve_cmds;
> diff --git a/include/target/target_core_fabric_ops.h
> b/include/target/target_core_fabric_ops.h
> index f3ac12b..997c45f 100644
> --- a/include/target/target_core_fabric_ops.h
> +++ b/include/target/target_core_fabric_ops.h
> @@ -8,7 +8,7 @@ struct target_core_fabric_ops {
> * for scatterlist chaining using transport_do_task_sg_link(),
> * disabled by default
> */
> - int task_sg_chaining:1;
> + int task_sg_chaining;
> char *(*get_fabric_name)(void);
> u8 (*get_fabric_proto_ident)(struct se_portal_group *);
> char *(*tpg_get_wwn)(struct se_portal_group *);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-01-22 23:19 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-17 20:00 [PATCH] target_core_mib.h move Fubo Chen
2011-01-17 20:51 ` Christoph Hellwig
2011-01-17 22:32 ` Nicholas A. Bellinger
2011-01-18 16:58 ` Fubo Chen
2011-01-18 20:12 ` Nicholas A. Bellinger
2011-01-18 20:15 ` Christoph Hellwig
2011-01-18 21:02 ` Nicholas A. Bellinger
2011-01-22 14:49 ` Fubo Chen
2011-01-22 23:19 ` Nicholas A. Bellinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox