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
commit 81c6e61594
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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;