[openib-general] ib_req_ncomp_notif in core_ layer
Hal Rosenstock
halr at voltaire.com
Wed Aug 4 04:13:17 PDT 2004
Michael S. Tsirkin wrote:
> Hello!
> I am looking at the ib core gen2 code now, and I am puzzled by
> the fact that some functions just seem to do a check and then copy
> another one. Taking the following example
>
> int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt)
> {
> return cq->device->req_ncomp_notif ?
> cq->device->req_ncomp_notif(cq, wc_cnt) :
> -ENOSYS;
> }
>
>
> Why cant all users just do device->req_ncomp_notif(cq, wc_cnt)
> directly?
They can (nothing stops them) but since these are currently optional
functions, consumers would need to check that the driver supplied that
function.
> Its true that req_ncomp_notif could be NULL, but this could
> be fixed, instead, by modifying it to a reasonable default when
> the device is initialised.
>
> Same goes for ib_resize_cq and some others.
Yes, they all could be done by the driver with error codes
always returned for optional routines whose features aren't implemented.
That is an alternative method of doing this.
-- Hal
More information about the general
mailing list