Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15794
b: refs/heads/master
c: 6cdbbdf
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Dec 12, 2005
1 parent 26ac912 commit 3a0c210
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 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: 734d18684695dd1c6a9527b50e01bba4acab4738
refs/heads/master: 6cdbbdf3055f4657c9d6ccc79257bbcac1a9a1fc
24 changes: 13 additions & 11 deletions trunk/drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ static int sky2_up(struct net_device *dev)
if (!sky2->tx_le)
goto err_out;

sky2->tx_ring = kzalloc(TX_RING_SIZE * sizeof(struct ring_info),
sky2->tx_ring = kcalloc(TX_RING_SIZE, sizeof(struct tx_ring_info),
GFP_KERNEL);
if (!sky2->tx_ring)
goto err_out;
Expand All @@ -970,7 +970,7 @@ static int sky2_up(struct net_device *dev)
goto err_out;
memset(sky2->rx_le, 0, RX_LE_BYTES);

sky2->rx_ring = kzalloc(sky2->rx_pending * sizeof(struct ring_info),
sky2->rx_ring = kcalloc(sky2->rx_pending, sizeof(struct ring_info),
GFP_KERNEL);
if (!sky2->rx_ring)
goto err_out;
Expand Down Expand Up @@ -1070,7 +1070,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
struct sky2_port *sky2 = netdev_priv(dev);
struct sky2_hw *hw = sky2->hw;
struct sky2_tx_le *le = NULL;
struct ring_info *re;
struct tx_ring_info *re;
unsigned i, len;
dma_addr_t mapping;
u32 addr64;
Expand Down Expand Up @@ -1173,11 +1173,11 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)

/* Record the transmit mapping info */
re->skb = skb;
re->mapaddr = mapping;
pci_unmap_addr_set(re, mapaddr, mapping);

for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
struct ring_info *fre;
struct tx_ring_info *fre;

mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset,
frag->size, PCI_DMA_TODEVICE);
Expand All @@ -1198,9 +1198,9 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)

fre = sky2->tx_ring
+ ((re - sky2->tx_ring) + i + 1) % TX_RING_SIZE;
fre->skb = NULL;
fre->mapaddr = mapping;
pci_unmap_addr_set(fre, mapaddr, mapping);
}

re->idx = sky2->tx_prod;
le->ctrl |= EOP;

Expand Down Expand Up @@ -1239,7 +1239,7 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
spin_lock(&sky2->tx_lock);

while (sky2->tx_cons != done) {
struct ring_info *re = sky2->tx_ring + sky2->tx_cons;
struct tx_ring_info *re = sky2->tx_ring + sky2->tx_cons;
struct sk_buff *skb;

/* Check for partial status */
Expand All @@ -1248,15 +1248,17 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
goto out;

skb = re->skb;
pci_unmap_single(sky2->hw->pdev, re->mapaddr,
pci_unmap_single(sky2->hw->pdev,
pci_unmap_addr(re, mapaddr),
skb_headlen(skb), PCI_DMA_TODEVICE);

for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
struct ring_info *fre;
struct tx_ring_info *fre;
fre =
sky2->tx_ring + (sky2->tx_cons + i +
1) % TX_RING_SIZE;
pci_unmap_page(sky2->hw->pdev, fre->mapaddr,
pci_unmap_page(sky2->hw->pdev,
pci_unmap_addr(fre, mapaddr),
skb_shinfo(skb)->frags[i].size,
PCI_DMA_TODEVICE);
}
Expand Down
9 changes: 7 additions & 2 deletions trunk/drivers/net/sky2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1777,10 +1777,15 @@ struct sky2_status_le {
u8 opcode;
} __attribute((packed));

struct tx_ring_info {
struct sk_buff *skb;
DECLARE_PCI_UNMAP_ADDR(mapaddr);
u16 idx;
};

struct ring_info {
struct sk_buff *skb;
dma_addr_t mapaddr;
u16 idx;
};

struct sky2_port {
Expand All @@ -1790,7 +1795,7 @@ struct sky2_port {
u32 msg_enable;

spinlock_t tx_lock ____cacheline_aligned_in_smp;
struct ring_info *tx_ring;
struct tx_ring_info *tx_ring;
struct sky2_tx_le *tx_le;
u16 tx_cons; /* next le to check */
u16 tx_prod; /* next le to use */
Expand Down

0 comments on commit 3a0c210

Please sign in to comment.