From owner-svn-src-stable@freebsd.org Fri Mar 30 18:30:10 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 C92A3F54A1F; Fri, 30 Mar 2018 18:30:10 +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 7D0B37558F; Fri, 30 Mar 2018 18:30:10 +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 5D7FA4983; Fri, 30 Mar 2018 18:30:10 +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 w2UIUAHG072679; Fri, 30 Mar 2018 18:30:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2UIUAs5072678; Fri, 30 Mar 2018 18:30:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803301830.w2UIUAs5072678@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:30:10 +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: r331780 - 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: 331780 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:30:11 -0000 Author: hselasky Date: Fri Mar 30 18:30:10 2018 New Revision: 331780 URL: https://svnweb.freebsd.org/changeset/base/331780 Log: MFC r330501: Make sure to register the VLAN GIDs using the VLAN network interface and not the parent one in ibcore. Else looking up the VLAN GIDs will fail for VLAN IPs. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Fri Mar 30 18:29:14 2018 (r331779) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Fri Mar 30 18:30:10 2018 (r331780) @@ -169,12 +169,14 @@ roce_gid_update_addr_callback(struct ib_device *device struct sockaddr_in v4; struct sockaddr_in6 v6; } ipx_addr; + struct net_device *ndev; }; struct ipx_entry *entry; struct net_device *idev; #if defined(INET) || defined(INET6) struct ifaddr *ifa; #endif + struct ib_gid_attr gid_attr; union ib_gid gid; int default_gids; u16 index_num; @@ -211,6 +213,7 @@ roce_gid_update_addr_callback(struct ib_device *device continue; } entry->ipx_addr.v4 = *((struct sockaddr_in *)ifa->ifa_addr); + entry->ndev = idev; STAILQ_INSERT_TAIL(&ipx_head, entry, entry); } #endif @@ -226,6 +229,7 @@ roce_gid_update_addr_callback(struct ib_device *device continue; } entry->ipx_addr.v6 = *((struct sockaddr_in6 *)ifa->ifa_addr); + entry->ndev = idev; /* trash IPv6 scope ID */ sa6_recoverscope(&entry->ipx_addr.v6); @@ -251,19 +255,25 @@ roce_gid_update_addr_callback(struct ib_device *device continue; /* check if entry found */ if (ib_find_cached_gid_by_port(device, &gid, i, - port, ndev, &index_num) == 0) + port, entry->ndev, &index_num) == 0) break; } if (i != IB_GID_TYPE_SIZE) continue; /* add new GID */ - update_gid(GID_ADD, device, port, &gid, ndev); + update_gid(GID_ADD, device, port, &gid, entry->ndev); } /* remove stale GIDs, if any */ - for (i = default_gids; ib_get_cached_gid(device, port, i, &gid, NULL) == 0; i++) { + for (i = default_gids; ib_get_cached_gid(device, port, i, &gid, &gid_attr) == 0; i++) { union ipx_addr ipx; + /* check for valid network device pointer */ + ndev = gid_attr.ndev; + if (ndev == NULL) + continue; + dev_put(ndev); + /* don't delete empty entries */ if (memcmp(&gid, &zgid, sizeof(zgid)) == 0) continue; @@ -274,7 +284,8 @@ roce_gid_update_addr_callback(struct ib_device *device rdma_gid2ip(&ipx.sa[0], &gid); STAILQ_FOREACH(entry, &ipx_head, entry) { - if (memcmp(&entry->ipx_addr, &ipx, sizeof(ipx)) == 0) + if (entry->ndev == ndev && + memcmp(&entry->ipx_addr, &ipx, sizeof(ipx)) == 0) break; } /* check if entry found */