Subject: Fix multicast filter overfloe and Add IPv6 MAC support

patch includes [PATCH] ar6003 : 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/include/common/wmi.h
 
kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/include/common/wmi.h
--- 
kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/include/common/wmi.h
    2011-05-27 06:16:59.000000000 +0800
+++ 
kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/include/common/wmi.h
      2011-06-01 16:12:31.929987025 +0800
@@ -2917,7 +2917,7 @@
 #define WOW_PATTERN_SIZE 64
 #define WOW_MASK_SIZE 64
 
-#define MAC_MAX_FILTERS_PER_LIST 4
+#define MAC_MAX_FILTERS_PER_LIST 7
 
 typedef PREPACK struct {
     A_UINT8 wow_valid_filter;
diff -ruN 
kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/include/wmi_api.h 
kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/include/wmi_api.h
--- 
kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/include/wmi_api.h   
    2011-05-27 06:16:59.000000000 +0800
+++ 
kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/include/wmi_api.h
 2011-06-01 16:12:44.154047644 +0800
@@ -313,10 +313,10 @@
 wmi_set_params_cmd(struct wmi_t *wmip, A_UINT32 opcode, A_UINT32 length, 
A_CHAR* buffer);
 
 A_STATUS
-wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, 
A_UINT8 dot3, A_UINT8 dot4);
+wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter);
 
 A_STATUS
-wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, 
A_UINT8 dot3, A_UINT8 dot4);
+wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter);
 
 A_STATUS
 wmi_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 enable);
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_1/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_1/drivers/staging/ar6003/os/linux/ar6000_drv.c
     2011-06-01 18:03:20.434955183 +0800
