Re: [RFC_V4 PATCH 1/2] scsi_transport_iscsi: Add flash target mgmt support

2013-02-19 Thread Vikas Chaudhary


-Original Message-
From: Admin vikas.chaudh...@qlogic.com
Date: Friday 1 February 2013 10:11 AM
To: Mike Christie micha...@cs.wisc.edu, open-iscsi@googlegroups.com
open-iscsi@googlegroups.com
Cc: Lalit Chandivade lalit.chandiv...@qlogic.com, Ravi Anand
ravi.an...@qlogic.com, Poornima Vonti poornima.vo...@qlogic.com,
Manish Rangankar manish.rangan...@qlogic.com, Adheer Chandravanshi
adheer.chandravan...@qlogic.com
Subject: Re: [RFC_V4 PATCH 1/2] scsi_transport_iscsi: Add flash target
mgmt support


-Original Message-
From: Mike Christie micha...@cs.wisc.edu
Date: Monday 28 January 2013 4:47 PM
To: open-iscsi@googlegroups.com open-iscsi@googlegroups.com
Cc: Vikas vikas.chaudh...@qlogic.com, Lalit Chandivade
lalit.chandiv...@qlogic.com, Ravi Anand ravi.an...@qlogic.com,
Poornima Vonti poornima.vo...@qlogic.com, Manish Rangankar
manish.rangan...@qlogic.com, Adheer Chandravanshi
adheer.chandravan...@qlogic.com
Subject: Re: [RFC_V4 PATCH 1/2] scsi_transport_iscsi: Add flash target
mgmt support

On 01/11/2013 05:50 AM, vikas.chaudh...@qlogic.com wrote:
 From: Adheer Chandravanshi adheer.chandravan...@qlogic.com

 This patch allows iscsiadm to manage iSCSI target information stored on
 adapter flash on per host basis.

 The sysfs entries will look as cited below:
 /sys/class/iscsi_flash_tgt/tgt-host_no-target_no/

 Signed-off-by: Adheer Chandravanshi adheer.chandravan...@qlogic.com
 Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
 ---
  drivers/scsi/scsi_transport_iscsi.c |  690
++-
  include/scsi/iscsi_if.h |  106 ++
  include/scsi/scsi_transport_iscsi.h |   35 ++
  3 files changed, 830 insertions(+), 1 deletions(-)

 diff --git a/drivers/scsi/scsi_transport_iscsi.c
b/drivers/scsi/scsi_transport_iscsi.c
 index dac7f8d..028f2c3 100644
 --- a/drivers/scsi/scsi_transport_iscsi.c
 +++ b/drivers/scsi/scsi_transport_iscsi.c
 @@ -25,6 +25,7 @@
  #include linux/slab.h
  #include linux/bsg-lib.h
  #include linux/idr.h
 +#include linux/list.h
  #include net/tcp.h
  #include scsi/scsi.h
  #include scsi/scsi_host.h
 @@ -460,6 +461,431 @@ void iscsi_destroy_iface(struct iscsi_iface
*iface)
  EXPORT_SYMBOL_GPL(iscsi_destroy_iface);

  /*
 + * Interface to display flash tgt params to sysfs
 + */
 +
 +static void iscsi_flash_tgt_release(struct device *dev)
 +{
 +   struct iscsi_flash_tgt *tgt = iscsi_dev_to_flash_tgt(dev);
 +   struct device *parent = tgt-dev.parent;
 +
 +   kfree(tgt);
 +   put_device(parent);
 +}
 +
 +
 +static struct class iscsi_flash_tgt_class = {
 +   .name = iscsi_flash_tgt,
 +   .dev_release = iscsi_flash_tgt_release,
 +};
 +


I guess we are supposed to be using buses now. See the recent fcoe
discussions and the code that got merged.

Ok. We will submit next RFC patch using buses.

Mike,

We are sending following RFC_V5 patches in next emails.

