]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/bnx2.c
[netdrvr] ibmlana: move away from legacy MCA API
[linux-2.6-omap-h63xx.git] / drivers / net / bnx2.c
index 96cee4badd289c4f4d78515d7db2588bd6f2ba1c..94d1857d2c5d06be7735c94300978f8f91c55bc9 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/dma-mapping.h>
-#include <asm/bitops.h>
+#include <linux/bitops.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <linux/delay.h>
 #include "bnx2_fw.h"
 #include "bnx2_fw2.h"
 
-#define FW_BUF_SIZE            0x8000
+#define FW_BUF_SIZE            0x10000
 
 #define DRV_MODULE_NAME                "bnx2"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.6.8"
-#define DRV_MODULE_RELDATE     "October 17, 2007"
+#define DRV_MODULE_VERSION     "1.7.1"
+#define DRV_MODULE_RELDATE     "December 19, 2007"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -226,7 +226,7 @@ static struct flash_spec flash_5709 = {
 
 MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl);
 
-static inline u32 bnx2_tx_avail(struct bnx2 *bp)
+static inline u32 bnx2_tx_avail(struct bnx2 *bp, struct bnx2_napi *bnapi)
 {
        u32 diff;
 
@@ -235,7 +235,7 @@ static inline u32 bnx2_tx_avail(struct bnx2 *bp)
        /* The ring uses 256 indices for 255 entries, one of them
         * needs to be skipped.
         */
-       diff = bp->tx_prod - bp->tx_cons;
+       diff = bp->tx_prod - bnapi->tx_cons;
        if (unlikely(diff >= TX_DESC_CNT)) {
                diff &= 0xffff;
                if (diff == TX_DESC_CNT)
@@ -399,30 +399,65 @@ bnx2_write_phy(struct bnx2 *bp, u32 reg, u32 val)
 static void
 bnx2_disable_int(struct bnx2 *bp)
 {
-       REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
-              BNX2_PCICFG_INT_ACK_CMD_MASK_INT);
+       int i;
+       struct bnx2_napi *bnapi;
+
+       for (i = 0; i < bp->irq_nvecs; i++) {
+               bnapi = &bp->bnx2_napi[i];
+               REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num |
+                      BNX2_PCICFG_INT_ACK_CMD_MASK_INT);
+       }
        REG_RD(bp, BNX2_PCICFG_INT_ACK_CMD);
 }
 
 static void
 bnx2_enable_int(struct bnx2 *bp)
 {
-       REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
-              BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
-              BNX2_PCICFG_INT_ACK_CMD_MASK_INT | bp->last_status_idx);
+       int i;
+       struct bnx2_napi *bnapi;
 
-       REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
-              BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | bp->last_status_idx);
+       for (i = 0; i < bp->irq_nvecs; i++) {
+               bnapi = &bp->bnx2_napi[i];
+
+               REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num |
+                      BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
+                      BNX2_PCICFG_INT_ACK_CMD_MASK_INT |
+                      bnapi->last_status_idx);
 
+               REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num |
+                      BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
+                      bnapi->last_status_idx);
+       }
        REG_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd | BNX2_HC_COMMAND_COAL_NOW);
 }
 
 static void
 bnx2_disable_int_sync(struct bnx2 *bp)
 {
+       int i;
+
        atomic_inc(&bp->intr_sem);
        bnx2_disable_int(bp);
-       synchronize_irq(bp->pdev->irq);
+       for (i = 0; i < bp->irq_nvecs; i++)
+               synchronize_irq(bp->irq_tbl[i].vector);
+}
+
+static void
+bnx2_napi_disable(struct bnx2 *bp)
+{
+       int i;
+
+       for (i = 0; i < bp->irq_nvecs; i++)
+               napi_disable(&bp->bnx2_napi[i].napi);
+}
+
+static void
+bnx2_napi_enable(struct bnx2 *bp)
+{
+       int i;
+
+       for (i = 0; i < bp->irq_nvecs; i++)
+               napi_enable(&bp->bnx2_napi[i].napi);
 }
 
 static void
@@ -430,7 +465,7 @@ bnx2_netif_stop(struct bnx2 *bp)
 {
        bnx2_disable_int_sync(bp);
        if (netif_running(bp->dev)) {
-               napi_disable(&bp->napi);
+               bnx2_napi_disable(bp);
                netif_tx_disable(bp->dev);
                bp->dev->trans_start = jiffies; /* prevent tx timeout */
        }
@@ -442,7 +477,7 @@ bnx2_netif_start(struct bnx2 *bp)
        if (atomic_dec_and_test(&bp->intr_sem)) {
                if (netif_running(bp->dev)) {
                        netif_wake_queue(bp->dev);
-                       napi_enable(&bp->napi);
+                       bnx2_napi_enable(bp);
                        bnx2_enable_int(bp);
                }
        }
@@ -468,8 +503,7 @@ bnx2_free_mem(struct bnx2 *bp)
                bp->stats_blk = NULL;
        }
        if (bp->tx_desc_ring) {
-               pci_free_consistent(bp->pdev,
-                                   sizeof(struct tx_bd) * TX_DESC_CNT,
+               pci_free_consistent(bp->pdev, TXBD_RING_SIZE,
                                    bp->tx_desc_ring, bp->tx_desc_mapping);
                bp->tx_desc_ring = NULL;
        }
@@ -477,14 +511,23 @@ bnx2_free_mem(struct bnx2 *bp)
        bp->tx_buf_ring = NULL;
        for (i = 0; i < bp->rx_max_ring; i++) {
                if (bp->rx_desc_ring[i])
-                       pci_free_consistent(bp->pdev,
-                                           sizeof(struct rx_bd) * RX_DESC_CNT,
+                       pci_free_consistent(bp->pdev, RXBD_RING_SIZE,
                                            bp->rx_desc_ring[i],
                                            bp->rx_desc_mapping[i]);
                bp->rx_desc_ring[i] = NULL;
        }
        vfree(bp->rx_buf_ring);
        bp->rx_buf_ring = NULL;
+       for (i = 0; i < bp->rx_max_pg_ring; i++) {
+               if (bp->rx_pg_desc_ring[i])
+                       pci_free_consistent(bp->pdev, RXBD_RING_SIZE,
+                                           bp->rx_pg_desc_ring[i],
+                                           bp->rx_pg_desc_mapping[i]);
+               bp->rx_pg_desc_ring[i] = NULL;
+       }
+       if (bp->rx_pg_ring)
+               vfree(bp->rx_pg_ring);
+       bp->rx_pg_ring = NULL;
 }
 
 static int
@@ -492,38 +535,54 @@ bnx2_alloc_mem(struct bnx2 *bp)
 {
        int i, status_blk_size;
 
-       bp->tx_buf_ring = kzalloc(sizeof(struct sw_bd) * TX_DESC_CNT,
-                                 GFP_KERNEL);
+       bp->tx_buf_ring = kzalloc(SW_TXBD_RING_SIZE, GFP_KERNEL);
        if (bp->tx_buf_ring == NULL)
                return -ENOMEM;
 
-       bp->tx_desc_ring = pci_alloc_consistent(bp->pdev,
-                                               sizeof(struct tx_bd) *
-                                               TX_DESC_CNT,
+       bp->tx_desc_ring = pci_alloc_consistent(bp->pdev, TXBD_RING_SIZE,
                                                &bp->tx_desc_mapping);
        if (bp->tx_desc_ring == NULL)
                goto alloc_mem_err;
 
-       bp->rx_buf_ring = vmalloc(sizeof(struct sw_bd) * RX_DESC_CNT *
-                                 bp->rx_max_ring);
+       bp->rx_buf_ring = vmalloc(SW_RXBD_RING_SIZE * bp->rx_max_ring);
        if (bp->rx_buf_ring == NULL)
                goto alloc_mem_err;
 
-       memset(bp->rx_buf_ring, 0, sizeof(struct sw_bd) * RX_DESC_CNT *
-                                  bp->rx_max_ring);
+       memset(bp->rx_buf_ring, 0, SW_RXBD_RING_SIZE * bp->rx_max_ring);
 
        for (i = 0; i < bp->rx_max_ring; i++) {
                bp->rx_desc_ring[i] =
-                       pci_alloc_consistent(bp->pdev,
-                                            sizeof(struct rx_bd) * RX_DESC_CNT,
+                       pci_alloc_consistent(bp->pdev, RXBD_RING_SIZE,
                                             &bp->rx_desc_mapping[i]);
                if (bp->rx_desc_ring[i] == NULL)
                        goto alloc_mem_err;
 
        }
 
+       if (bp->rx_pg_ring_size) {
+               bp->rx_pg_ring = vmalloc(SW_RXPG_RING_SIZE *
+                                        bp->rx_max_pg_ring);
+               if (bp->rx_pg_ring == NULL)
+                       goto alloc_mem_err;
+
+               memset(bp->rx_pg_ring, 0, SW_RXPG_RING_SIZE *
+                      bp->rx_max_pg_ring);
+       }
+
+       for (i = 0; i < bp->rx_max_pg_ring; i++) {
+               bp->rx_pg_desc_ring[i] =
+                       pci_alloc_consistent(bp->pdev, RXBD_RING_SIZE,
+                                            &bp->rx_pg_desc_mapping[i]);
+               if (bp->rx_pg_desc_ring[i] == NULL)
+                       goto alloc_mem_err;
+
+       }
+
        /* Combine status and statistics blocks into one allocation. */
        status_blk_size = L1_CACHE_ALIGN(sizeof(struct status_block));
+       if (bp->flags & MSIX_CAP_FLAG)
+               status_blk_size = L1_CACHE_ALIGN(BNX2_MAX_MSIX_HW_VEC *
+                                                BNX2_SBLK_MSIX_ALIGN_SIZE);
        bp->status_stats_size = status_blk_size +
                                sizeof(struct statistics_block);
 
@@ -534,6 +593,18 @@ bnx2_alloc_mem(struct bnx2 *bp)
 
        memset(bp->status_blk, 0, bp->status_stats_size);
 
+       bp->bnx2_napi[0].status_blk = bp->status_blk;
+       if (bp->flags & MSIX_CAP_FLAG) {
+               for (i = 1; i < BNX2_MAX_MSIX_VEC; i++) {
+                       struct bnx2_napi *bnapi = &bp->bnx2_napi[i];
+
+                       bnapi->status_blk_msix = (void *)
+                               ((unsigned long) bp->status_blk +
+                                BNX2_SBLK_MSIX_ALIGN_SIZE * i);
+                       bnapi->int_num = i << 24;
+               }
+       }
+
        bp->stats_blk = (void *) ((unsigned long) bp->status_blk +
                                  status_blk_size);
 
@@ -2125,15 +2196,12 @@ bnx2_init_context(struct bnx2 *bp)
                        vcid_addr += (i << PHY_CTX_SHIFT);
                        pcid_addr += (i << PHY_CTX_SHIFT);
 
-                       REG_WR(bp, BNX2_CTX_VIRT_ADDR, 0x00);
+                       REG_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr);
                        REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr);
 
                        /* Zero out the context. */
                        for (offset = 0; offset < PHY_CTX_SIZE; offset += 4)
-                               CTX_WR(bp, 0x00, offset, 0);
-
-                       REG_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr);
-                       REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr);
+                               CTX_WR(bp, vcid_addr, offset, 0);
                }
        }
 }
