[ofw] [Patch 44/62] Reference implementation of NDv2

Fab Tillier ftillier at microsoft.com
Wed Feb 20 18:34:06 PST 2013


Honor pkey in IBAT path queries.

This patch uses the pkey provided in the IBAT registration call in paths returned for that interface.

Signed-off-by: Fab Tillier <ftillier at microsoft.com>

diff -dwup3 -X excl.txt -r \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\ibat.cpp .\core\ibat\kernel\ibat.cpp
--- \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\ibat\kernel\ibat.cpp	Thu Aug 09 23:04:51 2012
+++ .\core\ibat\kernel\ibat.cpp	Wed Aug 15 15:43:06 2012
@@ -284,7 +284,11 @@ IbatRegister(
     g_ibatPorts[g_nReg].Luid = luid;
     g_ibatPorts[g_nReg].DriverId = *pDriverId;
     g_ibatPorts[g_nReg].Port  = *pPortRecord;
-    g_ibatPorts[g_nReg].pRouter = IbatRouter::Create( pPortRecord->PortGuid, isRoCE );
+    g_ibatPorts[g_nReg].pRouter = IbatRouter::Create(
+        pPortRecord->PortGuid,
+        pPortRecord->PKey,
+        isRoCE
+        );
     if( g_ibatPorts[g_nReg].pRouter == NULL )
     {
         status = STATUS_INSUFFICIENT_RESOURCES;
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	Mon Aug 13 13:25:25 2012
+++ .\core\ibat\kernel\route.cpp	Wed Aug 15 15:44:45 2012
@@ -50,7 +50,8 @@ struct IBAT_ROUTE_REQUEST
 IbatRoute*
 IbatRoute::Create(
     const ib_gid_t* pSrcGid,
-    const ib_gid_t* pDestGid
+    const ib_gid_t* pDestGid,
+    UINT16 pkey
     )
 {
     IbatRoute* pRoute = static_cast<IbatRoute*>(
@@ -64,6 +65,7 @@ IbatRoute::Create(
 
     pRoute->m_srcGid = *pSrcGid;
     pRoute->m_destGid = *pDestGid;
+    pRoute->m_pkey = pkey;
 
     KeInitializeSpinLock( &pRoute->m_requestLock );
     pRoute->m_requestList = NULL;
@@ -192,13 +194,21 @@ IbatRoute::QueryPathUnsafe()
         return STATUS_PENDING;
     }
 
-    ib_gid_pair_t gidPair;
-    gidPair.src_gid = m_srcGid;
-    gidPair.dest_gid = m_destGid;
+    ib_path_rec_t pathRec;
+    pathRec.dgid = m_destGid;
+    pathRec.sgid = m_srcGid;
+    pathRec.pkey = m_pkey;
+
+    ib_user_query_t userQuery;
+    userQuery.method = IB_MAD_METHOD_GET;
+    userQuery.attr_id = IB_MAD_ATTR_PATH_RECORD;
+    userQuery.attr_size = sizeof(pathRec);
+    userQuery.comp_mask = IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_PKEY;
+    userQuery.p_attr = &pathRec;
 
     ib_query_req_t query;
-    query.query_type = IB_QUERY_PATH_REC_BY_GIDS;
-    query.p_query_input = &gidPair;
+    query.query_type = IB_QUERY_USER_DEFINED;
+    query.p_query_input = &userQuery;
     query.port_guid = m_srcGid.unicast.interface_id;
 
     query.timeout_ms = IBAT_PATH_QUERY_TIMEOUT;
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	Mon Aug 13 13:25:25 2012
+++ .\core\ibat\kernel\route.h	Wed Aug 15 15:44:47 2012
@@ -56,10 +56,13 @@ class IbatRoute
 
     volatile LONG m_nRef;
 
+    UINT16 m_pkey;
+
 public:
     static IbatRoute* Create(
         const ib_gid_t* pSrcGid,
-        const ib_gid_t* pDestGid
+        const ib_gid_t* pDestGid,
+        UINT16 pkey
         );
 
     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	Mon Aug 13 13:25:25 2012
+++ .\core\ibat\kernel\router.cpp	Wed Aug 15 15:45:16 2012
@@ -98,7 +98,7 @@ IbatRouter::RouteFree(
 }
 
 
-IbatRouter* IbatRouter::Create( UINT64 portGuid, BOOLEAN isRoCE )
+IbatRouter* IbatRouter::Create( UINT64 portGuid, UINT16 pkey, BOOLEAN isRoCE )
 {
     NT_ASSERT( portGuid != 0 );
 
@@ -112,6 +112,7 @@ IbatRouter* IbatRouter::Create( UINT64 p
 
     KeInitializeSpinLock( &pRouter->m_lock );
     pRouter->m_portGuid = portGuid;
+    pRouter->m_pkey = pkey;
     pRouter->m_isRoCE = isRoCE;
     if( isRoCE == TRUE )
     {
@@ -128,7 +129,7 @@ IbatRouter* IbatRouter::Create( UINT64 p
             0,
             0,
             0,
-            IB_DEFAULT_PKEY,
+            pkey,
             0,
             0,
             IB_PATH_SELECTOR_EXACTLY,
@@ -176,7 +177,7 @@ IbatRouter::Update(
     ib_gid_t srcGid;
 
     ib_gid_set_default( &srcGid, m_portGuid );
-    pRoute = IbatRoute::Create( &srcGid, pDestGid );
+    pRoute = IbatRoute::Create( &srcGid, pDestGid, m_pkey );
     if( pRoute == NULL )
     {
         return STATUS_INSUFFICIENT_RESOURCES;
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	Mon Aug 13 13:25:25 2012
+++ .\core\ibat\kernel\router.h	Wed Aug 15 15:31:24 2012
@@ -50,6 +50,7 @@ private:
         ib_path_rec_t m_path;
     };
     UINT64 m_portGuid;
+    UINT16 m_pkey;
     BOOLEAN m_isRoCE;
 
     static RTL_AVL_COMPARE_ROUTINE RouteCompare;
@@ -57,7 +58,7 @@ private:
     static RTL_AVL_FREE_ROUTINE RouteFree;
 
 public:
-    static IbatRouter* Create( UINT64 portGuid, BOOLEAN roce );
+    static IbatRouter* Create( UINT64 portGuid, UINT16 pkey, BOOLEAN roce );
 
     NTSTATUS Update(
         __in UINT64 destMac,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.44.patch
Type: application/octet-stream
Size: 5241 bytes
Desc: ndv2.44.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/e69dd224/attachment.obj>


More information about the ofw mailing list