Implement S/G IO for non-batched sends and eliminate more data copies (#2867)

This commit is contained in:
Cameron Gutman
2024-07-17 21:34:56 -05:00
committed by GitHub
parent b93756a804
commit 81c6e61594
5 changed files with 76 additions and 63 deletions

View File

@@ -606,12 +606,19 @@ namespace platf {
memcpy(CMSG_DATA(pktinfo_cm), &pktInfo, sizeof(pktInfo));
}
struct iovec iov = {};
iov.iov_base = (void *) send_info.buffer;
iov.iov_len = send_info.size;
struct iovec iovs[2] = {};
int iovlen = 0;
if (send_info.header) {
iovs[iovlen].iov_base = (void *) send_info.header;
iovs[iovlen].iov_len = send_info.header_size;
iovlen++;
}
iovs[iovlen].iov_base = (void *) send_info.payload;
iovs[iovlen].iov_len = send_info.payload_size;
iovlen++;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov = iovs;
msg.msg_iovlen = iovlen;
msg.msg_controllen = cmbuflen;