@@ -2206,7 +2274,43 @@ bnx2_set_mac_addr(struct bnx2 *bp)
 }
 
 static inline int
-bnx2_alloc_rx_skb(struct bnx2 *bp, u16 index)
+bnx2_alloc_rx_page(struct bnx2 *bp, u16 index)
+{
+       dma_addr_t mapping;
+       struct sw_pg *rx_pg = &bp->rx_pg_ring[index];
+       struct rx_bd *rxbd =
+               &bp->rx_pg_desc_ring[RX_RING(index)][RX_IDX(index)];
+       struct page *page = alloc_page(GFP_ATOMIC);
+
+       if (!page)
+               return -ENOMEM;
+       mapping = pci_map_page(bp->pdev, page, 0, PAGE_SIZE,
+                              PCI_DMA_FROMDEVICE);
+       rx_pg->page = page;
+       pci_unmap_addr_set(rx_pg, mapping, mapping);
+       rxbd->rx_bd_haddr_hi = (u64) mapping >> 32;
+       rxbd->rx_bd_haddr_lo = (u64) mapping & 0xffffffff;
+       return 0;
+}
+
+static void
+bnx2_free_rx_page(struct bnx2 *bp, u16 index)
+{
+       struct sw_pg *rx_pg = &bp->rx_pg_ring[index];
+       struct page *page = rx_pg->page;
+
+       if (!page)
+               return;
+
+       pci_unmap_page(bp->pdev, pci_unmap_addr(rx_pg, mapping), PAGE_SIZE,
+                      PCI_DMA_FROMDEVICE);
+
+       __free_page(page);
+       rx_pg->page = NULL;
+}
+
+static inline int
+bnx2_alloc_rx_skb(struct bnx2 *bp, struct bnx2_napi *bnapi, u16 index)
 {
        struct sk_buff *skb;
        struct sw_bd *rx_buf = &bp->rx_buf_ring[index];
@@ -2231,15 +2335,15 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, u16 index)
        rxbd->rx_bd_haddr_hi = (u64) mapping >> 32;
        rxbd->rx_bd_haddr_lo = (u64) mapping & 0xffffffff;
 
-       bp->rx_prod_bseq += bp->rx_buf_use_size;
+       bnapi->rx_prod_bseq += bp->rx_buf_use_size;
 
        return 0;
 }
 
 static int
-bnx2_phy_event_is_set(struct bnx2 *bp, u32 event)
+bnx2_phy_event_is_set(struct bnx2 *bp, struct bnx2_napi *bnapi, u32 event)
 {
-       struct status_block *sblk = bp->status_blk;
+       struct status_block *sblk = bnapi->status_blk;
        u32 new_link_state, old_link_state;
        int is_set = 1;
 
@@ -2257,30 +2361,41 @@ bnx2_phy_event_is_set(struct bnx2 *bp, u32 event)
 }
 
 static void
-bnx2_phy_int(struct bnx2 *bp)
+bnx2_phy_int(struct bnx2 *bp, struct bnx2_napi *bnapi)
 {
-       if (bnx2_phy_event_is_set(bp, STATUS_ATTN_BITS_LINK_STATE)) {
+       if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_LINK_STATE)) {
                spin_lock(&bp->phy_lock);
                bnx2_set_link(bp);
                spin_unlock(&bp->phy_lock);
        }
-       if (bnx2_phy_event_is_set(bp, STATUS_ATTN_BITS_TIMER_ABORT))
+       if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_TIMER_ABORT))
                bnx2_set_remote_link(bp);
 
 }
 
-static void
-bnx2_tx_int(struct bnx2 *bp)
+static inline u16
+bnx2_get_hw_tx_cons(struct bnx2_napi *bnapi)
+{
+       u16 cons;
+
+       if (bnapi->int_num == 0)
+               cons = bnapi->status_blk->status_tx_quick_consumer_index0;
+       else
+               cons = bnapi->status_blk_msix->status_tx_quick_consumer_index;
+
+       if (unlikely((cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT))
+               cons++;
+       return cons;
+}
+
+static int
+bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
 {
-       struct status_block *sblk = bp->status_blk;
        u16 hw_cons, sw_cons, sw_ring_cons;
-       int tx_free_bd = 0;
+       int tx_pkt = 0;
 
-       hw_cons = bp->hw_tx_cons = sblk->status_tx_quick_consumer_index0;
-       if ((hw_cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT) {
-               hw_cons++;
-       }
-       sw_cons = bp->tx_cons;
+       hw_cons = bnx2_get_hw_tx_cons(bnapi);
+       sw_cons = bnapi->tx_cons;
 
        while (sw_cons != hw_cons) {
                struct sw_bd *tx_buf;
@@ -2327,19 +2442,16 @@ bnx2_tx_int(struct bnx2 *bp)
 
                sw_cons = NEXT_TX_BD(sw_cons);
 
-               tx_free_bd += last + 1;
-
                dev_kfree_skb(skb);
+               tx_pkt++;
+               if (tx_pkt == budget)
+                       break;
 
-               hw_cons = bp->hw_tx_cons =
-                       sblk->status_tx_quick_consumer_index0;
-
-               if ((hw_cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT) {
-                       hw_cons++;
-               }
+               hw_cons = bnx2_get_hw_tx_cons(bnapi);
        }
 
-       bp->tx_cons = sw_cons;
+       bnapi->hw_tx_cons = hw_cons;
+       bnapi->tx_cons = sw_cons;
        /* Need to make the tx_cons update visible to bnx2_start_xmit()
         * before checking for netif_queue_stopped().  Without the
         * memory barrier, there is a small possibility that bnx2_start_xmit()
@@ -2348,17 +2460,68 @@ bnx2_tx_int(struct bnx2 *bp)
        smp_mb();
 
        if (unlikely(netif_queue_stopped(bp->dev)) &&
-                    (bnx2_tx_avail(bp) > bp->tx_wake_thresh)) {
+                    (bnx2_tx_avail(bp, bnapi) > bp->tx_wake_thresh)) {
                netif_tx_lock(bp->dev);
                if ((netif_queue_stopped(bp->dev)) &&
-                   (bnx2_tx_avail(bp) > bp->tx_wake_thresh))
+                   (bnx2_tx_avail(bp, bnapi) > bp->tx_wake_thresh))
                        netif_wake_queue(bp->dev);
                netif_tx_unlock(bp->dev);
        }
+       return tx_pkt;
+}
+
+static void
+bnx2_reuse_rx_skb_pages(struct bnx2 *bp, struct bnx2_napi *bnapi,
+                       struct sk_buff *skb, int count)
+{
+       struct sw_pg *cons_rx_pg, *prod_rx_pg;
+       struct rx_bd *cons_bd, *prod_bd;
+       dma_addr_t mapping;
+       int i;
+       u16 hw_prod = bnapi->rx_pg_prod, prod;
+       u16 cons = bnapi->rx_pg_cons;
+
+       for (i = 0; i < count; i++) {
+               prod = RX_PG_RING_IDX(hw_prod);
+
+               prod_rx_pg = &bp->rx_pg_ring[prod];
+               cons_rx_pg = &bp->rx_pg_ring[cons];
+               cons_bd = &bp->rx_pg_desc_ring[RX_RING(cons)][RX_IDX(cons)];
+               prod_bd = &bp->rx_pg_desc_ring[RX_RING(prod)][RX_IDX(prod)];
+
+               if (i == 0 && skb) {
+                       struct page *page;
+                       struct skb_shared_info *shinfo;
+
+                       shinfo = skb_shinfo(skb);
+                       shinfo->nr_frags--;
+                       page = shinfo->frags[shinfo->nr_frags].page;
+                       shinfo->frags[shinfo->nr_frags].page = NULL;
+                       mapping = pci_map_page(bp->pdev, page, 0, PAGE_SIZE,
+                                              PCI_DMA_FROMDEVICE);
+                       cons_rx_pg->page = page;
+                       pci_unmap_addr_set(cons_rx_pg, mapping, mapping);
+                       dev_kfree_skb(skb);
+               }
+               if (prod != cons) {
+                       prod_rx_pg->page = cons_rx_pg->page;
+                       cons_rx_pg->page = NULL;
+                       pci_unmap_addr_set(prod_rx_pg, mapping,
+                               pci_unmap_addr(cons_rx_pg, mapping));
+
+                       prod_bd->rx_bd_haddr_hi = cons_bd->rx_bd_haddr_hi;
+                       prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo;
+
+               }
+               cons = RX_PG_RING_IDX(NEXT_RX_BD(cons));
+               hw_prod = NEXT_RX_BD(hw_prod);
+       }
+       bnapi->rx_pg_prod = hw_prod;
+       bnapi->rx_pg_cons = cons;
 }
 
 static inline void
-bnx2_reuse_rx_skb(struct bnx2 *bp, struct sk_buff *skb,
+bnx2_reuse_rx_skb(struct bnx2 *bp, struct bnx2_napi *bnapi, struct sk_buff *skb,
        u16 cons, u16 prod)
 {
        struct sw_bd *cons_rx_buf, *prod_rx_buf;
@@ -2371,7 +2534,7 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct sk_buff *skb,
                pci_unmap_addr(cons_rx_buf, mapping),
                bp->rx_offset + RX_COPY_THRESH, PCI_DMA_FROMDEVICE);
 
-       bp->rx_prod_bseq += bp->rx_buf_use_size;
+       bnapi->rx_prod_bseq += bp->rx_buf_use_size;
 
        prod_rx_buf->skb = skb;
 
@@ -2388,26 +2551,124 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct sk_buff *skb,
 }
 
 static int
-bnx2_rx_int(struct bnx2 *bp, int budget)
+bnx2_rx_skb(struct bnx2 *bp, struct bnx2_napi *bnapi, struct sk_buff *skb,
+           unsigned int len, unsigned int hdr_len, dma_addr_t dma_addr,
+           u32 ring_idx)
+{
+       int err;
+       u16 prod = ring_idx & 0xffff;
+
+       err = bnx2_alloc_rx_skb(bp, bnapi, prod);
+       if (unlikely(err)) {
+               bnx2_reuse_rx_skb(bp, bnapi, skb, (u16) (ring_idx >> 16), prod);
+               if (hdr_len) {
+                       unsigned int raw_len = len + 4;
+                       int pages = PAGE_ALIGN(raw_len - hdr_len) >> PAGE_SHIFT;
+
+                       bnx2_reuse_rx_skb_pages(bp, bnapi, NULL, pages);
+               }
+               return err;
+       }
+
+       skb_reserve(skb, bp->rx_offset);
+       pci_unmap_single(bp->pdev, dma_addr, bp->rx_buf_use_size,
+                        PCI_DMA_FROMDEVICE);
+
+       if (hdr_len == 0) {
+               skb_put(skb, len);
+               return 0;
+       } else {
+               unsigned int i, frag_len, frag_size, pages;
+               struct sw_pg *rx_pg;
+               u16 pg_cons = bnapi->rx_pg_cons;
+               u16 pg_prod = bnapi->rx_pg_prod;
+
+               frag_size = len + 4 - hdr_len;
+               pages = PAGE_ALIGN(frag_size) >> PAGE_SHIFT;
+               skb_put(skb, hdr_len);
+
+               for (i = 0; i < pages; i++) {
+                       frag_len = min(frag_size, (unsigned int) PAGE_SIZE);
+                       if (unlikely(frag_len <= 4)) {
+                               unsigned int tail = 4 - frag_len;
+
+                               bnapi->rx_pg_cons = pg_cons;
+                               bnapi->rx_pg_prod = pg_prod;
+                               bnx2_reuse_rx_skb_pages(bp, bnapi, NULL,
+                                                       pages - i);
+                               skb->len -= tail;
+                               if (i == 0) {
+                                       skb->tail -= tail;
+                               } else {
+                                       skb_frag_t *frag =
+                                               &skb_shinfo(skb)->frags[i - 1];
+                                       frag->size -= tail;
+                                       skb->data_len -= tail;
+                                       skb->truesize -= tail;
+                               }
+                               return 0;
+                       }
+                       rx_pg = &bp->rx_pg_ring[pg_cons];
+
+                       pci_unmap_page(bp->pdev, pci_unmap_addr(rx_pg, mapping),
+                                      PAGE_SIZE, PCI_DMA_FROMDEVICE);
+
+                       if (i == pages - 1)
+                               frag_len -= 4;
+
+                       skb_fill_page_desc(skb, i, rx_pg->page, 0, frag_len);
+                       rx_pg->page = NULL;
+
+                       err = bnx2_alloc_rx_page(bp, RX_PG_RING_IDX(pg_prod));
+                       if (unlikely(err)) {
+                               bnapi->rx_pg_cons = pg_cons;
+                               bnapi->rx_pg_prod = pg_prod;
+                               bnx2_reuse_rx_skb_pages(bp, bnapi, skb,
+                                                       pages - i);
+                               return err;
+                       }
+
+                       frag_size -= frag_len;
+                       skb->data_len += frag_len;
+                       skb->truesize += frag_len;
+                       skb->len += frag_len;
+
+                       pg_prod = NEXT_RX_BD(pg_prod);
+                       pg_cons = RX_PG_RING_IDX(NEXT_RX_BD(pg_cons));
+               }
+               bnapi->rx_pg_prod = pg_prod;
+               bnapi->rx_pg_cons = pg_cons;
+       }
+       return 0;
+}
+
+static inline u16
+bnx2_get_hw_rx_cons(struct bnx2_napi *bnapi)
+{
+       u16 cons = bnapi->status_blk->status_rx_quick_consumer_index0;
+
+       if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT))
+               cons++;
+       return cons;
+}
+
+static int
+bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
 {
-       struct status_block *sblk = bp->status_blk;
        u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod;
        struct l2_fhdr *rx_hdr;
-       int rx_pkt = 0;
+       int rx_pkt = 0, pg_ring_used = 0;
 
-       hw_cons = bp->hw_rx_cons = sblk->status_rx_quick_consumer_index0;
-       if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) {
-               hw_cons++;
-       }
-       sw_cons = bp->rx_cons;
-       sw_prod = bp->rx_prod;
+       hw_cons = bnx2_get_hw_rx_cons(bnapi);
+       sw_cons = bnapi->rx_cons;
+       sw_prod = bnapi->rx_prod;
 
        /* Memory barrier necessary as speculative reads of the rx
         * buffer can be ahead of the index in the status block
         */
        rmb();
        while (sw_cons != hw_cons) {
-               unsigned int len;
+               unsigned int len, hdr_len;
                u32 status;
                struct sw_bd *rx_buf;
                struct sk_buff *skb;
@@ -2427,7 +2688,7 @@ bnx2_rx_int(struct bnx2 *bp, int budget)
                        bp->rx_offset + RX_COPY_THRESH, PCI_DMA_FROMDEVICE);
 
                rx_hdr = (struct l2_fhdr *) skb->data;
-               len = rx_hdr->l2_fhdr_pkt_len - 4;
+               len = rx_hdr->l2_fhdr_pkt_len;
 
                if ((status = rx_hdr->l2_fhdr_status) &
                        (L2_FHDR_ERRORS_BAD_CRC |
@@ -2436,18 +2697,30 @@ bnx2_rx_int(struct bnx2 *bp, int budget)
                        L2_FHDR_ERRORS_TOO_SHORT |
                        L2_FHDR_ERRORS_GIANT_FRAME)) {
 
-                       goto reuse_rx;
+                       bnx2_reuse_rx_skb(bp, bnapi, skb, sw_ring_cons,
+                                         sw_ring_prod);
+                       goto next_rx;
+               }
+               hdr_len = 0;
+               if (status & L2_FHDR_STATUS_SPLIT) {
+                       hdr_len = rx_hdr->l2_fhdr_ip_xsum;
+                       pg_ring_used = 1;
+               } else if (len > bp->rx_jumbo_thresh) {
+                       hdr_len = bp->rx_jumbo_thresh;
+                       pg_ring_used = 1;
                }
 
-               /* Since we don't have a jumbo ring, copy small packets
-                * if mtu > 1500
-                */
-               if ((bp->dev->mtu > 1500) && (len <= RX_COPY_THRESH)) {
+               len -= 4;
+
+               if (len <= bp->rx_copy_thresh) {
                        struct sk_buff *new_skb;
 
                        new_skb = netdev_alloc_skb(bp->dev, len + 2);
-                       if (new_skb == NULL)
-                               goto reuse_rx;
+                       if (new_skb == NULL) {
+                               bnx2_reuse_rx_skb(bp, bnapi, skb, sw_ring_cons,
+                                                 sw_ring_prod);
+                               goto next_rx;
+                       }
 
                        /* aligned copy */
                        skb_copy_from_linear_data_offset(skb, bp->rx_offset - 2,
@@ -2455,24 +2728,13 @@ bnx2_rx_int(struct bnx2 *bp, int budget)
                        skb_reserve(new_skb, 2);
                        skb_put(new_skb, len);
 
-                       bnx2_reuse_rx_skb(bp, skb,
+                       bnx2_reuse_rx_skb(bp, bnapi, skb,
                                sw_ring_cons, sw_ring_prod);
 
                        skb = new_skb;
-               }
-               else if (bnx2_alloc_rx_skb(bp, sw_ring_prod) == 0) {
-                       pci_unmap_single(bp->pdev, dma_addr,
-                               bp->rx_buf_use_size, PCI_DMA_FROMDEVICE);
-
-                       skb_reserve(skb, bp->rx_offset);
-                       skb_put(skb, len);
-               }
-               else {
-reuse_rx:
-                       bnx2_reuse_rx_skb(bp, skb,
-                               sw_ring_cons, sw_ring_prod);
+               } else if (unlikely(bnx2_rx_skb(bp, bnapi, skb, len, hdr_len,
+                          dma_addr, (sw_ring_cons << 16) | sw_ring_prod)))
                        goto next_rx;
-               }
 
                skb->protocol = eth_type_trans(skb, bp->dev);
 
@@ -2515,19 +2777,20 @@ next_rx:
 
                /* Refresh hw_cons to see if there is new work */
                if (sw_cons == hw_cons) {
-                       hw_cons = bp->hw_rx_cons =
-                               sblk->status_rx_quick_consumer_index0;
-                       if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)
-                               hw_cons++;
+                       hw_cons = bnx2_get_hw_rx_cons(bnapi);
                        rmb();
                }
        }
-       bp->rx_cons = sw_cons;
-       bp->rx_prod = sw_prod;
+       bnapi->rx_cons = sw_cons;
+       bnapi->rx_prod = sw_prod;
+
+       if (pg_ring_used)
+               REG_WR16(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_PG_BDIDX,
+                        bnapi->rx_pg_prod);
 
        REG_WR16(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BDIDX, sw_prod);
 
-       REG_WR(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BSEQ, bp->rx_prod_bseq);
+       REG_WR(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BSEQ, bnapi->rx_prod_bseq);
 
        mmiowb();
 
@@ -2543,8 +2806,9 @@ bnx2_msi(int irq, void *dev_instance)
 {
        struct net_device *dev = dev_instance;
        struct bnx2 *bp = netdev_priv(dev);
+       struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
 
-       prefetch(bp->status_blk);
+       prefetch(bnapi->status_blk);
        REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
                BNX2_PCICFG_INT_ACK_CMD_USE_INT_HC_PARAM |
                BNX2_PCICFG_INT_ACK_CMD_MASK_INT);
@@ -2553,7 +2817,7 @@ bnx2_msi(int irq, void *dev_instance)
        if (unlikely(atomic_read(&bp->intr_sem) != 0))
                return IRQ_HANDLED;
 
-       netif_rx_schedule(dev, &bp->napi);
+       netif_rx_schedule(dev, &bnapi->napi);
 
        return IRQ_HANDLED;
 }
@@ -2563,14 +2827,15 @@ bnx2_msi_1shot(int irq, void *dev_instance)
 {
        struct net_device *dev = dev_instance;
        struct bnx2 *bp = netdev_priv(dev);
+       struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
 
-       prefetch(bp->status_blk);
+       prefetch(bnapi->status_blk);
 
        /* Return here if interrupt is disabled. */
        if (unlikely(atomic_read(&bp->intr_sem) != 0))
                return IRQ_HANDLED;
 
-       netif_rx_schedule(dev, &bp->napi);
+       netif_rx_schedule(dev, &bnapi->napi);
 
        return IRQ_HANDLED;
 }
@@ -2580,7 +2845,8 @@ bnx2_interrupt(int irq, void *dev_instance)
 {
        struct net_device *dev = dev_instance;
        struct bnx2 *bp = netdev_priv(dev);
-       struct status_block *sblk = bp->status_blk;
+       struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
+       struct status_block *sblk = bnapi->status_blk;
 
        /* When using INTx, it is possible for the interrupt to arrive
         * at the CPU before the status block posted prior to the
@@ -2588,7 +2854,7 @@ bnx2_interrupt(int irq, void *dev_instance)
         * When using MSI, the MSI message will always complete after
         * the status block write.
         */
-       if ((sblk->status_idx == bp->last_status_idx) &&
+       if ((sblk->status_idx == bnapi->last_status_idx) &&
            (REG_RD(bp, BNX2_PCICFG_MISC_STATUS) &
             BNX2_PCICFG_MISC_STATUS_INTA_VALUE))
                return IRQ_NONE;
@@ -2606,24 +2872,42 @@ bnx2_interrupt(int irq, void *dev_instance)
        if (unlikely(atomic_read(&bp->intr_sem) != 0))
                return IRQ_HANDLED;
 
-       if (netif_rx_schedule_prep(dev, &bp->napi)) {
-               bp->last_status_idx = sblk->status_idx;
-               __netif_rx_schedule(dev, &bp->napi);
+       if (netif_rx_schedule_prep(dev, &bnapi->napi)) {
+               bnapi->last_status_idx = sblk->status_idx;
+               __netif_rx_schedule(dev, &bnapi->napi);
        }
 
        return IRQ_HANDLED;
 }
 
+static irqreturn_t
+bnx2_tx_msix(int irq, void *dev_instance)
+{
+       struct net_device *dev = dev_instance;
+       struct bnx2 *bp = netdev_priv(dev);
+       struct bnx2_napi *bnapi = &bp->bnx2_napi[BNX2_TX_VEC];
+
+       prefetch(bnapi->status_blk_msix);
+
+       /* Return here if interrupt is disabled. */
+       if (unlikely(atomic_read(&bp->intr_sem) != 0))
+               return IRQ_HANDLED;
+
+       netif_rx_schedule(dev, &bnapi->napi);
+       return IRQ_HANDLED;
+}
+
 #define STATUS_ATTN_EVENTS     (STATUS_ATTN_BITS_LINK_STATE | \
                                 STATUS_ATTN_BITS_TIMER_ABORT)
 
 static inline int
-bnx2_has_work(struct bnx2 *bp)
+bnx2_has_work(struct bnx2_napi *bnapi)
 {
+       struct bnx2 *bp = bnapi->bp;
        struct status_block *sblk = bp->status_blk;
 
-       if ((sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) ||
-           (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons))
+       if ((bnx2_get_hw_rx_cons(bnapi) != bnapi->rx_cons) ||
+           (bnx2_get_hw_tx_cons(bnapi) != bnapi->hw_tx_cons))
                return 1;
 
        if ((sblk->status_attn_bits & STATUS_ATTN_EVENTS) !=
@@ -2633,16 +2917,40 @@ bnx2_has_work(struct bnx2 *bp)
        return 0;
 }
 
-static int bnx2_poll_work(struct bnx2 *bp, int work_done, int budget)
+static int bnx2_tx_poll(struct napi_struct *napi, int budget)
 {
-       struct status_block *sblk = bp->status_blk;
+       struct bnx2_napi *bnapi = container_of(napi, struct bnx2_napi, napi);
+       struct bnx2 *bp = bnapi->bp;
+       int work_done = 0;
+       struct status_block_msix *sblk = bnapi->status_blk_msix;
+
+       do {
+               work_done += bnx2_tx_int(bp, bnapi, budget - work_done);
+               if (unlikely(work_done >= budget))
+                       return work_done;
+
+               bnapi->last_status_idx = sblk->status_idx;
+               rmb();
+       } while (bnx2_get_hw_tx_cons(bnapi) != bnapi->hw_tx_cons);
+
+       netif_rx_complete(bp->dev, napi);
+       REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num |
+              BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
+              bnapi->last_status_idx);
+       return work_done;
+}
+
+static int bnx2_poll_work(struct bnx2 *bp, struct bnx2_napi *bnapi,
+                         int work_done, int budget)
+{
+       struct status_block *sblk = bnapi->status_blk;
        u32 status_attn_bits = sblk->status_attn_bits;
        u32 status_attn_bits_ack = sblk->status_attn_bits_ack;
 
        if ((status_attn_bits & STATUS_ATTN_EVENTS) !=
            (status_attn_bits_ack & STATUS_ATTN_EVENTS)) {
 
-               bnx2_phy_int(bp);
+               bnx2_phy_int(bp, bnapi);
 
                /* This is needed to take care of transient status
                 * during link changes.
@@ -2652,49 +2960,50 @@ static int bnx2_poll_work(struct bnx2 *bp, int work_done, int budget)
                REG_RD(bp, BNX2_HC_COMMAND);
        }
 
-       if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)
-               bnx2_tx_int(bp);
+       if (bnx2_get_hw_tx_cons(bnapi) != bnapi->hw_tx_cons)
+               bnx2_tx_int(bp, bnapi, 0);
 
-       if (sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons)
-               work_done += bnx2_rx_int(bp, budget - work_done);
+       if (bnx2_get_hw_rx_cons(bnapi) != bnapi->rx_cons)
+               work_done += bnx2_rx_int(bp, bnapi, budget - work_done);
 
        return work_done;
 }
 
 static int bnx2_poll(struct napi_struct *napi, int budget)
 {
-       struct bnx2 *bp = container_of(napi, struct bnx2, napi);
+       struct bnx2_napi *bnapi = container_of(napi, struct bnx2_napi, napi);
+       struct bnx2 *bp = bnapi->bp;
        int work_done = 0;
-       struct status_block *sblk = bp->status_blk;
+       struct status_block *sblk = bnapi->status_blk;
 
        while (1) {
-               work_done = bnx2_poll_work(bp, work_done, budget);
+               work_done = bnx2_poll_work(bp, bnapi, work_done, budget);
 
                if (unlikely(work_done >= budget))
                        break;
 
-               /* bp->last_status_idx is used below to tell the hw how
+               /* bnapi->last_status_idx is used below to tell the hw how
                 * much work has been processed, so we must read it before
                 * checking for more work.
                 */
-               bp->last_status_idx = sblk->status_idx;
+               bnapi->last_status_idx = sblk->status_idx;
                rmb();
-               if (likely(!bnx2_has_work(bp))) {
+               if (likely(!bnx2_has_work(bnapi))) {
                        netif_rx_complete(bp->dev, napi);
-                       if (likely(bp->flags & USING_MSI_FLAG)) {
+                       if (likely(bp->flags & USING_MSI_OR_MSIX_FLAG)) {
                                REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
                                       BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
-                                      bp->last_status_idx);
+                                      bnapi->last_status_idx);
                                break;
                        }
                        REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
                               BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
                               BNX2_PCICFG_INT_ACK_CMD_MASK_INT |
-                              bp->last_status_idx);
+                              bnapi->last_status_idx);
 
                        REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
                               BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
-                              bp->last_status_idx);
+                              bnapi->last_status_idx);
                        break;
                }
        }
@@ -2897,20 +3206,34 @@ bnx2_init_cpus(struct bnx2 *bp)
 {
        struct cpu_reg cpu_reg;
        struct fw_info *fw;
-       int rc;
-       void *text;
+       int rc, rv2p_len;
+       void *text, *rv2p;
 
        /* Initialize the RV2P processor. */
        text = vmalloc(FW_BUF_SIZE);
        if (!text)
                return -ENOMEM;
-       rc = zlib_inflate_blob(text, FW_BUF_SIZE, bnx2_rv2p_proc1, sizeof(bnx2_rv2p_proc1));
+       if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+               rv2p = bnx2_xi_rv2p_proc1;
+               rv2p_len = sizeof(bnx2_xi_rv2p_proc1);
+       } else {
+               rv2p = bnx2_rv2p_proc1;
+               rv2p_len = sizeof(bnx2_rv2p_proc1);
+       }
+       rc = zlib_inflate_blob(text, FW_BUF_SIZE, rv2p, rv2p_len);
        if (rc < 0)
                goto init_cpu_err;
 
        load_rv2p_fw(bp, text, rc /* == len */, RV2P_PROC1);
 
-       rc = zlib_inflate_blob(text, FW_BUF_SIZE, bnx2_rv2p_proc2, sizeof(bnx2_rv2p_proc2));
+       if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+               rv2p = bnx2_xi_rv2p_proc2;
+               rv2p_len = sizeof(bnx2_xi_rv2p_proc2);
+       } else {
+               rv2p = bnx2_rv2p_proc2;
+               rv2p_len = sizeof(bnx2_rv2p_proc2);
+       }
+       rc = zlib_inflate_blob(text, FW_BUF_SIZE, rv2p, rv2p_len);
        if (rc < 0)
                goto init_cpu_err;
 
@@ -3026,14 +3349,14 @@ bnx2_init_cpus(struct bnx2 *bp)
        cpu_reg.spad_base = BNX2_CP_SCRATCH;
        cpu_reg.mips_view_base = 0x8000000;
 
-       if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+       if (CHIP_NUM(bp) == CHIP_NUM_5709)
                fw = &bnx2_cp_fw_09;
+       else
+               fw = &bnx2_cp_fw_06;
+
+       fw->text = text;
+       rc = load_cpu_fw(bp, &cpu_reg, fw);
 
-               fw->text = text;
-               rc = load_cpu_fw(bp, &cpu_reg, fw);
-               if (rc)
-                       goto init_cpu_err;
-       }
 init_cpu_err:
        vfree(text);
        return rc;
@@ -3828,6 +4151,15 @@ bnx2_init_remote_phy(struct bnx2 *bp)
        }
 }
 
+static void
+bnx2_setup_msix_tbl(struct bnx2 *bp)
+{
+       REG_WR(bp, BNX2_PCI_GRC_WINDOW_ADDR, BNX2_PCI_GRC_WINDOW_ADDR_SEP_WIN);
+
+       REG_WR(bp, BNX2_PCI_GRC_WINDOW2_ADDR, BNX2_MSIX_TABLE_ADDR);
+       REG_WR(bp, BNX2_PCI_GRC_WINDOW3_ADDR, BNX2_MSIX_PBA_ADDR);
+}
+
 static int
 bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
 {
@@ -3927,6 +4259,9 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
                rc = bnx2_alloc_bad_rbuf(bp);
        }
 
