speedtch usbatm.c,1.44,1.45

Duncan Sands duncan at infradead.org
Fri May 20 09:45:10 EDT 2005


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

Modified Files:
	usbatm.c 
Log Message:
Rate limit the number of "unknown vpi/vci" messages.
At the moment we get one per cell, which completely
spams my system logs if I unplug the modem then plug
it in again while traffic is heavy.  Since this patch
doesn't look like it has anything to do with rate
limiting, here's an explanation: we now only print the
message when the vpi/vci is different to the previous
one (cached_vpi/cached_vci).  So we now always store
vpi/vci in cached_vpi/cached_vci, and use cached_vcc
to determine if these correspond to a real vcc or not.
I got rid of vcc_data since we might as well just use
cached_vcc instead.  This patch might cause trouble if
it is possible to open a vcc with vci and vpi equal to
zero, since right now 0.0 results in NULL vcc, and thus
dropped cells (which is actually correct since 0.0 is
for idle cells which are supposed to be dropped) except
if a cell with vpi!=0 or vci!=0 is seen followed by
vpi==0 and vci==0, in which case we look up 0.0 and
could in theory find a non-null vcc, which we would
send cells to, even though we should be dropping them.
It doesn't seem like a big deal, and I've written to
the ATM list asking them about this.


Index: usbatm.c
===================================================================
RCS file: /home/cvs/speedtch/usbatm.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- usbatm.c	11 May 2005 14:59:39 -0000	1.44
+++ usbatm.c	20 May 2005 13:45:06 -0000	1.45
@@ -216,7 +216,7 @@
 		spin_unlock_irq(&channel->lock);
 		return NULL;
 	}
-	
+
 	urb = list_entry(channel->list.next, struct urb, urb_list);
 	list_del(&urb->urb_list);
 	spin_unlock_irq(&channel->lock);
@@ -298,7 +298,6 @@
 	struct usbatm_vcc_data *cached_vcc = NULL;
 	struct atm_vcc *vcc;
 	struct sk_buff *sarb;
-	struct usbatm_vcc_data *vcc_data;
 	unsigned int stride = instance->rx_channel.stride;
 	int vci, cached_vci = 0;
 	short vpi, cached_vpi = 0;
@@ -311,18 +310,20 @@
 
 		vdbg("%s: vpi %hd, vci %d, pti %d", __func__, vpi, vci, pti);
 
-		if (cached_vcc && (vci == cached_vci) && (vpi == cached_vpi))
-			vcc_data = cached_vcc;
-		else if ((vcc_data = usbatm_find_vcc(instance, vpi, vci))) {
-			cached_vcc = vcc_data;
+		if ((vci != cached_vci) || (vpi != cached_vpi)) {
 			cached_vpi = vpi;
 			cached_vci = vci;
-		} else {
-			atm_dbg(instance, "%s: unknown vpi/vci (%hd/%d)!\n", __func__, vpi, vci);
-			continue;
+
+			cached_vcc = usbatm_find_vcc(instance, vpi, vci);
+
+			if (!cached_vcc)
+				atm_dbg(instance, "%s: unknown vpi/vci (%hd/%d)!\n", __func__, vpi, vci);
 		}
 
-		vcc = vcc_data->vcc;
+		if (!cached_vcc)
+			continue;
+
+		vcc = cached_vcc->vcc;
 
 		/* OAM F5 end-to-end */
 		if (pti == ATM_PTI_E2EF5) {
@@ -331,7 +332,7 @@
 			continue;
 		}
 
-		sarb = vcc_data->sarb;
+		sarb = cached_vcc->sarb;
 
 		if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) {
 			atm_dbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n",




More information about the Usbatm-commits mailing list