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

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

diff -u --recursive --new-file v2.1.41/linux/drivers/isdn/hisax/l3_1tr6.c linux/drivers/isdn/hisax/l3_1tr6.c
@@ -1,4 +1,4 @@
-/* $Id: l3_1tr6.c,v 1.9 1997/02/11 01:37:40 keil Exp $
+/* $Id: l3_1tr6.c,v 1.11 1997/04/06 22:54:18 keil Exp $
 
  *  German 1TR6 D-channel protocol
  *
@@ -6,6 +6,12 @@
  *
  *
  * $Log: l3_1tr6.c,v $
+ * Revision 1.11  1997/04/06 22:54:18  keil
+ * Using SKB's
+ *
+ * Revision 1.10  1997/03/13 20:37:58  keil
+ * channel request added
+ *
  * Revision 1.9  1997/02/11 01:37:40  keil
  * Changed setup-interface (incoming and outgoing)
  *
@@ -40,9 +46,10 @@
 #include "hisax.h"
 #include "l3_1tr6.h"
 #include "isdnl3.h"
+#include <linux/ctype.h>
 
 extern char *HiSax_getrev(const char *revision);
-const char *l3_1tr6_revision = "$Revision: 1.9 $";
+const char *l3_1tr6_revision = "$Revision: 1.11 $";
 
 #define MsgHead(ptr, cref, mty, dis) \
 	*ptr++ = dis; \
@@ -51,36 +58,63 @@
 	*ptr++ = mty
 
 static void
-l3_1TR6_message(struct PStack *st, byte mt, byte pd)
+l3_1TR6_message(struct PStack *st, u_char mt, u_char pd)
 {
-	struct BufHeader *dibh;
-	byte *p;
-
-	BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 18);
-	p = DATAPTR(dibh);
-	p += st->l2.ihsize;
+	struct sk_buff *skb;
+	u_char *p;
 
+	if (!(skb = l3_alloc_skb(4)))
+		return;
+	p = skb_put(skb, 4);
 	MsgHead(p, st->l3.callref, mt, pd);
-
-	dibh->datasize = p - DATAPTR(dibh);
-	st->l3.l3l2(st, DL_DATA, dibh);
+	st->l3.l3l2(st, DL_DATA, skb);
 }
 
 static void
-l3_1tr6_setup_req(struct PStack *st, byte pr, void *arg)
+l3_1tr6_setup_req(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *dibh;
-	byte *p;
-	char *teln;
+	struct sk_buff *skb;
+	u_char tmp[128];
+	u_char *p = tmp;
+	u_char *teln;
+	u_char *eaz;
+	u_char channel = 0;
+	int l;
 
-	st->l3.callref = st->pa->callref;
-	BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 19);
-	p = DATAPTR(dibh);
-	p += st->l2.ihsize;
 
+	st->l3.callref = st->pa->callref;
 	MsgHead(p, st->l3.callref, MT_N1_SETUP, PROTO_DIS_N1);
 
-	if ('S' == (st->pa->setup.phone[0] & 0x5f)) {	/* SPV ? */
+	teln = st->pa->setup.phone;
+	st->pa->spv = 0;
+	if (!isdigit(*teln)) {
+		switch (0x5f & *teln) {
+			case 'S':
+				st->pa->spv = 1;
+				break;
+			case 'C':
+				channel = 0x08;
+			case 'P':
+				channel |= 0x80;
+				teln++;
+				if (*teln == '1')
+					channel |= 0x01;
+				else
+					channel |= 0x02;
+				break;
+			default:
+				if (st->l3.debug & L3_DEB_WARN)
+					l3_debug(st, "Wrong MSN Code");
+				break;
+		}
+		teln++;
+	}
+	if (channel) {
+		*p++ = 0x18;	/* channel indicator */
+		*p++ = 1;
+		*p++ = channel;
+	}
+	if (st->pa->spv) {	/* SPV ? */
 		/* NSF SPV */
 		*p++ = WE0_netSpecFac;
 		*p++ = 4;	/* Laenge */
@@ -95,25 +129,17 @@
 		*p++ = st->pa->setup.si1;	/* 0 for all Services */
 		*p++ = st->pa->setup.si2;	/* 0 for all Services */
 	}