+       if (bp->flags & USING_MSIX_FLAG)
+               bnx2_setup_msix_tbl(bp);
+
        return rc;
 }
 
@@ -3934,7 +4269,7 @@ static int
 bnx2_init_chip(struct bnx2 *bp)
 {
        u32 val;
-       int rc;
+       int rc, i;
 
        /* Make sure the interrupt is not active. */
        REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, BNX2_PCICFG_INT_ACK_CMD_MASK_INT);
@@ -4030,7 +4365,9 @@ bnx2_init_chip(struct bnx2 *bp)
                val |= BNX2_EMAC_RX_MTU_SIZE_JUMBO_ENA;
        REG_WR(bp, BNX2_EMAC_RX_MTU_SIZE, val);
 
-       bp->last_status_idx = 0;
+       for (i = 0; i < BNX2_MAX_MSIX_VEC; i++)
+               bp->bnx2_napi[i].last_status_idx = 0;
+
        bp->rx_mode = BNX2_EMAC_RX_MODE_SORT_MODE;
 
        /* Set up how to generate a link change interrupt. */
@@ -4077,6 +4414,24 @@ bnx2_init_chip(struct bnx2 *bp)
                      BNX2_HC_CONFIG_COLLECT_STATS;
        }
 
+       if (bp->flags & USING_MSIX_FLAG) {
+               REG_WR(bp, BNX2_HC_MSIX_BIT_VECTOR,
+                      BNX2_HC_MSIX_BIT_VECTOR_VAL);
+
+               REG_WR(bp, BNX2_HC_SB_CONFIG_1,
+                       BNX2_HC_SB_CONFIG_1_TX_TMR_MODE |
+                       BNX2_HC_SB_CONFIG_1_ONE_SHOT);
+
+               REG_WR(bp, BNX2_HC_TX_QUICK_CONS_TRIP_1,
+                       (bp->tx_quick_cons_trip_int << 16) |
+                        bp->tx_quick_cons_trip);
+
+               REG_WR(bp, BNX2_HC_TX_TICKS_1,
+                       (bp->tx_ticks_int << 16) | bp->tx_ticks);
+
+               val |= BNX2_HC_CONFIG_SB_ADDR_INC_128B;
+       }
+
        if (bp->flags & ONE_SHOT_MSI_FLAG)
                val |= BNX2_HC_CONFIG_ONE_SHOT;
 
@@ -4108,6 +4463,25 @@ bnx2_init_chip(struct bnx2 *bp)
        return rc;
 }
 
