[openib-general] help with gen2 cq callback

Hal Rosenstock halr at voltaire.com
Fri Jul 22 13:09:05 PDT 2005


On Fri, 2005-07-22 at 13:30, PAulN wrote:
> Can someone tell me what replaces the "struct ib_cq_entry *" param
> of gen1's ib_cq_event_callback_func?  It's not obvious to me how to
> access the cq entry in the gen2 stack from the callback - gen1
> pushes it right up.  Is it necessary to poll the cq from the callback
> to determine which entries are done?
> Thanks,
> Paul
> 
> //GEN2
> typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
> 
> struct ib_cq {
>         struct ib_device       *device;
>         struct ib_uobject      *uobject;
>         ib_comp_handler         comp_handler;
>         void                  (*event_handler)(struct ib_event *, void *);
>         void *                  cq_context;
>         int                     cqe;
>         atomic_t                usecnt; /* count number of work queues */
> };
> 
> //GEN1
> typedef void (*ib_cq_entry_callback_func)(struct ib_cq       *cq,
>                                           struct ib_cq_entry *entry,
>                                           void               *arg);
> typedef void (*ib_cq_event_callback_func)(struct ib_cq *cq,
>                                           void         *arg);
> struct ib_cq_entry {
>         void                     *device_specific;
>         u64                       work_request_id;
>         u64                       bytes_transferred;
>         enum ib_completion_status status;
>         enum ib_completion_op     op;
>         int                       pkey_index;
>         u32                       immediate_data;
>         u32                       sqpn;
>         u32                       local_eecn;
>         u32                       freed_resource_count;
>         u16                       ethertype;
>         u16                       slid;
>         u8                        sl;
>         u8                        dlid_path_bits;
>         int                       grh_present:1;
>         int                       immediate_data_valid:1;
> };
> 
> struct ib_cq;

In gen2, after receiving the CQ callback, the CQ is then polled for WCs.

This is true in both kernel and user space. 

Some kernel examples:
linux-kernel/infiniband/core/mad.c
linux-kernel/infiniband/ulp/ipoib/ipoib_ib.c
(each ULP does this).

Userspace examples:
the pingpong programs in userspace/libibverbs/examples

-- Hal




More information about the general mailing list