-	if (st->pa->setup.eazmsn[0] != '\0') {
+	eaz = st->pa->setup.eazmsn;
+	if (*eaz) {
 		*p++ = WE0_origAddr;
-		*p++ = strlen(st->pa->setup.eazmsn) + 1;
+		*p++ = strlen(eaz) + 1;
 		/* Classify as AnyPref. */
 		*p++ = 0x81;	/* Ext = '1'B, Type = '000'B, Plan = '0001'B. */
-		teln = st->pa->setup.eazmsn;
-		while (*teln)
-			*p++ = *teln++ & 0x7f;
+		while (*eaz)
+			*p++ = *eaz++ & 0x7f;
 	}
 	*p++ = WE0_destAddr;
-	teln = st->pa->setup.phone;
-	if ('S' != (st->pa->setup.phone[0] & 0x5f)) {	/* Keine SPV */
-		*p++ = strlen(st->pa->setup.phone) + 1;
-		st->pa->spv = 0;
-	} else {		/* SPV */
-		*p++ = strlen(st->pa->setup.phone);
-		teln++;		/* skip S */
-		st->pa->spv = 1;
-	}
+	*p++ = strlen(teln) + 1;
 	/* Classify as AnyPref. */
 	*p++ = 0x81;		/* Ext = '1'B, Type = '000'B, Plan = '0001'B. */
 	while (*teln)
@@ -126,67 +152,64 @@
 	*p++ = st->pa->setup.si1;
 	*p++ = st->pa->setup.si2;
 
-	dibh->datasize = p - DATAPTR(dibh);
-
+	l = p - tmp;
+	if (!(skb = l3_alloc_skb(l)))
+		return;
+	memcpy(skb_put(skb, l), tmp, l);
 	L3DelTimer(&st->l3.timer);
 	L3AddTimer(&st->l3.timer, st->l3.t303, CC_T303);
 	newl3state(st, 1);
-	st->l3.l3l2(st, DL_DATA, dibh);
+	st->l3.l3l2(st, DL_DATA, skb);
 
 }
 
 static void