+static void
+bnx2_clear_ring_states(struct bnx2 *bp)
+{
+       struct bnx2_napi *bnapi;
+       int i;
+
+       for (i = 0; i < BNX2_MAX_MSIX_VEC; i++) {
+               bnapi = &bp->bnx2_napi[i];
+
+               bnapi->tx_cons = 0;
+               bnapi->hw_tx_cons = 0;
+               bnapi->rx_prod_bseq = 0;
+               bnapi->rx_prod = 0;
+               bnapi->rx_cons = 0;
+               bnapi->rx_pg_prod = 0;
+               bnapi->rx_pg_cons = 0;
+       }
+}
+
 static void
 bnx2_init_tx_context(struct bnx2 *bp, u32 cid)
 {
@@ -4141,7 +4515,17 @@ static void
 bnx2_init_tx_ring(struct bnx2 *bp)
 {
        struct tx_bd *txbd;
-       u32 cid;
+       u32 cid = TX_CID;
+       struct bnx2_napi *bnapi;
+
+       bp->tx_vec = 0;
+       if (bp->flags & USING_MSIX_FLAG) {
+               cid = TX_TSS_CID;
+               bp->tx_vec = BNX2_TX_VEC;
+               REG_WR(bp, BNX2_TSCH_TSS_CFG, BNX2_TX_INT_NUM |
+                      (TX_TSS_CID << 7));
+       }
+       bnapi = &bp->bnx2_napi[bp->tx_vec];
 
        bp->tx_wake_thresh = bp->tx_ring_size / 2;
 
@@ -4151,11 +4535,8 @@ bnx2_init_tx_ring(struct bnx2 *bp)
        txbd->tx_bd_haddr_lo = (u64) bp->tx_desc_mapping & 0xffffffff;
 
        bp->tx_prod = 0;
-       bp->tx_cons = 0;
-       bp->hw_tx_cons = 0;
        bp->tx_prod_bseq = 0;
 
-       cid = TX_CID;
        bp->tx_bidx_addr = MB_GET_CID_ADDR(cid) + BNX2_L2CTX_TX_HOST_BIDX;
        bp->tx_bseq_addr = MB_GET_CID_ADDR(cid) + BNX2_L2CTX_TX_HOST_BSEQ;
 
@@ -4163,85 +4544,152 @@ bnx2_init_tx_ring(struct bnx2 *bp)
 }
 
 static void
-bnx2_init_rx_ring(struct bnx2 *bp)
+bnx2_init_rxbd_rings(struct rx_bd *rx_ring[], dma_addr_t dma[], u32 buf_size,
+                    int num_rings)
 {
-       struct rx_bd *rxbd;
        int i;
-       u16 prod, ring_prod;
-       u32 val;
-
-       /* 8 for CRC and VLAN */
-       bp->rx_buf_use_size = bp->dev->mtu + ETH_HLEN + bp->rx_offset + 8;
-       /* hw alignment */
-       bp->rx_buf_size = bp->rx_buf_use_size + BNX2_RX_ALIGN;
-
-       ring_prod = prod = bp->rx_prod = 0;
-       bp->rx_cons = 0;
-       bp->hw_rx_cons = 0;
-       bp->rx_prod_bseq = 0;
+       struct rx_bd *rxbd;
 
-       for (i = 0; i < bp->rx_max_ring; i++) {
+       for (i = 0; i < num_rings; i++) {
                int j;
 
-               rxbd = &bp->rx_desc_ring[i][0];
+               rxbd = &rx_ring[i][0];
                for (j = 0; j < MAX_RX_DESC_CNT; j++, rxbd++) {
-                       rxbd->rx_bd_len = bp->rx_buf_use_size;
+                       rxbd->rx_bd_len = buf_size;
                        rxbd->rx_bd_flags = RX_BD_FLAGS_START | RX_BD_FLAGS_END;
                }
-               if (i == (bp->rx_max_ring - 1))
+               if (i == (num_rings - 1))
                        j = 0;
                else
                        j = i + 1;
-               rxbd->rx_bd_haddr_hi = (u64) bp->rx_desc_mapping[j] >> 32;
-               rxbd->rx_bd_haddr_lo = (u64) bp->rx_desc_mapping[j] &
-                                      0xffffffff;
+               rxbd->rx_bd_haddr_hi = (u64) dma[j] >> 32;
+               rxbd->rx_bd_haddr_lo = (u64) dma[j] & 0xffffffff;
+       }
+}
+
+static void
+bnx2_init_rx_ring(struct bnx2 *bp)
+{
+       int i;
+       u16 prod, ring_prod;
+       u32 val, rx_cid_addr = GET_CID_ADDR(RX_CID);
+       struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
+
+       bnx2_init_rxbd_rings(bp->rx_desc_ring, bp->rx_desc_mapping,
+                            bp->rx_buf_use_size, bp->rx_max_ring);
+
+       CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, 0);
+       if (bp->rx_pg_ring_size) {
+               bnx2_init_rxbd_rings(bp->rx_pg_desc_ring,
+                                    bp->rx_pg_desc_mapping,
+                                    PAGE_SIZE, bp->rx_max_pg_ring);
+               val = (bp->rx_buf_use_size << 16) | PAGE_SIZE;
+               CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, val);
+               CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_RBDC_KEY,
+                      BNX2_L2CTX_RBDC_JUMBO_KEY);
+
+               val = (u64) bp->rx_pg_desc_mapping[0] >> 32;
+               CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_HI, val);
+
+               val = (u64) bp->rx_pg_desc_mapping[0] & 0xffffffff;
+               CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_LO, val);
+
+               if (CHIP_NUM(bp) == CHIP_NUM_5709)
+                       REG_WR(bp, BNX2_MQ_MAP_L2_3, BNX2_MQ_MAP_L2_3_DEFAULT);
        }
 
        val = BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE;
        val |= BNX2_L2CTX_CTX_TYPE_SIZE_L2;
        val |= 0x02 << 8;
-       CTX_WR(bp, GET_CID_ADDR(RX_CID), BNX2_L2CTX_CTX_TYPE, val);
+       CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_CTX_TYPE, val);
 
        val = (u64) bp->rx_desc_mapping[0] >> 32;
-       CTX_WR(bp, GET_CID_ADDR(RX_CID), BNX2_L2CTX_NX_BDHADDR_HI, val);
+       CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val);
 
        val = (u64) bp->rx_desc_mapping[0] & 0xffffffff;
-       CTX_WR(bp, GET_CID_ADDR(RX_CID), BNX2_L2CTX_NX_BDHADDR_LO, val);
+       CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val);
 
+       ring_prod = prod = bnapi->rx_pg_prod;
+       for (i = 0; i < bp->rx_pg_ring_size; i++) {
+               if (bnx2_alloc_rx_page(bp, ring_prod) < 0)
+                       break;
+               prod = NEXT_RX_BD(prod);
+               ring_prod = RX_PG_RING_IDX(prod);
+       }
+       bnapi->rx_pg_prod = prod;
+
+       ring_prod = prod = bnapi->rx_prod;
        for (i = 0; i < bp->rx_ring_size; i++) {
-               if (bnx2_alloc_rx_skb(bp, ring_prod) < 0) {
+               if (bnx2_alloc_rx_skb(bp, bnapi, ring_prod) < 0) {
                        break;
                }
                prod = NEXT_RX_BD(prod);
                ring_prod = RX_RING_IDX(prod);
        }
-       bp->rx_prod = prod;
+       bnapi->rx_prod = prod;
 
+       REG_WR16(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_PG_BDIDX,
+                bnapi->rx_pg_prod);
        REG_WR16(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BDIDX, prod);
 
-       REG_WR(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BSEQ, bp->rx_prod_bseq);
+       REG_WR(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BSEQ, bnapi->rx_prod_bseq);
 }
 
-static void
-bnx2_set_rx_ring_size(struct bnx2 *bp, u32 size)
+static u32 bnx2_find_max_ring(u32 ring_size, u32 max_size)
 {
-       u32 num_rings, max;
+       u32 max, num_rings = 1;
 
-       bp->rx_ring_size = size;
-       num_rings = 1;
-       while (size > MAX_RX_DESC_CNT) {
-               size -= MAX_RX_DESC_CNT;
+       while (ring_size > MAX_RX_DESC_CNT) {
+               ring_size -= MAX_RX_DESC_CNT;
                num_rings++;
        }
        /* round to next power of 2 */
-       max = MAX_RX_RINGS;
+       max = max_size;
        while ((max & num_rings) == 0)
                max >>= 1;
 
        if (num_rings != max)
                max <<= 1;
 
-       bp->rx_max_ring = max;
+       return max;
+}
+
+static void
+bnx2_set_rx_ring_size(struct bnx2 *bp, u32 size)
+{
+       u32 rx_size, rx_space, jumbo_size;
+
+       /* 8 for CRC and VLAN */
+       rx_size = bp->dev->mtu + ETH_HLEN + bp->rx_offset + 8;
+
+       rx_space = SKB_DATA_ALIGN(rx_size + BNX2_RX_ALIGN) + NET_SKB_PAD +
+               sizeof(struct skb_shared_info);
+
+       bp->rx_copy_thresh = RX_COPY_THRESH;
+       bp->rx_pg_ring_size = 0;
+       bp->rx_max_pg_ring = 0;
+       bp->rx_max_pg_ring_idx = 0;
+       if (rx_space > PAGE_SIZE) {
+               int pages = PAGE_ALIGN(bp->dev->mtu - 40) >> PAGE_SHIFT;
+
+               jumbo_size = size * pages;
+               if (jumbo_size > MAX_TOTAL_RX_PG_DESC_CNT)
+                       jumbo_size = MAX_TOTAL_RX_PG_DESC_CNT;
+
+               bp->rx_pg_ring_size = jumbo_size;
+               bp->rx_max_pg_ring = bnx2_find_max_ring(jumbo_size,
+                                                       MAX_RX_PG_RINGS);
+               bp->rx_max_pg_ring_idx = (bp->rx_max_pg_ring * RX_DESC_CNT) - 1;
+               rx_size = RX_COPY_THRESH + bp->rx_offset;
+               bp->rx_copy_thresh = 0;
+       }
+
+       bp->rx_buf_use_size = rx_size;
+       /* hw alignment */
+       bp->rx_buf_size = bp->rx_buf_use_size + BNX2_RX_ALIGN;
+       bp->rx_jumbo_thresh = rx_size - bp->rx_offset;
+       bp->rx_ring_size = size;
+       bp->rx_max_ring = bnx2_find_max_ring(size, MAX_RX_RINGS);
        bp->rx_max_ring_idx = (bp->rx_max_ring * RX_DESC_CNT) - 1;
 }
 
@@ -4304,6 +4752,8 @@ bnx2_free_rx_skbs(struct bnx2 *bp)
 
                dev_kfree_skb(skb);
        }
