From 0b8c9b5f0faa235caabcb00814dadb8a93ed6786 Mon Sep 17 00:00:00 2001 From: aestrin Date: Mon, 12 Jan 2009 22:36:10 +0000 Subject: [PATCH] [ipoib] CM. merge with latest changes from the trunk. git-svn-id: svn://openib.tc.cornell.edu/gen1@1814 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- branches/ipoib_cm/kernel/SOURCES | 3 +- branches/ipoib_cm/kernel/ipoib_adapter.c | 5 -- branches/ipoib_cm/kernel/ipoib_port.c | 4 +- branches/ipoib_cm/kernel/ipoib_xfr_mgr.c | 52 ++++++++++++++++++ branches/ipoib_cm/kernel/ipoib_xfr_mgr.h | 70 ++++++++++++++++-------- 5 files changed, 103 insertions(+), 31 deletions(-) create mode 100644 branches/ipoib_cm/kernel/ipoib_xfr_mgr.c diff --git a/branches/ipoib_cm/kernel/SOURCES b/branches/ipoib_cm/kernel/SOURCES index f18da583..0c02dff7 100644 --- a/branches/ipoib_cm/kernel/SOURCES +++ b/branches/ipoib_cm/kernel/SOURCES @@ -24,7 +24,8 @@ SOURCES= ipoib_log.mc \ ipoib_endpoint.c \ ipoib_port.c \ ipoib_ibat.c \ - ipoib_cm.c + ipoib_cm.c \ + ipoib_xfr_mgr.c INCLUDES=..;..\..\..\inc;..\..\..\inc\kernel; diff --git a/branches/ipoib_cm/kernel/ipoib_adapter.c b/branches/ipoib_cm/kernel/ipoib_adapter.c index dd81c377..ac210703 100644 --- a/branches/ipoib_cm/kernel/ipoib_adapter.c +++ b/branches/ipoib_cm/kernel/ipoib_adapter.c @@ -72,11 +72,6 @@ __adapter_destroying( IN cl_obj_t* const p_obj ); -static void -__adapter_cleanup( - IN cl_obj_t* const p_obj ); - - static void __adapter_free( IN cl_obj_t* const p_obj ); diff --git a/branches/ipoib_cm/kernel/ipoib_port.c b/branches/ipoib_cm/kernel/ipoib_port.c index 451002e0..f12d3cf9 100644 --- a/branches/ipoib_cm/kernel/ipoib_port.c +++ b/branches/ipoib_cm/kernel/ipoib_port.c @@ -5309,7 +5309,7 @@ __endpt_mgr_remove( IPOIB_ENTER( IPOIB_DBG_ENDPT ); - /* This function must be called from the recieve path */ + /* This function must be called from the receive path */ CL_ASSERT(p_port->endpt_rdr > 0); cl_obj_lock( &p_port->obj ); @@ -5464,7 +5464,7 @@ ipoib_mac_to_path( /* Set global routing information. */ ib_path_rec_set_hop_flow_raw( p_path, hop_limit, flow_lbl, FALSE ); p_path->tclass = p_port->ib_mgr.bcast_rec.tclass; - + cl_obj_unlock( &p_port->obj ); IPOIB_EXIT( IPOIB_DBG_ENDPT ); diff --git a/branches/ipoib_cm/kernel/ipoib_xfr_mgr.c b/branches/ipoib_cm/kernel/ipoib_xfr_mgr.c new file mode 100644 index 00000000..0fc4f102 --- /dev/null +++ b/branches/ipoib_cm/kernel/ipoib_xfr_mgr.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2008 Mellanox Technologies. All rights reserved. + * + * This software is available to you under the OpenIB.org BSD license + * below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: ipoib_xfr_mgr.c 3459 2008-11-12 16:48:21Z tzachid $ + */ + + +#include "ipoib_xfr_mgr.h" +#if defined(EVENT_TRACING) +#ifdef offsetof +#undef offsetof +#endif +#include "ipoib_xfr_mgr.tmh" +#endif + + +const ipoib_guid2mac_translation_t guid2mac_table[] = { + {0x30, 0x48, 0xE7}, + {0x05, 0xAD, 0xE7}, + {0x18, 0x8B, 0xE7}, + {0x1A, 0x4B, 0xE7}, + {0x17, 0x08, 0xE7}, + {0x1E, 0x0B, 0xE7}, + + {0x00, 0x00, 0x00}, +}; + diff --git a/branches/ipoib_cm/kernel/ipoib_xfr_mgr.h b/branches/ipoib_cm/kernel/ipoib_xfr_mgr.h index cff2e31e..a836b9c2 100644 --- a/branches/ipoib_cm/kernel/ipoib_xfr_mgr.h +++ b/branches/ipoib_cm/kernel/ipoib_xfr_mgr.h @@ -81,7 +81,39 @@ typedef struct _ipoib_hw_addr *********/ #include +/****s* IPoIB Driver/ipoib_guid2mac_translation_t +* NAME +* ipoib_guid2mac_translation_t +* +* DESCRIPTION +* The ipoib_guid2mac_translation_t structure defines a GUID to MAC translation. +* The structure holds map between known OUI to an appropriate GUID mask. +* +* SYNOPSIS +*/ +typedef struct _ipoib_guid2mac_translation_ +{ + uint8_t second_byte; + uint8_t third_byte; + uint8_t guid_mask; + +} ipoib_guid2mac_translation_t; +/* +* FIELDS +* second_byte +* second byte of OUI (located in lower three bytes of GUID). +* +* third_byte +* third byte of OUI (located in lower three bytes of GUID). +* +* guid_mask +* GUID mask that will be used to generate MAC from the GUID. +* +* SEE ALSO +* IPoIB, ipoib_mac_from_guid_mask +*********/ +extern const ipoib_guid2mac_translation_t guid2mac_table[]; #ifdef __cplusplus extern "C" @@ -372,10 +404,9 @@ ipoib_mac_from_guid( OUT mac_addr_t* const p_mac_addr ) { - static const uint32_t guid_default_mask = 0xE7; //==0b 11100111 ib_api_status_t status = IB_INVALID_GUID; const uint8_t *p_guid = (const uint8_t*)&port_guid; - uint32_t laa; + uint32_t laa, idx = 0; /* Port guid is in network byte order. OUI is in lower 3 bytes. */ if( p_guid[0] == 0 ) @@ -388,33 +419,26 @@ ipoib_mac_from_guid( { status = ipoib_mac_from_voltaire_guid( port_guid, p_mac_addr ); } - else if( p_guid[1] == 0x30 && p_guid[2] == 0x48 ) - { - //Supermicro GUID - status =ipoib_mac_from_guid_mask( p_guid, guid_default_mask, p_mac_addr ); - } - else if( p_guid[1] == 0x05 && p_guid[2] == 0xad ) - { - //Cisco GUID - status =ipoib_mac_from_guid_mask( p_guid, guid_default_mask, p_mac_addr ); - } else if( p_guid[1] == 0x06 && p_guid[2] == 0x6a ) { status = ipoib_mac_from_sst_guid( port_guid, p_mac_addr ); } - else if( p_guid[1] == 0x1a && p_guid[2] == 0x4b || - p_guid[1] == 0x17 && p_guid[2] == 0x08 || - p_guid[1] == 0x1e && p_guid[2] == 0x0b ) - { - //HP GUID - status =ipoib_mac_from_guid_mask( p_guid, guid_default_mask, p_mac_addr ); - } - else if( p_guid[1] == 0x18 && p_guid[2] == 0x8b ) + else { - //DELL GUID - status =ipoib_mac_from_guid_mask( p_guid, guid_default_mask, p_mac_addr ); + while( guid2mac_table[idx].second_byte != 0x00 || + guid2mac_table[idx].third_byte != 0x00 ) + { + if( p_guid[1] == guid2mac_table[idx].second_byte && + p_guid[2] == guid2mac_table[idx].third_byte ) + { + status = ipoib_mac_from_guid_mask(p_guid, guid2mac_table[idx].guid_mask, + p_mac_addr); + break; + } + ++idx; + } } - + if( status == IB_SUCCESS ) return status; } -- 2.46.0