Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23315
b: refs/heads/master
c: 29b4e88
h: refs/heads/master
i:
  23313: 3faaac4
  23311: d2a1006
v: v3
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Mar 23, 2006
1 parent e26c149 commit 85325cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 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: 866b4f3e94a7568a1cb0018c061e19e120de6922
refs/heads/master: 29b4e886cbba5e0b0e4379fea7fc313e7808b5c2
20 changes: 10 additions & 10 deletions trunk/drivers/net/skge.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,8 +847,7 @@ static void skge_link_up(struct skge_port *skge)
LED_BLK_OFF|LED_SYNC_OFF|LED_ON);

netif_carrier_on(skge->netdev);
if (skge->tx_avail > MAX_SKB_FRAGS + 1)
netif_wake_queue(skge->netdev);
netif_wake_queue(skge->netdev);

if (netif_msg_link(skge))
printk(KERN_INFO PFX
Expand Down Expand Up @@ -2190,8 +2189,6 @@ static int skge_up(struct net_device *dev)
if (err)
goto free_rx_ring;

skge->tx_avail = skge->tx_ring.count - 1;

/* Initialize MAC */
spin_lock_bh(&hw->phy_lock);
if (hw->chip_id == CHIP_ID_GENESIS)
Expand Down Expand Up @@ -2294,6 +2291,12 @@ static int skge_down(struct net_device *dev)
return 0;
}

static inline int skge_avail(const struct skge_ring *ring)
{
return ((ring->to_clean > ring->to_use) ? 0 : ring->count)
+ (ring->to_clean - ring->to_use) - 1;
}

static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
{
struct skge_port *skge = netdev_priv(dev);
Expand All @@ -2314,7 +2317,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_LOCKED;
}

if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) {
if (unlikely(skge_avail(&skge->tx_ring) < skb_shinfo(skb)->nr_frags + 1)) {
if (!netif_queue_stopped(dev)) {
netif_stop_queue(dev);

Expand Down Expand Up @@ -2390,8 +2393,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
dev->name, e - ring->start, skb->len);

ring->to_use = e->next;
skge->tx_avail -= skb_shinfo(skb)->nr_frags + 1;
if (skge->tx_avail <= MAX_SKB_FRAGS + 1) {
if (skge_avail(&skge->tx_ring) <= MAX_SKB_FRAGS + 1) {
pr_debug("%s: transmit queue full\n", dev->name);
netif_stop_queue(dev);
}
Expand All @@ -2416,14 +2418,12 @@ static void skge_tx_complete(struct skge_port *skge, struct skge_element *last)
e->skb = NULL;
pci_unmap_single(pdev, pci_unmap_addr(e, mapaddr),
skb_headlen(skb), PCI_DMA_TODEVICE);
++skge->tx_avail;

for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
e = e->next;
pci_unmap_page(pdev, pci_unmap_addr(e, mapaddr),
skb_shinfo(skb)->frags[i].size,
PCI_DMA_TODEVICE);
++skge->tx_avail;
}

dev_kfree_skb(skb);
Expand Down Expand Up @@ -2688,7 +2688,7 @@ static void skge_tx_done(struct skge_port *skge)

skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F);

if (skge->tx_avail > MAX_SKB_FRAGS + 1)
if (skge_avail(&skge->tx_ring) > MAX_SKB_FRAGS + 1)
netif_wake_queue(skge->netdev);

spin_unlock(&skge->tx_lock);
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/net/skge.h
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,6 @@ struct skge_port {
int port;

spinlock_t tx_lock;
u32 tx_avail;
struct skge_ring tx_ring;
struct skge_ring rx_ring;

Expand Down

0 comments on commit 85325cf

Please sign in to comment.