Re: [PATCH] iscsiuio: Fix lookup of IPv6 router address

2015-05-22 Thread Eddie Wai
Hi,

Don't mind if I chime in.  From the upstream code, the patch looks good.
Just curious at who the caller for that might be?

Eddie

On Fri, 2015-05-22 at 10:48 -0500, Mike Christie wrote:
 CCing qlogic.
 
 Which one of you guys is watching over iscsiuio?
 
 
 On 5/21/15, 4:12 AM, Johannes Thumshirn wrote:
  Gnetle ping on this
 
  On Mon, May 11, 2015 at 01:38:12PM +0200, Johannes Thumshirn wrote:
  When iscsiuio performs a lookup in it's routing table
  for the default router, nothing is returned as ndpc_request()
  didn't understand the 'GET_DEFAULT_ROUTER_ADDR' request.
  The solution is to add the request and return the default router
  address.
 
  Signed-off-by: Johannes Thumshirn jthumsh...@suse.de
  ---
iscsiuio/src/uip/ipv6_ndpc.c | 3 +++
1 file changed, 3 insertions(+)
 
  diff --git a/iscsiuio/src/uip/ipv6_ndpc.c b/iscsiuio/src/uip/ipv6_ndpc.c
  index 62d1c21..8422d7e 100644
  --- a/iscsiuio/src/uip/ipv6_ndpc.c
  +++ b/iscsiuio/src/uip/ipv6_ndpc.c
  @@ -413,6 +413,9 @@ int ndpc_request(struct uip_stack *ustack, void *in, 
  void *out, int request)
 (struct ipv6_addr *)((struct ndpc_reqptr *)in)-ipv6,
 (struct mac_address *)((struct ndpc_reqptr *)in)-eth);
 break;
  +  case GET_DEFAULT_ROUTER_ADDR:
  +  ipv6_get_default_router_ip_addrs(ipv6c, *(struct ipv6_addr 
  **)out);
  +  break;
 case GET_HOST_ADDR:
 *(struct ipv6_addr **)out = ipv6_find_longest_match(ipv6c,
 (struct ipv6_addr *)in);
  --
  2.3.7
 
 
 


-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [PATCH 5/5] iscsiuio systemd socket activation support

2015-01-12 Thread Eddie Wai
I'm surprised that this change hasn't made it upstream yet.  I worked on
it back when and here's my ACK for it.  Thanks for the patch again,
Chris.

acked-by: Eddie Wai eddie@broadcom.com

Eddie

On Mon, 2015-01-12 at 11:24 -0800, Chris Leech wrote:
 Signed-off-by: Chris Leech cle...@redhat.com
 ---
  iscsiuio/src/unix/iscsid_ipc.c | 28 
  1 file changed, 28 insertions(+)
 
 diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
 index 4a89ec2..3e92d90 100644
 --- a/iscsiuio/src/unix/iscsid_ipc.c
 +++ b/iscsiuio/src/unix/iscsid_ipc.c
 @@ -953,6 +953,30 @@ static void *iscsid_loop(void *arg)
   pthread_exit(NULL);
  }
  
 +#define SD_SOCKET_FDS_START 3
 +
 +static int ipc_systemd(void)
 +{
 + char *env;
 +
 + env = getenv(LISTEN_PID);
 +
 + if (!env || (strtoul(env, NULL, 10) != getpid()))
 + return -EINVAL;
 +
 + env = getenv(LISTEN_FDS);
 +
 + if (!env)
 + return -EINVAL;
 +
 + if (strtoul(env, NULL, 10) != 1) {
 + LOG_ERR(Did not receive exactly one IPC socket from systemd);
 + return -EINVAL;
 + }
 +
 + return SD_SOCKET_FDS_START;
 +}
 +
  
 /**
   *  Initialize/Cleanup routines
   
 **/
 @@ -966,6 +990,10 @@ int iscsid_init()
   int rc, addr_len;
   struct sockaddr_un addr;
  
 + iscsid_opts.fd = ipc_systemd();
 + if (iscsid_opts.fd = 0)
 + return 0;
 +
   iscsid_opts.fd = socket(AF_LOCAL, SOCK_STREAM, 0);
   if (iscsid_opts.fd  0) {
   LOG_ERR(PFX Can not create IPC socket);
 -- 
 2.1.0
 


-- 
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.
For more options, visit https://groups.google.com/d/optout.


[PATCH] ISCSIUIO: Fixed a pthread resc leak from excessive session recovery

2014-02-26 Thread Eddie Wai
A pthread resource leak was discovered in the ongoing pthread
creation code during the session recovery process.  These pthreads
were erroneously created as joinable instead of having the intended
detached attribute.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 iscsiuio/RELEASE.TXT   |   12 
 iscsiuio/src/unix/iscsid_ipc.c |   26 +-
 iscsiuio/src/unix/main.c   |5 -
 iscsiuio/src/unix/nic.c|   23 ++-
 iscsiuio/src/unix/nic_utils.c  |5 -
 5 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/iscsiuio/RELEASE.TXT b/iscsiuio/RELEASE.TXT
index 22628fd..48feedd 100644
--- a/iscsiuio/RELEASE.TXT
+++ b/iscsiuio/RELEASE.TXT
@@ -10,6 +10,18 @@
Copyright (c) 2004 - 2013 Broadcom Corporation
All rights reserved
 
+uIP v0.7.10.2 (Feb 12, 2014)
+===
+   Fixes
+   -
+   1. Problem: Cont00072504 - ifconfig shows allocation failure after
+   up/down few hours with iSCSI + L2 traffic
+  Cause:   A memory leak was discovered in the ongoing pthread creation
+   destruction code during the connection recovery process
+  Change:  Fixed the pthread creation code
+  Impact:  All
+
+
 uIP v0.7.8.2 (Dec 10, 2013)
 ===
Fixes
diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
index 033308d..0b9b18c 100644
--- a/iscsiuio/src/unix/iscsid_ipc.c
+++ b/iscsiuio/src/unix/iscsid_ipc.c
@@ -334,9 +334,9 @@ static int parse_iface(void *arg)
char ipv6_buf_str[INET6_ADDRSTRLEN];
int request_type = 0;
struct iface_rec *rec;
-   void *res;
struct iface_rec_decode ird;
struct in_addr src_match, dst_match;
+   pthread_attr_t attr;
 
data = (iscsid_uip_broadcast_t *) arg;
rec = data-u.iface_rec.rec;
@@ -594,7 +594,9 @@ static int parse_iface(void *arg)
 
nic_iface-flags |= NIC_IFACE_PATHREQ_WAIT1;
if (nic-nl_process_thread == INVALID_THREAD) {
-   rc = pthread_create(nic-nl_process_thread, NULL,
+   pthread_attr_init(attr);
+   pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED);
+   rc = pthread_create(nic-nl_process_thread, attr,
nl_process_handle_thread, nic);
if (rc != 0) {
LOG_ERR(PFX %s: Could not create NIC NL 
@@ -745,14 +747,16 @@ enable_nic:
case NIC_STOPPED:
/* This thread will be thrown away when completed */
if (nic-enable_thread != INVALID_THREAD) {
-   rc = pthread_join(nic-enable_thread, res);
+   rc = pthread_cancel(nic-enable_thread);
if (rc != 0) {
-   LOG_INFO(PFX %s: failed joining enable NIC 
+   LOG_INFO(PFX %s: failed to cancel enable NIC 
 thread\n, nic-log_name);
goto eagain;
}
}
-   rc = pthread_create(nic-enable_thread, NULL,
+   pthread_attr_init(attr);
+   pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED);
+   rc = pthread_create(nic-enable_thread, attr,
enable_nic_thread, (void *)nic);
if (rc != 0)
LOG_WARN(PFX %s: failed starting enable NIC thread\n,
@@ -1001,9 +1005,12 @@ error:
  */
 int iscsid_start()
 {
+   pthread_attr_t attr;
int rc;
 
-   rc = pthread_create(iscsid_opts.thread, NULL, iscsid_loop, NULL);
+   pthread_attr_init(attr);
+   pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED);
+   rc = pthread_create(iscsid_opts.thread, attr, iscsid_loop, NULL);
if (rc != 0) {
LOG_ERR(PFX Could not start iscsid listening thread rc=%d,
rc);
@@ -1026,7 +1033,6 @@ error:
 void iscsid_cleanup()
 {
int rc;
-   void *res;
 
if (iscsid_opts.fd != INVALID_FD) {
rc = pthread_cancel(iscsid_opts.thread);
@@ -1034,12 +1040,6 @@ void iscsid_cleanup()
LOG_ERR(Could not cancel iscsid listening thread: %s,
strerror(rc));
}
-
-   rc = pthread_join(iscsid_opts.thread, res);
-   if (rc != 0) {
-   LOG_ERR(Could not wait for the iscsid listening 
-   thread: %s, strerror(rc));
-   }
}
 
LOG_INFO(PFX iscsid listening thread has shutdown);
diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c
index 340e275..e33db04 100644
--- a/iscsiuio/src/unix/main.c
+++ b/iscsiuio/src/unix/main.c
@@ -237,6 +237,7 @@ int main(int

Re: [PATCHv2 0/3] iscsiuio: Update autoconf

2014-01-29 Thread Eddie Wai
The patchset works great on my system.  Forcing an autoreconf and
untrack all autogen files makes sense.  Thanks for the work.

Although I would be more inclined to put all .gitignore entries into a
single .gitignore file in the trunk, separating them out is fine too.

Acked-by:  Eddie Wai eddie@broadcom.com


On Wed, 2014-01-29 at 09:27 +0100, Hannes Reinecke wrote:
 Hi Eddie,
 
 as discussed here is a patchset to remove the auto-generated
 files from tracking. And I've updated the autoconf files so
 the current autoreconf doesn't complain.
 
 The first version actually had an error here, so that
 autoconf wouldn't install all required files. That's
 fixed now. And I've added .gitignore files so that
 the autogenerated files won't show up anymore.
 
 Please note I've attached the patches as a tarball;
 I've found that sending them via 'git send-email'
 leads to corruption due to mime-encoding as the
 original files have binary ^M embedded. Bah.
 
 Hannes Reinecke (3):
   iscsiuio: Remove autogenerated files from tracking
   iscsiuio: Update automake files
   iscsiuio: Add .gitignore files
 
 -- 
 Dr. Hannes Reinecke zSeries  Storage
 h...@suse.de+49 911 74053 688
 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
 GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
 


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[PATCH 2/5] ISCSIUIO: Added fix for the iface.subnet_mask decoding for IPv6

2013-12-11 Thread Eddie Wai
Fixed a inet_pton decode error for the iface.subnet_mask for IPv6.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 iscsiuio/src/unix/iscsid_ipc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
index e22de0d..033308d 100644
--- a/iscsiuio/src/unix/iscsid_ipc.c
+++ b/iscsiuio/src/unix/iscsid_ipc.c
@@ -274,7 +274,7 @@ static int decode_iface(struct iface_rec_decode *ird, 
struct iface_rec *rec)
   sizeof(struct in6_addr));
/* Subnet mask priority: CIDR, then rec */
if (!ird-ipv6_subnet_mask.s6_addr)
-   inet_pton(AF_INET, rec-subnet_mask,
+   inet_pton(AF_INET6, rec-subnet_mask,
  ird-ipv6_subnet_mask);
 
/* For LL on, ignore the IPv6 addr in the iface */
-- 
1.7.1

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[PATCH 4/5] ISCSIUIO: Updated RELEASE note and version

2013-12-11 Thread Eddie Wai
old version: 0.7.8.1b
new version: 0.7.8.2

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 iscsiuio/README  |4 ++--
 iscsiuio/RELEASE.TXT |   24 ++--
 iscsiuio/configure.ac|4 ++--
 iscsiuio/docs/iscsiuio.8 |2 +-
 4 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/iscsiuio/README b/iscsiuio/README
index e7e5fe4..a283116 100644
--- a/iscsiuio/README
+++ b/iscsiuio/README
@@ -1,6 +1,6 @@
 Iscsiuio Userspace Tool
-Version 0.7.8.1b
-May 01, 2013
+Version 0.7.8.2
+Dec 10, 2013
 --
 
 This tool is to be used in conjunction with the Broadcom NetXtreme II Linux
diff --git a/iscsiuio/RELEASE.TXT b/iscsiuio/RELEASE.TXT
index de70667..22628fd 100644
--- a/iscsiuio/RELEASE.TXT
+++ b/iscsiuio/RELEASE.TXT
@@ -1,7 +1,7 @@
   Release Notes
 Broadcom uIP Linux Driver
-Version 0.7.8.1b
-   05/01/2013
+Version 0.7.8.2
+   12/10/2013
 
   Broadcom Corporation
  5300 California Avenue,
@@ -10,6 +10,26 @@
Copyright (c) 2004 - 2013 Broadcom Corporation
All rights reserved
 
+uIP v0.7.8.2 (Dec 10, 2013)
+===
+   Fixes
+   -
+   1. Problem: Cont00072053 - Some hardware iSCSI paths fail during test
+  Cause:   The test exercised a corner case where the ARP cache flush
+   mechanism didn't work properly
+  Change:  Fixed the ARP cache flush mechanism
+  Impact:  All
+
+   Enhancements
+   
+   1. Change:  Added a new tx doorbell field in the uio path to work with
+   the new bnx2x/cnic drivers that supports VF_RSS
+  Impact:  10G only
+
+   2. Change:  Fixed the iface.subnet_mask decoding for IPv6
+  Impact:  IPv6
+
+
 uIP v0.7.8.1b (May 01, 2013)
 ===
Enhancements
diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac
index e9a5e32..381b94d 100644
--- a/iscsiuio/configure.ac
+++ b/iscsiuio/configure.ac
@@ -11,9 +11,9 @@ dnl Benjamin Li  (be...@broadcom.com)
 dnl
 
 PACKAGE=iscsiuio
-VERSION=0.7.8.1b
+VERSION=0.7.8.2
 
-AC_INIT(iscsiuio, 0.7.8.1b, eddie@broadcom.com)
+AC_INIT(iscsiuio, 0.7.8.2, eddie@broadcom.com)
 
 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
 AC_CONFIG_HEADER(config.h)
diff --git a/iscsiuio/docs/iscsiuio.8 b/iscsiuio/docs/iscsiuio.8
index ea21d78..3b50409 100644
--- a/iscsiuio/docs/iscsiuio.8
+++ b/iscsiuio/docs/iscsiuio.8
@@ -5,7 +5,7 @@
 .\
 .\ bnx2.4,v 0.7.8.1b
 .\
-.TH iscsiuio 8 05/01/2013 Broadcom Corporation
+.TH iscsiuio 8 12/10/2013 Broadcom Corporation
 .\
 .\ NAME part
 .\
-- 
1.7.1

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[PATCH 3/5] ISCSIUIO: Added fix for the ARP cache flush mechanism

2013-12-11 Thread Eddie Wai
The ARP cache table wasn't being flushed correctly due to a bug
in the time stamp comparison.  The same bug can also be observed
to find the oldest entry in the ARP cache table to override.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 iscsiuio/src/uip/uip_arp.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/iscsiuio/src/uip/uip_arp.c b/iscsiuio/src/uip/uip_arp.c
index f7a9594..a8de07f 100644
--- a/iscsiuio/src/uip/uip_arp.c
+++ b/iscsiuio/src/uip/uip_arp.c
@@ -112,7 +112,7 @@ void uip_arp_timer(void)
for (i = 0; i  UIP_ARPTAB_SIZE; ++i) {
tabptr = arp_table[i];
if ((tabptr-ipaddr[0] | tabptr-ipaddr[1]) != 0 
-   arptime - tabptr-time = UIP_ARP_MAXAGE)
+   (u8_t)(arptime - tabptr-time) = UIP_ARP_MAXAGE)
memset(tabptr-ipaddr, 0, 4);
}
 
@@ -165,8 +165,8 @@ static void uip_arp_update(u16_t *ipaddr, struct 
uip_eth_addr *ethaddr)
c = 0;
for (i = 0; i  UIP_ARPTAB_SIZE; ++i) {
tabptr = arp_table[i];
-   if (arptime - tabptr-time  tmpage) {
-   tmpage = arptime - tabptr-time;
+   if ((u8_t)(arptime - tabptr-time)  tmpage) {
+   tmpage = (u8_t)(arptime - tabptr-time);
c = i;
}
}
-- 
1.7.1

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[PATCH 0/5] ISCSIUIO patchset for various fixes

2013-12-11 Thread Eddie Wai
This iscsiuio patchset includes various bug fixes.  The version
has also been bumped from 0.7.8.1b to 0.7.8.2.  Thanks.


Eddie Wai (5):
  ISCSIUIO: Added tx doorbell override mechanism
  ISCSIUIO: Added fix for the iface.subnet_mask decoding for IPv6
  ISCSIUIO: Added fix for the ARP cache flush mechanism
  ISCSIUIO: Updated RELEASE note and version
  ISCSIUIO: Updated the configure file to reflect the new version

 iscsiuio/README|4 +-
 iscsiuio/RELEASE.TXT   |   24 +-
 iscsiuio/configure |11348 +++-
 iscsiuio/configure.ac  |4 +-
 iscsiuio/docs/iscsiuio.8   |2 +-
 iscsiuio/src/uip/uip_arp.c |6 +-
 iscsiuio/src/unix/iscsid_ipc.c |2 +-
 iscsiuio/src/unix/libs/bnx2x.c |   13 +-
 iscsiuio/src/unix/libs/bnx2x.h |9 +-
 9 files changed, 6475 insertions(+), 4937 deletions(-)

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[PATCH 1/5] ISCSIUIO: Added tx doorbell override mechanism

2013-12-11 Thread Eddie Wai
Added a new tx doorbell field in the uio path to work with new
bnx2x/cnic drivers that supports VF_RSS.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 iscsiuio/src/unix/libs/bnx2x.c |   13 ++---
 iscsiuio/src/unix/libs/bnx2x.h |9 -
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c
index 36fc48e..748b59d 100644
--- a/iscsiuio/src/unix/libs/bnx2x.c
+++ b/iscsiuio/src/unix/libs/bnx2x.c
@@ -900,8 +900,14 @@ static int bnx2x_open(nic_t *nic)
struct client_init_general_data *data = bp-bufs;
 
bp-client_id = data-client_id;
-   if (data-reserved0)
-   bp-cid = data-reserved0;
+   if (data-uid.cid)
+   bp-cid = data-uid.cid;
+   if (bp-version.minor = 78  bp-version.sub_minor = 55 
+   data-uid.cid_override_key == UIO_USE_TX_DOORBELL) {
+   bp-tx_doorbell = data-uid.tx_db_off;
+   LOG_INFO(PFX %s: tx doorbell override offset = 0x%x,
+nic-log_name, bp-tx_doorbell);
+   }
}
 
LOG_INFO(PFX %s: func 0x%x, pfid 0x%x, client_id 0x%x, cid 0x%x,
@@ -928,7 +934,8 @@ static int bnx2x_open(nic_t *nic)
 USTORM_RX_PRODS_E2_OFFSET(cl_qzone_id) :
 USTORM_RX_PRODS_E1X_OFFSET(bp-port, bp-client_id));
 
-   bp-tx_doorbell = bp-cid * 0x80 + 0x40;
+   if (!bp-tx_doorbell)
+   bp-tx_doorbell = bp-cid * 0x80 + 0x40;
 
bp-get_rx_cons = bnx2x_get_rx_60;
bp-get_tx_cons = bnx2x_get_tx_60;
diff --git a/iscsiuio/src/unix/libs/bnx2x.h b/iscsiuio/src/unix/libs/bnx2x.h
index 0b74e44..ce55cfc 100644
--- a/iscsiuio/src/unix/libs/bnx2x.h
+++ b/iscsiuio/src/unix/libs/bnx2x.h
@@ -382,6 +382,13 @@ union eth_rx_cqe_70 {
struct eth_rx_cqe_next_page_70 next_page_cqe_70;
 };
 
+struct uio_init_data {
+   __u32 cid;
+   __u32 tx_db_off;
+   __u32 cid_override_key;
+#define UIO_USE_TX_DOORBELL0x017855DB
+};
+
 struct client_init_general_data {
__u8 client_id;
__u8 statistics_counter_id;
@@ -394,7 +401,7 @@ struct client_init_general_data {
__u8 func_id;
__u8 cos;
__u8 traffic_type;
-   __u32 reserved0;
+   struct uio_init_data uid;
 };
 
 /**
-- 
1.7.1

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [PATCH v5 1/3] ISCSISTART: Saved ibft boot info to the session sysfs

2013-08-25 Thread Eddie Wai
On Sun, 2013-08-25 at 13:24 +0300, Or Gerlitz wrote:
 On 24/08/2013 00:04, Eddie Wai wrote:
  diff --git a/include/iscsi_if.h b/include/iscsi_if.h
  index 20f2bc2..b47dde7 100644
  --- a/include/iscsi_if.h
  +++ b/include/iscsi_if.h
  @@ -495,6 +495,10 @@ enum iscsi_param {

  ISCSI_PARAM_TGT_RESET_TMO,
  ISCSI_PARAM_TARGET_ALIAS,
  +
  +   ISCSI_PARAM_BOOT_ROOT,
  +   ISCSI_PARAM_BOOT_NIC,
  +   ISCSI_PARAM_BOOT_TARGET,
  /* must always be last */
  ISCSI_PARAM_MAX,
};
 
 This is inconsistent with the kernel iscsi_if.h as of James for-next 
 branch, you missed the CHAP thing

Thanks for reviewing, Or.  This is a new rev of 6 month old patchset so
its no surprise that there are obsolete components by now.  I was merely
re-sending it to inquire about the status.  I can rev this up to reflect
current component changes if it helps.  Thanks.
 
  ISCSI_PARAM_TGT_RESET_TMO,
  ISCSI_PARAM_TARGET_ALIAS,
 
  ISCSI_PARAM_CHAP_IN_IDX,
  ISCSI_PARAM_CHAP_OUT_IDX,
 
  ISCSI_PARAM_BOOT_ROOT,
  ISCSI_PARAM_BOOT_NIC,
  ISCSI_PARAM_BOOT_TARGET,
 
  ISCSI_PARAM_AUTO_SND_TGT_DISABLE,
  ISCSI_PARAM_DISCOVERY_SESS,
 
 



-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[PATCH v5 2/3] ISCSID: Added the extraction of the session boot info

2013-08-23 Thread Eddie Wai
This patch does the work to extract the corresponding
boot_root-ethernetN net params as specified from the kernel
session boot_nic sysfs entry based on the transport param
use_boot_info.

This is only populated for iscsi_tcp and bnx2i.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsi_sysfs.c |   40 
 usr/transport.c   |2 ++
 usr/transport.h   |1 +
 3 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index aed10a3..56cb90c 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -674,6 +674,43 @@ free_fnode:
return rc;
 }
 
+static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
+{
+   char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
+   char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
+
+   /* Extract boot info */
+   strlcpy(boot_name, boot_target, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
+ boot_content, BOOT_NAME_MAXLEN))
+   return -1;
+   strlcpy(boot_name, boot_nic, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
+ BOOT_NAME_MAXLEN))
+   return -1;
+   strlcpy(boot_name, boot_root, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
+ BOOT_NAME_MAXLEN))
+   return -1;
+
+   /* If all boot_root/boot_target/boot_nic exist, then extract the
+  info from the boot nic */
+   if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
+ BOOT_NAME_MAXLEN))
+   log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
+   else
+   iface-vlan_id = atoi(boot_content);
+
+   if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
+ iface-subnet_mask, NI_MAXHOST))
+   log_debug(5, could not read %s/%s/subnet, boot_root,
+ boot_nic);
+
+   log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
+ boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
+   return 0;
+}
+
 /*
  * Read in iface settings based on host and session values. If
  * session is not passed in, then the ifacename will not be set. And
@@ -802,6 +839,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, 
int host_no,
}
}
 
+   if (session  t-template-use_boot_info)
+   iscsi_sysfs_read_boot(iface, session);
+
if (!iface_kern_id)
goto done;
 
diff --git a/usr/transport.c b/usr/transport.c
index 52b7674..4d030a8 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -42,6 +42,7 @@
 
 struct iscsi_transport_template iscsi_tcp = {
.name   = tcp,
+   .use_boot_info  = 1,
.ep_connect = iscsi_io_tcp_connect,
.ep_poll= iscsi_io_tcp_poll,
.ep_disconnect  = iscsi_io_tcp_disconnect,
@@ -77,6 +78,7 @@ struct iscsi_transport_template cxgb4i = {
 struct iscsi_transport_template bnx2i = {
.name   = bnx2i,
.set_host_ip= 1,
+   .use_boot_info  = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll= ktransport_ep_poll,
.ep_disconnect  = ktransport_ep_disconnect,
diff --git a/usr/transport.h b/usr/transport.h
index 5dcf872..388e4b1 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -31,6 +31,7 @@ struct iscsi_transport_template {
 * the host's ip address.
 */
uint8_t set_host_ip;
+   uint8_t use_boot_info;
int (*ep_connect) (struct iscsi_conn *conn, int non_blocking);
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
void (*ep_disconnect) (struct iscsi_conn *conn);
-- 
1.7.1


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[PATCH v5 3/3] ISCSID: Added iface content override fix

2013-08-23 Thread Eddie Wai
Patch provided by Mike Christie.

This patch fixes the unconditional overwrite of the iface struct
even when the corresponding iface info from the node config was
found and extracted.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsid.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/usr/iscsid.c b/usr/iscsid.c
index 8f19220..d1756ef 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -111,9 +111,7 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct 
session_info *info)
strlcpy(rec-name, info-targetname, TARGET_NAME_MAXLEN);
rec-conn[0].port = info-persistent_port;
strlcpy(rec-conn[0].address, info-persistent_address, NI_MAXHOST);
-   memcpy(rec-iface, info-iface, sizeof(struct iface_rec));
rec-tpgt = info-tpgt;
-   iface_copy(rec-iface, info-iface);
 
iscsi_sysfs_get_negotiated_session_conf(info-sid, session_conf);
iscsi_sysfs_get_negotiated_conn_conf(info-sid, conn_conf);
@@ -238,6 +236,7 @@ static int sync_session(void *data, struct session_info 
*info)
log_warning(Could not read data from db. Using default and 
currently negotiated values\n);
setup_rec_from_negotiated_values(rec, info);
+   iface_copy(rec.iface, info-iface);
} else {
/*
 * we have a valid record and iface so lets merge
@@ -251,13 +250,12 @@ static int sync_session(void *data, struct session_info 
*info)
memset(sysfsrec, 0, sizeof(node_rec_t));
setup_rec_from_negotiated_values(sysfsrec, info);
/*
-* target, portal and iface name values have to be the same
+* target, portal and iface values have to be the same
 * or we would not have found the record, so just copy
-* CHAP and iface settings.
+* CHAP settings.
 */
memcpy(rec.session.auth, sysfsrec.session.auth,
  sizeof(struct iscsi_auth_config));
-   memcpy(rec.iface, info-iface, sizeof(rec.iface));
}
 
/* multiple drivers could be connected to the same portal */
-- 
1.7.1


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[PATCH v5 1/3] ISCSISTART: Saved ibft boot info to the session sysfs

2013-08-23 Thread Eddie Wai
Three new session sysfs parameters are introduced:
boot_root   - holds the ibft boot root folder name
boot_nic- holds the ibft boot ethernetN name
boot_target - holds the ibft boot targetN name

This patch copies over the /sys/firmware/boot_root/ethernetN/targetN info
from the boot context to the node_rec.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 include/fw_context.h   |3 +++
 include/iscsi_if.h |4 
 include/iscsi_proto.h  |1 +
 usr/config.h   |3 +++
 usr/idbm.c |6 ++
 usr/initiator_common.c |   14 +-
 utils/fwparam_ibft/fwparam_sysfs.c |8 
 7 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/include/fw_context.h b/include/fw_context.h
