Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15748
b: refs/heads/master
c: 13210ce
h: refs/heads/master
v: v3
  • Loading branch information
shemminger@osdl.org authored and Jeff Garzik committed Dec 1, 2005
1 parent ae43d98 commit 3900afd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 42eeea0145a1c7570624ddeaa15d3f357a52edf8
refs/heads/master: 13210ce5c06ed9537558b85e9c0df4248b28f1f7
66 changes: 34 additions & 32 deletions trunk/drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@
unlikely((hw)->chip_id == CHIP_ID_YUKON_EC && \
(hw)->chip_rev == CHIP_REV_YU_EC_A1)

#define RX_LE_SIZE 256
#define RX_LE_SIZE 512
#define RX_LE_BYTES (RX_LE_SIZE*sizeof(struct sky2_rx_le))
#define RX_MAX_PENDING (RX_LE_SIZE/2 - 2)
#define RX_DEF_PENDING 128
#define RX_DEF_PENDING RX_MAX_PENDING
#define RX_COPY_THRESHOLD 256

#define TX_RING_SIZE 512
Expand Down Expand Up @@ -1596,7 +1596,6 @@ static struct sk_buff *sky2_receive(struct sky2_port *sky2,
{
struct ring_info *re = sky2->rx_ring + sky2->rx_next;
struct sk_buff *skb = NULL;
struct net_device *dev;
const unsigned int bufsize = rx_size(sky2);

if (unlikely(netif_msg_rx_status(sky2)))
Expand Down Expand Up @@ -1643,11 +1642,6 @@ static struct sk_buff *sky2_receive(struct sky2_port *sky2,
}

skb_put(skb, length);
dev = sky2->netdev;
skb->dev = dev;
skb->protocol = eth_type_trans(skb, dev);
dev->last_rx = jiffies;

resubmit:
re->skb->ip_summed = CHECKSUM_NONE;
sky2_rx_add(sky2, re);
Expand Down Expand Up @@ -1702,35 +1696,42 @@ static int sky2_poll(struct net_device *dev0, int *budget)
BUG_ON(hwidx >= STATUS_RING_SIZE);
rmb();

do {
struct sky2_status_le *le = hw->st_le + hw->st_idx;
while (hwidx != hw->st_idx) {
struct sky2_status_le *le = hw->st_le + hw->st_idx;
struct net_device *dev;
struct sky2_port *sky2;
struct sk_buff *skb;
u32 status;
u16 length;
u8 op;

/* Are we done yet? */
if (hw->st_idx == hwidx) {
sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
hwidx = sky2_read16(hw, STAT_PUT_IDX);
if (hwidx == hw->st_idx)
break;
}

le = hw->st_le + hw->st_idx;
hw->st_idx = (hw->st_idx + 1) % STATUS_RING_SIZE;
prefetch(&hw->st_le[hw->st_idx]);
prefetch(hw->st_le + hw->st_idx);

BUG_ON(le->link >= hw->ports || !hw->dev[le->link]);

sky2 = netdev_priv(hw->dev[le->link]);
BUG_ON(le->link >= 2);
dev = hw->dev[le->link];
if (dev == NULL || !netif_running(dev))
continue;

sky2 = netdev_priv(dev);
status = le32_to_cpu(le->status);
length = le16_to_cpu(le->length);
op = le->opcode & ~HW_OWNER;
le->opcode = 0;

switch (le->opcode & ~HW_OWNER) {
switch (op) {
case OP_RXSTAT:
skb = sky2_receive(sky2, length, status);
if (!skb)
break;

skb->dev = dev;
skb->protocol = eth_type_trans(skb, dev);
dev->last_rx = jiffies;

#ifdef SKY2_VLAN_TAG_USED
if (sky2->vlgrp && (status & GMR_FS_VLAN)) {
vlan_hwaccel_receive_skb(skb,
Expand All @@ -1739,7 +1740,9 @@ static int sky2_poll(struct net_device *dev0, int *budget)
} else
#endif
netif_receive_skb(skb);
++work_done;

if (++work_done >= to_do)
goto exit_loop;
break;

#ifdef SKY2_VLAN_TAG_USED
Expand All @@ -1765,18 +1768,15 @@ static int sky2_poll(struct net_device *dev0, int *budget)
default:
if (net_ratelimit())
printk(KERN_WARNING PFX
"unknown status opcode 0x%x\n",
le->opcode);
"unknown status opcode 0x%x\n", op);
break;
}
}

le->opcode = 0; /* paranoia */
} while (work_done < to_do);
exit_loop:

mmiowb();

*budget -= work_done;
dev0->quota -= work_done;
if (work_done < to_do) {
/*
* Another chip workaround, need to restart TX timer if status
Expand All @@ -1790,11 +1790,13 @@ static int sky2_poll(struct net_device *dev0, int *budget)
netif_rx_complete(dev0);
hw->intr_mask |= Y2_IS_STAT_BMU;
sky2_write32(hw, B0_IMSK, hw->intr_mask);
sky2_read32(hw, B0_IMSK);
mmiowb();
return 0;
} else {
*budget -= work_done;
dev0->quota -= work_done;
return 1;
}

return work_done >= to_do;

}

static void sky2_hw_error(struct sky2_hw *hw, unsigned port, u32 status)
Expand Down

0 comments on commit 3900afd

Please sign in to comment.