tg3: Restore likely() check in tg3_poll_msix()
[safe/jmp/linux-2.6] / drivers / net / tg3.c
index f59f369..4c71f3e 100644 (file)
@@ -4987,8 +4987,8 @@ static int tg3_poll_msix(struct napi_struct *napi, int budget)
                rmb();
 
                /* check for RX/TX work to do */
-               if (sblk->idx[0].tx_consumer == tnapi->tx_cons &&
-                   *(tnapi->rx_rcb_prod_idx) == tnapi->rx_rcb_ptr) {
+               if (likely(sblk->idx[0].tx_consumer == tnapi->tx_cons &&
+                          *(tnapi->rx_rcb_prod_idx) == tnapi->rx_rcb_ptr)) {
                        napi_complete(napi);
                        /* Reenable interrupts. */
                        tw32_mailbox(tnapi->int_mbox, tnapi->last_tag << 24);
@@ -5279,7 +5279,7 @@ static void tg3_poll_controller(struct net_device *dev)
        struct tg3 *tp = netdev_priv(dev);
 
        for (i = 0; i < tp->irq_cnt; i++)
-               tg3_interrupt(tp->napi[i].irq_vec, dev);
+               tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]);
 }
 #endif
 
@@ -9457,14 +9457,14 @@ static void __tg3_set_rx_mode(struct net_device *dev)
                tg3_set_multi (tp, 0);
        } else {
                /* Accept one or more multicast(s). */
-               struct dev_mc_list *mclist;
+               struct netdev_hw_addr *ha;
                u32 mc_filter[4] = { 0, };
                u32 regidx;
                u32 bit;
                u32 crc;
 
-               netdev_for_each_mc_addr(mclist, dev) {
-                       crc = calc_crc (mclist->dmi_addr, ETH_ALEN);
+               netdev_for_each_mc_addr(ha, dev) {
+                       crc = calc_crc(ha->addr, ETH_ALEN);
                        bit = ~crc & 0x7f;
                        regidx = (bit & 0x60) >> 5;
                        bit &= 0x1f;
@@ -9776,7 +9776,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                           ADVERTISED_Pause |
                           ADVERTISED_Asym_Pause;
 
-               if (!(tp->tg3_flags2 & TG3_FLAG_10_100_ONLY))
+               if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY))
                        mask |= ADVERTISED_1000baseT_Half |
                                ADVERTISED_1000baseT_Full;
 
@@ -12547,7 +12547,8 @@ skip_phy_reset:
 static void __devinit tg3_read_partno(struct tg3 *tp)
 {
        unsigned char vpd_data[TG3_NVM_VPD_LEN];   /* in little-endian format */
-       int i;
+       unsigned int block_end, rosize, len;
+       int i = 0;
        u32 magic;
 
        if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
@@ -12569,7 +12570,7 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
                }
        } else {
                ssize_t cnt;
-               unsigned int pos = 0, i = 0;
+               unsigned int pos = 0;
 
                for (; pos < TG3_NVM_VPD_LEN && i < 3; i++, pos += cnt) {
                        cnt = pci_read_vpd(tp->pdev, pos,
@@ -12584,46 +12585,33 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
                        goto out_not_found;
        }
 
-       /* Now parse and find the part number. */
-       for (i = 0; i < TG3_NVM_VPD_LEN - 2; ) {
-               unsigned int block_end;
-
-               i = pci_vpd_find_tag(vpd_data, i, TG3_NVM_VPD_LEN,
-                                    PCI_VPD_LRDT_RO_DATA);
-               if (i < 0)
-                       break;
-
-               block_end = i + PCI_VPD_LRDT_TAG_SIZE +
-                           pci_vpd_lrdt_size(&vpd_data[i]);
+       i = pci_vpd_find_tag(vpd_data, 0, TG3_NVM_VPD_LEN,
+                            PCI_VPD_LRDT_RO_DATA);
+       if (i < 0)
+               goto out_not_found;
 
-               i += PCI_VPD_LRDT_TAG_SIZE;
+       rosize = pci_vpd_lrdt_size(&vpd_data[i]);
+       block_end = i + PCI_VPD_LRDT_TAG_SIZE + rosize;
+       i += PCI_VPD_LRDT_TAG_SIZE;
 
-               if (block_end > TG3_NVM_VPD_LEN)
-                       goto out_not_found;
+       if (block_end > TG3_NVM_VPD_LEN)
+               goto out_not_found;
 
-               while (i < (block_end - 2)) {
-                       if (vpd_data[i + 0] == 'P' &&
-                           vpd_data[i + 1] == 'N') {
-                               int partno_len = pci_vpd_info_field_size(&vpd_data[i]);
+       i = pci_vpd_find_info_keyword(vpd_data, i, rosize,
+                                     PCI_VPD_RO_KEYWORD_PARTNO);
+       if (i < 0)
+               goto out_not_found;
 
-                               i += PCI_VPD_INFO_FLD_HDR_SIZE;
-                               if (partno_len > TG3_BPN_SIZE ||
-                                   (partno_len + i) > TG3_NVM_VPD_LEN)
-                                       goto out_not_found;
+       len = pci_vpd_info_field_size(&vpd_data[i]);
 
-                               memcpy(tp->board_part_number,
-                                      &vpd_data[i], partno_len);
+       i += PCI_VPD_INFO_FLD_HDR_SIZE;
+       if (len > TG3_BPN_SIZE ||
+           (len + i) > TG3_NVM_VPD_LEN)
+               goto out_not_found;
 
-                               /* Success. */
-                               return;
-                       }
-                       i += PCI_VPD_INFO_FLD_HDR_SIZE +
-                            pci_vpd_info_field_size(&vpd_data[i]);
-               }
+       memcpy(tp->board_part_number, &vpd_data[i], len);
 
-               /* Part number not found. */
-               goto out_not_found;
-       }
+       return;
 
 out_not_found:
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)