-l3_1tr6_setup(struct PStack *st, byte pr, void *arg)
+l3_1tr6_setup(struct PStack *st, u_char pr, void *arg)
 {
-	byte *p;
+	u_char *p;
 	int bcfound = 0;
 	char tmp[80];
-	struct BufHeader *ibh = arg;
+	struct sk_buff *skb = arg;
 
-	p = DATAPTR(ibh);
-	p += st->l2.uihsize;
+	p = skb->data;
 	st->pa->callref = getcallref(p);
 	st->l3.callref = 0x80 + st->pa->callref;
 
 	/* Channel Identification */
-	p = DATAPTR(ibh);
-	if ((p = findie(p + st->l2.uihsize, ibh->datasize - st->l2.uihsize,
-			WE0_chanID, 0))) {
+	p = skb->data;
+	if ((p = findie(p, skb->len, WE0_chanID, 0))) {
 		st->pa->bchannel = p[2] & 0x3;
 		bcfound++;
 	} else if (st->l3.debug & L3_DEB_WARN)
 		l3_debug(st, "setup without bchannel");
 
-	p = DATAPTR(ibh);
-
-	if ((p = findie(p + st->l2.uihsize, ibh->datasize - st->l2.uihsize, WE6_serviceInd, 6))) {
+	p = skb->data;
+	if ((p = findie(p, skb->len, WE6_serviceInd, 6))) {
 		st->pa->setup.si1 = p[2];
 		st->pa->setup.si2 = p[3];
 	} else if (st->l3.debug & L3_DEB_WARN)
 		l3_debug(st, "setup without service indicator");
 
-	p = DATAPTR(ibh);
-	if ((p = findie(p + st->l2.uihsize, ibh->datasize - st->l2.uihsize,
-			WE0_destAddr, 0)))
+	p = skb->data;
+	if ((p = findie(p, skb->len, WE0_destAddr, 0)))
 		iecpy(st->pa->setup.eazmsn, p, 1);
 	else
 		st->pa->setup.eazmsn[0] = 0;
 
-	p = DATAPTR(ibh);
-	if ((p = findie(p + st->l2.uihsize, ibh->datasize - st->l2.uihsize,
-			WE0_origAddr, 0))) {
+	p = skb->data;
+	if ((p = findie(p, skb->len, WE0_origAddr, 0))) {
 		iecpy(st->pa->setup.phone, p, 1);
 	} else
 		st->pa->setup.phone[0] = 0;
 
-	p = DATAPTR(ibh);
+	p = skb->data;
 	st->pa->spv = 0;
-	if ((p = findie(p + st->l2.uihsize, ibh->datasize - st->l2.uihsize,
-			WE0_netSpecFac, 0))) {
+	if ((p = findie(p, skb->len, WE0_netSpecFac, 0))) {
 		if ((FAC_SPV == p[3]) || (FAC_Activate == p[3]))
 			st->pa->spv = 1;
 	}
-	BufPoolRelease(ibh);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 
 	/* Signal all services, linklevel takes care of Service-Indicator */
 	if (bcfound) {
@@ -202,67 +225,65 @@
 }
 
 static void
-l3_1tr6_setup_ack(struct PStack *st, byte pr, void *arg)
+l3_1tr6_setup_ack(struct PStack *st, u_char pr, void *arg)
 {
-	byte *p;
-	struct BufHeader *ibh = arg;
+	u_char *p;
+	struct sk_buff *skb = arg;
 
 	L3DelTimer(&st->l3.timer);
+	p = skb->data;
 	newl3state(st, 2);
-	p = DATAPTR(ibh);
-	if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
-			WE0_chanID, 0))) {
+	if ((p = findie(p, skb->len, WE0_chanID, 0))) {
 		st->pa->bchannel = p[2] & 0x3;
 	} else if (st->l3.debug & L3_DEB_WARN)
 		l3_debug(st, "setup answer without bchannel");
-
-	BufPoolRelease(ibh);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 	L3AddTimer(&st->l3.timer, st->l3.t304, CC_T304);
 	st->l3.l3l4(st, CC_MORE_INFO, NULL);
 }
 
 static void
-l3_1tr6_call_sent(struct PStack *st, byte pr, void *arg)
+l3_1tr6_call_sent(struct PStack *st, u_char pr, void *arg)
 {
-	byte *p;
-	struct BufHeader *ibh = arg;
+	u_char *p;
+	struct sk_buff *skb = arg;
 
 	L3DelTimer(&st->l3.timer);
-	p = DATAPTR(ibh);
-	if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
-			WE0_chanID, 0))) {
+	p = skb->data;
+	if ((p = findie(p, skb->len, WE0_chanID, 0))) {
 		st->pa->bchannel = p[2] & 0x3;
 	} else if (st->l3.debug & L3_DEB_WARN)
 		l3_debug(st, "setup answer without bchannel");
-
-	BufPoolRelease(ibh);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 	L3AddTimer(&st->l3.timer, st->l3.t310, CC_T310);
 	newl3state(st, 3);
 	st->l3.l3l4(st, CC_PROCEEDING_IND, NULL);
 }
 
 static void
-l3_1tr6_alert(struct PStack *st, byte pr, void *arg)
+l3_1tr6_alert(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *ibh = arg;
+	struct sk_buff *skb = arg;
 
-	BufPoolRelease(ibh);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 	L3DelTimer(&st->l3.timer);	/* T304 */
 	newl3state(st, 4);
 	st->l3.l3l4(st, CC_ALERTING_IND, NULL);
 }
 
 static void
-l3_1tr6_info(struct PStack *st, byte pr, void *arg)
+l3_1tr6_info(struct PStack *st, u_char pr, void *arg)
 {
-	byte *p;
+	u_char *p;
 	int i, tmpcharge = 0;
 	char a_charge[8], tmp[32];
-	struct BufHeader *ibh = arg;
+	struct sk_buff *skb = arg;
 
-	p = DATAPTR(ibh);
-	if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
-			WE6_chargingInfo, 6))) {
+	p = skb->data;
+	if ((p = findie(p, skb->len, WE6_chargingInfo, 6))) {
 		iecpy(a_charge, p, 1);
 		for (i = 0; i < strlen(a_charge); i++) {
 			tmpcharge *= 10;
@@ -278,39 +299,41 @@
 		}
 	} else if (st->l3.debug & L3_DEB_CHARGE)
 		l3_debug(st, "charging info not found");
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 
-	BufPoolRelease(ibh);
 }
 
 static void
-l3_1tr6_info_s2(struct PStack *st, byte pr, void *arg)
+l3_1tr6_info_s2(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *ibh = arg;
+	struct sk_buff *skb = arg;
 
-	BufPoolRelease(ibh);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 }
 
 static void
