__be32 doorbell[2];  
int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr,			      struct ib_recv_wr **bad_wr){	struct mthca_dev *dev = to_mdev(ibsrq->device);	struct mthca_srq *srq = to_msrq(ibsrq);	unsigned long flags;	int err = 0;	int first_ind;	int ind;	int next_ind;	int nreq;	int i;	void *wqe;	void *prev_wqe;	spin_lock_irqsave(&srq->lock, flags);	first_ind = srq->first_free;	for (nreq = 0; wr; ++nreq, wr = wr->next) {		ind = srq->first_free;		if (ind < 0) {			mthca_err(dev, "SRQ %06x full\n", srq->srqn);			err = -ENOMEM;			*bad_wr = wr;			break;		}		wqe       = get_wqe(srq, ind);		next_ind  = *wqe_to_link(wqe);		if (next_ind < 0) {			mthca_err(dev, "SRQ %06x full\n", srq->srqn);			err = -ENOMEM;			*bad_wr = wr;			break;		}		prev_wqe  = srq->last;		srq->last = wqe;		((struct mthca_next_seg *) wqe)->nda_op = 0;		((struct mthca_next_seg *) wqe)->ee_nds = 0;		/* flags field will always remain 0 */		wqe += sizeof (struct mthca_next_seg);		if (unlikely(wr->num_sge > srq->max_gs)) {			err = -EINVAL;			*bad_wr = wr;			srq->last = prev_wqe;			break;		}		for (i = 0; i < wr->num_sge; ++i) {			((struct mthca_data_seg *) wqe)->byte_count =				cpu_to_be32(wr->sg_list[i].length);			((struct mthca_data_seg *) wqe)->lkey =				cpu_to_be32(wr->sg_list[i].lkey);			((struct mthca_data_seg *) wqe)->addr =				cpu_to_be64(wr->sg_list[i].addr);			wqe += sizeof (struct mthca_data_seg);		}		if (i < srq->max_gs) {			((struct mthca_data_seg *) wqe)->byte_count = 0;			((struct mthca_data_seg *) wqe)->lkey = cpu_to_be32(MTHCA_INVAL_LKEY);			((struct mthca_data_seg *) wqe)->addr = 0;		}		((struct mthca_next_seg *) prev_wqe)->nda_op =			cpu_to_be32((ind << srq->wqe_shift) | 1);		wmb();		((struct mthca_next_seg *) prev_wqe)->ee_nds =			cpu_to_be32(MTHCA_NEXT_DBD);		srq->wrid[ind]  = wr->wr_id;		srq->first_free = next_ind;	}	if (likely(nreq)) {		__be32 doorbell[2];		doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift);		doorbell[1] = cpu_to_be32((srq->srqn << 8) | nreq);		/*		 * Make sure that descriptors are written before		 * doorbell is rung.		 */		wmb();		mthca_write64(doorbell,			      dev->kar + MTHCA_RECEIVE_DOORBELL,			      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));	}	spin_unlock_irqrestore(&srq->lock, flags);	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/ae57e24a4006fd46b73d842ee99db9580ef74a02/mthca_srq.c/clean/drivers/infiniband/hw/mthca/mthca_srq.c