* Any receive that isn't recvmsg with multishot can be handled the same way. * Iterate from '*bid' and 'in_bytes' in total, and append the data to the * outgoing queue. */
| 1187 | * outgoing queue. |
| 1188 | */ |
| 1189 | static int recv_bids(struct conn *c, struct conn_dir *cd, int *bid, int in_bytes) |
| 1190 | { |
| 1191 | struct conn_buf_ring *cbr = &c->out_br; |
| 1192 | struct conn_buf_ring *in_cbr = &c->in_br; |
| 1193 | struct io_uring_buf *buf; |
| 1194 | int nr_packets = 0; |
| 1195 | |
| 1196 | while (in_bytes) { |
| 1197 | int this_bytes; |
| 1198 | void *data; |
| 1199 | |
| 1200 | buf = &in_cbr->br->bufs[*bid]; |
| 1201 | data = (void *) (unsigned long) buf->addr; |
| 1202 | this_bytes = buf->len; |
| 1203 | if (this_bytes > in_bytes) |
| 1204 | this_bytes = in_bytes; |
| 1205 | |
| 1206 | in_bytes -= this_bytes; |
| 1207 | |
| 1208 | if (send_ring) |
| 1209 | io_uring_buf_ring_add(cbr->br, data, this_bytes, *bid, |
| 1210 | br_mask, nr_packets); |
| 1211 | else |
| 1212 | send_append(c, cd, data, *bid, this_bytes); |
| 1213 | |
| 1214 | *bid = (*bid + 1) & (nr_bufs - 1); |
| 1215 | nr_packets++; |
| 1216 | } |
| 1217 | |
| 1218 | if (send_ring) |
| 1219 | io_uring_buf_ring_advance(cbr->br, nr_packets); |
| 1220 | |
| 1221 | return nr_packets; |
| 1222 | } |
| 1223 | |
| 1224 | /* |
| 1225 | * Special handling of recvmsg with multishot |
no test coverage detected