From: Robert LeBlanc <robert-4JaGZRWAfWbajFs6igw21g@public.gmane.org>
To: lduncan-IBi9RG/b67k@public.gmane.org
Cc: cleech-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
jejb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
martin.petersen-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
open-iscsi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org,
roid-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
subbu.seetharaman-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
ketan.mukadam-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
jitendra.bhivare-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
QLogic-Storage-Upstream-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org,
varun-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org,
Robert LeBlanc <robert-4JaGZRWAfWbajFs6igw21g@public.gmane.org>
Subject: [PATCH 3/7] ib/iSER: Add binding to source IP address.
Date: Tue, 6 Jun 2017 12:07:13 -0600 [thread overview]
Message-ID: <20170606180717.5007-4-robert@leblancnet.us> (raw)
In-Reply-To: <20170606180717.5007-1-robert-4JaGZRWAfWbajFs6igw21g@public.gmane.org>
If the iface passed in has ip address set, then attept to create an RDMA
connection using it as the source IP address. This allows iSER to use
multiple ports on the same network or in more complex routing
configurations. Also update to accepting sockaddr_storage.
Signed-off-by: Robert LeBlanc <robert-4JaGZRWAfWbajFs6igw21g@public.gmane.org>
---
drivers/infiniband/ulp/iser/iscsi_iser.c | 33 ++++++++++++++++++++++++----
drivers/infiniband/ulp/iser/iscsi_iser.h | 4 ++--
drivers/infiniband/ulp/iser/iser_initiator.c | 1 +
drivers/infiniband/ulp/iser/iser_memory.c | 1 +
drivers/infiniband/ulp/iser/iser_verbs.c | 8 ++++---
5 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 5a887efb4bdf..7ba5ed9afe05 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -59,6 +59,7 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>
+#include <linux/inet.h>
#include <net/sock.h>
@@ -808,12 +809,16 @@ static int iscsi_iser_get_ep_param(struct iscsi_endpoint *ep,
* if fails.
*/
static struct iscsi_endpoint *
-iscsi_iser_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
- int non_blocking)
+iscsi_iser_ep_connect(struct Scsi_Host *shost, struct sockaddr_storage *dst_addr,
+ int non_blocking, struct iface_rec *iface)
{
int err;
struct iser_conn *iser_conn;
struct iscsi_endpoint *ep;
+ struct sockaddr_storage src_addr;
+ struct sockaddr_in *tmp_addr;
+ struct sockaddr_in6 *tmp_addr6;
+ memset(&src_addr, 0, sizeof(src_addr));
ep = iscsi_create_endpoint(0);
if (!ep)
@@ -828,8 +833,28 @@ iscsi_iser_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
ep->dd_data = iser_conn;
iser_conn->ep = ep;
iser_conn_init(iser_conn);
-
- err = iser_connect(iser_conn, NULL, dst_addr, non_blocking);
+ if (iface && iface->ipaddress[0]) {
+ if (strchr(iface->ipaddress, ':')) {
+ tmp_addr6 = (struct sockaddr_in6 *)&src_addr;
+ tmp_addr6->sin6_family = AF_INET6;
+ if(!in6_pton(iface->ipaddress, -1,
+ tmp_addr6->sin6_addr.s6_addr,
+ -1, NULL)) {
+ err = -EINVAL;
+ goto failure;
+ }
+ } else {
+ tmp_addr = (struct sockaddr_in *)&src_addr;
+ tmp_addr->sin_family = AF_INET;
+ if (!in4_pton(iface->ipaddress, -1,
+ (u8 *)&tmp_addr->sin_addr.s_addr,
+ -1, NULL)) {
+ err = -EINVAL;
+ goto failure;
+ }
+ }
+ }
+ err = iser_connect(iser_conn, &src_addr, dst_addr, non_blocking);
if (err)
goto failure;
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index c1ae4aeae2f9..1eda6ff49bdc 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -628,8 +628,8 @@ void iser_unreg_rdma_mem(struct iscsi_iser_task *task,
enum iser_data_dir dir);
int iser_connect(struct iser_conn *iser_conn,
- struct sockaddr *src_addr,
- struct sockaddr *dst_addr,
+ struct sockaddr_storage *src_addr,
+ struct sockaddr_storage *dst_addr,
int non_blocking);
void iser_unreg_mem_fmr(struct iscsi_iser_task *iser_task,
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 12ed62ce9ff7..361d5e411fe7 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -35,6 +35,7 @@
#include <linux/mm.h>
#include <linux/scatterlist.h>
#include <linux/kfifo.h>
+#include <linux/if.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
index 9c3e9ab53a41..c9d95b997820 100644
--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -36,6 +36,7 @@
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/scatterlist.h>
+#include <linux/if.h>
#include "iscsi_iser.h"
static
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index c538a38c91ce..0a43009296b6 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -35,6 +35,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/delay.h>
+#include <linux/if.h>
#include "iscsi_iser.h"
@@ -941,8 +942,8 @@ void iser_conn_init(struct iser_conn *iser_conn)
* sleeps until the connection is established or rejected
*/
int iser_connect(struct iser_conn *iser_conn,
- struct sockaddr *src_addr,
- struct sockaddr *dst_addr,
+ struct sockaddr_storage *src_addr,
+ struct sockaddr_storage *dst_addr,
int non_blocking)
{
struct ib_conn *ib_conn = &iser_conn->ib_conn;
@@ -968,7 +969,8 @@ int iser_connect(struct iser_conn *iser_conn,
goto id_failure;
}
- err = rdma_resolve_addr(ib_conn->cma_id, src_addr, dst_addr, 1000);
+ err = rdma_resolve_addr(ib_conn->cma_id, (struct sockaddr *)src_addr,
+ (struct sockaddr *)dst_addr, 1000);
if (err) {
iser_err("rdma_resolve_addr failed: %d\n", err);
goto addr_failure;
--
2.11.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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.
next prev parent reply other threads:[~2017-06-06 18:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-06 18:07 [PATCH 0/7] Enable iSCSI offload drivers to use information from iface Robert LeBlanc
[not found] ` <20170606180717.5007-1-robert-4JaGZRWAfWbajFs6igw21g@public.gmane.org>
2017-06-06 18:07 ` [PATCH 1/7] scsi/scsi_transport_iscsi: Add iface struct to kernel Robert LeBlanc
[not found] ` <20170606180717.5007-2-robert-4JaGZRWAfWbajFs6igw21g@public.gmane.org>
2017-06-08 12:29 ` kbuild test robot
2017-06-06 18:07 ` [PATCH 2/7] scsi/scsi_transport_iscsi: Update ep_connect to include iface Robert LeBlanc
[not found] ` <20170606180717.5007-3-robert-4JaGZRWAfWbajFs6igw21g@public.gmane.org>
2017-06-08 12:24 ` kbuild test robot
2017-06-08 12:53 ` kbuild test robot
2017-06-06 18:07 ` Robert LeBlanc [this message]
2017-06-06 18:07 ` [PATCH 4/7] scsi/be2iscsi: Update beiscsi_ep_connect to accept iface and sockaddr_storage Robert LeBlanc
2017-06-06 18:07 ` [PATCH 5/7] scsi/bnx2i: Update bnx2i_ep_connect " Robert LeBlanc
2017-06-06 18:07 ` [PATCH 6/7] scsi/cxgbi: Update cxgbi_ep_connect " Robert LeBlanc
2017-06-06 18:07 ` [PATCH 7/7] scsi/qla4xxx: Update qla4xxx_ep_connect " Robert LeBlanc
2017-06-07 8:09 ` [PATCH 0/7] Enable iSCSI offload drivers to use information from iface Hannes Reinecke
2017-06-07 16:28 ` Chris Leech
2017-06-07 18:30 ` Robert LeBlanc
[not found] ` <CAANLjFomYCEmjfE7HLAsE7SgVqBKH8KSxYzFqxuV7t8as8+-ZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-13 16:49 ` Robert LeBlanc
2017-06-14 9:20 ` Rangankar, Manish
[not found] ` <D566FD10.3ABC0%manish.rangankar-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2017-06-14 16:47 ` Robert LeBlanc
2017-07-24 18:32 ` Robert LeBlanc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170606180717.5007-4-robert@leblancnet.us \
--to=robert-4jagzrwafwbajfs6igw21g@public.gmane.org \
--cc=QLogic-Storage-Upstream-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org \
--cc=cleech-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=jejb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=jitendra.bhivare-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=ketan.mukadam-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=lduncan-IBi9RG/b67k@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=martin.petersen-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=open-iscsi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
--cc=roid-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=subbu.seetharaman-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=varun-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox