From owner-svn-src-stable@freebsd.org Fri Mar 30 18:27:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83081F545D1; Fri, 30 Mar 2018 18:27:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33E857508C; Fri, 30 Mar 2018 18:27:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EA6B497A; Fri, 30 Mar 2018 18:27:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2UIRPFa072378; Fri, 30 Mar 2018 18:27:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2UIRPGa072377; Fri, 30 Mar 2018 18:27:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803301827.w2UIRPGa072377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 30 Mar 2018 18:27:25 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 331777 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Mar 2018 18:27:25 -0000 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);