>From 8f361ce2159c8a37a68a472abd495208b02a7279 Mon Sep 17 00:00:00 2001
From: Sasha Khapyorsky <[EMAIL PROTECTED]>
Date: Wed, 8 Oct 2008 15:42:40 +0200
Subject: [PATCH] opensm/ucast_cache: simplify osm_ucast_cache_add_link() 
prototype

Simplify osm_ucast_cache_add_link() prototype - instead of pair of node,
port number parameter list get just two pointers to physical ports.

Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>
---
 opensm/include/opensm/osm_ucast_cache.h |   19 +++---------
 opensm/opensm/osm_drop_mgr.c            |    5 +--
 opensm/opensm/osm_port_info_rcv.c       |    5 +--
 opensm/opensm/osm_ucast_cache.c         |   49 +++++++++++++-----------------
 4 files changed, 29 insertions(+), 49 deletions(-)

diff --git a/opensm/include/opensm/osm_ucast_cache.h 
b/opensm/include/opensm/osm_ucast_cache.h
index caffc83..3ecd2d8 100644
--- a/opensm/include/opensm/osm_ucast_cache.h
+++ b/opensm/include/opensm/osm_ucast_cache.h
@@ -282,26 +282,17 @@ osm_ucast_cache_check_new_link(osm_ucast_cache_t * 
p_cache,
 */
 void
 osm_ucast_cache_add_link(osm_ucast_cache_t * p_cache,
-                        osm_node_t * p_node_1,
-                        uint8_t port_num_1,
-                        osm_node_t * p_node_2,
-                        uint8_t port_num_2);
+                        osm_physp_t *physp1, osm_physp_t *physp2);
 /*
 * PARAMETERS
 *      p_cache
 *              [in] Pointer to the cache object.
 *
-*      p_node_1
-*              [in] Pointer to the first node of the link.
-*
-*      port_num_1
-*              [in] Port number on the first node of the link.
+*      physp1
+*              [in] Pointer to the first physical port of the link.
 *
-*      p_node_2
-*              [in] Pointer to the second node of the link.
-*
-*      port_num_2
-*              [in] Port number on the second node of the link.
+*      physp2
+*              [in] Pointer to the second physical port of the link.
 *
 * RETURN VALUE
 *      This function does not return any value.
diff --git a/opensm/opensm/osm_drop_mgr.c b/opensm/opensm/osm_drop_mgr.c
index 5fc46a9..eceb9a6 100644
--- a/opensm/opensm/osm_drop_mgr.c
+++ b/opensm/opensm/osm_drop_mgr.c
@@ -137,10 +137,7 @@ static void drop_mgr_clean_physp(osm_sm_t * sm, IN 
osm_physp_t * p_physp)
 
                if (sm->p_subn->opt.use_ucast_cache)
                        osm_ucast_cache_add_link(sm->ucast_mgr.p_cache,
-                                                p_physp->p_node,
-                                                p_physp->port_num,
-                                                p_remote_physp->p_node,
-                                                p_remote_physp->port_num);
+                                                p_physp, p_remote_physp);
 
                osm_physp_unlink(p_physp, p_remote_physp);
 
diff --git a/opensm/opensm/osm_port_info_rcv.c 
b/opensm/opensm/osm_port_info_rcv.c
index d8d2021..8004fa8 100644
--- a/opensm/opensm/osm_port_info_rcv.c
+++ b/opensm/opensm/osm_port_info_rcv.c
@@ -247,9 +247,8 @@ __osm_pi_rcv_process_switch_port(IN osm_sm_t * sm,
 
                                if (sm->p_subn->opt.use_ucast_cache)
                                        
osm_ucast_cache_add_link(sm->ucast_mgr.p_cache,
-                                                                p_node, 
port_num,
-                                                                p_remote_node,
-                                                                
remote_port_num);
+                                                                p_physp,
+                                                                
p_remote_physp);
 
                                osm_node_unlink(p_node, (uint8_t) port_num,
                                                p_remote_node,
diff --git a/opensm/opensm/osm_ucast_cache.c b/opensm/opensm/osm_ucast_cache.c
index 57dc0a0..e5264cd 100644
--- a/opensm/opensm/osm_ucast_cache.c
+++ b/opensm/opensm/osm_ucast_cache.c
@@ -929,15 +929,11 @@ Exit:
 /**********************************************************************
  **********************************************************************/
 