+       for (i = 0; i < bp->rx_max_pg_ring_idx; i++)
+               bnx2_free_rx_page(bp, i);
 }
 
 static void
@@ -4326,6 +4776,7 @@ bnx2_reset_nic(struct bnx2 *bp, u32 reset_code)
        if ((rc = bnx2_init_chip(bp)) != 0)
                return rc;
 
+       bnx2_clear_ring_states(bp);
        bnx2_init_tx_ring(bp);
        bnx2_init_rx_ring(bp);
        return 0;
@@ -4597,6 +5048,11 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
        struct sw_bd *rx_buf;
        struct l2_fhdr *rx_hdr;
        int ret = -ENODEV;
+       struct bnx2_napi *bnapi = &bp->bnx2_napi[0], *tx_napi;
+
+       tx_napi = bnapi;
+       if (bp->flags & USING_MSIX_FLAG)
+               tx_napi = &bp->bnx2_napi[BNX2_TX_VEC];
 
        if (loopback_mode == BNX2_MAC_LOOPBACK) {
                bp->loopback = MAC_LOOPBACK;
@@ -4612,7 +5068,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
        else
                return -EINVAL;
 
-       pkt_size = 1514;
+       pkt_size = min(bp->dev->mtu + ETH_HLEN, bp->rx_jumbo_thresh - 4);
        skb = netdev_alloc_skb(bp->dev, pkt_size);
        if (!skb)
                return -ENOMEM;
@@ -4631,7 +5087,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
        REG_RD(bp, BNX2_HC_COMMAND);
 
        udelay(5);
-       rx_start_idx = bp->status_blk->status_rx_quick_consumer_index0;
+       rx_start_idx = bnx2_get_hw_rx_cons(bnapi);
 
        num_pkts = 0;
 
@@ -4661,11 +5117,10 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
        pci_unmap_single(bp->pdev, map, pkt_size, PCI_DMA_TODEVICE);
        dev_kfree_skb(skb);
 
-       if (bp->status_blk->status_tx_quick_consumer_index0 != bp->tx_prod) {
+       if (bnx2_get_hw_tx_cons(tx_napi) != bp->tx_prod)
                goto loopback_test_done;
-       }
 
-       rx_idx = bp->status_blk->status_rx_quick_consumer_index0;
+       rx_idx = bnx2_get_hw_rx_cons(bnapi);
        if (rx_idx != rx_start_idx + num_pkts) {
                goto loopback_test_done;
        }
@@ -4945,18 +5400,23 @@ static int
 bnx2_request_irq(struct bnx2 *bp)
 {
        struct net_device *dev = bp->dev;
-       int rc = 0;
-
-       if (bp->flags & USING_MSI_FLAG) {
-               irq_handler_t   fn = bnx2_msi;
+       unsigned long flags;
+       struct bnx2_irq *irq;
+       int rc = 0, i;
 
-               if (bp->flags & ONE_SHOT_MSI_FLAG)
-                       fn = bnx2_msi_1shot;
+       if (bp->flags & USING_MSI_OR_MSIX_FLAG)
+               flags = 0;
+       else
+               flags = IRQF_SHARED;
 
-               rc = request_irq(bp->pdev->irq, fn, 0, dev->name, dev);
-       } else
-               rc = request_irq(bp->pdev->irq, bnx2_interrupt,
-                                IRQF_SHARED, dev->name, dev);
+       for (i = 0; i < bp->irq_nvecs; i++) {
+               irq = &bp->irq_tbl[i];
+               rc = request_irq(irq->vector, irq->handler, flags, irq->name,
+                                dev);
+               if (rc)
+                       break;
+               irq->requested = 1;
+       }
        return rc;
 }
 
@@ -4964,13 +5424,81 @@ static void
 bnx2_free_irq(struct bnx2 *bp)
 {
        struct net_device *dev = bp->dev;
+       struct bnx2_irq *irq;
+       int i;
 
-       if (bp->flags & USING_MSI_FLAG) {
-               free_irq(bp->pdev->irq, dev);
+       for (i = 0; i < bp->irq_nvecs; i++) {
+               irq = &bp->irq_tbl[i];
+               if (irq->requested)
+                       free_irq(irq->vector, dev);
+               irq->requested = 0;
+       }
+       if (bp->flags & USING_MSI_FLAG)
                pci_disable_msi(bp->pdev);
-               bp->flags &= ~(USING_MSI_FLAG | ONE_SHOT_MSI_FLAG);
-       } else
-               free_irq(bp->pdev->irq, dev);
+       else if (bp->flags & USING_MSIX_FLAG)
+               pci_disable_msix(bp->pdev);
+
+       bp->flags &= ~(USING_MSI_OR_MSIX_FLAG | ONE_SHOT_MSI_FLAG);
+}
+
+static void
+bnx2_enable_msix(struct bnx2 *bp)
+{
+       int i, rc;
+       struct msix_entry msix_ent[BNX2_MAX_MSIX_VEC];
+
+       bnx2_setup_msix_tbl(bp);
+       REG_WR(bp, BNX2_PCI_MSIX_CONTROL, BNX2_MAX_MSIX_HW_VEC - 1);
+       REG_WR(bp, BNX2_PCI_MSIX_TBL_OFF_BIR, BNX2_PCI_GRC_WINDOW2_BASE);
+       REG_WR(bp, BNX2_PCI_MSIX_PBA_OFF_BIT, BNX2_PCI_GRC_WINDOW3_BASE);
+
+       for (i = 0; i < BNX2_MAX_MSIX_VEC; i++) {
+               msix_ent[i].entry = i;
+               msix_ent[i].vector = 0;
+       }
+
+       rc = pci_enable_msix(bp->pdev, msix_ent, BNX2_MAX_MSIX_VEC);
+       if (rc != 0)
+               return;
+
+       bp->irq_tbl[BNX2_BASE_VEC].handler = bnx2_msi_1shot;
+       bp->irq_tbl[BNX2_TX_VEC].handler = bnx2_tx_msix;
+
+       strcpy(bp->irq_tbl[BNX2_BASE_VEC].name, bp->dev->name);
+       strcat(bp->irq_tbl[BNX2_BASE_VEC].name, "-base");
+       strcpy(bp->irq_tbl[BNX2_TX_VEC].name, bp->dev->name);
+       strcat(bp->irq_tbl[BNX2_TX_VEC].name, "-tx");
+
+       bp->irq_nvecs = BNX2_MAX_MSIX_VEC;
+       bp->flags |= USING_MSIX_FLAG | ONE_SHOT_MSI_FLAG;
+       for (i = 0; i < BNX2_MAX_MSIX_VEC; i++)
+               bp->irq_tbl[i].vector = msix_ent[i].vector;
+}
+
+static void
+bnx2_setup_int_mode(struct bnx2 *bp, int dis_msi)
+{
+       bp->irq_tbl[0].handler = bnx2_interrupt;
+       strcpy(bp->irq_tbl[0].name, bp->dev->name);
+       bp->irq_nvecs = 1;
+       bp->irq_tbl[0].vector = bp->pdev->irq;
+
+       if ((bp->flags & MSIX_CAP_FLAG) && !dis_msi)
+               bnx2_enable_msix(bp);
+
+       if ((bp->flags & MSI_CAP_FLAG) && !dis_msi &&
+           !(bp->flags & USING_MSIX_FLAG)) {
+               if (pci_enable_msi(bp->pdev) == 0) {
+                       bp->flags |= USING_MSI_FLAG;
+                       if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+                               bp->flags |= ONE_SHOT_MSI_FLAG;
+                               bp->irq_tbl[0].handler = bnx2_msi_1shot;
+                       } else
+                               bp->irq_tbl[0].handler = bnx2_msi;
+
+                       bp->irq_tbl[0].vector = bp->pdev->irq;
+               }
+       }
 }
 
 /* Called with rtnl_lock */
@@ -4989,19 +5517,12 @@ bnx2_open(struct net_device *dev)
        if (rc)
                return rc;
 
-       napi_enable(&bp->napi);
-
-       if ((bp->flags & MSI_CAP_FLAG) && !disable_msi) {
-               if (pci_enable_msi(bp->pdev) == 0) {
-                       bp->flags |= USING_MSI_FLAG;
-                       if (CHIP_NUM(bp) == CHIP_NUM_5709)
-                               bp->flags |= ONE_SHOT_MSI_FLAG;
-               }
-       }
+       bnx2_setup_int_mode(bp, disable_msi);
+       bnx2_napi_enable(bp);
        rc = bnx2_request_irq(bp);
 
        if (rc) {
-               napi_disable(&bp->napi);
+               bnx2_napi_disable(bp);
                bnx2_free_mem(bp);
                return rc;
        }