-l3_1tr6_connect(struct PStack *st, byte pr, void *arg)
+l3_1tr6_connect(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *ibh = arg;
+	struct sk_buff *skb = arg;
 
 	L3DelTimer(&st->l3.timer);	/* T310 */
 	newl3state(st, 10);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 	st->pa->chargeinfo = 0;
-	BufPoolRelease(ibh);
 	st->l3.l3l4(st, CC_SETUP_CNF, NULL);
 }
 
 static void
-l3_1tr6_rel(struct PStack *st, byte pr, void *arg)
+l3_1tr6_rel(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *ibh = arg;
-	byte *p;
-	
-	p = DATAPTR(ibh);
-	if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
-			WE0_cause, 0))) {
+	struct sk_buff *skb = arg;
+	u_char *p;
+
+	p = skb->data;
+	if ((p = findie(p, skb->len, WE0_cause, 0))) {
 		if (p[1] > 0) {
 			st->pa->cause = p[2];
 			if (p[1] > 1)
@@ -321,9 +344,10 @@
 			st->pa->cause = 0;
 			st->pa->loc = 0;
 		}
-	} else 
+	} else
 		st->pa->cause = -1;
-	BufPoolRelease(ibh);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 	StopAllL3Timer(st);
 	newl3state(st, 0);
 	l3_1TR6_message(st, MT_N1_REL_ACK, PROTO_DIS_N1);
@@ -331,11 +355,12 @@
 }
 
 static void
-l3_1tr6_rel_ack(struct PStack *st, byte pr, void *arg)
+l3_1tr6_rel_ack(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *ibh = arg;
+	struct sk_buff *skb = arg;
 
-	BufPoolRelease(ibh);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 	StopAllL3Timer(st);
 	newl3state(st, 0);
 	st->pa->cause = -1;
@@ -343,17 +368,16 @@
 }
 
 static void