index 1640859..6563d68 100644
--- a/include/fw_context.h
+++ b/include/fw_context.h
@@ -30,6 +30,9 @@
 
 struct boot_context {
struct list_head list;
+   char boot_root[BOOT_NAME_MAXLEN];
+   char boot_nic[BOOT_NAME_MAXLEN];
+   char boot_target[BOOT_NAME_MAXLEN];
 
/* target settings */
int target_port;
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 20f2bc2..b47dde7 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -495,6 +495,10 @@ enum iscsi_param {
 
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
+
+   ISCSI_PARAM_BOOT_ROOT,
+   ISCSI_PARAM_BOOT_NIC,
+   ISCSI_PARAM_BOOT_TARGET,
/* must always be last */
ISCSI_PARAM_MAX,
 };
diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h
index 1c69feb..56f757b 100644
--- a/include/iscsi_proto.h
+++ b/include/iscsi_proto.h
@@ -619,6 +619,7 @@ struct iscsi_reject {
 #define KEY_MAXLEN 64
 #define VALUE_MAXLEN   255
 #define TARGET_NAME_MAXLEN VALUE_MAXLEN
+#define BOOT_NAME_MAXLEN   256
 
 #define ISCSI_DEF_MAX_RECV_SEG_LEN 8192
 #define ISCSI_MIN_MAX_RECV_SEG_LEN 512
diff --git a/usr/config.h b/usr/config.h
index 998caff..d457bdd 100644
--- a/usr/config.h
+++ b/usr/config.h
@@ -201,6 +201,9 @@ typedef struct session_rec {
 * allowed to be initiated on this record
 */
unsigned char   multiple;
+   charboot_root[BOOT_NAME_MAXLEN];
+   charboot_nic[BOOT_NAME_MAXLEN];
+   charboot_target[BOOT_NAME_MAXLEN];
 } session_rec_t;
 
 #define ISCSI_TRANSPORT_NAME_MAXLEN 16
diff --git a/usr/idbm.c b/usr/idbm.c
index bc06058..1e4f8c8 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2748,6 +2748,12 @@ struct node_rec 
*idbm_create_rec_from_boot_context(struct boot_context *context)
strlen((char *)context-chap_password);
rec-session.auth.password_in_length =
strlen((char *)context-chap_password_in);
+   strlcpy(rec-session.boot_root, context-boot_root,
+   sizeof(context-boot_root));
+   strlcpy(rec-session.boot_nic, context-boot_nic,
+   sizeof(context-boot_nic));
+   strlcpy(rec-session.boot_target, context-boot_target,
+   sizeof(context-boot_target));
 
iface_setup_from_boot_context(rec-iface, context);
 
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index eb72795..544d637 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -324,7 +324,7 @@ int iscsi_host_set_params(struct iscsi_session *session)
return 0;
 }
 
-#define MAX_SESSION_PARAMS 32
+#define MAX_SESSION_PARAMS 35
 
 int iscsi_session_set_params(struct iscsi_conn *conn)
 {
@@ -496,6 +496,18 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.param = ISCSI_PARAM_INITIATOR_NAME,
.value = session-initiator_name,
.type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_ROOT,
+   .value = session-nrec.session.boot_root,
+   .type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_NIC,
+   .value = session-nrec.session.boot_nic,
+   .type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_TARGET,
+   .value = session-nrec.session.boot_target,
+   .type = ISCSI_STRING,
},
};
 
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c 
b/utils/fwparam_ibft/fwparam_sysfs.c
index 3997363..2f37b59 100644
--- a/utils/fwparam_ibft/fwparam_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
@@ -200,6 +200,9 @@ static int fill_nic_context(char *subsys, char *id,
strlcpy(context-scsi_host_name, subsys,
sizeof(context-scsi_host_name));
 
+   memset(context-boot_nic, 0, sizeof(context

[PATCH v5 0/3] ISCSITOOLS: Patchset to add the extraction of

2013-08-23 Thread Eddie Wai
Version 5:
- Added fix for when the session is NULL before calling read_boot

Version 4:
- Added transport switch 'use_boot_info' to enable the overriding of
  the session's iface param with the boot_info or not.  This is only
  populated for iscsi_tcp and bnx2i so far.

Version 3:
- Added support for ISCSI_LLD_ROOT support as well
- Removed the 'boot_initiator' param because its not useful
- Added the 'boot_root' param to hold the 'ibft' or 'iscsi_root'N name to
  support non-ibft sessions
- Moved the boot_nic net param extraction out of the iscsi_sysfs_read_iface
  routine because it can affect iscsiadm iface config printouts

Version 2:
- Added boot_initiator to hold the ibft initiator name
- Added boot_targetN to hold the corresponding ibft target name
- Moved the boot_nic net param extraction to the iscsi_sysfs_read_iface
  routine
- Added extra check before eluding to use the boot_nic info

For the case when iscsid is invoked for the first time after pivot root
during iSCSI boot, the boot connection would fail to re-connect if the
ibft/iscsi_boot sysfs entry contains tagged vlan.

The problem was caused by the lack of such info in the iscsi_session sysfs
for sync_session to inherit from.

The enclosed patchset does the following:
1. Extract and save the ibft-ethernetN name to the boot_context-boot_nic
2. Pass the boot_nic info to be saved to the sessionN sysfs
3. Extract the sessionN boot_nic sysfs info and retrieve the corresponding
   net params

This 'boot_nic' kernel session sysfs entry will only be present for ibft
boot.  Corresponding kernel drivers will have to add the ISCSI_PARAM_BOOT_NIC
attribute to its attr_is_visible table.

The last patch provides the fix for the unconditional overwrite of the
iface struct even after the ibft net info was already extracted.


Eddie Wai (3):
  ISCSISTART: Saved ibft boot info to the session sysfs
  ISCSID: Added the extraction of the session boot info
  ISCSID: Added iface content override fix

 include/fw_context.h   |3 ++
 include/iscsi_if.h |4 +++
 include/iscsi_proto.h  |1 +
 usr/config.h   |3 ++
 usr/idbm.c |6 +
 usr/initiator_common.c |   14 +++-
 usr/iscsi_sysfs.c  |   40 
 usr/iscsid.c   |8 ++
 usr/transport.c|2 +
 usr/transport.h|1 +
 utils/fwparam_ibft/fwparam_sysfs.c |8 +++
 11 files changed, 84 insertions(+), 6 deletions(-)


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [PATCH v4 2/3] ISCSID: Added the extraction of the session boot info

2013-08-23 Thread Eddie Wai
Hello Mike,

I just notice that this patch hasn't been included yet for open-iscsi
while the corresponding kernel component already has.  So do we still
have concerns over the enclosed patchset?

I had to spin this to version 5 as a bug as found in the enclosed patch
as-is.  

Thanks,
Eddie

On Tue, 2013-05-28 at 12:13 -0500, Mike Christie wrote:
 On 05/28/2013 12:07 PM, Eddie Wai wrote:
  
  On Tue, 2013-05-28 at 04:05 -0500, Mike Christie wrote:
  On 04/12/2013 12:41 PM, Eddie Wai wrote:
  This patch does the work to extract the corresponding
  boot_root-ethernetN net params as specified from the kernel
  session boot_nic sysfs entry based on the transport param
  use_boot_info.
 
  This is only populated for iscsi_tcp and bnx2i.
 
  Signed-off-by: Eddie Wai eddie@broadcom.com
  ---
   usr/iscsi_sysfs.c |   40 
   usr/transport.c   |2 ++
   usr/transport.h   |1 +
   3 files changed, 43 insertions(+), 0 deletions(-)
 
  diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
  index 4015b35..91c3989 100644
  --- a/usr/iscsi_sysfs.c
  +++ b/usr/iscsi_sysfs.c
  @@ -439,6 +439,43 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct 
  iface_rec *iface, int *rc)
return host_no;
   }
   
  +static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
  +{
  + char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
  + char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
  +
  + /* Extract boot info */
  + strlcpy(boot_name, boot_target, sizeof(boot_name));
  + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
  +   boot_content, BOOT_NAME_MAXLEN))
  + return -1;
  + strlcpy(boot_name, boot_nic, sizeof(boot_name));
  + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
  +   BOOT_NAME_MAXLEN))
  + return -1;
  + strlcpy(boot_name, boot_root, sizeof(boot_name));
  + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
  +   BOOT_NAME_MAXLEN))
  + return -1;
  +
  + /* If all boot_root/boot_target/boot_nic exist, then extract the
  +info from the boot nic */
  + if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
  +   BOOT_NAME_MAXLEN))
  + log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
  + else
  + iface-vlan_id = atoi(boot_content);
  +
  + if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
  +   iface-subnet_mask, NI_MAXHOST))
  + log_debug(5, could not read %s/%s/subnet, boot_root,
  +   boot_nic);
  +
  + log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
  +   boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
  + return 0;
  +}
  +
   /*
* Read in iface settings based on host and session values. If
* session is not passed in, then the ifacename will not be set. And
  @@ -567,6 +604,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec 
  *iface, int host_no,
}
}
   
  + if (t-template-use_boot_info)
  + iscsi_sysfs_read_boot(iface, session);
  +
 
  I forgot what we were saying for this. For the running boot session is
  it possible to change the network settings while the session is running?
  If so then this would print the old info (info used for boot that might
  not be currently used) right? Was this ok?
  I'm not sure if this applies to iscsi_tcp or not, but for bnx2i, the
  boot session network settings cannot be altered once its booted.  So the
  print out will follow the boot params; which is also the currently used
  params.
 
 For tcp we can. Let's just set use_boot_info for bnx2i for now. Let me
 think about tcp some more or let someone complain :)
 
 I think it then looks ok. Or, at least I do not remember if I had other
 concerns about it :) So send kernel stuff upstream. I can actually hand
 edit the userspace patches to remove the tcp use_boot_info bit if these
 patches are ok with you.
 
 Thanks.
 
 



-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[PATCH 1/2] BNX2I: Update version and copyright year 2013

2013-07-11 Thread Eddie Wai
Old version: 2.7.2.2
New version: 2.7.6.2

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/bnx2i/57xx_iscsi_constants.h |2 +-
 drivers/scsi/bnx2i/57xx_iscsi_hsi.h   |2 +-
 drivers/scsi/bnx2i/bnx2i.h|2 +-
 drivers/scsi/bnx2i/bnx2i_hwi.c|2 +-
 drivers/scsi/bnx2i/bnx2i_init.c   |6 +++---
 drivers/scsi/bnx2i/bnx2i_iscsi.c  |2 +-
 drivers/scsi/bnx2i/bnx2i_sysfs.c  |2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/bnx2i/57xx_iscsi_constants.h 
b/drivers/scsi/bnx2i/57xx_iscsi_constants.h
index 25093a0..3d33767 100644
--- a/drivers/scsi/bnx2i/57xx_iscsi_constants.h
+++ b/drivers/scsi/bnx2i/57xx_iscsi_constants.h
@@ -1,6 +1,6 @@
 /* 57xx_iscsi_constants.h: Broadcom NetXtreme II iSCSI HSI
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/drivers/scsi/bnx2i/57xx_iscsi_hsi.h 
b/drivers/scsi/bnx2i/57xx_iscsi_hsi.h
index f2db5fe..37049e4 100644
--- a/drivers/scsi/bnx2i/57xx_iscsi_hsi.h
+++ b/drivers/scsi/bnx2i/57xx_iscsi_hsi.h
@@ -1,6 +1,6 @@
 /* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index f109e3b..6940f09 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -1,6 +1,6 @@
 /* bnx2i.h: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index a28b03e..af3e675 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1,6 +1,6 @@
 /* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 50fef69..b6f6f43 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -1,6 +1,6 @@
 /* bnx2i.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
@@ -18,8 +18,8 @@ static struct list_head adapter_list = 
LIST_HEAD_INIT(adapter_list);
 static u32 adapter_count;
 
 #define DRV_MODULE_NAMEbnx2i
-#define DRV_MODULE_VERSION 2.7.2.2
-#define DRV_MODULE_RELDATE Apr 25, 2012
+#define DRV_MODULE_VERSION 2.7.6.2
+#define DRV_MODULE_RELDATE Jun 06, 2013
 
 static char version[] =
Broadcom NetXtreme II iSCSI Driver  DRV_MODULE_NAME \
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 0056e47..fabeb88 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -1,7 +1,7 @@
 /*
  * bnx2i_iscsi.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
diff --git a/drivers/scsi/bnx2i/bnx2i_sysfs.c b/drivers/scsi/bnx2i/bnx2i_sysfs.c
index c61cf7a..a0a3d9f 100644
--- a/drivers/scsi/bnx2i/bnx2i_sysfs.c
+++ b/drivers/scsi/bnx2i/bnx2i_sysfs.c
@@ -1,6 +1,6 @@
 /* bnx2i_sysfs.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2004 - 2012 Broadcom Corporation
+ * Copyright (c) 2004 - 2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
-- 
1.7.7.4


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




[PATCH 2/2] MAINTAINER: Added maintainer info for bnx2i

2013-07-11 Thread Eddie Wai
Signed-off-by: Eddie Wai eddie@broadcom.com
---
 MAINTAINERS |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 50105f9..e297cb0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1816,6 +1816,12 @@ L:   linux-s...@vger.kernel.org
 S: Supported
 F: drivers/scsi/bnx2fc/
 
+BROADCOM BNX2I 1/10 GIGABIT iSCSI DRIVER
+M: Eddie Wai eddie@broadcom.com
+L: linux-s...@vger.kernel.org
+S: Supported
+F: drivers/scsi/bnx2i/
+
 BROADCOM SPECIFIC AMBA DRIVER (BCMA)
 M: Rafał Miłecki zaj...@gmail.com
 L: linux-wirel...@vger.kernel.org
-- 
1.7.7.4


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [PATCH] iscsiuio: Change socket bind to use the same struct size as iscsid

2013-06-26 Thread Eddie Wai
Looks aligned now, good catch!

Acked-by: Eddie Wai eddie@broadcom.com

On Wed, 2013-06-26 at 19:52 -0500, Mike Christie wrote:
 Thanks Jan. Works for me.
 
 Eddie, please review too, and then I will merge if ok with you too.
 
 On 06/26/2013 08:55 AM, Jan Vesely wrote:
  From: Jan Vesely jves...@redhat.com
  
  Without this patch connections to iscsiuio fail, and strace prints:
  
  connect(8, {sa_family=AF_FILE, path=@ISCSID_UIP_ABSTRACT_NAMESPACE}, 32) 
  = -1 ECONNREFUSED (Connection refused)
  
  Note that updating mgmt_ipc_listen and ipc_connect to use sizeof(addr) 
  instead
  of the precomputed values also fixes the issue.
  Looks like (Null bytes in the name have no special significance.) [man 7 
  unix] is the culprit here.
  
  Signed-off-by: Jan Vesely jves...@redhat.com
  ---
   iscsiuio/src/unix/iscsid_ipc.c | 6 --
   1 file changed, 4 insertions(+), 2 deletions(-)
  
  diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
  index 5c097e6..e22de0d 100644
  --- a/iscsiuio/src/unix/iscsid_ipc.c
  +++ b/iscsiuio/src/unix/iscsid_ipc.c
  @@ -958,7 +958,7 @@ static void *iscsid_loop(void *arg)
*/
   int iscsid_init()
   {
  -   int rc;
  +   int rc, addr_len;
  struct sockaddr_un addr;
   
  iscsid_opts.fd = socket(AF_LOCAL, SOCK_STREAM, 0);
  @@ -967,12 +967,14 @@ int iscsid_init()
  return iscsid_opts.fd;
  }
   
  +   addr_len = offsetof(struct sockaddr_un, sun_path) + 
  strlen(ISCSID_UIP_NAMESPACE) + 1;
  +
  memset(addr, 0, sizeof(addr));
  addr.sun_family = AF_LOCAL;
  memcpy((char *)addr.sun_path + 1, ISCSID_UIP_NAMESPACE,
 strlen(ISCSID_UIP_NAMESPACE));
   
  -   rc = bind(iscsid_opts.fd, (struct sockaddr *)addr, sizeof(addr));
  +   rc = bind(iscsid_opts.fd, (struct sockaddr *)addr, addr_len);
  if (rc  0) {
  LOG_ERR(PFX Can not bind IPC socket: %s, strerror(errno));
  goto error;
  
 


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




[PATCH v2] LIBISCSI: Added new boot entries in the session sysfs

2013-06-20 Thread Eddie Wai
v2: Moved the new BOOT params to the end of the iscsi_param enum

This is the kernel part of the modification to extract the net params
from the ibft sysfs to the iface struct used for the connection
request upon sync_session in the open-iscsi util.

Three new session sysfs params are defined:
boot_root - holds the name of the /sys/firmware/ibft or iscsi_rootN
boot_nic  - holds the ethernetN name
boot_target - holds the targetN name

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/libiscsi.c |   18 ++
 drivers/scsi/scsi_transport_iscsi.c |   12 
 include/scsi/iscsi_if.h |5 +
 include/scsi/libiscsi.h |4 
 4 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 5de9469..ae69dfc 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2808,6 +2808,9 @@ void iscsi_session_teardown(struct iscsi_cls_session 
*cls_session)
kfree(session-targetname);
kfree(session-targetalias);
kfree(session-initiatorname);
+   kfree(session-boot_root);
+   kfree(session-boot_nic);
+   kfree(session-boot_target);
kfree(session-ifacename);
 
iscsi_destroy_session(cls_session);
@@ -3248,6 +3251,12 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
return iscsi_switch_str_param(session-ifacename, buf);
case ISCSI_PARAM_INITIATOR_NAME:
return iscsi_switch_str_param(session-initiatorname, buf);
+   case ISCSI_PARAM_BOOT_ROOT:
+   return iscsi_switch_str_param(session-boot_root, buf);
+   case ISCSI_PARAM_BOOT_NIC:
+   return iscsi_switch_str_param(session-boot_nic, buf);
+   case ISCSI_PARAM_BOOT_TARGET:
+   return iscsi_switch_str_param(session-boot_target, buf);
default:
return -ENOSYS;
}
@@ -3326,6 +3335,15 @@ int iscsi_session_get_param(struct iscsi_cls_session 
*cls_session,
case ISCSI_PARAM_INITIATOR_NAME:
len = sprintf(buf, %s\n, session-initiatorname);
break;
+   case ISCSI_PARAM_BOOT_ROOT:
+   len = sprintf(buf, %s\n, session-boot_root);
+   break;
+   case ISCSI_PARAM_BOOT_NIC:
+   len = sprintf(buf, %s\n, session-boot_nic);
+   break;
+   case ISCSI_PARAM_BOOT_TARGET:
+   len = sprintf(buf, %s\n, session-boot_target);
+   break;
default:
return -ENOSYS;
}
diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index 133926b..abf7c40 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -3473,6 +3473,9 @@ iscsi_session_attr(tgt_reset_tmo, 
ISCSI_PARAM_TGT_RESET_TMO, 0);
 iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0);
 iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0);
 iscsi_session_attr(targetalias, ISCSI_PARAM_TARGET_ALIAS, 0);
