From owner-svn-src-stable@freebsd.org Mon Jun 10 13:44:30 2019 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 0FDAF15BFE4C; Mon, 10 Jun 2019 13:44:30 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A78357421D; Mon, 10 Jun 2019 13:44:29 +0000 (UTC) (envelope-from slavash@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 7E4131B0BB; Mon, 10 Jun 2019 13:44:29 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5ADiTxW034437; Mon, 10 Jun 2019 13:44:29 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5ADiTmX034436; Mon, 10 Jun 2019 13:44:29 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201906101344.x5ADiTmX034436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Mon, 10 Jun 2019 13:44:29 +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: r348859 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 348859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A78357421D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 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: Mon, 10 Jun 2019 13:44:30 -0000 Author: slavash Date: Mon Jun 10 13:44:29 2019 New Revision: 348859 URL: https://svnweb.freebsd.org/changeset/base/348859 Log: MFC r348601: Fix prio vs. nonprio tagged traffic in RDMACM In current RDMACM implementation RDMACM server will not find a GID index when the request was prio-tagged and the sever is non prio-tagged and vise-versa. According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be considered as untagged. Treat RDMACM request the same. Reviewed by: hselasky, kib Sponsored by: Mellanox Technologies Approved by: re (gjb@) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Mon Jun 10 13:38:57 2019 (r348858) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Mon Jun 10 13:44:29 2019 (r348859) @@ -414,18 +414,32 @@ struct find_gid_index_context { enum ib_gid_type gid_type; }; + +/* + * This function will return true only if a inspected GID index + * matches the request based on the GID type and VLAN configuration + */ static bool find_gid_index(const union ib_gid *gid, const struct ib_gid_attr *gid_attr, void *context) { + u16 vlan_diff; struct find_gid_index_context *ctx = (struct find_gid_index_context *)context; if (ctx->gid_type != gid_attr->gid_type) return false; - if (rdma_vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id) - return false; - return true; + + /* + * The following will verify: + * 1. VLAN ID matching for VLAN tagged requests. + * 2. prio-tagged/untagged to prio-tagged/untagged matching. + * + * This XOR is valid, since 0x0 < vlan_id < 0x0FFF. + */ + vlan_diff = rdma_vlan_dev_vlan_id(gid_attr->ndev) ^ ctx->vlan_id; + + return (vlan_diff == 0x0000 || vlan_diff == 0xFFFF); } static int get_sgid_index_from_eth(struct ib_device *device, u8 port_num,