call->tx_pending = NULL;
copied = 0;
- if (len > iov_iter_count(&msg->msg_iter))
- len = iov_iter_count(&msg->msg_iter);
do {
if (!skb) {
size_t size, chunk, max, space;
max &= ~(call->conn->size_align - 1UL);
chunk = max;
- if (chunk > len && !more)
- chunk = len;
+ if (chunk > iov_iter_count(&msg->msg_iter) && !more)
+ chunk = iov_iter_count(&msg->msg_iter);
space = chunk + call->conn->size_align;
space &= ~(call->conn->size_align - 1UL);
sp = rxrpc_skb(skb);
/* append next segment of data to the current buffer */
- if (len > 0) {
+ if (iov_iter_count(&msg->msg_iter) > 0) {
int copy = skb_tailroom(skb);
ASSERTCMP(copy, >, 0);
- if (copy > len)
- copy = len;
+ if (copy > iov_iter_count(&msg->msg_iter))
+ copy = iov_iter_count(&msg->msg_iter);
if (copy > sp->remain)
copy = sp->remain;
sp->remain -= copy;
skb->mark += copy;
copied += copy;
-
- len -= copy;
}
/* check for the far side aborting the call or a network error
goto call_aborted;
/* add the packet to the send queue if it's now full */
- if (sp->remain <= 0 || (!len && !more)) {
+ if (sp->remain <= 0 ||
+ (iov_iter_count(&msg->msg_iter) == 0 && !more)) {
struct rxrpc_connection *conn = call->conn;
uint32_t seq;
size_t pad;
sp->hdr.serviceId = conn->service_id;
sp->hdr.flags = conn->out_clientflag;
- if (len == 0 && !more)
+ if (iov_iter_count(&msg->msg_iter) == 0 && !more)
sp->hdr.flags |= RXRPC_LAST_PACKET;
else if (CIRC_SPACE(call->acks_head, call->acks_tail,
call->acks_winsz) > 1)
memcpy(skb->head, &sp->hdr,
sizeof(struct rxrpc_header));
- rxrpc_queue_packet(call, skb, !iov_iter_count(&msg->msg_iter) && !more);
+ rxrpc_queue_packet(call, skb,
+ iov_iter_count(&msg->msg_iter) == 0 && !more);
skb = NULL;
}
- } while (len > 0);
+ } while (iov_iter_count(&msg->msg_iter) > 0);
success:
ret = copied;