Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jun 2019 09:03:08 +0000 (UTC)
From:      Slava Shwartsman <slavash@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r348849 - stable/12/sys/ofed/drivers/infiniband/core
Message-ID:  <201906100903.x5A938jj087181@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: slavash
Date: Mon Jun 10 09:03:08 2019
New Revision: 348849
URL: https://svnweb.freebsd.org/changeset/base/348849

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

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

Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c
==============================================================================
--- stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c	Mon Jun 10 07:12:46 2019	(r348848)
+++ stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c	Mon Jun 10 09:03:08 2019	(r348849)
@@ -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,



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