[openib-general] Proposed device enumeration & async event APIs

Hal Rosenstock halr at voltaire.com
Mon Sep 13 17:51:32 PDT 2004


On Fri, 2004-09-10 at 16:35, Roland Dreier wrote:
> Finally, I added event_handler members to struct ib_cq and struct
> ib_qp and added support for setting them on creation:
> 
> 	struct ib_cq {
> 		struct ib_device *device;
> 		ib_comp_handler   comp_handler;
> 		void             (*event_handler)(struct ib_event *, void *);
> 		void *            context;
> 		int               cqe;
> 		atomic_t          usecnt; /* count number of work queues */
> 	};
> 
> 	struct ib_cq *ib_create_cq(struct ib_device *device,
> 				   ib_comp_handler comp_handler,
> 				   void (*event_handler)(struct ib_event *, void *),
> 				   void *cq_context, int cqe);
> 
> 	struct ib_qp {
> 		struct ib_device       *device;
> 		struct ib_pd	       *pd;
> 		struct ib_cq	       *send_cq;
> 		struct ib_cq	       *recv_cq;
> 		struct ib_srq	       *srq;
> 		void                  (*event_handler)(struct ib_event *, void *);
> 		void		       *qp_context;
> 		u32			qp_num;
> 	};
> 
> 	struct ib_qp_init_attr {
> 		void                  (*event_handler)(struct ib_event *, void *);
> 		void		       *qp_context;
> 		struct ib_cq	       *send_cq;
> 		struct ib_cq	       *recv_cq;
> 		struct ib_srq	       *srq;
> 		struct ib_qp_cap	cap;
> 		enum ib_sig_type	sq_sig_type;
> 		enum ib_sig_type	rq_sig_type;
> 		enum ib_qp_type		qp_type;
> 		u8			port_num; /* special QP types only */
> 	};
> 
> These do get passed the context to match what we did with the
> comp_handler member of struct ib_cq.
> 
> Comments?

Is there a way to do the following things:

1. Can other than the QP owner obtain any QP async events (or perhaps
only certain ones) ? Certain events might need to go to more than 1
place (I think that 2 is sufficient).
(perhaps this is a second event handler which could be at qp_create time
or qp modify time (with a new virtual QP attribute to add or remove
this).

2. An optimization would be to be able to obtain all QP async events
rather than needing to do this for all QPs as they come and go.
Perhaps something like ib_set/clear_global_qp_handler() would set/clear
the second event handler in all existing QPs and if a global handler is
set, this would be used at QP create time.

Sorry for the delay in responding to this.

-- Hal




More information about the general mailing list