From: Chien Tung <chien.tin.tung-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Roland Dreier <rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v2] RDMA/CMA: fix iWARP adapter TCP port space usage
Date: Fri, 11 Jun 2010 07:47:46 -0500 [thread overview]
Message-ID: <20100611124746.GA2292@CTUNG-MOBL1> (raw)
Current iWARP implementations make use of the TCP port space for iWARP
connections without synchornizing with the host TCP stack. This can
lead to both host TCP and offloaded iWARP connections for the iWARP
interface to use the same TCP port. The combined traffic will result
in undesirable behaviors from connection failures to resets.
This patch resolves the issue by allocating a kernel socket consuming
the TCP port for the iWARP connection upon connection creation and
freeing the socket once the iWARP connection is destroyed.
This functionality is needed for iWARP adapters that are both a L2 and
offload iWARP device. Applications can create and use host TCP and
iWARP connections over the same interface without additional
administrative overhead and complication needed to manage TCP port space
manually.
Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Signed-off-by: Faisal Latif <faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Chien Tung <chien.tin.tung-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
V2 changes:
* Fix compilation warning in cma_0100_unified_tcp_ports.patch
Signed-off-by: Vladimir Sokolovsky <vlad-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
- ip_addr_size(&id_priv->id.route.addr.src_addr));
+ ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr));
* IB/core: fix build warning
Eliminates the following build warning:
CC [M] ./drivers/infiniband/core/cma.o
./drivers/infiniband/core/cma.c: In function 'cma_get_tcp_port':
./drivers/infiniband/core/cma.c:2076: warning: passing argument 1 of 'ip_addr_size' from incompatible pointer type
Signed-off-by: John Gregor <john.gregor-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Yannick Cote <yannick.cote-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org>
- size = ip_addr_size(&id_priv->id.route.addr.src_addr);
+ size = ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr);
* Add getname
Signed-off-by: Faisal Latif <faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
* Change default unify_tcp_port_space to 1
Signed-off-by: Chien Tung <chien.tin.tung-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
drivers/infiniband/core/cma.c | 46 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 45 insertions(+), 1 deletions(-)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index b930b81..d5855f9 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -56,6 +56,11 @@ MODULE_AUTHOR("Sean Hefty");
MODULE_DESCRIPTION("Generic RDMA CM Agent");
MODULE_LICENSE("Dual BSD/GPL");
+int unify_tcp_port_space = 1;
+module_param(unify_tcp_port_space, int, 0644);
+MODULE_PARM_DESC(unify_tcp_port_space, "Unify the host TCP and RDMA port "
+ "space allocation (default=1)");
+
#define CMA_CM_RESPONSE_TIMEOUT 20
#define CMA_MAX_CM_RETRIES 15
#define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24)
@@ -118,6 +123,7 @@ struct rdma_id_private {
struct rdma_cm_id id;
struct rdma_bind_list *bind_list;
+ struct socket *sock;
struct hlist_node node;
struct list_head list; /* listen_any_list or cma_device.list */
struct list_head listen_list; /* per device listens */
@@ -806,6 +812,8 @@ static void cma_release_port(struct rdma_id_private *id_priv)
kfree(bind_list);
}
mutex_unlock(&lock);
+ if (id_priv->sock)
+ sock_release(id_priv->sock);
}
static void cma_leave_mc_groups(struct rdma_id_private *id_priv)
@@ -2035,6 +2043,37 @@ static int cma_use_port(struct idr *ps, struct rdma_id_private *id_priv)
return 0;
}
+static int cma_get_tcp_port(struct rdma_id_private *id_priv)
+{
+ int ret;
+ int size;
+ struct socket *sock;
+
+ ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
+ if (ret)
+ return ret;
+
+ size = ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr);
+
+ ret = sock->ops->bind(sock,
+ (struct sockaddr *) &id_priv->id.route.addr.src_addr,
+ size);
+ if (ret)
+ goto err;
+
+ ret = sock->ops->getname(sock,
+ (struct sockaddr *) &id_priv->id.route.addr.src_addr,
+ &size, 0);
+ if (ret)
+ goto err;
+
+ id_priv->sock = sock;
+ return 0;
+err:
+ sock_release(sock);
+ return ret;
+}
+
static int cma_get_port(struct rdma_id_private *id_priv)
{
struct idr *ps;
@@ -2046,6 +2085,11 @@ static int cma_get_port(struct rdma_id_private *id_priv)
break;
case RDMA_PS_TCP:
ps = &tcp_ps;
+ if (unify_tcp_port_space) {
+ ret = cma_get_tcp_port(id_priv);
+ if (ret)
+ goto out;
+ }
break;
case RDMA_PS_UDP:
ps = &udp_ps;
@@ -2063,7 +2107,7 @@ static int cma_get_port(struct rdma_id_private *id_priv)
else
ret = cma_use_port(ps, id_priv);
mutex_unlock(&lock);
-
+out:
return ret;
}
--
1.6.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2010-06-11 12:47 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-11 12:47 Chien Tung [this message]
2010-06-11 16:03 ` [PATCH v2] RDMA/CMA: fix iWARP adapter TCP port space usage Roland Dreier
[not found] ` <adapqzxy2sb.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-06-11 19:49 ` Tung, Chien Tin
[not found] ` <2EFBCAEF10980645BBCFB605689E08E904924CCE42-uLM7Qlg6MbdZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-06-11 21:13 ` Steve Wise
[not found] ` <4C12A6E8.5040400-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-11 22:08 ` Roland Dreier
[not found] ` <adamxv1w7cb.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-06-11 22:41 ` Jason Gunthorpe
[not found] ` <20100611224126.GA4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-06-11 22:47 ` Hefty, Sean
[not found] ` <CF9C39F99A89134C9CF9C4CCB68B8DDF255F6BB9B7-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-06-11 22:55 ` Jason Gunthorpe
2010-06-11 23:40 ` Steve Wise
[not found] ` <4C12C971.4000909-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-12 0:04 ` Jason Gunthorpe
[not found] ` <20100612000431.GC4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-06-12 1:18 ` Steve Wise
[not found] ` <4C12E073.2040008-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-12 1:56 ` Jason Gunthorpe
[not found] ` <20100612015652.GA7648-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-06-12 2:10 ` Steve Wise
[not found] ` <4C12EC89.1030305-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-12 4:34 ` Peter P Waskiewicz Jr
[not found] ` <Pine.WNT.4.64.1006112117160.6192-sfjRBClDQW9noNDWh8xLylnYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2010-06-12 4:46 ` Roland Dreier
[not found] ` <adaeigcx3hw.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-06-12 6:30 ` Pradeep Satyanarayana
2010-06-12 15:17 ` Steve Wise
[not found] ` <4C13A526.3040500-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-17 14:14 ` Bernard Metzler
[not found] ` <OF026C9B22.332F6F2C-ONC1257745.00429E02-C1257745.004E411D-Xeyd2O9EBijQT0dZR+AlfA@public.gmane.org>
2010-06-17 14:56 ` Steve Wise
[not found] ` <4C1A378B.9030509-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-17 16:13 ` Bernard Metzler
2010-06-23 17:30 ` Roland Dreier
[not found] ` <ada8w65veq4.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-06-23 17:37 ` Steve Wise
[not found] ` <4C224652.2060601-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-23 18:33 ` Tung, Chien Tin
[not found] ` <2EFBCAEF10980645BBCFB605689E08E90492696E76-uLM7Qlg6MbdZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-06-23 18:48 ` Steve Wise
2010-06-23 18:20 ` Steve Wise
[not found] ` <4C225078.6050001-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-23 18:28 ` Roland Dreier
[not found] ` <adar5jxtxho.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-06-23 18:46 ` Steve Wise
[not found] ` <4C225697.6060702-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-23 18:45 ` Roland Dreier
2010-06-23 19:29 ` Jason Gunthorpe
[not found] ` <20100623192909.GT4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-06-23 19:42 ` Steve Wise
[not found] ` <4C2263B3.9010608-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-23 19:45 ` Steve Wise
[not found] ` <4C226441.5000904-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-23 19:49 ` Steve Wise
2010-06-23 19:52 ` Jason Gunthorpe
[not found] ` <20100623195210.GU4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-06-23 20:01 ` Roland Dreier
[not found] ` <adawrtpsem5.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-06-23 20:13 ` Steve Wise
2010-06-23 20:11 ` Steve Wise
[not found] ` <4C226A6F.4000801-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-23 20:09 ` Jason Gunthorpe
[not found] ` <20100623200937.GV4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-06-23 20:19 ` Steve Wise
[not found] ` <4C226C53.7080802-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-06-23 20:26 ` Jason Gunthorpe
[not found] ` <20100623202607.GW4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-06-23 20:39 ` Steve Wise
2010-06-23 20:29 ` Steve Wise
2010-06-23 19:17 ` Tung, Chien Tin
[not found] ` <2EFBCAEF10980645BBCFB605689E08E90492696EF7-uLM7Qlg6MbdZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-06-23 19:50 ` Roland Dreier
[not found] ` <ada6319ttnj.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-06-23 20:51 ` Tung, Chien Tin
2010-06-25 16:46 ` Bernard Metzler
[not found] ` <OFE69DF7DF.E7AB1B1F-ONC125774D.0035CCED-C125774D.005C2F46-Xeyd2O9EBijQT0dZR+AlfA@public.gmane.org>
2010-06-25 20:14 ` Tung, Chien Tin
[not found] ` <2EFBCAEF10980645BBCFB605689E08E904926FF2A4-uLM7Qlg6MbdZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-07-06 20:52 ` Tung, Chien Tin
[not found] ` <2EFBCAEF10980645BBCFB605689E08E904928D9C9B-uLM7Qlg6MbdZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-07-06 21:03 ` Steve Wise
[not found] ` <4C339A13.3030802-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-07-07 15:37 ` Bernard Metzler
[not found] ` <OF9B577A15.49E0F3EB-ONC1257759.005129F2-C1257759.0055D7D7-Xeyd2O9EBijQT0dZR+AlfA@public.gmane.org>
2010-07-07 16:26 ` Steve Wise
[not found] ` <4C34AAA6.2080909-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-07-07 18:10 ` Tung, Chien Tin
[not found] ` <2EFBCAEF10980645BBCFB605689E08E904928DA373-uLM7Qlg6MbdZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-07-07 18:12 ` Steve Wise
2010-06-12 5:22 ` Jason Gunthorpe
[not found] ` <20100612052242.GA17793-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-06-12 14:51 ` Tung, Chien Tin
2010-06-11 23:45 ` Steve Wise
2010-06-11 19:40 ` Or Gerlitz
[not found] ` <AANLkTinDsfGtQZUc6kfW2-pWK51V2SK3CLjE-8jDjfzN-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-11 19:52 ` Tung, Chien Tin
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=20100611124746.GA2292@CTUNG-MOBL1 \
--to=chien.tin.tung-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rdreier-FYB4Gu1CFyUAvxtiuMwx3w@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