@@ -5009,7 +5530,7 @@ bnx2_open(struct net_device *dev)
        rc = bnx2_init_nic(bp);
 
        if (rc) {
-               napi_disable(&bp->napi);
+               bnx2_napi_disable(bp);
                bnx2_free_irq(bp);
                bnx2_free_skbs(bp);
                bnx2_free_mem(bp);
@@ -5036,13 +5557,15 @@ bnx2_open(struct net_device *dev)
                        bnx2_disable_int(bp);
                        bnx2_free_irq(bp);
 
+                       bnx2_setup_int_mode(bp, 1);
+
                        rc = bnx2_init_nic(bp);
 
                        if (!rc)
                                rc = bnx2_request_irq(bp);
 
                        if (rc) {
-                               napi_disable(&bp->napi);
+                               bnx2_napi_disable(bp);
                                bnx2_free_skbs(bp);
                                bnx2_free_mem(bp);
                                del_timer_sync(&bp->timer);
@@ -5051,9 +5574,10 @@ bnx2_open(struct net_device *dev)
                        bnx2_enable_int(bp);
                }
        }
-       if (bp->flags & USING_MSI_FLAG) {
+       if (bp->flags & USING_MSI_FLAG)
                printk(KERN_INFO PFX "%s: using MSI\n", dev->name);
-       }
+       else if (bp->flags & USING_MSIX_FLAG)
+               printk(KERN_INFO PFX "%s: using MSIX\n", dev->name);
 
        netif_start_queue(dev);
 
@@ -5117,8 +5641,10 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
        u32 len, vlan_tag_flags, last_frag, mss;
        u16 prod, ring_prod;
        int i;
+       struct bnx2_napi *bnapi = &bp->bnx2_napi[bp->tx_vec];
 
-       if (unlikely(bnx2_tx_avail(bp) < (skb_shinfo(skb)->nr_frags + 1))) {
+       if (unlikely(bnx2_tx_avail(bp, bnapi) <
+           (skb_shinfo(skb)->nr_frags + 1))) {
                netif_stop_queue(dev);
                printk(KERN_ERR PFX "%s: BUG! Tx ring full when queue awake!\n",
                        dev->name);
@@ -5233,9 +5759,9 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
        bp->tx_prod = prod;
        dev->trans_start = jiffies;
 
-       if (unlikely(bnx2_tx_avail(bp) <= MAX_SKB_FRAGS)) {
+       if (unlikely(bnx2_tx_avail(bp, bnapi) <= MAX_SKB_FRAGS)) {
                netif_stop_queue(dev);
-               if (bnx2_tx_avail(bp) > bp->tx_wake_thresh)
+               if (bnx2_tx_avail(bp, bnapi) > bp->tx_wake_thresh)
                        netif_wake_queue(dev);
        }
 
@@ -5257,7 +5783,7 @@ bnx2_close(struct net_device *dev)
                msleep(1);
 
        bnx2_disable_int_sync(bp);
-       napi_disable(&bp->napi);
+       bnx2_napi_disable(bp);
        del_timer_sync(&bp->timer);
        if (bp->flags & NO_WOL_FLAG)
                reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN;
@@ -5776,27 +6302,19 @@ bnx2_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
 
        ering->rx_max_pending = MAX_TOTAL_RX_DESC_CNT;
        ering->rx_mini_max_pending = 0;
-       ering->rx_jumbo_max_pending = 0;
+       ering->rx_jumbo_max_pending = MAX_TOTAL_RX_PG_DESC_CNT;
 
        ering->rx_pending = bp->rx_ring_size;
        ering->rx_mini_pending = 0;
-       ering->rx_jumbo_pending = 0;
+       ering->rx_jumbo_pending = bp->rx_pg_ring_size;
 
        ering->tx_max_pending = MAX_TX_DESC_CNT;
        ering->tx_pending = bp->tx_ring_size;
 }
 
 static int
-bnx2_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
+bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
 {
-       struct bnx2 *bp = netdev_priv(dev);
-
-       if ((ering->rx_pending > MAX_TOTAL_RX_DESC_CNT) ||
-               (ering->tx_pending > MAX_TX_DESC_CNT) ||
-               (ering->tx_pending <= MAX_SKB_FRAGS)) {
-
-               return -EINVAL;
-       }
        if (netif_running(bp->dev)) {
                bnx2_netif_stop(bp);
                bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET);
@@ -5804,8 +6322,8 @@ bnx2_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
                bnx2_free_mem(bp);
        }
 
-       bnx2_set_rx_ring_size(bp, ering->rx_pending);
-       bp->tx_ring_size = ering->tx_pending;
+       bnx2_set_rx_ring_size(bp, rx);
+       bp->tx_ring_size = tx;
 
        if (netif_running(bp->dev)) {
                int rc;
@@ -5816,10 +6334,25 @@ bnx2_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
                bnx2_init_nic(bp);
                bnx2_netif_start(bp);
        }
-
        return 0;
 }
 
+static int
+bnx2_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
+{
+       struct bnx2 *bp = netdev_priv(dev);
+       int rc;
+
+       if ((ering->rx_pending > MAX_TOTAL_RX_DESC_CNT) ||
+               (ering->tx_pending > MAX_TX_DESC_CNT) ||
+               (ering->tx_pending <= MAX_SKB_FRAGS)) {
+
+               return -EINVAL;
+       }
+       rc = bnx2_change_ring_size(bp, ering->rx_pending, ering->tx_pending);
+       return rc;
+}
+
 static void
 bnx2_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
 {
@@ -6308,14 +6841,7 @@ bnx2_change_mtu(struct net_device *dev, int new_mtu)
                return -EINVAL;
 
        dev->mtu = new_mtu;
-       if (netif_running(dev)) {
-               bnx2_netif_stop(bp);
-
-               bnx2_init_nic(bp);
-
-               bnx2_netif_start(bp);
-       }
-       return 0;
+       return (bnx2_change_ring_size(bp, bp->rx_ring_size, bp->tx_ring_size));
 }
 
 #if defined(HAVE_POLL_CONTROLLER) || defined(CONFIG_NET_POLL_CONTROLLER)
@@ -6515,6 +7041,11 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
                }
        }
 
+       if (CHIP_NUM(bp) == CHIP_NUM_5709 && CHIP_REV(bp) != CHIP_REV_Ax) {
+               if (pci_find_capability(pdev, PCI_CAP_ID_MSIX))
+                       bp->flags |= MSIX_CAP_FLAG;
+       }
+
        if (CHIP_ID(bp) != CHIP_ID_5706_A0 && CHIP_ID(bp) != CHIP_ID_5706_A1) {
                if (pci_find_capability(pdev, PCI_CAP_ID_MSI))
                        bp->flags |= MSI_CAP_FLAG;
@@ -6636,13 +7167,13 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        bp->mac_addr[4] = (u8) (reg >> 8);
        bp->mac_addr[5] = (u8) reg;
 
+       bp->rx_offset = sizeof(struct l2_fhdr) + 2;
+
        bp->tx_ring_size = MAX_TX_DESC_CNT;
        bnx2_set_rx_ring_size(bp, 255);
 
        bp->rx_csum = 1;
 
-       bp->rx_offset = sizeof(struct l2_fhdr) + 2;
-
        bp->tx_quick_cons_trip_int = 20;
        bp->tx_quick_cons_trip = 20;
        bp->tx_ticks_int = 80;
@@ -6685,8 +7216,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        } else if (CHIP_NUM(bp) == CHIP_NUM_5706 ||
                   CHIP_NUM(bp) == CHIP_NUM_5708)
                bp->phy_flags |= PHY_CRC_FIX_FLAG;
-       else if (CHIP_ID(bp) == CHIP_ID_5709_A0 ||
-                CHIP_ID(bp) == CHIP_ID_5709_A1)
+       else if (CHIP_NUM(bp) == CHIP_NUM_5709 &&
+                (CHIP_REV(bp) == CHIP_REV_Ax ||
+                 CHIP_REV(bp) == CHIP_REV_Bx))
                bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG;
 
        if ((CHIP_ID(bp) == CHIP_ID_5708_A0) ||
@@ -6781,6 +7313,21 @@ bnx2_bus_string(struct bnx2 *bp, char *str)
        return str;
 }
 
+static void __devinit
+bnx2_init_napi(struct bnx2 *bp)
+{
+       int i;
+       struct bnx2_napi *bnapi;
+
+       for (i = 0; i < BNX2_MAX_MSIX_VEC; i++) {
+               bnapi = &bp->bnx2_napi[i];
+               bnapi->bp = bp;
+       }
+       netif_napi_add(bp->dev, &bp->bnx2_napi[0].napi, bnx2_poll, 64);
+       netif_napi_add(bp->dev, &bp->bnx2_napi[BNX2_TX_VEC].napi, bnx2_tx_poll,
+                      64);
+}
+
 static int __devinit
 bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
@@ -6822,7 +7369,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        dev->ethtool_ops = &bnx2_ethtool_ops;
 
        bp = netdev_priv(dev);
-       netif_napi_add(dev, &bp->napi, bnx2_poll, 64);
+       bnx2_init_napi(bp);
 
 #if defined(HAVE_POLL_CONTROLLER) || defined(CONFIG_NET_POLL_CONTROLLER)
        dev->poll_controller = poll_bnx2;