diff options
Diffstat (limited to 'drivers/net')
114 files changed, 1792 insertions, 1474 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 8b4e96e01d6c..dbbea0eec134 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -846,8 +846,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, | |||
846 | if (bond->dev->flags & IFF_ALLMULTI) | 846 | if (bond->dev->flags & IFF_ALLMULTI) |
847 | dev_set_allmulti(old_active->dev, -1); | 847 | dev_set_allmulti(old_active->dev, -1); |
848 | 848 | ||
849 | netif_addr_lock_bh(bond->dev); | ||
849 | netdev_for_each_mc_addr(ha, bond->dev) | 850 | netdev_for_each_mc_addr(ha, bond->dev) |
850 | dev_mc_del(old_active->dev, ha->addr); | 851 | dev_mc_del(old_active->dev, ha->addr); |
852 | netif_addr_unlock_bh(bond->dev); | ||
851 | } | 853 | } |
852 | 854 | ||
853 | if (new_active) { | 855 | if (new_active) { |
@@ -858,8 +860,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, | |||
858 | if (bond->dev->flags & IFF_ALLMULTI) | 860 | if (bond->dev->flags & IFF_ALLMULTI) |
859 | dev_set_allmulti(new_active->dev, 1); | 861 | dev_set_allmulti(new_active->dev, 1); |
860 | 862 | ||
863 | netif_addr_lock_bh(bond->dev); | ||
861 | netdev_for_each_mc_addr(ha, bond->dev) | 864 | netdev_for_each_mc_addr(ha, bond->dev) |
862 | dev_mc_add(new_active->dev, ha->addr); | 865 | dev_mc_add(new_active->dev, ha->addr); |
866 | netif_addr_unlock_bh(bond->dev); | ||
863 | } | 867 | } |
864 | } | 868 | } |
865 | 869 | ||
@@ -1746,6 +1750,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1746 | 1750 | ||
1747 | bond_compute_features(bond); | 1751 | bond_compute_features(bond); |
1748 | 1752 | ||
1753 | bond_update_speed_duplex(new_slave); | ||
1754 | |||
1749 | read_lock(&bond->lock); | 1755 | read_lock(&bond->lock); |
1750 | 1756 | ||
1751 | new_slave->last_arp_rx = jiffies - | 1757 | new_slave->last_arp_rx = jiffies - |
@@ -1798,8 +1804,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1798 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : | 1804 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : |
1799 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); | 1805 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); |
1800 | 1806 | ||
1801 | bond_update_speed_duplex(new_slave); | ||
1802 | |||
1803 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { | 1807 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { |
1804 | /* if there is a primary slave, remember it */ | 1808 | /* if there is a primary slave, remember it */ |
1805 | if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { | 1809 | if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { |
@@ -1901,11 +1905,29 @@ err_dest_symlinks: | |||
1901 | bond_destroy_slave_symlinks(bond_dev, slave_dev); | 1905 | bond_destroy_slave_symlinks(bond_dev, slave_dev); |
1902 | 1906 | ||
1903 | err_detach: | 1907 | err_detach: |
1908 | if (!USES_PRIMARY(bond->params.mode)) { | ||
1909 | netif_addr_lock_bh(bond_dev); | ||
1910 | bond_mc_list_flush(bond_dev, slave_dev); | ||
1911 | netif_addr_unlock_bh(bond_dev); | ||
1912 | } | ||
1913 | bond_del_vlans_from_slave(bond, slave_dev); | ||
1904 | write_lock_bh(&bond->lock); | 1914 | write_lock_bh(&bond->lock); |
1905 | bond_detach_slave(bond, new_slave); | 1915 | bond_detach_slave(bond, new_slave); |
1916 | if (bond->primary_slave == new_slave) | ||
1917 | bond->primary_slave = NULL; | ||
1906 | write_unlock_bh(&bond->lock); | 1918 | write_unlock_bh(&bond->lock); |
1919 | if (bond->curr_active_slave == new_slave) { | ||
1920 | read_lock(&bond->lock); | ||
1921 | write_lock_bh(&bond->curr_slave_lock); | ||
1922 | bond_change_active_slave(bond, NULL); | ||
1923 | bond_select_active_slave(bond); | ||
1924 | write_unlock_bh(&bond->curr_slave_lock); | ||
1925 | read_unlock(&bond->lock); | ||
1926 | } | ||
1927 | slave_disable_netpoll(new_slave); | ||
1907 | 1928 | ||
1908 | err_close: | 1929 | err_close: |
1930 | slave_dev->priv_flags &= ~IFF_BONDING; | ||
1909 | dev_close(slave_dev); | 1931 | dev_close(slave_dev); |
1910 | 1932 | ||
1911 | err_unset_master: | 1933 | err_unset_master: |
@@ -1976,12 +1998,11 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1976 | return -EINVAL; | 1998 | return -EINVAL; |
1977 | } | 1999 | } |
1978 | 2000 | ||
2001 | write_unlock_bh(&bond->lock); | ||
1979 | /* unregister rx_handler early so bond_handle_frame wouldn't be called | 2002 | /* unregister rx_handler early so bond_handle_frame wouldn't be called |
1980 | * for this slave anymore. | 2003 | * for this slave anymore. |
1981 | */ | 2004 | */ |
1982 | netdev_rx_handler_unregister(slave_dev); | 2005 | netdev_rx_handler_unregister(slave_dev); |
1983 | write_unlock_bh(&bond->lock); | ||
1984 | synchronize_net(); | ||
1985 | write_lock_bh(&bond->lock); | 2006 | write_lock_bh(&bond->lock); |
1986 | 2007 | ||
1987 | if (!all && !bond->params.fail_over_mac) { | 2008 | if (!all && !bond->params.fail_over_mac) { |
@@ -2374,8 +2395,6 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2374 | bond_set_backup_slave(slave); | 2395 | bond_set_backup_slave(slave); |
2375 | } | 2396 | } |
2376 | 2397 | ||
2377 | bond_update_speed_duplex(slave); | ||
2378 | |||
2379 | pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", | 2398 | pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", |
2380 | bond->dev->name, slave->dev->name, | 2399 | bond->dev->name, slave->dev->name, |
2381 | slave->speed, slave->duplex ? "full" : "half"); | 2400 | slave->speed, slave->duplex ? "full" : "half"); |
@@ -3171,11 +3190,20 @@ static int bond_slave_netdev_event(unsigned long event, | |||
3171 | struct net_device *slave_dev) | 3190 | struct net_device *slave_dev) |
3172 | { | 3191 | { |
3173 | struct slave *slave = bond_slave_get_rtnl(slave_dev); | 3192 | struct slave *slave = bond_slave_get_rtnl(slave_dev); |
3174 | struct bonding *bond = slave->bond; | 3193 | struct bonding *bond; |
3175 | struct net_device *bond_dev = slave->bond->dev; | 3194 | struct net_device *bond_dev; |
3176 | u32 old_speed; | 3195 | u32 old_speed; |
3177 | u8 old_duplex; | 3196 | u8 old_duplex; |
3178 | 3197 | ||
3198 | /* A netdev event can be generated while enslaving a device | ||
3199 | * before netdev_rx_handler_register is called in which case | ||
3200 | * slave will be NULL | ||
3201 | */ | ||
3202 | if (!slave) | ||
3203 | return NOTIFY_DONE; | ||
3204 | bond_dev = slave->bond->dev; | ||
3205 | bond = slave->bond; | ||
3206 | |||
3179 | switch (event) { | 3207 | switch (event) { |
3180 | case NETDEV_UNREGISTER: | 3208 | case NETDEV_UNREGISTER: |
3181 | if (bond->setup_by_slave) | 3209 | if (bond->setup_by_slave) |
@@ -3289,20 +3317,22 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count) | |||
3289 | */ | 3317 | */ |
3290 | static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count) | 3318 | static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count) |
3291 | { | 3319 | { |
3292 | struct ethhdr *data = (struct ethhdr *)skb->data; | 3320 | const struct ethhdr *data; |
3293 | struct iphdr *iph; | 3321 | const struct iphdr *iph; |
3294 | struct ipv6hdr *ipv6h; | 3322 | const struct ipv6hdr *ipv6h; |
3295 | u32 v6hash; | 3323 | u32 v6hash; |
3296 | __be32 *s, *d; | 3324 | const __be32 *s, *d; |
3297 | 3325 | ||
3298 | if (skb->protocol == htons(ETH_P_IP) && | 3326 | if (skb->protocol == htons(ETH_P_IP) && |
3299 | skb_network_header_len(skb) >= sizeof(*iph)) { | 3327 | pskb_network_may_pull(skb, sizeof(*iph))) { |
3300 | iph = ip_hdr(skb); | 3328 | iph = ip_hdr(skb); |
3329 | data = (struct ethhdr *)skb->data; | ||
3301 | return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ | 3330 | return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ |
3302 | (data->h_dest[5] ^ data->h_source[5])) % count; | 3331 | (data->h_dest[5] ^ data->h_source[5])) % count; |
3303 | } else if (skb->protocol == htons(ETH_P_IPV6) && | 3332 | } else if (skb->protocol == htons(ETH_P_IPV6) && |
3304 | skb_network_header_len(skb) >= sizeof(*ipv6h)) { | 3333 | pskb_network_may_pull(skb, sizeof(*ipv6h))) { |
3305 | ipv6h = ipv6_hdr(skb); | 3334 | ipv6h = ipv6_hdr(skb); |
3335 | data = (struct ethhdr *)skb->data; | ||
3306 | s = &ipv6h->saddr.s6_addr32[0]; | 3336 | s = &ipv6h->saddr.s6_addr32[0]; |
3307 | d = &ipv6h->daddr.s6_addr32[0]; | 3337 | d = &ipv6h->daddr.s6_addr32[0]; |
3308 | v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]); | 3338 | v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]); |
@@ -3321,33 +3351,36 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count) | |||
3321 | static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count) | 3351 | static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count) |
3322 | { | 3352 | { |
3323 | u32 layer4_xor = 0; | 3353 | u32 layer4_xor = 0; |
3324 | struct iphdr *iph; | 3354 | const struct iphdr *iph; |
3325 | struct ipv6hdr *ipv6h; | 3355 | const struct ipv6hdr *ipv6h; |
3326 | __be32 *s, *d; | 3356 | const __be32 *s, *d; |
3327 | __be16 *layer4hdr; | 3357 | const __be16 *l4 = NULL; |
3358 | __be16 _l4[2]; | ||
3359 | int noff = skb_network_offset(skb); | ||
3360 | int poff; | ||
3328 | 3361 | ||
3329 | if (skb->protocol == htons(ETH_P_IP) && | 3362 | if (skb->protocol == htons(ETH_P_IP) && |
3330 | skb_network_header_len(skb) >= sizeof(*iph)) { | 3363 | pskb_may_pull(skb, noff + sizeof(*iph))) { |
3331 | iph = ip_hdr(skb); | 3364 | iph = ip_hdr(skb); |
3332 | if (!ip_is_fragment(iph) && | 3365 | poff = proto_ports_offset(iph->protocol); |
3333 | (iph->protocol == IPPROTO_TCP || | 3366 | |
3334 | iph->protocol == IPPROTO_UDP) && | 3367 | if (!ip_is_fragment(iph) && poff >= 0) { |
3335 | (skb_headlen(skb) - skb_network_offset(skb) >= | 3368 | l4 = skb_header_pointer(skb, noff + (iph->ihl << 2) + poff, |
3336 | iph->ihl * sizeof(u32) + sizeof(*layer4hdr) * 2)) { | 3369 | sizeof(_l4), &_l4); |
3337 | layer4hdr = (__be16 *)((u32 *)iph + iph->ihl); | 3370 | if (l4) |
3338 | layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1)); | 3371 | layer4_xor = ntohs(l4[0] ^ l4[1]); |
3339 | } | 3372 | } |
3340 | return (layer4_xor ^ | 3373 | return (layer4_xor ^ |
3341 | ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count; | 3374 | ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count; |
3342 | } else if (skb->protocol == htons(ETH_P_IPV6) && | 3375 | } else if (skb->protocol == htons(ETH_P_IPV6) && |
3343 | skb_network_header_len(skb) >= sizeof(*ipv6h)) { | 3376 | pskb_may_pull(skb, noff + sizeof(*ipv6h))) { |
3344 | ipv6h = ipv6_hdr(skb); | 3377 | ipv6h = ipv6_hdr(skb); |
3345 | if ((ipv6h->nexthdr == IPPROTO_TCP || | 3378 | poff = proto_ports_offset(ipv6h->nexthdr); |
3346 | ipv6h->nexthdr == IPPROTO_UDP) && | 3379 | if (poff >= 0) { |
3347 | (skb_headlen(skb) - skb_network_offset(skb) >= | 3380 | l4 = skb_header_pointer(skb, noff + sizeof(*ipv6h) + poff, |
3348 | sizeof(*ipv6h) + sizeof(*layer4hdr) * 2)) { | 3381 | sizeof(_l4), &_l4); |
3349 | layer4hdr = (__be16 *)(ipv6h + 1); | 3382 | if (l4) |
3350 | layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1)); | 3383 | layer4_xor = ntohs(l4[0] ^ l4[1]); |
3351 | } | 3384 | } |
3352 | s = &ipv6h->saddr.s6_addr32[0]; | 3385 | s = &ipv6h->saddr.s6_addr32[0]; |
3353 | d = &ipv6h->daddr.s6_addr32[0]; | 3386 | d = &ipv6h->daddr.s6_addr32[0]; |
@@ -4849,9 +4882,18 @@ static int __net_init bond_net_init(struct net *net) | |||
4849 | static void __net_exit bond_net_exit(struct net *net) | 4882 | static void __net_exit bond_net_exit(struct net *net) |
4850 | { | 4883 | { |
4851 | struct bond_net *bn = net_generic(net, bond_net_id); | 4884 | struct bond_net *bn = net_generic(net, bond_net_id); |
4885 | struct bonding *bond, *tmp_bond; | ||
4886 | LIST_HEAD(list); | ||
4852 | 4887 | ||
4853 | bond_destroy_sysfs(bn); | 4888 | bond_destroy_sysfs(bn); |
4854 | bond_destroy_proc_dir(bn); | 4889 | bond_destroy_proc_dir(bn); |
4890 | |||
4891 | /* Kill off any bonds created after unregistering bond rtnl ops */ | ||
4892 | rtnl_lock(); | ||
4893 | list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list) | ||
4894 | unregister_netdevice_queue(bond->dev, &list); | ||
4895 | unregister_netdevice_many(&list); | ||
4896 | rtnl_unlock(); | ||
4855 | } | 4897 | } |
4856 | 4898 | ||
4857 | static struct pernet_operations bond_net_ops = { | 4899 | static struct pernet_operations bond_net_ops = { |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 1c9e09fbdff8..ea7a388f4843 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -183,6 +183,11 @@ int bond_create_slave_symlinks(struct net_device *master, | |||
183 | sprintf(linkname, "slave_%s", slave->name); | 183 | sprintf(linkname, "slave_%s", slave->name); |
184 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), | 184 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), |
185 | linkname); | 185 | linkname); |
186 | |||
187 | /* free the master link created earlier in case of error */ | ||
188 | if (ret) | ||
189 | sysfs_remove_link(&(slave->dev.kobj), "master"); | ||
190 | |||
186 | return ret; | 191 | return ret; |
187 | 192 | ||
188 | } | 193 | } |
@@ -522,7 +527,7 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
522 | goto out; | 527 | goto out; |
523 | } | 528 | } |
524 | if (new_value < 0) { | 529 | if (new_value < 0) { |
525 | pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", | 530 | pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n", |
526 | bond->dev->name, new_value, INT_MAX); | 531 | bond->dev->name, new_value, INT_MAX); |
527 | ret = -EINVAL; | 532 | ret = -EINVAL; |
528 | goto out; | 533 | goto out; |
@@ -537,14 +542,15 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
537 | pr_info("%s: Setting ARP monitoring interval to %d.\n", | 542 | pr_info("%s: Setting ARP monitoring interval to %d.\n", |
538 | bond->dev->name, new_value); | 543 | bond->dev->name, new_value); |
539 | bond->params.arp_interval = new_value; | 544 | bond->params.arp_interval = new_value; |
540 | if (bond->params.miimon) { | 545 | if (new_value) { |
541 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", | 546 | if (bond->params.miimon) { |
542 | bond->dev->name, bond->dev->name); | 547 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", |
543 | bond->params.miimon = 0; | 548 | bond->dev->name, bond->dev->name); |
544 | } | 549 | bond->params.miimon = 0; |
545 | if (!bond->params.arp_targets[0]) { | 550 | } |
546 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", | 551 | if (!bond->params.arp_targets[0]) |
547 | bond->dev->name); | 552 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", |
553 | bond->dev->name); | ||
548 | } | 554 | } |
549 | if (bond->dev->flags & IFF_UP) { | 555 | if (bond->dev->flags & IFF_UP) { |
550 | /* If the interface is up, we may need to fire off | 556 | /* If the interface is up, we may need to fire off |
@@ -552,10 +558,13 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
552 | * timer will get fired off when the open function | 558 | * timer will get fired off when the open function |
553 | * is called. | 559 | * is called. |
554 | */ | 560 | */ |
555 | cancel_delayed_work_sync(&bond->mii_work); | 561 | if (!new_value) { |
556 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | 562 | cancel_delayed_work_sync(&bond->arp_work); |
563 | } else { | ||
564 | cancel_delayed_work_sync(&bond->mii_work); | ||
565 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | ||
566 | } | ||
557 | } | 567 | } |
558 | |||
559 | out: | 568 | out: |
560 | rtnl_unlock(); | 569 | rtnl_unlock(); |
561 | return ret; | 570 | return ret; |
@@ -697,7 +706,7 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
697 | } | 706 | } |
698 | if (new_value < 0) { | 707 | if (new_value < 0) { |
699 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 708 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
700 | bond->dev->name, new_value, 1, INT_MAX); | 709 | bond->dev->name, new_value, 0, INT_MAX); |
701 | ret = -EINVAL; | 710 | ret = -EINVAL; |
702 | goto out; | 711 | goto out; |
703 | } else { | 712 | } else { |
@@ -752,8 +761,8 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
752 | goto out; | 761 | goto out; |
753 | } | 762 | } |
754 | if (new_value < 0) { | 763 | if (new_value < 0) { |
755 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 764 | pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n", |
756 | bond->dev->name, new_value, 1, INT_MAX); | 765 | bond->dev->name, new_value, 0, INT_MAX); |
757 | ret = -EINVAL; | 766 | ret = -EINVAL; |
758 | goto out; | 767 | goto out; |
759 | } else { | 768 | } else { |
@@ -963,37 +972,37 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
963 | } | 972 | } |
964 | if (new_value < 0) { | 973 | if (new_value < 0) { |
965 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", | 974 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", |
966 | bond->dev->name, new_value, 1, INT_MAX); | 975 | bond->dev->name, new_value, 0, INT_MAX); |
967 | ret = -EINVAL; | 976 | ret = -EINVAL; |
968 | goto out; | 977 | goto out; |
969 | } else { | 978 | } |
970 | pr_info("%s: Setting MII monitoring interval to %d.\n", | 979 | pr_info("%s: Setting MII monitoring interval to %d.\n", |
971 | bond->dev->name, new_value); | 980 | bond->dev->name, new_value); |
972 | bond->params.miimon = new_value; | 981 | bond->params.miimon = new_value; |
973 | if (bond->params.updelay) | 982 | if (bond->params.updelay) |
974 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", | 983 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", |
975 | bond->dev->name, | 984 | bond->dev->name, |
976 | bond->params.updelay * bond->params.miimon); | 985 | bond->params.updelay * bond->params.miimon); |
977 | if (bond->params.downdelay) | 986 | if (bond->params.downdelay) |
978 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", | 987 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", |
979 | bond->dev->name, | 988 | bond->dev->name, |
980 | bond->params.downdelay * bond->params.miimon); | 989 | bond->params.downdelay * bond->params.miimon); |
981 | if (bond->params.arp_interval) { | 990 | if (new_value && bond->params.arp_interval) { |
982 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", | 991 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", |
983 | bond->dev->name); | 992 | bond->dev->name); |
984 | bond->params.arp_interval = 0; | 993 | bond->params.arp_interval = 0; |
985 | if (bond->params.arp_validate) { | 994 | if (bond->params.arp_validate) |
986 | bond->params.arp_validate = | 995 | bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; |
987 | BOND_ARP_VALIDATE_NONE; | 996 | } |
988 | } | 997 | if (bond->dev->flags & IFF_UP) { |
989 | } | 998 | /* If the interface is up, we may need to fire off |
990 | 999 | * the MII timer. If the interface is down, the | |
991 | if (bond->dev->flags & IFF_UP) { | 1000 | * timer will get fired off when the open function |
992 | /* If the interface is up, we may need to fire off | 1001 | * is called. |
993 | * the MII timer. If the interface is down, the | 1002 | */ |
994 | * timer will get fired off when the open function | 1003 | if (!new_value) { |
995 | * is called. | 1004 | cancel_delayed_work_sync(&bond->mii_work); |
996 | */ | 1005 | } else { |
997 | cancel_delayed_work_sync(&bond->arp_work); | 1006 | cancel_delayed_work_sync(&bond->arp_work); |
998 | queue_delayed_work(bond->wq, &bond->mii_work, 0); | 1007 | queue_delayed_work(bond->wq, &bond->mii_work, 0); |
999 | } | 1008 | } |
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index f32b9fc6a983..9aa0c64c33c8 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -929,6 +929,7 @@ static int mcp251x_open(struct net_device *net) | |||
929 | struct mcp251x_priv *priv = netdev_priv(net); | 929 | struct mcp251x_priv *priv = netdev_priv(net); |
930 | struct spi_device *spi = priv->spi; | 930 | struct spi_device *spi = priv->spi; |
931 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; | 931 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; |
932 | unsigned long flags; | ||
932 | int ret; | 933 | int ret; |
933 | 934 | ||
934 | ret = open_candev(net); | 935 | ret = open_candev(net); |
@@ -945,9 +946,14 @@ static int mcp251x_open(struct net_device *net) | |||
945 | priv->tx_skb = NULL; | 946 | priv->tx_skb = NULL; |
946 | priv->tx_len = 0; | 947 | priv->tx_len = 0; |
947 | 948 | ||
949 | flags = IRQF_ONESHOT; | ||
950 | if (pdata->irq_flags) | ||
951 | flags |= pdata->irq_flags; | ||
952 | else | ||
953 | flags |= IRQF_TRIGGER_FALLING; | ||
954 | |||
948 | ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, | 955 | ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, |
949 | pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING, | 956 | flags, DEVICE_NAME, priv); |
950 | DEVICE_NAME, priv); | ||
951 | if (ret) { | 957 | if (ret) { |
952 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); | 958 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); |
953 | if (pdata->transceiver_enable) | 959 | if (pdata->transceiver_enable) |
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig index b39ca5b3ea7f..ff2ba86cd4a4 100644 --- a/drivers/net/can/sja1000/Kconfig +++ b/drivers/net/can/sja1000/Kconfig | |||
@@ -46,6 +46,7 @@ config CAN_EMS_PCI | |||
46 | config CAN_PEAK_PCMCIA | 46 | config CAN_PEAK_PCMCIA |
47 | tristate "PEAK PCAN-PC Card" | 47 | tristate "PEAK PCAN-PC Card" |
48 | depends on PCMCIA | 48 | depends on PCMCIA |
49 | depends on HAS_IOPORT | ||
49 | ---help--- | 50 | ---help--- |
50 | This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels) | 51 | This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels) |
51 | from PEAK-System (http://www.peak-system.com). To compile this | 52 | from PEAK-System (http://www.peak-system.com). To compile this |
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c index a042cdc260dc..3c18d7d000ed 100644 --- a/drivers/net/can/sja1000/plx_pci.c +++ b/drivers/net/can/sja1000/plx_pci.c | |||
@@ -348,7 +348,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv) | |||
348 | */ | 348 | */ |
349 | if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) == | 349 | if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) == |
350 | REG_CR_BASICCAN_INITIAL && | 350 | REG_CR_BASICCAN_INITIAL && |
351 | (priv->read_reg(priv, REG_SR) == REG_SR_BASICCAN_INITIAL) && | 351 | (priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_BASICCAN_INITIAL) && |
352 | (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL)) | 352 | (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL)) |
353 | flag = 1; | 353 | flag = 1; |
354 | 354 | ||
@@ -360,7 +360,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv) | |||
360 | * See states on p. 23 of the Datasheet. | 360 | * See states on p. 23 of the Datasheet. |
361 | */ | 361 | */ |
362 | if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL && | 362 | if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL && |
363 | priv->read_reg(priv, REG_SR) == REG_SR_PELICAN_INITIAL && | 363 | priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_PELICAN_INITIAL && |
364 | priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL) | 364 | priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL) |
365 | return flag; | 365 | return flag; |
366 | 366 | ||
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index daf4013a8fc7..e4df307eaa90 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -92,7 +92,7 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val) | |||
92 | */ | 92 | */ |
93 | spin_lock_irqsave(&priv->cmdreg_lock, flags); | 93 | spin_lock_irqsave(&priv->cmdreg_lock, flags); |
94 | priv->write_reg(priv, REG_CMR, val); | 94 | priv->write_reg(priv, REG_CMR, val); |
95 | priv->read_reg(priv, REG_SR); | 95 | priv->read_reg(priv, SJA1000_REG_SR); |
96 | spin_unlock_irqrestore(&priv->cmdreg_lock, flags); | 96 | spin_unlock_irqrestore(&priv->cmdreg_lock, flags); |
97 | } | 97 | } |
98 | 98 | ||
@@ -502,7 +502,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
502 | 502 | ||
503 | while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { | 503 | while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { |
504 | n++; | 504 | n++; |
505 | status = priv->read_reg(priv, REG_SR); | 505 | status = priv->read_reg(priv, SJA1000_REG_SR); |
506 | /* check for absent controller due to hw unplug */ | 506 | /* check for absent controller due to hw unplug */ |
507 | if (status == 0xFF && sja1000_is_absent(priv)) | 507 | if (status == 0xFF && sja1000_is_absent(priv)) |
508 | return IRQ_NONE; | 508 | return IRQ_NONE; |
@@ -530,7 +530,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
530 | /* receive interrupt */ | 530 | /* receive interrupt */ |
531 | while (status & SR_RBS) { | 531 | while (status & SR_RBS) { |
532 | sja1000_rx(dev); | 532 | sja1000_rx(dev); |
533 | status = priv->read_reg(priv, REG_SR); | 533 | status = priv->read_reg(priv, SJA1000_REG_SR); |
534 | /* check for absent controller */ | 534 | /* check for absent controller */ |
535 | if (status == 0xFF && sja1000_is_absent(priv)) | 535 | if (status == 0xFF && sja1000_is_absent(priv)) |
536 | return IRQ_NONE; | 536 | return IRQ_NONE; |
diff --git a/drivers/net/can/sja1000/sja1000.h b/drivers/net/can/sja1000/sja1000.h index afa99847a510..aa48e053da27 100644 --- a/drivers/net/can/sja1000/sja1000.h +++ b/drivers/net/can/sja1000/sja1000.h | |||
@@ -56,7 +56,7 @@ | |||
56 | /* SJA1000 registers - manual section 6.4 (Pelican Mode) */ | 56 | /* SJA1000 registers - manual section 6.4 (Pelican Mode) */ |
57 | #define REG_MOD 0x00 | 57 | #define REG_MOD 0x00 |
58 | #define REG_CMR 0x01 | 58 | #define REG_CMR 0x01 |
59 | #define REG_SR 0x02 | 59 | #define SJA1000_REG_SR 0x02 |
60 | #define REG_IR 0x03 | 60 | #define REG_IR 0x03 |
61 | #define REG_IER 0x04 | 61 | #define REG_IER 0x04 |
62 | #define REG_ALC 0x0B | 62 | #define REG_ALC 0x0B |
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c index 6433b81256cd..8e0c4a001939 100644 --- a/drivers/net/can/sja1000/sja1000_of_platform.c +++ b/drivers/net/can/sja1000/sja1000_of_platform.c | |||
@@ -96,8 +96,8 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) | |||
96 | struct net_device *dev; | 96 | struct net_device *dev; |
97 | struct sja1000_priv *priv; | 97 | struct sja1000_priv *priv; |
98 | struct resource res; | 98 | struct resource res; |
99 | const u32 *prop; | 99 | u32 prop; |
100 | int err, irq, res_size, prop_size; | 100 | int err, irq, res_size; |
101 | void __iomem *base; | 101 | void __iomem *base; |
102 | 102 | ||
103 | err = of_address_to_resource(np, 0, &res); | 103 | err = of_address_to_resource(np, 0, &res); |
@@ -138,27 +138,27 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) | |||
138 | priv->read_reg = sja1000_ofp_read_reg; | 138 | priv->read_reg = sja1000_ofp_read_reg; |
139 | priv->write_reg = sja1000_ofp_write_reg; | 139 | priv->write_reg = sja1000_ofp_write_reg; |
140 | 140 | ||
141 | prop = of_get_property(np, "nxp,external-clock-frequency", &prop_size); | 141 | err = of_property_read_u32(np, "nxp,external-clock-frequency", &prop); |
142 | if (prop && (prop_size == sizeof(u32))) | 142 | if (!err) |
143 | priv->can.clock.freq = *prop / 2; | 143 | priv->can.clock.freq = prop / 2; |
144 | else | 144 | else |
145 | priv->can.clock.freq = SJA1000_OFP_CAN_CLOCK; /* default */ | 145 | priv->can.clock.freq = SJA1000_OFP_CAN_CLOCK; /* default */ |
146 | 146 | ||
147 | prop = of_get_property(np, "nxp,tx-output-mode", &prop_size); | 147 | err = of_property_read_u32(np, "nxp,tx-output-mode", &prop); |
148 | if (prop && (prop_size == sizeof(u32))) | 148 | if (!err) |
149 | priv->ocr |= *prop & OCR_MODE_MASK; | 149 | priv->ocr |= prop & OCR_MODE_MASK; |
150 | else | 150 | else |
151 | priv->ocr |= OCR_MODE_NORMAL; /* default */ | 151 | priv->ocr |= OCR_MODE_NORMAL; /* default */ |
152 | 152 | ||
153 | prop = of_get_property(np, "nxp,tx-output-config", &prop_size); | 153 | err = of_property_read_u32(np, "nxp,tx-output-config", &prop); |
154 | if (prop && (prop_size == sizeof(u32))) | 154 | if (!err) |
155 | priv->ocr |= (*prop << OCR_TX_SHIFT) & OCR_TX_MASK; | 155 | priv->ocr |= (prop << OCR_TX_SHIFT) & OCR_TX_MASK; |
156 | else | 156 | else |
157 | priv->ocr |= OCR_TX0_PULLDOWN; /* default */ | 157 | priv->ocr |= OCR_TX0_PULLDOWN; /* default */ |
158 | 158 | ||
159 | prop = of_get_property(np, "nxp,clock-out-frequency", &prop_size); | 159 | err = of_property_read_u32(np, "nxp,clock-out-frequency", &prop); |
160 | if (prop && (prop_size == sizeof(u32)) && *prop) { | 160 | if (!err && prop) { |
161 | u32 divider = priv->can.clock.freq * 2 / *prop; | 161 | u32 divider = priv->can.clock.freq * 2 / prop; |
162 | 162 | ||
163 | if (divider > 1) | 163 | if (divider > 1) |
164 | priv->cdr |= divider / 2 - 1; | 164 | priv->cdr |= divider / 2 - 1; |
@@ -168,8 +168,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) | |||
168 | priv->cdr |= CDR_CLK_OFF; /* default */ | 168 | priv->cdr |= CDR_CLK_OFF; /* default */ |
169 | } | 169 | } |
170 | 170 | ||
171 | prop = of_get_property(np, "nxp,no-comparator-bypass", NULL); | 171 | if (!of_property_read_bool(np, "nxp,no-comparator-bypass")) |
172 | if (!prop) | ||
173 | priv->cdr |= CDR_CBP; /* default */ | 172 | priv->cdr |= CDR_CBP; /* default */ |
174 | 173 | ||
175 | priv->irq_flags = IRQF_SHARED; | 174 | priv->irq_flags = IRQF_SHARED; |
diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index cab306a9888e..e1d26433d619 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c | |||
@@ -828,7 +828,7 @@ static int ax_probe(struct platform_device *pdev) | |||
828 | struct ei_device *ei_local; | 828 | struct ei_device *ei_local; |
829 | struct ax_device *ax; | 829 | struct ax_device *ax; |
830 | struct resource *irq, *mem, *mem2; | 830 | struct resource *irq, *mem, *mem2; |
831 | resource_size_t mem_size, mem2_size = 0; | 831 | unsigned long mem_size, mem2_size = 0; |
832 | int ret = 0; | 832 | int ret = 0; |
833 | 833 | ||
834 | dev = ax__alloc_ei_netdev(sizeof(struct ax_device)); | 834 | dev = ax__alloc_ei_netdev(sizeof(struct ax_device)); |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e.h b/drivers/net/ethernet/atheros/atl1e/atl1e.h index 829b5ad71d0d..b5fd934585e9 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e.h +++ b/drivers/net/ethernet/atheros/atl1e/atl1e.h | |||
@@ -186,7 +186,7 @@ struct atl1e_tpd_desc { | |||
186 | /* how about 0x2000 */ | 186 | /* how about 0x2000 */ |
187 | #define MAX_TX_BUF_LEN 0x2000 | 187 | #define MAX_TX_BUF_LEN 0x2000 |
188 | #define MAX_TX_BUF_SHIFT 13 | 188 | #define MAX_TX_BUF_SHIFT 13 |
189 | /*#define MAX_TX_BUF_LEN 0x3000 */ | 189 | #define MAX_TSO_SEG_SIZE 0x3c00 |
190 | 190 | ||
191 | /* rrs word 1 bit 0:31 */ | 191 | /* rrs word 1 bit 0:31 */ |
192 | #define RRS_RX_CSUM_MASK 0xFFFF | 192 | #define RRS_RX_CSUM_MASK 0xFFFF |
@@ -438,7 +438,6 @@ struct atl1e_adapter { | |||
438 | struct atl1e_hw hw; | 438 | struct atl1e_hw hw; |
439 | struct atl1e_hw_stats hw_stats; | 439 | struct atl1e_hw_stats hw_stats; |
440 | 440 | ||
441 | bool have_msi; | ||
442 | u32 wol; | 441 | u32 wol; |
443 | u16 link_speed; | 442 | u16 link_speed; |
444 | u16 link_duplex; | 443 | u16 link_duplex; |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 92f4734f860d..ac25f05ff68f 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c | |||
@@ -1849,34 +1849,19 @@ static void atl1e_free_irq(struct atl1e_adapter *adapter) | |||
1849 | struct net_device *netdev = adapter->netdev; | 1849 | struct net_device *netdev = adapter->netdev; |
1850 | 1850 | ||
1851 | free_irq(adapter->pdev->irq, netdev); | 1851 | free_irq(adapter->pdev->irq, netdev); |
1852 | |||
1853 | if (adapter->have_msi) | ||
1854 | pci_disable_msi(adapter->pdev); | ||
1855 | } | 1852 | } |
1856 | 1853 | ||
1857 | static int atl1e_request_irq(struct atl1e_adapter *adapter) | 1854 | static int atl1e_request_irq(struct atl1e_adapter *adapter) |
1858 | { | 1855 | { |
1859 | struct pci_dev *pdev = adapter->pdev; | 1856 | struct pci_dev *pdev = adapter->pdev; |
1860 | struct net_device *netdev = adapter->netdev; | 1857 | struct net_device *netdev = adapter->netdev; |
1861 | int flags = 0; | ||
1862 | int err = 0; | 1858 | int err = 0; |
1863 | 1859 | ||
1864 | adapter->have_msi = true; | 1860 | err = request_irq(pdev->irq, atl1e_intr, IRQF_SHARED, netdev->name, |
1865 | err = pci_enable_msi(pdev); | 1861 | netdev); |
1866 | if (err) { | ||
1867 | netdev_dbg(netdev, | ||
1868 | "Unable to allocate MSI interrupt Error: %d\n", err); | ||
1869 | adapter->have_msi = false; | ||
1870 | } | ||
1871 | |||
1872 | if (!adapter->have_msi) | ||
1873 | flags |= IRQF_SHARED; | ||
1874 | err = request_irq(pdev->irq, atl1e_intr, flags, netdev->name, netdev); | ||
1875 | if (err) { | 1862 | if (err) { |
1876 | netdev_dbg(adapter->netdev, | 1863 | netdev_dbg(adapter->netdev, |
1877 | "Unable to allocate interrupt Error: %d\n", err); | 1864 | "Unable to allocate interrupt Error: %d\n", err); |
1878 | if (adapter->have_msi) | ||
1879 | pci_disable_msi(pdev); | ||
1880 | return err; | 1865 | return err; |
1881 | } | 1866 | } |
1882 | netdev_dbg(netdev, "atl1e_request_irq OK\n"); | 1867 | netdev_dbg(netdev, "atl1e_request_irq OK\n"); |
@@ -2344,6 +2329,7 @@ static int atl1e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2344 | 2329 | ||
2345 | INIT_WORK(&adapter->reset_task, atl1e_reset_task); | 2330 | INIT_WORK(&adapter->reset_task, atl1e_reset_task); |
2346 | INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); | 2331 | INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); |
2332 | netif_set_gso_max_size(netdev, MAX_TSO_SEG_SIZE); | ||
2347 | err = register_netdev(netdev); | 2333 | err = register_netdev(netdev); |
2348 | if (err) { | 2334 | if (err) { |
2349 | netdev_err(netdev, "register netdevice failed\n"); | 2335 | netdev_err(netdev, "register netdevice failed\n"); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index a923bc4d5a1f..57619dd4a92b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -2614,6 +2614,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
2614 | } | 2614 | } |
2615 | } | 2615 | } |
2616 | 2616 | ||
2617 | /* initialize FW coalescing state machines in RAM */ | ||
2618 | bnx2x_update_coalesce(bp); | ||
2619 | |||
2617 | /* setup the leading queue */ | 2620 | /* setup the leading queue */ |
2618 | rc = bnx2x_setup_leading(bp); | 2621 | rc = bnx2x_setup_leading(bp); |
2619 | if (rc) { | 2622 | if (rc) { |
@@ -2760,6 +2763,7 @@ load_error2: | |||
2760 | bp->port.pmf = 0; | 2763 | bp->port.pmf = 0; |
2761 | load_error1: | 2764 | load_error1: |
2762 | bnx2x_napi_disable(bp); | 2765 | bnx2x_napi_disable(bp); |
2766 | bnx2x_del_all_napi(bp); | ||
2763 | 2767 | ||
2764 | /* clear pf_load status, as it was already set */ | 2768 | /* clear pf_load status, as it was already set */ |
2765 | if (IS_PF(bp)) | 2769 | if (IS_PF(bp)) |
@@ -4579,11 +4583,11 @@ static void storm_memset_hc_disable(struct bnx2x *bp, u8 port, | |||
4579 | u32 enable_flag = disable ? 0 : (1 << HC_INDEX_DATA_HC_ENABLED_SHIFT); | 4583 | u32 enable_flag = disable ? 0 : (1 << HC_INDEX_DATA_HC_ENABLED_SHIFT); |
4580 | u32 addr = BAR_CSTRORM_INTMEM + | 4584 | u32 addr = BAR_CSTRORM_INTMEM + |
4581 | CSTORM_STATUS_BLOCK_DATA_FLAGS_OFFSET(fw_sb_id, sb_index); | 4585 | CSTORM_STATUS_BLOCK_DATA_FLAGS_OFFSET(fw_sb_id, sb_index); |
4582 | u16 flags = REG_RD16(bp, addr); | 4586 | u8 flags = REG_RD8(bp, addr); |
4583 | /* clear and set */ | 4587 | /* clear and set */ |
4584 | flags &= ~HC_INDEX_DATA_HC_ENABLED; | 4588 | flags &= ~HC_INDEX_DATA_HC_ENABLED; |
4585 | flags |= enable_flag; | 4589 | flags |= enable_flag; |
4586 | REG_WR16(bp, addr, flags); | 4590 | REG_WR8(bp, addr, flags); |
4587 | DP(NETIF_MSG_IFUP, | 4591 | DP(NETIF_MSG_IFUP, |
4588 | "port %x fw_sb_id %d sb_index %d disable %d\n", | 4592 | "port %x fw_sb_id %d sb_index %d disable %d\n", |
4589 | port, fw_sb_id, sb_index, disable); | 4593 | port, fw_sb_id, sb_index, disable); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c index 568205436a15..91ecd6a00d05 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c | |||
@@ -2139,12 +2139,12 @@ static u8 bnx2x_dcbnl_get_cap(struct net_device *netdev, int capid, u8 *cap) | |||
2139 | break; | 2139 | break; |
2140 | default: | 2140 | default: |
2141 | BNX2X_ERR("Non valid capability ID\n"); | 2141 | BNX2X_ERR("Non valid capability ID\n"); |
2142 | rval = -EINVAL; | 2142 | rval = 1; |
2143 | break; | 2143 | break; |
2144 | } | 2144 | } |
2145 | } else { | 2145 | } else { |
2146 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); | 2146 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); |
2147 | rval = -EINVAL; | 2147 | rval = 1; |
2148 | } | 2148 | } |
2149 | 2149 | ||
2150 | DP(BNX2X_MSG_DCB, "capid %d:%x\n", capid, *cap); | 2150 | DP(BNX2X_MSG_DCB, "capid %d:%x\n", capid, *cap); |
@@ -2170,12 +2170,12 @@ static int bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num) | |||
2170 | break; | 2170 | break; |
2171 | default: | 2171 | default: |
2172 | BNX2X_ERR("Non valid TC-ID\n"); | 2172 | BNX2X_ERR("Non valid TC-ID\n"); |
2173 | rval = -EINVAL; | 2173 | rval = 1; |
2174 | break; | 2174 | break; |
2175 | } | 2175 | } |
2176 | } else { | 2176 | } else { |
2177 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); | 2177 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); |
2178 | rval = -EINVAL; | 2178 | rval = 1; |
2179 | } | 2179 | } |
2180 | 2180 | ||
2181 | return rval; | 2181 | return rval; |
@@ -2188,7 +2188,7 @@ static int bnx2x_dcbnl_set_numtcs(struct net_device *netdev, int tcid, u8 num) | |||
2188 | return -EINVAL; | 2188 | return -EINVAL; |
2189 | } | 2189 | } |
2190 | 2190 | ||
2191 | static u8 bnx2x_dcbnl_get_pfc_state(struct net_device *netdev) | 2191 | static u8 bnx2x_dcbnl_get_pfc_state(struct net_device *netdev) |
2192 | { | 2192 | { |
2193 | struct bnx2x *bp = netdev_priv(netdev); | 2193 | struct bnx2x *bp = netdev_priv(netdev); |
2194 | DP(BNX2X_MSG_DCB, "state = %d\n", bp->dcbx_local_feat.pfc.enabled); | 2194 | DP(BNX2X_MSG_DCB, "state = %d\n", bp->dcbx_local_feat.pfc.enabled); |
@@ -2390,12 +2390,12 @@ static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev, int featid, | |||
2390 | break; | 2390 | break; |
2391 | default: | 2391 | default: |
2392 | BNX2X_ERR("Non valid featrue-ID\n"); | 2392 | BNX2X_ERR("Non valid featrue-ID\n"); |
2393 | rval = -EINVAL; | 2393 | rval = 1; |
2394 | break; | 2394 | break; |
2395 | } | 2395 | } |
2396 | } else { | 2396 | } else { |
2397 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); | 2397 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); |
2398 | rval = -EINVAL; | 2398 | rval = 1; |
2399 | } | 2399 | } |
2400 | 2400 | ||
2401 | return rval; | 2401 | return rval; |
@@ -2431,12 +2431,12 @@ static u8 bnx2x_dcbnl_set_featcfg(struct net_device *netdev, int featid, | |||
2431 | break; | 2431 | break; |
2432 | default: | 2432 | default: |
2433 | BNX2X_ERR("Non valid featrue-ID\n"); | 2433 | BNX2X_ERR("Non valid featrue-ID\n"); |
2434 | rval = -EINVAL; | 2434 | rval = 1; |
2435 | break; | 2435 | break; |
2436 | } | 2436 | } |
2437 | } else { | 2437 | } else { |
2438 | DP(BNX2X_MSG_DCB, "dcbnl call not valid\n"); | 2438 | DP(BNX2X_MSG_DCB, "dcbnl call not valid\n"); |
2439 | rval = -EINVAL; | 2439 | rval = 1; |
2440 | } | 2440 | } |
2441 | 2441 | ||
2442 | return rval; | 2442 | return rval; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index 77ebae0ac64a..0283f343b0d1 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -13437,13 +13437,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13437 | { | 13437 | { |
13438 | struct bnx2x *bp = params->bp; | 13438 | struct bnx2x *bp = params->bp; |
13439 | u16 base_page, next_page, not_kr2_device, lane; | 13439 | u16 base_page, next_page, not_kr2_device, lane; |
13440 | int sigdet = bnx2x_warpcore_get_sigdet(phy, params); | 13440 | int sigdet; |
13441 | |||
13442 | if (!sigdet) { | ||
13443 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) | ||
13444 | bnx2x_kr2_recovery(params, vars, phy); | ||
13445 | return; | ||
13446 | } | ||
13447 | 13441 | ||
13448 | /* Once KR2 was disabled, wait 5 seconds before checking KR2 recovery | 13442 | /* Once KR2 was disabled, wait 5 seconds before checking KR2 recovery |
13449 | * since some switches tend to reinit the AN process and clear the | 13443 | * since some switches tend to reinit the AN process and clear the |
@@ -13454,6 +13448,16 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13454 | vars->check_kr2_recovery_cnt--; | 13448 | vars->check_kr2_recovery_cnt--; |
13455 | return; | 13449 | return; |
13456 | } | 13450 | } |
13451 | |||
13452 | sigdet = bnx2x_warpcore_get_sigdet(phy, params); | ||
13453 | if (!sigdet) { | ||
13454 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | ||
13455 | bnx2x_kr2_recovery(params, vars, phy); | ||
13456 | DP(NETIF_MSG_LINK, "No sigdet\n"); | ||
13457 | } | ||
13458 | return; | ||
13459 | } | ||
13460 | |||
13457 | lane = bnx2x_get_warpcore_lane(phy, params); | 13461 | lane = bnx2x_get_warpcore_lane(phy, params); |
13458 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | 13462 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, |
13459 | MDIO_AER_BLOCK_AER_REG, lane); | 13463 | MDIO_AER_BLOCK_AER_REG, lane); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index e81a747ea8ce..c50696b396f1 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -4947,7 +4947,7 @@ static void bnx2x_after_function_update(struct bnx2x *bp) | |||
4947 | q); | 4947 | q); |
4948 | } | 4948 | } |
4949 | 4949 | ||
4950 | if (!NO_FCOE(bp)) { | 4950 | if (!NO_FCOE(bp) && CNIC_ENABLED(bp)) { |
4951 | fp = &bp->fp[FCOE_IDX(bp)]; | 4951 | fp = &bp->fp[FCOE_IDX(bp)]; |
4952 | queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; | 4952 | queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; |
4953 | 4953 | ||
@@ -9878,6 +9878,10 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) | |||
9878 | REG_RD(bp, NIG_REG_NIG_INT_STS_CLR_0); | 9878 | REG_RD(bp, NIG_REG_NIG_INT_STS_CLR_0); |
9879 | } | 9879 | } |
9880 | } | 9880 | } |
9881 | if (!CHIP_IS_E1x(bp)) | ||
9882 | /* block FW from writing to host */ | ||
9883 | REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_MASTER, 0); | ||
9884 | |||
9881 | /* wait until BRB is empty */ | 9885 | /* wait until BRB is empty */ |
9882 | tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); | 9886 | tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); |
9883 | while (timer_count) { | 9887 | while (timer_count) { |
@@ -13354,6 +13358,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev) | |||
13354 | RCU_INIT_POINTER(bp->cnic_ops, NULL); | 13358 | RCU_INIT_POINTER(bp->cnic_ops, NULL); |
13355 | mutex_unlock(&bp->cnic_mutex); | 13359 | mutex_unlock(&bp->cnic_mutex); |
13356 | synchronize_rcu(); | 13360 | synchronize_rcu(); |
13361 | bp->cnic_enabled = false; | ||
13357 | kfree(bp->cnic_kwq); | 13362 | kfree(bp->cnic_kwq); |
13358 | bp->cnic_kwq = NULL; | 13363 | bp->cnic_kwq = NULL; |
13359 | 13364 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h index 364e37ecbc5c..198f6f1c9ad5 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h | |||
@@ -459,8 +459,9 @@ struct bnx2x_fw_port_stats_old { | |||
459 | 459 | ||
460 | #define UPDATE_QSTAT(s, t) \ | 460 | #define UPDATE_QSTAT(s, t) \ |
461 | do { \ | 461 | do { \ |
462 | qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi); \ | ||
463 | qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \ | 462 | qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \ |
463 | qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi) \ | ||
464 | + ((qstats->t##_lo < qstats_old->t##_lo) ? 1 : 0); \ | ||
464 | } while (0) | 465 | } while (0) |
465 | 466 | ||
466 | #define UPDATE_QSTAT_OLD(f) \ | 467 | #define UPDATE_QSTAT_OLD(f) \ |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 93729f942358..17a972734ba7 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -4130,6 +4130,14 @@ static void tg3_phy_copper_begin(struct tg3 *tp) | |||
4130 | tp->link_config.active_speed = tp->link_config.speed; | 4130 | tp->link_config.active_speed = tp->link_config.speed; |
4131 | tp->link_config.active_duplex = tp->link_config.duplex; | 4131 | tp->link_config.active_duplex = tp->link_config.duplex; |
4132 | 4132 | ||
4133 | if (tg3_asic_rev(tp) == ASIC_REV_5714) { | ||
4134 | /* With autoneg disabled, 5715 only links up when the | ||
4135 | * advertisement register has the configured speed | ||
4136 | * enabled. | ||
4137 | */ | ||
4138 | tg3_writephy(tp, MII_ADVERTISE, ADVERTISE_ALL); | ||
4139 | } | ||
4140 | |||
4133 | bmcr = 0; | 4141 | bmcr = 0; |
4134 | switch (tp->link_config.speed) { | 4142 | switch (tp->link_config.speed) { |
4135 | default: | 4143 | default: |
@@ -14596,8 +14604,11 @@ static void tg3_read_vpd(struct tg3 *tp) | |||
14596 | if (j + len > block_end) | 14604 | if (j + len > block_end) |
14597 | goto partno; | 14605 | goto partno; |
14598 | 14606 | ||
14599 | memcpy(tp->fw_ver, &vpd_data[j], len); | 14607 | if (len >= sizeof(tp->fw_ver)) |
14600 | strncat(tp->fw_ver, " bc ", vpdlen - len - 1); | 14608 | len = sizeof(tp->fw_ver) - 1; |
14609 | memset(tp->fw_ver, 0, sizeof(tp->fw_ver)); | ||
14610 | snprintf(tp->fw_ver, sizeof(tp->fw_ver), "%.*s bc ", len, | ||
14611 | &vpd_data[j]); | ||
14601 | } | 14612 | } |
14602 | 14613 | ||
14603 | partno: | 14614 | partno: |
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index a170065b5973..b0ebc9f6d55e 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c | |||
@@ -163,6 +163,7 @@ | |||
163 | #define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ | 163 | #define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ |
164 | 164 | ||
165 | /* XGMAC_INT_STAT reg */ | 165 | /* XGMAC_INT_STAT reg */ |
166 | #define XGMAC_INT_STAT_PMTIM 0x00800000 /* PMT Interrupt Mask */ | ||
166 | #define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */ | 167 | #define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */ |
167 | #define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */ | 168 | #define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */ |
168 | 169 | ||
@@ -960,6 +961,9 @@ static int xgmac_hw_init(struct net_device *dev) | |||
960 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS); | 961 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS); |
961 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA); | 962 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA); |
962 | 963 | ||
964 | /* Mask power mgt interrupt */ | ||
965 | writel(XGMAC_INT_STAT_PMTIM, ioaddr + XGMAC_INT_STAT); | ||
966 | |||
963 | /* XGMAC requires AXI bus init. This is a 'magic number' for now */ | 967 | /* XGMAC requires AXI bus init. This is a 'magic number' for now */ |
964 | writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS); | 968 | writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS); |
965 | 969 | ||
@@ -1141,6 +1145,9 @@ static int xgmac_rx(struct xgmac_priv *priv, int limit) | |||
1141 | struct sk_buff *skb; | 1145 | struct sk_buff *skb; |
1142 | int frame_len; | 1146 | int frame_len; |
1143 | 1147 | ||
1148 | if (!dma_ring_cnt(priv->rx_head, priv->rx_tail, DMA_RX_RING_SZ)) | ||
1149 | break; | ||
1150 | |||
1144 | entry = priv->rx_tail; | 1151 | entry = priv->rx_tail; |
1145 | p = priv->dma_rx + entry; | 1152 | p = priv->dma_rx + entry; |
1146 | if (desc_get_owner(p)) | 1153 | if (desc_get_owner(p)) |
@@ -1825,7 +1832,7 @@ static void xgmac_pmt(void __iomem *ioaddr, unsigned long mode) | |||
1825 | unsigned int pmt = 0; | 1832 | unsigned int pmt = 0; |
1826 | 1833 | ||
1827 | if (mode & WAKE_MAGIC) | 1834 | if (mode & WAKE_MAGIC) |
1828 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT; | 1835 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT_EN; |
1829 | if (mode & WAKE_UCAST) | 1836 | if (mode & WAKE_UCAST) |
1830 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST; | 1837 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST; |
1831 | 1838 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 4ce62031f62f..8049268ce0f2 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -497,8 +497,9 @@ int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len, | |||
497 | } | 497 | } |
498 | 498 | ||
499 | #define EEPROM_STAT_ADDR 0x7bfc | 499 | #define EEPROM_STAT_ADDR 0x7bfc |
500 | #define VPD_BASE 0 | ||
501 | #define VPD_LEN 512 | 500 | #define VPD_LEN 512 |
501 | #define VPD_BASE 0x400 | ||
502 | #define VPD_BASE_OLD 0 | ||
502 | 503 | ||
503 | /** | 504 | /** |
504 | * t4_seeprom_wp - enable/disable EEPROM write protection | 505 | * t4_seeprom_wp - enable/disable EEPROM write protection |
@@ -524,7 +525,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable) | |||
524 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | 525 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p) |
525 | { | 526 | { |
526 | u32 cclk_param, cclk_val; | 527 | u32 cclk_param, cclk_val; |
527 | int i, ret; | 528 | int i, ret, addr; |
528 | int ec, sn; | 529 | int ec, sn; |
529 | u8 *vpd, csum; | 530 | u8 *vpd, csum; |
530 | unsigned int vpdr_len, kw_offset, id_len; | 531 | unsigned int vpdr_len, kw_offset, id_len; |
@@ -533,7 +534,12 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | |||
533 | if (!vpd) | 534 | if (!vpd) |
534 | return -ENOMEM; | 535 | return -ENOMEM; |
535 | 536 | ||
536 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, VPD_LEN, vpd); | 537 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd); |
538 | if (ret < 0) | ||
539 | goto out; | ||
540 | addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD; | ||
541 | |||
542 | ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd); | ||
537 | if (ret < 0) | 543 | if (ret < 0) |
538 | goto out; | 544 | goto out; |
539 | 545 | ||
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 8cdf02503d13..9eada8e86078 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
@@ -257,6 +257,107 @@ static void dm9000_dumpblk_32bit(void __iomem *reg, int count) | |||
257 | tmp = readl(reg); | 257 | tmp = readl(reg); |
258 | } | 258 | } |
259 | 259 | ||
260 | /* | ||
261 | * Sleep, either by using msleep() or if we are suspending, then | ||
262 | * use mdelay() to sleep. | ||
263 | */ | ||
264 | static void dm9000_msleep(board_info_t *db, unsigned int ms) | ||
265 | { | ||
266 | if (db->in_suspend) | ||
267 | mdelay(ms); | ||
268 | else | ||
269 | msleep(ms); | ||
270 | } | ||
271 | |||
272 | /* Read a word from phyxcer */ | ||
273 | static int | ||
274 | dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg) | ||
275 | { | ||
276 | board_info_t *db = netdev_priv(dev); | ||
277 | unsigned long flags; | ||
278 | unsigned int reg_save; | ||
279 | int ret; | ||
280 | |||
281 | mutex_lock(&db->addr_lock); | ||
282 | |||
283 | spin_lock_irqsave(&db->lock, flags); | ||
284 | |||
285 | /* Save previous register address */ | ||
286 | reg_save = readb(db->io_addr); | ||
287 | |||
288 | /* Fill the phyxcer register into REG_0C */ | ||
289 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
290 | |||
291 | /* Issue phyxcer read command */ | ||
292 | iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); | ||
293 | |||
294 | writeb(reg_save, db->io_addr); | ||
295 | spin_unlock_irqrestore(&db->lock, flags); | ||
296 | |||
297 | dm9000_msleep(db, 1); /* Wait read complete */ | ||
298 | |||
299 | spin_lock_irqsave(&db->lock, flags); | ||
300 | reg_save = readb(db->io_addr); | ||
301 | |||
302 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */ | ||
303 | |||
304 | /* The read data keeps on REG_0D & REG_0E */ | ||
305 | ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL); | ||
306 | |||
307 | /* restore the previous address */ | ||
308 | writeb(reg_save, db->io_addr); | ||
309 | spin_unlock_irqrestore(&db->lock, flags); | ||
310 | |||
311 | mutex_unlock(&db->addr_lock); | ||
312 | |||
313 | dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret); | ||
314 | return ret; | ||
315 | } | ||
316 | |||
317 | /* Write a word to phyxcer */ | ||
318 | static void | ||
319 | dm9000_phy_write(struct net_device *dev, | ||
320 | int phyaddr_unused, int reg, int value) | ||
321 | { | ||
322 | board_info_t *db = netdev_priv(dev); | ||
323 | unsigned long flags; | ||
324 | unsigned long reg_save; | ||
325 | |||
326 | dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value); | ||
327 | mutex_lock(&db->addr_lock); | ||
328 | |||
329 | spin_lock_irqsave(&db->lock, flags); | ||
330 | |||
331 | /* Save previous register address */ | ||
332 | reg_save = readb(db->io_addr); | ||
333 | |||
334 | /* Fill the phyxcer register into REG_0C */ | ||
335 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
336 | |||
337 | /* Fill the written data into REG_0D & REG_0E */ | ||
338 | iow(db, DM9000_EPDRL, value); | ||
339 | iow(db, DM9000_EPDRH, value >> 8); | ||
340 | |||
341 | /* Issue phyxcer write command */ | ||
342 | iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); | ||
343 | |||
344 | writeb(reg_save, db->io_addr); | ||
345 | spin_unlock_irqrestore(&db->lock, flags); | ||
346 | |||
347 | dm9000_msleep(db, 1); /* Wait write complete */ | ||
348 | |||
349 | spin_lock_irqsave(&db->lock, flags); | ||
350 | reg_save = readb(db->io_addr); | ||
351 | |||
352 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ | ||
353 | |||
354 | /* restore the previous address */ | ||
355 | writeb(reg_save, db->io_addr); | ||
356 | |||
357 | spin_unlock_irqrestore(&db->lock, flags); | ||
358 | mutex_unlock(&db->addr_lock); | ||
359 | } | ||
360 | |||
260 | /* dm9000_set_io | 361 | /* dm9000_set_io |
261 | * | 362 | * |
262 | * select the specified set of io routines to use with the | 363 | * select the specified set of io routines to use with the |
@@ -795,6 +896,9 @@ dm9000_init_dm9000(struct net_device *dev) | |||
795 | 896 | ||
796 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ | 897 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ |
797 | 898 | ||
899 | dm9000_phy_write(dev, 0, MII_BMCR, BMCR_RESET); /* PHY RESET */ | ||
900 | dm9000_phy_write(dev, 0, MII_DM_DSPCR, DSPCR_INIT_PARAM); /* Init */ | ||
901 | |||
798 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; | 902 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; |
799 | 903 | ||
800 | /* if wol is needed, then always set NCR_WAKEEN otherwise we end | 904 | /* if wol is needed, then always set NCR_WAKEEN otherwise we end |
@@ -1201,109 +1305,6 @@ dm9000_open(struct net_device *dev) | |||
1201 | return 0; | 1305 | return 0; |
1202 | } | 1306 | } |
1203 | 1307 | ||
1204 | /* | ||
1205 | * Sleep, either by using msleep() or if we are suspending, then | ||
1206 | * use mdelay() to sleep. | ||
1207 | */ | ||
1208 | static void dm9000_msleep(board_info_t *db, unsigned int ms) | ||
1209 | { | ||
1210 | if (db->in_suspend) | ||
1211 | mdelay(ms); | ||
1212 | else | ||
1213 | msleep(ms); | ||
1214 | } | ||
1215 | |||
1216 | /* | ||
1217 | * Read a word from phyxcer | ||
1218 | */ | ||
1219 | static int | ||
1220 | dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg) | ||
1221 | { | ||
1222 | board_info_t *db = netdev_priv(dev); | ||
1223 | unsigned long flags; | ||
1224 | unsigned int reg_save; | ||
1225 | int ret; | ||
1226 | |||
1227 | mutex_lock(&db->addr_lock); | ||
1228 | |||
1229 | spin_lock_irqsave(&db->lock,flags); | ||
1230 | |||
1231 | /* Save previous register address */ | ||
1232 | reg_save = readb(db->io_addr); | ||
1233 | |||
1234 | /* Fill the phyxcer register into REG_0C */ | ||
1235 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
1236 | |||
1237 | iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); /* Issue phyxcer read command */ | ||
1238 | |||
1239 | writeb(reg_save, db->io_addr); | ||
1240 | spin_unlock_irqrestore(&db->lock,flags); | ||
1241 | |||
1242 | dm9000_msleep(db, 1); /* Wait read complete */ | ||
1243 | |||
1244 | spin_lock_irqsave(&db->lock,flags); | ||
1245 | reg_save = readb(db->io_addr); | ||
1246 | |||
1247 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */ | ||
1248 | |||
1249 | /* The read data keeps on REG_0D & REG_0E */ | ||
1250 | ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL); | ||
1251 | |||
1252 | /* restore the previous address */ | ||
1253 | writeb(reg_save, db->io_addr); | ||
1254 | spin_unlock_irqrestore(&db->lock,flags); | ||
1255 | |||
1256 | mutex_unlock(&db->addr_lock); | ||
1257 | |||
1258 | dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret); | ||
1259 | return ret; | ||
1260 | } | ||
1261 | |||
1262 | /* | ||
1263 | * Write a word to phyxcer | ||
1264 | */ | ||
1265 | static void | ||
1266 | dm9000_phy_write(struct net_device *dev, | ||
1267 | int phyaddr_unused, int reg, int value) | ||
1268 | { | ||
1269 | board_info_t *db = netdev_priv(dev); | ||
1270 | unsigned long flags; | ||
1271 | unsigned long reg_save; | ||
1272 | |||
1273 | dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value); | ||
1274 | mutex_lock(&db->addr_lock); | ||
1275 | |||
1276 | spin_lock_irqsave(&db->lock,flags); | ||
1277 | |||
1278 | /* Save previous register address */ | ||
1279 | reg_save = readb(db->io_addr); | ||
1280 | |||
1281 | /* Fill the phyxcer register into REG_0C */ | ||
1282 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
1283 | |||
1284 | /* Fill the written data into REG_0D & REG_0E */ | ||
1285 | iow(db, DM9000_EPDRL, value); | ||
1286 | iow(db, DM9000_EPDRH, value >> 8); | ||
1287 | |||
1288 | iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); /* Issue phyxcer write command */ | ||
1289 | |||
1290 | writeb(reg_save, db->io_addr); | ||
1291 | spin_unlock_irqrestore(&db->lock, flags); | ||
1292 | |||
1293 | dm9000_msleep(db, 1); /* Wait write complete */ | ||
1294 | |||
1295 | spin_lock_irqsave(&db->lock,flags); | ||
1296 | reg_save = readb(db->io_addr); | ||
1297 | |||
1298 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ | ||
1299 | |||
1300 | /* restore the previous address */ | ||
1301 | writeb(reg_save, db->io_addr); | ||
1302 | |||
1303 | spin_unlock_irqrestore(&db->lock, flags); | ||
1304 | mutex_unlock(&db->addr_lock); | ||
1305 | } | ||
1306 | |||
1307 | static void | 1308 | static void |
1308 | dm9000_shutdown(struct net_device *dev) | 1309 | dm9000_shutdown(struct net_device *dev) |
1309 | { | 1310 | { |
@@ -1502,7 +1503,12 @@ dm9000_probe(struct platform_device *pdev) | |||
1502 | db->flags |= DM9000_PLATF_SIMPLE_PHY; | 1503 | db->flags |= DM9000_PLATF_SIMPLE_PHY; |
1503 | #endif | 1504 | #endif |
1504 | 1505 | ||
1505 | dm9000_reset(db); | 1506 | /* Fixing bug on dm9000_probe, takeover dm9000_reset(db), |
1507 | * Need 'NCR_MAC_LBK' bit to indeed stable our DM9000 fifo | ||
1508 | * while probe stage. | ||
1509 | */ | ||
1510 | |||
1511 | iow(db, DM9000_NCR, NCR_MAC_LBK | NCR_RST); | ||
1506 | 1512 | ||
1507 | /* try multiple times, DM9000 sometimes gets the read wrong */ | 1513 | /* try multiple times, DM9000 sometimes gets the read wrong */ |
1508 | for (i = 0; i < 8; i++) { | 1514 | for (i = 0; i < 8; i++) { |
diff --git a/drivers/net/ethernet/davicom/dm9000.h b/drivers/net/ethernet/davicom/dm9000.h index 55688bd1a3ef..9ce058adabab 100644 --- a/drivers/net/ethernet/davicom/dm9000.h +++ b/drivers/net/ethernet/davicom/dm9000.h | |||
@@ -69,7 +69,9 @@ | |||
69 | #define NCR_WAKEEN (1<<6) | 69 | #define NCR_WAKEEN (1<<6) |
70 | #define NCR_FCOL (1<<4) | 70 | #define NCR_FCOL (1<<4) |
71 | #define NCR_FDX (1<<3) | 71 | #define NCR_FDX (1<<3) |
72 | #define NCR_LBK (3<<1) | 72 | |
73 | #define NCR_RESERVED (3<<1) | ||
74 | #define NCR_MAC_LBK (1<<1) | ||
73 | #define NCR_RST (1<<0) | 75 | #define NCR_RST (1<<0) |
74 | 76 | ||
75 | #define NSR_SPEED (1<<7) | 77 | #define NSR_SPEED (1<<7) |
@@ -167,5 +169,12 @@ | |||
167 | #define ISR_LNKCHNG (1<<5) | 169 | #define ISR_LNKCHNG (1<<5) |
168 | #define ISR_UNDERRUN (1<<4) | 170 | #define ISR_UNDERRUN (1<<4) |
169 | 171 | ||
172 | /* Davicom MII registers. | ||
173 | */ | ||
174 | |||
175 | #define MII_DM_DSPCR 0x1b /* DSP Control Register */ | ||
176 | |||
177 | #define DSPCR_INIT_PARAM 0xE100 /* DSP init parameter */ | ||
178 | |||
170 | #endif /* _DM9000X_H_ */ | 179 | #endif /* _DM9000X_H_ */ |
171 | 180 | ||
diff --git a/drivers/net/ethernet/dec/tulip/Kconfig b/drivers/net/ethernet/dec/tulip/Kconfig index 0c37fb2cc867..1df33c799c00 100644 --- a/drivers/net/ethernet/dec/tulip/Kconfig +++ b/drivers/net/ethernet/dec/tulip/Kconfig | |||
@@ -108,6 +108,7 @@ config TULIP_DM910X | |||
108 | config DE4X5 | 108 | config DE4X5 |
109 | tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" | 109 | tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" |
110 | depends on (PCI || EISA) | 110 | depends on (PCI || EISA) |
111 | depends on VIRT_TO_BUS || ALPHA || PPC || SPARC | ||
111 | select CRC32 | 112 | select CRC32 |
112 | ---help--- | 113 | ---help--- |
113 | This is support for the DIGITAL series of PCI/EISA Ethernet cards. | 114 | This is support for the DIGITAL series of PCI/EISA Ethernet cards. |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 08e54f3d288b..2886c9b63f90 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -759,8 +759,9 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter, | |||
759 | 759 | ||
760 | if (vlan_tx_tag_present(skb)) { | 760 | if (vlan_tx_tag_present(skb)) { |
761 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); | 761 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); |
762 | __vlan_put_tag(skb, vlan_tag); | 762 | skb = __vlan_put_tag(skb, vlan_tag); |
763 | skb->vlan_tci = 0; | 763 | if (skb) |
764 | skb->vlan_tci = 0; | ||
764 | } | 765 | } |
765 | 766 | ||
766 | return skb; | 767 | return skb; |
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 069a155d16ed..73195f643c9c 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c | |||
@@ -345,6 +345,53 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
345 | return NETDEV_TX_OK; | 345 | return NETDEV_TX_OK; |
346 | } | 346 | } |
347 | 347 | ||
348 | /* Init RX & TX buffer descriptors | ||
349 | */ | ||
350 | static void fec_enet_bd_init(struct net_device *dev) | ||
351 | { | ||
352 | struct fec_enet_private *fep = netdev_priv(dev); | ||
353 | struct bufdesc *bdp; | ||
354 | unsigned int i; | ||
355 | |||
356 | /* Initialize the receive buffer descriptors. */ | ||
357 | bdp = fep->rx_bd_base; | ||
358 | for (i = 0; i < RX_RING_SIZE; i++) { | ||
359 | |||
360 | /* Initialize the BD for every fragment in the page. */ | ||
361 | if (bdp->cbd_bufaddr) | ||
362 | bdp->cbd_sc = BD_ENET_RX_EMPTY; | ||
363 | else | ||
364 | bdp->cbd_sc = 0; | ||
365 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
366 | } | ||
367 | |||
368 | /* Set the last buffer to wrap */ | ||
369 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
370 | bdp->cbd_sc |= BD_SC_WRAP; | ||
371 | |||
372 | fep->cur_rx = fep->rx_bd_base; | ||
373 | |||
374 | /* ...and the same for transmit */ | ||
375 | bdp = fep->tx_bd_base; | ||
376 | fep->cur_tx = bdp; | ||
377 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
378 | |||
379 | /* Initialize the BD for every fragment in the page. */ | ||
380 | bdp->cbd_sc = 0; | ||
381 | if (bdp->cbd_bufaddr && fep->tx_skbuff[i]) { | ||
382 | dev_kfree_skb_any(fep->tx_skbuff[i]); | ||
383 | fep->tx_skbuff[i] = NULL; | ||
384 | } | ||
385 | bdp->cbd_bufaddr = 0; | ||
386 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
387 | } | ||
388 | |||
389 | /* Set the last buffer to wrap */ | ||
390 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
391 | bdp->cbd_sc |= BD_SC_WRAP; | ||
392 | fep->dirty_tx = bdp; | ||
393 | } | ||
394 | |||
348 | /* This function is called to start or restart the FEC during a link | 395 | /* This function is called to start or restart the FEC during a link |
349 | * change. This only happens when switching between half and full | 396 | * change. This only happens when switching between half and full |
350 | * duplex. | 397 | * duplex. |
@@ -388,6 +435,8 @@ fec_restart(struct net_device *ndev, int duplex) | |||
388 | /* Set maximum receive buffer size. */ | 435 | /* Set maximum receive buffer size. */ |
389 | writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); | 436 | writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); |
390 | 437 | ||
438 | fec_enet_bd_init(ndev); | ||
439 | |||
391 | /* Set receive and transmit descriptor base. */ | 440 | /* Set receive and transmit descriptor base. */ |
392 | writel(fep->bd_dma, fep->hwp + FEC_R_DES_START); | 441 | writel(fep->bd_dma, fep->hwp + FEC_R_DES_START); |
393 | if (fep->bufdesc_ex) | 442 | if (fep->bufdesc_ex) |
@@ -397,7 +446,6 @@ fec_restart(struct net_device *ndev, int duplex) | |||
397 | writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc) | 446 | writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc) |
398 | * RX_RING_SIZE, fep->hwp + FEC_X_DES_START); | 447 | * RX_RING_SIZE, fep->hwp + FEC_X_DES_START); |
399 | 448 | ||
400 | fep->cur_rx = fep->rx_bd_base; | ||
401 | 449 | ||
402 | for (i = 0; i <= TX_RING_MOD_MASK; i++) { | 450 | for (i = 0; i <= TX_RING_MOD_MASK; i++) { |
403 | if (fep->tx_skbuff[i]) { | 451 | if (fep->tx_skbuff[i]) { |
@@ -934,24 +982,29 @@ static void fec_enet_adjust_link(struct net_device *ndev) | |||
934 | goto spin_unlock; | 982 | goto spin_unlock; |
935 | } | 983 | } |
936 | 984 | ||
937 | /* Duplex link change */ | ||
938 | if (phy_dev->link) { | 985 | if (phy_dev->link) { |
939 | if (fep->full_duplex != phy_dev->duplex) { | 986 | if (!fep->link) { |
940 | fec_restart(ndev, phy_dev->duplex); | ||
941 | /* prevent unnecessary second fec_restart() below */ | ||
942 | fep->link = phy_dev->link; | 987 | fep->link = phy_dev->link; |
943 | status_change = 1; | 988 | status_change = 1; |
944 | } | 989 | } |
945 | } | ||
946 | 990 | ||
947 | /* Link on or off change */ | 991 | if (fep->full_duplex != phy_dev->duplex) |
948 | if (phy_dev->link != fep->link) { | 992 | status_change = 1; |
949 | fep->link = phy_dev->link; | 993 | |
950 | if (phy_dev->link) | 994 | if (phy_dev->speed != fep->speed) { |
995 | fep->speed = phy_dev->speed; | ||
996 | status_change = 1; | ||
997 | } | ||
998 | |||
999 | /* if any of the above changed restart the FEC */ | ||
1000 | if (status_change) | ||
951 | fec_restart(ndev, phy_dev->duplex); | 1001 | fec_restart(ndev, phy_dev->duplex); |
952 | else | 1002 | } else { |
1003 | if (fep->link) { | ||
953 | fec_stop(ndev); | 1004 | fec_stop(ndev); |
954 | status_change = 1; | 1005 | fep->link = phy_dev->link; |
1006 | status_change = 1; | ||
1007 | } | ||
955 | } | 1008 | } |
956 | 1009 | ||
957 | spin_unlock: | 1010 | spin_unlock: |
@@ -1328,7 +1381,7 @@ static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) | |||
1328 | static void fec_enet_free_buffers(struct net_device *ndev) | 1381 | static void fec_enet_free_buffers(struct net_device *ndev) |
1329 | { | 1382 | { |
1330 | struct fec_enet_private *fep = netdev_priv(ndev); | 1383 | struct fec_enet_private *fep = netdev_priv(ndev); |
1331 | int i; | 1384 | unsigned int i; |
1332 | struct sk_buff *skb; | 1385 | struct sk_buff *skb; |
1333 | struct bufdesc *bdp; | 1386 | struct bufdesc *bdp; |
1334 | 1387 | ||
@@ -1352,7 +1405,7 @@ static void fec_enet_free_buffers(struct net_device *ndev) | |||
1352 | static int fec_enet_alloc_buffers(struct net_device *ndev) | 1405 | static int fec_enet_alloc_buffers(struct net_device *ndev) |
1353 | { | 1406 | { |
1354 | struct fec_enet_private *fep = netdev_priv(ndev); | 1407 | struct fec_enet_private *fep = netdev_priv(ndev); |
1355 | int i; | 1408 | unsigned int i; |
1356 | struct sk_buff *skb; | 1409 | struct sk_buff *skb; |
1357 | struct bufdesc *bdp; | 1410 | struct bufdesc *bdp; |
1358 | 1411 | ||
@@ -1437,6 +1490,7 @@ fec_enet_close(struct net_device *ndev) | |||
1437 | struct fec_enet_private *fep = netdev_priv(ndev); | 1490 | struct fec_enet_private *fep = netdev_priv(ndev); |
1438 | 1491 | ||
1439 | /* Don't know what to do yet. */ | 1492 | /* Don't know what to do yet. */ |
1493 | napi_disable(&fep->napi); | ||
1440 | fep->opened = 0; | 1494 | fep->opened = 0; |
1441 | netif_stop_queue(ndev); | 1495 | netif_stop_queue(ndev); |
1442 | fec_stop(ndev); | 1496 | fec_stop(ndev); |
@@ -1592,8 +1646,6 @@ static int fec_enet_init(struct net_device *ndev) | |||
1592 | { | 1646 | { |
1593 | struct fec_enet_private *fep = netdev_priv(ndev); | 1647 | struct fec_enet_private *fep = netdev_priv(ndev); |
1594 | struct bufdesc *cbd_base; | 1648 | struct bufdesc *cbd_base; |
1595 | struct bufdesc *bdp; | ||
1596 | int i; | ||
1597 | 1649 | ||
1598 | /* Allocate memory for buffer descriptors. */ | 1650 | /* Allocate memory for buffer descriptors. */ |
1599 | cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, | 1651 | cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, |
@@ -1603,6 +1655,7 @@ static int fec_enet_init(struct net_device *ndev) | |||
1603 | return -ENOMEM; | 1655 | return -ENOMEM; |
1604 | } | 1656 | } |
1605 | 1657 | ||
1658 | memset(cbd_base, 0, PAGE_SIZE); | ||
1606 | spin_lock_init(&fep->hw_lock); | 1659 | spin_lock_init(&fep->hw_lock); |
1607 | 1660 | ||
1608 | fep->netdev = ndev; | 1661 | fep->netdev = ndev; |
@@ -1626,35 +1679,6 @@ static int fec_enet_init(struct net_device *ndev) | |||
1626 | writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); | 1679 | writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); |
1627 | netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); | 1680 | netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); |
1628 | 1681 | ||
1629 | /* Initialize the receive buffer descriptors. */ | ||
1630 | bdp = fep->rx_bd_base; | ||
1631 | for (i = 0; i < RX_RING_SIZE; i++) { | ||
1632 | |||
1633 | /* Initialize the BD for every fragment in the page. */ | ||
1634 | bdp->cbd_sc = 0; | ||
1635 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
1636 | } | ||
1637 | |||
1638 | /* Set the last buffer to wrap */ | ||
1639 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
1640 | bdp->cbd_sc |= BD_SC_WRAP; | ||
1641 | |||
1642 | /* ...and the same for transmit */ | ||
1643 | bdp = fep->tx_bd_base; | ||
1644 | fep->cur_tx = bdp; | ||
1645 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
1646 | |||
1647 | /* Initialize the BD for every fragment in the page. */ | ||
1648 | bdp->cbd_sc = 0; | ||
1649 | bdp->cbd_bufaddr = 0; | ||
1650 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
1651 | } | ||
1652 | |||
1653 | /* Set the last buffer to wrap */ | ||
1654 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
1655 | bdp->cbd_sc |= BD_SC_WRAP; | ||
1656 | fep->dirty_tx = bdp; | ||
1657 | |||
1658 | fec_restart(ndev, 0); | 1682 | fec_restart(ndev, 0); |
1659 | 1683 | ||
1660 | return 0; | 1684 | return 0; |
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index f5390071efd0..eb4372962839 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h | |||
@@ -240,6 +240,7 @@ struct fec_enet_private { | |||
240 | phy_interface_t phy_interface; | 240 | phy_interface_t phy_interface; |
241 | int link; | 241 | int link; |
242 | int full_duplex; | 242 | int full_duplex; |
243 | int speed; | ||
243 | struct completion mdio_done; | 244 | struct completion mdio_done; |
244 | int irq[FEC_IRQ_NUM]; | 245 | int irq[FEC_IRQ_NUM]; |
245 | int bufdesc_ex; | 246 | int bufdesc_ex; |
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 1f17ca0f2201..0d8df400a479 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c | |||
@@ -128,6 +128,7 @@ void fec_ptp_start_cyclecounter(struct net_device *ndev) | |||
128 | 128 | ||
129 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); | 129 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); |
130 | } | 130 | } |
131 | EXPORT_SYMBOL(fec_ptp_start_cyclecounter); | ||
131 | 132 | ||
132 | /** | 133 | /** |
133 | * fec_ptp_adjfreq - adjust ptp cycle frequency | 134 | * fec_ptp_adjfreq - adjust ptp cycle frequency |
@@ -318,6 +319,7 @@ int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd) | |||
318 | return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? | 319 | return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? |
319 | -EFAULT : 0; | 320 | -EFAULT : 0; |
320 | } | 321 | } |
322 | EXPORT_SYMBOL(fec_ptp_ioctl); | ||
321 | 323 | ||
322 | /** | 324 | /** |
323 | * fec_time_keep - call timecounter_read every second to avoid timer overrun | 325 | * fec_time_keep - call timecounter_read every second to avoid timer overrun |
@@ -383,3 +385,4 @@ void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev) | |||
383 | pr_info("registered PHC device on %s\n", ndev->name); | 385 | pr_info("registered PHC device on %s\n", ndev->name); |
384 | } | 386 | } |
385 | } | 387 | } |
388 | EXPORT_SYMBOL(fec_ptp_init); | ||
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index ec800b093e7e..d2bea3f07c73 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c | |||
@@ -870,7 +870,7 @@ err_unlock: | |||
870 | } | 870 | } |
871 | 871 | ||
872 | static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, | 872 | static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, |
873 | void (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) | 873 | int (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) |
874 | { | 874 | { |
875 | struct cb *cb; | 875 | struct cb *cb; |
876 | unsigned long flags; | 876 | unsigned long flags; |
@@ -888,10 +888,13 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, | |||
888 | nic->cbs_avail--; | 888 | nic->cbs_avail--; |
889 | cb->skb = skb; | 889 | cb->skb = skb; |
890 | 890 | ||
891 | err = cb_prepare(nic, cb, skb); | ||
892 | if (err) | ||
893 | goto err_unlock; | ||
894 | |||
891 | if (unlikely(!nic->cbs_avail)) | 895 | if (unlikely(!nic->cbs_avail)) |
892 | err = -ENOSPC; | 896 | err = -ENOSPC; |
893 | 897 | ||
894 | cb_prepare(nic, cb, skb); | ||
895 | 898 | ||
896 | /* Order is important otherwise we'll be in a race with h/w: | 899 | /* Order is important otherwise we'll be in a race with h/w: |
897 | * set S-bit in current first, then clear S-bit in previous. */ | 900 | * set S-bit in current first, then clear S-bit in previous. */ |
@@ -1091,7 +1094,7 @@ static void e100_get_defaults(struct nic *nic) | |||
1091 | nic->mii.mdio_write = mdio_write; | 1094 | nic->mii.mdio_write = mdio_write; |
1092 | } | 1095 | } |
1093 | 1096 | ||
1094 | static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | 1097 | static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) |
1095 | { | 1098 | { |
1096 | struct config *config = &cb->u.config; | 1099 | struct config *config = &cb->u.config; |
1097 | u8 *c = (u8 *)config; | 1100 | u8 *c = (u8 *)config; |
@@ -1181,6 +1184,7 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |||
1181 | netif_printk(nic, hw, KERN_DEBUG, nic->netdev, | 1184 | netif_printk(nic, hw, KERN_DEBUG, nic->netdev, |
1182 | "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", | 1185 | "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", |
1183 | c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); | 1186 | c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); |
1187 | return 0; | ||
1184 | } | 1188 | } |
1185 | 1189 | ||
1186 | /************************************************************************* | 1190 | /************************************************************************* |
@@ -1331,7 +1335,7 @@ static const struct firmware *e100_request_firmware(struct nic *nic) | |||
1331 | return fw; | 1335 | return fw; |
1332 | } | 1336 | } |
1333 | 1337 | ||
1334 | static void e100_setup_ucode(struct nic *nic, struct cb *cb, | 1338 | static int e100_setup_ucode(struct nic *nic, struct cb *cb, |
1335 | struct sk_buff *skb) | 1339 | struct sk_buff *skb) |
1336 | { | 1340 | { |
1337 | const struct firmware *fw = (void *)skb; | 1341 | const struct firmware *fw = (void *)skb; |
@@ -1358,6 +1362,7 @@ static void e100_setup_ucode(struct nic *nic, struct cb *cb, | |||
1358 | cb->u.ucode[min_size] |= cpu_to_le32((BUNDLESMALL) ? 0xFFFF : 0xFF80); | 1362 | cb->u.ucode[min_size] |= cpu_to_le32((BUNDLESMALL) ? 0xFFFF : 0xFF80); |
1359 | 1363 | ||
1360 | cb->command = cpu_to_le16(cb_ucode | cb_el); | 1364 | cb->command = cpu_to_le16(cb_ucode | cb_el); |
1365 | return 0; | ||
1361 | } | 1366 | } |
1362 | 1367 | ||
1363 | static inline int e100_load_ucode_wait(struct nic *nic) | 1368 | static inline int e100_load_ucode_wait(struct nic *nic) |
@@ -1400,18 +1405,20 @@ static inline int e100_load_ucode_wait(struct nic *nic) | |||
1400 | return err; | 1405 | return err; |
1401 | } | 1406 | } |
1402 | 1407 | ||
1403 | static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, | 1408 | static int e100_setup_iaaddr(struct nic *nic, struct cb *cb, |
1404 | struct sk_buff *skb) | 1409 | struct sk_buff *skb) |
1405 | { | 1410 | { |
1406 | cb->command = cpu_to_le16(cb_iaaddr); | 1411 | cb->command = cpu_to_le16(cb_iaaddr); |
1407 | memcpy(cb->u.iaaddr, nic->netdev->dev_addr, ETH_ALEN); | 1412 | memcpy(cb->u.iaaddr, nic->netdev->dev_addr, ETH_ALEN); |
1413 | return 0; | ||
1408 | } | 1414 | } |
1409 | 1415 | ||
1410 | static void e100_dump(struct nic *nic, struct cb *cb, struct sk_buff *skb) | 1416 | static int e100_dump(struct nic *nic, struct cb *cb, struct sk_buff *skb) |
1411 | { | 1417 | { |
1412 | cb->command = cpu_to_le16(cb_dump); | 1418 | cb->command = cpu_to_le16(cb_dump); |
1413 | cb->u.dump_buffer_addr = cpu_to_le32(nic->dma_addr + | 1419 | cb->u.dump_buffer_addr = cpu_to_le32(nic->dma_addr + |
1414 | offsetof(struct mem, dump_buf)); | 1420 | offsetof(struct mem, dump_buf)); |
1421 | return 0; | ||
1415 | } | 1422 | } |
1416 | 1423 | ||
1417 | static int e100_phy_check_without_mii(struct nic *nic) | 1424 | static int e100_phy_check_without_mii(struct nic *nic) |
@@ -1581,7 +1588,7 @@ static int e100_hw_init(struct nic *nic) | |||
1581 | return 0; | 1588 | return 0; |
1582 | } | 1589 | } |
1583 | 1590 | ||
1584 | static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) | 1591 | static int e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) |
1585 | { | 1592 | { |
1586 | struct net_device *netdev = nic->netdev; | 1593 | struct net_device *netdev = nic->netdev; |
1587 | struct netdev_hw_addr *ha; | 1594 | struct netdev_hw_addr *ha; |
@@ -1596,6 +1603,7 @@ static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |||
1596 | memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &ha->addr, | 1603 | memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &ha->addr, |
1597 | ETH_ALEN); | 1604 | ETH_ALEN); |
1598 | } | 1605 | } |
1606 | return 0; | ||
1599 | } | 1607 | } |
1600 | 1608 | ||
1601 | static void e100_set_multicast_list(struct net_device *netdev) | 1609 | static void e100_set_multicast_list(struct net_device *netdev) |
@@ -1756,11 +1764,18 @@ static void e100_watchdog(unsigned long data) | |||
1756 | round_jiffies(jiffies + E100_WATCHDOG_PERIOD)); | 1764 | round_jiffies(jiffies + E100_WATCHDOG_PERIOD)); |
1757 | } | 1765 | } |
1758 | 1766 | ||
1759 | static void e100_xmit_prepare(struct nic *nic, struct cb *cb, | 1767 | static int e100_xmit_prepare(struct nic *nic, struct cb *cb, |
1760 | struct sk_buff *skb) | 1768 | struct sk_buff *skb) |
1761 | { | 1769 | { |
1770 | dma_addr_t dma_addr; | ||
1762 | cb->command = nic->tx_command; | 1771 | cb->command = nic->tx_command; |
1763 | 1772 | ||
1773 | dma_addr = pci_map_single(nic->pdev, | ||
1774 | skb->data, skb->len, PCI_DMA_TODEVICE); | ||
1775 | /* If we can't map the skb, have the upper layer try later */ | ||
1776 | if (pci_dma_mapping_error(nic->pdev, dma_addr)) | ||
1777 | return -ENOMEM; | ||
1778 | |||
1764 | /* | 1779 | /* |
1765 | * Use the last 4 bytes of the SKB payload packet as the CRC, used for | 1780 | * Use the last 4 bytes of the SKB payload packet as the CRC, used for |
1766 | * testing, ie sending frames with bad CRC. | 1781 | * testing, ie sending frames with bad CRC. |
@@ -1777,11 +1792,10 @@ static void e100_xmit_prepare(struct nic *nic, struct cb *cb, | |||
1777 | cb->u.tcb.tcb_byte_count = 0; | 1792 | cb->u.tcb.tcb_byte_count = 0; |
1778 | cb->u.tcb.threshold = nic->tx_threshold; | 1793 | cb->u.tcb.threshold = nic->tx_threshold; |
1779 | cb->u.tcb.tbd_count = 1; | 1794 | cb->u.tcb.tbd_count = 1; |
1780 | cb->u.tcb.tbd.buf_addr = cpu_to_le32(pci_map_single(nic->pdev, | 1795 | cb->u.tcb.tbd.buf_addr = cpu_to_le32(dma_addr); |
1781 | skb->data, skb->len, PCI_DMA_TODEVICE)); | ||
1782 | /* check for mapping failure? */ | ||
1783 | cb->u.tcb.tbd.size = cpu_to_le16(skb->len); | 1796 | cb->u.tcb.tbd.size = cpu_to_le16(skb->len); |
1784 | skb_tx_timestamp(skb); | 1797 | skb_tx_timestamp(skb); |
1798 | return 0; | ||
1785 | } | 1799 | } |
1786 | 1800 | ||
1787 | static netdev_tx_t e100_xmit_frame(struct sk_buff *skb, | 1801 | static netdev_tx_t e100_xmit_frame(struct sk_buff *skb, |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c index 43462d596a4e..ffd287196bf8 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c | |||
@@ -1053,6 +1053,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1053 | txdr->buffer_info[i].dma = | 1053 | txdr->buffer_info[i].dma = |
1054 | dma_map_single(&pdev->dev, skb->data, skb->len, | 1054 | dma_map_single(&pdev->dev, skb->data, skb->len, |
1055 | DMA_TO_DEVICE); | 1055 | DMA_TO_DEVICE); |
1056 | if (dma_mapping_error(&pdev->dev, txdr->buffer_info[i].dma)) { | ||
1057 | ret_val = 4; | ||
1058 | goto err_nomem; | ||
1059 | } | ||
1056 | tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); | 1060 | tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); |
1057 | tx_desc->lower.data = cpu_to_le32(skb->len); | 1061 | tx_desc->lower.data = cpu_to_le32(skb->len); |
1058 | tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | | 1062 | tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | |
@@ -1069,7 +1073,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1069 | rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), | 1073 | rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), |
1070 | GFP_KERNEL); | 1074 | GFP_KERNEL); |
1071 | if (!rxdr->buffer_info) { | 1075 | if (!rxdr->buffer_info) { |
1072 | ret_val = 4; | 1076 | ret_val = 5; |
1073 | goto err_nomem; | 1077 | goto err_nomem; |
1074 | } | 1078 | } |
1075 | 1079 | ||
@@ -1077,7 +1081,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1077 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, | 1081 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, |
1078 | GFP_KERNEL); | 1082 | GFP_KERNEL); |
1079 | if (!rxdr->desc) { | 1083 | if (!rxdr->desc) { |
1080 | ret_val = 5; | 1084 | ret_val = 6; |
1081 | goto err_nomem; | 1085 | goto err_nomem; |
1082 | } | 1086 | } |
1083 | memset(rxdr->desc, 0, rxdr->size); | 1087 | memset(rxdr->desc, 0, rxdr->size); |
@@ -1101,7 +1105,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1101 | 1105 | ||
1102 | skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); | 1106 | skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); |
1103 | if (!skb) { | 1107 | if (!skb) { |
1104 | ret_val = 6; | 1108 | ret_val = 7; |
1105 | goto err_nomem; | 1109 | goto err_nomem; |
1106 | } | 1110 | } |
1107 | skb_reserve(skb, NET_IP_ALIGN); | 1111 | skb_reserve(skb, NET_IP_ALIGN); |
@@ -1110,6 +1114,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1110 | rxdr->buffer_info[i].dma = | 1114 | rxdr->buffer_info[i].dma = |
1111 | dma_map_single(&pdev->dev, skb->data, | 1115 | dma_map_single(&pdev->dev, skb->data, |
1112 | E1000_RXBUFFER_2048, DMA_FROM_DEVICE); | 1116 | E1000_RXBUFFER_2048, DMA_FROM_DEVICE); |
1117 | if (dma_mapping_error(&pdev->dev, rxdr->buffer_info[i].dma)) { | ||
1118 | ret_val = 8; | ||
1119 | goto err_nomem; | ||
1120 | } | ||
1113 | rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); | 1121 | rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); |
1114 | memset(skb->data, 0x00, skb->len); | 1122 | memset(skb->data, 0x00, skb->len); |
1115 | } | 1123 | } |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 948b86ffa4f0..7e615e2bf7e6 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -848,11 +848,16 @@ check_page: | |||
848 | } | 848 | } |
849 | } | 849 | } |
850 | 850 | ||
851 | if (!buffer_info->dma) | 851 | if (!buffer_info->dma) { |
852 | buffer_info->dma = dma_map_page(&pdev->dev, | 852 | buffer_info->dma = dma_map_page(&pdev->dev, |
853 | buffer_info->page, 0, | 853 | buffer_info->page, 0, |
854 | PAGE_SIZE, | 854 | PAGE_SIZE, |
855 | DMA_FROM_DEVICE); | 855 | DMA_FROM_DEVICE); |
856 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { | ||
857 | adapter->alloc_rx_buff_failed++; | ||
858 | break; | ||
859 | } | ||
860 | } | ||
856 | 861 | ||
857 | rx_desc = E1000_RX_DESC_EXT(*rx_ring, i); | 862 | rx_desc = E1000_RX_DESC_EXT(*rx_ring, i); |
858 | rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); | 863 | rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index b64542acfa34..12b1d8480808 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
@@ -1818,27 +1818,32 @@ out: | |||
1818 | **/ | 1818 | **/ |
1819 | void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) | 1819 | void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) |
1820 | { | 1820 | { |
1821 | u32 dtxswc; | 1821 | u32 reg_val, reg_offset; |
1822 | 1822 | ||
1823 | switch (hw->mac.type) { | 1823 | switch (hw->mac.type) { |
1824 | case e1000_82576: | 1824 | case e1000_82576: |
1825 | reg_offset = E1000_DTXSWC; | ||
1826 | break; | ||
1825 | case e1000_i350: | 1827 | case e1000_i350: |
1826 | dtxswc = rd32(E1000_DTXSWC); | 1828 | reg_offset = E1000_TXSWC; |
1827 | if (enable) { | ||
1828 | dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1829 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1830 | /* The PF can spoof - it has to in order to | ||
1831 | * support emulation mode NICs */ | ||
1832 | dtxswc ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); | ||
1833 | } else { | ||
1834 | dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1835 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1836 | } | ||
1837 | wr32(E1000_DTXSWC, dtxswc); | ||
1838 | break; | 1829 | break; |
1839 | default: | 1830 | default: |
1840 | break; | 1831 | return; |
1832 | } | ||
1833 | |||
1834 | reg_val = rd32(reg_offset); | ||
1835 | if (enable) { | ||
1836 | reg_val |= (E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1837 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1838 | /* The PF can spoof - it has to in order to | ||
1839 | * support emulation mode NICs | ||
1840 | */ | ||
1841 | reg_val ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); | ||
1842 | } else { | ||
1843 | reg_val &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1844 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1841 | } | 1845 | } |
1846 | wr32(reg_offset, reg_val); | ||
1842 | } | 1847 | } |
1843 | 1848 | ||
1844 | /** | 1849 | /** |
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index 25151401c2ab..ab577a763a20 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h | |||
@@ -284,18 +284,10 @@ struct igb_q_vector { | |||
284 | enum e1000_ring_flags_t { | 284 | enum e1000_ring_flags_t { |
285 | IGB_RING_FLAG_RX_SCTP_CSUM, | 285 | IGB_RING_FLAG_RX_SCTP_CSUM, |
286 | IGB_RING_FLAG_RX_LB_VLAN_BSWAP, | 286 | IGB_RING_FLAG_RX_LB_VLAN_BSWAP, |
287 | IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, | ||
288 | IGB_RING_FLAG_TX_CTX_IDX, | 287 | IGB_RING_FLAG_TX_CTX_IDX, |
289 | IGB_RING_FLAG_TX_DETECT_HANG | 288 | IGB_RING_FLAG_TX_DETECT_HANG |
290 | }; | 289 | }; |
291 | 290 | ||
292 | #define ring_uses_build_skb(ring) \ | ||
293 | test_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) | ||
294 | #define set_ring_build_skb_enabled(ring) \ | ||
295 | set_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) | ||
296 | #define clear_ring_build_skb_enabled(ring) \ | ||
297 | clear_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags) | ||
298 | |||
299 | #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS) | 291 | #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS) |
300 | 292 | ||
301 | #define IGB_RX_DESC(R, i) \ | 293 | #define IGB_RX_DESC(R, i) \ |
diff --git a/drivers/net/ethernet/intel/igb/igb_hwmon.c b/drivers/net/ethernet/intel/igb/igb_hwmon.c index 4623502054d5..0478a1abe541 100644 --- a/drivers/net/ethernet/intel/igb/igb_hwmon.c +++ b/drivers/net/ethernet/intel/igb/igb_hwmon.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
40 | 40 | ||
41 | #ifdef CONFIG_IGB_HWMON | 41 | #ifdef CONFIG_IGB_HWMON |
42 | struct i2c_board_info i350_sensor_info = { | 42 | static struct i2c_board_info i350_sensor_info = { |
43 | I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)), | 43 | I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)), |
44 | }; | 44 | }; |
45 | 45 | ||
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 4dbd62968c7a..64f75291e3a5 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -2542,8 +2542,8 @@ static void igb_probe_vfs(struct igb_adapter *adapter) | |||
2542 | if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) | 2542 | if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) |
2543 | return; | 2543 | return; |
2544 | 2544 | ||
2545 | igb_enable_sriov(pdev, max_vfs); | ||
2546 | pci_sriov_set_totalvfs(pdev, 7); | 2545 | pci_sriov_set_totalvfs(pdev, 7); |
2546 | igb_enable_sriov(pdev, max_vfs); | ||
2547 | 2547 | ||
2548 | #endif /* CONFIG_PCI_IOV */ | 2548 | #endif /* CONFIG_PCI_IOV */ |
2549 | } | 2549 | } |
@@ -2652,7 +2652,7 @@ static int igb_sw_init(struct igb_adapter *adapter) | |||
2652 | if (max_vfs > 7) { | 2652 | if (max_vfs > 7) { |
2653 | dev_warn(&pdev->dev, | 2653 | dev_warn(&pdev->dev, |
2654 | "Maximum of 7 VFs per PF, using max\n"); | 2654 | "Maximum of 7 VFs per PF, using max\n"); |
2655 | adapter->vfs_allocated_count = 7; | 2655 | max_vfs = adapter->vfs_allocated_count = 7; |
2656 | } else | 2656 | } else |
2657 | adapter->vfs_allocated_count = max_vfs; | 2657 | adapter->vfs_allocated_count = max_vfs; |
2658 | if (adapter->vfs_allocated_count) | 2658 | if (adapter->vfs_allocated_count) |
@@ -3350,20 +3350,6 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, | |||
3350 | wr32(E1000_RXDCTL(reg_idx), rxdctl); | 3350 | wr32(E1000_RXDCTL(reg_idx), rxdctl); |
3351 | } | 3351 | } |
3352 | 3352 | ||
3353 | static void igb_set_rx_buffer_len(struct igb_adapter *adapter, | ||
3354 | struct igb_ring *rx_ring) | ||
3355 | { | ||
3356 | #define IGB_MAX_BUILD_SKB_SIZE \ | ||
3357 | (SKB_WITH_OVERHEAD(IGB_RX_BUFSZ) - \ | ||
3358 | (NET_SKB_PAD + NET_IP_ALIGN + IGB_TS_HDR_LEN)) | ||
3359 | |||
3360 | /* set build_skb flag */ | ||
3361 | if (adapter->max_frame_size <= IGB_MAX_BUILD_SKB_SIZE) | ||
3362 | set_ring_build_skb_enabled(rx_ring); | ||
3363 | else | ||
3364 | clear_ring_build_skb_enabled(rx_ring); | ||
3365 | } | ||
3366 | |||
3367 | /** | 3353 | /** |
3368 | * igb_configure_rx - Configure receive Unit after Reset | 3354 | * igb_configure_rx - Configure receive Unit after Reset |
3369 | * @adapter: board private structure | 3355 | * @adapter: board private structure |
@@ -3383,11 +3369,8 @@ static void igb_configure_rx(struct igb_adapter *adapter) | |||
3383 | 3369 | ||
3384 | /* Setup the HW Rx Head and Tail Descriptor Pointers and | 3370 | /* Setup the HW Rx Head and Tail Descriptor Pointers and |
3385 | * the Base and Length of the Rx Descriptor Ring */ | 3371 | * the Base and Length of the Rx Descriptor Ring */ |
3386 | for (i = 0; i < adapter->num_rx_queues; i++) { | 3372 | for (i = 0; i < adapter->num_rx_queues; i++) |
3387 | struct igb_ring *rx_ring = adapter->rx_ring[i]; | 3373 | igb_configure_rx_ring(adapter, adapter->rx_ring[i]); |
3388 | igb_set_rx_buffer_len(adapter, rx_ring); | ||
3389 | igb_configure_rx_ring(adapter, rx_ring); | ||
3390 | } | ||
3391 | } | 3374 | } |
3392 | 3375 | ||
3393 | /** | 3376 | /** |
@@ -6203,78 +6186,6 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring, | |||
6203 | return igb_can_reuse_rx_page(rx_buffer, page, truesize); | 6186 | return igb_can_reuse_rx_page(rx_buffer, page, truesize); |
6204 | } | 6187 | } |
6205 | 6188 | ||
6206 | static struct sk_buff *igb_build_rx_buffer(struct igb_ring *rx_ring, | ||
6207 | union e1000_adv_rx_desc *rx_desc) | ||
6208 | { | ||
6209 | struct igb_rx_buffer *rx_buffer; | ||
6210 | struct sk_buff *skb; | ||
6211 | struct page *page; | ||
6212 | void *page_addr; | ||
6213 | unsigned int size = le16_to_cpu(rx_desc->wb.upper.length); | ||
6214 | #if (PAGE_SIZE < 8192) | ||
6215 | unsigned int truesize = IGB_RX_BUFSZ; | ||
6216 | #else | ||
6217 | unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + | ||
6218 | SKB_DATA_ALIGN(NET_SKB_PAD + | ||
6219 | NET_IP_ALIGN + | ||
6220 | size); | ||
6221 | #endif | ||
6222 | |||
6223 | /* If we spanned a buffer we have a huge mess so test for it */ | ||
6224 | BUG_ON(unlikely(!igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP))); | ||
6225 | |||
6226 | rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; | ||
6227 | page = rx_buffer->page; | ||
6228 | prefetchw(page); | ||
6229 | |||
6230 | page_addr = page_address(page) + rx_buffer->page_offset; | ||
6231 | |||
6232 | /* prefetch first cache line of first page */ | ||
6233 | prefetch(page_addr + NET_SKB_PAD + NET_IP_ALIGN); | ||
6234 | #if L1_CACHE_BYTES < 128 | ||
6235 | prefetch(page_addr + L1_CACHE_BYTES + NET_SKB_PAD + NET_IP_ALIGN); | ||
6236 | #endif | ||
6237 | |||
6238 | /* build an skb to around the page buffer */ | ||
6239 | skb = build_skb(page_addr, truesize); | ||
6240 | if (unlikely(!skb)) { | ||
6241 | rx_ring->rx_stats.alloc_failed++; | ||
6242 | return NULL; | ||
6243 | } | ||
6244 | |||
6245 | /* we are reusing so sync this buffer for CPU use */ | ||
6246 | dma_sync_single_range_for_cpu(rx_ring->dev, | ||
6247 | rx_buffer->dma, | ||
6248 | rx_buffer->page_offset, | ||
6249 | IGB_RX_BUFSZ, | ||
6250 | DMA_FROM_DEVICE); | ||
6251 | |||
6252 | /* update pointers within the skb to store the data */ | ||
6253 | skb_reserve(skb, NET_IP_ALIGN + NET_SKB_PAD); | ||
6254 | __skb_put(skb, size); | ||
6255 | |||
6256 | /* pull timestamp out of packet data */ | ||
6257 | if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { | ||
6258 | igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb); | ||
6259 | __skb_pull(skb, IGB_TS_HDR_LEN); | ||
6260 | } | ||
6261 | |||
6262 | if (igb_can_reuse_rx_page(rx_buffer, page, truesize)) { | ||
6263 | /* hand second half of page back to the ring */ | ||
6264 | igb_reuse_rx_page(rx_ring, rx_buffer); | ||
6265 | } else { | ||
6266 | /* we are not reusing the buffer so unmap it */ | ||
6267 | dma_unmap_page(rx_ring->dev, rx_buffer->dma, | ||
6268 | PAGE_SIZE, DMA_FROM_DEVICE); | ||
6269 | } | ||
6270 | |||
6271 | /* clear contents of buffer_info */ | ||
6272 | rx_buffer->dma = 0; | ||
6273 | rx_buffer->page = NULL; | ||
6274 | |||
6275 | return skb; | ||
6276 | } | ||
6277 | |||
6278 | static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, | 6189 | static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, |
6279 | union e1000_adv_rx_desc *rx_desc, | 6190 | union e1000_adv_rx_desc *rx_desc, |
6280 | struct sk_buff *skb) | 6191 | struct sk_buff *skb) |
@@ -6690,10 +6601,7 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) | |||
6690 | rmb(); | 6601 | rmb(); |
6691 | 6602 | ||
6692 | /* retrieve a buffer from the ring */ | 6603 | /* retrieve a buffer from the ring */ |
6693 | if (ring_uses_build_skb(rx_ring)) | 6604 | skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb); |
6694 | skb = igb_build_rx_buffer(rx_ring, rx_desc); | ||
6695 | else | ||
6696 | skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb); | ||
6697 | 6605 | ||
6698 | /* exit if we failed to retrieve a buffer */ | 6606 | /* exit if we failed to retrieve a buffer */ |
6699 | if (!skb) | 6607 | if (!skb) |
@@ -6780,14 +6688,6 @@ static bool igb_alloc_mapped_page(struct igb_ring *rx_ring, | |||
6780 | return true; | 6688 | return true; |
6781 | } | 6689 | } |
6782 | 6690 | ||
6783 | static inline unsigned int igb_rx_offset(struct igb_ring *rx_ring) | ||
6784 | { | ||
6785 | if (ring_uses_build_skb(rx_ring)) | ||
6786 | return NET_SKB_PAD + NET_IP_ALIGN; | ||
6787 | else | ||
6788 | return 0; | ||
6789 | } | ||
6790 | |||
6791 | /** | 6691 | /** |
6792 | * igb_alloc_rx_buffers - Replace used receive buffers; packet split | 6692 | * igb_alloc_rx_buffers - Replace used receive buffers; packet split |
6793 | * @adapter: address of board private structure | 6693 | * @adapter: address of board private structure |
@@ -6814,9 +6714,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count) | |||
6814 | * Refresh the desc even if buffer_addrs didn't change | 6714 | * Refresh the desc even if buffer_addrs didn't change |
6815 | * because each write-back erases this info. | 6715 | * because each write-back erases this info. |
6816 | */ | 6716 | */ |
6817 | rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + | 6717 | rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + bi->page_offset); |
6818 | bi->page_offset + | ||
6819 | igb_rx_offset(rx_ring)); | ||
6820 | 6718 | ||
6821 | rx_desc++; | 6719 | rx_desc++; |
6822 | bi++; | 6720 | bi++; |
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index 0987822359f0..0a237507ee85 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c | |||
@@ -740,7 +740,7 @@ void igb_ptp_init(struct igb_adapter *adapter) | |||
740 | case e1000_82576: | 740 | case e1000_82576: |
741 | snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); | 741 | snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); |
742 | adapter->ptp_caps.owner = THIS_MODULE; | 742 | adapter->ptp_caps.owner = THIS_MODULE; |
743 | adapter->ptp_caps.max_adj = 1000000000; | 743 | adapter->ptp_caps.max_adj = 999999881; |
744 | adapter->ptp_caps.n_ext_ts = 0; | 744 | adapter->ptp_caps.n_ext_ts = 0; |
745 | adapter->ptp_caps.pps = 0; | 745 | adapter->ptp_caps.pps = 0; |
746 | adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; | 746 | adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; |
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index ea4808373435..b5f94abe3cff 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c | |||
@@ -2159,6 +2159,10 @@ map_skb: | |||
2159 | skb->data, | 2159 | skb->data, |
2160 | adapter->rx_buffer_len, | 2160 | adapter->rx_buffer_len, |
2161 | DMA_FROM_DEVICE); | 2161 | DMA_FROM_DEVICE); |
2162 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { | ||
2163 | adapter->alloc_rx_buff_failed++; | ||
2164 | break; | ||
2165 | } | ||
2162 | 2166 | ||
2163 | rx_desc = IXGB_RX_DESC(*rx_ring, i); | 2167 | rx_desc = IXGB_RX_DESC(*rx_ring, i); |
2164 | rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); | 2168 | rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); |
@@ -2168,7 +2172,8 @@ map_skb: | |||
2168 | rx_desc->status = 0; | 2172 | rx_desc->status = 0; |
2169 | 2173 | ||
2170 | 2174 | ||
2171 | if (++i == rx_ring->count) i = 0; | 2175 | if (++i == rx_ring->count) |
2176 | i = 0; | ||
2172 | buffer_info = &rx_ring->buffer_info[i]; | 2177 | buffer_info = &rx_ring->buffer_info[i]; |
2173 | } | 2178 | } |
2174 | 2179 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index db5611ae407e..79f4a26ea6cc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -7922,12 +7922,19 @@ static int __init ixgbe_init_module(void) | |||
7922 | ixgbe_dbg_init(); | 7922 | ixgbe_dbg_init(); |
7923 | #endif /* CONFIG_DEBUG_FS */ | 7923 | #endif /* CONFIG_DEBUG_FS */ |
7924 | 7924 | ||
7925 | ret = pci_register_driver(&ixgbe_driver); | ||
7926 | if (ret) { | ||
7927 | #ifdef CONFIG_DEBUG_FS | ||
7928 | ixgbe_dbg_exit(); | ||
7929 | #endif /* CONFIG_DEBUG_FS */ | ||
7930 | return ret; | ||
7931 | } | ||
7932 | |||
7925 | #ifdef CONFIG_IXGBE_DCA | 7933 | #ifdef CONFIG_IXGBE_DCA |
7926 | dca_register_notify(&dca_notifier); | 7934 | dca_register_notify(&dca_notifier); |
7927 | #endif | 7935 | #endif |
7928 | 7936 | ||
7929 | ret = pci_register_driver(&ixgbe_driver); | 7937 | return 0; |
7930 | return ret; | ||
7931 | } | 7938 | } |
7932 | 7939 | ||
7933 | module_init(ixgbe_init_module); | 7940 | module_init(ixgbe_init_module); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index d44b4d21268c..97e33669c0b9 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | |||
@@ -1049,6 +1049,12 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) | |||
1049 | if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) | 1049 | if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) |
1050 | return -EINVAL; | 1050 | return -EINVAL; |
1051 | if (vlan || qos) { | 1051 | if (vlan || qos) { |
1052 | if (adapter->vfinfo[vf].pf_vlan) | ||
1053 | err = ixgbe_set_vf_vlan(adapter, false, | ||
1054 | adapter->vfinfo[vf].pf_vlan, | ||
1055 | vf); | ||
1056 | if (err) | ||
1057 | goto out; | ||
1052 | err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); | 1058 | err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); |
1053 | if (err) | 1059 | if (err) |
1054 | goto out; | 1060 | goto out; |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index c3db6cd69b68..2b6cb5ca48ee 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -944,9 +944,17 @@ free_queue_irqs: | |||
944 | free_irq(adapter->msix_entries[vector].vector, | 944 | free_irq(adapter->msix_entries[vector].vector, |
945 | adapter->q_vector[vector]); | 945 | adapter->q_vector[vector]); |
946 | } | 946 | } |
947 | pci_disable_msix(adapter->pdev); | 947 | /* This failure is non-recoverable - it indicates the system is |
948 | kfree(adapter->msix_entries); | 948 | * out of MSIX vector resources and the VF driver cannot run |
949 | adapter->msix_entries = NULL; | 949 | * without them. Set the number of msix vectors to zero |
950 | * indicating that not enough can be allocated. The error | ||
951 | * will be returned to the user indicating device open failed. | ||
952 | * Any further attempts to force the driver to open will also | ||
953 | * fail. The only way to recover is to unload the driver and | ||
954 | * reload it again. If the system has recovered some MSIX | ||
955 | * vectors then it may succeed. | ||
956 | */ | ||
957 | adapter->num_msix_vectors = 0; | ||
950 | return err; | 958 | return err; |
951 | } | 959 | } |
952 | 960 | ||
@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2572 | struct ixgbe_hw *hw = &adapter->hw; | 2580 | struct ixgbe_hw *hw = &adapter->hw; |
2573 | int err; | 2581 | int err; |
2574 | 2582 | ||
2583 | /* A previous failure to open the device because of a lack of | ||
2584 | * available MSIX vector resources may have reset the number | ||
2585 | * of msix vectors variable to zero. The only way to recover | ||
2586 | * is to unload/reload the driver and hope that the system has | ||
2587 | * been able to recover some MSIX vector resources. | ||
2588 | */ | ||
2589 | if (!adapter->num_msix_vectors) | ||
2590 | return -ENOMEM; | ||
2591 | |||
2575 | /* disallow open during test */ | 2592 | /* disallow open during test */ |
2576 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) | 2593 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) |
2577 | return -EBUSY; | 2594 | return -EBUSY; |
@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2628 | 2645 | ||
2629 | err_req_irq: | 2646 | err_req_irq: |
2630 | ixgbevf_down(adapter); | 2647 | ixgbevf_down(adapter); |
2631 | ixgbevf_free_irq(adapter); | ||
2632 | err_setup_rx: | 2648 | err_setup_rx: |
2633 | ixgbevf_free_all_rx_resources(adapter); | 2649 | ixgbevf_free_all_rx_resources(adapter); |
2634 | err_setup_tx: | 2650 | err_setup_tx: |
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index 6a2127489af7..bfdb06860397 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c | |||
@@ -769,7 +769,7 @@ ltq_etop_probe(struct platform_device *pdev) | |||
769 | return 0; | 769 | return 0; |
770 | 770 | ||
771 | err_free: | 771 | err_free: |
772 | kfree(dev); | 772 | free_netdev(dev); |
773 | err_out: | 773 | err_out: |
774 | return err; | 774 | return err; |
775 | } | 775 | } |
diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig index edfba9370922..434e33c527df 100644 --- a/drivers/net/ethernet/marvell/Kconfig +++ b/drivers/net/ethernet/marvell/Kconfig | |||
@@ -33,6 +33,7 @@ config MV643XX_ETH | |||
33 | 33 | ||
34 | config MVMDIO | 34 | config MVMDIO |
35 | tristate "Marvell MDIO interface support" | 35 | tristate "Marvell MDIO interface support" |
36 | select PHYLIB | ||
36 | ---help--- | 37 | ---help--- |
37 | This driver supports the MDIO interface found in the network | 38 | This driver supports the MDIO interface found in the network |
38 | interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, | 39 | interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, |
@@ -45,7 +46,6 @@ config MVMDIO | |||
45 | config MVNETA | 46 | config MVNETA |
46 | tristate "Marvell Armada 370/XP network interface support" | 47 | tristate "Marvell Armada 370/XP network interface support" |
47 | depends on MACH_ARMADA_370_XP | 48 | depends on MACH_ARMADA_370_XP |
48 | select PHYLIB | ||
49 | select MVMDIO | 49 | select MVMDIO |
50 | ---help--- | 50 | ---help--- |
51 | This driver supports the network interface units in the | 51 | This driver supports the network interface units in the |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index cd345b8969bc..a47a097c21e1 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -374,7 +374,6 @@ static int rxq_number = 8; | |||
374 | static int txq_number = 8; | 374 | static int txq_number = 8; |
375 | 375 | ||
376 | static int rxq_def; | 376 | static int rxq_def; |
377 | static int txq_def; | ||
378 | 377 | ||
379 | #define MVNETA_DRIVER_NAME "mvneta" | 378 | #define MVNETA_DRIVER_NAME "mvneta" |
380 | #define MVNETA_DRIVER_VERSION "1.0" | 379 | #define MVNETA_DRIVER_VERSION "1.0" |
@@ -1475,7 +1474,8 @@ error: | |||
1475 | static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) | 1474 | static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) |
1476 | { | 1475 | { |
1477 | struct mvneta_port *pp = netdev_priv(dev); | 1476 | struct mvneta_port *pp = netdev_priv(dev); |
1478 | struct mvneta_tx_queue *txq = &pp->txqs[txq_def]; | 1477 | u16 txq_id = skb_get_queue_mapping(skb); |
1478 | struct mvneta_tx_queue *txq = &pp->txqs[txq_id]; | ||
1479 | struct mvneta_tx_desc *tx_desc; | 1479 | struct mvneta_tx_desc *tx_desc; |
1480 | struct netdev_queue *nq; | 1480 | struct netdev_queue *nq; |
1481 | int frags = 0; | 1481 | int frags = 0; |
@@ -1485,7 +1485,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) | |||
1485 | goto out; | 1485 | goto out; |
1486 | 1486 | ||
1487 | frags = skb_shinfo(skb)->nr_frags + 1; | 1487 | frags = skb_shinfo(skb)->nr_frags + 1; |
1488 | nq = netdev_get_tx_queue(dev, txq_def); | 1488 | nq = netdev_get_tx_queue(dev, txq_id); |
1489 | 1489 | ||
1490 | /* Get a descriptor for the first part of the packet */ | 1490 | /* Get a descriptor for the first part of the packet */ |
1491 | tx_desc = mvneta_txq_next_desc_get(txq); | 1491 | tx_desc = mvneta_txq_next_desc_get(txq); |
@@ -2689,7 +2689,7 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2689 | return -EINVAL; | 2689 | return -EINVAL; |
2690 | } | 2690 | } |
2691 | 2691 | ||
2692 | dev = alloc_etherdev_mq(sizeof(struct mvneta_port), 8); | 2692 | dev = alloc_etherdev_mqs(sizeof(struct mvneta_port), txq_number, rxq_number); |
2693 | if (!dev) | 2693 | if (!dev) |
2694 | return -ENOMEM; | 2694 | return -ENOMEM; |
2695 | 2695 | ||
@@ -2771,16 +2771,17 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2771 | 2771 | ||
2772 | netif_napi_add(dev, &pp->napi, mvneta_poll, pp->weight); | 2772 | netif_napi_add(dev, &pp->napi, mvneta_poll, pp->weight); |
2773 | 2773 | ||
2774 | dev->features = NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2775 | dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2776 | dev->vlan_features |= NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2777 | dev->priv_flags |= IFF_UNICAST_FLT; | ||
2778 | |||
2774 | err = register_netdev(dev); | 2779 | err = register_netdev(dev); |
2775 | if (err < 0) { | 2780 | if (err < 0) { |
2776 | dev_err(&pdev->dev, "failed to register\n"); | 2781 | dev_err(&pdev->dev, "failed to register\n"); |
2777 | goto err_deinit; | 2782 | goto err_deinit; |
2778 | } | 2783 | } |
2779 | 2784 | ||
2780 | dev->features = NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2781 | dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM; | ||
2782 | dev->priv_flags |= IFF_UNICAST_FLT; | ||
2783 | |||
2784 | netdev_info(dev, "mac: %pM\n", dev->dev_addr); | 2785 | netdev_info(dev, "mac: %pM\n", dev->dev_addr); |
2785 | 2786 | ||
2786 | platform_set_drvdata(pdev, pp->dev); | 2787 | platform_set_drvdata(pdev, pp->dev); |
@@ -2843,4 +2844,3 @@ module_param(rxq_number, int, S_IRUGO); | |||
2843 | module_param(txq_number, int, S_IRUGO); | 2844 | module_param(txq_number, int, S_IRUGO); |
2844 | 2845 | ||
2845 | module_param(rxq_def, int, S_IRUGO); | 2846 | module_param(rxq_def, int, S_IRUGO); |
2846 | module_param(txq_def, int, S_IRUGO); | ||
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index fc07ca35721b..6a0e671fcecd 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -1067,7 +1067,7 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 space) | |||
1067 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp); | 1067 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp); |
1068 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2); | 1068 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2); |
1069 | 1069 | ||
1070 | tp = space - 2048/8; | 1070 | tp = space - 8192/8; |
1071 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); | 1071 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); |
1072 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); | 1072 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); |
1073 | } else { | 1073 | } else { |
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h index 615ac63ea860..ec6dcd80152b 100644 --- a/drivers/net/ethernet/marvell/sky2.h +++ b/drivers/net/ethernet/marvell/sky2.h | |||
@@ -2074,7 +2074,7 @@ enum { | |||
2074 | GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ | 2074 | GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ |
2075 | GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ | 2075 | GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ |
2076 | 2076 | ||
2077 | #define GMAC_DEF_MSK GM_IS_TX_FF_UR | 2077 | #define GMAC_DEF_MSK (GM_IS_TX_FF_UR | GM_IS_RX_FF_OR) |
2078 | }; | 2078 | }; |
2079 | 2079 | ||
2080 | /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ | 2080 | /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 995d4b6d5c1e..30d78f806dc3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -411,8 +411,8 @@ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
411 | 411 | ||
412 | static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) | 412 | static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) |
413 | { | 413 | { |
414 | unsigned int i; | 414 | int i; |
415 | for (i = ETH_ALEN - 1; i; --i) { | 415 | for (i = ETH_ALEN - 1; i >= 0; --i) { |
416 | dst_mac[i] = src_mac & 0xff; | 416 | dst_mac[i] = src_mac & 0xff; |
417 | src_mac >>= 8; | 417 | src_mac >>= 8; |
418 | } | 418 | } |
@@ -1637,6 +1637,17 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) | |||
1637 | /* Flush multicast filter */ | 1637 | /* Flush multicast filter */ |
1638 | mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, 1, MLX4_MCAST_CONFIG); | 1638 | mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, 1, MLX4_MCAST_CONFIG); |
1639 | 1639 | ||
1640 | /* Remove flow steering rules for the port*/ | ||
1641 | if (mdev->dev->caps.steering_mode == | ||
1642 | MLX4_STEERING_MODE_DEVICE_MANAGED) { | ||
1643 | ASSERT_RTNL(); | ||
1644 | list_for_each_entry_safe(flow, tmp_flow, | ||
1645 | &priv->ethtool_list, list) { | ||
1646 | mlx4_flow_detach(mdev->dev, flow->id); | ||
1647 | list_del(&flow->list); | ||
1648 | } | ||
1649 | } | ||
1650 | |||
1640 | mlx4_en_destroy_drop_qp(priv); | 1651 | mlx4_en_destroy_drop_qp(priv); |
1641 | 1652 | ||
1642 | /* Free TX Rings */ | 1653 | /* Free TX Rings */ |
@@ -1657,17 +1668,6 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) | |||
1657 | if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN)) | 1668 | if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN)) |
1658 | mdev->mac_removed[priv->port] = 1; | 1669 | mdev->mac_removed[priv->port] = 1; |
1659 | 1670 | ||
1660 | /* Remove flow steering rules for the port*/ | ||
1661 | if (mdev->dev->caps.steering_mode == | ||
1662 | MLX4_STEERING_MODE_DEVICE_MANAGED) { | ||
1663 | ASSERT_RTNL(); | ||
1664 | list_for_each_entry_safe(flow, tmp_flow, | ||
1665 | &priv->ethtool_list, list) { | ||
1666 | mlx4_flow_detach(mdev->dev, flow->id); | ||
1667 | list_del(&flow->list); | ||
1668 | } | ||
1669 | } | ||
1670 | |||
1671 | /* Free RX Rings */ | 1671 | /* Free RX Rings */ |
1672 | for (i = 0; i < priv->rx_ring_num; i++) { | 1672 | for (i = 0; i < priv->rx_ring_num; i++) { |
1673 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); | 1673 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index 251ae2f93116..8e3123a1df88 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -771,7 +771,7 @@ int mlx4_MAP_EQ_wrapper(struct mlx4_dev *dev, int slave, | |||
771 | struct mlx4_slave_event_eq_info *event_eq = | 771 | struct mlx4_slave_event_eq_info *event_eq = |
772 | priv->mfunc.master.slave_state[slave].event_eq; | 772 | priv->mfunc.master.slave_state[slave].event_eq; |
773 | u32 in_modifier = vhcr->in_modifier; | 773 | u32 in_modifier = vhcr->in_modifier; |
774 | u32 eqn = in_modifier & 0x1FF; | 774 | u32 eqn = in_modifier & 0x3FF; |
775 | u64 in_param = vhcr->in_param; | 775 | u64 in_param = vhcr->in_param; |
776 | int err = 0; | 776 | int err = 0; |
777 | int i; | 777 | int i; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 2995687f1aee..1391b52f443a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -99,6 +99,7 @@ struct res_qp { | |||
99 | struct list_head mcg_list; | 99 | struct list_head mcg_list; |
100 | spinlock_t mcg_spl; | 100 | spinlock_t mcg_spl; |
101 | int local_qpn; | 101 | int local_qpn; |
102 | atomic_t ref_count; | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | enum res_mtt_states { | 105 | enum res_mtt_states { |
@@ -197,6 +198,7 @@ enum res_fs_rule_states { | |||
197 | 198 | ||
198 | struct res_fs_rule { | 199 | struct res_fs_rule { |
199 | struct res_common com; | 200 | struct res_common com; |
201 | int qpn; | ||
200 | }; | 202 | }; |
201 | 203 | ||
202 | static void *res_tracker_lookup(struct rb_root *root, u64 res_id) | 204 | static void *res_tracker_lookup(struct rb_root *root, u64 res_id) |
@@ -355,7 +357,7 @@ static int mpt_mask(struct mlx4_dev *dev) | |||
355 | return dev->caps.num_mpts - 1; | 357 | return dev->caps.num_mpts - 1; |
356 | } | 358 | } |
357 | 359 | ||
358 | static void *find_res(struct mlx4_dev *dev, int res_id, | 360 | static void *find_res(struct mlx4_dev *dev, u64 res_id, |
359 | enum mlx4_resource type) | 361 | enum mlx4_resource type) |
360 | { | 362 | { |
361 | struct mlx4_priv *priv = mlx4_priv(dev); | 363 | struct mlx4_priv *priv = mlx4_priv(dev); |
@@ -447,6 +449,7 @@ static struct res_common *alloc_qp_tr(int id) | |||
447 | ret->local_qpn = id; | 449 | ret->local_qpn = id; |
448 | INIT_LIST_HEAD(&ret->mcg_list); | 450 | INIT_LIST_HEAD(&ret->mcg_list); |
449 | spin_lock_init(&ret->mcg_spl); | 451 | spin_lock_init(&ret->mcg_spl); |
452 | atomic_set(&ret->ref_count, 0); | ||
450 | 453 | ||
451 | return &ret->com; | 454 | return &ret->com; |
452 | } | 455 | } |
@@ -554,7 +557,7 @@ static struct res_common *alloc_xrcdn_tr(int id) | |||
554 | return &ret->com; | 557 | return &ret->com; |
555 | } | 558 | } |
556 | 559 | ||
557 | static struct res_common *alloc_fs_rule_tr(u64 id) | 560 | static struct res_common *alloc_fs_rule_tr(u64 id, int qpn) |
558 | { | 561 | { |
559 | struct res_fs_rule *ret; | 562 | struct res_fs_rule *ret; |
560 | 563 | ||
@@ -564,7 +567,7 @@ static struct res_common *alloc_fs_rule_tr(u64 id) | |||
564 | 567 | ||
565 | ret->com.res_id = id; | 568 | ret->com.res_id = id; |
566 | ret->com.state = RES_FS_RULE_ALLOCATED; | 569 | ret->com.state = RES_FS_RULE_ALLOCATED; |
567 | 570 | ret->qpn = qpn; | |
568 | return &ret->com; | 571 | return &ret->com; |
569 | } | 572 | } |
570 | 573 | ||
@@ -602,7 +605,7 @@ static struct res_common *alloc_tr(u64 id, enum mlx4_resource type, int slave, | |||
602 | ret = alloc_xrcdn_tr(id); | 605 | ret = alloc_xrcdn_tr(id); |
603 | break; | 606 | break; |
604 | case RES_FS_RULE: | 607 | case RES_FS_RULE: |
605 | ret = alloc_fs_rule_tr(id); | 608 | ret = alloc_fs_rule_tr(id, extra); |
606 | break; | 609 | break; |
607 | default: | 610 | default: |
608 | return NULL; | 611 | return NULL; |
@@ -671,10 +674,14 @@ undo: | |||
671 | 674 | ||
672 | static int remove_qp_ok(struct res_qp *res) | 675 | static int remove_qp_ok(struct res_qp *res) |
673 | { | 676 | { |
674 | if (res->com.state == RES_QP_BUSY) | 677 | if (res->com.state == RES_QP_BUSY || atomic_read(&res->ref_count) || |
678 | !list_empty(&res->mcg_list)) { | ||
679 | pr_err("resource tracker: fail to remove qp, state %d, ref_count %d\n", | ||
680 | res->com.state, atomic_read(&res->ref_count)); | ||
675 | return -EBUSY; | 681 | return -EBUSY; |
676 | else if (res->com.state != RES_QP_RESERVED) | 682 | } else if (res->com.state != RES_QP_RESERVED) { |
677 | return -EPERM; | 683 | return -EPERM; |
684 | } | ||
678 | 685 | ||
679 | return 0; | 686 | return 0; |
680 | } | 687 | } |
@@ -3124,6 +3131,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3124 | struct list_head *rlist = &tracker->slave_list[slave].res_list[RES_MAC]; | 3131 | struct list_head *rlist = &tracker->slave_list[slave].res_list[RES_MAC]; |
3125 | int err; | 3132 | int err; |
3126 | int qpn; | 3133 | int qpn; |
3134 | struct res_qp *rqp; | ||
3127 | struct mlx4_net_trans_rule_hw_ctrl *ctrl; | 3135 | struct mlx4_net_trans_rule_hw_ctrl *ctrl; |
3128 | struct _rule_hw *rule_header; | 3136 | struct _rule_hw *rule_header; |
3129 | int header_id; | 3137 | int header_id; |
@@ -3134,7 +3142,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3134 | 3142 | ||
3135 | ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf; | 3143 | ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf; |
3136 | qpn = be32_to_cpu(ctrl->qpn) & 0xffffff; | 3144 | qpn = be32_to_cpu(ctrl->qpn) & 0xffffff; |
3137 | err = get_res(dev, slave, qpn, RES_QP, NULL); | 3145 | err = get_res(dev, slave, qpn, RES_QP, &rqp); |
3138 | if (err) { | 3146 | if (err) { |
3139 | pr_err("Steering rule with qpn 0x%x rejected.\n", qpn); | 3147 | pr_err("Steering rule with qpn 0x%x rejected.\n", qpn); |
3140 | return err; | 3148 | return err; |
@@ -3175,14 +3183,16 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3175 | if (err) | 3183 | if (err) |
3176 | goto err_put; | 3184 | goto err_put; |
3177 | 3185 | ||
3178 | err = add_res_range(dev, slave, vhcr->out_param, 1, RES_FS_RULE, 0); | 3186 | err = add_res_range(dev, slave, vhcr->out_param, 1, RES_FS_RULE, qpn); |
3179 | if (err) { | 3187 | if (err) { |
3180 | mlx4_err(dev, "Fail to add flow steering resources.\n "); | 3188 | mlx4_err(dev, "Fail to add flow steering resources.\n "); |
3181 | /* detach rule*/ | 3189 | /* detach rule*/ |
3182 | mlx4_cmd(dev, vhcr->out_param, 0, 0, | 3190 | mlx4_cmd(dev, vhcr->out_param, 0, 0, |
3183 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, | 3191 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, |
3184 | MLX4_CMD_NATIVE); | 3192 | MLX4_CMD_NATIVE); |
3193 | goto err_put; | ||
3185 | } | 3194 | } |
3195 | atomic_inc(&rqp->ref_count); | ||
3186 | err_put: | 3196 | err_put: |
3187 | put_res(dev, slave, qpn, RES_QP); | 3197 | put_res(dev, slave, qpn, RES_QP); |
3188 | return err; | 3198 | return err; |
@@ -3195,20 +3205,35 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3195 | struct mlx4_cmd_info *cmd) | 3205 | struct mlx4_cmd_info *cmd) |
3196 | { | 3206 | { |
3197 | int err; | 3207 | int err; |
3208 | struct res_qp *rqp; | ||
3209 | struct res_fs_rule *rrule; | ||
3198 | 3210 | ||
3199 | if (dev->caps.steering_mode != | 3211 | if (dev->caps.steering_mode != |
3200 | MLX4_STEERING_MODE_DEVICE_MANAGED) | 3212 | MLX4_STEERING_MODE_DEVICE_MANAGED) |
3201 | return -EOPNOTSUPP; | 3213 | return -EOPNOTSUPP; |
3202 | 3214 | ||
3215 | err = get_res(dev, slave, vhcr->in_param, RES_FS_RULE, &rrule); | ||
3216 | if (err) | ||
3217 | return err; | ||
3218 | /* Release the rule form busy state before removal */ | ||
3219 | put_res(dev, slave, vhcr->in_param, RES_FS_RULE); | ||
3220 | err = get_res(dev, slave, rrule->qpn, RES_QP, &rqp); | ||
3221 | if (err) | ||
3222 | return err; | ||
3223 | |||
3203 | err = rem_res_range(dev, slave, vhcr->in_param, 1, RES_FS_RULE, 0); | 3224 | err = rem_res_range(dev, slave, vhcr->in_param, 1, RES_FS_RULE, 0); |
3204 | if (err) { | 3225 | if (err) { |
3205 | mlx4_err(dev, "Fail to remove flow steering resources.\n "); | 3226 | mlx4_err(dev, "Fail to remove flow steering resources.\n "); |
3206 | return err; | 3227 | goto out; |
3207 | } | 3228 | } |
3208 | 3229 | ||
3209 | err = mlx4_cmd(dev, vhcr->in_param, 0, 0, | 3230 | err = mlx4_cmd(dev, vhcr->in_param, 0, 0, |
3210 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, | 3231 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, |
3211 | MLX4_CMD_NATIVE); | 3232 | MLX4_CMD_NATIVE); |
3233 | if (!err) | ||
3234 | atomic_dec(&rqp->ref_count); | ||
3235 | out: | ||
3236 | put_res(dev, slave, rrule->qpn, RES_QP); | ||
3212 | return err; | 3237 | return err; |
3213 | } | 3238 | } |
3214 | 3239 | ||
@@ -3806,6 +3831,7 @@ void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave) | |||
3806 | mutex_lock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); | 3831 | mutex_lock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); |
3807 | /*VLAN*/ | 3832 | /*VLAN*/ |
3808 | rem_slave_macs(dev, slave); | 3833 | rem_slave_macs(dev, slave); |
3834 | rem_slave_fs_rule(dev, slave); | ||
3809 | rem_slave_qps(dev, slave); | 3835 | rem_slave_qps(dev, slave); |
3810 | rem_slave_srqs(dev, slave); | 3836 | rem_slave_srqs(dev, slave); |
3811 | rem_slave_cqs(dev, slave); | 3837 | rem_slave_cqs(dev, slave); |
@@ -3814,6 +3840,5 @@ void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave) | |||
3814 | rem_slave_mtts(dev, slave); | 3840 | rem_slave_mtts(dev, slave); |
3815 | rem_slave_counters(dev, slave); | 3841 | rem_slave_counters(dev, slave); |
3816 | rem_slave_xrcdns(dev, slave); | 3842 | rem_slave_xrcdns(dev, slave); |
3817 | rem_slave_fs_rule(dev, slave); | ||
3818 | mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); | 3843 | mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); |
3819 | } | 3844 | } |
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index 33bcb63d56a2..8fb481252e2c 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
@@ -528,7 +528,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) | |||
528 | for (; rxfc != 0; rxfc--) { | 528 | for (; rxfc != 0; rxfc--) { |
529 | rxh = ks8851_rdreg32(ks, KS_RXFHSR); | 529 | rxh = ks8851_rdreg32(ks, KS_RXFHSR); |
530 | rxstat = rxh & 0xffff; | 530 | rxstat = rxh & 0xffff; |
531 | rxlen = rxh >> 16; | 531 | rxlen = (rxh >> 16) & 0xfff; |
532 | 532 | ||
533 | netif_dbg(ks, rx_status, ks->netdev, | 533 | netif_dbg(ks, rx_status, ks->netdev, |
534 | "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen); | 534 | "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen); |
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index c4122c86f829..efa29b712d5f 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1472,7 +1472,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) | |||
1472 | } | 1472 | } |
1473 | platform_set_drvdata(pdev, ndev); | 1473 | platform_set_drvdata(pdev, ndev); |
1474 | 1474 | ||
1475 | if (lpc_mii_init(pldat) != 0) | 1475 | ret = lpc_mii_init(pldat); |
1476 | if (ret) | ||
1476 | goto err_out_unregister_netdev; | 1477 | goto err_out_unregister_netdev; |
1477 | 1478 | ||
1478 | netdev_info(ndev, "LPC mac at 0x%08x irq %d\n", | 1479 | netdev_info(ndev, "LPC mac at 0x%08x irq %d\n", |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index 39ab4d09faaa..73ce7dd6b954 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
@@ -1726,9 +1726,9 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter, | |||
1726 | 1726 | ||
1727 | skb->protocol = eth_type_trans(skb, netdev); | 1727 | skb->protocol = eth_type_trans(skb, netdev); |
1728 | if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) | 1728 | if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) |
1729 | skb->ip_summed = CHECKSUM_NONE; | ||
1730 | else | ||
1731 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1729 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1730 | else | ||
1731 | skb->ip_summed = CHECKSUM_NONE; | ||
1732 | 1732 | ||
1733 | napi_gro_receive(&adapter->napi, skb); | 1733 | napi_gro_receive(&adapter->napi, skb); |
1734 | (*work_done)++; | 1734 | (*work_done)++; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index cd5ae8813cb3..edd63f1230f3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -1500,6 +1500,12 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) | |||
1500 | } | 1500 | } |
1501 | } while ((adapter->ahw->linkup && ahw->has_link_events) != 1); | 1501 | } while ((adapter->ahw->linkup && ahw->has_link_events) != 1); |
1502 | 1502 | ||
1503 | /* Make sure carrier is off and queue is stopped during loopback */ | ||
1504 | if (netif_running(netdev)) { | ||
1505 | netif_carrier_off(netdev); | ||
1506 | netif_stop_queue(netdev); | ||
1507 | } | ||
1508 | |||
1503 | ret = qlcnic_do_lb_test(adapter, mode); | 1509 | ret = qlcnic_do_lb_test(adapter, mode); |
1504 | 1510 | ||
1505 | qlcnic_83xx_clear_lb_mode(adapter, mode); | 1511 | qlcnic_83xx_clear_lb_mode(adapter, mode); |
@@ -2780,6 +2786,7 @@ static u64 *qlcnic_83xx_fill_stats(struct qlcnic_adapter *adapter, | |||
2780 | void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) | 2786 | void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) |
2781 | { | 2787 | { |
2782 | struct qlcnic_cmd_args cmd; | 2788 | struct qlcnic_cmd_args cmd; |
2789 | struct net_device *netdev = adapter->netdev; | ||
2783 | int ret = 0; | 2790 | int ret = 0; |
2784 | 2791 | ||
2785 | qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_STATISTICS); | 2792 | qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_STATISTICS); |
@@ -2789,7 +2796,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) | |||
2789 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, | 2796 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, |
2790 | QLC_83XX_STAT_TX, &ret); | 2797 | QLC_83XX_STAT_TX, &ret); |
2791 | if (ret) { | 2798 | if (ret) { |
2792 | dev_info(&adapter->pdev->dev, "Error getting MAC stats\n"); | 2799 | netdev_err(netdev, "Error getting Tx stats\n"); |
2793 | goto out; | 2800 | goto out; |
2794 | } | 2801 | } |
2795 | /* Get MAC stats */ | 2802 | /* Get MAC stats */ |
@@ -2799,8 +2806,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) | |||
2799 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, | 2806 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, |
2800 | QLC_83XX_STAT_MAC, &ret); | 2807 | QLC_83XX_STAT_MAC, &ret); |
2801 | if (ret) { | 2808 | if (ret) { |
2802 | dev_info(&adapter->pdev->dev, | 2809 | netdev_err(netdev, "Error getting MAC stats\n"); |
2803 | "Error getting Rx stats\n"); | ||
2804 | goto out; | 2810 | goto out; |
2805 | } | 2811 | } |
2806 | /* Get Rx stats */ | 2812 | /* Get Rx stats */ |
@@ -2810,8 +2816,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) | |||
2810 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, | 2816 | data = qlcnic_83xx_fill_stats(adapter, &cmd, data, |
2811 | QLC_83XX_STAT_RX, &ret); | 2817 | QLC_83XX_STAT_RX, &ret); |
2812 | if (ret) | 2818 | if (ret) |
2813 | dev_info(&adapter->pdev->dev, | 2819 | netdev_err(netdev, "Error getting Rx stats\n"); |
2814 | "Error getting Tx stats\n"); | ||
2815 | out: | 2820 | out: |
2816 | qlcnic_free_mbx_args(&cmd); | 2821 | qlcnic_free_mbx_args(&cmd); |
2817 | } | 2822 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index 0e630061bff3..5fa847fe388a 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | |||
@@ -358,8 +358,7 @@ set_flags: | |||
358 | memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN); | 358 | memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN); |
359 | } | 359 | } |
360 | opcode = TX_ETHER_PKT; | 360 | opcode = TX_ETHER_PKT; |
361 | if ((adapter->netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && | 361 | if (skb_is_gso(skb)) { |
362 | skb_shinfo(skb)->gso_size > 0) { | ||
363 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 362 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
364 | first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | 363 | first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
365 | first_desc->total_hdr_length = hdr_len; | 364 | first_desc->total_hdr_length = hdr_len; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index 987fb6f8adc3..5ef328af61d0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -200,10 +200,10 @@ beacon_err: | |||
200 | } | 200 | } |
201 | 201 | ||
202 | err = qlcnic_config_led(adapter, b_state, b_rate); | 202 | err = qlcnic_config_led(adapter, b_state, b_rate); |
203 | if (!err) | 203 | if (!err) { |
204 | err = len; | 204 | err = len; |
205 | else | ||
206 | ahw->beacon_state = b_state; | 205 | ahw->beacon_state = b_state; |
206 | } | ||
207 | 207 | ||
208 | if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) | 208 | if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) |
209 | qlcnic_diag_free_res(adapter->netdev, max_sds_rings); | 209 | qlcnic_diag_free_res(adapter->netdev, max_sds_rings); |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h index a131d7b5d2fe..7e8d68263963 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge.h +++ b/drivers/net/ethernet/qlogic/qlge/qlge.h | |||
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #define DRV_NAME "qlge" | 19 | #define DRV_NAME "qlge" |
20 | #define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " | 20 | #define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " |
21 | #define DRV_VERSION "v1.00.00.31" | 21 | #define DRV_VERSION "v1.00.00.32" |
22 | 22 | ||
23 | #define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ | 23 | #define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ |
24 | 24 | ||
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c index 6f316ab23257..0780e039b271 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c | |||
@@ -379,13 +379,13 @@ static int ql_get_settings(struct net_device *ndev, | |||
379 | 379 | ||
380 | ecmd->supported = SUPPORTED_10000baseT_Full; | 380 | ecmd->supported = SUPPORTED_10000baseT_Full; |
381 | ecmd->advertising = ADVERTISED_10000baseT_Full; | 381 | ecmd->advertising = ADVERTISED_10000baseT_Full; |
382 | ecmd->autoneg = AUTONEG_ENABLE; | ||
383 | ecmd->transceiver = XCVR_EXTERNAL; | 382 | ecmd->transceiver = XCVR_EXTERNAL; |
384 | if ((qdev->link_status & STS_LINK_TYPE_MASK) == | 383 | if ((qdev->link_status & STS_LINK_TYPE_MASK) == |
385 | STS_LINK_TYPE_10GBASET) { | 384 | STS_LINK_TYPE_10GBASET) { |
386 | ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); | 385 | ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); |
387 | ecmd->advertising |= (ADVERTISED_TP | ADVERTISED_Autoneg); | 386 | ecmd->advertising |= (ADVERTISED_TP | ADVERTISED_Autoneg); |
388 | ecmd->port = PORT_TP; | 387 | ecmd->port = PORT_TP; |
388 | ecmd->autoneg = AUTONEG_ENABLE; | ||
389 | } else { | 389 | } else { |
390 | ecmd->supported |= SUPPORTED_FIBRE; | 390 | ecmd->supported |= SUPPORTED_FIBRE; |
391 | ecmd->advertising |= ADVERTISED_FIBRE; | 391 | ecmd->advertising |= ADVERTISED_FIBRE; |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index b13ab544a7eb..8033555e53c2 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -1434,11 +1434,13 @@ map_error: | |||
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | /* Categorizing receive firmware frame errors */ | 1436 | /* Categorizing receive firmware frame errors */ |
1437 | static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err) | 1437 | static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err, |
1438 | struct rx_ring *rx_ring) | ||
1438 | { | 1439 | { |
1439 | struct nic_stats *stats = &qdev->nic_stats; | 1440 | struct nic_stats *stats = &qdev->nic_stats; |
1440 | 1441 | ||
1441 | stats->rx_err_count++; | 1442 | stats->rx_err_count++; |
1443 | rx_ring->rx_errors++; | ||
1442 | 1444 | ||
1443 | switch (rx_err & IB_MAC_IOCB_RSP_ERR_MASK) { | 1445 | switch (rx_err & IB_MAC_IOCB_RSP_ERR_MASK) { |
1444 | case IB_MAC_IOCB_RSP_ERR_CODE_ERR: | 1446 | case IB_MAC_IOCB_RSP_ERR_CODE_ERR: |
@@ -1474,6 +1476,12 @@ static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev, | |||
1474 | struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring); | 1476 | struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring); |
1475 | struct napi_struct *napi = &rx_ring->napi; | 1477 | struct napi_struct *napi = &rx_ring->napi; |
1476 | 1478 | ||
1479 | /* Frame error, so drop the packet. */ | ||
1480 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1481 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | ||
1482 | put_page(lbq_desc->p.pg_chunk.page); | ||
1483 | return; | ||
1484 | } | ||
1477 | napi->dev = qdev->ndev; | 1485 | napi->dev = qdev->ndev; |
1478 | 1486 | ||
1479 | skb = napi_get_frags(napi); | 1487 | skb = napi_get_frags(napi); |
@@ -1529,6 +1537,12 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev, | |||
1529 | addr = lbq_desc->p.pg_chunk.va; | 1537 | addr = lbq_desc->p.pg_chunk.va; |
1530 | prefetch(addr); | 1538 | prefetch(addr); |
1531 | 1539 | ||
1540 | /* Frame error, so drop the packet. */ | ||
1541 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1542 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | ||
1543 | goto err_out; | ||
1544 | } | ||
1545 | |||
1532 | /* The max framesize filter on this chip is set higher than | 1546 | /* The max framesize filter on this chip is set higher than |
1533 | * MTU since FCoE uses 2k frames. | 1547 | * MTU since FCoE uses 2k frames. |
1534 | */ | 1548 | */ |
@@ -1614,6 +1628,13 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev, | |||
1614 | memcpy(skb_put(new_skb, length), skb->data, length); | 1628 | memcpy(skb_put(new_skb, length), skb->data, length); |
1615 | skb = new_skb; | 1629 | skb = new_skb; |
1616 | 1630 | ||
1631 | /* Frame error, so drop the packet. */ | ||
1632 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1633 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | ||
1634 | dev_kfree_skb_any(skb); | ||
1635 | return; | ||
1636 | } | ||
1637 | |||
1617 | /* loopback self test for ethtool */ | 1638 | /* loopback self test for ethtool */ |
1618 | if (test_bit(QL_SELFTEST, &qdev->flags)) { | 1639 | if (test_bit(QL_SELFTEST, &qdev->flags)) { |
1619 | ql_check_lb_frame(qdev, skb); | 1640 | ql_check_lb_frame(qdev, skb); |
@@ -1919,6 +1940,13 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev, | |||
1919 | return; | 1940 | return; |
1920 | } | 1941 | } |
1921 | 1942 | ||
1943 | /* Frame error, so drop the packet. */ | ||
1944 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1945 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring); | ||
1946 | dev_kfree_skb_any(skb); | ||
1947 | return; | ||
1948 | } | ||
1949 | |||
1922 | /* The max framesize filter on this chip is set higher than | 1950 | /* The max framesize filter on this chip is set higher than |
1923 | * MTU since FCoE uses 2k frames. | 1951 | * MTU since FCoE uses 2k frames. |
1924 | */ | 1952 | */ |
@@ -2000,12 +2028,6 @@ static unsigned long ql_process_mac_rx_intr(struct ql_adapter *qdev, | |||
2000 | 2028 | ||
2001 | QL_DUMP_IB_MAC_RSP(ib_mac_rsp); | 2029 | QL_DUMP_IB_MAC_RSP(ib_mac_rsp); |
2002 | 2030 | ||
2003 | /* Frame error, so drop the packet. */ | ||
2004 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
2005 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2); | ||
2006 | return (unsigned long)length; | ||
2007 | } | ||
2008 | |||
2009 | if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { | 2031 | if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { |
2010 | /* The data and headers are split into | 2032 | /* The data and headers are split into |
2011 | * separate buffers. | 2033 | * separate buffers. |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 28fb50a1e9c3..4ecbe64a758d 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -3818,6 +3818,30 @@ static void rtl_init_mdio_ops(struct rtl8169_private *tp) | |||
3818 | } | 3818 | } |
3819 | } | 3819 | } |
3820 | 3820 | ||
3821 | static void rtl_speed_down(struct rtl8169_private *tp) | ||
3822 | { | ||
3823 | u32 adv; | ||
3824 | int lpa; | ||
3825 | |||
3826 | rtl_writephy(tp, 0x1f, 0x0000); | ||
3827 | lpa = rtl_readphy(tp, MII_LPA); | ||
3828 | |||
3829 | if (lpa & (LPA_10HALF | LPA_10FULL)) | ||
3830 | adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full; | ||
3831 | else if (lpa & (LPA_100HALF | LPA_100FULL)) | ||
3832 | adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
3833 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; | ||
3834 | else | ||
3835 | adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
3836 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | | ||
3837 | (tp->mii.supports_gmii ? | ||
3838 | ADVERTISED_1000baseT_Half | | ||
3839 | ADVERTISED_1000baseT_Full : 0); | ||
3840 | |||
3841 | rtl8169_set_speed(tp->dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL, | ||
3842 | adv); | ||
3843 | } | ||
3844 | |||
3821 | static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) | 3845 | static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) |
3822 | { | 3846 | { |
3823 | void __iomem *ioaddr = tp->mmio_addr; | 3847 | void __iomem *ioaddr = tp->mmio_addr; |
@@ -3848,9 +3872,7 @@ static bool rtl_wol_pll_power_down(struct rtl8169_private *tp) | |||
3848 | if (!(__rtl8169_get_wol(tp) & WAKE_ANY)) | 3872 | if (!(__rtl8169_get_wol(tp) & WAKE_ANY)) |
3849 | return false; | 3873 | return false; |
3850 | 3874 | ||
3851 | rtl_writephy(tp, 0x1f, 0x0000); | 3875 | rtl_speed_down(tp); |
3852 | rtl_writephy(tp, MII_BMCR, 0x0000); | ||
3853 | |||
3854 | rtl_wol_suspend_quirk(tp); | 3876 | rtl_wol_suspend_quirk(tp); |
3855 | 3877 | ||
3856 | return true; | 3878 | return true; |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 33e96176e4d8..6ed333fe5c04 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -1216,10 +1216,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status) | |||
1216 | if (felic_stat & ECSR_LCHNG) { | 1216 | if (felic_stat & ECSR_LCHNG) { |
1217 | /* Link Changed */ | 1217 | /* Link Changed */ |
1218 | if (mdp->cd->no_psr || mdp->no_ether_link) { | 1218 | if (mdp->cd->no_psr || mdp->no_ether_link) { |
1219 | if (mdp->link == PHY_DOWN) | 1219 | goto ignore_link; |
1220 | link_stat = 0; | ||
1221 | else | ||
1222 | link_stat = PHY_ST_LINK; | ||
1223 | } else { | 1220 | } else { |
1224 | link_stat = (sh_eth_read(ndev, PSR)); | 1221 | link_stat = (sh_eth_read(ndev, PSR)); |
1225 | if (mdp->ether_link_active_low) | 1222 | if (mdp->ether_link_active_low) |
@@ -1242,6 +1239,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status) | |||
1242 | } | 1239 | } |
1243 | } | 1240 | } |
1244 | 1241 | ||
1242 | ignore_link: | ||
1245 | if (intr_status & EESR_TWB) { | 1243 | if (intr_status & EESR_TWB) { |
1246 | /* Write buck end. unused write back interrupt */ | 1244 | /* Write buck end. unused write back interrupt */ |
1247 | if (intr_status & EESR_TABT) /* Transmit Abort int */ | 1245 | if (intr_status & EESR_TABT) /* Transmit Abort int */ |
@@ -1326,12 +1324,18 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) | |||
1326 | struct sh_eth_private *mdp = netdev_priv(ndev); | 1324 | struct sh_eth_private *mdp = netdev_priv(ndev); |
1327 | struct sh_eth_cpu_data *cd = mdp->cd; | 1325 | struct sh_eth_cpu_data *cd = mdp->cd; |
1328 | irqreturn_t ret = IRQ_NONE; | 1326 | irqreturn_t ret = IRQ_NONE; |
1329 | u32 intr_status = 0; | 1327 | unsigned long intr_status; |
1330 | 1328 | ||
1331 | spin_lock(&mdp->lock); | 1329 | spin_lock(&mdp->lock); |
1332 | 1330 | ||
1333 | /* Get interrpt stat */ | 1331 | /* Get interrupt status */ |
1334 | intr_status = sh_eth_read(ndev, EESR); | 1332 | intr_status = sh_eth_read(ndev, EESR); |
1333 | /* Mask it with the interrupt mask, forcing ECI interrupt to be always | ||
1334 | * enabled since it's the one that comes thru regardless of the mask, | ||
1335 | * and we need to fully handle it in sh_eth_error() in order to quench | ||
1336 | * it as it doesn't get cleared by just writing 1 to the ECI bit... | ||
1337 | */ | ||
1338 | intr_status &= sh_eth_read(ndev, EESIPR) | DMAC_M_ECI; | ||
1335 | /* Clear interrupt */ | 1339 | /* Clear interrupt */ |
1336 | if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF | | 1340 | if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF | |
1337 | EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF | | 1341 | EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF | |
@@ -1373,7 +1377,7 @@ static void sh_eth_adjust_link(struct net_device *ndev) | |||
1373 | struct phy_device *phydev = mdp->phydev; | 1377 | struct phy_device *phydev = mdp->phydev; |
1374 | int new_state = 0; | 1378 | int new_state = 0; |
1375 | 1379 | ||
1376 | if (phydev->link != PHY_DOWN) { | 1380 | if (phydev->link) { |
1377 | if (phydev->duplex != mdp->duplex) { | 1381 | if (phydev->duplex != mdp->duplex) { |
1378 | new_state = 1; | 1382 | new_state = 1; |
1379 | mdp->duplex = phydev->duplex; | 1383 | mdp->duplex = phydev->duplex; |
@@ -1387,17 +1391,21 @@ static void sh_eth_adjust_link(struct net_device *ndev) | |||
1387 | if (mdp->cd->set_rate) | 1391 | if (mdp->cd->set_rate) |
1388 | mdp->cd->set_rate(ndev); | 1392 | mdp->cd->set_rate(ndev); |
1389 | } | 1393 | } |
1390 | if (mdp->link == PHY_DOWN) { | 1394 | if (!mdp->link) { |
1391 | sh_eth_write(ndev, | 1395 | sh_eth_write(ndev, |
1392 | (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR); | 1396 | (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR); |
1393 | new_state = 1; | 1397 | new_state = 1; |
1394 | mdp->link = phydev->link; | 1398 | mdp->link = phydev->link; |
1399 | if (mdp->cd->no_psr || mdp->no_ether_link) | ||
1400 | sh_eth_rcv_snd_enable(ndev); | ||
1395 | } | 1401 | } |
1396 | } else if (mdp->link) { | 1402 | } else if (mdp->link) { |
1397 | new_state = 1; | 1403 | new_state = 1; |
1398 | mdp->link = PHY_DOWN; | 1404 | mdp->link = 0; |
1399 | mdp->speed = 0; | 1405 | mdp->speed = 0; |
1400 | mdp->duplex = -1; | 1406 | mdp->duplex = -1; |
1407 | if (mdp->cd->no_psr || mdp->no_ether_link) | ||
1408 | sh_eth_rcv_snd_disable(ndev); | ||
1401 | } | 1409 | } |
1402 | 1410 | ||
1403 | if (new_state && netif_msg_link(mdp)) | 1411 | if (new_state && netif_msg_link(mdp)) |
@@ -1414,7 +1422,7 @@ static int sh_eth_phy_init(struct net_device *ndev) | |||
1414 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, | 1422 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, |
1415 | mdp->mii_bus->id , mdp->phy_id); | 1423 | mdp->mii_bus->id , mdp->phy_id); |
1416 | 1424 | ||
1417 | mdp->link = PHY_DOWN; | 1425 | mdp->link = 0; |
1418 | mdp->speed = 0; | 1426 | mdp->speed = 0; |
1419 | mdp->duplex = -1; | 1427 | mdp->duplex = -1; |
1420 | 1428 | ||
@@ -2220,6 +2228,7 @@ static void sh_eth_tsu_init(struct sh_eth_private *mdp) | |||
2220 | /* MDIO bus release function */ | 2228 | /* MDIO bus release function */ |
2221 | static int sh_mdio_release(struct net_device *ndev) | 2229 | static int sh_mdio_release(struct net_device *ndev) |
2222 | { | 2230 | { |
2231 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
2223 | struct mii_bus *bus = dev_get_drvdata(&ndev->dev); | 2232 | struct mii_bus *bus = dev_get_drvdata(&ndev->dev); |
2224 | 2233 | ||
2225 | /* unregister mdio bus */ | 2234 | /* unregister mdio bus */ |
@@ -2234,6 +2243,9 @@ static int sh_mdio_release(struct net_device *ndev) | |||
2234 | /* free bitbang info */ | 2243 | /* free bitbang info */ |
2235 | free_mdio_bitbang(bus); | 2244 | free_mdio_bitbang(bus); |
2236 | 2245 | ||
2246 | /* free bitbang memory */ | ||
2247 | kfree(mdp->bitbang); | ||
2248 | |||
2237 | return 0; | 2249 | return 0; |
2238 | } | 2250 | } |
2239 | 2251 | ||
@@ -2262,6 +2274,7 @@ static int sh_mdio_init(struct net_device *ndev, int id, | |||
2262 | bitbang->ctrl.ops = &bb_ops; | 2274 | bitbang->ctrl.ops = &bb_ops; |
2263 | 2275 | ||
2264 | /* MII controller setting */ | 2276 | /* MII controller setting */ |
2277 | mdp->bitbang = bitbang; | ||
2265 | mdp->mii_bus = alloc_mdio_bitbang(&bitbang->ctrl); | 2278 | mdp->mii_bus = alloc_mdio_bitbang(&bitbang->ctrl); |
2266 | if (!mdp->mii_bus) { | 2279 | if (!mdp->mii_bus) { |
2267 | ret = -ENOMEM; | 2280 | ret = -ENOMEM; |
@@ -2441,6 +2454,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev) | |||
2441 | } | 2454 | } |
2442 | mdp->tsu_addr = ioremap(rtsu->start, | 2455 | mdp->tsu_addr = ioremap(rtsu->start, |
2443 | resource_size(rtsu)); | 2456 | resource_size(rtsu)); |
2457 | if (mdp->tsu_addr == NULL) { | ||
2458 | ret = -ENOMEM; | ||
2459 | dev_err(&pdev->dev, "TSU ioremap failed.\n"); | ||
2460 | goto out_release; | ||
2461 | } | ||
2444 | mdp->port = devno % 2; | 2462 | mdp->port = devno % 2; |
2445 | ndev->features = NETIF_F_HW_VLAN_FILTER; | 2463 | ndev->features = NETIF_F_HW_VLAN_FILTER; |
2446 | } | 2464 | } |
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index bae84fd2e73a..828be4515008 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -705,6 +705,7 @@ struct sh_eth_private { | |||
705 | const u16 *reg_offset; | 705 | const u16 *reg_offset; |
706 | void __iomem *addr; | 706 | void __iomem *addr; |
707 | void __iomem *tsu_addr; | 707 | void __iomem *tsu_addr; |
708 | struct bb_info *bitbang; | ||
708 | u32 num_rx_ring; | 709 | u32 num_rx_ring; |
709 | u32 num_tx_ring; | 710 | u32 num_tx_ring; |
710 | dma_addr_t rx_desc_dma; | 711 | dma_addr_t rx_desc_dma; |
@@ -722,7 +723,7 @@ struct sh_eth_private { | |||
722 | u32 phy_id; /* PHY ID */ | 723 | u32 phy_id; /* PHY ID */ |
723 | struct mii_bus *mii_bus; /* MDIO bus control */ | 724 | struct mii_bus *mii_bus; /* MDIO bus control */ |
724 | struct phy_device *phydev; /* PHY device control */ | 725 | struct phy_device *phydev; /* PHY device control */ |
725 | enum phy_state link; | 726 | int link; |
726 | phy_interface_t phy_interface; | 727 | phy_interface_t phy_interface; |
727 | int msg_enable; | 728 | int msg_enable; |
728 | int speed; | 729 | int speed; |
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c index 0ad790cc473c..eaa8e874a3cb 100644 --- a/drivers/net/ethernet/sfc/nic.c +++ b/drivers/net/ethernet/sfc/nic.c | |||
@@ -376,7 +376,8 @@ efx_may_push_tx_desc(struct efx_tx_queue *tx_queue, unsigned int write_count) | |||
376 | return false; | 376 | return false; |
377 | 377 | ||
378 | tx_queue->empty_read_count = 0; | 378 | tx_queue->empty_read_count = 0; |
379 | return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0; | 379 | return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0 |
380 | && tx_queue->write_count - write_count == 1; | ||
380 | } | 381 | } |
381 | 382 | ||
382 | /* For each entry inserted into the software descriptor ring, create a | 383 | /* For each entry inserted into the software descriptor ring, create a |
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c index 0c74a702d461..50617c5a0bdb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c | |||
@@ -149,6 +149,7 @@ void dwmac_mmc_intr_all_mask(void __iomem *ioaddr) | |||
149 | { | 149 | { |
150 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_INTR_MASK); | 150 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_INTR_MASK); |
151 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_TX_INTR_MASK); | 151 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_TX_INTR_MASK); |
152 | writel(MMC_DEFAULT_MASK, ioaddr + MMC_RX_IPC_INTR_MASK); | ||
152 | } | 153 | } |
153 | 154 | ||
154 | /* This reads the MAC core counters (if actaully supported). | 155 | /* This reads the MAC core counters (if actaully supported). |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 01ffbc486982..4781d3d8e182 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -436,7 +436,7 @@ void cpsw_tx_handler(void *token, int len, int status) | |||
436 | * queue is stopped then start the queue as we have free desc for tx | 436 | * queue is stopped then start the queue as we have free desc for tx |
437 | */ | 437 | */ |
438 | if (unlikely(netif_queue_stopped(ndev))) | 438 | if (unlikely(netif_queue_stopped(ndev))) |
439 | netif_start_queue(ndev); | 439 | netif_wake_queue(ndev); |
440 | cpts_tx_timestamp(priv->cpts, skb); | 440 | cpts_tx_timestamp(priv->cpts, skb); |
441 | priv->stats.tx_packets++; | 441 | priv->stats.tx_packets++; |
442 | priv->stats.tx_bytes += len; | 442 | priv->stats.tx_bytes += len; |
@@ -905,7 +905,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb, | |||
905 | /* If there is no more tx desc left free then we need to | 905 | /* If there is no more tx desc left free then we need to |
906 | * tell the kernel to stop sending us tx frames. | 906 | * tell the kernel to stop sending us tx frames. |
907 | */ | 907 | */ |
908 | if (unlikely(cpdma_check_free_tx_desc(priv->txch))) | 908 | if (unlikely(!cpdma_check_free_tx_desc(priv->txch))) |
909 | netif_stop_queue(ndev); | 909 | netif_stop_queue(ndev); |
910 | 910 | ||
911 | return NETDEV_TX_OK; | 911 | return NETDEV_TX_OK; |
@@ -1364,7 +1364,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1364 | struct platform_device *mdio; | 1364 | struct platform_device *mdio; |
1365 | 1365 | ||
1366 | parp = of_get_property(slave_node, "phy_id", &lenp); | 1366 | parp = of_get_property(slave_node, "phy_id", &lenp); |
1367 | if ((parp == NULL) && (lenp != (sizeof(void *) * 2))) { | 1367 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { |
1368 | pr_err("Missing slave[%d] phy_id property\n", i); | 1368 | pr_err("Missing slave[%d] phy_id property\n", i); |
1369 | ret = -EINVAL; | 1369 | ret = -EINVAL; |
1370 | goto error_ret; | 1370 | goto error_ret; |
@@ -1380,7 +1380,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1380 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); | 1380 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); |
1381 | 1381 | ||
1382 | if (data->dual_emac) { | 1382 | if (data->dual_emac) { |
1383 | if (of_property_read_u32(node, "dual_emac_res_vlan", | 1383 | if (of_property_read_u32(slave_node, "dual_emac_res_vlan", |
1384 | &prop)) { | 1384 | &prop)) { |
1385 | pr_err("Missing dual_emac_res_vlan in DT.\n"); | 1385 | pr_err("Missing dual_emac_res_vlan in DT.\n"); |
1386 | slave_data->dual_emac_res_vlan = i+1; | 1386 | slave_data->dual_emac_res_vlan = i+1; |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 52c05366599a..72300bc9e378 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1053,7 +1053,7 @@ static void emac_tx_handler(void *token, int len, int status) | |||
1053 | * queue is stopped then start the queue as we have free desc for tx | 1053 | * queue is stopped then start the queue as we have free desc for tx |
1054 | */ | 1054 | */ |
1055 | if (unlikely(netif_queue_stopped(ndev))) | 1055 | if (unlikely(netif_queue_stopped(ndev))) |
1056 | netif_start_queue(ndev); | 1056 | netif_wake_queue(ndev); |
1057 | ndev->stats.tx_packets++; | 1057 | ndev->stats.tx_packets++; |
1058 | ndev->stats.tx_bytes += len; | 1058 | ndev->stats.tx_bytes += len; |
1059 | dev_kfree_skb_any(skb); | 1059 | dev_kfree_skb_any(skb); |
@@ -1102,7 +1102,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1102 | /* If there is no more tx desc left free then we need to | 1102 | /* If there is no more tx desc left free then we need to |
1103 | * tell the kernel to stop sending us tx frames. | 1103 | * tell the kernel to stop sending us tx frames. |
1104 | */ | 1104 | */ |
1105 | if (unlikely(cpdma_check_free_tx_desc(priv->txchan))) | 1105 | if (unlikely(!cpdma_check_free_tx_desc(priv->txchan))) |
1106 | netif_stop_queue(ndev); | 1106 | netif_stop_queue(ndev); |
1107 | 1107 | ||
1108 | return NETDEV_TX_OK; | 1108 | return NETDEV_TX_OK; |
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 1cd77483da50..f5f0f09e4cc5 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
@@ -470,8 +470,10 @@ static void netvsc_send_completion(struct hv_device *device, | |||
470 | packet->trans_id; | 470 | packet->trans_id; |
471 | 471 | ||
472 | /* Notify the layer above us */ | 472 | /* Notify the layer above us */ |
473 | nvsc_packet->completion.send.send_completion( | 473 | if (nvsc_packet) |
474 | nvsc_packet->completion.send.send_completion_ctx); | 474 | nvsc_packet->completion.send.send_completion( |
475 | nvsc_packet->completion.send. | ||
476 | send_completion_ctx); | ||
475 | 477 | ||
476 | num_outstanding_sends = | 478 | num_outstanding_sends = |
477 | atomic_dec_return(&net_device->num_outstanding_sends); | 479 | atomic_dec_return(&net_device->num_outstanding_sends); |
@@ -498,6 +500,7 @@ int netvsc_send(struct hv_device *device, | |||
498 | int ret = 0; | 500 | int ret = 0; |
499 | struct nvsp_message sendMessage; | 501 | struct nvsp_message sendMessage; |
500 | struct net_device *ndev; | 502 | struct net_device *ndev; |
503 | u64 req_id; | ||
501 | 504 | ||
502 | net_device = get_outbound_net_device(device); | 505 | net_device = get_outbound_net_device(device); |
503 | if (!net_device) | 506 | if (!net_device) |
@@ -518,20 +521,24 @@ int netvsc_send(struct hv_device *device, | |||
518 | 0xFFFFFFFF; | 521 | 0xFFFFFFFF; |
519 | sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0; | 522 | sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0; |
520 | 523 | ||
524 | if (packet->completion.send.send_completion) | ||
525 | req_id = (u64)packet; | ||
526 | else | ||
527 | req_id = 0; | ||
528 | |||
521 | if (packet->page_buf_cnt) { | 529 | if (packet->page_buf_cnt) { |
522 | ret = vmbus_sendpacket_pagebuffer(device->channel, | 530 | ret = vmbus_sendpacket_pagebuffer(device->channel, |
523 | packet->page_buf, | 531 | packet->page_buf, |
524 | packet->page_buf_cnt, | 532 | packet->page_buf_cnt, |
525 | &sendMessage, | 533 | &sendMessage, |
526 | sizeof(struct nvsp_message), | 534 | sizeof(struct nvsp_message), |
527 | (unsigned long)packet); | 535 | req_id); |
528 | } else { | 536 | } else { |
529 | ret = vmbus_sendpacket(device->channel, &sendMessage, | 537 | ret = vmbus_sendpacket(device->channel, &sendMessage, |
530 | sizeof(struct nvsp_message), | 538 | sizeof(struct nvsp_message), |
531 | (unsigned long)packet, | 539 | req_id, |
532 | VM_PKT_DATA_INBAND, | 540 | VM_PKT_DATA_INBAND, |
533 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 541 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
534 | |||
535 | } | 542 | } |
536 | 543 | ||
537 | if (ret == 0) { | 544 | if (ret == 0) { |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 5f85205cd12b..8341b62e5521 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -241,13 +241,11 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, | |||
241 | 241 | ||
242 | if (status == 1) { | 242 | if (status == 1) { |
243 | netif_carrier_on(net); | 243 | netif_carrier_on(net); |
244 | netif_wake_queue(net); | ||
245 | ndev_ctx = netdev_priv(net); | 244 | ndev_ctx = netdev_priv(net); |
246 | schedule_delayed_work(&ndev_ctx->dwork, 0); | 245 | schedule_delayed_work(&ndev_ctx->dwork, 0); |
247 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); | 246 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); |
248 | } else { | 247 | } else { |
249 | netif_carrier_off(net); | 248 | netif_carrier_off(net); |
250 | netif_tx_disable(net); | ||
251 | } | 249 | } |
252 | } | 250 | } |
253 | 251 | ||
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 2b657d4d63a8..0775f0aefd1e 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c | |||
@@ -61,9 +61,6 @@ struct rndis_request { | |||
61 | 61 | ||
62 | static void rndis_filter_send_completion(void *ctx); | 62 | static void rndis_filter_send_completion(void *ctx); |
63 | 63 | ||
64 | static void rndis_filter_send_request_completion(void *ctx); | ||
65 | |||
66 | |||
67 | 64 | ||
68 | static struct rndis_device *get_rndis_device(void) | 65 | static struct rndis_device *get_rndis_device(void) |
69 | { | 66 | { |
@@ -241,10 +238,7 @@ static int rndis_filter_send_request(struct rndis_device *dev, | |||
241 | packet->page_buf[0].len; | 238 | packet->page_buf[0].len; |
242 | } | 239 | } |
243 | 240 | ||
244 | packet->completion.send.send_completion_ctx = req;/* packet; */ | 241 | packet->completion.send.send_completion = NULL; |
245 | packet->completion.send.send_completion = | ||
246 | rndis_filter_send_request_completion; | ||
247 | packet->completion.send.send_completion_tid = (unsigned long)dev; | ||
248 | 242 | ||
249 | ret = netvsc_send(dev->net_dev->dev, packet); | 243 | ret = netvsc_send(dev->net_dev->dev, packet); |
250 | return ret; | 244 | return ret; |
@@ -999,9 +993,3 @@ static void rndis_filter_send_completion(void *ctx) | |||
999 | /* Pass it back to the original handler */ | 993 | /* Pass it back to the original handler */ |
1000 | filter_pkt->completion(filter_pkt->completion_ctx); | 994 | filter_pkt->completion(filter_pkt->completion_ctx); |
1001 | } | 995 | } |
1002 | |||
1003 | |||
1004 | static void rndis_filter_send_request_completion(void *ctx) | ||
1005 | { | ||
1006 | /* Noop */ | ||
1007 | } | ||
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 37add21a3d7d..59ac143dec25 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -666,6 +666,7 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
666 | goto done; | 666 | goto done; |
667 | 667 | ||
668 | spin_lock_irqsave(&target_list_lock, flags); | 668 | spin_lock_irqsave(&target_list_lock, flags); |
669 | restart: | ||
669 | list_for_each_entry(nt, &target_list, list) { | 670 | list_for_each_entry(nt, &target_list, list) { |
670 | netconsole_target_get(nt); | 671 | netconsole_target_get(nt); |
671 | if (nt->np.dev == dev) { | 672 | if (nt->np.dev == dev) { |
@@ -678,15 +679,17 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
678 | case NETDEV_UNREGISTER: | 679 | case NETDEV_UNREGISTER: |
679 | /* | 680 | /* |
680 | * rtnl_lock already held | 681 | * rtnl_lock already held |
682 | * we might sleep in __netpoll_cleanup() | ||
681 | */ | 683 | */ |
682 | if (nt->np.dev) { | 684 | spin_unlock_irqrestore(&target_list_lock, flags); |
683 | __netpoll_cleanup(&nt->np); | 685 | __netpoll_cleanup(&nt->np); |
684 | dev_put(nt->np.dev); | 686 | spin_lock_irqsave(&target_list_lock, flags); |
685 | nt->np.dev = NULL; | 687 | dev_put(nt->np.dev); |
686 | } | 688 | nt->np.dev = NULL; |
687 | nt->enabled = 0; | 689 | nt->enabled = 0; |
688 | stopped = true; | 690 | stopped = true; |
689 | break; | 691 | netconsole_target_put(nt); |
692 | goto restart; | ||
690 | } | 693 | } |
691 | } | 694 | } |
692 | netconsole_target_put(nt); | 695 | netconsole_target_put(nt); |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index b7c457adc0dc..729ed533bb33 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1594,7 +1594,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1594 | 1594 | ||
1595 | if (tun->flags & TUN_TAP_MQ && | 1595 | if (tun->flags & TUN_TAP_MQ && |
1596 | (tun->numqueues + tun->numdisabled > 1)) | 1596 | (tun->numqueues + tun->numdisabled > 1)) |
1597 | return err; | 1597 | return -EBUSY; |
1598 | } | 1598 | } |
1599 | else { | 1599 | else { |
1600 | char *name; | 1600 | char *name; |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 3b6e9b83342d..7c769d8e25ad 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -268,7 +268,7 @@ config USB_NET_SMSC75XX | |||
268 | select CRC16 | 268 | select CRC16 |
269 | select CRC32 | 269 | select CRC32 |
270 | help | 270 | help |
271 | This option adds support for SMSC LAN95XX based USB 2.0 | 271 | This option adds support for SMSC LAN75XX based USB 2.0 |
272 | Gigabit Ethernet adapters. | 272 | Gigabit Ethernet adapters. |
273 | 273 | ||
274 | config USB_NET_SMSC95XX | 274 | config USB_NET_SMSC95XX |
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index 248d2dc765a5..6bd91676d2cb 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c | |||
@@ -68,18 +68,9 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf) | |||
68 | struct cdc_ncm_ctx *ctx; | 68 | struct cdc_ncm_ctx *ctx; |
69 | struct usb_driver *subdriver = ERR_PTR(-ENODEV); | 69 | struct usb_driver *subdriver = ERR_PTR(-ENODEV); |
70 | int ret = -ENODEV; | 70 | int ret = -ENODEV; |
71 | u8 data_altsetting = CDC_NCM_DATA_ALTSETTING_NCM; | 71 | u8 data_altsetting = cdc_ncm_select_altsetting(dev, intf); |
72 | struct cdc_mbim_state *info = (void *)&dev->data; | 72 | struct cdc_mbim_state *info = (void *)&dev->data; |
73 | 73 | ||
74 | /* see if interface supports MBIM alternate setting */ | ||
75 | if (intf->num_altsetting == 2) { | ||
76 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | ||
77 | usb_set_interface(dev->udev, | ||
78 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
79 | CDC_NCM_COMM_ALTSETTING_MBIM); | ||
80 | data_altsetting = CDC_NCM_DATA_ALTSETTING_MBIM; | ||
81 | } | ||
82 | |||
83 | /* Probably NCM, defer for cdc_ncm_bind */ | 74 | /* Probably NCM, defer for cdc_ncm_bind */ |
84 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | 75 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) |
85 | goto err; | 76 | goto err; |
@@ -143,7 +134,7 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb | |||
143 | goto error; | 134 | goto error; |
144 | 135 | ||
145 | if (skb) { | 136 | if (skb) { |
146 | if (skb->len <= sizeof(ETH_HLEN)) | 137 | if (skb->len <= ETH_HLEN) |
147 | goto error; | 138 | goto error; |
148 | 139 | ||
149 | /* mapping VLANs to MBIM sessions: | 140 | /* mapping VLANs to MBIM sessions: |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 61b74a2b89ac..4709fa3497cf 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -55,6 +55,14 @@ | |||
55 | 55 | ||
56 | #define DRIVER_VERSION "14-Mar-2012" | 56 | #define DRIVER_VERSION "14-Mar-2012" |
57 | 57 | ||
58 | #if IS_ENABLED(CONFIG_USB_NET_CDC_MBIM) | ||
59 | static bool prefer_mbim = true; | ||
60 | #else | ||
61 | static bool prefer_mbim; | ||
62 | #endif | ||
63 | module_param(prefer_mbim, bool, S_IRUGO | S_IWUSR); | ||
64 | MODULE_PARM_DESC(prefer_mbim, "Prefer MBIM setting on dual NCM/MBIM functions"); | ||
65 | |||
58 | static void cdc_ncm_txpath_bh(unsigned long param); | 66 | static void cdc_ncm_txpath_bh(unsigned long param); |
59 | static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); | 67 | static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); |
60 | static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); | 68 | static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); |
@@ -550,9 +558,12 @@ void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
550 | } | 558 | } |
551 | EXPORT_SYMBOL_GPL(cdc_ncm_unbind); | 559 | EXPORT_SYMBOL_GPL(cdc_ncm_unbind); |
552 | 560 | ||
553 | static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | 561 | /* Select the MBIM altsetting iff it is preferred and available, |
562 | * returning the number of the corresponding data interface altsetting | ||
563 | */ | ||
564 | u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf) | ||
554 | { | 565 | { |
555 | int ret; | 566 | struct usb_host_interface *alt; |
556 | 567 | ||
557 | /* The MBIM spec defines a NCM compatible default altsetting, | 568 | /* The MBIM spec defines a NCM compatible default altsetting, |
558 | * which we may have matched: | 569 | * which we may have matched: |
@@ -568,23 +579,27 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | |||
568 | * endpoint descriptors, shall be constructed according to | 579 | * endpoint descriptors, shall be constructed according to |
569 | * the rules given in section 6 (USB Device Model) of this | 580 | * the rules given in section 6 (USB Device Model) of this |
570 | * specification." | 581 | * specification." |
571 | * | ||
572 | * Do not bind to such interfaces, allowing cdc_mbim to handle | ||
573 | * them | ||
574 | */ | 582 | */ |
575 | #if IS_ENABLED(CONFIG_USB_NET_CDC_MBIM) | 583 | if (prefer_mbim && intf->num_altsetting == 2) { |
576 | if ((intf->num_altsetting == 2) && | 584 | alt = usb_altnum_to_altsetting(intf, CDC_NCM_COMM_ALTSETTING_MBIM); |
577 | !usb_set_interface(dev->udev, | 585 | if (alt && cdc_ncm_comm_intf_is_mbim(alt) && |
578 | intf->cur_altsetting->desc.bInterfaceNumber, | 586 | !usb_set_interface(dev->udev, |
579 | CDC_NCM_COMM_ALTSETTING_MBIM)) { | 587 | intf->cur_altsetting->desc.bInterfaceNumber, |
580 | if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | 588 | CDC_NCM_COMM_ALTSETTING_MBIM)) |
581 | return -ENODEV; | 589 | return CDC_NCM_DATA_ALTSETTING_MBIM; |
582 | else | ||
583 | usb_set_interface(dev->udev, | ||
584 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
585 | CDC_NCM_COMM_ALTSETTING_NCM); | ||
586 | } | 590 | } |
587 | #endif | 591 | return CDC_NCM_DATA_ALTSETTING_NCM; |
592 | } | ||
593 | EXPORT_SYMBOL_GPL(cdc_ncm_select_altsetting); | ||
594 | |||
595 | static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | ||
596 | { | ||
597 | int ret; | ||
598 | |||
599 | /* MBIM backwards compatible function? */ | ||
600 | cdc_ncm_select_altsetting(dev, intf); | ||
601 | if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | ||
602 | return -ENODEV; | ||
588 | 603 | ||
589 | /* NCM data altsetting is always 1 */ | 604 | /* NCM data altsetting is always 1 */ |
590 | ret = cdc_ncm_bind_common(dev, intf, 1); | 605 | ret = cdc_ncm_bind_common(dev, intf, 1); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index efb5c7c33a28..2a3579f67910 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <linux/ethtool.h> | 15 | #include <linux/ethtool.h> |
16 | #include <linux/etherdevice.h> | ||
16 | #include <linux/mii.h> | 17 | #include <linux/mii.h> |
17 | #include <linux/usb.h> | 18 | #include <linux/usb.h> |
18 | #include <linux/usb/cdc.h> | 19 | #include <linux/usb/cdc.h> |
@@ -52,6 +53,96 @@ struct qmi_wwan_state { | |||
52 | struct usb_interface *data; | 53 | struct usb_interface *data; |
53 | }; | 54 | }; |
54 | 55 | ||
56 | /* default ethernet address used by the modem */ | ||
57 | static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3}; | ||
58 | |||
59 | /* Make up an ethernet header if the packet doesn't have one. | ||
60 | * | ||
61 | * A firmware bug common among several devices cause them to send raw | ||
62 | * IP packets under some circumstances. There is no way for the | ||
63 | * driver/host to know when this will happen. And even when the bug | ||
64 | * hits, some packets will still arrive with an intact header. | ||
65 | * | ||
66 | * The supported devices are only capably of sending IPv4, IPv6 and | ||
67 | * ARP packets on a point-to-point link. Any packet with an ethernet | ||
68 | * header will have either our address or a broadcast/multicast | ||
69 | * address as destination. ARP packets will always have a header. | ||
70 | * | ||
71 | * This means that this function will reliably add the appropriate | ||
72 | * header iff necessary, provided our hardware address does not start | ||
73 | * with 4 or 6. | ||
74 | * | ||
75 | * Another common firmware bug results in all packets being addressed | ||
76 | * to 00:a0:c6:00:00:00 despite the host address being different. | ||
77 | * This function will also fixup such packets. | ||
78 | */ | ||
79 | static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||
80 | { | ||
81 | __be16 proto; | ||
82 | |||
83 | /* usbnet rx_complete guarantees that skb->len is at least | ||
84 | * hard_header_len, so we can inspect the dest address without | ||
85 | * checking skb->len | ||
86 | */ | ||
87 | switch (skb->data[0] & 0xf0) { | ||
88 | case 0x40: | ||
89 | proto = htons(ETH_P_IP); | ||
90 | break; | ||
91 | case 0x60: | ||
92 | proto = htons(ETH_P_IPV6); | ||
93 | break; | ||
94 | case 0x00: | ||
95 | if (is_multicast_ether_addr(skb->data)) | ||
96 | return 1; | ||
97 | /* possibly bogus destination - rewrite just in case */ | ||
98 | skb_reset_mac_header(skb); | ||
99 | goto fix_dest; | ||
100 | default: | ||
101 | /* pass along other packets without modifications */ | ||
102 | return 1; | ||
103 | } | ||
104 | if (skb_headroom(skb) < ETH_HLEN) | ||
105 | return 0; | ||
106 | skb_push(skb, ETH_HLEN); | ||
107 | skb_reset_mac_header(skb); | ||
108 | eth_hdr(skb)->h_proto = proto; | ||
109 | memset(eth_hdr(skb)->h_source, 0, ETH_ALEN); | ||
110 | fix_dest: | ||
111 | memcpy(eth_hdr(skb)->h_dest, dev->net->dev_addr, ETH_ALEN); | ||
112 | return 1; | ||
113 | } | ||
114 | |||
115 | /* very simplistic detection of IPv4 or IPv6 headers */ | ||
116 | static bool possibly_iphdr(const char *data) | ||
117 | { | ||
118 | return (data[0] & 0xd0) == 0x40; | ||
119 | } | ||
120 | |||
121 | /* disallow addresses which may be confused with IP headers */ | ||
122 | static int qmi_wwan_mac_addr(struct net_device *dev, void *p) | ||
123 | { | ||
124 | int ret; | ||
125 | struct sockaddr *addr = p; | ||
126 | |||
127 | ret = eth_prepare_mac_addr_change(dev, p); | ||
128 | if (ret < 0) | ||
129 | return ret; | ||
130 | if (possibly_iphdr(addr->sa_data)) | ||
131 | return -EADDRNOTAVAIL; | ||
132 | eth_commit_mac_addr_change(dev, p); | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static const struct net_device_ops qmi_wwan_netdev_ops = { | ||
137 | .ndo_open = usbnet_open, | ||
138 | .ndo_stop = usbnet_stop, | ||
139 | .ndo_start_xmit = usbnet_start_xmit, | ||
140 | .ndo_tx_timeout = usbnet_tx_timeout, | ||
141 | .ndo_change_mtu = usbnet_change_mtu, | ||
142 | .ndo_set_mac_address = qmi_wwan_mac_addr, | ||
143 | .ndo_validate_addr = eth_validate_addr, | ||
144 | }; | ||
145 | |||
55 | /* using a counter to merge subdriver requests with our own into a combined state */ | 146 | /* using a counter to merge subdriver requests with our own into a combined state */ |
56 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) | 147 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) |
57 | { | 148 | { |
@@ -139,16 +230,9 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
139 | 230 | ||
140 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); | 231 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); |
141 | 232 | ||
142 | /* control and data is shared? */ | 233 | /* set up initial state */ |
143 | if (intf->cur_altsetting->desc.bNumEndpoints == 3) { | 234 | info->control = intf; |
144 | info->control = intf; | 235 | info->data = intf; |
145 | info->data = intf; | ||
146 | goto shared; | ||
147 | } | ||
148 | |||
149 | /* else require a single interrupt status endpoint on control intf */ | ||
150 | if (intf->cur_altsetting->desc.bNumEndpoints != 1) | ||
151 | goto err; | ||
152 | 236 | ||
153 | /* and a number of CDC descriptors */ | 237 | /* and a number of CDC descriptors */ |
154 | while (len > 3) { | 238 | while (len > 3) { |
@@ -207,25 +291,14 @@ next_desc: | |||
207 | buf += h->bLength; | 291 | buf += h->bLength; |
208 | } | 292 | } |
209 | 293 | ||
210 | /* did we find all the required ones? */ | 294 | /* Use separate control and data interfaces if we found a CDC Union */ |
211 | if (!(found & (1 << USB_CDC_HEADER_TYPE)) || | 295 | if (cdc_union) { |
212 | !(found & (1 << USB_CDC_UNION_TYPE))) { | 296 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); |
213 | dev_err(&intf->dev, "CDC functional descriptors missing\n"); | 297 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 || !info->data) { |
214 | goto err; | 298 | dev_err(&intf->dev, "bogus CDC Union: master=%u, slave=%u\n", |
215 | } | 299 | cdc_union->bMasterInterface0, cdc_union->bSlaveInterface0); |
216 | 300 | goto err; | |
217 | /* verify CDC Union */ | 301 | } |
218 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) { | ||
219 | dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0); | ||
220 | goto err; | ||
221 | } | ||
222 | |||
223 | /* need to save these for unbind */ | ||
224 | info->control = intf; | ||
225 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); | ||
226 | if (!info->data) { | ||
227 | dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0); | ||
228 | goto err; | ||
229 | } | 302 | } |
230 | 303 | ||
231 | /* errors aren't fatal - we can live with the dynamic address */ | 304 | /* errors aren't fatal - we can live with the dynamic address */ |
@@ -235,17 +308,30 @@ next_desc: | |||
235 | } | 308 | } |
236 | 309 | ||
237 | /* claim data interface and set it up */ | 310 | /* claim data interface and set it up */ |
238 | status = usb_driver_claim_interface(driver, info->data, dev); | 311 | if (info->control != info->data) { |
239 | if (status < 0) | 312 | status = usb_driver_claim_interface(driver, info->data, dev); |
240 | goto err; | 313 | if (status < 0) |
314 | goto err; | ||
315 | } | ||
241 | 316 | ||
242 | shared: | ||
243 | status = qmi_wwan_register_subdriver(dev); | 317 | status = qmi_wwan_register_subdriver(dev); |
244 | if (status < 0 && info->control != info->data) { | 318 | if (status < 0 && info->control != info->data) { |
245 | usb_set_intfdata(info->data, NULL); | 319 | usb_set_intfdata(info->data, NULL); |
246 | usb_driver_release_interface(driver, info->data); | 320 | usb_driver_release_interface(driver, info->data); |
247 | } | 321 | } |
248 | 322 | ||
323 | /* Never use the same address on both ends of the link, even | ||
324 | * if the buggy firmware told us to. | ||
325 | */ | ||
326 | if (!compare_ether_addr(dev->net->dev_addr, default_modem_addr)) | ||
327 | eth_hw_addr_random(dev->net); | ||
328 | |||
329 | /* make MAC addr easily distinguishable from an IP header */ | ||
330 | if (possibly_iphdr(dev->net->dev_addr)) { | ||
331 | dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */ | ||
332 | dev->net->dev_addr[0] &= 0xbf; /* clear "IP" bit */ | ||
333 | } | ||
334 | dev->net->netdev_ops = &qmi_wwan_netdev_ops; | ||
249 | err: | 335 | err: |
250 | return status; | 336 | return status; |
251 | } | 337 | } |
@@ -324,6 +410,7 @@ static const struct driver_info qmi_wwan_info = { | |||
324 | .bind = qmi_wwan_bind, | 410 | .bind = qmi_wwan_bind, |
325 | .unbind = qmi_wwan_unbind, | 411 | .unbind = qmi_wwan_unbind, |
326 | .manage_power = qmi_wwan_manage_power, | 412 | .manage_power = qmi_wwan_manage_power, |
413 | .rx_fixup = qmi_wwan_rx_fixup, | ||
327 | }; | 414 | }; |
328 | 415 | ||
329 | #define HUAWEI_VENDOR_ID 0x12D1 | 416 | #define HUAWEI_VENDOR_ID 0x12D1 |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 9abe51710f22..1a15ec14c386 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -914,8 +914,12 @@ static int smsc75xx_set_rx_max_frame_length(struct usbnet *dev, int size) | |||
914 | static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu) | 914 | static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu) |
915 | { | 915 | { |
916 | struct usbnet *dev = netdev_priv(netdev); | 916 | struct usbnet *dev = netdev_priv(netdev); |
917 | int ret; | ||
918 | |||
919 | if (new_mtu > MAX_SINGLE_PACKET_SIZE) | ||
920 | return -EINVAL; | ||
917 | 921 | ||
918 | int ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu); | 922 | ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu + ETH_HLEN); |
919 | if (ret < 0) { | 923 | if (ret < 0) { |
920 | netdev_warn(dev->net, "Failed to set mac rx frame length\n"); | 924 | netdev_warn(dev->net, "Failed to set mac rx frame length\n"); |
921 | return ret; | 925 | return ret; |
@@ -1324,7 +1328,7 @@ static int smsc75xx_reset(struct usbnet *dev) | |||
1324 | 1328 | ||
1325 | netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf); | 1329 | netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf); |
1326 | 1330 | ||
1327 | ret = smsc75xx_set_rx_max_frame_length(dev, 1514); | 1331 | ret = smsc75xx_set_rx_max_frame_length(dev, dev->net->mtu + ETH_HLEN); |
1328 | if (ret < 0) { | 1332 | if (ret < 0) { |
1329 | netdev_warn(dev->net, "Failed to set max rx frame length\n"); | 1333 | netdev_warn(dev->net, "Failed to set max rx frame length\n"); |
1330 | return ret; | 1334 | return ret; |
@@ -2134,8 +2138,8 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
2134 | else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT)) | 2138 | else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT)) |
2135 | dev->net->stats.rx_frame_errors++; | 2139 | dev->net->stats.rx_frame_errors++; |
2136 | } else { | 2140 | } else { |
2137 | /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */ | 2141 | /* MAX_SINGLE_PACKET_SIZE + 4(CRC) + 2(COE) + 4(Vlan) */ |
2138 | if (unlikely(size > (ETH_FRAME_LEN + 12))) { | 2142 | if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12))) { |
2139 | netif_dbg(dev, rx_err, dev->net, | 2143 | netif_dbg(dev, rx_err, dev->net, |
2140 | "size err rx_cmd_a=0x%08x\n", | 2144 | "size err rx_cmd_a=0x%08x\n", |
2141 | rx_cmd_a); | 2145 | rx_cmd_a); |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 4cc13940c895..f76c3ca07a45 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
@@ -1023,6 +1023,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, | |||
1023 | AR_PHY_AGC_CONTROL_FLTR_CAL | | 1023 | AR_PHY_AGC_CONTROL_FLTR_CAL | |
1024 | AR_PHY_AGC_CONTROL_PKDET_CAL; | 1024 | AR_PHY_AGC_CONTROL_PKDET_CAL; |
1025 | 1025 | ||
1026 | /* Use chip chainmask only for calibration */ | ||
1026 | ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask); | 1027 | ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask); |
1027 | 1028 | ||
1028 | if (rtt) { | 1029 | if (rtt) { |
@@ -1150,6 +1151,9 @@ skip_tx_iqcal: | |||
1150 | ar9003_hw_rtt_disable(ah); | 1151 | ar9003_hw_rtt_disable(ah); |
1151 | } | 1152 | } |
1152 | 1153 | ||
1154 | /* Revert chainmask to runtime parameters */ | ||
1155 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | ||
1156 | |||
1153 | /* Initialize list pointers */ | 1157 | /* Initialize list pointers */ |
1154 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; | 1158 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; |
1155 | 1159 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h index 28fd99203f64..bdee2ed67219 100644 --- a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h | |||
@@ -519,7 +519,7 @@ static const u32 ar9580_1p0_mac_core[][2] = { | |||
519 | {0x00008258, 0x00000000}, | 519 | {0x00008258, 0x00000000}, |
520 | {0x0000825c, 0x40000000}, | 520 | {0x0000825c, 0x40000000}, |
521 | {0x00008260, 0x00080922}, | 521 | {0x00008260, 0x00080922}, |
522 | {0x00008264, 0x9bc00010}, | 522 | {0x00008264, 0x9d400010}, |
523 | {0x00008268, 0xffffffff}, | 523 | {0x00008268, 0xffffffff}, |
524 | {0x0000826c, 0x0000ffff}, | 524 | {0x0000826c, 0x0000ffff}, |
525 | {0x00008270, 0x00000000}, | 525 | {0x00008270, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c index 467b60014b7b..73fe8d6db566 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c +++ b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c | |||
@@ -143,14 +143,14 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq) | |||
143 | u32 sz, i; | 143 | u32 sz, i; |
144 | struct channel_detector *cd; | 144 | struct channel_detector *cd; |
145 | 145 | ||
146 | cd = kmalloc(sizeof(*cd), GFP_KERNEL); | 146 | cd = kmalloc(sizeof(*cd), GFP_ATOMIC); |
147 | if (cd == NULL) | 147 | if (cd == NULL) |
148 | goto fail; | 148 | goto fail; |
149 | 149 | ||
150 | INIT_LIST_HEAD(&cd->head); | 150 | INIT_LIST_HEAD(&cd->head); |
151 | cd->freq = freq; | 151 | cd->freq = freq; |
152 | sz = sizeof(cd->detectors) * dpd->num_radar_types; | 152 | sz = sizeof(cd->detectors) * dpd->num_radar_types; |
153 | cd->detectors = kzalloc(sz, GFP_KERNEL); | 153 | cd->detectors = kzalloc(sz, GFP_ATOMIC); |
154 | if (cd->detectors == NULL) | 154 | if (cd->detectors == NULL) |
155 | goto fail; | 155 | goto fail; |
156 | 156 | ||
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c index 91b8dceeadb1..5e48c5515b8c 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c +++ b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c | |||
@@ -218,7 +218,7 @@ static bool pulse_queue_enqueue(struct pri_detector *pde, u64 ts) | |||
218 | { | 218 | { |
219 | struct pulse_elem *p = pool_get_pulse_elem(); | 219 | struct pulse_elem *p = pool_get_pulse_elem(); |
220 | if (p == NULL) { | 220 | if (p == NULL) { |
221 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 221 | p = kmalloc(sizeof(*p), GFP_ATOMIC); |
222 | if (p == NULL) { | 222 | if (p == NULL) { |
223 | DFS_POOL_STAT_INC(pulse_alloc_error); | 223 | DFS_POOL_STAT_INC(pulse_alloc_error); |
224 | return false; | 224 | return false; |
@@ -299,7 +299,7 @@ static bool pseq_handler_create_sequences(struct pri_detector *pde, | |||
299 | ps.deadline_ts = ps.first_ts + ps.dur; | 299 | ps.deadline_ts = ps.first_ts + ps.dur; |
300 | new_ps = pool_get_pseq_elem(); | 300 | new_ps = pool_get_pseq_elem(); |
301 | if (new_ps == NULL) { | 301 | if (new_ps == NULL) { |
302 | new_ps = kmalloc(sizeof(*new_ps), GFP_KERNEL); | 302 | new_ps = kmalloc(sizeof(*new_ps), GFP_ATOMIC); |
303 | if (new_ps == NULL) { | 303 | if (new_ps == NULL) { |
304 | DFS_POOL_STAT_INC(pseq_alloc_error); | 304 | DFS_POOL_STAT_INC(pseq_alloc_error); |
305 | return false; | 305 | return false; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 716058b67557..a47f5e05fc04 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -796,7 +796,7 @@ static int ath9k_init_firmware_version(struct ath9k_htc_priv *priv) | |||
796 | * required version. | 796 | * required version. |
797 | */ | 797 | */ |
798 | if (priv->fw_version_major != MAJOR_VERSION_REQ || | 798 | if (priv->fw_version_major != MAJOR_VERSION_REQ || |
799 | priv->fw_version_minor != MINOR_VERSION_REQ) { | 799 | priv->fw_version_minor < MINOR_VERSION_REQ) { |
800 | dev_err(priv->dev, "ath9k_htc: Please upgrade to FW version %d.%d\n", | 800 | dev_err(priv->dev, "ath9k_htc: Please upgrade to FW version %d.%d\n", |
801 | MAJOR_VERSION_REQ, MINOR_VERSION_REQ); | 801 | MAJOR_VERSION_REQ, MINOR_VERSION_REQ); |
802 | return -EINVAL; | 802 | return -EINVAL; |
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c index ade3afb21f91..7fdac6c7b3ea 100644 --- a/drivers/net/wireless/ath/ath9k/link.c +++ b/drivers/net/wireless/ath/ath9k/link.c | |||
@@ -28,21 +28,21 @@ void ath_tx_complete_poll_work(struct work_struct *work) | |||
28 | int i; | 28 | int i; |
29 | bool needreset = false; | 29 | bool needreset = false; |
30 | 30 | ||
31 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) | 31 | for (i = 0; i < IEEE80211_NUM_ACS; i++) { |
32 | if (ATH_TXQ_SETUP(sc, i)) { | 32 | txq = sc->tx.txq_map[i]; |
33 | txq = &sc->tx.txq[i]; | 33 | |
34 | ath_txq_lock(sc, txq); | 34 | ath_txq_lock(sc, txq); |
35 | if (txq->axq_depth) { | 35 | if (txq->axq_depth) { |
36 | if (txq->axq_tx_inprogress) { | 36 | if (txq->axq_tx_inprogress) { |
37 | needreset = true; | 37 | needreset = true; |
38 | ath_txq_unlock(sc, txq); | 38 | ath_txq_unlock(sc, txq); |
39 | break; | 39 | break; |
40 | } else { | 40 | } else { |
41 | txq->axq_tx_inprogress = true; | 41 | txq->axq_tx_inprogress = true; |
42 | } | ||
43 | } | 42 | } |
44 | ath_txq_unlock_complete(sc, txq); | ||
45 | } | 43 | } |
44 | ath_txq_unlock_complete(sc, txq); | ||
45 | } | ||
46 | 46 | ||
47 | if (needreset) { | 47 | if (needreset) { |
48 | ath_dbg(ath9k_hw_common(sc->sc_ah), RESET, | 48 | ath_dbg(ath9k_hw_common(sc->sc_ah), RESET, |
@@ -170,7 +170,8 @@ void ath_rx_poll(unsigned long data) | |||
170 | { | 170 | { |
171 | struct ath_softc *sc = (struct ath_softc *)data; | 171 | struct ath_softc *sc = (struct ath_softc *)data; |
172 | 172 | ||
173 | ieee80211_queue_work(sc->hw, &sc->hw_check_work); | 173 | if (!test_bit(SC_OP_INVALID, &sc->sc_flags)) |
174 | ieee80211_queue_work(sc->hw, &sc->hw_check_work); | ||
174 | } | 175 | } |
175 | 176 | ||
176 | /* | 177 | /* |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 6e66f9c6782b..988372d218a4 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -280,6 +280,10 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) | |||
280 | if (r) { | 280 | if (r) { |
281 | ath_err(common, | 281 | ath_err(common, |
282 | "Unable to reset channel, reset status %d\n", r); | 282 | "Unable to reset channel, reset status %d\n", r); |
283 | |||
284 | ath9k_hw_enable_interrupts(ah); | ||
285 | ath9k_queue_reset(sc, RESET_TYPE_BB_HANG); | ||
286 | |||
283 | goto out; | 287 | goto out; |
284 | } | 288 | } |
285 | 289 | ||
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 38bc5a7997ff..122146943bf2 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -1487,8 +1487,12 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1487 | const struct b43_dma_ops *ops; | 1487 | const struct b43_dma_ops *ops; |
1488 | struct b43_dmaring *ring; | 1488 | struct b43_dmaring *ring; |
1489 | struct b43_dmadesc_meta *meta; | 1489 | struct b43_dmadesc_meta *meta; |
1490 | static const struct b43_txstatus fake; /* filled with 0 */ | ||
1491 | const struct b43_txstatus *txstat; | ||
1490 | int slot, firstused; | 1492 | int slot, firstused; |
1491 | bool frame_succeed; | 1493 | bool frame_succeed; |
1494 | int skip; | ||
1495 | static u8 err_out1, err_out2; | ||
1492 | 1496 | ||
1493 | ring = parse_cookie(dev, status->cookie, &slot); | 1497 | ring = parse_cookie(dev, status->cookie, &slot); |
1494 | if (unlikely(!ring)) | 1498 | if (unlikely(!ring)) |
@@ -1501,13 +1505,36 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1501 | firstused = ring->current_slot - ring->used_slots + 1; | 1505 | firstused = ring->current_slot - ring->used_slots + 1; |
1502 | if (firstused < 0) | 1506 | if (firstused < 0) |
1503 | firstused = ring->nr_slots + firstused; | 1507 | firstused = ring->nr_slots + firstused; |
1508 | |||
1509 | skip = 0; | ||
1504 | if (unlikely(slot != firstused)) { | 1510 | if (unlikely(slot != firstused)) { |
1505 | /* This possibly is a firmware bug and will result in | 1511 | /* This possibly is a firmware bug and will result in |
1506 | * malfunction, memory leaks and/or stall of DMA functionality. */ | 1512 | * malfunction, memory leaks and/or stall of DMA functionality. |
1507 | b43dbg(dev->wl, "Out of order TX status report on DMA ring %d. " | 1513 | */ |
1508 | "Expected %d, but got %d\n", | 1514 | if (slot == next_slot(ring, next_slot(ring, firstused))) { |
1509 | ring->index, firstused, slot); | 1515 | /* If a single header/data pair was missed, skip over |
1510 | return; | 1516 | * the first two slots in an attempt to recover. |
1517 | */ | ||
1518 | slot = firstused; | ||
1519 | skip = 2; | ||
1520 | if (!err_out1) { | ||
1521 | /* Report the error once. */ | ||
1522 | b43dbg(dev->wl, | ||
1523 | "Skip on DMA ring %d slot %d.\n", | ||
1524 | ring->index, slot); | ||
1525 | err_out1 = 1; | ||
1526 | } | ||
1527 | } else { | ||
1528 | /* More than a single header/data pair were missed. | ||
1529 | * Report this error once. | ||
1530 | */ | ||
1531 | if (!err_out2) | ||
1532 | b43dbg(dev->wl, | ||
1533 | "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n", | ||
1534 | ring->index, firstused, slot); | ||
1535 | err_out2 = 1; | ||
1536 | return; | ||
1537 | } | ||
1511 | } | 1538 | } |
1512 | 1539 | ||
1513 | ops = ring->ops; | 1540 | ops = ring->ops; |
@@ -1522,11 +1549,13 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1522 | slot, firstused, ring->index); | 1549 | slot, firstused, ring->index); |
1523 | break; | 1550 | break; |
1524 | } | 1551 | } |
1552 | |||
1525 | if (meta->skb) { | 1553 | if (meta->skb) { |
1526 | struct b43_private_tx_info *priv_info = | 1554 | struct b43_private_tx_info *priv_info = |
1527 | b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb)); | 1555 | b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb)); |
1528 | 1556 | ||
1529 | unmap_descbuffer(ring, meta->dmaaddr, meta->skb->len, 1); | 1557 | unmap_descbuffer(ring, meta->dmaaddr, |
1558 | meta->skb->len, 1); | ||
1530 | kfree(priv_info->bouncebuffer); | 1559 | kfree(priv_info->bouncebuffer); |
1531 | priv_info->bouncebuffer = NULL; | 1560 | priv_info->bouncebuffer = NULL; |
1532 | } else { | 1561 | } else { |
@@ -1538,8 +1567,9 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1538 | struct ieee80211_tx_info *info; | 1567 | struct ieee80211_tx_info *info; |
1539 | 1568 | ||
1540 | if (unlikely(!meta->skb)) { | 1569 | if (unlikely(!meta->skb)) { |
1541 | /* This is a scatter-gather fragment of a frame, so | 1570 | /* This is a scatter-gather fragment of a frame, |
1542 | * the skb pointer must not be NULL. */ | 1571 | * so the skb pointer must not be NULL. |
1572 | */ | ||
1543 | b43dbg(dev->wl, "TX status unexpected NULL skb " | 1573 | b43dbg(dev->wl, "TX status unexpected NULL skb " |
1544 | "at slot %d (first=%d) on ring %d\n", | 1574 | "at slot %d (first=%d) on ring %d\n", |
1545 | slot, firstused, ring->index); | 1575 | slot, firstused, ring->index); |
@@ -1550,9 +1580,18 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1550 | 1580 | ||
1551 | /* | 1581 | /* |
1552 | * Call back to inform the ieee80211 subsystem about | 1582 | * Call back to inform the ieee80211 subsystem about |
1553 | * the status of the transmission. | 1583 | * the status of the transmission. When skipping over |
1584 | * a missed TX status report, use a status structure | ||
1585 | * filled with zeros to indicate that the frame was not | ||
1586 | * sent (frame_count 0) and not acknowledged | ||
1554 | */ | 1587 | */ |
1555 | frame_succeed = b43_fill_txstatus_report(dev, info, status); | 1588 | if (unlikely(skip)) |
1589 | txstat = &fake; | ||
1590 | else | ||
1591 | txstat = status; | ||
1592 | |||
1593 | frame_succeed = b43_fill_txstatus_report(dev, info, | ||
1594 | txstat); | ||
1556 | #ifdef CONFIG_B43_DEBUG | 1595 | #ifdef CONFIG_B43_DEBUG |
1557 | if (frame_succeed) | 1596 | if (frame_succeed) |
1558 | ring->nr_succeed_tx_packets++; | 1597 | ring->nr_succeed_tx_packets++; |
@@ -1580,12 +1619,14 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1580 | /* Everything unmapped and free'd. So it's not used anymore. */ | 1619 | /* Everything unmapped and free'd. So it's not used anymore. */ |
1581 | ring->used_slots--; | 1620 | ring->used_slots--; |
1582 | 1621 | ||
1583 | if (meta->is_last_fragment) { | 1622 | if (meta->is_last_fragment && !skip) { |
1584 | /* This is the last scatter-gather | 1623 | /* This is the last scatter-gather |
1585 | * fragment of the frame. We are done. */ | 1624 | * fragment of the frame. We are done. */ |
1586 | break; | 1625 | break; |
1587 | } | 1626 | } |
1588 | slot = next_slot(ring, slot); | 1627 | slot = next_slot(ring, slot); |
1628 | if (skip > 0) | ||
1629 | --skip; | ||
1589 | } | 1630 | } |
1590 | if (ring->stopped) { | 1631 | if (ring->stopped) { |
1591 | B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); | 1632 | B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); |
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 3c35382ee6c2..b70f220bc4b3 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -1564,7 +1564,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1564 | u16 clip_off[2] = { 0xFFFF, 0xFFFF }; | 1564 | u16 clip_off[2] = { 0xFFFF, 0xFFFF }; |
1565 | 1565 | ||
1566 | u8 vcm_final = 0; | 1566 | u8 vcm_final = 0; |
1567 | s8 offset[4]; | 1567 | s32 offset[4]; |
1568 | s32 results[8][4] = { }; | 1568 | s32 results[8][4] = { }; |
1569 | s32 results_min[4] = { }; | 1569 | s32 results_min[4] = { }; |
1570 | s32 poll_results[4] = { }; | 1570 | s32 poll_results[4] = { }; |
@@ -1615,7 +1615,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1615 | } | 1615 | } |
1616 | for (i = 0; i < 4; i += 2) { | 1616 | for (i = 0; i < 4; i += 2) { |
1617 | s32 curr; | 1617 | s32 curr; |
1618 | s32 mind = 40; | 1618 | s32 mind = 0x100000; |
1619 | s32 minpoll = 249; | 1619 | s32 minpoll = 249; |
1620 | u8 minvcm = 0; | 1620 | u8 minvcm = 0; |
1621 | if (2 * core != i) | 1621 | if (2 * core != i) |
@@ -1732,7 +1732,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type) | |||
1732 | u8 regs_save_radio[2]; | 1732 | u8 regs_save_radio[2]; |
1733 | u16 regs_save_phy[2]; | 1733 | u16 regs_save_phy[2]; |
1734 | 1734 | ||
1735 | s8 offset[4]; | 1735 | s32 offset[4]; |
1736 | u8 core; | 1736 | u8 core; |
1737 | u8 rail; | 1737 | u8 rail; |
1738 | 1738 | ||
@@ -1799,7 +1799,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type) | |||
1799 | } | 1799 | } |
1800 | 1800 | ||
1801 | for (i = 0; i < 4; i++) { | 1801 | for (i = 0; i < 4; i++) { |
1802 | s32 mind = 40; | 1802 | s32 mind = 0x100000; |
1803 | u8 minvcm = 0; | 1803 | u8 minvcm = 0; |
1804 | s32 minpoll = 249; | 1804 | s32 minpoll = 249; |
1805 | s32 curr; | 1805 | s32 curr; |
@@ -5165,7 +5165,8 @@ static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid) | |||
5165 | #endif | 5165 | #endif |
5166 | #ifdef CONFIG_B43_SSB | 5166 | #ifdef CONFIG_B43_SSB |
5167 | case B43_BUS_SSB: | 5167 | case B43_BUS_SSB: |
5168 | /* FIXME */ | 5168 | ssb_pmu_spuravoid_pllupdate(&dev->dev->sdev->bus->chipco, |
5169 | avoid); | ||
5169 | break; | 5170 | break; |
5170 | #endif | 5171 | #endif |
5171 | } | 5172 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 4469321c0eb3..35fc68be158d 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -3317,15 +3317,15 @@ static int _brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus) | |||
3317 | goto err; | 3317 | goto err; |
3318 | } | 3318 | } |
3319 | 3319 | ||
3320 | /* External image takes precedence if specified */ | ||
3321 | if (brcmf_sdbrcm_download_code_file(bus)) { | 3320 | if (brcmf_sdbrcm_download_code_file(bus)) { |
3322 | brcmf_err("dongle image file download failed\n"); | 3321 | brcmf_err("dongle image file download failed\n"); |
3323 | goto err; | 3322 | goto err; |
3324 | } | 3323 | } |
3325 | 3324 | ||
3326 | /* External nvram takes precedence if specified */ | 3325 | if (brcmf_sdbrcm_download_nvram(bus)) { |
3327 | if (brcmf_sdbrcm_download_nvram(bus)) | ||
3328 | brcmf_err("dongle nvram file download failed\n"); | 3326 | brcmf_err("dongle nvram file download failed\n"); |
3327 | goto err; | ||
3328 | } | ||
3329 | 3329 | ||
3330 | /* Take arm out of reset */ | 3330 | /* Take arm out of reset */ |
3331 | if (brcmf_sdbrcm_download_state(bus, false)) { | 3331 | if (brcmf_sdbrcm_download_state(bus, false)) { |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 2af9c0f0798d..78da3eff75e8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -1891,8 +1891,10 @@ static s32 | |||
1891 | brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, | 1891 | brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, |
1892 | u8 key_idx, const u8 *mac_addr, struct key_params *params) | 1892 | u8 key_idx, const u8 *mac_addr, struct key_params *params) |
1893 | { | 1893 | { |
1894 | struct brcmf_if *ifp = netdev_priv(ndev); | ||
1894 | struct brcmf_wsec_key key; | 1895 | struct brcmf_wsec_key key; |
1895 | s32 err = 0; | 1896 | s32 err = 0; |
1897 | u8 keybuf[8]; | ||
1896 | 1898 | ||
1897 | memset(&key, 0, sizeof(key)); | 1899 | memset(&key, 0, sizeof(key)); |
1898 | key.index = (u32) key_idx; | 1900 | key.index = (u32) key_idx; |
@@ -1916,8 +1918,9 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, | |||
1916 | brcmf_dbg(CONN, "Setting the key index %d\n", key.index); | 1918 | brcmf_dbg(CONN, "Setting the key index %d\n", key.index); |
1917 | memcpy(key.data, params->key, key.len); | 1919 | memcpy(key.data, params->key, key.len); |
1918 | 1920 | ||
1919 | if (params->cipher == WLAN_CIPHER_SUITE_TKIP) { | 1921 | if ((ifp->vif->mode != WL_MODE_AP) && |
1920 | u8 keybuf[8]; | 1922 | (params->cipher == WLAN_CIPHER_SUITE_TKIP)) { |
1923 | brcmf_dbg(CONN, "Swapping RX/TX MIC key\n"); | ||
1921 | memcpy(keybuf, &key.data[24], sizeof(keybuf)); | 1924 | memcpy(keybuf, &key.data[24], sizeof(keybuf)); |
1922 | memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); | 1925 | memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); |
1923 | memcpy(&key.data[16], keybuf, sizeof(keybuf)); | 1926 | memcpy(&key.data[16], keybuf, sizeof(keybuf)); |
@@ -2013,7 +2016,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, | |||
2013 | break; | 2016 | break; |
2014 | case WLAN_CIPHER_SUITE_TKIP: | 2017 | case WLAN_CIPHER_SUITE_TKIP: |
2015 | if (ifp->vif->mode != WL_MODE_AP) { | 2018 | if (ifp->vif->mode != WL_MODE_AP) { |
2016 | brcmf_dbg(CONN, "Swapping key\n"); | 2019 | brcmf_dbg(CONN, "Swapping RX/TX MIC key\n"); |
2017 | memcpy(keybuf, &key.data[24], sizeof(keybuf)); | 2020 | memcpy(keybuf, &key.data[24], sizeof(keybuf)); |
2018 | memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); | 2021 | memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); |
2019 | memcpy(&key.data[16], keybuf, sizeof(keybuf)); | 2022 | memcpy(&key.data[16], keybuf, sizeof(keybuf)); |
@@ -2118,8 +2121,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, | |||
2118 | err = -EAGAIN; | 2121 | err = -EAGAIN; |
2119 | goto done; | 2122 | goto done; |
2120 | } | 2123 | } |
2121 | switch (wsec & ~SES_OW_ENABLED) { | 2124 | if (wsec & WEP_ENABLED) { |
2122 | case WEP_ENABLED: | ||
2123 | sec = &profile->sec; | 2125 | sec = &profile->sec; |
2124 | if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { | 2126 | if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { |
2125 | params.cipher = WLAN_CIPHER_SUITE_WEP40; | 2127 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
@@ -2128,16 +2130,13 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, | |||
2128 | params.cipher = WLAN_CIPHER_SUITE_WEP104; | 2130 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
2129 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); | 2131 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); |
2130 | } | 2132 | } |
2131 | break; | 2133 | } else if (wsec & TKIP_ENABLED) { |
2132 | case TKIP_ENABLED: | ||
2133 | params.cipher = WLAN_CIPHER_SUITE_TKIP; | 2134 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
2134 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); | 2135 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); |
2135 | break; | 2136 | } else if (wsec & AES_ENABLED) { |
2136 | case AES_ENABLED: | ||
2137 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; | 2137 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
2138 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); | 2138 | brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); |
2139 | break; | 2139 | } else { |
2140 | default: | ||
2141 | brcmf_err("Invalid algo (0x%x)\n", wsec); | 2140 | brcmf_err("Invalid algo (0x%x)\n", wsec); |
2142 | err = -EINVAL; | 2141 | err = -EINVAL; |
2143 | goto done; | 2142 | goto done; |
@@ -3824,8 +3823,9 @@ exit: | |||
3824 | static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) | 3823 | static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) |
3825 | { | 3824 | { |
3826 | struct brcmf_if *ifp = netdev_priv(ndev); | 3825 | struct brcmf_if *ifp = netdev_priv(ndev); |
3827 | s32 err = -EPERM; | 3826 | s32 err; |
3828 | struct brcmf_fil_bss_enable_le bss_enable; | 3827 | struct brcmf_fil_bss_enable_le bss_enable; |
3828 | struct brcmf_join_params join_params; | ||
3829 | 3829 | ||
3830 | brcmf_dbg(TRACE, "Enter\n"); | 3830 | brcmf_dbg(TRACE, "Enter\n"); |
3831 | 3831 | ||
@@ -3833,16 +3833,21 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) | |||
3833 | /* Due to most likely deauths outstanding we sleep */ | 3833 | /* Due to most likely deauths outstanding we sleep */ |
3834 | /* first to make sure they get processed by fw. */ | 3834 | /* first to make sure they get processed by fw. */ |
3835 | msleep(400); | 3835 | msleep(400); |
3836 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); | 3836 | |
3837 | if (err < 0) { | 3837 | memset(&join_params, 0, sizeof(join_params)); |
3838 | brcmf_err("setting AP mode failed %d\n", err); | 3838 | err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, |
3839 | goto exit; | 3839 | &join_params, sizeof(join_params)); |
3840 | } | 3840 | if (err < 0) |
3841 | brcmf_err("SET SSID error (%d)\n", err); | ||
3841 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); | 3842 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); |
3842 | if (err < 0) { | 3843 | if (err < 0) |
3843 | brcmf_err("BRCMF_C_UP error %d\n", err); | 3844 | brcmf_err("BRCMF_C_UP error %d\n", err); |
3844 | goto exit; | 3845 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); |
3845 | } | 3846 | if (err < 0) |
3847 | brcmf_err("setting AP mode failed %d\n", err); | ||
3848 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 0); | ||
3849 | if (err < 0) | ||
3850 | brcmf_err("setting INFRA mode failed %d\n", err); | ||
3846 | } else { | 3851 | } else { |
3847 | bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx); | 3852 | bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx); |
3848 | bss_enable.enable = cpu_to_le32(0); | 3853 | bss_enable.enable = cpu_to_le32(0); |
@@ -3855,7 +3860,6 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) | |||
3855 | set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); | 3860 | set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); |
3856 | clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); | 3861 | clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); |
3857 | 3862 | ||
3858 | exit: | ||
3859 | return err; | 3863 | return err; |
3860 | } | 3864 | } |
3861 | 3865 | ||
@@ -4124,10 +4128,6 @@ static const struct ieee80211_iface_limit brcmf_iface_limits[] = { | |||
4124 | }, | 4128 | }, |
4125 | { | 4129 | { |
4126 | .max = 1, | 4130 | .max = 1, |
4127 | .types = BIT(NL80211_IFTYPE_P2P_DEVICE) | ||
4128 | }, | ||
4129 | { | ||
4130 | .max = 1, | ||
4131 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | | 4131 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | |
4132 | BIT(NL80211_IFTYPE_P2P_GO) | 4132 | BIT(NL80211_IFTYPE_P2P_GO) |
4133 | }, | 4133 | }, |
@@ -4183,8 +4183,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) | |||
4183 | BIT(NL80211_IFTYPE_ADHOC) | | 4183 | BIT(NL80211_IFTYPE_ADHOC) | |
4184 | BIT(NL80211_IFTYPE_AP) | | 4184 | BIT(NL80211_IFTYPE_AP) | |
4185 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | 4185 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
4186 | BIT(NL80211_IFTYPE_P2P_GO) | | 4186 | BIT(NL80211_IFTYPE_P2P_GO); |
4187 | BIT(NL80211_IFTYPE_P2P_DEVICE); | ||
4188 | wiphy->iface_combinations = brcmf_iface_combos; | 4187 | wiphy->iface_combinations = brcmf_iface_combos; |
4189 | wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); | 4188 | wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); |
4190 | wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; | 4189 | wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index c6451c61407a..e2340b231aa1 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
@@ -274,6 +274,130 @@ static void brcms_set_basic_rate(struct brcm_rateset *rs, u16 rate, bool is_br) | |||
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
277 | /** | ||
278 | * This function frees the WL per-device resources. | ||
279 | * | ||
280 | * This function frees resources owned by the WL device pointed to | ||
281 | * by the wl parameter. | ||
282 | * | ||
283 | * precondition: can both be called locked and unlocked | ||
284 | * | ||
285 | */ | ||
286 | static void brcms_free(struct brcms_info *wl) | ||
287 | { | ||
288 | struct brcms_timer *t, *next; | ||
289 | |||
290 | /* free ucode data */ | ||
291 | if (wl->fw.fw_cnt) | ||
292 | brcms_ucode_data_free(&wl->ucode); | ||
293 | if (wl->irq) | ||
294 | free_irq(wl->irq, wl); | ||
295 | |||
296 | /* kill dpc */ | ||
297 | tasklet_kill(&wl->tasklet); | ||
298 | |||
299 | if (wl->pub) { | ||
300 | brcms_debugfs_detach(wl->pub); | ||
301 | brcms_c_module_unregister(wl->pub, "linux", wl); | ||
302 | } | ||
303 | |||
304 | /* free common resources */ | ||
305 | if (wl->wlc) { | ||
306 | brcms_c_detach(wl->wlc); | ||
307 | wl->wlc = NULL; | ||
308 | wl->pub = NULL; | ||
309 | } | ||
310 | |||
311 | /* virtual interface deletion is deferred so we cannot spinwait */ | ||
312 | |||
313 | /* wait for all pending callbacks to complete */ | ||
314 | while (atomic_read(&wl->callbacks) > 0) | ||
315 | schedule(); | ||
316 | |||
317 | /* free timers */ | ||
318 | for (t = wl->timers; t; t = next) { | ||
319 | next = t->next; | ||
320 | #ifdef DEBUG | ||
321 | kfree(t->name); | ||
322 | #endif | ||
323 | kfree(t); | ||
324 | } | ||
325 | } | ||
326 | |||
327 | /* | ||
328 | * called from both kernel as from this kernel module (error flow on attach) | ||
329 | * precondition: perimeter lock is not acquired. | ||
330 | */ | ||
331 | static void brcms_remove(struct bcma_device *pdev) | ||
332 | { | ||
333 | struct ieee80211_hw *hw = bcma_get_drvdata(pdev); | ||
334 | struct brcms_info *wl = hw->priv; | ||
335 | |||
336 | if (wl->wlc) { | ||
337 | wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); | ||
338 | wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); | ||
339 | ieee80211_unregister_hw(hw); | ||
340 | } | ||
341 | |||
342 | brcms_free(wl); | ||
343 | |||
344 | bcma_set_drvdata(pdev, NULL); | ||
345 | ieee80211_free_hw(hw); | ||
346 | } | ||
347 | |||
348 | /* | ||
349 | * Precondition: Since this function is called in brcms_pci_probe() context, | ||
350 | * no locking is required. | ||
351 | */ | ||
352 | static void brcms_release_fw(struct brcms_info *wl) | ||
353 | { | ||
354 | int i; | ||
355 | for (i = 0; i < MAX_FW_IMAGES; i++) { | ||
356 | release_firmware(wl->fw.fw_bin[i]); | ||
357 | release_firmware(wl->fw.fw_hdr[i]); | ||
358 | } | ||
359 | } | ||
360 | |||
361 | /* | ||
362 | * Precondition: Since this function is called in brcms_pci_probe() context, | ||
363 | * no locking is required. | ||
364 | */ | ||
365 | static int brcms_request_fw(struct brcms_info *wl, struct bcma_device *pdev) | ||
366 | { | ||
367 | int status; | ||
368 | struct device *device = &pdev->dev; | ||
369 | char fw_name[100]; | ||
370 | int i; | ||
371 | |||
372 | memset(&wl->fw, 0, sizeof(struct brcms_firmware)); | ||
373 | for (i = 0; i < MAX_FW_IMAGES; i++) { | ||
374 | if (brcms_firmwares[i] == NULL) | ||
375 | break; | ||
376 | sprintf(fw_name, "%s-%d.fw", brcms_firmwares[i], | ||
377 | UCODE_LOADER_API_VER); | ||
378 | status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); | ||
379 | if (status) { | ||
380 | wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | ||
381 | KBUILD_MODNAME, fw_name); | ||
382 | return status; | ||
383 | } | ||
384 | sprintf(fw_name, "%s_hdr-%d.fw", brcms_firmwares[i], | ||
385 | UCODE_LOADER_API_VER); | ||
386 | status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); | ||
387 | if (status) { | ||
388 | wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | ||
389 | KBUILD_MODNAME, fw_name); | ||
390 | return status; | ||
391 | } | ||
392 | wl->fw.hdr_num_entries[i] = | ||
393 | wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr)); | ||
394 | } | ||
395 | wl->fw.fw_cnt = i; | ||
396 | status = brcms_ucode_data_init(wl, &wl->ucode); | ||
397 | brcms_release_fw(wl); | ||
398 | return status; | ||
399 | } | ||
400 | |||
277 | static void brcms_ops_tx(struct ieee80211_hw *hw, | 401 | static void brcms_ops_tx(struct ieee80211_hw *hw, |
278 | struct ieee80211_tx_control *control, | 402 | struct ieee80211_tx_control *control, |
279 | struct sk_buff *skb) | 403 | struct sk_buff *skb) |
@@ -306,6 +430,14 @@ static int brcms_ops_start(struct ieee80211_hw *hw) | |||
306 | if (!blocked) | 430 | if (!blocked) |
307 | wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); | 431 | wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); |
308 | 432 | ||
433 | if (!wl->ucode.bcm43xx_bomminor) { | ||
434 | err = brcms_request_fw(wl, wl->wlc->hw->d11core); | ||
435 | if (err) { | ||
436 | brcms_remove(wl->wlc->hw->d11core); | ||
437 | return -ENOENT; | ||
438 | } | ||
439 | } | ||
440 | |||
309 | spin_lock_bh(&wl->lock); | 441 | spin_lock_bh(&wl->lock); |
310 | /* avoid acknowledging frames before a non-monitor device is added */ | 442 | /* avoid acknowledging frames before a non-monitor device is added */ |
311 | wl->mute_tx = true; | 443 | wl->mute_tx = true; |
@@ -793,128 +925,6 @@ void brcms_dpc(unsigned long data) | |||
793 | wake_up(&wl->tx_flush_wq); | 925 | wake_up(&wl->tx_flush_wq); |
794 | } | 926 | } |
795 | 927 | ||
796 | /* | ||
797 | * Precondition: Since this function is called in brcms_pci_probe() context, | ||
798 | * no locking is required. | ||
799 | */ | ||
800 | static int brcms_request_fw(struct brcms_info *wl, struct bcma_device *pdev) | ||
801 | { | ||
802 | int status; | ||
803 | struct device *device = &pdev->dev; | ||
804 | char fw_name[100]; | ||
805 | int i; | ||
806 | |||
807 | memset(&wl->fw, 0, sizeof(struct brcms_firmware)); | ||
808 | for (i = 0; i < MAX_FW_IMAGES; i++) { | ||
809 | if (brcms_firmwares[i] == NULL) | ||
810 | break; | ||
811 | sprintf(fw_name, "%s-%d.fw", brcms_firmwares[i], | ||
812 | UCODE_LOADER_API_VER); | ||
813 | status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); | ||
814 | if (status) { | ||
815 | wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | ||
816 | KBUILD_MODNAME, fw_name); | ||
817 | return status; | ||
818 | } | ||
819 | sprintf(fw_name, "%s_hdr-%d.fw", brcms_firmwares[i], | ||
820 | UCODE_LOADER_API_VER); | ||
821 | status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); | ||
822 | if (status) { | ||
823 | wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", | ||
824 | KBUILD_MODNAME, fw_name); | ||
825 | return status; | ||
826 | } | ||
827 | wl->fw.hdr_num_entries[i] = | ||
828 | wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr)); | ||
829 | } | ||
830 | wl->fw.fw_cnt = i; | ||
831 | return brcms_ucode_data_init(wl, &wl->ucode); | ||
832 | } | ||
833 | |||
834 | /* | ||
835 | * Precondition: Since this function is called in brcms_pci_probe() context, | ||
836 | * no locking is required. | ||
837 | */ | ||
838 | static void brcms_release_fw(struct brcms_info *wl) | ||
839 | { | ||
840 | int i; | ||
841 | for (i = 0; i < MAX_FW_IMAGES; i++) { | ||
842 | release_firmware(wl->fw.fw_bin[i]); | ||
843 | release_firmware(wl->fw.fw_hdr[i]); | ||
844 | } | ||
845 | } | ||
846 | |||
847 | /** | ||
848 | * This function frees the WL per-device resources. | ||
849 | * | ||
850 | * This function frees resources owned by the WL device pointed to | ||
851 | * by the wl parameter. | ||
852 | * | ||
853 | * precondition: can both be called locked and unlocked | ||
854 | * | ||
855 | */ | ||
856 | static void brcms_free(struct brcms_info *wl) | ||
857 | { | ||
858 | struct brcms_timer *t, *next; | ||
859 | |||
860 | /* free ucode data */ | ||
861 | if (wl->fw.fw_cnt) | ||
862 | brcms_ucode_data_free(&wl->ucode); | ||
863 | if (wl->irq) | ||
864 | free_irq(wl->irq, wl); | ||
865 | |||
866 | /* kill dpc */ | ||
867 | tasklet_kill(&wl->tasklet); | ||
868 | |||
869 | if (wl->pub) { | ||
870 | brcms_debugfs_detach(wl->pub); | ||
871 | brcms_c_module_unregister(wl->pub, "linux", wl); | ||
872 | } | ||
873 | |||
874 | /* free common resources */ | ||
875 | if (wl->wlc) { | ||
876 | brcms_c_detach(wl->wlc); | ||
877 | wl->wlc = NULL; | ||
878 | wl->pub = NULL; | ||
879 | } | ||
880 | |||
881 | /* virtual interface deletion is deferred so we cannot spinwait */ | ||
882 | |||
883 | /* wait for all pending callbacks to complete */ | ||
884 | while (atomic_read(&wl->callbacks) > 0) | ||
885 | schedule(); | ||
886 | |||
887 | /* free timers */ | ||
888 | for (t = wl->timers; t; t = next) { | ||
889 | next = t->next; | ||
890 | #ifdef DEBUG | ||
891 | kfree(t->name); | ||
892 | #endif | ||
893 | kfree(t); | ||
894 | } | ||
895 | } | ||
896 | |||
897 | /* | ||
898 | * called from both kernel as from this kernel module (error flow on attach) | ||
899 | * precondition: perimeter lock is not acquired. | ||
900 | */ | ||
901 | static void brcms_remove(struct bcma_device *pdev) | ||
902 | { | ||
903 | struct ieee80211_hw *hw = bcma_get_drvdata(pdev); | ||
904 | struct brcms_info *wl = hw->priv; | ||
905 | |||
906 | if (wl->wlc) { | ||
907 | wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); | ||
908 | wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); | ||
909 | ieee80211_unregister_hw(hw); | ||
910 | } | ||
911 | |||
912 | brcms_free(wl); | ||
913 | |||
914 | bcma_set_drvdata(pdev, NULL); | ||
915 | ieee80211_free_hw(hw); | ||
916 | } | ||
917 | |||
918 | static irqreturn_t brcms_isr(int irq, void *dev_id) | 928 | static irqreturn_t brcms_isr(int irq, void *dev_id) |
919 | { | 929 | { |
920 | struct brcms_info *wl; | 930 | struct brcms_info *wl; |
@@ -1047,18 +1057,8 @@ static struct brcms_info *brcms_attach(struct bcma_device *pdev) | |||
1047 | spin_lock_init(&wl->lock); | 1057 | spin_lock_init(&wl->lock); |
1048 | spin_lock_init(&wl->isr_lock); | 1058 | spin_lock_init(&wl->isr_lock); |
1049 | 1059 | ||
1050 | /* prepare ucode */ | ||
1051 | if (brcms_request_fw(wl, pdev) < 0) { | ||
1052 | wiphy_err(wl->wiphy, "%s: Failed to find firmware usually in " | ||
1053 | "%s\n", KBUILD_MODNAME, "/lib/firmware/brcm"); | ||
1054 | brcms_release_fw(wl); | ||
1055 | brcms_remove(pdev); | ||
1056 | return NULL; | ||
1057 | } | ||
1058 | |||
1059 | /* common load-time initialization */ | 1060 | /* common load-time initialization */ |
1060 | wl->wlc = brcms_c_attach((void *)wl, pdev, unit, false, &err); | 1061 | wl->wlc = brcms_c_attach((void *)wl, pdev, unit, false, &err); |
1061 | brcms_release_fw(wl); | ||
1062 | if (!wl->wlc) { | 1062 | if (!wl->wlc) { |
1063 | wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n", | 1063 | wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n", |
1064 | KBUILD_MODNAME, err); | 1064 | KBUILD_MODNAME, err); |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c index 21a824232478..18d37645e2cd 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | |||
@@ -1137,9 +1137,8 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi, | |||
1137 | gain0_15 = ((biq1 & 0xf) << 12) | | 1137 | gain0_15 = ((biq1 & 0xf) << 12) | |
1138 | ((tia & 0xf) << 8) | | 1138 | ((tia & 0xf) << 8) | |
1139 | ((lna2 & 0x3) << 6) | | 1139 | ((lna2 & 0x3) << 6) | |
1140 | ((lna2 & 0x3) << 4) | | 1140 | ((lna2 & |
1141 | ((lna1 & 0x3) << 2) | | 1141 | 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0); |
1142 | ((lna1 & 0x3) << 0); | ||
1143 | 1142 | ||
1144 | mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); | 1143 | mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); |
1145 | mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); | 1144 | mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); |
@@ -1157,8 +1156,6 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi, | |||
1157 | } | 1156 | } |
1158 | 1157 | ||
1159 | mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); | 1158 | mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); |
1160 | mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11); | ||
1161 | mod_phy_reg(pi, 0x4e6, (0x3 << 3), lna1 << 3); | ||
1162 | 1159 | ||
1163 | } | 1160 | } |
1164 | 1161 | ||
@@ -1331,43 +1328,6 @@ static u32 wlc_lcnphy_measure_digital_power(struct brcms_phy *pi, u16 nsamples) | |||
1331 | return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; | 1328 | return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; |
1332 | } | 1329 | } |
1333 | 1330 | ||
1334 | static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain, | ||
1335 | u16 tia_gain, u16 lna2_gain) | ||
1336 | { | ||
1337 | u32 i_thresh_l, q_thresh_l; | ||
1338 | u32 i_thresh_h, q_thresh_h; | ||
1339 | struct lcnphy_iq_est iq_est_h, iq_est_l; | ||
1340 | |||
1341 | wlc_lcnphy_set_rx_gain_by_distribution(pi, 0, 0, 0, biq1_gain, tia_gain, | ||
1342 | lna2_gain, 0); | ||
1343 | |||
1344 | wlc_lcnphy_rx_gain_override_enable(pi, true); | ||
1345 | wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); | ||
1346 | udelay(500); | ||
1347 | write_radio_reg(pi, RADIO_2064_REG112, 0); | ||
1348 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) | ||
1349 | return false; | ||
1350 | |||
1351 | wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); | ||
1352 | udelay(500); | ||
1353 | write_radio_reg(pi, RADIO_2064_REG112, 0); | ||
1354 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) | ||
1355 | return false; | ||
1356 | |||
1357 | i_thresh_l = (iq_est_l.i_pwr << 1); | ||
1358 | i_thresh_h = (iq_est_l.i_pwr << 2) + iq_est_l.i_pwr; | ||
1359 | |||
1360 | q_thresh_l = (iq_est_l.q_pwr << 1); | ||
1361 | q_thresh_h = (iq_est_l.q_pwr << 2) + iq_est_l.q_pwr; | ||
1362 | if ((iq_est_h.i_pwr > i_thresh_l) && | ||
1363 | (iq_est_h.i_pwr < i_thresh_h) && | ||
1364 | (iq_est_h.q_pwr > q_thresh_l) && | ||
1365 | (iq_est_h.q_pwr < q_thresh_h)) | ||
1366 | return true; | ||
1367 | |||
1368 | return false; | ||
1369 | } | ||
1370 | |||
1371 | static bool | 1331 | static bool |
1372 | wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | 1332 | wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, |
1373 | const struct lcnphy_rx_iqcomp *iqcomp, | 1333 | const struct lcnphy_rx_iqcomp *iqcomp, |
@@ -1382,8 +1342,8 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | |||
1382 | RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, | 1342 | RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, |
1383 | rfoverride3_old, rfoverride3val_old, rfoverride4_old, | 1343 | rfoverride3_old, rfoverride3val_old, rfoverride4_old, |
1384 | rfoverride4val_old, afectrlovr_old, afectrlovrval_old; | 1344 | rfoverride4val_old, afectrlovr_old, afectrlovrval_old; |
1385 | int tia_gain, lna2_gain, biq1_gain; | 1345 | int tia_gain; |
1386 | bool set_gain; | 1346 | u32 received_power, rx_pwr_threshold; |
1387 | u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; | 1347 | u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; |
1388 | u16 values_to_save[11]; | 1348 | u16 values_to_save[11]; |
1389 | s16 *ptr; | 1349 | s16 *ptr; |
@@ -1408,134 +1368,126 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | |||
1408 | goto cal_done; | 1368 | goto cal_done; |
1409 | } | 1369 | } |
1410 | 1370 | ||
1411 | WARN_ON(module != 1); | 1371 | if (module == 1) { |
1412 | tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); | ||
1413 | wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); | ||
1414 | |||
1415 | for (i = 0; i < 11; i++) | ||
1416 | values_to_save[i] = | ||
1417 | read_radio_reg(pi, rxiq_cal_rf_reg[i]); | ||
1418 | Core1TxControl_old = read_phy_reg(pi, 0x631); | ||
1419 | |||
1420 | or_phy_reg(pi, 0x631, 0x0015); | ||
1421 | |||
1422 | RFOverride0_old = read_phy_reg(pi, 0x44c); | ||
1423 | RFOverrideVal0_old = read_phy_reg(pi, 0x44d); | ||
1424 | rfoverride2_old = read_phy_reg(pi, 0x4b0); | ||
1425 | rfoverride2val_old = read_phy_reg(pi, 0x4b1); | ||
1426 | rfoverride3_old = read_phy_reg(pi, 0x4f9); | ||
1427 | rfoverride3val_old = read_phy_reg(pi, 0x4fa); | ||
1428 | rfoverride4_old = read_phy_reg(pi, 0x938); | ||
1429 | rfoverride4val_old = read_phy_reg(pi, 0x939); | ||
1430 | afectrlovr_old = read_phy_reg(pi, 0x43b); | ||
1431 | afectrlovrval_old = read_phy_reg(pi, 0x43c); | ||
1432 | old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); | ||
1433 | old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); | ||
1434 | |||
1435 | tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); | ||
1436 | if (tx_gain_override_old) { | ||
1437 | wlc_lcnphy_get_tx_gain(pi, &old_gains); | ||
1438 | tx_gain_index_old = pi_lcn->lcnphy_current_index; | ||
1439 | } | ||
1440 | |||
1441 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); | ||
1442 | 1372 | ||
1443 | mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); | 1373 | tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); |
1444 | mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); | 1374 | wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); |
1445 | 1375 | ||
1446 | mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); | 1376 | for (i = 0; i < 11; i++) |
1447 | mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); | 1377 | values_to_save[i] = |
1378 | read_radio_reg(pi, rxiq_cal_rf_reg[i]); | ||
1379 | Core1TxControl_old = read_phy_reg(pi, 0x631); | ||
1380 | |||
1381 | or_phy_reg(pi, 0x631, 0x0015); | ||
1382 | |||
1383 | RFOverride0_old = read_phy_reg(pi, 0x44c); | ||
1384 | RFOverrideVal0_old = read_phy_reg(pi, 0x44d); | ||
1385 | rfoverride2_old = read_phy_reg(pi, 0x4b0); | ||
1386 | rfoverride2val_old = read_phy_reg(pi, 0x4b1); | ||
1387 | rfoverride3_old = read_phy_reg(pi, 0x4f9); | ||
1388 | rfoverride3val_old = read_phy_reg(pi, 0x4fa); | ||
1389 | rfoverride4_old = read_phy_reg(pi, 0x938); | ||
1390 | rfoverride4val_old = read_phy_reg(pi, 0x939); | ||
1391 | afectrlovr_old = read_phy_reg(pi, 0x43b); | ||
1392 | afectrlovrval_old = read_phy_reg(pi, 0x43c); | ||
1393 | old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); | ||
1394 | old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); | ||
1395 | |||
1396 | tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); | ||
1397 | if (tx_gain_override_old) { | ||
1398 | wlc_lcnphy_get_tx_gain(pi, &old_gains); | ||
1399 | tx_gain_index_old = pi_lcn->lcnphy_current_index; | ||
1400 | } | ||
1448 | 1401 | ||
1449 | write_radio_reg(pi, RADIO_2064_REG116, 0x06); | 1402 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); |
1450 | write_radio_reg(pi, RADIO_2064_REG12C, 0x07); | ||
1451 | write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); | ||
1452 | write_radio_reg(pi, RADIO_2064_REG098, 0x03); | ||
1453 | write_radio_reg(pi, RADIO_2064_REG00B, 0x7); | ||
1454 | mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); | ||
1455 | write_radio_reg(pi, RADIO_2064_REG01D, 0x01); | ||
1456 | write_radio_reg(pi, RADIO_2064_REG114, 0x01); | ||
1457 | write_radio_reg(pi, RADIO_2064_REG02E, 0x10); | ||
1458 | write_radio_reg(pi, RADIO_2064_REG12A, 0x08); | ||
1459 | |||
1460 | mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); | ||
1461 | mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); | ||
1462 | mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); | ||
1463 | mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); | ||
1464 | mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); | ||
1465 | mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); | ||
1466 | mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); | ||
1467 | mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); | ||
1468 | mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); | ||
1469 | mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); | ||
1470 | 1403 | ||
1471 | mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); | 1404 | mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); |
1472 | mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); | 1405 | mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); |
1473 | 1406 | ||
1474 | write_phy_reg(pi, 0x6da, 0xffff); | 1407 | mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); |
1475 | or_phy_reg(pi, 0x6db, 0x3); | 1408 | mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); |
1476 | 1409 | ||
1477 | wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); | 1410 | write_radio_reg(pi, RADIO_2064_REG116, 0x06); |
1478 | set_gain = false; | 1411 | write_radio_reg(pi, RADIO_2064_REG12C, 0x07); |
1479 | 1412 | write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); | |
1480 | lna2_gain = 3; | 1413 | write_radio_reg(pi, RADIO_2064_REG098, 0x03); |
1481 | while ((lna2_gain >= 0) && !set_gain) { | 1414 | write_radio_reg(pi, RADIO_2064_REG00B, 0x7); |
1482 | tia_gain = 4; | 1415 | mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); |
1483 | 1416 | write_radio_reg(pi, RADIO_2064_REG01D, 0x01); | |
1484 | while ((tia_gain >= 0) && !set_gain) { | 1417 | write_radio_reg(pi, RADIO_2064_REG114, 0x01); |
1485 | biq1_gain = 6; | 1418 | write_radio_reg(pi, RADIO_2064_REG02E, 0x10); |
1486 | 1419 | write_radio_reg(pi, RADIO_2064_REG12A, 0x08); | |
1487 | while ((biq1_gain >= 0) && !set_gain) { | 1420 | |
1488 | set_gain = wlc_lcnphy_rx_iq_cal_gain(pi, | 1421 | mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); |
1489 | (u16) | 1422 | mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); |
1490 | biq1_gain, | 1423 | mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); |
1491 | (u16) | 1424 | mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); |
1492 | tia_gain, | 1425 | mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); |
1493 | (u16) | 1426 | mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); |
1494 | lna2_gain); | 1427 | mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); |
1495 | biq1_gain -= 1; | 1428 | mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); |
1496 | } | 1429 | mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); |
1430 | mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); | ||
1431 | |||
1432 | mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); | ||
1433 | mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); | ||
1434 | |||
1435 | wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0); | ||
1436 | write_phy_reg(pi, 0x6da, 0xffff); | ||
1437 | or_phy_reg(pi, 0x6db, 0x3); | ||
1438 | wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); | ||
1439 | wlc_lcnphy_rx_gain_override_enable(pi, true); | ||
1440 | |||
1441 | tia_gain = 8; | ||
1442 | rx_pwr_threshold = 950; | ||
1443 | while (tia_gain > 0) { | ||
1497 | tia_gain -= 1; | 1444 | tia_gain -= 1; |
1445 | wlc_lcnphy_set_rx_gain_by_distribution(pi, | ||
1446 | 0, 0, 2, 2, | ||
1447 | (u16) | ||
1448 | tia_gain, 1, 0); | ||
1449 | udelay(500); | ||
1450 | |||
1451 | received_power = | ||
1452 | wlc_lcnphy_measure_digital_power(pi, 2000); | ||
1453 | if (received_power < rx_pwr_threshold) | ||
1454 | break; | ||
1498 | } | 1455 | } |
1499 | lna2_gain -= 1; | 1456 | result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff); |
1500 | } | ||
1501 | 1457 | ||
1502 | if (set_gain) | 1458 | wlc_lcnphy_stop_tx_tone(pi); |
1503 | result = wlc_lcnphy_calc_rx_iq_comp(pi, 1024); | ||
1504 | else | ||
1505 | result = false; | ||
1506 | 1459 | ||
1507 | wlc_lcnphy_stop_tx_tone(pi); | 1460 | write_phy_reg(pi, 0x631, Core1TxControl_old); |
1508 | 1461 | ||
1509 | write_phy_reg(pi, 0x631, Core1TxControl_old); | 1462 | write_phy_reg(pi, 0x44c, RFOverrideVal0_old); |
1510 | 1463 | write_phy_reg(pi, 0x44d, RFOverrideVal0_old); | |
1511 | write_phy_reg(pi, 0x44c, RFOverrideVal0_old); | 1464 | write_phy_reg(pi, 0x4b0, rfoverride2_old); |
1512 | write_phy_reg(pi, 0x44d, RFOverrideVal0_old); | 1465 | write_phy_reg(pi, 0x4b1, rfoverride2val_old); |
1513 | write_phy_reg(pi, 0x4b0, rfoverride2_old); | 1466 | write_phy_reg(pi, 0x4f9, rfoverride3_old); |
1514 | write_phy_reg(pi, 0x4b1, rfoverride2val_old); | 1467 | write_phy_reg(pi, 0x4fa, rfoverride3val_old); |
1515 | write_phy_reg(pi, 0x4f9, rfoverride3_old); | 1468 | write_phy_reg(pi, 0x938, rfoverride4_old); |
1516 | write_phy_reg(pi, 0x4fa, rfoverride3val_old); | 1469 | write_phy_reg(pi, 0x939, rfoverride4val_old); |
1517 | write_phy_reg(pi, 0x938, rfoverride4_old); | 1470 | write_phy_reg(pi, 0x43b, afectrlovr_old); |
1518 | write_phy_reg(pi, 0x939, rfoverride4val_old); | 1471 | write_phy_reg(pi, 0x43c, afectrlovrval_old); |
1519 | write_phy_reg(pi, 0x43b, afectrlovr_old); | 1472 | write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); |
1520 | write_phy_reg(pi, 0x43c, afectrlovrval_old); | 1473 | write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); |
1521 | write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); | ||
1522 | write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); | ||
1523 | 1474 | ||
1524 | wlc_lcnphy_clear_trsw_override(pi); | 1475 | wlc_lcnphy_clear_trsw_override(pi); |
1525 | 1476 | ||
1526 | mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); | 1477 | mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); |
1527 | 1478 | ||
1528 | for (i = 0; i < 11; i++) | 1479 | for (i = 0; i < 11; i++) |
1529 | write_radio_reg(pi, rxiq_cal_rf_reg[i], | 1480 | write_radio_reg(pi, rxiq_cal_rf_reg[i], |
1530 | values_to_save[i]); | 1481 | values_to_save[i]); |
1531 | 1482 | ||
1532 | if (tx_gain_override_old) | 1483 | if (tx_gain_override_old) |
1533 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); | 1484 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); |
1534 | else | 1485 | else |
1535 | wlc_lcnphy_disable_tx_gain_override(pi); | 1486 | wlc_lcnphy_disable_tx_gain_override(pi); |
1536 | 1487 | ||
1537 | wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); | 1488 | wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); |
1538 | wlc_lcnphy_rx_gain_override_enable(pi, false); | 1489 | wlc_lcnphy_rx_gain_override_enable(pi, false); |
1490 | } | ||
1539 | 1491 | ||
1540 | cal_done: | 1492 | cal_done: |
1541 | kfree(ptr); | 1493 | kfree(ptr); |
@@ -1829,17 +1781,6 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel) | |||
1829 | write_radio_reg(pi, RADIO_2064_REG038, 3); | 1781 | write_radio_reg(pi, RADIO_2064_REG038, 3); |
1830 | write_radio_reg(pi, RADIO_2064_REG091, 7); | 1782 | write_radio_reg(pi, RADIO_2064_REG091, 7); |
1831 | } | 1783 | } |
1832 | |||
1833 | if (!(pi->sh->boardflags & BFL_FEM)) { | ||
1834 | u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc, | ||
1835 | 0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0}; | ||
1836 | |||
1837 | write_radio_reg(pi, RADIO_2064_REG02A, 0xf); | ||
1838 | write_radio_reg(pi, RADIO_2064_REG091, 0x3); | ||
1839 | write_radio_reg(pi, RADIO_2064_REG038, 0x3); | ||
1840 | |||
1841 | write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]); | ||
1842 | } | ||
1843 | } | 1784 | } |
1844 | 1785 | ||
1845 | static int | 1786 | static int |
@@ -2034,16 +1975,6 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos) | |||
2034 | } else { | 1975 | } else { |
2035 | mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); | 1976 | mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); |
2036 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); | 1977 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); |
2037 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0); | ||
2038 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2); | ||
2039 | mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0); | ||
2040 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4); | ||
2041 | mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); | ||
2042 | mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77); | ||
2043 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1); | ||
2044 | mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7); | ||
2045 | mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1); | ||
2046 | mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4); | ||
2047 | } | 1978 | } |
2048 | } else { | 1979 | } else { |
2049 | mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); | 1980 | mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); |
@@ -2130,14 +2061,12 @@ static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi) | |||
2130 | (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); | 2061 | (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); |
2131 | 2062 | ||
2132 | mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); | 2063 | mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); |
2133 | mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0)); | ||
2134 | } | 2064 | } |
2135 | 2065 | ||
2136 | static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | 2066 | static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) |
2137 | { | 2067 | { |
2138 | struct phytbl_info tab; | 2068 | struct phytbl_info tab; |
2139 | u32 rfseq, ind; | 2069 | u32 rfseq, ind; |
2140 | u8 tssi_sel; | ||
2141 | 2070 | ||
2142 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; | 2071 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; |
2143 | tab.tbl_width = 32; | 2072 | tab.tbl_width = 32; |
@@ -2159,13 +2088,7 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2159 | 2088 | ||
2160 | mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); | 2089 | mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); |
2161 | 2090 | ||
2162 | if (pi->sh->boardflags & BFL_FEM) { | 2091 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); |
2163 | tssi_sel = 0x1; | ||
2164 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); | ||
2165 | } else { | ||
2166 | tssi_sel = 0xe; | ||
2167 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_POST_PA); | ||
2168 | } | ||
2169 | mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); | 2092 | mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); |
2170 | 2093 | ||
2171 | mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); | 2094 | mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); |
@@ -2201,10 +2124,9 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2201 | mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); | 2124 | mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); |
2202 | 2125 | ||
2203 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { | 2126 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { |
2204 | mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel); | 2127 | mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe); |
2205 | mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); | 2128 | mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); |
2206 | } else { | 2129 | } else { |
2207 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1); | ||
2208 | mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); | 2130 | mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); |
2209 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); | 2131 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); |
2210 | } | 2132 | } |
@@ -2251,10 +2173,6 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2251 | 2173 | ||
2252 | mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); | 2174 | mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); |
2253 | 2175 | ||
2254 | mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0); | ||
2255 | mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); | ||
2256 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); | ||
2257 | |||
2258 | wlc_lcnphy_pwrctrl_rssiparams(pi); | 2176 | wlc_lcnphy_pwrctrl_rssiparams(pi); |
2259 | } | 2177 | } |
2260 | 2178 | ||
@@ -2873,8 +2791,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2873 | read_radio_reg(pi, RADIO_2064_REG007) & 1; | 2791 | read_radio_reg(pi, RADIO_2064_REG007) & 1; |
2874 | u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; | 2792 | u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; |
2875 | u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; | 2793 | u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; |
2876 | u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi); | ||
2877 | |||
2878 | idleTssi = read_phy_reg(pi, 0x4ab); | 2794 | idleTssi = read_phy_reg(pi, 0x4ab); |
2879 | suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & | 2795 | suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & |
2880 | MCTL_EN_MAC)); | 2796 | MCTL_EN_MAC)); |
@@ -2892,12 +2808,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2892 | mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); | 2808 | mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); |
2893 | mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); | 2809 | mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); |
2894 | wlc_lcnphy_tssi_setup(pi); | 2810 | wlc_lcnphy_tssi_setup(pi); |
2895 | |||
2896 | mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0)); | ||
2897 | mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6)); | ||
2898 | |||
2899 | wlc_lcnphy_set_bbmult(pi, 0x0); | ||
2900 | |||
2901 | wlc_phy_do_dummy_tx(pi, true, OFF); | 2811 | wlc_phy_do_dummy_tx(pi, true, OFF); |
2902 | idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) | 2812 | idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) |
2903 | >> 0); | 2813 | >> 0); |
@@ -2919,7 +2829,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2919 | 2829 | ||
2920 | mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); | 2830 | mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); |
2921 | 2831 | ||
2922 | wlc_lcnphy_set_bbmult(pi, SAVE_bbmult); | ||
2923 | wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); | 2832 | wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); |
2924 | wlc_lcnphy_set_tx_gain(pi, &old_gains); | 2833 | wlc_lcnphy_set_tx_gain(pi, &old_gains); |
2925 | wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); | 2834 | wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); |
@@ -3133,11 +3042,6 @@ static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi) | |||
3133 | wlc_lcnphy_write_table(pi, &tab); | 3042 | wlc_lcnphy_write_table(pi, &tab); |
3134 | tab.tbl_offset++; | 3043 | tab.tbl_offset++; |
3135 | } | 3044 | } |
3136 | mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0); | ||
3137 | mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0); | ||
3138 | mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8); | ||
3139 | mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4); | ||
3140 | mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2); | ||
3141 | 3045 | ||
3142 | mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); | 3046 | mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); |
3143 | 3047 | ||
@@ -3939,6 +3843,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) | |||
3939 | target_gains.pad_gain = 21; | 3843 | target_gains.pad_gain = 21; |
3940 | target_gains.dac_gain = 0; | 3844 | target_gains.dac_gain = 0; |
3941 | wlc_lcnphy_set_tx_gain(pi, &target_gains); | 3845 | wlc_lcnphy_set_tx_gain(pi, &target_gains); |
3846 | wlc_lcnphy_set_tx_pwr_by_index(pi, 16); | ||
3942 | 3847 | ||
3943 | if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { | 3848 | if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { |
3944 | 3849 | ||
@@ -3949,7 +3854,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) | |||
3949 | lcnphy_recal ? LCNPHY_CAL_RECAL : | 3854 | lcnphy_recal ? LCNPHY_CAL_RECAL : |
3950 | LCNPHY_CAL_FULL), false); | 3855 | LCNPHY_CAL_FULL), false); |
3951 | } else { | 3856 | } else { |
3952 | wlc_lcnphy_set_tx_pwr_by_index(pi, 16); | ||
3953 | wlc_lcnphy_tx_iqlo_soft_cal_full(pi); | 3857 | wlc_lcnphy_tx_iqlo_soft_cal_full(pi); |
3954 | } | 3858 | } |
3955 | 3859 | ||
@@ -4374,22 +4278,17 @@ wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi, | |||
4374 | if (CHSPEC_IS5G(pi->radio_chanspec)) | 4278 | if (CHSPEC_IS5G(pi->radio_chanspec)) |
4375 | pa_gain = 0x70; | 4279 | pa_gain = 0x70; |
4376 | else | 4280 | else |
4377 | pa_gain = 0x60; | 4281 | pa_gain = 0x70; |
4378 | 4282 | ||
4379 | if (pi->sh->boardflags & BFL_FEM) | 4283 | if (pi->sh->boardflags & BFL_FEM) |
4380 | pa_gain = 0x10; | 4284 | pa_gain = 0x10; |
4381 | |||
4382 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; | 4285 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; |
4383 | tab.tbl_width = 32; | 4286 | tab.tbl_width = 32; |
4384 | tab.tbl_len = 1; | 4287 | tab.tbl_len = 1; |
4385 | tab.tbl_ptr = &val; | 4288 | tab.tbl_ptr = &val; |
4386 | 4289 | ||
4387 | for (j = 0; j < 128; j++) { | 4290 | for (j = 0; j < 128; j++) { |
4388 | if (pi->sh->boardflags & BFL_FEM) | 4291 | gm_gain = gain_table[j].gm; |
4389 | gm_gain = gain_table[j].gm; | ||
4390 | else | ||
4391 | gm_gain = 15; | ||
4392 | |||
4393 | val = (((u32) pa_gain << 24) | | 4292 | val = (((u32) pa_gain << 24) | |
4394 | (gain_table[j].pad << 16) | | 4293 | (gain_table[j].pad << 16) | |
4395 | (gain_table[j].pga << 8) | gm_gain); | 4294 | (gain_table[j].pga << 8) | gm_gain); |
@@ -4600,10 +4499,7 @@ static void wlc_radio_2064_init(struct brcms_phy *pi) | |||
4600 | 4499 | ||
4601 | write_phy_reg(pi, 0x4ea, 0x4688); | 4500 | write_phy_reg(pi, 0x4ea, 0x4688); |
4602 | 4501 | ||
4603 | if (pi->sh->boardflags & BFL_FEM) | 4502 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); |
4604 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); | ||
4605 | else | ||
4606 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0); | ||
4607 | 4503 | ||
4608 | mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); | 4504 | mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); |
4609 | 4505 | ||
@@ -4614,13 +4510,6 @@ static void wlc_radio_2064_init(struct brcms_phy *pi) | |||
4614 | wlc_lcnphy_rcal(pi); | 4510 | wlc_lcnphy_rcal(pi); |
4615 | 4511 | ||
4616 | wlc_lcnphy_rc_cal(pi); | 4512 | wlc_lcnphy_rc_cal(pi); |
4617 | |||
4618 | if (!(pi->sh->boardflags & BFL_FEM)) { | ||
4619 | write_radio_reg(pi, RADIO_2064_REG032, 0x6f); | ||
4620 | write_radio_reg(pi, RADIO_2064_REG033, 0x19); | ||
4621 | write_radio_reg(pi, RADIO_2064_REG039, 0xe); | ||
4622 | } | ||
4623 | |||
4624 | } | 4513 | } |
4625 | 4514 | ||
4626 | static void wlc_lcnphy_radio_init(struct brcms_phy *pi) | 4515 | static void wlc_lcnphy_radio_init(struct brcms_phy *pi) |
@@ -4650,20 +4539,22 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi) | |||
4650 | wlc_lcnphy_write_table(pi, &tab); | 4539 | wlc_lcnphy_write_table(pi, &tab); |
4651 | } | 4540 | } |
4652 | 4541 | ||
4653 | if (!(pi->sh->boardflags & BFL_FEM)) { | 4542 | tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; |
4654 | tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; | 4543 | tab.tbl_width = 16; |
4655 | tab.tbl_width = 16; | 4544 | tab.tbl_ptr = &val; |
4656 | tab.tbl_ptr = &val; | 4545 | tab.tbl_len = 1; |
4657 | tab.tbl_len = 1; | ||
4658 | 4546 | ||
4659 | val = 150; | 4547 | val = 114; |
4660 | tab.tbl_offset = 0; | 4548 | tab.tbl_offset = 0; |
4661 | wlc_lcnphy_write_table(pi, &tab); | 4549 | wlc_lcnphy_write_table(pi, &tab); |
4662 | 4550 | ||
4663 | val = 220; | 4551 | val = 130; |
4664 | tab.tbl_offset = 1; | 4552 | tab.tbl_offset = 1; |
4665 | wlc_lcnphy_write_table(pi, &tab); | 4553 | wlc_lcnphy_write_table(pi, &tab); |
4666 | } | 4554 | |
4555 | val = 6; | ||
4556 | tab.tbl_offset = 8; | ||
4557 | wlc_lcnphy_write_table(pi, &tab); | ||
4667 | 4558 | ||
4668 | if (CHSPEC_IS2G(pi->radio_chanspec)) { | 4559 | if (CHSPEC_IS2G(pi->radio_chanspec)) { |
4669 | if (pi->sh->boardflags & BFL_FEM) | 4560 | if (pi->sh->boardflags & BFL_FEM) |
@@ -5055,7 +4946,6 @@ void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec) | |||
5055 | wlc_lcnphy_load_tx_iir_filter(pi, true, 3); | 4946 | wlc_lcnphy_load_tx_iir_filter(pi, true, 3); |
5056 | 4947 | ||
5057 | mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); | 4948 | mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); |
5058 | wlc_lcnphy_tssi_setup(pi); | ||
5059 | } | 4949 | } |
5060 | 4950 | ||
5061 | void wlc_phy_detach_lcnphy(struct brcms_phy *pi) | 4951 | void wlc_phy_detach_lcnphy(struct brcms_phy *pi) |
@@ -5094,7 +4984,8 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) | |||
5094 | if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) | 4984 | if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) |
5095 | return false; | 4985 | return false; |
5096 | 4986 | ||
5097 | if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { | 4987 | if ((pi->sh->boardflags & BFL_FEM) && |
4988 | (LCNREV_IS(pi->pubpi.phy_rev, 1))) { | ||
5098 | if (pi_lcn->lcnphy_tempsense_option == 3) { | 4989 | if (pi_lcn->lcnphy_tempsense_option == 3) { |
5099 | pi->hwpwrctrl = true; | 4990 | pi->hwpwrctrl = true; |
5100 | pi->hwpwrctrl_capable = true; | 4991 | pi->hwpwrctrl_capable = true; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c index b7e95acc2084..622c01ca72c5 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c | |||
@@ -1992,70 +1992,70 @@ static const u16 dot11lcn_sw_ctrl_tbl_4313_epa_rev0[] = { | |||
1992 | }; | 1992 | }; |
1993 | 1993 | ||
1994 | static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { | 1994 | static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { |
1995 | 0x0009, | ||
1996 | 0x000a, | 1995 | 0x000a, |
1997 | 0x0005, | ||
1998 | 0x0006, | ||
1999 | 0x0009, | 1996 | 0x0009, |
2000 | 0x000a, | ||
2001 | 0x0005, | ||
2002 | 0x0006, | 1997 | 0x0006, |
2003 | 0x0009, | ||
2004 | 0x000a, | ||
2005 | 0x0005, | 1998 | 0x0005, |
2006 | 0x0006, | ||
2007 | 0x0009, | ||
2008 | 0x000a, | 1999 | 0x000a, |
2009 | 0x0005, | ||
2010 | 0x0006, | ||
2011 | 0x0009, | 2000 | 0x0009, |
2012 | 0x000a, | ||
2013 | 0x0005, | ||
2014 | 0x0006, | 2001 | 0x0006, |
2015 | 0x0009, | ||
2016 | 0x000a, | ||
2017 | 0x0005, | 2002 | 0x0005, |
2018 | 0x0006, | ||
2019 | 0x0009, | ||
2020 | 0x000a, | 2003 | 0x000a, |
2021 | 0x0005, | ||
2022 | 0x0006, | ||
2023 | 0x0009, | 2004 | 0x0009, |
2024 | 0x000a, | ||
2025 | 0x0005, | ||
2026 | 0x0006, | 2005 | 0x0006, |
2027 | 0x0009, | ||
2028 | 0x000a, | ||
2029 | 0x0005, | 2006 | 0x0005, |
2030 | 0x0006, | ||
2031 | 0x0009, | ||
2032 | 0x000a, | 2007 | 0x000a, |
2033 | 0x0005, | ||
2034 | 0x0006, | ||
2035 | 0x0009, | 2008 | 0x0009, |
2036 | 0x000a, | ||
2037 | 0x0005, | ||
2038 | 0x0006, | 2009 | 0x0006, |
2039 | 0x0009, | ||
2040 | 0x000a, | ||
2041 | 0x0005, | 2010 | 0x0005, |
2042 | 0x0006, | 2011 | 0x000a, |
2043 | 0x0009, | 2012 | 0x0009, |
2013 | 0x0006, | ||
2014 | 0x0005, | ||
2044 | 0x000a, | 2015 | 0x000a, |
2016 | 0x0009, | ||
2017 | 0x0006, | ||
2045 | 0x0005, | 2018 | 0x0005, |
2019 | 0x000a, | ||
2020 | 0x0009, | ||
2046 | 0x0006, | 2021 | 0x0006, |
2022 | 0x0005, | ||
2023 | 0x000a, | ||
2047 | 0x0009, | 2024 | 0x0009, |
2025 | 0x0006, | ||
2026 | 0x0005, | ||
2048 | 0x000a, | 2027 | 0x000a, |
2028 | 0x0009, | ||
2029 | 0x0006, | ||
2049 | 0x0005, | 2030 | 0x0005, |
2031 | 0x000a, | ||
2032 | 0x0009, | ||
2050 | 0x0006, | 2033 | 0x0006, |
2034 | 0x0005, | ||
2035 | 0x000a, | ||
2051 | 0x0009, | 2036 | 0x0009, |
2037 | 0x0006, | ||
2038 | 0x0005, | ||
2052 | 0x000a, | 2039 | 0x000a, |
2040 | 0x0009, | ||
2041 | 0x0006, | ||
2053 | 0x0005, | 2042 | 0x0005, |
2043 | 0x000a, | ||
2044 | 0x0009, | ||
2054 | 0x0006, | 2045 | 0x0006, |
2046 | 0x0005, | ||
2047 | 0x000a, | ||
2055 | 0x0009, | 2048 | 0x0009, |
2049 | 0x0006, | ||
2050 | 0x0005, | ||
2056 | 0x000a, | 2051 | 0x000a, |
2052 | 0x0009, | ||
2053 | 0x0006, | ||
2057 | 0x0005, | 2054 | 0x0005, |
2055 | 0x000a, | ||
2056 | 0x0009, | ||
2058 | 0x0006, | 2057 | 0x0006, |
2058 | 0x0005, | ||
2059 | }; | 2059 | }; |
2060 | 2060 | ||
2061 | static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { | 2061 | static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { |
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index 3630a41df50d..c353b5f19c8c 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c | |||
@@ -475,6 +475,7 @@ il3945_tx_skb(struct il_priv *il, | |||
475 | dma_addr_t txcmd_phys; | 475 | dma_addr_t txcmd_phys; |
476 | int txq_id = skb_get_queue_mapping(skb); | 476 | int txq_id = skb_get_queue_mapping(skb); |
477 | u16 len, idx, hdr_len; | 477 | u16 len, idx, hdr_len; |
478 | u16 firstlen, secondlen; | ||
478 | u8 id; | 479 | u8 id; |
479 | u8 unicast; | 480 | u8 unicast; |
480 | u8 sta_id; | 481 | u8 sta_id; |
@@ -589,21 +590,22 @@ il3945_tx_skb(struct il_priv *il, | |||
589 | len = | 590 | len = |
590 | sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) + | 591 | sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) + |
591 | hdr_len; | 592 | hdr_len; |
592 | len = (len + 3) & ~3; | 593 | firstlen = (len + 3) & ~3; |
593 | 594 | ||
594 | /* Physical address of this Tx command's header (not MAC header!), | 595 | /* Physical address of this Tx command's header (not MAC header!), |
595 | * within command buffer array. */ | 596 | * within command buffer array. */ |
596 | txcmd_phys = | 597 | txcmd_phys = |
597 | pci_map_single(il->pci_dev, &out_cmd->hdr, len, PCI_DMA_TODEVICE); | 598 | pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen, |
599 | PCI_DMA_TODEVICE); | ||
598 | if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys))) | 600 | if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys))) |
599 | goto drop_unlock; | 601 | goto drop_unlock; |
600 | 602 | ||
601 | /* Set up TFD's 2nd entry to point directly to remainder of skb, | 603 | /* Set up TFD's 2nd entry to point directly to remainder of skb, |
602 | * if any (802.11 null frames have no payload). */ | 604 | * if any (802.11 null frames have no payload). */ |
603 | len = skb->len - hdr_len; | 605 | secondlen = skb->len - hdr_len; |
604 | if (len) { | 606 | if (secondlen > 0) { |
605 | phys_addr = | 607 | phys_addr = |
606 | pci_map_single(il->pci_dev, skb->data + hdr_len, len, | 608 | pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen, |
607 | PCI_DMA_TODEVICE); | 609 | PCI_DMA_TODEVICE); |
608 | if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) | 610 | if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) |
609 | goto drop_unlock; | 611 | goto drop_unlock; |
@@ -611,12 +613,12 @@ il3945_tx_skb(struct il_priv *il, | |||
611 | 613 | ||
612 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 614 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
613 | * first entry */ | 615 | * first entry */ |
614 | il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, len, 1, 0); | 616 | il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0); |
615 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); | 617 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); |
616 | dma_unmap_len_set(out_meta, len, len); | 618 | dma_unmap_len_set(out_meta, len, firstlen); |
617 | if (len) | 619 | if (secondlen > 0) |
618 | il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, len, 0, | 620 | il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, 0, |
619 | U32_PAD(len)); | 621 | U32_PAD(secondlen)); |
620 | 622 | ||
621 | if (!ieee80211_has_morefrags(hdr->frame_control)) { | 623 | if (!ieee80211_has_morefrags(hdr->frame_control)) { |
622 | txq->need_update = 1; | 624 | txq->need_update = 1; |
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c index e8324b5e5bfe..6c7493c2d698 100644 --- a/drivers/net/wireless/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/iwlegacy/4965-rs.c | |||
@@ -2152,7 +2152,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf, | |||
2152 | int rate_idx; | 2152 | int rate_idx; |
2153 | int i; | 2153 | int i; |
2154 | u32 rate; | 2154 | u32 rate; |
2155 | u8 use_green = il4965_rs_use_green(il, sta); | 2155 | u8 use_green; |
2156 | u8 active_tbl = 0; | 2156 | u8 active_tbl = 0; |
2157 | u8 valid_tx_ant; | 2157 | u8 valid_tx_ant; |
2158 | struct il_station_priv *sta_priv; | 2158 | struct il_station_priv *sta_priv; |
@@ -2160,6 +2160,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf, | |||
2160 | if (!sta || !lq_sta) | 2160 | if (!sta || !lq_sta) |
2161 | return; | 2161 | return; |
2162 | 2162 | ||
2163 | use_green = il4965_rs_use_green(il, sta); | ||
2163 | sta_priv = (void *)sta->drv_priv; | 2164 | sta_priv = (void *)sta->drv_priv; |
2164 | 2165 | ||
2165 | i = lq_sta->last_txrate_idx; | 2166 | i = lq_sta->last_txrate_idx; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c index 86ea5f4c3939..44ca0e57f9f7 100644 --- a/drivers/net/wireless/iwlwifi/dvm/lib.c +++ b/drivers/net/wireless/iwlwifi/dvm/lib.c | |||
@@ -1262,6 +1262,15 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | /* | 1264 | /* |
1265 | * This can happen upon FW ASSERT: we clear the STATUS_FW_ERROR flag | ||
1266 | * in iwl_down but cancel the workers only later. | ||
1267 | */ | ||
1268 | if (!priv->ucode_loaded) { | ||
1269 | IWL_ERR(priv, "Fw not loaded - dropping CMD: %x\n", cmd->id); | ||
1270 | return -EIO; | ||
1271 | } | ||
1272 | |||
1273 | /* | ||
1265 | * Synchronous commands from this op-mode must hold | 1274 | * Synchronous commands from this op-mode must hold |
1266 | * the mutex, this ensures we don't try to send two | 1275 | * the mutex, this ensures we don't try to send two |
1267 | * (or more) synchronous commands at a time. | 1276 | * (or more) synchronous commands at a time. |
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c index 23be948cf162..a82b6b39d4ff 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rxon.c +++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c | |||
@@ -1419,6 +1419,14 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
1419 | 1419 | ||
1420 | mutex_lock(&priv->mutex); | 1420 | mutex_lock(&priv->mutex); |
1421 | 1421 | ||
1422 | if (changes & BSS_CHANGED_IDLE && bss_conf->idle) { | ||
1423 | /* | ||
1424 | * If we go idle, then clearly no "passive-no-rx" | ||
1425 | * workaround is needed any more, this is a reset. | ||
1426 | */ | ||
1427 | iwlagn_lift_passive_no_rx(priv); | ||
1428 | } | ||
1429 | |||
1422 | if (unlikely(!iwl_is_ready(priv))) { | 1430 | if (unlikely(!iwl_is_ready(priv))) { |
1423 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | 1431 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); |
1424 | mutex_unlock(&priv->mutex); | 1432 | mutex_unlock(&priv->mutex); |
@@ -1450,16 +1458,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
1450 | priv->timestamp = bss_conf->sync_tsf; | 1458 | priv->timestamp = bss_conf->sync_tsf; |
1451 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; | 1459 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
1452 | } else { | 1460 | } else { |
1453 | /* | ||
1454 | * If we disassociate while there are pending | ||
1455 | * frames, just wake up the queues and let the | ||
1456 | * frames "escape" ... This shouldn't really | ||
1457 | * be happening to start with, but we should | ||
1458 | * not get stuck in this case either since it | ||
1459 | * can happen if userspace gets confused. | ||
1460 | */ | ||
1461 | iwlagn_lift_passive_no_rx(priv); | ||
1462 | |||
1463 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1461 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1464 | 1462 | ||
1465 | if (ctx->ctxid == IWL_RXON_CTX_BSS) | 1463 | if (ctx->ctxid == IWL_RXON_CTX_BSS) |
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c index 6aec2df3bb27..d1a670d7b10c 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/iwlwifi/dvm/tx.c | |||
@@ -1192,7 +1192,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, | |||
1192 | memset(&info->status, 0, sizeof(info->status)); | 1192 | memset(&info->status, 0, sizeof(info->status)); |
1193 | 1193 | ||
1194 | if (status == TX_STATUS_FAIL_PASSIVE_NO_RX && | 1194 | if (status == TX_STATUS_FAIL_PASSIVE_NO_RX && |
1195 | iwl_is_associated_ctx(ctx) && ctx->vif && | 1195 | ctx->vif && |
1196 | ctx->vif->type == NL80211_IFTYPE_STATION) { | 1196 | ctx->vif->type == NL80211_IFTYPE_STATION) { |
1197 | /* block and stop all queues */ | 1197 | /* block and stop all queues */ |
1198 | priv->passive_no_rx = true; | 1198 | priv->passive_no_rx = true; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c index 736fe9bb140e..1a4ac9236a44 100644 --- a/drivers/net/wireless/iwlwifi/dvm/ucode.c +++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c | |||
@@ -367,6 +367,8 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, | |||
367 | return -EIO; | 367 | return -EIO; |
368 | } | 368 | } |
369 | 369 | ||
370 | priv->ucode_loaded = true; | ||
371 | |||
370 | if (ucode_type != IWL_UCODE_WOWLAN) { | 372 | if (ucode_type != IWL_UCODE_WOWLAN) { |
371 | /* delay a bit to give rfkill time to run */ | 373 | /* delay a bit to give rfkill time to run */ |
372 | msleep(5); | 374 | msleep(5); |
@@ -380,8 +382,6 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, | |||
380 | return ret; | 382 | return ret; |
381 | } | 383 | } |
382 | 384 | ||
383 | priv->ucode_loaded = true; | ||
384 | |||
385 | return 0; | 385 | return 0; |
386 | } | 386 | } |
387 | 387 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 17bedc50e753..12c4f31ca8fb 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -475,6 +475,10 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, | |||
475 | 475 | ||
476 | /* If platform's RF_KILL switch is NOT set to KILL */ | 476 | /* If platform's RF_KILL switch is NOT set to KILL */ |
477 | hw_rfkill = iwl_is_rfkill_set(trans); | 477 | hw_rfkill = iwl_is_rfkill_set(trans); |
478 | if (hw_rfkill) | ||
479 | set_bit(STATUS_RFKILL, &trans_pcie->status); | ||
480 | else | ||
481 | clear_bit(STATUS_RFKILL, &trans_pcie->status); | ||
478 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 482 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
479 | if (hw_rfkill && !run_in_rfkill) | 483 | if (hw_rfkill && !run_in_rfkill) |
480 | return -ERFKILL; | 484 | return -ERFKILL; |
@@ -641,6 +645,7 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, | |||
641 | 645 | ||
642 | static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | 646 | static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) |
643 | { | 647 | { |
648 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
644 | bool hw_rfkill; | 649 | bool hw_rfkill; |
645 | int err; | 650 | int err; |
646 | 651 | ||
@@ -656,6 +661,10 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | |||
656 | iwl_enable_rfkill_int(trans); | 661 | iwl_enable_rfkill_int(trans); |
657 | 662 | ||
658 | hw_rfkill = iwl_is_rfkill_set(trans); | 663 | hw_rfkill = iwl_is_rfkill_set(trans); |
664 | if (hw_rfkill) | ||
665 | set_bit(STATUS_RFKILL, &trans_pcie->status); | ||
666 | else | ||
667 | clear_bit(STATUS_RFKILL, &trans_pcie->status); | ||
659 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 668 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
660 | 669 | ||
661 | return 0; | 670 | return 0; |
@@ -694,6 +703,10 @@ static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans, | |||
694 | * op_mode. | 703 | * op_mode. |
695 | */ | 704 | */ |
696 | hw_rfkill = iwl_is_rfkill_set(trans); | 705 | hw_rfkill = iwl_is_rfkill_set(trans); |
706 | if (hw_rfkill) | ||
707 | set_bit(STATUS_RFKILL, &trans_pcie->status); | ||
708 | else | ||
709 | clear_bit(STATUS_RFKILL, &trans_pcie->status); | ||
697 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 710 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
698 | } | 711 | } |
699 | } | 712 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 8595c16f74de..cb5c6792e3a8 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -1264,7 +1264,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1264 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { | 1264 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
1265 | int copy = 0; | 1265 | int copy = 0; |
1266 | 1266 | ||
1267 | if (!cmd->len) | 1267 | if (!cmd->len[i]) |
1268 | continue; | 1268 | continue; |
1269 | 1269 | ||
1270 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ | 1270 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index a44023a7bd57..8aaf56ade4d9 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1892,7 +1892,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1892 | } | 1892 | } |
1893 | } | 1893 | } |
1894 | 1894 | ||
1895 | for (i = 0; i < request->n_channels; i++) { | 1895 | for (i = 0; i < min_t(u32, request->n_channels, |
1896 | MWIFIEX_USER_SCAN_CHAN_MAX); i++) { | ||
1896 | chan = request->channels[i]; | 1897 | chan = request->channels[i]; |
1897 | priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value; | 1898 | priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value; |
1898 | priv->user_scan_cfg->chan_list[i].radio_type = chan->band; | 1899 | priv->user_scan_cfg->chan_list[i].radio_type = chan->band; |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 20a6c5555873..b5c8b962ce12 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -157,6 +157,20 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, | |||
157 | return -1; | 157 | return -1; |
158 | } | 158 | } |
159 | 159 | ||
160 | cmd_code = le16_to_cpu(host_cmd->command); | ||
161 | cmd_size = le16_to_cpu(host_cmd->size); | ||
162 | |||
163 | if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && | ||
164 | cmd_code != HostCmd_CMD_FUNC_SHUTDOWN && | ||
165 | cmd_code != HostCmd_CMD_FUNC_INIT) { | ||
166 | dev_err(adapter->dev, | ||
167 | "DNLD_CMD: FW in reset state, ignore cmd %#x\n", | ||
168 | cmd_code); | ||
169 | mwifiex_complete_cmd(adapter, cmd_node); | ||
170 | mwifiex_insert_cmd_to_free_q(adapter, cmd_node); | ||
171 | return -1; | ||
172 | } | ||
173 | |||
160 | /* Set command sequence number */ | 174 | /* Set command sequence number */ |
161 | adapter->seq_num++; | 175 | adapter->seq_num++; |
162 | host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO | 176 | host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO |
@@ -168,9 +182,6 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, | |||
168 | adapter->curr_cmd = cmd_node; | 182 | adapter->curr_cmd = cmd_node; |
169 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | 183 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); |
170 | 184 | ||
171 | cmd_code = le16_to_cpu(host_cmd->command); | ||
172 | cmd_size = le16_to_cpu(host_cmd->size); | ||
173 | |||
174 | /* Adjust skb length */ | 185 | /* Adjust skb length */ |
175 | if (cmd_node->cmd_skb->len > cmd_size) | 186 | if (cmd_node->cmd_skb->len > cmd_size) |
176 | /* | 187 | /* |
@@ -484,8 +495,6 @@ int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no, | |||
484 | 495 | ||
485 | ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid, | 496 | ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid, |
486 | data_buf); | 497 | data_buf); |
487 | if (!ret) | ||
488 | ret = mwifiex_wait_queue_complete(adapter); | ||
489 | 498 | ||
490 | return ret; | 499 | return ret; |
491 | } | 500 | } |
@@ -588,9 +597,10 @@ int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no, | |||
588 | if (cmd_no == HostCmd_CMD_802_11_SCAN) { | 597 | if (cmd_no == HostCmd_CMD_802_11_SCAN) { |
589 | mwifiex_queue_scan_cmd(priv, cmd_node); | 598 | mwifiex_queue_scan_cmd(priv, cmd_node); |
590 | } else { | 599 | } else { |
591 | adapter->cmd_queued = cmd_node; | ||
592 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); | 600 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); |
593 | queue_work(adapter->workqueue, &adapter->main_work); | 601 | queue_work(adapter->workqueue, &adapter->main_work); |
602 | if (cmd_node->wait_q_enabled) | ||
603 | ret = mwifiex_wait_queue_complete(adapter, cmd_node); | ||
594 | } | 604 | } |
595 | 605 | ||
596 | return ret; | 606 | return ret; |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index e38aa9b3663d..0ff4c37ab42a 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -709,6 +709,14 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) | |||
709 | return ret; | 709 | return ret; |
710 | } | 710 | } |
711 | 711 | ||
712 | /* cancel current command */ | ||
713 | if (adapter->curr_cmd) { | ||
714 | dev_warn(adapter->dev, "curr_cmd is still in processing\n"); | ||
715 | del_timer(&adapter->cmd_timer); | ||
716 | mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd); | ||
717 | adapter->curr_cmd = NULL; | ||
718 | } | ||
719 | |||
712 | /* shut down mwifiex */ | 720 | /* shut down mwifiex */ |
713 | dev_dbg(adapter->dev, "info: shutdown mwifiex...\n"); | 721 | dev_dbg(adapter->dev, "info: shutdown mwifiex...\n"); |
714 | 722 | ||
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 246aa62a4817..2fe0ceba4400 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -1117,10 +1117,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, | |||
1117 | adhoc_join->bss_descriptor.bssid, | 1117 | adhoc_join->bss_descriptor.bssid, |
1118 | adhoc_join->bss_descriptor.ssid); | 1118 | adhoc_join->bss_descriptor.ssid); |
1119 | 1119 | ||
1120 | for (i = 0; bss_desc->supported_rates[i] && | 1120 | for (i = 0; i < MWIFIEX_SUPPORTED_RATES && |
1121 | i < MWIFIEX_SUPPORTED_RATES; | 1121 | bss_desc->supported_rates[i]; i++) |
1122 | i++) | 1122 | ; |
1123 | ; | ||
1124 | rates_size = i; | 1123 | rates_size = i; |
1125 | 1124 | ||
1126 | /* Copy Data Rates from the Rates recorded in scan response */ | 1125 | /* Copy Data Rates from the Rates recorded in scan response */ |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 553adfb0aa81..7035ade9af74 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -723,7 +723,6 @@ struct mwifiex_adapter { | |||
723 | u16 cmd_wait_q_required; | 723 | u16 cmd_wait_q_required; |
724 | struct mwifiex_wait_queue cmd_wait_q; | 724 | struct mwifiex_wait_queue cmd_wait_q; |
725 | u8 scan_wait_q_woken; | 725 | u8 scan_wait_q_woken; |
726 | struct cmd_ctrl_node *cmd_queued; | ||
727 | spinlock_t queue_lock; /* lock for tx queues */ | 726 | spinlock_t queue_lock; /* lock for tx queues */ |
728 | struct completion fw_load; | 727 | struct completion fw_load; |
729 | u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; | 728 | u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; |
@@ -1018,7 +1017,8 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, | |||
1018 | struct mwifiex_multicast_list *mcast_list); | 1017 | struct mwifiex_multicast_list *mcast_list); |
1019 | int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, | 1018 | int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, |
1020 | struct net_device *dev); | 1019 | struct net_device *dev); |
1021 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter); | 1020 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, |
1021 | struct cmd_ctrl_node *cmd_queued); | ||
1022 | int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | 1022 | int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, |
1023 | struct cfg80211_ssid *req_ssid); | 1023 | struct cfg80211_ssid *req_ssid); |
1024 | int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); | 1024 | int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 5c395e2e6a2b..feb204613397 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -1508,6 +1508,7 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) | |||
1508 | } | 1508 | } |
1509 | memcpy(adapter->upld_buf, skb->data, | 1509 | memcpy(adapter->upld_buf, skb->data, |
1510 | min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); | 1510 | min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); |
1511 | skb_push(skb, INTF_HEADER_LEN); | ||
1511 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, | 1512 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, |
1512 | PCI_DMA_FROMDEVICE)) | 1513 | PCI_DMA_FROMDEVICE)) |
1513 | return -1; | 1514 | return -1; |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index bb60c2754a97..e7f6deaf715e 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1388,10 +1388,15 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
1388 | list_del(&cmd_node->list); | 1388 | list_del(&cmd_node->list); |
1389 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | 1389 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
1390 | flags); | 1390 | flags); |
1391 | adapter->cmd_queued = cmd_node; | ||
1392 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, | 1391 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, |
1393 | true); | 1392 | true); |
1394 | queue_work(adapter->workqueue, &adapter->main_work); | 1393 | queue_work(adapter->workqueue, &adapter->main_work); |
1394 | |||
1395 | /* Perform internal scan synchronously */ | ||
1396 | if (!priv->scan_request) { | ||
1397 | dev_dbg(adapter->dev, "wait internal scan\n"); | ||
1398 | mwifiex_wait_queue_complete(adapter, cmd_node); | ||
1399 | } | ||
1395 | } else { | 1400 | } else { |
1396 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | 1401 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
1397 | flags); | 1402 | flags); |
@@ -1790,7 +1795,12 @@ check_next_scan: | |||
1790 | /* Need to indicate IOCTL complete */ | 1795 | /* Need to indicate IOCTL complete */ |
1791 | if (adapter->curr_cmd->wait_q_enabled) { | 1796 | if (adapter->curr_cmd->wait_q_enabled) { |
1792 | adapter->cmd_wait_q.status = 0; | 1797 | adapter->cmd_wait_q.status = 0; |
1793 | mwifiex_complete_cmd(adapter, adapter->curr_cmd); | 1798 | if (!priv->scan_request) { |
1799 | dev_dbg(adapter->dev, | ||
1800 | "complete internal scan\n"); | ||
1801 | mwifiex_complete_cmd(adapter, | ||
1802 | adapter->curr_cmd); | ||
1803 | } | ||
1794 | } | 1804 | } |
1795 | if (priv->report_scan_result) | 1805 | if (priv->report_scan_result) |
1796 | priv->report_scan_result = false; | 1806 | priv->report_scan_result = false; |
@@ -1946,9 +1956,6 @@ int mwifiex_request_scan(struct mwifiex_private *priv, | |||
1946 | /* Normal scan */ | 1956 | /* Normal scan */ |
1947 | ret = mwifiex_scan_networks(priv, NULL); | 1957 | ret = mwifiex_scan_networks(priv, NULL); |
1948 | 1958 | ||
1949 | if (!ret) | ||
1950 | ret = mwifiex_wait_queue_complete(priv->adapter); | ||
1951 | |||
1952 | up(&priv->async_sem); | 1959 | up(&priv->async_sem); |
1953 | 1960 | ||
1954 | return ret; | 1961 | return ret; |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 9f33c92c90f5..13100f8de3db 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -54,16 +54,10 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, | |||
54 | * This function waits on a cmd wait queue. It also cancels the pending | 54 | * This function waits on a cmd wait queue. It also cancels the pending |
55 | * request after waking up, in case of errors. | 55 | * request after waking up, in case of errors. |
56 | */ | 56 | */ |
57 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) | 57 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, |
58 | struct cmd_ctrl_node *cmd_queued) | ||
58 | { | 59 | { |
59 | int status; | 60 | int status; |
60 | struct cmd_ctrl_node *cmd_queued; | ||
61 | |||
62 | if (!adapter->cmd_queued) | ||
63 | return 0; | ||
64 | |||
65 | cmd_queued = adapter->cmd_queued; | ||
66 | adapter->cmd_queued = NULL; | ||
67 | 61 | ||
68 | dev_dbg(adapter->dev, "cmd pending\n"); | 62 | dev_dbg(adapter->dev, "cmd pending\n"); |
69 | atomic_inc(&adapter->cmd_pending); | 63 | atomic_inc(&adapter->cmd_pending); |
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 44d6ead43341..76cd47eb901e 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
@@ -20,6 +20,7 @@ if RT2X00 | |||
20 | config RT2400PCI | 20 | config RT2400PCI |
21 | tristate "Ralink rt2400 (PCI/PCMCIA) support" | 21 | tristate "Ralink rt2400 (PCI/PCMCIA) support" |
22 | depends on PCI | 22 | depends on PCI |
23 | select RT2X00_LIB_MMIO | ||
23 | select RT2X00_LIB_PCI | 24 | select RT2X00_LIB_PCI |
24 | select EEPROM_93CX6 | 25 | select EEPROM_93CX6 |
25 | ---help--- | 26 | ---help--- |
@@ -31,6 +32,7 @@ config RT2400PCI | |||
31 | config RT2500PCI | 32 | config RT2500PCI |
32 | tristate "Ralink rt2500 (PCI/PCMCIA) support" | 33 | tristate "Ralink rt2500 (PCI/PCMCIA) support" |
33 | depends on PCI | 34 | depends on PCI |
35 | select RT2X00_LIB_MMIO | ||
34 | select RT2X00_LIB_PCI | 36 | select RT2X00_LIB_PCI |
35 | select EEPROM_93CX6 | 37 | select EEPROM_93CX6 |
36 | ---help--- | 38 | ---help--- |
@@ -43,6 +45,7 @@ config RT61PCI | |||
43 | tristate "Ralink rt2501/rt61 (PCI/PCMCIA) support" | 45 | tristate "Ralink rt2501/rt61 (PCI/PCMCIA) support" |
44 | depends on PCI | 46 | depends on PCI |
45 | select RT2X00_LIB_PCI | 47 | select RT2X00_LIB_PCI |
48 | select RT2X00_LIB_MMIO | ||
46 | select RT2X00_LIB_FIRMWARE | 49 | select RT2X00_LIB_FIRMWARE |
47 | select RT2X00_LIB_CRYPTO | 50 | select RT2X00_LIB_CRYPTO |
48 | select CRC_ITU_T | 51 | select CRC_ITU_T |
@@ -55,10 +58,11 @@ config RT61PCI | |||
55 | 58 | ||
56 | config RT2800PCI | 59 | config RT2800PCI |
57 | tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" | 60 | tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" |
58 | depends on PCI || RALINK_RT288X || RALINK_RT305X | 61 | depends on PCI || SOC_RT288X || SOC_RT305X |
59 | select RT2800_LIB | 62 | select RT2800_LIB |
63 | select RT2X00_LIB_MMIO | ||
60 | select RT2X00_LIB_PCI if PCI | 64 | select RT2X00_LIB_PCI if PCI |
61 | select RT2X00_LIB_SOC if RALINK_RT288X || RALINK_RT305X | 65 | select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X |
62 | select RT2X00_LIB_FIRMWARE | 66 | select RT2X00_LIB_FIRMWARE |
63 | select RT2X00_LIB_CRYPTO | 67 | select RT2X00_LIB_CRYPTO |
64 | select CRC_CCITT | 68 | select CRC_CCITT |
@@ -185,6 +189,9 @@ endif | |||
185 | config RT2800_LIB | 189 | config RT2800_LIB |
186 | tristate | 190 | tristate |
187 | 191 | ||
192 | config RT2X00_LIB_MMIO | ||
193 | tristate | ||
194 | |||
188 | config RT2X00_LIB_PCI | 195 | config RT2X00_LIB_PCI |
189 | tristate | 196 | tristate |
190 | select RT2X00_LIB | 197 | select RT2X00_LIB |
diff --git a/drivers/net/wireless/rt2x00/Makefile b/drivers/net/wireless/rt2x00/Makefile index 349d5b8284a4..f069d8bc5b67 100644 --- a/drivers/net/wireless/rt2x00/Makefile +++ b/drivers/net/wireless/rt2x00/Makefile | |||
@@ -9,6 +9,7 @@ rt2x00lib-$(CONFIG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o | |||
9 | rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o | 9 | rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o |
10 | 10 | ||
11 | obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o | 11 | obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o |
12 | obj-$(CONFIG_RT2X00_LIB_MMIO) += rt2x00mmio.o | ||
12 | obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o | 13 | obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o |
13 | obj-$(CONFIG_RT2X00_LIB_SOC) += rt2x00soc.o | 14 | obj-$(CONFIG_RT2X00_LIB_SOC) += rt2x00soc.o |
14 | obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00usb.o | 15 | obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00usb.o |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 221beaaa83f1..dcfb54e0c516 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | 35 | ||
36 | #include "rt2x00.h" | 36 | #include "rt2x00.h" |
37 | #include "rt2x00mmio.h" | ||
37 | #include "rt2x00pci.h" | 38 | #include "rt2x00pci.h" |
38 | #include "rt2400pci.h" | 39 | #include "rt2400pci.h" |
39 | 40 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 39edc59e8d03..e1d2dc9ed28a 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | 35 | ||
36 | #include "rt2x00.h" | 36 | #include "rt2x00.h" |
37 | #include "rt2x00mmio.h" | ||
37 | #include "rt2x00pci.h" | 38 | #include "rt2x00pci.h" |
38 | #include "rt2500pci.h" | 39 | #include "rt2500pci.h" |
39 | 40 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 48a01aa21f1c..ba5a05625aaa 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/eeprom_93cx6.h> | 41 | #include <linux/eeprom_93cx6.h> |
42 | 42 | ||
43 | #include "rt2x00.h" | 43 | #include "rt2x00.h" |
44 | #include "rt2x00mmio.h" | ||
44 | #include "rt2x00pci.h" | 45 | #include "rt2x00pci.h" |
45 | #include "rt2x00soc.h" | 46 | #include "rt2x00soc.h" |
46 | #include "rt2800lib.h" | 47 | #include "rt2800lib.h" |
@@ -89,7 +90,7 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) | |||
89 | rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 90 | rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
90 | } | 91 | } |
91 | 92 | ||
92 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 93 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
93 | static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | 94 | static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) |
94 | { | 95 | { |
95 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); | 96 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); |
@@ -107,7 +108,7 @@ static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | |||
107 | { | 108 | { |
108 | return -ENOMEM; | 109 | return -ENOMEM; |
109 | } | 110 | } |
110 | #endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ | 111 | #endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */ |
111 | 112 | ||
112 | #ifdef CONFIG_PCI | 113 | #ifdef CONFIG_PCI |
113 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) | 114 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) |
@@ -1177,7 +1178,7 @@ MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); | |||
1177 | #endif /* CONFIG_PCI */ | 1178 | #endif /* CONFIG_PCI */ |
1178 | MODULE_LICENSE("GPL"); | 1179 | MODULE_LICENSE("GPL"); |
1179 | 1180 | ||
1180 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1181 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1181 | static int rt2800soc_probe(struct platform_device *pdev) | 1182 | static int rt2800soc_probe(struct platform_device *pdev) |
1182 | { | 1183 | { |
1183 | return rt2x00soc_probe(pdev, &rt2800pci_ops); | 1184 | return rt2x00soc_probe(pdev, &rt2800pci_ops); |
@@ -1194,7 +1195,7 @@ static struct platform_driver rt2800soc_driver = { | |||
1194 | .suspend = rt2x00soc_suspend, | 1195 | .suspend = rt2x00soc_suspend, |
1195 | .resume = rt2x00soc_resume, | 1196 | .resume = rt2x00soc_resume, |
1196 | }; | 1197 | }; |
1197 | #endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ | 1198 | #endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */ |
1198 | 1199 | ||
1199 | #ifdef CONFIG_PCI | 1200 | #ifdef CONFIG_PCI |
1200 | static int rt2800pci_probe(struct pci_dev *pci_dev, | 1201 | static int rt2800pci_probe(struct pci_dev *pci_dev, |
@@ -1217,7 +1218,7 @@ static int __init rt2800pci_init(void) | |||
1217 | { | 1218 | { |
1218 | int ret = 0; | 1219 | int ret = 0; |
1219 | 1220 | ||
1220 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1221 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1221 | ret = platform_driver_register(&rt2800soc_driver); | 1222 | ret = platform_driver_register(&rt2800soc_driver); |
1222 | if (ret) | 1223 | if (ret) |
1223 | return ret; | 1224 | return ret; |
@@ -1225,7 +1226,7 @@ static int __init rt2800pci_init(void) | |||
1225 | #ifdef CONFIG_PCI | 1226 | #ifdef CONFIG_PCI |
1226 | ret = pci_register_driver(&rt2800pci_driver); | 1227 | ret = pci_register_driver(&rt2800pci_driver); |
1227 | if (ret) { | 1228 | if (ret) { |
1228 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1229 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1229 | platform_driver_unregister(&rt2800soc_driver); | 1230 | platform_driver_unregister(&rt2800soc_driver); |
1230 | #endif | 1231 | #endif |
1231 | return ret; | 1232 | return ret; |
@@ -1240,7 +1241,7 @@ static void __exit rt2800pci_exit(void) | |||
1240 | #ifdef CONFIG_PCI | 1241 | #ifdef CONFIG_PCI |
1241 | pci_unregister_driver(&rt2800pci_driver); | 1242 | pci_unregister_driver(&rt2800pci_driver); |
1242 | #endif | 1243 | #endif |
1243 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1244 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1244 | platform_driver_unregister(&rt2800soc_driver); | 1245 | platform_driver_unregister(&rt2800soc_driver); |
1245 | #endif | 1246 | #endif |
1246 | } | 1247 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mmio.c b/drivers/net/wireless/rt2x00/rt2x00mmio.c new file mode 100644 index 000000000000..d84a680ba0c9 --- /dev/null +++ b/drivers/net/wireless/rt2x00/rt2x00mmio.c | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> | ||
3 | <http://rt2x00.serialmonkey.com> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the | ||
17 | Free Software Foundation, Inc., | ||
18 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | Module: rt2x00mmio | ||
23 | Abstract: rt2x00 generic mmio device routines. | ||
24 | */ | ||
25 | |||
26 | #include <linux/dma-mapping.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/slab.h> | ||
30 | |||
31 | #include "rt2x00.h" | ||
32 | #include "rt2x00mmio.h" | ||
33 | |||
34 | /* | ||
35 | * Register access. | ||
36 | */ | ||
37 | int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
38 | const unsigned int offset, | ||
39 | const struct rt2x00_field32 field, | ||
40 | u32 *reg) | ||
41 | { | ||
42 | unsigned int i; | ||
43 | |||
44 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
45 | return 0; | ||
46 | |||
47 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | ||
48 | rt2x00pci_register_read(rt2x00dev, offset, reg); | ||
49 | if (!rt2x00_get_field32(*reg, field)) | ||
50 | return 1; | ||
51 | udelay(REGISTER_BUSY_DELAY); | ||
52 | } | ||
53 | |||
54 | printk_once(KERN_ERR "%s() Indirect register access failed: " | ||
55 | "offset=0x%.08x, value=0x%.08x\n", __func__, offset, *reg); | ||
56 | *reg = ~0; | ||
57 | |||
58 | return 0; | ||
59 | } | ||
60 | EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); | ||
61 | |||
62 | bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | ||
63 | { | ||
64 | struct data_queue *queue = rt2x00dev->rx; | ||
65 | struct queue_entry *entry; | ||
66 | struct queue_entry_priv_pci *entry_priv; | ||
67 | struct skb_frame_desc *skbdesc; | ||
68 | int max_rx = 16; | ||
69 | |||
70 | while (--max_rx) { | ||
71 | entry = rt2x00queue_get_entry(queue, Q_INDEX); | ||
72 | entry_priv = entry->priv_data; | ||
73 | |||
74 | if (rt2x00dev->ops->lib->get_entry_state(entry)) | ||
75 | break; | ||
76 | |||
77 | /* | ||
78 | * Fill in desc fields of the skb descriptor | ||
79 | */ | ||
80 | skbdesc = get_skb_frame_desc(entry->skb); | ||
81 | skbdesc->desc = entry_priv->desc; | ||
82 | skbdesc->desc_len = entry->queue->desc_size; | ||
83 | |||
84 | /* | ||
85 | * DMA is already done, notify rt2x00lib that | ||
86 | * it finished successfully. | ||
87 | */ | ||
88 | rt2x00lib_dmastart(entry); | ||
89 | rt2x00lib_dmadone(entry); | ||
90 | |||
91 | /* | ||
92 | * Send the frame to rt2x00lib for further processing. | ||
93 | */ | ||
94 | rt2x00lib_rxdone(entry, GFP_ATOMIC); | ||
95 | } | ||
96 | |||
97 | return !max_rx; | ||
98 | } | ||
99 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); | ||
100 | |||
101 | void rt2x00pci_flush_queue(struct data_queue *queue, bool drop) | ||
102 | { | ||
103 | unsigned int i; | ||
104 | |||
105 | for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++) | ||
106 | msleep(10); | ||
107 | } | ||
108 | EXPORT_SYMBOL_GPL(rt2x00pci_flush_queue); | ||
109 | |||
110 | /* | ||
111 | * Device initialization handlers. | ||
112 | */ | ||
113 | static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, | ||
114 | struct data_queue *queue) | ||
115 | { | ||
116 | struct queue_entry_priv_pci *entry_priv; | ||
117 | void *addr; | ||
118 | dma_addr_t dma; | ||
119 | unsigned int i; | ||
120 | |||
121 | /* | ||
122 | * Allocate DMA memory for descriptor and buffer. | ||
123 | */ | ||
124 | addr = dma_alloc_coherent(rt2x00dev->dev, | ||
125 | queue->limit * queue->desc_size, | ||
126 | &dma, GFP_KERNEL); | ||
127 | if (!addr) | ||
128 | return -ENOMEM; | ||
129 | |||
130 | memset(addr, 0, queue->limit * queue->desc_size); | ||
131 | |||
132 | /* | ||
133 | * Initialize all queue entries to contain valid addresses. | ||
134 | */ | ||
135 | for (i = 0; i < queue->limit; i++) { | ||
136 | entry_priv = queue->entries[i].priv_data; | ||
137 | entry_priv->desc = addr + i * queue->desc_size; | ||
138 | entry_priv->desc_dma = dma + i * queue->desc_size; | ||
139 | } | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev, | ||
145 | struct data_queue *queue) | ||
146 | { | ||
147 | struct queue_entry_priv_pci *entry_priv = | ||
148 | queue->entries[0].priv_data; | ||
149 | |||
150 | if (entry_priv->desc) | ||
151 | dma_free_coherent(rt2x00dev->dev, | ||
152 | queue->limit * queue->desc_size, | ||
153 | entry_priv->desc, entry_priv->desc_dma); | ||
154 | entry_priv->desc = NULL; | ||
155 | } | ||
156 | |||
157 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) | ||
158 | { | ||
159 | struct data_queue *queue; | ||
160 | int status; | ||
161 | |||
162 | /* | ||
163 | * Allocate DMA | ||
164 | */ | ||
165 | queue_for_each(rt2x00dev, queue) { | ||
166 | status = rt2x00pci_alloc_queue_dma(rt2x00dev, queue); | ||
167 | if (status) | ||
168 | goto exit; | ||
169 | } | ||
170 | |||
171 | /* | ||
172 | * Register interrupt handler. | ||
173 | */ | ||
174 | status = request_irq(rt2x00dev->irq, | ||
175 | rt2x00dev->ops->lib->irq_handler, | ||
176 | IRQF_SHARED, rt2x00dev->name, rt2x00dev); | ||
177 | if (status) { | ||
178 | ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", | ||
179 | rt2x00dev->irq, status); | ||
180 | goto exit; | ||
181 | } | ||
182 | |||
183 | return 0; | ||
184 | |||
185 | exit: | ||
186 | queue_for_each(rt2x00dev, queue) | ||
187 | rt2x00pci_free_queue_dma(rt2x00dev, queue); | ||
188 | |||
189 | return status; | ||
190 | } | ||
191 | EXPORT_SYMBOL_GPL(rt2x00pci_initialize); | ||
192 | |||
193 | void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev) | ||
194 | { | ||
195 | struct data_queue *queue; | ||
196 | |||
197 | /* | ||
198 | * Free irq line. | ||
199 | */ | ||
200 | free_irq(rt2x00dev->irq, rt2x00dev); | ||
201 | |||
202 | /* | ||
203 | * Free DMA | ||
204 | */ | ||
205 | queue_for_each(rt2x00dev, queue) | ||
206 | rt2x00pci_free_queue_dma(rt2x00dev, queue); | ||
207 | } | ||
208 | EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize); | ||
209 | |||
210 | /* | ||
211 | * rt2x00mmio module information. | ||
212 | */ | ||
213 | MODULE_AUTHOR(DRV_PROJECT); | ||
214 | MODULE_VERSION(DRV_VERSION); | ||
215 | MODULE_DESCRIPTION("rt2x00 mmio library"); | ||
216 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00mmio.h b/drivers/net/wireless/rt2x00/rt2x00mmio.h new file mode 100644 index 000000000000..4ecaf60175bf --- /dev/null +++ b/drivers/net/wireless/rt2x00/rt2x00mmio.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> | ||
3 | <http://rt2x00.serialmonkey.com> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the | ||
17 | Free Software Foundation, Inc., | ||
18 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | Module: rt2x00mmio | ||
23 | Abstract: Data structures for the rt2x00mmio module. | ||
24 | */ | ||
25 | |||
26 | #ifndef RT2X00MMIO_H | ||
27 | #define RT2X00MMIO_H | ||
28 | |||
29 | #include <linux/io.h> | ||
30 | |||
31 | /* | ||
32 | * Register access. | ||
33 | */ | ||
34 | static inline void rt2x00pci_register_read(struct rt2x00_dev *rt2x00dev, | ||
35 | const unsigned int offset, | ||
36 | u32 *value) | ||
37 | { | ||
38 | *value = readl(rt2x00dev->csr.base + offset); | ||
39 | } | ||
40 | |||
41 | static inline void rt2x00pci_register_multiread(struct rt2x00_dev *rt2x00dev, | ||
42 | const unsigned int offset, | ||
43 | void *value, const u32 length) | ||
44 | { | ||
45 | memcpy_fromio(value, rt2x00dev->csr.base + offset, length); | ||
46 | } | ||
47 | |||
48 | static inline void rt2x00pci_register_write(struct rt2x00_dev *rt2x00dev, | ||
49 | const unsigned int offset, | ||
50 | u32 value) | ||
51 | { | ||
52 | writel(value, rt2x00dev->csr.base + offset); | ||
53 | } | ||
54 | |||
55 | static inline void rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev, | ||
56 | const unsigned int offset, | ||
57 | const void *value, | ||
58 | const u32 length) | ||
59 | { | ||
60 | __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2); | ||
61 | } | ||
62 | |||
63 | /** | ||
64 | * rt2x00pci_regbusy_read - Read from register with busy check | ||
65 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
66 | * @offset: Register offset | ||
67 | * @field: Field to check if register is busy | ||
68 | * @reg: Pointer to where register contents should be stored | ||
69 | * | ||
70 | * This function will read the given register, and checks if the | ||
71 | * register is busy. If it is, it will sleep for a couple of | ||
72 | * microseconds before reading the register again. If the register | ||
73 | * is not read after a certain timeout, this function will return | ||
74 | * FALSE. | ||
75 | */ | ||
76 | int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
77 | const unsigned int offset, | ||
78 | const struct rt2x00_field32 field, | ||
79 | u32 *reg); | ||
80 | |||
81 | /** | ||
82 | * struct queue_entry_priv_pci: Per entry PCI specific information | ||
83 | * | ||
84 | * @desc: Pointer to device descriptor | ||
85 | * @desc_dma: DMA pointer to &desc. | ||
86 | * @data: Pointer to device's entry memory. | ||
87 | * @data_dma: DMA pointer to &data. | ||
88 | */ | ||
89 | struct queue_entry_priv_pci { | ||
90 | __le32 *desc; | ||
91 | dma_addr_t desc_dma; | ||
92 | }; | ||
93 | |||
94 | /** | ||
95 | * rt2x00pci_rxdone - Handle RX done events | ||
96 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
97 | * | ||
98 | * Returns true if there are still rx frames pending and false if all | ||
99 | * pending rx frames were processed. | ||
100 | */ | ||
101 | bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); | ||
102 | |||
103 | /** | ||
104 | * rt2x00pci_flush_queue - Flush data queue | ||
105 | * @queue: Data queue to stop | ||
106 | * @drop: True to drop all pending frames. | ||
107 | * | ||
108 | * This will wait for a maximum of 100ms, waiting for the queues | ||
109 | * to become empty. | ||
110 | */ | ||
111 | void rt2x00pci_flush_queue(struct data_queue *queue, bool drop); | ||
112 | |||
113 | /* | ||
114 | * Device initialization handlers. | ||
115 | */ | ||
116 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev); | ||
117 | void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev); | ||
118 | |||
119 | #endif /* RT2X00MMIO_H */ | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index a0c8caef3b0a..e87865e33113 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -33,182 +33,6 @@ | |||
33 | #include "rt2x00pci.h" | 33 | #include "rt2x00pci.h" |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Register access. | ||
37 | */ | ||
38 | int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
39 | const unsigned int offset, | ||
40 | const struct rt2x00_field32 field, | ||
41 | u32 *reg) | ||
42 | { | ||
43 | unsigned int i; | ||
44 | |||
45 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
46 | return 0; | ||
47 | |||
48 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | ||
49 | rt2x00pci_register_read(rt2x00dev, offset, reg); | ||
50 | if (!rt2x00_get_field32(*reg, field)) | ||
51 | return 1; | ||
52 | udelay(REGISTER_BUSY_DELAY); | ||
53 | } | ||
54 | |||
55 | ERROR(rt2x00dev, "Indirect register access failed: " | ||
56 | "offset=0x%.08x, value=0x%.08x\n", offset, *reg); | ||
57 | *reg = ~0; | ||
58 | |||
59 | return 0; | ||
60 | } | ||
61 | EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); | ||
62 | |||
63 | bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | ||
64 | { | ||
65 | struct data_queue *queue = rt2x00dev->rx; | ||
66 | struct queue_entry *entry; | ||
67 | struct queue_entry_priv_pci *entry_priv; | ||
68 | struct skb_frame_desc *skbdesc; | ||
69 | int max_rx = 16; | ||
70 | |||
71 | while (--max_rx) { | ||
72 | entry = rt2x00queue_get_entry(queue, Q_INDEX); | ||
73 | entry_priv = entry->priv_data; | ||
74 | |||
75 | if (rt2x00dev->ops->lib->get_entry_state(entry)) | ||
76 | break; | ||
77 | |||
78 | /* | ||
79 | * Fill in desc fields of the skb descriptor | ||
80 | */ | ||
81 | skbdesc = get_skb_frame_desc(entry->skb); | ||
82 | skbdesc->desc = entry_priv->desc; | ||
83 | skbdesc->desc_len = entry->queue->desc_size; | ||
84 | |||
85 | /* | ||
86 | * DMA is already done, notify rt2x00lib that | ||
87 | * it finished successfully. | ||
88 | */ | ||
89 | rt2x00lib_dmastart(entry); | ||
90 | rt2x00lib_dmadone(entry); | ||
91 | |||
92 | /* | ||
93 | * Send the frame to rt2x00lib for further processing. | ||
94 | */ | ||
95 | rt2x00lib_rxdone(entry, GFP_ATOMIC); | ||
96 | } | ||
97 | |||
98 | return !max_rx; | ||
99 | } | ||
100 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); | ||
101 | |||
102 | void rt2x00pci_flush_queue(struct data_queue *queue, bool drop) | ||
103 | { | ||
104 | unsigned int i; | ||
105 | |||
106 | for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++) | ||
107 | msleep(10); | ||
108 | } | ||
109 | EXPORT_SYMBOL_GPL(rt2x00pci_flush_queue); | ||
110 | |||
111 | /* | ||
112 | * Device initialization handlers. | ||
113 | */ | ||
114 | static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, | ||
115 | struct data_queue *queue) | ||
116 | { | ||
117 | struct queue_entry_priv_pci *entry_priv; | ||
118 | void *addr; | ||
119 | dma_addr_t dma; | ||
120 | unsigned int i; | ||
121 | |||
122 | /* | ||
123 | * Allocate DMA memory for descriptor and buffer. | ||
124 | */ | ||
125 | addr = dma_alloc_coherent(rt2x00dev->dev, | ||
126 | queue->limit * queue->desc_size, | ||
127 | &dma, GFP_KERNEL); | ||
128 | if (!addr) | ||
129 | return -ENOMEM; | ||
130 | |||
131 | memset(addr, 0, queue->limit * queue->desc_size); | ||
132 | |||
133 | /* | ||
134 | * Initialize all queue entries to contain valid addresses. | ||
135 | */ | ||
136 | for (i = 0; i < queue->limit; i++) { | ||
137 | entry_priv = queue->entries[i].priv_data; | ||
138 | entry_priv->desc = addr + i * queue->desc_size; | ||
139 | entry_priv->desc_dma = dma + i * queue->desc_size; | ||
140 | } | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev, | ||
146 | struct data_queue *queue) | ||
147 | { | ||
148 | struct queue_entry_priv_pci *entry_priv = | ||
149 | queue->entries[0].priv_data; | ||
150 | |||
151 | if (entry_priv->desc) | ||
152 | dma_free_coherent(rt2x00dev->dev, | ||
153 | queue->limit * queue->desc_size, | ||
154 | entry_priv->desc, entry_priv->desc_dma); | ||
155 | entry_priv->desc = NULL; | ||
156 | } | ||
157 | |||
158 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) | ||
159 | { | ||
160 | struct data_queue *queue; | ||
161 | int status; | ||
162 | |||
163 | /* | ||
164 | * Allocate DMA | ||
165 | */ | ||
166 | queue_for_each(rt2x00dev, queue) { | ||
167 | status = rt2x00pci_alloc_queue_dma(rt2x00dev, queue); | ||
168 | if (status) | ||
169 | goto exit; | ||
170 | } | ||
171 | |||
172 | /* | ||
173 | * Register interrupt handler. | ||
174 | */ | ||
175 | status = request_irq(rt2x00dev->irq, | ||
176 | rt2x00dev->ops->lib->irq_handler, | ||
177 | IRQF_SHARED, rt2x00dev->name, rt2x00dev); | ||
178 | if (status) { | ||
179 | ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", | ||
180 | rt2x00dev->irq, status); | ||
181 | goto exit; | ||
182 | } | ||
183 | |||
184 | return 0; | ||
185 | |||
186 | exit: | ||
187 | queue_for_each(rt2x00dev, queue) | ||
188 | rt2x00pci_free_queue_dma(rt2x00dev, queue); | ||
189 | |||
190 | return status; | ||
191 | } | ||
192 | EXPORT_SYMBOL_GPL(rt2x00pci_initialize); | ||
193 | |||
194 | void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev) | ||
195 | { | ||
196 | struct data_queue *queue; | ||
197 | |||
198 | /* | ||
199 | * Free irq line. | ||
200 | */ | ||
201 | free_irq(rt2x00dev->irq, rt2x00dev); | ||
202 | |||
203 | /* | ||
204 | * Free DMA | ||
205 | */ | ||
206 | queue_for_each(rt2x00dev, queue) | ||
207 | rt2x00pci_free_queue_dma(rt2x00dev, queue); | ||
208 | } | ||
209 | EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize); | ||
210 | |||
211 | /* | ||
212 | * PCI driver handlers. | 36 | * PCI driver handlers. |
213 | */ | 37 | */ |
214 | static void rt2x00pci_free_reg(struct rt2x00_dev *rt2x00dev) | 38 | static void rt2x00pci_free_reg(struct rt2x00_dev *rt2x00dev) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h index e2c99f2b9a14..60d90b20f8b9 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.h +++ b/drivers/net/wireless/rt2x00/rt2x00pci.h | |||
@@ -36,94 +36,6 @@ | |||
36 | #define PCI_DEVICE_DATA(__ops) .driver_data = (kernel_ulong_t)(__ops) | 36 | #define PCI_DEVICE_DATA(__ops) .driver_data = (kernel_ulong_t)(__ops) |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Register access. | ||
40 | */ | ||
41 | static inline void rt2x00pci_register_read(struct rt2x00_dev *rt2x00dev, | ||
42 | const unsigned int offset, | ||
43 | u32 *value) | ||
44 | { | ||
45 | *value = readl(rt2x00dev->csr.base + offset); | ||
46 | } | ||
47 | |||
48 | static inline void rt2x00pci_register_multiread(struct rt2x00_dev *rt2x00dev, | ||
49 | const unsigned int offset, | ||
50 | void *value, const u32 length) | ||
51 | { | ||
52 | memcpy_fromio(value, rt2x00dev->csr.base + offset, length); | ||
53 | } | ||
54 | |||
55 | static inline void rt2x00pci_register_write(struct rt2x00_dev *rt2x00dev, | ||
56 | const unsigned int offset, | ||
57 | u32 value) | ||
58 | { | ||
59 | writel(value, rt2x00dev->csr.base + offset); | ||
60 | } | ||
61 | |||
62 | static inline void rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev, | ||
63 | const unsigned int offset, | ||
64 | const void *value, | ||
65 | const u32 length) | ||
66 | { | ||
67 | __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2); | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * rt2x00pci_regbusy_read - Read from register with busy check | ||
72 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
73 | * @offset: Register offset | ||
74 | * @field: Field to check if register is busy | ||
75 | * @reg: Pointer to where register contents should be stored | ||
76 | * | ||
77 | * This function will read the given register, and checks if the | ||
78 | * register is busy. If it is, it will sleep for a couple of | ||
79 | * microseconds before reading the register again. If the register | ||
80 | * is not read after a certain timeout, this function will return | ||
81 | * FALSE. | ||
82 | */ | ||
83 | int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
84 | const unsigned int offset, | ||
85 | const struct rt2x00_field32 field, | ||
86 | u32 *reg); | ||
87 | |||
88 | /** | ||
89 | * struct queue_entry_priv_pci: Per entry PCI specific information | ||
90 | * | ||
91 | * @desc: Pointer to device descriptor | ||
92 | * @desc_dma: DMA pointer to &desc. | ||
93 | * @data: Pointer to device's entry memory. | ||
94 | * @data_dma: DMA pointer to &data. | ||
95 | */ | ||
96 | struct queue_entry_priv_pci { | ||
97 | __le32 *desc; | ||
98 | dma_addr_t desc_dma; | ||
99 | }; | ||
100 | |||
101 | /** | ||
102 | * rt2x00pci_rxdone - Handle RX done events | ||
103 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
104 | * | ||
105 | * Returns true if there are still rx frames pending and false if all | ||
106 | * pending rx frames were processed. | ||
107 | */ | ||
108 | bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); | ||
109 | |||
110 | /** | ||
111 | * rt2x00pci_flush_queue - Flush data queue | ||
112 | * @queue: Data queue to stop | ||
113 | * @drop: True to drop all pending frames. | ||
114 | * | ||
115 | * This will wait for a maximum of 100ms, waiting for the queues | ||
116 | * to become empty. | ||
117 | */ | ||
118 | void rt2x00pci_flush_queue(struct data_queue *queue, bool drop); | ||
119 | |||
120 | /* | ||
121 | * Device initialization handlers. | ||
122 | */ | ||
123 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev); | ||
124 | void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev); | ||
125 | |||
126 | /* | ||
127 | * PCI driver handlers. | 39 | * PCI driver handlers. |
128 | */ | 40 | */ |
129 | int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops); | 41 | int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops); |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index f95792cfcf89..9e3c8ff53e3f 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/eeprom_93cx6.h> | 35 | #include <linux/eeprom_93cx6.h> |
36 | 36 | ||
37 | #include "rt2x00.h" | 37 | #include "rt2x00.h" |
38 | #include "rt2x00mmio.h" | ||
38 | #include "rt2x00pci.h" | 39 | #include "rt2x00pci.h" |
39 | #include "rt61pci.h" | 40 | #include "rt61pci.h" |
40 | 41 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index b1ccff474c79..c08d0f4c5f3d 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -1377,74 +1377,57 @@ void rtl92cu_card_disable(struct ieee80211_hw *hw) | |||
1377 | 1377 | ||
1378 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) | 1378 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) |
1379 | { | 1379 | { |
1380 | /* dummy routine needed for callback from rtl_op_configure_filter() */ | ||
1381 | } | ||
1382 | |||
1383 | /*========================================================================== */ | ||
1384 | |||
1385 | static void _rtl92cu_set_check_bssid(struct ieee80211_hw *hw, | ||
1386 | enum nl80211_iftype type) | ||
1387 | { | ||
1388 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1380 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1389 | u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); | ||
1390 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); | 1381 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); |
1391 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 1382 | u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); |
1392 | u8 filterout_non_associated_bssid = false; | ||
1393 | 1383 | ||
1394 | switch (type) { | 1384 | if (rtlpriv->psc.rfpwr_state != ERFON) |
1395 | case NL80211_IFTYPE_ADHOC: | 1385 | return; |
1396 | case NL80211_IFTYPE_STATION: | 1386 | |
1397 | filterout_non_associated_bssid = true; | 1387 | if (check_bssid) { |
1398 | break; | 1388 | u8 tmp; |
1399 | case NL80211_IFTYPE_UNSPECIFIED: | ||
1400 | case NL80211_IFTYPE_AP: | ||
1401 | default: | ||
1402 | break; | ||
1403 | } | ||
1404 | if (filterout_non_associated_bssid) { | ||
1405 | if (IS_NORMAL_CHIP(rtlhal->version)) { | 1389 | if (IS_NORMAL_CHIP(rtlhal->version)) { |
1406 | switch (rtlphy->current_io_type) { | 1390 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
1407 | case IO_CMD_RESUME_DM_BY_SCAN: | 1391 | tmp = BIT(4); |
1408 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); | ||
1409 | rtlpriv->cfg->ops->set_hw_reg(hw, | ||
1410 | HW_VAR_RCR, (u8 *)(®_rcr)); | ||
1411 | /* enable update TSF */ | ||
1412 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); | ||
1413 | break; | ||
1414 | case IO_CMD_PAUSE_DM_BY_SCAN: | ||
1415 | reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); | ||
1416 | rtlpriv->cfg->ops->set_hw_reg(hw, | ||
1417 | HW_VAR_RCR, (u8 *)(®_rcr)); | ||
1418 | /* disable update TSF */ | ||
1419 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); | ||
1420 | break; | ||
1421 | } | ||
1422 | } else { | 1392 | } else { |
1423 | reg_rcr |= (RCR_CBSSID); | 1393 | reg_rcr |= RCR_CBSSID; |
1424 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1394 | tmp = BIT(4) | BIT(5); |
1425 | (u8 *)(®_rcr)); | ||
1426 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, (BIT(4)|BIT(5))); | ||
1427 | } | 1395 | } |
1428 | } else if (filterout_non_associated_bssid == false) { | 1396 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
1397 | (u8 *) (®_rcr)); | ||
1398 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, tmp); | ||
1399 | } else { | ||
1400 | u8 tmp; | ||
1429 | if (IS_NORMAL_CHIP(rtlhal->version)) { | 1401 | if (IS_NORMAL_CHIP(rtlhal->version)) { |
1430 | reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); | 1402 | reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
1431 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1403 | tmp = BIT(4); |
1432 | (u8 *)(®_rcr)); | ||
1433 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); | ||
1434 | } else { | 1404 | } else { |
1435 | reg_rcr &= (~RCR_CBSSID); | 1405 | reg_rcr &= ~RCR_CBSSID; |
1436 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1406 | tmp = BIT(4) | BIT(5); |
1437 | (u8 *)(®_rcr)); | ||
1438 | _rtl92cu_set_bcn_ctrl_reg(hw, (BIT(4)|BIT(5)), 0); | ||
1439 | } | 1407 | } |
1408 | reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); | ||
1409 | rtlpriv->cfg->ops->set_hw_reg(hw, | ||
1410 | HW_VAR_RCR, (u8 *) (®_rcr)); | ||
1411 | _rtl92cu_set_bcn_ctrl_reg(hw, tmp, 0); | ||
1440 | } | 1412 | } |
1441 | } | 1413 | } |
1442 | 1414 | ||
1415 | /*========================================================================== */ | ||
1416 | |||
1443 | int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) | 1417 | int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) |
1444 | { | 1418 | { |
1419 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1420 | |||
1445 | if (_rtl92cu_set_media_status(hw, type)) | 1421 | if (_rtl92cu_set_media_status(hw, type)) |
1446 | return -EOPNOTSUPP; | 1422 | return -EOPNOTSUPP; |
1447 | _rtl92cu_set_check_bssid(hw, type); | 1423 | |
1424 | if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { | ||
1425 | if (type != NL80211_IFTYPE_AP) | ||
1426 | rtl92cu_set_check_bssid(hw, true); | ||
1427 | } else { | ||
1428 | rtl92cu_set_check_bssid(hw, false); | ||
1429 | } | ||
1430 | |||
1448 | return 0; | 1431 | return 0; |
1449 | } | 1432 | } |
1450 | 1433 | ||
@@ -2058,8 +2041,6 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | |||
2058 | (shortgi_rate << 4) | (shortgi_rate); | 2041 | (shortgi_rate << 4) | (shortgi_rate); |
2059 | } | 2042 | } |
2060 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); | 2043 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); |
2061 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", | ||
2062 | rtl_read_dword(rtlpriv, REG_ARFR0)); | ||
2063 | } | 2044 | } |
2064 | 2045 | ||
2065 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | 2046 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 156b52732f3d..5847d6d0881e 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -851,6 +851,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
851 | if (unlikely(!_urb)) { | 851 | if (unlikely(!_urb)) { |
852 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 852 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
853 | "Can't allocate urb. Drop skb!\n"); | 853 | "Can't allocate urb. Drop skb!\n"); |
854 | kfree_skb(skb); | ||
854 | return; | 855 | return; |
855 | } | 856 | } |
856 | _rtl_submit_tx_urb(hw, _urb); | 857 | _rtl_submit_tx_urb(hw, _urb); |