-l3_1tr6_disc(struct PStack *st, byte pr, void *arg)
+l3_1tr6_disc(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *ibh = arg;
-	byte *p;
+	struct sk_buff *skb = arg;
+	u_char *p;
 	int i, tmpcharge = 0;
 	char a_charge[8], tmp[32];
 
 	StopAllL3Timer(st);
-	p = DATAPTR(ibh);
-	if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
-			WE6_chargingInfo, 6))) {
+	p = skb->data;
+	if ((p = findie(p, skb->len, WE6_chargingInfo, 6))) {
 		iecpy(a_charge, p, 1);
 		for (i = 0; i < strlen(a_charge); i++) {
 			tmpcharge *= 10;
@@ -371,9 +395,8 @@
 		l3_debug(st, "charging info not found");
 
 
-	p = DATAPTR(ibh);
-	if ((p = findie(p + st->l2.ihsize, ibh->datasize - st->l2.ihsize,
-			WE0_cause, 0))) {
+	p = skb->data;
+	if ((p = findie(p, skb->len, WE0_cause, 0))) {
 		if (p[1] > 0) {
 			st->pa->cause = p[2];
 			if (p[1] > 1)
@@ -389,18 +412,20 @@
 			l3_debug(st, "cause not found");
 		st->pa->cause = -1;
 	}
-	BufPoolRelease(ibh);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 	newl3state(st, 12);
 	st->l3.l3l4(st, CC_DISCONNECT_IND, NULL);
 }
 
 
 static void
-l3_1tr6_connect_ack(struct PStack *st, byte pr, void *arg)
+l3_1tr6_connect_ack(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *ibh = arg;
+	struct sk_buff *skb = arg;
 
-	BufPoolRelease(ibh);
+	SET_SKB_FREE(skb);
+	dev_kfree_skb(skb, FREE_READ);
 	newl3state(st, 10);
 	st->pa->chargeinfo = 0;
 	L3DelTimer(&st->l3.timer);
@@ -408,23 +433,20 @@
 }
 
 static void
-l3_1tr6_alert_req(struct PStack *st, byte pr,
-		  void *arg)
+l3_1tr6_alert_req(struct PStack *st, u_char pr, void *arg)
 {
 	newl3state(st, 7);
 	l3_1TR6_message(st, MT_N1_ALERT, PROTO_DIS_N1);
 }
 
 static void
-l3_1tr6_setup_rsp(struct PStack *st, byte pr,
-		  void *arg)
+l3_1tr6_setup_rsp(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *dibh;
-	byte *p;
+	struct sk_buff *skb;
+	u_char tmp[24];
+	u_char *p = tmp;
+	int l;
 
-	BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 20);
-	p = DATAPTR(dibh);
-	p += st->l2.ihsize;
 	MsgHead(p, st->l3.callref, MT_N1_CONN, PROTO_DIS_N1);
 	if (st->pa->spv) {	/* SPV ? */
 		/* NSF SPV */
@@ -442,54 +464,59 @@
 		*p++ = st->pa->setup.si2;
 	}
 	newl3state(st, 8);
-	dibh->datasize = p - DATAPTR(dibh);
-	st->l3.l3l2(st, DL_DATA, dibh);
+	l = p - tmp;
+	if (!(skb = l3_alloc_skb(l)))
+		return;
+	memcpy(skb_put(skb, l), tmp, l);
+	st->l3.l3l2(st, DL_DATA, skb);
 	L3DelTimer(&st->l3.timer);
 	L3AddTimer(&st->l3.timer, st->l3.t313, CC_T313);
 }
 
 static void
-l3_1tr6_reset(struct PStack *st, byte pr, void *arg)
+l3_1tr6_reset(struct PStack *st, u_char pr, void *arg)
 {
 	newl3state(st, 0);
 }
 
 static void
-l3_1tr6_disconnect_req(struct PStack *st, byte pr, void *arg)
+l3_1tr6_disconnect_req(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *dibh;
-	byte *p;
-	byte cause = 0x10;
-	byte clen = 1;
+	struct sk_buff *skb;
+	u_char tmp[16];
+	u_char *p = tmp;
+	int l;
+	u_char cause = 0x10;
+	u_char clen = 1;
 
 	if (st->pa->cause > 0)
 		cause = st->pa->cause;
 	/* Map DSS1 causes */
 	switch (cause & 0x7f) {
-	case 0x10:
-		clen = 0;
-		break;
-	case 0x15:
-		cause = CAUSE_CallRejected;
-		break;
+		case 0x10:
+			clen = 0;
+			break;
+		case 0x15:
+			cause = CAUSE_CallRejected;
+			break;
 	}
 	StopAllL3Timer(st);
-	BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 21);
-	p = DATAPTR(dibh);
-	p += st->l2.ihsize;
 	MsgHead(p, st->l3.callref, MT_N1_DISC, PROTO_DIS_N1);
 	*p++ = WE0_cause;
 	*p++ = clen;		/* Laenge */
 	if (clen)
 		*p++ = cause | 0x80;
-	dibh->datasize = p - DATAPTR(dibh);
 	newl3state(st, 11);
-	st->l3.l3l2(st, DL_DATA, dibh);
+	l = p - tmp;
+	if (!(skb = l3_alloc_skb(l)))
+		return;
+	memcpy(skb_put(skb, l), tmp, l);
+	st->l3.l3l2(st, DL_DATA, skb);
 	L3AddTimer(&st->l3.timer, st->l3.t305, CC_T305);
 }
 
 static void
-l3_1tr6_release_req(struct PStack *st, byte pr, void *arg)
+l3_1tr6_release_req(struct PStack *st, u_char pr, void *arg)
 {
 	StopAllL3Timer(st);
 	newl3state(st, 19);
@@ -498,7 +525,7 @@
 }
 
 static void
-l3_1tr6_t303(struct PStack *st, byte pr, void *arg)
+l3_1tr6_t303(struct PStack *st, u_char pr, void *arg)
 {
 	if (st->l3.n_t303 > 0) {
 		st->l3.n_t303--;
@@ -513,7 +540,7 @@
 }
 
 static void
-l3_1tr6_t304(struct PStack *st, byte pr, void *arg)
+l3_1tr6_t304(struct PStack *st, u_char pr, void *arg)
 {
 	L3DelTimer(&st->l3.timer);
 	st->pa->cause = 0xE6;
@@ -523,41 +550,43 @@
 }
 
 static void
-l3_1tr6_t305(struct PStack *st, byte pr, void *arg)
+l3_1tr6_t305(struct PStack *st, u_char pr, void *arg)
 {
-	struct BufHeader *dibh;
-	byte *p;
-	byte cause = 0x90;
-	byte clen = 1;
+	struct sk_buff *skb;
+	u_char tmp[16];
+	u_char *p = tmp;
+	int l;
+	u_char cause = 0x90;
+	u_char clen = 1;
 
 	L3DelTimer(&st->l3.timer);
 	if (st->pa->cause > 0)
 		cause = st->pa->cause;
 	/* Map DSS1 causes */
 	switch (cause & 0x7f) {
-	case 0x10:
-		clen = 0;
-		break;
-	case 0x15:
-		cause = CAUSE_CallRejected;
-		break;
-	}
-	BufPoolGet(&dibh, st->l1.sbufpool, GFP_ATOMIC, (void *) st, 20);
-	p = DATAPTR(dibh);
-	p += st->l2.ihsize;
+		case 0x10:
+			clen = 0;
+			break;
+		case 0x15:
+			cause = CAUSE_CallRejected;
+			break;
+	}
 	MsgHead(p, st->l3.callref, MT_N1_REL, PROTO_DIS_N1);
 	*p++ = WE0_cause;
 	*p++ = clen;		/* Laenge */
 	if (clen)
 		*p++ = cause;
-	dibh->datasize = p - DATAPTR(dibh);
 	newl3state(st, 19);
-	st->l3.l3l2(st, DL_DATA, dibh);
+	l = p - tmp;
+	if (!(skb = l3_alloc_skb(l)))
+		return;
+	memcpy(skb_put(skb, l), tmp, l);
+	st->l3.l3l2(st, DL_DATA, skb);
 	L3AddTimer(&st->l3.timer, st->l3.t308, CC_T308_1);
 }
 
 static void
-l3_1tr6_t310(struct PStack *st, byte pr, void *arg)
+l3_1tr6_t310(struct PStack *st, u_char pr, void *arg)
 {
 	L3DelTimer(&st->l3.timer);
 	st->pa->cause = 0xE6;
@@ -566,7 +595,7 @@
 }
 
 static void
-l3_1tr6_t313(struct PStack *st, byte pr, void *arg)
+l3_1tr6_t313(struct PStack *st, u_char pr, void *arg)
 {
 	L3DelTimer(&st->l3.timer);
 	st->pa->cause = 0xE6;
@@ -575,7 +604,7 @@
 }
 
 static void
-l3_1tr6_t308_1(struct PStack *st, byte pr, void *arg)
+l3_1tr6_t308_1(struct PStack *st, u_char pr, void *arg)
 {
 	L3DelTimer(&st->l3.timer);
 	l3_1TR6_message(st, MT_N1_REL, PROTO_DIS_N1);
@@ -584,13 +613,13 @@
 }
 
 static void
-l3_1tr6_t308_2(struct PStack *st, byte pr, void *arg)
+l3_1tr6_t308_2(struct PStack *st, u_char pr, void *arg)
 {
 	L3DelTimer(&st->l3.timer);
 	st->l3.l3l4(st, CC_RELEASE_ERR, NULL);
 	newl3state(st, 0);
 }
-
+/* *INDENT-OFF* */
 static struct stateentry downstl[] =
 {
 	{SBIT(0),
@@ -637,8 +666,8 @@
 	 MT_N1_SETUP_ACK, l3_1tr6_setup_ack},
 	{SBIT(1) | SBIT(2),
 	 MT_N1_CALL_SENT, l3_1tr6_call_sent},
-   {SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(10),
-    MT_N1_DISC, l3_1tr6_disc},
+	{SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(10),
+	 MT_N1_DISC, l3_1tr6_disc},
 	{SBIT(2) | SBIT(3) | SBIT(4),
 	 MT_N1_ALERT, l3_1tr6_alert},
 	{SBIT(2) | SBIT(3) | SBIT(4),
@@ -649,70 +678,55 @@
 	 MT_N1_CONN_ACK, l3_1tr6_connect_ack},
 	{SBIT(10),
 	 MT_N1_INFO, l3_1tr6_info},
-   {SBIT(0) | SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) |
-    SBIT(10) | SBIT(11) | SBIT(12) | SBIT(15) | SBIT(17) | SBIT(19),
-    MT_N1_REL, l3_1tr6_rel},
+	{SBIT(0) | SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) |
+	 SBIT(10) | SBIT(11) | SBIT(12) | SBIT(15) | SBIT(17) | SBIT(19),
+	 MT_N1_REL, l3_1tr6_rel},
 	{SBIT(19),
 	 MT_N1_REL_ACK, l3_1tr6_rel_ack}
 };
