Commit 6c9257a7 authored by David S. Miller's avatar David S. Miller

Merge tag 'rxrpc-fixes-20171129' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

David Howells says:

====================
rxrpc: Fixes

Here are three patches for AF_RXRPC.  One removes some whitespace, one
fixes terminal ACK generation and the third makes a couple of places
actually use the timeout value just determined rather than ignoring it.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1c08ac0c 282ef472
...@@ -123,7 +123,7 @@ static void __rxrpc_propose_ACK(struct rxrpc_call *call, u8 ack_reason, ...@@ -123,7 +123,7 @@ static void __rxrpc_propose_ACK(struct rxrpc_call *call, u8 ack_reason,
else else
ack_at = expiry; ack_at = expiry;
ack_at = jiffies + expiry; ack_at += now;
if (time_before(ack_at, call->ack_at)) { if (time_before(ack_at, call->ack_at)) {
WRITE_ONCE(call->ack_at, ack_at); WRITE_ONCE(call->ack_at, ack_at);
rxrpc_reduce_call_timer(call, ack_at, now, rxrpc_reduce_call_timer(call, ack_at, now,
...@@ -426,7 +426,7 @@ void rxrpc_process_call(struct work_struct *work) ...@@ -426,7 +426,7 @@ void rxrpc_process_call(struct work_struct *work)
next = call->expect_rx_by; next = call->expect_rx_by;
#define set(T) { t = READ_ONCE(T); if (time_before(t, next)) next = t; } #define set(T) { t = READ_ONCE(T); if (time_before(t, next)) next = t; }
set(call->expect_req_by); set(call->expect_req_by);
set(call->expect_term_by); set(call->expect_term_by);
set(call->ack_at); set(call->ack_at);
......
...@@ -30,22 +30,18 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, ...@@ -30,22 +30,18 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
struct rxrpc_skb_priv *sp = skb ? rxrpc_skb(skb) : NULL; struct rxrpc_skb_priv *sp = skb ? rxrpc_skb(skb) : NULL;
struct rxrpc_channel *chan; struct rxrpc_channel *chan;
struct msghdr msg; struct msghdr msg;
struct kvec iov; struct kvec iov[3];
struct { struct {
struct rxrpc_wire_header whdr; struct rxrpc_wire_header whdr;
union { union {
struct { __be32 abort_code;
__be32 code; struct rxrpc_ackpacket ack;
} abort;
struct {
struct rxrpc_ackpacket ack;
u8 padding[3];
struct rxrpc_ackinfo info;
};
}; };
} __attribute__((packed)) pkt; } __attribute__((packed)) pkt;
struct rxrpc_ackinfo ack_info;
size_t len; size_t len;
u32 serial, mtu, call_id; int ioc;
u32 serial, mtu, call_id, padding;
_enter("%d", conn->debug_id); _enter("%d", conn->debug_id);
...@@ -66,6 +62,13 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, ...@@ -66,6 +62,13 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
msg.msg_controllen = 0; msg.msg_controllen = 0;
msg.msg_flags = 0; msg.msg_flags = 0;
iov[0].iov_base = &pkt;
iov[0].iov_len = sizeof(pkt.whdr);
iov[1].iov_base = &padding;
iov[1].iov_len = 3;
iov[2].iov_base = &ack_info;
iov[2].iov_len = sizeof(ack_info);
pkt.whdr.epoch = htonl(conn->proto.epoch); pkt.whdr.epoch = htonl(conn->proto.epoch);
pkt.whdr.cid = htonl(conn->proto.cid); pkt.whdr.cid = htonl(conn->proto.cid);
pkt.whdr.callNumber = htonl(call_id); pkt.whdr.callNumber = htonl(call_id);
...@@ -80,8 +83,10 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, ...@@ -80,8 +83,10 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
len = sizeof(pkt.whdr); len = sizeof(pkt.whdr);
switch (chan->last_type) { switch (chan->last_type) {
case RXRPC_PACKET_TYPE_ABORT: case RXRPC_PACKET_TYPE_ABORT:
pkt.abort.code = htonl(chan->last_abort); pkt.abort_code = htonl(chan->last_abort);
len += sizeof(pkt.abort); iov[0].iov_len += sizeof(pkt.abort_code);
len += sizeof(pkt.abort_code);
ioc = 1;
break; break;
case RXRPC_PACKET_TYPE_ACK: case RXRPC_PACKET_TYPE_ACK:
...@@ -94,13 +99,19 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, ...@@ -94,13 +99,19 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
pkt.ack.serial = htonl(skb ? sp->hdr.serial : 0); pkt.ack.serial = htonl(skb ? sp->hdr.serial : 0);
pkt.ack.reason = skb ? RXRPC_ACK_DUPLICATE : RXRPC_ACK_IDLE; pkt.ack.reason = skb ? RXRPC_ACK_DUPLICATE : RXRPC_ACK_IDLE;
pkt.ack.nAcks = 0; pkt.ack.nAcks = 0;
pkt.info.rxMTU = htonl(rxrpc_rx_mtu); ack_info.rxMTU = htonl(rxrpc_rx_mtu);
pkt.info.maxMTU = htonl(mtu); ack_info.maxMTU = htonl(mtu);
pkt.info.rwind = htonl(rxrpc_rx_window_size); ack_info.rwind = htonl(rxrpc_rx_window_size);
pkt.info.jumbo_max = htonl(rxrpc_rx_jumbo_max); ack_info.jumbo_max = htonl(rxrpc_rx_jumbo_max);
pkt.whdr.flags |= RXRPC_SLOW_START_OK; pkt.whdr.flags |= RXRPC_SLOW_START_OK;
len += sizeof(pkt.ack) + sizeof(pkt.info); padding = 0;
iov[0].iov_len += sizeof(pkt.ack);
len += sizeof(pkt.ack) + 3 + sizeof(ack_info);
ioc = 3;
break; break;
default:
return;
} }
/* Resync with __rxrpc_disconnect_call() and check that the last call /* Resync with __rxrpc_disconnect_call() and check that the last call
...@@ -110,9 +121,6 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, ...@@ -110,9 +121,6 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
if (READ_ONCE(chan->last_call) != call_id) if (READ_ONCE(chan->last_call) != call_id)
return; return;
iov.iov_base = &pkt;
iov.iov_len = len;
serial = atomic_inc_return(&conn->serial); serial = atomic_inc_return(&conn->serial);
pkt.whdr.serial = htonl(serial); pkt.whdr.serial = htonl(serial);
...@@ -127,7 +135,7 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, ...@@ -127,7 +135,7 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
break; break;
} }
kernel_sendmsg(conn->params.local->socket, &msg, &iov, 1, len); kernel_sendmsg(conn->params.local->socket, &msg, iov, ioc, len);
_leave(""); _leave("");
return; return;
} }
......
...@@ -424,7 +424,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work) ...@@ -424,7 +424,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work)
if (earliest != now + MAX_JIFFY_OFFSET) { if (earliest != now + MAX_JIFFY_OFFSET) {
_debug("reschedule reaper %ld", (long)earliest - (long)now); _debug("reschedule reaper %ld", (long)earliest - (long)now);
ASSERT(time_after(earliest, now)); ASSERT(time_after(earliest, now));
rxrpc_set_service_reap_timer(rxnet, earliest); rxrpc_set_service_reap_timer(rxnet, earliest);
} }
while (!list_empty(&graveyard)) { while (!list_empty(&graveyard)) {
......
...@@ -976,7 +976,7 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call, ...@@ -976,7 +976,7 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
rxrpc_reduce_call_timer(call, expect_rx_by, now, rxrpc_reduce_call_timer(call, expect_rx_by, now,
rxrpc_timer_set_for_normal); rxrpc_timer_set_for_normal);
} }
switch (sp->hdr.type) { switch (sp->hdr.type) {
case RXRPC_PACKET_TYPE_DATA: case RXRPC_PACKET_TYPE_DATA:
rxrpc_input_data(call, skb, skew); rxrpc_input_data(call, skb, skew);
...@@ -1213,7 +1213,7 @@ void rxrpc_data_ready(struct sock *udp_sk) ...@@ -1213,7 +1213,7 @@ void rxrpc_data_ready(struct sock *udp_sk)
goto reupgrade; goto reupgrade;
conn->service_id = sp->hdr.serviceId; conn->service_id = sp->hdr.serviceId;
} }
if (sp->hdr.callNumber == 0) { if (sp->hdr.callNumber == 0) {
/* Connection-level packet */ /* Connection-level packet */
_debug("CONN %p {%d}", conn, conn->debug_id); _debug("CONN %p {%d}", conn, conn->debug_id);
......
...@@ -233,7 +233,7 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call, ...@@ -233,7 +233,7 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
if (resend_at < 1) if (resend_at < 1)
resend_at = 1; resend_at = 1;
resend_at = now + rxrpc_resend_timeout; resend_at += now;
WRITE_ONCE(call->resend_at, resend_at); WRITE_ONCE(call->resend_at, resend_at);
rxrpc_reduce_call_timer(call, resend_at, now, rxrpc_reduce_call_timer(call, resend_at, now,
rxrpc_timer_set_for_send); rxrpc_timer_set_for_send);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment