Commit 16d14ef9f29dfa9b1d99f3eff860e9f15bc99f39
Committed by
David S. Miller
1 parent
5c58298c25
Exists in
master
and in
20 other branches
[SCTP]: Consolidate sctp_ulpq_renege_xxx functions
Both are equal, except for the list to be traversed. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 10 additions and 24 deletions Side-by-side Diff
net/sctp/ulpqueue.c
... | ... | @@ -908,8 +908,8 @@ |
908 | 908 | return; |
909 | 909 | } |
910 | 910 | |
911 | -/* Renege 'needed' bytes from the ordering queue. */ | |
912 | -static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed) | |
911 | +static __u16 sctp_ulpq_renege_list(struct sctp_ulpq *ulpq, | |
912 | + struct sk_buff_head *list, __u16 needed) | |
913 | 913 | { |
914 | 914 | __u16 freed = 0; |
915 | 915 | __u32 tsn; |
... | ... | @@ -919,7 +919,7 @@ |
919 | 919 | |
920 | 920 | tsnmap = &ulpq->asoc->peer.tsn_map; |
921 | 921 | |
922 | - while ((skb = __skb_dequeue_tail(&ulpq->lobby)) != NULL) { | |
922 | + while ((skb = __skb_dequeue_tail(list)) != NULL) { | |
923 | 923 | freed += skb_headlen(skb); |
924 | 924 | event = sctp_skb2event(skb); |
925 | 925 | tsn = event->tsn; |
926 | 926 | |
... | ... | @@ -933,30 +933,16 @@ |
933 | 933 | return freed; |
934 | 934 | } |
935 | 935 | |
936 | +/* Renege 'needed' bytes from the ordering queue. */ | |
937 | +static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed) | |
938 | +{ | |
939 | + return sctp_ulpq_renege_list(ulpq, &ulpq->lobby, needed); | |
940 | +} | |
941 | + | |
936 | 942 | /* Renege 'needed' bytes from the reassembly queue. */ |
937 | 943 | static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed) |
938 | 944 | { |
939 | - __u16 freed = 0; | |
940 | - __u32 tsn; | |
941 | - struct sk_buff *skb; | |
942 | - struct sctp_ulpevent *event; | |
943 | - struct sctp_tsnmap *tsnmap; | |
944 | - | |
945 | - tsnmap = &ulpq->asoc->peer.tsn_map; | |
946 | - | |
947 | - /* Walk backwards through the list, reneges the newest tsns. */ | |
948 | - while ((skb = __skb_dequeue_tail(&ulpq->reasm)) != NULL) { | |
949 | - freed += skb_headlen(skb); | |
950 | - event = sctp_skb2event(skb); | |
951 | - tsn = event->tsn; | |
952 | - | |
953 | - sctp_ulpevent_free(event); | |
954 | - sctp_tsnmap_renege(tsnmap, tsn); | |
955 | - if (freed >= needed) | |
956 | - return freed; | |
957 | - } | |
958 | - | |
959 | - return freed; | |
945 | + return sctp_ulpq_renege_list(ulpq, &ulpq->reasm, needed); | |
960 | 946 | } |
961 | 947 | |
962 | 948 | /* Partial deliver the first message as there is pressure on rwnd. */ |