patch-2.1.42 linux/drivers/isdn/hisax/tei.c

Next file: linux/drivers/isdn/hisax/teles0.c
Previous file: linux/drivers/isdn/hisax/q931.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.41/linux/drivers/isdn/hisax/tei.c linux/drivers/isdn/hisax/tei.c
@@ -1,4 +1,4 @@
-/* $Id: tei.c,v 1.6 1997/02/09 00:25:12 keil Exp $
+/* $Id: tei.c,v 1.8 1997/04/07 22:59:08 keil Exp $
 
  * Author       Karsten Keil (keil@temic-ech.spacenet.de)
  *              based on the teles driver from Jan den Ouden
@@ -7,6 +7,12 @@
  *              Fritz Elfert
  *
  * $Log: tei.c,v $
+ * Revision 1.8  1997/04/07 22:59:08  keil
+ * GFP_KERNEL --> GFP_ATOMIC
+ *
+ * Revision 1.7  1997/04/06 22:54:03  keil
+ * Using SKB's
+ *
  * Revision 1.6  1997/02/09 00:25:12  keil
  * new interface handling, one interface per card
  *
@@ -34,7 +40,7 @@
 extern struct IsdnCard cards[];
 extern int nrcards;
 
-const char *tei_revision = "$Revision: 1.6 $";
+const char *tei_revision = "$Revision: 1.8 $";
 
 static struct PStack *
 findces(struct PStack *st, int ces)
@@ -66,26 +72,27 @@
 }
 
 static void
-mdl_unit_data_res(struct PStack *st, unsigned int ri, byte mt, byte ai)
+mdl_unit_data_res(struct PStack *st, unsigned int ri, u_char mt, u_char ai)
 {
-	struct BufHeader *ibh;
-	byte *bp;
+	struct sk_buff *skb;
+	u_char *bp;
 
-	if (BufPoolGet(&ibh, st->l1.smallpool, GFP_ATOMIC, (void *) st, 7))
+	if (!(skb = alloc_skb(6 + MAX_HEADER_LEN, GFP_ATOMIC))) {
+		printk(KERN_WARNING "HiSax: No skb for TEI manager\n");
 		return;
-	bp = DATAPTR(ibh);
-	bp += 3;
+	}
+	skb_reserve(skb, MAX_HEADER_LEN);
+	bp = skb_put(skb, 5);
 	bp[0] = 0xf;
 	bp[1] = ri >> 8;
 	bp[2] = ri & 0xff;
 	bp[3] = mt;
 	bp[4] = (ai << 1) | 1;
-	ibh->datasize = 8;
-	st->l3.l3l2(st, DL_UNIT_DATA, ibh);
+	st->l3.l3l2(st, DL_UNIT_DATA, skb);
 }
 
 static void
-mdl_unit_data_ind(struct PStack *st, unsigned int ri, byte mt, byte ai)
+mdl_unit_data_ind(struct PStack *st, unsigned int ri, u_char mt, u_char ai)
 {
 	unsigned int tces;
 	struct PStack *otsp, *ptr;
@@ -194,15 +201,15 @@
 
 void
 tei_handler(struct PStack *st,
-	    byte pr, struct BufHeader *ibh)
+	    u_char pr, struct sk_buff *skb)
 {
-	byte *bp;
+	u_char *bp;
 	unsigned int data;
 	char tmp[32];
 
 	switch (pr) {
 		case (MDL_ASSIGN):
-			data = (unsigned int) ibh;
+			data = (unsigned int) skb;
 			if (st->l3.debug) {
 				sprintf(tmp, "ces %d assign request", data);
 				st->l2.l2m.printdebug(&st->l2.l2m, tmp);
@@ -210,7 +217,7 @@
 			mdl_unit_data_res(st, data, 1, 127);
 			break;
 		case (MDL_VERIFY):
-			data = (unsigned int) ibh;
+			data = (unsigned int) skb;
 			if (st->l3.debug) {
 				sprintf(tmp, "%d id verify request", data);
 				st->l2.l2m.printdebug(&st->l2.l2m, tmp);
@@ -218,17 +225,15 @@
 			mdl_unit_data_res(st, 0, 7, data);
 			break;
 		case (DL_UNIT_DATA):
-			bp = DATAPTR(ibh);
-			bp += 3;
+			bp = skb->data;
 			if (bp[0] != 0xf) {
 				/* wrong management entity identifier, ignore */
 				/* shouldn't ibh be released??? */
 				printk(KERN_WARNING "tei handler wrong entity id %x\n", bp[0]);
-				BufPoolRelease(ibh);
-				break;
-			}
-			mdl_unit_data_ind(st, (bp[1] << 8) | bp[2], bp[3], bp[4] >> 1);
-			BufPoolRelease(ibh);
+			} else
+				mdl_unit_data_ind(st, (bp[1] << 8) | bp[2], bp[3], bp[4] >> 1);
+			SET_SKB_FREE(skb);
+			dev_kfree_skb(skb, FREE_READ);
 			break;
 		default:
 			break;
@@ -270,8 +275,7 @@
 	struct PStack *st;
 	char tmp[128];
 
-	st = (struct PStack *) Smalloc(sizeof(struct PStack), GFP_KERNEL,
-				       "struct PStack");
+	st = (struct PStack *) kmalloc(sizeof(struct PStack), GFP_ATOMIC);
 	setstack_HiSax(st, sp);
 	st->l2.extended = !0;
 	st->l2.laptype = LAPD;
@@ -281,7 +285,6 @@
 /*
  * the following is not necessary for tei mng. (broadcast only)
  */
-
 	st->l2.t200 = 500;	/* 500 milliseconds */
 	st->l2.n200 = 4;	/* try 4 times */
 
@@ -310,5 +313,5 @@
 	struct PStack *st = sp->teistack;
 
 	HiSax_rmlist(sp, st);
-	Sfree((void *) st);
+	kfree((void *) st);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov