OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Consolidate sctp_ulpq_renege_xxx functions
[PATCH] Consolidate sctp_ulpq_renege_xxx functions [message #22214] Tue, 23 October 2007 15:17 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
Both are equal, except for the list to be traversed.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index b937095..4be92d0 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -908,8 +908,8 @@ void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn)
 	return;
 }
 
-/* Renege 'needed' bytes from the ordering queue. */
-static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed)
+static __u16 sctp_ulpq_renege_list(struct sctp_ulpq *ulpq,
+		struct sk_buff_head *list, __u16 needed)
 {
 	__u16 freed = 0;
 	__u32 tsn;
@@ -919,7 +919,7 @@ static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed)
 
 	tsnmap = &ulpq->asoc->peer.tsn_map;
 
-	while ((skb = __skb_dequeue_tail(&ulpq->lobby)) != NULL) {
+	while ((skb = __skb_dequeue_tail(list)) != NULL) {
 		freed += skb_headlen(skb);
 		event = sctp_skb2event(skb);
 		tsn = event->tsn;
@@ -933,30 +933,16 @@ static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed)
 	return freed;
 }
 
+/* Renege 'needed' bytes from the ordering queue. */
+static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed)
+{
+	return sctp_ulpq_renege_list(ulpq, &ulpq->lobby, needed);
+}
+
 /* Renege 'needed' bytes from the reassembly queue. */
 static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed)
 {
-	__u16 freed = 0;
-	__u32 tsn;
-	struct sk_buff *skb;
-	struct sctp_ulpevent *event;
-	struct sctp_tsnmap *tsnmap;
-
-	tsnmap = &ulpq->asoc->peer.tsn_map;
-
-	/* Walk backwards through the list, reneges the newest tsns. */
-	while ((skb = __skb_dequeue_tail(&ulpq->reasm)) != NULL) {
-		freed += skb_headlen(skb);
-		event = sctp_skb2event(skb);
-		tsn = event->tsn;
-
-		sctp_ulpevent_free(event);
-		sctp_tsnmap_renege(tsnmap, tsn);
-		if (freed >= needed)
-			return freed;
-	}
-
-	return freed;
+	return sctp_ulpq_renege_list(ulpq, &ulpq->reasm, needed);
 }
 
 /* Partial deliver the first message as there is pressure on rwnd. */
Re: [PATCH] Consolidate sctp_ulpq_renege_xxx functions [message #22223 is a reply to message #22214] Tue, 23 October 2007 15:57 Go to previous messageGo to next message
Vlad Yasevich is currently offline  Vlad Yasevich
Messages: 8
Registered: November 2006
Junior Member
Pavel Emelyanov wrote:
> Both are equal, except for the list to be traversed.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> 

ACK.  Good clean-up Pavel.

Thanks
-vlad
Re: [PATCH] Consolidate sctp_ulpq_renege_xxx functions [message #22237 is a reply to message #22223] Wed, 24 October 2007 03:30 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Tue, 23 Oct 2007 11:57:42 -0400

> Pavel Emelyanov wrote:
> > Both are equal, except for the list to be traversed.
> > 
> > Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> > 
> 
> ACK.  Good clean-up Pavel.

Yep, nice work, applied.

Thanks!
Previous Topic: Re: [RFC] what the hell is going on with /proc/self?
Next Topic: [PATCH 1/3] Don't declare extern variables in net/core/sysctl_net_core.c
Goto Forum:
  


Current Time: Wed Jun 19 14:54:48 GMT 2024

Total time taken to generate the page: 0.03387 seconds