+/* *INDENT-ON* */
+
 
 
 static int datastln1_len = sizeof(datastln1) /
 sizeof(struct stateentry);
 
 static void
-up1tr6(struct PStack *st,
-       int pr, void *arg)
+up1tr6(struct PStack *st, int pr, void *arg)
 {
-	int i, mt, size;
-	byte *ptr;
-	struct BufHeader *ibh = arg;
+	int i, mt;
+	struct sk_buff *skb = arg;
 	char tmp[80];
 
-	if (pr == DL_DATA) {
-		ptr = DATAPTR(ibh);
-		ptr += st->l2.ihsize;
-		size = ibh->datasize - st->l2.ihsize;
-	} else if (pr == DL_UNIT_DATA) {
-		ptr = DATAPTR(ibh);
-		ptr += st->l2.uihsize;
-		size = ibh->datasize - st->l2.uihsize;
-	} else {
-		if (st->l3.debug & L3_DEB_WARN) {
-			sprintf(tmp, "up1tr6 unknown data typ %d state %d",
-				pr, st->l3.state);
-			l3_debug(st, tmp);
-		}
-		BufPoolRelease(ibh);
-		return;
-	}
-	if ((ptr[0] & 0xfe) != PROTO_DIS_N0) {
+	if ((skb->data[0] & 0xfe) != PROTO_DIS_N0) {
 		if (st->l3.debug & L3_DEB_PROTERR) {
-			sprintf(tmp, "up1tr6%sunexpected discriminator %x message len %d state %d",
+			sprintf(tmp, "up1tr6%sunexpected discriminator %x message len %ld state %d",
 				(pr == DL_DATA) ? " " : "(broadcast) ",
-				ptr[0], size, st->l3.state);
+				skb->data[0], skb->len, st->l3.state);
 			l3_debug(st, tmp);
 		}
-		BufPoolRelease(ibh);
+		SET_SKB_FREE(skb);
+		dev_kfree_skb(skb, FREE_READ);
 		return;
 	}
-	mt = ptr[3];
-
-	if (ptr[0] == PROTO_DIS_N0) {
-		BufPoolRelease(ibh);
+	mt = skb->data[skb->data[1] + 2];
+	if (skb->data[0] == PROTO_DIS_N0) {
+		SET_SKB_FREE(skb);
+		dev_kfree_skb(skb, FREE_READ);
 		if (st->l3.debug & L3_DEB_STATE) {
 			sprintf(tmp, "up1tr6%s N0 state %d mt %x unhandled",
 				(pr == DL_DATA) ? " " : "(broadcast) ",
 				st->l3.state, mt);
 			l3_debug(st, tmp);
 		}
-	} else if (ptr[0] == PROTO_DIS_N1) {
+	} else if (skb->data[0] == PROTO_DIS_N1) {
 		for (i = 0; i < datastln1_len; i++)
 			if ((mt == datastln1[i].primitive) &&
 			    ((1 << st->l3.state) & datastln1[i].state))
 				break;
 		if (i == datastln1_len) {
-			BufPoolRelease(ibh);
+			SET_SKB_FREE(skb);
+			dev_kfree_skb(skb, FREE_READ);
 			if (st->l3.debug & L3_DEB_STATE) {
 				sprintf(tmp, "up1tr6%sstate %d mt %x unhandled",
 				  (pr == DL_DATA) ? " " : "(broadcast) ",
@@ -727,17 +741,15 @@
 					st->l3.state, mt);
 				l3_debug(st, tmp);
 			}
-			datastln1[i].rout(st, pr, ibh);
+			datastln1[i].rout(st, pr, skb);
 		}
 	}
 }
 
 static void
-down1tr6(struct PStack *st,
-	 int pr, void *arg)
+down1tr6(struct PStack *st, int pr, void *arg)
 {
 	int i;
-	struct BufHeader *ibh = arg;
 	char tmp[80];
 
 	for (i = 0; i < downstl_len; i++)
@@ -756,7 +768,7 @@
 				st->l3.state, pr);
 			l3_debug(st, tmp);
 		}
-		downstl[i].rout(st, pr, ibh);
+		downstl[i].rout(st, pr, arg);
 	}
 }
 

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