Merge branches 'acpi-cleanup', 'acpi-thermal', 'acpi-video' and 'acpi-dock'
[cascardo/linux.git] / net / rxrpc / ar-output.c
index d0e8f1c..0b4b9a7 100644 (file)
 #include <net/af_rxrpc.h>
 #include "ar-internal.h"
 
-int rxrpc_resend_timeout = 4;
+/*
+ * Time till packet resend (in jiffies).
+ */
+unsigned rxrpc_resend_timeout = 4 * HZ;
 
 static int rxrpc_send_data(struct kiocb *iocb,
                           struct rxrpc_sock *rx,
@@ -487,7 +490,7 @@ static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb,
               ntohl(sp->hdr.serial), ntohl(sp->hdr.seq));
 
        sp->need_resend = false;
-       sp->resend_at = jiffies + rxrpc_resend_timeout * HZ;
+       sp->resend_at = jiffies + rxrpc_resend_timeout;
        if (!test_and_set_bit(RXRPC_CALL_RUN_RTIMER, &call->flags)) {
                _debug("run timer");
                call->resend_timer.expires = sp->resend_at;
@@ -666,6 +669,7 @@ static int rxrpc_send_data(struct kiocb *iocb,
                /* add the packet to the send queue if it's now full */
                if (sp->remain <= 0 || (segment == 0 && !more)) {
                        struct rxrpc_connection *conn = call->conn;
+                       uint32_t seq;
                        size_t pad;
 
                        /* pad out if we're using security */
@@ -678,11 +682,12 @@ static int rxrpc_send_data(struct kiocb *iocb,
                                        memset(skb_put(skb, pad), 0, pad);
                        }
 
+                       seq = atomic_inc_return(&call->sequence);
+
                        sp->hdr.epoch = conn->epoch;
                        sp->hdr.cid = call->cid;
                        sp->hdr.callNumber = call->call_id;
-                       sp->hdr.seq =
-                               htonl(atomic_inc_return(&call->sequence));
+                       sp->hdr.seq = htonl(seq);
                        sp->hdr.serial =
                                htonl(atomic_inc_return(&conn->serial));
                        sp->hdr.type = RXRPC_PACKET_TYPE_DATA;
@@ -697,6 +702,8 @@ static int rxrpc_send_data(struct kiocb *iocb,
                        else if (CIRC_SPACE(call->acks_head, call->acks_tail,
                                            call->acks_winsz) > 1)
                                sp->hdr.flags |= RXRPC_MORE_PACKETS;
+                       if (more && seq & 1)
+                               sp->hdr.flags |= RXRPC_REQUEST_ACK;
 
                        ret = rxrpc_secure_packet(
                                call, skb, skb->mark,