patch-2.1.20 linux/net/802/cl2llc.pre

Next file: linux/net/802/fddi.c
Previous file: linux/net/802/cl2llc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.19/linux/net/802/cl2llc.pre linux/net/802/cl2llc.pre
@@ -21,6 +21,10 @@
  *	Changes
  *		Alan Cox	:	Chainsawed into Linux format
  *					Modified to use llc_ names
+ *					Changed callbacks
+ *
+ *			Note: TST/XID stuff is broken at the moment. The
+ *			buffer is freed before being passed up.
  *
  *	This file must be processed by sed before it can be compiled.
  */
@@ -97,6 +101,11 @@
 				break;
 			default:
 		}
+		if(lp->llc_callbacks)
+		{
+			lp->llc_event(lp);
+			lp->llc_callbacks=0;
+		}
 		return 0;  
 	}              
 }
@@ -118,6 +127,14 @@
 	{
 		lp->state = D_CONN;
 		llc_interpret_pseudo_code(lp, SH1, NULL, NO_FRAME);
+		if(lp->llc_callbacks)
+		{
+			lp->llc_event(lp);
+			lp->llc_callbacks=0;
+		}
+		/*
+ 		 *	lp may be invalid after the callback
+		 */
 	}
 }
 
@@ -132,6 +149,14 @@
 	{
 		lp->state = SETUP;
 		llc_interpret_pseudo_code(lp, ADM1, NULL, NO_FRAME);
+		if(lp->llc_callbacks)
+		{
+			lp->llc_event(lp);
+			lp->llc_callbacks=0;
+		}
+		/*
+ 		 *	lp may be invalid after the callback
+		 */
 	}
 }
 
@@ -196,53 +221,41 @@
 			case CONNECT_INDICATION:
 				lp->state = NORMAL;  /* needed to eliminate connect_response() */
 				lp->llc_mode = MODE_ABM;
-				if (lp->ops->connect_indication_ep != NULL)
-					lp->ops->connect_indication_ep(lp);
+				lp->llc_callbacks|=LLC_CONN_INDICATION;
 				break;
 			case CONNECT_CONFIRM:
 				lp->llc_mode = MODE_ABM;
-				if (lp->ops->connect_confirm_ep != NULL)
-					lp->ops->connect_confirm_ep(lp);
+				lp->llc_callbacks|=LLC_CONN_CONFIRM;
 				break;
 			case DATA_INDICATION:
-				if (lp->ops->data_indication_ep != NULL)
-				{
-					skb_pull(skb, 4);
-					lp->ops->data_indication_ep(lp, skb);
-				}
+				skb_pull(skb, 4);
+				lp->inc_skb=skb;
+				lp->llc_callbacks|=LLC_DATA_INDIC;
 				break;
 			case DISCONNECT_INDICATION:
 				lp->llc_mode = MODE_ADM;
-				if (lp->ops->disconnect_indication_ep != NULL)
-					lp->ops->disconnect_indication_ep(lp);
+				lp->llc_callbacks|=LLC_DISC_INDICATION;
 				break;
 			case RESET_INDICATION(LOCAL):
-				if (lp->ops->reset_indication_ep != NULL)
-					lp->ops->reset_indication_ep(lp, LOCAL);
+				lp->llc_callbacks|=LLC_RESET_INDIC_LOC;
 				break;
 			case RESET_INDICATION(REMOTE):
-				if (lp->ops->reset_indication_ep != NULL)
-					lp->ops->reset_indication_ep(lp, REMOTE);
+				lp->llc_callbacks|=LLC_RESET_INDIC_REM;
 				break;
 			case RESET_CONFIRM:
-				if (lp->ops->reset_confirm_ep != NULL)
-					lp->ops->reset_confirm_ep(lp, REMOTE);
+				lp->llc_callbacks|=LLC_RST_CONFIRM;
 				break;
 			case REPORT_STATUS(FRMR_RECEIVED):
-				if (lp->ops->report_status_ep != NULL)
-					lp->ops->report_status_ep(lp, FRMR_RECEIVED);
+				lp->llc_callbacks|=LLC_FRMR_RECV;
 				break;
 			case REPORT_STATUS(FRMR_SENT):
-				if (lp->ops->report_status_ep != NULL)
-					lp->ops->report_status_ep(lp, FRMR_SENT);
+				lp->llc_callbacks|=LLC_FRMR_SENT;
 				break;
 			case REPORT_STATUS(REMOTE_BUSY):
-				if (lp->ops->report_status_ep != NULL)
-					lp->ops->report_status_ep(lp, REMOTE_BUSY);
+				lp->llc_callbacks|=LLC_REMOTE_BUSY;
 				break;
 			case REPORT_STATUS(REMOTE_NOT_BUSY):
-				if (lp->ops->report_status_ep != NULL)
-					lp->ops->report_status_ep(lp, REMOTE_NOT_BUSY);
+				lp->llc_callbacks|=LLC_REMOTE_NOTBUSY;
 				break;
 			case SEND_DISC_CMD(P=X):
 				llc_sendpdu(lp, DISC_CMD, lp->f_flag, 0, NULL);
@@ -322,8 +335,7 @@
 				{
 					lp->remote_busy = 1;
 					llc_start_timer(lp, BUSY_TIMER);
-					if (lp->ops->report_status_ep != NULL)
-						lp->ops->report_status_ep(lp, REMOTE_BUSY);
+					lp->llc_callbacks|=LLC_REMOTE_BUSY;
 				}
 				else if (lp->timer_state[BUSY_TIMER] == TIMER_IDLE)
 				{
@@ -559,6 +571,15 @@
 	if (pc_label != NOP)
 	{ 
 		llc_interpret_pseudo_code(lp, pc_label, skb, type);
+		if(lp->llc_callbacks)
+		{
+			lp->llc_event(lp);
+			lp->llc_callbacks=0;
+		}
+		/*
+ 		 *	lp may no longer be valid after this point. Be
+		 *	careful what is added!
+		 */
 	}
 }
 
@@ -585,5 +606,13 @@
 		lp->state = timertr_entry[idx +1];
 	}
 	lp->timer_state[t] = TIMER_IDLE;
+	if(lp->llc_callbacks)
+	{
+		lp->llc_event(lp);
+		lp->llc_callbacks=0;
+	}
+	/*
+ 	 *	And lp may have vanished in the event callback
+ 	 */
 }
 

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