From 5f5ee2d0667039bd840ab78e43e7ec53f8d6c941 Mon Sep 17 00:00:00 2001
From: zhaoqiang <zhaoqiang>
Date: Fri, 10 Sep 2004 03:23:41 +0000
Subject: [PATCH] b=bug4165

Move the LUSTRE_SRV_PTL_PID definition from lustre_idl.h to libcfs.h
---
 lnet/include/linux/libcfs.h           | 19 +++++++++++++++++++
 lnet/klnds/qswlnd/qswlnd.h            |  1 -
 lnet/lnet/module.c                    |  1 -
 lustre/include/linux/lustre_idl.h     |  4 ----
 lustre/portals/include/linux/libcfs.h | 19 +++++++++++++++++++
 lustre/portals/knals/qswnal/qswnal.h  |  1 -
 lustre/portals/portals/module.c       |  1 -
 7 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/lnet/include/linux/libcfs.h b/lnet/include/linux/libcfs.h
index 6bd9196631..b725a568db 100644
--- a/lnet/include/linux/libcfs.h
+++ b/lnet/include/linux/libcfs.h
@@ -221,6 +221,25 @@ do {                                                                    \
 #define EXIT                            do { } while (0)
 #endif
 
+/* initial pid  */
+# if CRAY_PORTALS
+/* 
+ *
+ * 1) ptl_pid_t in cray portals is only 16 bits, not 32 bits, therefore this is too
+ * big.
+ *
+ * 2) the implementation of ernal in cray portals further restricts the pid space
+ * that may be used to 0 <= pid <= 255 (an 8 bit value).  Returns an error at nal
+ * init time for any pid outside this range.  Other nals in cray portals don't have
+ * this restriction.
+ * */
+#define LUSTRE_PTL_PID          9
+# else
+#define LUSTRE_PTL_PID          12345
+# endif
+
+#define LUSTRE_SRV_PTL_PID      LUSTRE_PTL_PID    
+
 #define PORTALS_CFG_VERSION 0x00010001;
 
 struct portals_cfg {
diff --git a/lnet/klnds/qswlnd/qswlnd.h b/lnet/klnds/qswlnd/qswlnd.h
index bc4b2fdb19..b085caae96 100644
--- a/lnet/klnds/qswlnd/qswlnd.h
+++ b/lnet/klnds/qswlnd/qswlnd.h
@@ -79,7 +79,6 @@
 #include <portals/p30.h>
 #include <portals/lib-p30.h>
 #include <portals/nal.h>
-#include <linux/lustre_idl.h>
 
 #define KQSW_CHECKSUM   0
 #if KQSW_CHECKSUM
diff --git a/lnet/lnet/module.c b/lnet/lnet/module.c
index d292a501a0..eb41dfd16a 100644
--- a/lnet/lnet/module.c
+++ b/lnet/lnet/module.c
@@ -50,7 +50,6 @@
 #include <linux/kp30.h>
 #include <linux/kpr.h>
 #include <linux/portals_compat25.h>
-#include <linux/lustre_idl.h>
 
 extern void (kping_client)(struct portal_ioctl_data *);
 
diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h
index b0d32e54d1..8fb130376f 100644
--- a/lustre/include/linux/lustre_idl.h
+++ b/lustre/include/linux/lustre_idl.h
@@ -137,10 +137,6 @@
 #define LUSTRE_LOG_VERSION  0x00050000
 #define LUSTRE_PBD_VERSION  0x00060000
 
-/* initial pid  */
-#define LUSTRE_PTL_PID          999999
-#define LUSTRE_SRV_PTL_PID      LUSTRE_PTL_PID    
-
 struct lustre_handle {
         __u64 cookie;
 };
diff --git a/lustre/portals/include/linux/libcfs.h b/lustre/portals/include/linux/libcfs.h
index 6bd9196631..b725a568db 100644
--- a/lustre/portals/include/linux/libcfs.h
+++ b/lustre/portals/include/linux/libcfs.h
@@ -221,6 +221,25 @@ do {                                                                    \
 #define EXIT                            do { } while (0)
 #endif
 
+/* initial pid  */
+# if CRAY_PORTALS
+/* 
+ *
+ * 1) ptl_pid_t in cray portals is only 16 bits, not 32 bits, therefore this is too
+ * big.
+ *
+ * 2) the implementation of ernal in cray portals further restricts the pid space
+ * that may be used to 0 <= pid <= 255 (an 8 bit value).  Returns an error at nal
+ * init time for any pid outside this range.  Other nals in cray portals don't have
+ * this restriction.
+ * */
+#define LUSTRE_PTL_PID          9
+# else
+#define LUSTRE_PTL_PID          12345
+# endif
+
+#define LUSTRE_SRV_PTL_PID      LUSTRE_PTL_PID    
+
 #define PORTALS_CFG_VERSION 0x00010001;
 
 struct portals_cfg {
diff --git a/lustre/portals/knals/qswnal/qswnal.h b/lustre/portals/knals/qswnal/qswnal.h
index bc4b2fdb19..b085caae96 100644
--- a/lustre/portals/knals/qswnal/qswnal.h
+++ b/lustre/portals/knals/qswnal/qswnal.h
@@ -79,7 +79,6 @@
 #include <portals/p30.h>
 #include <portals/lib-p30.h>
 #include <portals/nal.h>
-#include <linux/lustre_idl.h>
 
 #define KQSW_CHECKSUM   0
 #if KQSW_CHECKSUM
diff --git a/lustre/portals/portals/module.c b/lustre/portals/portals/module.c
index d292a501a0..eb41dfd16a 100644
--- a/lustre/portals/portals/module.c
+++ b/lustre/portals/portals/module.c
@@ -50,7 +50,6 @@
 #include <linux/kp30.h>
 #include <linux/kpr.h>
 #include <linux/portals_compat25.h>
-#include <linux/lustre_idl.h>
 
 extern void (kping_client)(struct portal_ioctl_data *);
 
-- 
GitLab