From c7f92fa83f5b604fca5391a1c11ecc970e5b5f8e Mon Sep 17 00:00:00 2001
From: Erik von Reis <evonreis@caltech.edu>
Date: Wed, 13 Oct 2021 23:27:00 -0700
Subject: [PATCH] RCG: Dolphin broadcast node changed from 4 to 252.  This
 change allows node 4 to work like a normal node.

Exported Dolphin segments now properly unexported when there's an error farther down the line during initialization.

Some slight improvements to Dolphin initialization error messages.
---
 src/fe/dolphin.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/fe/dolphin.c b/src/fe/dolphin.c
index 94011e3e8..a7db9a5d5 100644
--- a/src/fe/dolphin.c
+++ b/src/fe/dolphin.c
@@ -104,7 +104,7 @@ init_dolphin( int modules )
         }
 
         err = sci_export_segment( segment[ ii ], 0, DIS_BROADCAST );
-        printk("DIS segment export status %d\n", err);
+        printk("DIS segment export status 0x%x\n", err);
         if ( err )
         {
             sci_remove_segment( &segment[ ii ], 0 );
@@ -115,6 +115,7 @@ init_dolphin( int modules )
         if ( read_addr == 0 )
         {
             printk("DIS sci_local_kernel_virtual_address returned 0\n");
+            sci_unexport_segment( segment[ ii ], 0, 0);
             sci_remove_segment( &segment[ ii ], 0 );
             return -4;
         }
@@ -128,7 +129,9 @@ init_dolphin( int modules )
         udelay( MAX_UDELAY );
 
         err = sci_connect_segment( NO_BINDING,
-                                   4, // DIS_BROADCAST_NODEID_GROUP_ALL
+                                   252, //broadcast node - should not match any
+                                        // actual node number.
+                                        // 252 taken from sisci driver code.
                                    0,
                                    0,
                                    ii,
@@ -139,6 +142,7 @@ init_dolphin( int modules )
         printk("DIS connect segment status %d\n", err);
         if ( err )
         {
+            sci_unexport_segment( segment[ ii ], 0, 0);
             sci_remove_segment( &segment[ ii ], 0 );
             return -5;
         }
@@ -150,10 +154,11 @@ init_dolphin( int modules )
                                0,
                                IPC_TOTAL_ALLOC_SIZE,
                                &client_map_handle[ ii ] );
-        printk("DIS segment mapping status %d\n", err);
+        printk("DIS segment mapping status 0x%x\n", err);
         if ( err )
         {
             sci_disconnect_segment( &remote_segment_handle[ ii ], 0 );
+            sci_unexport_segment( segment[ ii ], 0, 0);
             sci_remove_segment( &segment[ ii ], 0 );
             return -6;
         }
@@ -164,6 +169,7 @@ init_dolphin( int modules )
             // printk ("Got zero pointer from
             // sci_kernel_virtual_address_of_mapping\n");
             sci_disconnect_segment( &remote_segment_handle[ ii ], 0 );
+            sci_unexport_segment( segment[ ii ], 0, 0);
             sci_remove_segment( &segment[ ii ], 0 );
             return -7;
         }
-- 
GitLab