fix multicast filter overflow

Signed-off-by: Samuel Chang <[email protected]>


diff -ruN 
kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/ar6000_drv.c
 
kernel-adaptation-mrst-2.6.37.6-11.5_mod/drivers/staging/ar6003/os/linux/ar6000_drv.c
--- 
kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/ar6000_drv.c
   2011-05-27 06:17:00.000000000 +0800
+++ 
kernel-adaptation-mrst-2.6.37.6-11.5_mod/drivers/staging/ar6003/os/linux/ar6000_drv.c
       2011-06-01 07:57:04.079716341 +0800
@@ -4751,6 +4751,19 @@
         }

         /*
+         * Delete old entries and free-up space for new additions
+         */
+        for (i = 0; i < MAC_MAX_FILTERS_PER_LIST; i++) {
+            filter = arPriv->mcast_filters[i];
+            if (action[i] == DELETE) {
+                wmi_del_mcast_filter_cmd(arPriv->arWmi, filter[0], filter[1], 
filter[2], filter[3]);
+                A_MEMZERO(filter, AR_MCAST_FILTER_MAC_ADDR_SIZE);
+                /* Make this available for further additions */
+                action[i] = IGNORE;
+            }
+        }
+
+        /*
          *  Pass 3: Add new filters to empty slots
          */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
@@ -4775,7 +4788,7 @@
                     if ((A_MEMCMP(filter, &mac[2], 
AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) {
                         match = TRUE;
                         break;
-                    } else if (action[i] != MATCH) {
+                    } else if (action[i] != MATCH && action[i] != ADD) {
                         if (free == -1) {
                             free = i;   // Mark the first free index
                         }
@@ -4795,6 +4808,7 @@
         if (action[i] == DELETE) {
             wmi_del_mcast_filter_cmd(arPriv->arWmi, filter[0], filter[1], 
filter[2], filter[3]);
             A_MEMZERO(filter, AR_MCAST_FILTER_MAC_ADDR_SIZE);
+            action[i] = IGNORE;
         } else if (action[i] == ADD) {
             wmi_set_mcast_filter_cmd(arPriv->arWmi, filter[0], filter[1], 
filter[2] , filter[3]);
         }
diff -ruN kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/ar6000_drv.c kernel-adaptation-mrst-2.6.37.6-11.5_mod/drivers/staging/ar6003/os/linux/ar6000_drv.c
--- kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/ar6000_drv.c	2011-05-27 06:17:00.000000000 +0800
+++ kernel-adaptation-mrst-2.6.37.6-11.5_mod/drivers/staging/ar6003/os/linux/ar6000_drv.c	2011-06-01 07:57:04.079716341 +0800
@@ -4751,6 +4751,19 @@
         }
 
         /*
+         * Delete old entries and free-up space for new additions
+         */
+        for (i = 0; i < MAC_MAX_FILTERS_PER_LIST; i++) {
+            filter = arPriv->mcast_filters[i];
+            if (action[i] == DELETE) {
+                wmi_del_mcast_filter_cmd(arPriv->arWmi, filter[0], filter[1], filter[2], filter[3]);
+                A_MEMZERO(filter, AR_MCAST_FILTER_MAC_ADDR_SIZE);
+                /* Make this available for further additions */
+                action[i] = IGNORE;
+            }
+        }
+
+        /* 
          *  Pass 3: Add new filters to empty slots
          */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
@@ -4775,7 +4788,7 @@
                     if ((A_MEMCMP(filter, &mac[2], AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) {
                         match = TRUE;
                         break;
-                    } else if (action[i] != MATCH) {
+                    } else if (action[i] != MATCH && action[i] != ADD) {
                         if (free == -1) {
                             free = i;   // Mark the first free index
                         }
@@ -4795,6 +4808,7 @@
         if (action[i] == DELETE) {
             wmi_del_mcast_filter_cmd(arPriv->arWmi, filter[0], filter[1], filter[2], filter[3]);
             A_MEMZERO(filter, AR_MCAST_FILTER_MAC_ADDR_SIZE);
+            action[i] = IGNORE;
         } else if (action[i] == ADD) {
             wmi_set_mcast_filter_cmd(arPriv->arWmi, filter[0], filter[1], filter[2] , filter[3]);
         }
_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to