Merge tag 'lsk-v3.10-android-15.02'
[firefly-linux-kernel-4.4.55.git] / drivers / net / usb / sr9700.c
index b25eb29805f1fed7ccdac7b19e4ced91016508a1..11281802b52524ab117fab3fc3b0410d094dfc91 100755 (executable)
@@ -9,7 +9,7 @@
  * kind, whether express or implied.
  */
 
-//#define DEBUG
+#define DEBUG
 
 #include <linux/module.h>
 #include <linux/sched.h>
@@ -353,31 +353,31 @@ static const struct ethtool_ops sr9700_android_ethtool_ops = {
 
 static void sr9700_android_set_multicast(struct net_device *net)
 {
-       struct usbnet *dev = netdev_priv(net);
-       /* We use the 20 byte dev->data for our 8 byte filter buffer
-        * to avoid allocating memory that is tricky to free later */
-       u8 *hashes = (u8 *) & dev->data;
-       u8 rx_ctl = 0x31;       // enable, disable_long, disable_crc
-
-       memset(hashes, 0x00, QF_MCAST_SIZE);
-       hashes[QF_MCAST_SIZE - 1] |= 0x80;      /* broadcast address */
-
-       if (net->flags & IFF_PROMISC) {
-               rx_ctl |= 0x02;
-       } else if (net->flags & IFF_ALLMULTI || net->mc_count > QF_MCAST_MAX) {
-               rx_ctl |= 0x04;
-       } else if (net->mc_count) {
-               struct dev_mc_list *mc_list = net->mc_list;
-               int i;
-
-               for (i = 0; i < net->mc_count; i++, mc_list = mc_list->next) {
-                       u32 crc = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26;
-                       hashes[crc >> 3] |= 1 << (crc & 0x7);
-               }
-       }
-
-       qf_write_async(dev, MAR, QF_MCAST_SIZE, hashes);
-       qf_write_reg_async(dev, RCR, rx_ctl);
+        struct usbnet *dev = netdev_priv(net);
+        /* We use the 20 byte dev->data for our 8 byte filter buffer
+         * to avoid allocating memory that is tricky to free later */
+        u8 *hashes = (u8 *) & dev->data;
+        u8 rx_ctl = 0x31;
+
+        memset(hashes, 0x00, QF_MCAST_SIZE);
+        hashes[QF_MCAST_SIZE - 1] |= 0x80;      /* broadcast address */
+
+        if (net->flags & IFF_PROMISC) {
+                rx_ctl |= 0x02;
+        } else if (net->flags & IFF_ALLMULTI ||
+                   netdev_mc_count(net) > QF_MCAST_MAX) {
+                rx_ctl |= 0x04;
+        } else if (!netdev_mc_empty(net)) {
+                struct netdev_hw_addr *ha;
+
+                netdev_for_each_mc_addr(ha, net) {
+                        u32 crc = ether_crc(ETH_ALEN, ha->addr) >> 26;
+                        hashes[crc >> 3] |= 1 << (crc & 0x7);
+                }
+        }
+
+        qf_write_async(dev, MAR, QF_MCAST_SIZE, hashes);
+        qf_write_reg_async(dev, RCR, rx_ctl);
 }
 
 static int sr9700_android_set_mac_address(struct net_device *net, void *p)
@@ -421,7 +421,7 @@ static int sr9700_android_bind(struct usbnet *dev, struct usb_interface *intf)
        dev->net->ethtool_ops = &sr9700_android_ethtool_ops;
        dev->net->hard_header_len += QF_TX_OVERHEAD;
        dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
-       dev->rx_urb_size =4096;// dev->net->mtu + ETH_HLEN + QF_RX_OVERHEAD;
+       dev->rx_urb_size = dev->net->mtu + ETH_HLEN + QF_RX_OVERHEAD;
 
        dev->mii.dev = dev->net;
        dev->mii.mdio_read = sr9700_android_mdio_read;