]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - net/sctp/chunk.c
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
[mirror_ubuntu-zesty-kernel.git] / net / sctp / chunk.c
index 7a1cdf43e49d26b3b12ff35a903a4389753ee3fc..615f0ddd41dfb1ff46a9d4e564716de8e7b60ea6 100644 (file)
@@ -52,7 +52,6 @@ static void sctp_datamsg_init(struct sctp_datamsg *msg)
        atomic_set(&msg->refcnt, 1);
        msg->send_failed = 0;
        msg->send_error = 0;
-       msg->can_abandon = 0;
        msg->can_delay = 1;
        msg->expires_at = 0;
        INIT_LIST_HEAD(&msg->chunks);
@@ -182,20 +181,11 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
        /* Note: Calculate this outside of the loop, so that all fragments
         * have the same expiration.
         */
-       if (sinfo->sinfo_timetolive) {
-               /* sinfo_timetolive is in milliseconds */
+       if (asoc->peer.prsctp_capable && sinfo->sinfo_timetolive &&
+           (SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags) ||
+            !SCTP_PR_POLICY(sinfo->sinfo_flags)))
                msg->expires_at = jiffies +
                                    msecs_to_jiffies(sinfo->sinfo_timetolive);
-               msg->can_abandon = 1;
-
-               pr_debug("%s: msg:%p expires_at:%ld jiffies:%ld\n", __func__,
-                        msg, msg->expires_at, jiffies);
-       }
-
-       if (asoc->peer.prsctp_capable &&
-           SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags))
-               msg->expires_at =
-                       jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive);
 
        /* This is the biggest possible DATA chunk that can fit into
         * the packet
@@ -354,18 +344,8 @@ errout:
 /* Check whether this message has expired. */
 int sctp_chunk_abandoned(struct sctp_chunk *chunk)
 {
-       if (!chunk->asoc->peer.prsctp_capable ||
-           !SCTP_PR_POLICY(chunk->sinfo.sinfo_flags)) {
-               struct sctp_datamsg *msg = chunk->msg;
-
-               if (!msg->can_abandon)
-                       return 0;
-
-               if (time_after(jiffies, msg->expires_at))
-                       return 1;
-
+       if (!chunk->asoc->peer.prsctp_capable)
                return 0;
-       }
 
        if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) &&
            time_after(jiffies, chunk->msg->expires_at)) {
@@ -378,6 +358,10 @@ int sctp_chunk_abandoned(struct sctp_chunk *chunk)
                   chunk->sent_count > chunk->sinfo.sinfo_timetolive) {
                chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++;
                return 1;
+       } else if (!SCTP_PR_POLICY(chunk->sinfo.sinfo_flags) &&
+                  chunk->msg->expires_at &&
+                  time_after(jiffies, chunk->msg->expires_at)) {
+               return 1;
        }
        /* PRIO policy is processed by sendmsg, not here */