aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c101
-rw-r--r--drivers/net/can/mcp251x.c10
-rw-r--r--drivers/net/can/sja1000/sja1000_of_platform.c31
-rw-r--r--drivers/net/ethernet/8390/ax88796.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c7
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c7
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c5
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c1
-rw-r--r--drivers/net/ethernet/intel/e100.c36
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h8
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c110
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c6
-rw-r--r--drivers/net/ethernet/marvell/Kconfig2
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c18
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c15
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c3
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c4
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge.h2
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c36
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/mmc_core.c1
-rw-r--r--drivers/net/ethernet/ti/cpsw.c2
-rw-r--r--drivers/net/hyperv/netvsc.c17
-rw-r--r--drivers/net/hyperv/netvsc_drv.c2
-rw-r--r--drivers/net/hyperv/rndis_filter.c14
-rw-r--r--drivers/net/tun.c2
-rw-r--r--drivers/net/usb/cdc_mbim.c2
-rw-r--r--drivers/net/usb/qmi_wwan.c104
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/dfs_pri_detector.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c2
-rw-r--r--drivers/net/wireless/b43/phy_n.c3
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c7
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c265
35 files changed, 463 insertions, 374 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5e22126c7a26..532153db1f9c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -848,8 +848,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
848 if (bond->dev->flags & IFF_ALLMULTI) 848 if (bond->dev->flags & IFF_ALLMULTI)
849 dev_set_allmulti(old_active->dev, -1); 849 dev_set_allmulti(old_active->dev, -1);
850 850
851 netif_addr_lock_bh(bond->dev);
851 netdev_for_each_mc_addr(ha, bond->dev) 852 netdev_for_each_mc_addr(ha, bond->dev)
852 dev_mc_del(old_active->dev, ha->addr); 853 dev_mc_del(old_active->dev, ha->addr);
854 netif_addr_unlock_bh(bond->dev);
853 } 855 }
854 856
855 if (new_active) { 857 if (new_active) {
@@ -860,8 +862,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
860 if (bond->dev->flags & IFF_ALLMULTI) 862 if (bond->dev->flags & IFF_ALLMULTI)
861 dev_set_allmulti(new_active->dev, 1); 863 dev_set_allmulti(new_active->dev, 1);
862 864
865 netif_addr_lock_bh(bond->dev);
863 netdev_for_each_mc_addr(ha, bond->dev) 866 netdev_for_each_mc_addr(ha, bond->dev)
864 dev_mc_add(new_active->dev, ha->addr); 867 dev_mc_add(new_active->dev, ha->addr);
868 netif_addr_unlock_bh(bond->dev);
865 } 869 }
866} 870}
867 871
@@ -1903,11 +1907,29 @@ err_dest_symlinks:
1903 bond_destroy_slave_symlinks(bond_dev, slave_dev); 1907 bond_destroy_slave_symlinks(bond_dev, slave_dev);
1904 1908
1905err_detach: 1909err_detach:
1910 if (!USES_PRIMARY(bond->params.mode)) {
1911 netif_addr_lock_bh(bond_dev);
1912 bond_mc_list_flush(bond_dev, slave_dev);
1913 netif_addr_unlock_bh(bond_dev);
1914 }
1915 bond_del_vlans_from_slave(bond, slave_dev);
1906 write_lock_bh(&bond->lock); 1916 write_lock_bh(&bond->lock);
1907 bond_detach_slave(bond, new_slave); 1917 bond_detach_slave(bond, new_slave);
1918 if (bond->primary_slave == new_slave)
1919 bond->primary_slave = NULL;
1908 write_unlock_bh(&bond->lock); 1920 write_unlock_bh(&bond->lock);
1921 if (bond->curr_active_slave == new_slave) {
1922 read_lock(&bond->lock);
1923 write_lock_bh(&bond->curr_slave_lock);
1924 bond_change_active_slave(bond, NULL);
1925 bond_select_active_slave(bond);
1926 write_unlock_bh(&bond->curr_slave_lock);
1927 read_unlock(&bond->lock);
1928 }
1929 slave_disable_netpoll(new_slave);
1909 1930
1910err_close: 1931err_close:
1932 slave_dev->priv_flags &= ~IFF_BONDING;
1911 dev_close(slave_dev); 1933 dev_close(slave_dev);
1912 1934
1913err_unset_master: 1935err_unset_master:
@@ -3172,11 +3194,20 @@ static int bond_slave_netdev_event(unsigned long event,
3172 struct net_device *slave_dev) 3194 struct net_device *slave_dev)
3173{ 3195{
3174 struct slave *slave = bond_slave_get_rtnl(slave_dev); 3196 struct slave *slave = bond_slave_get_rtnl(slave_dev);
3175 struct bonding *bond = slave->bond; 3197 struct bonding *bond;
3176 struct net_device *bond_dev = slave->bond->dev; 3198 struct net_device *bond_dev;
3177 u32 old_speed; 3199 u32 old_speed;
3178 u8 old_duplex; 3200 u8 old_duplex;
3179 3201
3202 /* A netdev event can be generated while enslaving a device
3203 * before netdev_rx_handler_register is called in which case
3204 * slave will be NULL
3205 */
3206 if (!slave)
3207 return NOTIFY_DONE;
3208 bond_dev = slave->bond->dev;
3209 bond = slave->bond;
3210
3180 switch (event) { 3211 switch (event) {
3181 case NETDEV_UNREGISTER: 3212 case NETDEV_UNREGISTER:
3182 if (bond->setup_by_slave) 3213 if (bond->setup_by_slave)
@@ -3290,20 +3321,22 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
3290 */ 3321 */
3291static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count) 3322static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
3292{ 3323{
3293 struct ethhdr *data = (struct ethhdr *)skb->data; 3324 const struct ethhdr *data;
3294 struct iphdr *iph; 3325 const struct iphdr *iph;
3295 struct ipv6hdr *ipv6h; 3326 const struct ipv6hdr *ipv6h;
3296 u32 v6hash; 3327 u32 v6hash;
3297 __be32 *s, *d; 3328 const __be32 *s, *d;
3298 3329
3299 if (skb->protocol == htons(ETH_P_IP) && 3330 if (skb->protocol == htons(ETH_P_IP) &&
3300 skb_network_header_len(skb) >= sizeof(*iph)) { 3331 pskb_network_may_pull(skb, sizeof(*iph))) {
3301 iph = ip_hdr(skb); 3332 iph = ip_hdr(skb);
3333 data = (struct ethhdr *)skb->data;
3302 return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ 3334 return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
3303 (data->h_dest[5] ^ data->h_source[5])) % count; 3335 (data->h_dest[5] ^ data->h_source[5])) % count;
3304 } else if (skb->protocol == htons(ETH_P_IPV6) && 3336 } else if (skb->protocol == htons(ETH_P_IPV6) &&
3305 skb_network_header_len(skb) >= sizeof(*ipv6h)) { 3337 pskb_network_may_pull(skb, sizeof(*ipv6h))) {
3306 ipv6h = ipv6_hdr(skb); 3338 ipv6h = ipv6_hdr(skb);
3339 data = (struct ethhdr *)skb->data;
3307 s = &ipv6h->saddr.s6_addr32[0]; 3340 s = &ipv6h->saddr.s6_addr32[0];
3308 d = &ipv6h->daddr.s6_addr32[0]; 3341 d = &ipv6h->daddr.s6_addr32[0];
3309 v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]); 3342 v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]);
@@ -3322,33 +3355,36 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
3322static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count) 3355static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count)
3323{ 3356{
3324 u32 layer4_xor = 0; 3357 u32 layer4_xor = 0;
3325 struct iphdr *iph; 3358 const struct iphdr *iph;
3326 struct ipv6hdr *ipv6h; 3359 const struct ipv6hdr *ipv6h;
3327 __be32 *s, *d; 3360 const __be32 *s, *d;
3328 __be16 *layer4hdr; 3361 const __be16 *l4 = NULL;
3362 __be16 _l4[2];
3363 int noff = skb_network_offset(skb);
3364 int poff;
3329 3365
3330 if (skb->protocol == htons(ETH_P_IP) && 3366 if (skb->protocol == htons(ETH_P_IP) &&
3331 skb_network_header_len(skb) >= sizeof(*iph)) { 3367 pskb_may_pull(skb, noff + sizeof(*iph))) {
3332 iph = ip_hdr(skb); 3368 iph = ip_hdr(skb);
3333 if (!ip_is_fragment(iph) && 3369 poff = proto_ports_offset(iph->protocol);
3334 (iph->protocol == IPPROTO_TCP || 3370
3335 iph->protocol == IPPROTO_UDP) && 3371 if (!ip_is_fragment(iph) && poff >= 0) {
3336 (skb_headlen(skb) - skb_network_offset(skb) >= 3372 l4 = skb_header_pointer(skb, noff + (iph->ihl << 2) + poff,
3337 iph->ihl * sizeof(u32) + sizeof(*layer4hdr) * 2)) { 3373 sizeof(_l4), &_l4);
3338 layer4hdr = (__be16 *)((u32 *)iph + iph->ihl); 3374 if (l4)
3339 layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1)); 3375 layer4_xor = ntohs(l4[0] ^ l4[1]);
3340 } 3376 }
3341 return (layer4_xor ^ 3377 return (layer4_xor ^
3342 ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count; 3378 ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count;
3343 } else if (skb->protocol == htons(ETH_P_IPV6) && 3379 } else if (skb->protocol == htons(ETH_P_IPV6) &&
3344 skb_network_header_len(skb) >= sizeof(*ipv6h)) { 3380 pskb_may_pull(skb, noff + sizeof(*ipv6h))) {
3345 ipv6h = ipv6_hdr(skb); 3381 ipv6h = ipv6_hdr(skb);
3346 if ((ipv6h->nexthdr == IPPROTO_TCP || 3382 poff = proto_ports_offset(ipv6h->nexthdr);
3347 ipv6h->nexthdr == IPPROTO_UDP) && 3383 if (poff >= 0) {
3348 (skb_headlen(skb) - skb_network_offset(skb) >= 3384 l4 = skb_header_pointer(skb, noff + sizeof(*ipv6h) + poff,
3349 sizeof(*ipv6h) + sizeof(*layer4hdr) * 2)) { 3385 sizeof(_l4), &_l4);
3350 layer4hdr = (__be16 *)(ipv6h + 1); 3386 if (l4)
3351 layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1)); 3387 layer4_xor = ntohs(l4[0] ^ l4[1]);
3352 } 3388 }
3353 s = &ipv6h->saddr.s6_addr32[0]; 3389 s = &ipv6h->saddr.s6_addr32[0];
3354 d = &ipv6h->daddr.s6_addr32[0]; 3390 d = &ipv6h->daddr.s6_addr32[0];
@@ -4882,9 +4918,18 @@ static int __net_init bond_net_init(struct net *net)
4882static void __net_exit bond_net_exit(struct net *net) 4918static void __net_exit bond_net_exit(struct net *net)
4883{ 4919{
4884 struct bond_net *bn = net_generic(net, bond_net_id); 4920 struct bond_net *bn = net_generic(net, bond_net_id);
4921 struct bonding *bond, *tmp_bond;
4922 LIST_HEAD(list);
4885 4923
4886 bond_destroy_sysfs(bn); 4924 bond_destroy_sysfs(bn);
4887 bond_destroy_proc_dir(bn); 4925 bond_destroy_proc_dir(bn);
4926
4927 /* Kill off any bonds created after unregistering bond rtnl ops */
4928 rtnl_lock();
4929 list_for_each_entry_safe(bond, tmp_bond, &bn->dev_list, bond_list)
4930 unregister_netdevice_queue(bond->dev, &list);
4931 unregister_netdevice_many(&list);
4932 rtnl_unlock();
4888} 4933}
4889 4934
4890static struct pernet_operations bond_net_ops = { 4935static struct pernet_operations bond_net_ops = {
@@ -4938,8 +4983,8 @@ static void __exit bonding_exit(void)
4938 4983
4939 bond_destroy_debugfs(); 4984 bond_destroy_debugfs();
4940 4985
4941 unregister_pernet_subsys(&bond_net_ops);
4942 rtnl_link_unregister(&bond_link_ops); 4986 rtnl_link_unregister(&bond_link_ops);
4987 unregister_pernet_subsys(&bond_net_ops);
4943 4988
4944#ifdef CONFIG_NET_POLL_CONTROLLER 4989#ifdef CONFIG_NET_POLL_CONTROLLER
4945 /* 4990 /*
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 55033dd57afb..8cda23bf0614 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/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/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 6b50443d3456..d72bd8c40aa1 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2615,6 +2615,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
2615 } 2615 }
2616 } 2616 }
2617 2617
2618 /* initialize FW coalescing state machines in RAM */
2619 bnx2x_update_coalesce(bp);
2620
2618 /* setup the leading queue */ 2621 /* setup the leading queue */
2619 rc = bnx2x_setup_leading(bp); 2622 rc = bnx2x_setup_leading(bp);
2620 if (rc) { 2623 if (rc) {
@@ -4737,11 +4740,11 @@ static void storm_memset_hc_disable(struct bnx2x *bp, u8 port,
4737 u32 enable_flag = disable ? 0 : (1 << HC_INDEX_DATA_HC_ENABLED_SHIFT); 4740 u32 enable_flag = disable ? 0 : (1 << HC_INDEX_DATA_HC_ENABLED_SHIFT);
4738 u32 addr = BAR_CSTRORM_INTMEM + 4741 u32 addr = BAR_CSTRORM_INTMEM +
4739 CSTORM_STATUS_BLOCK_DATA_FLAGS_OFFSET(fw_sb_id, sb_index); 4742 CSTORM_STATUS_BLOCK_DATA_FLAGS_OFFSET(fw_sb_id, sb_index);
4740 u16 flags = REG_RD16(bp, addr); 4743 u8 flags = REG_RD8(bp, addr);
4741 /* clear and set */ 4744 /* clear and set */
4742 flags &= ~HC_INDEX_DATA_HC_ENABLED; 4745 flags &= ~HC_INDEX_DATA_HC_ENABLED;
4743 flags |= enable_flag; 4746 flags |= enable_flag;
4744 REG_WR16(bp, addr, flags); 4747 REG_WR8(bp, addr, flags);
4745 DP(NETIF_MSG_IFUP, 4748 DP(NETIF_MSG_IFUP,
4746 "port %x fw_sb_id %d sb_index %d disable %d\n", 4749 "port %x fw_sb_id %d sb_index %d disable %d\n",
4747 port, fw_sb_id, sb_index, disable); 4750 port, fw_sb_id, sb_index, disable);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 1e60c5d139d1..86d13870399e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -4959,7 +4959,7 @@ static void bnx2x_after_function_update(struct bnx2x *bp)
4959 q); 4959 q);
4960 } 4960 }
4961 4961
4962 if (!NO_FCOE(bp)) { 4962 if (!NO_FCOE(bp) && CNIC_ENABLED(bp)) {
4963 fp = &bp->fp[FCOE_IDX(bp)]; 4963 fp = &bp->fp[FCOE_IDX(bp)];
4964 queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; 4964 queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj;
4965 4965
@@ -9946,6 +9946,10 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp)
9946 REG_RD(bp, NIG_REG_NIG_INT_STS_CLR_0); 9946 REG_RD(bp, NIG_REG_NIG_INT_STS_CLR_0);
9947 } 9947 }
9948 } 9948 }
9949 if (!CHIP_IS_E1x(bp))
9950 /* block FW from writing to host */
9951 REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_MASTER, 0);
9952
9949 /* wait until BRB is empty */ 9953 /* wait until BRB is empty */
9950 tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); 9954 tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS);
9951 while (timer_count) { 9955 while (timer_count) {
@@ -13450,6 +13454,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev)
13450 RCU_INIT_POINTER(bp->cnic_ops, NULL); 13454 RCU_INIT_POINTER(bp->cnic_ops, NULL);
13451 mutex_unlock(&bp->cnic_mutex); 13455 mutex_unlock(&bp->cnic_mutex);
13452 synchronize_rcu(); 13456 synchronize_rcu();
13457 bp->cnic_enabled = false;
13453 kfree(bp->cnic_kwq); 13458 kfree(bp->cnic_kwq);
13454 bp->cnic_kwq = NULL; 13459 bp->cnic_kwq = NULL;
13455 13460
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 21808680b91f..654e7820daa0 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -772,8 +772,9 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter,
772 772
773 if (vlan_tx_tag_present(skb)) { 773 if (vlan_tx_tag_present(skb)) {
774 vlan_tag = be_get_tx_vlan_tag(adapter, skb); 774 vlan_tag = be_get_tx_vlan_tag(adapter, skb);
775 __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); 775 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
776 skb->vlan_tci = 0; 776 if (skb)
777 skb->vlan_tci = 0;
777 } 778 }
778 779
779 return skb; 780 return skb;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 20890874ead7..2451ab1b5a83 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -997,6 +997,7 @@ static void fec_enet_adjust_link(struct net_device *ndev)
997 } else { 997 } else {
998 if (fep->link) { 998 if (fep->link) {
999 fec_stop(ndev); 999 fec_stop(ndev);
1000 fep->link = phy_dev->link;
1000 status_change = 1; 1001 status_change = 1;
1001 } 1002 }
1002 } 1003 }
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
872static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, 872static 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
1094static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) 1097static 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
1334static void e100_setup_ucode(struct nic *nic, struct cb *cb, 1338static 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
1363static inline int e100_load_ucode_wait(struct nic *nic) 1368static 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
1403static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, 1408static 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
1410static void e100_dump(struct nic *nic, struct cb *cb, struct sk_buff *skb) 1416static 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
1417static int e100_phy_check_without_mii(struct nic *nic) 1424static 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
1584static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) 1591static 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
1601static void e100_set_multicast_list(struct net_device *netdev) 1609static 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
1759static void e100_xmit_prepare(struct nic *nic, struct cb *cb, 1767static 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
1787static netdev_tx_t e100_xmit_frame(struct sk_buff *skb, 1801static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index c92115e71ebe..9d6c075e232d 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -293,18 +293,10 @@ struct igb_q_vector {
293enum e1000_ring_flags_t { 293enum e1000_ring_flags_t {
294 IGB_RING_FLAG_RX_SCTP_CSUM, 294 IGB_RING_FLAG_RX_SCTP_CSUM,
295 IGB_RING_FLAG_RX_LB_VLAN_BSWAP, 295 IGB_RING_FLAG_RX_LB_VLAN_BSWAP,
296 IGB_RING_FLAG_RX_BUILD_SKB_ENABLED,
297 IGB_RING_FLAG_TX_CTX_IDX, 296 IGB_RING_FLAG_TX_CTX_IDX,
298 IGB_RING_FLAG_TX_DETECT_HANG 297 IGB_RING_FLAG_TX_DETECT_HANG
299}; 298};
300 299
301#define ring_uses_build_skb(ring) \
302 test_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags)
303#define set_ring_build_skb_enabled(ring) \
304 set_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags)
305#define clear_ring_build_skb_enabled(ring) \
306 clear_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags)
307
308#define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS) 300#define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS)
309 301
310#define IGB_RX_DESC(R, i) \ 302#define IGB_RX_DESC(R, i) \
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 9bf08b977daa..dcaa35481dd7 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -3387,20 +3387,6 @@ void igb_configure_rx_ring(struct igb_adapter *adapter,
3387 wr32(E1000_RXDCTL(reg_idx), rxdctl); 3387 wr32(E1000_RXDCTL(reg_idx), rxdctl);
3388} 3388}
3389 3389
3390static void igb_set_rx_buffer_len(struct igb_adapter *adapter,
3391 struct igb_ring *rx_ring)
3392{
3393#define IGB_MAX_BUILD_SKB_SIZE \
3394 (SKB_WITH_OVERHEAD(IGB_RX_BUFSZ) - \
3395 (NET_SKB_PAD + NET_IP_ALIGN + IGB_TS_HDR_LEN))
3396
3397 /* set build_skb flag */
3398 if (adapter->max_frame_size <= IGB_MAX_BUILD_SKB_SIZE)
3399 set_ring_build_skb_enabled(rx_ring);
3400 else
3401 clear_ring_build_skb_enabled(rx_ring);
3402}
3403
3404/** 3390/**
3405 * igb_configure_rx - Configure receive Unit after Reset 3391 * igb_configure_rx - Configure receive Unit after Reset
3406 * @adapter: board private structure 3392 * @adapter: board private structure
@@ -3421,11 +3407,8 @@ static void igb_configure_rx(struct igb_adapter *adapter)
3421 /* Setup the HW Rx Head and Tail Descriptor Pointers and 3407 /* Setup the HW Rx Head and Tail Descriptor Pointers and
3422 * the Base and Length of the Rx Descriptor Ring 3408 * the Base and Length of the Rx Descriptor Ring
3423 */ 3409 */
3424 for (i = 0; i < adapter->num_rx_queues; i++) { 3410 for (i = 0; i < adapter->num_rx_queues; i++)
3425 struct igb_ring *rx_ring = adapter->rx_ring[i]; 3411 igb_configure_rx_ring(adapter, adapter->rx_ring[i]);
3426 igb_set_rx_buffer_len(adapter, rx_ring);
3427 igb_configure_rx_ring(adapter, rx_ring);
3428 }
3429} 3412}
3430 3413
3431/** 3414/**
@@ -6238,78 +6221,6 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring,
6238 return igb_can_reuse_rx_page(rx_buffer, page, truesize); 6221 return igb_can_reuse_rx_page(rx_buffer, page, truesize);
6239} 6222}
6240 6223
6241static struct sk_buff *igb_build_rx_buffer(struct igb_ring *rx_ring,
6242 union e1000_adv_rx_desc *rx_desc)
6243{
6244 struct igb_rx_buffer *rx_buffer;
6245 struct sk_buff *skb;
6246 struct page *page;
6247 void *page_addr;
6248 unsigned int size = le16_to_cpu(rx_desc->wb.upper.length);
6249#if (PAGE_SIZE < 8192)
6250 unsigned int truesize = IGB_RX_BUFSZ;
6251#else
6252 unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
6253 SKB_DATA_ALIGN(NET_SKB_PAD +
6254 NET_IP_ALIGN +
6255 size);
6256#endif
6257
6258 /* If we spanned a buffer we have a huge mess so test for it */
6259 BUG_ON(unlikely(!igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP)));
6260
6261 rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean];
6262 page = rx_buffer->page;
6263 prefetchw(page);
6264
6265 page_addr = page_address(page) + rx_buffer->page_offset;
6266
6267 /* prefetch first cache line of first page */
6268 prefetch(page_addr + NET_SKB_PAD + NET_IP_ALIGN);
6269#if L1_CACHE_BYTES < 128
6270 prefetch(page_addr + L1_CACHE_BYTES + NET_SKB_PAD + NET_IP_ALIGN);
6271#endif
6272
6273 /* build an skb to around the page buffer */
6274 skb = build_skb(page_addr, truesize);
6275 if (unlikely(!skb)) {
6276 rx_ring->rx_stats.alloc_failed++;
6277 return NULL;
6278 }
6279
6280 /* we are reusing so sync this buffer for CPU use */
6281 dma_sync_single_range_for_cpu(rx_ring->dev,
6282 rx_buffer->dma,
6283 rx_buffer->page_offset,
6284 IGB_RX_BUFSZ,
6285 DMA_FROM_DEVICE);
6286
6287 /* update pointers within the skb to store the data */
6288 skb_reserve(skb, NET_IP_ALIGN + NET_SKB_PAD);
6289 __skb_put(skb, size);
6290
6291 /* pull timestamp out of packet data */
6292 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
6293 igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb);
6294 __skb_pull(skb, IGB_TS_HDR_LEN);
6295 }
6296
6297 if (igb_can_reuse_rx_page(rx_buffer, page, truesize)) {
6298 /* hand second half of page back to the ring */
6299 igb_reuse_rx_page(rx_ring, rx_buffer);
6300 } else {
6301 /* we are not reusing the buffer so unmap it */
6302 dma_unmap_page(rx_ring->dev, rx_buffer->dma,
6303 PAGE_SIZE, DMA_FROM_DEVICE);
6304 }
6305
6306 /* clear contents of buffer_info */
6307 rx_buffer->dma = 0;
6308 rx_buffer->page = NULL;
6309
6310 return skb;
6311}
6312
6313static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, 6224static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring,
6314 union e1000_adv_rx_desc *rx_desc, 6225 union e1000_adv_rx_desc *rx_desc,
6315 struct sk_buff *skb) 6226 struct sk_buff *skb)
@@ -6719,10 +6630,7 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
6719 rmb(); 6630 rmb();
6720 6631
6721 /* retrieve a buffer from the ring */ 6632 /* retrieve a buffer from the ring */
6722 if (ring_uses_build_skb(rx_ring)) 6633 skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb);
6723 skb = igb_build_rx_buffer(rx_ring, rx_desc);
6724 else
6725 skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb);
6726 6634
6727 /* exit if we failed to retrieve a buffer */ 6635 /* exit if we failed to retrieve a buffer */
6728 if (!skb) 6636 if (!skb)
@@ -6808,14 +6716,6 @@ static bool igb_alloc_mapped_page(struct igb_ring *rx_ring,
6808 return true; 6716 return true;
6809} 6717}
6810 6718
6811static inline unsigned int igb_rx_offset(struct igb_ring *rx_ring)
6812{
6813 if (ring_uses_build_skb(rx_ring))
6814 return NET_SKB_PAD + NET_IP_ALIGN;
6815 else
6816 return 0;
6817}
6818
6819/** 6719/**
6820 * igb_alloc_rx_buffers - Replace used receive buffers; packet split 6720 * igb_alloc_rx_buffers - Replace used receive buffers; packet split
6821 * @adapter: address of board private structure 6721 * @adapter: address of board private structure
@@ -6841,9 +6741,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count)
6841 /* Refresh the desc even if buffer_addrs didn't change 6741 /* Refresh the desc even if buffer_addrs didn't change
6842 * because each write-back erases this info. 6742 * because each write-back erases this info.
6843 */ 6743 */
6844 rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + 6744 rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + bi->page_offset);
6845 bi->page_offset +
6846 igb_rx_offset(rx_ring));
6847 6745
6848 rx_desc++; 6746 rx_desc++;
6849 bi++; 6747 bi++;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 2d4bdcc4fdbe..1e7d587c4e57 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -1052,6 +1052,12 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
1052 if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7)) 1052 if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7))
1053 return -EINVAL; 1053 return -EINVAL;
1054 if (vlan || qos) { 1054 if (vlan || qos) {
1055 if (adapter->vfinfo[vf].pf_vlan)
1056 err = ixgbe_set_vf_vlan(adapter, false,
1057 adapter->vfinfo[vf].pf_vlan,
1058 vf);
1059 if (err)
1060 goto out;
1055 err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); 1061 err = ixgbe_set_vf_vlan(adapter, true, vlan, vf);
1056 if (err) 1062 if (err)
1057 goto out; 1063 goto out;
diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig
index 0051f0ef3cd0..a49e81bdf8e8 100644
--- a/drivers/net/ethernet/marvell/Kconfig
+++ b/drivers/net/ethernet/marvell/Kconfig
@@ -33,6 +33,7 @@ config MV643XX_ETH
33 33
34config MVMDIO 34config 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,
@@ -43,7 +44,6 @@ config MVMDIO
43config MVNETA 44config MVNETA
44 tristate "Marvell Armada 370/XP network interface support" 45 tristate "Marvell Armada 370/XP network interface support"
45 depends on MACH_ARMADA_370_XP 46 depends on MACH_ARMADA_370_XP
46 select PHYLIB
47 select MVMDIO 47 select MVMDIO
48 ---help--- 48 ---help---
49 This driver supports the network interface units in the 49 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 e48261e468f3..c96678555233 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -374,7 +374,6 @@ static int rxq_number = 8;
374static int txq_number = 8; 374static int txq_number = 8;
375 375
376static int rxq_def; 376static int rxq_def;
377static 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:
1475static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) 1474static 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);
@@ -2679,7 +2679,7 @@ static int mvneta_probe(struct platform_device *pdev)
2679 return -EINVAL; 2679 return -EINVAL;
2680 } 2680 }
2681 2681
2682 dev = alloc_etherdev_mq(sizeof(struct mvneta_port), 8); 2682 dev = alloc_etherdev_mqs(sizeof(struct mvneta_port), txq_number, rxq_number);
2683 if (!dev) 2683 if (!dev)
2684 return -ENOMEM; 2684 return -ENOMEM;
2685 2685
@@ -2761,16 +2761,17 @@ static int mvneta_probe(struct platform_device *pdev)
2761 2761
2762 netif_napi_add(dev, &pp->napi, mvneta_poll, pp->weight); 2762 netif_napi_add(dev, &pp->napi, mvneta_poll, pp->weight);
2763 2763
2764 dev->features = NETIF_F_SG | NETIF_F_IP_CSUM;
2765 dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM;
2766 dev->vlan_features |= NETIF_F_SG | NETIF_F_IP_CSUM;
2767 dev->priv_flags |= IFF_UNICAST_FLT;
2768
2764 err = register_netdev(dev); 2769 err = register_netdev(dev);
2765 if (err < 0) { 2770 if (err < 0) {
2766 dev_err(&pdev->dev, "failed to register\n"); 2771 dev_err(&pdev->dev, "failed to register\n");
2767 goto err_deinit; 2772 goto err_deinit;
2768 } 2773 }
2769 2774
2770 dev->features = NETIF_F_SG | NETIF_F_IP_CSUM;
2771 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM;
2772 dev->priv_flags |= IFF_UNICAST_FLT;
2773
2774 netdev_info(dev, "mac: %pM\n", dev->dev_addr); 2775 netdev_info(dev, "mac: %pM\n", dev->dev_addr);
2775 2776
2776 platform_set_drvdata(pdev, pp->dev); 2777 platform_set_drvdata(pdev, pp->dev);
@@ -2833,4 +2834,3 @@ module_param(rxq_number, int, S_IRUGO);
2833module_param(txq_number, int, S_IRUGO); 2834module_param(txq_number, int, S_IRUGO);
2834 2835
2835module_param(rxq_def, int, S_IRUGO); 2836module_param(rxq_def, int, S_IRUGO);
2836module_param(txq_def, int, S_IRUGO);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 32a95c105e4e..fd0829c2839d 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -1619,6 +1619,12 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode)
1619 } 1619 }
1620 } while ((adapter->ahw->linkup && ahw->has_link_events) != 1); 1620 } while ((adapter->ahw->linkup && ahw->has_link_events) != 1);
1621 1621
1622 /* Make sure carrier is off and queue is stopped during loopback */
1623 if (netif_running(netdev)) {
1624 netif_carrier_off(netdev);
1625 netif_stop_queue(netdev);
1626 }
1627
1622 ret = qlcnic_do_lb_test(adapter, mode); 1628 ret = qlcnic_do_lb_test(adapter, mode);
1623 1629
1624 qlcnic_83xx_clear_lb_mode(adapter, mode); 1630 qlcnic_83xx_clear_lb_mode(adapter, mode);
@@ -2944,6 +2950,7 @@ static u64 *qlcnic_83xx_fill_stats(struct qlcnic_adapter *adapter,
2944void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data) 2950void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data)
2945{ 2951{
2946 struct qlcnic_cmd_args cmd; 2952 struct qlcnic_cmd_args cmd;
2953 struct net_device *netdev = adapter->netdev;
2947 int ret = 0; 2954 int ret = 0;
2948 2955
2949 qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_STATISTICS); 2956 qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_STATISTICS);
@@ -2953,7 +2960,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data)
2953 data = qlcnic_83xx_fill_stats(adapter, &cmd, data, 2960 data = qlcnic_83xx_fill_stats(adapter, &cmd, data,
2954 QLC_83XX_STAT_TX, &ret); 2961 QLC_83XX_STAT_TX, &ret);
2955 if (ret) { 2962 if (ret) {
2956 dev_info(&adapter->pdev->dev, "Error getting MAC stats\n"); 2963 netdev_err(netdev, "Error getting Tx stats\n");
2957 goto out; 2964 goto out;
2958 } 2965 }
2959 /* Get MAC stats */ 2966 /* Get MAC stats */
@@ -2963,8 +2970,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data)
2963 data = qlcnic_83xx_fill_stats(adapter, &cmd, data, 2970 data = qlcnic_83xx_fill_stats(adapter, &cmd, data,
2964 QLC_83XX_STAT_MAC, &ret); 2971 QLC_83XX_STAT_MAC, &ret);
2965 if (ret) { 2972 if (ret) {
2966 dev_info(&adapter->pdev->dev, 2973 netdev_err(netdev, "Error getting MAC stats\n");
2967 "Error getting Rx stats\n");
2968 goto out; 2974 goto out;
2969 } 2975 }
2970 /* Get Rx stats */ 2976 /* Get Rx stats */
@@ -2974,8 +2980,7 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data)
2974 data = qlcnic_83xx_fill_stats(adapter, &cmd, data, 2980 data = qlcnic_83xx_fill_stats(adapter, &cmd, data,
2975 QLC_83XX_STAT_RX, &ret); 2981 QLC_83XX_STAT_RX, &ret);
2976 if (ret) 2982 if (ret)
2977 dev_info(&adapter->pdev->dev, 2983 netdev_err(netdev, "Error getting Rx stats\n");
2978 "Error getting Tx stats\n");
2979out: 2984out:
2980 qlcnic_free_mbx_args(&cmd); 2985 qlcnic_free_mbx_args(&cmd);
2981} 2986}
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index 356859b9f21c..d3f8797efcc3 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -362,8 +362,7 @@ set_flags:
362 memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN); 362 memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN);
363 } 363 }
364 opcode = TX_ETHER_PKT; 364 opcode = TX_ETHER_PKT;
365 if ((adapter->netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && 365 if (skb_is_gso(skb)) {
366 skb_shinfo(skb)->gso_size > 0) {
367 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); 366 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
368 first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); 367 first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
369 first_desc->total_hdr_length = hdr_len; 368 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 c77675da671f..4e22e794a186 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
@@ -198,10 +198,10 @@ beacon_err:
198 } 198 }
199 199
200 err = qlcnic_config_led(adapter, b_state, b_rate); 200 err = qlcnic_config_led(adapter, b_state, b_rate);
201 if (!err) 201 if (!err) {
202 err = len; 202 err = len;
203 else
204 ahw->beacon_state = b_state; 203 ahw->beacon_state = b_state;
204 }
205 205
206 if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) 206 if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state))
207 qlcnic_diag_free_res(adapter->netdev, max_sds_rings); 207 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 44cf72ac2489..87463bc701a6 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -1432,11 +1432,13 @@ map_error:
1432} 1432}
1433 1433
1434/* Categorizing receive firmware frame errors */ 1434/* Categorizing receive firmware frame errors */
1435static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err) 1435static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err,
1436 struct rx_ring *rx_ring)
1436{ 1437{
1437 struct nic_stats *stats = &qdev->nic_stats; 1438 struct nic_stats *stats = &qdev->nic_stats;
1438 1439
1439 stats->rx_err_count++; 1440 stats->rx_err_count++;
1441 rx_ring->rx_errors++;
1440 1442
1441 switch (rx_err & IB_MAC_IOCB_RSP_ERR_MASK) { 1443 switch (rx_err & IB_MAC_IOCB_RSP_ERR_MASK) {
1442 case IB_MAC_IOCB_RSP_ERR_CODE_ERR: 1444 case IB_MAC_IOCB_RSP_ERR_CODE_ERR:
@@ -1472,6 +1474,12 @@ static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev,
1472 struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring); 1474 struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring);
1473 struct napi_struct *napi = &rx_ring->napi; 1475 struct napi_struct *napi = &rx_ring->napi;
1474 1476
1477 /* Frame error, so drop the packet. */
1478 if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) {
1479 ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring);
1480 put_page(lbq_desc->p.pg_chunk.page);
1481 return;
1482 }
1475 napi->dev = qdev->ndev; 1483 napi->dev = qdev->ndev;
1476 1484
1477 skb = napi_get_frags(napi); 1485 skb = napi_get_frags(napi);
@@ -1525,6 +1533,12 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev,
1525 addr = lbq_desc->p.pg_chunk.va; 1533 addr = lbq_desc->p.pg_chunk.va;
1526 prefetch(addr); 1534 prefetch(addr);
1527 1535
1536 /* Frame error, so drop the packet. */
1537 if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) {
1538 ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring);
1539 goto err_out;
1540 }
1541
1528 /* The max framesize filter on this chip is set higher than 1542 /* The max framesize filter on this chip is set higher than
1529 * MTU since FCoE uses 2k frames. 1543 * MTU since FCoE uses 2k frames.
1530 */ 1544 */
@@ -1608,6 +1622,13 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev,
1608 memcpy(skb_put(new_skb, length), skb->data, length); 1622 memcpy(skb_put(new_skb, length), skb->data, length);
1609 skb = new_skb; 1623 skb = new_skb;
1610 1624
1625 /* Frame error, so drop the packet. */
1626 if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) {
1627 ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring);
1628 dev_kfree_skb_any(skb);
1629 return;
1630 }
1631
1611 /* loopback self test for ethtool */ 1632 /* loopback self test for ethtool */
1612 if (test_bit(QL_SELFTEST, &qdev->flags)) { 1633 if (test_bit(QL_SELFTEST, &qdev->flags)) {
1613 ql_check_lb_frame(qdev, skb); 1634 ql_check_lb_frame(qdev, skb);
@@ -1913,6 +1934,13 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev,
1913 return; 1934 return;
1914 } 1935 }
1915 1936
1937 /* Frame error, so drop the packet. */
1938 if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) {
1939 ql_categorize_rx_err(qdev, ib_mac_rsp->flags2, rx_ring);
1940 dev_kfree_skb_any(skb);
1941 return;
1942 }
1943
1916 /* The max framesize filter on this chip is set higher than 1944 /* The max framesize filter on this chip is set higher than
1917 * MTU since FCoE uses 2k frames. 1945 * MTU since FCoE uses 2k frames.
1918 */ 1946 */
@@ -1994,12 +2022,6 @@ static unsigned long ql_process_mac_rx_intr(struct ql_adapter *qdev,
1994 2022
1995 QL_DUMP_IB_MAC_RSP(ib_mac_rsp); 2023 QL_DUMP_IB_MAC_RSP(ib_mac_rsp);
1996 2024
1997 /* Frame error, so drop the packet. */
1998 if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) {
1999 ql_categorize_rx_err(qdev, ib_mac_rsp->flags2);
2000 return (unsigned long)length;
2001 }
2002
2003 if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { 2025 if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) {
2004 /* The data and headers are split into 2026 /* The data and headers are split into
2005 * separate buffers. 2027 * separate buffers.
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 5cf8d03b8cae..25c364209a21 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1520,7 +1520,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
1520 memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); 1520 memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);
1521 1521
1522 if (data->dual_emac) { 1522 if (data->dual_emac) {
1523 if (of_property_read_u32(node, "dual_emac_res_vlan", 1523 if (of_property_read_u32(slave_node, "dual_emac_res_vlan",
1524 &prop)) { 1524 &prop)) {
1525 pr_err("Missing dual_emac_res_vlan in DT.\n"); 1525 pr_err("Missing dual_emac_res_vlan in DT.\n");
1526 slave_data->dual_emac_res_vlan = i+1; 1526 slave_data->dual_emac_res_vlan = i+1;
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 4559bb8115bf..088c55496191 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
62static void rndis_filter_send_completion(void *ctx); 62static void rndis_filter_send_completion(void *ctx);
63 63
64static void rndis_filter_send_request_completion(void *ctx);
65
66
67 64
68static struct rndis_device *get_rndis_device(void) 65static 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
1004static void rndis_filter_send_request_completion(void *ctx)
1005{
1006 /* Noop */
1007}
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 316c759bd988..66109a2ad886 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/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index cc6dfe4102fd..c96454434f7b 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -134,7 +134,7 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb
134 goto error; 134 goto error;
135 135
136 if (skb) { 136 if (skb) {
137 if (skb->len <= sizeof(ETH_HLEN)) 137 if (skb->len <= ETH_HLEN)
138 goto error; 138 goto error;
139 139
140 /* mapping VLANs to MBIM sessions: 140 /* mapping VLANs to MBIM sessions:
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 968d5d50751d..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 */
57static 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 */
79static 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);
110fix_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 */
116static 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 */
122static 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
136static 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 */
56static int qmi_wwan_manage_power(struct usbnet *dev, int on) 147static int qmi_wwan_manage_power(struct usbnet *dev, int on)
57{ 148{
@@ -229,6 +320,18 @@ next_desc:
229 usb_driver_release_interface(driver, info->data); 320 usb_driver_release_interface(driver, info->data);
230 } 321 }
231 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;
232err: 335err:
233 return status; 336 return status;
234} 337}
@@ -307,6 +410,7 @@ static const struct driver_info qmi_wwan_info = {
307 .bind = qmi_wwan_bind, 410 .bind = qmi_wwan_bind,
308 .unbind = qmi_wwan_unbind, 411 .unbind = qmi_wwan_unbind,
309 .manage_power = qmi_wwan_manage_power, 412 .manage_power = qmi_wwan_manage_power,
413 .rx_fixup = qmi_wwan_rx_fixup,
310}; 414};
311 415
312#define HUAWEI_VENDOR_ID 0x12D1 416#define HUAWEI_VENDOR_ID 0x12D1
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/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index f9339e7ea6af..63cca9c2bf97 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -5161,7 +5161,8 @@ static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid)
5161#endif 5161#endif
5162#ifdef CONFIG_B43_SSB 5162#ifdef CONFIG_B43_SSB
5163 case B43_BUS_SSB: 5163 case B43_BUS_SSB:
5164 /* FIXME */ 5164 ssb_pmu_spuravoid_pllupdate(&dev->dev->sdev->bus->chipco,
5165 avoid);
5165 break; 5166 break;
5166#endif 5167#endif
5167 } 5168 }
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 62699203869d..e4f1f3c9575a 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -4078,10 +4078,6 @@ static const struct ieee80211_iface_limit brcmf_iface_limits[] = {
4078 }, 4078 },
4079 { 4079 {
4080 .max = 1, 4080 .max = 1,
4081 .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
4082 },
4083 {
4084 .max = 1,
4085 .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | 4081 .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
4086 BIT(NL80211_IFTYPE_P2P_GO) 4082 BIT(NL80211_IFTYPE_P2P_GO)
4087 }, 4083 },
@@ -4142,8 +4138,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev)
4142 BIT(NL80211_IFTYPE_ADHOC) | 4138 BIT(NL80211_IFTYPE_ADHOC) |
4143 BIT(NL80211_IFTYPE_AP) | 4139 BIT(NL80211_IFTYPE_AP) |
4144 BIT(NL80211_IFTYPE_P2P_CLIENT) | 4140 BIT(NL80211_IFTYPE_P2P_CLIENT) |
4145 BIT(NL80211_IFTYPE_P2P_GO) | 4141 BIT(NL80211_IFTYPE_P2P_GO);
4146 BIT(NL80211_IFTYPE_P2P_DEVICE);
4147 wiphy->iface_combinations = brcmf_iface_combos; 4142 wiphy->iface_combinations = brcmf_iface_combos;
4148 wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); 4143 wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos);
4149 wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; 4144 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 cd837860cd42..c837be242cba 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -276,6 +276,130 @@ static void brcms_set_basic_rate(struct brcm_rateset *rs, u16 rate, bool is_br)
276 } 276 }
277} 277}
278 278
279/**
280 * This function frees the WL per-device resources.
281 *
282 * This function frees resources owned by the WL device pointed to
283 * by the wl parameter.
284 *
285 * precondition: can both be called locked and unlocked
286 *
287 */
288static void brcms_free(struct brcms_info *wl)
289{
290 struct brcms_timer *t, *next;
291
292 /* free ucode data */
293 if (wl->fw.fw_cnt)
294 brcms_ucode_data_free(&wl->ucode);
295 if (wl->irq)
296 free_irq(wl->irq, wl);
297
298 /* kill dpc */
299 tasklet_kill(&wl->tasklet);
300
301 if (wl->pub) {
302 brcms_debugfs_detach(wl->pub);
303 brcms_c_module_unregister(wl->pub, "linux", wl);
304 }
305
306 /* free common resources */
307 if (wl->wlc) {
308 brcms_c_detach(wl->wlc);
309 wl->wlc = NULL;
310 wl->pub = NULL;
311 }
312
313 /* virtual interface deletion is deferred so we cannot spinwait */
314
315 /* wait for all pending callbacks to complete */
316 while (atomic_read(&wl->callbacks) > 0)
317 schedule();
318
319 /* free timers */
320 for (t = wl->timers; t; t = next) {
321 next = t->next;
322#ifdef DEBUG
323 kfree(t->name);
324#endif
325 kfree(t);
326 }
327}
328
329/*
330* called from both kernel as from this kernel module (error flow on attach)
331* precondition: perimeter lock is not acquired.
332*/
333static void brcms_remove(struct bcma_device *pdev)
334{
335 struct ieee80211_hw *hw = bcma_get_drvdata(pdev);
336 struct brcms_info *wl = hw->priv;
337
338 if (wl->wlc) {
339 wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false);
340 wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy);
341 ieee80211_unregister_hw(hw);
342 }
343
344 brcms_free(wl);
345
346 bcma_set_drvdata(pdev, NULL);
347 ieee80211_free_hw(hw);
348}
349
350/*
351 * Precondition: Since this function is called in brcms_pci_probe() context,
352 * no locking is required.
353 */
354static void brcms_release_fw(struct brcms_info *wl)
355{
356 int i;
357 for (i = 0; i < MAX_FW_IMAGES; i++) {
358 release_firmware(wl->fw.fw_bin[i]);
359 release_firmware(wl->fw.fw_hdr[i]);
360 }
361}
362
363/*
364 * Precondition: Since this function is called in brcms_pci_probe() context,
365 * no locking is required.
366 */
367static int brcms_request_fw(struct brcms_info *wl, struct bcma_device *pdev)
368{
369 int status;
370 struct device *device = &pdev->dev;
371 char fw_name[100];
372 int i;
373
374 memset(&wl->fw, 0, sizeof(struct brcms_firmware));
375 for (i = 0; i < MAX_FW_IMAGES; i++) {
376 if (brcms_firmwares[i] == NULL)
377 break;
378 sprintf(fw_name, "%s-%d.fw", brcms_firmwares[i],
379 UCODE_LOADER_API_VER);
380 status = request_firmware(&wl->fw.fw_bin[i], fw_name, device);
381 if (status) {
382 wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n",
383 KBUILD_MODNAME, fw_name);
384 return status;
385 }
386 sprintf(fw_name, "%s_hdr-%d.fw", brcms_firmwares[i],
387 UCODE_LOADER_API_VER);
388 status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device);
389 if (status) {
390 wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n",
391 KBUILD_MODNAME, fw_name);
392 return status;
393 }
394 wl->fw.hdr_num_entries[i] =
395 wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr));
396 }
397 wl->fw.fw_cnt = i;
398 status = brcms_ucode_data_init(wl, &wl->ucode);
399 brcms_release_fw(wl);
400 return status;
401}
402
279static void brcms_ops_tx(struct ieee80211_hw *hw, 403static void brcms_ops_tx(struct ieee80211_hw *hw,
280 struct ieee80211_tx_control *control, 404 struct ieee80211_tx_control *control,
281 struct sk_buff *skb) 405 struct sk_buff *skb)
@@ -308,6 +432,14 @@ static int brcms_ops_start(struct ieee80211_hw *hw)
308 if (!blocked) 432 if (!blocked)
309 wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); 433 wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy);
310 434
435 if (!wl->ucode.bcm43xx_bomminor) {
436 err = brcms_request_fw(wl, wl->wlc->hw->d11core);
437 if (err) {
438 brcms_remove(wl->wlc->hw->d11core);
439 return -ENOENT;
440 }
441 }
442
311 spin_lock_bh(&wl->lock); 443 spin_lock_bh(&wl->lock);
312 /* avoid acknowledging frames before a non-monitor device is added */ 444 /* avoid acknowledging frames before a non-monitor device is added */
313 wl->mute_tx = true; 445 wl->mute_tx = true;
@@ -856,129 +988,6 @@ void brcms_dpc(unsigned long data)
856 wake_up(&wl->tx_flush_wq); 988 wake_up(&wl->tx_flush_wq);
857} 989}
858 990
859/*
860 * Precondition: Since this function is called in brcms_pci_probe() context,
861 * no locking is required.
862 */
863static int brcms_request_fw(struct brcms_info *wl, struct bcma_device *pdev)
864{
865 int status;
866 struct device *device = &pdev->dev;
867 char fw_name[100];
868 int i;
869
870 memset(&wl->fw, 0, sizeof(struct brcms_firmware));
871 for (i = 0; i < MAX_FW_IMAGES; i++) {
872 if (brcms_firmwares[i] == NULL)
873 break;
874 sprintf(fw_name, "%s-%d.fw", brcms_firmwares[i],
875 UCODE_LOADER_API_VER);
876 status = request_firmware(&wl->fw.fw_bin[i], fw_name, device);
877 if (status) {
878 wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n",
879 KBUILD_MODNAME, fw_name);
880 return status;
881 }
882 sprintf(fw_name, "%s_hdr-%d.fw", brcms_firmwares[i],
883 UCODE_LOADER_API_VER);
884 status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device);
885 if (status) {
886 wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n",
887 KBUILD_MODNAME, fw_name);
888 return status;
889 }
890 wl->fw.hdr_num_entries[i] =
891 wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr));
892 }
893 wl->fw.fw_cnt = i;
894 return brcms_ucode_data_init(wl, &wl->ucode);
895}
896
897/*
898 * Precondition: Since this function is called in brcms_pci_probe() context,
899 * no locking is required.
900 */
901static void brcms_release_fw(struct brcms_info *wl)
902{
903 int i;
904 for (i = 0; i < MAX_FW_IMAGES; i++) {
905 release_firmware(wl->fw.fw_bin[i]);
906 release_firmware(wl->fw.fw_hdr[i]);
907 }
908}
909
910/**
911 * This function frees the WL per-device resources.
912 *
913 * This function frees resources owned by the WL device pointed to
914 * by the wl parameter.
915 *
916 * precondition: can both be called locked and unlocked
917 *
918 */
919static void brcms_free(struct brcms_info *wl)
920{
921 struct brcms_timer *t, *next;
922
923 /* free ucode data */
924 if (wl->fw.fw_cnt)
925 brcms_ucode_data_free(&wl->ucode);
926 if (wl->irq)
927 free_irq(wl->irq, wl);
928
929 /* kill dpc */
930 tasklet_kill(&wl->tasklet);
931
932 if (wl->pub) {
933 brcms_debugfs_detach(wl->pub);
934 brcms_c_module_unregister(wl->pub, "linux", wl);
935 }
936
937 /* free common resources */
938 if (wl->wlc) {
939 brcms_c_detach(wl->wlc);
940 wl->wlc = NULL;
941 wl->pub = NULL;
942 }
943
944 /* virtual interface deletion is deferred so we cannot spinwait */
945
946 /* wait for all pending callbacks to complete */
947 while (atomic_read(&wl->callbacks) > 0)
948 schedule();
949
950 /* free timers */
951 for (t = wl->timers; t; t = next) {
952 next = t->next;
953#ifdef DEBUG
954 kfree(t->name);
955#endif
956 kfree(t);
957 }
958}
959
960/*
961* called from both kernel as from this kernel module (error flow on attach)
962* precondition: perimeter lock is not acquired.
963*/
964static void brcms_remove(struct bcma_device *pdev)
965{
966 struct ieee80211_hw *hw = bcma_get_drvdata(pdev);
967 struct brcms_info *wl = hw->priv;
968
969 if (wl->wlc) {
970 brcms_led_unregister(wl);
971 wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false);
972 wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy);
973 ieee80211_unregister_hw(hw);
974 }
975
976 brcms_free(wl);
977
978 bcma_set_drvdata(pdev, NULL);
979 ieee80211_free_hw(hw);
980}
981
982static irqreturn_t brcms_isr(int irq, void *dev_id) 991static irqreturn_t brcms_isr(int irq, void *dev_id)
983{ 992{
984 struct brcms_info *wl; 993 struct brcms_info *wl;
@@ -1120,18 +1129,8 @@ static struct brcms_info *brcms_attach(struct bcma_device *pdev)
1120 spin_lock_init(&wl->lock); 1129 spin_lock_init(&wl->lock);
1121 spin_lock_init(&wl->isr_lock); 1130 spin_lock_init(&wl->isr_lock);
1122 1131
1123 /* prepare ucode */
1124 if (brcms_request_fw(wl, pdev) < 0) {
1125 wiphy_err(wl->wiphy, "%s: Failed to find firmware usually in "
1126 "%s\n", KBUILD_MODNAME, "/lib/firmware/brcm");
1127 brcms_release_fw(wl);
1128 brcms_remove(pdev);
1129 return NULL;
1130 }
1131
1132 /* common load-time initialization */ 1132 /* common load-time initialization */
1133 wl->wlc = brcms_c_attach((void *)wl, pdev, unit, false, &err); 1133 wl->wlc = brcms_c_attach((void *)wl, pdev, unit, false, &err);
1134 brcms_release_fw(wl);
1135 if (!wl->wlc) { 1134 if (!wl->wlc) {
1136 wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n", 1135 wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n",
1137 KBUILD_MODNAME, err); 1136 KBUILD_MODNAME, err);