From: leonidk Date: Tue, 31 Jul 2007 19:04:15 +0000 (+0000) Subject: [IBBUS, MTHCA, SRP] 1) (SRP) added a flow management mechanism for better sustaining... X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=27a7bcb06e672aa0cc74ec81ea3a0d13f14b6e3e;p=~shefty%2Frdma-win.git [IBBUS, MTHCA, SRP] 1) (SRP) added a flow management mechanism for better sustaining the work under stress; 2) (SRP) fixed a bug of not setting max_sg value, which is used in calculating NumberOfPhysicalBreaks; 3) (SRP) added Registry parameter ModeFlags (for debugging and tuning purposes): 1 - don't use FMR_POOL, 2 - increase StorPort SG list (disallowed by DDK). 4) (SRP) fixes to support maximal buffer size (up to 1MB). It was 64KB, because of StorPort limitation of 16 SG list size. 5) (SRP) added some debug prints and statistics. 6) (IBBUS,MTHCA,SRP) added support for fmr_pool (only for kernel). Added new functions to IBAL interface, so its version increased. 7) (MTHCA) added two profile parameters to replace the values in the built-in MTHCA profile (QpNum, RdmaOutstanding). 8) (IBBUS, MTHCA) enable driver installation on Longhorn; git-svn-id: svn://openib.tc.cornell.edu/gen1@744 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/core/al/al_common.c b/trunk/core/al/al_common.c index fbbe2e5c..722c32f5 100644 --- a/trunk/core/al/al_common.c +++ b/trunk/core/al/al_common.c @@ -119,7 +119,9 @@ const char* ib_obj_type_str[] = "AL_OBJ_TYPE_H_CA_ATTR", "AL_OBJ_TYPE_H_PNP_EVENT", "AL_OBJ_TYPE_H_SA_REG", - "AL_OBJ_TYPE_H_FMR" + "AL_OBJ_TYPE_H_FMR", + "AL_OBJ_TYPE_H_SRQ", + "AL_OBJ_TYPE_H_FMR_POOL" }; diff --git a/trunk/core/al/al_common.h b/trunk/core/al/al_common.h index d8cdceca..84af9994 100644 --- a/trunk/core/al/al_common.h +++ b/trunk/core/al/al_common.h @@ -163,7 +163,8 @@ typedef void #define AL_OBJ_TYPE_H_SA_REG 39 #define AL_OBJ_TYPE_H_FMR 40 #define AL_OBJ_TYPE_H_SRQ 41 -#define AL_OBJ_TYPE_INVALID 42 /* Must be last type. */ +#define AL_OBJ_TYPE_H_FMR_POOL 42 +#define AL_OBJ_TYPE_INVALID 43 /* Must be last type. */ /* Kernel object for a user-mode app. */ #define AL_OBJ_SUBTYPE_UM_EXPORT 0x80000000 diff --git a/trunk/core/al/al_debug.h b/trunk/core/al/al_debug.h index 6d1ed6d6..3d24c195 100644 --- a/trunk/core/al/al_debug.h +++ b/trunk/core/al/al_debug.h @@ -95,7 +95,7 @@ extern uint32_t g_al_dbg_flags; WPP_DEFINE_BIT( AL_DBG_AL_OBJ) \ WPP_DEFINE_BIT( AL_DBG_SMI) \ WPP_DEFINE_BIT( AL_DBG_SMI_CB) \ - WPP_DEFINE_BIT( AL_DBG_RES1) \ + WPP_DEFINE_BIT( AL_DBG_FMR_POOL) \ WPP_DEFINE_BIT( AL_DBG_MAD_POOL) \ WPP_DEFINE_BIT( AL_DBG_MAD_SVC) \ WPP_DEFINE_BIT( AL_DBG_RES2) \ @@ -156,6 +156,7 @@ extern uint32_t g_al_dbg_flags; #define AL_DBG_AL_OBJ (1 << 3) #define AL_DBG_SMI (1 << 4) #define AL_DBG_SMI_CB (1 << 5) +#define AL_DBG_FMR_POOL (1 << 6) #define AL_DBG_MAD_POOL (1 << 7) #define AL_DBG_MAD_SVC (1 << 8) #define AL_DBG_CM (1 << 10) diff --git a/trunk/core/al/al_mr.h b/trunk/core/al/al_mr.h index f64dce42..e01539bf 100644 --- a/trunk/core/al/al_mr.h +++ b/trunk/core/al/al_mr.h @@ -156,10 +156,11 @@ typedef struct _mlnx_fmr { al_obj_t obj; mlnx_fmr_handle_t h_ci_fmr; /* Actual HW handle. */ - + struct _mlnx_fmr* __ptr64 p_next; } mlnx_fmr_t; + cl_status_t mlnx_fmr_ctor( IN void* const p_object, @@ -171,6 +172,9 @@ void mlnx_fmr_dtor( IN const cl_pool_item_t* const p_pool_item, IN void* context ); + + + #endif diff --git a/trunk/core/al/al_verbs.h b/trunk/core/al/al_verbs.h index fe499377..dec7a33f 100644 --- a/trunk/core/al/al_verbs.h +++ b/trunk/core/al/al_verbs.h @@ -168,8 +168,8 @@ verbs_create_cq( h_fmr->obj.p_ci_ca->verbs.map_phys_mlnx_fmr( h_fmr->h_ci_fmr,\ plist_addr, list_len, p_vaddr, p_lkey, p_rkey ) -#define verbs_unmap_mlnx_fmr( h_fmr ) \ - h_fmr->obj.p_ci_ca->verbs.unmap_mlnx_fmr( h_fmr->h_ci_fmr) +#define verbs_unmap_mlnx_fmr( h_fmr, p_fmr_array ) \ + h_fmr->obj.p_ci_ca->verbs.unmap_mlnx_fmr( p_fmr_array) #define verbs_destroy_mlnx_fmr( h_fmr ) \ h_fmr->obj.p_ci_ca->verbs.dealloc_mlnx_fmr( h_fmr->h_ci_fmr ) diff --git a/trunk/core/al/kernel/SOURCES b/trunk/core/al/kernel/SOURCES index 3ff56ac8..b45085bb 100644 --- a/trunk/core/al/kernel/SOURCES +++ b/trunk/core/al/kernel/SOURCES @@ -20,6 +20,7 @@ SOURCES= ibal.rc \ al_dev.c \ al_ioc_pnp.c \ al_mad_pool.c \ + al_fmr_pool.c \ al_mgr.c \ al_mr.c \ al_pnp.c \ diff --git a/trunk/core/al/kernel/al_fmr_pool.c b/trunk/core/al/kernel/al_fmr_pool.c new file mode 100644 index 00000000..cf927684 --- /dev/null +++ b/trunk/core/al/kernel/al_fmr_pool.c @@ -0,0 +1,749 @@ +/* + * Copyright (c) 2005 SilverStorm Technologies. All rights reserved. + * Copyright (c) 1996-2003 Intel Corporation. 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: al_fmr_pool.h 1611 2006-08-20 14:48:55Z sleybo $ + */ + + + + +#include "al_debug.h" + +#if defined(EVENT_TRACING) +#ifdef offsetof +#undef offsetof +#endif +#include "al_fmr_pool.tmh" +#endif + +#include "al_fmr_pool.h" +#include "al_mr.h" +#include "al_pd.h" + +#define hash_mix(a, b, c) \ + { \ + a -= b; a -= c; a ^= (c>>13); \ + b -= c; b -= a; b ^= (a<<8); \ + c -= a; c -= b; c ^= (b>>13); \ + a -= b; a -= c; a ^= (c>>12); \ + b -= c; b -= a; b ^= (a<<16); \ + c -= a; c -= b; c ^= (b>>5); \ + a -= b; a -= c; a ^= (c>>3); \ + b -= c; b -= a; b ^= (a<<10); \ + c -= a; c -= b; c ^= (b>>15); \ +} + +static inline uint32_t hash_2words(uint32_t a, uint32_t b, uint32_t c) +{ + a += 0x9e3779b9; + b += 0x9e3779b9; + hash_mix(a, b, c); + return c; +} + +enum { + IB_FMR_MAX_REMAPS = 32, + + IB_FMR_HASH_BITS = 8, + IB_FMR_HASH_SIZE = 1 << IB_FMR_HASH_BITS, + IB_FMR_HASH_MASK = IB_FMR_HASH_SIZE - 1 +}; + + +static inline uint32_t __fmr_hash(uint64_t first_page) +{ + return hash_2words((uint32_t) first_page, (uint32_t) (first_page >> 32), 0) & + (IB_FMR_HASH_SIZE - 1); +} + +/* Caller must hold pool_lock */ +static inline mlnx_fmr_pool_element_t *__fmr_cache_lookup( + mlnx_fmr_pool_t *p_pool, + const uint64_t* const page_list, + int page_list_len, + uint64_t io_virtual_address) +{ + cl_qlist_t *bucket; + cl_list_item_t *p_list_item; + mlnx_fmr_pool_element_t *p_fmr_el; + + if (!p_pool->cache_bucket) + return NULL; + + bucket = p_pool->cache_bucket + __fmr_hash(*page_list); + + for( p_list_item = cl_qlist_head( bucket ); + p_list_item != cl_qlist_end( bucket); + p_list_item = cl_qlist_next( p_list_item ) ) + { + p_fmr_el = PARENT_STRUCT( p_list_item, mlnx_fmr_pool_element_t, cache_node ); + if (io_virtual_address == p_fmr_el->io_virtual_address && + page_list_len == p_fmr_el->page_list_len && + !memcmp(page_list, p_fmr_el->page_list, page_list_len * sizeof *page_list)) + return p_fmr_el; + } + + return NULL; +} + + +static void +__fmr_pool_batch_release(mlnx_fmr_pool_t *p_pool) +{ + ib_api_status_t status; + mlnx_fmr_pool_element_t *p_fmr_el; + mlnx_fmr_handle_t h_fmr = NULL; + cl_qlist_t unmap_list; + cl_list_item_t *p_list_item; + cl_qlist_t *bucket; + + cl_qlist_init(&unmap_list); + + cl_spinlock_acquire(&p_pool->pool_lock); + + for( p_list_item = cl_qlist_head( &p_pool->dirty_list ); + p_list_item != cl_qlist_end( &p_pool->dirty_list); + p_list_item = cl_qlist_next( p_list_item ) ) + { + p_fmr_el = PARENT_STRUCT( p_list_item, mlnx_fmr_pool_element_t, list_item ); + if (p_fmr_el->in_cash) + { + p_fmr_el->in_cash = FALSE; + bucket = p_pool->cache_bucket + __fmr_hash(p_fmr_el->page_list[0]); + cl_qlist_remove_item( bucket, &p_fmr_el->cache_node ); + } + p_fmr_el->remap_count = 0; + p_fmr_el->h_fmr->p_next = h_fmr; + h_fmr = p_fmr_el->h_fmr; + if (p_fmr_el->ref_count !=0) + { + AL_PRINT(TRACE_LEVEL_WARNING, AL_DBG_FMR_POOL, ("Unmapping FMR 0x%p with ref count %d", + p_fmr_el, p_fmr_el->ref_count)); + } + } + + cl_qlist_insert_list_head(&unmap_list, &p_pool->dirty_list ); + cl_qlist_init(&p_pool->dirty_list); + p_pool->dirty_len = 0; + + cl_spinlock_release( &p_pool->pool_lock ); + + if (cl_is_qlist_empty(&unmap_list)) { + return; + } + + status = mlnx_unmap_fmr(h_fmr); + if (status != IB_SUCCESS) + AL_PRINT(TRACE_LEVEL_WARNING, AL_DBG_FMR_POOL, ("mlnx_unmap_fmr returned %s", ib_get_err_str(status))); + + + cl_spinlock_acquire( &p_pool->pool_lock ); + cl_qlist_insert_list_head(&p_pool->free_list,&unmap_list); + cl_spinlock_release( &p_pool->pool_lock ); +} + + + +static int +__fmr_cleanup_thread(void * p_pool_ptr) +{ + mlnx_fmr_pool_t *p_pool = p_pool_ptr; + atomic32_t flush_req; + int forever = 1; + + do { + flush_req = 0; + if (p_pool->flush_req || p_pool->dirty_len >= p_pool->dirty_watermark) + { + __fmr_pool_batch_release(p_pool); + + if (p_pool->flush_req) + { + cl_event_signal(&p_pool->flush_done_event); + flush_req = cl_atomic_dec( &p_pool->flush_req ); + } + + if (p_pool->flush_function) + p_pool->flush_function( (mlnx_fmr_pool_handle_t)p_pool, p_pool->flush_arg); + } + + if (!flush_req) + { + if (p_pool->should_stop) + break; + cl_event_wait_on(&p_pool->do_flush_event, EVENT_NO_TIMEOUT, TRUE); + } + } while (forever); + + return 0; +} + +/* + * Destroying the pool. + */ +static void +__destroying_fmr_pool( + IN al_obj_t* p_obj ) +{ + mlnx_fmr_pool_t* p_pool; + + CL_ASSERT( p_obj ); + p_pool = PARENT_STRUCT( p_obj, mlnx_fmr_pool_t, obj ); + AL_PRINT(TRACE_LEVEL_ERROR, AL_DBG_FMR_POOL, ("pool %p\n", p_pool)); + + // notify cleaning thread to exit + cl_atomic_inc( &p_pool->should_stop ); + cl_event_signal(&p_pool->do_flush_event); + cl_thread_destroy(&p_pool->thread); +} + +/* + * Cleanup the pool. + */ +static void +__cleanup_fmr_pool( + IN al_obj_t* p_obj ) +{ + int i=0; + ib_api_status_t status = IB_SUCCESS; + mlnx_fmr_pool_t* p_pool; + mlnx_fmr_pool_element_t *p_fmr_el; + cl_list_item_t *p_list_item; + cl_qlist_t *bucket; + + CL_ASSERT( p_obj ); + p_pool = PARENT_STRUCT( p_obj, mlnx_fmr_pool_t, obj ); + AL_PRINT(TRACE_LEVEL_ERROR, AL_DBG_FMR_POOL, ("pool %p\n", p_pool)); + + // cleanup the dirty list stuff + __fmr_pool_batch_release(p_pool); + + cl_spinlock_acquire(&p_pool->pool_lock); + + // merge the rest with free list + for( p_list_item = cl_qlist_head( &p_pool->rest_list ); + p_list_item != cl_qlist_end( &p_pool->rest_list ); + p_list_item = cl_qlist_head( &p_pool->rest_list ) ) + { + p_fmr_el = PARENT_STRUCT( p_list_item, mlnx_fmr_pool_element_t, list_item ); + if (p_fmr_el->in_cash) + { + p_fmr_el->in_cash = FALSE; + bucket = p_pool->cache_bucket + __fmr_hash(p_fmr_el->page_list[0]); + cl_qlist_remove_item( bucket, &p_fmr_el->cache_node ); + } + cl_qlist_remove_item(&p_pool->rest_list, p_list_item); + cl_qlist_insert_tail(&p_pool->free_list, &p_fmr_el->list_item); + p_fmr_el->p_cur_list = &p_pool->free_list; + } + + // cleanup the free list + for( p_list_item = cl_qlist_head( &p_pool->free_list ); + p_list_item != cl_qlist_end( &p_pool->free_list ); + p_list_item = cl_qlist_head( &p_pool->free_list ) ) + { + p_fmr_el = PARENT_STRUCT( p_list_item, mlnx_fmr_pool_element_t, list_item); + cl_spinlock_release( &p_pool->pool_lock ); + if (p_fmr_el->remap_count) + { + p_fmr_el->h_fmr->p_next = NULL; + status = mlnx_unmap_fmr(p_fmr_el->h_fmr); + if (status != IB_SUCCESS) + AL_PRINT(TRACE_LEVEL_WARNING, AL_DBG_FMR_POOL, ("mlnx_unmap_fmr returned %s\n", ib_get_err_str(status))); + + } + status = mlnx_destroy_fmr(p_fmr_el->h_fmr); + if (status != IB_SUCCESS) + AL_PRINT(TRACE_LEVEL_WARNING, AL_DBG_FMR_POOL, ("mlnx_destroy_fmr returned %s\n", ib_get_err_str(status))); + + cl_spinlock_acquire(&p_pool->pool_lock); + cl_qlist_remove_item(&p_pool->free_list, p_list_item); + cl_free(p_fmr_el); + ++i; + } + + cl_spinlock_release( &p_pool->pool_lock ); + + if (i < p_pool->pool_size) + AL_PRINT(TRACE_LEVEL_ERROR, AL_DBG_FMR_POOL, ("pool still has %d regions registered\n", + p_pool->pool_size - i)); +} + + +/* + * Free the pool. + */ +static void +__free_fmr_pool( + IN al_obj_t* p_obj ) +{ + mlnx_fmr_pool_t* p_pool; + + CL_ASSERT( p_obj ); + p_pool = PARENT_STRUCT( p_obj, mlnx_fmr_pool_t, obj ); + + cl_spinlock_destroy(&p_pool->pool_lock); + destroy_al_obj( &p_pool->obj ); + if (p_pool->cache_bucket) + cl_free( p_pool->cache_bucket ); + cl_free( p_pool ); + AL_PRINT(TRACE_LEVEL_ERROR, AL_DBG_FMR_POOL, ("__free_pool: pool %p\n", p_pool)); +} + + + +ib_api_status_t +mlnx_create_fmr_pool( + IN const ib_pd_handle_t h_pd, + IN const mlnx_fmr_pool_create_t *p_fmr_pool_attr, + OUT mlnx_fmr_pool_handle_t* const ph_pool ) +{ + ib_api_status_t status = IB_SUCCESS; + mlnx_fmr_pool_t *p_pool; + int i; + int max_remaps; + cl_status_t cl_status; + mlnx_fmr_pool_element_t *p_fmr_el; + + + AL_ENTER( AL_DBG_FMR_POOL ); + + if( AL_OBJ_INVALID_HANDLE( h_pd, AL_OBJ_TYPE_H_PD ) ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_PD_HANDLE\n") ); + status = IB_INVALID_AL_HANDLE; + goto end; + } + + if( !ph_pool ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_PARAMETER\n") ); + status = IB_INVALID_PARAMETER; + goto end; + } + + if( !p_fmr_pool_attr || !p_fmr_pool_attr->dirty_watermark) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_PARAMETER\n") ); + status = IB_INVALID_PARAMETER; + goto end; + } + + if (!h_pd->obj.p_ci_ca || !h_pd->obj.p_ci_ca->p_pnp_attr) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_STATE\n") ); + status = IB_INVALID_STATE; + goto end; + } + + // check whether the device support FMR + if (!h_pd->obj.p_ci_ca->verbs.alloc_mlnx_fmr|| !h_pd->obj.p_ci_ca->verbs.dealloc_mlnx_fmr || + !h_pd->obj.p_ci_ca->verbs.map_phys_mlnx_fmr || !h_pd->obj.p_ci_ca->verbs.unmap_mlnx_fmr) { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Device does not support fast memory regions")); + status = IB_UNSUPPORTED; + goto end; + } + + if (!h_pd->obj.p_ci_ca->p_pnp_attr->max_map_per_fmr) + { + max_remaps = IB_FMR_MAX_REMAPS; + } + else + { + max_remaps = h_pd->obj.p_ci_ca->p_pnp_attr->max_map_per_fmr; + } + + // allocate pool object + p_pool = cl_zalloc( sizeof( mlnx_fmr_pool_t ) ); + if( !p_pool ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Couldn't allocate pool struct")); + status = IB_INSUFFICIENT_MEMORY; + goto err_alloc_pool_obj; + } + + // construct pool objects + cl_spinlock_construct( &p_pool->pool_lock); + cl_thread_construct(&p_pool->thread); + cl_event_construct(&p_pool->do_flush_event); + cl_event_construct(&p_pool->flush_done_event); + + + // init pool objects + p_pool->pool_size = 0; + p_pool->max_pages = p_fmr_pool_attr->max_pages_per_fmr; + p_pool->max_remaps = max_remaps; + p_pool->dirty_watermark = p_fmr_pool_attr->dirty_watermark; + p_pool->dirty_len = 0; + p_pool->cache_bucket = NULL; + p_pool->flush_function = p_fmr_pool_attr->flush_function; + p_pool->flush_arg = p_fmr_pool_attr->flush_arg; + cl_qlist_init(&p_pool->dirty_list); + cl_qlist_init(&p_pool->free_list); + cl_qlist_init(&p_pool->rest_list); + + if (p_fmr_pool_attr->cache) { + p_pool->cache_bucket = + cl_zalloc(IB_FMR_HASH_SIZE * sizeof *p_pool->cache_bucket); + if (!p_pool->cache_bucket) { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Failed to allocate cache in pool")); + status = IB_INSUFFICIENT_MEMORY; + goto err_alloc_cache; + } + + for (i = 0; i < IB_FMR_HASH_SIZE; ++i) + cl_qlist_init(p_pool->cache_bucket + i); + } + + cl_status = cl_spinlock_init( &p_pool->pool_lock ); + if( cl_status != CL_SUCCESS ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Failed cl_spinlock_init")); + status = IB_ERROR; + goto err_pool_init; + } + + cl_event_init(&p_pool->do_flush_event,FALSE); + if( cl_status != CL_SUCCESS ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Failed cl_event_init")); + status = IB_ERROR; + goto err_pool_init; + } + + cl_event_init(&p_pool->flush_done_event,FALSE); + if( cl_status != CL_SUCCESS ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Failed cl_event_init")); + status = IB_ERROR; + goto err_pool_init; + } + + cl_thread_init(&p_pool->thread ,__fmr_cleanup_thread,p_pool,"fmr_cleanup"); + if( cl_status != CL_SUCCESS ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Failed cl_thread_init")); + status = IB_ERROR; + goto err_pool_init; + } + + { + mlnx_fmr_create_t fmr_attr; + + fmr_attr.max_pages = p_fmr_pool_attr->max_pages_per_fmr, + fmr_attr.max_maps = p_pool->max_remaps, + fmr_attr.page_size = p_fmr_pool_attr->page_size; + fmr_attr.access_ctrl = p_fmr_pool_attr->access_ctrl; + + + for (i = 0; i < p_fmr_pool_attr->pool_size; ++i) + { + p_fmr_el = cl_zalloc(sizeof (mlnx_fmr_pool_element_t) + p_fmr_pool_attr->max_pages_per_fmr * sizeof (uint64_t)); + if (!p_fmr_el) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, (" failed to allocate struct for FMR %d \n",i)); + status = IB_INSUFFICIENT_MEMORY; + goto err_alloc_cache_el; + } + + p_fmr_el->h_pool = (mlnx_fmr_pool_handle_t)p_pool; + p_fmr_el->remap_count = 0; + p_fmr_el->ref_count = 0; + + status = mlnx_create_fmr(h_pd, &fmr_attr,&p_fmr_el->h_fmr); + if (status != IB_SUCCESS) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, + ("mlnx_create_fmr failed for FMR %d with status %s.\n",i,ib_get_err_str(status))); + cl_free(p_fmr_el); + goto err_alloc_cache_el; + } + + cl_qlist_insert_tail(&p_pool->free_list, &p_fmr_el->list_item); + p_fmr_el->p_cur_list = &p_pool->free_list; + ++p_pool->pool_size; + } + + } + + /* Do IBAL stuff for creating and iniitializing the object */ + construct_al_obj( &p_pool->obj, AL_OBJ_TYPE_H_FMR_POOL); + + status = init_al_obj( &p_pool->obj, p_pool, FALSE, __destroying_fmr_pool, __cleanup_fmr_pool, __free_fmr_pool ); + if( status != IB_SUCCESS ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, + ("init_al_obj failed with status %s.\n", ib_get_err_str(status)) ); + goto err_init_al_obj; + } + + /* Attach the pool to the AL object. */ + status = attach_al_obj( &h_pd->obj, &p_pool->obj ); + if( status != IB_SUCCESS ) + { + ref_al_obj( &p_pool->obj ); + p_pool->obj.pfn_destroy( &p_pool->obj, NULL ); + AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, + ("attach_al_obj returned %s.\n", ib_get_err_str(status)) ); + goto end; + } + + + /* Release the reference taken in init_al_obj */ + deref_al_obj( &p_pool->obj ); + + *ph_pool = p_pool; + status = IB_SUCCESS; + goto end; + +err_init_al_obj: + destroy_al_obj( &p_pool->obj ); + +err_alloc_cache_el: + __destroying_fmr_pool( &p_pool->obj ); + __cleanup_fmr_pool( &p_pool->obj ); + +err_pool_init: + if (p_pool->cache_bucket) + cl_free( p_pool->cache_bucket ); + +err_alloc_cache: + cl_free( p_pool ); + +err_alloc_pool_obj: +end: + AL_EXIT( AL_DBG_FMR_POOL ); + return status; +} + +/** + * ib_destroy_fmr_pool - Free FMR pool + * @pool:FMR pool to free + * + * Destroy an FMR pool and free all associated resources. + */ +ib_api_status_t +mlnx_destroy_fmr_pool( + IN const mlnx_fmr_pool_handle_t h_pool) +{ + mlnx_fmr_pool_t *p_pool = (mlnx_fmr_pool_t*)h_pool; + + AL_ENTER( AL_DBG_FMR_POOL ); + + if( AL_OBJ_INVALID_HANDLE( h_pool, AL_OBJ_TYPE_H_FMR_POOL ) ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_HANDLE\n") ); + return IB_INVALID_HANDLE; + } + + ref_al_obj( &p_pool->obj ); + p_pool->obj.pfn_destroy( &p_pool->obj, NULL ); + + AL_EXIT( AL_DBG_FMR_POOL ); + return IB_SUCCESS; +} + + + +ib_api_status_t +mlnx_flush_fmr_pool(mlnx_fmr_pool_handle_t h_pool) +{ + + ib_api_status_t status = IB_SUCCESS; + mlnx_fmr_pool_t *p_pool = (mlnx_fmr_pool_t*)h_pool; + + if( AL_OBJ_INVALID_HANDLE( h_pool, AL_OBJ_TYPE_H_FMR_POOL ) ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_HANDLE\n") ); + return IB_INVALID_HANDLE; + } + + ref_al_obj( &p_pool->obj ); + + cl_atomic_inc( &p_pool->flush_req ); + cl_event_signal(&p_pool->do_flush_event); + if (cl_event_wait_on(&p_pool->flush_done_event, EVENT_NO_TIMEOUT, TRUE)) + status = IB_ERROR; + + deref_al_obj( &p_pool->obj ); + + return status; +} + +ib_api_status_t +mlnx_map_phys_fmr_pool( + IN const mlnx_fmr_pool_handle_t h_pool , + IN const uint64_t* const page_list, + IN const int list_len, + IN OUT uint64_t* const p_vaddr, + OUT net32_t* const p_lkey, + OUT net32_t* const p_rkey, + OUT mlnx_fmr_pool_el_t *pp_fmr_el) +{ + + ib_api_status_t status = IB_SUCCESS; + mlnx_fmr_pool_t *p_pool = (mlnx_fmr_pool_t*)h_pool; + mlnx_fmr_pool_element_t *p_fmr_el; + cl_qlist_t *bucket; + + if( AL_OBJ_INVALID_HANDLE( h_pool, AL_OBJ_TYPE_H_FMR_POOL ) ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_HANDLE\n") ); + return IB_INVALID_HANDLE; + } + + if (list_len < 1 || list_len > p_pool->max_pages) + return IB_INVALID_PARAMETER; + + ref_al_obj( &p_pool->obj ); + + cl_spinlock_acquire(&p_pool->pool_lock); + + p_fmr_el = __fmr_cache_lookup( p_pool, page_list, list_len, *p_vaddr ); + if (p_fmr_el) { + /* found in cache */ + ++p_fmr_el->ref_count; + if (p_fmr_el->ref_count == 1) { + cl_qlist_remove_item( p_fmr_el->p_cur_list, &p_fmr_el->list_item ); + cl_qlist_insert_tail(&p_pool->rest_list, &p_fmr_el->list_item); + p_fmr_el->p_cur_list = &p_pool->rest_list; + } + + cl_spinlock_release(&p_pool->pool_lock); + goto end; + } + + if (cl_is_qlist_empty(&p_pool->free_list)) { + cl_spinlock_release(&p_pool->pool_lock); + status = IB_RESOURCE_BUSY; + goto exit; + } + + p_fmr_el = PARENT_STRUCT(cl_qlist_remove_head(&p_pool->free_list),mlnx_fmr_pool_element_t,list_item); + if (p_fmr_el->in_cash) + { + p_fmr_el->in_cash = FALSE; + bucket = p_pool->cache_bucket + __fmr_hash(p_fmr_el->page_list[0]); + cl_qlist_remove_item( bucket, &p_fmr_el->cache_node ); + } + cl_spinlock_release(&p_pool->pool_lock); + + status = mlnx_map_phys_fmr(p_fmr_el->h_fmr, page_list, + list_len, p_vaddr, p_lkey, p_rkey); + + if (status != IB_SUCCESS) { + cl_spinlock_acquire(&p_pool->pool_lock); + cl_qlist_insert_tail(&p_pool->free_list, &p_fmr_el->list_item); + p_fmr_el->p_cur_list = &p_pool->free_list; + cl_spinlock_release(&p_pool->pool_lock); + goto exit; + } + + ++p_fmr_el->remap_count; + p_fmr_el->ref_count = 1; + p_fmr_el->lkey = *p_lkey; + p_fmr_el->rkey = *p_rkey; + p_fmr_el->io_virtual_address = *p_vaddr; + cl_spinlock_acquire(&p_pool->pool_lock); + cl_qlist_insert_tail(&p_pool->rest_list, &p_fmr_el->list_item); + p_fmr_el->p_cur_list = &p_pool->rest_list; + cl_spinlock_release(&p_pool->pool_lock); + + if (p_pool->cache_bucket) { + p_fmr_el->io_virtual_address = *p_vaddr; + p_fmr_el->page_list_len = list_len; + memcpy(p_fmr_el->page_list, page_list, list_len * sizeof(*page_list)); + + cl_spinlock_acquire(&p_pool->pool_lock); + bucket = p_pool->cache_bucket + __fmr_hash(p_fmr_el->page_list[0]); + cl_qlist_insert_head( bucket, &p_fmr_el->cache_node ); + p_fmr_el->in_cash = TRUE; + cl_spinlock_release(&p_pool->pool_lock); + } + +end: + *pp_fmr_el = (mlnx_fmr_pool_el_t)p_fmr_el; + *p_lkey = p_fmr_el->lkey; + *p_rkey = p_fmr_el->rkey; + *p_vaddr = p_fmr_el->io_virtual_address; + +exit: + deref_al_obj( &p_pool->obj ); + return status; +} + + + +ib_api_status_t +mlnx_unmap_fmr_pool( + IN mlnx_fmr_pool_el_t p_fmr_el ) +{ + mlnx_fmr_pool_t *p_pool; + + p_pool = (mlnx_fmr_pool_t*)p_fmr_el->h_pool; + + if( AL_OBJ_INVALID_HANDLE( (mlnx_fmr_pool_handle_t)p_pool, AL_OBJ_TYPE_H_FMR_POOL ) ) + { + AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_HANDLE\n") ); + return IB_INVALID_HANDLE; + } + + ref_al_obj( &p_pool->obj ); + + cl_spinlock_acquire(&p_pool->pool_lock); + + --p_fmr_el->ref_count; + if (!p_fmr_el->ref_count) + { + if (p_fmr_el->p_cur_list == &p_pool->rest_list) + cl_qlist_remove_item( p_fmr_el->p_cur_list, &p_fmr_el->list_item ); + + if (p_fmr_el->remap_count < p_pool->max_remaps) + { + cl_qlist_insert_tail(&p_pool->free_list,&p_fmr_el->list_item); + p_fmr_el->p_cur_list = &p_pool->free_list; + } + else + { + cl_qlist_insert_tail(&p_pool->dirty_list, &p_fmr_el->list_item); + p_fmr_el->p_cur_list = &p_pool->dirty_list; + ++p_pool->dirty_len; + cl_event_signal(&p_pool->do_flush_event); + } + } + + if (p_fmr_el->ref_count < 0) + { + AL_PRINT(TRACE_LEVEL_WARNING, AL_DBG_FMR_POOL, ("FMR %p has ref count %d < 0\n",p_fmr_el, p_fmr_el->ref_count)); + } + cl_spinlock_release( &p_pool->pool_lock ); + + deref_al_obj( &p_pool->obj ); + return IB_SUCCESS; +} diff --git a/trunk/core/al/kernel/al_fmr_pool.h b/trunk/core/al/kernel/al_fmr_pool.h new file mode 100644 index 00000000..f68fad63 --- /dev/null +++ b/trunk/core/al/kernel/al_fmr_pool.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2005 SilverStorm Technologies. All rights reserved. + * Copyright (c) 1996-2003 Intel Corporation. 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: al_fmr_pool.h 1611 2006-08-20 14:48:55Z sleybo $ + */ + + +#if !defined(__AL_FMR_POOL_H__) +#define __AL_FMR_POOL_H__ + +#include +#include +#include "al_common.h" + + +/* + * If an FMR is not in use, then the list member will point to either + * its pool's free_list (if the FMR can be mapped again; that is, + * remap_count < pool->max_remaps) or its pool's dirty_list (if the + * FMR needs to be unmapped before being remapped). In either of + * these cases it is a bug if the ref_count is not 0. In other words, + * if ref_count is > 0, then the list member must not be linked into + * either free_list or dirty_list. + * + * The cache_node member is used to link the FMR into a cache bucket + * (if caching is enabled). This is independent of the reference + * count of the FMR. When a valid FMR is released, its ref_count is + * decremented, and if ref_count reaches 0, the FMR is placed in + * either free_list or dirty_list as appropriate. However, it is not + * removed from the cache and may be "revived" if a call to + * ib_fmr_register_physical() occurs before the FMR is remapped. In + * this case we just increment the ref_count and remove the FMR from + * free_list/dirty_list. + * + * Before we remap an FMR from free_list, we remove it from the cache + * (to prevent another user from obtaining a stale FMR). When an FMR + * is released, we add it to the tail of the free list, so that our + * cache eviction policy is "least recently used." + * + * All manipulation of ref_count, list and cache_node is protected by + * pool_lock to maintain consistency. + */ + +#pragma warning( disable : 4200) +typedef struct _mlnx_fmr_pool_element { + mlnx_fmr_handle_t h_fmr; + mlnx_fmr_pool_handle_t h_pool; + cl_list_item_t list_item; + cl_qlist_t *p_cur_list; + cl_list_item_t cache_node; + boolean_t in_cash; + int ref_count; + int remap_count; + uint64_t io_virtual_address; + net32_t lkey; + net32_t rkey; + int page_list_len; + uint64_t page_list[0]; +} mlnx_fmr_pool_element_t; +#pragma warning( default : 4200) + + +typedef struct _mlnx_fmr_pool { + + al_obj_t obj; /* Child of ib_al_handle_t */ + cl_spinlock_t pool_lock; + + int pool_size; + int max_pages; + int max_remaps; + int dirty_watermark; + int dirty_len; + cl_qlist_t free_list; + cl_qlist_t dirty_list; + cl_qlist_t rest_list; /* those, that not in free and not in dirty */ + cl_qlist_t *cache_bucket; + + void (*flush_function) (mlnx_fmr_pool_handle_t h_pool,void* arg); + void *flush_arg; + + cl_thread_t thread; + cl_event_t do_flush_event; + cl_event_t flush_done_event; + atomic32_t flush_req; + atomic32_t should_stop; +} mlnx_fmr_pool_t; + + +#endif /* IB_FMR_POOL_H */ + diff --git a/trunk/core/al/kernel/al_mr.c b/trunk/core/al/kernel/al_mr.c index 8be79efd..bf2f27ed 100644 --- a/trunk/core/al/kernel/al_mr.c +++ b/trunk/core/al/kernel/al_mr.c @@ -136,6 +136,7 @@ __cleanup_mlnx_fmr( CL_ASSERT( status == IB_SUCCESS ); h_fmr->h_ci_fmr = NULL; + h_fmr->p_next = NULL; } } @@ -262,7 +263,11 @@ mlnx_unmap_fmr( IN const mlnx_fmr_handle_t h_fmr ) { ib_api_status_t status; - + mlnx_fmr_t *p_fmr = (mlnx_fmr_t*)h_fmr; + mlnx_fmr_t *p_cur_fmr; + mlnx_fmr_handle_t *p_fmr_array; + int i; + AL_ENTER( AL_DBG_MR ); if( AL_OBJ_INVALID_HANDLE( h_fmr, AL_OBJ_TYPE_H_FMR ) ) @@ -271,10 +276,35 @@ mlnx_unmap_fmr( return IB_INVALID_FMR_HANDLE; } - ref_al_obj( &h_fmr->obj ); - status = verbs_unmap_mlnx_fmr( h_fmr ); - deref_al_obj( &h_fmr->obj ); + // calculate the list size + for ( i=0, p_cur_fmr = p_fmr; p_cur_fmr; p_cur_fmr = p_cur_fmr->p_next) + i++; + + // allocate the array + p_fmr_array = cl_zalloc((i+1)*sizeof(mlnx_fmr_handle_t)); + if (!p_fmr_array) + { + AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_FMR_HANDLE\n") ); + return IB_INSUFFICIENT_MEMORY; + } + + // fill the array + for ( i=0, p_cur_fmr = p_fmr; p_cur_fmr; p_cur_fmr = p_cur_fmr->p_next) + { + p_fmr_array[i++] = p_cur_fmr->h_ci_fmr; + ref_al_obj( &p_cur_fmr->obj ); + } + p_fmr_array[i] = NULL; + + // unmap the array of FMRs + status = verbs_unmap_mlnx_fmr( h_fmr, p_fmr_array ); + + // deref the objects + for ( p_cur_fmr = p_fmr; p_cur_fmr; p_cur_fmr = p_cur_fmr->p_next) + deref_al_obj( &p_cur_fmr->obj ); + cl_free( p_fmr_array ); + AL_EXIT( AL_DBG_MR ); return status; } @@ -310,7 +340,7 @@ mlnx_destroy_fmr( h_fmr->h_ci_fmr = NULL; /* We're good to destroy the object. NOTE: No need to deref the al object , - we are reseting the fmr objb before inserting it back to the pool */ + we are resetting the fmr obj before inserting it back to the pool */ h_fmr->obj.pfn_destroy( &h_fmr->obj, NULL ); } diff --git a/trunk/core/al/kernel/al_smi.c b/trunk/core/al/kernel/al_smi.c index 6d7f7860..4461730c 100644 --- a/trunk/core/al/kernel/al_smi.c +++ b/trunk/core/al/kernel/al_smi.c @@ -1578,7 +1578,7 @@ __update_pkey_table( cl_memcpy( &p_cache->pkey_tbl[idx].tbl, ib_smp_get_payload_ptr( p_mad ), - sizeof(ib_pkey_table_info_t) ); + sizeof(ib_pkey_table_t) ); p_cache->pkey_tbl[idx].valid = TRUE; } @@ -1825,7 +1825,7 @@ __process_guid_info( if( p_mad->method == IB_MAD_METHOD_SET ) { if( cl_memcmp( ib_smp_get_payload_ptr( (ib_smp_t*)p_mad ), - &p_spl_qp_svc->cache.guid_block[idx].tbl, sizeof(ib_pkey_table_info_t) ) ) + &p_spl_qp_svc->cache.guid_block[idx].tbl, sizeof(ib_guid_info_t) ) ) { /* The set is requesting a change. */ return IB_NOT_DONE; @@ -1872,7 +1872,7 @@ __process_pkey_table( ib_mad_t *p_mad; ib_mad_element_t *p_mad_resp; ib_smp_t *p_smp; - ib_pkey_table_info_t *p_pkey_table_info; + ib_pkey_table_t *p_pkey_table; uint16_t idx; ib_api_status_t status; @@ -1911,7 +1911,7 @@ __process_pkey_table( if( p_mad->method == IB_MAD_METHOD_SET ) { if( cl_memcmp( ib_smp_get_payload_ptr( (ib_smp_t*)p_mad ), - &p_spl_qp_svc->cache.pkey_tbl[idx].tbl, sizeof(ib_pkey_table_info_t) ) ) + &p_spl_qp_svc->cache.pkey_tbl[idx].tbl, sizeof(ib_pkey_table_t) ) ) { /* The set is requesting a change. */ AL_EXIT( AL_DBG_SMI ); @@ -1933,14 +1933,14 @@ __process_pkey_table( else p_smp->status = 0; - p_pkey_table_info = (ib_pkey_table_info_t*)ib_smp_get_payload_ptr( p_smp ); + p_pkey_table = (ib_pkey_table_t*)ib_smp_get_payload_ptr( p_smp ); // TODO: do we need lock on the cache ????? /* Copy the cached data. */ - cl_memcpy( p_pkey_table_info, - &p_spl_qp_svc->cache.pkey_tbl[idx].tbl, sizeof(ib_pkey_table_info_t) ); + cl_memcpy( p_pkey_table, + &p_spl_qp_svc->cache.pkey_tbl[idx].tbl, sizeof(ib_pkey_table_t) ); status = complete_local_mad( p_spl_qp_svc, p_mad_wr, p_mad_resp ); } diff --git a/trunk/core/al/kernel/al_smi.h b/trunk/core/al/kernel/al_smi.h index 883d9708..51180287 100644 --- a/trunk/core/al/kernel/al_smi.h +++ b/trunk/core/al/kernel/al_smi.h @@ -83,7 +83,7 @@ typedef struct _guid_block typedef struct _pkey_block { boolean_t valid; - ib_pkey_table_info_t tbl; + ib_pkey_table_t tbl; } pkey_block_t; diff --git a/trunk/core/al/user/al_exports.src b/trunk/core/al/user/al_exports.src index 83f82acc..87d428bd 100644 --- a/trunk/core/al/user/al_exports.src +++ b/trunk/core/al/user/al_exports.src @@ -199,8 +199,8 @@ ib_rmpp_is_flag_set ib_rmpp_set_resp_time ib_sa_mad_get_payload_ptr ib_send_mad -ib_slvl_table_get_vl -ib_slvl_table_set_vl +ib_slvl_table_set +ib_slvl_table_get ib_sminfo_get_priority ib_sminfo_get_state ib_smp_get_payload_ptr diff --git a/trunk/core/bus/kernel/bus_pnp.c b/trunk/core/bus/kernel/bus_pnp.c index 00190ff4..e0188c53 100644 --- a/trunk/core/bus/kernel/bus_pnp.c +++ b/trunk/core/bus/kernel/bus_pnp.c @@ -680,6 +680,11 @@ al_set_ifc( p_ifc->map_phys_mlnx_fmr = mlnx_map_phys_fmr; p_ifc->unmap_mlnx_fmr = mlnx_unmap_fmr; p_ifc->destroy_mlnx_fmr = mlnx_destroy_fmr; + p_ifc->create_mlnx_fmr_pool = mlnx_create_fmr_pool; + p_ifc->destroy_mlnx_fmr_pool = mlnx_destroy_fmr_pool; + p_ifc->map_phys_mlnx_fmr_pool = mlnx_map_phys_fmr_pool; + p_ifc->unmap_mlnx_fmr_pool = mlnx_unmap_fmr_pool; + p_ifc->flush_mlnx_fmr_pool = mlnx_flush_fmr_pool; p_ifc->create_srq = ib_create_srq; p_ifc->modify_srq = ib_modify_srq; p_ifc->query_srq = ib_query_srq; diff --git a/trunk/core/bus/kernel/ib_bus.inf b/trunk/core/bus/kernel/ib_bus.inf index f77def1f..c3ae6c32 100644 --- a/trunk/core/bus/kernel/ib_bus.inf +++ b/trunk/core/bus/kernel/ib_bus.inf @@ -158,6 +158,7 @@ ErrorControl = %SERVICE_ERROR_NORMAL% ServiceBinary = %12%\ibbus.sys LoadOrderGroup = extended base AddReg = Ibbus.ParamsReg +Dependencies = mthca [Iou.ServiceInstall] DisplayName = %Iou.ServiceDesc% diff --git a/trunk/hw/mt23108/kernel/hca_data.h b/trunk/hw/mt23108/kernel/hca_data.h index ebf91d52..e5248975 100644 --- a/trunk/hw/mt23108/kernel/hca_data.h +++ b/trunk/hw/mt23108/kernel/hca_data.h @@ -164,7 +164,7 @@ typedef struct _port_info_cache typedef struct _pkey_block { boolean_t valid; - ib_pkey_table_info_t tbl; + ib_pkey_table_t tbl; } mlnx_pkey_block_t; diff --git a/trunk/hw/mt23108/kernel/hca_memory.c b/trunk/hw/mt23108/kernel/hca_memory.c index 0250f126..26d8f50d 100644 --- a/trunk/hw/mt23108/kernel/hca_memory.c +++ b/trunk/hw/mt23108/kernel/hca_memory.c @@ -729,9 +729,9 @@ mlnx_map_phys_fmr ( ib_api_status_t mlnx_unmap_fmr ( - IN const mlnx_fmr_handle_t h_fmr) + IN const mlnx_fmr_handle_t *ph_fmr) { - UNUSED_PARAM( h_fmr ); + UNUSED_PARAM( ph_fmr ); return IB_UNSUPPORTED; } diff --git a/trunk/hw/mt23108/kernel/hca_smp.c b/trunk/hw/mt23108/kernel/hca_smp.c index e57b5b06..725634fd 100644 --- a/trunk/hw/mt23108/kernel/hca_smp.c +++ b/trunk/hw/mt23108/kernel/hca_smp.c @@ -119,7 +119,7 @@ mlnx_cachable_pkey_table( if( p_mad_in->method == IB_MAD_METHOD_SET ) { if( cl_memcmp( ib_smp_get_payload_ptr( (ib_smp_t*)p_mad_in ), - &p_cache->pkey_tbl[idx].tbl, sizeof(ib_pkey_table_info_t) ) ) + &p_cache->pkey_tbl[idx].tbl, sizeof(ib_pkey_table_t) ) ) { /* The set is requesting a change. */ return FALSE; @@ -136,7 +136,7 @@ mlnx_cachable_pkey_table( /* Copy the cached data. */ cl_memcpy( ib_smp_get_payload_ptr( (ib_smp_t*)p_mad_out ), - &p_cache->pkey_tbl[idx].tbl, sizeof(ib_pkey_table_info_t) ); + &p_cache->pkey_tbl[idx].tbl, sizeof(ib_pkey_table_t) ); return TRUE; } @@ -376,7 +376,7 @@ mlnx_update_pkey_table( cl_memcpy( &p_cache->pkey_tbl[idx].tbl, ib_smp_get_payload_ptr( (ib_smp_t*)p_mad_out ), - sizeof(ib_pkey_table_info_t) ); + sizeof(ib_pkey_table_t) ); p_cache->pkey_tbl[idx].valid = TRUE; } diff --git a/trunk/hw/mthca/kernel/hca_data.h b/trunk/hw/mthca/kernel/hca_data.h index ebbeb0f2..a102c612 100644 --- a/trunk/hw/mthca/kernel/hca_data.h +++ b/trunk/hw/mthca/kernel/hca_data.h @@ -46,6 +46,8 @@ extern uint32_t g_disable_tavor_reset; extern uint32_t g_tune_pci; extern uint32_t g_processor_affinity; extern uint32_t g_max_DPC_time_us; +extern uint32_t g_profile_qp_num; +extern uint32_t g_profile_rd_out; #define MLNX_MAX_HCA 4 @@ -139,7 +141,7 @@ typedef struct _port_info_cache typedef struct _pkey_block { boolean_t valid; - ib_pkey_table_info_t tbl; + ib_pkey_table_t tbl; } mlnx_pkey_block_t; diff --git a/trunk/hw/mthca/kernel/hca_driver.c b/trunk/hw/mthca/kernel/hca_driver.c index 9fee6e99..a91abe59 100644 --- a/trunk/hw/mthca/kernel/hca_driver.c +++ b/trunk/hw/mthca/kernel/hca_driver.c @@ -71,6 +71,8 @@ uint32_t g_disable_tavor_reset=1; /* disable Tavor reset for the next driver lo uint32_t g_tune_pci=0; /* 0 - skip tuning PCI configuration space of HCAs */ uint32_t g_processor_affinity = 0; uint32_t g_max_DPC_time_us = 10000; +uint32_t g_profile_qp_num = 0; +uint32_t g_profile_rd_out = 0xffffffff; UNICODE_STRING g_param_path; @@ -239,7 +241,7 @@ __read_registry( { NTSTATUS status; /* Remember the terminating entry in the table below. */ - RTL_QUERY_REGISTRY_TABLE table[8]; + RTL_QUERY_REGISTRY_TABLE table[10]; HCA_ENTER( HCA_DBG_DEV ); @@ -314,16 +316,31 @@ __read_registry( table[6].DefaultData = &g_max_DPC_time_us; table[6].DefaultLength = sizeof(ULONG); + table[7].Flags = RTL_QUERY_REGISTRY_DIRECT; + table[7].Name = L"ProfileQpNum"; + table[7].EntryContext = &g_profile_qp_num; + table[7].DefaultType = REG_DWORD; + table[7].DefaultData = &g_profile_qp_num; + table[7].DefaultLength = sizeof(ULONG); + + table[8].Flags = RTL_QUERY_REGISTRY_DIRECT; + table[8].Name = L"ProfileRdOut"; + table[8].EntryContext = &g_profile_rd_out; + table[8].DefaultType = REG_DWORD; + table[8].DefaultData = &g_profile_rd_out; + table[8].DefaultLength = sizeof(ULONG); + /* Have at it! */ status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, g_param_path.Buffer, table, NULL, NULL ); HCA_PRINT( TRACE_LEVEL_INFORMATION, HCA_DBG_INIT, - ("debug level %d debug flags 0x%.8x SkipTavorReset %d DisableTavorReset %d TunePci %d" - "g_processor_affinity %d g_max_DPC_time_us%d\n", - g_mthca_dbg_level , g_mthca_dbg_flags, + ("debug level %d debug flags 0x%.8x SkipTavorReset %d DisableTavorReset %d TunePci %d" + "g_processor_affinity %d g_max_DPC_time_us %d g_profile_qp_num %d g_profile_rd_out %d\n", + g_mthca_dbg_level, g_mthca_dbg_flags, g_skip_tavor_reset, g_disable_tavor_reset, - g_tune_pci, g_processor_affinity, g_max_DPC_time_us )); + g_tune_pci, g_processor_affinity, g_max_DPC_time_us, + g_profile_qp_num, g_profile_rd_out )); HCA_EXIT( HCA_DBG_DEV ); return status; @@ -549,7 +566,13 @@ __map_crspace( // resource tracking p_context->p_mdl = p_mdl; p_context->va = ua; - + +#if 0 + HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM, + ("MTHCA: __map_crspace succeeded with .ka %I64x, size %I64x va %I64x, size %x, pa %I64x \n", + p_ext->bar[HCA_BAR_TYPE_HCR].virt, p_ext->bar[HCA_BAR_TYPE_HCR].size, + p_res->va, p_res->size, p_ext->bar[HCA_BAR_TYPE_HCR].phys )); +#endif status = STATUS_SUCCESS; goto out; diff --git a/trunk/hw/mthca/kernel/hca_memory.c b/trunk/hw/mthca/kernel/hca_memory.c index e3fdcd6c..6e9e90a0 100644 --- a/trunk/hw/mthca/kernel/hca_memory.c +++ b/trunk/hw/mthca/kernel/hca_memory.c @@ -354,11 +354,7 @@ mlnx_alloc_fmr( status = IB_INVALID_PARAMETER; goto err_invalid_parm; } - //TODO: temporary limitation, till implementing somewhat like Gen2's FMR_POOL - if (p_fmr_create->max_maps != 1) { - status = IB_INVALID_PARAMETER; - goto err_invalid_parm; - } + // TODO: check Max remap in AL // prepare parameters RtlZeroMemory(&fmr_attr, sizeof(struct ib_fmr_attr)); @@ -442,11 +438,11 @@ err_dealloc_fmr: ib_api_status_t mlnx_unmap_fmr ( - IN const mlnx_fmr_handle_t h_fmr) + IN const mlnx_fmr_handle_t *ph_fmr) { ib_api_status_t status; int err; - struct ib_fmr *ib_fmr = (struct ib_fmr *)h_fmr; + struct ib_fmr *ib_fmr = (struct ib_fmr *)*ph_fmr; struct list_head fmr_list; PREP_IBDEV_FOR_PRINT(ib_fmr->device); @@ -457,15 +453,20 @@ mlnx_unmap_fmr ( status = IB_UNSUPPORTED; goto err_unsupported; } - - // deregister + INIT_LIST_HEAD(&fmr_list); - list_add_tail(&ib_fmr->list, &fmr_list); + while(*ph_fmr) + { + ib_fmr = (struct ib_fmr*)*ph_fmr; + list_add_tail(&ib_fmr->list, &fmr_list); + ph_fmr ++; + } + err = ibv_unmap_fmr(&fmr_list); if (err) { status = errno_to_iberr(err); HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_MEMORY , - ("ibv_unmap_fmr failed (%d) for fmr %p\n", err, h_fmr)); + ("ibv_unmap_fmr failed (%d) \n", err)); goto err_unmap_fmr; } @@ -510,8 +511,8 @@ mlnx_dealloc_fmr ( err = ibv_dealloc_fmr((struct ib_fmr *)h_fmr); if (err) { status = errno_to_iberr(err); - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_MEMORY , - ("ibv_dealloc_fmr failed (%d) for mr %p\n", err, h_fmr)); + HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_MEMORY , + ("ibv_dealloc_fmr failed (%d) for mr %p\n",err, h_fmr)); goto err_dealloc_fmr; } @@ -605,3 +606,4 @@ mlnx_memory_if_livefish( p_interface->deregister_mr = mlnx_deregister_mr; } + diff --git a/trunk/hw/mthca/kernel/mthca.inf b/trunk/hw/mthca/kernel/mthca.inf index 135c1753..f995a48a 100644 --- a/trunk/hw/mthca/kernel/mthca.inf +++ b/trunk/hw/mthca/kernel/mthca.inf @@ -108,16 +108,19 @@ mthca32d.dll=1 [MTHCA.DDInstall.ntx86] CopyFiles = MTHCA.CopyFiles CopyFiles = MTHCA.UMCopyFiles +CopyINF=ib_bus.inf [MTHCA.DDInstall.ntamd64] CopyFiles = MTHCA.CopyFiles CopyFiles = MTHCA.UMCopyFiles CopyFiles = MTHCA.WOW64CopyFiles +CopyINF=ib_bus.inf [MTHCA.DDInstall.ntia64] CopyFiles = MTHCA.CopyFiles CopyFiles = MTHCA.UMCopyFiles CopyFiles = MTHCA.WOW64CopyFiles +CopyINF=ib_bus.inf [MTHCA.DDInstall.ntx86.Services] AddService = mthca,%SPSVCINST_ASSOCSERVICE%,MTHCA.ServiceInstall,MTHCA.EventLog @@ -168,6 +171,8 @@ HKR,"Parameters","DisableTavorResetOnFailure",%REG_DWORD%,1 HKR,"Parameters","TunePci",%REG_DWORD%,0 HKR,"Parameters","ProcessorAffinity",%REG_DWORD%,0 HKR,"Parameters","MaxDpcTimeUs",%REG_DWORD%,10000 +HKR,"Parameters","ProfileQpNum",%REG_DWORD%,0 +HKR,"Parameters","ProfileRdOut",%REG_DWORD%,0xffffffff HKLM,"System\CurrentControlSet\Control\WMI\GlobalLogger\8bf1f640-63fe-4743-b9ef-fa38c695bfde","Flags",%REG_DWORD%,0xffff HKLM,"System\CurrentControlSet\Control\WMI\GlobalLogger\8bf1f640-63fe-4743-b9ef-fa38c695bfde","Level",%REG_DWORD%,0x3 diff --git a/trunk/hw/mthca/kernel/mthca_main.c b/trunk/hw/mthca/kernel/mthca_main.c index f918ecdb..3137a6b2 100644 --- a/trunk/hw/mthca/kernel/mthca_main.c +++ b/trunk/hw/mthca/kernel/mthca_main.c @@ -310,6 +310,14 @@ static int mthca_init_tavor(struct mthca_dev *mdev) profile = default_profile; profile.num_uar = dev_lim.uar_size / PAGE_SIZE; profile.uarc_size = 0; + + /* correct default profile */ + if ( g_profile_qp_num != 0 ) + profile.num_qp = g_profile_qp_num; + + if ( g_profile_rd_out != 0xffffffff ) + profile.rdb_per_qp = g_profile_rd_out; + if (mdev->mthca_flags & MTHCA_FLAG_SRQ) profile.num_srq = dev_lim.max_srqs; @@ -612,6 +620,13 @@ static int mthca_init_arbel(struct mthca_dev *mdev) if (mdev->mthca_flags & MTHCA_FLAG_SRQ) profile.num_srq = dev_lim.max_srqs; + /* correct default profile */ + if ( g_profile_qp_num != 0 ) + profile.num_qp = g_profile_qp_num; + + if ( g_profile_rd_out != 0xffffffff ) + profile.rdb_per_qp = g_profile_rd_out; + RtlZeroMemory( &init_hca, sizeof(init_hca)); icm_size = mthca_make_profile(mdev, &profile, &dev_lim, &init_hca); if ((int) icm_size < 0) { diff --git a/trunk/hw/mthca/kernel/mthca_mr.c b/trunk/hw/mthca/kernel/mthca_mr.c index 3d349ee7..f76b4b0c 100644 --- a/trunk/hw/mthca/kernel/mthca_mr.c +++ b/trunk/hw/mthca/kernel/mthca_mr.c @@ -553,27 +553,27 @@ void mthca_free_mr(struct mthca_dev *dev, struct mthca_mr *mr) } int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd, - mthca_mpt_access_t access, struct mthca_fmr *mr) + mthca_mpt_access_t access, struct mthca_fmr *fmr) { struct mthca_mpt_entry *mpt_entry; struct mthca_mailbox *mailbox; u64 mtt_seg; u32 key, idx; u8 status; - int list_len = mr->attr.max_pages; + int list_len = fmr->attr.max_pages; int err = -ENOMEM; int i; CPU_2_BE64_PREP; - if (mr->attr.page_shift < 12 || mr->attr.page_shift >= 32) + if (fmr->attr.page_shift < 12 || fmr->attr.page_shift >= 32) return -EINVAL; /* For Arbel, all MTTs must fit in the same page. */ if (mthca_is_memfree(dev) && - mr->attr.max_pages * sizeof *mr->mem.arbel.mtts > PAGE_SIZE) + fmr->attr.max_pages * sizeof *fmr->mem.arbel.mtts > PAGE_SIZE) return -EINVAL; - mr->maps = 0; + fmr->maps = 0; key = mthca_alloc(&dev->mr_table.mpt_alloc); if (key == -1) @@ -581,31 +581,31 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd, key = adjust_key(dev, key); idx = key & (dev->limits.num_mpts - 1); - mr->ibmr.rkey = mr->ibmr.lkey = hw_index_to_key(dev, key); + fmr->ibfmr.rkey = fmr->ibfmr.lkey = hw_index_to_key(dev, key); if (mthca_is_memfree(dev)) { err = mthca_table_get(dev, dev->mr_table.mpt_table, key); if (err) goto err_out_mpt_free; - mr->mem.arbel.mpt = mthca_table_find(dev->mr_table.mpt_table, key); - BUG_ON(!mr->mem.arbel.mpt); + fmr->mem.arbel.mpt = mthca_table_find(dev->mr_table.mpt_table, key); + BUG_ON(!fmr->mem.arbel.mpt); } else - mr->mem.tavor.mpt = (struct mthca_mpt_entry*)((u8*)dev->mr_table.tavor_fmr.mpt_base + - sizeof *(mr->mem.tavor.mpt) * idx); + fmr->mem.tavor.mpt = (struct mthca_mpt_entry*)((u8*)dev->mr_table.tavor_fmr.mpt_base + + sizeof *(fmr->mem.tavor.mpt) * idx); - mr->mtt = __mthca_alloc_mtt(dev, list_len, dev->mr_table.fmr_mtt_buddy); - if (IS_ERR(mr->mtt)) + fmr->mtt = __mthca_alloc_mtt(dev, list_len, dev->mr_table.fmr_mtt_buddy); + if (IS_ERR(fmr->mtt)) goto err_out_table; - mtt_seg = mr->mtt->first_seg * MTHCA_MTT_SEG_SIZE; + mtt_seg =fmr->mtt->first_seg * MTHCA_MTT_SEG_SIZE; if (mthca_is_memfree(dev)) { - mr->mem.arbel.mtts = mthca_table_find(dev->mr_table.mtt_table, - mr->mtt->first_seg); - BUG_ON(!mr->mem.arbel.mtts); + fmr->mem.arbel.mtts = mthca_table_find(dev->mr_table.mtt_table, + fmr->mtt->first_seg); + BUG_ON(!fmr->mem.arbel.mtts); } else - mr->mem.tavor.mtts = (u64*)((u8*)dev->mr_table.tavor_fmr.mtt_base + mtt_seg); + fmr->mem.tavor.mtts = (u64*)((u8*)dev->mr_table.tavor_fmr.mtt_base + mtt_seg); mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); if (IS_ERR(mailbox)) @@ -618,7 +618,7 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd, MTHCA_MPT_FLAG_REGION | access); - mpt_entry->page_size = cl_hton32(mr->attr.page_shift - 12); + mpt_entry->page_size = cl_hton32(fmr->attr.page_shift - 12); mpt_entry->key = cl_hton32(key); mpt_entry->pd = cl_hton32(pd); RtlZeroMemory(&mpt_entry->start, @@ -626,7 +626,7 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd, mpt_entry->mtt_seg = CPU_2_BE64(dev->mr_table.mtt_base + mtt_seg); { - HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_MEMORY ,("Dumping MPT entry %08x:\n", mr->ibmr.lkey)); + HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_MEMORY ,("Dumping MPT entry %08x:\n", fmr->ibfmr.lkey)); for (i = 0; i < sizeof (struct mthca_mpt_entry) / 4; i=i+4) { HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_MEMORY ,("[%02x] %08x %08x %08x %08x \n",i, cl_ntoh32(((__be32 *) mpt_entry)[i]), @@ -658,13 +658,13 @@ err_out_mailbox_free: mthca_free_mailbox(dev, mailbox); err_out_free_mtt: - mthca_free_mtt(dev, mr->mtt); + mthca_free_mtt(dev, fmr->mtt); err_out_table: mthca_table_put(dev, dev->mr_table.mpt_table, key); err_out_mpt_free: - mthca_free(&dev->mr_table.mpt_alloc, mr->ibmr.lkey); + mthca_free(&dev->mr_table.mpt_alloc, fmr->ibfmr.lkey); return err; } @@ -674,7 +674,7 @@ int mthca_free_fmr(struct mthca_dev *dev, struct mthca_fmr *fmr) if (fmr->maps) return -EBUSY; - mthca_free_region(dev, fmr->ibmr.lkey); + mthca_free_region(dev, fmr->ibfmr.lkey); mthca_free_mtt(dev, fmr->mtt); return 0; @@ -727,9 +727,9 @@ int mthca_tavor_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list, ++fmr->maps; - key = tavor_key_to_hw_index(fmr->ibmr.lkey); + key = tavor_key_to_hw_index(fmr->ibfmr.lkey); key += dev->limits.num_mpts; - fmr->ibmr.lkey = fmr->ibmr.rkey = tavor_hw_index_to_key(key); + fmr->ibfmr.lkey = fmr->ibfmr.rkey = tavor_hw_index_to_key(key); writeb(MTHCA_MPT_STATUS_SW, fmr->mem.tavor.mpt); @@ -771,12 +771,12 @@ int mthca_arbel_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list, ++fmr->maps; - key = arbel_key_to_hw_index(fmr->ibmr.lkey); + key = arbel_key_to_hw_index(fmr->ibfmr.lkey); if (dev->mthca_flags & MTHCA_FLAG_SINAI_OPT) key += SINAI_FMR_KEY_INC; else key += dev->limits.num_mpts; - fmr->ibmr.lkey = fmr->ibmr.rkey = arbel_hw_index_to_key(key); + fmr->ibfmr.lkey = fmr->ibfmr.rkey = arbel_hw_index_to_key(key); *(u8 *) fmr->mem.arbel.mpt = MTHCA_MPT_STATUS_SW; @@ -811,9 +811,9 @@ void mthca_tavor_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr) if (!fmr->maps) return; - key = tavor_key_to_hw_index(fmr->ibmr.lkey); + key = tavor_key_to_hw_index(fmr->ibfmr.lkey); key &= dev->limits.num_mpts - 1; - fmr->ibmr.lkey = fmr->ibmr.rkey = tavor_hw_index_to_key(key); + fmr->ibfmr.lkey = fmr->ibfmr.rkey = tavor_hw_index_to_key(key); fmr->maps = 0; @@ -828,9 +828,9 @@ void mthca_arbel_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr) if (!fmr->maps) return; - key = arbel_key_to_hw_index(fmr->ibmr.lkey); + key = arbel_key_to_hw_index(fmr->ibfmr.lkey); key &= dev->limits.num_mpts - 1; - fmr->ibmr.lkey = fmr->ibmr.rkey = arbel_hw_index_to_key(key); + fmr->ibfmr.lkey = fmr->ibfmr.rkey = arbel_hw_index_to_key(key); fmr->maps = 0; @@ -967,3 +967,4 @@ void mthca_cleanup_mr_table(struct mthca_dev *dev) mthca_alloc_cleanup(&dev->mr_table.mpt_alloc); } + diff --git a/trunk/hw/mthca/kernel/mthca_provider.c b/trunk/hw/mthca/kernel/mthca_provider.c index c8d00199..90979cd8 100644 --- a/trunk/hw/mthca/kernel/mthca_provider.c +++ b/trunk/hw/mthca/kernel/mthca_provider.c @@ -427,7 +427,7 @@ err_nomem: int mthca_dealloc_ucontext(struct ib_ucontext *context) { - struct mthca_ucontext *mucontext = to_mucontext(context); + struct mthca_ucontext *mucontext = to_mucontext(context); if (mthca_is_livefish(to_mdev(context->device))) goto done; @@ -1156,7 +1156,7 @@ static struct ib_fmr *mthca_alloc_fmr(struct ib_pd *pd, mthca_qp_access_t acc, return ERR_PTR(err); } - return &fmr->ibmr; + return &fmr->ibfmr; } static int mthca_dealloc_fmr(struct ib_fmr *fmr) diff --git a/trunk/hw/mthca/kernel/mthca_provider.h b/trunk/hw/mthca/kernel/mthca_provider.h index d24e0e43..7395f0fe 100644 --- a/trunk/hw/mthca/kernel/mthca_provider.h +++ b/trunk/hw/mthca/kernel/mthca_provider.h @@ -83,7 +83,7 @@ struct mthca_mr { }; struct mthca_fmr { - struct ib_fmr ibmr; + struct ib_fmr ibfmr; struct ib_fmr_attr attr; struct mthca_mtt *mtt; int maps; @@ -296,9 +296,9 @@ static inline struct mthca_ucontext *to_mucontext(struct ib_ucontext *ibucontext return container_of(ibucontext, struct mthca_ucontext, ibucontext); } -static inline struct mthca_fmr *to_mfmr(struct ib_fmr *ibmr) +static inline struct mthca_fmr *to_mfmr(struct ib_fmr *ibfmr) { - return container_of(ibmr, struct mthca_fmr, ibmr); + return container_of(ibfmr, struct mthca_fmr, ibfmr); } static inline struct mthca_mr *to_mmr(struct ib_mr *ibmr) diff --git a/trunk/inc/iba/ib_al.h b/trunk/inc/iba/ib_al.h index a63ecb61..0fb3354f 100644 --- a/trunk/inc/iba/ib_al.h +++ b/trunk/inc/iba/ib_al.h @@ -36,7 +36,7 @@ #include #include - +#include #ifdef __cplusplus extern "C" @@ -71,7 +71,7 @@ typedef struct _al_ioc* __ptr64 ib_ioc_handle_t; typedef struct _al_svc_entry* __ptr64 ib_svc_handle_t; typedef struct _al_pool_key* __ptr64 ib_pool_key_t; typedef struct _al_pool* __ptr64 ib_pool_handle_t; - +typedef struct _mlnx_fmr_pool_element* __ptr64 mlnx_fmr_pool_el_t; typedef struct _ib_cm_handle { @@ -2850,6 +2850,155 @@ mlnx_destroy_fmr( * mlnx_destroy_fmr, mlnx_fmr_create_t *****/ + +/****f* Access Layer/ib_create_fmr_pool +* NAME +* ib_create_fmr_pool +* +* DESCRIPTION +* Creates a pool of FMR elements for use +* +* SYNOPSIS +*/ +AL_EXPORT ib_api_status_t AL_API +mlnx_create_fmr_pool( + IN const ib_pd_handle_t h_pd, + IN const mlnx_fmr_pool_create_t *p_fmr_pool_attr, + OUT mlnx_fmr_pool_handle_t* const ph_pool ); +/* +* PARAMETERS +TODO +* +* RETURN VALUES +TODO +* +* NOTES +TODO +* +* SEE ALSO +TOD +*****/ + + +/****f* Access Layer/ib_destroy_fmr_pool +* NAME +* ib_destroy_fmr_pool +* +* DESCRIPTION +* Destroys a MAD pool and all associated resources. +* +* SYNOPSIS +*/ +AL_EXPORT ib_api_status_t AL_API +mlnx_destroy_fmr_pool( + IN const mlnx_fmr_pool_handle_t h_pool ); +/* +* PARAMETERS +TODO +* +* RETURN VALUES +TODO +* +* NOTES +TODO +* +* SEE ALSO +TODO +*****/ + + + + + + + +/****f* Access Layer/ib_fmr_pool_map_phys +* NAME +* ib_destroy_fmr_pool +* +* DESCRIPTION +* Destroys a MAD pool and all associated resources. +* +* SYNOPSIS +*/ +AL_EXPORT ib_api_status_t AL_API +mlnx_map_phys_fmr_pool( + IN const mlnx_fmr_pool_handle_t h_pool , + IN const uint64_t* const paddr_list, + IN const int list_len, + IN OUT uint64_t* const p_vaddr, + OUT net32_t* const p_lkey, + OUT net32_t* const p_rkey, + OUT mlnx_fmr_pool_el_t *pp_fmr_el); +/* +* PARAMETERS +TODO +* +* RETURN VALUES +TODO +* +* NOTES +TODO +* +* SEE ALSO +TODO +*****/ + + + + + +/****f* Access Layer/ib_destroy_fmr_pool +* NAME +* ib_destroy_fmr_pool +* +* DESCRIPTION +* Destroys a MAD pool and all associated resources. +* +* SYNOPSIS +*/ +AL_EXPORT ib_api_status_t AL_API +mlnx_unmap_fmr_pool( + IN mlnx_fmr_pool_el_t p_fmr_el ); +/* +* PARAMETERS +TODO +* +* RETURN VALUES +TODO +* +* NOTES +TODO +* +* SEE ALSO +TODO +*****/ + + +/****f* Access Layer/ib_flush_fmr_pool +* NAME +* ib_flush_fmr_pool +* +* DESCRIPTION +* Destroys a MAD pool and all associated resources. +* +* SYNOPSIS +*/ +ib_api_status_t +mlnx_flush_fmr_pool(mlnx_fmr_pool_handle_t h_pool); +/* +* PARAMETERS +TODO +* +* RETURN VALUES +TODO +* +* NOTES +TODO +* +* SEE ALSO +TODO +*****/ #endif /* CL_KERNEL */ /****f* Access Layer/ib_create_mw diff --git a/trunk/inc/iba/ib_ci.h b/trunk/inc/iba/ib_ci.h index 710f67d3..8e7b2057 100644 --- a/trunk/inc/iba/ib_ci.h +++ b/trunk/inc/iba/ib_ci.h @@ -1870,7 +1870,7 @@ typedef ib_api_status_t */ typedef ib_api_status_t (*ci_unmap_mlnx_fmr) ( - IN const mlnx_fmr_handle_t h_fmr); + IN const mlnx_fmr_handle_t *ph_fmr); /* * DESCRIPTION * //TODO diff --git a/trunk/inc/iba/ib_types.h b/trunk/inc/iba/ib_types.h index 51ed6401..e84252b1 100644 --- a/trunk/inc/iba/ib_types.h +++ b/trunk/inc/iba/ib_types.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2005 SilverStorm Technologies. All rights reserved. * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under the OpenIB.org BSD license @@ -702,7 +702,7 @@ ib_class_is_rmpp( /* * MAD methods */ - + /****d* IBA Base: Constants/IB_MAX_METHOD * NAME * IB_MAX_METHOD @@ -714,7 +714,7 @@ ib_class_is_rmpp( */ #define IB_MAX_METHODS 128 /**********/ - + /****d* IBA Base: Constants/IB_MAD_METHOD_RESP_MASK * NAME * IB_MAD_METHOD_RESP_MASK @@ -726,7 +726,7 @@ ib_class_is_rmpp( */ #define IB_MAD_METHOD_RESP_MASK 0x80 /**********/ - + /****d* IBA Base: Constants/IB_MAD_METHOD_GET * NAME * IB_MAD_METHOD_GET @@ -738,7 +738,7 @@ ib_class_is_rmpp( */ #define IB_MAD_METHOD_GET 0x01 /**********/ - + /****d* IBA Base: Constants/IB_MAD_METHOD_SET * NAME * IB_MAD_METHOD_SET @@ -750,7 +750,7 @@ ib_class_is_rmpp( */ #define IB_MAD_METHOD_SET 0x02 /**********/ - + /****d* IBA Base: Constants/IB_MAD_METHOD_GET_RESP * NAME * IB_MAD_METHOD_GET_RESP @@ -776,7 +776,7 @@ ib_class_is_rmpp( */ #define IB_MAD_METHOD_GETTABLE 0x12 /**********/ - + /****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE_RESP * NAME * IB_MAD_METHOD_GETTABLE_RESP @@ -806,7 +806,7 @@ ib_class_is_rmpp( */ #define IB_MAD_METHOD_SEND 0x03 /**********/ - + /****d* IBA Base: Constants/IB_MAD_METHOD_TRAP * NAME * IB_MAD_METHOD_TRAP @@ -818,7 +818,7 @@ ib_class_is_rmpp( */ #define IB_MAD_METHOD_TRAP 0x05 /**********/ - + /****d* IBA Base: Constants/IB_MAD_METHOD_REPORT * NAME * IB_MAD_METHOD_REPORT @@ -830,7 +830,7 @@ ib_class_is_rmpp( */ #define IB_MAD_METHOD_REPORT 0x06 /**********/ - + /****d* IBA Base: Constants/IB_MAD_METHOD_REPORT_RESP * NAME * IB_MAD_METHOD_REPORT_RESP @@ -842,7 +842,7 @@ ib_class_is_rmpp( */ #define IB_MAD_METHOD_REPORT_RESP 0x86 /**********/ - + /****d* IBA Base: Constants/IB_MAD_METHOD_TRAP_REPRESS * NAME * IB_MAD_METHOD_TRAP_REPRESS @@ -854,7 +854,7 @@ ib_class_is_rmpp( */ #define IB_MAD_METHOD_TRAP_REPRESS 0x07 /**********/ - + /****d* IBA Base: Constants/IB_MAD_STATUS_BUSY * NAME * IB_MAD_STATUS_BUSY @@ -866,7 +866,7 @@ ib_class_is_rmpp( */ #define IB_MAD_STATUS_BUSY (CL_HTON16(0x0001)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_STATUS_REDIRECT * NAME * IB_MAD_STATUS_REDIRECT @@ -878,7 +878,7 @@ ib_class_is_rmpp( */ #define IB_MAD_STATUS_REDIRECT (CL_HTON16(0x0002)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_CLASS_VER * NAME * IB_MAD_STATUS_UNSUP_CLASS_VER @@ -890,7 +890,7 @@ ib_class_is_rmpp( */ #define IB_MAD_STATUS_UNSUP_CLASS_VER (CL_HTON16(0x0004)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD * NAME * IB_MAD_STATUS_UNSUP_METHOD @@ -902,7 +902,7 @@ ib_class_is_rmpp( */ #define IB_MAD_STATUS_UNSUP_METHOD (CL_HTON16(0x0008)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD_ATTR * NAME * IB_MAD_STATUS_UNSUP_METHOD_ATTR @@ -914,7 +914,7 @@ ib_class_is_rmpp( */ #define IB_MAD_STATUS_UNSUP_METHOD_ATTR (CL_HTON16(0x000C)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_STATUS_INVALID_FIELD * NAME * IB_MAD_STATUS_INVALID_FIELD @@ -952,7 +952,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_CLASS_PORT_INFO (CL_NTOH16(0x0001)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_NOTICE * NAME * IB_MAD_ATTR_NOTICE @@ -964,7 +964,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_NOTICE (CL_NTOH16(0x0002)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO * NAME * IB_MAD_ATTR_INFORM_INFO @@ -976,7 +976,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_INFORM_INFO (CL_NTOH16(0x0003)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_NODE_DESC * NAME * IB_MAD_ATTR_NODE_DESC @@ -987,7 +987,7 @@ ib_class_is_rmpp( * SOURCE */ #define IB_MAD_ATTR_NODE_DESC (CL_NTOH16(0x0010)) - + /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_CTRL * NAME * IB_MAD_ATTR_PORT_SMPL_CTRL @@ -999,7 +999,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_PORT_SMPL_CTRL (CL_NTOH16(0x0010)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_NODE_INFO * NAME * IB_MAD_ATTR_NODE_INFO @@ -1011,7 +1011,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_NODE_INFO (CL_NTOH16(0x0011)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_RSLT * NAME * IB_MAD_ATTR_PORT_SMPL_RSLT @@ -1023,7 +1023,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_PORT_SMPL_RSLT (CL_NTOH16(0x0011)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO * NAME * IB_MAD_ATTR_SWITCH_INFO @@ -1035,7 +1035,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_SWITCH_INFO (CL_NTOH16(0x0012)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS * NAME * IB_MAD_ATTR_PORT_CNTRS @@ -1047,7 +1047,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_PORT_CNTRS (CL_NTOH16(0x0012)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO * NAME * IB_MAD_ATTR_GUID_INFO @@ -1059,7 +1059,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_GUID_INFO (CL_NTOH16(0x0014)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_INFO * NAME * IB_MAD_ATTR_PORT_INFO @@ -1071,7 +1071,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_PORT_INFO (CL_NTOH16(0x0015)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_P_KEY_TABLE * NAME * IB_MAD_ATTR_P_KEY_TABLE @@ -1083,7 +1083,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_P_KEY_TABLE (CL_NTOH16(0x0016)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_TABLE * NAME * IB_MAD_ATTR_SLVL_TABLE @@ -1095,7 +1095,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_SLVL_TABLE (CL_NTOH16(0x0017)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_VL_ARBITRATION * NAME * IB_MAD_ATTR_VL_ARBITRATION @@ -1107,7 +1107,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_VL_ARBITRATION (CL_NTOH16(0x0018)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_LIN_FWD_TBL * NAME * IB_MAD_ATTR_LIN_FWD_TBL @@ -1119,7 +1119,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_LIN_FWD_TBL (CL_NTOH16(0x0019)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_RND_FWD_TBL * NAME * IB_MAD_ATTR_RND_FWD_TBL @@ -1131,7 +1131,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_RND_FWD_TBL (CL_NTOH16(0x001A)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_MCAST_FWD_TBL * NAME * IB_MAD_ATTR_MCAST_FWD_TBL @@ -1155,7 +1155,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_NODE_RECORD (CL_NTOH16(0x0011)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_PORTINFO_RECORD * NAME * IB_MAD_ATTR_PORTINFO_RECORD @@ -1168,17 +1168,17 @@ ib_class_is_rmpp( #define IB_MAD_ATTR_PORTINFO_RECORD (CL_NTOH16(0x0012)) /**********/ -/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO_RECORD -* NAME -* IB_MAD_ATTR_SWITCH_INFO_RECORD -* -* DESCRIPTION -* SwitchInfoRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SWITCH_INFO_RECORD (CL_NTOH16(0x0014)) -/**********/ +/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO_RECORD +* NAME +* IB_MAD_ATTR_SWITCH_INFO_RECORD +* +* DESCRIPTION +* SwitchInfoRecord attribute (15.2.5) +* +* SOURCE +*/ +#define IB_MAD_ATTR_SWITCH_INFO_RECORD (CL_NTOH16(0x0014)) +/**********/ /****d* IBA Base: Constants/IB_MAD_ATTR_LINK_RECORD * NAME @@ -1209,7 +1209,7 @@ ib_class_is_rmpp( * IB_MAD_ATTR_SMINFO_RECORD * * DESCRIPTION -* SMInfoRecord attribute (15.2.5) +* SMInfoRecord attribute (15.2.5) * * SOURCE */ @@ -1239,7 +1239,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_VENDOR_DIAG (CL_NTOH16(0x0030)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_LED_INFO * NAME * IB_MAD_ATTR_LED_INFO @@ -1251,7 +1251,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_LED_INFO (CL_NTOH16(0x0031)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD * NAME * IB_MAD_ATTR_SERVICE_RECORD @@ -1263,7 +1263,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_SERVICE_RECORD (CL_NTOH16(0x0031)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_LFT_RECORD * NAME * IB_MAD_ATTR_LFT_RECORD @@ -1275,19 +1275,19 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_LFT_RECORD (CL_NTOH16(0x0015)) /**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_MFT_RECORD -* NAME -* IB_MAD_ATTR_MFT_RECORD -* -* DESCRIPTION -* MulticastForwardingTableRecord attribute (15.2.5.8) -* -* SOURCE -*/ -#define IB_MAD_ATTR_MFT_RECORD (CL_NTOH16(0x0017)) -/**********/ - + +/****d* IBA Base: Constants/IB_MAD_ATTR_MFT_RECORD +* NAME +* IB_MAD_ATTR_MFT_RECORD +* +* DESCRIPTION +* MulticastForwardingTableRecord attribute (15.2.5.8) +* +* SOURCE +*/ +#define IB_MAD_ATTR_MFT_RECORD (CL_NTOH16(0x0017)) +/**********/ + /****d* IBA Base: Constants/IB_MAD_ATTR_PKEYTBL_RECORD * NAME * IB_MAD_ATTR_PKEYTBL_RECORD @@ -1299,7 +1299,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_PKEY_TBL_RECORD (CL_NTOH16(0x0033)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_PATH_RECORD * NAME * IB_MAD_ATTR_PATH_RECORD @@ -1311,7 +1311,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_PATH_RECORD (CL_NTOH16(0x0035)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_VLARB_RECORD * NAME * IB_MAD_ATTR_VLARB_RECORD @@ -1323,7 +1323,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_VLARB_RECORD (CL_NTOH16(0x0036)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_RECORD * NAME * IB_MAD_ATTR_SLVL_RECORD @@ -1335,7 +1335,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_SLVL_RECORD (CL_NTOH16(0x0013)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_MCMEMBER_RECORD * NAME * IB_MAD_ATTR_MCMEMBER_RECORD @@ -1347,10 +1347,10 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_MCMEMBER_RECORD (CL_NTOH16(0x0038)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_TRACE_RECORD * NAME -* IB_MAD_ATTR_TRACE_RECORD +* IB_MAD_ATTR_TRACE_RECORD * * DESCRIPTION * TraceRecord attribute (15.2.5) @@ -1359,7 +1359,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_TRACE_RECORD (CL_NTOH16(0x0039)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_MULTIPATH_RECORD * NAME * IB_MAD_ATTR_MULTIPATH_RECORD @@ -1406,19 +1406,19 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_IO_UNIT_INFO (CL_NTOH16(0x0010)) /**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_IO_CONTROLLER_PROFILE + +/****d* IBA Base: Constants/IB_MAD_ATTR_IO_CONTROLLER_PROFILE * NAME -* IB_MAD_ATTR_IO_CONTROLLER_PROFILE +* IB_MAD_ATTR_IO_CONTROLLER_PROFILE * * DESCRIPTION * IOControllerProfile attribute (16.3.3) * * SOURCE */ -#define IB_MAD_ATTR_IO_CONTROLLER_PROFILE (CL_NTOH16(0x0011)) +#define IB_MAD_ATTR_IO_CONTROLLER_PROFILE (CL_NTOH16(0x0011)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_ENTRIES * NAME * IB_MAD_ATTR_SERVICE_ENTRIES @@ -1430,7 +1430,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_SERVICE_ENTRIES (CL_NTOH16(0x0012)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT * NAME * IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT @@ -1442,7 +1442,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT (CL_NTOH16(0x0020)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_PREPARE_TO_TEST * NAME * IB_MAD_ATTR_PREPARE_TO_TEST @@ -1454,7 +1454,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_PREPARE_TO_TEST (CL_NTOH16(0x0021)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_ONCE * NAME * IB_MAD_ATTR_TEST_DEVICE_ONCE @@ -1466,7 +1466,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_TEST_DEVICE_ONCE (CL_NTOH16(0x0022)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_LOOP * NAME * IB_MAD_ATTR_TEST_DEVICE_LOOP @@ -1478,7 +1478,7 @@ ib_class_is_rmpp( */ #define IB_MAD_ATTR_TEST_DEVICE_LOOP (CL_NTOH16(0x0023)) /**********/ - + /****d* IBA Base: Constants/IB_MAD_ATTR_DIAG_CODE * NAME * IB_MAD_ATTR_DIAG_CODE @@ -1502,7 +1502,7 @@ ib_class_is_rmpp( */ #define IB_NODE_TYPE_CA 0x01 /**********/ - + /****d* IBA Base: Constants/IB_NODE_TYPE_SWITCH * NAME * IB_NODE_TYPE_SWITCH @@ -1514,7 +1514,7 @@ ib_class_is_rmpp( */ #define IB_NODE_TYPE_SWITCH 0x02 /**********/ - + /****d* IBA Base: Constants/IB_NODE_TYPE_ROUTER * NAME * IB_NODE_TYPE_ROUTER @@ -1538,7 +1538,7 @@ ib_class_is_rmpp( */ #define IB_NOTICE_NODE_TYPE_CA (CL_NTOH32(0x000001)) /**********/ - + /****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_SWITCH * NAME * IB_NOTICE_NODE_TYPE_SWITCH @@ -1550,7 +1550,7 @@ ib_class_is_rmpp( */ #define IB_NOTICE_NODE_TYPE_SWITCH (CL_NTOH32(0x000002)) /**********/ - + /****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_ROUTER * NAME * IB_NOTICE_NODE_TYPE_ROUTER @@ -1562,7 +1562,7 @@ ib_class_is_rmpp( */ #define IB_NOTICE_NODE_TYPE_ROUTER (CL_NTOH32(0x000003)) /**********/ - + /****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_SUBN_MGMT * NAME * IB_NOTICE_NODE_TYPE_SUBN_MGMT @@ -1577,9 +1577,9 @@ ib_class_is_rmpp( #define IB_NOTICE_NODE_TYPE_SUBN_MGMT (CL_NTOH32(0x000004)) /**********/ -/****d* IBA Base: Constants/IB_MTU_LEN_TYPE +/****d* IBA Base: Constants/IB_MTU_LEN_TYPE * NAME -* IB_MTU_LEN_TYPE +* IB_MTU_LEN_TYPE * * DESCRIPTION * Encoded path MTU. @@ -1592,15 +1592,15 @@ ib_class_is_rmpp( * * SOURCE */ -#define IB_MTU_LEN_256 1 -#define IB_MTU_LEN_512 2 -#define IB_MTU_LEN_1024 3 -#define IB_MTU_LEN_2048 4 -#define IB_MTU_LEN_4096 5 - -#define IB_MIN_MTU IB_MTU_LEN_256 -#define IB_MAX_MTU IB_MTU_LEN_4096 - +#define IB_MTU_LEN_256 1 +#define IB_MTU_LEN_512 2 +#define IB_MTU_LEN_1024 3 +#define IB_MTU_LEN_2048 4 +#define IB_MTU_LEN_4096 5 + +#define IB_MIN_MTU IB_MTU_LEN_256 +#define IB_MAX_MTU IB_MTU_LEN_4096 + /**********/ /****d* IBA Base: Constants/IB_PATH_SELECTOR_TYPE @@ -1633,7 +1633,7 @@ ib_class_is_rmpp( */ #define IB_SMINFO_STATE_NOTACTIVE 0 /**********/ - + /****d* IBA Base: Constants/IB_SMINFO_STATE_DISCOVERING * NAME * IB_SMINFO_STATE_DISCOVERING @@ -1645,7 +1645,7 @@ ib_class_is_rmpp( */ #define IB_SMINFO_STATE_DISCOVERING 1 /**********/ - + /****d* IBA Base: Constants/IB_SMINFO_STATE_STANDBY * NAME * IB_SMINFO_STATE_STANDBY @@ -1657,7 +1657,7 @@ ib_class_is_rmpp( */ #define IB_SMINFO_STATE_STANDBY 2 /**********/ - + /****d* IBA Base: Constants/IB_SMINFO_STATE_MASTER * NAME * IB_SMINFO_STATE_MASTER @@ -1669,7 +1669,7 @@ ib_class_is_rmpp( */ #define IB_SMINFO_STATE_MASTER 3 /**********/ - + /****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK * NAME * IB_PATH_REC_SELECTOR_MASK @@ -1681,20 +1681,20 @@ ib_class_is_rmpp( * SOURCE */ #define IB_PATH_REC_SELECTOR_MASK 0xC0 - -/****d* IBA Base: Constants/IB_MULTIPATH_REC_SELECTOR_MASK -* NAME -* IB_MULTIPATH_REC_SELECTOR_MASK -* -* DESCRIPTION -* Mask for the selector field for multipath record MTU, rate, -* and packet lifetime. -* -* SOURCE -*/ -#define IB_MULTIPATH_REC_SELECTOR_MASK 0xC0 + +/****d* IBA Base: Constants/IB_MULTIPATH_REC_SELECTOR_MASK +* NAME +* IB_MULTIPATH_REC_SELECTOR_MASK +* +* DESCRIPTION +* Mask for the selector field for multipath record MTU, rate, +* and packet lifetime. +* +* SOURCE +*/ +#define IB_MULTIPATH_REC_SELECTOR_MASK 0xC0 /**********/ - + /****d* IBA Base: Constants/IB_PATH_REC_BASE_MASK * NAME * IB_PATH_REC_BASE_MASK @@ -1729,7 +1729,7 @@ ib_class_is_rmpp( * Definitions are from the InfiniBand Architecture Specification v1.2 * *********/ - + /****d* IBA Base: Types/ib_net16_t * NAME * ib_net16_t @@ -1741,7 +1741,7 @@ ib_class_is_rmpp( */ typedef uint16_t ib_net16_t; /**********/ - + /****d* IBA Base: Types/ib_net32_t * NAME * ib_net32_t @@ -1753,7 +1753,7 @@ typedef uint16_t ib_net16_t; */ typedef uint32_t ib_net32_t; /**********/ - + /****d* IBA Base: Types/ib_net64_t * NAME * ib_net64_t @@ -1765,7 +1765,7 @@ typedef uint32_t ib_net32_t; */ typedef uint64_t ib_net64_t; /**********/ - + /****d* IBA Base: Types/ib_gid_prefix_t * NAME * ib_gid_prefix_t @@ -1958,7 +1958,7 @@ ib_pkey_get_base( * * SEE ALSO *********/ - + /****f* IBA Base: Types/ib_pkey_is_full_member * NAME * ib_pkey_is_full_member @@ -2006,7 +2006,7 @@ ib_pkey_is_invalid( { if (ib_pkey_get_base(pkey) == 0x0000) return TRUE; - + return FALSE; } /* @@ -2064,15 +2064,15 @@ typedef union _ib_gid * * SEE ALSO *********/ - -/****f* IBA Base: Types/ib_gid_is_multicast -* NAME -* ib_gid_is_multicast -* -* DESCRIPTION -* Returns a boolean indicating whether a GID is a multicast GID. -* -* SYNOPSIS + +/****f* IBA Base: Types/ib_gid_is_multicast +* NAME +* ib_gid_is_multicast +* +* DESCRIPTION +* Returns a boolean indicating whether a GID is a multicast GID. +* +* SYNOPSIS */ AL_INLINE boolean_t AL_API ib_gid_is_multicast( @@ -2081,40 +2081,40 @@ ib_gid_is_multicast( return( p_gid->raw[0] == 0xFF ); } -/****f* IBA Base: Types/ib_gid_get_scope -* NAME -* ib_gid_get_scope -* -* DESCRIPTION -* Returns scope of (assumed) multicast GID. -* -* SYNOPSIS -*/ +/****f* IBA Base: Types/ib_gid_get_scope +* NAME +* ib_gid_get_scope +* +* DESCRIPTION +* Returns scope of (assumed) multicast GID. +* +* SYNOPSIS +*/ AL_INLINE uint8_t AL_API -ib_mgid_get_scope( - IN const ib_gid_t* p_gid ) -{ - return( p_gid->raw[1] & 0x0F ); -} - -/****f* IBA Base: Types/ib_gid_set_scope -* NAME -* ib_gid_set_scope -* -* DESCRIPTION -* Sets scope of (assumed) multicast GID. -* -* SYNOPSIS -*/ +ib_mgid_get_scope( + IN const ib_gid_t* p_gid ) +{ + return( p_gid->raw[1] & 0x0F ); +} + +/****f* IBA Base: Types/ib_gid_set_scope +* NAME +* ib_gid_set_scope +* +* DESCRIPTION +* Sets scope of (assumed) multicast GID. +* +* SYNOPSIS +*/ AL_INLINE void AL_API -ib_mgid_set_scope( - IN ib_gid_t* const p_gid, - IN const uint8_t scope ) -{ - p_gid->raw[1] &= 0xF0; - p_gid->raw[1] |= scope & 0x0F; -} - +ib_mgid_set_scope( + IN ib_gid_t* const p_gid, + IN const uint8_t scope ) +{ + p_gid->raw[1] &= 0xF0; + p_gid->raw[1] |= scope & 0x0F; +} + /****f* IBA Base: Types/ib_gid_set_default * NAME * ib_gid_set_default @@ -2148,7 +2148,7 @@ ib_gid_set_default( * SEE ALSO * ib_gid_t *********/ - + /****f* IBA Base: Types/ib_gid_get_subnet_prefix * NAME * ib_gid_get_subnet_prefix @@ -2177,7 +2177,7 @@ ib_gid_get_subnet_prefix( * SEE ALSO * ib_gid_t *********/ - + /****f* IBA Base: Types/ib_gid_is_link_local * NAME * ib_gid_is_link_local @@ -2208,7 +2208,7 @@ ib_gid_is_link_local( * SEE ALSO * ib_gid_t *********/ - + /****f* IBA Base: Types/ib_gid_is_site_local * NAME * ib_gid_is_site_local @@ -2232,7 +2232,7 @@ ib_gid_is_site_local( * [in] Pointer to the GID object. * * RETURN VALUES -* Returns TRUE if the unicast GID scoping indicates site local, +* Returns TRUE if the unicast GID scoping indicates site local, * FALSE otherwise. * * NOTES @@ -2240,7 +2240,7 @@ ib_gid_is_site_local( * SEE ALSO * ib_gid_t *********/ - + /****f* IBA Base: Types/ib_gid_get_guid * NAME * ib_gid_get_guid @@ -2354,8 +2354,8 @@ typedef __declspec(align(8)) struct _ib_path_rec * Another global routing parameter. * * num_path -* Reversible path - 1 bit to say if path is reversible. -* num_path [6:0] In queries, maximum number of paths to return. +* Reversible path - 1 bit to say if path is reversible. +* num_path [6:0] In queries, maximum number of paths to return. * In responses, undefined. * * pkey @@ -2388,27 +2388,27 @@ typedef __declspec(align(8)) struct _ib_path_rec * SEE ALSO *********/ -/* Path Record Component Masks */ -#define IB_PR_COMPMASK_DGID (CL_HTON64(((uint64_t)1)<<2)) -#define IB_PR_COMPMASK_SGID (CL_HTON64(((uint64_t)1)<<3)) -#define IB_PR_COMPMASK_DLID (CL_HTON64(((uint64_t)1)<<4)) -#define IB_PR_COMPMASK_SLID (CL_HTON64(((uint64_t)1)<<5)) -#define IB_PR_COMPMASK_RAWTRAFFIC (CL_HTON64(((uint64_t)1)<<6)) -#define IB_PR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<7)) -#define IB_PR_COMPMASK_FLOWLABEL (CL_HTON64(((uint64_t)1)<<8)) -#define IB_PR_COMPMASK_HOPLIMIT (CL_HTON64(((uint64_t)1)<<9)) -#define IB_PR_COMPMASK_TCLASS (CL_HTON64(((uint64_t)1)<<10)) -#define IB_PR_COMPMASK_REVERSIBLE (CL_HTON64(((uint64_t)1)<<11)) +/* Path Record Component Masks */ +#define IB_PR_COMPMASK_DGID (CL_HTON64(((uint64_t)1)<<2)) +#define IB_PR_COMPMASK_SGID (CL_HTON64(((uint64_t)1)<<3)) +#define IB_PR_COMPMASK_DLID (CL_HTON64(((uint64_t)1)<<4)) +#define IB_PR_COMPMASK_SLID (CL_HTON64(((uint64_t)1)<<5)) +#define IB_PR_COMPMASK_RAWTRAFFIC (CL_HTON64(((uint64_t)1)<<6)) +#define IB_PR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<7)) +#define IB_PR_COMPMASK_FLOWLABEL (CL_HTON64(((uint64_t)1)<<8)) +#define IB_PR_COMPMASK_HOPLIMIT (CL_HTON64(((uint64_t)1)<<9)) +#define IB_PR_COMPMASK_TCLASS (CL_HTON64(((uint64_t)1)<<10)) +#define IB_PR_COMPMASK_REVERSIBLE (CL_HTON64(((uint64_t)1)<<11)) #define IB_PR_COMPMASK_NUM_PATH (CL_HTON64(((uint64_t)1)<<12)) -#define IB_PR_COMPMASK_PKEY (CL_HTON64(((uint64_t)1)<<13)) -#define IB_PR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<14)) -#define IB_PR_COMPMASK_SL (CL_HTON64(((uint64_t)1)<<15)) -#define IB_PR_COMPMASK_MTUSELEC (CL_HTON64(((uint64_t)1)<<16)) -#define IB_PR_COMPMASK_MTU (CL_HTON64(((uint64_t)1)<<17)) -#define IB_PR_COMPMASK_RATESELEC (CL_HTON64(((uint64_t)1)<<18)) -#define IB_PR_COMPMASK_RATE (CL_HTON64(((uint64_t)1)<<19)) -#define IB_PR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<20)) -#define IB_PR_COMPMASK_PKTLIFETIME (CL_HTON64(((uint64_t)1)<<21)) +#define IB_PR_COMPMASK_PKEY (CL_HTON64(((uint64_t)1)<<13)) +#define IB_PR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<14)) +#define IB_PR_COMPMASK_SL (CL_HTON64(((uint64_t)1)<<15)) +#define IB_PR_COMPMASK_MTUSELEC (CL_HTON64(((uint64_t)1)<<16)) +#define IB_PR_COMPMASK_MTU (CL_HTON64(((uint64_t)1)<<17)) +#define IB_PR_COMPMASK_RATESELEC (CL_HTON64(((uint64_t)1)<<18)) +#define IB_PR_COMPMASK_RATE (CL_HTON64(((uint64_t)1)<<19)) +#define IB_PR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<20)) +#define IB_PR_COMPMASK_PKTLIFETIME (CL_HTON64(((uint64_t)1)<<21)) /* Link Record Component Masks */ #define IB_LR_COMPMASK_FROM_LID (CL_HTON64(((uint64_t)1)<<0)) @@ -2416,7 +2416,7 @@ typedef __declspec(align(8)) struct _ib_path_rec #define IB_LR_COMPMASK_TO_PORT (CL_HTON64(((uint64_t)1)<<2)) #define IB_LR_COMPMASK_TO_LID (CL_HTON64(((uint64_t)1)<<3)) -/* VL Arbitration Record Masks */ +/* VL Arbitration Record Masks */ #define IB_VLA_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) #define IB_VLA_COMPMASK_OUT_PORT (CL_HTON64(((uint64_t)1)<<1)) #define IB_VLA_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<2)) @@ -2431,21 +2431,21 @@ typedef __declspec(align(8)) struct _ib_path_rec #define IB_PKEY_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<1)) #define IB_PKEY_COMPMASK_PORT (CL_HTON64(((uint64_t)1)<<2)) -/* Switch Info Record Masks */ -#define IB_SWIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_SWIR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<1)) - -/* LFT Record Masks */ +/* Switch Info Record Masks */ +#define IB_SWIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) +#define IB_SWIR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<1)) + +/* LFT Record Masks */ #define IB_LFTR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) #define IB_LFTR_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<1)) -/* MFT Record Masks */ -#define IB_MFTR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_MFTR_COMPMASK_POSITION (CL_HTON64(((uint64_t)1)<<1)) -#define IB_MFTR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<2)) -#define IB_MFTR_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<3)) -#define IB_MFTR_COMPMASK_RESERVED2 (CL_HTON64(((uint64_t)1)<<4)) - +/* MFT Record Masks */ +#define IB_MFTR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) +#define IB_MFTR_COMPMASK_POSITION (CL_HTON64(((uint64_t)1)<<1)) +#define IB_MFTR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<2)) +#define IB_MFTR_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<3)) +#define IB_MFTR_COMPMASK_RESERVED2 (CL_HTON64(((uint64_t)1)<<4)) + /* NodeInfo Record Masks */ #define IB_NR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) #define IB_NR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<1)) @@ -2501,58 +2501,58 @@ typedef __declspec(align(8)) struct _ib_path_rec #define IB_SR_COMPMASK_SDATA32_3 (CL_HTON64(((uint64_t)1)<<34)) #define IB_SR_COMPMASK_SDATA64_0 (CL_HTON64(((uint64_t)1)<<35)) #define IB_SR_COMPMASK_SDATA64_1 (CL_HTON64(((uint64_t)1)<<36)) - + /* Port Info Record Component Masks */ -#define IB_PIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_PIR_COMPMASK_PORTNUM (CL_HTON64(((uint64_t)1)<<1)) -#define IB_PIR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<2)) -#define IB_PIR_COMPMASK_MKEY (CL_HTON64(((uint64_t)1)<<3)) -#define IB_PIR_COMPMASK_GIDPRE (CL_HTON64(((uint64_t)1)<<4)) -#define IB_PIR_COMPMASK_BASELID (CL_HTON64(((uint64_t)1)<<5)) -#define IB_PIR_COMPMASK_SMLID (CL_HTON64(((uint64_t)1)<<6)) -#define IB_PIR_COMPMASK_CAPMASK (CL_HTON64(((uint64_t)1)<<7)) -#define IB_PIR_COMPMASK_DIAGCODE (CL_HTON64(((uint64_t)1)<<8)) -#define IB_PIR_COMPMASK_MKEYLEASEPRD (CL_HTON64(((uint64_t)1)<<9)) -#define IB_PIR_COMPMASK_LOCALPORTNUM (CL_HTON64(((uint64_t)1)<<10)) -#define IB_PIR_COMPMASK_LINKWIDTHENABLED (CL_HTON64(((uint64_t)1)<<11)) -#define IB_PIR_COMPMASK_LNKWIDTHSUPPORT (CL_HTON64(((uint64_t)1)<<12)) -#define IB_PIR_COMPMASK_LNKWIDTHACTIVE (CL_HTON64(((uint64_t)1)<<13)) -#define IB_PIR_COMPMASK_LNKSPEEDSUPPORT (CL_HTON64(((uint64_t)1)<<14)) -#define IB_PIR_COMPMASK_PORTSTATE (CL_HTON64(((uint64_t)1)<<15)) -#define IB_PIR_COMPMASK_PORTPHYSTATE (CL_HTON64(((uint64_t)1)<<16)) -#define IB_PIR_COMPMASK_LINKDWNDFLTSTATE (CL_HTON64(((uint64_t)1)<<17)) -#define IB_PIR_COMPMASK_MKEYPROTBITS (CL_HTON64(((uint64_t)1)<<18)) -#define IB_PIR_COMPMASK_RESV2 (CL_HTON64(((uint64_t)1)<<19)) -#define IB_PIR_COMPMASK_LMC (CL_HTON64(((uint64_t)1)<<20)) -#define IB_PIR_COMPMASK_LINKSPEEDACTIVE (CL_HTON64(((uint64_t)1)<<21)) -#define IB_PIR_COMPMASK_LINKSPEEDENABLE (CL_HTON64(((uint64_t)1)<<22)) -#define IB_PIR_COMPMASK_NEIGHBORMTU (CL_HTON64(((uint64_t)1)<<23)) -#define IB_PIR_COMPMASK_MASTERSMSL (CL_HTON64(((uint64_t)1)<<24)) -#define IB_PIR_COMPMASK_VLCAP (CL_HTON64(((uint64_t)1)<<25)) -#define IB_PIR_COMPMASK_INITTYPE (CL_HTON64(((uint64_t)1)<<26)) -#define IB_PIR_COMPMASK_VLHIGHLIMIT (CL_HTON64(((uint64_t)1)<<27)) -#define IB_PIR_COMPMASK_VLARBHIGHCAP (CL_HTON64(((uint64_t)1)<<28)) -#define IB_PIR_COMPMASK_VLARBLOWCAP (CL_HTON64(((uint64_t)1)<<29)) -#define IB_PIR_COMPMASK_INITTYPEREPLY (CL_HTON64(((uint64_t)1)<<30)) -#define IB_PIR_COMPMASK_MTUCAP (CL_HTON64(((uint64_t)1)<<31)) -#define IB_PIR_COMPMASK_VLSTALLCNT (CL_HTON64(((uint64_t)1)<<32)) -#define IB_PIR_COMPMASK_HOQLIFE (CL_HTON64(((uint64_t)1)<<33)) -#define IB_PIR_COMPMASK_OPVLS (CL_HTON64(((uint64_t)1)<<34)) -#define IB_PIR_COMPMASK_PARENFIN (CL_HTON64(((uint64_t)1)<<35)) -#define IB_PIR_COMPMASK_PARENFOUT (CL_HTON64(((uint64_t)1)<<36)) -#define IB_PIR_COMPMASK_FILTERRAWIN (CL_HTON64(((uint64_t)1)<<37)) -#define IB_PIR_COMPMASK_FILTERRAWOUT (CL_HTON64(((uint64_t)1)<<38)) -#define IB_PIR_COMPMASK_MKEYVIO (CL_HTON64(((uint64_t)1)<<39)) -#define IB_PIR_COMPMASK_PKEYVIO (CL_HTON64(((uint64_t)1)<<40)) -#define IB_PIR_COMPMASK_QKEYVIO (CL_HTON64(((uint64_t)1)<<41)) -#define IB_PIR_COMPMASK_GUIDCAP (CL_HTON64(((uint64_t)1)<<42)) -#define IB_PIR_COMPMASK_RESV3 (CL_HTON64(((uint64_t)1)<<43)) -#define IB_PIR_COMPMASK_SUBNTO (CL_HTON64(((uint64_t)1)<<44)) -#define IB_PIR_COMPMASK_RESV4 (CL_HTON64(((uint64_t)1)<<45)) -#define IB_PIR_COMPMASK_RESPTIME (CL_HTON64(((uint64_t)1)<<46)) -#define IB_PIR_COMPMASK_LOCALPHYERR (CL_HTON64(((uint64_t)1)<<47)) -#define IB_PIR_COMPMASK_OVERRUNERR (CL_HTON64(((uint64_t)1)<<48)) - +#define IB_PIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) +#define IB_PIR_COMPMASK_PORTNUM (CL_HTON64(((uint64_t)1)<<1)) +#define IB_PIR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<2)) +#define IB_PIR_COMPMASK_MKEY (CL_HTON64(((uint64_t)1)<<3)) +#define IB_PIR_COMPMASK_GIDPRE (CL_HTON64(((uint64_t)1)<<4)) +#define IB_PIR_COMPMASK_BASELID (CL_HTON64(((uint64_t)1)<<5)) +#define IB_PIR_COMPMASK_SMLID (CL_HTON64(((uint64_t)1)<<6)) +#define IB_PIR_COMPMASK_CAPMASK (CL_HTON64(((uint64_t)1)<<7)) +#define IB_PIR_COMPMASK_DIAGCODE (CL_HTON64(((uint64_t)1)<<8)) +#define IB_PIR_COMPMASK_MKEYLEASEPRD (CL_HTON64(((uint64_t)1)<<9)) +#define IB_PIR_COMPMASK_LOCALPORTNUM (CL_HTON64(((uint64_t)1)<<10)) +#define IB_PIR_COMPMASK_LINKWIDTHENABLED (CL_HTON64(((uint64_t)1)<<11)) +#define IB_PIR_COMPMASK_LNKWIDTHSUPPORT (CL_HTON64(((uint64_t)1)<<12)) +#define IB_PIR_COMPMASK_LNKWIDTHACTIVE (CL_HTON64(((uint64_t)1)<<13)) +#define IB_PIR_COMPMASK_LNKSPEEDSUPPORT (CL_HTON64(((uint64_t)1)<<14)) +#define IB_PIR_COMPMASK_PORTSTATE (CL_HTON64(((uint64_t)1)<<15)) +#define IB_PIR_COMPMASK_PORTPHYSTATE (CL_HTON64(((uint64_t)1)<<16)) +#define IB_PIR_COMPMASK_LINKDWNDFLTSTATE (CL_HTON64(((uint64_t)1)<<17)) +#define IB_PIR_COMPMASK_MKEYPROTBITS (CL_HTON64(((uint64_t)1)<<18)) +#define IB_PIR_COMPMASK_RESV2 (CL_HTON64(((uint64_t)1)<<19)) +#define IB_PIR_COMPMASK_LMC (CL_HTON64(((uint64_t)1)<<20)) +#define IB_PIR_COMPMASK_LINKSPEEDACTIVE (CL_HTON64(((uint64_t)1)<<21)) +#define IB_PIR_COMPMASK_LINKSPEEDENABLE (CL_HTON64(((uint64_t)1)<<22)) +#define IB_PIR_COMPMASK_NEIGHBORMTU (CL_HTON64(((uint64_t)1)<<23)) +#define IB_PIR_COMPMASK_MASTERSMSL (CL_HTON64(((uint64_t)1)<<24)) +#define IB_PIR_COMPMASK_VLCAP (CL_HTON64(((uint64_t)1)<<25)) +#define IB_PIR_COMPMASK_INITTYPE (CL_HTON64(((uint64_t)1)<<26)) +#define IB_PIR_COMPMASK_VLHIGHLIMIT (CL_HTON64(((uint64_t)1)<<27)) +#define IB_PIR_COMPMASK_VLARBHIGHCAP (CL_HTON64(((uint64_t)1)<<28)) +#define IB_PIR_COMPMASK_VLARBLOWCAP (CL_HTON64(((uint64_t)1)<<29)) +#define IB_PIR_COMPMASK_INITTYPEREPLY (CL_HTON64(((uint64_t)1)<<30)) +#define IB_PIR_COMPMASK_MTUCAP (CL_HTON64(((uint64_t)1)<<31)) +#define IB_PIR_COMPMASK_VLSTALLCNT (CL_HTON64(((uint64_t)1)<<32)) +#define IB_PIR_COMPMASK_HOQLIFE (CL_HTON64(((uint64_t)1)<<33)) +#define IB_PIR_COMPMASK_OPVLS (CL_HTON64(((uint64_t)1)<<34)) +#define IB_PIR_COMPMASK_PARENFIN (CL_HTON64(((uint64_t)1)<<35)) +#define IB_PIR_COMPMASK_PARENFOUT (CL_HTON64(((uint64_t)1)<<36)) +#define IB_PIR_COMPMASK_FILTERRAWIN (CL_HTON64(((uint64_t)1)<<37)) +#define IB_PIR_COMPMASK_FILTERRAWOUT (CL_HTON64(((uint64_t)1)<<38)) +#define IB_PIR_COMPMASK_MKEYVIO (CL_HTON64(((uint64_t)1)<<39)) +#define IB_PIR_COMPMASK_PKEYVIO (CL_HTON64(((uint64_t)1)<<40)) +#define IB_PIR_COMPMASK_QKEYVIO (CL_HTON64(((uint64_t)1)<<41)) +#define IB_PIR_COMPMASK_GUIDCAP (CL_HTON64(((uint64_t)1)<<42)) +#define IB_PIR_COMPMASK_RESV3 (CL_HTON64(((uint64_t)1)<<43)) +#define IB_PIR_COMPMASK_SUBNTO (CL_HTON64(((uint64_t)1)<<44)) +#define IB_PIR_COMPMASK_RESV4 (CL_HTON64(((uint64_t)1)<<45)) +#define IB_PIR_COMPMASK_RESPTIME (CL_HTON64(((uint64_t)1)<<46)) +#define IB_PIR_COMPMASK_LOCALPHYERR (CL_HTON64(((uint64_t)1)<<47)) +#define IB_PIR_COMPMASK_OVERRUNERR (CL_HTON64(((uint64_t)1)<<48)) + /* Multicast Member Record Component Masks */ #define IB_MCR_COMPMASK_GID (CL_HTON64(((uint64_t)1)<<0)) #define IB_MCR_COMPMASK_MGID (CL_HTON64(((uint64_t)1)<<0)) @@ -2710,8 +2710,8 @@ ib_path_rec_init_local( * [in] LID of source port. * * num_path -* [in] Reversible path - 1 bit to say if path is reversible. -* num_path [6:0] In queries, maximum number of paths to return. +* [in] Reversible path - 1 bit to say if path is reversible. +* num_path [6:0] In queries, maximum number of paths to return. * In responses, undefined. * * pkey @@ -3126,7 +3126,7 @@ ib_path_rec_set_hop_flow_raw( */ #define IB_CLASS_CAP_TRAP 0x0001 /*********/ - + /****s* IBA Base: Constants/IB_CLASS_CAP_GETSET * NAME * IB_CLASS_CAP_GETSET @@ -3142,7 +3142,7 @@ ib_path_rec_set_hop_flow_raw( */ #define IB_CLASS_CAP_GETSET 0x0002 /*********/ - + /****s* IBA Base: Constants/IB_CLASS_RESP_TIME_MASK * NAME * IB_CLASS_RESP_TIME_MASK @@ -3247,7 +3247,7 @@ typedef struct _ib_class_port_info * IB_CLASS_CAP_GETSET, IB_CLASS_CAP_TRAP * *********/ - + /****s* IBA Base: Types/ib_sm_info_t * NAME * ib_sm_info_t @@ -3821,7 +3821,7 @@ ib_smp_is_response( * SEE ALSO * ib_smp_t *********/ - + /****f* IBA Base: Types/ib_smp_is_d * NAME * ib_smp_is_d @@ -3941,7 +3941,7 @@ ib_smp_init_new( * SEE ALSO * ib_mad_t *********/ - + /****f* IBA Base: Types/ib_smp_get_payload_ptr * NAME * ib_smp_get_payload_ptr @@ -3998,7 +3998,7 @@ typedef struct _ib_node_info } PACK_SUFFIX ib_node_info_t; #include /************/ - + /****s* IBA Base: Types/ib_sa_mad_t * NAME * ib_sa_mad_t @@ -4131,7 +4131,7 @@ ib_node_info_get_local_port_num( * SEE ALSO * ib_node_info_t *********/ - + /****f* IBA Base: Types/ib_node_info_get_vendor_id * NAME * ib_node_info_get_vendor_id @@ -4259,21 +4259,21 @@ typedef struct _ib_port_info #define IB_PORT_CAP_HAS_NV_PKEY (CL_NTOH32(0x00000100)) #define IB_PORT_CAP_HAS_LED_INFO (CL_NTOH32(0x00000200)) #define IB_PORT_CAP_SM_DISAB (CL_NTOH32(0x00000400)) -#define IB_PORT_CAP_HAS_SYS_IMG_GUID (CL_NTOH32(0x00000800)) +#define IB_PORT_CAP_HAS_SYS_IMG_GUID (CL_NTOH32(0x00000800)) #define IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP (CL_NTOH32(0x00001000)) #define IB_PORT_CAP_RESV13 (CL_NTOH32(0x00002000)) #define IB_PORT_CAP_RESV14 (CL_NTOH32(0x00004000)) #define IB_PORT_CAP_RESV15 (CL_NTOH32(0x00008000)) #define IB_PORT_CAP_HAS_COM_MGT (CL_NTOH32(0x00010000)) #define IB_PORT_CAP_HAS_SNMP (CL_NTOH32(0x00020000)) -#define IB_PORT_CAP_REINIT (CL_NTOH32(0x00040000)) +#define IB_PORT_CAP_REINIT (CL_NTOH32(0x00040000)) #define IB_PORT_CAP_HAS_DEV_MGT (CL_NTOH32(0x00080000)) #define IB_PORT_CAP_HAS_VEND_CLS (CL_NTOH32(0x00100000)) #define IB_PORT_CAP_HAS_DR_NTC (CL_NTOH32(0x00200000)) #define IB_PORT_CAP_HAS_CAP_NTC (CL_NTOH32(0x00400000)) #define IB_PORT_CAP_HAS_BM (CL_NTOH32(0x00800000)) -#define IB_PORT_CAP_HAS_LINK_RT_LATENCY (CL_NTOH32(0x01000000)) -#define IB_PORT_CAP_HAS_CLIENT_REREG (CL_NTOH32(0x02000000)) +#define IB_PORT_CAP_HAS_LINK_RT_LATENCY (CL_NTOH32(0x01000000)) +#define IB_PORT_CAP_HAS_CLIENT_REREG (CL_NTOH32(0x02000000)) #define IB_PORT_CAP_RESV26 (CL_NTOH32(0x04000000)) #define IB_PORT_CAP_RESV27 (CL_NTOH32(0x08000000)) #define IB_PORT_CAP_RESV28 (CL_NTOH32(0x10000000)) @@ -4308,7 +4308,7 @@ ib_port_info_get_port_state( * * SEE ALSO *********/ - + /****f* IBA Base: Types/ib_port_info_set_port_state * NAME * ib_port_info_set_port_state @@ -4340,7 +4340,7 @@ ib_port_info_set_port_state( * * SEE ALSO *********/ - + /****f* IBA Base: Types/ib_port_info_get_vl_cap * NAME * ib_port_info_get_vl_cap @@ -4424,7 +4424,7 @@ ib_port_info_get_op_vls( * * SEE ALSO *********/ - + /****f* IBA Base: Types/ib_port_info_set_op_vls * NAME * ib_port_info_set_op_vls @@ -4456,7 +4456,7 @@ ib_port_info_set_op_vls( * * SEE ALSO *********/ - + /****f* IBA Base: Types/ib_port_info_set_state_no_change * NAME * ib_port_info_set_state_no_change @@ -4552,132 +4552,132 @@ ib_port_info_set_link_speed_sup( * SEE ALSO *********/ -/****f* IBA Base: Types/ib_port_info_get_port_phys_state -* NAME -* ib_port_info_get_port_phys_state -* -* DESCRIPTION -* Returns the encoded value for the port physical state. -* -* SYNOPSIS +/****f* IBA Base: Types/ib_port_info_get_port_phys_state +* NAME +* ib_port_info_get_port_phys_state +* +* DESCRIPTION +* Returns the encoded value for the port physical state. +* +* SYNOPSIS */ AL_INLINE uint8_t AL_API -ib_port_info_get_port_phys_state( - IN const ib_port_info_t* const p_pi ) -{ - return( (uint8_t)((p_pi->state_info2 & - IB_PORT_PHYS_STATE_MASK) >> - IB_PORT_PHYS_STATE_SHIFT) ); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the encoded value for the port physical state. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_port_phys_state -* NAME -* ib_port_info_set_port_phys_state -* -* DESCRIPTION -* Given an integer of the port physical state, -* Set the appropriate bits in state_info2 -* -* SYNOPSIS -*/ +ib_port_info_get_port_phys_state( + IN const ib_port_info_t* const p_pi ) +{ + return( (uint8_t)((p_pi->state_info2 & + IB_PORT_PHYS_STATE_MASK) >> + IB_PORT_PHYS_STATE_SHIFT) ); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* Returns the encoded value for the port physical state. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_set_port_phys_state +* NAME +* ib_port_info_set_port_phys_state +* +* DESCRIPTION +* Given an integer of the port physical state, +* Set the appropriate bits in state_info2 +* +* SYNOPSIS +*/ AL_INLINE void AL_API -ib_port_info_set_port_phys_state( - IN uint8_t const phys_state, - IN ib_port_info_t* p_pi ) -{ - p_pi->state_info2 = - ( ~IB_PORT_PHYS_STATE_MASK & p_pi->state_info2 ) | - ( IB_PORT_PHYS_STATE_MASK & - (phys_state << IB_PORT_PHYS_STATE_SHIFT) ); -} -/* -* PARAMETERS -* phys_state -* [in] port physical state. -* -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* This function does not return a value. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_link_down_def_state -* NAME -* ib_port_info_get_link_down_def_state -* -* DESCRIPTION -* Returns the link down default state. -* -* SYNOPSIS -*/ +ib_port_info_set_port_phys_state( + IN uint8_t const phys_state, + IN ib_port_info_t* p_pi ) +{ + p_pi->state_info2 = + ( ~IB_PORT_PHYS_STATE_MASK & p_pi->state_info2 ) | + ( IB_PORT_PHYS_STATE_MASK & + (phys_state << IB_PORT_PHYS_STATE_SHIFT) ); +} +/* +* PARAMETERS +* phys_state +* [in] port physical state. +* +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* This function does not return a value. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_get_link_down_def_state +* NAME +* ib_port_info_get_link_down_def_state +* +* DESCRIPTION +* Returns the link down default state. +* +* SYNOPSIS +*/ AL_INLINE uint8_t AL_API -ib_port_info_get_link_down_def_state( - IN const ib_port_info_t* const p_pi ) -{ - return( (uint8_t)(p_pi->state_info2 & IB_PORT_LNKDWNDFTSTATE_MASK) ); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* link down default state of the port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_link_down_def_state -* NAME -* ib_port_info_set_link_down_def_state -* -* DESCRIPTION -* Sets the link down default state of the port. -* -* SYNOPSIS -*/ +ib_port_info_get_link_down_def_state( + IN const ib_port_info_t* const p_pi ) +{ + return( (uint8_t)(p_pi->state_info2 & IB_PORT_LNKDWNDFTSTATE_MASK) ); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* link down default state of the port. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_set_link_down_def_state +* NAME +* ib_port_info_set_link_down_def_state +* +* DESCRIPTION +* Sets the link down default state of the port. +* +* SYNOPSIS +*/ AL_INLINE void AL_API -ib_port_info_set_link_down_def_state( - IN ib_port_info_t* const p_pi, - IN const uint8_t link_dwn_state ) -{ - p_pi->state_info2 = (uint8_t)((p_pi->state_info2 & 0xF0) | link_dwn_state ); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* link_dwn_state -* [in] Link down default state of the port. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - +ib_port_info_set_link_down_def_state( + IN ib_port_info_t* const p_pi, + IN const uint8_t link_dwn_state ) +{ + p_pi->state_info2 = (uint8_t)((p_pi->state_info2 & 0xF0) | link_dwn_state ); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* link_dwn_state +* [in] Link down default state of the port. +* +* RETURN VALUES +* None. +* +* NOTES +* +* SEE ALSO +*********/ + /****f* IBA Base: Types/ib_port_info_get_link_speed_active * NAME * ib_port_info_get_link_speed_active @@ -4691,8 +4691,8 @@ AL_INLINE uint8_t AL_API ib_port_info_get_link_speed_active( IN const ib_port_info_t* const p_pi ) { - return( (uint8_t)((p_pi->link_speed & - IB_PORT_LINK_SPEED_ACTIVE_MASK) >> + return( (uint8_t)((p_pi->link_speed & + IB_PORT_LINK_SPEED_ACTIVE_MASK) >> IB_PORT_LINK_SPEED_SHIFT) ); } /* @@ -4715,7 +4715,7 @@ ib_port_info_get_link_speed_active( #define IB_LINK_SPEED_ACTIVE_5 2 #define IB_LINK_SPEED_ACTIVE_10 4 -/* following v1 ver1.2 p901 */ +/* following v1 ver1.2 p901 */ #define IB_PATH_RECORD_RATE_2_5_GBS 2 #define IB_PATH_RECORD_RATE_10_GBS 3 #define IB_PATH_RECORD_RATE_30_GBS 4 @@ -4726,8 +4726,8 @@ ib_port_info_get_link_speed_active( #define IB_PATH_RECORD_RATE_80_GBS 9 #define IB_PATH_RECORD_RATE_120_GBS 10 -#define IB_MIN_RATE IB_PATH_RECORD_RATE_2_5_GBS -#define IB_MAX_RATE IB_PATH_RECORD_RATE_120_GBS +#define IB_MIN_RATE IB_PATH_RECORD_RATE_2_5_GBS +#define IB_MAX_RATE IB_PATH_RECORD_RATE_120_GBS /****f* IBA Base: Types/ib_port_info_compute_rate * NAME @@ -4742,76 +4742,76 @@ AL_INLINE uint8_t AL_API ib_port_info_compute_rate( IN const ib_port_info_t* const p_pi ) { - uint8_t rate = 0; - - switch (ib_port_info_get_link_speed_active(p_pi)) + uint8_t rate = 0; + + switch (ib_port_info_get_link_speed_active(p_pi)) { - case IB_LINK_SPEED_ACTIVE_2_5: - switch (p_pi->link_width_active) - { - case IB_LINK_WIDTH_ACTIVE_1X: - rate = IB_PATH_RECORD_RATE_2_5_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_4X: - rate = IB_PATH_RECORD_RATE_10_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_12X: - rate = IB_PATH_RECORD_RATE_30_GBS; - break; - - default: - rate = IB_PATH_RECORD_RATE_2_5_GBS; - break; - } - break; - case IB_LINK_SPEED_ACTIVE_5: - switch (p_pi->link_width_active) - { - case IB_LINK_WIDTH_ACTIVE_1X: - rate = IB_PATH_RECORD_RATE_5_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_4X: - rate = IB_PATH_RECORD_RATE_20_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_12X: - rate = IB_PATH_RECORD_RATE_60_GBS; - break; - - default: - rate = IB_PATH_RECORD_RATE_5_GBS; - break; - } - break; - case IB_LINK_SPEED_ACTIVE_10: - switch (p_pi->link_width_active) - { - case IB_LINK_WIDTH_ACTIVE_1X: - rate = IB_PATH_RECORD_RATE_10_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_4X: - rate = IB_PATH_RECORD_RATE_40_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_12X: - rate =IB_PATH_RECORD_RATE_120_GBS; - break; + case IB_LINK_SPEED_ACTIVE_2_5: + switch (p_pi->link_width_active) + { + case IB_LINK_WIDTH_ACTIVE_1X: + rate = IB_PATH_RECORD_RATE_2_5_GBS; + break; + + case IB_LINK_WIDTH_ACTIVE_4X: + rate = IB_PATH_RECORD_RATE_10_GBS; + break; + + case IB_LINK_WIDTH_ACTIVE_12X: + rate = IB_PATH_RECORD_RATE_30_GBS; + break; + + default: + rate = IB_PATH_RECORD_RATE_2_5_GBS; + break; + } + break; + case IB_LINK_SPEED_ACTIVE_5: + switch (p_pi->link_width_active) + { + case IB_LINK_WIDTH_ACTIVE_1X: + rate = IB_PATH_RECORD_RATE_5_GBS; + break; + + case IB_LINK_WIDTH_ACTIVE_4X: + rate = IB_PATH_RECORD_RATE_20_GBS; + break; + + case IB_LINK_WIDTH_ACTIVE_12X: + rate = IB_PATH_RECORD_RATE_60_GBS; + break; + + default: + rate = IB_PATH_RECORD_RATE_5_GBS; + break; + } + break; + case IB_LINK_SPEED_ACTIVE_10: + switch (p_pi->link_width_active) + { + case IB_LINK_WIDTH_ACTIVE_1X: + rate = IB_PATH_RECORD_RATE_10_GBS; + break; + + case IB_LINK_WIDTH_ACTIVE_4X: + rate = IB_PATH_RECORD_RATE_40_GBS; + break; + + case IB_LINK_WIDTH_ACTIVE_12X: + rate =IB_PATH_RECORD_RATE_120_GBS; + break; default: - rate = IB_PATH_RECORD_RATE_10_GBS; - break; - } - break; - default: - rate = IB_PATH_RECORD_RATE_2_5_GBS; - break; + rate = IB_PATH_RECORD_RATE_10_GBS; + break; + } + break; + default: + rate = IB_PATH_RECORD_RATE_2_5_GBS; + break; } - - return rate; + + return rate; } /* * PARAMETERS @@ -4844,11 +4844,11 @@ ib_path_get_ipd( switch(local_link_width_supported) { - /* link_width_supported = 1: 1x */ + /* link_width_supported = 1: 1x */ case 1: break; - /* link_width_supported = 3: 1x or 4x */ + /* link_width_supported = 3: 1x or 4x */ case 3: switch(path_rec_rate & 0x3F) { @@ -4860,7 +4860,7 @@ ib_path_get_ipd( } break; - /* link_width_supported = 11: 1x or 4x or 12x */ + /* link_width_supported = 11: 1x or 4x or 12x */ case 11: switch(path_rec_rate & 0x3F) { @@ -4924,7 +4924,7 @@ ib_port_info_get_mtu_cap( * * SEE ALSO *********/ - + /****f* IBA Base: Types/ib_port_info_get_neighbor_mtu * NAME * ib_port_info_get_neighbor_mtu @@ -4952,7 +4952,7 @@ ib_port_info_get_neighbor_mtu( * * SEE ALSO *********/ - + /****f* IBA Base: Types/ib_port_info_set_neighbor_mtu * NAME * ib_port_info_set_neighbor_mtu @@ -5064,9 +5064,9 @@ ib_port_info_set_timeout( IN const uint8_t timeout ) { CL_ASSERT( timeout <= 0x1F ); - p_pi->subnet_timeout = - (uint8_t)( - (p_pi->subnet_timeout & 0x80) | (timeout & 0x1F)); + p_pi->subnet_timeout = + (uint8_t)( + (p_pi->subnet_timeout & 0x80) | (timeout & 0x1F)); } /* * PARAMETERS @@ -5083,347 +5083,347 @@ ib_port_info_set_timeout( * * SEE ALSO *********/ - -/****f* IBA Base: Types/ib_port_info_set_client_rereg -* NAME -* ib_port_info_set_client_rereg -* -* DESCRIPTION -* Sets the encoded client reregistration bit value in the PortInfo attribute. -* -* SYNOPSIS -*/ -AL_INLINE void AL_API -ib_port_info_set_client_rereg( - IN ib_port_info_t* const p_pi, - IN const uint8_t client_rereg ) -{ - CL_ASSERT( client_rereg <= 0x1 ); - p_pi->subnet_timeout = - (uint8_t)( - (p_pi->subnet_timeout & 0x1F) | ((client_rereg << 7) & 0x80)); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* client_rereg -* [in] Client reregistration value to set (either 1 or 0). -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_timeout -* NAME -* ib_port_info_get_timeout -* -* DESCRIPTION -* Gets the encoded subnet timeout value in the PortInfo attribute. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_port_info_get_timeout( - IN ib_port_info_t const* p_pi ) -{ - return(p_pi->subnet_timeout & 0x1F ); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* The encoded timeout value -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_client_rereg -* NAME -* ib_port_info_get_client_rereg -* -* DESCRIPTION -* Gets the encoded client reregistration bit value in the PortInfo attribute. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_port_info_get_client_rereg( - IN ib_port_info_t const* p_pi ) -{ - return ( (p_pi->subnet_timeout & 0x80 ) >> 7); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Client reregistration value (either 1 or 0). -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime -* NAME -* ib_port_info_set_hoq_lifetime -* -* DESCRIPTION -* Sets the Head of Queue Lifetime for which a packet can live in the head -* of VL queue -* -* SYNOPSIS -*/ -AL_INLINE void AL_API -ib_port_info_set_hoq_lifetime( - IN ib_port_info_t* const p_pi, - IN const uint8_t hoq_life ) -{ - p_pi->vl_stall_life = (uint8_t)((hoq_life & 0x1f) | - (p_pi->vl_stall_life & 0xe0)); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* hoq_life -* [in] Encoded lifetime value to set -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime -* NAME -* ib_port_info_get_hoq_lifetime -* -* DESCRIPTION -* Gets the Head of Queue Lifetime for which a packet can live in the head -* of VL queue -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_port_info_get_hoq_lifetime( - IN const ib_port_info_t* const p_pi ) -{ - return( (uint8_t)(p_pi->vl_stall_life & 0x1f) ); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Encoded lifetime value -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_vl_stall_count -* NAME -* ib_port_info_set_vl_stall_count -* -* DESCRIPTION -* Sets the VL Stall Count which define the number of contiguous -* HLL (hoq) drops that will put the VL into stalled mode. -* -* SYNOPSIS -*/ -AL_INLINE void AL_API -ib_port_info_set_vl_stall_count( - IN ib_port_info_t* const p_pi, - IN const uint8_t vl_stall_count ) -{ - p_pi->vl_stall_life = (uint8_t)((p_pi->vl_stall_life & 0x1f) | - ((vl_stall_count << 5) & 0xe0)); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* vl_stall_count -* [in] value to set -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_vl_stall_count -* NAME -* ib_port_info_get_vl_stall_count -* -* DESCRIPTION -* Gets the VL Stall Count which define the number of contiguous -* HLL (hoq) drops that will put the VL into stalled mode -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_port_info_get_vl_stall_count( - IN const ib_port_info_t* const p_pi ) -{ - return( (uint8_t)(p_pi->vl_stall_life & 0xe0) >> 5); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* vl stall count -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_lmc + +/****f* IBA Base: Types/ib_port_info_set_client_rereg * NAME -* ib_port_info_get_lmc +* ib_port_info_set_client_rereg * * DESCRIPTION -* Returns the LMC value assigned to this port. +* Sets the encoded client reregistration bit value in the PortInfo attribute. * * SYNOPSIS */ -AL_INLINE uint8_t AL_API -ib_port_info_get_lmc( - IN const ib_port_info_t* const p_pi ) -{ - return( (uint8_t)(p_pi->mkey_lmc & IB_PORT_LMC_MASK) ); +AL_INLINE void AL_API +ib_port_info_set_client_rereg( + IN ib_port_info_t* const p_pi, + IN const uint8_t client_rereg ) +{ + CL_ASSERT( client_rereg <= 0x1 ); + p_pi->subnet_timeout = + (uint8_t)( + (p_pi->subnet_timeout & 0x1F) | ((client_rereg << 7) & 0x80)); } /* * PARAMETERS * p_pi * [in] Pointer to a PortInfo attribute. * +* client_rereg +* [in] Client reregistration value to set (either 1 or 0). +* * RETURN VALUES -* Returns the LMC value assigned to this port. +* None. * * NOTES * * SEE ALSO *********/ - -/****f* IBA Base: Types/ib_port_info_set_lmc + +/****f* IBA Base: Types/ib_port_info_get_timeout * NAME -* ib_port_info_set_lmc +* ib_port_info_get_timeout * * DESCRIPTION -* Sets the LMC value in the PortInfo attribute. +* Gets the encoded subnet timeout value in the PortInfo attribute. * * SYNOPSIS */ -AL_INLINE void AL_API -ib_port_info_set_lmc( - IN ib_port_info_t* const p_pi, - IN const uint8_t lmc ) +AL_INLINE uint8_t AL_API +ib_port_info_get_timeout( + IN ib_port_info_t const* p_pi ) { - CL_ASSERT( lmc <= IB_PORT_LMC_MAX ); - p_pi->mkey_lmc = (uint8_t)((p_pi->mkey_lmc & 0xF8) | lmc); + return(p_pi->subnet_timeout & 0x1F ); } /* * PARAMETERS * p_pi * [in] Pointer to a PortInfo attribute. * -* lmc -* [in] LMC value to set, must be less than 7. -* * RETURN VALUES -* None. +* The encoded timeout value * * NOTES * * SEE ALSO *********/ - -/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled -* NAME -* ib_port_info_get_link_speed_enabled -* -* DESCRIPTION -* Returns the link speed enabled value assigned to this port. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_port_info_get_link_speed_enabled( - IN const ib_port_info_t* const p_pi ) -{ - return( (uint8_t)(p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK) ); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Port state. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled -* NAME -* ib_port_info_set_link_speed_enabled -* -* DESCRIPTION -* Sets the link speed enabled value in the PortInfo attribute. -* -* SYNOPSIS -*/ + +/****f* IBA Base: Types/ib_port_info_get_client_rereg +* NAME +* ib_port_info_get_client_rereg +* +* DESCRIPTION +* Gets the encoded client reregistration bit value in the PortInfo attribute. +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_port_info_get_client_rereg( + IN ib_port_info_t const* p_pi ) +{ + return ( (p_pi->subnet_timeout & 0x80 ) >> 7); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* Client reregistration value (either 1 or 0). +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime +* NAME +* ib_port_info_set_hoq_lifetime +* +* DESCRIPTION +* Sets the Head of Queue Lifetime for which a packet can live in the head +* of VL queue +* +* SYNOPSIS +*/ +AL_INLINE void AL_API +ib_port_info_set_hoq_lifetime( + IN ib_port_info_t* const p_pi, + IN const uint8_t hoq_life ) +{ + p_pi->vl_stall_life = (uint8_t)((hoq_life & 0x1f) | + (p_pi->vl_stall_life & 0xe0)); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* hoq_life +* [in] Encoded lifetime value to set +* +* RETURN VALUES +* None. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime +* NAME +* ib_port_info_get_hoq_lifetime +* +* DESCRIPTION +* Gets the Head of Queue Lifetime for which a packet can live in the head +* of VL queue +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_port_info_get_hoq_lifetime( + IN const ib_port_info_t* const p_pi ) +{ + return( (uint8_t)(p_pi->vl_stall_life & 0x1f) ); +} + +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* Encoded lifetime value +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_set_vl_stall_count +* NAME +* ib_port_info_set_vl_stall_count +* +* DESCRIPTION +* Sets the VL Stall Count which define the number of contiguous +* HLL (hoq) drops that will put the VL into stalled mode. +* +* SYNOPSIS +*/ +AL_INLINE void AL_API +ib_port_info_set_vl_stall_count( + IN ib_port_info_t* const p_pi, + IN const uint8_t vl_stall_count ) +{ + p_pi->vl_stall_life = (uint8_t)((p_pi->vl_stall_life & 0x1f) | + ((vl_stall_count << 5) & 0xe0)); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* vl_stall_count +* [in] value to set +* +* RETURN VALUES +* None. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_get_vl_stall_count +* NAME +* ib_port_info_get_vl_stall_count +* +* DESCRIPTION +* Gets the VL Stall Count which define the number of contiguous +* HLL (hoq) drops that will put the VL into stalled mode +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_port_info_get_vl_stall_count( + IN const ib_port_info_t* const p_pi ) +{ + return( (uint8_t)(p_pi->vl_stall_life & 0xe0) >> 5); +} + +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* vl stall count +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_get_lmc +* NAME +* ib_port_info_get_lmc +* +* DESCRIPTION +* Returns the LMC value assigned to this port. +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_port_info_get_lmc( + IN const ib_port_info_t* const p_pi ) +{ + return( (uint8_t)(p_pi->mkey_lmc & IB_PORT_LMC_MASK) ); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* Returns the LMC value assigned to this port. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_set_lmc +* NAME +* ib_port_info_set_lmc +* +* DESCRIPTION +* Sets the LMC value in the PortInfo attribute. +* +* SYNOPSIS +*/ +AL_INLINE void AL_API +ib_port_info_set_lmc( + IN ib_port_info_t* const p_pi, + IN const uint8_t lmc ) +{ + CL_ASSERT( lmc <= IB_PORT_LMC_MAX ); + p_pi->mkey_lmc = (uint8_t)((p_pi->mkey_lmc & 0xF8) | lmc); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* lmc +* [in] LMC value to set, must be less than 7. +* +* RETURN VALUES +* None. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled +* NAME +* ib_port_info_get_link_speed_enabled +* +* DESCRIPTION +* Returns the link speed enabled value assigned to this port. +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_port_info_get_link_speed_enabled( + IN const ib_port_info_t* const p_pi ) +{ + return( (uint8_t)(p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK) ); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* Port state. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled +* NAME +* ib_port_info_set_link_speed_enabled +* +* DESCRIPTION +* Sets the link speed enabled value in the PortInfo attribute. +* +* SYNOPSIS +*/ AL_INLINE void AL_API -ib_port_info_set_link_speed_enabled( - IN ib_port_info_t* const p_pi, - IN const uint8_t link_speed_enabled ) -{ - p_pi->link_speed = (uint8_t)((p_pi->link_speed & 0xF0) | link_speed_enabled ); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* link_speed_enabled -* [in] link speed enabled value to set. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - +ib_port_info_set_link_speed_enabled( + IN ib_port_info_t* const p_pi, + IN const uint8_t link_speed_enabled ) +{ + p_pi->link_speed = (uint8_t)((p_pi->link_speed & 0xF0) | link_speed_enabled ); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* link_speed_enabled +* [in] link speed enabled value to set. +* +* RETURN VALUES +* None. +* +* NOTES +* +* SEE ALSO +*********/ + /****f* IBA Base: Types/ib_port_info_get_mpb * NAME * ib_port_info_get_mpb @@ -5458,126 +5458,126 @@ ib_port_info_get_mpb( * ib_port_info_set_mpb * * DESCRIPTION -* Set the M_Key protect bits of this port. +* Set the M_Key protect bits of this port. +* +* SYNOPSIS +*/ +AL_INLINE void AL_API +ib_port_info_set_mpb( + IN ib_port_info_t* p_pi, + IN uint8_t mpb ) +{ + p_pi->mkey_lmc = + (~IB_PORT_MPB_MASK & p_pi->mkey_lmc) | + ( IB_PORT_MPB_MASK & (mpb << IB_PORT_MPB_SHIFT) ); +} +/* +* PARAMETERS +* mpb +* [in] M_Key protect bits +* p_ni +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_get_local_phy_err_thd +* NAME +* ib_port_info_get_local_phy_err_thd +* +* DESCRIPTION +* Returns the Phy Link Threshold +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_port_info_get_local_phy_err_thd( + IN const ib_port_info_t* const p_pi ) +{ + return (uint8_t)( (p_pi->error_threshold & 0xF0) >> 4); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* Returns the Phy Link error threshold assigned to this port. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_get_overrun_err_thd +* NAME +* ib_port_info_get_local_overrun_err_thd +* +* DESCRIPTION +* Returns the Credits Overrun Errors Threshold +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_port_info_get_overrun_err_thd( + IN const ib_port_info_t* const p_pi ) +{ + return (uint8_t)(p_pi->error_threshold & 0x0F); +} +/* +* PARAMETERS +* p_pi +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* Returns the Credits Overrun errors threshold assigned to this port. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_port_info_set_phy_and_overrun_err_thd +* NAME +* ib_port_info_set_phy_and_overrun_err_thd +* +* DESCRIPTION +* Sets the Phy Link and Credits Overrun Errors Threshold * * SYNOPSIS */ AL_INLINE void AL_API -ib_port_info_set_mpb( - IN ib_port_info_t* p_pi, - IN uint8_t mpb ) +ib_port_info_set_phy_and_overrun_err_thd( + IN ib_port_info_t* const p_pi, + IN uint8_t phy_threshold, + IN uint8_t overrun_threshold ) { - p_pi->mkey_lmc = - (~IB_PORT_MPB_MASK & p_pi->mkey_lmc) | - ( IB_PORT_MPB_MASK & (mpb << IB_PORT_MPB_SHIFT) ); + p_pi->error_threshold = + (uint8_t)( ((phy_threshold & 0x0F) << 4) | (overrun_threshold & 0x0F) ); } /* * PARAMETERS -* mpb -* [in] M_Key protect bits -* p_ni +* p_pi * [in] Pointer to a PortInfo attribute. * +* phy_threshold +* [in] Physical Link Errors Threshold above which Trap 129 is generated +* +* overrun_threshold +* [in] Credits overrun Errors Threshold above which Trap 129 is generated +* * RETURN VALUES +* None. * * NOTES * * SEE ALSO *********/ -/****f* IBA Base: Types/ib_port_info_get_local_phy_err_thd -* NAME -* ib_port_info_get_local_phy_err_thd -* -* DESCRIPTION -* Returns the Phy Link Threshold -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_port_info_get_local_phy_err_thd( - IN const ib_port_info_t* const p_pi ) -{ - return (uint8_t)( (p_pi->error_threshold & 0xF0) >> 4); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the Phy Link error threshold assigned to this port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_overrun_err_thd -* NAME -* ib_port_info_get_local_overrun_err_thd -* -* DESCRIPTION -* Returns the Credits Overrun Errors Threshold -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_port_info_get_overrun_err_thd( - IN const ib_port_info_t* const p_pi ) -{ - return (uint8_t)(p_pi->error_threshold & 0x0F); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the Credits Overrun errors threshold assigned to this port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_phy_and_overrun_err_thd -* NAME -* ib_port_info_set_phy_and_overrun_err_thd -* -* DESCRIPTION -* Sets the Phy Link and Credits Overrun Errors Threshold -* -* SYNOPSIS -*/ -AL_INLINE void AL_API -ib_port_info_set_phy_and_overrun_err_thd( - IN ib_port_info_t* const p_pi, - IN uint8_t phy_threshold, - IN uint8_t overrun_threshold ) -{ - p_pi->error_threshold = - (uint8_t)( ((phy_threshold & 0x0F) << 4) | (overrun_threshold & 0x0F) ); -} -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* phy_threshold -* [in] Physical Link Errors Threshold above which Trap 129 is generated -* -* overrun_threshold -* [in] Credits overrun Errors Threshold above which Trap 129 is generated -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - typedef uint8_t ib_svc_name_t[64]; #include @@ -5633,533 +5633,558 @@ typedef struct _ib_sminfo_record } PACK_SUFFIX ib_sminfo_record_t; #include -/****s* IBA Base: Types/ib_lft_record_t +/****s* IBA Base: Types/ib_lft_record_t +* NAME +* ib_lft_record_t +* +* DESCRIPTION +* IBA defined LinearForwardingTableRecord (15.2.5.6) +* +* SYNOPSIS +*/ +#include +typedef struct _ib_lft_record +{ + ib_net16_t lid; + ib_net16_t block_num; + uint32_t resv0; + uint8_t lft[64]; +} PACK_SUFFIX ib_lft_record_t; +#include +/************/ + +/****s* IBA Base: Types/ib_mft_record_t +* NAME +* ib_mft_record_t +* +* DESCRIPTION +* IBA defined MulticastForwardingTableRecord (15.2.5.8) +* +* SYNOPSIS +*/ +#include +typedef struct _ib_mft_record +{ + ib_net16_t lid; + ib_net16_t position_block_num; + uint32_t resv0; + ib_net16_t mft[IB_MCAST_BLOCK_SIZE]; +} PACK_SUFFIX ib_mft_record_t; +#include +/************/ + +/****s* IBA Base: Types/ib_switch_info_t +* NAME +* ib_switch_info_t +* +* DESCRIPTION +* IBA defined SwitchInfo. (14.2.5.4) +* +* SYNOPSIS +*/ +#include +typedef struct _ib_switch_info +{ + ib_net16_t lin_cap; + ib_net16_t rand_cap; + ib_net16_t mcast_cap; + ib_net16_t lin_top; + uint8_t def_port; + uint8_t def_mcast_pri_port; + uint8_t def_mcast_not_port; + uint8_t life_state; + ib_net16_t lids_per_port; + ib_net16_t enforce_cap; + uint8_t flags; + +} PACK_SUFFIX ib_switch_info_t; +#include +/************/ + +#include +typedef struct _ib_switch_info_record +{ + ib_net16_t lid; + uint16_t resv0; + ib_switch_info_t switch_info; + uint8_t pad[3]; + +} PACK_SUFFIX ib_switch_info_record_t; +#include + +#define IB_SWITCH_PSC 0x04 + +/****f* IBA Base: Types/ib_switch_info_get_state_change +* NAME +* ib_switch_info_get_state_change +* +* DESCRIPTION +* Returns the value of the state change flag. +* +* SYNOPSIS +*/ +AL_INLINE boolean_t AL_API +ib_switch_info_get_state_change( + IN const ib_switch_info_t* const p_si ) +{ + return( (p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC ); +} +/* +* PARAMETERS +* p_si +* [in] Pointer to a SwitchInfo attribute. +* +* RETURN VALUES +* Returns the value of the state change flag. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_switch_info_clear_state_change +* NAME +* ib_switch_info_clear_state_change +* +* DESCRIPTION +* Clears the switch's state change bit. +* +* SYNOPSIS +*/ +AL_INLINE void AL_API +ib_switch_info_clear_state_change( + IN ib_switch_info_t* const p_si ) +{ + p_si->life_state = (uint8_t)(p_si->life_state & 0xFB); +} +/* +* PARAMETERS +* p_ni +* [in] Pointer to a PortInfo attribute. +* +* RETURN VALUES +* Returns the LMC value assigned to this port. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_switch_info_is_enhanced_port0 +* NAME +* ib_switch_info_is_enhanced_port0 +* +* DESCRIPTION +* Returns TRUE if the enhancedPort0 bit is on (meaning the switch +* port zero supports enhanced functions). +* Returns FALSE otherwise. +* +* SYNOPSIS +*/ +AL_INLINE boolean_t AL_API +ib_switch_info_is_enhanced_port0( + IN const ib_switch_info_t* const p_si ) +{ + return( (p_si->flags & 0x08) == 0x08 ); +} +/* +* PARAMETERS +* p_si +* [in] Pointer to a SwitchInfo attribute. +* +* RETURN VALUES +* Returns TRUE if the switch supports enhanced port 0. FALSE otherwise. +* +* NOTES +* +* SEE ALSO +*********/ + +/****s* IBA Base: Types/ib_guid_info_t +* NAME +* ib_guid_info_t +* +* DESCRIPTION +* IBA defined GuidInfo. (14.2.5.5) +* +* SYNOPSIS +*/ +#define GUID_TABLE_MAX_ENTRIES 8 + +#include +typedef struct _ib_guid_info +{ + ib_net64_t guid[GUID_TABLE_MAX_ENTRIES]; + +} PACK_SUFFIX ib_guid_info_t; +#include +/************/ + +#include +typedef struct _ib_guidinfo_record +{ + ib_net16_t lid; + uint8_t block_num; + uint8_t resv; + uint32_t reserved; + ib_guid_info_t guid_info; +} PACK_SUFFIX ib_guidinfo_record_t; +#include + +#define IB_MULTIPATH_MAX_GIDS 11 /* Support max that can fit into first MAD (for now) */ + +#include +typedef struct _ib_multipath_rec_t +{ + ib_net32_t hop_flow_raw; + uint8_t tclass; + uint8_t num_path; + ib_net16_t pkey; + uint8_t resv0; + uint8_t sl; + uint8_t mtu; + uint8_t rate; + uint8_t pkt_life; + uint8_t resv1; + uint8_t independence; /* formerly resv2 */ + uint8_t sgid_count; + uint8_t dgid_count; + uint8_t resv3[7]; + ib_gid_t gids[IB_MULTIPATH_MAX_GIDS]; +} PACK_SUFFIX ib_multipath_rec_t; +#include +/* +* FIELDS +* hop_flow_raw +* Global routing parameters: hop count, flow label and raw bit. +* +* tclass +* Another global routing parameter. +* +* num_path +* Reversible path - 1 bit to say if path is reversible. +* num_path [6:0] In queries, maximum number of paths to return. +* In responses, undefined. +* +* pkey +* Partition key (P_Key) to use on this path. +* +* sl +* Service level to use on this path. +* +* mtu +* MTU and MTU selector fields to use on this path +* rate +* Rate and rate selector fields to use on this path. +* +* pkt_life +* Packet lifetime +* +* preference +* Indicates the relative merit of this path versus other path +* records returned from the SA. Lower numbers are better. +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_multipath_rec_num_path +* NAME +* ib_multipath_rec_num_path +* +* DESCRIPTION +* Get max number of paths to return. +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_multipath_rec_num_path( + IN const ib_multipath_rec_t* const p_rec ) +{ + return( p_rec->num_path &0x7F ); +} +/* +* PARAMETERS +* p_rec +* [in] Pointer to the multipath record object. +* +* RETURN VALUES +* Maximum number of paths to return for each unique SGID_DGID combination. +* +* NOTES +* +* SEE ALSO +* ib_multipath_rec_t +*********/ + +/****f* IBA Base: Types/ib_multipath_rec_sl +* NAME +* ib_multipath_rec_sl +* +* DESCRIPTION +* Get multipath service level. +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_multipath_rec_sl( + IN const ib_multipath_rec_t* const p_rec ) +{ + return( (uint8_t)((cl_ntoh16( p_rec->sl )) & 0xF) ); +} +/* +* PARAMETERS +* p_rec +* [in] Pointer to the multipath record object. +* +* RETURN VALUES +* SL. +* +* NOTES +* +* SEE ALSO +* ib_multipath_rec_t +*********/ + +/****f* IBA Base: Types/ib_multipath_rec_mtu +* NAME +* ib_multipath_rec_mtu +* +* DESCRIPTION +* Get encoded path MTU. +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_multipath_rec_mtu( + IN const ib_multipath_rec_t* const p_rec ) +{ + return( (uint8_t)(p_rec->mtu & IB_MULTIPATH_REC_BASE_MASK) ); +} +/* +* PARAMETERS +* p_rec +* [in] Pointer to the multipath record object. +* +* RETURN VALUES +* Encoded path MTU. +* 1: 256 +* 2: 512 +* 3: 1024 +* 4: 2048 +* 5: 4096 +* others: reserved +* +* NOTES +* +* SEE ALSO +* ib_multipath_rec_t +*********/ + +/****f* IBA Base: Types/ib_multipath_rec_mtu_sel * NAME -* ib_lft_record_t +* ib_multipath_rec_mtu_sel * * DESCRIPTION -* IBA defined LinearForwardingTableRecord (15.2.5.6) +* Get encoded multipath MTU selector. * * SYNOPSIS */ -#include -typedef struct _ib_lft_record +AL_INLINE uint8_t AL_API +ib_multipath_rec_mtu_sel( + IN const ib_multipath_rec_t* const p_rec ) { - ib_net16_t lid; - ib_net16_t block_num; - uint32_t resv0; - uint8_t lft[64]; -} PACK_SUFFIX ib_lft_record_t; -#include -/************/ + return( (uint8_t)((p_rec->mtu & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6) ); +} +/* +* PARAMETERS +* p_rec +* [in] Pointer to the multipath record object. +* +* RETURN VALUES +* Encoded path MTU selector value (for queries). +* 0: greater than MTU specified +* 1: less than MTU specified +* 2: exactly the MTU specified +* 3: largest MTU available +* +* NOTES +* +* SEE ALSO +* ib_multipath_rec_t +*********/ -/****s* IBA Base: Types/ib_mft_record_t -* NAME -* ib_mft_record_t -* -* DESCRIPTION -* IBA defined MulticastForwardingTableRecord (15.2.5.8) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_mft_record -{ - ib_net16_t lid; - ib_net16_t position_block_num; - uint32_t resv0; - ib_net16_t mft[IB_MCAST_BLOCK_SIZE]; -} PACK_SUFFIX ib_mft_record_t; -#include -/************/ - -/****s* IBA Base: Types/ib_switch_info_t +/****f* IBA Base: Types/ib_multipath_rec_rate * NAME -* ib_switch_info_t +* ib_multipath_rec_rate * * DESCRIPTION -* IBA defined SwitchInfo. (14.2.5.4) +* Get encoded multipath rate. * * SYNOPSIS */ -#include -typedef struct _ib_switch_info +AL_INLINE uint8_t AL_API +ib_multipath_rec_rate( + IN const ib_multipath_rec_t* const p_rec ) { - ib_net16_t lin_cap; - ib_net16_t rand_cap; - ib_net16_t mcast_cap; - ib_net16_t lin_top; - uint8_t def_port; - uint8_t def_mcast_pri_port; - uint8_t def_mcast_not_port; - uint8_t life_state; - ib_net16_t lids_per_port; - ib_net16_t enforce_cap; - uint8_t flags; - -} PACK_SUFFIX ib_switch_info_t; -#include -/************/ + return( (uint8_t)(p_rec->rate & IB_MULTIPATH_REC_BASE_MASK) ); +} +/* +* PARAMETERS +* p_rec +* [in] Pointer to the multipath record object. +* +* RETURN VALUES +* Encoded multipath rate. +* 2: 2.5 Gb/sec. +* 3: 10 Gb/sec. +* 4: 30 Gb/sec. +* others: reserved +* +* NOTES +* +* SEE ALSO +* ib_multipath_rec_t +*********/ -#include -typedef struct _ib_switch_info_record +/****f* IBA Base: Types/ib_multipath_rec_rate_sel +* NAME +* ib_multipath_rec_rate_sel +* +* DESCRIPTION +* Get encoded multipath rate selector. +* +* SYNOPSIS +*/ +AL_INLINE uint8_t AL_API +ib_multipath_rec_rate_sel( + IN const ib_multipath_rec_t* const p_rec ) { - ib_net16_t lid; - uint16_t resv0; - ib_switch_info_t switch_info; - uint8_t pad[3]; - -} PACK_SUFFIX ib_switch_info_record_t; -#include - -#define IB_SWITCH_PSC 0x04 + return( (uint8_t)((p_rec->rate & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6) ); +} +/* +* PARAMETERS +* p_rec +* [in] Pointer to the multipath record object. +* +* RETURN VALUES +* Encoded path rate selector value (for queries). +* 0: greater than rate specified +* 1: less than rate specified +* 2: exactly the rate specified +* 3: largest rate available +* +* NOTES +* +* SEE ALSO +* ib_multipath_rec_t +*********/ -/****f* IBA Base: Types/ib_switch_info_get_state_change +/****f* IBA Base: Types/ib_multipath_rec_pkt_life * NAME -* ib_switch_info_get_state_change +* ib_multipath_rec_pkt_life * * DESCRIPTION -* Returns the value of the state change flag. +* Get encoded multipath pkt_life. * * SYNOPSIS */ -AL_INLINE boolean_t AL_API -ib_switch_info_get_state_change( - IN const ib_switch_info_t* const p_si ) +AL_INLINE uint8_t AL_API +ib_multipath_rec_pkt_life( + IN const ib_multipath_rec_t* const p_rec ) { - return( (p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC ); + return( (uint8_t)(p_rec->pkt_life & IB_MULTIPATH_REC_BASE_MASK) ); } /* * PARAMETERS -* p_si -* [in] Pointer to a SwitchInfo attribute. +* p_rec +* [in] Pointer to the multipath record object. * * RETURN VALUES -* Returns the value of the state change flag. +* Encoded multipath pkt_life = 4.096 µsec * 2 ** PacketLifeTime. * * NOTES * * SEE ALSO +* ib_multipath_rec_t *********/ -/****f* IBA Base: Types/ib_switch_info_clear_state_change +/****f* IBA Base: Types/ib_multipath_rec_pkt_life_sel * NAME -* ib_switch_info_clear_state_change +* ib_multipath_rec_pkt_life_sel * * DESCRIPTION -* Clears the switch's state change bit. +* Get encoded multipath pkt_lifetime selector. * * SYNOPSIS */ -AL_INLINE void AL_API -ib_switch_info_clear_state_change( - IN ib_switch_info_t* const p_si ) +AL_INLINE uint8_t AL_API +ib_multipath_rec_pkt_life_sel( + IN const ib_multipath_rec_t* const p_rec ) { - p_si->life_state = (uint8_t)(p_si->life_state & 0xFB); + return( (uint8_t)((p_rec->pkt_life & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6 )); } /* * PARAMETERS -* p_ni -* [in] Pointer to a PortInfo attribute. +* p_rec +* [in] Pointer to the multipath record object. * * RETURN VALUES -* Returns the LMC value assigned to this port. +* Encoded path pkt_lifetime selector value (for queries). +* 0: greater than rate specified +* 1: less than rate specified +* 2: exactly the rate specified +* 3: smallest packet lifetime available * * NOTES * * SEE ALSO +* ib_multipath_rec_t *********/ -/****f* IBA Base: Types/ib_switch_info_is_enhanced_port0 -* NAME -* ib_switch_info_is_enhanced_port0 -* -* DESCRIPTION -* Returns TRUE if the enhancedPort0 bit is on (meaning the switch -* port zero supports enhanced functions). -* Returns FALSE otherwise. -* -* SYNOPSIS -*/ -AL_INLINE boolean_t AL_API -ib_switch_info_is_enhanced_port0( - IN const ib_switch_info_t* const p_si ) -{ - return( (p_si->flags & 0x08) == 0x08 ); -} -/* -* PARAMETERS -* p_si -* [in] Pointer to a SwitchInfo attribute. -* -* RETURN VALUES -* Returns TRUE if the switch supports enhanced port 0. FALSE otherwise. -* -* NOTES -* -* SEE ALSO -*********/ - -/****s* IBA Base: Types/ib_guid_info_t +#define IB_NUM_PKEY_ELEMENTS_IN_BLOCK 32 +/****s* IBA Base: Types/ib_pkey_table_t * NAME -* ib_guid_info_t +* ib_pkey_table_t * * DESCRIPTION -* IBA defined GuidInfo. (14.2.5.5) +* IBA defined PKey table. (14.2.5.7) * * SYNOPSIS */ -#define GUID_TABLE_MAX_ENTRIES 8 #include -typedef struct _ib_guid_info +typedef struct _ib_pkey_table { - ib_net64_t guid[GUID_TABLE_MAX_ENTRIES]; + ib_net16_t pkey_entry[IB_NUM_PKEY_ELEMENTS_IN_BLOCK]; -} PACK_SUFFIX ib_guid_info_t; +} PACK_SUFFIX ib_pkey_table_t; #include /************/ -#include -typedef struct _ib_guidinfo_record -{ - ib_net16_t lid; - uint8_t block_num; - uint8_t resv; - uint32_t reserved; - ib_guid_info_t guid_info; -} PACK_SUFFIX ib_guidinfo_record_t; -#include - -#define IB_MULTIPATH_MAX_GIDS 11 /* Support max that can fit into first MAD (for now) */ - -#include -typedef struct _ib_multipath_rec_t -{ - ib_net32_t hop_flow_raw; - uint8_t tclass; - uint8_t num_path; - ib_net16_t pkey; - uint8_t resv0; - uint8_t sl; - uint8_t mtu; - uint8_t rate; - uint8_t pkt_life; - uint8_t resv1; - uint8_t independence; /* formerly resv2 */ - uint8_t sgid_count; - uint8_t dgid_count; - uint8_t resv3[7]; - ib_gid_t gids[IB_MULTIPATH_MAX_GIDS]; -} PACK_SUFFIX ib_multipath_rec_t; -#include -/* -* FIELDS -* hop_flow_raw -* Global routing parameters: hop count, flow label and raw bit. -* -* tclass -* Another global routing parameter. -* -* num_path -* Reversible path - 1 bit to say if path is reversible. -* num_path [6:0] In queries, maximum number of paths to return. -* In responses, undefined. -* -* pkey -* Partition key (P_Key) to use on this path. -* -* sl -* Service level to use on this path. -* -* mtu -* MTU and MTU selector fields to use on this path -* rate -* Rate and rate selector fields to use on this path. -* -* pkt_life -* Packet lifetime -* -* preference -* Indicates the relative merit of this path versus other path -* records returned from the SA. Lower numbers are better. -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_num_path -* NAME -* ib_multipath_rec_num_path -* -* DESCRIPTION -* Get max number of paths to return. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_multipath_rec_num_path( - IN const ib_multipath_rec_t* const p_rec ) -{ - return( p_rec->num_path &0x7F ); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Maximum number of paths to return for each unique SGID_DGID combination. -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_sl -* NAME -* ib_multipath_rec_sl -* -* DESCRIPTION -* Get multipath service level. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_multipath_rec_sl( - IN const ib_multipath_rec_t* const p_rec ) -{ - return( (uint8_t)((cl_ntoh16( p_rec->sl )) & 0xF) ); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* SL. -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_mtu -* NAME -* ib_multipath_rec_mtu -* -* DESCRIPTION -* Get encoded path MTU. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_multipath_rec_mtu( - IN const ib_multipath_rec_t* const p_rec ) -{ - return( (uint8_t)(p_rec->mtu & IB_MULTIPATH_REC_BASE_MASK) ); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded path MTU. -* 1: 256 -* 2: 512 -* 3: 1024 -* 4: 2048 -* 5: 4096 -* others: reserved -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_mtu_sel -* NAME -* ib_multipath_rec_mtu_sel -* -* DESCRIPTION -* Get encoded multipath MTU selector. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_multipath_rec_mtu_sel( - IN const ib_multipath_rec_t* const p_rec ) -{ - return( (uint8_t)((p_rec->mtu & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6) ); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded path MTU selector value (for queries). -* 0: greater than MTU specified -* 1: less than MTU specified -* 2: exactly the MTU specified -* 3: largest MTU available -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_rate -* NAME -* ib_multipath_rec_rate -* -* DESCRIPTION -* Get encoded multipath rate. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_multipath_rec_rate( - IN const ib_multipath_rec_t* const p_rec ) -{ - return( (uint8_t)(p_rec->rate & IB_MULTIPATH_REC_BASE_MASK) ); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded multipath rate. -* 2: 2.5 Gb/sec. -* 3: 10 Gb/sec. -* 4: 30 Gb/sec. -* others: reserved -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_rate_sel -* NAME -* ib_multipath_rec_rate_sel -* -* DESCRIPTION -* Get encoded multipath rate selector. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_multipath_rec_rate_sel( - IN const ib_multipath_rec_t* const p_rec ) -{ - return( (uint8_t)((p_rec->rate & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6) ); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded path rate selector value (for queries). -* 0: greater than rate specified -* 1: less than rate specified -* 2: exactly the rate specified -* 3: largest rate available -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_pkt_life -* NAME -* ib_multipath_rec_pkt_life -* -* DESCRIPTION -* Get encoded multipath pkt_life. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_multipath_rec_pkt_life( - IN const ib_multipath_rec_t* const p_rec ) -{ - return( (uint8_t)(p_rec->pkt_life & IB_MULTIPATH_REC_BASE_MASK) ); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded multipath pkt_life = 4.096 µsec * 2 ** PacketLifeTime. -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_pkt_life_sel -* NAME -* ib_multipath_rec_pkt_life_sel -* -* DESCRIPTION -* Get encoded multipath pkt_lifetime selector. -* -* SYNOPSIS -*/ -AL_INLINE uint8_t AL_API -ib_multipath_rec_pkt_life_sel( - IN const ib_multipath_rec_t* const p_rec ) -{ - return( (uint8_t)((p_rec->pkt_life & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6 )); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded path pkt_lifetime selector value (for queries). -* 0: greater than rate specified -* 1: less than rate specified -* 2: exactly the rate specified -* 3: smallest packet lifetime available -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ -/****s* IBA Base: Types/ib_pkey_table_info_t -* NAME -* ib_pkey_table_info_t +/****s* IBA Base: Types/ib_pkey_table_record_t +* NAME +* ib_pkey_table_record_t * * DESCRIPTION -* IBA defined PKey table. (14.2.5.7) +* IBA defined P_Key Table Record for SA Query. (15.2.5.11) * * SYNOPSIS */ -#define PKEY_TABLE_MAX_ENTRIES 32 - #include -typedef struct _ib_pkey_table_info +typedef struct _ib_pkey_table_record { - ib_net16_t pkey[PKEY_TABLE_MAX_ENTRIES]; + ib_net16_t lid; // for CA: lid of port, for switch lid of port 0 + uint16_t block_num; + uint8_t port_num; // for switch: port number, for CA: reserved + uint8_t reserved1; + uint16_t reserved2; + ib_pkey_table_t pkey_tbl; -} PACK_SUFFIX ib_pkey_table_info_t; +} PACK_SUFFIX ib_pkey_table_record_t; #include /************/ +#define IB_DROP_VL 15 #define IB_MAX_NUM_VLS 16 /****s* IBA Base: Types/ib_slvl_table_t * NAME @@ -6179,119 +6204,122 @@ typedef struct _ib_slvl_table #include /************/ -/****f* IBA Base: Types/ib_slvl_table_get_vl +/****s* IBA Base: Types/ib_slvl_table_record_t * NAME -* ib_slvl_table_get_vl +* ib_slvl_table_record_t * * DESCRIPTION -* Retrieves the VL for a given SL from an SL to VL mapping table. +* IBA defined SL to VL Mapping Table Record for SA Query. (15.2.5.4) * * SYNOPSIS */ -AL_INLINE uint8_t AL_API -ib_slvl_table_get_vl( - IN const ib_slvl_table_t* const p_slvl_tbl, - IN const uint8_t sl ) +#include +typedef struct _ib_slvl_table_record { - uint8_t vl; - - /* There are two VL's per byte. */ - vl = p_slvl_tbl->vl_table[sl/2]; - /* If odd, shift down 4 bits. */ - if( sl % 2 ) - vl >>= 4; + ib_net16_t lid; // for CA: lid of port, for switch lid of port 0 + uint8_t in_port_num; // reserved for CAs + uint8_t out_port_num; // reserved for CAs + uint32_t resv; + ib_slvl_table_t slvl_tbl; - /* Mask off upper bits and return. */ - return vl & 0x0F; -} -/* -* PARAMETERS -* p_slvl_tbl -* [in] Pointer to the SL to VL mapping table from which to return the VL. -* -* sl -* [in] SL in the table for which to return the VL. -* -* RETURN VALUES -* Returns the VL value for the specified SL in the provided table. -* -* SEE ALSO -* ib_slvl_table_t, ib_slvl_table_set_vl -*********/ +} PACK_SUFFIX ib_slvl_table_record_t; +#include +/************/ -/****f* IBA Base: Types/ib_slvl_table_set_vl +/****f* IBA Base: Types/ib_slvl_table_set * NAME -* ib_slvl_table_set_vl +* ib_slvl_table_set * * DESCRIPTION -* Sets the VL for a given SL in an SL to VL mapping table. +* Set slvl table entry. * * SYNOPSIS */ AL_INLINE void AL_API -ib_slvl_table_set_vl( - IN OUT ib_slvl_table_t* const p_slvl_tbl, - IN const uint8_t sl, - IN const uint8_t vl ) -{ - uint8_t entry; - - /* Get the current value for the byte in which the VL is stored. */ - entry = p_slvl_tbl->vl_table[sl/2]; +ib_slvl_table_set( + IN ib_slvl_table_t* p_slvl_tbl, + IN const uint8_t sl_index, + IN const uint8_t vl ) + { + uint8_t idx = sl_index/2; + CL_ASSERT(vl <= 15); + CL_ASSERT(sl_index <= 15); - /* Clear the appropriate bits and set the new VL value. */ - if( sl % 2 ) + if (sl_index%2) { - entry &= 0x0F; - entry |= ((vl & 0x0F) << 4); + /* this is an odd sl. Need to update the ls bits */ + p_slvl_tbl->vl_table[idx] = ( p_slvl_tbl->vl_table[idx] & 0xF0 ) | vl ; } else { - entry &= 0xF0; - entry |= (vl & 0x0F); + /* this is an even sl. Need to update the ms bits */ + p_slvl_tbl->vl_table[idx] = ( vl << 4 ) | ( p_slvl_tbl->vl_table[idx] & 0x0F ); } - /* Store the updated entry back into the table. */ - p_slvl_tbl->vl_table[sl/2] = entry; } /* * PARAMETERS -* slvl_tbl -* [in/out] Pointer to the SL to VL mapping table in which to store the VL. +* p_slvl_tbl +* [in] pointer to ib_slvl_table_t object. * -* sl -* [in] SL in the table for which to store the VL. +* sl_index +* [in] the sl index in the table to be updated. * * vl -* [in] VL to store at the specifed SL. +* [in] the vl value to update for that sl. * * RETURN VALUES -* This function does not return a value. +* None +* +* NOTES * * SEE ALSO -* ib_slvl_table_t, ib_slvl_table_get_vl +* ib_slvl_table_t *********/ -/****s* IBA Base: Types/ib_slvl_table_record_t +/****f* IBA Base: Types/ib_slvl_table_get * NAME -* ib_slvl_table_record_t +* ib_slvl_table_get * * DESCRIPTION -* IBA defined Sl to VL Mapping Table Record for SA Query. (15.2.5.4) +* Get slvl table entry. * * SYNOPSIS */ -#include -typedef struct _ib_slvl_table_record +AL_INLINE uint8_t AL_API +ib_slvl_table_get( +IN const ib_slvl_table_t* p_slvl_tbl, +IN const uint8_t sl_index ) { - ib_net16_t lid; // for CA: lid of port, for switch lid of port 0 - uint8_t in_port_num; // reserved for CA's - uint8_t out_port_num; // reserved for CA's - uint32_t resv; - ib_slvl_table_t slvl_tbl; + uint8_t idx = sl_index/2; + CL_ASSERT(sl_index <= 15); -} PACK_SUFFIX ib_slvl_table_record_t; -#include -/************/ + if (sl_index%2) + { + /* this is an odd sl. Need to return the ls bits. */ + return ( p_slvl_tbl->vl_table[idx] & 0x0F ); + } + else + { + /* this is an even sl. Need to return the ms bits. */ + return ( (p_slvl_tbl->vl_table[idx] & 0xF0) >> 4 ); + } +} +/* +* PARAMETERS +* p_slvl_tbl +* [in] pointer to ib_slvl_table_t object. +* +* sl_index +* [in] the sl index in the table whose value should be returned. +* +* RETURN VALUES +* vl for the requested sl_index. +* +* NOTES +* +* SEE ALSO +* ib_slvl_table_t +*********/ /****s* IBA Base: Types/ib_vl_arb_element_t * NAME @@ -6307,7 +6335,6 @@ typedef struct _ib_vl_arb_element { uint8_t res_vl; uint8_t weight; - } PACK_SUFFIX ib_vl_arb_element_t; #include /************/ @@ -6371,6 +6398,7 @@ ib_vl_arb_element_set_vl( *********/ #define IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK 32 + /****s* IBA Base: Types/ib_vl_arb_table_t * NAME * ib_vl_arb_table_t @@ -6384,7 +6412,6 @@ ib_vl_arb_element_set_vl( typedef struct _ib_vl_arb_table { ib_vl_arb_element_t vl_entry[IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK]; - } PACK_SUFFIX ib_vl_arb_table_t; #include /************/ @@ -6406,7 +6433,6 @@ typedef struct _ib_vl_arb_table_record uint8_t block_num; uint32_t reserved; ib_vl_arb_table_t vl_arb_tbl; - } PACK_SUFFIX ib_vl_arb_table_record_t; #include /************/ @@ -6429,7 +6455,6 @@ typedef struct _ib_grh uint8_t hop_limit; ib_gid_t src_gid; ib_gid_t dest_gid; - } PACK_SUFFIX ib_grh_t; #include /************/ @@ -6605,7 +6630,7 @@ typedef struct _ib_member_rec * ib_member_get_sl_flow_hop * * DESCRIPTION -* Get encoded sl, flow label, and hop limit +* Get encoded sl, flow label, and hop limit * * SYNOPSIS */ @@ -6634,7 +6659,7 @@ ib_member_get_sl_flow_hop( /* * PARAMETERS * sl_flow_hop -* [in] the sl, flow label, and hop limit of MC Group +* [in] the sl, flow label, and hop limit of MC Group * * RETURN VALUES * p_sl @@ -6657,7 +6682,7 @@ ib_member_get_sl_flow_hop( * ib_member_set_sl_flow_hop * * DESCRIPTION -* Set encoded sl, flow label, and hop limit +* Set encoded sl, flow label, and hop limit * * SYNOPSIS */ @@ -6689,7 +6714,7 @@ ib_member_set_sl_flow_hop( * * RETURN VALUES * sl_flow_hop -* [out] the encoded sl, flow label, and hop limit +* [out] the encoded sl, flow label, and hop limit * * NOTES * @@ -6944,7 +6969,6 @@ ib_member_set_join_state( #define IB_NOTICE_TYPE_INFO 0x04 #define IB_NOTICE_TYPE_EMPTY 0x7F - #include typedef struct _ib_mad_notice_attr { @@ -7503,7 +7527,6 @@ typedef struct _ib_inform_info } PACK_SUFFIX ib_inform_info_t; #include - /****f* IBA Base: Types/ib_inform_get_trap_num * NAME * ib_inform_get_trap_num @@ -8366,7 +8389,7 @@ typedef struct _ib_ioc_info * Defines known Communication management class versions */ #define IB_MCLASS_CM_VER_2 2 -#define IB_MCLASS_CM_VER_1 1 +#define IB_MCLASS_CM_VER_1 1 /* * Defines the size of user available data in communication management MADs @@ -8435,8 +8458,8 @@ typedef ib_net16_t ib_rej_status_t; #define IB_REJ_INVALID_FLOW_LBL CL_HTON16(32) #define IB_REJ_INVALID_ALT_FLOW_LBL CL_HTON16(33) -#define IB_REJ_SERVICE_HANDOFF CL_HTON16(65535) -/******/ +#define IB_REJ_SERVICE_HANDOFF CL_HTON16(65535) +/******/ /****d* Access Layer/ib_apr_status_t * NAME @@ -8606,13 +8629,14 @@ typedef struct _ib_port_counters typedef struct _ib_ca* __ptr64 ib_ca_handle_t; typedef struct _ib_pd* __ptr64 ib_pd_handle_t; typedef struct _ib_mr* __ptr64 ib_mr_handle_t; -typedef struct _mlnx_fmr* __ptr64 mlnx_fmr_handle_t; typedef struct _ib_mw* __ptr64 ib_mw_handle_t; typedef struct _ib_qp* __ptr64 ib_qp_handle_t; typedef struct _ib_srq* __ptr64 ib_srq_handle_t; typedef struct _ib_cq* __ptr64 ib_cq_handle_t; typedef struct _ib_av* __ptr64 ib_av_handle_t; typedef struct _ib_mcast* __ptr64 ib_mcast_handle_t; +typedef struct _mlnx_fmr* __ptr64 mlnx_fmr_handle_t; +typedef struct _mlnx_fmr_pool* __ptr64 mlnx_fmr_pool_handle_t; /****d* Access Layer/ib_api_status_t @@ -8763,7 +8787,7 @@ typedef enum _ib_async_event_t /* * VALUES * IB_AE_SQ_ERROR -* An error occurred when accessing the send queue of the QP or EEC. +* An error occurred when accessing the send queue of the QP or EEC. * This event is optional. * * IB_AE_SQ_DRAINED @@ -8772,7 +8796,7 @@ typedef enum _ib_async_event_t * applicable, has received all acknowledgements for those messages. * * IB_AE_RQ_ERROR -* An error occurred when accessing the receive queue of the QP or EEC. +* An error occurred when accessing the receive queue of the QP or EEC. * This event is optional. * * IB_AE_CQ_ERROR @@ -9354,7 +9378,7 @@ typedef struct _ib_ca_attr * Indicates ability to check port number in address handles. * * change_primary_port -* Indicates ability to change primary port for a QP or EEC during a +* Indicates ability to change primary port for a QP or EEC during a * SQD->RTS transition. * * modify_wr_depth @@ -9525,8 +9549,8 @@ typedef enum _ib_qp_type { IB_QPT_RELIABLE_CONN = 0, /* Matches CM REQ transport type */ IB_QPT_UNRELIABLE_CONN = 1, /* Matches CM REQ transport type */ - IB_QPT_RELIABLE_DGRM = 2, /* Matches CM REQ transport type */ - IB_QPT_UNRELIABLE_DGRM, + IB_QPT_RELIABLE_DGRM = 2, /* Matches CM REQ transport type */ + IB_QPT_UNRELIABLE_DGRM, IB_QPT_QP0, IB_QPT_QP1, IB_QPT_RAW_IPV6, @@ -9544,9 +9568,9 @@ typedef enum _ib_qp_type * IB_QPT_UNRELIABLE_CONN * Unreliable, connected queue pair. * -* IB_QPT_RELIABLE_DGRM -* Reliable, datagram queue pair. -* +* IB_QPT_RELIABLE_DGRM +* Reliable, datagram queue pair. +* * IB_QPT_UNRELIABLE_DGRM * Unreliable, datagram queue pair. * @@ -10073,8 +10097,8 @@ typedef uint32_t ib_send_opt_t; * Send immediate data with the given request. * * IB_SEND_OPT_FENCE -* The operation is fenced. Complete all pending send operations -* before processing this request. +* The operation is fenced. Complete all pending send operations +* before processing this request. * * IB_SEND_OPT_SIGNALED * If the queue pair is configured for signaled completion, then @@ -10091,13 +10115,13 @@ typedef uint32_t ib_send_opt_t; * vendor specific restrictions on the size of send operation that may * be performed as inline. * -* +* * IB_SEND_OPT_LOCAL * Indicates that a sent MAD request should be given to the local VPD for * processing. MADs sent using this option are not placed on the wire. * This send option is only valid for MAD send operations. * -* +* * IB_SEND_OPT_VEND_MASK * This mask indicates bits reserved in the send options that may be used * by the verbs provider to indicate vendor specific options. Bits set @@ -10138,14 +10162,14 @@ typedef struct _ib_send_wr } ud; - struct _send_rd - { - ib_net32_t remote_qp; - ib_net32_t remote_qkey; - ib_net32_t eecn; - - } rd; - + struct _send_rd + { + ib_net32_t remote_qp; + ib_net32_t remote_qkey; + ib_net32_t eecn; + + } rd; + struct _send_raw_ether { ib_net16_t dest_lid; @@ -10630,16 +10654,16 @@ typedef struct _ib_wc } ud; - struct _wc_rd - { - ib_net32_t remote_eecn; - ib_net32_t remote_qp; - ib_net16_t remote_lid; - uint8_t remote_sl; - uint32_t free_cnt; - - } rd; - + struct _wc_rd + { + ib_net32_t remote_eecn; + ib_net32_t remote_qp; + ib_net16_t remote_lid; + uint8_t remote_sl; + uint32_t free_cnt; + + } rd; + struct _wc_raw_ipv6 { ib_net16_t remote_lid; @@ -10675,7 +10699,7 @@ typedef struct _ib_wc * wc_type * Indicates the type of work completion. * -* +* * length * The total length of the data sent or received with the work request. * @@ -10707,8 +10731,8 @@ typedef struct _ib_wc * Identifies the source queue pair of a received datagram. * * recv.ud.pkey_index -* The pkey index for the source queue pair. This is valid only for -* GSI type QP's. +* The pkey index for the source queue pair. This is valid only for +* GSI type QP's. * * recv.ud.remote_lid * The source LID of the received datagram. @@ -10719,23 +10743,23 @@ typedef struct _ib_wc * recv.ud.path_bits * path bits... * -* recv.rd.remote_eecn -* The remote end-to-end context number that sent the received message. -* -* recv.rd.remote_qp -* Identifies the source queue pair of a received message. -* -* recv.rd.remote_lid -* The source LID of the received message. -* -* recv.rd.remote_sl -* The service level used by the source of the received message. -* -* recv.rd.free_cnt -* The number of available entries in the completion queue. Reliable -* datagrams may complete out of order, so this field may be used to -* determine the number of additional completions that may occur. -* +* recv.rd.remote_eecn +* The remote end-to-end context number that sent the received message. +* +* recv.rd.remote_qp +* Identifies the source queue pair of a received message. +* +* recv.rd.remote_lid +* The source LID of the received message. +* +* recv.rd.remote_sl +* The service level used by the source of the received message. +* +* recv.rd.free_cnt +* The number of available entries in the completion queue. Reliable +* datagrams may complete out of order, so this field may be used to +* determine the number of additional completions that may occur. +* * recv.raw_ipv6.remote_lid * The source LID of the received message. * @@ -10839,6 +10863,47 @@ typedef struct _mlnx_fmr_create * ib_access_t *****/ + +/****s* Access Layer/mlnx_fmr_pool_create_t +* NAME +* mlnx_fmr_pool_create_t +* +* DESCRIPTION +* Information required to create a Mellanox fast memory region pool. +* +* SYNOPSIS +*/ +typedef struct _mlnx_fmr_pool_create +{ + int max_pages_per_fmr; + uint8_t page_size; /* really - page_shift, log2 of page_size */ + enum ib_access_flags access_ctrl; + int pool_size; + int dirty_watermark; + void (*flush_function)(mlnx_fmr_pool_handle_t h_pool, void *arg); + void *flush_arg; + boolean_t cache; +} mlnx_fmr_pool_create_t; +/* +* FIELDS +* max_pages +* max pages in the region. +* +* max_maps +* max times, the region can be mapped before remapping. +* +* page_size +* log2 of the page size (e.g. 12 for 4KB). +* +* access_ctrl +* Access rights of the registered region. +* +* NOTES +* This is a Mellanox specific extension to verbs. +* +* SEE ALSO +* ib_access_t +*****/ #endif /****s* Access Layer/ib_phys_range_t @@ -11024,28 +11089,28 @@ typedef uint32_t ib_ca_mod_t; * Indicates if there is an SNMP agent accessible through the port. * * IB_CA_MOD_IS_DEV_MGMT_SUPPORTED -* Indicates if there is a device management agent accessible -* through the port. +* Indicates if there is a device management agent accessible +* through the port. * * IB_CA_MOD_IS_VEND_SUPPORTED -* Indicates if there is a vendor supported agent accessible -* through the port. +* Indicates if there is a vendor supported agent accessible +* through the port. * * IB_CA_MOD_IS_SM * Indicates if there is a subnet manager accessible through * the port. * * IB_CA_MOD_IS_SM_DISABLED -* Indicates if the port has been disabled for configuration by the -* subnet manager. +* Indicates if the port has been disabled for configuration by the +* subnet manager. * * IB_CA_MOD_QKEY_CTR -* Used to reset the qkey violation counter associated with the -* port. +* Used to reset the qkey violation counter associated with the +* port. * * IB_CA_MOD_PKEY_CTR -* Used to reset the pkey violation counter associated with the -* port. +* Used to reset the pkey violation counter associated with the +* port. * * IB_CA_MOD_IS_NOTICE_SUPPORTED * Indicates that this CA supports ability to generate Notices for @@ -11056,8 +11121,8 @@ typedef uint32_t ib_ca_mod_t; * trap messages. (only applicable to switches) * * IB_CA_MOD_IS_APM_SUPPORTED -* Indicates that this port is capable of performing Automatic -* Path Migration. +* Indicates that this port is capable of performing Automatic +* Path Migration. * * IB_CA_MOD_IS_SLMAP_SUPPORTED * Indicates this port supports SLMAP capability. @@ -11264,4 +11329,5 @@ typedef struct _ib_ci_op #endif /* __IB_TYPES_H__ */ - + + diff --git a/trunk/inc/kernel/iba/ib_al_ifc.h b/trunk/inc/kernel/iba/ib_al_ifc.h index b8fefadc..de4ce45b 100644 --- a/trunk/inc/kernel/iba/ib_al_ifc.h +++ b/trunk/inc/kernel/iba/ib_al_ifc.h @@ -47,7 +47,7 @@ * IB resources provided by HCAs. *********/ -#define AL_INTERFACE_VERSION (10) +#define AL_INTERFACE_VERSION (11) @@ -309,16 +309,48 @@ typedef ib_api_status_t (*mlnx_pfn_destroy_fmr_t)( IN mlnx_fmr_handle_t const h_fmr ); + +typedef ib_api_status_t +(*mlnx_pfn_create_fmr_pool_t)( + IN const ib_pd_handle_t h_pd, + IN const mlnx_fmr_pool_create_t *p_fmr_pool_attr, + OUT mlnx_fmr_pool_handle_t* const ph_pool ); + + +typedef ib_api_status_t +(*mlnx_pfn_destroy_fmr_pool_t)( + IN const mlnx_fmr_pool_handle_t h_pool ); + + +typedef ib_api_status_t +(*mlnx_pfn_map_phys_fmr_pool_t)( + IN const mlnx_fmr_pool_handle_t h_pool , + IN const uint64_t* const paddr_list, + IN const int list_len, + IN OUT uint64_t* const p_vaddr, + OUT net32_t* const p_lkey, + OUT net32_t* const p_rkey, + OUT mlnx_fmr_pool_el_t *p_fmr_el); + +typedef ib_api_status_t +(*mlnx_pfn_unmap_fmr_pool_t)( + IN mlnx_fmr_pool_el_t p_fmr_el ); + +typedef ib_api_status_t +(*mlnx_pfn_flush_fmr_pool_t)( + IN const mlnx_fmr_pool_handle_t h_pool ); + + typedef ib_api_status_t (*ib_pfn_create_mw_t)( IN const ib_pd_handle_t h_pd, OUT uint32_t* const p_rkey, - OUT ib_mw_handle_t* const ph_mw ); + OUT ib_mw_handle_t* const ph_mw ); typedef ib_api_status_t (*ib_pfn_query_mw_t)( IN const ib_mw_handle_t h_mw, - OUT ib_pd_handle_t* const ph_pd, + OUT ib_pd_handle_t* const ph_pd, OUT uint32_t* const p_rkey ); typedef ib_api_status_t @@ -716,6 +748,12 @@ typedef struct _ib_al_ifc mlnx_pfn_map_phys_fmr_t map_phys_mlnx_fmr; mlnx_pfn_unmap_fmr_t unmap_mlnx_fmr; mlnx_pfn_destroy_fmr_t destroy_mlnx_fmr; + mlnx_pfn_create_fmr_pool_t create_mlnx_fmr_pool; + mlnx_pfn_destroy_fmr_pool_t destroy_mlnx_fmr_pool; + mlnx_pfn_map_phys_fmr_pool_t map_phys_mlnx_fmr_pool; + mlnx_pfn_unmap_fmr_pool_t unmap_mlnx_fmr_pool; + mlnx_pfn_flush_fmr_pool_t flush_mlnx_fmr_pool; + ib_pfn_create_srq_t create_srq; ib_pfn_query_srq_t query_srq; ib_pfn_modify_srq_t modify_srq; diff --git a/trunk/ulp/srp/kernel/ib_srp.inf b/trunk/ulp/srp/kernel/ib_srp.inf index 650632ae..ceb1eb2a 100644 --- a/trunk/ulp/srp/kernel/ib_srp.inf +++ b/trunk/ulp/srp/kernel/ib_srp.inf @@ -105,6 +105,7 @@ HKR,"Parameters\PnpInterface",%InternalBus%,%REG_DWORD%,1 HKR,"Parameters\PnpInterface",%PNPBus%,%REG_DWORD%,1 HKR,"Parameters","DebugLevel",%REG_DWORD%,2 HKR,"Parameters","DebugFlags",%REG_DWORD%,0x00ffffff +HKR,"Parameters","ModeFlags",%REG_DWORD%,0 ; ; == The NT EventLog entries are the same for all SCSI miniports. == diff --git a/trunk/ulp/srp/kernel/srp.h b/trunk/ulp/srp/kernel/srp.h index c508fbb6..626af3ec 100644 --- a/trunk/ulp/srp/kernel/srp.h +++ b/trunk/ulp/srp/kernel/srp.h @@ -49,7 +49,8 @@ #define SRP_EXTENSION_ID_LENGTH 16 /* Service name extension ID length */ #define SRP_MIN_IU_SIZE 64 -#define SRP_MAX_IU_SIZE 340 +#define SRP_MAX_SG_IN_INDIRECT_DATA_BUFFER 257 /* it was 16 */ +#define SRP_MAX_IU_SIZE (SRP_MIN_IU_SIZE + 20 + 16*SRP_MAX_SG_IN_INDIRECT_DATA_BUFFER) #define SRP_MIN_INI_TO_TGT_IU 64 // Minimum initiator message size #define SRP_MIN_TGT_TO_INI_IU 56 // Minimum target message size diff --git a/trunk/ulp/srp/kernel/srp_connection.c b/trunk/ulp/srp/kernel/srp_connection.c index e7705439..e1caea7b 100644 --- a/trunk/ulp/srp/kernel/srp_connection.c +++ b/trunk/ulp/srp/kernel/srp_connection.c @@ -443,6 +443,16 @@ __srp_cm_reply_cb( p_connection->request_limit = MIN( get_srp_login_response_request_limit_delta( p_srp_login_rsp ), SRP_DEFAULT_RECV_Q_DEPTH ); + + p_connection->request_threashold = 2; +#if DBG + p_srp_session->x_req_limit = p_connection->request_limit; +#endif + SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG, + ( "request_limit_delta %d, SRP_DEFAULT_RECV_Q_DEPTH %d, request_threashold %d\n", + get_srp_login_response_request_limit_delta( p_srp_login_rsp ), + SRP_DEFAULT_RECV_Q_DEPTH, p_connection->request_threashold )); + p_connection->send_queue_depth = p_connection->request_limit; p_connection->recv_queue_depth = p_connection->request_limit; p_connection->init_to_targ_iu_sz = get_srp_login_response_max_init_to_targ_iu( p_srp_login_rsp ); @@ -476,6 +486,9 @@ __srp_cm_reply_cb( p_connection->targ_to_init_iu_sz, p_connection->max_scatter_gather_entries) ); + /* will be used in srp_find_adapter to calculate NumberOfPhysicalBreaks */ + p_srp_session->p_hba->max_sg = p_connection->max_scatter_gather_entries; + u.cm_mra.svc_timeout = 0x08; u.cm_mra.p_mra_pdata = NULL; u.cm_mra.mra_length = 0; @@ -516,15 +529,7 @@ __srp_cm_reply_cb( p_connection->h_qp ); if ( status != IB_SUCCESS ) { - cl_free( p_connection->p_wc_array ); - p_connection->p_wc_array = NULL; - p_connection->p_wc_free_list = NULL; -rej: - p_connection->state = SRP_CONNECT_FAILURE; - cl_memclr( &u.cm_rej, sizeof(u.cm_rej) ); - u.cm_rej.rej_status = IB_REJ_INSUF_RESOURCES; - p_ifc->cm_rej( p_cm_reply->h_cm_rep, &u.cm_rej ); - goto exit; + goto err_init_desc; } u.cm_rtu.access_ctrl = IB_AC_LOCAL_WRITE | IB_AC_RDMA_READ | IB_AC_RDMA_WRITE; @@ -543,8 +548,7 @@ rej: { SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, ("Cannot Send RTU. Status = %d\n", status) ); - p_connection->state = SRP_CONNECT_FAILURE; - goto exit; + goto err_send_rtu; } p_connection->state = SRP_CONNECTED; @@ -556,8 +560,7 @@ rej: ("ib_rearm_cq() for send cq failed!, status 0x%x", status) ); // TODO: Kill session and inform port driver link down storportnotification - p_connection->state = SRP_CONNECT_FAILURE; - goto exit; + goto err_send_rtu; } status = p_ifc->rearm_cq( p_connection->h_recv_cq, FALSE ); @@ -567,9 +570,23 @@ rej: ("ib_rearm_cq() for recv failed!, status 0x%x", status) ); // TODO: Kill session and inform port driver link down storportnotification - p_connection->state = SRP_CONNECT_FAILURE; + goto err_send_rtu; } + goto exit; +err_send_rtu: + // the rest will be cleaned up in srp_session_login + +err_init_desc: + cl_free( p_connection->p_wc_array ); + p_connection->p_wc_array = NULL; + p_connection->p_wc_free_list = NULL; + +rej: + p_connection->state = SRP_CONNECT_FAILURE; + cl_memclr( &u.cm_rej, sizeof(u.cm_rej) ); + u.cm_rej.rej_status = IB_REJ_INSUF_RESOURCES; + p_ifc->cm_rej( p_cm_reply->h_cm_rep, &u.cm_rej ); exit: cl_status = cl_event_signal( &p_connection->conn_req_event ); @@ -687,7 +704,10 @@ __srp_issue_session_login( status = IB_ERROR; goto exit; } - p_connection->req_max_iu_msg_size = ( p_connection->ioc_max_send_msg_size >= SRP_MAX_IU_SIZE )? SRP_MAX_IU_SIZE: p_connection->ioc_max_send_msg_size; + p_connection->req_max_iu_msg_size = ( p_connection->ioc_max_send_msg_size >= SRP_MAX_IU_SIZE ) ? SRP_MAX_IU_SIZE: p_connection->ioc_max_send_msg_size; + SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_ERROR, + ( "(init_to_targ_iu_sz requested) req_max_iu_msg_size %d, (from profile) ioc_max_send_msg_size %d\n", + p_connection->req_max_iu_msg_size, p_connection->ioc_max_send_msg_size )); /* Build SRP Login request */ @@ -706,7 +726,7 @@ __srp_issue_session_login( cm_req.qp_type = IB_QPT_RELIABLE_CONN; cm_req.h_qp = p_connection->h_qp; - /* The maximum number of outstanding RDMA read/atomic operations. */ + /* The maximum number of outstanding RDMA read/atomic operations. */ status = srp_get_responder_resources( p_hca, &cm_req.resp_res ); if ( status != IB_SUCCESS ) { diff --git a/trunk/ulp/srp/kernel/srp_connection.h b/trunk/ulp/srp/kernel/srp_connection.h index 5cfab6fa..d9810f8d 100644 --- a/trunk/ulp/srp/kernel/srp_connection.h +++ b/trunk/ulp/srp/kernel/srp_connection.h @@ -80,6 +80,7 @@ typedef struct _srp_connection atomic32_t tag; atomic32_t request_limit; + int32_t request_threashold; uint32_t init_to_targ_iu_sz; uint32_t targ_to_init_iu_sz; diff --git a/trunk/ulp/srp/kernel/srp_data_path.c b/trunk/ulp/srp/kernel/srp_data_path.c index 0b8fe703..cc41615c 100644 --- a/trunk/ulp/srp/kernel/srp_data_path.c +++ b/trunk/ulp/srp/kernel/srp_data_path.c @@ -59,6 +59,118 @@ // Final address is of the form 0b00ttttttllllllll #define BUILD_SCSI_ADDRESS(lun) ((uint64_t)lun << 48) +#define SRP_REQUEST_LIMIT_THRESHOLD 2 + +static ib_api_status_t +__srp_map_fmr( + IN PVOID p_dev_ext, + IN PSTOR_SCATTER_GATHER_LIST p_scatter_gather_list, + IN srp_send_descriptor_t *p_send_descriptor, + IN OUT srp_memory_descriptor_t *p_memory_descriptor) +{ + srp_hba_t *p_hba = ((srp_ext_t *)p_dev_ext)->p_hba; + PSTOR_SCATTER_GATHER_ELEMENT p_sg_element; + uint32_t total_len = 0; + uint32_t i,j,list_len = 0; + uint64_t *p_addr_list; + uint64_t vaddr=0; + ib_api_status_t status; + srp_hca_t hca; + uint64_t fmr_page_mask; + net32_t lkey; + net32_t rkey; + srp_session_t *p_srp_session; + mlnx_fmr_pool_el_t p_fmr_el; + + SRP_ENTER( SRP_DBG_DATA ); + + if (g_srp_mode_flags & SRP_MODE_NO_FMR_POOL) + return IB_UNSUPPORTED; + + p_srp_session = p_hba->session_list[p_send_descriptor->p_srb->TargetId]; + if ( p_srp_session == NULL ) + return IB_INVALID_STATE; + + hca = p_srp_session->hca; + fmr_page_mask = ~(hca.fmr_page_size-1); + + for ( i = 0, p_sg_element = p_scatter_gather_list->List; + i < p_scatter_gather_list->NumberOfElements; + i++, p_sg_element++ ) + { + uint32_t dma_len = p_sg_element->Length; + + if (p_sg_element->PhysicalAddress.QuadPart & ~fmr_page_mask) { + if (i > 0) + { // buffer start not from the beginning of the page is allowed only for the first SG element + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("Unaligned address at the begin of the list\n") ); + return IB_INVALID_PARAMETER; + } + } + + if ((p_sg_element->PhysicalAddress.QuadPart + dma_len) & ~fmr_page_mask) { + if (i < (uint32_t)p_scatter_gather_list->NumberOfElements -1) + { // buffer end not on the beginning of the page is allowed only for the last SG element + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("Unaligned address at the end of the list\n") ); + return IB_INVALID_PARAMETER; + } + } + + total_len += p_sg_element->Length; + list_len += (p_sg_element->Length + (hca.fmr_page_size-1)) >> hca.fmr_page_shift; + } + + + p_addr_list = cl_zalloc(sizeof(uint64_t)*list_len); + if(!p_addr_list) + { + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,("Failed to allocate page list\n")); + return IB_INSUFFICIENT_MEMORY; + } + + list_len = 0; + for ( i = 0, p_sg_element = p_scatter_gather_list->List; + i < p_scatter_gather_list->NumberOfElements; + i++, p_sg_element++ ) + { + uint32_t dma_len = p_sg_element->Length; + for( j = 0; j < dma_len; j+=PAGE_SIZE) + { + p_addr_list[list_len++] = (p_sg_element->PhysicalAddress.QuadPart & fmr_page_mask) + j; + } + } + + p_send_descriptor->p_fmr_el = NULL; + status = p_hba->ifc.map_phys_mlnx_fmr_pool + (hca.h_fmr_pool, p_addr_list, list_len, &vaddr, &lkey, &rkey, &p_fmr_el ); + + cl_free( p_addr_list ); + + if(status != IB_SUCCESS) + { + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,("Failed to map fmr\n")); + return status; + } + + p_send_descriptor->p_fmr_el = p_fmr_el; + p_sg_element = p_scatter_gather_list->List; + + p_memory_descriptor->virtual_address = cl_hton64( p_sg_element->PhysicalAddress.QuadPart & ~fmr_page_mask); + p_memory_descriptor->memory_handle = rkey; + p_memory_descriptor->data_length = cl_hton32( total_len); + +#if DBG + /* statistics */ + p_srp_session->x_pkt_fmr++; +#endif + + SRP_EXIT( SRP_DBG_DATA ); + return IB_SUCCESS; +} + + static inline void @@ -93,7 +205,7 @@ __srp_dump_srb_info(srp_send_descriptor_t* p_send_descriptor) static inline void __srp_process_session_send_completions( - IN srp_session_t *p_session ) + IN srp_session_t *p_srp_session ) { ib_api_status_t status; ib_wc_t *p_wc_done_list = NULL; @@ -101,18 +213,18 @@ __srp_process_session_send_completions( SRP_ENTER( SRP_DBG_DATA ); - cl_obj_lock( &p_session->obj ); + cl_obj_lock( &p_srp_session->obj ); - if ( p_session->connection.state != SRP_CONNECTED ) + if ( p_srp_session->connection.state != SRP_CONNECTED ) { - cl_obj_unlock( &p_session->obj ); + cl_obj_unlock( &p_srp_session->obj ); SRP_EXIT( SRP_DBG_DATA ); return; } - status = p_session->p_hba->ifc.poll_cq( - p_session->connection.h_send_cq, - &p_session->connection.p_wc_free_list, + status = p_srp_session->p_hba->ifc.poll_cq( + p_srp_session->connection.h_send_cq, + &p_srp_session->connection.p_wc_free_list, &p_wc_done_list ); if ( status != IB_SUCCESS ) { @@ -120,12 +232,12 @@ __srp_process_session_send_completions( ("ib_poll_cq() failed!, status 0x%x\n", status) ); // TODO: Kill session and inform port driver link down scsiportnotification - cl_obj_unlock( &p_session->obj ); + cl_obj_unlock( &p_srp_session->obj ); return; } - cl_obj_ref( &p_session->obj ); - cl_obj_unlock( &p_session->obj ); + cl_obj_ref( &p_srp_session->obj ); + cl_obj_unlock( &p_srp_session->obj ); while ( (p_wc = p_wc_done_list) != NULL ) { @@ -145,7 +257,7 @@ __srp_process_session_send_completions( // TODO: Kill session and inform port driver link down scsiportnotification SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA, ("Send Completion Status %s Vendore Status = 0x%x, \n", - p_session->p_hba->ifc.get_wc_status_str( p_wc->status ), + p_srp_session->p_hba->ifc.get_wc_status_str( p_wc->status ), (int)p_wc->vendor_specific)); SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA, @@ -162,7 +274,7 @@ __srp_process_session_send_completions( // TODO: Kill session and inform port driver link down scsiportnotification SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, ("Send Completion Status %s Vendore Status = 0x%x, \n", - p_session->p_hba->ifc.get_wc_status_str( p_wc->status ), + p_srp_session->p_hba->ifc.get_wc_status_str( p_wc->status ), (int)p_wc->vendor_specific)); SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, @@ -178,18 +290,18 @@ __srp_process_session_send_completions( } /* Put onto head of free list */ - cl_obj_lock( &p_session->obj ); - p_wc->p_next = p_session->connection.p_wc_free_list; - p_session->connection.p_wc_free_list = p_wc; - cl_obj_unlock( &p_session->obj ); + cl_obj_lock( &p_srp_session->obj ); + p_wc->p_next = p_srp_session->connection.p_wc_free_list; + p_srp_session->connection.p_wc_free_list = p_wc; + cl_obj_unlock( &p_srp_session->obj ); /* Get next completion */ p_wc = p_wc_done_list; } /* Re-arm the CQ for more completions */ - status = p_session->p_hba->ifc.rearm_cq( - p_session->connection.h_send_cq, FALSE ); + status = p_srp_session->p_hba->ifc.rearm_cq( + p_srp_session->connection.h_send_cq, FALSE ); if ( status != IB_SUCCESS) { SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, @@ -198,7 +310,7 @@ __srp_process_session_send_completions( // TODO: Kill session and inform port driver link down scsiportnotification } - cl_obj_deref( &p_session->obj ); + cl_obj_deref( &p_srp_session->obj ); SRP_EXIT( SRP_DBG_DATA ); } @@ -216,22 +328,173 @@ srp_send_completion_cb( IN const ib_cq_handle_t h_cq, IN void *p_context ) { - srp_session_t *p_session = (srp_session_t *)p_context; + srp_session_t *p_srp_session = (srp_session_t *)p_context; SRP_ENTER( SRP_DBG_DATA ); UNUSED_PARAM( h_cq ); - __srp_process_session_send_completions( p_session ); + __srp_process_session_send_completions( p_srp_session ); + + SRP_EXIT( SRP_DBG_DATA ); +} + + +static inline ib_api_status_t +__srp_clean_send_descriptor( + IN srp_send_descriptor_t *p_send_descriptor, + IN srp_session_t *p_srp_session ) +{ + ib_api_status_t status = IB_SUCCESS; + + if(p_srp_session && p_send_descriptor && p_send_descriptor->p_fmr_el) + { + status = p_srp_session->p_hba->ifc.unmap_mlnx_fmr_pool(p_send_descriptor->p_fmr_el); + p_send_descriptor->p_fmr_el = NULL; + } + return status; +} + +void +__srp_post_io_request( + IN PVOID p_dev_ext, + IN OUT PSCSI_REQUEST_BLOCK p_srb, + srp_session_t *p_srp_session ) +{ + ib_api_status_t status; + srp_send_descriptor_t *p_send_descriptor = (srp_send_descriptor_t *)p_srb->SrbExtension; + + SRP_ENTER( SRP_DBG_DATA ); + + status = srp_post_send_descriptor( &p_srp_session->descriptors, + p_send_descriptor, + p_srp_session ); + + if ( status == IB_SUCCESS ) + { + cl_atomic_dec( &p_srp_session->connection.request_limit ); +#if DBG + { /* statistics */ + uint32_t size = (uint32_t)cl_qlist_count(&p_srp_session->descriptors.sent_descriptors); + p_srp_session->x_sent_num++; + p_srp_session->x_sent_total += size; + if ( p_srp_session->x_sent_max < size ) + p_srp_session->x_sent_max = size; + } +#endif + goto exit; + } + else + { + p_srb->SrbStatus = SRB_STATUS_NO_HBA; + + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, " + "Target = 0x%x, Lun = 0x%x, tag 0x%I64xn", + g_srb_status_name[p_srb->SrbStatus], + p_srb->SrbStatus, + g_srb_function_name[p_srb->Function], + p_srb->Function, + p_srb->PathId, + p_srb->TargetId, + p_srb->Lun, + get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) ); + + status = __srp_clean_send_descriptor( p_send_descriptor, p_srp_session ); + if ( status != IB_SUCCESS ) + { + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("Failed to unmap FMR Status = %d.\n", status) ); + // TODO: Kill session and inform port driver link down storportnotification + } + + StorPortNotification( RequestComplete, p_dev_ext, p_srb ); + } + +exit: + SRP_EXIT( SRP_DBG_DATA ); +} + +static +void +__srp_repost_io_request( + IN srp_session_t *p_srp_session ) +{ + srp_hba_t *p_hba; + srp_send_descriptor_t *p_send_descriptor = NULL; + srp_descriptors_t *p_descriptors = &p_srp_session->descriptors; + + SRP_ENTER( SRP_DBG_DATA ); + + if ( !cl_qlist_count(&p_descriptors->pending_descriptors) || + (p_srp_session->connection.request_limit <= p_srp_session->connection.request_threashold) ) + goto exit; + +#if DBG + { /* statistics */ + uint32_t size = (uint32_t)cl_qlist_count(&p_descriptors->pending_descriptors); + p_srp_session->x_pend_num++; + p_srp_session->x_pend_total += size; + if ( p_srp_session->x_pend_max < size ) + p_srp_session->x_pend_max = size; + } +#endif + + /* in case when the follows loop will release the last pending request for sending it, + there will be race between it and StorPort, that can call srp_post_io_request + just at that moment. In the "worst" case it will cause changing order between 2 posting. + The flag 'repost_is_on' is intended for preventing ths case */ + cl_atomic_inc( &p_srp_session->repost_is_on ); + + while (p_srp_session->connection.request_limit > p_srp_session->connection.request_threashold) + { + cl_list_item_t *p_list_item; + /* extract a pending descriptor, if any */ + cl_spinlock_acquire ( &p_descriptors->pending_list_lock ); + p_list_item = cl_qlist_remove_head( &p_descriptors->pending_descriptors ); + if ( p_list_item == cl_qlist_end( &p_descriptors->pending_descriptors ) ) + { + cl_spinlock_release ( &p_descriptors->pending_list_lock ); + break; + } + cl_spinlock_release ( &p_descriptors->pending_list_lock ); + + /* post the request */ + p_hba = p_srp_session->p_hba; + p_send_descriptor = PARENT_STRUCT(p_list_item, srp_send_descriptor_t,list_item); + __srp_post_io_request( p_hba->p_ext, p_send_descriptor->p_srb, p_srp_session ); + } + + cl_atomic_dec( &p_srp_session->repost_is_on ); + +exit: SRP_EXIT( SRP_DBG_DATA ); } + +static inline void +__srp_fix_request_limit( + IN srp_session_t *p_srp_session, + IN srp_rsp_t *p_srp_rsp ) +{ + int32_t rld = get_srp_response_request_limit_delta( p_srp_rsp ); + cl_atomic_add( &p_srp_session->connection.request_limit, rld ); +#if DBG + /* statistics */ + p_srp_session->x_rld_num++; + p_srp_session->x_rld_total += rld; + if ( p_srp_session->x_rld_max < rld ) + p_srp_session->x_rld_max = rld; + if ( p_srp_session->x_rld_min > rld ) + p_srp_session->x_rld_min = rld; +#endif +} static inline ib_api_status_t __srp_process_recv_completion( IN srp_recv_descriptor_t *p_recv_descriptor, - IN srp_session_t *p_session ) + IN srp_session_t *p_srp_session ) { ib_api_status_t status = IB_SUCCESS; srp_rsp_t *p_srp_rsp; @@ -247,13 +510,13 @@ __srp_process_recv_completion( response_status = get_srp_response_status( p_srp_rsp ); p_send_descriptor = srp_find_matching_send_descriptor( - &p_session->descriptors, + &p_srp_session->descriptors, get_srp_response_tag( (srp_rsp_t *)p_recv_descriptor->p_data_segment ) ); if ( p_send_descriptor == NULL ) { /* Repost the recv descriptor */ - status = p_session->p_hba->ifc.post_recv( - p_session->connection.h_qp, &p_recv_descriptor->wr, NULL ); + status = p_srp_session->p_hba->ifc.post_recv( + p_srp_session->connection.h_qp, &p_recv_descriptor->wr, NULL ); if ( status != IB_SUCCESS ) { SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, @@ -261,7 +524,8 @@ __srp_process_recv_completion( // TODO: Kill session and inform port driver link down scsiportnotification } - cl_atomic_add( &p_session->connection.request_limit, get_srp_response_request_limit_delta( p_srp_rsp ) ); + __srp_fix_request_limit( p_srp_session, p_srp_rsp ); + __srp_repost_io_request( p_srp_session ); SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA, ("Matching Send Descriptor Not Found.\n") ); @@ -311,8 +575,8 @@ __srp_process_recv_completion( if ( get_srp_tsk_mgmt_task_management_flags( p_srp_tsk_mgmt ) == TMF_ABORT_TASK ) { /* Repost the recv descriptor */ - status = p_session->p_hba->ifc.post_recv( - p_session->connection.h_qp, &p_recv_descriptor->wr, NULL ); + status = p_srp_session->p_hba->ifc.post_recv( + p_srp_session->connection.h_qp, &p_recv_descriptor->wr, NULL ); if ( status != IB_SUCCESS ) { SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, @@ -320,11 +584,24 @@ __srp_process_recv_completion( // TODO: Kill session and inform port driver link down storportnotification } - cl_atomic_add( &p_session->connection.request_limit, get_srp_response_request_limit_delta( p_srp_rsp ) ); + __srp_fix_request_limit( p_srp_session, p_srp_rsp ); + __srp_repost_io_request( p_srp_session ); + __srp_dump_srb_info( p_send_descriptor); - StorPortNotification( RequestComplete, p_session->p_hba->p_ext, p_send_descriptor->p_srb ); + status = __srp_clean_send_descriptor( p_send_descriptor, p_srp_session ); + if ( status != IB_SUCCESS ) + { + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("Failed to unmap FMR Status = %d.\n", status) ); + // TODO: Kill session and inform port driver link down storportnotification + } + + StorPortNotification( RequestComplete, p_srp_session->p_hba->p_ext, p_send_descriptor->p_srb ); } + + + break; } @@ -411,7 +688,7 @@ __srp_process_recv_completion( /* initiate session recovery */ SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA, ("Sense Data indicates FC link connectivity has been lost.\n") ); - StorPortPauseDevice( p_session->p_hba->p_ext, + StorPortPauseDevice( p_srp_session->p_hba->p_ext, p_send_descriptor->p_srb->PathId, p_send_descriptor->p_srb->TargetId, p_send_descriptor->p_srb->Lun, @@ -436,8 +713,8 @@ __srp_process_recv_completion( p_send_descriptor->p_srb->DataBuffer ).QuadPart) ); /* Repost the recv descriptor */ - status = p_session->p_hba->ifc.post_recv( - p_session->connection.h_qp, &p_recv_descriptor->wr, NULL ); + status = p_srp_session->p_hba->ifc.post_recv( + p_srp_session->connection.h_qp, &p_recv_descriptor->wr, NULL ); if ( status != IB_SUCCESS ) { SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, @@ -445,10 +722,20 @@ __srp_process_recv_completion( // TODO: Kill session and inform port driver link down storportnotification } - cl_atomic_add( &p_session->connection.request_limit, get_srp_response_request_limit_delta( p_srp_rsp ) ); + __srp_fix_request_limit( p_srp_session, p_srp_rsp ); + __srp_repost_io_request( p_srp_session ); + __srp_dump_srb_info( p_send_descriptor); - StorPortNotification( RequestComplete, p_session->p_hba->p_ext, p_send_descriptor->p_srb ); + status = __srp_clean_send_descriptor( p_send_descriptor, p_srp_session ); + if ( status != IB_SUCCESS ) + { + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("Failed to unmap FMR Status = %d.\n", status) ); + // TODO: Kill session and inform port driver link down storportnotification + } + + StorPortNotification( RequestComplete, p_srp_session->p_hba->p_ext, p_send_descriptor->p_srb ); break; case SRP_LOGIN_REQ: @@ -469,7 +756,7 @@ exit: static inline void __srp_process_session_recv_completions( - IN srp_session_t *p_session ) + IN srp_session_t *p_srp_session ) { ib_api_status_t status; ib_wc_t *p_wc_done_list; @@ -477,18 +764,18 @@ __srp_process_session_recv_completions( SRP_ENTER( SRP_DBG_DATA ); - cl_obj_lock( &p_session->obj ); + cl_obj_lock( &p_srp_session->obj ); - if ( p_session->connection.state != SRP_CONNECTED ) + if ( p_srp_session->connection.state != SRP_CONNECTED ) { - cl_obj_unlock( &p_session->obj ); + cl_obj_unlock( &p_srp_session->obj ); SRP_EXIT( SRP_DBG_DATA ); return; } - status = p_session->p_hba->ifc.poll_cq( - p_session->connection.h_recv_cq, - &p_session->connection.p_wc_free_list, + status = p_srp_session->p_hba->ifc.poll_cq( + p_srp_session->connection.h_recv_cq, + &p_srp_session->connection.p_wc_free_list, &p_wc_done_list ); if ( status != IB_SUCCESS ) { @@ -497,12 +784,12 @@ __srp_process_session_recv_completions( // TODO: Kill session and inform port driver link down scsiportnotification SRP_EXIT( SRP_DBG_DATA ); - cl_obj_unlock( &p_session->obj ); + cl_obj_unlock( &p_srp_session->obj ); return; } - cl_obj_ref( &p_session->obj ); - cl_obj_unlock( &p_session->obj ); + cl_obj_ref( &p_srp_session->obj ); + cl_obj_unlock( &p_srp_session->obj ); while ( (p_wc = p_wc_done_list) != NULL ) { @@ -516,7 +803,7 @@ __srp_process_session_recv_completions( if ( p_wc->status == IB_WCS_SUCCESS ) { - status = __srp_process_recv_completion( p_recv_descriptor, p_session ); + status = __srp_process_recv_completion( p_recv_descriptor, p_srp_session ); if ( status != IB_SUCCESS ) { // TODO: Kill session and inform port driver link down scsiportnotification @@ -528,31 +815,31 @@ __srp_process_session_recv_completions( { SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, ("Recv Completion with Error Status %s (vendore specific %#x)\n", - p_session->p_hba->ifc.get_wc_status_str( p_wc->status ), + p_srp_session->p_hba->ifc.get_wc_status_str( p_wc->status ), (int)p_wc->vendor_specific) ); } else { SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA, ("Recv Completion Flushed in Error Status: %s\n", - p_session->p_hba->ifc.get_wc_status_str( p_wc->status ))); + p_srp_session->p_hba->ifc.get_wc_status_str( p_wc->status ))); } } /* Put onto head of free list */ - cl_obj_lock( &p_session->obj ); - p_wc->p_next = p_session->connection.p_wc_free_list; - p_session->connection.p_wc_free_list = p_wc; - cl_obj_unlock( &p_session->obj ); + cl_obj_lock( &p_srp_session->obj ); + p_wc->p_next = p_srp_session->connection.p_wc_free_list; + p_srp_session->connection.p_wc_free_list = p_wc; + cl_obj_unlock( &p_srp_session->obj ); /* Get next completion */ p_wc = p_wc_done_list; } /* Re-arm the CQ for more completions */ - status = p_session->p_hba->ifc.rearm_cq( - p_session->connection.h_recv_cq, FALSE ); + status = p_srp_session->p_hba->ifc.rearm_cq( + p_srp_session->connection.h_recv_cq, FALSE ); if ( status != IB_SUCCESS) { SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, @@ -561,7 +848,7 @@ __srp_process_session_recv_completions( // TODO: Kill session and inform port driver link down scsiportnotification } - cl_obj_deref( &p_session->obj ); + cl_obj_deref( &p_srp_session->obj ); SRP_EXIT( SRP_DBG_DATA ); } @@ -579,13 +866,13 @@ srp_recv_completion_cb( IN const ib_cq_handle_t h_cq, IN void *p_context ) { - srp_session_t *p_session = (srp_session_t *)p_context; + srp_session_t *p_srp_session = (srp_session_t *)p_context; SRP_ENTER( SRP_DBG_DATA ); UNUSED_PARAM( h_cq ); - __srp_process_session_recv_completions( p_session ); + __srp_process_session_recv_completions( p_srp_session ); SRP_EXIT( SRP_DBG_DATA ); } @@ -617,8 +904,19 @@ __srp_build_cmd( ULONG scsi_direction = p_srb->SrbFlags & ( SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT ); DATA_BUFFER_DESCRIPTOR_FORMAT format = p_srp_conn_info->descriptor_format & DBDF_INDIRECT_DATA_BUFFER_DESCRIPTORS; ULONG length; +#if DBG + srp_hba_t *p_hba = ((srp_ext_t *)p_dev_ext)->p_hba; + srp_session_t *p_srp_session; +#endif + SRP_ENTER( SRP_DBG_DATA ); +#if DBG + /* statistics */ + p_srp_session = p_hba->session_list[p_send_descriptor->p_srb->TargetId]; + p_srp_session->x_pkt_built++; +#endif + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, ("Sending I/O to Path = 0x%x, Target = 0x%x, Lun = 0x%x\n", p_srb->PathId, @@ -692,6 +990,27 @@ __srp_build_cmd( p_memory_descriptor = get_srp_command_data_out_buffer_desc( p_srp_cmd ); } +#if DBG + { /* print max SG list, gotten from the StorPort */ + static ULONG s_sg_max = 0; + if ( p_scatter_gather_list && s_sg_max < p_scatter_gather_list->NumberOfElements ) + { + uint32_t total = 0; + PSTOR_SCATTER_GATHER_ELEMENT p_sg_el; + for ( i = 0, p_sg_el = p_scatter_gather_list->List; + i < scatter_gather_count; i++, p_sg_el++ ) + { + total += p_sg_el->Length; + } + s_sg_max = p_scatter_gather_list->NumberOfElements; + SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA, + ( "StorPort sg_cnt %d, total %#x, max sg_cnt %d, direction %s\n", + s_sg_max, total, p_srp_conn_info->max_scatter_gather_entries, + ( scsi_direction == SRB_FLAGS_DATA_IN ) ? "IN" : "OUT" )); + } + } +#endif + if ( p_memory_descriptor != NULL ) { PSTOR_SCATTER_GATHER_ELEMENT p_sg_element; @@ -708,44 +1027,92 @@ __srp_build_cmd( p_table_descriptor->descriptor.virtual_address = cl_hton64( buf_addr ); p_table_descriptor->descriptor.memory_handle = p_srp_conn_info->rkey; - p_table_descriptor->descriptor.data_length = - cl_hton32( sizeof(srp_memory_descriptor_t) * - p_scatter_gather_list->NumberOfElements ); - - for ( i = 0, totalLength = 0, p_sg_element = p_scatter_gather_list->List; - i < p_scatter_gather_list->NumberOfElements; - i++, p_memory_descriptor++, p_sg_element++ ) + if((p_scatter_gather_list->NumberOfElements > 1) && !__srp_map_fmr(p_dev_ext,p_scatter_gather_list,p_send_descriptor,p_memory_descriptor)) { - buf_addr = p_srp_conn_info->vaddr + p_sg_element->PhysicalAddress.QuadPart; - - p_memory_descriptor->virtual_address = cl_hton64( buf_addr ); - p_memory_descriptor->memory_handle = p_srp_conn_info->rkey; - p_memory_descriptor->data_length = cl_hton32( p_sg_element->Length ); - totalLength += p_sg_element->Length; + /* Set the discriptor list len */ + p_table_descriptor->descriptor.data_length = + cl_hton32( sizeof(srp_memory_descriptor_t) *1); + p_table_descriptor->total_length = p_memory_descriptor->data_length; + if ( scsi_direction == SRB_FLAGS_DATA_IN ) + set_srp_command_data_in_buffer_desc_count( p_srp_cmd, 1 ); + else if ( scsi_direction == SRB_FLAGS_DATA_OUT ) + set_srp_command_data_out_buffer_desc_count( p_srp_cmd, 1 ); + + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("virtual_address[%d] = 0x%I64x.\n", + 0, cl_ntoh64(p_memory_descriptor->virtual_address) ) ); + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("memory_handle[%d] = 0x%x.\n", + 0, cl_ntoh32( p_memory_descriptor->memory_handle) ) ); + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("data_length[%d] = %d.\n", + 0, cl_ntoh32( p_memory_descriptor->data_length) ) ); + } + else + { + CL_ASSERT( scatter_gather_count == + p_scatter_gather_list->NumberOfElements ); + + /* Set the descriptor list len */ + p_table_descriptor->descriptor.data_length = + cl_hton32( sizeof(srp_memory_descriptor_t) * + p_scatter_gather_list->NumberOfElements ); + + for ( i = 0, totalLength = 0, p_sg_element = p_scatter_gather_list->List; + i < scatter_gather_count; + i++, p_memory_descriptor++, p_sg_element++ ) + { + buf_addr = p_srp_conn_info->vaddr + p_sg_element->PhysicalAddress.QuadPart; + + p_memory_descriptor->virtual_address = cl_hton64( buf_addr ); + p_memory_descriptor->memory_handle = p_srp_conn_info->rkey; + p_memory_descriptor->data_length = cl_hton32( p_sg_element->Length ); + totalLength += p_sg_element->Length; + + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("virtual_address[%d] = 0x%I64x.\n", + i, cl_ntoh64(p_memory_descriptor->virtual_address) ) ); + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("memory_handle[%d] = 0x%x.\n", + i, cl_ntoh32( p_memory_descriptor->memory_handle) ) ); + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("data_length[%d] = %d.\n", + i, cl_ntoh32( p_memory_descriptor->data_length) ) ); + } + p_table_descriptor->total_length = cl_hton32( totalLength ); } - p_table_descriptor->total_length = cl_hton32( totalLength ); } else if ( format == DBDF_DIRECT_DATA_BUFFER_DESCRIPTOR ) { CL_ASSERT( scatter_gather_count == p_scatter_gather_list->NumberOfElements ); - for ( i = 0, p_sg_element = p_scatter_gather_list->List; - i < scatter_gather_count; i++, p_memory_descriptor++, p_sg_element++ ) + if((p_scatter_gather_list->NumberOfElements > 1) && !__srp_map_fmr(p_dev_ext,p_scatter_gather_list,p_send_descriptor,p_memory_descriptor)) { - buf_addr = p_srp_conn_info->vaddr + p_sg_element->PhysicalAddress.QuadPart; - p_memory_descriptor->virtual_address = cl_hton64( buf_addr ); - p_memory_descriptor->memory_handle = p_srp_conn_info->rkey; - p_memory_descriptor->data_length = cl_hton32( p_sg_element->Length ); - - SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, - ("virtual_address[%d] = 0x%I64x.\n", - i, cl_ntoh64(p_memory_descriptor->virtual_address) ) ); - SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, - ("memory_handle[%d] = 0x%x.\n", - i, cl_ntoh32( p_memory_descriptor->memory_handle) ) ); - SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, - ("data_length[%d] = %d.\n", - i, cl_ntoh32( p_memory_descriptor->data_length) ) ); + if ( scsi_direction == SRB_FLAGS_DATA_IN ) + set_srp_command_data_in_buffer_desc_count( p_srp_cmd, 1 ); + else if ( scsi_direction == SRB_FLAGS_DATA_OUT ) + set_srp_command_data_out_buffer_desc_count( p_srp_cmd, 1 ); + } + else + { + for ( i = 0, p_sg_element = p_scatter_gather_list->List; + i < scatter_gather_count; i++, p_memory_descriptor++, p_sg_element++ ) + { + buf_addr = p_srp_conn_info->vaddr + p_sg_element->PhysicalAddress.QuadPart; + p_memory_descriptor->virtual_address = cl_hton64( buf_addr ); + p_memory_descriptor->memory_handle = p_srp_conn_info->rkey; + p_memory_descriptor->data_length = cl_hton32( p_sg_element->Length ); + + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("virtual_address[%d] = 0x%I64x.\n", + i, cl_ntoh64(p_memory_descriptor->virtual_address) ) ); + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("memory_handle[%d] = 0x%x.\n", + i, cl_ntoh32( p_memory_descriptor->memory_handle) ) ); + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("data_length[%d] = %d.\n", + i, cl_ntoh32( p_memory_descriptor->data_length) ) ); + } } } SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, @@ -835,11 +1202,12 @@ srp_post_io_request( IN PVOID p_dev_ext, IN OUT PSCSI_REQUEST_BLOCK p_srb ) { - ib_api_status_t status; + ib_api_status_t status = IB_SUCCESS; srp_hba_t *p_hba = ((srp_ext_t *)p_dev_ext)->p_hba; srp_send_descriptor_t *p_send_descriptor = (srp_send_descriptor_t *)p_srb->SrbExtension; srp_session_t *p_srp_session; - + srp_descriptors_t *p_descriptors; + SRP_ENTER( SRP_DBG_DATA ); cl_obj_lock( &p_hba->obj ); @@ -851,33 +1219,32 @@ srp_post_io_request( cl_obj_ref( &p_srp_session->obj ); cl_obj_unlock( &p_hba->obj ); - status = srp_post_send_descriptor( &p_srp_session->descriptors, - p_send_descriptor, - p_srp_session ); + p_descriptors = &p_srp_session->descriptors; - if ( status == IB_SUCCESS ) + cl_spinlock_acquire ( &p_descriptors->pending_list_lock ); + if ( (p_srp_session->connection.request_limit <= p_srp_session->connection.request_threashold) || + !cl_is_qlist_empty( &p_descriptors->pending_descriptors ) || + p_srp_session->repost_is_on ) { - cl_atomic_dec( &p_srp_session->connection.request_limit ); - - if ( p_srp_session->connection.request_limit < 3 ) - { - SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA, - ("Calling StorPortBusy.\n") ); - StorPortBusy( p_dev_ext, 1 ); - } - + cl_spinlock_release ( &p_descriptors->pending_list_lock ); + srp_add_pending_descriptor( p_descriptors, p_send_descriptor ); cl_obj_deref( &p_srp_session->obj ); goto exit; } + cl_spinlock_release ( &p_descriptors->pending_list_lock ); + __srp_post_io_request( p_dev_ext, p_srb, p_srp_session ); cl_obj_deref( &p_srp_session->obj ); + goto exit; } else { cl_obj_unlock( &p_hba->obj ); + p_srb->SrbStatus = SRB_STATUS_NO_HBA; + goto err; } - p_srb->SrbStatus = SRB_STATUS_NO_HBA; +err: SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, " "Target = 0x%x, Lun = 0x%x, tag 0x%I64xn", @@ -889,6 +1256,15 @@ srp_post_io_request( p_srb->TargetId, p_srb->Lun, get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) ); + + status = __srp_clean_send_descriptor( p_send_descriptor, p_srp_session ); + if ( status != IB_SUCCESS ) + { + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("Failed to unmap FMR Status = %d.\n", status) ); + // TODO: Kill session and inform port driver link down storportnotification + } + StorPortNotification( RequestComplete, p_dev_ext, p_srb ); exit: @@ -988,6 +1364,7 @@ srp_lun_reset( IN OUT PSCSI_REQUEST_BLOCK p_srb ) { + ib_api_status_t status = IB_SUCCESS; srp_hba_t *p_hba = ((srp_ext_t *)p_dev_ext)->p_hba; srp_session_t *p_srp_session; @@ -1005,8 +1382,41 @@ srp_lun_reset( StorPortPauseDevice( p_dev_ext, p_srb->PathId, p_srb->TargetId, p_srb->Lun, 10 ); + /* release this device' descriptors from the pending_list */ + while ( (p_send_descriptor = srp_remove_lun_head_pending_descriptor( &p_srp_session->descriptors, p_srb->Lun )) != NULL ) + { + status = __srp_clean_send_descriptor( p_send_descriptor, p_srp_session ); + if ( status != IB_SUCCESS ) + { + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("Failed to unmap FMR Status = %d.\n", status) ); + // TODO: Kill session and inform port driver link down storportnotification + } + + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, + ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), " + "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn", + g_srb_status_name[SRB_STATUS_BUS_RESET], + SRB_STATUS_BUS_RESET, + g_srb_function_name[p_send_descriptor->p_srb->Function], + p_send_descriptor->p_srb->Function, + p_send_descriptor->p_srb->PathId, + p_send_descriptor->p_srb->TargetId, + p_send_descriptor->p_srb->Lun, + get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) ); + } + + /* release this device' descriptors from the sent_list */ while ( (p_send_descriptor = srp_remove_lun_head_send_descriptor( &p_srp_session->descriptors, p_srb->Lun )) != NULL ) { + status = __srp_clean_send_descriptor( p_send_descriptor, p_srp_session ); + if ( status != IB_SUCCESS ) + { + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("Failed to unmap FMR Status = %d.\n", status) ); + // TODO: Kill session and inform port driver link down storportnotification + } + SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), " "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn", @@ -1020,6 +1430,7 @@ srp_lun_reset( get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) ); } + p_srb->SrbStatus = SRB_STATUS_SUCCESS; SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA, @@ -1061,3 +1472,67 @@ srp_lun_reset( SRP_EXIT( SRP_DBG_DATA ); } + +#if DBG + +/* statistics */ + +void +srp_x_clean( + IN void *p_session ) +{ + srp_session_t *p_srp_session = p_session; + + if (p_srp_session == NULL) + return; + + p_srp_session->x_pkt_fmr = 0; + p_srp_session->x_pkt_built = 0; + p_srp_session->x_rld_total = 0; + p_srp_session->x_rld_num = 0; + p_srp_session->x_rld_max = 0; + p_srp_session->x_rld_min = p_srp_session->x_req_limit; + p_srp_session->x_pend_total = 0; + p_srp_session->x_pend_num = 0; + p_srp_session->x_pend_max = 0; + p_srp_session->x_sent_total = 0; + p_srp_session->x_sent_num = 0; + p_srp_session->x_sent_max = 0; +} + +void +srp_x_print( + IN void *p_session ) +{ + srp_session_t *p_srp_session = p_session; + + if (p_srp_session == NULL) + return; + + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_DATA, + ("req_limit %d, pkt_built %d, pkt_fmr'ed %d\n", + p_srp_session->x_req_limit, + p_srp_session->x_pkt_built, + p_srp_session->x_pkt_fmr )); + + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_DATA, + ("request_limit_delta: max %d, min %d, average %d, num %d\n", + p_srp_session->x_rld_max, p_srp_session->x_rld_min, + (p_srp_session->x_rld_num) ? p_srp_session->x_rld_total / p_srp_session->x_rld_num : 0, + p_srp_session->x_rld_num )); + + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_DATA, + ("pendinq_desc: max %d, average %d, num %d\n", + p_srp_session->x_pend_max, + (p_srp_session->x_pend_num) ? p_srp_session->x_pend_total / p_srp_session->x_pend_num : 0, + p_srp_session->x_pend_num )); + + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_DATA, + ("sent_desc: max %d, average %d, num %d\n", + p_srp_session->x_sent_max, + (p_srp_session->x_sent_num) ? p_srp_session->x_sent_total / p_srp_session->x_sent_num : 0, + p_srp_session->x_sent_num )); + +} + +#endif diff --git a/trunk/ulp/srp/kernel/srp_debug.h b/trunk/ulp/srp/kernel/srp_debug.h index 383d3030..9a5ff7a1 100644 --- a/trunk/ulp/srp/kernel/srp_debug.h +++ b/trunk/ulp/srp/kernel/srp_debug.h @@ -40,6 +40,11 @@ extern uint32_t g_srp_dbg_level; extern uint32_t g_srp_dbg_flags; +extern uint32_t g_srp_mode_flags; + +// mode flags +#define SRP_MODE_NO_FMR_POOL (1 << 0) /* don't use FMR_POOL - for tuning purposes */ +#define SRP_MODE_SG_UNLIMITED (1 << 1) /* don't obey the limitation, stated in DDK, not to enlarge StorPort max SG */ #if defined(EVENT_TRACING) // diff --git a/trunk/ulp/srp/kernel/srp_descriptors.c b/trunk/ulp/srp/kernel/srp_descriptors.c index e10802a9..c77571a5 100644 --- a/trunk/ulp/srp/kernel/srp_descriptors.c +++ b/trunk/ulp/srp/kernel/srp_descriptors.c @@ -184,7 +184,9 @@ srp_init_descriptors( cl_memclr( p_descriptors, sizeof(*p_descriptors) ); cl_spinlock_init ( &p_descriptors->sent_list_lock ); + cl_spinlock_init ( &p_descriptors->pending_list_lock ); cl_qlist_init( &p_descriptors->sent_descriptors ); + cl_qlist_init( &p_descriptors->pending_descriptors ); p_descriptors->initialized = TRUE; @@ -219,6 +221,7 @@ srp_destroy_descriptors( if ( p_descriptors->initialized == TRUE ) { cl_spinlock_destroy ( &p_descriptors->sent_list_lock ); + cl_spinlock_destroy ( &p_descriptors->pending_list_lock ); if ( p_descriptors->p_recv_data_segments_array != NULL ) { @@ -238,6 +241,35 @@ srp_destroy_descriptors( return IB_SUCCESS; } +/* __srp_add_descriptor */ +/*! +Puts descriptor at tail of the list + +@param p_descriptors - pointer to the descriptors structure +@param p_descriptor - pointer to the descriptor to add +@param descriptors_list - pointer to the list + +@return - none +*/ +inline +void +__srp_add_descriptor( + IN srp_send_descriptor_t *p_descriptor, + IN cl_qlist_t *descriptors_list, + IN cl_spinlock_t *p_lock) +{ + SRP_ENTER( SRP_DBG_DATA ); + + cl_spinlock_acquire ( p_lock ); + + cl_qlist_insert_tail( descriptors_list, &p_descriptor->list_item ); + CL_ASSERT( descriptors_list == p_descriptor->list_item.p_list ); + + cl_spinlock_release ( p_lock ); + + SRP_EXIT( SRP_DBG_DATA ); +} + /* srp_add_send_descriptor */ /*! Puts send descriptor at tail of the sent list @@ -254,17 +286,61 @@ srp_add_send_descriptor( IN srp_send_descriptor_t *p_descriptor ) { SRP_ENTER( SRP_DBG_DATA ); + __srp_add_descriptor( p_descriptor, + &p_descriptors->sent_descriptors, &p_descriptors->sent_list_lock ); + SRP_EXIT( SRP_DBG_DATA ); +} + +/* srp_add_pending_descriptor */ +/*! +Puts pending send descriptor at tail of the pending list + +@param p_descriptors - pointer to the descriptors structure +@param p_descriptor - pointer to the descriptor to add + +@return - none +*/ +void +srp_add_pending_descriptor( + IN srp_descriptors_t *p_descriptors, + IN srp_send_descriptor_t *p_descriptor ) +{ + SRP_ENTER( SRP_DBG_DATA ); + __srp_add_descriptor( p_descriptor, + &p_descriptors->pending_descriptors, &p_descriptors->pending_list_lock ); + SRP_EXIT( SRP_DBG_DATA ); +} + +/* __srp_remove_send_descriptor */ +/*! +Removes send descriptor from the sent list + +@param p_descriptors - pointer to the descriptors structure +@param p_descriptor - pointer to the descriptor to add +@param descriptors_list - pointer to the list + +@return - none +*/ +inline +void +__srp_remove_send_descriptor( + IN srp_send_descriptor_t *p_descriptor, + IN cl_qlist_t *descriptors_list, + IN cl_spinlock_t *p_lock) +{ + SRP_ENTER( SRP_DBG_DATA ); - cl_spinlock_acquire ( &p_descriptors->sent_list_lock ); + cl_spinlock_acquire ( p_lock ); - cl_qlist_insert_tail( &p_descriptors->sent_descriptors, &p_descriptor->list_item ); - CL_ASSERT( &p_descriptors->sent_descriptors == p_descriptor->list_item.p_list ); + CL_ASSERT( descriptors_list == p_descriptor->list_item.p_list ); + cl_qlist_remove_item( descriptors_list, &p_descriptor->list_item ); - cl_spinlock_release ( &p_descriptors->sent_list_lock ); + cl_spinlock_release ( p_lock ); SRP_EXIT( SRP_DBG_DATA ); } + /* srp_remove_send_descriptor */ /*! Removes send descriptor from the sent list @@ -281,60 +357,126 @@ srp_remove_send_descriptor( IN srp_send_descriptor_t *p_descriptor ) { SRP_ENTER( SRP_DBG_DATA ); + __srp_remove_send_descriptor( p_descriptor, + &p_descriptors->sent_descriptors, &p_descriptors->sent_list_lock ); + SRP_EXIT( SRP_DBG_DATA ); +} - cl_spinlock_acquire ( &p_descriptors->sent_list_lock ); - - CL_ASSERT( &p_descriptors->sent_descriptors == p_descriptor->list_item.p_list ); - cl_qlist_remove_item( &p_descriptors->sent_descriptors, &p_descriptor->list_item ); +/* srp_remove_pending_descriptor */ +/*! +Removes pending send descriptor from the sent list - cl_spinlock_release ( &p_descriptors->sent_list_lock ); +@param p_descriptors - pointer to the descriptors structure +@param p_descriptor - pointer to the descriptor to add +@return - none +*/ +inline +void +srp_remove_pending_descriptor( + IN srp_descriptors_t *p_descriptors, + IN srp_send_descriptor_t *p_descriptor ) +{ + SRP_ENTER( SRP_DBG_DATA ); + __srp_remove_send_descriptor( p_descriptor, + &p_descriptors->pending_descriptors, &p_descriptors->pending_list_lock ); SRP_EXIT( SRP_DBG_DATA ); } -/* srp_remove_lun_head_send_descriptor */ +/* __srp_remove_lun_head_send_descriptor */ /*! -Removes and returns the send descriptor from the head of the sent list for the lun specified +Removes and returns the send descriptor from the head of the a list for the lun specified @param p_descriptors - pointer to the descriptors structure @param lun - lun for which to remove head send descriptor +@param descriptors_list - pointer to the list @return - srp_send_descriptor at head of sent list or NULL if empty */ srp_send_descriptor_t* -srp_remove_lun_head_send_descriptor( - IN srp_descriptors_t *p_descriptors, - IN UCHAR lun ) +__srp_remove_lun_head_send_descriptor( + IN UCHAR lun, + IN cl_qlist_t *descriptors_list, + IN cl_spinlock_t *p_lock) { srp_send_descriptor_t *p_descriptor; SRP_ENTER( SRP_DBG_DATA ); - cl_spinlock_acquire ( &p_descriptors->sent_list_lock ); + cl_spinlock_acquire ( p_lock ); - p_descriptor = (srp_send_descriptor_t *)cl_qlist_head( &p_descriptors->sent_descriptors ); - CL_ASSERT( &p_descriptors->sent_descriptors == p_descriptor->list_item.p_list ); + p_descriptor = (srp_send_descriptor_t *)cl_qlist_head( descriptors_list ); + CL_ASSERT( descriptors_list == p_descriptor->list_item.p_list ); - while ( p_descriptor != (srp_send_descriptor_t *)cl_qlist_end( &p_descriptors->sent_descriptors ) ) + while ( p_descriptor != (srp_send_descriptor_t *)cl_qlist_end( descriptors_list ) ) { if ( p_descriptor->p_srb->Lun == lun ) { - CL_ASSERT( &p_descriptors->sent_descriptors == p_descriptor->list_item.p_list ); - cl_qlist_remove_item( &p_descriptors->sent_descriptors, &p_descriptor->list_item ); + CL_ASSERT( descriptors_list == p_descriptor->list_item.p_list ); + cl_qlist_remove_item( descriptors_list, &p_descriptor->list_item ); break; } p_descriptor = (srp_send_descriptor_t *)cl_qlist_next( &p_descriptor->list_item ); - CL_ASSERT( &p_descriptors->sent_descriptors == p_descriptor->list_item.p_list ); + CL_ASSERT( descriptors_list == p_descriptor->list_item.p_list ); } - if ( p_descriptor == (srp_send_descriptor_t *)cl_qlist_end( &p_descriptors->sent_descriptors ) ) + if ( p_descriptor == (srp_send_descriptor_t *)cl_qlist_end( descriptors_list ) ) { p_descriptor = NULL; } - cl_spinlock_release ( &p_descriptors->sent_list_lock ); + cl_spinlock_release ( p_lock ); + + SRP_EXIT( SRP_DBG_DATA ); + + return ( p_descriptor ); +} + + +/* srp_remove_lun_head_send_descriptor */ +/*! +Removes and returns the send descriptor from the head of the sent list for the lun specified + +@param p_descriptors - pointer to the descriptors structure +@param lun - lun for which to remove head send descriptor +@return - srp_send_descriptor at head of sent list or NULL if empty +*/ +srp_send_descriptor_t* +srp_remove_lun_head_send_descriptor( + IN srp_descriptors_t *p_descriptors, + IN UCHAR lun ) +{ + srp_send_descriptor_t *p_descriptor; + + SRP_ENTER( SRP_DBG_DATA ); + p_descriptor = __srp_remove_lun_head_send_descriptor( + lun, &p_descriptors->sent_descriptors, &p_descriptors->sent_list_lock ); + SRP_EXIT( SRP_DBG_DATA ); + + return ( p_descriptor ); +} + +/* srp_remove_lun_head_pending_descriptor */ +/*! +Removes and returns the send descriptor from the head of the sent list for the lun specified + +@param p_descriptors - pointer to the descriptors structure +@param lun - lun for which to remove head send descriptor + +@return - srp_send_descriptor at head of sent list or NULL if empty +*/ +srp_send_descriptor_t* +srp_remove_lun_head_pending_descriptor( + IN srp_descriptors_t *p_descriptors, + IN UCHAR lun ) +{ + srp_send_descriptor_t *p_descriptor; + + SRP_ENTER( SRP_DBG_DATA ); + p_descriptor = __srp_remove_lun_head_send_descriptor( + lun, &p_descriptors->pending_descriptors, &p_descriptors->pending_list_lock ); SRP_EXIT( SRP_DBG_DATA ); return ( p_descriptor ); @@ -514,6 +656,7 @@ srp_build_send_descriptor( p_send_descriptor->ds[0].vaddr = p_srp_conn_info->vaddr + physical_address.QuadPart; p_send_descriptor->ds[0].length = p_srp_conn_info->init_to_targ_iu_sz; p_send_descriptor->ds[0].lkey = p_srp_conn_info->lkey; + p_send_descriptor->p_fmr_el = NULL; SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, ("hca vaddr = 0x%I64x.\n", p_srp_conn_info->vaddr)); diff --git a/trunk/ulp/srp/kernel/srp_descriptors.h b/trunk/ulp/srp/kernel/srp_descriptors.h index cb6ebacd..9f7c60d7 100644 --- a/trunk/ulp/srp/kernel/srp_descriptors.h +++ b/trunk/ulp/srp/kernel/srp_descriptors.h @@ -54,20 +54,22 @@ typedef struct _srp_conn_info *p_srp_conn_info_t; typedef struct _srp_send_descriptor { /* Leave this as first member variable */ - cl_list_item_t list_item; - ib_send_wr_t wr; - uint64_t tag; - SCSI_REQUEST_BLOCK *p_srb; - ib_local_ds_t ds[SRP_NUM_SGE]; - uint8_t data_segment[SRP_MAX_IU_SIZE]; -} srp_send_descriptor_t; + cl_list_item_t list_item; + ib_send_wr_t wr; + uint64_t tag; + SCSI_REQUEST_BLOCK *p_srb; + mlnx_fmr_pool_el_t p_fmr_el; + ib_local_ds_t ds[SRP_NUM_SGE]; + /* must be the last*/ + uint8_t data_segment[SRP_MAX_IU_SIZE]; +}srp_send_descriptor_t; typedef struct _srp_recv_descriptor { - ib_recv_wr_t wr; - ib_local_ds_t ds[SRP_NUM_SGE]; - uint8_t *p_data_segment; -} srp_recv_descriptor_t; + ib_recv_wr_t wr; + ib_local_ds_t ds[SRP_NUM_SGE]; + uint8_t *p_data_segment; +}srp_recv_descriptor_t; typedef struct _srp_descriptors { @@ -75,6 +77,8 @@ typedef struct _srp_descriptors cl_spinlock_t sent_list_lock; cl_qlist_t sent_descriptors; + cl_spinlock_t pending_list_lock; + cl_qlist_t pending_descriptors; uint32_t recv_descriptor_count; srp_recv_descriptor_t *p_recv_descriptors_array; @@ -106,6 +110,16 @@ srp_remove_lun_head_send_descriptor( IN srp_descriptors_t *p_descriptors, IN UCHAR lun ); +srp_send_descriptor_t* +srp_remove_lun_head_pending_descriptor( + IN srp_descriptors_t *p_descriptors, + IN UCHAR lun ); + +void +srp_add_pending_descriptor( + IN srp_descriptors_t *p_descriptors, + IN srp_send_descriptor_t *p_descriptor ); + ib_api_status_t srp_post_send_descriptor( IN srp_descriptors_t *p_descriptors, diff --git a/trunk/ulp/srp/kernel/srp_driver.c b/trunk/ulp/srp/kernel/srp_driver.c index fe81ad50..c5d893a3 100644 --- a/trunk/ulp/srp/kernel/srp_driver.c +++ b/trunk/ulp/srp/kernel/srp_driver.c @@ -55,6 +55,7 @@ BOOLEAN g_srp_system_shutdown = FALSE; uint32_t g_srp_dbg_level = TRACE_LEVEL_ERROR; uint32_t g_srp_dbg_flags = 0x0000ffff; +uint32_t g_srp_mode_flags = 0; char g_srb_function_name[][32] = { @@ -254,6 +255,19 @@ static void __srp_free( IN cl_obj_t *p_obj ); +#if DBG + +void +srp_x_print( + IN void *p_session ); + +void +srp_x_clean( + IN void *p_session ); + +void *gp_session = NULL; + +#endif static NTSTATUS @@ -262,7 +276,7 @@ __read_registry( { NTSTATUS status; /* Remember the terminating entry in the table below. */ - RTL_QUERY_REGISTRY_TABLE table[3]; + RTL_QUERY_REGISTRY_TABLE table[4]; UNICODE_STRING param_path; SRP_ENTER( SRP_DBG_PNP ); @@ -301,6 +315,15 @@ __read_registry( table[1].DefaultType = REG_DWORD; table[1].DefaultData = &g_srp_dbg_flags; table[1].DefaultLength = sizeof(ULONG); + + table[2].Flags = RTL_QUERY_REGISTRY_DIRECT; + table[2].Name = L"ModeFlags"; + table[2].EntryContext = &g_srp_mode_flags; + table[2].DefaultType = REG_DWORD; + table[2].DefaultData = &g_srp_mode_flags; + table[2].DefaultLength = sizeof(ULONG); + + /* Have at it! */ status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, param_path.Buffer, table, NULL, NULL ); @@ -525,6 +548,25 @@ srp_dispatch_pnp( ("KeReleaseMutex status = %d.\n", release_status) ); } + #if DBG + /* statistics */ + + /* this function is called sometimes in the begging of the test with + IRP_MN_QUERY_DEVICE_RELATIONS (7) request. Use this fact to print the statistics */ + { + /* sometimes it's called once in 50msec, so we'll print once in 20 times */ + static int interval = 40; /* 2 sec */ + static int cnt = 0; + if (++cnt >= interval) + { + cnt = 0; + srp_x_print( gp_session ); + srp_x_clean( gp_session ); + } + } + + #endif + SRP_EXIT( SRP_DBG_PNP ); return status; } @@ -596,11 +638,16 @@ srp_find_adapter( } else { - p_config->NumberOfPhysicalBreaks = MIN( p_ext->p_hba->max_sg - 1, p_config->NumberOfPhysicalBreaks ); + if (g_srp_mode_flags & SRP_MODE_SG_UNLIMITED) + // It is prohibited by DDK, but seems like work + p_config->NumberOfPhysicalBreaks = p_ext->p_hba->max_sg - 1; + else + p_config->NumberOfPhysicalBreaks = MIN( p_ext->p_hba->max_sg - 1, p_config->NumberOfPhysicalBreaks ); } SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, - ("NumberOfPhysicalBreaks set to = %d.\n", p_config->NumberOfPhysicalBreaks) ); + ( "max_sg %d, New NumberOfPhysicalBreaks %d\n", + p_ext->p_hba->max_sg, p_config->NumberOfPhysicalBreaks)); SRP_EXIT( SRP_DBG_PNP ); return SP_RETURN_FOUND; diff --git a/trunk/ulp/srp/kernel/srp_hca.c b/trunk/ulp/srp/kernel/srp_hca.c index 732bbeb7..8ea75891 100644 --- a/trunk/ulp/srp/kernel/srp_hca.c +++ b/trunk/ulp/srp/kernel/srp_hca.c @@ -44,6 +44,7 @@ /* Amount of physical memory to register. */ #define MEM_REG_SIZE 0xFFFFFFFFFFFFFFFF + /* srp_open_ca */ /*! Open the channel adapter associated with the SRP initiator @@ -63,7 +64,8 @@ srp_open_ca( ib_api_status_t status; ib_phys_create_t phys_create; ib_phys_range_t phys_range; - + mlnx_fmr_pool_create_t fmr_pool_create; + SRP_ENTER( SRP_DBG_PNP ); status = p_hca->p_hba->ifc.open_ca( p_hca->p_hba->h_al, @@ -100,22 +102,48 @@ srp_open_ca( p_hca->vaddr = 0; + status = p_hca->p_hba->ifc.reg_phys( p_hca->h_pd, &phys_create, &p_hca->vaddr, &p_hca->lkey, &p_hca->rkey, &p_hca->h_mr ); + if( status != IB_SUCCESS ) { SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, ("Physical Memory Registration Failure. Status = %d\n", status) ); -exit: - srp_close_ca( p_hca ); + goto exit; } - SRP_EXIT( SRP_DBG_PNP ); + fmr_pool_create.max_pages_per_fmr = SRP_MAX_SG_IN_INDIRECT_DATA_BUFFER; + fmr_pool_create.page_size = 12; + fmr_pool_create.access_ctrl = IB_AC_LOCAL_WRITE | IB_AC_RDMA_READ | IB_AC_RDMA_WRITE; + fmr_pool_create.pool_size = 100; + fmr_pool_create.dirty_watermark = 2; + fmr_pool_create.flush_function = NULL; + fmr_pool_create.flush_arg = NULL; + fmr_pool_create.cache = TRUE; + + status = p_hca->p_hba->ifc.create_mlnx_fmr_pool(p_hca->h_pd, &fmr_pool_create, &p_hca->h_fmr_pool); + if( status != IB_SUCCESS ) + { + SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, + ("FMR pool creation Failure. Status = %d\n", status) ); + goto exit; + } + + p_hca->fmr_page_size = 1<< fmr_pool_create.page_size; + p_hca->fmr_page_shift = (uint32_t)fmr_pool_create.page_size; + + SRP_EXIT( SRP_DBG_PNP ); + return IB_SUCCESS; +exit: + srp_close_ca( p_hca ); + + SRP_EXIT( SRP_DBG_PNP ); return ( status ); } @@ -225,3 +253,4 @@ srp_init_hca( return ( IB_SUCCESS ); } + diff --git a/trunk/ulp/srp/kernel/srp_hca.h b/trunk/ulp/srp/kernel/srp_hca.h index c47f965f..897a3e9d 100644 --- a/trunk/ulp/srp/kernel/srp_hca.h +++ b/trunk/ulp/srp/kernel/srp_hca.h @@ -45,7 +45,10 @@ typedef struct _srp_hca ib_ca_handle_t h_ca; ib_pd_handle_t h_pd; ib_mr_handle_t h_mr; - uint64_t vaddr; + mlnx_fmr_pool_handle_t h_fmr_pool; + uint32_t fmr_page_size; + uint32_t fmr_page_shift; + uint64_t vaddr; net32_t lkey; net32_t rkey; diff --git a/trunk/ulp/srp/kernel/srp_session.c b/trunk/ulp/srp/kernel/srp_session.c index 3cef1aab..d2deb56d 100644 --- a/trunk/ulp/srp/kernel/srp_session.c +++ b/trunk/ulp/srp/kernel/srp_session.c @@ -40,6 +40,10 @@ #include "srp_session.h" #include +#if DBG +extern void *gp_session; +#endif + /* __srp_destroying_session */ /*! Called when session has been marked for destruction @@ -303,6 +307,10 @@ srp_new_session( ("After Insert Rel Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) ); +#if DBG + gp_session = p_srp_session; +#endif + exit: SRP_EXIT( SRP_DBG_SESSION ); @@ -340,6 +348,12 @@ srp_session_login( (uint8_t)p_srp_session->p_hba->ioc_info.profile.send_msg_depth, p_srp_session ); + if ( status != IB_SUCCESS ) + { // clean resources, taken upon login + srp_close_ca( &p_srp_session->hca ); + srp_destroy_descriptors( &p_srp_session->descriptors ); + } + exit: SRP_EXIT( SRP_DBG_SESSION ); return ( status ); diff --git a/trunk/ulp/srp/kernel/srp_session.h b/trunk/ulp/srp/kernel/srp_session.h index 1da558dd..925ab689 100644 --- a/trunk/ulp/srp/kernel/srp_session.h +++ b/trunk/ulp/srp/kernel/srp_session.h @@ -51,13 +51,44 @@ typedef struct _srp_session cl_obj_rel_t rel; srp_hba_t *p_hba; - + atomic32_t repost_is_on; srp_hca_t hca; srp_connection_t connection; srp_descriptors_t descriptors; SCSI_REQUEST_BLOCK *p_shutdown_srb; +#if DBG + /* statistics */ + + /* packets, built */ + uint64_t x_pkt_fmr; /* number of packets, mapped by fmr_pool */ + uint64_t x_pkt_built; /* number of packets, built */ + + /* request_limit_delta */ + int64_t x_rld_total; /* sum of req_limit_delta values */ + int32_t x_rld_num; /* number of req_limit_delta values */ + int32_t x_rld_max; /* max req_limit_delta value */ + int32_t x_rld_min; /* min req_limit_delta value */ + int32_t x_rld_zeroes; /* number of zeroes */ + + int32_t x_rld_zeroes_cur; /* number of zeroes */ + int32_t x_rld_zeroes_cur_min; /* number of zeroes */ + int32_t x_rld_busy_success; + int32_t x_rld_busy_fail; + + /* pending queue */ + uint64_t x_pend_total; /* sum of pending_descriptors queue sizes */ + uint32_t x_pend_num; /* number of pending_descriptors queue sizes */ + uint32_t x_pend_max; /* max pending_descriptors queue size */ + + /* pending queue */ + uint64_t x_sent_total; /* sum of sent_descriptors queue sizes */ + uint32_t x_sent_num; /* number of sent_descriptors queue sizes */ + uint32_t x_sent_max; /* max sent_descriptors queue size */ + + uint32_t x_req_limit; /* max number in-flight packets */ +#endif } srp_session_t; srp_session_t*