| 1 |
/* |
| 2 |
* Copyright (c) 2014, Cisco Systems, Inc. All rights reserved. |
| 3 |
* |
| 4 |
* LICENSE_BEGIN |
| 5 |
* |
| 6 |
* This software is available to you under a choice of one of two |
| 7 |
* licenses. You may choose to be licensed under the terms of the GNU |
| 8 |
* General Public License (GPL) Version 2, available from the file |
| 9 |
* COPYING in the main directory of this source tree, or the |
| 10 |
* BSD license below: |
| 11 |
* |
| 12 |
* Redistribution and use in source and binary forms, with or |
| 13 |
* without modification, are permitted provided that the following |
| 14 |
* conditions are met: |
| 15 |
* |
| 16 |
* - Redistributions of source code must retain the above |
| 17 |
* copyright notice, this list of conditions and the following |
| 18 |
* disclaimer. |
| 19 |
* |
| 20 |
* - Redistributions in binary form must reproduce the above |
| 21 |
* copyright notice, this list of conditions and the following |
| 22 |
* disclaimer in the documentation and/or other materials |
| 23 |
* provided with the distribution. |
| 24 |
* |
| 25 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 26 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 27 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 28 |
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 29 |
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 30 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 31 |
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 32 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 33 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 34 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 35 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 36 |
* POSSIBILITY OF SUCH DAMAGE. |
| 37 |
* |
| 38 |
* LICENSE_END |
| 39 |
* |
| 40 |
* |
| 41 |
*/ |
| 42 |
|
| 43 |
#include "usd.h"cxx . . $ `<file>/prov/usnic/src/usnic_direct/usd.h`/ |
| 44 |
#include "usd_post.h"cxx . . $ `<file>/prov/usnic/src/usnic_direct/usd_post.h`/ |
| 45 |
|
| 46 |
unsigned |
| 47 |
usd_get_send_creditscxx . . $ usd_get_send_credits(c4e32bfc0ff3ca8).( |
| 48 |
struct usd_qpcxx . . $ usd_qp# *uqp) |
| 49 |
{ |
| 50 |
struct usd_qp_implcxx . . $ usd_qp_impl# *qp; |
| 51 |
|
| 52 |
qp = to_qpicxx . . $ `prov/usnic/src/usnic_direct/usd.h:310:9`!(uqp); |
| 53 |
|
| 54 |
return qp->uq_wqcxx . . $ usd_qp_impl#uq_wq..uwq_send_creditscxx . . $ usd_wq#uwq_send_credits.; |
| 55 |
} |
| 56 |
|
| 57 |
unsigned |
| 58 |
usd_get_recv_creditscxx . . $ usd_get_recv_credits(c4e32bfc0ff3ca8).( |
| 59 |
struct usd_qpcxx . . $ usd_qp# *uqp) |
| 60 |
{ |
| 61 |
struct usd_qp_implcxx . . $ usd_qp_impl# *qp; |
| 62 |
|
| 63 |
qp = to_qpicxx . . $ `prov/usnic/src/usnic_direct/usd.h:310:9`!(uqp); |
| 64 |
|
| 65 |
return qp->uq_rqcxx . . $ usd_qp_impl#uq_rq..urq_recv_creditscxx . . $ usd_rq#urq_recv_credits.; |
| 66 |
} |
| 67 |
|
| 68 |
int |
| 69 |
usd_post_recvcxx . . $ usd_post_recv(dbe290298e716738).( |
| 70 |
struct usd_qpcxx . . $ usd_qp# *uqp, |
| 71 |
struct usd_recv_desccxx . . $ usd_recv_desc# *recv_list) |
| 72 |
{ |
| 73 |
struct usd_qp_implcxx . . $ usd_qp_impl# *qp; |
| 74 |
struct usd_rqcxx . . $ usd_rq# *rq; |
| 75 |
struct vnic_rqcxx . . $ vnic_rq# *vrq; |
| 76 |
struct rq_enet_desccxx . . $ rq_enet_desc# *desc; |
| 77 |
struct ioveccxx . . $ iovec# *iovp; |
| 78 |
uint32_tcxx . . $ uint32_t# index; |
| 79 |
uint32_tcxx . . $ uint32_t# count; |
| 80 |
unsigned i; |
| 81 |
|
| 82 |
qp = to_qpicxx . . $ `prov/usnic/src/usnic_direct/usd.h:310:9`!(uqp); |
| 83 |
rq = &qp->uq_rqcxx . . $ usd_qp_impl#uq_rq.; |
| 84 |
vrq = &rq->urq_vnic_rqcxx . . $ usd_rq#urq_vnic_rq.; |
| 85 |
desc = rq->urq_next_desccxx . . $ usd_rq#urq_next_desc.; |
| 86 |
index = rq->urq_post_indexcxx . . $ usd_rq#urq_post_index.; |
| 87 |
|
| 88 |
count = 0; |
| 89 |
|
| 90 |
while (recv_list != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 91 |
iovp = recv_list->urd_iovcxx . . $ usd_recv_desc#urd_iov.; |
| 92 |
rq->urq_contextcxx . . $ usd_rq#urq_context.[index] = recv_list->urd_contextcxx . . $ usd_recv_desc#urd_context.; |
| •93 |
rq_enet_desc_enccxx . . $ rq_enet_desc_enc(ff6fca8dd4313ec7).(desc, (dma_addr_tcxx . . $ dma_addr_t#)(uintptr_tcxx . . $ uintptr_t#) iovp[0].iov_basecxx . . $ iovec#iov_base., |
| 94 |
RQ_ENET_TYPE_ONLY_SOPcxx . . $ RQ_ENET_TYPE_ONLY_SOP., iovp[0].iov_lencxx . . $ iovec#iov_len.); |
| 95 |
count++; |
| 96 |
|
| 97 |
index = (index+1) & rq->urq_post_index_maskcxx . . $ usd_rq#urq_post_index_mask.; |
| 98 |
desc = (struct rq_enet_desccxx . . $ rq_enet_desc# *) ((uintptr_tcxx . . $ uintptr_t#)rq->urq_desc_ringcxx . . $ usd_rq#urq_desc_ring. |
| 99 |
+ (index<<4)); |
| 100 |
|
| 101 |
for (i = 1; i < recv_list->urd_iov_cntcxx . . $ usd_recv_desc#urd_iov_cnt.; ++i) { |
| 102 |
rq->urq_contextcxx . . $ usd_rq#urq_context.[index] = recv_list->urd_contextcxx . . $ usd_recv_desc#urd_context.; |
| •103 |
rq_enet_desc_enccxx . . $ rq_enet_desc_enc(ff6fca8dd4313ec7).(desc, (dma_addr_tcxx . . $ dma_addr_t#)(uintptr_tcxx . . $ uintptr_t#) iovp[i].iov_basecxx . . $ iovec#iov_base., |
| 104 |
RQ_ENET_TYPE_NOT_SOPcxx . . $ RQ_ENET_TYPE_NOT_SOP., iovp[i].iov_lencxx . . $ iovec#iov_len.); |
| 105 |
count++; |
| 106 |
|
| 107 |
index = (index+1) & rq->urq_post_index_maskcxx . . $ usd_rq#urq_post_index_mask.; |
| 108 |
desc = (struct rq_enet_desccxx . . $ rq_enet_desc# *) ((uintptr_tcxx . . $ uintptr_t#)rq->urq_desc_ringcxx . . $ usd_rq#urq_desc_ring. |
| 109 |
+ (index<<4)); |
| 110 |
} |
| 111 |
recv_list = recv_list->urd_nextcxx . . $ usd_recv_desc#urd_next.; |
| 112 |
} |
| 113 |
|
| 114 |
wmbcxx . . $ `prov/usnic/src/usnic_direct/kcompat_priv.h:88:9`!(); |
| 115 |
iowrite32cxx . . $ iowrite32(56cca040bbd65dce).(index, &vrq->ctrlcxx . . $ vnic_rq#ctrl.->posted_indexcxx . . $ vnic_rq_ctrl#posted_index.); |
| 116 |
|
| 117 |
rq->urq_next_desccxx . . $ usd_rq#urq_next_desc. = desc; |
| 118 |
rq->urq_post_indexcxx . . $ usd_rq#urq_post_index. = index; |
| 119 |
rq->urq_recv_creditscxx . . $ usd_rq#urq_recv_credits. -= count; |
| 120 |
|
| 121 |
return 0; |
| 122 |
} |