Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

Conflicts:
drivers/net/bnx2x_main.c

Merge bnx2x bug fixes in by hand... :-/

Signed-off-by: David S. Miller <davem@davemloft.net>

+147 -32
+4
drivers/net/bnx2x/bnx2x.h
··· 863 863 864 864 /* used to synchronize stats collecting */ 865 865 int stats_state; 866 + 867 + /* used for synchronization of concurrent threads statistics handling */ 868 + spinlock_t stats_lock; 869 + 866 870 /* used by dmae command loader */ 867 871 struct dmae_command stats_dmae; 868 872 int executer_idx;
+1
drivers/net/bnx2x/bnx2x_main.c
··· 6714 6714 6715 6715 mutex_init(&bp->port.phy_mutex); 6716 6716 mutex_init(&bp->fw_mb_mutex); 6717 + spin_lock_init(&bp->stats_lock); 6717 6718 #ifdef BCM_CNIC 6718 6719 mutex_init(&bp->cnic_mutex); 6719 6720 #endif
+24 -13
drivers/net/bnx2x/bnx2x_stats.c
··· 156 156 struct eth_query_ramrod_data ramrod_data = {0}; 157 157 int i, rc; 158 158 159 + spin_lock_bh(&bp->stats_lock); 160 + 159 161 ramrod_data.drv_counter = bp->stats_counter++; 160 162 ramrod_data.collect_port = bp->port.pmf ? 1 : 0; 161 163 for_each_queue(bp, i) ··· 171 169 bp->spq_left++; 172 170 bp->stats_pending = 1; 173 171 } 172 + 173 + spin_unlock_bh(&bp->stats_lock); 174 174 } 175 175 } 176 176 ··· 738 734 struct host_func_stats *fstats = bnx2x_sp(bp, func_stats); 739 735 struct bnx2x_eth_stats *estats = &bp->eth_stats; 740 736 int i; 737 + u16 cur_stats_counter; 738 + 739 + /* Make sure we use the value of the counter 740 + * used for sending the last stats ramrod. 741 + */ 742 + spin_lock_bh(&bp->stats_lock); 743 + cur_stats_counter = bp->stats_counter - 1; 744 + spin_unlock_bh(&bp->stats_lock); 741 745 742 746 memcpy(&(fstats->total_bytes_received_hi), 743 747 &(bnx2x_sp(bp, func_stats_base)->total_bytes_received_hi), ··· 773 761 u32 diff; 774 762 775 763 /* are storm stats valid? */ 776 - if ((u16)(le16_to_cpu(xclient->stats_counter) + 1) != 777 - bp->stats_counter) { 764 + if (le16_to_cpu(xclient->stats_counter) != cur_stats_counter) { 778 765 DP(BNX2X_MSG_STATS, "[%d] stats not updated by xstorm" 779 766 " xstorm counter (0x%x) != stats_counter (0x%x)\n", 780 - i, xclient->stats_counter, bp->stats_counter); 767 + i, xclient->stats_counter, cur_stats_counter + 1); 781 768 return -1; 782 769 } 783 - if ((u16)(le16_to_cpu(tclient->stats_counter) + 1) != 784 - bp->stats_counter) { 770 + if (le16_to_cpu(tclient->stats_counter) != cur_stats_counter) { 785 771 DP(BNX2X_MSG_STATS, "[%d] stats not updated by tstorm" 786 772 " tstorm counter (0x%x) != stats_counter (0x%x)\n", 787 - i, tclient->stats_counter, bp->stats_counter); 773 + i, tclient->stats_counter, cur_stats_counter + 1); 788 774 return -2; 789 775 } 790 - if ((u16)(le16_to_cpu(uclient->stats_counter) + 1) != 791 - bp->stats_counter) { 776 + if (le16_to_cpu(uclient->stats_counter) != cur_stats_counter) { 792 777 DP(BNX2X_MSG_STATS, "[%d] stats not updated by ustorm" 793 778 " ustorm counter (0x%x) != stats_counter (0x%x)\n", 794 - i, uclient->stats_counter, bp->stats_counter); 779 + i, uclient->stats_counter, cur_stats_counter + 1); 795 780 return -4; 796 781 } 797 782 ··· 1225 1216 1226 1217 void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) 1227 1218 { 1228 - enum bnx2x_stats_state state = bp->stats_state; 1219 + enum bnx2x_stats_state state; 1229 1220 1230 1221 if (unlikely(bp->panic)) 1231 1222 return; 1232 1223 1233 - bnx2x_stats_stm[state][event].action(bp); 1224 + /* Protect a state change flow */ 1225 + spin_lock_bh(&bp->stats_lock); 1226 + state = bp->stats_state; 1234 1227 bp->stats_state = bnx2x_stats_stm[state][event].next_state; 1228 + spin_unlock_bh(&bp->stats_lock); 1235 1229 1236 - /* Make sure the state has been "changed" */ 1237 - smp_wmb(); 1230 + bnx2x_stats_stm[state][event].action(bp); 1238 1231 1239 1232 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) 1240 1233 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
+1 -1
drivers/net/bonding/bond_alb.c
··· 815 815 816 816 /*initialize packet type*/ 817 817 pk_type->type = cpu_to_be16(ETH_P_ARP); 818 - pk_type->dev = NULL; 818 + pk_type->dev = bond->dev; 819 819 pk_type->func = rlb_arp_recv; 820 820 821 821 /* register to receive ARPs */
+9
drivers/net/igb/igb_main.c
··· 1722 1722 u16 eeprom_apme_mask = IGB_EEPROM_APME; 1723 1723 u32 part_num; 1724 1724 1725 + /* Catch broken hardware that put the wrong VF device ID in 1726 + * the PCIe SR-IOV capability. 1727 + */ 1728 + if (pdev->is_virtfn) { 1729 + WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n", 1730 + pci_name(pdev), pdev->vendor, pdev->device); 1731 + return -EINVAL; 1732 + } 1733 + 1725 1734 err = pci_enable_device_mem(pdev); 1726 1735 if (err) 1727 1736 return err;
+9
drivers/net/ixgbe/ixgbe_main.c
··· 6539 6539 #endif 6540 6540 u32 part_num, eec; 6541 6541 6542 + /* Catch broken hardware that put the wrong VF device ID in 6543 + * the PCIe SR-IOV capability. 6544 + */ 6545 + if (pdev->is_virtfn) { 6546 + WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n", 6547 + pci_name(pdev), pdev->vendor, pdev->device); 6548 + return -EINVAL; 6549 + } 6550 + 6542 6551 err = pci_enable_device_mem(pdev); 6543 6552 if (err) 6544 6553 return err;
+8 -2
drivers/net/macvlan.c
··· 515 515 .ndo_validate_addr = eth_validate_addr, 516 516 }; 517 517 518 - static void macvlan_setup(struct net_device *dev) 518 + void macvlan_common_setup(struct net_device *dev) 519 519 { 520 520 ether_setup(dev); 521 521 ··· 524 524 dev->destructor = free_netdev; 525 525 dev->header_ops = &macvlan_hard_header_ops, 526 526 dev->ethtool_ops = &macvlan_ethtool_ops; 527 + } 528 + EXPORT_SYMBOL_GPL(macvlan_common_setup); 529 + 530 + static void macvlan_setup(struct net_device *dev) 531 + { 532 + macvlan_common_setup(dev); 527 533 dev->tx_queue_len = 0; 528 534 } 529 535 ··· 741 735 /* common fields */ 742 736 ops->priv_size = sizeof(struct macvlan_dev); 743 737 ops->get_tx_queues = macvlan_get_tx_queues; 744 - ops->setup = macvlan_setup; 745 738 ops->validate = macvlan_validate; 746 739 ops->maxtype = IFLA_MACVLAN_MAX; 747 740 ops->policy = macvlan_policy; ··· 754 749 755 750 static struct rtnl_link_ops macvlan_link_ops = { 756 751 .kind = "macvlan", 752 + .setup = macvlan_setup, 757 753 .newlink = macvlan_newlink, 758 754 .dellink = macvlan_dellink, 759 755 };
+16 -2
drivers/net/macvtap.c
··· 180 180 { 181 181 struct macvtap_queue *q = macvtap_get_queue(dev, skb); 182 182 if (!q) 183 - return -ENOLINK; 183 + goto drop; 184 + 185 + if (skb_queue_len(&q->sk.sk_receive_queue) >= dev->tx_queue_len) 186 + goto drop; 184 187 185 188 skb_queue_tail(&q->sk.sk_receive_queue, skb); 186 189 wake_up_interruptible_poll(sk_sleep(&q->sk), POLLIN | POLLRDNORM | POLLRDBAND); 187 - return 0; 190 + return NET_RX_SUCCESS; 191 + 192 + drop: 193 + kfree_skb(skb); 194 + return NET_RX_DROP; 188 195 } 189 196 190 197 /* ··· 242 235 macvlan_dellink(dev, head); 243 236 } 244 237 238 + static void macvtap_setup(struct net_device *dev) 239 + { 240 + macvlan_common_setup(dev); 241 + dev->tx_queue_len = TUN_READQ_SIZE; 242 + } 243 + 245 244 static struct rtnl_link_ops macvtap_link_ops __read_mostly = { 246 245 .kind = "macvtap", 246 + .setup = macvtap_setup, 247 247 .newlink = macvtap_newlink, 248 248 .dellink = macvtap_dellink, 249 249 };
+1 -1
drivers/net/s2io.h
··· 65 65 66 66 /* DEBUG message print. */ 67 67 #define DBG_PRINT(dbg_level, fmt, args...) do { \ 68 - if (dbg_level >= debug_level) \ 68 + if (dbg_level <= debug_level) \ 69 69 pr_info(fmt, ##args); \ 70 70 } while (0) 71 71
+12 -2
drivers/net/tun.c
··· 736 736 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; 737 737 else if (sinfo->gso_type & SKB_GSO_UDP) 738 738 gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; 739 - else 740 - BUG(); 739 + else { 740 + printk(KERN_ERR "tun: unexpected GSO type: " 741 + "0x%x, gso_size %d, hdr_len %d\n", 742 + sinfo->gso_type, gso.gso_size, 743 + gso.hdr_len); 744 + print_hex_dump(KERN_ERR, "tun: ", 745 + DUMP_PREFIX_NONE, 746 + 16, 1, skb->head, 747 + min((int)gso.hdr_len, 64), true); 748 + WARN_ON_ONCE(1); 749 + return -EINVAL; 750 + } 741 751 if (sinfo->gso_type & SKB_GSO_TCP_ECN) 742 752 gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN; 743 753 } else
+1
drivers/net/wimax/i2400m/i2400m-usb.h
··· 152 152 /* Device IDs */ 153 153 USB_DEVICE_ID_I6050 = 0x0186, 154 154 USB_DEVICE_ID_I6050_2 = 0x0188, 155 + USB_DEVICE_ID_I6250 = 0x0187, 155 156 }; 156 157 157 158
+2
drivers/net/wimax/i2400m/usb.c
··· 491 491 switch (id->idProduct) { 492 492 case USB_DEVICE_ID_I6050: 493 493 case USB_DEVICE_ID_I6050_2: 494 + case USB_DEVICE_ID_I6250: 494 495 i2400mu->i6050 = 1; 495 496 break; 496 497 default: ··· 740 739 struct usb_device_id i2400mu_id_table[] = { 741 740 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) }, 742 741 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2) }, 742 + { USB_DEVICE(0x8086, USB_DEVICE_ID_I6250) }, 743 743 { USB_DEVICE(0x8086, 0x0181) }, 744 744 { USB_DEVICE(0x8086, 0x1403) }, 745 745 { USB_DEVICE(0x8086, 0x1405) },
+2
include/linux/if_macvlan.h
··· 72 72 } 73 73 } 74 74 75 + extern void macvlan_common_setup(struct net_device *dev); 76 + 75 77 extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, 76 78 struct nlattr *tb[], struct nlattr *data[], 77 79 int (*receive)(struct sk_buff *skb),
+1
include/net/tc_act/tc_mirred.h
··· 9 9 int tcfm_ifindex; 10 10 int tcfm_ok_push; 11 11 struct net_device *tcfm_dev; 12 + struct list_head tcfm_list; 12 13 }; 13 14 #define to_mirred(pc) \ 14 15 container_of(pc, struct tcf_mirred, common)
+1
net/core/dev.c
··· 1484 1484 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) 1485 1485 { 1486 1486 skb_orphan(skb); 1487 + nf_reset(skb); 1487 1488 1488 1489 if (!(dev->flags & IFF_UP) || 1489 1490 (skb->len > (dev->mtu + dev->hard_header_len))) {
+5 -2
net/core/skbuff.c
··· 843 843 skb->network_header += off; 844 844 if (skb_mac_header_was_set(skb)) 845 845 skb->mac_header += off; 846 - skb->csum_start += nhead; 846 + /* Only adjust this if it actually is csum_start rather than csum */ 847 + if (skb->ip_summed == CHECKSUM_PARTIAL) 848 + skb->csum_start += nhead; 847 849 skb->cloned = 0; 848 850 skb->hdr_len = 0; 849 851 skb->nohdr = 0; ··· 932 930 copy_skb_header(n, skb); 933 931 934 932 off = newheadroom - oldheadroom; 935 - n->csum_start += off; 933 + if (n->ip_summed == CHECKSUM_PARTIAL) 934 + n->csum_start += off; 936 935 #ifdef NET_SKBUFF_DATA_USES_OFFSET 937 936 n->transport_header += off; 938 937 n->network_header += off;
+9 -5
net/ipv6/addrconf.c
··· 1763 1763 1764 1764 idev = ipv6_find_idev(dev); 1765 1765 if (!idev) 1766 - return NULL; 1766 + return ERR_PTR(-ENOBUFS); 1767 + 1768 + if (idev->cnf.disable_ipv6) 1769 + return ERR_PTR(-EACCES); 1767 1770 1768 1771 /* Add default multicast route */ 1769 1772 addrconf_add_mroute(dev); ··· 2135 2132 if (!dev) 2136 2133 return -ENODEV; 2137 2134 2138 - if ((idev = addrconf_add_dev(dev)) == NULL) 2139 - return -ENOBUFS; 2135 + idev = addrconf_add_dev(dev); 2136 + if (IS_ERR(idev)) 2137 + return PTR_ERR(idev); 2140 2138 2141 2139 scope = ipv6_addr_scope(pfx); 2142 2140 ··· 2384 2380 } 2385 2381 2386 2382 idev = addrconf_add_dev(dev); 2387 - if (idev == NULL) 2383 + if (IS_ERR(idev)) 2388 2384 return; 2389 2385 2390 2386 memset(&addr, 0, sizeof(struct in6_addr)); ··· 2475 2471 ASSERT_RTNL(); 2476 2472 2477 2473 idev = addrconf_add_dev(dev); 2478 - if (!idev) { 2474 + if (IS_ERR(idev)) { 2479 2475 printk(KERN_DEBUG "init ip6-ip6: add_dev failed\n"); 2480 2476 return; 2481 2477 }
+1 -1
net/mac80211/cfg.c
··· 632 632 skb->dev = sta->sdata->dev; 633 633 skb->protocol = eth_type_trans(skb, sta->sdata->dev); 634 634 memset(skb->cb, 0, sizeof(skb->cb)); 635 - netif_rx(skb); 635 + netif_rx_ni(skb); 636 636 } 637 637 638 638 static void sta_apply_parameters(struct ieee80211_local *local,
+40 -3
net/sched/act_mirred.c
··· 33 33 static struct tcf_common *tcf_mirred_ht[MIRRED_TAB_MASK + 1]; 34 34 static u32 mirred_idx_gen; 35 35 static DEFINE_RWLOCK(mirred_lock); 36 + static LIST_HEAD(mirred_list); 36 37 37 38 static struct tcf_hashinfo mirred_hash_info = { 38 39 .htab = tcf_mirred_ht, ··· 48 47 m->tcf_bindcnt--; 49 48 m->tcf_refcnt--; 50 49 if(!m->tcf_bindcnt && m->tcf_refcnt <= 0) { 51 - dev_put(m->tcfm_dev); 50 + list_del(&m->tcfm_list); 51 + if (m->tcfm_dev) 52 + dev_put(m->tcfm_dev); 52 53 tcf_hash_destroy(&m->common, &mirred_hash_info); 53 54 return 1; 54 55 } ··· 137 134 m->tcfm_ok_push = ok_push; 138 135 } 139 136 spin_unlock_bh(&m->tcf_lock); 140 - if (ret == ACT_P_CREATED) 137 + if (ret == ACT_P_CREATED) { 138 + list_add(&m->tcfm_list, &mirred_list); 141 139 tcf_hash_insert(pc, &mirred_hash_info); 140 + } 142 141 143 142 return ret; 144 143 } ··· 169 164 m->tcf_bstats.packets++; 170 165 171 166 dev = m->tcfm_dev; 167 + if (!dev) { 168 + printk_once(KERN_NOTICE "tc mirred: target device is gone\n"); 169 + goto out; 170 + } 171 + 172 172 if (!(dev->flags & IFF_UP)) { 173 173 if (net_ratelimit()) 174 - pr_notice("tc mirred to Houston: device %s is gone!\n", 174 + pr_notice("tc mirred to Houston: device %s is down\n", 175 175 dev->name); 176 176 goto out; 177 177 } ··· 240 230 return -1; 241 231 } 242 232 233 + static int mirred_device_event(struct notifier_block *unused, 234 + unsigned long event, void *ptr) 235 + { 236 + struct net_device *dev = ptr; 237 + struct tcf_mirred *m; 238 + 239 + if (event == NETDEV_UNREGISTER) 240 + list_for_each_entry(m, &mirred_list, tcfm_list) { 241 + if (m->tcfm_dev == dev) { 242 + dev_put(dev); 243 + m->tcfm_dev = NULL; 244 + } 245 + } 246 + 247 + return NOTIFY_DONE; 248 + } 249 + 250 + static struct notifier_block mirred_device_notifier = { 251 + .notifier_call = mirred_device_event, 252 + }; 253 + 254 + 243 255 static struct tc_action_ops act_mirred_ops = { 244 256 .kind = "mirred", 245 257 .hinfo = &mirred_hash_info, ··· 282 250 283 251 static int __init mirred_init_module(void) 284 252 { 253 + int err = register_netdevice_notifier(&mirred_device_notifier); 254 + if (err) 255 + return err; 256 + 285 257 pr_info("Mirror/redirect action on\n"); 286 258 return tcf_register_action(&act_mirred_ops); 287 259 } 288 260 289 261 static void __exit mirred_cleanup_module(void) 290 262 { 263 + unregister_netdevice_notifier(&mirred_device_notifier); 291 264 tcf_unregister_action(&act_mirred_ops); 292 265 } 293 266