]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/bnx2.c
p54: report appropriate rate and band values for 802.11a
[linux-2.6-omap-h63xx.git] / drivers / net / bnx2.c
index 5ebde67d4297451aa9019f97105f31c76f268f7f..883e0a724107c10c29f0eb13421f9db4a2d38963 100644 (file)
@@ -35,8 +35,8 @@
 #include <linux/time.h>
 #include <linux/ethtool.h>
 #include <linux/mii.h>
-#ifdef NETIF_F_HW_VLAN_TX
 #include <linux/if_vlan.h>
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 #define BCM_VLAN 1
 #endif
 #include <net/ip.h>
@@ -57,8 +57,8 @@
 
 #define DRV_MODULE_NAME                "bnx2"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.7.9"
-#define DRV_MODULE_RELDATE     "July 18, 2008"
+#define DRV_MODULE_VERSION     "1.8.0"
+#define DRV_MODULE_RELDATE     "Aug 14, 2008"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -69,7 +69,7 @@ static char version[] __devinitdata =
        "Broadcom NetXtreme II Gigabit Ethernet Driver " DRV_MODULE_NAME " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
 
 MODULE_AUTHOR("Michael Chan <mchan@broadcom.com>");
-MODULE_DESCRIPTION("Broadcom NetXtreme II BCM5706/5708/5709 Driver");
+MODULE_DESCRIPTION("Broadcom NetXtreme II BCM5706/5708/5709/5716 Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_MODULE_VERSION);
 
@@ -1127,7 +1127,7 @@ bnx2_init_all_rx_contexts(struct bnx2 *bp)
        }
 }
 
-static int
+static void
 bnx2_set_mac_link(struct bnx2 *bp)
 {
        u32 val;
@@ -1193,8 +1193,6 @@ bnx2_set_mac_link(struct bnx2 *bp)
 
        if (CHIP_NUM(bp) == CHIP_NUM_5709)
                bnx2_init_all_rx_contexts(bp);
-
-       return 0;
 }
 
 static void
@@ -2876,6 +2874,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
                struct sw_bd *rx_buf;
                struct sk_buff *skb;
                dma_addr_t dma_addr;
+               u16 vtag = 0;
+               int hw_vlan __maybe_unused = 0;
 
                sw_ring_cons = RX_RING_IDX(sw_cons);
                sw_ring_prod = RX_RING_IDX(sw_prod);
@@ -2919,7 +2919,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
                if (len <= bp->rx_copy_thresh) {
                        struct sk_buff *new_skb;
 
-                       new_skb = netdev_alloc_skb(bp->dev, len + 2);
+                       new_skb = netdev_alloc_skb(bp->dev, len + 6);
                        if (new_skb == NULL) {
                                bnx2_reuse_rx_skb(bp, rxr, skb, sw_ring_cons,
                                                  sw_ring_prod);
@@ -2928,9 +2928,9 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
 
                        /* aligned copy */
                        skb_copy_from_linear_data_offset(skb,
-                                                        BNX2_RX_OFFSET - 2,
-                                     new_skb->data, len + 2);
-                       skb_reserve(new_skb, 2);
+                                                        BNX2_RX_OFFSET - 6,
+                                     new_skb->data, len + 6);
+                       skb_reserve(new_skb, 6);
                        skb_put(new_skb, len);
 
                        bnx2_reuse_rx_skb(bp, rxr, skb,
@@ -2941,6 +2941,25 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
                           dma_addr, (sw_ring_cons << 16) | sw_ring_prod)))
                        goto next_rx;
 
+               if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) &&
+                   !(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) {
+                       vtag = rx_hdr->l2_fhdr_vlan_tag;
+#ifdef BCM_VLAN
+                       if (bp->vlgrp)
+                               hw_vlan = 1;
+                       else
+#endif
+                       {
+                               struct vlan_ethhdr *ve = (struct vlan_ethhdr *)
+                                       __skb_push(skb, 4);
+
+                               memmove(ve, skb->data + 4, ETH_ALEN * 2);
+                               ve->h_vlan_proto = htons(ETH_P_8021Q);
+                               ve->h_vlan_TCI = htons(vtag);
+                               len += 4;
+                       }
+               }
+
                skb->protocol = eth_type_trans(skb, bp->dev);
 
                if ((len > (bp->dev->mtu + ETH_HLEN)) &&
@@ -2962,10 +2981,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
                }
 
 #ifdef BCM_VLAN
