Commit 55c9dd35 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Jeff Garzik

sky2: receive fill

Simplify receive buffer refill logic. Rather than trying to update
incrementally; do receive ring refill at end of receive processing.
Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 5c11ce70
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
#define RX_MAX_PENDING (RX_LE_SIZE/6 - 2) #define RX_MAX_PENDING (RX_LE_SIZE/6 - 2)
#define RX_DEF_PENDING RX_MAX_PENDING #define RX_DEF_PENDING RX_MAX_PENDING
#define RX_SKB_ALIGN 8 #define RX_SKB_ALIGN 8
#define RX_BUF_WRITE 16
#define TX_RING_SIZE 512 #define TX_RING_SIZE 512
#define TX_DEF_PENDING (TX_RING_SIZE - 1) #define TX_DEF_PENDING (TX_RING_SIZE - 1)
...@@ -1138,6 +1137,11 @@ static struct sk_buff *sky2_rx_alloc(struct sky2_port *sky2) ...@@ -1138,6 +1137,11 @@ static struct sk_buff *sky2_rx_alloc(struct sky2_port *sky2)
return NULL; return NULL;
} }
static inline void sky2_rx_update(struct sky2_port *sky2, unsigned rxq)
{
sky2_put_idx(sky2->hw, rxq, sky2->rx_put);
}
/* /*
* Allocate and setup receiver buffer pool. * Allocate and setup receiver buffer pool.
* Normal case this ends up creating one list element for skb * Normal case this ends up creating one list element for skb
...@@ -1229,7 +1233,7 @@ static int sky2_rx_start(struct sky2_port *sky2) ...@@ -1229,7 +1233,7 @@ static int sky2_rx_start(struct sky2_port *sky2)
} }
/* Tell chip about available buffers */ /* Tell chip about available buffers */
sky2_put_idx(hw, rxq, sky2->rx_put); sky2_rx_update(sky2, rxq);
return 0; return 0;
nomem: nomem:
sky2_rx_clean(sky2); sky2_rx_clean(sky2);
...@@ -2147,14 +2151,14 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) ...@@ -2147,14 +2151,14 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
/* Process status response ring */ /* Process status response ring */
static int sky2_status_intr(struct sky2_hw *hw, int to_do) static int sky2_status_intr(struct sky2_hw *hw, int to_do)
{ {
struct sky2_port *sky2;
int work_done = 0; int work_done = 0;
unsigned buf_write[2] = { 0, 0 }; unsigned rx[2] = { 0, 0 };
u16 hwidx = sky2_read16(hw, STAT_PUT_IDX); u16 hwidx = sky2_read16(hw, STAT_PUT_IDX);
rmb(); rmb();
while (hw->st_idx != hwidx) { while (hw->st_idx != hwidx) {
struct sky2_port *sky2;
struct sky2_status_le *le = hw->st_le + hw->st_idx; struct sky2_status_le *le = hw->st_le + hw->st_idx;
unsigned port = le->css & CSS_LINK_BIT; unsigned port = le->css & CSS_LINK_BIT;
struct net_device *dev; struct net_device *dev;
...@@ -2171,10 +2175,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do) ...@@ -2171,10 +2175,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
switch (le->opcode & ~HW_OWNER) { switch (le->opcode & ~HW_OWNER) {
case OP_RXSTAT: case OP_RXSTAT:
++rx[port];
skb = sky2_receive(dev, length, status); skb = sky2_receive(dev, length, status);
if (unlikely(!skb)) { if (unlikely(!skb)) {
sky2->net_stats.rx_dropped++; sky2->net_stats.rx_dropped++;
goto force_update; break;
} }
/* This chip reports checksum status differently */ /* This chip reports checksum status differently */
...@@ -2201,13 +2206,6 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do) ...@@ -2201,13 +2206,6 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
#endif #endif
netif_receive_skb(skb); netif_receive_skb(skb);
/* Update receiver after 16 frames */
if (++buf_write[port] == RX_BUF_WRITE) {
force_update:
sky2_put_idx(hw, rxqaddr[port], sky2->rx_put);
buf_write[port] = 0;
}
/* Stop after net poll weight */ /* Stop after net poll weight */
if (++work_done >= to_do) if (++work_done >= to_do)
goto exit_loop; goto exit_loop;
...@@ -2263,24 +2261,18 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do) ...@@ -2263,24 +2261,18 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING PFX printk(KERN_WARNING PFX
"unknown status opcode 0x%x\n", le->opcode); "unknown status opcode 0x%x\n", le->opcode);
goto exit_loop;
} }
} }
/* Fully processed status ring so clear irq */ /* Fully processed status ring so clear irq */
sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
mmiowb();
exit_loop: exit_loop:
if (buf_write[0]) { if (rx[0])
sky2 = netdev_priv(hw->dev[0]); sky2_rx_update(netdev_priv(hw->dev[0]), Q_R1);
sky2_put_idx(hw, Q_R1, sky2->rx_put);
}
if (buf_write[1]) { if (rx[1])
sky2 = netdev_priv(hw->dev[1]); sky2_rx_update(netdev_priv(hw->dev[1]), Q_R2);
sky2_put_idx(hw, Q_R2, sky2->rx_put);
}
return work_done; return work_done;
} }
......
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