+iscsi_session_attr(boot_root, ISCSI_PARAM_BOOT_ROOT, 0);
+iscsi_session_attr(boot_nic, ISCSI_PARAM_BOOT_NIC, 0);
+iscsi_session_attr(boot_target, ISCSI_PARAM_BOOT_TARGET, 0);
 
 static ssize_t
 show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -3568,6 +3571,9 @@ static struct attribute *iscsi_session_attrs[] = {
dev_attr_sess_ifacename.attr,
dev_attr_sess_initiatorname.attr,
dev_attr_sess_targetalias.attr,
+   dev_attr_sess_boot_root.attr,
+   dev_attr_sess_boot_nic.attr,
+   dev_attr_sess_boot_target.attr,
dev_attr_priv_sess_recovery_tmo.attr,
dev_attr_priv_sess_state.attr,
dev_attr_priv_sess_creator.attr,
@@ -3631,6 +3637,12 @@ static umode_t iscsi_session_attr_is_visible(struct 
kobject *kobj,
param = ISCSI_PARAM_INITIATOR_NAME;
else if (attr == dev_attr_sess_targetalias.attr)
param = ISCSI_PARAM_TARGET_ALIAS;
+   else if (attr == dev_attr_sess_boot_root.attr)
+   param = ISCSI_PARAM_BOOT_ROOT;
+   else if (attr == dev_attr_sess_boot_nic.attr)
+   param = ISCSI_PARAM_BOOT_NIC;
+   else if (attr == dev_attr_sess_boot_target.attr)
+   param = ISCSI_PARAM_BOOT_TARGET;
else if (attr == dev_attr_priv_sess_recovery_tmo.attr)
return S_IRUGO | S_IWUSR;
else if (attr == dev_attr_priv_sess_state.attr)
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index fe7f06c..9d28ded 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -489,6 +489,11 @@ enum iscsi_param {
 
ISCSI_PARAM_CHAP_IN_IDX,
ISCSI_PARAM_CHAP_OUT_IDX,
+
+   ISCSI_PARAM_BOOT_ROOT,
+   ISCSI_PARAM_BOOT_NIC,
+   ISCSI_PARAM_BOOT_TARGET,
+
/* must always be last */
ISCSI_PARAM_MAX,
 };
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 09c041e..4265a4b

[PATCH] ISCSIUIO: Updated iscsiuio to version 0.7.8.1b for perf optimization

2013-06-19 Thread Eddie Wai
uIP v0.7.8.1b (May 01, 2013)
===
   Enhancements
   
   1. Change:  Performance optimization by caching the page size
  Impact:  All

   2. Change:  Fixed a bug in the tx completion interrupt handler
  Impact:  10G only

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 iscsiuio/README|9 +--
 iscsiuio/RELEASE.TXT   |   15 -
 iscsiuio/configure |  124 
 iscsiuio/configure.ac  |4 +-
 iscsiuio/docs/iscsiuio.8   |8 +-
 iscsiuio/src/unix/libs/bnx2.c  |   14 ++--
 iscsiuio/src/unix/libs/bnx2x.c |   19 +++---
 iscsiuio/src/unix/nic.c|1 +
 iscsiuio/src/unix/nic.h|6 ++-
 9 files changed, 108 insertions(+), 92 deletions(-)

diff --git a/iscsiuio/README b/iscsiuio/README
index 1a6386f..e7e5fe4 100644
--- a/iscsiuio/README
+++ b/iscsiuio/README
@@ -1,6 +1,6 @@
 Iscsiuio Userspace Tool
-Version 0.7.6.1g
-Jan 14, 2013
+Version 0.7.8.1b
+May 01, 2013
 --
 
 This tool is to be used in conjunction with the Broadcom NetXtreme II Linux
@@ -189,9 +189,8 @@ To run the daemon in debug mode please pass the parameter  
'-d debug level'
 
 where the following debug levels are defined:
 
-PACKET5 - Print all messages
-DEBUG 4 - Print debug messages
-INFO  3 - Print messages needed to follow the uIP code
+DEBUG 4 - Print all messages
+INFO  3 - Print messages needed to follow the uIP code (default)
 WARN  2 - Print warning messages
 ERROR 1 - Only print critical errors
 
diff --git a/iscsiuio/RELEASE.TXT b/iscsiuio/RELEASE.TXT
index 2fa19bb..de70667 100644
--- a/iscsiuio/RELEASE.TXT
+++ b/iscsiuio/RELEASE.TXT
@@ -1,7 +1,7 @@
   Release Notes
 Broadcom uIP Linux Driver
-Version 0.7.6.1g
-   01/14/2013
+Version 0.7.8.1b
+   05/01/2013
 
   Broadcom Corporation
  5300 California Avenue,
@@ -10,6 +10,16 @@
Copyright (c) 2004 - 2013 Broadcom Corporation
All rights reserved
 
+uIP v0.7.8.1b (May 01, 2013)
+===
+   Enhancements
+   
+   1. Change:  Performance optimization by caching the page size
+  Impact:  All
+
+   2. Change:  Fixed a bug in the tx completion interrupt handler
+  Impact:  10G only
+
 
 uIP v0.7.6.1g (Jan 14, 2013)
 ===
@@ -1986,3 +1996,4 @@ uIP v0.5.0b (Nov 24, 2009)
1. Change: Add Broadcom 10G iSCSI offload support
 
   Impact: Linux
+
diff --git a/iscsiuio/configure b/iscsiuio/configure
index 1852551..2740598 100755
--- a/iscsiuio/configure
+++ b/iscsiuio/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for iscsiuio 0.7.6.1g.
+# Generated by GNU Autoconf 2.59 for iscsiuio 0.7.8.1b.
 #
 # Report bugs to eddie@broadcom.com.
 #
@@ -72,9 +72,9 @@ $as_expr X/$0 : '.*/\([^/][^/]*\)/*$' \| \
 . : '\(.\)' 2/dev/null ||
 echo X/$0 |
 sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
 
 
 # PATH needs CR, and LINENO needs CR and PATH.
@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='iscsiuio'
 PACKAGE_TARNAME='iscsiuio'
-PACKAGE_VERSION='0.7.6.1g'
-PACKAGE_STRING='iscsiuio 0.7.6.1g'
+PACKAGE_VERSION='0.7.8.1b'
+PACKAGE_STRING='iscsiuio 0.7.8.1b'
 PACKAGE_BUGREPORT='eddie@broadcom.com'
 
 # Factoring default headers for most tests.
@@ -870,10 +870,10 @@ $as_expr X$0 : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 . : '\(.\)' 2/dev/null ||
 echo X$0 |
 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
   srcdir=$ac_confdir
   if test ! -r $srcdir/$ac_unique_file; then
 srcdir=..
@@ -954,7 +954,7 @@ if test $ac_init_help = long; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat _ACEOF
-\`configure' configures iscsiuio 0.7.6.1g to adapt to many kinds of systems.
+\`configure' configures iscsiuio 0.7.8.1b to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1020,7 +1020,7 @@ fi

Re: [RFC_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node mgmt support

2013-06-11 Thread Eddie Wai

On Tue, 2013-06-11 at 12:25 -0500, Mike Christie wrote:
 On 6/10/13 10:47 PM, Vikas Chaudhary wrote:
 
 
  -Original Message-
  From: Eddie Wai w...@broadcom.com
  Date: Wednesday 5 June 2013 7:00 AM
  To: shyam_i...@dell.com shyam_i...@dell.com
  Cc: open-iscsi@googlegroups.com open-iscsi@googlegroups.com, 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_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node mgmt
  support
 
 
  On Wed, 2013-05-29 at 14:37 -0700, shyam_i...@dell.com wrote:
 
  -Original Message-
  From: open-iscsi@googlegroups.com [mailto:open-iscsi@googlegroups.com]
  On Behalf Of Mike Christie
  Sent: Wednesday, May 29, 2013 1:30 PM
  To: open-iscsi@googlegroups.com
  Cc: Eddie Wai; vikas.chaudh...@qlogic.com;
  lalit.chandiv...@qlogic.com;
  ravi.an...@qlogic.com; poornima.vo...@qlogic.com;
  manish.rangan...@qlogic.com; Adheer Chandravanshi
  Subject: Re: [RFC_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node
  mgmt
  support
 
  On 05/29/2013 12:23 PM, Eddie Wai wrote:
 
  On Wed, 2013-05-29 at 10:26 -0500, Mike Christie wrote:
  On 05/28/2013 07:35 PM, Eddie Wai wrote:
  Hello Mike, Vikas, and all,
 
  Thanks for the great work in creating the flash node mechanism!
 
  To extend the conversation we had to add support for software and
  other offload solutions that requires iscsid/iscsiadm to create
  the
  sessions, the following needs to be further discussed:
 
  1. Flash node creation.
 
  The current solution relies on the transport driver to initiate
  the
  flash node sysfs creation upon iscsi_host allocation.  This
  presents
  a fundamental problem for software iSCSI as new iscsi_host
  instance
  won't get created until there's a session initiation.
 
  Per our conversation, I think it makes sense to move the flash
  node
  initiation code altogether to a separate module like how its done
  for ibft.  The new module shall cycle through each existing iSCSI
  host and query the corresponding transport to fill the flash node
  sysfs entries specific to that host.  Perhaps via a new transport
  callback
  or so.
 
  Agree.
 
 
  Since there won't be any pre-existing host created for software
  iSCSI, this needs to be handled differently.  Instead, the new
  module will also need to cycle through each network interfaces
  present and query for the flash node content separately.
 
  To accomplish this, each network interface will need to be made
  aware of flash nodes and also provide a way for the new module to
  read out the flash node content.  Per our conversation, this can
  be
  done via an extension of the ethtool utility.  For unsupported
  network drivers, this
 
  I do not remember that discussion. Has it been discussed with the
  netdev people already?
  This has only been discussed internally so far, but we believe
  adding
  a new ethtool extension for this flash memory access is one logical
  way that the netdev community can accept.
 
  Why does the new module need to cycle through each net device?
  Can't
  a net driver that knows it supports this just call into the new
  module to register itself when it is loaded? When it registers it
  can
  create any sysfs/netlink stuff needed so userspace can detect it
  and
  access it.
  That would work too, but our proposal essentially is tailored toward
  minimizing any storage specific code in the network drivers.
 
  Note that our proposal is to add an ethtool extension which will
  provide read/write access directly to the flash memory.  It will not
  do any sysfs creation or parameter qualification.  It only provides
  a
  gateway to the flash memory, that's it.  It will be up to the new
  module to initiate, create, and manage over those sysfs parameters.
 
  Sounds ok to me.
 
 
  Perhaps we can add some minor initiation code in the network driver
  to
  perhaps 'register' some flag so the new module will only have to
  cycle
  through a list of supported network interfaces only.
 
  It is ok. I was just thinking along the lines of either ethtool or
  iscsi mod only. I
  cannot think of a major issue to probe with ethtool from userspace
  like you
  suggested before. The only issue might be if we have to do some sort
  of
  probing and checking if this is supported takes a while (like if we
  have to do
  some fw command that takes several to 10-15 seconds each time). For
  that
  case we do not want to have to probe every device during boot or the
  boot/distro people will not be happy.
 
 
  Second that..
 
  One alternative is that the network driver registers to the new module.
  I would prefer that the new module is loaded already so it can
  enumerate the /sysfs  entries correctly.
 
  Although we have not proposed this via the netdev ML yet, however

Re: [RFC_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node mgmt support

2013-06-11 Thread Eddie Wai

On Tue, 2013-06-11 at 13:26 -0500, Mike Christie wrote:
 On 06/11/2013 12:43 PM, Eddie Wai wrote:
  
  On Tue, 2013-06-11 at 12:25 -0500, Mike Christie wrote:
  On 6/10/13 10:47 PM, Vikas Chaudhary wrote:
 
 
  -Original Message-
  From: Eddie Wai w...@broadcom.com
  Date: Wednesday 5 June 2013 7:00 AM
  To: shyam_i...@dell.com shyam_i...@dell.com
  Cc: open-iscsi@googlegroups.com open-iscsi@googlegroups.com, 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_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node mgmt
  support
 
 
  On Wed, 2013-05-29 at 14:37 -0700, shyam_i...@dell.com wrote:
 
  -Original Message-
  From: open-iscsi@googlegroups.com [mailto:open-iscsi@googlegroups.com]
  On Behalf Of Mike Christie
  Sent: Wednesday, May 29, 2013 1:30 PM
  To: open-iscsi@googlegroups.com
  Cc: Eddie Wai; vikas.chaudh...@qlogic.com;
  lalit.chandiv...@qlogic.com;
  ravi.an...@qlogic.com; poornima.vo...@qlogic.com;
  manish.rangan...@qlogic.com; Adheer Chandravanshi
  Subject: Re: [RFC_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node
  mgmt
  support
 
  On 05/29/2013 12:23 PM, Eddie Wai wrote:
 
  On Wed, 2013-05-29 at 10:26 -0500, Mike Christie wrote:
  On 05/28/2013 07:35 PM, Eddie Wai wrote:
  Hello Mike, Vikas, and all,
 
  Thanks for the great work in creating the flash node mechanism!
 
  To extend the conversation we had to add support for software and
  other offload solutions that requires iscsid/iscsiadm to create
  the
  sessions, the following needs to be further discussed:
 
  1. Flash node creation.
 
  The current solution relies on the transport driver to initiate
  the
  flash node sysfs creation upon iscsi_host allocation.  This
  presents
  a fundamental problem for software iSCSI as new iscsi_host
  instance
  won't get created until there's a session initiation.
 
  Per our conversation, I think it makes sense to move the flash
  node
  initiation code altogether to a separate module like how its done
  for ibft.  The new module shall cycle through each existing iSCSI
  host and query the corresponding transport to fill the flash node
  sysfs entries specific to that host.  Perhaps via a new transport
  callback
  or so.
 
  Agree.
 
 
  Since there won't be any pre-existing host created for software
  iSCSI, this needs to be handled differently.  Instead, the new
  module will also need to cycle through each network interfaces
  present and query for the flash node content separately.
 
  To accomplish this, each network interface will need to be made
  aware of flash nodes and also provide a way for the new module to
  read out the flash node content.  Per our conversation, this can
  be
  done via an extension of the ethtool utility.  For unsupported
  network drivers, this
 
  I do not remember that discussion. Has it been discussed with the
  netdev people already?
  This has only been discussed internally so far, but we believe
  adding
  a new ethtool extension for this flash memory access is one logical
  way that the netdev community can accept.
 
  Why does the new module need to cycle through each net device?
  Can't
  a net driver that knows it supports this just call into the new
  module to register itself when it is loaded? When it registers it
  can
  create any sysfs/netlink stuff needed so userspace can detect it
  and
  access it.
  That would work too, but our proposal essentially is tailored toward
  minimizing any storage specific code in the network drivers.
 
  Note that our proposal is to add an ethtool extension which will
  provide read/write access directly to the flash memory.  It will not
  do any sysfs creation or parameter qualification.  It only provides
  a
  gateway to the flash memory, that's it.  It will be up to the new
  module to initiate, create, and manage over those sysfs parameters.
 
  Sounds ok to me.
 
 
  Perhaps we can add some minor initiation code in the network driver
  to
  perhaps 'register' some flag so the new module will only have to
  cycle
  through a list of supported network interfaces only.
 
  It is ok. I was just thinking along the lines of either ethtool or
  iscsi mod only. I
  cannot think of a major issue to probe with ethtool from userspace
  like you
  suggested before. The only issue might be if we have to do some sort
  of
  probing and checking if this is supported takes a while (like if we
  have to do
  some fw command that takes several to 10-15 seconds each time). For
  that
  case we do not want to have to probe every device during boot or the
  boot/distro people will not be happy.
 
 
  Second that..
 
  One alternative is that the network driver registers to the new module.
  I would prefer that the new module is loaded already so it can
  enumerate the /sysfs

[PATCH] LIBISCSI: Added new boot entries in the session sysfs

2013-06-10 Thread Eddie Wai
This is the kernel part of the modification to extract the net params
from the ibft sysfs to the iface struct used for the connection
request upon sync_session in the open-iscsi util.

Three new session sysfs params are defined:
boot_root - holds the name of the /sys/firmware/ibft or iscsi_rootN
boot_nic  - holds the ethernetN name
boot_target - holds the targetN name

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/libiscsi.c |   18 ++
 drivers/scsi/scsi_transport_iscsi.c |   12 
 include/scsi/iscsi_if.h |4 
 include/scsi/libiscsi.h |4 
 4 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 5de9469..ae69dfc 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2808,6 +2808,9 @@ void iscsi_session_teardown(struct iscsi_cls_session 
*cls_session)
kfree(session-targetname);
kfree(session-targetalias);
kfree(session-initiatorname);
+   kfree(session-boot_root);
+   kfree(session-boot_nic);
+   kfree(session-boot_target);
kfree(session-ifacename);
 
iscsi_destroy_session(cls_session);
@@ -3248,6 +3251,12 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
return iscsi_switch_str_param(session-ifacename, buf);
case ISCSI_PARAM_INITIATOR_NAME:
return iscsi_switch_str_param(session-initiatorname, buf);
+   case ISCSI_PARAM_BOOT_ROOT:
+   return iscsi_switch_str_param(session-boot_root, buf);
+   case ISCSI_PARAM_BOOT_NIC:
+   return iscsi_switch_str_param(session-boot_nic, buf);
+   case ISCSI_PARAM_BOOT_TARGET:
+   return iscsi_switch_str_param(session-boot_target, buf);
default:
return -ENOSYS;
}
@@ -3326,6 +3335,15 @@ int iscsi_session_get_param(struct iscsi_cls_session 
*cls_session,
case ISCSI_PARAM_INITIATOR_NAME:
len = sprintf(buf, %s\n, session-initiatorname);
break;
+   case ISCSI_PARAM_BOOT_ROOT:
+   len = sprintf(buf, %s\n, session-boot_root);
+   break;
+   case ISCSI_PARAM_BOOT_NIC:
+   len = sprintf(buf, %s\n, session-boot_nic);
+   break;
+   case ISCSI_PARAM_BOOT_TARGET:
+   len = sprintf(buf, %s\n, session-boot_target);
+   break;
default:
return -ENOSYS;
}
diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index 133926b..abf7c40 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -3473,6 +3473,9 @@ iscsi_session_attr(tgt_reset_tmo, 
ISCSI_PARAM_TGT_RESET_TMO, 0);
 iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0);
 iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0);
 iscsi_session_attr(targetalias, ISCSI_PARAM_TARGET_ALIAS, 0);
+iscsi_session_attr(boot_root, ISCSI_PARAM_BOOT_ROOT, 0);
+iscsi_session_attr(boot_nic, ISCSI_PARAM_BOOT_NIC, 0);
+iscsi_session_attr(boot_target, ISCSI_PARAM_BOOT_TARGET, 0);
 
 static ssize_t
 show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -3568,6 +3571,9 @@ static struct attribute *iscsi_session_attrs[] = {
dev_attr_sess_ifacename.attr,
dev_attr_sess_initiatorname.attr,
dev_attr_sess_targetalias.attr,
+   dev_attr_sess_boot_root.attr,
+   dev_attr_sess_boot_nic.attr,
+   dev_attr_sess_boot_target.attr,
dev_attr_priv_sess_recovery_tmo.attr,
dev_attr_priv_sess_state.attr,
dev_attr_priv_sess_creator.attr,
@@ -3631,6 +3637,12 @@ static umode_t iscsi_session_attr_is_visible(struct 
kobject *kobj,
param = ISCSI_PARAM_INITIATOR_NAME;
else if (attr == dev_attr_sess_targetalias.attr)
param = ISCSI_PARAM_TARGET_ALIAS;
+   else if (attr == dev_attr_sess_boot_root.attr)
+   param = ISCSI_PARAM_BOOT_ROOT;
+   else if (attr == dev_attr_sess_boot_nic.attr)
+   param = ISCSI_PARAM_BOOT_NIC;
+   else if (attr == dev_attr_sess_boot_target.attr)
+   param = ISCSI_PARAM_BOOT_TARGET;
else if (attr == dev_attr_priv_sess_recovery_tmo.attr)
return S_IRUGO | S_IWUSR;
else if (attr == dev_attr_priv_sess_state.attr)
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index fe7f06c..f9cc89b 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -487,6 +487,10 @@ enum iscsi_param {
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
 
+   ISCSI_PARAM_BOOT_ROOT,
+   ISCSI_PARAM_BOOT_NIC,
+   ISCSI_PARAM_BOOT_TARGET,
+
ISCSI_PARAM_CHAP_IN_IDX,
ISCSI_PARAM_CHAP_OUT_IDX,
/* must always be last */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 09c041e..4265a4b 100644
--- a/include/scsi

RE: [RFC_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node mgmt support

2013-06-04 Thread Eddie Wai

On Wed, 2013-05-29 at 14:37 -0700, shyam_i...@dell.com wrote:
 
  -Original Message-
  From: open-iscsi@googlegroups.com [mailto:open-iscsi@googlegroups.com]
  On Behalf Of Mike Christie
  Sent: Wednesday, May 29, 2013 1:30 PM
  To: open-iscsi@googlegroups.com
  Cc: Eddie Wai; vikas.chaudh...@qlogic.com; lalit.chandiv...@qlogic.com;
  ravi.an...@qlogic.com; poornima.vo...@qlogic.com;
  manish.rangan...@qlogic.com; Adheer Chandravanshi
  Subject: Re: [RFC_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node mgmt
  support
  
  On 05/29/2013 12:23 PM, Eddie Wai wrote:
  
   On Wed, 2013-05-29 at 10:26 -0500, Mike Christie wrote:
   On 05/28/2013 07:35 PM, Eddie Wai wrote:
   Hello Mike, Vikas, and all,
  
   Thanks for the great work in creating the flash node mechanism!
  
   To extend the conversation we had to add support for software and
   other offload solutions that requires iscsid/iscsiadm to create the
   sessions, the following needs to be further discussed:
  
   1. Flash node creation.
  
   The current solution relies on the transport driver to initiate the
   flash node sysfs creation upon iscsi_host allocation.  This presents
   a fundamental problem for software iSCSI as new iscsi_host instance
   won't get created until there's a session initiation.
  
   Per our conversation, I think it makes sense to move the flash node
   initiation code altogether to a separate module like how its done
   for ibft.  The new module shall cycle through each existing iSCSI
   host and query the corresponding transport to fill the flash node
   sysfs entries specific to that host.  Perhaps via a new transport 
   callback
  or so.
  
   Agree.
  
  
   Since there won't be any pre-existing host created for software
   iSCSI, this needs to be handled differently.  Instead, the new
   module will also need to cycle through each network interfaces
   present and query for the flash node content separately.
  
   To accomplish this, each network interface will need to be made
   aware of flash nodes and also provide a way for the new module to
   read out the flash node content.  Per our conversation, this can be
   done via an extension of the ethtool utility.  For unsupported
   network drivers, this
  
   I do not remember that discussion. Has it been discussed with the
   netdev people already?
   This has only been discussed internally so far, but we believe adding
   a new ethtool extension for this flash memory access is one logical
   way that the netdev community can accept.
  
   Why does the new module need to cycle through each net device? Can't
   a net driver that knows it supports this just call into the new
   module to register itself when it is loaded? When it registers it can
   create any sysfs/netlink stuff needed so userspace can detect it and
  access it.
   That would work too, but our proposal essentially is tailored toward
   minimizing any storage specific code in the network drivers.
  
   Note that our proposal is to add an ethtool extension which will
   provide read/write access directly to the flash memory.  It will not
   do any sysfs creation or parameter qualification.  It only provides a
   gateway to the flash memory, that's it.  It will be up to the new
   module to initiate, create, and manage over those sysfs parameters.
  
  Sounds ok to me.
  
  
   Perhaps we can add some minor initiation code in the network driver to
   perhaps 'register' some flag so the new module will only have to cycle
   through a list of supported network interfaces only.
  
  It is ok. I was just thinking along the lines of either ethtool or iscsi 
  mod only. I
  cannot think of a major issue to probe with ethtool from userspace like you
  suggested before. The only issue might be if we have to do some sort of
  probing and checking if this is supported takes a while (like if we have to 
  do
  some fw command that takes several to 10-15 seconds each time). For that
  case we do not want to have to probe every device during boot or the
  boot/distro people will not be happy.
  
 
 Second that..
 
 One alternative is that the network driver registers to the new module.  I 
 would prefer that the new module is loaded already so it can enumerate the 
 /sysfs  entries correctly.
 
Although we have not proposed this via the netdev ML yet, however, the
current suggestion to only add ethtool extension to support this is
gaining traction.

As far as latency goes, a simple for_each_netdev loop to probe each
netdev's ethtool_ops for these new extensions (like get/set_flash_node)
shouldn't incur too much cost for unsupported nics.  However, for the
case when there are many supported nics in the system, we would then
have to decide how to best handle the delay.  We might have to rely on
defer tactics or impose a hard limit on the number of flash targets to
support on a system.  This should be easy to govern via the bios.

How about for HBAs?  We probably want to employ the same top-down
approach

Re: [RFC_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node mgmt support

2013-05-29 Thread Eddie Wai

On Wed, 2013-05-29 at 10:26 -0500, Mike Christie wrote:
 On 05/28/2013 07:35 PM, Eddie Wai wrote:
  Hello Mike, Vikas, and all,
  
  Thanks for the great work in creating the flash node mechanism!
  
  To extend the conversation we had to add support for software and other
  offload solutions that requires iscsid/iscsiadm to create the sessions,
  the following needs to be further discussed:
  
  1. Flash node creation.
  
  The current solution relies on the transport driver to initiate the
  flash node sysfs creation upon iscsi_host allocation.  This presents a
  fundamental problem for software iSCSI as new iscsi_host instance won't
  get created until there's a session initiation.
  
  Per our conversation, I think it makes sense to move the flash node
  initiation code altogether to a separate module like how its done for
  ibft.  The new module shall cycle through each existing iSCSI host and
  query the corresponding transport to fill the flash node sysfs entries
  specific to that host.  Perhaps via a new transport callback or so.
 
 Agree.
 
  
  Since there won't be any pre-existing host created for software iSCSI,
  this needs to be handled differently.  Instead, the new module will also
  need to cycle through each network interfaces present and query for the
  flash node content separately.
 
  To accomplish this, each network interface will need to be made aware of
  flash nodes and also provide a way for the new module to read out the
  flash node content.  Per our conversation, this can be done via an
  extension of the ethtool utility.  For unsupported network drivers, this
 
 I do not remember that discussion. Has it been discussed with the netdev
 people already?
This has only been discussed internally so far, but we believe adding a
new ethtool extension for this flash memory access is one logical way
that the netdev community can accept.
 
 Why does the new module need to cycle through each net device? Can't a
 net driver that knows it supports this just call into the new module to
 register itself when it is loaded? When it registers it can create any
 sysfs/netlink stuff needed so userspace can detect it and access it.
That would work too, but our proposal essentially is tailored toward
minimizing any storage specific code in the network drivers.

Note that our proposal is to add an ethtool extension which will provide
read/write access directly to the flash memory.  It will not do any
sysfs creation or parameter qualification.  It only provides a gateway
to the flash memory, that's it.  It will be up to the new module to
initiate, create, and manage over those sysfs parameters.

Perhaps we can add some minor initiation code in the network driver to
perhaps 'register' some flag so the new module will only have to cycle
through a list of supported network interfaces only.

I imagine the sysfs entries created for this will look something like
this:
  /sys/bus/iscsi_flashnode/devices/flashnode_sess-tcp:flashnode_id/session 
attrs
  
/sys/bus/iscsi_flashnode/devices/flashnode_conn-tcp:flashnode_id:conn_id/conn
 attrs
  
/sys/bus/iscsi_flashnode/devices/flashnode_initiator-tcp:flashnode_id/initiator
 attrs

 
 I am not sure I got why we need a new module and ethtool extensions. It
 seems you only need one or the other.
 
 
  call will simply return an unsupported ethtool extension error.  For
  others, it can return a memory pointer to the flash node content.
  
  Additionally, the net tools must also provide a way for these net params
  to be populated to the corresponding network interfaces.  This needs
  further discussion.
  
  
  2. Initiator iSCSI/network params.
  
  The current solution does not provide any means to link initiator
  parameters to the associated flash nodes.
  
  In order to resolve this, new initiator entries will need to be created
  alongside or inside these flash node sysfs entries.  The content and
  naming will somewhat follow our last conversation of creating
  corresponding entries inside the iscsi_flashnode sysfs as follows:
  
  /sys/bus/iscsi_flashnode/devices/flashnode_initiator-host_no:flashnode_id/
  initiator attrs
  
  Offload solutions that doesn't need to use this can ignore these
  initiator entries.
  
 
 Sounds ok.
 
  
  3. Connection initiation.
  
  The current solution provides 2 ways to initiate the connection to these
  flash node targets; initiate from inside the driver, or via the iscsiadm
  flash node login command.
   
  This posts a problem for software iSCSI and other offload solutions as
  they do not conventionally initiate a connection from within the driver.
  
  One way to resolve this is to augment the iscsi tool to loop through
  these entries and create the sessions automatically upon start-up.
  
  We can simply add a transport switch here for offload solutions that
  doesn't want/need this.
 
 Sounds ok.
 
  
  
  Comments welcome!  Thanks.
  
  Eddie
  
  
  On Tue, 2013-02-19 at 07:05 -0500, vikas.chaudh...@qlogic.com

Re: [PATCH v4 2/3] ISCSID: Added the extraction of the session boot info

2013-05-28 Thread Eddie Wai

On Tue, 2013-05-28 at 04:05 -0500, Mike Christie wrote:
 On 04/12/2013 12:41 PM, Eddie Wai wrote:
  This patch does the work to extract the corresponding
  boot_root-ethernetN net params as specified from the kernel
  session boot_nic sysfs entry based on the transport param
  use_boot_info.
  
  This is only populated for iscsi_tcp and bnx2i.
  
  Signed-off-by: Eddie Wai eddie@broadcom.com
  ---
   usr/iscsi_sysfs.c |   40 
   usr/transport.c   |2 ++
   usr/transport.h   |1 +
   3 files changed, 43 insertions(+), 0 deletions(-)
  
  diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
  index 4015b35..91c3989 100644
  --- a/usr/iscsi_sysfs.c
  +++ b/usr/iscsi_sysfs.c
  @@ -439,6 +439,43 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct 
  iface_rec *iface, int *rc)
  return host_no;
   }
   
  +static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
  +{
  +   char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
  +   char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
  +
  +   /* Extract boot info */
  +   strlcpy(boot_name, boot_target, sizeof(boot_name));
  +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
  + boot_content, BOOT_NAME_MAXLEN))
  +   return -1;
  +   strlcpy(boot_name, boot_nic, sizeof(boot_name));
  +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
  + BOOT_NAME_MAXLEN))
  +   return -1;
  +   strlcpy(boot_name, boot_root, sizeof(boot_name));
  +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
  + BOOT_NAME_MAXLEN))
  +   return -1;
  +
  +   /* If all boot_root/boot_target/boot_nic exist, then extract the
  +  info from the boot nic */
  +   if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
  + BOOT_NAME_MAXLEN))
  +   log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
  +   else
  +   iface-vlan_id = atoi(boot_content);
  +
  +   if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
  + iface-subnet_mask, NI_MAXHOST))
  +   log_debug(5, could not read %s/%s/subnet, boot_root,
  + boot_nic);
  +
  +   log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
  + boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
  +   return 0;
  +}
  +
   /*
* Read in iface settings based on host and session values. If
* session is not passed in, then the ifacename will not be set. And
  @@ -567,6 +604,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec 
  *iface, int host_no,
  }
  }
   
  +   if (t-template-use_boot_info)
  +   iscsi_sysfs_read_boot(iface, session);
  +
 
 I forgot what we were saying for this. For the running boot session is
 it possible to change the network settings while the session is running?
 If so then this would print the old info (info used for boot that might
 not be currently used) right? Was this ok?
I'm not sure if this applies to iscsi_tcp or not, but for bnx2i, the
boot session network settings cannot be altered once its booted.  So the
print out will follow the boot params; which is also the currently used
params.

 
 


-- 
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_V5 PATCH 1/3] scsi_transport_iscsi: Add flash node mgmt support

2013-05-28 Thread Eddie Wai
Hello Mike, Vikas, and all,

Thanks for the great work in creating the flash node mechanism!

To extend the conversation we had to add support for software and other
offload solutions that requires iscsid/iscsiadm to create the sessions,
the following needs to be further discussed:

1. Flash node creation.

The current solution relies on the transport driver to initiate the
flash node sysfs creation upon iscsi_host allocation.  This presents a
fundamental problem for software iSCSI as new iscsi_host instance won't
get created until there's a session initiation.

Per our conversation, I think it makes sense to move the flash node
initiation code altogether to a separate module like how its done for
ibft.  The new module shall cycle through each existing iSCSI host and
query the corresponding transport to fill the flash node sysfs entries
specific to that host.  Perhaps via a new transport callback or so.

Since there won't be any pre-existing host created for software iSCSI,
this needs to be handled differently.  Instead, the new module will also
need to cycle through each network interfaces present and query for the
flash node content separately.

To accomplish this, each network interface will need to be made aware of
flash nodes and also provide a way for the new module to read out the
flash node content.  Per our conversation, this can be done via an
extension of the ethtool utility.  For unsupported network drivers, this
call will simply return an unsupported ethtool extension error.  For
others, it can return a memory pointer to the flash node content.

Additionally, the net tools must also provide a way for these net params
to be populated to the corresponding network interfaces.  This needs
further discussion.


2. Initiator iSCSI/network params.

The current solution does not provide any means to link initiator
parameters to the associated flash nodes.

In order to resolve this, new initiator entries will need to be created
alongside or inside these flash node sysfs entries.  The content and
naming will somewhat follow our last conversation of creating
corresponding entries inside the iscsi_flashnode sysfs as follows:

/sys/bus/iscsi_flashnode/devices/flashnode_initiator-host_no:flashnode_id/
initiator attrs

Offload solutions that doesn't need to use this can ignore these
initiator entries.


3. Connection initiation.

The current solution provides 2 ways to initiate the connection to these
flash node targets; initiate from inside the driver, or via the iscsiadm
flash node login command.
 
This posts a problem for software iSCSI and other offload solutions as
they do not conventionally initiate a connection from within the driver.

One way to resolve this is to augment the iscsi tool to loop through
these entries and create the sessions automatically upon start-up.

We can simply add a transport switch here for offload solutions that
doesn't want/need this.


Comments welcome!  Thanks.

Eddie


On Tue, 2013-02-19 at 07:05 -0500, 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/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
 
 Signed-off-by: Adheer Chandravanshi adheer.chandravan...@qlogic.com
 Signed-off-by: Manish Rangankar manish.rangan...@qlogic.com
 Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
 ---
  drivers/scsi/scsi_transport_iscsi.c |  998 
 ++-
  include/scsi/iscsi_if.h |  112 
  include/scsi/scsi_transport_iscsi.h |  150 ++
  3 files changed, 1259 insertions(+), 1 deletions(-)
 



-- 
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.




[PATCH 4/4] ISCSID: Added uip_mgmt_ipc source

2013-05-13 Thread Eddie Wai
As part of the iscsid to iscsiuio communication socket.


Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/uip_mgmt_ipc.c |   41 +
 usr/uip_mgmt_ipc.h |   73 
 2 files changed, 114 insertions(+), 0 deletions(-)
 create mode 100644 usr/uip_mgmt_ipc.c
 create mode 100644 usr/uip_mgmt_ipc.h

diff --git a/usr/uip_mgmt_ipc.c b/usr/uip_mgmt_ipc.c
new file mode 100644
index 000..f3074ee
--- /dev/null
+++ b/usr/uip_mgmt_ipc.c
@@ -0,0 +1,41 @@
+/*
+ * uIP iSCSI Daemon/Admin Management IPC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ */
+
+#include string.h
+
+#include log.h
+#include uip_mgmt_ipc.h
+#include iscsid_req.h
+
+int uip_broadcast_params(struct iscsi_transport *t,
+struct iface_rec *iface,
+struct iscsi_session *session)
+{
+   struct iscsid_uip_broadcast broadcast;
+
+   log_debug(3, broadcasting to uip\n);
+
+   memset(broadcast, 0, sizeof(broadcast));
+
+   broadcast.header.command = ISCSID_UIP_IPC_GET_IFACE;
+   broadcast.header.payload_len = sizeof(*iface);
+
+   memcpy(broadcast.u.iface_rec, iface, sizeof(*iface));
+
+   return uip_broadcast(broadcast,
+sizeof(iscsid_uip_broadcast_header_t) +
+sizeof(*iface));
+}
diff --git a/usr/uip_mgmt_ipc.h b/usr/uip_mgmt_ipc.h
new file mode 100644
index 000..29a4769
--- /dev/null
+++ b/usr/uip_mgmt_ipc.h
@@ -0,0 +1,73 @@
+/*
+ * uIP iSCSI Daemon/Admin Management IPC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ */
+#ifndef UIP_MGMT_IPC_H
+#define UIP_MGMT_IPC_H
+
+#include types.h
+#include iscsi_if.h
+#include config.h
+#include mgmt_ipc.h
+
+#include initiator.h
+#include transport.h
+
+#define ISCSID_UIP_NAMESPACE   ISCSID_UIP_ABSTRACT_NAMESPACE
+
+typedef enum iscsid_uip_cmd {
+   ISCSID_UIP_IPC_UNKNOWN  = 0,
+   ISCSID_UIP_IPC_GET_IFACE= 1,
+
+   __ISCSID_UIP_IPC_MAX_COMMAND
+} iscsid_uip_cmd_e;
+
+typedef struct iscsid_uip_broadcast_header {
+   iscsid_uip_cmd_e command;
+   uint32_t payload_len;
+} iscsid_uip_broadcast_header_t;
+
+/* IPC Request */
+typedef struct iscsid_uip_broadcast {
+   struct iscsid_uip_broadcast_header header;
+
+   union {
+   /* messages */
+   struct ipc_broadcast_iface_rec {
+   struct iface_rec rec;
+   } iface_rec;
+   } u;
+} iscsid_uip_broadcast_t;
+
+typedef enum iscsid_uip_mgmt_ipc_err {
+   ISCSID_UIP_MGMT_IPC_OK = 0,
+   ISCSID_UIP_MGMT_IPC_ERR= 1,
+   ISCSID_UIP_MGMT_IPC_ERR_NOT_FOUND  = 2,
+   ISCSID_UIP_MGMT_IPC_ERR_NOMEM  = 3,
+   ISCSID_UIP_MGMT_IPC_DEVICE_UP  = 4,
+   ISCSID_UIP_MGMT_IPC_DEVICE_INITIALIZING= 5,
+} iscsid_uip_mgmt_ipc_err_e;
+
+/* IPC Response */
+typedef struct iscsid_uip_mgmt_rsp {
+   iscsid_uip_cmd_e command;
+   iscsid_uip_mgmt_ipc_err_e err;
+} iscsid_uip_rsp_t;
+
+extern int uip_broadcast_params(struct iscsi_transport *t,
+   struct iface_rec *iface,
+   struct iscsi_session *session);
+
+
+#endif /* UIP_MGMT_IPC_H */
-- 
1.7.7.4


-- 
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.




[PATCH v4 0/3] ISCSITOOLS: Patchset to add the extraction of

2013-04-12 Thread Eddie Wai
Version 4:
- Added transport switch 'use_boot_info' to enable the overriding of
  the session's iface param with the boot_info or not.  This is only
  populated for iscsi_tcp and bnx2i so far.

Version 3:
- Added support for ISCSI_LLD_ROOT support as well
- Removed the 'boot_initiator' param because its not useful
- Added the 'boot_root' param to hold the 'ibft' or 'iscsi_root'N name to
  support non-ibft sessions
- Moved the boot_nic net param extraction out of the iscsi_sysfs_read_iface
  routine because it can affect iscsiadm iface config printouts

Version 2:
- Added boot_initiator to hold the ibft initiator name
- Added boot_targetN to hold the corresponding ibft target name
- Moved the boot_nic net param extraction to the iscsi_sysfs_read_iface
  routine
- Added extra check before eluding to use the boot_nic info

For the case when iscsid is invoked for the first time after pivot root
during iSCSI boot, the boot connection would fail to re-connect if the
ibft/iscsi_boot sysfs entry contains tagged vlan.

The problem was caused by the lack of such info in the iscsi_session sysfs
for sync_session to inherit from.

The enclosed patchset does the following:
1. Extract and save the ibft-ethernetN name to the boot_context-boot_nic
2. Pass the boot_nic info to be saved to the sessionN sysfs
3. Extract the sessionN boot_nic sysfs info and retrieve the corresponding
   net params

This 'boot_nic' kernel session sysfs entry will only be present for ibft
boot.  Corresponding kernel drivers will have to add the ISCSI_PARAM_BOOT_NIC
attribute to its attr_is_visible table.

The last patch provides the fix for the unconditional overwrite of the
iface struct even after the ibft net info was already extracted.

Please review.  Thanks.
Eddie


Eddie Wai (3):
  ISCSISTART: Saved ibft boot info to the session sysfs
  ISCSID: Added the extraction of the session boot info
  ISCSID: Added iface content override fix

 include/fw_context.h   |3 ++
 include/iscsi_if.h |4 +++
 include/iscsi_proto.h  |1 +
 usr/config.h   |3 ++
 usr/idbm.c |6 +
 usr/initiator_common.c |   14 +++-
 usr/iscsi_sysfs.c  |   40 
 usr/iscsid.c   |8 ++
 usr/transport.c|2 +
 usr/transport.h|1 +
 utils/fwparam_ibft/fwparam_sysfs.c |8 +++
 11 files changed, 84 insertions(+), 6 deletions(-)

-- 
1.7.7.4


-- 
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.




[PATCH v4 2/3] ISCSID: Added the extraction of the session boot info

2013-04-12 Thread Eddie Wai
This patch does the work to extract the corresponding
boot_root-ethernetN net params as specified from the kernel
session boot_nic sysfs entry based on the transport param
use_boot_info.

This is only populated for iscsi_tcp and bnx2i.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsi_sysfs.c |   40 
 usr/transport.c   |2 ++
 usr/transport.h   |1 +
 3 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 4015b35..91c3989 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -439,6 +439,43 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct 
iface_rec *iface, int *rc)
return host_no;
 }
 
+static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
+{
+   char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
+   char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
+
+   /* Extract boot info */
+   strlcpy(boot_name, boot_target, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
+ boot_content, BOOT_NAME_MAXLEN))
+   return -1;
+   strlcpy(boot_name, boot_nic, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
+ BOOT_NAME_MAXLEN))
+   return -1;
+   strlcpy(boot_name, boot_root, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
+ BOOT_NAME_MAXLEN))
+   return -1;
+
+   /* If all boot_root/boot_target/boot_nic exist, then extract the
+  info from the boot nic */
+   if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
+ BOOT_NAME_MAXLEN))
+   log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
+   else
+   iface-vlan_id = atoi(boot_content);
+
+   if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
+ iface-subnet_mask, NI_MAXHOST))
+   log_debug(5, could not read %s/%s/subnet, boot_root,
+ boot_nic);
+
+   log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
+ boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
+   return 0;
+}
+
 /*
  * Read in iface settings based on host and session values. If
  * session is not passed in, then the ifacename will not be set. And
@@ -567,6 +604,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, 
int host_no,
}
}
 
+   if (t-template-use_boot_info)
+   iscsi_sysfs_read_boot(iface, session);
+
if (!iface_kern_id)
goto done;
 
diff --git a/usr/transport.c b/usr/transport.c
index e6e3dfc..c646ff4 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -41,6 +41,7 @@
 
 struct iscsi_transport_template iscsi_tcp = {
.name   = tcp,
+   .use_boot_info  = 1,
.ep_connect = iscsi_io_tcp_connect,
.ep_poll= iscsi_io_tcp_poll,
.ep_disconnect  = iscsi_io_tcp_disconnect,
@@ -76,6 +77,7 @@ struct iscsi_transport_template cxgb4i = {
 struct iscsi_transport_template bnx2i = {
.name   = bnx2i,
.set_host_ip= 1,
+   .use_boot_info  = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll= ktransport_ep_poll,
.ep_disconnect  = ktransport_ep_disconnect,
diff --git a/usr/transport.h b/usr/transport.h
index 672561b..3f8b3fe 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -31,6 +31,7 @@ struct iscsi_transport_template {
 * the host's ip address.
 */
uint8_t set_host_ip;
+   uint8_t use_boot_info;
int (*ep_connect) (struct iscsi_conn *conn, int non_blocking);
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
void (*ep_disconnect) (struct iscsi_conn *conn);
-- 
1.7.7.4


-- 
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.




[PATCH v4 3/3] ISCSID: Added iface content override fix

2013-04-12 Thread Eddie Wai
Patch provided by Mike Christie.

This patch fixes the unconditional overwrite of the iface struct
even when the corresponding iface info from the node config was
found and extracted.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsid.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/usr/iscsid.c b/usr/iscsid.c
index b4bb65b..b912b58 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -111,9 +111,7 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct 
session_info *info)
strlcpy(rec-name, info-targetname, TARGET_NAME_MAXLEN);
rec-conn[0].port = info-persistent_port;
strlcpy(rec-conn[0].address, info-persistent_address, NI_MAXHOST);
-   memcpy(rec-iface, info-iface, sizeof(struct iface_rec));
rec-tpgt = info-tpgt;
-   iface_copy(rec-iface, info-iface);
 
iscsi_sysfs_get_negotiated_session_conf(info-sid, session_conf);
iscsi_sysfs_get_negotiated_conn_conf(info-sid, conn_conf);
@@ -238,6 +236,7 @@ static int sync_session(void *data, struct session_info 
*info)
log_warning(Could not read data from db. Using default and 
currently negotiated values\n);
setup_rec_from_negotiated_values(rec, info);
+   iface_copy(rec.iface, info-iface);
} else {
/*
 * we have a valid record and iface so lets merge
@@ -251,13 +250,12 @@ static int sync_session(void *data, struct session_info 
*info)
memset(sysfsrec, 0, sizeof(node_rec_t));
setup_rec_from_negotiated_values(sysfsrec, info);
/*
-* target, portal and iface name values have to be the same
+* target, portal and iface values have to be the same
 * or we would not have found the record, so just copy
-* CHAP and iface settings.
+* CHAP settings.
 */
memcpy(rec.session.auth, sysfsrec.session.auth,
  sizeof(struct iscsi_auth_config));
-   memcpy(rec.iface, info-iface, sizeof(rec.iface));
}
 
/* multiple drivers could be connected to the same portal */
-- 
1.7.7.4


-- 
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.




[PATCH v4 1/3] ISCSISTART: Saved ibft boot info to the session sysfs

2013-04-12 Thread Eddie Wai
Three new session sysfs parameters are introduced:
boot_root   - holds the ibft boot root folder name
boot_nic- holds the ibft boot ethernetN name
boot_target - holds the ibft boot targetN name

This patch copies over the /sys/firmware/boot_root/ethernetN/targetN info
from the boot context to the node_rec.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 include/fw_context.h   |3 +++
 include/iscsi_if.h |4 
 include/iscsi_proto.h  |1 +
 usr/config.h   |3 +++
 usr/idbm.c |6 ++
 usr/initiator_common.c |   14 +-
 utils/fwparam_ibft/fwparam_sysfs.c |8 
 7 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/include/fw_context.h b/include/fw_context.h
index 1640859..6563d68 100644
--- a/include/fw_context.h
+++ b/include/fw_context.h
@@ -30,6 +30,9 @@
 
 struct boot_context {
struct list_head list;
+   char boot_root[BOOT_NAME_MAXLEN];
+   char boot_nic[BOOT_NAME_MAXLEN];
+   char boot_target[BOOT_NAME_MAXLEN];
 
/* target settings */
int target_port;
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index dad9fd8..7a8ee9a 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -460,6 +460,10 @@ enum iscsi_param {
 
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
+
+   ISCSI_PARAM_BOOT_ROOT,
+   ISCSI_PARAM_BOOT_NIC,
+   ISCSI_PARAM_BOOT_TARGET,
/* must always be last */
ISCSI_PARAM_MAX,
 };
diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h
index 1c69feb..56f757b 100644
--- a/include/iscsi_proto.h
+++ b/include/iscsi_proto.h
@@ -619,6 +619,7 @@ struct iscsi_reject {
 #define KEY_MAXLEN 64
 #define VALUE_MAXLEN   255
 #define TARGET_NAME_MAXLEN VALUE_MAXLEN
+#define BOOT_NAME_MAXLEN   256
 
 #define ISCSI_DEF_MAX_RECV_SEG_LEN 8192
 #define ISCSI_MIN_MAX_RECV_SEG_LEN 512
diff --git a/usr/config.h b/usr/config.h
index 998caff..d457bdd 100644
--- a/usr/config.h
+++ b/usr/config.h
@@ -201,6 +201,9 @@ typedef struct session_rec {
 * allowed to be initiated on this record
 */
unsigned char   multiple;
+   charboot_root[BOOT_NAME_MAXLEN];
+   charboot_nic[BOOT_NAME_MAXLEN];
+   charboot_target[BOOT_NAME_MAXLEN];
 } session_rec_t;
 
 #define ISCSI_TRANSPORT_NAME_MAXLEN 16
diff --git a/usr/idbm.c b/usr/idbm.c
index 4d30aa9..ca2d1f6 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2569,6 +2569,12 @@ struct node_rec 
*idbm_create_rec_from_boot_context(struct boot_context *context)
strlen((char *)context-chap_password);
rec-session.auth.password_in_length =
strlen((char *)context-chap_password_in);
+   strlcpy(rec-session.boot_root, context-boot_root,
+   sizeof(context-boot_root));
+   strlcpy(rec-session.boot_nic, context-boot_nic,
+   sizeof(context-boot_nic));
+   strlcpy(rec-session.boot_target, context-boot_target,
+   sizeof(context-boot_target));
 
iface_setup_from_boot_context(rec-iface, context);
 
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index ef6820c..6fc114d 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -324,7 +324,7 @@ int iscsi_host_set_params(struct iscsi_session *session)
return 0;
 }
 
-#define MAX_SESSION_PARAMS 32
+#define MAX_SESSION_PARAMS 35
 
 int iscsi_session_set_params(struct iscsi_conn *conn)
 {
@@ -496,6 +496,18 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.param = ISCSI_PARAM_INITIATOR_NAME,
.value = session-initiator_name,
.type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_ROOT,
+   .value = session-nrec.session.boot_root,
+   .type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_NIC,
+   .value = session-nrec.session.boot_nic,
+   .type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_TARGET,
+   .value = session-nrec.session.boot_target,
+   .type = ISCSI_STRING,
},
};
 
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c 
b/utils/fwparam_ibft/fwparam_sysfs.c
index 3997363..2f37b59 100644
--- a/utils/fwparam_ibft/fwparam_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
@@ -200,6 +200,9 @@ static int fill_nic_context(char *subsys, char *id,
strlcpy(context-scsi_host_name, subsys,
sizeof(context-scsi_host_name));
 
+   memset(context-boot_nic, 0, sizeof(context

Re: need help before I kill myself

2013-04-08 Thread Eddie Wai

On Mon, 2013-04-08 at 04:25 -0700, liano...@gmail.com wrote:
 I finally got this to work but I have some questions about the card
 and its setup. Some specifics:
  
 Server with 4 onboard NICS (eth0, eth1, eth4, eth5), eth0 connected to
 array via 174.x.x.x (this port will be closed once setup complete,
 used for testing remotely atm)
 BC 5709 dual port (eth2, eth3), eth2 connected to array via 192.x.x.x
 Created and iface config with the following:
  
 # BEGIN RECORD 6.2.0-873.2.el6
 ace.iscsi_ifacename = eth2
 iface.transport_name = bnx2i
 iface.hwaddress = 00:10:18:F3:43:00
 iface.ipaddress = 192.x.x.x
 iface.bootproto = static
 iface.subnet_mask = 255.255.255.0
 iface.vlan_id = 0
 iface.vlan_priority = 0
 iface.iface_num = 0
 iface.mtu = 9000
 iface.port = 0
 # END RECORD
 
  
 I read that ToE cards and other accelerator cards have a separate MAC
 for the accelerator engines. Is this true? So my dual port BC 5709
 would have 4 mac addresses? If so I take the proper Mac to place in
 the iface config would be that of the accelerator?
  
This is true.  You should have 2 MACs and 2 SAN MACs.
The SAN MACs are the ones you need to specify in the iface config file
if you choose to specify the iface.hwaddress explicity.

You should be able to find the corresponding SAN MACs
under /sys/class/iscsi_host.

 # iscsiadm -m session -o show
 tcp: [1] 192.x.x.x:3260,0 iqn.2000-01.com.synology:san.quincy
 
 Is the 'tcp' telling me it is not properly setup? should it be bnx2i
 at the beginning of the above result?
Yes, the bnx2i transport name would be indicated upon a successful
offload connection.
  
 I was also under the impression that when I created an iface config
 file it would act as the default and only connection. I say this
 because the connection with the server's nic is still appearing when I
 reboot. How do I stop this from happening and force the 5709 to be the
 only interface? Right now I just firewalled the 174.x.x.x network from
 the array but that causes a long delay as it times out at boot time,
 not a very elegant fix. I did delete all traces of earlier discovered
 targets with the 174.x.x.x IP.
If the node created already contains the correct transport_name, then
perhaps the MAC address specified was not the SAN MAC.  This would lead
to a fallback to use software iSCSI for your connection.
  
 
 On Thursday, April 4, 2013 2:46:12 PM UTC-4, gee...@gmail.com wrote:
 Hello, 
 I have been trying to setup an iSCSI storage array for several
 weeks now. I have some things working but others are not. I am
 running out of time and am willing to to hire someone with the
 skill and experience to help me out. If this kind of request
 is not accepted on this list I apologize and will stop posting
 at the first notice I receive. If it's ok then please respond.
 
 Here is what I have and need help with. I have purchased a
 Synology DS1812+, running the latest DSM management software
 and configured with 14 TB of storage. I want to use the array
 for my  /home and /backup partitions on my web hosting
 servers. There will be about 3-4 servers using it for this
 purpose. The individiual servers will be running CentOS,
 various versions, and open-iscsi as the initiator. I have
 purchaes a few ToE cards (the broadcom 5709) for the physical
 connections. I am currently working on a new server (centos
 6.4) and testing the concept out. I have been able to connect
 using the server's onboard NIC but not the ToE card. I have
 played with the iface config but it refuses to connect.
 
 I am not going to post the details as I am hoping to have
 someone help me out with this. I am not a very experienced
 Linux administrator but I can manage with proper instruction. 
 
 Thanks for reading
 jservices
 
 -- 
 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.
  
  


-- 
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.




[PATCH 2/3] ISCSID: Modified the Makefile for iscsiuio compilation

2013-02-15 Thread Eddie Wai
This patch modifies the open-iscsi Makefile to include the compilation,
binary/manpage install, and clean of the iscsiuio source.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 Makefile |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index c5d9700..0b7bb98 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,8 @@ mandir = $(prefix)/share/man
 etcdir = /etc
 initddir = $(etcdir)/init.d
 
-MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8
-PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname
+MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 
iscsiuio/docs/iscsiuio.8
+PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname 
iscsiuio/src/unix/iscsiuio
 INSTALL = install
 ETCFILES = etc/iscsid.conf
 IFACEFILES = etc/iface.example
@@ -26,24 +26,29 @@ IFACEFILES = etc/iface.example
 
 all: user
 
-user: utils/open-isns/Makefile
+user: utils/open-isns/Makefile iscsiuio/Makefile
$(MAKE) -C utils/open-isns
$(MAKE) -C utils/sysdeps
$(MAKE) -C utils/fwparam_ibft
$(MAKE) -C usr
$(MAKE) -C utils
+   $(MAKE) -C iscsiuio
@echo
@echo Compilation complete Output file
@echo ---  
@echo Built iSCSI daemon:  usr/iscsid
@echo Built management application:usr/iscsiadm
@echo Built boot tool: usr/iscsistart
+   @echo Built iscsiuio daemon:   iscsiuio/src/unix/iscsiuio
@echo
@echo Read README file for detailed information.
 
 utils/open-isns/Makefile: utils/open-isns/configure utils/open-isns/Makefile.in
cd utils/open-isns; ./configure CFLAGS=$(OPTFLAGS) --with-security=no
 
+iscsiuio/Makefile: iscsiuio/configure iscsiuio/Makefile.in
+   cd iscsiuio; ./configure
+
 kernel: force
$(MAKE) -C kernel
@echo Kernel Compilation complete  Output file
@@ -61,6 +66,7 @@ clean:
$(MAKE) -C utils clean
$(MAKE) -C usr clean
$(MAKE) -C kernel clean
+   $(MAKE) -C iscsiuio clean
$(MAKE) -C utils/open-isns clean
$(MAKE) -C utils/open-isns distclean
 
-- 
1.7.7.4


-- 
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.




[PATCH 1/3] ISCSID: Added socket communication hooks for uip

2013-02-15 Thread Eddie Wai
This patch adds the communication path between iscsid-iscsiuio.

It utilizes the set_net_config func ptr in the iscsi_transport_template
to initiate the callbacks.

Two new files are introduced:  uip_mgmt_ipc.h and uip_mgmt_ipc.c

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 include/iscsi_err.h|2 +
 usr/Makefile   |3 +-
 usr/initiator.c|  112 +++-
 usr/initiator.h|4 ++
 usr/initiator_common.c |   34 ++
 usr/iscsid_req.c   |   91 ++-
 usr/iscsid_req.h   |2 +
 usr/transport.c|2 +
 usr/transport.h|3 +
 9 files changed, 249 insertions(+), 4 deletions(-)

diff --git a/include/iscsi_err.h b/include/iscsi_err.h
index aabea4e..1139133 100644
--- a/include/iscsi_err.h
+++ b/include/iscsi_err.h
@@ -62,6 +62,8 @@ enum {
ISCSI_ERR_OP_NOT_SUPP   = 27,
/* device or resource in use */
ISCSI_ERR_BUSY  = 28,
+   /* Operation failed, but retrying layer may succeed */
+   ISCSI_ERR_AGAIN = 29,
 
/* Always last. Indicates end of error code space */
ISCSI_MAX_ERR_VAL,
diff --git a/usr/Makefile b/usr/Makefile
index 673b7f1..33b517c 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -40,7 +40,8 @@ SYSDEPS_SRCS = $(wildcard ../utils/sysdeps/*.o)
 ISCSI_LIB_SRCS = iscsi_util.o io.o auth.o iscsi_timer.o login.o log.o md5.o \
sha1.o iface.o idbm.o sysfs.o host.o session_info.o iscsi_sysfs.o \
iscsi_net_util.o iscsid_req.o transport.o iser.o cxgbi.o be2iscsi.o \
-   initiator_common.o iscsi_err.o $(IPC_OBJ)  $(SYSDEPS_SRCS)
+   initiator_common.o iscsi_err.o uip_mgmt_ipc.o \
+   $(IPC_OBJ)  $(SYSDEPS_SRCS)
 # core initiator files
 INITIATOR_SRCS = initiator.o scsi.o actor.o event_poll.o mgmt_ipc.o 
kern_err_table.o
 
diff --git a/usr/initiator.c b/usr/initiator.c
index d475358..86df222 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -45,6 +45,7 @@
 #include iscsi_sysfs.h
 #include iscsi_settings.h
 #include iface.h
+#include host.h
 #include sysdeps.h
 #include iscsi_err.h
 #include kern_err_table.h
@@ -557,6 +558,48 @@ static int iscsi_conn_connect(struct iscsi_conn *conn, 
queue_task_t *qtask)
return 0;
 }
 
+static void iscsi_uio_poll_login_timedout(void *data)
+{
+   struct queue_task *qtask = data;
+   struct iscsi_conn *conn = qtask-conn;
+   iscsi_session_t *session = conn-session;
+
+   log_debug(3, timeout waiting for UIO ...\n);
+   mgmt_ipc_write_rsp(qtask, ISCSI_ERR_TRANS_TIMEOUT);
+   conn_delete_timers(conn);
+   __session_destroy(session);
+}
+
+static int iscsi_sched_uio_poll(queue_task_t *qtask)
+{
+   struct iscsi_conn *conn = qtask-conn;
+   struct iscsi_session *session = conn-session;
+   struct iscsi_transport *t = session-t;
+   struct iscsi_ev_context *ev_context;
+
+   if (!t-template-set_net_config)
+   return 0;
+
+   ev_context = iscsi_ev_context_get(conn, 0);
+   if (!ev_context) {
+   /* while reopening the recv pool should be full */
+   log_error(BUG: __session_conn_reopen could 
+ not get conn context for recv.);
+   return -ENOMEM;
+   }
+
+   ev_context-data = qtask;
+   conn-state = ISCSI_CONN_STATE_XPT_WAIT;
+
+   iscsi_sched_ev_context(ev_context, conn, 0, EV_UIO_POLL);
+
+   log_debug(3, Setting login UIO poll timer %p timeout %d,
+ conn-login_timer, conn-login_timeout);
+   actor_timer(conn-login_timer, conn-login_timeout * 1000,
+   iscsi_uio_poll_login_timedout, qtask);
+   return -EAGAIN;
+}
+
 static void
 __session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop,
  int redirected)
@@ -598,6 +641,11 @@ __session_conn_reopen(iscsi_conn_t *conn, queue_task_t 
*qtask, int do_stop,
if (!redirected)
session-reopen_cnt++;
 
+   /* uIP will needs to be re-triggered on the connection re-open */
+   if (iscsi_set_net_config(conn-session-t, conn-session,
+conn-session-nrec.iface) != 0)
+   goto queue_reopen;
+
if (iscsi_conn_connect(conn, qtask)) {
delay = ISCSI_CONN_ERR_REOPEN_DELAY;
goto queue_reopen;
@@ -1670,6 +1718,53 @@ failed_login:
 
 }
 
+static void session_conn_uio_poll(void *data)
+{
+   struct iscsi_ev_context *ev_context = data;
+   iscsi_conn_t *conn = ev_context-conn;
+   struct iscsi_session *session = conn-session;
+   queue_task_t *qtask = ev_context-data;
+   int rc;
+
+   log_debug(4, retrying uio poll);
+   rc = iscsi_set_net_config(session-t, session,
+ conn-session-nrec.iface);
+   if (rc != 0) {
+   if (rc == ISCSI_ERR_AGAIN) {
+   ev_context-data

[PATCH 0/3] open-iscsi patchset to add iscsiuio

2013-02-15 Thread Eddie Wai
This patchset can be applied on top of the open-iscsi package
to enable Broadcom's iSCSI offload user space tool 'iscsiuio'.

This user space tool is used in conjunction with the following
Broadcom Network Controllers to enable iSCSI offload functionality:
  bnx2:  BCM5706, BCM5708, BCM5709 devices
  bnx2x: BCM57710, BCM57711, BCM57711E, BCM57712, BCM57712E,
 BCM57800, BCM57810, BCM57840 devices

Please use 'git apply' to apply the patches.  Otherwise, the
file mode attribute will get lost.

open-iscsi version: mainline
iscsiuio version: 0.7.6.1g


Eddie Wai (3):
  ISCSID: Added socket communication hooks for uip
  ISCSID: Modified the Makefile for iscsiuio compilation
  ISCSID: Added iscsiuio source to the open-iscsi pkg

 Makefile |   12 +-
 include/iscsi_err.h  |2 +
 iscsiuio/COPYING |  674 +
 iscsiuio/ChangeLog   |7 +
 iscsiuio/INSTALL |  290 +
 iscsiuio/Makefile.am |   25 +
 iscsiuio/Makefile.in |  629 +
 iscsiuio/README  |  225 +
 iscsiuio/RELEASE.TXT | 1988 ++
 iscsiuio/aclocal.m4  | 7276 +++
 iscsiuio/compile |  142 +
 iscsiuio/config.guess| 1548 ++
 iscsiuio/config.h.in |  111 +
 iscsiuio/config.status   | 1236 ++
 iscsiuio/config.sub  | 1695 ++
 iscsiuio/configure   |22765 ++
 iscsiuio/configure.ac|   76 +
 iscsiuio/depcomp |  589 +
 iscsiuio/docs/iscsiuio.8 |   86 +
 iscsiuio/install-sh  |  519 +
 iscsiuio/iscsiuiolog |   10 +
 iscsiuio/ltmain.sh   | 6912 +++
 iscsiuio/missing |  367 +
 iscsiuio/src/Makefile.am |1 +
 iscsiuio/src/Makefile.in |  471 +
 iscsiuio/src/README  |   13 +
 iscsiuio/src/apps/Makefile.am|1 +
 iscsiuio/src/apps/Makefile.in|  471 +
 iscsiuio/src/apps/README |2 +
 iscsiuio/src/apps/brcm-iscsi/Makefile.am |   13 +
 iscsiuio/src/apps/brcm-iscsi/Makefile.brcm-iscsi |1 +
 iscsiuio/src/apps/brcm-iscsi/Makefile.in |  446 +
 iscsiuio/src/apps/brcm-iscsi/brcm_iscsi.c|   88 +
 iscsiuio/src/apps/brcm-iscsi/brcm_iscsi.h|   90 +
 iscsiuio/src/apps/dhcpc/Makefile.am  |   13 +
 iscsiuio/src/apps/dhcpc/Makefile.dhcpc   |1 +
 iscsiuio/src/apps/dhcpc/Makefile.in  |  461 +
 iscsiuio/src/apps/dhcpc/dhcpc.c  |  417 +
 iscsiuio/src/apps/dhcpc/dhcpc.h  |   86 +
 iscsiuio/src/apps/dhcpc/dhcpv6.c |  513 +
 iscsiuio/src/apps/dhcpc/dhcpv6.h |  252 +
 iscsiuio/src/uip-1.0-changelog.txt   |   98 +
 iscsiuio/src/uip/Makefile.am |   18 +
 iscsiuio/src/uip/Makefile.in |  562 +
 iscsiuio/src/uip/Makefile.include|   47 +
 iscsiuio/src/uip/clock.h |   87 +
 iscsiuio/src/uip/debug.h |   13 +
 iscsiuio/src/uip/icmpv6.h|  301 +
 iscsiuio/src/uip/ipv6.c  | 1296 ++
 iscsiuio/src/uip/ipv6.h  |  346 +
 iscsiuio/src/uip/ipv6_ndpc.c |  426 +
 iscsiuio/src/uip/ipv6_ndpc.h |   97 +
 iscsiuio/src/uip/ipv6_pkt.h  |   49 +
 iscsiuio/src/uip/lc-addrlabels.h |   80 +
 iscsiuio/src/uip/lc-switch.h |   73 +
 iscsiuio/src/uip/lc.h|  130 +
 iscsiuio/src/uip/psock.c |  339 +
 iscsiuio/src/uip/psock.h |  383 +
 iscsiuio/src/uip/pt.h|  322 +
 iscsiuio/src/uip/timer.c |  127 +
 iscsiuio/src/uip/timer.h |   84 +
 iscsiuio/src/uip/uip-neighbor.c  |  219 +
 iscsiuio/src/uip/uip-neighbor.h  |  105 +
 iscsiuio/src/uip/uip.c   | 2405 +++
 iscsiuio/src/uip/uip.h   | 1569 ++
 iscsiuio/src/uip/uip_arch.h  |  137 +
 iscsiuio/src/uip/uip_arp.c   |  481 +
 iscsiuio/src/uip/uip_arp.h   |  197 +
 iscsiuio/src/uip/uip_eth.c   |   49 +
 iscsiuio/src/uip/uip_eth.h   |   43 +
 iscsiuio/src/uip/uipopt.h|  536 +
 iscsiuio/src/unix

Re: Sources of iscsiuio

2013-02-15 Thread Eddie Wai
Hello Mike,

I've re-spin and resent the patchset based on the open-iscsi mainline
tree.  Please let me know what else we might want to add.

Thanks for your help,
Eddie

On Fri, 2013-02-15 at 16:49 -0600, Mike Christie wrote:
 Let's just get this merged. I think we agreed to merge what we have and
 evolve it as needed in tree.
 
 I think I missed the latest patches that were sent to the list, so
 repost and I will merge them up.
 
 
 On 02/14/2013 11:35 AM, Eddie Wai wrote:
  Hello Rafal, Mike and all,
  
  As we are still working toward having iscsiuio to be merged upstream
  alongside the open-iscsi package, at this time, we want to provide the
  following patchset which includes the source of the latest iscsiuio
  utility and allow it to be compiled and installed alongside the
  open-iscsi source.
  
  http://linux.broadcom.com/mchan/iscsiuio/open-iscsi-2.0-873-patchset-to-add-iscsiuio-0.7.6.1g.tar.gz
  
  The patchset was created based on the recently released
  open-iscsi-2.0-873 source.
  
  We'll be updating this link regularly with the latest patches until
  iscsiuio gets merged upstream.
  
  About iscsiuio:
  Iscsiuio is an user-mode utility which works alongside the open-iscsi
  util to provide ARP/DHCP/PING assistance for Broadcom's Linux iSCSI
  offload solution.  This utility, along with the associated patch hooks,
  has already been shipping under two popular distros for many years.  
  
  Regards,
  Eddie
  
  On Thu, 2013-02-14 at 17:41 +0100, Rafał Ramocki wrote:
  Hi,
 
  Broadcom iSCSI offload engine requires iscsiuio daemon to operate in 
  Linux. I know that this software is included in iscsi-initatior-tools in 
  RHEL, SLES and some other RPM-based Linux distributions. I want to add 
  it to Debian and other DEB-based distributions. I've been looking 
  repository, place or other channel where this user application is 
  available in current version. I've searched the web but didn't found any 
  clues.
 
  Can You give me an information where to look for latest version today 
  and in future?
 
  PS: I found Your addresses in manual of iscsiuio. And thank You for Your 
  time to replay.
 
  best regards
  Rafał Ramocki
  eo Networks
  Senior Administrator
 
 
  
  
 
 


-- 
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: Sources of iscsiuio

2013-02-14 Thread Eddie Wai
Hello Rafal, Mike and all,

As we are still working toward having iscsiuio to be merged upstream
alongside the open-iscsi package, at this time, we want to provide the
following patchset which includes the source of the latest iscsiuio
utility and allow it to be compiled and installed alongside the
open-iscsi source.

http://linux.broadcom.com/mchan/iscsiuio/open-iscsi-2.0-873-patchset-to-add-iscsiuio-0.7.6.1g.tar.gz

The patchset was created based on the recently released
open-iscsi-2.0-873 source.

We'll be updating this link regularly with the latest patches until
iscsiuio gets merged upstream.

About iscsiuio:
Iscsiuio is an user-mode utility which works alongside the open-iscsi
util to provide ARP/DHCP/PING assistance for Broadcom's Linux iSCSI
offload solution.  This utility, along with the associated patch hooks,
has already been shipping under two popular distros for many years.  

Regards,
Eddie

On Thu, 2013-02-14 at 17:41 +0100, Rafał Ramocki wrote:
 Hi,
 
 Broadcom iSCSI offload engine requires iscsiuio daemon to operate in 
 Linux. I know that this software is included in iscsi-initatior-tools in 
 RHEL, SLES and some other RPM-based Linux distributions. I want to add 
 it to Debian and other DEB-based distributions. I've been looking 
 repository, place or other channel where this user application is 
 available in current version. I've searched the web but didn't found any 
 clues.
 
 Can You give me an information where to look for latest version today 
 and in future?
 
 PS: I found Your addresses in manual of iscsiuio. And thank You for Your 
 time to replay.
 
 best regards
 Rafał Ramocki
 eo Networks
 Senior Administrator
 
 


-- 
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_V3 PATCH 2/2] qla4xxx: Add flash target mgmt support through sysfs.

2013-01-10 Thread Eddie Wai
This looks to be a bug where tgt is being dereferenced prior to the
existence check.

On Fri, 2012-11-30 at 07:16 -0500, vikas.chaudh...@qlogic.com wrote:
 +static int qla4xxx_sysfs_ddb_is_non_persistent(struct device *dev,
 void *data)
 +{
 +   struct iscsi_flash_tgt *tgt = iscsi_dev_to_flash_tgt(dev);
 +   struct ddb_sysfs_entry *ddb_sysfs = tgt-dd_data;
 +   int *valid_cookie = data;
 +
 +   if (!iscsi_is_flash_tgt_dev(dev))
 +   return 0;
 +
 +   tgt = iscsi_dev_to_flash_tgt(dev);
 +   ddb_sysfs = tgt-dd_data;
 +
 +   return !(ddb_sysfs-fw_ddb.cookie == *valid_cookie);
 +}


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



Re: Broadcom NIC sessions not retaining on reboot (node.startup=automatic not working)

2012-11-06 Thread Eddie Wai
It is also possible that the corresponding nic interface is up on boot.
It's worthwhile to make sure that the ONBOOT=yes is set inside that
corresponding sysconfig network script.

On Tue, 2012-11-06 at 03:00 -0600, Mike Christie wrote:
 On 11/06/2012 02:29 AM, vaibhav pol wrote:
  Hi 
  set node.startup = manual in 
  iscsid.conf then run iscsiadm to turn on specific portals by setting the 
  --value/-v to automatic.
 
 Just wanted to add some more details.
 
 The iscsi/iscsid service does not go by the iscsid.conf settings alone.
 When you discovery/setup targets it uses those as the defaults for the
 records that get made. If you run
 
 iscsiadm -m node -T youtarget -p ip -I iface
 
 then you will see the settings that will get used for that specific records.
 
 If those also have automatic, then check that the iscsid and iscsi
 services are started at boot (in some distros it might be called
 open-iscsi).
 
 And to set settings for specific records run:
 
 iscsiadm -m node -T youtarget -p ip -I iface -o update -n nameofsetting
 -v newvalue
 
 
 
   
  Thanks and regards
  Vaibhav  Pol
  Senior Technical Officer 
  National PARAM Supercomputing Facility
  Centre for Development of Advanced   Computing
  Ganeshkhind Road
  Pune University Campus
  PUNE-Maharastra
  Phone +91-20-25704176 ext: 176
  Cell Phone :  +919850466409
  
  
  
  On Mon, Nov 5, 2012 at 1:46 PM, riva gupta riva7s...@gmail.com
  mailto:riva7s...@gmail.com wrote:
  
  Dear All
  
  I have connected my host and iSCSI storage directly with LAN cable.
  
  The iface created for the particular port through which the
  connection is made is:
  
  * iscsiadm -m iface -I bnx2i.3c:d9:2b:f5:2e:e7*
  # BEGIN RECORD 2.0-872
  iface.iscsi_ifacename = bnx2i.3c:d9:2b:f5:2e:e7
  iface.net_ifacename = empty
  iface.ipaddress = 192.168.3.20
  iface.hwaddress = 3c:d9:2b:f5:2e:e7
  iface.transport_name = bnx2i
  iface.initiatorname = empty
  # END RECORD
  
  I have successfully discovered the target using the command:
  *iscsiadm -m discovery -t st -p 192.168.3.14:3260
  http://192.168.3.14:3260 -I bnx2i.3c:d9:2b:f5:2e:e7*
  
  And logged into my storage successfully as:
  *iscsiadm -m node -p 192.168.3.14:3260 http://192.168.3.14:3260 -I
  bnx2i.3c:d9:2b:f5:2e:e7 -l
  *
  I can then see my sessions successfully as:
  *iscsiadm -m session*
  bnx2i: [2] 192.168.3.14 tel:%5B2%5D%20192.168.3.14:3260,1
  
  iqn.2001-03.jp.nec:storage01:ist-m000-sn-00090019.lx-hprhel6.target
  
  I have the setting *node.startup = automatic*
  in the file /etc/iscsi/iscsid.conf
  
  But on reboot I see:
  *iscsiadm -m session*
  iscsiadm: No active sessions.
  
  I think the node.startup=automatic is not working. Have any of you
  faced such a problem. Please help.
  
  
  -- 
  You received this message because you are subscribed to the Google
  Groups open-iscsi group.
  To view this discussion on the web visit
  https://groups.google.com/d/msg/open-iscsi/-/iSgT7ktg3bMJ.
  To post to this group, send email to open-iscsi@googlegroups.com
  mailto:open-iscsi@googlegroups.com.
  To unsubscribe from this group, send email to
  open-iscsi+unsubscr...@googlegroups.com
  mailto:open-iscsi%2bunsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/open-iscsi?hl=en.
  
  
  -- 
  You received this message because you are subscribed to the Google
  Groups open-iscsi group.
  To post to this group, send email to open-iscsi@googlegroups.com.
  To unsubscribe from this group, send email to
  open-iscsi+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/open-iscsi?hl=en.
 


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



[PATCH v3 3/3] ISCSID: Added iface content override fix

2012-11-05 Thread Eddie Wai
Patch provided by Mike Christie.

This patch fixes the unconditional overwrite of the iface struct
even when the corresponding iface info from the node config was
found and extracted.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsid.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/usr/iscsid.c b/usr/iscsid.c
index b4bb65b..b912b58 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -111,9 +111,7 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct 
session_info *info)
strlcpy(rec-name, info-targetname, TARGET_NAME_MAXLEN);
rec-conn[0].port = info-persistent_port;
strlcpy(rec-conn[0].address, info-persistent_address, NI_MAXHOST);
-   memcpy(rec-iface, info-iface, sizeof(struct iface_rec));
rec-tpgt = info-tpgt;
-   iface_copy(rec-iface, info-iface);
 
iscsi_sysfs_get_negotiated_session_conf(info-sid, session_conf);
iscsi_sysfs_get_negotiated_conn_conf(info-sid, conn_conf);
@@ -238,6 +236,7 @@ static int sync_session(void *data, struct session_info 
*info)
log_warning(Could not read data from db. Using default and 
currently negotiated values\n);
setup_rec_from_negotiated_values(rec, info);
+   iface_copy(rec.iface, info-iface);
} else {
/*
 * we have a valid record and iface so lets merge
@@ -251,13 +250,12 @@ static int sync_session(void *data, struct session_info 
*info)
memset(sysfsrec, 0, sizeof(node_rec_t));
setup_rec_from_negotiated_values(sysfsrec, info);
/*
-* target, portal and iface name values have to be the same
+* target, portal and iface values have to be the same
 * or we would not have found the record, so just copy
-* CHAP and iface settings.
+* CHAP settings.
 */
memcpy(rec.session.auth, sysfsrec.session.auth,
  sizeof(struct iscsi_auth_config));
-   memcpy(rec.iface, info-iface, sizeof(rec.iface));
}
 
/* multiple drivers could be connected to the same portal */
-- 
1.7.7.4


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



[PATCH v3 1/3] ISCSISTART: Saved ibft boot info to the session sysfs

2012-11-05 Thread Eddie Wai
Three new session sysfs parameters are introduced:
boot_root   - holds the ibft boot root folder name
boot_nic- holds the ibft boot ethernetN name
boot_target - holds the ibft boot targetN name

This patch copies over the /sys/firmware/boot_root/ethernetN/targetN info
from the boot context to the node_rec.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 include/fw_context.h   |3 +++
 include/iscsi_if.h |4 
 include/iscsi_proto.h  |1 +
 usr/config.h   |3 +++
 usr/idbm.c |6 ++
 usr/initiator_common.c |   14 +-
 utils/fwparam_ibft/fwparam_sysfs.c |8 
 7 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/include/fw_context.h b/include/fw_context.h
index 1640859..6563d68 100644
--- a/include/fw_context.h
+++ b/include/fw_context.h
@@ -30,6 +30,9 @@
 
 struct boot_context {
struct list_head list;
+   char boot_root[BOOT_NAME_MAXLEN];
+   char boot_nic[BOOT_NAME_MAXLEN];
+   char boot_target[BOOT_NAME_MAXLEN];
 
/* target settings */
int target_port;
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index dad9fd8..7a8ee9a 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -460,6 +460,10 @@ enum iscsi_param {
 
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
+
+   ISCSI_PARAM_BOOT_ROOT,
+   ISCSI_PARAM_BOOT_NIC,
+   ISCSI_PARAM_BOOT_TARGET,
/* must always be last */
ISCSI_PARAM_MAX,
 };
diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h
index 1c69feb..56f757b 100644
--- a/include/iscsi_proto.h
+++ b/include/iscsi_proto.h
@@ -619,6 +619,7 @@ struct iscsi_reject {
 #define KEY_MAXLEN 64
 #define VALUE_MAXLEN   255
 #define TARGET_NAME_MAXLEN VALUE_MAXLEN
+#define BOOT_NAME_MAXLEN   256
 
 #define ISCSI_DEF_MAX_RECV_SEG_LEN 8192
 #define ISCSI_MIN_MAX_RECV_SEG_LEN 512
diff --git a/usr/config.h b/usr/config.h
index 998caff..d457bdd 100644
--- a/usr/config.h
+++ b/usr/config.h
@@ -201,6 +201,9 @@ typedef struct session_rec {
 * allowed to be initiated on this record
 */
unsigned char   multiple;
+   charboot_root[BOOT_NAME_MAXLEN];
+   charboot_nic[BOOT_NAME_MAXLEN];
+   charboot_target[BOOT_NAME_MAXLEN];
 } session_rec_t;
 
 #define ISCSI_TRANSPORT_NAME_MAXLEN 16
diff --git a/usr/idbm.c b/usr/idbm.c
index 4d30aa9..ca2d1f6 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2569,6 +2569,12 @@ struct node_rec 
*idbm_create_rec_from_boot_context(struct boot_context *context)
strlen((char *)context-chap_password);
rec-session.auth.password_in_length =
strlen((char *)context-chap_password_in);
+   strlcpy(rec-session.boot_root, context-boot_root,
+   sizeof(context-boot_root));
+   strlcpy(rec-session.boot_nic, context-boot_nic,
+   sizeof(context-boot_nic));
+   strlcpy(rec-session.boot_target, context-boot_target,
+   sizeof(context-boot_target));
 
iface_setup_from_boot_context(rec-iface, context);
 
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index ef6820c..6fc114d 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -324,7 +324,7 @@ int iscsi_host_set_params(struct iscsi_session *session)
return 0;
 }
 
-#define MAX_SESSION_PARAMS 32
+#define MAX_SESSION_PARAMS 35
 
 int iscsi_session_set_params(struct iscsi_conn *conn)
 {
@@ -496,6 +496,18 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.param = ISCSI_PARAM_INITIATOR_NAME,
.value = session-initiator_name,
.type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_ROOT,
+   .value = session-nrec.session.boot_root,
+   .type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_NIC,
+   .value = session-nrec.session.boot_nic,
+   .type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_TARGET,
+   .value = session-nrec.session.boot_target,
+   .type = ISCSI_STRING,
},
};
 
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c 
b/utils/fwparam_ibft/fwparam_sysfs.c
index 3997363..2f37b59 100644
--- a/utils/fwparam_ibft/fwparam_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
@@ -200,6 +200,9 @@ static int fill_nic_context(char *subsys, char *id,
strlcpy(context-scsi_host_name, subsys,
sizeof(context-scsi_host_name));
 
+   memset(context-boot_nic, 0, sizeof(context

[PATCH v3 0/3] ISCSITOOLS: Patchset to add the extraction of

2012-11-05 Thread Eddie Wai
Version 3:
- Added support for ISCSI_LLD_ROOT support as well
- Removed the 'boot_initiator' param because its not useful
- Added the 'boot_root' param to hold the 'ibft' or 'iscsi_root'N name to
  support non-ibft sessions
- Moved the boot_nic net param extraction out of the iscsi_sysfs_read_iface
  routine because it can affect iscsiadm iface config printouts

Version 2:
- Added boot_initiator to hold the ibft initiator name
- Added boot_targetN to hold the corresponding ibft target name
- Moved the boot_nic net param extraction to the iscsi_sysfs_read_iface
  routine
- Added extra check before eluding to use the boot_nic info

For the case when iscsid is invoked for the first time after pivot root
during iSCSI boot, the boot connection would fail to re-connect if the
ibft/iscsi_boot sysfs entry contains tagged vlan.

The problem was caused by the lack of such info in the iscsi_session sysfs
for sync_session to inherit from.

The enclosed patchset does the following:
1. Extract and save the ibft-ethernetN name to the boot_context-boot_nic
2. Pass the boot_nic info to be saved to the sessionN sysfs
3. Extract the sessionN boot_nic sysfs info and retrieve the corresponding
   net params

This 'boot_nic' kernel session sysfs entry will only be present for ibft
boot.  Corresponding kernel drivers will have to add the ISCSI_PARAM_BOOT_NIC
attribute to its attr_is_visible table.

The last patch provides the fix for the unconditional overwrite of the
iface struct even after the ibft net info was already extracted.

Please review.  Thanks.
Eddie


Eddie Wai (3):
  ISCSISTART: Saved ibft boot info to the session sysfs
  ISCSID: Added the extraction of the session boot info
  ISCSID: Added iface content override fix

 include/fw_context.h   |3 ++
 include/iscsi_if.h |4 +++
 include/iscsi_proto.h  |1 +
 usr/config.h   |3 ++
 usr/idbm.c |6 +
 usr/initiator_common.c |   14 -
 usr/iscsi_sysfs.c  |   39 
 usr/iscsid.c   |8 ++
 utils/fwparam_ibft/fwparam_sysfs.c |8 +++
 9 files changed, 80 insertions(+), 6 deletions(-)

-- 
1.7.7.4


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



[PATCH v3 2/3] ISCSID: Added the extraction of the session boot info

2012-11-05 Thread Eddie Wai
This patch does the work to extract the corresponding
boot_root-ethernetN net params as specified from the kernel
session boot_nic sysfs entry.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsi_sysfs.c |   39 +++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 4015b35..deea3d3 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -439,6 +439,43 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct 
iface_rec *iface, int *rc)
return host_no;
 }
 
+static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
+{
+   char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
+   char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
+
+   /* Extract boot info */
+   strlcpy(boot_name, boot_target, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
+ boot_content, BOOT_NAME_MAXLEN))
+   return -1;
+   strlcpy(boot_name, boot_nic, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
+ BOOT_NAME_MAXLEN))
+   return -1;
+   strlcpy(boot_name, boot_root, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
+ BOOT_NAME_MAXLEN))
+   return -1;
+
+   /* If all boot_root/boot_target/boot_nic exist, then extract the
+  info from the boot nic */
+   if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
+ BOOT_NAME_MAXLEN))
+   log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
+   else
+   iface-vlan_id = atoi(boot_content);
+
+   if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
+ iface-subnet_mask, NI_MAXHOST))
+   log_debug(5, could not read %s/%s/subnet, boot_root,
+ boot_nic);
+
+   log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
+ boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
+   return 0;
+}
+
 /*
  * Read in iface settings based on host and session values. If
  * session is not passed in, then the ifacename will not be set. And
@@ -920,6 +957,8 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info 
*info, char *session)
 
iscsi_sysfs_read_iface(info-iface, host_no, session, NULL);
 
+   iscsi_sysfs_read_boot(info-iface, session);
+
log_debug(7, found targetname %s address %s pers address %s port %d 
 pers port %d driver %s iface name %s ipaddress %s 
 netdev %s hwaddress %s iname %s,
-- 
1.7.7.4


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



[PATCH v3] LIBISCSI: Added new boot entries in the session sysfs

2012-11-05 Thread Eddie Wai
This is the kernel part of the modification to extract the net params
from the ibft sysfs to the iface struct used for the connection
request upon sync_session in the open-iscsi util.

Three new session sysfs params are defined:
boot_root - holds the name of the /sys/firmware/ibft or iscsi_rootN
boot_nic  - holds the ethernetN name
boot_target - holds the targetN name

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/libiscsi.c |   18 ++
 drivers/scsi/scsi_transport_iscsi.c |   12 
 include/scsi/iscsi_if.h |4 
 include/scsi/libiscsi.h |4 
 4 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..d03328e 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2809,6 +2809,9 @@ void iscsi_session_teardown(struct iscsi_cls_session 
*cls_session)
kfree(session-targetname);
kfree(session-targetalias);
kfree(session-initiatorname);
+   kfree(session-boot_root);
+   kfree(session-boot_nic);
+   kfree(session-boot_target);
kfree(session-ifacename);
 
iscsi_destroy_session(cls_session);
@@ -3248,6 +3251,12 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
return iscsi_switch_str_param(session-ifacename, buf);
case ISCSI_PARAM_INITIATOR_NAME:
return iscsi_switch_str_param(session-initiatorname, buf);
+   case ISCSI_PARAM_BOOT_ROOT:
+   return iscsi_switch_str_param(session-boot_root, buf);
+   case ISCSI_PARAM_BOOT_NIC:
+   return iscsi_switch_str_param(session-boot_nic, buf);
+   case ISCSI_PARAM_BOOT_TARGET:
+   return iscsi_switch_str_param(session-boot_target, buf);
default:
return -ENOSYS;
}
@@ -3326,6 +3335,15 @@ int iscsi_session_get_param(struct iscsi_cls_session 
*cls_session,
case ISCSI_PARAM_INITIATOR_NAME:
len = sprintf(buf, %s\n, session-initiatorname);
break;
+   case ISCSI_PARAM_BOOT_ROOT:
+   len = sprintf(buf, %s\n, session-boot_root);
+   break;
+   case ISCSI_PARAM_BOOT_NIC:
+   len = sprintf(buf, %s\n, session-boot_nic);
+   break;
+   case ISCSI_PARAM_BOOT_TARGET:
+   len = sprintf(buf, %s\n, session-boot_target);
+   break;
default:
return -ENOSYS;
}
diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index 31969f2..2873711 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2484,6 +2484,9 @@ iscsi_session_attr(tgt_reset_tmo, 
ISCSI_PARAM_TGT_RESET_TMO, 0);
 iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0);
 iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0);
 iscsi_session_attr(targetalias, ISCSI_PARAM_TARGET_ALIAS, 0);
+iscsi_session_attr(boot_root, ISCSI_PARAM_BOOT_ROOT, 0);
+iscsi_session_attr(boot_nic, ISCSI_PARAM_BOOT_NIC, 0);
+iscsi_session_attr(boot_target, ISCSI_PARAM_BOOT_TARGET, 0);
 
 static ssize_t
 show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -2570,6 +2573,9 @@ static struct attribute *iscsi_session_attrs[] = {
dev_attr_sess_ifacename.attr,
dev_attr_sess_initiatorname.attr,
dev_attr_sess_targetalias.attr,
+   dev_attr_sess_boot_root.attr,
+   dev_attr_sess_boot_nic.attr,
+   dev_attr_sess_boot_target.attr,
dev_attr_priv_sess_recovery_tmo.attr,
dev_attr_priv_sess_state.attr,
dev_attr_priv_sess_creator.attr,
@@ -2632,6 +2638,12 @@ static umode_t iscsi_session_attr_is_visible(struct 
kobject *kobj,
param = ISCSI_PARAM_INITIATOR_NAME;
else if (attr == dev_attr_sess_targetalias.attr)
param = ISCSI_PARAM_TARGET_ALIAS;
+   else if (attr == dev_attr_sess_boot_root.attr)
+   param = ISCSI_PARAM_BOOT_ROOT;
+   else if (attr == dev_attr_sess_boot_nic.attr)
+   param = ISCSI_PARAM_BOOT_NIC;
+   else if (attr == dev_attr_sess_boot_target.attr)
+   param = ISCSI_PARAM_BOOT_TARGET;
else if (attr == dev_attr_priv_sess_recovery_tmo.attr)
return S_IRUGO | S_IWUSR;
else if (attr == dev_attr_priv_sess_state.attr)
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 917741b..d68b992 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -452,6 +452,10 @@ enum iscsi_param {
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
 
+   ISCSI_PARAM_BOOT_ROOT,
+   ISCSI_PARAM_BOOT_NIC,
+   ISCSI_PARAM_BOOT_TARGET,
+
ISCSI_PARAM_CHAP_IN_IDX,
ISCSI_PARAM_CHAP_OUT_IDX,
/* must always be last */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 6e33386..b021462 100644
--- a/include/scsi

Re: [PATCH v2 2/3] ISCSID: Added the extraction of the session boot info

2012-11-02 Thread Eddie Wai

On Thu, 2012-11-01 at 19:57 -0500, Mike Christie wrote:
 On 10/24/2012 06:30 PM, Eddie Wai wrote:
  +
  +   /* Extract boot info */
  +   strlcpy(boot_content, boot_initiator, sizeof(boot_content));
  +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS,
  + boot_content,
  + boot_name, NAME_SIZE))
  +   goto skip_boot;
  +   strlcpy(boot_content, boot_target, sizeof(boot_content));
  +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS,
  + boot_content,
  + boot_name, NAME_SIZE))
  +   goto skip_boot;
  +   strlcpy(boot_content, boot_nic, sizeof(boot_content));
  +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS,
  + boot_content,
  + boot_name, NAME_SIZE))
  +   goto skip_boot;
  +
  +   /* If boot_initiator/boot_target/boot_nic exist,
  +  then extract the info from the boot nic */
  +   if (sysfs_get_str(boot_name, ISCSI_IBFT_SUBSYS,
  + vlan, boot_content, NAME_SIZE))
  +   log_debug(5, could not read %s/vlan: %d,
  + boot_name, ret);
  +   else
  +   iface-vlan_id = atoi(boot_content);
  +
  +   if (sysfs_get_str(boot_name, ISCSI_IBFT_SUBSYS,
  + subnet-mask,
  + iface-subnet_mask,
  + NI_MAXHOST))
  +   log_debug(5, could not read %s/subnet: %d,
  + boot_name, ret);
  +
  +   memset(boot_content, 0, sizeof(boot_content));
  +skip_boot:
  +   if (strlen(boot_content))
  +   log_debug(5, %s not found, boot_content);
  }
 
 Ok. I was wrong about moving this to the iface code. In one case, we
 want to know the value used for boot. In another we want to know the
 currently used value (if you ran some iscsiadm command to change the
 value then the values will not match).
Right, this is true.  The iscsiadm command to dump iface values should
only report what's in the iface rec and not from the boot.  The boot
values should only be for session resyncs.  Let me adjust this to a more
appropriate place.
 
 Should we just move this to a new function. Then in iscsid call it and
 copy the values. For iscsid non boot restart, do we want to assume we
 want the boot values or the currently used values?
For the non-boot restarts, the boot_xxx params should not be populated.
Hence, it should then just use the currently used values.
 


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



Re: [PATCH v2 1/3] ISCSISTART: Saved ibft boot info to the session sysfs

2012-11-01 Thread Eddie Wai

On Thu, 2012-11-01 at 19:42 -0500, Mike Christie wrote:
 On 10/24/2012 06:30 PM, Eddie Wai wrote:
  +   /* boot_nic is only for IBFT subsys */
  +   memset(context-boot_nic, 0, sizeof(context-boot_nic));
  +   snprintf(context-boot_nic, sizeof(context-boot_nic), %s,
  +id);
  } else
  strlcpy(context-scsi_host_name, subsys,
  sizeof(context-scsi_host_name));
  @@ -224,6 +228,11 @@ static void fill_initiator_context(char *subsys, 
  struct boot_context *context)
sizeof(context-initiatorname));
  sysfs_get_str(initiator, subsys, isid, context-isid,
sizeof(context-isid));
  +
  +   if (!strcmp(IBFT_SUBSYS, subsys))
  +   /* boot_initiator is only for IBFT subsys */
  +   strlcpy(context-boot_initiator, initiator,
  +   sizeof(context-boot_initiator));
   }
   static int fill_tgt_context(char *subsys, char *id,
  struct boot_context *context)
  @@ -240,6 +249,12 @@ static int fill_tgt_context(char *subsys, char *id,
  if (rc)
  return rc;
   
  +   if (!strcmp(IBFT_SUBSYS, subsys)) {
  +   /* boot_target is only for IBFT subsys */
  +   memset(context-boot_target, 0, sizeof(context-boot_target));
  +   snprintf(context-boot_target, sizeof(context-boot_target),
  +%s, id);
  +   }
 
 The above 3 chunks are not correct. Non-ibft drivers export the above
 info too. It is in a different root dir though. Instead of the ibft dir
 
 #define IBFT_SYSFS_ROOT /sys/firmware/ibft/
 
 it is in a per host dir
 
 #define ISCSI_LLD_SUBSYS_PREFIX iscsi_boot
 
The patch wasn't originally intended to export these boot_xxx info for
non-ibft drivers.  But we can certainly do so.
 


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



Re: [PATCH 3/4] ISCSID: Added the extraction of the session boot_nic info

2012-10-24 Thread Eddie Wai

On Wed, 2012-10-24 at 01:27 -0500, Mike Christie wrote:
 On 10/22/2012 05:13 PM, Eddie Wai wrote:
   
  @@ -920,6 +921,28 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct 
  session_info *info, char *session)
   
  iscsi_sysfs_read_iface(info-iface, host_no, session, NULL);
   
  +   ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_nic,
  +   boot_nic, NAME_SIZE);
  +   if (!ret) {
  +   /* If boot_nic exist, then extract the info from the boot nic */
  +   ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS,
  +   vlan, id, NAME_SIZE);
  +   if (ret)
  +   log_debug(5, could not read %s/vlan: %d,
  + boot_nic, ret);
  +   else
  +   info-iface.vlan_id = atoi(id);
  +
  +   ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS,
  +   subnet-mask, info-iface.subnet_mask,
  +   NI_MAXHOST);
  +   if (ret)
  +   log_debug(5, could not read %s/subnet: %d,
  + boot_nic, ret);
  +   } else {
  +   log_debug(5, could not read boot_nic: %d, ret);
  +   }
  +
 
 It seems like this should go in iscsi_sysfs_read_iface.
Yeah, I think so also.
 
 Why only boot nic? Why don't we also export the boot target and initiator?
The ibft-initiator only has the initiator-name that is of interest.
But this info is already in the session sysfs, so I wouldn't think this
would be too helpful.

The ibft-targetN contains the following info:
chap-type, ip-addr, lun, nic-assoc, port, target-name

Many of which are also in the session sysfs as well.  Is there something
in particular that we might be interested in that I missed?  Or are you
just thinking its best to populate all the associated ibft info first
and have a choice to pick and choose what we need for future
augmentations?

The main reason why we need the ethernetN is just because the few net
params in the ibft doesn't get passed over to the session sysfs.  One of
which is the vlan_id which is something that we really need.

Thanks,
Eddie
 


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



[PATCH v2 0/3] ISCSITOOLS: Patchset to add the extraction of ibft net attributes

2012-10-24 Thread Eddie Wai
Version 2:
- Added boot_initiator to hold the ibft initiator name
- Added boot_targetN to hold the corresponding ibft target name
- Moved the boot_nic net param extraction to the iscsi_sysfs_read_iface
  routine
- Added extra check before eluding to use the boot_nic info
  
For the case when iscsid is invoked for the first time after pivot root
during iSCSI boot, the boot connection would fail to re-connect if the
ibft/iscsi_boot sysfs entry contains tagged vlan.
 
The problem was caused by the lack of such info in the iscsi_session sysfs
for sync_session to inherit from.
 
The enclosed patchset does the following:
1. Extract and save the ibft-ethernetN name to the boot_context-boot_nic
2. Pass the boot_nic info to be saved to the sessionN sysfs
3. Extract the sessionN boot_nic sysfs info and retrieve the corresponding
   net params
 
This 'boot_nic' kernel session sysfs entry will only be present for ibft
boot.  Corresponding kernel drivers will have to add the ISCSI_PARAM_BOOT_NIC
attribute to its attr_is_visible table.

The last patch provides the fix for the unconditional overwrite of the
iface struct even after the ibft net info was already extracted.

Please review.  Thanks.
Eddie


Eddie Wai (3):
  ISCSISTART: Saved ibft boot info to the session sysfs
  ISCSID: Added the extraction of the session boot info
  ISCSID: Added iface content override fix

 include/fw_context.h   |3 ++
 include/iscsi_if.h |4 +++
 usr/config.h   |3 ++
 usr/idbm.c |6 +
 usr/initiator_common.c |   14 +++-
 usr/iscsi_sysfs.c  |   40 
 usr/iscsid.c   |8 ++
 utils/fwparam_ibft/fwparam_sysfs.c |   15 +
 8 files changed, 87 insertions(+), 6 deletions(-)

-- 
1.7.7.4


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



[PATCH v2 3/3] ISCSID: Added iface content override fix

2012-10-24 Thread Eddie Wai
Patch provided by Mike Christie.

This patch fixes the unconditional overwrite of the iface struct
even when the corresponding iface info from the node config was
found and extracted.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsid.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/usr/iscsid.c b/usr/iscsid.c
index b4bb65b..b912b58 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -111,9 +111,7 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct 
session_info *info)
strlcpy(rec-name, info-targetname, TARGET_NAME_MAXLEN);
rec-conn[0].port = info-persistent_port;
strlcpy(rec-conn[0].address, info-persistent_address, NI_MAXHOST);
-   memcpy(rec-iface, info-iface, sizeof(struct iface_rec));
rec-tpgt = info-tpgt;
-   iface_copy(rec-iface, info-iface);
 
iscsi_sysfs_get_negotiated_session_conf(info-sid, session_conf);
iscsi_sysfs_get_negotiated_conn_conf(info-sid, conn_conf);
@@ -238,6 +236,7 @@ static int sync_session(void *data, struct session_info 
*info)
log_warning(Could not read data from db. Using default and 
currently negotiated values\n);
setup_rec_from_negotiated_values(rec, info);
+   iface_copy(rec.iface, info-iface);
} else {
/*
 * we have a valid record and iface so lets merge
@@ -251,13 +250,12 @@ static int sync_session(void *data, struct session_info 
*info)
memset(sysfsrec, 0, sizeof(node_rec_t));
setup_rec_from_negotiated_values(sysfsrec, info);
/*
-* target, portal and iface name values have to be the same
+* target, portal and iface values have to be the same
 * or we would not have found the record, so just copy
-* CHAP and iface settings.
+* CHAP settings.
 */
memcpy(rec.session.auth, sysfsrec.session.auth,
  sizeof(struct iscsi_auth_config));
-   memcpy(rec.iface, info-iface, sizeof(rec.iface));
}
 
/* multiple drivers could be connected to the same portal */
-- 
1.7.7.4


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



[PATCH v2 2/3] ISCSID: Added the extraction of the session boot info

2012-10-24 Thread Eddie Wai
This patch does the work to extract the corresponding ibft-ethernetN
net params as specified from the kernel session boot_nic sysfs entry.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsi_sysfs.c |   40 
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 4015b35..ffd8b83 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -53,6 +53,7 @@
 #define ISCSI_IFACE_SUBSYS iscsi_iface
 #define SCSI_HOST_SUBSYS   scsi_host
 #define SCSI_SUBSYSscsi
+#define ISCSI_IBFT_SUBSYS  ibft
 
 #define ISCSI_SESSION_ID   session%d
 #define ISCSI_CONN_ID  connection%d:0
@@ -450,6 +451,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, 
int host_no,
 {
uint32_t tmp_host_no, iface_num;
char host_id[NAME_SIZE];
+   char boot_name[NAME_SIZE], boot_content[NAME_SIZE];
struct iscsi_transport *t;
int ret, iface_type;
 
@@ -565,6 +567,44 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, 
int host_no,
  bound to: iface_fmt \n,
  iface_str(iface));
}
+
+   /* Extract boot info */
+   strlcpy(boot_content, boot_initiator, sizeof(boot_content));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS,
+ boot_content,
+ boot_name, NAME_SIZE))
+   goto skip_boot;
+   strlcpy(boot_content, boot_target, sizeof(boot_content));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS,
+ boot_content,
+ boot_name, NAME_SIZE))
+   goto skip_boot;
+   strlcpy(boot_content, boot_nic, sizeof(boot_content));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS,
+ boot_content,
+ boot_name, NAME_SIZE))
+   goto skip_boot;
+
+   /* If boot_initiator/boot_target/boot_nic exist,
+  then extract the info from the boot nic */
+   if (sysfs_get_str(boot_name, ISCSI_IBFT_SUBSYS,
+ vlan, boot_content, NAME_SIZE))
+   log_debug(5, could not read %s/vlan: %d,
+ boot_name, ret);
+   else
+   iface-vlan_id = atoi(boot_content);
+
+   if (sysfs_get_str(boot_name, ISCSI_IBFT_SUBSYS,
+ subnet-mask,
+ iface-subnet_mask,
+ NI_MAXHOST))
+   log_debug(5, could not read %s/subnet: %d,
+ boot_name, ret);
+
+   memset(boot_content, 0, sizeof(boot_content));
+skip_boot:
+   if (strlen(boot_content))
+   log_debug(5, %s not found, boot_content);
}
 
if (!iface_kern_id)
-- 
1.7.7.4


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



[PATCH v2 1/3] ISCSISTART: Saved ibft boot info to the session sysfs

2012-10-24 Thread Eddie Wai
Three new session sysfs parameters are introduced:
boot_initiator - holds the ibft boot initiator name
boot_nic   - holds the ibft boot ethernetN name
boot_target- holds the ibft boot targetN name

This patch copies over the ibft-initiator/ethernetN/targetN info
from the boot context to the node_rec.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 include/fw_context.h   |3 +++
 include/iscsi_if.h |4 
 usr/config.h   |3 +++
 usr/idbm.c |6 ++
 usr/initiator_common.c |   14 +-
 utils/fwparam_ibft/fwparam_sysfs.c |   15 +++
 6 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/include/fw_context.h b/include/fw_context.h
index 1640859..484e363 100644
--- a/include/fw_context.h
+++ b/include/fw_context.h
@@ -30,6 +30,9 @@
 
 struct boot_context {
struct list_head list;
+   char boot_initiator[TARGET_NAME_MAXLEN + 1];
+   char boot_nic[TARGET_NAME_MAXLEN + 1];
+   char boot_target[TARGET_NAME_MAXLEN + 1];
 
/* target settings */
int target_port;
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index dad9fd8..d9f8506 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -460,6 +460,10 @@ enum iscsi_param {
 
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
+
+   ISCSI_PARAM_BOOT_INITIATOR,
+   ISCSI_PARAM_BOOT_NIC,
+   ISCSI_PARAM_BOOT_TARGET,
/* must always be last */
ISCSI_PARAM_MAX,
 };
diff --git a/usr/config.h b/usr/config.h
index 998caff..42fba71 100644
--- a/usr/config.h
+++ b/usr/config.h
@@ -201,6 +201,9 @@ typedef struct session_rec {
 * allowed to be initiated on this record
 */
unsigned char   multiple;
+   charboot_initiator[TARGET_NAME_MAXLEN + 1];
+   charboot_nic[TARGET_NAME_MAXLEN + 1];
+   charboot_target[TARGET_NAME_MAXLEN + 1];
 } session_rec_t;
 
 #define ISCSI_TRANSPORT_NAME_MAXLEN 16
diff --git a/usr/idbm.c b/usr/idbm.c
index 4d30aa9..56d7e43 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2569,6 +2569,12 @@ struct node_rec 
*idbm_create_rec_from_boot_context(struct boot_context *context)
strlen((char *)context-chap_password);
rec-session.auth.password_in_length =
strlen((char *)context-chap_password_in);
+   strlcpy(rec-session.boot_initiator, context-boot_initiator,
+   sizeof(context-boot_initiator));
+   strlcpy(rec-session.boot_nic, context-boot_nic,
+   sizeof(context-boot_nic));
+   strlcpy(rec-session.boot_target, context-boot_target,
+   sizeof(context-boot_target));
 
iface_setup_from_boot_context(rec-iface, context);
 
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index ef6820c..1d851db 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -324,7 +324,7 @@ int iscsi_host_set_params(struct iscsi_session *session)
return 0;
 }
 
-#define MAX_SESSION_PARAMS 32
+#define MAX_SESSION_PARAMS 35
 
 int iscsi_session_set_params(struct iscsi_conn *conn)
 {
@@ -496,6 +496,18 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.param = ISCSI_PARAM_INITIATOR_NAME,
.value = session-initiator_name,
.type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_INITIATOR,
+   .value = session-nrec.session.boot_initiator,
+   .type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_NIC,
+   .value = session-nrec.session.boot_nic,
+   .type = ISCSI_STRING,
+   }, {
+   .param = ISCSI_PARAM_BOOT_TARGET,
+   .value = session-nrec.session.boot_target,
+   .type = ISCSI_STRING,
},
};
 
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c 
b/utils/fwparam_ibft/fwparam_sysfs.c
index 3997363..190a284 100644
--- a/utils/fwparam_ibft/fwparam_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
@@ -196,6 +196,10 @@ static int fill_nic_context(char *subsys, char *id,
if (rc)
return rc;
}
+   /* boot_nic is only for IBFT subsys */
+   memset(context-boot_nic, 0, sizeof(context-boot_nic));
+   snprintf(context-boot_nic, sizeof(context-boot_nic), %s,
+id);
} else
strlcpy(context-scsi_host_name, subsys,
sizeof(context-scsi_host_name));
@@ -224,6 +228,11 @@ static void fill_initiator_context(char *subsys, struct 
boot_context *context)
  sizeof(context-initiatorname

[PATCH] LIBISCSI: Added new boot entries in the session sysfs

2012-10-24 Thread Eddie Wai
This is the kernel part of the modification to extract the net params
from the ibft sysfs to the iface struct used for the connection
request upon sync_session in the open-iscsi util.

Three new session sysfs params are defined:
boot_initiator
boot_nic
boot_target

Each of which will hold the name of the entry from the ibft table.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/libiscsi.c |   18 ++
 drivers/scsi/scsi_transport_iscsi.c |   12 
 include/scsi/iscsi_if.h |4 
 include/scsi/libiscsi.h |4 
 4 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..1cfa240 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2809,6 +2809,9 @@ void iscsi_session_teardown(struct iscsi_cls_session 
*cls_session)
kfree(session-targetname);
kfree(session-targetalias);
kfree(session-initiatorname);
+   kfree(session-boot_initiator);
+   kfree(session-boot_nic);
+   kfree(session-boot_target);
kfree(session-ifacename);
 
iscsi_destroy_session(cls_session);
@@ -3248,6 +3251,12 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
return iscsi_switch_str_param(session-ifacename, buf);
case ISCSI_PARAM_INITIATOR_NAME:
return iscsi_switch_str_param(session-initiatorname, buf);
+   case ISCSI_PARAM_BOOT_INITIATOR:
+   return iscsi_switch_str_param(session-boot_initiator, buf);
+   case ISCSI_PARAM_BOOT_NIC:
+   return iscsi_switch_str_param(session-boot_nic, buf);
+   case ISCSI_PARAM_BOOT_TARGET:
+   return iscsi_switch_str_param(session-boot_target, buf);
default:
return -ENOSYS;
}
@@ -3326,6 +3335,15 @@ int iscsi_session_get_param(struct iscsi_cls_session 
*cls_session,
case ISCSI_PARAM_INITIATOR_NAME:
len = sprintf(buf, %s\n, session-initiatorname);
break;
+   case ISCSI_PARAM_BOOT_INITIATOR:
+   len = sprintf(buf, %s\n, session-boot_initiator);
+   break;
+   case ISCSI_PARAM_BOOT_NIC:
+   len = sprintf(buf, %s\n, session-boot_nic);
+   break;
+   case ISCSI_PARAM_BOOT_TARGET:
+   len = sprintf(buf, %s\n, session-boot_target);
+   break;
default:
return -ENOSYS;
}
diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index 31969f2..c157bbb 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2484,6 +2484,9 @@ iscsi_session_attr(tgt_reset_tmo, 
ISCSI_PARAM_TGT_RESET_TMO, 0);
 iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0);
 iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0);
 iscsi_session_attr(targetalias, ISCSI_PARAM_TARGET_ALIAS, 0);
+iscsi_session_attr(boot_initiator, ISCSI_PARAM_BOOT_INITIATOR, 0);
+iscsi_session_attr(boot_nic, ISCSI_PARAM_BOOT_NIC, 0);
+iscsi_session_attr(boot_target, ISCSI_PARAM_BOOT_TARGET, 0);
 
 static ssize_t
 show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -2570,6 +2573,9 @@ static struct attribute *iscsi_session_attrs[] = {
dev_attr_sess_ifacename.attr,
dev_attr_sess_initiatorname.attr,
dev_attr_sess_targetalias.attr,
+   dev_attr_sess_boot_initiator.attr,
+   dev_attr_sess_boot_nic.attr,
+   dev_attr_sess_boot_target.attr,
dev_attr_priv_sess_recovery_tmo.attr,
dev_attr_priv_sess_state.attr,
dev_attr_priv_sess_creator.attr,
@@ -2632,6 +2638,12 @@ static umode_t iscsi_session_attr_is_visible(struct 
kobject *kobj,
param = ISCSI_PARAM_INITIATOR_NAME;
else if (attr == dev_attr_sess_targetalias.attr)
param = ISCSI_PARAM_TARGET_ALIAS;
+   else if (attr == dev_attr_sess_boot_initiator.attr)
+   param = ISCSI_PARAM_BOOT_INITIATOR;
+   else if (attr == dev_attr_sess_boot_nic.attr)
+   param = ISCSI_PARAM_BOOT_NIC;
+   else if (attr == dev_attr_sess_boot_target.attr)
+   param = ISCSI_PARAM_BOOT_TARGET;
else if (attr == dev_attr_priv_sess_recovery_tmo.attr)
return S_IRUGO | S_IWUSR;
else if (attr == dev_attr_priv_sess_state.attr)
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 917741b..886a3b0 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -452,6 +452,10 @@ enum iscsi_param {
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
 
+   ISCSI_PARAM_BOOT_INITIATOR,
+   ISCSI_PARAM_BOOT_NIC,
+   ISCSI_PARAM_BOOT_TARGET,
+
ISCSI_PARAM_CHAP_IN_IDX,
ISCSI_PARAM_CHAP_OUT_IDX,
/* must always be last */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 6e33386..4d50665 100644

[PATCH 0/4] ISCSITOOLS: Patchset to add the extraction of ibft net attributes

2012-10-22 Thread Eddie Wai
For the case when iscsid is invoked for the first time after pivot root
during iSCSI boot, the boot connection would fail to re-connect if the
ibft/iscsi_boot sysfs entry contains tagged vlan.

The problem was caused by the lack of such info in the iscsi_session sysfs
for sync_session to inherit from.

The enclosed patchset does the following:
1. Extract and save the ibft-ethernetN name to the boot_context-boot_nic
2. Pass the boot_nic info to be saved to the sessionN sysfs
3. Extract the sessionN boot_nic sysfs info and retrieve the corresponding
   net params

This 'boot_nic' kernel session sysfs entry will only be present for ibft
boot.  Corresponding kernel drivers will have to add the ISCSI_PARAM_BOOT_NIC
attribute to its attr_is_visible table.

The last patch provides the fix for the unconditional overwrite of the
iface struct even after the ibft net info was already extracted.

Please review.  Thanks.
Eddie


Eddie Wai (4):
  ISCSISTART: Saved ibft ethernetN to the session sysfs
  LIBISCSI: Added boot_nic session sysfs
  ISCSID: Added the extraction of the session boot_nic info
  ISCSID: Added iface content override fix

 include/fw_context.h   |1 +
 include/iscsi_if.h |3 +++
 kernel/libiscsi.c  |6 ++
 kernel/libiscsi.h  |2 ++
 kernel/scsi_transport_iscsi.c  |2 ++
 usr/config.h   |1 +
 usr/idbm.c |2 ++
 usr/initiator_common.c |6 +-
 usr/iscsi_sysfs.c  |   25 -
 usr/iscsid.c   |8 +++-
 utils/fwparam_ibft/fwparam_sysfs.c |4 
 11 files changed, 53 insertions(+), 7 deletions(-)

-- 
1.7.7.4


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



[PATCH 3/4] ISCSID: Added the extraction of the session boot_nic info

2012-10-22 Thread Eddie Wai
This patch does the work to extract the corresponding ibft-ethernetN
net params as specified from the kernel session boot_nic sysfs entry.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 include/iscsi_if.h |3 +++
 usr/iscsi_sysfs.c  |   25 -
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index dad9fd8..498117d 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -460,6 +460,9 @@ enum iscsi_param {
 
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
+
+   ISCSI_PARAM_BOOT_NIC,
+
/* must always be last */
ISCSI_PARAM_MAX,
 };
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 4015b35..a4095b5 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -53,6 +53,7 @@
 #define ISCSI_IFACE_SUBSYS iscsi_iface
 #define SCSI_HOST_SUBSYS   scsi_host
 #define SCSI_SUBSYSscsi
+#define ISCSI_IBFT_SUBSYS  ibft
 
 #define ISCSI_SESSION_ID   session%d
 #define ISCSI_CONN_ID  connection%d:0
@@ -793,7 +794,7 @@ int iscsi_sysfs_get_sid_from_path(char *session)
 
 int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session)
 {
-   char id[NAME_SIZE];
+   char id[NAME_SIZE], boot_nic[NAME_SIZE];
int ret, pers_failed = 0;
uint32_t host_no;
 
@@ -920,6 +921,28 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info 
*info, char *session)
 
iscsi_sysfs_read_iface(info-iface, host_no, session, NULL);
 
+   ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_nic,
+   boot_nic, NAME_SIZE);
+   if (!ret) {
+   /* If boot_nic exist, then extract the info from the boot nic */
+   ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS,
+   vlan, id, NAME_SIZE);
+   if (ret)
+   log_debug(5, could not read %s/vlan: %d,
+ boot_nic, ret);
+   else
+   info-iface.vlan_id = atoi(id);
+
+   ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS,
+   subnet-mask, info-iface.subnet_mask,
+   NI_MAXHOST);
+   if (ret)
+   log_debug(5, could not read %s/subnet: %d,
+ boot_nic, ret);
+   } else {
+   log_debug(5, could not read boot_nic: %d, ret);
+   }
+
log_debug(7, found targetname %s address %s pers address %s port %d 
 pers port %d driver %s iface name %s ipaddress %s 
 netdev %s hwaddress %s iname %s,
-- 
1.7.7.4


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



[PATCH 2/4] LIBISCSI: Added boot_nic session sysfs

2012-10-22 Thread Eddie Wai
Kernel component to enable the new 'boot_nic' param in the kernel
session sysfs.


Signed-off-by: Eddie Wai eddie@broadcom.com
---
 kernel/libiscsi.c |6 ++
 kernel/libiscsi.h |2 ++
 kernel/scsi_transport_iscsi.c |2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/kernel/libiscsi.c b/kernel/libiscsi.c
index 59e3a5f..56cf22a 100644
--- a/kernel/libiscsi.c
+++ b/kernel/libiscsi.c
@@ -2833,6 +2833,7 @@ void iscsi_session_teardown(struct iscsi_cls_session 
*cls_session)
kfree(session-username_in);
kfree(session-targetname);
kfree(session-initiatorname);
+   kfree(session-boot_nic);
kfree(session-ifacename);
 
iscsi_destroy_session(cls_session);
@@ -3279,6 +3280,8 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
return iscsi_switch_str_param(session-ifacename, buf);
case ISCSI_PARAM_INITIATOR_NAME:
return iscsi_switch_str_param(session-initiatorname, buf);
+   case ISCSI_PARAM_BOOT_NIC:
+   return iscsi_switch_str_param(session-boot_nic, buf);
default:
return -ENOSYS;
}
@@ -3354,6 +3357,9 @@ int iscsi_session_get_param(struct iscsi_cls_session 
*cls_session,
case ISCSI_PARAM_INITIATOR_NAME:
len = sprintf(buf, %s\n, session-initiatorname);
break;
+   case ISCSI_PARAM_BOOT_NIC:
+   len = sprintf(buf, %s\n, session-boot_nic);
+   break;
default:
return -ENOSYS;
}
diff --git a/kernel/libiscsi.h b/kernel/libiscsi.h
index 0563539..762692c 100644
--- a/kernel/libiscsi.h
+++ b/kernel/libiscsi.h
@@ -287,6 +287,8 @@ struct iscsi_session {
char*targetname;
char*ifacename;
char*initiatorname;
+   char*boot_nic;
+
/* control data */
struct iscsi_transport  *tt;
struct Scsi_Host*host;
diff --git a/kernel/scsi_transport_iscsi.c b/kernel/scsi_transport_iscsi.c
index fed8c9e..6f23318 100644
--- a/kernel/scsi_transport_iscsi.c
+++ b/kernel/scsi_transport_iscsi.c
@@ -1764,6 +1764,7 @@ iscsi_session_attr(lu_reset_tmo, 
ISCSI_PARAM_LU_RESET_TMO, 0);
 iscsi_session_attr(tgt_reset_tmo, ISCSI_PARAM_TGT_RESET_TMO, 0);
 iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0);
 iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0)
+iscsi_session_attr(boot_nic, ISCSI_PARAM_BOOT_NIC, 0)
 
 static ssize_t
 show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -2006,6 +2007,7 @@ iscsi_register_transport(struct iscsi_transport *tt)
SETUP_SESSION_RD_ATTR(tgt_reset_tmo,ISCSI_TGT_RESET_TMO);
SETUP_SESSION_RD_ATTR(ifacename, ISCSI_IFACE_NAME);
SETUP_SESSION_RD_ATTR(initiatorname, ISCSI_INITIATOR_NAME);
+   SETUP_SESSION_RD_ATTR(boot_nic, ISCSI_BOOT_NIC);
SETUP_PRIV_SESSION_RD_ATTR(recovery_tmo);
SETUP_PRIV_SESSION_RD_ATTR(state);
 
-- 
1.7.7.4


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



[PATCH] LIBISCSI: Added the new boot_nic entry in the session sysfs

2012-10-22 Thread Eddie Wai
This is the kernel part of the modification to extract the net params
from the ibft sysfs to the iface struct used for the connection
request upon sync_session in the open-iscsi util.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/libiscsi.c |6 ++
 drivers/scsi/scsi_transport_iscsi.c |4 
 include/scsi/iscsi_if.h |2 ++
 include/scsi/libiscsi.h |2 ++
 4 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..4f4c154 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2809,6 +2809,7 @@ void iscsi_session_teardown(struct iscsi_cls_session 
*cls_session)
kfree(session-targetname);
kfree(session-targetalias);
kfree(session-initiatorname);
+   kfree(session-boot_nic);
kfree(session-ifacename);
 
iscsi_destroy_session(cls_session);
@@ -3248,6 +3249,8 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
return iscsi_switch_str_param(session-ifacename, buf);
case ISCSI_PARAM_INITIATOR_NAME:
return iscsi_switch_str_param(session-initiatorname, buf);
+   case ISCSI_PARAM_BOOT_NIC:
+   return iscsi_switch_str_param(session-boot_nic, buf);
default:
return -ENOSYS;
}
@@ -3326,6 +3329,9 @@ int iscsi_session_get_param(struct iscsi_cls_session 
*cls_session,
case ISCSI_PARAM_INITIATOR_NAME:
len = sprintf(buf, %s\n, session-initiatorname);
break;
+   case ISCSI_PARAM_BOOT_NIC:
+   len = sprintf(buf, %s\n, session-boot_nic);
+   break;
default:
return -ENOSYS;
}
diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index 31969f2..2cc28fe 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2484,6 +2484,7 @@ iscsi_session_attr(tgt_reset_tmo, 
ISCSI_PARAM_TGT_RESET_TMO, 0);
 iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0);
 iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0);
 iscsi_session_attr(targetalias, ISCSI_PARAM_TARGET_ALIAS, 0);
+iscsi_session_attr(boot_nic, ISCSI_PARAM_BOOT_NIC, 0);
 
 static ssize_t
 show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -2570,6 +2571,7 @@ static struct attribute *iscsi_session_attrs[] = {
dev_attr_sess_ifacename.attr,
dev_attr_sess_initiatorname.attr,
dev_attr_sess_targetalias.attr,
+   dev_attr_sess_boot_nic.attr,
dev_attr_priv_sess_recovery_tmo.attr,
dev_attr_priv_sess_state.attr,
dev_attr_priv_sess_creator.attr,
@@ -2632,6 +2634,8 @@ static umode_t iscsi_session_attr_is_visible(struct 
kobject *kobj,
param = ISCSI_PARAM_INITIATOR_NAME;
else if (attr == dev_attr_sess_targetalias.attr)
param = ISCSI_PARAM_TARGET_ALIAS;
+   else if (attr == dev_attr_sess_boot_nic.attr)
+   param = ISCSI_PARAM_BOOT_NIC;
else if (attr == dev_attr_priv_sess_recovery_tmo.attr)
return S_IRUGO | S_IWUSR;
else if (attr == dev_attr_priv_sess_state.attr)
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 917741b..874c8f3 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -452,6 +452,8 @@ enum iscsi_param {
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
 
+   ISCSI_PARAM_BOOT_NIC,
+
ISCSI_PARAM_CHAP_IN_IDX,
ISCSI_PARAM_CHAP_OUT_IDX,
/* must always be last */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 6e33386..7ba5cc8 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -287,6 +287,8 @@ struct iscsi_session {
char*targetalias;
char*ifacename;
char*initiatorname;
+   char*boot_nic;
+
/* control data */
struct iscsi_transport  *tt;
struct Scsi_Host*host;
-- 
1.7.7.4


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



[PATCH] BNX2I: Removed the individual PCI DEVICE ID checking

2012-10-15 Thread Eddie Wai
Removed the individual PCI DEVICE ID checking inside bnx2i.  The device
type can easily be read from the corresponding cnic-flags.  This will
free bnx2i from having to get updated for every new device ID that gets
added.

Signed-off-by: Eddie Wai eddie@broadcom.com
Acked-by: Michael Chan mc...@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i.h   |2 +-
 drivers/scsi/bnx2i/bnx2i_init.c  |   43 +++---
 drivers/scsi/bnx2i/bnx2i_iscsi.c |2 +-
 3 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 3f9e706..b44d04e 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -800,7 +800,7 @@ extern struct device_attribute *bnx2i_dev_attributes[];
 /*
  * Function Prototypes
  */
-extern void bnx2i_identify_device(struct bnx2i_hba *hba);
+extern void bnx2i_identify_device(struct bnx2i_hba *hba, struct cnic_dev *dev);
 
 extern void bnx2i_ulp_init(struct cnic_dev *dev);
 extern void bnx2i_ulp_exit(struct cnic_dev *dev);
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index b17637a..ee009e4ad 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -79,42 +79,33 @@ static struct notifier_block bnx2i_cpu_notifier = {
 /**
  * bnx2i_identify_device - identifies NetXtreme II device type
  * @hba:   Adapter structure pointer
+ * @cnic:  Corresponding cnic device
  *
  * This function identifies the NX2 device type and sets appropriate
  * queue mailbox register access method, 5709 requires driver to
  * access MBOX regs using *bin* mode
  */
-void bnx2i_identify_device(struct bnx2i_hba *hba)
+void bnx2i_identify_device(struct bnx2i_hba *hba, struct cnic_dev *dev)
 {
hba-cnic_dev_type = 0;
-   if ((hba-pci_did == PCI_DEVICE_ID_NX2_5706) ||
-   (hba-pci_did == PCI_DEVICE_ID_NX2_5706S))
-   set_bit(BNX2I_NX2_DEV_5706, hba-cnic_dev_type);
-   else if ((hba-pci_did == PCI_DEVICE_ID_NX2_5708) ||
-   (hba-pci_did == PCI_DEVICE_ID_NX2_5708S))
-   set_bit(BNX2I_NX2_DEV_5708, hba-cnic_dev_type);
-   else if ((hba-pci_did == PCI_DEVICE_ID_NX2_5709) ||
-   (hba-pci_did == PCI_DEVICE_ID_NX2_5709S)) {
-   set_bit(BNX2I_NX2_DEV_5709, hba-cnic_dev_type);
-   hba-mail_queue_access = BNX2I_MQ_BIN_MODE;
-   } else if (hba-pci_did == PCI_DEVICE_ID_NX2_57710||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57711||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57711E   ||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57712||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57712E   ||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57800||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57800_MF ||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57800_VF ||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57810||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57810_MF ||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57810_VF ||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57840||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57840_MF ||
-  hba-pci_did == PCI_DEVICE_ID_NX2_57840_VF)
+   if (test_bit(CNIC_F_BNX2_CLASS, dev-flags)) {
+   if (hba-pci_did == PCI_DEVICE_ID_NX2_5706 ||
+   hba-pci_did == PCI_DEVICE_ID_NX2_5706S) {
+   set_bit(BNX2I_NX2_DEV_5706, hba-cnic_dev_type);
+   } else if (hba-pci_did == PCI_DEVICE_ID_NX2_5708 ||
+   hba-pci_did == PCI_DEVICE_ID_NX2_5708S) {
+   set_bit(BNX2I_NX2_DEV_5708, hba-cnic_dev_type);
+   } else if (hba-pci_did == PCI_DEVICE_ID_NX2_5709 ||
+   hba-pci_did == PCI_DEVICE_ID_NX2_5709S) {
+   set_bit(BNX2I_NX2_DEV_5709, hba-cnic_dev_type);
+   hba-mail_queue_access = BNX2I_MQ_BIN_MODE;
+   }
+   } else if (test_bit(CNIC_F_BNX2X_CLASS, dev-flags)) {
set_bit(BNX2I_NX2_DEV_57710, hba-cnic_dev_type);
-   else
+   } else {
printk(KERN_ALERT bnx2i: unknown device, 0x%x\n,
  hba-pci_did);
+   }
 }
 
 
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 3b34c13..0056e47 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -808,7 +808,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)
hba-pci_func = PCI_FUNC(hba-pcidev-devfn);
hba-pci_devno = PCI_SLOT(hba-pcidev-devfn);
 
-   bnx2i_identify_device(hba);
+   bnx2i_identify_device(hba, cnic);
bnx2i_setup_host_queue_size(hba, shost);
 
hba-reg_base = pci_resource_start(hba-pcidev, 0);
-- 
1.7.7.4


-- 
You received this message because you are subscribed to the Google Groups 
open

Re: [PATCH 0/2] ISCSID - Fixed sync_session

2012-10-10 Thread Eddie Wai

On Tue, 2012-10-09 at 21:31 -0500, Michael Christie wrote:
 On Oct 8, 2012, at 7:44 PM, Eddie Wai eddie@broadcom.com wrote:
 
  Upon the startup of iscsid in both the iSCSI boot and the non-boot
  environment, the sync_session procedure fails to recover the connection
  when the connection require additional net param setup for the sync.
  
  For boot, there are additional params from ibft.  Namely:
  vlan, gateway, subnet_mask.
  
  For non-boot, the additional net params are in the corresponding iface
  config file.
  
  For both cases, the info must be explicitly extracted from either
  the ibft/iscsi_boot sysfs, or from the iface config file correspondingly
  before the connection can be sync'd.
  
  Please review, thanks!
 
 Would it be possible to make bnx2i to work like be2iscsi/qla4xxx where it 
 exports the all the net info in sysfs in the iface did? I think that would 
 take care of needing the net info.
 
 I think we would just need to then fix up iface_setup_from_boot_context so 
 that it used the newer kernel based iface naming that is done in 
 iface_setup_binding_from_kern_iface when creating the default iface: 
 transport_name.mac.ipv4-or-ipv6.some_num.
 
I did not know that be2iscsi/qla4xxx would create such iface sysfs
entries even for non-boot session establishments.  I always thought
these iface sysfs entries would only get created upon iface update
applies.

I agree with you that the best solution would probably be populating the
iscsi_iface sysfs for all sessions that's currently active.  This way,
no matter where the session would come from (boot or non-boot), sysfs
will always have an iscsi_iface entry to retrieve the net params from
during sync.

Let me see if I can spin the patch to do this instead.




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



[PATCH 0/2] ISCSID - Fixed sync_session

2012-10-08 Thread Eddie Wai
Upon the startup of iscsid in both the iSCSI boot and the non-boot
environment, the sync_session procedure fails to recover the connection
when the connection require additional net param setup for the sync.

For boot, there are additional params from ibft.  Namely:
vlan, gateway, subnet_mask.

For non-boot, the additional net params are in the corresponding iface
config file.

For both cases, the info must be explicitly extracted from either
the ibft/iscsi_boot sysfs, or from the iface config file correspondingly
before the connection can be sync'd.

Please review, thanks!

Eddie

Eddie Wai (2):
  ISCSID: Fixed the syncing of ibft/iscsi_boot disk connections with
vlan
  ISCSID: Fixed the syncing of non-boot sessions with tagged vlan

 usr/iface.c  |2 +-
 usr/iscsid.c |   45 +++--
 2 files changed, 44 insertions(+), 3 deletions(-)

-- 
1.7.7.4


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



[PATCH 1/2] ISCSID: Fixed the syncing of ibft/iscsi_boot disk connections with vlan

2012-10-08 Thread Eddie Wai
For the case when iscsid is invoked for the first time after pivot root
during iSCSI boot, the boot connection would fail to re-connect if the
ibft/iscsi_boot sysfs entry contains tagged vlan.

The problem was caused by the lack of such info in the iscsi_session sysfs
for sync_session to inherit from.

The proposed solution is as follows:
1. Utilize unique ifacename identifier for boot specific connections:
   old iface.name for the boot connection: transport.MAC
   new iface.name for the boot connection: transport.MAC.boot

2. Upon sync_session, the session's ifacename will then be used to compare
   against the MAC+'boot' ifacename as generated from the ibft/iscsi_boot
   sysfs entries.  Upon a match, the additional params from the boot nic will
   then get passed to the sync_session's iface record for the reconnection 
request.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iface.c  |2 +-
 usr/iscsid.c |   38 +-
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/usr/iface.c b/usr/iface.c
index c86892e..98b1aed 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -956,7 +956,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
strcpy(iface-transport_name, t-name);
 
memset(iface-name, 0, sizeof(iface-name));
-   snprintf(iface-name, sizeof(iface-name), %s.%s,
+   snprintf(iface-name, sizeof(iface-name), %s.%s.boot,
 iface-transport_name, context-mac);
strlcpy(iface-hwaddress, context-mac,
sizeof(iface-hwaddress));
diff --git a/usr/iscsid.c b/usr/iscsid.c
index b4bb65b..295a29e 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -51,6 +51,7 @@
 #include discoveryd.h
 #include iscsid_req.h
 #include iscsi_err.h
+#include fw_context.h
 
 /* global config info */
 struct iscsi_daemon_config daemon_config;
@@ -186,6 +187,30 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct 
session_info *info)
}
 }
 
+static int iscsi_match_boot(struct iface_rec *iface,
+   struct list_head *targets)
+{
+   struct boot_context *context;
+   int rc = -ENODEV;
+
+   if (!iface)
+   return rc;
+   if (!strstr(iface-name, .boot))
+   return rc;
+
+   /* Find the matching boot nic */
+   list_for_each_entry(context, targets, list) {
+   if (strstr(iface-name, context-mac)) {
+   iface-vlan_id = atoi(context-vlan);
+   strlcpy(iface-gateway, context-gateway, NI_MAXHOST);
+   strlcpy(iface-subnet_mask, context-mask, NI_MAXHOST);
+   log_debug(1, iscsi_match_boot found\n);
+   return 0;
+   }
+   }
+   return rc;
+}
+
 static int sync_session(void *data, struct session_info *info)
 {
node_rec_t rec, sysfsrec;
@@ -193,6 +218,7 @@ static int sync_session(void *data, struct session_info 
*info)
iscsiadm_rsp_t rsp;
struct iscsi_transport *t;
int rc, retries = 0;
+   struct list_head *boot_targets = data;
 
log_debug(7, sync session [%d][%s,%s.%d][%s]\n, info-sid,
  info-targetname, info-persistent_address,
@@ -269,6 +295,12 @@ static int sync_session(void *data, struct session_info 
*info)
 * app.
 */
strcpy(rec.iface.iname, info-iface.iname);
+
+   /* In the case the session is from boot, extract the additional
+  boot iface info */
+   if (iscsi_match_boot(rec.iface, boot_targets))
+   log_debug(1, Could not get boot entry.\n);
+
memset(req, 0, sizeof(req));
req.command = MGMT_IPC_SESSION_SYNC;
req.u.session.sid = info-sid;
@@ -348,6 +380,7 @@ int main(int argc, char *argv[])
struct sigaction sa_new;
int control_fd;
pid_t pid;
+   LIST_HEAD(boot_targets);
 
while ((ch = getopt_long(argc, argv, c:i:fd:nu:g:p:vh, long_options,
 longindex)) = 0) {
@@ -511,7 +544,10 @@ int main(int argc, char *argv[])
if (pid == 0) {
int nr_found = 0;
/* child */
-   iscsi_sysfs_for_each_session(NULL, nr_found, sync_session);
+   fw_get_targets(boot_targets);
+   iscsi_sysfs_for_each_session(boot_targets, nr_found,
+sync_session);
+   fw_free_targets(boot_targets);
exit(0);
} else if (pid  0) {
log_error(Fork failed error %d: existing sessions
-- 
1.7.7.4


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



[PATCH 2/2] ISCSID: Fixed the syncing of non-boot sessions with tagged vlan

2012-10-08 Thread Eddie Wai
For the syncing of non-boot sessions, the vlan info would have to
be extracted from the iface config file.  This patch adds such
a call to retrieve the additional net params from the iface config
file.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsid.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/usr/iscsid.c b/usr/iscsid.c
index 295a29e..15926e7 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -107,13 +107,18 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct 
session_info *info)
struct iscsi_session_operational_config session_conf;
struct iscsi_conn_operational_config conn_conf;
struct iscsi_auth_config auth_conf;
+   int rc;
 
idbm_node_setup_from_conf(rec);
strlcpy(rec-name, info-targetname, TARGET_NAME_MAXLEN);
rec-conn[0].port = info-persistent_port;
strlcpy(rec-conn[0].address, info-persistent_address, NI_MAXHOST);
-   memcpy(rec-iface, info-iface, sizeof(struct iface_rec));
rec-tpgt = info-tpgt;
+
+   rc = iface_conf_read(info-iface);
+   if (rc)
+   log_warning(iface %s configuration file not found (%d),
+   info-iface.name, rc);
iface_copy(rec-iface, info-iface);
 
iscsi_sysfs_get_negotiated_session_conf(info-sid, session_conf);
-- 
1.7.7.4


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



[PATCH] ISCSID: Passing more net params from ibft to iface

2012-09-27 Thread Eddie Wai
Added the passing of the vlan_id, subnet_mask, and gateway attributes
from the ibft context to the iface struct for the connection request.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iface.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/usr/iface.c b/usr/iface.c
index 4f81a76..c86892e 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -962,6 +962,11 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
sizeof(iface-hwaddress));
strlcpy(iface-ipaddress, context-ipaddr,
sizeof(iface-ipaddress));
+   iface-vlan_id = atoi(context-vlan);
+   strlcpy(iface-subnet_mask, context-mask,
+   sizeof(iface-subnet_mask));
+   strlcpy(iface-gateway, context-gateway,
+   sizeof(iface-gateway));
log_debug(1, iface  iface_fmt \n, iface_str(iface));
return 1;
 }
-- 
1.7.7.4


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



[PATCH] BNX2I: Fixed NULL ptr deference for 1G bnx2 Linux iSCSI offload

2012-08-21 Thread Eddie Wai
This patch fixes the following kernel panic invoked by uninitialized fields
in the chip initialization for the 1G bnx2 iSCSI offload.

One of the bits in the chip initialization is being used by the latest
firmware to control overflow packets.  When this control bit gets enabled
erroneously, it would ultimately result in a bad packet placement which would
cause the bnx2 driver to dereference a NULL ptr in the placement handler.

This can happen under certain stress I/O environment under the Linux
iSCSI offload operation.

This change only affects Broadcom's 5709 chipset.

Unable to handle kernel NULL pointer dereference at 0008 RIP:
 [881f0e7d] :bnx2:bnx2_poll_work+0xd0d/0x13c5
Pid: 0, comm: swapper Tainted: G  2.6.18-333.el5debug #2
RIP: 0010:[881f0e7d]  [881f0e7d] 
:bnx2:bnx2_poll_work+0xd0d/0x13c5
RSP: 0018:8101b575bd50  EFLAGS: 00010216
RAX: 0005 RBX: 81007c5fb180 RCX: 
RDX: 0ffc RSI: 817e8000 RDI: 0220
RBP: 81015bbd7ec0 R08: 8100817e9000 R09: 
R10: 81007c5fb180 R11: 00c8 R12: 7a25a010
R13:  R14: 0005 R15: 810159f80558
FS:  () GS:8101afebc240() knlGS:
CS:  0010 DS: 0018 ES: 0018 CR0: 8005003b
CR2: 0008 CR3: 00201000 CR4: 06a0
Process swapper (pid: 0, threadinfo 8101b5754000, task 8101afebd820)
Stack:  000b 810159f8 0040 810159f80520
 810159f80500 00cf00cf8008e84b c200100939e0 810009035b20
 5029 00be0001 8100817e7810 00d08101b575bea8
Call Trace:
 IRQ  [8008e0d0] show_schedstat+0x1c2/0x25b
 [881f1886] :bnx2:bnx2_poll+0xf6/0x231
 [8000c9b9] net_rx_action+0xac/0x1b1
 [800125a0] __do_softirq+0x89/0x133
 [8005e30c] call_softirq+0x1c/0x28
 [8006d5de] do_softirq+0x2c/0x7d
 [8006d46e] do_IRQ+0xee/0xf7
 [8005d625] ret_from_intr+0x0/0xa
 EOI  [801a5780] acpi_processor_idle_simple+0x1c5/0x341
 [801a573d] acpi_processor_idle_simple+0x182/0x341
 [801a55bb] acpi_processor_idle_simple+0x0/0x341
 [80049560] cpu_idle+0x95/0xb8
 [80078b1c] start_secondary+0x479/0x488

Signed-off-by: Eddie Wai eddie@broadcom.com
Cc: sta...@kernel.org
---
 drivers/scsi/bnx2i/bnx2i_hwi.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 86a12b4..3878e62 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1264,6 +1264,9 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba)
int rc = 0;
u64 mask64;
 
+   memset(iscsi_init, 0x00, sizeof(struct iscsi_kwqe_init1));
+   memset(iscsi_init2, 0x00, sizeof(struct iscsi_kwqe_init2));
+
bnx2i_adjust_qp_size(hba);
 
iscsi_init.flags =
-- 
1.7.7.4


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



Re: [PATCH] BNX2I: Removed the reference to the netdev-base_addr

2012-07-03 Thread Eddie Wai
Thanks, Mike.

Hello James,

This patch is actually a critical bug fix as the 1G bnx2 driver no
longer supports the netdev-base_addr in the current kernel of the scsi
tree.  This means that Broadcom's 1G Linux iSCSI offload solution would
not work at all without this patch.  If at all possible, please consider
including this patch into the fixes branch.

Thanks,
Eddie

On Fri, 2012-06-29 at 21:41 -0500, Mike Christie wrote:
 On 06/29/2012 06:37 PM, Eddie Wai wrote:
  The netdev-base_addr parameter has been deprecated in the L2 bnx2
  driver.  This is used by bnx2i for the BARn iomapping.
 
  This patch will directly reference the pci_resource_start instead
  of using the deprecated netdev-base_addr.
 
  Signed-off-by: Eddie Wai eddie@broadcom.com
 
 
 Looks ok to me
 
 Reviewed-by: Mike Christie micha...@cs.wisc.edu
 


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



[PATCH] BNX2I: Removed the reference to the netdev-base_addr

2012-06-29 Thread Eddie Wai
The netdev-base_addr parameter has been deprecated in the L2 bnx2
driver.  This is used by bnx2i for the BARn iomapping.

This patch will directly reference the pci_resource_start instead
of using the deprecated netdev-base_addr.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i.h   |1 +
 drivers/scsi/bnx2i/bnx2i_hwi.c   |3 +--
 drivers/scsi/bnx2i/bnx2i_iscsi.c |   10 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 0c53c28..7e77cf6 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -350,6 +350,7 @@ struct bnx2i_hba {
struct pci_dev *pcidev;
struct net_device *netdev;
void __iomem *regview;
+   resource_size_t reg_base;
 
u32 age;
unsigned long cnic_dev_type;
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index ece47e5..86a12b4 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -2724,7 +2724,6 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep)
goto arm_cq;
}
 
-   reg_base = ep-hba-netdev-base_addr;
if ((test_bit(BNX2I_NX2_DEV_5709, ep-hba-cnic_dev_type)) 
(ep-hba-mail_queue_access == BNX2I_MQ_BIN_MODE)) {
config2 = REG_RD(ep-hba, BNX2_MQ_CONFIG2);
@@ -2740,7 +2739,7 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep)
/* 5709 device in normal node and 5706/5708 devices */
reg_off = CTX_OFFSET + (MB_KERNEL_CTX_SIZE * cid_num);
 
-   ep-qp.ctx_base = ioremap_nocache(reg_base + reg_off,
+   ep-qp.ctx_base = ioremap_nocache(ep-hba-reg_base + reg_off,
  MB_KERNEL_CTX_SIZE);
if (!ep-qp.ctx_base)
return -ENOMEM;
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index f8d516b..621538b 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -811,13 +811,13 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)
bnx2i_identify_device(hba);
bnx2i_setup_host_queue_size(hba, shost);
 
+   hba-reg_base = pci_resource_start(hba-pcidev, 0);
if (test_bit(BNX2I_NX2_DEV_5709, hba-cnic_dev_type)) {
-   hba-regview = ioremap_nocache(hba-netdev-base_addr,
-  BNX2_MQ_CONFIG2);
+   hba-regview = pci_iomap(hba-pcidev, 0, BNX2_MQ_CONFIG2);
if (!hba-regview)
goto ioreg_map_err;
} else if (test_bit(BNX2I_NX2_DEV_57710, hba-cnic_dev_type)) {
-   hba-regview = ioremap_nocache(hba-netdev-base_addr, 4096);
+   hba-regview = pci_iomap(hba-pcidev, 0, 4096);
if (!hba-regview)
goto ioreg_map_err;
}
@@ -884,7 +884,7 @@ cid_que_err:
bnx2i_free_mp_bdt(hba);
 mp_bdt_mem_err:
if (hba-regview) {
-   iounmap(hba-regview);
+   pci_iounmap(hba-pcidev, hba-regview);
hba-regview = NULL;
}
 ioreg_map_err:
@@ -910,7 +910,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)
pci_dev_put(hba-pcidev);
 
if (hba-regview) {
-   iounmap(hba-regview);
+   pci_iounmap(hba-pcidev, hba-regview);
hba-regview = NULL;
}
bnx2i_free_mp_bdt(hba);
-- 
1.7.7.4


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



open-iscsi - Win2012 iSCSI target

2012-06-20 Thread Eddie Wai
Hello Mike,

We recently discovered a login interoperability issue using software
iSCSI (open-iscsi 872) connecting against the iSCSI software target that
comes with the win2012 rc build (build 8400).  Notice the same problem
is not seen with their target version 3.3.

The problem appears to be related to the Wintarget not allowing the
SessionType, InitiatorName, InitiatorAlias, TargetAlias, TargetName, and
TargetPortalGroupTag keys to be negotiated during the
OperationalNegotiation stage of the Login phase.  I think this
contradicts to RFC 3720 which indicates that the described keys CAN also
be negotiated at this stage of the login phase.

I've attached iscsid/iscsiadm logs and sniffer traces captured from our
PQA team for your reference.  The target merely response with the
NotUnderstood value to some of the keys mentioned.

One way to workaround the problem is to enable the authentication method
(to CHAP or something) so that the above keys along with the
AuthenMethod can be negotiated through the SecurityNegotiation stage
instead.  Another way would be to change the login procedure in
open-iscsi to always start the login with the SecurityNegotiation stage
even when the authentication method is set to None.

Anyhow, I would think we want to have this fixed in the target.  Let me
know what you think as I wasn't able to find anything online that
touches this subject matter.

Thanks,
Eddie

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



login_problem.tar.gz
Description: application/compressed-tar


Re: Problem with REJECT coming from an MS iSCSI target?

2012-05-23 Thread Eddie Wai

On Wed, 2012-05-23 at 12:33 -0500, Mike Christie wrote:
 On 05/23/2012 10:16 AM, Lee Duncan wrote:
  Hi Mike:
  
  On May 22, 2012, at 12:15 PM, Mike Christie wrote:
  
  On 05/22/2012 12:17 PM, Lee Duncan wrote:
  Hi All:
 
  I have tracked down a problem I was having with open-iscsi and smartd,
  and I thought I'd see if anybody else has seen this.
 
  In my case, there is a SLES 11 server booting using iSCSI, and the iSCSI
  target is the latest Microsoft software target (version 3.3) does not
  form the iSCSI PDU correctly when REJECTing a packet.
 
  What seems to happen is that smartd sends down an illegal SCSI command
  because it's testing for an ATA pass-through interface.
 
  The MS iSCSI target sees this illegal PDU and sends a REJECT. But the
  target sets the StatSN incorrectly, left-shifting the StatSN value. In
  my case, an expected StatSN value of 0xd9 was returned as 0xd900.
 
  The open-iscsi initiator sees this as an error and attempts recovery via
  closing the connection then reconnecting. This recovery works but
 
 
  Are you sure the initiator is closing the connection? I think we just
  copy the statsn from the pdu, increment it and then pass it back the
  target in the expStatSN field of the next pdu.
 
  
  I'm not sure who or what is closing it. I have a tcp dump, and it shows the 
  following sequence:
  
  Init - Tgt: iSCSI: SCSI Command 0x24, with ExpectedStatSN of 0xd9 (from 
  smartd)
  Tgt - Init: iSCSI: SCSI Reject of Command 0x24 (with bogus StatSN of 
  0xd900)
  Tgt - Init: TCP: Sends a RST, ACK (reset,  acknowledge)
  
  
  So the MS target sends the incorrectly-formatted REJECT, then a TCP RESET 
  ACK, to which to initiator  responds with a SYN:
  
  Init - Tgt: TCP: Sends a SYN (connection establish request)
  Tgt - Init: TCP: Sends a SYN ACK
  Init - Tgt: TCP: Sends an ACK
  
  So it looks like the connection is being reestablished. Right after that, 
  we get:
  
  Init - Tgt: iSCSI: Login Command
  … (TCP and ARP stuff)
  Tgt - Init: iSCSI: Login Successful
  
  (I'd be glad to send you this PCAP file …)
 
 No need. I assumed you were using iscsi_tcp. I see you are using bnx2i,
 so this makes sense now.
 
  
  
  The log file on my initiator shows this immediately after smartd starts up 
  and starts probing the iSCSI MS Target:
  
  [  109.327424]  connection1:0: bnx2i: iscsi_error - wrong StatSN rcvd
  [  109.327431]  connection1:0: conn_err - hostno 6 conn 880076f114c8, 
  iscsi_cid 3 cid 43
  [  109.327440]  connection1:0: detected conn error (1011) Kernel reported 
  iSCSI connection 1:0 error (1011 - ISCSI_ERR_CONN_FAILED: iSCSI connection 
  failed) state (3)
  [  113.008661]  connection1:0: bnx2i: conn update - MBL 0x4 FBL 
  0x1MRDSL_I 0x4 MRDSL_T 0x1
  [  113.009289]  connection1:0: bnx2i: iscsi_error - wrong StatSN rcvd
  [  113.009294]  connection1:0: conn_err - hostno 6 conn 880076f114c8, 
  iscsi_cid 4 cid 44
  [  113.009302]  connection1:0: detected conn error (1011) Device: /dev/sda, 
  opened
  iscsid: connection1:0 is operational after recovery (1 attempts)
  Kernel reported iSCSI connection 1:0 error (1011 - ISCSI_ERR_CONN_FAILED: 
  iSCSI connection failed) state (3)
  [  117.186588]  connection1:0: bnx2i: conn update - MBL 0x4 FBL 
  0x1MRDSL_I 0x4 MRDSL_T 0x1
  
  To be honest, looking at this, it looks like the work around, if any, would 
  have to be applied to bnx2i, not open-iscsi. What do you think?
  
 
 Yeah. libiscsi is not doing anything in this case. It is all bnx2i
 bnx2i_process_iscsi_error.
 
bnx2i has a module parameter to mask out the specific errors from
various targets.  We could default this statsn error mask to ON so it
won't force recovery.  This is being considered.

I don't think many has seen this as the problem only pertains to REJECT
frames, which often times warrants a recovery.
  
 
  ...
 
 
 
  So I wondered:
 
  1. Has anybody else seen this?, and
 
 
  Nope.
 
  2. Is there any interest in putting in a work around for such behavior,
  since the MS target is quite common?
 
  What is the ETA for MS fixing this in their target? Their target is
  software right? I do not mind adding workarounds for targets, but for
  software targets if the target implementer can send a update quicker or
  as quick as us then it does not make sense to do workarounds in the
  initiator.
  
  
  I did not find any indication that MS plans to fix this.
 
 Do you know if it has this been added in a recent release or is a long
 standing bug?
 


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



Re: [PATCH 1/3] ISCSID: Added iface_num to the ep_connect kernel call

2012-04-25 Thread Eddie Wai

On Wed, 2012-04-18 at 12:42 -0500, Mike Christie wrote:
 On 04/18/2012 11:58 AM, Eddie Wai wrote:
  
  On Wed, 2012-04-18 at 03:14 -0500, Mike Christie wrote:
  On 04/18/2012 01:21 AM, Eddie Wai wrote:
 
  On Tue, 2012-04-17 at 21:36 -0500, Mike Christie wrote:
  On 04/04/2012 06:39 PM, Eddie Wai wrote:
  struct msg_req_path {
  uint32_thost_no;
  +   uint32_tiface_num;
  } req_path;
 
  Are you using this in iscsiuo now? Do you match the host_no + iface_num
  to some iface file in /var/lib/iscsi/ifaces? How do you do it?
 
  The new iscsiuio will look for the host_no from the uevent and extract
  the iface_num accordingly.  The matching logic matches this iface_num
  with the iface struct created from the iface info received from the
  iscsid-iscsiuio socket.  It does not examine the /var/lib/iscsi/ifaces
  database directly.
 
  In the situation when multiple ifaces are supported per HBA, each iface
  info passed from iscsid will create entries to the iface struct linklist
  in iscsiuio.  The asynchronous PATH_REQ nl uevents will then supply the
  iface_num as the key for the search.  This will take the guessing work
  away from iscsiuio.
 
 
  For qla4xxx and be2iscsi the iface num is based on some fw/hw/driver
  type of limit. For the other drivers right now it is always 0. Are you
  having users set the iface_num manually then? Do we need a function to
  automatically allocate a new unique iface_num value for drivers like bnx2i?
  Currently, we are relying on the user to set the iface_num accordingly.
  We'll have to beef up the README for that.  We can definitely think
  about having it automatically allocated.  But it would only work on the
  iface files that are auto generated from iscsiadm.  Manually added iface
  files would not work here.  Another possible idea would be to make the
  iface_num field hidden so users doesn't have to deal with it at all and
 
 That would be best.
 
  the management will be all in iscsid.  But as I understand, that doesn't
  quite work for qla/be2 as the iface_num is, by design, controlled by the
  user (iface apply) to setup the different net param info for the HBA.
 
 The user does not actually have to know and probably does not know about
 the iface num for qla/be in the default use case. When you load those
 drivers they will create ifaces with specific nums and that is exported
 in the sysfs as part of the iface's sysfs name.
 iface_setup_binding_from_kern_iface will then grab that and set that up
 for the default iface creation.
 
 When the user runs a iscsiadm command they pass in the ifacename like
 normal and so the user does not really know about iface nums at all. It
 is just something for userspace/kernel to use to match on. We could have
 just passed around the iface name instead. Not sure why we did not.
 Maybe because the num is much shorter.
 
 I was asking about the iface num being auto created because we need a
 fix for the isid is not persistent problem. For that we need a 24 bit
 value that is unique and persistent for each iscsi port (initiatorname +
 isid combo). I could reuse that code for allocating unique ifacenums.
 For both cases we need to loop over some existing objects and find a
 free id, or we need to create a integer id based off of some other
 attributes of the object. Any idea for the latter?
 
 Your patches are ok as is. Let me try to make it so users do not have to
 worry about iface nums.
 
Our current solution also expects the iface_num to be unique only within
its IP type as well.  Same idea as qla/be.  So we'll need to define two
arrays of free ids instead.  I guess you need unique 24-bit numbers to
resolve the persistent isid problem...  Currently, the iface_num is
defined to be 16 bits long.  So perhaps some kind of combined format can
work here.  Something like using only the lower 16-bit of this unique
24-bit number for iface_num usage.  Perhaps the upper 8-bit can be
derived from host# + ipv4/6?
 
 


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



[PATCH 1/2] BNX2I: Added the setting of target can_queue via target_alloc

2012-04-25 Thread Eddie Wai
This will set the target can_queue limit to the number of preallocated
session tasks set during creation.

Could not send nopout messages were observed without this when the
iSCSI connection experiences dropped frames under heavy I/O stress.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i_iscsi.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 1a44b45..e4029327 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -2244,6 +2244,7 @@ static struct scsi_host_template bnx2i_host_template = {
.eh_device_reset_handler = iscsi_eh_device_reset,
.eh_target_reset_handler = iscsi_eh_recover_target,
.change_queue_depth = iscsi_change_queue_depth,
+   .target_alloc   = iscsi_target_alloc,
.can_queue  = 2048,
.max_sectors= 127,
.cmd_per_lun= 128,
-- 
1.7.7.4


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



[PATCH 2/2] BNX2I: Updated version and copyright year

2012-04-25 Thread Eddie Wai
Old version: 2.7.0.3
New version: 2.7.2.2

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/bnx2i/57xx_iscsi_constants.h |2 +-
 drivers/scsi/bnx2i/57xx_iscsi_hsi.h   |2 +-
 drivers/scsi/bnx2i/bnx2i.h|2 +-
 drivers/scsi/bnx2i/bnx2i_hwi.c|2 +-
 drivers/scsi/bnx2i/bnx2i_init.c   |6 +++---
 drivers/scsi/bnx2i/bnx2i_iscsi.c  |2 +-
 drivers/scsi/bnx2i/bnx2i_sysfs.c  |2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/bnx2i/57xx_iscsi_constants.h 
b/drivers/scsi/bnx2i/57xx_iscsi_constants.h
index 495a841..25093a0 100644
--- a/drivers/scsi/bnx2i/57xx_iscsi_constants.h
+++ b/drivers/scsi/bnx2i/57xx_iscsi_constants.h
@@ -1,6 +1,6 @@
 /* 57xx_iscsi_constants.h: Broadcom NetXtreme II iSCSI HSI
  *
- * Copyright (c) 2006 - 2011 Broadcom Corporation
+ * Copyright (c) 2006 - 2012 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/drivers/scsi/bnx2i/57xx_iscsi_hsi.h 
b/drivers/scsi/bnx2i/57xx_iscsi_hsi.h
index 72118db..dc0a08e 100644
--- a/drivers/scsi/bnx2i/57xx_iscsi_hsi.h
+++ b/drivers/scsi/bnx2i/57xx_iscsi_hsi.h
@@ -1,6 +1,6 @@
 /* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI.
  *
- * Copyright (c) 2006 - 2011 Broadcom Corporation
+ * Copyright (c) 2006 - 2012 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 0bd70e8..0c53c28 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -1,6 +1,6 @@
 /* bnx2i.h: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2011 Broadcom Corporation
+ * Copyright (c) 2006 - 2012 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index f9d6f41..ece47e5 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1,6 +1,6 @@
 /* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2011 Broadcom Corporation
+ * Copyright (c) 2006 - 2012 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 4927cca..8b68167 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -1,6 +1,6 @@
 /* bnx2i.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2011 Broadcom Corporation
+ * Copyright (c) 2006 - 2012 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
@@ -18,8 +18,8 @@ static struct list_head adapter_list = 
LIST_HEAD_INIT(adapter_list);
 static u32 adapter_count;
 
 #define DRV_MODULE_NAMEbnx2i
-#define DRV_MODULE_VERSION 2.7.0.3
-#define DRV_MODULE_RELDATE Jun 15, 2011
+#define DRV_MODULE_VERSION 2.7.2.2
+#define DRV_MODULE_RELDATE Apr 25, 2012
 
 static char version[] __devinitdata =
Broadcom NetXtreme II iSCSI Driver  DRV_MODULE_NAME \
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index e4029327..f8d516b 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -1,7 +1,7 @@
 /*
  * bnx2i_iscsi.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2011 Broadcom Corporation
+ * Copyright (c) 2006 - 2012 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
diff --git a/drivers/scsi/bnx2i/bnx2i_sysfs.c b/drivers/scsi/bnx2i/bnx2i_sysfs.c
index 83a77f7..c61cf7a 100644
--- a/drivers/scsi/bnx2i/bnx2i_sysfs.c
+++ b/drivers/scsi/bnx2i/bnx2i_sysfs.c
@@ -1,6 +1,6 @@
 /* bnx2i_sysfs.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2004 - 2011 Broadcom Corporation
+ * Copyright (c) 2004 - 2012 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
-- 
1.7.7.4


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



Re: [PATCH 1/3] ISCSID: Added iface_num to the ep_connect kernel call

2012-04-18 Thread Eddie Wai

On Tue, 2012-04-17 at 21:36 -0500, Mike Christie wrote:
 On 04/04/2012 06:39 PM, Eddie Wai wrote:
  struct msg_req_path {
  uint32_thost_no;
  +   uint32_tiface_num;
  } req_path;
 
 Are you using this in iscsiuo now? Do you match the host_no + iface_num
 to some iface file in /var/lib/iscsi/ifaces? How do you do it?
 
The new iscsiuio will look for the host_no from the uevent and extract
the iface_num accordingly.  The matching logic matches this iface_num
with the iface struct created from the iface info received from the
iscsid-iscsiuio socket.  It does not examine the /var/lib/iscsi/ifaces
database directly.

In the situation when multiple ifaces are supported per HBA, each iface
info passed from iscsid will create entries to the iface struct linklist
in iscsiuio.  The asynchronous PATH_REQ nl uevents will then supply the
iface_num as the key for the search.  This will take the guessing work
away from iscsiuio.


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



Re: [PATCH 1/3] ISCSID: Added iface_num to the ep_connect kernel call

2012-04-18 Thread Eddie Wai

On Wed, 2012-04-18 at 03:14 -0500, Mike Christie wrote:
 On 04/18/2012 01:21 AM, Eddie Wai wrote:
  
  On Tue, 2012-04-17 at 21:36 -0500, Mike Christie wrote:
  On 04/04/2012 06:39 PM, Eddie Wai wrote:
struct msg_req_path {
uint32_thost_no;
  + uint32_tiface_num;
} req_path;
 
  Are you using this in iscsiuo now? Do you match the host_no + iface_num
  to some iface file in /var/lib/iscsi/ifaces? How do you do it?
 
  The new iscsiuio will look for the host_no from the uevent and extract
  the iface_num accordingly.  The matching logic matches this iface_num
  with the iface struct created from the iface info received from the
  iscsid-iscsiuio socket.  It does not examine the /var/lib/iscsi/ifaces
  database directly.
  
  In the situation when multiple ifaces are supported per HBA, each iface
  info passed from iscsid will create entries to the iface struct linklist
  in iscsiuio.  The asynchronous PATH_REQ nl uevents will then supply the
  iface_num as the key for the search.  This will take the guessing work
  away from iscsiuio.
 
 
 For qla4xxx and be2iscsi the iface num is based on some fw/hw/driver
 type of limit. For the other drivers right now it is always 0. Are you
 having users set the iface_num manually then? Do we need a function to
 automatically allocate a new unique iface_num value for drivers like bnx2i?
Currently, we are relying on the user to set the iface_num accordingly.
We'll have to beef up the README for that.  We can definitely think
about having it automatically allocated.  But it would only work on the
iface files that are auto generated from iscsiadm.  Manually added iface
files would not work here.  Another possible idea would be to make the
iface_num field hidden so users doesn't have to deal with it at all and
the management will be all in iscsid.  But as I understand, that doesn't
quite work for qla/be2 as the iface_num is, by design, controlled by the
user (iface apply) to setup the different net param info for the HBA.
 
 


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



[PATCH 0/3] ISCSI: Patchset to include iface_num in ep_connect

2012-04-04 Thread Eddie Wai
This patchset include changes for both the open-iscsi util and all
corresponding kernel components which either facilitates or handles
the augmented ep_connect call.

The motivation behind the augmentation is so that HBAs which supports
multiple sets of network parameters can have a handle (iface_num) to
decipher which set(s) of network parameters to use for the particular
ep_connect call.

Please review, thanks.
Eddie

Eddie Wai (1):
  ISCSID: Added iface_num to the ep_connect kernel call

 include/iscsi_if.h |3 +++
 usr/discovery.c|2 +-
 usr/initiator.c|3 ++-
 usr/initiator.h|3 ++-
 usr/netlink.c  |4 +++-
 usr/transport.h|3 ++-
 6 files changed, 13 insertions(+), 5 deletions(-)

Eddie Wai (2):
  ISCSI: Added iface_num to the ep_connect event handling
  CNIC: Added iface_num to the path request event handler

 drivers/infiniband/ulp/iser/iscsi_iser.c |2 +-
 drivers/net/ethernet/broadcom/cnic.c |8 ++--
 drivers/net/ethernet/broadcom/cnic_if.h  |7 +--
 drivers/scsi/be2iscsi/be_iscsi.c |4 ++--
 drivers/scsi/be2iscsi/be_iscsi.h |2 +-
 drivers/scsi/bnx2i/bnx2i_hwi.c   |4 ++--
 drivers/scsi/bnx2i/bnx2i_iscsi.c |5 +++--
 drivers/scsi/cxgbi/libcxgbi.c|2 +-
 drivers/scsi/cxgbi/libcxgbi.h|2 +-
 drivers/scsi/qla4xxx/ql4_os.c|7 ---
 drivers/scsi/scsi_transport_iscsi.c  |   13 -
 include/scsi/iscsi_if.h  |3 +++
 include/scsi/scsi_transport_iscsi.h  |6 --
 13 files changed, 41 insertions(+), 24 deletions(-)

-- 
1.7.7.4


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



[PATCH 3/3] CNIC: Added iface_num to the path request event handler

2012-04-04 Thread Eddie Wai
This patch adds the handling of the newly added iface_num parameter from
the ep_connect call to CNIC.  This iface_num will eventually be populated back
up to the iscsiuio usermode application via the netlink path to be included
for path request duties.

The path request kevent has been augmented to include the iface_num parameter.

Signed-off-by: Eddie Wai eddie@broadcom.com
Acked-by: Michael Chan mc...@broadcom.com
---
 drivers/net/ethernet/broadcom/cnic.c|8 ++--
 drivers/net/ethernet/broadcom/cnic_if.h |6 --
 drivers/scsi/bnx2i/bnx2i_hwi.c  |4 ++--
 drivers/scsi/bnx2i/bnx2i_iscsi.c|2 +-
 drivers/scsi/scsi_transport_iscsi.c |3 ++-
 include/scsi/iscsi_if.h |1 +
 include/scsi/scsi_transport_iscsi.h |3 ++-
 7 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/cnic.c 
b/drivers/net/ethernet/broadcom/cnic.c
index 6f10c69..ae78b0f 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -289,6 +289,7 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
struct cnic_ulp_ops *ulp_ops;
struct cnic_uio_dev *udev = cp-udev;
int rc = 0, retry = 0;
+   u32 iface_num = 0;
 
if (!udev || udev-uio_dev == -1)
return -ENODEV;
@@ -311,6 +312,7 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
}
path_req.vlan_id = csk-vlan_id;
path_req.pmtu = csk-mtu;
+   iface_num = csk-iface_num;
}
 
while (retry  3) {
@@ -320,7 +322,7 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
if (ulp_ops)
rc = ulp_ops-iscsi_nl_send_msg(
cp-ulp_handle[CNIC_ULP_ISCSI],
-   msg_type, buf, len);
+   msg_type, buf, len, iface_num);
rcu_read_unlock();
if (rc == 0 || msg_type != ISCSI_KEVENT_PATH_REQ)
break;
@@ -3361,7 +3363,8 @@ static int cnic_cm_abort_req(struct cnic_sock *csk)
 }
 
 static int cnic_cm_create(struct cnic_dev *dev, int ulp_type, u32 cid,
- u32 l5_cid, struct cnic_sock **csk, void *context)
+ u32 l5_cid, struct cnic_sock **csk, void *context,
+ u32 iface_num)
 {
struct cnic_local *cp = dev-cnic_priv;
struct cnic_sock *csk1;
@@ -3388,6 +3391,7 @@ static int cnic_cm_create(struct cnic_dev *dev, int 
ulp_type, u32 cid,
csk1-l5_cid = l5_cid;
csk1-ulp_type = ulp_type;
csk1-context = context;
+   csk1-iface_num = iface_num;
 
csk1-ka_timeout = DEF_KA_TIMEOUT;
csk1-ka_interval = DEF_KA_INTERVAL;
diff --git a/drivers/net/ethernet/broadcom/cnic_if.h 
b/drivers/net/ethernet/broadcom/cnic_if.h
index 79443e0..84a4dbf 100644
--- a/drivers/net/ethernet/broadcom/cnic_if.h
+++ b/drivers/net/ethernet/broadcom/cnic_if.h
@@ -261,6 +261,8 @@ struct cnic_sock {
struct kwqe kwqe1;
struct kwqe kwqe2;
struct kwqe kwqe3;
+
+   u32 iface_num;
 };
 
 struct cnic_dev {
@@ -278,7 +280,7 @@ struct cnic_dev {
u32 num_wqes);
 
int (*cm_create)(struct cnic_dev *, int, u32, u32, struct cnic_sock **,
-void *);
+void *, u32);
int (*cm_destroy)(struct cnic_sock *);
int (*cm_connect)(struct cnic_sock *, struct cnic_sockaddr *);
int (*cm_abort)(struct cnic_sock *);
@@ -325,7 +327,7 @@ struct cnic_ulp_ops {
void (*cm_remote_close)(struct cnic_sock *);
void (*cm_remote_abort)(struct cnic_sock *);
int (*iscsi_nl_send_msg)(void *ulp_ctx, u32 msg_type,
- char *data, u16 data_size);
+ char *data, u16 data_size, u32 iface_num);
struct module *owner;
atomic_t ref_count;
 };
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 1ad0b82..9990db9 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -2653,7 +2653,7 @@ static void bnx2i_cm_remote_abort(struct cnic_sock *cm_sk)
 
 
 static int bnx2i_send_nl_mesg(void *context, u32 msg_type,
- char *buf, u16 buflen)
+ char *buf, u16 buflen, uint32_t iface_num)
 {
struct bnx2i_hba *hba = context;
int rc;
@@ -2662,7 +2662,7 @@ static int bnx2i_send_nl_mesg(void *context, u32 msg_type,
return -ENODEV;
 
rc = iscsi_offload_mesg(hba-shost, bnx2i_iscsi_transport,
-   msg_type, buf, buflen);
+   msg_type, buf, buflen, iface_num);
if (rc)
printk(KERN_ALERT bnx2i: private nl message send error\n);
 
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b

[PATCH 2/3] ISCSI: Added iface_num to the ep_connect event handling

2012-04-04 Thread Eddie Wai
This patch augments all low level SCSI drivers to include the iface_num
parameter to its ep_connect call.


Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/infiniband/ulp/iser/iscsi_iser.c |2 +-
 drivers/scsi/be2iscsi/be_iscsi.c |4 ++--
 drivers/scsi/be2iscsi/be_iscsi.h |2 +-
 drivers/scsi/bnx2i/bnx2i_iscsi.c |3 ++-
 drivers/scsi/cxgbi/libcxgbi.c|2 +-
 drivers/scsi/cxgbi/libcxgbi.h|2 +-
 drivers/scsi/qla4xxx/ql4_os.c|7 ---
 drivers/scsi/scsi_transport_iscsi.c  |   10 ++
 include/scsi/iscsi_if.h  |2 ++
 include/scsi/scsi_transport_iscsi.h  |3 ++-
 10 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c 
b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 7e7373a..f345c99 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -567,7 +567,7 @@ static int iscsi_iser_get_ep_param(struct iscsi_endpoint 
*ep,
 
 static struct iscsi_endpoint *
 iscsi_iser_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
- int non_blocking)
+ int non_blocking, uint32_t iface_num)
 {
int err;
struct iser_conn *ib_conn;
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 8b002f6..7895158 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -111,7 +111,7 @@ void beiscsi_session_destroy(struct iscsi_cls_session 
*cls_session)
  * @cid: iscsi cid
  */
 struct iscsi_cls_conn *
-beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid)
+beiscsi_conn_create(struct iscsi_cls_session *cls_session, uint32_t cid)
 {
struct beiscsi_hba *phba;
struct Scsi_Host *shost;
@@ -581,7 +581,7 @@ free_ep:
  */
 struct iscsi_endpoint *
 beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
-  int non_blocking)
+  int non_blocking, uint32_t iface_num)
 {
struct beiscsi_hba *phba;
struct beiscsi_endpoint *beiscsi_ep;
diff --git a/drivers/scsi/be2iscsi/be_iscsi.h b/drivers/scsi/be2iscsi/be_iscsi.h
index 4a1f2e3..a7836e3 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.h
+++ b/drivers/scsi/be2iscsi/be_iscsi.h
@@ -64,7 +64,7 @@ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn);
 
 struct iscsi_endpoint *beiscsi_ep_connect(struct Scsi_Host *shost,
  struct sockaddr *dst_addr,
- int non_blocking);
+ int non_blocking, uint32_t iface_num);
 
 int beiscsi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms);
 
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index d1e6971..b07bf21 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -1757,7 +1757,8 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba,
  */
 static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
   struct sockaddr *dst_addr,
-  int non_blocking)
+  int non_blocking,
+  uint32_t iface_num)
 {
u32 iscsi_cid = BNX2I_CID_RESERVED;
struct sockaddr_in *desti = (struct sockaddr_in *) dst_addr;
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index c10f74a..29cc4df 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -2426,7 +2426,7 @@ EXPORT_SYMBOL_GPL(cxgbi_get_host_param);
 
 struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
struct sockaddr *dst_addr,
-   int non_blocking)
+   int non_blocking, uint32_t iface_num)
 {
struct iscsi_endpoint *ep;
struct cxgbi_endpoint *cep;
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 20c88279..e3e192e 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -724,7 +724,7 @@ int cxgbi_set_host_param(struct Scsi_Host *,
enum iscsi_host_param, char *, int);
 int cxgbi_get_host_param(struct Scsi_Host *, enum iscsi_host_param, char *);
 struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *,
-   struct sockaddr *, int);
+   struct sockaddr *, int, uint32_t);
 int cxgbi_ep_poll(struct iscsi_endpoint *, int);
 void cxgbi_ep_disconnect(struct iscsi_endpoint *);
 
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 70778d5..5eee6d5 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -94,7 +94,8 @@ static int qla4xxx_get_iface_param(struct

[PATCH 1/3] ISCSID: Added iface_num to the ep_connect kernel call

2012-04-04 Thread Eddie Wai
For HBAs that can support multiple sets of network parameters, it would be
beneficial to pass the iface-iface_num handle to the corresponding
ep_connect call.  This will allow the respective low level drivers to
have a way to decipher the particular set of network parameters to use for
the connection request.

This patch adds the passing of the iface_num to the ep_connect uevent
(ISCSI_UEVENT_TRANSPORT_EP_CONNECT and _THROUGH_HOST events).


Signed-off-by: Eddie Wai eddie@broadcom.com
---
 include/iscsi_if.h |3 +++
 usr/discovery.c|2 +-
 usr/initiator.c|3 ++-
 usr/initiator.h|3 ++-
 usr/netlink.c  |4 +++-
 usr/transport.h|3 ++-
 6 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 28447df..6708c30 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -152,10 +152,12 @@ struct iscsi_uevent {
} get_stats;
struct msg_transport_connect {
uint32_tnon_blocking;
+   uint32_tiface_num;
} ep_connect;
struct msg_transport_connect_through_host {
uint32_thost_no;
uint32_tnon_blocking;
+   uint32_tiface_num;
} ep_connect_through_host;
struct msg_transport_poll {
uint64_tep_handle;
@@ -227,6 +229,7 @@ struct iscsi_uevent {
} ep_connect_ret;
struct msg_req_path {
uint32_thost_no;
+   uint32_tiface_num;
} req_path;
struct msg_notify_if_down {
uint32_thost_no;
diff --git a/usr/discovery.c b/usr/discovery.c
index 1f39002..1de2374 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -1117,7 +1117,7 @@ static int iscsi_create_leading_conn(struct iscsi_session 
*session)
 
/* create interconnect endpoint */
log_debug(2, %s discovery ep connect\n, __FUNCTION__);
-   rc = t-template-ep_connect(conn, 1);
+   rc = t-template-ep_connect(conn, 1, iface-iface_num);
if (rc  0) {
rc = ISCSI_ERR_TRANS;
goto close_ipc;
diff --git a/usr/initiator.c b/usr/initiator.c
index 79ca32c..dd09045 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -534,7 +534,8 @@ static int iscsi_conn_connect(struct iscsi_conn *conn, 
queue_task_t *qtask)
}
ev_context-data = qtask;
 
-   rc = conn-session-t-template-ep_connect(conn, 1);
+   rc = conn-session-t-template-ep_connect(conn, 1,
+   conn-session-nrec.iface.iface_num);
if (rc  0  errno != EINPROGRESS) {
char serv[NI_MAXSERV];
 
diff --git a/usr/initiator.h b/usr/initiator.h
index b45caab..0029369 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -313,7 +313,8 @@ extern int resolve_address(char *host, char *port, struct 
sockaddr_storage *ss);
  * The exact IPC ABI for that matter is defined in iscsi_if.h
  */
 /* netlink.c */
-extern int ktransport_ep_connect(iscsi_conn_t *conn, int non_blocking);
+extern int ktransport_ep_connect(iscsi_conn_t *conn, int non_blocking,
+uint32_t iface_num);
 extern int ktransport_ep_poll(iscsi_conn_t *conn, int timeout_ms);
 extern void ktransport_ep_disconnect(iscsi_conn_t *conn);
 
diff --git a/usr/netlink.c b/usr/netlink.c
index 08c08d8..50ba6eb 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -823,7 +823,7 @@ krecv_pdu_end(struct iscsi_conn *conn)
 }
 
 int
-ktransport_ep_connect(iscsi_conn_t *conn, int non_blocking)
+ktransport_ep_connect(iscsi_conn_t *conn, int non_blocking, uint32_t iface_num)
 {
int rc, addrlen;
struct iscsi_uevent *ev;
@@ -840,9 +840,11 @@ ktransport_ep_connect(iscsi_conn_t *conn, int non_blocking)
ev-type = ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST;
ev-u.ep_connect_through_host.non_blocking = non_blocking;
ev-u.ep_connect_through_host.host_no = conn-session-hostno;
+   ev-u.ep_connect_through_host.iface_num = iface_num;
} else {
ev-type = ISCSI_UEVENT_TRANSPORT_EP_CONNECT;
ev-u.ep_connect.non_blocking = non_blocking;
+   ev-u.ep_connect.iface_num = iface_num;
}
 
if (dst_addr-sa_family == PF_INET)
diff --git a/usr/transport.h b/usr/transport.h
index 5ceedb3..cada8da 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -31,7 +31,8 @@ struct iscsi_transport_template {
 * the host's ip address.
 */
uint8_t set_host_ip;
-   int (*ep_connect) (struct iscsi_conn *conn, int non_blocking);
+   int (*ep_connect) (struct iscsi_conn *conn, int non_blocking,
+  uint32_t iface_num);
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms

Re: [PATCH] LIBISCSI: Alleviate NOP transmission request upon xmit failure

2012-03-15 Thread Eddie Wai

On Wed, 2012-03-14 at 20:49 -0500, Mike Christie wrote:
 On 03/14/2012 06:50 PM, Eddie Wai wrote:
  During heavy I/O transmission, it was observed that network packets
  can get dropped when no link flow control is enabled.  When this happens,
  I/O completions can exceed the default NOP transmission of 5s while the
  hw send queue resource backs up.  When the queue gets full, NOP
  transmission requests will also get blocked.  It was observed that
  the NOP transmission requests will keep repeatedly try to send out
  the NOP while holding the session lock.  This is very intrusive as the
  requests are being called on every timer execution since the last_ping
  parameter doesn't get updated upon transmission failure.  This creates a
  tremendous bottleneck especially when the connection is about to get torn 
  down.
  
  This patch alleviates the pounding of the NOP transmission in the
  iscsi_check_transport_timeouts routine by injecting an artifical 1s delay
  in between each NOP transmission requests due to failures upon timeout.
  
  There is no need to keep pounding on to request this data provoking NOP
  transmission continuously when the transmit queue is full.
  
  Please review and comment.  Thanks.
  
  
  Signed-off-by: Eddie Wai eddie@broadcom.com
  ---
   drivers/scsi/libiscsi.c |   13 +
   1 files changed, 9 insertions(+), 4 deletions(-)
  
  diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
  index 82c3fd4..f1141a8 100644
  --- a/drivers/scsi/libiscsi.c
  +++ b/drivers/scsi/libiscsi.c
  @@ -940,13 +940,14 @@ static void iscsi_tmf_rsp(struct iscsi_conn *conn, 
  struct iscsi_hdr *hdr)
  wake_up(conn-ehwait);
   }
   
  -static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin 
  *rhdr)
  +static struct iscsi_task *iscsi_send_nopout(struct iscsi_conn *conn,
  +   struct iscsi_nopin *rhdr)
   {
   struct iscsi_nopout hdr;
  struct iscsi_task *task;
   
  if (!rhdr  conn-ping_task)
  -   return;
  +   return NULL;
   
  memset(hdr, 0, sizeof(struct iscsi_nopout));
  hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE;
  @@ -967,6 +968,7 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, 
  struct iscsi_nopin *rhdr)
  conn-ping_task = task;
  conn-last_ping = jiffies;
  }
  +   return task;
   }
   
   static int iscsi_nop_out_rsp(struct iscsi_task *task,
  @@ -2059,8 +2061,11 @@ static void iscsi_check_transport_timeouts(unsigned 
  long data)
  if (time_before_eq(last_recv + recv_timeout, jiffies)) {
  /* send a ping to try to provoke some traffic */
  ISCSI_DBG_CONN(conn, Sending nopout as ping\n);
  -   iscsi_send_nopout(conn, NULL);
  -   next_timeout = conn-last_ping + (conn-ping_timeout * HZ);
  +   if (iscsi_send_nopout(conn, NULL))
  +   next_timeout = conn-last_ping +
  +  (conn-ping_timeout * HZ);
 
 Once we send a ping, we should not run this timer again until it has
 timed out Why is the ping not timing out and then why are not hitting
 the check above this that just returns?
The problem is that it is the right time to send the ping but the
request was not successful due to a lack of task resources.  The
send_pdu will then returned a NULL task which prevented the
conn-last_ping parameter from being updated.  So when this timer
routine exits, it comes right back with the last_recv and last_ping both
being the old value since there wasn't any new completions either.
 
 Is the timer firing early, so we keep hitting the iscsi_send_nopout path?
 


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



Re: [PATCH] LIBISCSI: Alleviate NOP transmission request upon xmit failure

2012-03-15 Thread Eddie Wai

On Wed, 2012-03-14 at 21:00 -0500, Mike Christie wrote:
 On 03/14/2012 08:49 PM, Mike Christie wrote:
  On 03/14/2012 06:50 PM, Eddie Wai wrote:
  During heavy I/O transmission, it was observed that network packets
  can get dropped when no link flow control is enabled.  When this happens,
  I/O completions can exceed the default NOP transmission of 5s while the
  hw send queue resource backs up.  When the queue gets full, NOP
  transmission requests will also get blocked.  It was observed that
  the NOP transmission requests will keep repeatedly try to send out
  the NOP while holding the session lock.  This is very intrusive as the
  requests are being called on every timer execution since the last_ping
  parameter doesn't get updated upon transmission failure.  This creates a
  tremendous bottleneck especially when the connection is about to get torn 
  down.
 
  This patch alleviates the pounding of the NOP transmission in the
  iscsi_check_transport_timeouts routine by injecting an artifical 1s delay
  in between each NOP transmission requests due to failures upon timeout.
 
  There is no need to keep pounding on to request this data provoking NOP
  transmission continuously when the transmit queue is full.
 
  Please review and comment.  Thanks.
 
 
  Signed-off-by: Eddie Wai eddie@broadcom.com
  ---
   drivers/scsi/libiscsi.c |   13 +
   1 files changed, 9 insertions(+), 4 deletions(-)
 
  diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
  index 82c3fd4..f1141a8 100644
  --- a/drivers/scsi/libiscsi.c
  +++ b/drivers/scsi/libiscsi.c
  @@ -940,13 +940,14 @@ static void iscsi_tmf_rsp(struct iscsi_conn *conn, 
  struct iscsi_hdr *hdr)
 wake_up(conn-ehwait);
   }
   
  -static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin 
  *rhdr)
  +static struct iscsi_task *iscsi_send_nopout(struct iscsi_conn *conn,
  +  struct iscsi_nopin *rhdr)
   {
   struct iscsi_nopout hdr;
 struct iscsi_task *task;
   
 if (!rhdr  conn-ping_task)
  -  return;
  +  return NULL;
   
 memset(hdr, 0, sizeof(struct iscsi_nopout));
 hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE;
  @@ -967,6 +968,7 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, 
  struct iscsi_nopin *rhdr)
 conn-ping_task = task;
 conn-last_ping = jiffies;
 }
  +  return task;
   }
   
   static int iscsi_nop_out_rsp(struct iscsi_task *task,
  @@ -2059,8 +2061,11 @@ static void iscsi_check_transport_timeouts(unsigned 
  long data)
 if (time_before_eq(last_recv + recv_timeout, jiffies)) {
 /* send a ping to try to provoke some traffic */
 ISCSI_DBG_CONN(conn, Sending nopout as ping\n);
  -  iscsi_send_nopout(conn, NULL);
  -  next_timeout = conn-last_ping + (conn-ping_timeout * HZ);
  +  if (iscsi_send_nopout(conn, NULL))
  +  next_timeout = conn-last_ping +
  + (conn-ping_timeout * HZ);
  
  Once we send a ping, we should not run this timer again until it has
  timed out Why is the ping not timing out and then why are not hitting
  the check above this that just returns?
  
  Is the timer firing early, so we keep hitting the iscsi_send_nopout path?
 
 One other side issue, when we get any completion we update the
 conn-last_recv field, so we should not try another ping for another
 recv_timeout seconds. If the above code is getting called to send a
 ping, then we are not getting any completion for recv_timeout seconds.
 
 Is there a way to tell if the card is making progress? For example if we
 were doing a lot of big writes, then the card could be making progress
 on them and handling R2Ts and sending data, but the libiscsi layer does
 not know, so it could fail the connection thinking that we did not get a
 response when the card was really busy handling R2Ts.
The default I/O completion timeout is defaulted to 5s which is not very
forgiving.  As we observed, any hiccups in the link will sometimes
trigger this timeout.  But the NOP heartbeat usually gets completed
within its ping timeout of 5s (default).  

For bnx2i offload, all the r2t packets are handled in the fw so there's
really no such indication I can think of to use.  I think the current
invocation to send NOP upon recv timeout is okay.  But if the transmit
queue is already full, I don't think its necessary to have the timer
handler to keep on pounding on to try to submit the NOP request since
the sole purpose of this NOP request is only to provoke traffic.  The
commands sitting in the queue should be sufficient for that matter.
 
 


-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http

[PATCH] LIBISCSI: Alleviate NOP transmission request upon xmit failure

2012-03-14 Thread Eddie Wai
During heavy I/O transmission, it was observed that network packets
can get dropped when no link flow control is enabled.  When this happens,
I/O completions can exceed the default NOP transmission of 5s while the
hw send queue resource backs up.  When the queue gets full, NOP
transmission requests will also get blocked.  It was observed that
the NOP transmission requests will keep repeatedly try to send out
the NOP while holding the session lock.  This is very intrusive as the
requests are being called on every timer execution since the last_ping
parameter doesn't get updated upon transmission failure.  This creates a
tremendous bottleneck especially when the connection is about to get torn down.

This patch alleviates the pounding of the NOP transmission in the
iscsi_check_transport_timeouts routine by injecting an artifical 1s delay
in between each NOP transmission requests due to failures upon timeout.

There is no need to keep pounding on to request this data provoking NOP
transmission continuously when the transmit queue is full.

Please review and comment.  Thanks.


Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/libiscsi.c |   13 +
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..f1141a8 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -940,13 +940,14 @@ static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct 
iscsi_hdr *hdr)
wake_up(conn-ehwait);
 }
 
-static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin 
*rhdr)
+static struct iscsi_task *iscsi_send_nopout(struct iscsi_conn *conn,
+   struct iscsi_nopin *rhdr)
 {
 struct iscsi_nopout hdr;
struct iscsi_task *task;
 
if (!rhdr  conn-ping_task)
-   return;
+   return NULL;
 
memset(hdr, 0, sizeof(struct iscsi_nopout));
hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE;
@@ -967,6 +968,7 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, 
struct iscsi_nopin *rhdr)
conn-ping_task = task;
conn-last_ping = jiffies;
}
+   return task;
 }
 
 static int iscsi_nop_out_rsp(struct iscsi_task *task,
@@ -2059,8 +2061,11 @@ static void iscsi_check_transport_timeouts(unsigned long 
data)
if (time_before_eq(last_recv + recv_timeout, jiffies)) {
/* send a ping to try to provoke some traffic */
ISCSI_DBG_CONN(conn, Sending nopout as ping\n);
-   iscsi_send_nopout(conn, NULL);
-   next_timeout = conn-last_ping + (conn-ping_timeout * HZ);
+   if (iscsi_send_nopout(conn, NULL))
+   next_timeout = conn-last_ping +
+  (conn-ping_timeout * HZ);
+   else
+   next_timeout = jiffies + HZ;
} else
next_timeout = last_recv + recv_timeout;
 
-- 
1.7.7.4


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




[PATCH] BNX2I: Fixed the override of the error_mask module param

2012-02-02 Thread Eddie Wai
The error_mask module param overrides has a bug which prevented
the new module param values to take effect.

Also changed the type attribute of the error_mask1/2 module params
from int to uint to allow the MSB to be set.

Signed-off-by: Eddie Wai eddie@broadcom.com
Acked-by: Anil Veerabhadrappa ani...@broadcom.com

---
 drivers/scsi/bnx2i/bnx2i_hwi.c  |   12 
 drivers/scsi/bnx2i/bnx2i_init.c |4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 1ad0b82..f9d6f41 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1312,14 +1312,18 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba)
  ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_EXP_DATASN) |
/* EMC */
(1ULL  ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_LUN));
-   if (error_mask1)
+   if (error_mask1) {
iscsi_init2.error_bit_map[0] = error_mask1;
-   else
+   mask64 = (u32)(~mask64);
+   mask64 |= error_mask1;
+   } else
iscsi_init2.error_bit_map[0] = (u32) mask64;
 
-   if (error_mask2)
+   if (error_mask2) {
iscsi_init2.error_bit_map[1] = error_mask2;
-   else
+   mask64 = 0x;
+   mask64 |= ((u64)error_mask2  32);
+   } else
iscsi_init2.error_bit_map[1] = (u32) (mask64  32);
 
iscsi_error_mask = mask64;
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 1a947f1..cc5a6c1 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -49,11 +49,11 @@ module_param(en_tcp_dack, int, 0664);
 MODULE_PARM_DESC(en_tcp_dack, Enable TCP Delayed ACK);
 
 unsigned int error_mask1 = 0x00;
-module_param(error_mask1, int, 0664);
+module_param(error_mask1, uint, 0664);
 MODULE_PARM_DESC(error_mask1, Config FW iSCSI Error Mask #1);
 
 unsigned int error_mask2 = 0x00;
-module_param(error_mask2, int, 0664);
+module_param(error_mask2, uint, 0664);
 MODULE_PARM_DESC(error_mask2, Config FW iSCSI Error Mask #2);
 
 unsigned int sq_size;
-- 
1.7.7.4


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



Re: using iface attributes for SW iscsi transport kernel transport (resend)

2012-01-03 Thread Eddie Wai
Hello Mike,

Yes, I think it would be beneficial to add the passing of the iface_num
parameter to the transport's ep_connect call so that it can identify
which iface profile to use.  This should help HW transports that have
support for more than one iface profile.

For bnx2i in particular, this iface_num handle will then get passed to
iscsiuio for iface identification.

Thanks,
Eddie

On Tue, 2012-01-03 at 13:53 -0600, Mike Christie wrote:
 Eddie,
 
 Did you say you were going to make some changes to the ep_connect path
 for bnx2i?
 
 On 01/03/2012 01:05 PM, Or Gerlitz wrote:
  Hi Mike,
  
  Resending, could you please look on that? (and happy new year)
  
  Or.
  
  -- Forwarded message --
  From: Or Gerlitz ogerl...@mellanox.com
  Date: Thu, Oct 27, 2011 at 12:55 PM
  Subject: using iface attributes for no HW iscsi transport
  To: Mike Christie micha...@cs.wisc.edu, open-iscsi@googlegroups.com
  
  Mike, yes, it could be RTFM question, if indeed this is the case, just
  point me to the-M
  portion or to some area of the code.. its been a while since we realized
  that iser needs
  some attributes from user space to the time ep_connect is called.
  
  Quick examples are the source ip address for multi-pathing (e.g when done
  on 2 paths
  who use the same IP subnet), the maximal number of SCSI commands to be used
  for that
  session, vlan proirity for the case of this session being on IBoE
  environment and
  this IP subnet being served by 8021q vlan nic, etc.
  
  For the most case, these attributes are present in the iface structure.
  
  I see that for HW iscsi, the iface attributes are sent down to the kernel
  and kept there, for example in the qla4xxx code, I see that flow
  qla4xxx_iface_set_param -- qla4xxx_set_ipv4 ... --
  qla4xxx_update_local_ifcb
  to set attributes such as source ip, vlan, etc. Later in ep_connect, I
  wasn't sure
  to realize if/how these settings are used, but I'm sure they are at some
  point (maybe
  earlier, when the scsi host is created I think at that point the
  session/connection
  are set already by HW iscsi drivers).
  
  So iser isn't HW iscsi driver, but we still be happy (need) to be able to
  use
  the iface mechanism for params required for the iser RDMA connection
  setting.
  
  What would be the way to achieve that? is that fully supported by user space
  and I just have to implement some kernel patches in iser and maybe in the
  iscsi
  transport code as well, or its change in the user space state-machine as
  seen
  @ 
  http://www.open-iscsi.org/**docs/open-iscsi-1.jpghttp://www.open-iscsi.org/docs/open-iscsi-1.jpg
  
  In the past you mentioned the possibility for ep_connect_ext API, is that
  what need
  to be done here?
  
  thanks,
  
  Or.
  
  The latest code I'm looking at is from
  
  kernel git://git.kernel.org/pub/scm/**linux/kernel/git/jejb/scsi-**
  misc-2.6.githttp://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
  user/kernel 
  git://github.com/mikechristie/**open-iscsihttp://github.com/mikechristie/open-iscsi
  
 
 


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



[PATCH] BNX2I: Fixed kernel panic caused by unprotected task-sc-request deref

2011-12-06 Thread Eddie Wai
During session recovery, the conn_stop call will trigger a flush
to all outstanding SCSI cmds in the xmit queue.  This will set
all outstanding task-sc to NULL prior to the session_teardown
call which frees the task memory.

In the bnx2i SCSI response processing path, only the task was being checked
for NULL under the session lock before the task-sc-request dereferencing.
If there are outstanding SCSI cmd responses pending for process, the
following kernel panic can be exposed where task-sc was found to be NULL.

 Call Trace:
[   69.720205]  [a040d0d0] bnx2i_process_new_cqes+0x290/0x3c0 [bnx2i]
[   69.804289]  [a040d233] bnx2i_fastpath_notification+0x33/0xa0 [bnx2
i]
[   69.891490]  [a040d37b] bnx2i_indicate_kcqe+0xdb/0x330 [bnx2i]
[   69.971427]  [a03eac5e] service_kcqes+0x16e/0x1d0 [cnic]
[   70.045132]  [a03eacea] cnic_service_bnx2x_kcq+0x2a/0x50 [cnic]
[   70.126105]  [a03ead53] cnic_service_bnx2x_bh+0x43/0x140 [cnic]
[   70.207081]  [81060676] tasklet_action+0x66/0x110
[   70.273521]  [8106025f] __do_softirq+0xef/0x220
[   70.337887]  [81447ebc] call_softirq+0x1c/0x30

This patch adds the !task-sc check and also protects the sc dereferencing
under the session lock.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i_hwi.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index dba72a4..1ad0b82 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1906,18 +1906,19 @@ static int bnx2i_queue_scsi_cmd_resp(struct 
iscsi_session *session,
spin_lock(session-lock);
task = iscsi_itt_to_task(bnx2i_conn-cls_conn-dd_data,
 cqe-itt  ISCSI_CMD_RESPONSE_INDEX);
-   if (!task) {
+   if (!task || !task-sc) {
spin_unlock(session-lock);
return -EINVAL;
}
sc = task-sc;
-   spin_unlock(session-lock);
 
if (!blk_rq_cpu_valid(sc-request))
cpu = smp_processor_id();
else
cpu = sc-request-cpu;
 
+   spin_unlock(session-lock);
+
p = per_cpu(bnx2i_percpu, cpu);
spin_lock(p-p_work_lock);
if (unlikely(!p-iothread)) {
-- 
1.7.7.4


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



New iface parameters to iscsiuio

2011-12-01 Thread Eddie Wai
Hello Mike,

I found that although the new iface additions of gateway/subnet/etc. are
now present in the iface file in rhel6.2 inbox open-iscsi util, however,
the particular parameters are not being passed to iscsiuio upon
connection request.

The problem looks to be related to the iface_rec inside the node_rec
only contains the previously defined fields and not the entire iface
fields.  Unfortunately for us, iscsiuio only gets the iface_rec from the
node_rec and not the iface_rec directly from the database...

I also notice that any changes to those new iface parameters via the
iface -o update would fail to update the node due to the same reason.  I
think the solution here is to add those new additions to the node_rec as
well in idbm.c.

I'll provide a patch for that.  Its probably too late for rhel6.2?

Thanks,
Eddie


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



Re: New iface parameters to iscsiuio

2011-12-01 Thread Eddie Wai

On Thu, 2011-12-01 at 16:32 -0800, Mike Christie wrote:
 On 12/01/2011 04:46 PM, Eddie Wai wrote:
  Hello Mike,
  
  I found that although the new iface additions of gateway/subnet/etc. are
  now present in the iface file in rhel6.2 inbox open-iscsi util, however,
  the particular parameters are not being passed to iscsiuio upon
  connection request.
  
  The problem looks to be related to the iface_rec inside the node_rec
 
 Do you mean the structs in the program or the recs stored in the db?
I mean the iface_rec content inside the node_recs.
 
  only contains the previously defined fields and not the entire iface
  fields.  Unfortunately for us, iscsiuio only gets the iface_rec from the
  node_rec and not the iface_rec directly from the database...
 
 How does it do this? By running commands to seach the db or are you
 saying iscsid passes it to iscsiuio through the socket?
During when iscsid passes it to iscsiuio through the socket via the
template-set_net_config call on the connect request path.
 
  
  I also notice that any changes to those new iface parameters via the
  iface -o update would fail to update the node due to the same reason.  I
 
 Yeah, it fails because are you logged into a session using them if I
 understand you right.
Not connected in this case.  Although the iface file itself does get the
change, but because the idbm_recinfo_node doesn't have the field
defined, it errors out like this:
 iscsiadm -m iface -I bnx2i-eth0 -n iface.mtu -v 1500 -o update
iscsiadm: Cannot modify iface.mtu. Invalid param name.
iscsiadm: Could not update iface bnx2i-eth0: invalid parameter

 
 What are you trying to update at this time?
 
  think the solution here is to add those new additions to the node_rec as
  well in idbm.c.
  
  I'll provide a patch for that.  Its probably too late for rhel6.2?
  

 
 6.2 is done.
Thanks.
 


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



[PATCH] ISCSID: Fixed iface update for the new iface net config params

2011-12-01 Thread Eddie Wai
Augmented the idbm_recinfo_node routine to include the parsing of
the newly added iface net config params:
  bootproto
  subnet_mask
  gateway
  ipv6_autocfg
  linklocal_autocfg
  router_autocfg
  ipv6_linklocal
  ipv6_router
  state
  vlan_id
  vlan_priority
  vlan_state
  iface_num
  mtu
  port

This will also update the iface_rec instance inside the node_rec struct
for the iscsiuio iface_rec info passing for bnx2i offload.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/idbm.c |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/usr/idbm.c b/usr/idbm.c
index d3383fc..82c2aeb 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -255,6 +255,32 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
__recinfo_str(IFACE_TRANSPORTNAME, ri, r, iface.transport_name,
  IDBM_SHOW, num, 1);
__recinfo_str(IFACE_INAME, ri, r, iface.iname, IDBM_SHOW, num, 1);
+   __recinfo_str(IFACE_BOOT_PROTO, ri, r, iface.bootproto, IDBM_SHOW,
+ num, 1);
+   __recinfo_str(IFACE_SUBNET_MASK, ri, r, iface.subnet_mask,
+ IDBM_SHOW, num, 1);
+   __recinfo_str(IFACE_GATEWAY, ri, r, iface.gateway, IDBM_SHOW, num, 1);
+   __recinfo_str(IFACE_IPV6_AUTOCFG, ri, r, iface.ipv6_autocfg,
+ IDBM_SHOW, num, 1);
+   __recinfo_str(IFACE_LINKLOCAL_AUTOCFG, ri, r, iface.linklocal_autocfg,
+ IDBM_SHOW, num, 1);
+   __recinfo_str(IFACE_ROUTER_AUTOCFG, ri, r, iface.router_autocfg,
+ IDBM_SHOW, num, 1);
+   __recinfo_str(IFACE_LINKLOCAL, ri, r, iface.ipv6_linklocal,
+ IDBM_SHOW, num, 1);
+   __recinfo_str(IFACE_ROUTER, ri, r, iface.ipv6_router, IDBM_SHOW, num,
+ 1);
+   __recinfo_str(IFACE_STATE, ri, r, iface.state, IDBM_SHOW, num, 1);
+   __recinfo_uint16(IFACE_VLAN_ID, ri, r, iface.vlan_id, IDBM_SHOW, num,
+1);
+   __recinfo_uint8(IFACE_VLAN_PRIORITY, ri, r, iface.vlan_priority,
+   IDBM_SHOW, num, 1);
+   __recinfo_str(IFACE_VLAN_STATE, ri, r, iface.vlan_state, IDBM_SHOW,
+ num, 1);
+   __recinfo_int(IFACE_NUM, ri, r, iface.iface_num, IDBM_SHOW, num, 1);
+   __recinfo_uint16(IFACE_MTU, ri, r, iface.mtu, IDBM_SHOW, num, 1);
+   __recinfo_uint16(IFACE_PORT, ri, r, iface.port, IDBM_SHOW, num, 1);
+
__recinfo_str(NODE_DISC_ADDR, ri, r, disc_address, IDBM_SHOW,
  num, 0);
__recinfo_int(NODE_DISC_PORT, ri, r, disc_port, IDBM_SHOW,
-- 
1.7.7.4


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



Re: NIC_NL waiting binding to NETLINK_ISCSI socket in /var/log/brcm-iscsi.log

2011-07-29 Thread Eddie Wai

On Fri, 2011-07-29 at 10:43 -0700, Mike Christie wrote:
 Ccing Broadcom.
 
 I believe they are working on the log file size issues. They can answer
 the other questions.
 
 On 07/29/2011 04:16 AM, Yuri Arabadji wrote:
  Hi.
  
  During recent log revision, we've found a huge log file present
  practically on all centos 5.6 hosts. It's located at /var/log/brcm-
  iscsi.log and being generated by brcm_iscsiuio process. The process
  writes to it *constantly*, thus generating disk I/O and consuming disk
  space. By default, centos/rhel's iscsi-initiator-utils rpm doesn't
  come with logrotate config file, thus the file grows bigger and
  bigger. Here are the messages in that log file:
  
  ERR   [Fri Jul 29 04:11:40 2011]NIC_NL waiting binding to
  NETLINK_ISCSI socket
  ERR   [Fri Jul 29 04:11:41 2011]NIC_NL waiting binding to
  NETLINK_ISCSI socket
  ERR   [Fri Jul 29 04:11:42 2011]NIC_NL waiting binding to
  NETLINK_ISCSI socket
  
  and so on. generated every second (although buffered, thanks for
  that). I have absolutely no idea what that message means and why it is
  being produced every second. If there's an error, syslog a fatal
  message and bail out - that's the proper behaviour. Note, this is an
  untouched default centos/rhel install. No file modifications have been
  done to any configs or init scripts.
  iscsi service is enabled by default on centos/rhel.
  
  Thanks.
  
logrotate handling was only added since brcm_iscsiuio-0.7.0.2
(May/2011), so the inbox version in centos 5.6 would not have this yet.
If you would like an upgrade, you can probably find the tarball for
iscsiuio-0.7.0.4 in the open-iscsi mailing list.

As for the specific error message, it looks like iscsiuio was not able
to bind the socket opened to get netlink messages.  Unfortunately, this
will continue to poll every second until the socket gets binded.  I
agree that this is probably not the best way to handle this error.

The underlying problem appears to be related to a socket communication
problem between the kernel's scsi_transport_iscsi(2) module and
iscsiuio.  I have only seen this if the scsi_transport_iscsi(2) module
is not modprobed or when iscsiuio is ran without iscsid.  Can you verify
to see if the iscsid process is running and if the
scsi_transport_iscsi(2) module is inserted?  Thanks.


 
 


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



iscsi_sysfs_read_iface

2011-07-25 Thread Eddie Wai
Hello Mike,

The following snippet from the 39d4ceb04f051c208ae7509d268a3871ffa194c5
commit is preventing bnx2i from being able to offload when connecting
through the iscsi_sysfs_get_hostinfo_by_host_no code path where the
session argument == NULL.  The initiatorname sysfs inquiry failed but
this is expected since it does not exist in the iscsi_host for bnx2i.

Perhaps the error return code should only be propagated upward when
session != NULL specifically for hbas like qla4xxx?

Thanks,
Eddie

- 8 - 8 -
@@ -527,7 +528,10 @@ static int iscsi_sysfs_read_iface(struct iface_rec
*iface, int host_no,
  iface_str(iface));
}
}
-   return ret;
+   if (ret)
+   return ISCSI_ERR_SYSFS_LOOKUP;
+   else
+   return 0;
 }
- 8 - 8 -


Author: Mike Christie micha...@cs.wisc.edu
Date:   Sun Jan 30 22:49:56 2011 -0600

iscsi tools: fix iscsiadm exit codes

iscsiadm/iscsistart return a mix of type of returns codes.
Sometimes -1 and sometimes a EXYZ type of error code. This
patch has them return a ISCSI_ERR value.

See iscsiadm man page EXIT STATUS section for error
code definitions.

commit 39d4ceb04f051c208ae7509d268a3871ffa194c5



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



[PATCH v3] BNX2I: Fixed kernel panic due to illegal usage of sc-request-cpu

2011-07-15 Thread Eddie Wai
A kernel panic was observed when passing the sc-request-cpu = -1 to
retrieve the per_cpu variable pointer:
 #0 [880011203960] machine_kexec at 81022bc3
 #1 [8800112039b0] crash_kexec at 81088630
 #2 [880011203a80] __die at 8139ea20
 #3 [880011203aa0] no_context at 8102f3a7
 #4 [880011203ae0] __bad_area_nosemaphore at 8102f665
 #5 [880011203ba0] retint_signal at 8139dd1f
 #6 [880011203cc8] bnx2i_indicate_kcqe at a03dc4f2
 #7 [880011203da8] service_kcqes at a03cb04f
 #8 [880011203e68] cnic_service_bnx2x_kcq at a03cb14a
 #9 [880011203e88] cnic_service_bnx2x_bh at a03cb1b3

The problem lies in the slow path sg_io (and perhaps sg_scsi_ioctl) call to
blk_get_request-get_request/wait-blk_alloc_request-blk_rq_init which
re-initializes the request-cpu to -1.  There is no assignment for cpu from
that to the request_fn call to low level drivers.

When this happens, the sc-request-cpu will be using the init value of
-1.  This will create a kernel panic when it hits bnx2i because the code
refers it to get the per_cpu variables ptr.

This change is to put in a guard against that and also for cases when
bio affinity/queue completion to the same cpu is not enabled.  In those
cases, the request-cpu will remain a -1 also.

This bug was created from commit:  b5cf6b63f73abdc051035f0050b367beeb2ef94c

For the case when the blk layer did not setup the request-cpu, bnx2i
will complete the sc with the current CPU of the thread.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i_hwi.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 54978c1..28c6693 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1901,6 +1901,7 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session 
*session,
struct iscsi_task *task;
struct scsi_cmnd *sc;
int rc = 0;
+   int cpu;
 
spin_lock(session-lock);
task = iscsi_itt_to_task(bnx2i_conn-cls_conn-dd_data,
@@ -1912,7 +1913,12 @@ static int bnx2i_queue_scsi_cmd_resp(struct 
iscsi_session *session,
sc = task-sc;
spin_unlock(session-lock);
 
-   p = per_cpu(bnx2i_percpu, sc-request-cpu);
+   if (!blk_rq_cpu_valid(sc-request))
+   cpu = smp_processor_id();
+   else
+   cpu = sc-request-cpu;
+
+   p = per_cpu(bnx2i_percpu, cpu);
spin_lock(p-p_work_lock);
if (unlikely(!p-iothread)) {
rc = -EINVAL;
-- 
1.7.0.5


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



Re: [PATCH] BNX2I: Fixed kernel panic due to illegal usage of sc-request-cpu

2011-07-14 Thread Eddie Wai

On Mon, 2011-07-11 at 13:02 -0700, Mike Christie wrote:
 On 07/11/2011 01:14 PM, Eddie Wai wrote:
  A kernel panic was observed when passing the sc-request-cpu = -1 to
  retrieve the per_cpu variable pointer:
   #0 [880011203960] machine_kexec at 81022bc3
   #1 [8800112039b0] crash_kexec at 81088630
   #2 [880011203a80] __die at 8139ea20
   #3 [880011203aa0] no_context at 8102f3a7
   #4 [880011203ae0] __bad_area_nosemaphore at 8102f665
   #5 [880011203ba0] retint_signal at 8139dd1f
   #6 [880011203cc8] bnx2i_indicate_kcqe at a03dc4f2
   #7 [880011203da8] service_kcqes at a03cb04f
   #8 [880011203e68] cnic_service_bnx2x_kcq at a03cb14a
   #9 [880011203e88] cnic_service_bnx2x_bh at a03cb1b3
  
  The problem lies in the sg_io (and perhaps sg_scsi_ioctl) call to
  blk_get_request-get_request/wait-blk_alloc_request-blk_rq_init which
  re-initializes the request-cpu to -1.  There is no assignment for cpu from
  that to the request_fn call to low level drivers.
  
  When this happens, the sc-request-cpu will be using the init value of
  -1.  This will create a kernel panic when it hits bnx2i because the code
  refers it to get the per_cpu variables ptr.
  
  This change is to put in a guard against that and also for cases when
  CONFIG_SMP/BIO_CPU_AFFINE is not enabled.  In those cases, the cpu
  affinitization code would not get run in __make_request either; hence
  the request-cpu will remain a -1 also.
  
 
 
  
  diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c 
  b/drivers/scsi/bnx2i/bnx2i_iscsi.c
  index 5c55a75..622383d 100644
  --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
  +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
  @@ -1225,6 +1225,10 @@ static int bnx2i_task_xmit(struct iscsi_task *task)
  if (!sc)
  return bnx2i_mtask_xmit(conn, task);
   
  +   if (!blk_rq_cpu_valid(sc-request)) {
  +   sc-request-cpu = get_cpu();
  +   put_cpu();
  +   }
 
 
 If I understand you right, then I think this needs to get fixed in the
 block or scsi layer instead of each LLD.

Absolutely, but this bnx2i fix is still applicable alongside the fixes I'm
proposing in the block layer below.

I think the whole idea behind the tracking of the blk req-cpu is so that the 
blk completion
can be fired off from the same CPU to take advantage of the CPU's llc.  
However, this is only being
done when the queue is defined with the QUEUE_FLAG_SAME_COMP queue_flag 
enabled.  In the case
when the queue is defined without this enforced, it would then be up to the blk 
completion
code to complete the blk request with the current CPU of the thread.

The same analogy should apply to the iSCSI LLD for cmd completion as well.  So 
if the
sc-request-cpu is left at -1, the LLD should then decide how it wants the cmd 
completion
to take place.  For all the other cases, the request-cpu id should be used 
instead.  
For bnx2i, if the blk layer didn't set the request-cpu, we would want to align 
and complete
the cmd against the task_xmit issuer's CPU id unconditionally; hence the 
explicit get_cpu call.

In the current block code, this CPU affinity code is only being called in the 
__make_request
code path. I believe the same code needs to be executed in all the other code 
paths where
the blk request is being added to the queue for execution.  This change will 
then properly
place the desired CPU to the request-cpu when the queue is defined with 
QUEUE_FLAG_SAME_COMP.
Otherwise, the request-cpu will assume the init value of -1.

Please throw in your 2 cents if anyone thinks otherwise.  I should have
the blk layer patches submitted soon.  Thanks.


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



Re: [PATCH] BNX2I: Fixed kernel panic due to illegal usage of sc-request-cpu

2011-07-14 Thread Eddie Wai

On Thu, 2011-07-14 at 00:41 -0700, Mike Christie wrote:
 On 07/14/2011 01:33 AM, Eddie Wai wrote:
  
  On Mon, 2011-07-11 at 13:02 -0700, Mike Christie wrote:
  On 07/11/2011 01:14 PM, Eddie Wai wrote:
  A kernel panic was observed when passing the sc-request-cpu = -1 to
  retrieve the per_cpu variable pointer:
   #0 [880011203960] machine_kexec at 81022bc3
   #1 [8800112039b0] crash_kexec at 81088630
   #2 [880011203a80] __die at 8139ea20
   #3 [880011203aa0] no_context at 8102f3a7
   #4 [880011203ae0] __bad_area_nosemaphore at 8102f665
   #5 [880011203ba0] retint_signal at 8139dd1f
   #6 [880011203cc8] bnx2i_indicate_kcqe at a03dc4f2
   #7 [880011203da8] service_kcqes at a03cb04f
   #8 [880011203e68] cnic_service_bnx2x_kcq at a03cb14a
   #9 [880011203e88] cnic_service_bnx2x_bh at a03cb1b3
 
  The problem lies in the sg_io (and perhaps sg_scsi_ioctl) call to
  blk_get_request-get_request/wait-blk_alloc_request-blk_rq_init which
  re-initializes the request-cpu to -1.  There is no assignment for cpu 
  from
  that to the request_fn call to low level drivers.
 
  When this happens, the sc-request-cpu will be using the init value of
  -1.  This will create a kernel panic when it hits bnx2i because the code
  refers it to get the per_cpu variables ptr.
 
  This change is to put in a guard against that and also for cases when
  CONFIG_SMP/BIO_CPU_AFFINE is not enabled.  In those cases, the cpu
  affinitization code would not get run in __make_request either; hence
  the request-cpu will remain a -1 also.
 
 
 
 
  diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c 
  b/drivers/scsi/bnx2i/bnx2i_iscsi.c
  index 5c55a75..622383d 100644
  --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
  +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
  @@ -1225,6 +1225,10 @@ static int bnx2i_task_xmit(struct iscsi_task *task)
if (!sc)
return bnx2i_mtask_xmit(conn, task);
   
  + if (!blk_rq_cpu_valid(sc-request)) {
  + sc-request-cpu = get_cpu();
  + put_cpu();
  + }
 
 
  If I understand you right, then I think this needs to get fixed in the
  block or scsi layer instead of each LLD.
  
  Absolutely, but this bnx2i fix is still applicable alongside the fixes I'm
  proposing in the block layer below.
  
  I think the whole idea behind the tracking of the blk req-cpu is so that 
  the blk completion
  can be fired off from the same CPU to take advantage of the CPU's llc.  
  However, this is only being
  done when the queue is defined with the QUEUE_FLAG_SAME_COMP queue_flag 
  enabled.  In the case
  when the queue is defined without this enforced, it would then be up to the 
  blk completion
  code to complete the blk request with the current CPU of the thread.
  
  The same analogy should apply to the iSCSI LLD for cmd completion as well.  
  So if the
  sc-request-cpu is left at -1, the LLD should then decide how it wants the 
  cmd completion
  to take place.  For all the other cases, the request-cpu id should be used 
  instead.  
  For bnx2i, if the blk layer didn't set the request-cpu, we would want to 
  align and complete
  the cmd against the task_xmit issuer's CPU id unconditionally; hence the 
  explicit get_cpu call.
 
 Oh yeah, wrt the code we have today (so I mean ignoring my rant in the
 other mail :)), I think what you are doing in your patch is sort of ok.
 I am not sure if we want to be touching the request-cpu field in a LLD
 though. I do not think LLDs should be modifying a block layer struct
 like that probably.
 
Agreed.  sc-request-cpu should be left to -1 in this case.  I'll go
ahead and defined a local variable to keep track of it.  Thanks.



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



[PATCH v2] BNX2I: Fixed kernel panic due to illegal usage of sc-request-cpu

2011-07-14 Thread Eddie Wai
A kernel panic was observed when passing the sc-request-cpu = -1 to
retrieve the per_cpu variable pointer:
 #0 [880011203960] machine_kexec at 81022bc3
 #1 [8800112039b0] crash_kexec at 81088630
 #2 [880011203a80] __die at 8139ea20
 #3 [880011203aa0] no_context at 8102f3a7
 #4 [880011203ae0] __bad_area_nosemaphore at 8102f665
 #5 [880011203ba0] retint_signal at 8139dd1f
 #6 [880011203cc8] bnx2i_indicate_kcqe at a03dc4f2
 #7 [880011203da8] service_kcqes at a03cb04f
 #8 [880011203e68] cnic_service_bnx2x_kcq at a03cb14a
 #9 [880011203e88] cnic_service_bnx2x_bh at a03cb1b3

The problem lies in the sg_io (and perhaps sg_scsi_ioctl) call to
blk_get_request-get_request/wait-blk_alloc_request-blk_rq_init which
re-initializes the request-cpu to -1.  There is no assignment for cpu from
that to the request_fn call to low level drivers.

When this happens, the sc-request-cpu will be using the init value of
-1.  This will create a kernel panic when it hits bnx2i because the code
refers it to get the per_cpu variables ptr.

This change is to put in a guard against that and also for cases when
bio affinity/queue completion to the same cpu is not enabled.  In those
cases, the request-cpu will remain a -1 also.

This bug was created from commit:  b5cf6b63f73abdc051035f0050b367beeb2ef94c

For the case when the blk layer did not setup the request-cpu, bnx2i
will complete the sc with the current CPU of the thread.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i_hwi.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 54978c1..0e71615 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1901,6 +1901,7 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session 
*session,
struct iscsi_task *task;
struct scsi_cmnd *sc;
int rc = 0;
+   int cpu;
 
spin_lock(session-lock);
task = iscsi_itt_to_task(bnx2i_conn-cls_conn-dd_data,
@@ -1912,7 +1913,13 @@ static int bnx2i_queue_scsi_cmd_resp(struct 
iscsi_session *session,
sc = task-sc;
spin_unlock(session-lock);
 
-   p = per_cpu(bnx2i_percpu, sc-request-cpu);
+   if (!blk_rq_cpu_valid(sc-request)) {
+   cpu = get_cpu();
+   put_cpu();
+   } else
+   cpu = sc-request-cpu;
+
+   p = per_cpu(bnx2i_percpu, cpu);
spin_lock(p-p_work_lock);
if (unlikely(!p-iothread)) {
rc = -EINVAL;
-- 
1.7.0.5


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



Re: [PATCH v2] BNX2I: Fixed kernel panic due to illegal usage of sc-request-cpu

2011-07-14 Thread Eddie Wai

On Thu, 2011-07-14 at 17:29 -0700, Michael Chan wrote:
 On Thu, 2011-07-14 at 16:42 -0700, Eddie Wai wrote:
  A kernel panic was observed when passing the sc-request-cpu = -1 to
  retrieve the per_cpu variable pointer:
   #0 [880011203960] machine_kexec at 81022bc3
   #1 [8800112039b0] crash_kexec at 81088630
   #2 [880011203a80] __die at 8139ea20
   #3 [880011203aa0] no_context at 8102f3a7
   #4 [880011203ae0] __bad_area_nosemaphore at 8102f665
   #5 [880011203ba0] retint_signal at 8139dd1f
   #6 [880011203cc8] bnx2i_indicate_kcqe at a03dc4f2
   #7 [880011203da8] service_kcqes at a03cb04f
   #8 [880011203e68] cnic_service_bnx2x_kcq at a03cb14a
   #9 [880011203e88] cnic_service_bnx2x_bh at a03cb1b3
  
  The problem lies in the sg_io (and perhaps sg_scsi_ioctl) call to
  blk_get_request-get_request/wait-blk_alloc_request-blk_rq_init which
  re-initializes the request-cpu to -1.  There is no assignment for cpu from
  that to the request_fn call to low level drivers.
  
  When this happens, the sc-request-cpu will be using the init value of
  -1.  This will create a kernel panic when it hits bnx2i because the code
  refers it to get the per_cpu variables ptr.
  
  This change is to put in a guard against that and also for cases when
  bio affinity/queue completion to the same cpu is not enabled.  In those
  cases, the request-cpu will remain a -1 also.
  
  This bug was created from commit:  b5cf6b63f73abdc051035f0050b367beeb2ef94c
  
  For the case when the blk layer did not setup the request-cpu, bnx2i
  will complete the sc with the current CPU of the thread.
  
  Signed-off-by: Eddie Wai eddie@broadcom.com
  ---
   drivers/scsi/bnx2i/bnx2i_hwi.c |9 -
   1 files changed, 8 insertions(+), 1 deletions(-)
  
  diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
  index 54978c1..0e71615 100644
  --- a/drivers/scsi/bnx2i/bnx2i_hwi.c
  +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
  @@ -1901,6 +1901,7 @@ static int bnx2i_queue_scsi_cmd_resp(struct 
  iscsi_session *session,
  struct iscsi_task *task;
  struct scsi_cmnd *sc;
  int rc = 0;
  +   int cpu;
   
  spin_lock(session-lock);
  task = iscsi_itt_to_task(bnx2i_conn-cls_conn-dd_data,
  @@ -1912,7 +1913,13 @@ static int bnx2i_queue_scsi_cmd_resp(struct 
  iscsi_session *session,
  sc = task-sc;
  spin_unlock(session-lock);
   
  -   p = per_cpu(bnx2i_percpu, sc-request-cpu);
  +   if (!blk_rq_cpu_valid(sc-request)) {
  +   cpu = get_cpu();
  +   put_cpu();
 
 Why not just use smp_processor_id()?
Good point.  This is run inside a tasklet which preemption is already
disabled.  I'll make the change, thanks.
 
  +   } else
  +   cpu = sc-request-cpu;
  +
  +   p = per_cpu(bnx2i_percpu, cpu);
  spin_lock(p-p_work_lock);
  if (unlikely(!p-iothread)) {
  rc = -EINVAL;
 


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



[PATCH] BNX2I: Fixed kernel panic due to illegal usage of sc-request-cpu

2011-07-11 Thread Eddie Wai
A kernel panic was observed when passing the sc-request-cpu = -1 to
retrieve the per_cpu variable pointer:
 #0 [880011203960] machine_kexec at 81022bc3
 #1 [8800112039b0] crash_kexec at 81088630
 #2 [880011203a80] __die at 8139ea20
 #3 [880011203aa0] no_context at 8102f3a7
 #4 [880011203ae0] __bad_area_nosemaphore at 8102f665
 #5 [880011203ba0] retint_signal at 8139dd1f
 #6 [880011203cc8] bnx2i_indicate_kcqe at a03dc4f2
 #7 [880011203da8] service_kcqes at a03cb04f
 #8 [880011203e68] cnic_service_bnx2x_kcq at a03cb14a
 #9 [880011203e88] cnic_service_bnx2x_bh at a03cb1b3

The problem lies in the sg_io (and perhaps sg_scsi_ioctl) call to
blk_get_request-get_request/wait-blk_alloc_request-blk_rq_init which
re-initializes the request-cpu to -1.  There is no assignment for cpu from
that to the request_fn call to low level drivers.

When this happens, the sc-request-cpu will be using the init value of
-1.  This will create a kernel panic when it hits bnx2i because the code
refers it to get the per_cpu variables ptr.

This change is to put in a guard against that and also for cases when
CONFIG_SMP/BIO_CPU_AFFINE is not enabled.  In those cases, the cpu
affinitization code would not get run in __make_request either; hence
the request-cpu will remain a -1 also.

This bug was created from commit:  b5cf6b63f73abdc051035f0050b367beeb2ef94c

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i_iscsi.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 5c55a75..622383d 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -1225,6 +1225,10 @@ static int bnx2i_task_xmit(struct iscsi_task *task)
if (!sc)
return bnx2i_mtask_xmit(conn, task);
 
+   if (!blk_rq_cpu_valid(sc-request)) {
+   sc-request-cpu = get_cpu();
+   put_cpu();
+   }
bnx2i_setup_cmd_wqe_template(cmd);
cmd-req.op_code = ISCSI_OP_SCSI_CMD;
cmd-conn = bnx2i_conn;
-- 
1.7.0.5


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



Re: [PATCH 1/4] BNX2I: Added the use of kthreads to handle SCSI cmd completion

2011-06-23 Thread Eddie Wai

On Wed, 2011-06-22 at 09:40 -0700, Fubo Chen wrote:
 On Tue, Jun 21, 2011 at 6:49 PM, Eddie Wai eddie@broadcom.com wrote:
  +/**
  + * bnx2i_percpu_io_thread - thread per cpu for ios
  + *
  + * @arg:   ptr to bnx2i_percpu_info structure
  + */
  +int bnx2i_percpu_io_thread(void *arg)
  +{
  +   struct bnx2i_percpu_s *p = arg;
  +   struct bnx2i_work *work, *tmp;
  +   LIST_HEAD(work_list);
  +
  +   set_user_nice(current, -20);
  +
  +   set_current_state(TASK_INTERRUPTIBLE);
  +   while (!kthread_should_stop()) {
  +   schedule();
  +   spin_lock_bh(p-p_work_lock);
  +   while (!list_empty(p-work_list)) {
  +   list_splice_init(p-work_list, work_list);
  +   spin_unlock_bh(p-p_work_lock);
  +
  +   list_for_each_entry_safe(work, tmp, work_list, 
  list) {
  +   list_del_init(work-list);
  +   /* work allocated in the bh, freed here */
  +   bnx2i_process_scsi_cmd_resp(work-session,
  +   
  work-bnx2i_conn,
  +   work-cqe);
  +   atomic_dec(work-bnx2i_conn-work_cnt);
  +   kfree(work);
  +   }
  +   spin_lock_bh(p-p_work_lock);
  +   }
  +   set_current_state(TASK_INTERRUPTIBLE);
  +   spin_unlock_bh(p-p_work_lock);
  +   }
  +   __set_current_state(TASK_RUNNING);
  +
  +   return 0;
  +}
 
 This loop looks a little strange to me. If the schedule() call would
 be moved from the top of the outermost while loop to the bottom then
 the first set_current_state(TASK_INTERRUPTIBLE) statement can be
 eliminated. And that also fixes the (theoretical?) race that occurs if
 wake_up_process() gets invoked after kthread_create() but before the
 first set_current_state(TASK_INTERRUPTIBLE) statement got executed.
Thanks Fubo.  Although the aforementioned race condition shouldn't be
much of a concern, however, it is theoretically possible.  I will make
the suggested change to process the work before calling schedule() to
resolve this.
 
 Fubo.
 


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



[PATCH 0/4 v2] BNX2I: Code and performance optimization

2011-06-23 Thread Eddie Wai
This patch set contains a collection of code and performance optimization
changes.

Changes from v2:
- Comments from Mike Christie to use sc-request-cpu instead of the newly
defined bnx2i_cmd-cpu
- Comments from Fubo Chen to process the work in the percpu io completion
kthread before calling schedule() to avoid potential race condition.

Your comments are welcome.  Please review.

Thanks,
Eddie

Eddie Wai (4):
  BNX2I: Added the use of kthreads to handle SCSI cmd completion
  BNX2I: Modified to skip CNIC registration if iSCSI is not supported
  BNX2I: Changed the nopout_wqe-lun memcpy to use sizeof instead
  BNX2I: Updated copyright and bump version

 drivers/scsi/bnx2i/57xx_iscsi_constants.h |2 +-
 drivers/scsi/bnx2i/57xx_iscsi_hsi.h   |2 +-
 drivers/scsi/bnx2i/bnx2i.h|   33 +-
 drivers/scsi/bnx2i/bnx2i_hwi.c|  187 -
 drivers/scsi/bnx2i/bnx2i_init.c   |  153 +---
 drivers/scsi/bnx2i/bnx2i_iscsi.c  |   38 +-
 drivers/scsi/bnx2i/bnx2i_sysfs.c  |2 +-
 7 files changed, 358 insertions(+), 59 deletions(-)


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



[PATCH 1/4 v2] BNX2I: Added the use of kthreads to handle SCSI cmd completion

2011-06-23 Thread Eddie Wai
This patch breaks the SCSI cmd completion into two parts:
1. The bh will allocate and queued work to the cmd specific CPU IO
completion kthread.  The CPU for the cmd is from the sc-request-cpu.

2. The CPU specific IO completion kthread will call the scsi_cmd_resp
routine to do the actual cmd completion.

In the normal case, these IO completion kthreads should complete before
the blk IO times out at 60s.  However, in the case when these kthreads
are blocked for whatever reason and exceeded the timeout, the call
to conn_destroy will have to iterate and exhaust all related work in the
percpu work list for all online CPUs.  This will guarantee the protection
of the work-session and conn pointers before they get freed.

Also modified the event coalescing formula to have at least the
event_coal_min outstanding cmds in the pipeline so the SCSI producer
would not get underrun.

Also changed the following SCSI parameters:
- can_queue from 1024 to 2048
- cmds_per_lun from 24 to 128

Signed-off-by: Eddie Wai eddie@broadcom.com
Acked-by: Benjamin Li be...@broadcom.com
Acked-by: Michael Chan mc...@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i.h   |   31 ++-
 drivers/scsi/bnx2i/bnx2i_hwi.c   |  183 --
 drivers/scsi/bnx2i/bnx2i_init.c  |  118 -
 drivers/scsi/bnx2i/bnx2i_iscsi.c |   36 +++-
 4 files changed, 333 insertions(+), 35 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 6bdd25a..239bc4e 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -22,11 +22,14 @@
 #include linux/pci.h
 #include linux/spinlock.h
 #include linux/interrupt.h
+#include linux/delay.h
 #include linux/sched.h
 #include linux/in.h
 #include linux/kfifo.h
 #include linux/netdevice.h
 #include linux/completion.h
+#include linux/kthread.h
+#include linux/cpu.h
 
 #include scsi/scsi_cmnd.h
 #include scsi/scsi_device.h
@@ -202,10 +205,13 @@ struct io_bdt {
 /**
  * bnx2i_cmd - iscsi command structure
  *
+ * @hdr:iSCSI header
+ * @conn:   iscsi_conn pointer
  * @scsi_cmd:   SCSI-ML task pointer corresponding to this iscsi cmd
  * @sg: SG list
  * @io_tbl: buffer descriptor (BD) table
  * @bd_tbl_dma: buffer descriptor (BD) table's dma address
+ * @req:bnx2i specific command request struct
  */
 struct bnx2i_cmd {
struct iscsi_hdr hdr;
@@ -229,6 +235,7 @@ struct bnx2i_cmd {
  * @gen_pdu:   login/nopout/logout pdu resources
  * @violation_notified:bit mask used to track iscsi error/warning messages
  * already printed out
+ * @work_cnt:  keeps track of the number of outstanding work
  *
  * iSCSI connection structure
  */
@@ -252,6 +259,8 @@ struct bnx2i_conn {
 */
struct generic_pdu_resc gen_pdu;
u64 violation_notified;
+
+   atomic_t work_cnt;
 };
 
 
@@ -661,7 +670,6 @@ enum {
  * @hba:adapter to which this connection belongs
  * @conn:   iscsi connection this EP is linked to
  * @cls_ep: associated iSCSI endpoint pointer
- * @sess:   iscsi session this EP is linked to
  * @cm_sk:  cnic sock struct
  * @hba_age:age to detect if 'iscsid' issues ep_disconnect()
  *  after HBA reset is completed by bnx2i/cnic/bnx2
@@ -687,7 +695,7 @@ struct bnx2i_endpoint {
u32 hba_age;
u32 state;
unsigned long timestamp;
-   int num_active_cmds;
+   atomic_t num_active_cmds;
u32 ec_shift;
 
struct qp_info qp;
@@ -700,6 +708,19 @@ struct bnx2i_endpoint {
 };
 
 
+struct bnx2i_work {
+   struct list_head list;
+   struct iscsi_session *session;
+   struct bnx2i_conn *bnx2i_conn;
+   struct cqe cqe;
+};
+
+struct bnx2i_percpu_s {
+   struct task_struct *iothread;
+   struct list_head work_list;
+   spinlock_t p_work_lock;
+};
+
 
 /* Global variables */
 extern unsigned int error_mask1, error_mask2;
@@ -783,7 +804,7 @@ extern struct bnx2i_endpoint *bnx2i_find_ep_in_destroy_list(
struct bnx2i_hba *hba, u32 iscsi_cid);
 
 extern int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep);
-extern void bnx2i_arm_cq_event_coalescing(struct bnx2i_endpoint *ep, u8 
action);
+extern int bnx2i_arm_cq_event_coalescing(struct bnx2i_endpoint *ep, u8 action);
 
 extern int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep);
 
@@ -793,4 +814,8 @@ extern void bnx2i_print_active_cmd_queue(struct bnx2i_conn 
*conn);
 extern void bnx2i_print_xmit_pdu_queue(struct bnx2i_conn *conn);
 extern void bnx2i_print_recv_state(struct bnx2i_conn *conn);
 
+extern int bnx2i_percpu_io_thread(void *arg);
+extern int bnx2i_process_scsi_cmd_resp(struct iscsi_session *session,
+  struct bnx2i_conn *bnx2i_conn,
+  struct cqe *cqe);
 #endif

[PATCH 2/4 v2] BNX2I: Modified to skip CNIC registration if iSCSI is not supported

2011-06-23 Thread Eddie Wai
The init routine will now examine the cnic-max_iscsi_conn variable
before registering to CNIC during ulp_init.

Signed-off-by: Eddie Wai eddie@broadcom.com
Acked-by: Michael Chan mc...@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i_init.c |   29 +++--
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 0f7fb14..28bfa9e 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -172,21 +172,14 @@ void bnx2i_start(void *handle)
struct bnx2i_hba *hba = handle;
int i = HZ;
 
-   if (!hba-cnic-max_iscsi_conn) {
-   printk(KERN_ALERT bnx2i: dev %s does not support 
-   iSCSI\n, hba-netdev-name);
+   /*
+* We should never register devices that don't support iSCSI
+* (see bnx2i_init_one), so something is wrong if we try to
+* start a iSCSI adapter on hardware with 0 supported iSCSI
+* connections
+*/
+   BUG_ON(!hba-cnic-max_iscsi_conn);
 
-   if (test_bit(BNX2I_CNIC_REGISTERED, hba-reg_with_cnic)) {
-   mutex_lock(bnx2i_dev_lock);
-   list_del_init(hba-link);
-   adapter_count--;
-   hba-cnic-unregister_device(hba-cnic, CNIC_ULP_ISCSI);
-   clear_bit(BNX2I_CNIC_REGISTERED, hba-reg_with_cnic);
-   mutex_unlock(bnx2i_dev_lock);
-   bnx2i_free_hba(hba);
-   }
-   return;
-   }
bnx2i_send_fw_iscsi_init_msg(hba);
while (!test_bit(ADAPTER_STATE_UP, hba-adapter_state)  i--)
msleep(BNX2I_INIT_POLL_TIME);
@@ -290,6 +283,13 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct 
cnic_dev *cnic)
int rc;
 
mutex_lock(bnx2i_dev_lock);
+   if (!cnic-max_iscsi_conn) {
+   printk(KERN_ALERT bnx2i: dev %s does not support 
+   iSCSI\n, hba-netdev-name);
+   rc = -EOPNOTSUPP;
+   goto out;
+   }
+
hba-cnic = cnic;
rc = cnic-register_device(cnic, CNIC_ULP_ISCSI, hba);
if (!rc) {
@@ -307,6 +307,7 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct 
cnic_dev *cnic)
else
printk(KERN_ERR bnx2i dev reg, unknown error, %d\n, rc);
 
+out:
mutex_unlock(bnx2i_dev_lock);
 
return rc;
-- 
1.7.0.5


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



[PATCH 3/4 v2] BNX2I: Changed the nopout_wqe-lun memcpy to use sizeof instead

2011-06-23 Thread Eddie Wai
Modified the memcpy of nopout_wqe-lun to use sizeof(struct scsi_lun)
instead of the hardcoded value 8 as noted by review comments.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 drivers/scsi/bnx2i/bnx2i_hwi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 2a1bb9f..ba2f96e 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -551,7 +551,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,
 
nopout_wqe-op_code = nopout_hdr-opcode;
nopout_wqe-op_attr = ISCSI_FLAG_CMD_FINAL;
-   memcpy(nopout_wqe-lun, nopout_hdr-lun, 8);
+   memcpy(nopout_wqe-lun, nopout_hdr-lun, sizeof(struct scsi_lun));
 
if (test_bit(BNX2I_NX2_DEV_57710, ep-hba-cnic_dev_type)) {
u32 tmp = nopout_wqe-lun[0];
-- 
1.7.0.5


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



  1   2   >