* process packets using sync crypto engine. * expects *num* to be greater than zero. */
| 110 | * expects *num* to be greater than zero. |
| 111 | */ |
| 112 | static inline void |
| 113 | cpu_crypto_bulk(const struct rte_ipsec_session *ss, |
| 114 | union rte_crypto_sym_ofs ofs, struct rte_mbuf *mb[], |
| 115 | struct rte_crypto_va_iova_ptr iv[], |
| 116 | struct rte_crypto_va_iova_ptr aad[], |
| 117 | struct rte_crypto_va_iova_ptr dgst[], uint32_t l4ofs[], |
| 118 | uint32_t clen[], uint32_t num) |
| 119 | { |
| 120 | uint32_t i, j, n; |
| 121 | int32_t vcnt, vofs; |
| 122 | int32_t st[num]; |
| 123 | struct rte_crypto_sgl vecpkt[num]; |
| 124 | struct rte_crypto_vec vec[UINT8_MAX]; |
| 125 | struct rte_crypto_sym_vec symvec; |
| 126 | |
| 127 | const uint32_t vnum = RTE_DIM(vec); |
| 128 | |
| 129 | j = 0, n = 0; |
| 130 | vofs = 0; |
| 131 | for (i = 0; i != num; i++) { |
| 132 | |
| 133 | vcnt = rte_crypto_mbuf_to_vec(mb[i], l4ofs[i], clen[i], |
| 134 | &vec[vofs], vnum - vofs); |
| 135 | |
| 136 | /* not enough space in vec[] to hold all segments */ |
| 137 | if (vcnt < 0) { |
| 138 | /* fill the request structure */ |
| 139 | symvec.src_sgl = &vecpkt[j]; |
| 140 | symvec.iv = &iv[j]; |
| 141 | symvec.digest = &dgst[j]; |
| 142 | symvec.aad = &aad[j]; |
| 143 | symvec.status = &st[j]; |
| 144 | symvec.num = i - j; |
| 145 | |
| 146 | /* flush vec array and try again */ |
| 147 | n += rte_cryptodev_sym_cpu_crypto_process( |
| 148 | ss->crypto.dev_id, ss->crypto.ses, ofs, |
| 149 | &symvec); |
| 150 | vofs = 0; |
| 151 | vcnt = rte_crypto_mbuf_to_vec(mb[i], l4ofs[i], clen[i], |
| 152 | vec, vnum); |
| 153 | RTE_ASSERT(vcnt > 0); |
| 154 | j = i; |
| 155 | } |
| 156 | |
| 157 | vecpkt[i].vec = &vec[vofs]; |
| 158 | vecpkt[i].num = vcnt; |
| 159 | vofs += vcnt; |
| 160 | } |
| 161 | |
| 162 | /* fill the request structure */ |
| 163 | symvec.src_sgl = &vecpkt[j]; |
| 164 | symvec.iv = &iv[j]; |
| 165 | symvec.aad = &aad[j]; |
| 166 | symvec.digest = &dgst[j]; |
| 167 | symvec.status = &st[j]; |
| 168 | symvec.num = i - j; |
| 169 |
no test coverage detected