-static inline void *vnic_rq_next_desc(struct vnic_rq *rq)
-{
- return rq->to_use->desc;
-}
-
-static inline unsigned int vnic_rq_next_index(struct vnic_rq *rq)
-{
- return rq->to_use->index;
-}
-
-static inline void vnic_rq_post(struct vnic_rq *rq,
- void *os_buf, unsigned int os_buf_index,
- dma_addr_t dma_addr, unsigned int len,
- uint64_t wrid)
-{
- struct vnic_rq_buf *buf = rq->to_use;
-
- buf->os_buf = os_buf;
- buf->os_buf_index = os_buf_index;
- buf->dma_addr = dma_addr;
- buf->len = len;
- buf->wr_id = wrid;
-
- buf = buf->next;
- rq->to_use = buf;
- rq->ring.desc_avail--;
-
- /* Move the posted_index every nth descriptor
- */
-
-#ifndef VNIC_RQ_RETURN_RATE
-#define VNIC_RQ_RETURN_RATE 0xf /* keep 2^n - 1 */
-#endif
-
- if ((buf->index & VNIC_RQ_RETURN_RATE) == 0) {
- /* Adding write memory barrier prevents compiler and/or CPU
- * reordering, thus avoiding descriptor posting before
- * descriptor is initialized. Otherwise, hardware can read
- * stale descriptor fields.
- */
- wmb();
- iowrite32(buf->index, &rq->ctrl->posted_index);
- }
-}
-
-static inline void vnic_rq_post_commit(struct vnic_rq *rq,
- void *os_buf, unsigned int os_buf_index,
- dma_addr_t dma_addr, unsigned int len)
-{
- struct vnic_rq_buf *buf = rq->to_use;
-
- buf->os_buf = os_buf;
- buf->os_buf_index = os_buf_index;
- buf->dma_addr = dma_addr;
- buf->len = len;
-
- buf = buf->next;
- rq->to_use = buf;
- rq->ring.desc_avail--;
-
- /* Move the posted_index every descriptor
- */
-
- /* Adding write memory barrier prevents compiler and/or CPU
- * reordering, thus avoiding descriptor posting before
- * descriptor is initialized. Otherwise, hardware can read
- * stale descriptor fields.
- */
- wmb();
- iowrite32(buf->index, &rq->ctrl->posted_index);
-}