fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / net / sctp / inqueue.c
index cedf435..71b0746 100644 (file)
 /* Initialize an SCTP inqueue.  */
 void sctp_inq_init(struct sctp_inq *queue)
 {
-       skb_queue_head_init(&queue->in);
+       INIT_LIST_HEAD(&queue->in_chunk_list);
        queue->in_progress = NULL;
 
        /* Create a task for delivering data.  */
-       INIT_WORK(&queue->immediate, NULL, NULL);
+       INIT_WORK(&queue->immediate, NULL);
 
        queue->malloced = 0;
 }
@@ -62,17 +62,21 @@ void sctp_inq_init(struct sctp_inq *queue)
 /* Release the memory associated with an SCTP inqueue.  */
 void sctp_inq_free(struct sctp_inq *queue)
 {
-       struct sctp_chunk *chunk;
+       struct sctp_chunk *chunk, *tmp;
 
        /* Empty the queue.  */
-       while ((chunk = (struct sctp_chunk *) skb_dequeue(&queue->in)) != NULL)
+       list_for_each_entry_safe(chunk, tmp, &queue->in_chunk_list, list) {
+               list_del_init(&chunk->list);
                sctp_chunk_free(chunk);
+       }
 
        /* If there is a packet which is currently being worked on,
         * free it as well.
         */
-       if (queue->in_progress)
+       if (queue->in_progress) {
                sctp_chunk_free(queue->in_progress);
+               queue->in_progress = NULL;
+       }
 
        if (queue->malloced) {
                /* Dump the master memory segment.  */
@@ -83,7 +87,7 @@ void sctp_inq_free(struct sctp_inq *queue)
 /* Put a new packet in an SCTP inqueue.
  * We assume that packet->sctp_hdr is set and in host byte order.
  */
-void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *packet)
+void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk)
 {
        /* Directly call the packet handling routine. */
 
@@ -92,8 +96,8 @@ void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *packet)
         * Eventually, we should clean up inqueue to not rely
         * on the BH related data structures.
         */
-       skb_queue_tail(&(q->in), (struct sk_buff *) packet);
-       q->immediate.func(q->immediate.data);
+       list_add_tail(&chunk->list, &q->in_chunk_list);
+       q->immediate.func(&q->immediate);
 }
 
 /* Extract a chunk from an SCTP inqueue.
@@ -131,16 +135,21 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
 
        /* Do we need to take the next packet out of the queue to process? */
        if (!chunk) {
+               struct list_head *entry;
+
                /* Is the queue empty?  */
-               if (skb_queue_empty(&queue->in))
+               if (list_empty(&queue->in_chunk_list))
                        return NULL;
 
+               entry = queue->in_chunk_list.next;
                chunk = queue->in_progress =
-                       (struct sctp_chunk *) skb_dequeue(&queue->in);
+                       list_entry(entry, struct sctp_chunk, list);
+               list_del_init(entry);
 
                /* This is the first chunk in the packet.  */
                chunk->singleton = 1;
                ch = (sctp_chunkhdr_t *) chunk->skb->data;
+               chunk->data_accepted = 0;
        }
 
         chunk->chunk_hdr = ch;
@@ -196,9 +205,8 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
  * The intent is that this routine will pull stuff out of the
  * inqueue and process it.
  */
-void sctp_inq_set_th_handler(struct sctp_inq *q,
-                                void (*callback)(void *), void *arg)
+void sctp_inq_set_th_handler(struct sctp_inq *q, work_func_t callback)
 {
-       INIT_WORK(&q->immediate, callback, arg);
+       INIT_WORK(&q->immediate, callback);
 }