@@ -4719,7 +4719,7 @@
      */
     for (i=0; i<MAC_MAX_FILTERS_PER_LIST; i++) {
         filter = arPriv->mcast_filters[i];
-        filterValid = (filter[0] || filter[1] || filter[2] || filter[3]);
+        filterValid = (filter[1] || filter[2]);
         if (filterValid) {
             action[i] = DELETE;        } else {
             action[i] = IGNORE;
@@ -4742,7 +4742,7 @@
             if (mcValid) {
                 for (i=0; i<MAC_MAX_FILTERS_PER_LIST; i++) {
                     filter = arPriv->mcast_filters[i];
-                    if ((A_MEMCMP(filter, &mac[2], 
AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) {
+                    if ((A_MEMCMP(filter, &mac[0], 
AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) {
                         action[i] = MATCH;
                         break;
                     }
@@ -4750,7 +4750,20 @@
             }
         }
 
-        /*
+               /*
+                * 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);
+                               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)
@@ -4772,10 +4785,10 @@
                 free = -1;
                 for (i=0; i<MAC_MAX_FILTERS_PER_LIST; i++) {
                     A_UINT8 *filter = arPriv->mcast_filters[i];
-                    if ((A_MEMCMP(filter, &mac[2], 
AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) {
+                                               if ((A_MEMCMP(filter, &mac[0], 
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
                         }
@@ -4783,7 +4796,7 @@
                 }
                 if ((!match) && (free != -1)) {
                     filter = arPriv->mcast_filters[free];
-                    A_MEMCPY(filter, &mac[2], AR_MCAST_FILTER_MAC_ADDR_SIZE);
+                                                A_MEMCPY(filter, &mac[0], 
AR_MCAST_FILTER_MAC_ADDR_SIZE);
                     action[free] = ADD;
                 }
             }
@@ -4793,10 +4806,11 @@
 
     for (i=0; i<MAC_MAX_FILTERS_PER_LIST; i++) {
         if (action[i] == DELETE) {
-            wmi_del_mcast_filter_cmd(arPriv->arWmi, filter[0], filter[1], 
filter[2], filter[3]);
+                         wmi_del_mcast_filter_cmd(arPriv->arWmi, filter);
             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]);
+                         wmi_set_mcast_filter_cmd(arPriv->arWmi, filter);
         }
     }
 
diff -ruN 
kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/include/ar6000_drv.h
 
kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/os/linux/include/ar6000_drv.h
--- 
kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/include/ar6000_drv.h
   2011-05-27 06:17:00.000000000 +0800
+++ 
kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/os/linux/include/ar6000_drv.h
     2011-06-01 16:12:51.330083224 +0800
@@ -707,7 +707,7 @@
     WMI_BTCOEX_CONFIG_EVENT arBtcoexConfig;
     WMI_BTCOEX_STATS_EVENT  arBtcoexStats;
     WMI_GET_WAC_INFO        wacInfo;
-#define AR_MCAST_FILTER_MAC_ADDR_SIZE  4
+#define AR_MCAST_FILTER_MAC_ADDR_SIZE  6
     A_UINT8                 
mcast_filters[MAC_MAX_FILTERS_PER_LIST][AR_MCAST_FILTER_MAC_ADDR_SIZE];
     A_UINT8                 bdaddr[ATH_MAC_LEN];
 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL
diff -ruN 
kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/ioctl.c 
kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/os/linux/ioctl.c
--- 
kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/ioctl.c    
    2011-05-27 06:17:00.000000000 +0800
+++ 
kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/os/linux/ioctl.c
  2011-06-01 18:04:34.795323913 +0800
@@ -3759,10 +3759,7 @@
                         sizeof(cmd))){
                  ret = -EFAULT;
              } else {
-                 if (wmi_set_mcast_filter_cmd(arPriv->arWmi, 
cmd.multicast_mac[0],
-                                                                               
      cmd.multicast_mac[1],
-                                                                               
      cmd.multicast_mac[2],
-                                                                               
      cmd.multicast_mac[3]) != A_OK) {
+                                        if 
(wmi_set_mcast_filter_cmd(arPriv->arWmi, &cmd.multicast_mac[0]) != A_OK) {
                      ret = -EIO;
                }
              }
@@ -3778,10 +3775,7 @@
                         sizeof(cmd))){
                  ret = -EFAULT;
              } else {
-                 if (wmi_del_mcast_filter_cmd(arPriv->arWmi, 
cmd.multicast_mac[0],
-                                                                               
      cmd.multicast_mac[1],
-                                                                               
      cmd.multicast_mac[2],
-                                                                               
      cmd.multicast_mac[3]) != A_OK) {
+                 if (wmi_del_mcast_filter_cmd(arPriv->arWmi, 
&cmd.multicast_mac[0]) != A_OK) {
                      ret = -EIO;
                }
              }
diff -ruN kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/wmi/wmi.c 
kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/wmi/wmi.c
--- kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/wmi/wmi.c       
2011-05-27 06:17:00.000000000 +0800
+++ kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/wmi/wmi.c 
2011-06-01 18:14:53.478391798 +0800
@@ -5763,9 +5763,10 @@
 
 
 A_STATUS
-wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, 
A_UINT8 dot3, A_UINT8 dot4)
+wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter)
 {
     void *osbuf;
+        A_BOOL mcast_ipv6 = FALSE;
     WMI_SET_MCAST_FILTER_CMD *cmd;
 
     osbuf = A_NETBUF_ALLOC(sizeof(*cmd));
@@ -5773,15 +5774,33 @@
         return A_NO_MEMORY;
     }
 
+        if(filter[0] == 0x33 && filter[1] == 0x33) {
+                mcast_ipv6 = TRUE;
+        } else {
+                if(filter[0] == 0x01 && filter[1] == 0x00 
+                               && filter[2] == 0x5e && filter[3] <= 0x7F) {
+                               mcast_ipv6 = FALSE;
+                } else {
+                       return A_BAD_ADDRESS;
+                }
+        }  
+
     A_NETBUF_PUT(osbuf, sizeof(*cmd));
 
     cmd = (WMI_SET_MCAST_FILTER_CMD *)(A_NETBUF_DATA(osbuf));
-    cmd->multicast_mac[0] = 0x01;
-    cmd->multicast_mac[1] = 0x00;
-    cmd->multicast_mac[2] = 0x5e;
-    cmd->multicast_mac[3] = dot2&0x7F;
-    cmd->multicast_mac[4] = dot3;
-    cmd->multicast_mac[5] = dot4;
+        if(mcast_ipv6) {
+                cmd->multicast_mac[0] = 0x33;
+                cmd->multicast_mac[1] = 0x33;
+                cmd->multicast_mac[2] = filter[2];
+                cmd->multicast_mac[3] = filter[3];
+        } else {
+                cmd->multicast_mac[0] = 0x01;
+                cmd->multicast_mac[1] = 0x00;
+                cmd->multicast_mac[2] = 0x5e;
+                cmd->multicast_mac[3] = filter[3]&0x7F;
+        }
+        cmd->multicast_mac[4] = filter[4];
+        cmd->multicast_mac[5] = filter[5];
 
     return (wmi_cmd_send(wmip, osbuf, WMI_SET_MCAST_FILTER_CMDID,
                          NO_SYNC_WMIFLAG));
@@ -5789,9 +5808,10 @@
 
 
 A_STATUS
-wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, 
A_UINT8 dot3, A_UINT8 dot4)
+wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter)
 {
     void *osbuf;
+        A_BOOL mcast_ipv6 = FALSE;
     WMI_SET_MCAST_FILTER_CMD *cmd;
 
     osbuf = A_NETBUF_ALLOC(sizeof(*cmd));
@@ -5799,15 +5819,32 @@
         return A_NO_MEMORY;
     }
 
+        if(filter[0] == 0x33 && filter[1] == 0x33) {
+                mcast_ipv6 = TRUE;
+        } else {
+                if(filter[0] == 0x01 && filter[1] == 0x00 && filter[2] == 0x5e 
&& filter[3] <= 0x7F) {
+                        mcast_ipv6 = FALSE;
+                } else {
+                        return A_BAD_ADDRESS;
+                }
+        }
+
     A_NETBUF_PUT(osbuf, sizeof(*cmd));
 
     cmd = (WMI_SET_MCAST_FILTER_CMD *)(A_NETBUF_DATA(osbuf));
-    cmd->multicast_mac[0] = 0x01;
-    cmd->multicast_mac[1] = 0x00;
-    cmd->multicast_mac[2] = 0x5e;
-    cmd->multicast_mac[3] = dot2&0x7F;
-    cmd->multicast_mac[4] = dot3;
-    cmd->multicast_mac[5] = dot4;
+        if(mcast_ipv6) {
+                cmd->multicast_mac[0] = 0x33;
+                cmd->multicast_mac[1] = 0x33;
+                cmd->multicast_mac[2] = filter[2];
+                cmd->multicast_mac[3] = filter[3];
+        } else {
+                cmd->multicast_mac[0] = 0x01;
+                cmd->multicast_mac[1] = 0x00;
+                cmd->multicast_mac[2] = 0x5e;
+                cmd->multicast_mac[3] = filter[3]&0x7F;
+        }
+        cmd->multicast_mac[4] = filter[4];
+        cmd->multicast_mac[5] = filter[5];
 
     return (wmi_cmd_send(wmip, osbuf, WMI_DEL_MCAST_FILTER_CMDID,
                          NO_SYNC_WMIFLAG));

Subject: Fix multicast filter overfloe and Add IPv6 MAC support

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


diff -ruN kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/include/common/wmi.h kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/include/common/wmi.h
--- kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/include/common/wmi.h	2011-05-27 06:16:59.000000000 +0800
+++ kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/include/common/wmi.h	2011-06-01 16:12:31.929987025 +0800
@@ -2917,7 +2917,7 @@
 #define WOW_PATTERN_SIZE 64
 #define WOW_MASK_SIZE 64
 
-#define MAC_MAX_FILTERS_PER_LIST 4
+#define MAC_MAX_FILTERS_PER_LIST 7
 
 typedef PREPACK struct {
     A_UINT8 wow_valid_filter;
diff -ruN kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/include/wmi_api.h kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/include/wmi_api.h
--- kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/include/wmi_api.h	2011-05-27 06:16:59.000000000 +0800
+++ kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/include/wmi_api.h	2011-06-01 16:12:44.154047644 +0800
@@ -313,10 +313,10 @@
 wmi_set_params_cmd(struct wmi_t *wmip, A_UINT32 opcode, A_UINT32 length, A_CHAR* buffer);
 
 A_STATUS
-wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, A_UINT8 dot3, A_UINT8 dot4);
+wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter);
 
 A_STATUS
-wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, A_UINT8 dot3, A_UINT8 dot4);
+wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter);
 
 A_STATUS
 wmi_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 enable);
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_1/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_1/drivers/staging/ar6003/os/linux/ar6000_drv.c	2011-06-01 18:03:20.434955183 +0800
@@ -4719,7 +4719,7 @@
      */
     for (i=0; i<MAC_MAX_FILTERS_PER_LIST; i++) {
         filter = arPriv->mcast_filters[i];
-        filterValid = (filter[0] || filter[1] || filter[2] || filter[3]);
+        filterValid = (filter[1] || filter[2]);
         if (filterValid) {
             action[i] = DELETE;        } else {
             action[i] = IGNORE;
@@ -4742,7 +4742,7 @@
             if (mcValid) {
                 for (i=0; i<MAC_MAX_FILTERS_PER_LIST; i++) {
                     filter = arPriv->mcast_filters[i];
-                    if ((A_MEMCMP(filter, &mac[2], AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) {
+                    if ((A_MEMCMP(filter, &mac[0], AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) {
                         action[i] = MATCH;
                         break;
                     }
@@ -4750,7 +4750,20 @@
             }
         }
 
-        /*
+		/*
+		 * 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);
+				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)
@@ -4772,10 +4785,10 @@
                 free = -1;
                 for (i=0; i<MAC_MAX_FILTERS_PER_LIST; i++) {
                     A_UINT8 *filter = arPriv->mcast_filters[i];
-                    if ((A_MEMCMP(filter, &mac[2], AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) {
+						if ((A_MEMCMP(filter, &mac[0], 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
                         }
@@ -4783,7 +4796,7 @@
                 }
                 if ((!match) && (free != -1)) {
                     filter = arPriv->mcast_filters[free];
-                    A_MEMCPY(filter, &mac[2], AR_MCAST_FILTER_MAC_ADDR_SIZE);
+						 A_MEMCPY(filter, &mac[0], AR_MCAST_FILTER_MAC_ADDR_SIZE);
                     action[free] = ADD;
                 }
             }
@@ -4793,10 +4806,11 @@
 
     for (i=0; i<MAC_MAX_FILTERS_PER_LIST; i++) {
         if (action[i] == DELETE) {
-            wmi_del_mcast_filter_cmd(arPriv->arWmi, filter[0], filter[1], filter[2], filter[3]);
+			  wmi_del_mcast_filter_cmd(arPriv->arWmi, filter);
             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]);
+			  wmi_set_mcast_filter_cmd(arPriv->arWmi, filter);
         }
     }
 
diff -ruN kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/include/ar6000_drv.h kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/os/linux/include/ar6000_drv.h
--- kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/include/ar6000_drv.h	2011-05-27 06:17:00.000000000 +0800
+++ kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/os/linux/include/ar6000_drv.h	2011-06-01 16:12:51.330083224 +0800
@@ -707,7 +707,7 @@
     WMI_BTCOEX_CONFIG_EVENT arBtcoexConfig;
     WMI_BTCOEX_STATS_EVENT  arBtcoexStats;
     WMI_GET_WAC_INFO        wacInfo;
-#define AR_MCAST_FILTER_MAC_ADDR_SIZE  4
+#define AR_MCAST_FILTER_MAC_ADDR_SIZE  6
     A_UINT8                 mcast_filters[MAC_MAX_FILTERS_PER_LIST][AR_MCAST_FILTER_MAC_ADDR_SIZE];
     A_UINT8                 bdaddr[ATH_MAC_LEN];
 #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL
diff -ruN kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/ioctl.c kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/os/linux/ioctl.c
--- kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/ioctl.c	2011-05-27 06:17:00.000000000 +0800
+++ kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/os/linux/ioctl.c	2011-06-01 18:04:34.795323913 +0800
@@ -3759,10 +3759,7 @@
                         sizeof(cmd))){
                  ret = -EFAULT;
              } else {
-                 if (wmi_set_mcast_filter_cmd(arPriv->arWmi, cmd.multicast_mac[0],
-                                                                                     cmd.multicast_mac[1],
-                                                                                     cmd.multicast_mac[2],
-                                                                                     cmd.multicast_mac[3]) != A_OK) {
+					 if (wmi_set_mcast_filter_cmd(arPriv->arWmi, &cmd.multicast_mac[0]) != A_OK) {
                      ret = -EIO;
                }
              }
@@ -3778,10 +3775,7 @@
                         sizeof(cmd))){
                  ret = -EFAULT;
              } else {
-                 if (wmi_del_mcast_filter_cmd(arPriv->arWmi, cmd.multicast_mac[0],
-                                                                                     cmd.multicast_mac[1],
-                                                                                     cmd.multicast_mac[2],
-                                                                                     cmd.multicast_mac[3]) != A_OK) {
+                 if (wmi_del_mcast_filter_cmd(arPriv->arWmi, &cmd.multicast_mac[0]) != A_OK) {
                      ret = -EIO;
                }
              }
diff -ruN kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/wmi/wmi.c kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/wmi/wmi.c
--- kernel-adaptation-mrst-2.6.37.6-11.5/drivers/staging/ar6003/wmi/wmi.c	2011-05-27 06:17:00.000000000 +0800
+++ kernel-adaptation-mrst-2.6.37.6-11.5_mod_1/drivers/staging/ar6003/wmi/wmi.c	2011-06-01 18:14:53.478391798 +0800
@@ -5763,9 +5763,10 @@
 
 
 A_STATUS
-wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, A_UINT8 dot3, A_UINT8 dot4)
+wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter)
 {
     void *osbuf;
+	 A_BOOL mcast_ipv6 = FALSE;
     WMI_SET_MCAST_FILTER_CMD *cmd;
 
     osbuf = A_NETBUF_ALLOC(sizeof(*cmd));
@@ -5773,15 +5774,33 @@
         return A_NO_MEMORY;
     }
 
+	 if(filter[0] == 0x33 && filter[1] == 0x33) {
+		 mcast_ipv6 = TRUE;
+	 } else {
+		 if(filter[0] == 0x01 && filter[1] == 0x00 
+				&& filter[2] == 0x5e && filter[3] <= 0x7F) {
+				mcast_ipv6 = FALSE;
+		 } else {
+			return A_BAD_ADDRESS;
+		 }
+	 }  
+
     A_NETBUF_PUT(osbuf, sizeof(*cmd));
 
     cmd = (WMI_SET_MCAST_FILTER_CMD *)(A_NETBUF_DATA(osbuf));
-    cmd->multicast_mac[0] = 0x01;
-    cmd->multicast_mac[1] = 0x00;
-    cmd->multicast_mac[2] = 0x5e;
-    cmd->multicast_mac[3] = dot2&0x7F;
-    cmd->multicast_mac[4] = dot3;
-    cmd->multicast_mac[5] = dot4;
+	 if(mcast_ipv6) {
+		 cmd->multicast_mac[0] = 0x33;
+		 cmd->multicast_mac[1] = 0x33;
+		 cmd->multicast_mac[2] = filter[2];
+		 cmd->multicast_mac[3] = filter[3];
+	 } else {
+		 cmd->multicast_mac[0] = 0x01;
+		 cmd->multicast_mac[1] = 0x00;
+		 cmd->multicast_mac[2] = 0x5e;
+		 cmd->multicast_mac[3] = filter[3]&0x7F;
+	 }
+	 cmd->multicast_mac[4] = filter[4];
+	 cmd->multicast_mac[5] = filter[5];
 
     return (wmi_cmd_send(wmip, osbuf, WMI_SET_MCAST_FILTER_CMDID,
                          NO_SYNC_WMIFLAG));
@@ -5789,9 +5808,10 @@
 
 
 A_STATUS
-wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, A_UINT8 dot3, A_UINT8 dot4)
+wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter)
 {
     void *osbuf;
+	 A_BOOL mcast_ipv6 = FALSE;
     WMI_SET_MCAST_FILTER_CMD *cmd;
 
     osbuf = A_NETBUF_ALLOC(sizeof(*cmd));
@@ -5799,15 +5819,32 @@
         return A_NO_MEMORY;
     }
 
+	 if(filter[0] == 0x33 && filter[1] == 0x33) {
+		 mcast_ipv6 = TRUE;
+	 } else {
+		 if(filter[0] == 0x01 && filter[1] == 0x00 && filter[2] == 0x5e && filter[3] <= 0x7F) {
+			 mcast_ipv6 = FALSE;
+		 } else {
+			 return A_BAD_ADDRESS;
+		 }
+	 }
+
     A_NETBUF_PUT(osbuf, sizeof(*cmd));
 
     cmd = (WMI_SET_MCAST_FILTER_CMD *)(A_NETBUF_DATA(osbuf));
-    cmd->multicast_mac[0] = 0x01;
-    cmd->multicast_mac[1] = 0x00;
-    cmd->multicast_mac[2] = 0x5e;
-    cmd->multicast_mac[3] = dot2&0x7F;
-    cmd->multicast_mac[4] = dot3;
-    cmd->multicast_mac[5] = dot4;
+	 if(mcast_ipv6) {
+	 	 cmd->multicast_mac[0] = 0x33;
+		 cmd->multicast_mac[1] = 0x33;
+		 cmd->multicast_mac[2] = filter[2];
+		 cmd->multicast_mac[3] = filter[3];
+	 } else {
+		 cmd->multicast_mac[0] = 0x01;
+		 cmd->multicast_mac[1] = 0x00;
+		 cmd->multicast_mac[2] = 0x5e;
+		 cmd->multicast_mac[3] = filter[3]&0x7F;
+	 }
+	 cmd->multicast_mac[4] = filter[4];
+	 cmd->multicast_mac[5] = filter[5];
 
     return (wmi_cmd_send(wmip, osbuf, WMI_DEL_MCAST_FILTER_CMDID,
                          NO_SYNC_WMIFLAG));
_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to