Commit 4361935a authored by Matt Carlson's avatar Matt Carlson Committed by David S. Miller

tg3: Consider rx_std_prod_idx a hw mailbox

This patch changes how the code uses the rx_std_prod_idx member.  In the
following patch, the code will be changed so that it will act just like
a hardware mailbox.  This patch prepares the code so that memory barriers
can be more easily inserted.
Signed-off-by: default avatarMatt Carlson <mcarlson@broadcom.com>
Reviewed-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 411da640
...@@ -4537,6 +4537,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) ...@@ -4537,6 +4537,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
{ {
struct tg3 *tp = tnapi->tp; struct tg3 *tp = tnapi->tp;
u32 work_mask, rx_std_posted = 0; u32 work_mask, rx_std_posted = 0;
u32 std_prod_idx, jmb_prod_idx;
u32 sw_idx = tnapi->rx_rcb_ptr; u32 sw_idx = tnapi->rx_rcb_ptr;
u16 hw_idx; u16 hw_idx;
int received; int received;
...@@ -4550,6 +4551,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) ...@@ -4550,6 +4551,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
rmb(); rmb();
work_mask = 0; work_mask = 0;
received = 0; received = 0;
std_prod_idx = tpr->rx_std_prod_idx;
jmb_prod_idx = tpr->rx_jmb_prod_idx;
while (sw_idx != hw_idx && budget > 0) { while (sw_idx != hw_idx && budget > 0) {
struct ring_info *ri; struct ring_info *ri;
struct tg3_rx_buffer_desc *desc = &tnapi->rx_rcb[sw_idx]; struct tg3_rx_buffer_desc *desc = &tnapi->rx_rcb[sw_idx];
...@@ -4564,13 +4567,13 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) ...@@ -4564,13 +4567,13 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
ri = &tpr->rx_std_buffers[desc_idx]; ri = &tpr->rx_std_buffers[desc_idx];
dma_addr = pci_unmap_addr(ri, mapping); dma_addr = pci_unmap_addr(ri, mapping);
skb = ri->skb; skb = ri->skb;
post_ptr = &tpr->rx_std_prod_idx; post_ptr = &std_prod_idx;
rx_std_posted++; rx_std_posted++;
} else if (opaque_key == RXD_OPAQUE_RING_JUMBO) { } else if (opaque_key == RXD_OPAQUE_RING_JUMBO) {
ri = &tpr->rx_jmb_buffers[desc_idx]; ri = &tpr->rx_jmb_buffers[desc_idx];
dma_addr = pci_unmap_addr(ri, mapping); dma_addr = pci_unmap_addr(ri, mapping);
skb = ri->skb; skb = ri->skb;
post_ptr = &tpr->rx_jmb_prod_idx; post_ptr = &jmb_prod_idx;
} else } else
goto next_pkt_nopost; goto next_pkt_nopost;
...@@ -4687,14 +4690,14 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) ...@@ -4687,14 +4690,14 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
/* Refill RX ring(s). */ /* Refill RX ring(s). */
if (work_mask & RXD_OPAQUE_RING_STD) { if (work_mask & RXD_OPAQUE_RING_STD) {
sw_idx = tpr->rx_std_prod_idx % TG3_RX_RING_SIZE; tpr->rx_std_prod_idx = std_prod_idx % TG3_RX_RING_SIZE;
tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW,
sw_idx); tpr->rx_std_prod_idx);
} }
if (work_mask & RXD_OPAQUE_RING_JUMBO) { if (work_mask & RXD_OPAQUE_RING_JUMBO) {
sw_idx = tpr->rx_jmb_prod_idx % TG3_RX_JUMBO_RING_SIZE; tpr->rx_jmb_prod_idx = jmb_prod_idx % TG3_RX_JUMBO_RING_SIZE;
tw32_rx_mbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW, tw32_rx_mbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW,
sw_idx); tpr->rx_jmb_prod_idx);
} }
mmiowb(); mmiowb();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment