speedtch usbatm.c,1.19,1.20

Duncan Sands duncan at infradead.org
Tue Apr 26 04:12:54 EDT 2005


Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv25354

Modified Files:
	usbatm.c 
Log Message:
"OAM unsupported" warning patch by Roman Kagan.  I tweaked the types of vpi
and vci.  Maybe we would get better code if they were unsigned...


Index: usbatm.c
===================================================================
RCS file: /home/cvs/speedtch/usbatm.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- usbatm.c	15 Apr 2005 08:49:51 -0000	1.19
+++ usbatm.c	26 Apr 2005 08:12:51 -0000	1.20
@@ -237,18 +237,16 @@
 	struct atm_vcc *vcc;
 	struct sk_buff *sarb;
 	struct usbatm_vcc_data *vcc_data;
-	int cached_vci = 0;
 	unsigned int i;
-	int pti;
-	int vci;
-	short cached_vpi = 0;
-	short vpi;
+	int vci, cached_vci = 0;
+	short vpi, cached_vpi = 0;
+	u8 pti;
 
 	for (i = 0; i < howmany;
 	     i++, source += ATM_CELL_SIZE + instance->rx_padding) {
 		vpi = ((source[0] & 0x0f) << 4) | (source[1] >> 4);
 		vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4);
-		pti = (source[3] & 0x2) != 0;
+		pti = ((source[3] & 0xe) >> 1);
 
 		vdbg("%s: vpi %hd, vci %d, pti %d", __func__, vpi, vci, pti);
 
@@ -264,6 +262,14 @@
 		}
 
 		vcc = vcc_data->vcc;
+
+		/* OAM F5 end-to-end */
+		if (pti == ATM_PTI_E2EF5) {
+			atm_warn(instance, "%s: OAM not supported (vpi %d, vci %d)!\n", __func__, vpi, vci);
+			atomic_inc(&vcc->stats->rx_err);
+			continue;
+		}
+
 		sarb = vcc_data->sarb;
 
 		if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) {
@@ -276,7 +282,7 @@
 		memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD);
 		__skb_put(sarb, ATM_CELL_PAYLOAD);
 
-		if (pti) {
+		if (pti & 1) {
 			struct sk_buff *skb;
 			unsigned int length;
 			unsigned int pdu_length;




More information about the Usbatm-commits mailing list