From e1e23b59a6add3b1446c6f88eb68068e36d55732 Mon Sep 17 00:00:00 2001
From: John Romein <romein@astron.nl>
Date: Mon, 10 Jan 2011 12:56:00 +0000
Subject: [PATCH] bug 225: Optimized core/pset remapping for BG/P.

---
 RTCP/Interface/src/CN_Mapping.cc | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/RTCP/Interface/src/CN_Mapping.cc b/RTCP/Interface/src/CN_Mapping.cc
index 60b42a5181a..77a8e796f1f 100644
--- a/RTCP/Interface/src/CN_Mapping.cc
+++ b/RTCP/Interface/src/CN_Mapping.cc
@@ -28,12 +28,15 @@ namespace RTCP {
 unsigned CN_Mapping::mapCoreOnPset(unsigned core, unsigned pset)
 {
 #if defined HAVE_BGP
-  // TODO: there may be better mappings for partitions larger than one midplane
-  static unsigned char mapX[] = { 0, 2, 6, 4 };
-  static unsigned char mapY[] = { 0, 1, 5, 4 };
-  static unsigned char mapZ[] = { 0, 1, 3, 2 };
-
-  return core ^ mapX[(pset >> 0) & 3] ^ mapY[(pset >> 2) & 3] ^ mapZ[(pset >> 4) & 3];
+  // TODO: there may be better mappings for partitions larger than one rack
+  static unsigned char mapX[] = { 0, 12 };
+  static unsigned char mapY[] = { 0,  2, 10,  8 };
+  static unsigned char mapZ[] = { 0,  1,  3,  2,  6,  7,  5,  4 };
+
+  return core ^
+	 mapX[((pset & 0x08) >> 3)] ^
+	 mapY[((pset & 0x01) >> 0) | ((pset & 0x10) >> 3)] ^
+	 mapZ[((pset & 0x03) >> 1) | ((pset & 0x20) >> 3)];
 #else
   (void)pset;
 
-- 
GitLab