patch-2.1.16 linux/net/802/llc_sendpdu.c
Next file: linux/net/802/transit/timertr.h
Previous file: linux/net/802/llc_macinit.c
Back to the patch index
Back to the overall index
- Lines: 191
- Date:
Wed Dec 18 12:07:55 1996
- Orig file:
v2.1.15/linux/net/802/llc_sendpdu.c
- Orig date:
Thu Dec 12 19:37:21 1996
diff -u --recursive --new-file v2.1.15/linux/net/802/llc_sendpdu.c linux/net/802/llc_sendpdu.c
@@ -162,8 +162,9 @@
lp->dev->hard_header(skb, lp->dev, ETH_P_802_3,
lp->remote_mac, NULL, fl);
skb->arp = 1;
- skb->free = 1;
- dev_queue_xmit(skb, lp->dev, SOPRI_NORMAL);
+ skb->priority=SOPRI_NORMAL;
+ skb->dev=lp->dev;
+ dev_queue_xmit(skb);
}
else
printk(KERN_DEBUG "cl2llc: skb_alloc() in llc_sendpdu() failed\n");
@@ -196,7 +197,8 @@
void llc_sendipdu(llcptr lp, char type, char pf, struct sk_buff *skb)
{
frameptr fr; /* ptr to output pdu buffer */
-
+ struct sk_buff *tmp;
+
fr = (frameptr) skb->data;
fr->pdu_hdr.dsap = lp->remote_sap;
@@ -213,9 +215,14 @@
lp->dev->hard_header(skb, lp->dev, ETH_P_802_3,
lp->remote_mac, NULL, skb->len);
skb->arp = 1;
- skb->free = 0; /* thanks, Alan */
ADD_TO_RTQ(skb); /* add skb to the retransmit queue */
- dev_queue_xmit(skb, lp->dev, SOPRI_NORMAL);
+ tmp=skb_clone(skb, GFP_ATOMIC);
+ if(tmp!=NULL)
+ {
+ tmp->dev=lp->dev;
+ tmp->priority=SOPRI_NORMAL;
+ dev_queue_xmit(tmp);
+ }
}
@@ -230,22 +237,21 @@
int llc_resend_ipdu(llcptr lp, unsigned char ack_nr, unsigned char type, char p)
{
- struct sk_buff *skb;
+ struct sk_buff *skb,*tmp;
int resend_count;
frameptr fr;
+ unsigned long flags;
+
resend_count = 0;
- skb = lp->rtq_front;
+
+ save_flags(flags);
+ cli();
+
+ skb = skb_peek(&lp->rtq);
- while(skb != NULL)
+ while(skb && skb != (struct sk_buff *)&lp->rtq)
{
- /*
- * Should not occur:
- */
-
- if (skb_device_locked(skb))
- return resend_count;
-
fr = (frameptr) (skb->data + lp->dev->hard_header_len);
if (resend_count == 0)
{
@@ -277,12 +283,18 @@
lp->vs++;
if (lp->vs > 127)
lp->vs = 0;
- skb->arp = 1;
- skb->free = 0;
- dev_queue_xmit(skb, lp->dev, SOPRI_NORMAL);
+ tmp=skb_clone(skb, GFP_ATOMIC);
+ if(tmp!=NULL)
+ {
+ tmp->arp = 1;
+ tmp->dev = lp->dev;
+ tmp->priority = SOPRI_NORMAL;
+ dev_queue_xmit(skb);
+ }
resend_count++;
- skb = skb->link3;
+ skb = skb->next;
}
+ restore_flags(flags);
return resend_count;
}
@@ -290,28 +302,6 @@
/*
- * Add_to_queue() adds an skb at back of an I-frame queue.
- * this function is used for both atq and rtq.
- * the front and back pointers identify the queue being edited.
- * this function is called with macros ADD_TO_RTQ() and ADD_TO_ATQ() .
- */
-
-void llc_add_to_queue(struct sk_buff *skb,
- struct sk_buff **front, struct sk_buff **back)
-{
- struct sk_buff *t;
-
- skb->link3 = NULL; /* there is no more recent skb */
- t = *back; /* save current back ptr */
- *back = skb;
- if (t != NULL)
- t->link3 = skb;
- if (*front == NULL)
- *front = *back;
-}
-
-
-/*
* Remove one skb from the front of the awaiting transmit queue
* (this is the skb longest on the queue) and return a pointer to
* that skb.
@@ -319,18 +309,7 @@
struct sk_buff *llc_pull_from_atq(llcptr lp)
{
- struct sk_buff *t;
-
- if (lp->atq_front == NULL)
- return NULL; /* empty queue */
-
- t = lp->atq_front;
- lp->atq_front = t->link3;
- if (lp->atq_front == NULL)
- {
- lp->atq_back = lp->atq_front;
- }
- return t;
+ return skb_dequeue(&lp->atq);
}
/*
@@ -346,6 +325,7 @@
int ack_count;
unsigned char ack; /* N(S) of most recently ack'ed pdu */
unsigned char ns_save;
+ unsigned long flags;
if (pdu_ack > 0)
ack = pdu_ack -1;
@@ -353,28 +333,31 @@
ack = 127;
ack_count = 0;
- pp = lp->rtq_front;
+
+ save_flags(flags);
+ cli();
+
+ pp = skb_dequeue(&lp->rtq);
while (pp != NULL)
{
/*
* Locate skb with N(S) == ack
*/
- lp->rtq_front = pp->link3;
+
+ /*
+ * BUG: FIXME - use skb->h.*
+ */
fr = (frameptr) (pp->data + lp->dev->hard_header_len);
ns_save = fr->i_hdr.ns;
- if (skb_device_locked(pp))
- return ack_count;
kfree_skb(pp, FREE_WRITE);
ack_count++;
if (ns_save == ack)
break;
- pp = lp->rtq_front;
+ pp = skb_dequeue(&lp->rtq);
}
- if (pp == NULL) /* if rtq empty now */
- lp->rtq_back = NULL; /* correct back pointer */
-
+ restore_flags(flags);
return ack_count;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov