Update IBAT so that the RoCE driver only needs to register/deregister with IBAT, without having to update routes.
Signed-off-by: Fab Tillier <[email protected]> diff -dwup3 -X excl.txt -r \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\route.cpp .\core\ibat\kernel\route.cpp --- \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\route.cpp Tue Aug 07 16:41:02 2012 +++ .\core\ibat\kernel\route.cpp Mon Aug 13 12:55:41 2012 @@ -50,8 +50,7 @@ struct IBAT_ROUTE_REQUEST IbatRoute* IbatRoute::Create( const ib_gid_t* pSrcGid, - const ib_gid_t* pDestGid, - BOOLEAN isRoCE + const ib_gid_t* pDestGid ) { IbatRoute* pRoute = static_cast<IbatRoute*>( @@ -68,34 +67,7 @@ IbatRoute::Create( KeInitializeSpinLock( &pRoute->m_requestLock ); pRoute->m_requestList = NULL; - if( isRoCE == TRUE ) - { - ib_path_rec_init_local( - &pRoute->m_path, - pDestGid, - pSrcGid, - 0, - 0, - 0, - IB_DEFAULT_PKEY, - 0, - 0, - IB_PATH_SELECTOR_EXACTLY, - IB_MTU_LEN_1024, - IB_PATH_SELECTOR_EXACTLY, - IB_PATH_RECORD_RATE_10_GBS, - IB_PATH_SELECTOR_EXACTLY, - 0, - 0 - ); - ib_path_rec_set_hop_flow_raw( &pRoute->m_path, 1, 0, FALSE ); - - pRoute->m_state = NlnsReachable; - } - else - { pRoute->m_state = NlnsUnreachable; - } pRoute->m_hQuery = NULL; pRoute->m_nRef = 1; diff -dwup3 -X excl.txt -r \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\route.h .\core\ibat\kernel\route.h --- \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\route.h Tue Aug 07 16:41:02 2012 +++ .\core\ibat\kernel\route.h Mon Aug 13 12:56:46 2012 @@ -59,8 +59,7 @@ class IbatRoute public: static IbatRoute* Create( const ib_gid_t* pSrcGid, - const ib_gid_t* pDestGid, - BOOLEAN isRoCE + const ib_gid_t* pDestGid ); inline VOID AddRef(){ InterlockedIncrement( &m_nRef ); } diff -dwup3 -X excl.txt -r \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\router.cpp .\core\ibat\kernel\router.cpp --- \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\router.cpp Tue Aug 07 16:41:02 2012 +++ .\core\ibat\kernel\router.cpp Mon Aug 13 12:59:54 2012 @@ -111,6 +111,38 @@ IbatRouter* IbatRouter::Create( UINT64 p } KeInitializeSpinLock( &pRouter->m_lock ); + pRouter->m_portGuid = portGuid; + pRouter->m_isRoCE = isRoCE; + if( isRoCE == TRUE ) + { + ib_gid_t srcGid; + ib_gid_set_default( &srcGid, portGuid ); + + ib_gid_t destGid; + ib_gid_set_default( &destGid, 0 ); + + ib_path_rec_init_local( + &pRouter->m_path, + &destGid, + &srcGid, + 0, + 0, + 0, + IB_DEFAULT_PKEY, + 0, + 0, + IB_PATH_SELECTOR_EXACTLY, + IB_MTU_LEN_2048, + IB_PATH_SELECTOR_EXACTLY, + IB_PATH_RECORD_RATE_10_GBS, + IB_PATH_SELECTOR_EXACTLY, + 0, + 0 + ); + ib_path_rec_set_hop_flow_raw( &pRouter->m_path, 1, 0, FALSE ); + } + else + { RtlInitializeGenericTableAvl( &pRouter->m_table, &IbatRouter::RouteCompare, @@ -118,8 +150,7 @@ IbatRouter* IbatRouter::Create( UINT64 p &IbatRouter::RouteFree, pRouter ); - pRouter->m_portGuid = portGuid; - pRouter->m_isRoCE = isRoCE; + } return pRouter; } @@ -131,6 +162,11 @@ IbatRouter::Update( __in const ib_gid_t* pDestGid ) { + if( m_isRoCE == TRUE ) + { + return STATUS_SUCCESS; + } + NTSTATUS status = STATUS_SUCCESS; KLOCK_QUEUE_HANDLE hdl; IbatRoute* pRoute; @@ -140,7 +176,7 @@ IbatRouter::Update( ib_gid_t srcGid; ib_gid_set_default( &srcGid, m_portGuid ); - pRoute = IbatRoute::Create( &srcGid, pDestGid, m_isRoCE ); + pRoute = IbatRoute::Create( &srcGid, pDestGid ); if( pRoute == NULL ) { return STATUS_INSUFFICIENT_RESOURCES; @@ -185,6 +221,11 @@ IbatRouter::Update( VOID IbatRouter::Reset() { + if( m_isRoCE == TRUE ) + { + return; + } + KLOCK_QUEUE_HANDLE hdl; IBAT_ROUTE_ENTRY* pRouteEntry; @@ -216,6 +257,26 @@ IbatRouter::Resolve( __out ib_path_rec_t* pPath ) { + if( m_isRoCE == TRUE ) + { + RtlCopyMemory( pPath, &m_path, sizeof(m_path) ); + // + // Copy OUI to first 3 bytes of interface ID. OUI is the first 3 bytes of the MAC. + // + RtlCopyMemory( &pPath->dgid.raw[8], &mac, 3 ); + pPath->dgid.raw[8] ^= 2; + // + // Fill in the middle two bytes. + // + pPath->dgid.raw[11] = 0xFF; + pPath->dgid.raw[12] = 0xFE; + // + // Copy the lower 3 bytes of the MAC to the last 3 bytes of the interface ID. + // + RtlCopyMemory( &pPath->dgid.raw[13], reinterpret_cast<UINT8*>(&mac) + 3, 3); + return STATUS_SUCCESS; + } + NTSTATUS status = STATUS_HOST_UNREACHABLE; KLOCK_QUEUE_HANDLE hdl; diff -dwup3 -X excl.txt -r \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\router.h .\core\ibat\kernel\router.h --- \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\router.h Tue Aug 07 16:41:02 2012 +++ .\core\ibat\kernel\router.h Mon Aug 13 12:34:04 2012 @@ -44,7 +44,11 @@ struct IbatRouter { private: KSPIN_LOCK m_lock; + union + { - RTL_AVL_TABLE m_table; + RTL_AVL_TABLE m_table; + ib_path_rec_t m_path; + }; UINT64 m_portGuid; BOOLEAN m_isRoCE;
ndv2.43.patch
Description: ndv2.43.patch
_______________________________________________ ofw mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