-               if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && bp->vlgrp) {
-                       vlan_hwaccel_receive_skb(skb, bp->vlgrp,
-                               rx_hdr->l2_fhdr_vlan_tag);
-               }
+               if (hw_vlan)
+                       vlan_hwaccel_receive_skb(skb, bp->vlgrp, vtag);
                else
 #endif
                        netif_receive_skb(skb);
@@ -3237,10 +3254,10 @@ bnx2_set_rx_mode(struct net_device *dev)
                                  BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG);
        sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN;
 #ifdef BCM_VLAN
-       if (!bp->vlgrp && !(bp->flags & BNX2_FLAG_ASF_ENABLE))
+       if (!bp->vlgrp && (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN))
                rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG;
 #else
-       if (!(bp->flags & BNX2_FLAG_ASF_ENABLE))
+       if (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)
                rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG;
 #endif
        if (dev->flags & IFF_PROMISC) {
@@ -5581,7 +5598,7 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
        } else if ((bp->link_up == 0) && (bp->autoneg & AUTONEG_SPEED)) {
                u32 bmcr;
 
-               bp->current_interval = bp->timer_interval;
+               bp->current_interval = BNX2_TIMER_INTERVAL;
 
                bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
 
@@ -5610,7 +5627,7 @@ bnx2_5706_serdes_timer(struct bnx2 *bp)
                        bp->phy_flags &= ~BNX2_PHY_FLAG_PARALLEL_DETECT;
                }
        } else
-               bp->current_interval = bp->timer_interval;
+               bp->current_interval = BNX2_TIMER_INTERVAL;
 
        if (check_link) {
                u32 val;
@@ -5655,11 +5672,11 @@ bnx2_5708_serdes_timer(struct bnx2 *bp)
                } else {
                        bnx2_disable_forced_2g5(bp);
                        bp->serdes_an_pending = 2;
-                       bp->current_interval = bp->timer_interval;
+                       bp->current_interval = BNX2_TIMER_INTERVAL;
                }
 
        } else
-               bp->current_interval = bp->timer_interval;
+               bp->current_interval = BNX2_TIMER_INTERVAL;
 
        spin_unlock(&bp->phy_lock);
 }
@@ -5963,10 +5980,12 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
                vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
        }
 
+#ifdef BCM_VLAN
        if (bp->vlgrp && vlan_tx_tag_present(skb)) {
                vlan_tag_flags |=
                        (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
        }
+#endif
        if ((mss = skb_shinfo(skb)->gso_size)) {
                u32 tcp_opt_len, ip_tcp_len;
                struct iphdr *iph;
@@ -7495,8 +7514,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 
        bp->stats_ticks = USEC_PER_SEC & BNX2_HC_STATS_TICKS_HC_STAT_TICKS;
 
-       bp->timer_interval =  HZ;
-       bp->current_interval =  HZ;
+       bp->current_interval = BNX2_TIMER_INTERVAL;
 
        bp->phy_addr = 1;
 
@@ -7586,7 +7604,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX;
 
        init_timer(&bp->timer);
-       bp->timer.expires = RUN_AT(bp->timer_interval);
+       bp->timer.expires = RUN_AT(BNX2_TIMER_INTERVAL);
        bp->timer.data = (unsigned long) bp;
        bp->timer.function = bnx2_timer;
 
@@ -7699,7 +7717,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        memcpy(dev->dev_addr, bp->mac_addr, 6);
        memcpy(dev->perm_addr, bp->mac_addr, 6);
-       bp->name = board_info[ent->driver_data].name;
 
        dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
        if (CHIP_NUM(bp) == CHIP_NUM_5709)
@@ -7726,7 +7743,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        printk(KERN_INFO "%s: %s (%c%d) %s found at mem %lx, "
                "IRQ %d, node addr %s\n",
                dev->name,
-               bp->name,
+               board_info[ent->driver_data].name,
                ((CHIP_ID(bp) & 0xf000) >> 12) + 'A',
                ((CHIP_ID(bp) & 0x0ff0) >> 4),
                bnx2_bus_string(bp, str),