diff mbox

infiniband: check local reserved ports

Message ID 20100603083106.6047.7657.sendpatchset@localhost.localdomain
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Amerigo Wang June 3, 2010, 8:27 a.m. UTC
Since Tetsuo's patch already got merged, now this is the missing part
for local port reservation.

Cc: Roland Dreier <rdreier@cisco.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: WANG Cong <amwang@redhat.com>

---
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Roland Dreier June 3, 2010, 4:39 p.m. UTC | #1
> Since Tetsuo's patch already got merged, now this is the missing part
 > for local port reservation.
 > 
 > Cc: Roland Dreier <rdreier@cisco.com>
 > Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
 > Signed-off-by: WANG Cong <amwang@redhat.com>
 > 
 > ---
 > diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
 > index b930b81..7b89bab 100644
 > --- a/drivers/infiniband/core/cma.c
 > +++ b/drivers/infiniband/core/cma.c
 > @@ -1978,6 +1978,7 @@ static int cma_alloc_any_port(struct idr *ps, struct rdma_id_private *id_priv)
 >  	rover = net_random() % remaining + low;
 >  retry:
 >  	if (last_used_port != rover &&
 > +	    !inet_is_reserved_local_port(rover) &&
 >  	    !idr_find(ps, (unsigned short) rover)) {
 >  		int ret = cma_alloc_port(ps, id_priv, rover);
 >  		/*

Should this inet_is_reserved_local_port() test apply to all the "port
spaces" that this code is handling?  I honestly am ignorant of the
intended semantics of the new local_reserved_ports stuff, hence my question.

 - R.
Amerigo Wang June 4, 2010, 1:53 a.m. UTC | #2
On 06/04/10 00:39, Roland Dreier wrote:
>   >  Since Tetsuo's patch already got merged, now this is the missing part
>   >  for local port reservation.
>   >
>   >  Cc: Roland Dreier<rdreier@cisco.com>
>   >  Cc: Tetsuo Handa<penguin-kernel@i-love.sakura.ne.jp>
>   >  Signed-off-by: WANG Cong<amwang@redhat.com>
>   >
>   >  ---
>   >  diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
>   >  index b930b81..7b89bab 100644
>   >  --- a/drivers/infiniband/core/cma.c
>   >  +++ b/drivers/infiniband/core/cma.c
>   >  @@ -1978,6 +1978,7 @@ static int cma_alloc_any_port(struct idr *ps, struct rdma_id_private *id_priv)
>   >   	rover = net_random() % remaining + low;
>   >   retry:
>   >   	if (last_used_port != rover&&
>   >  +	    !inet_is_reserved_local_port(rover)&&
>   >   	!idr_find(ps, (unsigned short) rover)) {
>   >   		int ret = cma_alloc_port(ps, id_priv, rover);
>   >   		/*
>
> Should this inet_is_reserved_local_port() test apply to all the "port
> spaces" that this code is handling?  I honestly am ignorant of the
> intended semantics of the new local_reserved_ports stuff, hence my question.
>

Yes, but I only found this case, is there any else?

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Roland Dreier June 4, 2010, 4:04 p.m. UTC | #3
> > Should this inet_is_reserved_local_port() test apply to all the "port
 > > spaces" that this code is handling?  I honestly am ignorant of the
 > > intended semantics of the new local_reserved_ports stuff, hence my question.

 > Yes, but I only found this case, is there any else?

My question was more in the other direction: should this test apply to
all the "port spaces" handled here?  From looking at the code, it
appears the answer is yes -- it seems that putting a port in
local_reserved_ports reserves that port for IPv4 and IPv6, UDP, TCP,
SCTP, DCCP, everything, so we should probably reserve all RDMA CM ports too.
Amerigo Wang June 7, 2010, 9:04 a.m. UTC | #4
On 06/05/10 00:04, Roland Dreier wrote:
>   >  >  Should this inet_is_reserved_local_port() test apply to all the "port
>   >  >  spaces" that this code is handling?  I honestly am ignorant of the
>   >  >  intended semantics of the new local_reserved_ports stuff, hence my question.
>
>   >  Yes, but I only found this case, is there any else?
>
> My question was more in the other direction: should this test apply to
> all the "port spaces" handled here?  From looking at the code, it
> appears the answer is yes -- it seems that putting a port in
> local_reserved_ports reserves that port for IPv4 and IPv6, UDP, TCP,
> SCTP, DCCP, everything, so we should probably reserve all RDMA CM ports too.

Yes.

So this patch looks good for you? :)

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Roland Dreier June 7, 2010, 3:45 p.m. UTC | #5
> So this patch looks good for you? :)

Yes, will queue it up, thanks.
Amerigo Wang June 8, 2010, 2:23 a.m. UTC | #6
On 06/07/10 23:45, Roland Dreier wrote:
>   >  So this patch looks good for you? :)
>
> Yes, will queue it up, thanks.

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index b930b81..7b89bab 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1978,6 +1978,7 @@  static int cma_alloc_any_port(struct idr *ps, struct rdma_id_private *id_priv)
 	rover = net_random() % remaining + low;
 retry:
 	if (last_used_port != rover &&
+	    !inet_is_reserved_local_port(rover) &&
 	    !idr_find(ps, (unsigned short) rover)) {
 		int ret = cma_alloc_port(ps, id_priv, rover);
 		/*