aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 11:39:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 11:39:24 -0400
commit53ee7569ce8beb3fd3fc0817116c29298d72353f (patch)
treef3dcce10508c2126347e40b468fd6d3c3cc7006a /drivers/net
parent4d9dec4db2efbd7edb549bd02373995b67496983 (diff)
parent1b6e2ceb4745b5838cb94463131d19dbea6cf0e3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (27 commits) bnx2x: allow device properly initialize after hotplug bnx2x: fix DMAE timeout according to hw specifications bnx2x: properly handle CFC DEL in cnic flow bnx2x: call dev_kfree_skb_any instead of dev_kfree_skb net: filter: move forward declarations to avoid compile warnings pktgen: refactor pg_init() code pktgen: use vzalloc_node() instead of vmalloc_node() + memset() net: skb_trim explicitely check the linearity instead of data_len ipv4: Give backtrace in ip_rt_bug(). net: avoid synchronize_rcu() in dev_deactivate_many net: remove synchronize_net() from netdev_set_master() rtnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE bridge: call NETDEV_JOIN notifiers when add a slave netpoll: disable netpoll when enslave a device macvlan: Forward unicast frames in bridge mode to lowerdev net: Remove linux/prefetch.h include from linux/skbuff.h ipv4: Include linux/prefetch.h in fib_trie.c netlabel: Remove prefetches from list handlers. drivers/net: add prefetch header for prefetch users ... Fixed up prefetch parts: removed a few duplicate prefetch.h includes, fixed the location of the igb prefetch.h, took my version of the skbuff.h code without the extra parentheses etc.
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.c4
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.h2
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c72
-rw-r--r--drivers/net/bonding/bond_main.c4
-rw-r--r--drivers/net/macvlan.c6
-rw-r--r--drivers/net/netconsole.c26
-rw-r--r--drivers/net/rionet.c4
7 files changed, 54 insertions, 64 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index 64d01e728a9d..d5bd35b7f2e1 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -131,7 +131,7 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fastpath *fp,
131 131
132 /* release skb */ 132 /* release skb */
133 WARN_ON(!skb); 133 WARN_ON(!skb);
134 dev_kfree_skb(skb); 134 dev_kfree_skb_any(skb);
135 tx_buf->first_bd = 0; 135 tx_buf->first_bd = 0;
136 tx_buf->skb = NULL; 136 tx_buf->skb = NULL;
137 137
@@ -465,7 +465,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
465 } else { 465 } else {
466 DP(NETIF_MSG_RX_STATUS, "Failed to allocate new pages" 466 DP(NETIF_MSG_RX_STATUS, "Failed to allocate new pages"
467 " - dropping packet!\n"); 467 " - dropping packet!\n");
468 dev_kfree_skb(skb); 468 dev_kfree_skb_any(skb);
469 } 469 }
470 470
471 471
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h
index fab161e8030d..1a3545bd8a92 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/bnx2x/bnx2x_cmn.h
@@ -840,7 +840,7 @@ static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp,
840 mapping = dma_map_single(&bp->pdev->dev, skb->data, fp->rx_buf_size, 840 mapping = dma_map_single(&bp->pdev->dev, skb->data, fp->rx_buf_size,
841 DMA_FROM_DEVICE); 841 DMA_FROM_DEVICE);
842 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { 842 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
843 dev_kfree_skb(skb); 843 dev_kfree_skb_any(skb);
844 return -ENOMEM; 844 return -ENOMEM;
845 } 845 }
846 846
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index f45c0caf3240..a97d9be331d1 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -571,7 +571,7 @@ static int bnx2x_issue_dmae_with_comp(struct bnx2x *bp,
571 struct dmae_command *dmae) 571 struct dmae_command *dmae)
572{ 572{
573 u32 *wb_comp = bnx2x_sp(bp, wb_comp); 573 u32 *wb_comp = bnx2x_sp(bp, wb_comp);
574 int cnt = CHIP_REV_IS_SLOW(bp) ? (400000) : 40; 574 int cnt = CHIP_REV_IS_SLOW(bp) ? (400000) : 4000;
575 int rc = 0; 575 int rc = 0;
576 576
577 DP(BNX2X_MSG_OFF, "data before [0x%08x 0x%08x 0x%08x 0x%08x]\n", 577 DP(BNX2X_MSG_OFF, "data before [0x%08x 0x%08x 0x%08x 0x%08x]\n",
@@ -3666,7 +3666,8 @@ static int bnx2x_cnic_handle_cfc_del(struct bnx2x *bp, u32 cid,
3666 union event_ring_elem *elem) 3666 union event_ring_elem *elem)
3667{ 3667{
3668 if (!bp->cnic_eth_dev.starting_cid || 3668 if (!bp->cnic_eth_dev.starting_cid ||
3669 cid < bp->cnic_eth_dev.starting_cid) 3669 (cid < bp->cnic_eth_dev.starting_cid &&
3670 cid != bp->cnic_eth_dev.iscsi_l2_cid))
3670 return 1; 3671 return 1;
3671 3672
3672 DP(BNX2X_MSG_SP, "got delete ramrod for CNIC CID %d\n", cid); 3673 DP(BNX2X_MSG_SP, "got delete ramrod for CNIC CID %d\n", cid);
@@ -7287,51 +7288,35 @@ static inline void bnx2x_mcp_wait_one(struct bnx2x *bp)
7287 msleep(MCP_ONE_TIMEOUT); 7288 msleep(MCP_ONE_TIMEOUT);
7288} 7289}
7289 7290
7290static int bnx2x_reset_mcp_comp(struct bnx2x *bp, u32 magic_val) 7291/*
7292 * initializes bp->common.shmem_base and waits for validity signature to appear
7293 */
7294static int bnx2x_init_shmem(struct bnx2x *bp)
7291{ 7295{
7292 u32 shmem, cnt, validity_offset, val; 7296 int cnt = 0;
7293 int rc = 0; 7297 u32 val = 0;
7294
7295 msleep(100);
7296 7298
7297 /* Get shmem offset */ 7299 do {
7298 shmem = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR); 7300 bp->common.shmem_base = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR);
7299 if (shmem == 0) { 7301 if (bp->common.shmem_base) {
7300 BNX2X_ERR("Shmem 0 return failure\n"); 7302 val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]);
7301 rc = -ENOTTY; 7303 if (val & SHR_MEM_VALIDITY_MB)
7302 goto exit_lbl; 7304 return 0;
7303 } 7305 }
7304 7306
7305 validity_offset = offsetof(struct shmem_region, validity_map[0]); 7307 bnx2x_mcp_wait_one(bp);
7306 7308
7307 /* Wait for MCP to come up */ 7309 } while (cnt++ < (MCP_TIMEOUT / MCP_ONE_TIMEOUT));
7308 for (cnt = 0; cnt < (MCP_TIMEOUT / MCP_ONE_TIMEOUT); cnt++) {
7309 /* TBD: its best to check validity map of last port.
7310 * currently checks on port 0.
7311 */
7312 val = REG_RD(bp, shmem + validity_offset);
7313 DP(NETIF_MSG_HW, "shmem 0x%x validity map(0x%x)=0x%x\n", shmem,
7314 shmem + validity_offset, val);
7315 7310
7316 /* check that shared memory is valid. */ 7311 BNX2X_ERR("BAD MCP validity signature\n");
7317 if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
7318 == (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
7319 break;
7320 7312
7321 bnx2x_mcp_wait_one(bp); 7313 return -ENODEV;
7322 } 7314}
7323
7324 DP(NETIF_MSG_HW, "Cnt=%d Shmem validity map 0x%x\n", cnt, val);
7325 7315
7326 /* Check that shared memory is valid. This indicates that MCP is up. */ 7316static int bnx2x_reset_mcp_comp(struct bnx2x *bp, u32 magic_val)
7327 if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) != 7317{
7328 (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) { 7318 int rc = bnx2x_init_shmem(bp);
7329 BNX2X_ERR("Shmem signature not present. MCP is not up !!\n");
7330 rc = -ENOTTY;
7331 goto exit_lbl;
7332 }
7333 7319
7334exit_lbl:
7335 /* Restore the `magic' bit value */ 7320 /* Restore the `magic' bit value */
7336 if (!CHIP_IS_E1(bp)) 7321 if (!CHIP_IS_E1(bp))
7337 bnx2x_clp_reset_done(bp, magic_val); 7322 bnx2x_clp_reset_done(bp, magic_val);
@@ -7844,10 +7829,12 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
7844 BNX2X_DEV_INFO("flash_size 0x%x (%d)\n", 7829 BNX2X_DEV_INFO("flash_size 0x%x (%d)\n",
7845 bp->common.flash_size, bp->common.flash_size); 7830 bp->common.flash_size, bp->common.flash_size);
7846 7831
7847 bp->common.shmem_base = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR); 7832 bnx2x_init_shmem(bp);
7833
7848 bp->common.shmem2_base = REG_RD(bp, (BP_PATH(bp) ? 7834 bp->common.shmem2_base = REG_RD(bp, (BP_PATH(bp) ?
7849 MISC_REG_GENERIC_CR_1 : 7835 MISC_REG_GENERIC_CR_1 :
7850 MISC_REG_GENERIC_CR_0)); 7836 MISC_REG_GENERIC_CR_0));
7837
7851 bp->link_params.shmem_base = bp->common.shmem_base; 7838 bp->link_params.shmem_base = bp->common.shmem_base;
7852 bp->link_params.shmem2_base = bp->common.shmem2_base; 7839 bp->link_params.shmem2_base = bp->common.shmem2_base;
7853 BNX2X_DEV_INFO("shmem offset 0x%x shmem2 offset 0x%x\n", 7840 BNX2X_DEV_INFO("shmem offset 0x%x shmem2 offset 0x%x\n",
@@ -7859,11 +7846,6 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
7859 return; 7846 return;
7860 } 7847 }
7861 7848
7862 val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]);
7863 if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
7864 != (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB))
7865 BNX2X_ERR("BAD MCP validity signature\n");
7866
7867 bp->common.hw_config = SHMEM_RD(bp, dev_info.shared_hw_config.config); 7849 bp->common.hw_config = SHMEM_RD(bp, dev_info.shared_hw_config.config);
7868 BNX2X_DEV_INFO("hw_config 0x%08x\n", bp->common.hw_config); 7850 BNX2X_DEV_INFO("hw_config 0x%08x\n", bp->common.hw_config);
7869 7851
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 088fd845ffdf..6dc428461541 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1640,6 +1640,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1640 } 1640 }
1641 } 1641 }
1642 1642
1643 call_netdevice_notifiers(NETDEV_JOIN, slave_dev);
1644
1643 /* If this is the first slave, then we need to set the master's hardware 1645 /* If this is the first slave, then we need to set the master's hardware
1644 * address to be the same as the slave's. */ 1646 * address to be the same as the slave's. */
1645 if (is_zero_ether_addr(bond->dev->dev_addr)) 1647 if (is_zero_ether_addr(bond->dev->dev_addr))
@@ -1972,7 +1974,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1972 } 1974 }
1973 1975
1974 block_netpoll_tx(); 1976 block_netpoll_tx();
1975 netdev_bonding_change(bond_dev, NETDEV_BONDING_DESLAVE); 1977 netdev_bonding_change(bond_dev, NETDEV_RELEASE);
1976 write_lock_bh(&bond->lock); 1978 write_lock_bh(&bond->lock);
1977 1979
1978 slave = bond_get_slave_by_dev(bond, slave_dev); 1980 slave = bond_get_slave_by_dev(bond, slave_dev);
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index d72a70615c0f..d6aeaa5f25ea 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -238,10 +238,8 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
238 238
239 dest = macvlan_hash_lookup(port, eth->h_dest); 239 dest = macvlan_hash_lookup(port, eth->h_dest);
240 if (dest && dest->mode == MACVLAN_MODE_BRIDGE) { 240 if (dest && dest->mode == MACVLAN_MODE_BRIDGE) {
241 unsigned int length = skb->len + ETH_HLEN; 241 /* send to lowerdev first for its network taps */
242 int ret = dest->forward(dest->dev, skb); 242 vlan->forward(vlan->lowerdev, skb);
243 macvlan_count_rx(dest, length,
244 ret == NET_RX_SUCCESS, 0);
245 243
246 return NET_XMIT_SUCCESS; 244 return NET_XMIT_SUCCESS;
247 } 245 }
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index a83e101440fd..dfc82720065a 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -621,11 +621,10 @@ static int netconsole_netdev_event(struct notifier_block *this,
621 bool stopped = false; 621 bool stopped = false;
622 622
623 if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER || 623 if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER ||
624 event == NETDEV_BONDING_DESLAVE || event == NETDEV_GOING_DOWN)) 624 event == NETDEV_RELEASE || event == NETDEV_JOIN))
625 goto done; 625 goto done;
626 626
627 spin_lock_irqsave(&target_list_lock, flags); 627 spin_lock_irqsave(&target_list_lock, flags);
628restart:
629 list_for_each_entry(nt, &target_list, list) { 628 list_for_each_entry(nt, &target_list, list) {
630 netconsole_target_get(nt); 629 netconsole_target_get(nt);
631 if (nt->np.dev == dev) { 630 if (nt->np.dev == dev) {
@@ -633,6 +632,8 @@ restart:
633 case NETDEV_CHANGENAME: 632 case NETDEV_CHANGENAME:
634 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); 633 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
635 break; 634 break;
635 case NETDEV_RELEASE:
636 case NETDEV_JOIN:
636 case NETDEV_UNREGISTER: 637 case NETDEV_UNREGISTER:
637 /* 638 /*
638 * rtnl_lock already held 639 * rtnl_lock already held
@@ -647,11 +648,7 @@ restart:
647 dev_put(nt->np.dev); 648 dev_put(nt->np.dev);
648 nt->np.dev = NULL; 649 nt->np.dev = NULL;
649 netconsole_target_put(nt); 650 netconsole_target_put(nt);
650 goto restart;
651 } 651 }
652 /* Fall through */
653 case NETDEV_GOING_DOWN:
654 case NETDEV_BONDING_DESLAVE:
655 nt->enabled = 0; 652 nt->enabled = 0;
656 stopped = true; 653 stopped = true;
657 break; 654 break;
@@ -660,10 +657,21 @@ restart:
660 netconsole_target_put(nt); 657 netconsole_target_put(nt);
661 } 658 }
662 spin_unlock_irqrestore(&target_list_lock, flags); 659 spin_unlock_irqrestore(&target_list_lock, flags);
663 if (stopped && (event == NETDEV_UNREGISTER || event == NETDEV_BONDING_DESLAVE)) 660 if (stopped) {
664 printk(KERN_INFO "netconsole: network logging stopped on " 661 printk(KERN_INFO "netconsole: network logging stopped on "
665 "interface %s as it %s\n", dev->name, 662 "interface %s as it ", dev->name);
666 event == NETDEV_UNREGISTER ? "unregistered" : "released slaves"); 663 switch (event) {
664 case NETDEV_UNREGISTER:
665 printk(KERN_CONT "unregistered\n");
666 break;
667 case NETDEV_RELEASE:
668 printk(KERN_CONT "released slaves\n");
669 break;
670 case NETDEV_JOIN:
671 printk(KERN_CONT "is joining a master device\n");
672 break;
673 }
674 }
667 675
668done: 676done:
669 return NOTIFY_DONE; 677 return NOTIFY_DONE;
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index 26afbaae23f0..77c5092a6a40 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -162,8 +162,8 @@ static int rionet_queue_tx_msg(struct sk_buff *skb, struct net_device *ndev,
162 rnet->tx_slot &= (RIONET_TX_RING_SIZE - 1); 162 rnet->tx_slot &= (RIONET_TX_RING_SIZE - 1);
163 163
164 if (netif_msg_tx_queued(rnet)) 164 if (netif_msg_tx_queued(rnet))
165 printk(KERN_INFO "%s: queued skb %8.8x len %8.8x\n", DRV_NAME, 165 printk(KERN_INFO "%s: queued skb len %8.8x\n", DRV_NAME,
166 (u32) skb, skb->len); 166 skb->len);
167 167
168 return 0; 168 return 0;
169} 169}