[ofw] [PATCH 2/4] Avoid the SM
Fab Tillier
ftillier at windows.microsoft.com
Thu Aug 21 09:51:35 PDT 2008
This patch adds a new IOCTL to IPoIB for converting a destination Ethernet MAC address to a path record. The path records is created using information from the broadcast group and previous work completions.
The limitations of this patch is that the rate is that of the broadcast group, which in a mixed rate fabric (SDR/DDR/QDR) will result in suboptimal data transfer rates.
Signed-off-by: Fab Tillier <ftillier at microsoft.com>
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\inc\iba\ib_at_ioctl.h trunk\inc\iba\ib_at_ioctl.h
--- old\inc\iba\ib_at_ioctl.h Tue Jul 08 10:15:55 2008
+++ trunk\inc\iba\ib_at_ioctl.h Thu Aug 21 09:50:26 2008
@@ -146,6 +146,24 @@ typedef struct _IOCTL_IBAT_IP_TO_PORT_OU
} IOCTL_IBAT_IP_TO_PORT_OUT;
+/** This IRP is used to convert a remote MAC addresses to a remote GID */
+#define IOCTL_IBAT_MAC_TO_PATH IOCTL_IBAT( 5 )
+
+typedef struct _IOCTL_IBAT_MAC_TO_PATH_IN
+{
+ ULONG Version;
+ UINT64 PortGuid;
+ UCHAR DestMac[IBAT_MAC_LEN];
+
+} IOCTL_IBAT_MAC_TO_PATH_IN;
+
+typedef struct _IOCTL_IBAT_MAC_TO_PATH_OUT
+{
+ ib_path_rec_t Path;
+
+} IOCTL_IBAT_MAC_TO_PATH_OUT;
+
+
#define IBAT_DEV_NAME L"\\Device\\ibat"
#define IBAT_DOS_DEV_NAME L"\\DosDevices\\Global\\ibat"
#define IBAT_WIN32_NAME L"\\\\.\\ibat"
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\ulp\ipoib\kernel\ipoib_ibat.c trunk\ulp\ipoib\kernel\ipoib_ibat.c
--- old\ulp\ipoib\kernel\ipoib_ibat.c Tue Jul 08 10:15:30 2008
+++ trunk\ulp\ipoib\kernel\ipoib_ibat.c Thu Aug 21 09:50:26 2008
@@ -329,6 +329,80 @@ __ibat_mac_to_gid(
static NTSTATUS
+__ibat_mac_to_path(
+ IN IRP *pIrp,
+ IN IO_STACK_LOCATION *pIoStack )
+{
+ NTSTATUS status = STATUS_INVALID_PARAMETER;
+ IOCTL_IBAT_MAC_TO_PATH_IN *pIn;
+ IOCTL_IBAT_MAC_TO_PATH_OUT *pOut;
+ KLOCK_QUEUE_HANDLE hdl;
+ cl_list_item_t *pItem;
+ ipoib_adapter_t *pAdapter;
+
+ IPOIB_ENTER(IPOIB_DBG_IOCTL);
+
+ if( pIoStack->Parameters.DeviceIoControl.InputBufferLength !=
+ sizeof(IOCTL_IBAT_MAC_TO_PATH_IN) )
+ {
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
+ ("Invalid input buffer size.\n") );
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ if( pIoStack->Parameters.DeviceIoControl.OutputBufferLength !=
+ sizeof(IOCTL_IBAT_MAC_TO_PATH_OUT) )
+ {
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
+ ("Invalid output buffer size.\n") );
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ pIn = pIrp->AssociatedIrp.SystemBuffer;
+ pOut = pIrp->AssociatedIrp.SystemBuffer;
+
+ if( pIn->Version != IBAT_IOCTL_VERSION )
+ {
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
+ ("Invalid version.\n") );
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ KeAcquireInStackQueuedSpinLock( &g_ipoib.lock, &hdl );
+
+ for( pItem = cl_qlist_head( &g_ipoib.adapter_list );
+ pItem != cl_qlist_end( &g_ipoib.adapter_list );
+ pItem = cl_qlist_next( pItem ) )
+ {
+ pAdapter = CONTAINING_RECORD( pItem, ipoib_adapter_t, entry );
+ if( pIn->PortGuid != pAdapter->guids.port_guid.guid )
+ continue;
+
+ /* Found the port - lookup the MAC. */
+ cl_obj_lock( &pAdapter->obj );
+ if( pAdapter->p_port )
+ {
+ status = ipoib_mac_to_path(
+ pAdapter->p_port, *(mac_addr_t*)pIn->DestMac, &pOut->Path );
+
+ if( NT_SUCCESS( status ) )
+ {
+ pIrp->IoStatus.Information =
+ sizeof(IOCTL_IBAT_MAC_TO_PATH_OUT);
+ }
+ }
+ cl_obj_unlock( &pAdapter->obj );
+ break;
+ }
+
+ KeReleaseInStackQueuedSpinLock( &hdl );
+
+ IPOIB_EXIT( IPOIB_DBG_IOCTL );
+ return status;
+}
+
+
+static NTSTATUS
__ibat_ip_to_port(
IN IRP *pIrp,
IN IO_STACK_LOCATION *pIoStack )
@@ -571,6 +645,12 @@ __ipoib_dispatch(
IPOIB_PRINT(TRACE_LEVEL_INFORMATION, IPOIB_DBG_IOCTL,
("IOCTL_IBAT_IP_TO_PORT received\n" ));
status = __ibat_ip_to_port( pIrp, pIoStack );
+ break;
+
+ case IOCTL_IBAT_MAC_TO_PATH:
+ IPOIB_PRINT(TRACE_LEVEL_INFORMATION, IPOIB_DBG_IOCTL,
+ ("IOCTL_IBAT_MAC_TO_PATH received\n" ));
+ status = __ibat_mac_to_path( pIrp, pIoStack );
break;
default:
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\ulp\ipoib\kernel\ipoib_port.c trunk\ulp\ipoib\kernel\ipoib_port.c
--- old\ulp\ipoib\kernel\ipoib_port.c Thu Aug 21 09:49:49 2008
+++ trunk\ulp\ipoib\kernel\ipoib_port.c Thu Aug 21 09:50:26 2008
@@ -4569,6 +4569,86 @@ ipoib_mac_to_gid(
}
+NTSTATUS
+ipoib_mac_to_path(
+ IN ipoib_port_t* const p_port,
+ IN const mac_addr_t mac,
+ OUT ib_path_rec_t* p_path )
+{
+ ipoib_endpt_t* p_endpt;
+ cl_map_item_t *p_item;
+ uint64_t key = 0;
+ uint8_t sl;
+ net32_t flow_lbl;
+ uint8_t hop_limit;
+
+ IPOIB_ENTER( IPOIB_DBG_ENDPT );
+
+ cl_memcpy( &key, &mac, sizeof(mac_addr_t) );
+
+ cl_obj_lock( &p_port->obj );
+
+ if( p_port->p_local_endpt == NULL )
+ {
+ cl_obj_unlock( &p_port->obj );
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
+ ("No local endpoint.\n") );
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ if( mac.addr[0] == 0 && mac.addr[1] == 0 && mac.addr[2] == 0 &&
+ mac.addr[3] == 0 && mac.addr[4] == 0 && mac.addr[5] == 0 )
+ {
+ p_endpt = p_port->p_local_endpt;
+ }
+ else
+ {
+ p_item = cl_qmap_get( &p_port->endpt_mgr.mac_endpts, key );
+ if( p_item == cl_qmap_end( &p_port->endpt_mgr.mac_endpts ) )
+ {
+ cl_obj_unlock( &p_port->obj );
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
+ ("Failed endpoint lookup.\n") );
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ p_endpt = PARENT_STRUCT( p_item, ipoib_endpt_t, mac_item );
+ }
+
+ p_path->resv0 = 0;
+ p_path->dgid = p_endpt->dgid;
+ p_path->sgid = p_port->p_local_endpt->dgid;
+ p_path->dlid = p_endpt->dlid;
+ p_path->slid = p_port->p_local_endpt->dlid;
+
+ ib_member_get_sl_flow_hop(
+ p_port->ib_mgr.bcast_rec.sl_flow_hop,
+ &sl,
+ &flow_lbl,
+ &hop_limit
+ );
+ ib_path_rec_set_hop_flow_raw( p_path, hop_limit, flow_lbl, FALSE );
+
+ p_path->tclass = p_port->ib_mgr.bcast_rec.tclass;
+ p_path->num_path = 1;
+ p_path->pkey = p_port->ib_mgr.bcast_rec.pkey;
+ p_path->mtu = p_port->ib_mgr.bcast_rec.mtu;
+ p_path->rate = p_port->ib_mgr.bcast_rec.rate;
+ if( p_path->slid == p_path->dlid )
+ p_path->pkt_life = 0;
+ else
+ p_path->pkt_life = p_port->ib_mgr.bcast_rec.pkt_life;
+ p_path->preference = 0;
+ p_path->resv1 = 0;
+ p_path->resv2 = 0;
+
+ cl_obj_unlock( &p_port->obj );
+
+ IPOIB_EXIT( IPOIB_DBG_ENDPT );
+ return STATUS_SUCCESS;
+}
+
+
static inline NDIS_STATUS
__endpt_mgr_ref(
IN ipoib_port_t* const p_port,
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\ulp\ipoib\kernel\ipoib_port.h trunk\ulp\ipoib\kernel\ipoib_port.h
--- old\ulp\ipoib\kernel\ipoib_port.h Thu Aug 21 08:40:18 2008
+++ trunk\ulp\ipoib\kernel\ipoib_port.h Thu Aug 21 09:50:26 2008
@@ -613,6 +613,12 @@ ipoib_mac_to_gid(
IN const mac_addr_t mac,
OUT ib_gid_t* p_gid );
+NTSTATUS
+ipoib_mac_to_path(
+ IN ipoib_port_t* const p_port,
+ IN const mac_addr_t mac,
+ OUT ib_path_rec_t* p_path );
+
inline void ipoib_port_ref(
IN ipoib_port_t * p_port,
IN int type);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoib_mac_to_path.patch
Type: application/octet-stream
Size: 6793 bytes
Desc: ipoib_mac_to_path.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080821/f12db6c1/attachment.obj>
More information about the ofw
mailing list