Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 382d7974 authored by David Howells's avatar David Howells
Browse files

RxRPC: Use iov_iter_count() in rxrpc_send_data() instead of the len argument



Use iov_iter_count() in rxrpc_send_data() to get the remaining data length
instead of using the len argument as the len argument is now redundant.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent aab94830
Loading
Loading
Loading
Loading
+11 −13
Original line number Original line Diff line number Diff line
@@ -546,8 +546,6 @@ static int rxrpc_send_data(struct kiocb *iocb,
	call->tx_pending = NULL;
	call->tx_pending = NULL;


	copied = 0;
	copied = 0;
	if (len > iov_iter_count(&msg->msg_iter))
		len = iov_iter_count(&msg->msg_iter);
	do {
	do {
		if (!skb) {
		if (!skb) {
			size_t size, chunk, max, space;
			size_t size, chunk, max, space;
@@ -570,8 +568,8 @@ static int rxrpc_send_data(struct kiocb *iocb,
			max &= ~(call->conn->size_align - 1UL);
			max &= ~(call->conn->size_align - 1UL);


			chunk = max;
			chunk = max;
			if (chunk > len && !more)
			if (chunk > iov_iter_count(&msg->msg_iter) && !more)
				chunk = len;
				chunk = iov_iter_count(&msg->msg_iter);


			space = chunk + call->conn->size_align;
			space = chunk + call->conn->size_align;
			space &= ~(call->conn->size_align - 1UL);
			space &= ~(call->conn->size_align - 1UL);
@@ -614,11 +612,11 @@ static int rxrpc_send_data(struct kiocb *iocb,
		sp = rxrpc_skb(skb);
		sp = rxrpc_skb(skb);


		/* append next segment of data to the current buffer */
		/* 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);
			int copy = skb_tailroom(skb);
			ASSERTCMP(copy, >, 0);
			ASSERTCMP(copy, >, 0);
			if (copy > len)
			if (copy > iov_iter_count(&msg->msg_iter))
				copy = len;
				copy = iov_iter_count(&msg->msg_iter);
			if (copy > sp->remain)
			if (copy > sp->remain)
				copy = sp->remain;
				copy = sp->remain;


@@ -630,8 +628,6 @@ static int rxrpc_send_data(struct kiocb *iocb,
			sp->remain -= copy;
			sp->remain -= copy;
			skb->mark += copy;
			skb->mark += copy;
			copied += copy;
			copied += copy;

			len -= copy;
		}
		}


		/* check for the far side aborting the call or a network error
		/* check for the far side aborting the call or a network error
@@ -640,7 +636,8 @@ static int rxrpc_send_data(struct kiocb *iocb,
			goto call_aborted;
			goto call_aborted;


		/* add the packet to the send queue if it's now full */
		/* 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;
			struct rxrpc_connection *conn = call->conn;
			uint32_t seq;
			uint32_t seq;
			size_t pad;
			size_t pad;
@@ -670,7 +667,7 @@ static int rxrpc_send_data(struct kiocb *iocb,
			sp->hdr.serviceId = conn->service_id;
			sp->hdr.serviceId = conn->service_id;


			sp->hdr.flags = conn->out_clientflag;
			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;
				sp->hdr.flags |= RXRPC_LAST_PACKET;
			else if (CIRC_SPACE(call->acks_head, call->acks_tail,
			else if (CIRC_SPACE(call->acks_head, call->acks_tail,
					    call->acks_winsz) > 1)
					    call->acks_winsz) > 1)
@@ -686,10 +683,11 @@ static int rxrpc_send_data(struct kiocb *iocb,


			memcpy(skb->head, &sp->hdr,
			memcpy(skb->head, &sp->hdr,
			       sizeof(struct rxrpc_header));
			       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;
			skb = NULL;
		}
		}
	} while (len > 0);
	} while (iov_iter_count(&msg->msg_iter) > 0);


success:
success:
	ret = copied;
	ret = copied;