-void
-osm_ucast_cache_add_link(osm_ucast_cache_t * p_cache,
-                        osm_node_t * p_node_1,
-                        uint8_t port_num_1,
-                        osm_node_t * p_node_2,
-                        uint8_t port_num_2)
+void osm_ucast_cache_add_link(osm_ucast_cache_t * p_cache,
+                             osm_physp_t *physp1, osm_physp_t *physp2)
 {
-       uint16_t lid_ho_1;
-       uint16_t lid_ho_2;
+       osm_node_t *p_node_1 = physp1->p_node, *p_node_2 = physp2->p_node;
+       uint16_t lid_ho_1, lid_ho_2;
 
        OSM_LOG_ENTER(p_cache->p_ucast_mgr->p_log);
 
@@ -961,7 +957,7 @@ osm_ucast_cache_add_link(osm_ucast_cache_t * p_cache,
                OSM_LOG(p_cache->p_ucast_mgr->p_log, OSM_LOG_VERBOSE,
                        "Port %u <-> port %u: port0 on one of the nodes"
                        "has already been dropped and cached\n",
-                       port_num_1, port_num_2);
+                       physp1->port_num, physp2->port_num);
                goto Exit;
        }
 
@@ -969,12 +965,11 @@ osm_ucast_cache_add_link(osm_ucast_cache_t * p_cache,
           simplicity, make sure that it's the first node. */
 
        if (osm_node_get_type(p_node_1) != IB_NODE_TYPE_SWITCH) {
-               osm_node_t * tmp_node = p_node_1;
-               uint8_t tmp_port_num = port_num_1;
-               p_node_1 = p_node_2;
-               port_num_1 = port_num_2;
-               p_node_2 = tmp_node;
-               port_num_2 = tmp_port_num;
+               osm_physp_t *tmp = physp1;
+               physp1 = physp2;
+               physp2 = tmp;
+               p_node_1 = physp1->p_node;
+               p_node_2 = physp2->p_node;
        }
 
        if (!p_node_1->sw) {
@@ -983,7 +978,7 @@ osm_ucast_cache_add_link(osm_ucast_cache_t * p_cache,
                goto Exit;
        }
 
-       lid_ho_1 = cl_ntoh16(osm_node_get_base_lid(p_node_1,0));
+       lid_ho_1 = cl_ntoh16(osm_node_get_base_lid(p_node_1, 0));
 
        if (osm_node_get_type(p_node_2) == IB_NODE_TYPE_SWITCH) {
 
@@ -993,20 +988,19 @@ osm_ucast_cache_add_link(osm_ucast_cache_t * p_cache,
                        goto Exit;
                }
 
-               lid_ho_2 = cl_ntoh16(osm_node_get_base_lid(p_node_2,0));
+               lid_ho_2 = cl_ntoh16(osm_node_get_base_lid(p_node_2, 0));
 
                /* lost switch-2-switch link - cache both sides */
-               __cache_add_port(p_cache, lid_ho_1, port_num_1,
+               __cache_add_port(p_cache, lid_ho_1, physp1->port_num,
                                 lid_ho_2, FALSE);
-               __cache_add_port(p_cache, lid_ho_2, port_num_2,
+               __cache_add_port(p_cache, lid_ho_2, physp2->port_num,
                                 lid_ho_1, FALSE);
        }
        else {
-               lid_ho_2 = cl_ntoh16(
-                       osm_node_get_base_lid(p_node_2, port_num_2));
+               lid_ho_2 = cl_ntoh16(osm_physp_get_base_lid(physp2));
 
                /* lost link to CA/RTR - cache only switch side */
-               __cache_add_port(p_cache, lid_ho_1, port_num_1,
+               __cache_add_port(p_cache, lid_ho_1, physp1->port_num,
                                 lid_ho_2, TRUE);
        }
 
@@ -1059,9 +1053,8 @@ osm_ucast_cache_add_node(osm_ucast_cache_t * p_cache,
                            !p_physp->p_remote_physp->p_node)
                                continue;
 
-                       osm_ucast_cache_add_link(p_cache, p_node, port_num,
-                                                
p_physp->p_remote_physp->p_node,
-                                                
p_physp->p_remote_physp->port_num);
+                       osm_ucast_cache_add_link(p_cache, p_physp,
+                                                p_physp->p_remote_physp);
                }
 
                /*
@@ -1128,9 +1121,9 @@ osm_ucast_cache_add_node(osm_ucast_cache_t * p_cache,
                                goto Exit;
                        }
 
-                       osm_ucast_cache_add_link(p_cache, p_remote_node,
-                                                
p_physp->p_remote_physp->port_num,
-                                                p_node, port_num);
+                       osm_ucast_cache_add_link(p_cache,
+                                                p_physp->p_remote_physp,
+                                                p_physp);
                }
        }
 Exit:
-- 
1.6.0.1.196.g01914

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to