As per your suggestion we have made following major changes from RFC_V4 to
RFC_V5,
1. Exporting flash target data in /sys/bus/iscsi_flashnode/*
2. Session and connection params are exported separatly

/sys/bus/iscsi_flashnode/devices/flashnode_sess-host_no:flashnode_id/
session attrs

/sys/bus/iscsi_flashnode/devices/flashnode_conn-host_no:flashnode_id:
conn_id/conn attrs
3. Modified iscsiadm code to accept multiple params.
4. Update operation directly writes to flash. Apply operation is removed.

Kernel Patches:-
Adheer Chandravanshi (3):
scsi_transport_iscsi: Add flash node mgmt support
libiscsi: export function iscsi_switch_str_param
qla4xxx: Add flash node mgmt support

Open-iscsi Patch:-
iscsiadm: Add flash node mgmt support.


Thanks,
Vikas.




This message and any attached documents contain information from QLogic 
Corporation or its wholly-owned subsidiaries that may be confidential. If you 
are not the intended recipient, you may not read, copy, distribute, or use this 
information. If you have received this transmission in error, please notify the 
sender immediately by reply e-mail and then delete this message.

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [RFC_V4 PATCH 1/2] scsi_transport_iscsi: Add flash target mgmt support

2013-02-04 Thread Mike Christie
On 01/31/2013 10:41 PM, Vikas Chaudhary wrote:
 +
 +#define iscsi_flash_tgt_attr(type, name, param)
  \
 +iscsi_flash_tgt_attr_show(type, name, param)\
 +static ISCSI_FLASHTGT_ATTR(type, name, S_IRUGO,
  \
 +show_##type##_##name, NULL);
 +
 +/* Target attributes */
 +
 +iscsi_flash_tgt_attr(tgt, is_fw_assigned_ipv6,
 + ISCSI_FLASHTGT_IS_FW_ASSIGNED_IPV6);


 Could you give me more info on this one? I saw on the follow on pathc it
 mentions link local ipv6 addrs. Can the card have multiple link local
 ipv6 addrs some are assigned my fw and some are assigned by the driver?
 
 No, only single link local IPv6 address is supported at a time.
 This flag indicate if the address is assigned by FW or driver.



 +iscsi_flash_tgt_attr(tgt, max_segment_size,
 ISCSI_FLASHTGT_MAX_SEGMENT_SIZE);
 +iscsi_flash_tgt_attr(tgt, local_port, ISCSI_FLASHTGT_LOCAL_PORT);

 So why is the port printed but not the local ipaddress? It is due to how
 your card supports addresses right?

 I think we want a link to the iface. Is that not possible?

 
 This will not be relevant when the target entry is in the flash.
 This is here just for placeholder and not running copy.

Ah ok. So that is why above for is_fw_assigned_ipv6 we have it on that
fw tgt instead on the iface right? Ok then.


Eddie, for bnx2i do you know what we want? We want to match a target
with some host/iface side networking info right?




 


 +iscsi_flash_tgt_attr(tgt, discovery_parent,
 ISCSI_FLASHTGT_DISCOVERY_PARENT);

 Could you make this print out a string like send_targets and 'isns?

 
 This can be send_target entries index as well. For ISNS it would be a hex
 number like 0xFFFDh

Is 0xFFFDh a qlogic specific value or does it have some spec
reference/meaning?

I think this might be too specific for your fw. Other drivers would want
to export how something was discovered but for isns returning 0xFFFDh
seems like a qlogic specific value.

Could you break it up into type and index?

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [RFC_V4 PATCH 1/2] scsi_transport_iscsi: Add flash target mgmt support

2013-02-04 Thread Eddie Wai

