aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2005-07-25 15:31:17 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-25 15:31:17 -0400
commit7e72aad48c3790636bfa006f3b0027852ccad47e (patch)
treeba2f201b4554f95b3e432f75f6cc7a2cbb296f70
parent0f893dc6ec890058d926224c8aa254d8621e0ea3 (diff)
[TG3]: add variable buffer size for standard ring
Add a new rx_pkt_buf_sz to the tg3 structure to support variable buffer sizes on the standard ring. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tg3.c11
-rw-r--r--drivers/net/tg3.h2
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 9188a9b3ba2e..eca4b91454c0 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2621,7 +2621,7 @@ static int tg3_alloc_rx_skb(struct tg3 *tp, u32 opaque_key,
2621 map = &tp->rx_std_buffers[dest_idx]; 2621 map = &tp->rx_std_buffers[dest_idx];
2622 if (src_idx >= 0) 2622 if (src_idx >= 0)
2623 src_map = &tp->rx_std_buffers[src_idx]; 2623 src_map = &tp->rx_std_buffers[src_idx];
2624 skb_size = RX_PKT_BUF_SZ; 2624 skb_size = tp->rx_pkt_buf_sz;
2625 break; 2625 break;
2626 2626
2627 case RXD_OPAQUE_RING_JUMBO: 2627 case RXD_OPAQUE_RING_JUMBO:
@@ -3500,7 +3500,7 @@ static void tg3_free_rings(struct tg3 *tp)
3500 continue; 3500 continue;
3501 pci_unmap_single(tp->pdev, 3501 pci_unmap_single(tp->pdev,
3502 pci_unmap_addr(rxp, mapping), 3502 pci_unmap_addr(rxp, mapping),
3503 RX_PKT_BUF_SZ - tp->rx_offset, 3503 tp->rx_pkt_buf_sz - tp->rx_offset,
3504 PCI_DMA_FROMDEVICE); 3504 PCI_DMA_FROMDEVICE);
3505 dev_kfree_skb_any(rxp->skb); 3505 dev_kfree_skb_any(rxp->skb);
3506 rxp->skb = NULL; 3506 rxp->skb = NULL;
@@ -3573,6 +3573,11 @@ static void tg3_init_rings(struct tg3 *tp)
3573 memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); 3573 memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
3574 memset(tp->tx_ring, 0, TG3_TX_RING_BYTES); 3574 memset(tp->tx_ring, 0, TG3_TX_RING_BYTES);
3575 3575
3576 tp->rx_pkt_buf_sz = RX_PKT_BUF_SZ;
3577 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) &&
3578 (tp->dev->mtu > ETH_DATA_LEN))
3579 tp->rx_pkt_buf_sz = RX_JUMBO_PKT_BUF_SZ;
3580
3576 /* Initialize invariants of the rings, we only set this 3581 /* Initialize invariants of the rings, we only set this
3577 * stuff once. This works because the card does not 3582 * stuff once. This works because the card does not
3578 * write into the rx buffer posting rings. 3583 * write into the rx buffer posting rings.
@@ -3581,7 +3586,7 @@ static void tg3_init_rings(struct tg3 *tp)
3581 struct tg3_rx_buffer_desc *rxd; 3586 struct tg3_rx_buffer_desc *rxd;
3582 3587
3583 rxd = &tp->rx_std[i]; 3588 rxd = &tp->rx_std[i];
3584 rxd->idx_len = (RX_PKT_BUF_SZ - tp->rx_offset - 64) 3589 rxd->idx_len = (tp->rx_pkt_buf_sz - tp->rx_offset - 64)
3585 << RXD_LEN_SHIFT; 3590 << RXD_LEN_SHIFT;
3586 rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT); 3591 rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT);
3587 rxd->opaque = (RXD_OPAQUE_RING_STD | 3592 rxd->opaque = (RXD_OPAQUE_RING_STD |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 7cb2eefa7aad..15eb2bdb2de1 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2088,6 +2088,8 @@ struct tg3 {
2088 struct tg3_rx_buffer_desc *rx_rcb; 2088 struct tg3_rx_buffer_desc *rx_rcb;
2089 dma_addr_t rx_rcb_mapping; 2089 dma_addr_t rx_rcb_mapping;
2090 2090
2091 u32 rx_pkt_buf_sz;
2092
2091 /* begin "everything else" cacheline(s) section */ 2093 /* begin "everything else" cacheline(s) section */
2092 struct net_device_stats net_stats; 2094 struct net_device_stats net_stats;
2093 struct net_device_stats net_stats_prev; 2095 struct net_device_stats net_stats_prev;