[ofw] [PATCH 3/9] events: allow callbacks per CQ, QP, or SRQ

Leonid Keller leonid at mellanox.co.il
Thu Jun 26 04:49:32 PDT 2008


Are the event_handlers are always installed ? 
[You removed all NULL-checking]
What if user is not interested in asynchronic events at all ?
What if user hadn't defined CQ completion callback, but mistakenly posts
sends with completion flag ?

> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org 
> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Sean Hefty
> Sent: Thursday, June 26, 2008 2:51 AM
> To: Hefty, Sean; ofw at lists.openfabrics.org
> Subject: [ofw] [PATCH 3/9] events: allow callbacks per CQ, QP, or SRQ
> 
> The underlying hardware drivers both support setting 
> callbacks on a per widget (CQ, QP, or SRQ) basis, but the 
> verbs interface only allows one global event handler and one 
> completion handler for the HCA.  Modify the verbs interface 
> to allow setting events callbacks directly on the HCA 
> objects.  This allows the HCA to support multiple consumers 
> of its interface, and users can optimize their event handling 
> based on the call.
> For example, the HCA drivers can invoke callbacks directly to 
> the ULPs without the calls first being filtered by IBAL.  
> This will improve completion event reporting.
> 
> To minimize changes to the existing stack, the current event 
> handler is used for all events, regardless of type.  
> Optimizations are left for a separate patch.
> 
> Signed-off-by: Sean Hefty <sean.hefty at intel.com>
> ---
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/core/al/al_verbs.h branches\winverbs/core/al/al_verbs.h
> --- trunk/core/al/al_verbs.h	2008-06-03 20:28:24.338500000 -0700
> +++ branches\winverbs/core/al/al_verbs.h	2008-06-03 
> 20:31:24.557250000 -0700
> @@ -72,6 +72,9 @@
>  	h_ca->obj.p_ci_ca->verbs.modify_ca( h_ca->obj.p_ci_ca->h_ci_ca,\
>  		port_num, ca_mod, p_port_attr_mod )
>  
> +void ci_ca_comp_cb(void *cq_context);
> +void ci_ca_async_event_cb(ib_event_rec_t* p_event_record);
> +
>  static inline ib_api_status_t
>  verbs_create_cq(
>  	IN		const	ib_ca_handle_t FUNC_PTR64	
> 			h_ca,
> @@ -81,7 +84,8 @@ verbs_create_cq(
>  {
>  	return h_ca->obj.p_ci_ca->verbs.create_cq(
>  		(p_umv_buf) ? h_ca->h_um_ca : 
> h_ca->obj.p_ci_ca->h_ci_ca,
> -		h_cq, &p_cq_create->size, &h_cq->h_ci_cq, p_umv_buf );
> +		h_cq, ci_ca_async_event_cb, ci_ca_comp_cb, 
> &p_cq_create->size,
> +		&h_cq->h_ci_cq, p_umv_buf );
>  }
>  
>  #define verbs_check_cq(h_cq)	((h_cq)->h_ci_cq)
> @@ -241,7 +245,7 @@ verbs_create_srq(
>  	ib_api_status_t		status;
>  
>  	status = h_srq->obj.p_ci_ca->verbs.create_srq(
> -		h_pd->h_ci_pd, h_srq, p_srq_attr,
> +		h_pd->h_ci_pd, h_srq, ci_ca_async_event_cb, p_srq_attr,
>  		&h_srq->h_ci_srq, p_umv_buf );
>  
>  	h_srq->h_recv_srq = h_srq->h_ci_srq;
> @@ -286,7 +290,7 @@ verbs_get_spl_qp(
>  	ib_api_status_t		status;
>  
>  	status = h_qp->obj.p_ci_ca->verbs.create_spl_qp(
> -		h_pd->h_ci_pd, port_num, h_qp, p_qp_create,
> +		h_pd->h_ci_pd, port_num, h_qp, 
> ci_ca_async_event_cb, p_qp_create,
>  		p_qp_attr, &h_qp->h_ci_qp );
>  
>  	h_qp->h_recv_qp = h_qp->h_ci_qp;
> @@ -309,7 +313,7 @@ verbs_create_qp(
>  	ib_api_status_t		status;
>  
>  	status = h_qp->obj.p_ci_ca->verbs.create_qp(
> -		h_pd->h_ci_pd, h_qp, p_qp_create, p_qp_attr,
> +		h_pd->h_ci_pd, h_qp, ci_ca_async_event_cb, 
> p_qp_create, p_qp_attr,
>  		&h_qp->h_ci_qp, p_umv_buf );
>  
>  	h_qp->h_recv_qp = h_qp->h_ci_qp;
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/core/al/kernel/al_ci_ca.c 
> branches\winverbs/core/al/kernel/al_ci_ca.c
> --- trunk/core/al/kernel/al_ci_ca.c	2008-06-03 
> 20:28:24.354125000 -0700
> +++ branches\winverbs/core/al/kernel/al_ci_ca.c	
> 2008-06-03 20:31:24.557250000 -0700
> @@ -76,7 +76,7 @@ ci_ca_async_proc_cb(
>  
>  void
>  ci_ca_async_event_cb(
> -	IN		const	ib_event_rec_t* const		
> p_event_record );
> +	IN				ib_event_rec_t*		
> 		p_event_record );
>  
>  
>  
> @@ -154,7 +154,7 @@ create_ci_ca(
>  	p_ci_ca->dereg_async_item.pfn_callback = ci_ca_async_proc_cb;
>  
>  	/* Open the CI CA. */
> -	status = p_ci_ca->verbs.open_ca( p_ci_ca->verbs.guid, 
> ci_ca_comp_cb,
> +	status = p_ci_ca->verbs.open_ca( p_ci_ca->verbs.guid,
>  		ci_ca_async_event_cb, p_ci_ca, &p_ci_ca->h_ci_ca );
>  	if( status != IB_SUCCESS )
>  	{
> @@ -335,7 +335,7 @@ ci_ca_comp_cb(
>   */
>  void
>  ci_ca_async_event_cb(
> -	IN		const	ib_event_rec_t* const		
> p_event_record )
> +	IN		ib_event_rec_t*		p_event_record )
>  {
>  	ib_async_event_rec_t	event_rec;
>  
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/bus/ib/cq.c 
> branches\winverbs/hw/mlx4/kernel/bus/ib/cq.c
> --- trunk/hw/mlx4/kernel/bus/ib/cq.c	2008-06-03 
> 20:28:24.385375000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/bus/ib/cq.c	
> 2008-06-03 20:31:24.572875000 -0700
> @@ -38,12 +38,12 @@
>  static void mlx4_ib_cq_comp(struct mlx4_cq *cq)  {
>  	struct ib_cq *ibcq = &to_mibcq(cq)->ibcq;
> -	ibcq->comp_handler(ibcq, ibcq->cq_context);
> +	ibcq->comp_handler(ibcq->cq_context);
>  }
>  
>  static void mlx4_ib_cq_event(struct mlx4_cq *cq, enum 
> mlx4_event type)  {
> -	struct ib_event event;
> +	ib_event_rec_t event;
>  	struct ib_cq *ibcq;
>  
>  	if (type != MLX4_EVENT_TYPE_CQ_ERROR) { @@ -53,12 
> +53,10 @@ static void mlx4_ib_cq_event(struct mlx4
>  	}
>  
>  	ibcq = &to_mibcq(cq)->ibcq;
> -	if (ibcq->event_handler) {
> -		event.device     = ibcq->device;
> -		event.event      = IB_EVENT_CQ_ERR;
> -		event.element.cq = ibcq;
> -		ibcq->event_handler(&event, ibcq->cq_context);
> -	}
> +	event.type = IB_EVENT_CQ_ERR;
> +	event.context = ibcq->cq_context;
> +	event.vendor_specific = type;
> +	ibcq->event_handler(&event);
>  }
>  
>  static void *get_cqe_from_buf(struct mlx4_ib_cq_buf *buf, 
> int n) diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/bus/ib/qp.c 
> branches\winverbs/hw/mlx4/kernel/bus/ib/qp.c
> --- trunk/hw/mlx4/kernel/bus/ib/qp.c	2008-06-03 
> 20:28:24.416625000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/bus/ib/qp.c	
> 2008-06-03 20:31:24.572875000 -0700
> @@ -127,48 +127,45 @@ static void stamp_send_wqe(struct mlx4_i
>  
>  static void mlx4_ib_qp_event(struct mlx4_qp *qp, enum 
> mlx4_event type)  {
> -	struct ib_event event;
> +	ib_event_rec_t event;
>  	struct ib_qp *ibqp = &to_mibqp(qp)->ibqp;
>  
>  	if (type == MLX4_EVENT_TYPE_PATH_MIG)
>  		to_mibqp(qp)->port = to_mibqp(qp)->alt_port;
>  
> -	if (ibqp->event_handler) {
> -		event.device     = ibqp->device;
> -		event.element.qp = ibqp;
> -		switch (type) {
> -		case MLX4_EVENT_TYPE_PATH_MIG:
> -			event.event = IB_EVENT_PATH_MIG;
> -			break;
> -		case MLX4_EVENT_TYPE_COMM_EST:
> -			event.event = IB_EVENT_COMM_EST;
> -			break;
> -		case MLX4_EVENT_TYPE_SQ_DRAINED:
> -			event.event = IB_EVENT_SQ_DRAINED;
> -			break;
> -		case MLX4_EVENT_TYPE_SRQ_QP_LAST_WQE:
> -			event.event = IB_EVENT_QP_LAST_WQE_REACHED;
> -			break;
> -		case MLX4_EVENT_TYPE_WQ_CATAS_ERROR:
> -			event.event = IB_EVENT_QP_FATAL;
> -			break;
> -		case MLX4_EVENT_TYPE_PATH_MIG_FAILED:
> -			event.event = IB_EVENT_PATH_MIG_ERR;
> -			break;
> -		case MLX4_EVENT_TYPE_WQ_INVAL_REQ_ERROR:
> -			event.event = IB_EVENT_QP_REQ_ERR;
> -			break;
> -		case MLX4_EVENT_TYPE_WQ_ACCESS_ERROR:
> -			event.event = IB_EVENT_QP_ACCESS_ERR;
> -			break;
> -		default:
> -			printk(KERN_WARNING "mlx4_ib: 
> Unexpected event type %d "
> -			       "on QP %06x\n", type, qp->qpn);
> -			return;
> -		}
> -
> -		ibqp->event_handler(&event, ibqp->qp_context);
> +	switch (type) {
> +	case MLX4_EVENT_TYPE_PATH_MIG:
> +		event.type = IB_EVENT_PATH_MIG;
> +		break;
> +	case MLX4_EVENT_TYPE_COMM_EST:
> +		event.type = IB_EVENT_COMM_EST;
> +		break;
> +	case MLX4_EVENT_TYPE_SQ_DRAINED:
> +		event.type = IB_EVENT_SQ_DRAINED;
> +		break;
> +	case MLX4_EVENT_TYPE_SRQ_QP_LAST_WQE:
> +		event.type = IB_EVENT_QP_LAST_WQE_REACHED;
> +		break;
> +	case MLX4_EVENT_TYPE_WQ_CATAS_ERROR:
> +		event.type = IB_EVENT_QP_FATAL;
> +		break;
> +	case MLX4_EVENT_TYPE_PATH_MIG_FAILED:
> +		event.type = IB_EVENT_PATH_MIG_ERR;
> +		break;
> +	case MLX4_EVENT_TYPE_WQ_INVAL_REQ_ERROR:
> +		event.type = IB_EVENT_QP_REQ_ERR;
> +		break;
> +	case MLX4_EVENT_TYPE_WQ_ACCESS_ERROR:
> +		event.type = IB_EVENT_QP_ACCESS_ERR;
> +		break;
> +	default:
> +		printk(KERN_WARNING "mlx4_ib: Unexpected event type %d "
> +		       "on QP %06x\n", type, qp->qpn);
> +		return;
>  	}
> +
> +	event.context = ibqp->qp_context;
> +	ibqp->event_handler(&event);
>  }
>  
>  static int send_wqe_overhead(enum ib_qp_type type) diff -up 
> -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/bus/ib/srq.c 
> branches\winverbs/hw/mlx4/kernel/bus/ib/srq.c
> --- trunk/hw/mlx4/kernel/bus/ib/srq.c	2008-06-03 
> 20:28:24.447875000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/bus/ib/srq.c	
> 2008-06-03 20:31:24.572875000 -0700
> @@ -48,27 +48,24 @@ static void *get_wqe(struct mlx4_ib_srq 
>  
>  static void mlx4_ib_srq_event(struct mlx4_srq *srq, enum 
> mlx4_event type)  {
> -	struct ib_event event;
> +	ib_event_rec_t event;
>  	struct ib_srq *ibsrq = &to_mibsrq(srq)->ibsrq;
>  
> -	if (ibsrq->event_handler) {
> -		event.device      = ibsrq->device;
> -		event.element.srq = ibsrq;
> -		switch (type) {
> -		case MLX4_EVENT_TYPE_SRQ_LIMIT:
> -			event.event = IB_EVENT_SRQ_LIMIT_REACHED;
> -			break;
> -		case MLX4_EVENT_TYPE_SRQ_CATAS_ERROR:
> -			event.event = IB_EVENT_SRQ_ERR;
> -			break;
> -		default:
> -			printk(KERN_WARNING "mlx4_ib: 
> Unexpected event type %d "
> -			       "on SRQ %06x\n", type, srq->srqn);
> -			return;
> -		}
> -
> -		ibsrq->event_handler(&event, ibsrq->srq_context);
> +	switch (type) {
> +	case MLX4_EVENT_TYPE_SRQ_LIMIT:
> +		event.type = IB_EVENT_SRQ_LIMIT_REACHED;
> +		break;
> +	case MLX4_EVENT_TYPE_SRQ_CATAS_ERROR:
> +		event.type = IB_EVENT_SRQ_ERR;
> +		break;
> +	default:
> +		printk(KERN_WARNING "mlx4_ib: Unexpected event type %d "
> +		       "on SRQ %06x\n", type, srq->srqn);
> +		return;
>  	}
> +
> +	event.context = ibsrq->srq_context;
> +	ibsrq->event_handler(&event);
>  }
>  
>  struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, diff -up 
> -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/bus/inc/ib_verbs.h
> branches\winverbs/hw/mlx4/kernel/bus/inc/ib_verbs.h
> --- trunk/hw/mlx4/kernel/bus/inc/ib_verbs.h	2008-06-03 
> 20:28:24.463500000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/bus/inc/ib_verbs.h	
> 2008-06-03 20:31:24.588500000 -0700
> @@ -446,7 +446,7 @@ struct ib_srq_attr {  };
>  
>  struct ib_srq_init_attr {
> -	void		      (*event_handler)(struct ib_event 
> *, void *);
> +	void		      (*event_handler)(ib_event_rec_t *);
>  	void		       *srq_context;
>  	struct ib_srq_attr	attr;
>  };
> @@ -481,7 +481,7 @@ enum ib_qp_type {
>  };
>  
>  struct ib_qp_init_attr {
> -	void                  (*event_handler)(struct ib_event 
> *, void *);
> +	void                  (*event_handler)(ib_event_rec_t *);
>  	void		       *qp_context;
>  	struct ib_cq	       *send_cq;
>  	struct ib_cq	       *recv_cq;
> @@ -729,13 +729,13 @@ struct ib_ah {
>  	struct ib_ucontext	*p_uctx;
>  };
>  
> -typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
> +typedef void (*ib_comp_handler)(void *cq_context);
>  
>  struct ib_cq {
>  	struct ib_device       *device;
>  	struct ib_ucontext     *p_uctx;
>  	ib_comp_handler   	comp_handler;
> -	void                  (*event_handler)(struct ib_event 
> *, void *);
> +	void                  (*event_handler)(ib_event_rec_t *);
>  	void *            	cq_context;
>  	int               	cqe;
>  	atomic_t          	usecnt; /* count number of work 
> queues */
> @@ -746,7 +746,7 @@ struct ib_srq {
>  	struct ib_device       *device;
>  	struct ib_pd	       *pd;
>  	struct ib_ucontext     *p_uctx;
> -	void		      (*event_handler)(struct ib_event 
> *, void *);
> +	void		      (*event_handler)(ib_event_rec_t *);
>  	void		       *srq_context;
>  	atomic_t		usecnt;
>  	struct ib_srq_ex        x;
> @@ -759,7 +759,7 @@ struct ib_qp {
>  	struct ib_cq	       *recv_cq;
>  	struct ib_srq	       *srq;
>  	struct ib_ucontext     *p_uctx;
> -	void                  (*event_handler)(struct ib_event 
> *, void *);
> +	void                  (*event_handler)(ib_event_rec_t *);
>  	void		       *qp_context;
>  	u32			qp_num;
>  	enum ib_qp_type		qp_type;
> @@ -1358,7 +1358,7 @@ static inline int ib_post_recv(struct ib
>   */
>  struct ib_cq *ib_create_cq(struct ib_device *device,
>  			   ib_comp_handler comp_handler,
> -			   void (*event_handler)(struct 
> ib_event *, void *),
> +			   void (*event_handler)(ib_event_rec_t *),
>  			   void *cq_context, int cqe, int comp_vector);
>  
>  /**
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/hca/ca.c 
> branches\winverbs/hw/mlx4/kernel/hca/ca.c
> --- trunk/hw/mlx4/kernel/hca/ca.c	2008-06-03 
> 20:28:24.479125000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/hca/ca.c	2008-06-03 
> 20:31:24.588500000 -0700
> @@ -42,7 +42,6 @@
>  ib_api_status_t
>  mlnx_open_ca (
>  	IN		const	ib_net64_t			
> 		ca_guid, // IN  const char *
> ca_name,
> -	IN		const	ci_completion_cb_t		
> 	pfn_completion_cb,
>  	IN		const	ci_async_event_cb_t		
> 	pfn_async_event_cb,
>  	IN		const	void*const			
> 		ca_context,
>  		OUT			ib_ca_handle_t		
> 		*ph_ca)
> @@ -75,7 +74,6 @@ mlnx_open_ca (
>  	HCA_PRINT(TRACE_LEVEL_INFORMATION  ,HCA_DBG_SHIM,
>  		("context 0x%p\n", ca_context));
>  	status = mlnx_set_cb(p_hca,
> -		pfn_completion_cb,
>  		pfn_async_event_cb,
>  		ca_context);
>  	if (IB_SUCCESS != status) {
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/hca/cq.c 
> branches\winverbs/hw/mlx4/kernel/hca/cq.c
> --- trunk/hw/mlx4/kernel/hca/cq.c	2008-06-03 
> 20:28:24.494750000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/hca/cq.c	2008-06-03 
> 20:31:24.588500000 -0700
> @@ -43,6 +43,8 @@ ib_api_status_t
>  mlnx_create_cq (
>  	IN		const	ib_ca_handle_t			
> 	h_ca,
>  	IN		const	void				
> 		*cq_context,
> +	IN				ci_async_event_cb_t	
> 		event_handler,
> +	IN				ci_completion_cb_t	
> 		cq_comp_handler,
>  	IN	OUT			uint32_t		
> 			*p_size,
>  		OUT			ib_cq_handle_t		
> 		*ph_cq,
>  	IN	OUT			ci_umv_buf_t		
> 		*p_umv_buf )
> @@ -86,7 +88,7 @@ mlnx_create_cq (
>  
>  	// allocate cq	
>  	p_ib_cq = ibv_create_cq(p_ibdev, 
> -		cq_comp_handler, cq_event_handler,
> +		cq_comp_handler, event_handler,
>  		p_hca, *p_size, p_uctx, p_umv_buf );
>  	if (IS_ERR(p_ib_cq)) {
>  		err = PTR_ERR(p_ib_cq);
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/hca/data.c 
> branches\winverbs/hw/mlx4/kernel/hca/data.c
> --- trunk/hw/mlx4/kernel/hca/data.c	2008-06-03 
> 20:31:11.104125000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/hca/data.c	
> 2008-06-03 20:31:24.604125000 -0700
> @@ -107,7 +107,6 @@ mlnx_hcas_init( void )  ib_api_status_t  
> mlnx_set_cb(
>  	IN				mlnx_hca_t		
> 		*	p_hca, 
> -	IN				ci_completion_cb_t	
> 		comp_cb_p,
>  	IN				ci_async_event_cb_t	
> 		async_cb_p,
>  	IN		const	void* const			
> 		ib_context)
>  {
> @@ -132,7 +131,6 @@ mlnx_set_cb(
>  		}
>  	}
>  
> -	p_hca->comp_cb_p	= comp_cb_p;
>  	p_hca->async_cb_p = async_cb_p;
>  	p_hca->ca_context = ib_context; // This is the context 
> our CB forwards to IBAL
>  	return IB_SUCCESS;
> @@ -152,7 +150,6 @@ mlnx_reset_cb(
>  	p_async_proc = p_hca->async_proc_mgr_p;
>  	p_hca->async_proc_mgr_p = NULL;
>  
> -	p_hca->comp_cb_p = NULL;
>  	p_hca->async_cb_p = NULL;
>  	p_hca->ca_context = NULL;
>  	p_hca->cl_device_h = NULL;
> @@ -295,21 +292,6 @@ from_hca_cap(
>  	}
>  }
>  
> -void cq_comp_handler(struct ib_cq *cq, void *context) -{
> -	mlnx_hca_t *p_hca = (mlnx_hca_t *)context;
> -	struct ib_cq *p_ib_cq =(struct ib_cq *)cq; 
> -	HCA_ENTER(HCA_DBG_CQ);
> -	if (p_hca && p_hca->comp_cb_p) {
> -		HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_CQ 
> ,("Invoking completion callback\n"));
> -		(p_hca->comp_cb_p)(p_ib_cq->x.ctx);
> -	}
> -	else {
> -		HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_CQ 
> ,("Incorrect context. Completion callback was not invoked\n"));
> -	}
> -	HCA_EXIT(HCA_DBG_CQ);
> -}
> -
>  void ca_event_handler(struct ib_event *ev, void *context)  {
>  	mlnx_hca_t *p_hca = (mlnx_hca_t *)context; @@ -333,67 
> +315,6 @@ void ca_event_handler(struct ib_event *e
>  	}
>  }
>  
> -void srq_event_handler(struct ib_event *ev, void *context) -{
> -	mlnx_hca_t *p_hca = (mlnx_hca_t *)context;
> -	ib_event_rec_t event_rec;
> -	struct ib_srq *p_srq;
> -
> -	// prepare parameters
> -	event_rec.type = ev->event;
> -	// TODO: who fills x.vendor_specific
> -	event_rec.vendor_specific = ev->x.vendor_specific;
> -	p_srq = (struct ib_srq *)ev->element.srq;
> -	event_rec.context = p_srq->x.ctx;
> -
> -	// call the user callback
> -	if (p_hca)
> -		(p_hca->async_cb_p)(&event_rec);
> -	else {
> -		HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM 
> ,("Incorrect context. Async callback was not invoked\n"));
> -	}
> -}
> -
> -
> -void qp_event_handler(struct ib_event *ev, void *context) -{
> -	mlnx_hca_t *p_hca = (mlnx_hca_t *)context;
> -	ib_event_rec_t event_rec;
> -	struct ib_qp *p_ib_qp;
> -
> -	// prepare parameters
> -	event_rec.type = ev->event;
> -	event_rec.vendor_specific = ev->x.vendor_specific;
> -	p_ib_qp = (struct ib_qp *)ev->element.qp;
> -	event_rec.context = p_ib_qp->x.ctx;
> -
> -	// call the user callback
> -	if (p_hca)
> -		(p_hca->async_cb_p)(&event_rec);
> -	else {
> -		HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM 
> ,("Incorrect context. Async callback was not invoked\n"));
> -	}
> -}
> -
> -void cq_event_handler(struct ib_event *ev, void *context) -{
> -	mlnx_hca_t *p_hca = (mlnx_hca_t *)context;
> -	ib_event_rec_t event_rec;
> -	struct ib_cq *p_ib_cq;
> -
> -	// prepare parameters
> -	event_rec.type = ev->event;
> -	p_ib_cq = (struct ib_cq *)ev->element.cq;
> -	event_rec.context = p_ib_cq->x.ctx;
> -
> -	// call the user callback
> -	if (p_hca)
> -		(p_hca->async_cb_p)(&event_rec);
> -	else {
> -		HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM 
> ,("Incorrect context. Async callback was not invoked\n"));
> -	}
> -}
> -
>  enum ib_rate to_rate(uint8_t rate)
>  {
>  	if (rate == IB_PATH_RECORD_RATE_2_5_GBS) return 
> IB_RATE_2_5_GBPS; diff -up -r -X trunk\docs\dontdiff.txt -I 
> '\$Id:' trunk/hw/mlx4/kernel/hca/data.h 
> branches\winverbs/hw/mlx4/kernel/hca/data.h
> --- trunk/hw/mlx4/kernel/hca/data.h	2008-06-03 
> 20:28:24.526000000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/hca/data.h	
> 2008-06-03 20:31:24.604125000 -0700
> @@ -155,7 +155,6 @@ typedef struct _mlnx_hca_t {
>  	net64_t			guid;				
> 	// HCA node Guid
>  	uint32_t			hw_ver;			
> 	// HCA HW version
>  	// HOB
> -	ci_completion_cb_t  comp_cb_p;
>  	ci_async_event_cb_t async_cb_p;
>  	const void          *ca_context;
>  	void                *cl_device_h;
> @@ -196,7 +195,6 @@ mlnx_hcas_init( void );  ib_api_status_t  
> mlnx_set_cb(
>  	IN				mlnx_hca_t		
> 		*	p_hca, 
> -	IN				ci_completion_cb_t	
> 		comp_cb_p,
>  	IN				ci_async_event_cb_t	
> 		async_cb_p,
>  	IN		const	void* const			
> 		ib_context);
>  
> @@ -229,16 +227,8 @@ fw_access_ctrl(
>  
>  void unmap_crspace_for_all( struct ib_ucontext *p_context );
>  
> -void cq_comp_handler(struct ib_cq *cq, void *context);
> -
>  void ca_event_handler(struct ib_event *ev, void *context);
>  
> -void srq_event_handler(struct ib_event *ev, void *context);
> -
> -void qp_event_handler(struct ib_event *ev, void *context);
> -
> -void cq_event_handler(struct ib_event *ev, void *context);
> -
>  ib_api_status_t
>  to_qp_attr(
>  	IN	 const	struct ib_qp *ib_qp_p,
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/hca/qp.c 
> branches\winverbs/hw/mlx4/kernel/hca/qp.c
> --- trunk/hw/mlx4/kernel/hca/qp.c	2008-06-03 
> 20:28:24.541625000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/hca/qp.c	2008-06-03 
> 20:31:24.619750000 -0700
> @@ -87,6 +87,7 @@ __create_qp (
>  	IN		const	ib_pd_handle_t			
> 	h_pd,
>  	IN		const	uint8_t				
> 		port_num,
>  	IN		const	void				
> 		*qp_uctx,
> +	IN				ci_async_event_cb_t	
> 		event_handler,
>  	IN		const	ib_qp_create_t			
> 	*p_create_attr,
>  		OUT			ib_qp_attr_t		
> 		*p_qp_attr,
>  		OUT			ib_qp_handle_t		
> 		*ph_qp,
> @@ -118,7 +119,7 @@ __create_qp (
>  
>  	// prepare the parameters
>  	RtlZeroMemory(&qp_init_attr, sizeof(qp_init_attr));
> -	qp_init_attr.event_handler = qp_event_handler;
> +	qp_init_attr.event_handler = event_handler;
>  	qp_init_attr.qp_context = p_hca;
>  	qp_init_attr.send_cq = (struct ib_cq *)p_create_attr->h_sq_cq;
>  	qp_init_attr.recv_cq = (struct ib_cq 
> *)p_create_attr->h_rq_cq; @@ -186,6 +187,7 @@ mlnx_create_spl_qp (
>  	IN		const	ib_pd_handle_t			
> 	h_pd,
>  	IN		const	uint8_t				
> 		port_num,
>  	IN		const	void				
> 		*qp_uctx,
> +	IN				ci_async_event_cb_t	
> 		event_handler,
>  	IN		const	ib_qp_create_t			
> 	*p_create_attr,
>  		OUT			ib_qp_attr_t		
> 		*p_qp_attr,
>  		OUT			ib_qp_handle_t		
> 		*ph_qp )
> @@ -195,7 +197,7 @@ mlnx_create_spl_qp (
>  	HCA_ENTER(HCA_DBG_SHIM);
>  
>  	status = __create_qp( h_pd, port_num,
> -		qp_uctx, p_create_attr, p_qp_attr, ph_qp, NULL );
> +		qp_uctx, event_handler, p_create_attr, 
> p_qp_attr, ph_qp, NULL );
>  		
>  	if (status != IB_SUCCESS)
>  		HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_QP,
> @@ -208,6 +210,7 @@ ib_api_status_t
>  mlnx_create_qp (
>  	IN		const	ib_pd_handle_t			
> 	h_pd,
>  	IN		const	void				
> 		*qp_uctx,
> +	IN				ci_async_event_cb_t	
> 		event_handler,
>  	IN		const	ib_qp_create_t			
> 	*p_create_attr,
>  		OUT			ib_qp_attr_t		
> 		*p_qp_attr,
>  		OUT			ib_qp_handle_t		
> 		*ph_qp,
> @@ -223,7 +226,7 @@ mlnx_create_qp (
>  	HCA_ENTER(HCA_DBG_QP);
>  
>  	status = __create_qp( h_pd, port_num,
> -		qp_uctx, p_create_attr, p_qp_attr, ph_qp, p_umv_buf );
> +		qp_uctx, event_handler, p_create_attr, 
> p_qp_attr, ph_qp, p_umv_buf );
>  		
>  	if (status != IB_SUCCESS)
>  		HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_QP,
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/hca/srq.c 
> branches\winverbs/hw/mlx4/kernel/hca/srq.c
> --- trunk/hw/mlx4/kernel/hca/srq.c	2008-06-03 
> 20:28:24.541625000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/hca/srq.c	
> 2008-06-03 20:31:24.635375000 -0700
> @@ -44,6 +44,7 @@ ib_api_status_t
>  mlnx_create_srq (
>  	IN		const	ib_pd_handle_t			h_pd,
>  	IN		const	void				
> 		*srq_context,
> +	IN				ci_async_event_cb_t	
> 		event_handler,
>  	IN		const	ib_srq_attr_t * const		
> p_srq_attr,
>  		OUT			ib_srq_handle_t		
> 	*ph_srq,
>  	IN	OUT			ci_umv_buf_t		
> 		*p_umv_buf )
> @@ -73,7 +74,7 @@ mlnx_create_srq (
>  
>  	// prepare the parameters
>  	RtlZeroMemory(&srq_init_attr, sizeof(srq_init_attr));
> -	srq_init_attr.event_handler = srq_event_handler;
> +	srq_init_attr.event_handler = event_handler;
>  	srq_init_attr.srq_context = p_hca;
>  	srq_init_attr.attr.max_wr = p_srq_attr->max_wr;
>  	srq_init_attr.attr.max_sge = p_srq_attr->max_sge; diff 
> -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/hca/verbs.c 
> branches\winverbs/hw/mlx4/kernel/hca/verbs.c
> --- trunk/hw/mlx4/kernel/hca/verbs.c	2008-06-03 
> 20:28:24.557250000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/hca/verbs.c	
> 2008-06-03 20:31:24.651000000 -0700
> @@ -166,7 +166,7 @@ static void release_user_cq_qp_resources
>  
>  struct ib_cq *ibv_create_cq(struct ib_device *p_ibdev,
>  			   ib_comp_handler comp_handler,
> -			   void (*event_handler)(struct 
> ib_event *, void *),
> +			   void (*event_handler)(ib_event_rec_t *),
>  			   void *cq_context, int cqe, 
>  			   struct ib_ucontext *p_uctx, 
> ci_umv_buf_t* const p_umv_buf)  { diff -up -r -X 
> trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mlx4/kernel/hca/verbs.h 
> branches\winverbs/hw/mlx4/kernel/hca/verbs.h
> --- trunk/hw/mlx4/kernel/hca/verbs.h	2008-06-03 
> 20:28:24.572875000 -0700
> +++ branches\winverbs/hw/mlx4/kernel/hca/verbs.h	
> 2008-06-03 20:31:24.651000000 -0700
> @@ -50,7 +50,7 @@ struct ib_mr *ibv_reg_mr(struct ib_pd *p
>  
>  struct ib_cq *ibv_create_cq(struct ib_device *p_ibdev,
>  			   ib_comp_handler comp_handler,
> -			   void (*event_handler)(struct 
> ib_event *, void *),
> +			   void (*event_handler)(ib_event_rec_t *),
>  			   void *cq_context, int cqe, 
>  			   struct ib_ucontext *p_uctx, 
> ci_umv_buf_t* const p_umv_buf);
>  
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mthca/kernel/hca_data.c 
> branches\winverbs/hw/mthca/kernel/hca_data.c
> --- trunk/hw/mthca/kernel/hca_data.c	2008-06-03 
> 20:31:11.119750000 -0700
> +++ branches\winverbs/hw/mthca/kernel/hca_data.c	
> 2008-06-03 20:31:24.651000000 -0700
> @@ -137,7 +137,6 @@ mlnx_hcas_init( void )  ib_api_status_t  
> mlnx_hobs_set_cb(
>  	IN				mlnx_hob_t		
> 			*hob_p, 
> -	IN				ci_completion_cb_t	
> 		comp_cb_p,
>  	IN				ci_async_event_cb_t	
> 		async_cb_p,
>  	IN		const	void* const			
> 		ib_context)
>  {
> @@ -162,7 +161,6 @@ mlnx_hobs_set_cb(
>  		}
>  	}
>  
> -	hob_p->comp_cb_p	= comp_cb_p;
>  	hob_p->async_cb_p = async_cb_p;
>  	hob_p->ca_context = ib_context; // This is the context 
> our CB forwards to IBAL
>  	HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,("CL: 
> hca_idx %d context 0x%p\n", (int)(hob_p - mlnx_hob_array), 
> ib_context)); @@ -185,7 +183,6 @@ mlnx_hobs_remove(
>  	p_async_proc = hob_p->async_proc_mgr_p;
>  	hob_p->async_proc_mgr_p = NULL;
>  
> -	hob_p->comp_cb_p = NULL;
>  	hob_p->async_cb_p = NULL;
>  	hob_p->ca_context = NULL;
>  	hob_p->cl_device_h = NULL;
> @@ -332,21 +329,6 @@ mlnx_conv_hca_cap(
>  	}
>  }
>  
> -void cq_comp_handler(struct ib_cq *cq, void *context) -{
> -	mlnx_hob_t *hob_p = (mlnx_hob_t *)context;
> -	struct mthca_cq *mcq =(struct mthca_cq *)cq; 
> -	HCA_ENTER(HCA_DBG_CQ);
> -	if (hob_p && hob_p->comp_cb_p) {
> -		HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_CQ 
> ,("Invoking completion callback\n"));
> -		(hob_p->comp_cb_p)(mcq->cq_context);
> -	}
> -	else {
> -		HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_CQ 
> ,("Incorrect context. Completion callback was not invoked\n"));
> -	}
> -	HCA_EXIT(HCA_DBG_CQ);
> -}
> -
>  void ca_event_handler(struct ib_event *ev, void *context)  {
>  	mlnx_hob_t *hob_p = (mlnx_hob_t *)context; @@ -370,66 
> +352,6 @@ void ca_event_handler(struct ib_event *e
>  	}
>  }
>  
> -void srq_event_handler(struct ib_event *ev, void *context) -{
> -	mlnx_hob_t *hob_p = (mlnx_hob_t *)context;
> -	ib_event_rec_t event_rec;
> -	struct mthca_srq *srq_p;
> -
> -	// prepare parameters
> -	event_rec.type = ev->event;
> -	event_rec.vendor_specific = ev->vendor_specific;
> -	srq_p = (struct mthca_srq *)ev->element.srq;
> -	event_rec.context = srq_p->srq_context;
> -
> -	// call the user callback
> -	if (hob_p)
> -		(hob_p->async_cb_p)(&event_rec);
> -	else {
> -		HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM 
> ,("Incorrect context. Async callback was not invoked\n"));
> -	}
> -}
> -
> -
> -void qp_event_handler(struct ib_event *ev, void *context) -{
> -	mlnx_hob_t *hob_p = (mlnx_hob_t *)context;
> -	ib_event_rec_t event_rec;
> -	struct mthca_qp *qp_p;
> -
> -	// prepare parameters
> -	event_rec.type = ev->event;
> -	event_rec.vendor_specific = ev->vendor_specific;
> -	qp_p = (struct mthca_qp *)ev->element.qp;
> -	event_rec.context = qp_p->qp_context;
> -
> -	// call the user callback
> -	if (hob_p)
> -		(hob_p->async_cb_p)(&event_rec);
> -	else {
> -		HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM 
> ,("Incorrect context. Async callback was not invoked\n"));
> -	}
> -}
> -
> -void cq_event_handler(struct ib_event *ev, void *context) -{
> -	mlnx_hob_t *hob_p = (mlnx_hob_t *)context;
> -	ib_event_rec_t event_rec;
> -	struct mthca_cq *cq_p;
> -
> -	// prepare parameters
> -	event_rec.type = ev->event;
> -	cq_p = (struct mthca_cq *)ev->element.cq;
> -	event_rec.context = cq_p->cq_context;
> -
> -	// call the user callback
> -	if (hob_p)
> -		(hob_p->async_cb_p)(&event_rec);
> -	else {
> -		HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM 
> ,("Incorrect context. Async callback was not invoked\n"));
> -	}
> -}
> -
>  ib_qp_state_t mlnx_qps_to_ibal(enum ib_qp_state qps)  {  
> #define MAP_QPS(val1,val2) case val1: ib_qps = val2; break 
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mthca/kernel/hca_data.h 
> branches\winverbs/hw/mthca/kernel/hca_data.h
> --- trunk/hw/mthca/kernel/hca_data.h	2008-06-03 
> 20:28:24.588500000 -0700
> +++ branches\winverbs/hw/mthca/kernel/hca_data.h	
> 2008-06-03 20:31:24.666625000 -0700
> @@ -171,7 +171,6 @@ typedef struct _attr_cache
>  
>  typedef struct _ib_ca {
>  	ENUM_MARK           mark;
> -	ci_completion_cb_t  comp_cb_p;
>  	ci_async_event_cb_t async_cb_p;
>  	const void          *ca_context;
>  	void                *cl_device_h;
> @@ -275,7 +274,6 @@ mlnx_hobs_insert(
>  ib_api_status_t
>  mlnx_hobs_set_cb(
>  	IN				mlnx_hob_t		
> 			*hob_p, 
> -	IN				ci_completion_cb_t	
> 		comp_cb_p,
>  	IN				ci_async_event_cb_t	
> 		async_cb_p,
>  	IN		const	void* const			
> 		ib_context);
>  
> @@ -351,16 +349,8 @@ fw_access_ctrl(
>  
>  void unmap_crspace_for_all( struct ib_ucontext *p_context );
>  
> -void cq_comp_handler(struct ib_cq *cq, void *context);
> -
>  void ca_event_handler(struct ib_event *ev, void *context);
>  
> -void srq_event_handler(struct ib_event *ev, void *context);
> -
> -void qp_event_handler(struct ib_event *ev, void *context);
> -
> -void cq_event_handler(struct ib_event *ev, void *context);
> -
>  ib_qp_state_t mlnx_qps_to_ibal(enum ib_qp_state qps);
>  
>  enum ib_qp_state mlnx_qps_from_ibal(ib_qp_state_t ib_qps); 
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mthca/kernel/hca_verbs.c 
> branches\winverbs/hw/mthca/kernel/hca_verbs.c
> --- trunk/hw/mthca/kernel/hca_verbs.c	2008-06-03 
> 20:28:24.604125000 -0700
> +++ branches\winverbs/hw/mthca/kernel/hca_verbs.c	
> 2008-06-03 20:31:24.666625000 -0700
> @@ -58,7 +58,6 @@ mlnx_query_qp (
>  ib_api_status_t
>  mlnx_open_ca (
>  	IN		const	ib_net64_t			
> 		ca_guid, // IN  const char *
> ca_name,
> -	IN		const	ci_completion_cb_t		
> 	pfn_completion_cb,
>  	IN		const	ci_async_event_cb_t		
> 	pfn_async_event_cb,
>  	IN		const	void*const			
> 		ca_context,
>  		OUT			ib_ca_handle_t 
> FUNC_PTR64				*ph_ca)
> @@ -91,7 +90,6 @@ mlnx_open_ca (
>  	HCA_PRINT(TRACE_LEVEL_INFORMATION  ,HCA_DBG_SHIM,
>  		("context 0x%p\n", ca_context));
>  	status = mlnx_hobs_set_cb(&p_hca->hob,
> -		pfn_completion_cb,
>  		pfn_async_event_cb,
>  		ca_context);
>  	if (IB_SUCCESS != status) {
> @@ -836,6 +834,7 @@ ib_api_status_t
>  mlnx_create_srq (
>  	IN		const	ib_pd_handle_t FUNC_PTR64	
> 		h_pd,
>  	IN		const	void				
> 		*srq_context,
> +	IN				ci_async_event_cb_t	
> 	event_handler,
>  	IN		const	ib_srq_attr_t * const		
> p_srq_attr,
>  		OUT			ib_srq_handle_t 
> FUNC_PTR64			*ph_srq,
>  	IN	OUT			ci_umv_buf_t		
> 		*p_umv_buf )
> @@ -866,7 +865,7 @@ mlnx_create_srq (
>  
>  	// prepare the parameters
>  	RtlZeroMemory(&srq_init_attr, sizeof(srq_init_attr));
> -	srq_init_attr.event_handler = srq_event_handler;
> +	srq_init_attr.event_handler = event_handler;
>  	srq_init_attr.srq_context = hob_p;
>  	srq_init_attr.attr = *p_srq_attr;
>  
> @@ -1003,6 +1002,7 @@ _create_qp (
>  	IN		const	ib_pd_handle_t FUNC_PTR64	
> 			h_pd,
>  	IN		const	uint8_t				
> 		port_num,
>  	IN		const	void				
> 		*qp_context,
> +	IN				ci_async_event_cb_t	
> 		event_handler,
>  	IN		const	ib_qp_create_t			
> 	*p_create_attr,
>  		OUT			ib_qp_attr_t		
> 		*p_qp_attr,
>  		OUT			ib_qp_handle_t 
> FUNC_PTR64				*ph_qp,
> @@ -1034,7 +1034,7 @@ _create_qp (
>  	// prepare the parameters
>  	RtlZeroMemory(&qp_init_attr, sizeof(qp_init_attr));
>  	qp_init_attr.qp_type = p_create_attr->qp_type;
> -	qp_init_attr.event_handler = qp_event_handler;
> +	qp_init_attr.event_handler = event_handler;
>  	qp_init_attr.qp_context = hob_p;
>  	qp_init_attr.recv_cq = (struct ib_cq *)p_create_attr->h_rq_cq;
>  	qp_init_attr.send_cq = (struct ib_cq 
> *)p_create_attr->h_sq_cq; @@ -1096,6 +1096,7 @@ mlnx_create_spl_qp (
>  	IN		const	ib_pd_handle_t FUNC_PTR64	
> 			h_pd,
>  	IN		const	uint8_t				
> 		port_num,
>  	IN		const	void				
> 		*qp_context,
> +	IN				ci_async_event_cb_t	
> 		event_handler,
>  	IN		const	ib_qp_create_t			
> 	*p_create_attr,
>  		OUT			ib_qp_attr_t		
> 		*p_qp_attr,
>  		OUT			ib_qp_handle_t 
> FUNC_PTR64				*ph_qp )
> @@ -1106,7 +1107,7 @@ mlnx_create_spl_qp (
>  	HCA_ENTER(HCA_DBG_SHIM);
>  
>  	status =	_create_qp( h_pd, port_num,
> -		qp_context, p_create_attr, p_qp_attr, ph_qp, NULL );
> +		qp_context, event_handler, p_create_attr, 
> p_qp_attr, ph_qp, NULL );
>  		
>  	if (status != IB_SUCCESS)
>  	{
> @@ -1121,6 +1122,7 @@ ib_api_status_t
>  mlnx_create_qp (
>  	IN		const	ib_pd_handle_t FUNC_PTR64	
> 			h_pd,
>  	IN		const	void				
> 		*qp_context,
> +	IN				ci_async_event_cb_t	
> 		event_handler,
>  	IN		const	ib_qp_create_t			
> 	*p_create_attr,
>  		OUT			ib_qp_attr_t		
> 		*p_qp_attr,
>  		OUT			ib_qp_handle_t 
> FUNC_PTR64				*ph_qp,
> @@ -1137,7 +1139,7 @@ mlnx_create_qp (
>  	HCA_ENTER(HCA_DBG_QP);
>  
>  	status = _create_qp( h_pd, port_num,
> -		qp_context, p_create_attr, p_qp_attr, ph_qp, 
> p_umv_buf );
> +		qp_context, event_handler, p_create_attr, 
> p_qp_attr, ph_qp, p_umv_buf 
> +);
>  		
>  	if (status != IB_SUCCESS)
>  	{
> @@ -1362,6 +1364,8 @@ ib_api_status_t
>  mlnx_create_cq (
>  	IN		const	ib_ca_handle_t FUNC_PTR64	
> 			h_ca,
>  	IN		const	void				
> 		*cq_context,
> +	IN				ci_async_event_cb_t	
> 		event_handler,
> +	IN				ci_completion_cb_t	
> 		cq_comp_handler,
>  	IN	OUT			uint32_t		
> 			*p_size,
>  		OUT			ib_cq_handle_t 
> FUNC_PTR64				*ph_cq,
>  	IN	OUT			ci_umv_buf_t		
> 		*p_umv_buf )
> @@ -1404,7 +1408,7 @@ mlnx_create_cq (
>  
>  	// allocate cq	
>  	ib_cq_p = ibv_create_cq(ib_dev, 
> -		cq_comp_handler, cq_event_handler,
> +		cq_comp_handler, event_handler,
>  		hob_p, *p_size, p_context, p_umv_buf );
>  	if (IS_ERR(ib_cq_p)) {
>  		err = PTR_ERR(ib_cq_p);
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mthca/kernel/ib_verbs.h 
> branches\winverbs/hw/mthca/kernel/ib_verbs.h
> --- trunk/hw/mthca/kernel/ib_verbs.h	2008-06-03 
> 20:28:24.619750000 -0700
> +++ branches\winverbs/hw/mthca/kernel/ib_verbs.h	
> 2008-06-03 20:31:24.682250000 -0700
> @@ -308,7 +308,7 @@ enum ib_cq_notify {
>  };
>  
>  struct ib_srq_init_attr {
> -	void					
> (*event_handler)(struct ib_event *, void *);
> +	void					
> (*event_handler)(ib_event_rec_t *);
>  	void					*srq_context;
>  	ib_srq_attr_t			attr;
>  };
> @@ -327,7 +327,7 @@ enum ib_sig_type {
>  };
>  
>  struct ib_qp_init_attr {
> -	void                  (*event_handler)(struct ib_event 
> *, void *);
> +	void                  (*event_handler)(ib_event_rec_t *);
>  	void		       *qp_context;
>  	struct ib_cq	       *send_cq;
>  	struct ib_cq	       *recv_cq;
> @@ -546,14 +546,14 @@ struct ib_ah {
>  	struct ib_ucontext      *ucontext;
>  };
>  
> -typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
> +typedef void (*ib_comp_handler)(void *cq_context);
>  
>  struct ib_cq {
>  	struct ib_device       *device;
>  	struct ib_ucontext	*ucontext;
>  	struct ib_mr *ib_mr;
>  	ib_comp_handler   	comp_handler;
> -	void                  (*event_handler)(struct ib_event 
> *, void *);
> +	void					
> (*event_handler)(ib_event_rec_t *);
>  	void *            	cq_context;
>  	int               	cqe;
>  	atomic_t          	usecnt; /* count number of work 
> queues */
> @@ -564,7 +564,7 @@ struct ib_srq {
>  	struct ib_pd	       *pd;
>  	struct ib_ucontext	*ucontext;
>  	struct ib_mr *ib_mr;
> -	void		      (*event_handler)(struct ib_event 
> *, void *);
> +	void					
> (*event_handler)(ib_event_rec_t *);
>  	void		       *srq_context;
>  	atomic_t          	usecnt; /* count number of work 
> queues */
>  };
> @@ -577,7 +577,7 @@ struct ib_qp {
>  	struct ib_srq	       *srq;
>  	struct ib_ucontext	*ucontext;
>  	struct ib_mr *ib_mr;
> -	void                  (*event_handler)(struct ib_event 
> *, void *);
> +	void					
> (*event_handler)(ib_event_rec_t *);
>  	void		       *qp_context;
>  	u32			qp_num;
>  	enum ib_qp_type_t		qp_type;
> @@ -1055,7 +1055,7 @@ static inline int ib_post_recv(struct ib
>   */
>  struct ib_cq *ibv_create_cq(struct ib_device *device,
>  			   ib_comp_handler comp_handler,
> -			   void (*event_handler)(struct 
> ib_event *, void *),
> +			   void (*event_handler)(ib_event_rec_t *),
>  			   void *cq_context, int cqe, 
>  			   struct ib_ucontext *context, 
> ci_umv_buf_t* const p_umv_buf);
>  
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mthca/kernel/mt_verbs.c 
> branches\winverbs/hw/mthca/kernel/mt_verbs.c
> --- trunk/hw/mthca/kernel/mt_verbs.c	2008-06-03 
> 20:28:24.635375000 -0700
> +++ branches\winverbs/hw/mthca/kernel/mt_verbs.c	
> 2008-06-03 20:31:24.682250000 -0700
> @@ -580,7 +580,7 @@ int ibv_destroy_qp(struct ib_qp *qp)
>  
>  struct ib_cq *ibv_create_cq(struct ib_device *device,
>  			   ib_comp_handler comp_handler,
> -			   void (*event_handler)(struct 
> ib_event *, void *),
> +			   void (*event_handler)(ib_event_rec_t *),
>  			   void *cq_context, int cqe, 
>  			   struct ib_ucontext *context, 
> ci_umv_buf_t* const p_umv_buf)  { diff -up -r -X 
> trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mthca/kernel/mthca_cq.c 
> branches\winverbs/hw/mthca/kernel/mthca_cq.c
> --- trunk/hw/mthca/kernel/mthca_cq.c	2008-06-03 
> 20:28:24.651000000 -0700
> +++ branches\winverbs/hw/mthca/kernel/mthca_cq.c	
> 2008-06-03 20:31:24.682250000 -0700
> @@ -237,14 +237,14 @@ void mthca_cq_completion(struct mthca_de
>  			++cq->arm_sn;
>  	}
>  
> -	cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
> +	cq->ibcq.comp_handler(cq->cq_context);
>  }
>  
>  void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
>  		    enum ib_event_type event_type)
>  {
>  	struct mthca_cq *cq;
> -	struct ib_event event;
> +	ib_event_rec_t event;
>  	SPIN_LOCK_PREP(lh);
>  
>  	spin_lock(&dev->cq_table.lock, &lh);
> @@ -260,11 +260,10 @@ void mthca_cq_event(struct mthca_dev *de
>  		return;
>  	}
>  
> -	event.device      = &dev->ib_dev;
> -	event.event       = event_type;
> -	event.element.cq  = &cq->ibcq;
> -	if (cq->ibcq.event_handler)
> -		cq->ibcq.event_handler(&event, cq->ibcq.cq_context);
> +	event.type = event_type;
> +	event.context = cq->ibcq.cq_context;
> +	event.vendor_specific = 0;
> +	cq->ibcq.event_handler(&event);
>  
>  	if (atomic_dec_and_test(&cq->refcount))
>  		wake_up(&cq->wait);
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mthca/kernel/mthca_qp.c 
> branches\winverbs/hw/mthca/kernel/mthca_qp.c
> --- trunk/hw/mthca/kernel/mthca_qp.c	2008-06-03 
> 20:28:24.666625000 -0700
> +++ branches\winverbs/hw/mthca/kernel/mthca_qp.c	
> 2008-06-03 20:31:24.697875000 -0700
> @@ -391,7 +391,7 @@ void mthca_qp_event(struct mthca_dev *de
>  		    enum ib_event_type event_type, u8 vendor_code)  {
>  	struct mthca_qp *qp;
> -	struct ib_event event;
> +	ib_event_rec_t event;
>  	SPIN_LOCK_PREP(lh);
>  
>  	spin_lock(&dev->qp_table.lock, &lh);
> @@ -405,14 +405,12 @@ void mthca_qp_event(struct mthca_dev *de
>  		return;
>  	}
>  
> -	event.device      = &dev->ib_dev;
> -	event.event       = event_type;
> -	event.element.qp  = &qp->ibqp;
> +	event.type = event_type;
> +	event.context = qp->ibqp.qp_context;
>  	event.vendor_specific = vendor_code;
>  	HCA_PRINT(TRACE_LEVEL_WARNING,HCA_DBG_QP,("QP %06x 
> Async event  event_type 0x%x vendor_code 0x%x\n",
>  		qpn,event_type,vendor_code));
> -	if (qp->ibqp.event_handler)
> -		qp->ibqp.event_handler(&event, qp->ibqp.qp_context);
> +	qp->ibqp.event_handler(&event);
>  
>  	if (atomic_dec_and_test(&qp->refcount))
>  		wake_up(&qp->wait);
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/hw/mthca/kernel/mthca_srq.c 
> branches\winverbs/hw/mthca/kernel/mthca_srq.c
> --- trunk/hw/mthca/kernel/mthca_srq.c	2008-06-03 
> 20:28:24.666625000 -0700
> +++ branches\winverbs/hw/mthca/kernel/mthca_srq.c	
> 2008-06-03 20:31:24.697875000 -0700
> @@ -432,7 +432,7 @@ void mthca_srq_event(struct mthca_dev *d
>  		     enum ib_event_type event_type, u8 vendor_code)  {
>  	struct mthca_srq *srq;
> -	struct ib_event event;
> +	ib_event_rec_t event;
>  	SPIN_LOCK_PREP(lh);
>  
>  	spin_lock(&dev->srq_table.lock, &lh);
> @@ -449,15 +449,13 @@ void mthca_srq_event(struct mthca_dev *d
>  	if (!srq->ibsrq.event_handler)
>  		goto out;
>  
> -	event.device      = &dev->ib_dev;
> -	event.event       = event_type;
> -	event.element.srq = &srq->ibsrq;
> +	event.type = event_type;
> +	event.context = srq->ibsrq.srq_context;
>  	event.vendor_specific = vendor_code;
>  	HCA_PRINT(TRACE_LEVEL_WARNING,HCA_DBG_SRQ,
>  		("SRQ %06x Async event  event_type 0x%x 
> vendor_code 0x%x\n",
>  		srqn,event_type,vendor_code));
> -	if (srq->ibsrq.event_handler)
> -		srq->ibsrq.event_handler(&event, 
> srq->ibsrq.srq_context);
> +	srq->ibsrq.event_handler(&event);
>  
>  out:
>  	if (atomic_dec_and_test(&srq->refcount))
> diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' 
> trunk/inc/iba/ib_ci.h branches\winverbs/inc/iba/ib_ci.h
> --- trunk/inc/iba/ib_ci.h	2008-06-03 20:28:24.682250000 -0700
> +++ branches\winverbs/inc/iba/ib_ci.h	2008-06-03 
> 20:31:24.713500000 -0700
> @@ -161,11 +161,11 @@ typedef void
>  * RETURN VALUE
>  *	None
>  * NOTES
> -*	The consumer only gets the cq_context and ca_context. 
> It is the client
> +*	The consumer only gets the cq_context. It is the client
>  *	responsibility to store the cq_handle in the context 
> after the creation
>  *	time. So it can call ci_poll_cq() after the arrival of 
> the notification.
>  * SEE ALSO
> -*	ci_open_ca, ci_create_cq
> +*	ci_create_cq
>  ******
>  */
>  
> @@ -181,7 +181,7 @@ typedef void
>  */
>  typedef void
>  (*ci_async_event_cb_t)(
> -	IN	const	ib_event_rec_t* const			
> p_event_record );
> +	IN		ib_event_rec_t*		p_event_record );
>  /*
>  * PARAMETERS
>  *	p_event_record
> @@ -204,7 +204,6 @@ typedef void
>  typedef ib_api_status_t
>  (*ci_open_ca) (
>  	IN		const	ib_net64_t			
> 		ca_guid,
> -	IN		const	ci_completion_cb_t		
> 	pfn_completion_cb,
>  	IN		const	ci_async_event_cb_t		
> 	pfn_async_event_cb,
>  	IN		const	void* const			
> 		ca_context,
>  		OUT			ib_ca_handle_t 
> FUNC_PTR64				*ph_ca );
> @@ -222,8 +221,6 @@ typedef ib_api_status_t
>  *		guids in a system, e.g. GetCaGuids(), 
> maintained by the IB
>  *		Access Layer. User mode consumers also have the 
> same mechanism
>  *		to retrieve this information.
> -*	pfn_completion_cb
> -*		[in] Completion Handler, one per open instance.
>  *	pfn_async_event_cb
>  *		[in] Asynchronous event handler, one per open instance.
>  *	ca_context
> @@ -707,6 +704,7 @@ typedef ib_api_status_t
>  (*ci_create_srq) (
>  	IN		const	ib_pd_handle_t FUNC_PTR64	
> 		h_pd,
>  	IN		const	void				
> 		*srq_context,
> +	IN		const	ci_async_event_cb_t		
> 	pfn_async_event_cb,
>  	IN		const	ib_srq_attr_t * const		
> p_srq_attr,
>  		OUT			ib_srq_handle_t 
> FUNC_PTR64			*ph_srq,
>  	IN	OUT			ci_umv_buf_t		
> 		*p_umv_buf OPTIONAL );
> @@ -720,6 +718,8 @@ typedef ib_api_status_t
>  *		[in] Handle to Protection Domain
>  *	srq_context
>  *		[in] A user specified context passed in a 
> asynchronous error callback.
> +*	pfn_async_event_cb
> +*		[in] Asynchronous event handler.
>  *	p_srq_attr
>  *		[in out] Initial attributes with which the srq 
> must be created.
>  *	ph_srq
> @@ -890,6 +890,7 @@ typedef ib_api_status_t
>  (*ci_create_qp) (
>  	IN		const	ib_pd_handle_t FUNC_PTR64	
> 			h_pd,
>  	IN		const	void				
> 		*qp_context,
> +	IN		const	ci_async_event_cb_t		
> 	pfn_async_event_cb,
>  	IN		const	ib_qp_create_t			
> 	*p_create_attr,
>  		OUT			ib_qp_attr_t		
> 		*p_qp_attr,
>  		OUT			ib_qp_handle_t 
> FUNC_PTR64				*ph_qp,
> @@ -905,6 +906,8 @@ typedef ib_api_status_t
>  *		[in] Handle to Protection Domain
>  *	qp_context
>  *		[in] A user specified context passed in a 
> asynchronous error callback.
> +*	pfn_async_event_cb
> +*		[in] Asynchronous event handler.
>  *	p_create_attr
>  *		[in] Initial attributes with which the qp must 
> be created.
>  *	p_qp_attr
> @@ -953,6 +956,7 @@ typedef ib_api_status_t
>  	IN		const	ib_pd_handle_t FUNC_PTR64	
> 	h_pd,
>  	IN		const	uint8_t				
> port_num,
>  	IN		const	void				
> *qp_context,
> +	IN		const	ci_async_event_cb_t		
> 	pfn_async_event_cb,
>  	IN		const	ib_qp_create_t		*p_create_attr,
>  		OUT			ib_qp_attr_t		
> *p_qp_attr,
>  		OUT			ib_qp_handle_t 
> FUNC_PTR64		*ph_qp );
> @@ -969,6 +973,8 @@ typedef ib_api_status_t
>  *	qp_context
>  *		[in] User specified context passed during the 
> async error callback
>  *		routine.
> +*	pfn_async_event_cb
> +*		[in] Asynchronous event handler.
>  *	p_create_attr
>  *		[in] Initial set of attributes with which the 
> queue pair is to be
>  *		created.
> @@ -1217,6 +1223,8 @@ typedef ib_api_status_t
>  (*ci_create_cq) (
>  	IN		const	ib_ca_handle_t FUNC_PTR64	
> 			h_ca,
>  	IN		const	void				
> 		*cq_context,
> +	IN		const	ci_async_event_cb_t		
> 	pfn_async_event_cb,
> +	IN				ci_completion_cb_t	
> 		completion_cb,
>  	IN	OUT			uint32_t* const		
> 		p_size,
>  		OUT			ib_cq_handle_t 
> FUNC_PTR64				*ph_cq,
>  	IN	OUT			ci_umv_buf_t		
> 		*p_umv_buf OPTIONAL );
> @@ -1231,6 +1239,10 @@ typedef ib_api_status_t
>  *		[in] A handle to the open HCA
>  *	cq_context
>  *		[in] The context that is passed during the 
> completion callbacks.
> +*	pfn_async_event_cb
> +*		[in] Asynchronous event handler.
> +*	completion_cb
> +*		[in] Callback for completion events
>  *	p_size
>  *		[in out] Points to a variable containing the 
> number of CQ entries
>  *		requested by the consumer. On completion points 
> to the size of the
> 
> 
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
> 



More information about the ofw mailing list