public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next] IB/cma: Fix gid type setting for RoCE
@ 2017-08-11  9:09 Selvin Xavier
       [not found] ` <1502442585-22391-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Selvin Xavier @ 2017-08-11  9:09 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Selvin Xavier, Somnath Kotur

RoCE gid_type should be 0 or 1 based on RoCE v1 or
RoCE V2. Since bit mask is used now, cma_dev->default_gid_type
is set to 2 (1 << IB_GID_TYPE_ROCE_UDP_ENCAP).
Use the bit mask to check the prefered gid_type and
assign the gid_type value to IB_GID_TYPE_ROCE(0) or
IB_GID_TYPE_ROCE_UDP_ENCAP(1).

Fixes: 3c7f67d1880d (IB/cma: Fix default RoCE type setting)
Signed-off-by: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/cma.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index ca4135c..eb420da 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -72,7 +72,8 @@ MODULE_LICENSE("Dual BSD/GPL");
 #define CMA_MAX_CM_RETRIES 15
 #define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24)
 #define CMA_IBOE_PACKET_LIFETIME 18
-#define CMA_PREFERRED_ROCE_GID_TYPE (1 << IB_GID_TYPE_ROCE_UDP_ENCAP)
+#define CMA_PREFERRED_ROCE_GID_TYPE_MASK (1 << IB_GID_TYPE_ROCE_UDP_ENCAP)
+#define CMA_PREFERRED_ROCE_GID_TYPE __ffs(CMA_PREFERRED_ROCE_GID_TYPE_MASK)
 
 static const char * const cma_events[] = {
 	[RDMA_CM_EVENT_ADDR_RESOLVED]	 = "address resolved",
@@ -4282,7 +4283,7 @@ static void cma_add_one(struct ib_device *device)
 	for (i = rdma_start_port(device); i <= rdma_end_port(device); i++) {
 		supported_gids = roce_gid_type_mask_support(device, i);
 		WARN_ON(!supported_gids);
-		if (supported_gids & CMA_PREFERRED_ROCE_GID_TYPE)
+		if (supported_gids & CMA_PREFERRED_ROCE_GID_TYPE_MASK)
 			cma_dev->default_gid_type[i - rdma_start_port(device)] =
 				CMA_PREFERRED_ROCE_GID_TYPE;
 		else
-- 
2.5.5

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH for-next] IB/cma: Fix gid type setting for RoCE
       [not found] ` <1502442585-22391-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
@ 2017-08-11  9:38   ` Leon Romanovsky
       [not found]     ` <20170811093838.GC24282-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Leon Romanovsky @ 2017-08-11  9:38 UTC (permalink / raw)
  To: Selvin Xavier
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Somnath Kotur

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

On Fri, Aug 11, 2017 at 02:09:45AM -0700, Selvin Xavier wrote:
> RoCE gid_type should be 0 or 1 based on RoCE v1 or
> RoCE V2. Since bit mask is used now, cma_dev->default_gid_type
> is set to 2 (1 << IB_GID_TYPE_ROCE_UDP_ENCAP).
> Use the bit mask to check the prefered gid_type and
> assign the gid_type value to IB_GID_TYPE_ROCE(0) or
> IB_GID_TYPE_ROCE_UDP_ENCAP(1).
>
> Fixes: 3c7f67d1880d (IB/cma: Fix default RoCE type setting)
> Signed-off-by: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/core/cma.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>

Hi Selvin,

We tested a little bit simple version of this fix.
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?h=rdma-next&id=bf01e3dda415538fcb799bebfe60053cf6154490

Thanks,

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for-next] IB/cma: Fix gid type setting for RoCE
       [not found]     ` <20170811093838.GC24282-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-08-11  9:56       ` Selvin Xavier
       [not found]         ` <CA+sbYW2RpmGMyf0sYwPsNrmjYUjE1rm+R-RGGj1N4PPS1im29Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Selvin Xavier @ 2017-08-11  9:56 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Somnath Kotur

On Fri, Aug 11, 2017 at 3:08 PM, Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>
>
> Hi Selvin,
>
> We tested a little bit simple version of this fix.
> https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?h=rdma-next&id=bf01e3dda415538fcb799bebfe60053cf6154490

Thanks Leon. Your patch looks good to me. Do you plan to post it  to
mailing list soon?
--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for-next] IB/cma: Fix gid type setting for RoCE
       [not found]         ` <CA+sbYW2RpmGMyf0sYwPsNrmjYUjE1rm+R-RGGj1N4PPS1im29Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-08-11 10:18           ` Leon Romanovsky
  0 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2017-08-11 10:18 UTC (permalink / raw)
  To: Selvin Xavier
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Somnath Kotur

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

On Fri, Aug 11, 2017 at 03:26:42PM +0530, Selvin Xavier wrote:
> On Fri, Aug 11, 2017 at 3:08 PM, Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> >
> >
> > Hi Selvin,
> >
> > We tested a little bit simple version of this fix.
> > https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?h=rdma-next&id=bf01e3dda415538fcb799bebfe60053cf6154490
>
> Thanks Leon. Your patch looks good to me. Do you plan to post it  to
> mailing list soon?

Yes, today.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-11 10:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-11  9:09 [PATCH for-next] IB/cma: Fix gid type setting for RoCE Selvin Xavier
     [not found] ` <1502442585-22391-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-08-11  9:38   ` Leon Romanovsky
     [not found]     ` <20170811093838.GC24282-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-08-11  9:56       ` Selvin Xavier
     [not found]         ` <CA+sbYW2RpmGMyf0sYwPsNrmjYUjE1rm+R-RGGj1N4PPS1im29Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-11 10:18           ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox