INCLUDES=..;..\..\..\inc;..\..\..\inc\kernel;\r
\r
C_DEFINES=$(C_DEFINES) -DNDIS_MINIPORT_DRIVER -DNDIS_WDM=1 \\r
- -DDEPRECATE_DDK_FUNCTIONS -DNDIS51_MINIPORT -DNEED_CL_OBJ -DBINARY_COMPATIBLE=0 -DPERF_TRACK_ON\r
+ -DDEPRECATE_DDK_FUNCTIONS -DNDIS51_MINIPORT -DNEED_CL_OBJ -DBINARY_COMPATIBLE=0\r
\r
TARGETLIBS= \\r
$(TARGETPATH)\*\complib.lib \\r
{\r
IPOIB_ENTER( IPOIB_DBG_ENDPT );\r
\r
- if( !p_port || !p_endpt )\r
- return;\r
-\r
- cl_event_init( &p_endpt->remove_event, FALSE );\r
NdisInterlockedInsertTailList( &p_port->endpt_mgr.remove_conns, \r
&p_endpt->list_item, &p_port->endpt_mgr.remove_lock );\r
cl_event_signal( &p_port->endpt_mgr.event );\r
\r
- cl_event_wait_on( &p_endpt->remove_event, EVENT_NO_TIMEOUT, TRUE );\r
- cl_event_destroy( &p_endpt->remove_event );\r
-\r
IPOIB_EXIT( IPOIB_DBG_ENDPT );\r
return;\r
}\r
cm_reply.h_qp = p_endpt->conn.h_qp;\r
cm_reply.qp_type = IB_QPT_RELIABLE_CONN;\r
\r
- cm_reply.access_ctrl = IB_AC_LOCAL_WRITE | IB_AC_RDMA_READ |IB_AC_RDMA_WRITE;\r
+ cm_reply.access_ctrl = IB_AC_LOCAL_WRITE;\r
\r
cm_reply.target_ack_delay = 18;\r
cm_reply.flow_ctrl = p_cm_req->flow_ctrl;\r
}\r
\r
cl_memclr( &cm_rtu, sizeof( ib_cm_rtu_t ) );\r
- cm_rtu.access_ctrl = IB_AC_LOCAL_WRITE | IB_AC_RDMA_READ |IB_AC_RDMA_WRITE;\r
+ cm_rtu.access_ctrl = IB_AC_LOCAL_WRITE;\r
cm_rtu.pfn_cm_dreq_cb = __conn_dreq_cb;\r
\r
ib_status = \r
ib_api_status_t ib_status;\r
UINT medium_index;\r
ipoib_adapter_t *p_adapter;\r
-\r
+#if IPOIB_USE_DMA\r
+ ULONG max_phys_mapping;\r
+#endif\r
IPOIB_ENTER( IPOIB_DBG_INIT );\r
\r
#ifdef _DEBUG_\r
NdisInterfacePNPBus );\r
\r
#if IPOIB_USE_DMA\r
+ max_phys_mapping = p_adapter->params.cm_enabled ? \r
+ p_adapter->params.cm_xfer_block_size: p_adapter->params.xfer_block_size;\r
+ max_phys_mapping = p_adapter->params.lso ? \r
+ max(LARGE_SEND_OFFLOAD_SIZE, max_phys_mapping): max_phys_mapping;\r
status =\r
- NdisMInitializeScatterGatherDma( h_adapter, TRUE,\r
- ( p_adapter->params.cm_enabled ? \r
- p_adapter->params.cm_xfer_block_size: \r
- p_adapter->params.xfer_block_size ) );\r
+ NdisMInitializeScatterGatherDma( h_adapter, TRUE, max_phys_mapping );\r
+\r
if( status != NDIS_STATUS_SUCCESS )\r
{\r
ipoib_destroy_adapter( p_adapter );\r
(NDIS_TASK_TCP_IP_CHECKSUM*)p_offload_task->TaskBuffer;\r
\r
p_offload_chksum->V4Transmit.IpOptionsSupported =\r
- p_adapter->params.send_chksum_offload;\r
p_offload_chksum->V4Transmit.TcpOptionsSupported =\r
- p_adapter->params.send_chksum_offload;\r
p_offload_chksum->V4Transmit.TcpChecksum =\r
- p_adapter->params.send_chksum_offload;\r
p_offload_chksum->V4Transmit.UdpChecksum =\r
- p_adapter->params.send_chksum_offload;\r
p_offload_chksum->V4Transmit.IpChecksum =\r
- p_adapter->params.send_chksum_offload;\r
+ !!p_adapter->params.send_chksum_offload;\r
\r
p_offload_chksum->V4Receive.IpOptionsSupported =\r
- p_adapter->params.recv_chksum_offload;\r
p_offload_chksum->V4Receive.TcpOptionsSupported =\r
- p_adapter->params.recv_chksum_offload;\r
p_offload_chksum->V4Receive.TcpChecksum =\r
- p_adapter->params.recv_chksum_offload;\r
p_offload_chksum->V4Receive.UdpChecksum =\r
- p_adapter->params.recv_chksum_offload;\r
p_offload_chksum->V4Receive.IpChecksum =\r
- p_adapter->params.recv_chksum_offload;\r
+ !!p_adapter->params.recv_chksum_offload;\r
\r
p_offload_chksum->V6Transmit.IpOptionsSupported = FALSE;\r
p_offload_chksum->V6Transmit.TcpOptionsSupported = FALSE;\r
buf_len = sizeof(ULONG);\r
\r
port_num = p_adapter->guids.port_num;\r
+ \r
+ cl_obj_lock( &p_adapter->obj );\r
+\r
+ if( p_adapter->state == IB_PNP_PORT_REMOVE )\r
+ {\r
+ *p_bytes_read = 0;\r
+ cl_obj_unlock( &p_adapter->obj );\r
+ return NDIS_STATUS_NOT_ACCEPTED;\r
+ }\r
+\r
+ cl_obj_unlock( &p_adapter->obj );\r
\r
switch( oid )\r
{\r
#include "ipoib_endpoint.tmh"\r
#endif\r
#include <complib/cl_atomic.h>\r
+#include <complib/cl_math.h>\r
\r
\r
static void\r
}\r
else if( p_port->p_adapter->params.cm_enabled )\r
{\r
- cm_state_t cm_state;\r
- cm_state = endpt_cm_set_state( p_endpt, IPOIB_CM_DESTROY );\r
p_endpt->cm_flag = 0;\r
- IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_ENDPT,\r
- ("Destroy Endpt CM state: %d\n", cm_state ) );\r
- switch( cm_state )\r
- {\r
- case IPOIB_CM_CONNECTED:\r
- /* DREQ will be sent in context of destroy_qp */\r
- case IPOIB_CM_CONNECT:\r
- case IPOIB_CM_DREP_SENT:\r
- case IPOIB_CM_STALE_CONN:\r
- cl_obj_unlock( p_obj );\r
- endpt_cm_destroy_conn( p_port, p_endpt );\r
- cl_obj_lock( p_obj );\r
- case IPOIB_CM_DISCONNECTED:\r
- default:\r
- CL_ASSERT( p_endpt->conn.h_qp == NULL );\r
- break;\r
- }\r
+ CL_ASSERT( endpt_cm_get_state( p_endpt ) == IPOIB_CM_DISCONNECTED );\r
}\r
\r
cl_obj_unlock( p_obj );\r
{\r
cl_status_t cl_status;\r
NDIS_STATUS ndis_status;\r
+ ib_api_status_t ib_status = IB_SUCCESS;\r
\r
IPOIB_ENTER( IPOIB_DBG_INIT );\r
\r
if( p_port->cm_buf_mgr.pool_init )\r
- return IB_SUCCESS;\r
+ return ib_status;\r
\r
cl_qlist_init( &p_port->cm_buf_mgr.posted_list );\r
\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
("NdisAllocatePacketPool returned %08X\n", ndis_status) );\r
\r
- return IB_INSUFFICIENT_RESOURCES;\r
+ ib_status = IB_INSUFFICIENT_RESOURCES;\r
+ goto pkt_pool_failed;\r
}\r
\r
NdisAllocateBufferPool( &ndis_status, \r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
("NdisAllocateBufferPool returned %08X\n", ndis_status) );\r
\r
- return IB_INSUFFICIENT_RESOURCES;\r
+ ib_status = IB_INSUFFICIENT_RESOURCES;\r
+ goto buf_pool_failed;\r
}\r
p_port->cm_recv_mgr.recv_pkt_array = \r
cl_zalloc( sizeof(NDIS_PACKET*) * p_port->cm_recv_mgr.rq_depth );\r
{\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
("cl_zalloc for PNDIS_PACKET array failed.\n") );\r
- return IB_INSUFFICIENT_MEMORY;\r
+ \r
+ ib_status = IB_INSUFFICIENT_MEMORY;\r
+ goto pkt_array_failed;\r
}\r
\r
p_port->cm_buf_mgr.pool_init = TRUE;\r
+ return IB_SUCCESS;\r
\r
- IPOIB_EXIT( IPOIB_DBG_INIT );\r
+pkt_array_failed:\r
+ if( p_port->cm_buf_mgr.h_buffer_pool )\r
+ NdisFreeBufferPool( p_port->cm_buf_mgr.h_buffer_pool );\r
+buf_pool_failed:\r
+ if( p_port->cm_buf_mgr.h_packet_pool )\r
+ NdisFreePacketPool( p_port->cm_buf_mgr.h_packet_pool );\r
+pkt_pool_failed:\r
+ cl_qpool_destroy( &p_port->cm_buf_mgr.recv_pool );\r
\r
- return IB_SUCCESS;\r
+ IPOIB_EXIT( IPOIB_DBG_INIT );\r
+ return ib_status;\r
}\r
\r
+void\r
+endpt_cm_buf_mgr_reset(\r
+ IN ipoib_port_t* const p_port )\r
+{\r
+ cl_list_item_t *p_item;\r
+\r
+ if( !p_port->cm_buf_mgr.pool_init )\r
+ return;\r
+\r
+ if( cl_qlist_count( &p_port->cm_buf_mgr.posted_list ) )\r
+ {\r
+ for( p_item = cl_qlist_remove_head( &p_port->cm_buf_mgr.posted_list );\r
+ p_item != cl_qlist_end( &p_port->cm_buf_mgr.posted_list );\r
+ p_item = cl_qlist_remove_head( &p_port->cm_buf_mgr.posted_list ) )\r
+ {\r
+ cl_qpool_put( &p_port->cm_buf_mgr.recv_pool, \r
+ &( PARENT_STRUCT( p_item, ipoib_cm_desc_t, list_item ))->item );\r
+ }\r
+ }\r
+}\r
\r
void\r
endpt_cm_buf_mgr_destroy(\r
IN ipoib_port_t* const p_port )\r
{\r
\r
- cl_list_item_t *p_item;\r
-\r
IPOIB_ENTER(IPOIB_DBG_INIT );\r
\r
CL_ASSERT( p_port );\r
/* Free the receive descriptors. */\r
if( !p_port->cm_buf_mgr.pool_init )\r
return;\r
- \r
+\r
+ endpt_cm_buf_mgr_reset( p_port );\r
+\r
p_port->cm_buf_mgr.pool_init = FALSE;\r
\r
if( p_port->cm_recv_mgr.recv_pkt_array )\r
if( p_port->cm_buf_mgr.h_packet_pool )\r
NdisFreePacketPool( p_port->cm_buf_mgr.h_packet_pool );\r
\r
- if( cl_qlist_count( &p_port->cm_buf_mgr.posted_list ) )\r
- {\r
- for( p_item = cl_qlist_remove_head( &p_port->cm_buf_mgr.posted_list );\r
- p_item != cl_qlist_end( &p_port->cm_buf_mgr.posted_list );\r
- p_item = cl_qlist_remove_head( &p_port->cm_buf_mgr.posted_list ) )\r
- {\r
- cl_qpool_put( &p_port->cm_buf_mgr.recv_pool, \r
- &( PARENT_STRUCT( p_item, ipoib_cm_desc_t, list_item ))->item );\r
- }\r
- }\r
cl_qpool_destroy( &p_port->cm_buf_mgr.recv_pool );\r
\r
IPOIB_EXIT( IPOIB_DBG_INIT );\r
{\r
ipoib_cm_desc_t* p_desc;\r
ipoib_port_t* p_port;\r
-\r
- //IPOIB_ENTER( IPOIB_DBG_ALLOC );\r
+ ib_mr_create_t create_mr;\r
\r
CL_ASSERT( p_object );\r
CL_ASSERT( context );\r
p_desc = (ipoib_cm_desc_t*)p_object;\r
p_port = (ipoib_port_t*)context;\r
\r
- /* Allocate the receive buffer. */\r
- p_desc->buf_size = p_port->p_adapter->params.cm_xfer_block_size;\r
- \r
- p_desc->p_buf = (uint8_t *)ExAllocatePoolWithTag( \r
- NonPagedPool, p_desc->buf_size, 'DOMC' );\r
+#define BUF_ALIGN (16)\r
+\r
+ p_desc->alloc_buf_size = \r
+ ROUNDUP( p_port->p_adapter->params.cm_xfer_block_size, BUF_ALIGN );\r
\r
- if( p_desc->p_buf == NULL )\r
+ p_desc->p_alloc_buf = (uint8_t *)ExAllocatePoolWithTag( \r
+ NonPagedPool, p_desc->alloc_buf_size, 'DOMC' );\r
+ if( p_desc->p_alloc_buf == NULL )\r
{\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("Failed to allocate receive buffer size %d bytes.\n", p_desc->buf_size ) );\r
+ ("Failed to allocate receive buffer size %d bytes.\n", p_desc->alloc_buf_size ) );\r
return CL_INSUFFICIENT_MEMORY;\r
}\r
\r
+ create_mr.vaddr = p_desc->p_alloc_buf;\r
+ create_mr.length = p_desc->alloc_buf_size;\r
+ create_mr.access_ctrl = IB_AC_LOCAL_WRITE;\r
+\r
+ \r
+ if( p_port->p_adapter->p_ifc->reg_mem( \r
+ p_port->ib_mgr.h_pd,\r
+ &create_mr,\r
+ &p_desc->lkey,\r
+ &p_desc->rkey,\r
+ &p_desc->h_mr ) != IB_SUCCESS )\r
+ {\r
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+ ("Failed to create Memory Region size %d bytes.\n", p_desc->alloc_buf_size ) );\r
+ goto ctor_failed;\r
+ }\r
+ p_desc->p_buf = p_desc->p_alloc_buf + (BUF_ALIGN - sizeof( ipoib_hdr_t));\r
+ p_desc->buf_size = p_desc->alloc_buf_size - (BUF_ALIGN - sizeof( ipoib_hdr_t));\r
+\r
/* Setup the local data segment. */\r
- p_desc->local_ds[0].vaddr = \r
- cl_get_physaddr( ((uint8_t*)p_desc->p_buf) + DATA_OFFSET );\r
- p_desc->local_ds[0].length = p_desc->buf_size - DATA_OFFSET;\r
- p_desc->local_ds[0].lkey = p_port->ib_mgr.lkey;\r
+ p_desc->local_ds[0].vaddr = (uint64_t)p_desc->p_buf;\r
+ p_desc->local_ds[0].length = p_desc->buf_size;\r
+ p_desc->local_ds[0].lkey = p_desc->lkey;\r
\r
/* Setup the work request. */\r
p_desc->wr.wr_id = (uintn_t)p_desc;\r
p_desc->wr.ds_array = p_desc->local_ds;\r
p_desc->wr.num_ds = 1;\r
-\r
p_desc->type = PKT_TYPE_CM_UCAST;\r
+ \r
*pp_pool_item = &p_desc->item;\r
-\r
- //IPOIB_EXIT( IPOIB_DBG_ALLOC );\r
return CL_SUCCESS;\r
+\r
+ctor_failed:\r
+ ExFreePoolWithTag( p_desc->p_alloc_buf, 'DOMC' );\r
+ return CL_INSUFFICIENT_MEMORY;\r
}\r
\r
static void\r
IN void *context )\r
{\r
ipoib_cm_desc_t *p_desc;\r
-\r
- //IPOIB_ENTER( IPOIB_DBG_ALLOC );\r
+ ipoib_port_t* p_port;\r
\r
UNUSED_PARAM( context );\r
-\r
+ p_port = (ipoib_port_t*)context;\r
p_desc = PARENT_STRUCT( p_pool_item, ipoib_cm_desc_t, item );\r
\r
- if( p_desc->p_buf )\r
- ExFreePoolWithTag( p_desc->p_buf, 'DOMC' );\r
+ if( p_desc->h_mr )\r
+ p_port->p_adapter->p_ifc->dereg_mr( p_desc->h_mr );\r
\r
- //IPOIB_EXIT( IPOIB_DBG_ALLOC );\r
+ if( p_desc->p_alloc_buf )\r
+ ExFreePoolWithTag( p_desc->p_alloc_buf, 'DOMC' );\r
}\r
\r
static NDIS_PACKET*\r
&status, \r
&p_buffer,\r
p_port->cm_buf_mgr.h_buffer_pool, \r
- (void *)p_desc->p_buf,\r
- p_desc->len );\r
+ (void *)(p_desc->p_buf - DATA_OFFSET),\r
+ p_desc->len + DATA_OFFSET );\r
\r
if( status != NDIS_STATUS_SUCCESS )\r
{\r
return p_desc;\r
}\r
\r
-\r
void\r
endpt_cm_buf_mgr_put_recv(\r
IN endpt_buf_mgr_t * const p_buf_mgr,\r
IPOIB_EXIT( IPOIB_DBG_RECV );\r
}\r
\r
-\r
void\r
endpt_cm_buf_mgr_put_recv_list(\r
IN endpt_buf_mgr_t * const p_buf_mgr,\r
uint32_t i = 0;\r
NDIS_PACKET *p_packet;\r
\r
- NDIS_TCP_IP_CHECKSUM_PACKET_INFO chksum;\r
-\r
IPOIB_ENTER( IPOIB_DBG_RECV );\r
+ UNUSED_PARAM( p_endpt );\r
\r
p_item = cl_qlist_remove_head( p_done_list );\r
\r
p_port->cm_recv_mgr.depth--;\r
continue;\r
}\r
-\r
- p_desc->p_endpt = p_endpt;\r
-\r
- chksum.Value = 0;\r
- chksum.Receive.NdisPacketTcpChecksumSucceeded = TRUE;\r
- chksum.Receive.NdisPacketUdpChecksumSucceeded = TRUE;\r
- chksum.Receive.NdisPacketIpChecksumSucceeded = TRUE;\r
+ p_desc->ndis_csum.Value = 0;\r
+ p_desc->ndis_csum.Receive.NdisPacketTcpChecksumSucceeded = TRUE;\r
+ p_desc->ndis_csum.Receive.NdisPacketUdpChecksumSucceeded = TRUE;\r
+ p_desc->ndis_csum.Receive.NdisPacketIpChecksumSucceeded = TRUE;\r
NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, TcpIpChecksumPacketInfo ) =\r
- (void*)(uintn_t)chksum.Value;\r
+ (void*)(uintn_t)p_desc->ndis_csum.Value;\r
\r
NDIS_SET_PACKET_STATUS( p_packet, NDIS_STATUS_SUCCESS );\r
p_port->cm_recv_mgr.recv_pkt_array[i] = p_packet;\r
/* Successful completion \r
Setup the ethernet/ip/arp header and queue descriptor for report. */\r
ib_status = IB_SUCCESS;\r
-\r
- p_ipoib = (ipoib_pkt_t *)( ((uint8_t*)p_desc->p_buf) + DATA_OFFSET );\r
- p_eth = (eth_pkt_t *)p_desc->p_buf;\r
+ p_ipoib = (ipoib_pkt_t *)((uint8_t*)p_desc->p_buf );\r
+ p_eth = (eth_pkt_t *)((uint8_t*)p_desc->p_buf - DATA_OFFSET );\r
\r
switch( p_ipoib->hdr.type )\r
{\r
p_eth->hdr.dst = p_port->p_adapter->mac;\r
\r
/* save payload length */\r
- p_desc->len = p_wc->length + DATA_OFFSET;\r
+ p_desc->len = p_wc->length;\r
\r
cl_qlist_insert_tail( p_done_list, &p_desc->item.list_item );\r
}\r
ib_av_handle_t h_av;\r
boolean_t expired;\r
endpt_conn_t conn;\r
- cl_event_t remove_event;\r
\r
ib_al_ifc_t *p_ifc;\r
boolean_t is_in_use;\r
\r
if( p_port->p_adapter->params.cm_enabled )\r
{\r
+ endpt_cm_buf_mgr_destroy( p_port );\r
+ ipoib_port_srq_destroy( p_port );\r
p_port->endpt_mgr.thread_is_done = 1;\r
cl_event_signal( &p_port->endpt_mgr.event );\r
}\r
p_port->p_adapter->p_ifc->get_err_str( status )) );\r
return status;\r
}\r
-\r
- status = ipoib_port_srq_init( p_port );\r
- if( status != IB_SUCCESS )\r
- {\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("ipoib_port_srq_init failed %s\n",\r
- p_port->p_adapter->p_ifc->get_err_str( status )) );\r
- // disable further CM initialization \r
- p_port->p_adapter->params.cm_enabled = FALSE;\r
- }\r
if (!p_port->p_ca_attrs->ipoib_csum )\r
{\r
//checksum is not supported by device\r
//user must specify BYPASS to explicitly cancel checksum calculation\r
- IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+ IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_INIT,\r
("IPOIB CHKSUM IS NOT SUPPORTED BY HCA\n" ) );\r
if (p_port->p_adapter->params.send_chksum_offload == CSUM_ENABLED)\r
p_port->p_adapter->params.send_chksum_offload = CSUM_DISABLED;\r
return status;\r
}\r
\r
+ status = ipoib_port_srq_init( p_port );\r
+ if( status != IB_SUCCESS )\r
+ {\r
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+ ("ipoib_port_srq_init failed %s\n",\r
+ p_port->p_adapter->p_ifc->get_err_str( status )) );\r
+ // disable further CM initialization \r
+ p_port->p_adapter->params.cm_enabled = FALSE;\r
+ }\r
+ if( p_port->p_adapter->params.cm_enabled )\r
+ {\r
+ status = endpt_cm_buf_mgr_init( p_port );\r
+ if( status != IB_SUCCESS )\r
+ {\r
+ IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+ ("CM Init buf mgr failed status %#x\n", status ) );\r
+ ipoib_port_srq_destroy( p_port );\r
+ p_port->p_adapter->params.cm_enabled = FALSE;\r
+ }\r
+ }\r
IPOIB_EXIT( IPOIB_DBG_INIT );\r
return IB_SUCCESS;\r
}\r
p_port->p_adapter->p_ifc->get_err_str( ib_status )) );\r
return ib_status;\r
}\r
-\r
p_port->ib_mgr.h_srq = h_srq;\r
\r
IPOIB_EXIT( IPOIB_DBG_INIT );\r
NdisFreeBuffer( p_buf );\r
\r
endpt_cm_buf_mgr_put_recv( &p_port->cm_buf_mgr, (ipoib_cm_desc_t *)p_desc );\r
- \r
status = endpt_cm_post_recv( p_port );\r
if( status != IB_SUCCESS )\r
{\r
p_port->hdr[hdr_idx].type = p_eth_hdr->type;\r
p_port->hdr[hdr_idx].resv = 0;\r
\r
- if (mss)\r
+ if( p_port->p_adapter->params.lso && mss )\r
{\r
memset(&TheLsoData, 0, sizeof TheLsoData );\r
status = GetLsoHeaderSize(\r
&TheLsoData, \r
&lso_header_size,\r
&IndexOfData,\r
- &p_port->hdr[hdr_idx]\r
- \r
- );\r
+ &p_port->hdr[hdr_idx] );\r
+\r
if ((status != NDIS_STATUS_SUCCESS ) || \r
(TheLsoData.FullBuffers != TheLsoData.UsedBuffers)) {\r
ASSERT(FALSE);\r
p_desc->wr.send_opt |= (IB_SEND_OPT_TX_IP_CSUM | IB_SEND_OPT_TX_TCP_UDP_CSUM);\r
__send_gen(p_port, p_desc, IndexOfData);\r
p_desc->wr.wr_type = ( WR_LSO | IB_SEND_OPT_SIGNALED);\r
- } else {\r
-\r
+ } \r
+ else\r
+ {\r
/* Setup the first local data segment (used for the IPoIB header). */\r
p_desc->local_ds[0].vaddr = cl_get_physaddr( &p_port->hdr[hdr_idx] );\r
p_desc->local_ds[0].length = sizeof(ipoib_hdr_t);\r
p_desc->wr.send_opt = IB_SEND_OPT_SIGNALED;\r
}\r
\r
-\r
-\r
/* Setup the work request. */\r
p_desc->wr.p_next = NULL;\r
p_desc->wr.wr_id = (uintn_t)p_desc->p_pkt;\r
LIST_ENTRY *p_item;\r
ipoib_endpt_t *p_endpt;\r
ipoib_port_t *p_port =( ipoib_port_t *)p_context;\r
-\r
\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT, \r
("Starting Port [%d] Endpt CM thread \n", p_port->port_num ) );\r
\r
while( !p_port->endpt_mgr.thread_is_done )\r
{\r
- cl_event_wait_on( &p_port->endpt_mgr.event, EVENT_NO_TIMEOUT, TRUE );\r
+ cl_event_wait_on( &p_port->endpt_mgr.event, EVENT_NO_TIMEOUT, FALSE );\r
\r
- if( p_port->endpt_mgr.thread_is_done )\r
- break;\r
- \r
while( ( p_item = NdisInterlockedRemoveHeadList( \r
&p_port->endpt_mgr.pending_conns,\r
&p_port->endpt_mgr.conn_lock) ) != NULL )\r
p_endpt = PARENT_STRUCT( p_item, ipoib_endpt_t, list_item );\r
if( p_port->endpt_mgr.thread_is_done )\r
{\r
- endpt_cm_set_state( p_endpt, IPOIB_CM_DESTROY );\r
- NdisInterlockedInsertTailList( &p_port->endpt_mgr.remove_conns, \r
- &p_endpt->list_item, \r
- &p_port->endpt_mgr.remove_lock );\r
+ endpt_cm_set_state( p_endpt, IPOIB_CM_DISCONNECTED );\r
continue;\r
}\r
\r
p_endpt->mac.addr[0], p_endpt->mac.addr[1],\r
p_endpt->mac.addr[2], p_endpt->mac.addr[3],\r
p_endpt->mac.addr[4], p_endpt->mac.addr[5] ) );\r
-\r
+ \r
if( !p_endpt->conn.h_qp )\r
{\r
ib_status = endpt_cm_create_qp( p_endpt );\r
if( ib_status != IB_SUCCESS && ib_status != IB_PENDING )\r
{\r
endpt_cm_set_state( p_endpt, IPOIB_CM_DESTROY );\r
- NdisInterlockedInsertTailList( &p_port->endpt_mgr.remove_conns, \r
- &p_endpt->list_item, \r
- &p_port->endpt_mgr.remove_lock );\r
+ endpt_cm_flush_recv( p_port, p_endpt );\r
+ endpt_cm_set_state( p_endpt, IPOIB_CM_DISCONNECTED );\r
}\r
}\r
\r
}//while( p_item != NULL )\r
\r
- \r
while( ( p_item = NdisInterlockedRemoveHeadList(\r
&p_port->endpt_mgr.remove_conns,\r
&p_port->endpt_mgr.remove_lock ) ) != NULL )\r
{\r
p_endpt = PARENT_STRUCT( p_item, ipoib_endpt_t, list_item );\r
\r
- IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
+ endpt_cm_set_state( p_endpt, IPOIB_CM_DESTROY );\r
+\r
+ IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_INIT,\r
("\nDESTROYING Endpt[%p] MAC %02x:%02x:%02x:%02x:%02x:%02x\n",\r
p_endpt,\r
p_endpt->mac.addr[0], p_endpt->mac.addr[1],\r
p_endpt->mac.addr[4], p_endpt->mac.addr[5] ) );\r
endpt_cm_flush_recv( p_port, p_endpt );\r
endpt_cm_set_state( p_endpt, IPOIB_CM_DISCONNECTED );\r
- cl_event_signal( &p_endpt->remove_event );\r
+ cl_obj_destroy( &p_endpt->obj );\r
}\r
}\r
\r
\r
while( cl_qlist_count( &conn_list ) )\r
{\r
- cl_obj_destroy( &PARENT_STRUCT( cl_qlist_remove_head( &conn_list ),\r
- ipoib_endpt_t, mac_item.pool_item.list_item )->obj );\r
+ endpt_cm_destroy_conn( p_port,\r
+ PARENT_STRUCT( cl_qlist_remove_head( &conn_list ),\r
+ ipoib_endpt_t, mac_item.pool_item.list_item ) );\r
}\r
\r
if(cl_qlist_count( &mc_list ) - local_exist)\r
IN ipoib_endpt_t* const p_endpt )\r
{\r
cl_fmap_item_t* p_fmap_item;\r
+ ipoib_endpt_t* p_conn_endpt = NULL;\r
\r
IPOIB_ENTER( IPOIB_DBG_ENDPT );\r
\r
{\r
cl_fmap_remove_item( &p_port->endpt_mgr.conn_endpts, \r
&p_endpt->conn_item );\r
+ p_conn_endpt = p_endpt;\r
}\r
}\r
if( p_endpt->dlid )\r
}\r
\r
cl_obj_unlock( &p_port->obj );\r
-\r
- cl_obj_destroy( &p_endpt->obj );\r
+ if( p_conn_endpt )\r
+ {\r
+ endpt_cm_destroy_conn( p_port, p_conn_endpt );\r
+ }\r
+ else\r
+ {\r
+ cl_obj_destroy( &p_endpt->obj );\r
+ }\r
\r
IPOIB_EXIT( IPOIB_DBG_ENDPT );\r
}\r
cl_map_item_t *p_item;\r
cl_fmap_item_t *p_fmap_item;\r
ipoib_endpt_t *p_endpt;\r
+ ipoib_endpt_t *p_conn_endpt = NULL;\r
uint64_t key;\r
\r
IPOIB_ENTER( IPOIB_DBG_ENDPT );\r
-\r
+ \r
key = 0;\r
cl_memcpy( &key, &mac, sizeof(mac_addr_t) );\r
\r
{\r
cl_fmap_remove_item( &p_port->endpt_mgr.conn_endpts, \r
&p_endpt->conn_item );\r
+ p_conn_endpt = p_endpt;\r
}\r
}\r
\r
}\r
\r
cl_obj_unlock( &p_port->obj );\r
- cl_obj_destroy( &p_endpt->obj );\r
+ if( p_conn_endpt )\r
+ {\r
+ endpt_cm_destroy_conn( p_port, p_conn_endpt );\r
+ }\r
+ else\r
+ {\r
+ cl_obj_destroy( &p_endpt->obj );\r
+ }\r
#if DBG\r
cl_atomic_dec( &p_port->ref[ref_endpt_track] );\r
IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_OBJ,\r
p_port->p_adapter->p_ifc->get_err_str( status )) );\r
return status;\r
}\r
-\r
- if( p_port->p_adapter->params.cm_enabled )\r
- {\r
- status = endpt_cm_buf_mgr_init( p_port );\r
- if( status != IB_SUCCESS )\r
- {\r
- IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("CM Init buf mgr failed status %#x\n", status ) );\r
-\r
- endpt_cm_buf_mgr_destroy( p_port );\r
- ipoib_port_srq_destroy( p_port );\r
- p_port->p_adapter->params.cm_enabled = FALSE;\r
- }\r
- }\r
p_port->p_local_endpt = p_endpt;\r
\r
IPOIB_EXIT( IPOIB_DBG_INIT );\r
ipoib_dereg_addrs( p_port->p_adapter );\r
cl_obj_unlock( &p_port->p_adapter->obj );\r
\r
- if( p_port->p_adapter->params.cm_enabled )\r
- {\r
- endpt_cm_buf_mgr_destroy( p_port );\r
- ipoib_port_srq_destroy( p_port );\r
- }\r
-\r
IPOIB_EXIT( IPOIB_DBG_INIT );\r
}\r
\r
\r
typedef struct _ipoib_cm_desc\r
{\r
- cl_pool_item_t item; /* Must be first. */\r
- uint32_t len;\r
- ipoib_pkt_type_t type;\r
- ib_recv_wr_t wr;\r
- ipoib_endpt_t* p_endpt;\r
- ib_local_ds_t local_ds[2];\r
- cl_list_item_t list_item;\r
- uint8_t *p_buf;\r
- uint8_t *p_phys_buf;\r
- uint32_t buf_size;\r
+ cl_pool_item_t item; /* Must be first. */\r
+ uint32_t len;\r
+ ipoib_pkt_type_t type;\r
+ ib_recv_wr_t wr;\r
+ ib_local_ds_t local_ds[2];\r
+ cl_list_item_t list_item;\r
+ uint8_t* p_alloc_buf;\r
+ uint8_t* p_buf;\r
+ uint32_t alloc_buf_size;\r
+ uint32_t buf_size;\r
+ net32_t lkey;\r
+ net32_t rkey;\r
+ ib_mr_handle_t h_mr;\r
NDIS_TCP_IP_CHECKSUM_PACKET_INFO ndis_csum;\r
\r
} ipoib_cm_desc_t;\r
endpt_cm_buf_mgr_destroy(\r
IN ipoib_port_t* const p_port );\r
\r
+void\r
+endpt_cm_buf_mgr_reset(\r
+ IN ipoib_port_t* const p_port );\r
+\r
void\r
endpt_cm_buf_mgr_put_recv(\r
IN endpt_buf_mgr_t * const p_buf_mgr,\r