[PATCH] USB ATM: reduce log spamming
authorDuncan Sands <duncan.sands@math.u-psud.fr>
Thu, 26 May 2005 12:32:51 +0000 (14:32 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 27 Jun 2005 21:43:57 +0000 (14:43 -0700)
Reduce the number of "unknown vpi/vci" debug messages to (usually) at most
one per-urb, rather than one per-cell.  This is only an issue when (a) many
packets come in but no connection is open; and (b) CONFIG_USB_DEBUG is set.

Signed-off-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/atm/usbatm.c

index e134e2794486b28b12abe64f06db3f22b95d649b..bb2b5d256e34d3027f185c9f0ff1eaf3a2c59239 100644 (file)
@@ -298,7 +298,6 @@ static void usbatm_extract_cells(struct usbatm_data *instance,
        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 @@ static void usbatm_extract_cells(struct usbatm_data *instance,
 
                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 @@ static void usbatm_extract_cells(struct usbatm_data *instance,
                        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",