aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-09-01 09:16:33 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-02 03:43:52 -0400
commit0c1d0e2b05e92ad847b3ebe1c75b7974086bc8fa (patch)
treefab2d998ab474a4969f1717812fd7f80b047e616 /drivers/net/tg3.c
parentbaf8a94a572928710e9e60967d153a7bf3aebd9c (diff)
tg3: Adjust RSS ring allocation strategies
When multivector RSS is enabled, the first interrupt vector is only used to report link interrupts and error conditions. This patch changes the code so that rx and tx ring resources are not allocated for this vector. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 26e9db8c1b95..5782511c9459 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -4804,7 +4804,8 @@ static irqreturn_t tg3_msi_1shot(int irq, void *dev_id)
4804 struct tg3 *tp = tnapi->tp; 4804 struct tg3 *tp = tnapi->tp;
4805 4805
4806 prefetch(tnapi->hw_status); 4806 prefetch(tnapi->hw_status);
4807 prefetch(&tnapi->rx_rcb[tnapi->rx_rcb_ptr]); 4807 if (tnapi->rx_rcb)
4808 prefetch(&tnapi->rx_rcb[tnapi->rx_rcb_ptr]);
4808 4809
4809 if (likely(!tg3_irq_sync(tp))) 4810 if (likely(!tg3_irq_sync(tp)))
4810 napi_schedule(&tnapi->napi); 4811 napi_schedule(&tnapi->napi);
@@ -4822,7 +4823,8 @@ static irqreturn_t tg3_msi(int irq, void *dev_id)
4822 struct tg3 *tp = tnapi->tp; 4823 struct tg3 *tp = tnapi->tp;
4823 4824
4824 prefetch(tnapi->hw_status); 4825 prefetch(tnapi->hw_status);
4825 prefetch(&tnapi->rx_rcb[tnapi->rx_rcb_ptr]); 4826 if (tnapi->rx_rcb)
4827 prefetch(&tnapi->rx_rcb[tnapi->rx_rcb_ptr]);
4826 /* 4828 /*
4827 * Writing any value to intr-mbox-0 clears PCI INTA# and 4829 * Writing any value to intr-mbox-0 clears PCI INTA# and
4828 * chip-internal interrupt pending events. 4830 * chip-internal interrupt pending events.
@@ -5765,6 +5767,9 @@ static void tg3_free_rings(struct tg3 *tp)
5765 for (j = 0; j < tp->irq_cnt; j++) { 5767 for (j = 0; j < tp->irq_cnt; j++) {
5766 struct tg3_napi *tnapi = &tp->napi[j]; 5768 struct tg3_napi *tnapi = &tp->napi[j];
5767 5769
5770 if (!tnapi->tx_buffers)
5771 continue;
5772
5768 for (i = 0; i < TG3_TX_RING_SIZE; ) { 5773 for (i = 0; i < TG3_TX_RING_SIZE; ) {
5769 struct tx_ring_info *txp; 5774 struct tx_ring_info *txp;
5770 struct sk_buff *skb; 5775 struct sk_buff *skb;
@@ -5815,10 +5820,12 @@ static int tg3_init_rings(struct tg3 *tp)
5815 5820
5816 tnapi->tx_prod = 0; 5821 tnapi->tx_prod = 0;
5817 tnapi->tx_cons = 0; 5822 tnapi->tx_cons = 0;
5818 memset(tnapi->tx_ring, 0, TG3_TX_RING_BYTES); 5823 if (tnapi->tx_ring)
5824 memset(tnapi->tx_ring, 0, TG3_TX_RING_BYTES);
5819 5825
5820 tnapi->rx_rcb_ptr = 0; 5826 tnapi->rx_rcb_ptr = 0;
5821 memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); 5827 if (tnapi->rx_rcb)
5828 memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
5822 } 5829 }
5823 5830
5824 return tg3_rx_prodring_alloc(tp, &tp->prodring[0]); 5831 return tg3_rx_prodring_alloc(tp, &tp->prodring[0]);
@@ -5898,6 +5905,13 @@ static int tg3_alloc_consistent(struct tg3 *tp)
5898 5905
5899 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE); 5906 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
5900 5907
5908 /*
5909 * If multivector RSS is enabled, vector 0 does not handle
5910 * rx or tx interrupts. Don't allocate any resources for it.
5911 */
5912 if (!i && (tp->tg3_flags3 & TG3_FLG3_ENABLE_RSS))
5913 continue;
5914
5901 tnapi->rx_rcb = pci_alloc_consistent(tp->pdev, 5915 tnapi->rx_rcb = pci_alloc_consistent(tp->pdev,
5902 TG3_RX_RCB_RING_BYTES(tp), 5916 TG3_RX_RCB_RING_BYTES(tp),
5903 &tnapi->rx_rcb_mapping); 5917 &tnapi->rx_rcb_mapping);
@@ -10166,8 +10180,13 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
10166 struct tg3_napi *tnapi, *rnapi; 10180 struct tg3_napi *tnapi, *rnapi;
10167 struct tg3_rx_prodring_set *tpr = &tp->prodring[0]; 10181 struct tg3_rx_prodring_set *tpr = &tp->prodring[0];
10168 10182
10169 tnapi = &tp->napi[0]; 10183 if (tp->irq_cnt > 1) {
10170 rnapi = &tp->napi[0]; 10184 tnapi = &tp->napi[1];
10185 rnapi = &tp->napi[1];
10186 } else {
10187 tnapi = &tp->napi[0];
10188 rnapi = &tp->napi[0];
10189 }
10171 coal_now = tnapi->coal_now | rnapi->coal_now; 10190 coal_now = tnapi->coal_now | rnapi->coal_now;
10172 10191
10173 if (loopback_mode == TG3_MAC_LOOPBACK) { 10192 if (loopback_mode == TG3_MAC_LOOPBACK) {