Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Mar 2018 18:27:25 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331777 - stable/11/sys/ofed/drivers/infiniband/core
Message-ID:  <201803301827.w2UIRPGa072377@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Mar 30 18:27:24 2018
New Revision: 331777
URL: https://svnweb.freebsd.org/changeset/base/331777

Log:
  MFC r330494:
  Select RoCEv2 by default in ibcore.
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c
==============================================================================
--- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c	Fri Mar 30 18:26:29 2018	(r331776)
+++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c	Fri Mar 30 18:27:24 2018	(r331777)
@@ -4137,7 +4137,6 @@ static void cma_add_one(struct ib_device *device)
 	struct cma_device *cma_dev;
 	struct rdma_id_private *id_priv;
 	unsigned int i;
-	unsigned long supported_gids = 0;
 
 	cma_dev = kmalloc(sizeof *cma_dev, GFP_KERNEL);
 	if (!cma_dev)
@@ -4154,10 +4153,23 @@ static void cma_add_one(struct ib_device *device)
 		return;
 	}
 	for (i = rdma_start_port(device); i <= rdma_end_port(device); i++) {
+		unsigned long supported_gids;
+		unsigned int default_gid_type;
+
 		supported_gids = roce_gid_type_mask_support(device, i);
-		WARN_ON(!supported_gids);
+
+		if (WARN_ON(!supported_gids)) {
+			/* set something valid */
+			default_gid_type = 0;
+		} else if (test_bit(IB_GID_TYPE_ROCE_UDP_ENCAP, &supported_gids)) {
+			/* prefer RoCEv2, if supported */
+			default_gid_type = IB_GID_TYPE_ROCE_UDP_ENCAP;
+		} else {
+			default_gid_type = find_first_bit(&supported_gids,
+			    BITS_PER_LONG);
+		}
 		cma_dev->default_gid_type[i - rdma_start_port(device)] =
-			find_first_bit(&supported_gids, BITS_PER_LONG);
+		    default_gid_type;
 	}
 
 	init_completion(&cma_dev->comp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803301827.w2UIRPGa072377>