On Mon, 2013-02-04 at 13:06 -0600, Mike Christie wrote:
 On 01/31/2013 10:41 PM, Vikas Chaudhary wrote:
  +
  +#define iscsi_flash_tgt_attr(type, name, param)  
 \
  +iscsi_flash_tgt_attr_show(type, name, param)\
  +static ISCSI_FLASHTGT_ATTR(type, name, S_IRUGO,  
 \
  +show_##type##_##name, NULL);
  +
  +/* Target attributes */
  +
  +iscsi_flash_tgt_attr(tgt, is_fw_assigned_ipv6,
  + ISCSI_FLASHTGT_IS_FW_ASSIGNED_IPV6);
 
 
  Could you give me more info on this one? I saw on the follow on pathc it
  mentions link local ipv6 addrs. Can the card have multiple link local
  ipv6 addrs some are assigned my fw and some are assigned by the driver?
  
  No, only single link local IPv6 address is supported at a time.
  This flag indicate if the address is assigned by FW or driver.
 
 
 
  +iscsi_flash_tgt_attr(tgt, max_segment_size,
  ISCSI_FLASHTGT_MAX_SEGMENT_SIZE);
  +iscsi_flash_tgt_attr(tgt, local_port, ISCSI_FLASHTGT_LOCAL_PORT);
 
  So why is the port printed but not the local ipaddress? It is due to how
  your card supports addresses right?
 
  I think we want a link to the iface. Is that not possible?
 
  
  This will not be relevant when the target entry is in the flash.
  This is here just for placeholder and not running copy.
 
 Ah ok. So that is why above for is_fw_assigned_ipv6 we have it on that
 fw tgt instead on the iface right? Ok then.
 
 
 Eddie, for bnx2i do you know what we want? We want to match a target
 with some host/iface side networking info right?
 
Yes, for bnx2i, our plan is to create corresponding (or symlink to)
initiator net sysfs entries which is also found in the flash.  Each of
these initiator net entries will hold parameters like AF_NET family, IP,
subnet (prefix len), gateway (router), vlan ID, etc for the HBA.

Upon a connection request to these persistent targets, the corresponding
initiator net entry will get fetched by iscsid and create iface entries
out of it for the connection request.

Thanks.
 
 
 
  
 
 
  +iscsi_flash_tgt_attr(tgt, discovery_parent,
  ISCSI_FLASHTGT_DISCOVERY_PARENT);
 
  Could you make this print out a string like send_targets and 'isns?
 
  
  This can be send_target entries index as well. For ISNS it would be a hex
  number like 0xFFFDh
 
 Is 0xFFFDh a qlogic specific value or does it have some spec
 reference/meaning?
 
 I think this might be too specific for your fw. Other drivers would want
 to export how something was discovered but for isns returning 0xFFFDh
 seems like a qlogic specific value.
 
 Could you break it up into type and index?
 


-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [RFC_V4 PATCH 1/2] scsi_transport_iscsi: Add flash target mgmt support

2013-01-31 Thread Vikas Chaudhary

-Original Message-
From: Mike Christie micha...@cs.wisc.edu
Date: Monday 28 January 2013 4:47 PM
To: open-iscsi@googlegroups.com open-iscsi@googlegroups.com
Cc: Vikas vikas.chaudh...@qlogic.com, Lalit Chandivade
lalit.chandiv...@qlogic.com, Ravi Anand ravi.an...@qlogic.com,
Poornima Vonti poornima.vo...@qlogic.com, Manish Rangankar
manish.rangan...@qlogic.com, Adheer Chandravanshi
adheer.chandravan...@qlogic.com
Subject: Re: [RFC_V4 PATCH 1/2] scsi_transport_iscsi: Add flash target
mgmt support

On 01/11/2013 05:50 AM, vikas.chaudh...@qlogic.com wrote:
 From: Adheer Chandravanshi adheer.chandravan...@qlogic.com

 This patch allows iscsiadm to manage iSCSI target information stored on
 adapter flash on per host basis.

 The sysfs entries will look as cited below:
 /sys/class/iscsi_flash_tgt/tgt-host_no-target_no/

 Signed-off-by: Adheer Chandravanshi adheer.chandravan...@qlogic.com
 Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
 ---
  drivers/scsi/scsi_transport_iscsi.c |  690
++-
  include/scsi/iscsi_if.h |  106 ++
  include/scsi/scsi_transport_iscsi.h |   35 ++
  3 files changed, 830 insertions(+), 1 deletions(-)

 diff --git a/drivers/scsi/scsi_transport_iscsi.c
b/drivers/scsi/scsi_transport_iscsi.c
 index dac7f8d..028f2c3 100644
 --- a/drivers/scsi/scsi_transport_iscsi.c
 +++ b/drivers/scsi/scsi_transport_iscsi.c
 @@ -25,6 +25,7 @@
  #include linux/slab.h
  #include linux/bsg-lib.h
  #include linux/idr.h
 +#include linux/list.h
  #include net/tcp.h
  #include scsi/scsi.h
  #include scsi/scsi_host.h
 @@ -460,6 +461,431 @@ void iscsi_destroy_iface(struct iscsi_iface
*iface)
  EXPORT_SYMBOL_GPL(iscsi_destroy_iface);

  /*
 + * Interface to display flash tgt params to sysfs
 + */
 +
 +static void iscsi_flash_tgt_release(struct device *dev)
 +{
 +struct iscsi_flash_tgt *tgt = iscsi_dev_to_flash_tgt(dev);
 +struct device *parent = tgt-dev.parent;
 +
 +kfree(tgt);
 +put_device(parent);
 +}
 +
 +
 +static struct class iscsi_flash_tgt_class = {
 +.name = iscsi_flash_tgt,
 +.dev_release = iscsi_flash_tgt_release,
 +};
 +


I guess we are supposed to be using buses now. See the recent fcoe
discussions and the code that got merged.

Ok. We will submit next RFC patch using buses.



 +#define ISCSI_FLASHTGT_ATTR(_prefix, _name, _mode, _show, _store)   \
 +struct device_attribute dev_attr_##_prefix##_##_name =  
 \
 +__ATTR(_name, _mode, _show, _store)
 +
 +/* flash tgt attrs show */
 +#define iscsi_flash_tgt_attr_show(type, name, param)
 \
 +static ssize_t  
 \
 +show_##type##_##name(struct device *dev, struct device_attribute
*attr,\
 + char *buf) \
 +{   \
 +struct iscsi_flash_tgt *tgt = iscsi_dev_to_flash_tgt(dev);  \
 +struct iscsi_transport *t = tgt-transport; \
 +return t-get_flash_tgt_param(tgt, param, buf); \
 +}   \
 +
 +
 +#define iscsi_flash_tgt_attr(type, name, param) 
 \
 +iscsi_flash_tgt_attr_show(type, name, param)\
 +static ISCSI_FLASHTGT_ATTR(type, name, S_IRUGO, 
 \
 +show_##type##_##name, NULL);
 +
 +/* Target attributes */
 +
 +iscsi_flash_tgt_attr(tgt, is_fw_assigned_ipv6,
 + ISCSI_FLASHTGT_IS_FW_ASSIGNED_IPV6);


Could you give me more info on this one? I saw on the follow on pathc it
mentions link local ipv6 addrs. Can the card have multiple link local
ipv6 addrs some are assigned my fw and some are assigned by the driver?

No, only single link local IPv6 address is supported at a time.
This flag indicate if the address is assigned by FW or driver.




 +iscsi_flash_tgt_attr(tgt, dev_type, ISCSI_FLASHTGT_DEV_TYPE);


Could you rename to portal addr type or something like that so it is
clear it is for the portal address.

Yes.



 +iscsi_flash_tgt_attr(tgt, dif, ISCSI_FLASHTGT_DIF_EN);
 +iscsi_flash_tgt_attr(tgt, auto_snd_tgt_disable,
 + ISCSI_FLASHTGT_AUTO_SND_TGT_DISABLE);
 +iscsi_flash_tgt_attr(tgt, discovery_session,
ISCSI_FLASHTGT_DISCOVERY_SESS);

This indicates if it is discovery session vs normal session right? Could
we rename to session_type?

Yes.



 +iscsi_flash_tgt_attr(tgt, entry_enable, ISCSI_FLASHTGT_ENTRY_EN);
 +iscsi_flash_tgt_attr(tgt, dev_assoc_target,
ISCSI_FLASHTGT_DEV_ASSOC_TARGET);
 +iscsi_flash_tgt_attr(tgt, dev_assoc_initiator,
 + ISCSI_FLASHTGT_DEV_ASSOC_INITIATOR);

I did not get this. In the iscsi spec can we discover initiators like
how with FC we can see initiator and target ports? Is this for iSNS?
Does it work such that iSNS in fw, will discovery initaitor and target

Re: [RFC_V4 PATCH 1/2] scsi_transport_iscsi: Add flash target mgmt support

2013-01-28 Thread Mike Christie
On 01/11/2013 05:50 AM, vikas.chaudh...@qlogic.com wrote:
 From: Adheer Chandravanshi adheer.chandravan...@qlogic.com
 
 This patch allows iscsiadm to manage iSCSI target information stored on
 adapter flash on per host basis.
 
 The sysfs entries will look as cited below:
 /sys/class/iscsi_flash_tgt/tgt-host_no-target_no/
 
 Signed-off-by: Adheer Chandravanshi adheer.chandravan...@qlogic.com
 Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
 ---
  drivers/scsi/scsi_transport_iscsi.c |  690 
 ++-
  include/scsi/iscsi_if.h |  106 ++
  include/scsi/scsi_transport_iscsi.h |   35 ++
  3 files changed, 830 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/scsi/scsi_transport_iscsi.c 
 b/drivers/scsi/scsi_transport_iscsi.c
 index dac7f8d..028f2c3 100644
 --- a/drivers/scsi/scsi_transport_iscsi.c
 +++ b/drivers/scsi/scsi_transport_iscsi.c
 @@ -25,6 +25,7 @@
  #include linux/slab.h
  #include linux/bsg-lib.h
  #include linux/idr.h
 +#include linux/list.h
  #include net/tcp.h
  #include scsi/scsi.h
  #include scsi/scsi_host.h
 @@ -460,6 +461,431 @@ void iscsi_destroy_iface(struct iscsi_iface *iface)
  EXPORT_SYMBOL_GPL(iscsi_destroy_iface);
  
  /*
 + * Interface to display flash tgt params to sysfs
 + */
 +
 +static void iscsi_flash_tgt_release(struct device *dev)
 +{
 + struct iscsi_flash_tgt *tgt = iscsi_dev_to_flash_tgt(dev);
 + struct device *parent = tgt-dev.parent;
 +
 + kfree(tgt);
 + put_device(parent);
 +}
 +
 +
 +static struct class iscsi_flash_tgt_class = {
 + .name = iscsi_flash_tgt,
 + .dev_release = iscsi_flash_tgt_release,
 +};
 +


I guess we are supposed to be using buses now. See the recent fcoe
discussions and the code that got merged.


 +#define ISCSI_FLASHTGT_ATTR(_prefix, _name, _mode, _show, _store)\
 +struct device_attribute dev_attr_##_prefix##_##_name =   
 \
 + __ATTR(_name, _mode, _show, _store)
 +
 +/* flash tgt attrs show */
 +#define iscsi_flash_tgt_attr_show(type, name, param) \
 +static ssize_t   
 \
 +show_##type##_##name(struct device *dev, struct device_attribute *attr,  
 \
 +  char *buf) \
 +{\
 + struct iscsi_flash_tgt *tgt = iscsi_dev_to_flash_tgt(dev);  \
 + struct iscsi_transport *t = tgt-transport; \
 + return t-get_flash_tgt_param(tgt, param, buf); \
 +}\
 +
 +
 +#define iscsi_flash_tgt_attr(type, name, param)  
 \
 + iscsi_flash_tgt_attr_show(type, name, param)\
 +static ISCSI_FLASHTGT_ATTR(type, name, S_IRUGO,  
 \
 + show_##type##_##name, NULL);
 +
 +/* Target attributes */
 +
 +iscsi_flash_tgt_attr(tgt, is_fw_assigned_ipv6,
 +  ISCSI_FLASHTGT_IS_FW_ASSIGNED_IPV6);


Could you give me more info on this one? I saw on the follow on pathc it
mentions link local ipv6 addrs. Can the card have multiple link local
ipv6 addrs some are assigned my fw and some are assigned by the driver?


 +iscsi_flash_tgt_attr(tgt, dev_type, ISCSI_FLASHTGT_DEV_TYPE);


Could you rename to portal addr type or something like that so it is
clear it is for the portal address.


 +iscsi_flash_tgt_attr(tgt, dif, ISCSI_FLASHTGT_DIF_EN);
 +iscsi_flash_tgt_attr(tgt, auto_snd_tgt_disable,
 +  ISCSI_FLASHTGT_AUTO_SND_TGT_DISABLE);
 +iscsi_flash_tgt_attr(tgt, discovery_session, ISCSI_FLASHTGT_DISCOVERY_SESS);

This indicates if it is discovery session vs normal session right? Could
we rename to session_type?


 +iscsi_flash_tgt_attr(tgt, entry_enable, ISCSI_FLASHTGT_ENTRY_EN);
 +iscsi_flash_tgt_attr(tgt, dev_assoc_target, ISCSI_FLASHTGT_DEV_ASSOC_TARGET);
 +iscsi_flash_tgt_attr(tgt, dev_assoc_initiator,
 +  ISCSI_FLASHTGT_DEV_ASSOC_INITIATOR);

I did not get this. In the iscsi spec can we discover initiators like
how with FC we can see initiator and target ports? Is this for iSNS?
Does it work such that iSNS in fw, will discovery initaitor and target
nodes and they can be exported in this flash tgt mgmt interface?

Can we rename to node_type?

Also then, do we want to rename all of this to flash_node/FLASHNODE
instead of flash_tgt?

 +iscsi_flash_tgt_attr(tgt, exec_throttle, ISCSI_FLASHTGT_EXEC_THROTTLE);

Is this scsi commands or all types of iscsi pdus? So scsi commands with
say something like nops?

If it is the limit of all iscsi and scsi commands combined, can we
rename to cmds_max so it matches the libiscsi/iscsid/iscsiadm name?

If it is the limit of just the scsi commands, can we rename to can_queue
so it matches the scsi layer setting name.


 +iscsi_flash_tgt_attr(tgt, exec_count, ISCSI_FLASHTGT_EXEC_COUNT);

I 

[RFC_V4 PATCH 1/2] scsi_transport_iscsi: Add flash target mgmt support

2013-01-11 Thread vikas . chaudhary
From: Adheer Chandravanshi adheer.chandravan...@qlogic.com

This patch allows iscsiadm to manage iSCSI target information stored on
adapter flash on per host basis.

The sysfs entries will look as cited below:
/sys/class/iscsi_flash_tgt/tgt-host_no-target_no/

Signed-off-by: Adheer Chandravanshi adheer.chandravan...@qlogic.com
Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
---
 drivers/scsi/scsi_transport_iscsi.c |  690 ++-
 include/scsi/iscsi_if.h |  106 ++
 include/scsi/scsi_transport_iscsi.h |   35 ++
 3 files changed, 830 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index dac7f8d..028f2c3 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -25,6 +25,7 @@
 #include linux/slab.h
 #include linux/bsg-lib.h
 #include linux/idr.h
+#include linux/list.h
 #include net/tcp.h
 #include scsi/scsi.h
 #include scsi/scsi_host.h
@@ -460,6 +461,431 @@ void iscsi_destroy_iface(struct iscsi_iface *iface)
 EXPORT_SYMBOL_GPL(iscsi_destroy_iface);
 
 /*
+ * Interface to display flash tgt params to sysfs
+ */
+
+static void iscsi_flash_tgt_release(struct device *dev)
+{
+   struct iscsi_flash_tgt *tgt = iscsi_dev_to_flash_tgt(dev);
+   struct device *parent = tgt-dev.parent;
+
+   kfree(tgt);
+   put_device(parent);
+}
+
+
+static struct class iscsi_flash_tgt_class = {
+   .name = iscsi_flash_tgt,
+   .dev_release = iscsi_flash_tgt_release,
+};
+
+#define ISCSI_FLASHTGT_ATTR(_prefix, _name, _mode, _show, _store)  \
+struct device_attribute dev_attr_##_prefix##_##_name = \
+   __ATTR(_name, _mode, _show, _store)
+
+/* flash tgt attrs show */
+#define iscsi_flash_tgt_attr_show(type, name, param)   \
+static ssize_t \
+show_##type##_##name(struct device *dev, struct device_attribute *attr,
\
+char *buf) \
+{  \
+   struct iscsi_flash_tgt *tgt = iscsi_dev_to_flash_tgt(dev);  \
+   struct iscsi_transport *t = tgt-transport; \
+   return t-get_flash_tgt_param(tgt, param, buf); \
+}  \
+
+
+#define iscsi_flash_tgt_attr(type, name, param)
\
+   iscsi_flash_tgt_attr_show(type, name, param)\
+static ISCSI_FLASHTGT_ATTR(type, name, S_IRUGO,
\
+   show_##type##_##name, NULL);
+
+/* Target attributes */
+
+iscsi_flash_tgt_attr(tgt, is_fw_assigned_ipv6,
+ISCSI_FLASHTGT_IS_FW_ASSIGNED_IPV6);
+iscsi_flash_tgt_attr(tgt, dev_type, ISCSI_FLASHTGT_DEV_TYPE);
+iscsi_flash_tgt_attr(tgt, dif, ISCSI_FLASHTGT_DIF_EN);
+iscsi_flash_tgt_attr(tgt, auto_snd_tgt_disable,
+ISCSI_FLASHTGT_AUTO_SND_TGT_DISABLE);
+iscsi_flash_tgt_attr(tgt, discovery_session, ISCSI_FLASHTGT_DISCOVERY_SESS);
+iscsi_flash_tgt_attr(tgt, entry_enable, ISCSI_FLASHTGT_ENTRY_EN);
+iscsi_flash_tgt_attr(tgt, dev_assoc_target, ISCSI_FLASHTGT_DEV_ASSOC_TARGET);
+iscsi_flash_tgt_attr(tgt, dev_assoc_initiator,
+ISCSI_FLASHTGT_DEV_ASSOC_INITIATOR);
+iscsi_flash_tgt_attr(tgt, exec_throttle, ISCSI_FLASHTGT_EXEC_THROTTLE);
+iscsi_flash_tgt_attr(tgt, exec_count, ISCSI_FLASHTGT_EXEC_COUNT);
+iscsi_flash_tgt_attr(tgt, retry_count, ISCSI_FLASHTGT_RETRY_COUNT);
+iscsi_flash_tgt_attr(tgt, retry_delay, ISCSI_FLASHTGT_RETRY_DELAY);
+iscsi_flash_tgt_attr(tgt, header_digest, ISCSI_FLASHTGT_HDR_DGST_EN);
+iscsi_flash_tgt_attr(tgt, data_digest, ISCSI_FLASHTGT_DATA_DGST_EN);
+iscsi_flash_tgt_attr(tgt, immediate_data, ISCSI_FLASHTGT_IMM_DATA_EN);
+iscsi_flash_tgt_attr(tgt, initial_r2t, ISCSI_FLASHTGT_INITIAL_R2T_EN);
+iscsi_flash_tgt_attr(tgt, data_seq_in_order, ISCSI_FLASHTGT_DATASEQ_INORDER);
+iscsi_flash_tgt_attr(tgt, data_pdu_in_order, ISCSI_FLASHTGT_PDU_INORDER);
+iscsi_flash_tgt_attr(tgt, chap_auth, ISCSI_FLASHTGT_CHAP_AUTH_EN);
+iscsi_flash_tgt_attr(tgt, snack_req, ISCSI_FLASHTGT_SNACK_REQ_EN);
+iscsi_flash_tgt_attr(tgt, discovery_logout,
+ISCSI_FLASHTGT_DISCOVERY_LOGOUT_EN);
+iscsi_flash_tgt_attr(tgt, bidi_chap, ISCSI_FLASHTGT_BIDI_CHAP_EN);
+iscsi_flash_tgt_attr(tgt, discovery_auth_optional,
+ISCSI_FLASHTGT_DISCOVERY_AUTH_OPTIONAL);
+iscsi_flash_tgt_attr(tgt, erl, ISCSI_FLASHTGT_ERL);
+iscsi_flash_tgt_attr(tgt, tcp_timestamp_stat,
+ISCSI_FLASHTGT_TCP_TIMESTAMP_STAT);
+iscsi_flash_tgt_attr(tgt, tcp_nagle_disable, ISCSI_FLASHTGT_TCP_NAGLE_DISABLE);
+iscsi_flash_tgt_attr(tgt, tcp_wsf_disable, ISCSI_FLASHTGT_TCP_WSF_DISABLE);
+iscsi_flash_tgt_attr(tgt, tcp_timer_scale, ISCSI_FLASHTGT_TCP_TIMER_SCALE);
+iscsi_flash_tgt_attr(tgt,