aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index b1a5886a48a0..1eefacbfcd2e 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -958,7 +958,7 @@ static int sky2_up(struct net_device *dev)
958 if (!sky2->tx_le) 958 if (!sky2->tx_le)
959 goto err_out; 959 goto err_out;
960 960
961 sky2->tx_ring = kzalloc(TX_RING_SIZE * sizeof(struct ring_info), 961 sky2->tx_ring = kcalloc(TX_RING_SIZE, sizeof(struct tx_ring_info),
962 GFP_KERNEL); 962 GFP_KERNEL);
963 if (!sky2->tx_ring) 963 if (!sky2->tx_ring)
964 goto err_out; 964 goto err_out;
@@ -970,7 +970,7 @@ static int sky2_up(struct net_device *dev)
970 goto err_out; 970 goto err_out;
971 memset(sky2->rx_le, 0, RX_LE_BYTES); 971 memset(sky2->rx_le, 0, RX_LE_BYTES);
972 972
973 sky2->rx_ring = kzalloc(sky2->rx_pending * sizeof(struct ring_info), 973 sky2->rx_ring = kcalloc(sky2->rx_pending, sizeof(struct ring_info),
974 GFP_KERNEL); 974 GFP_KERNEL);
975 if (!sky2->rx_ring) 975 if (!sky2->rx_ring)
976 goto err_out; 976 goto err_out;
@@ -1070,7 +1070,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1070 struct sky2_port *sky2 = netdev_priv(dev); 1070 struct sky2_port *sky2 = netdev_priv(dev);
1071 struct sky2_hw *hw = sky2->hw; 1071 struct sky2_hw *hw = sky2->hw;
1072 struct sky2_tx_le *le = NULL; 1072 struct sky2_tx_le *le = NULL;
1073 struct ring_info *re; 1073 struct tx_ring_info *re;
1074 unsigned i, len; 1074 unsigned i, len;
1075 dma_addr_t mapping; 1075 dma_addr_t mapping;
1076 u32 addr64; 1076 u32 addr64;
@@ -1173,11 +1173,11 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1173 1173
1174 /* Record the transmit mapping info */ 1174 /* Record the transmit mapping info */
1175 re->skb = skb; 1175 re->skb = skb;
1176 re->mapaddr = mapping; 1176 pci_unmap_addr_set(re, mapaddr, mapping);
1177 1177
1178 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 1178 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1179 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 1179 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1180 struct ring_info *fre; 1180 struct tx_ring_info *fre;
1181 1181
1182 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset, 1182 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset,
1183 frag->size, PCI_DMA_TODEVICE); 1183 frag->size, PCI_DMA_TODEVICE);
@@ -1198,9 +1198,9 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1198 1198
1199 fre = sky2->tx_ring 1199 fre = sky2->tx_ring
1200 + ((re - sky2->tx_ring) + i + 1) % TX_RING_SIZE; 1200 + ((re - sky2->tx_ring) + i + 1) % TX_RING_SIZE;
1201 fre->skb = NULL; 1201 pci_unmap_addr_set(fre, mapaddr, mapping);
1202 fre->mapaddr = mapping;
1203 } 1202 }
1203
1204 re->idx = sky2->tx_prod; 1204 re->idx = sky2->tx_prod;
1205 le->ctrl |= EOP; 1205 le->ctrl |= EOP;
1206 1206
@@ -1239,7 +1239,7 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
1239 spin_lock(&sky2->tx_lock); 1239 spin_lock(&sky2->tx_lock);
1240 1240
1241 while (sky2->tx_cons != done) { 1241 while (sky2->tx_cons != done) {
1242 struct ring_info *re = sky2->tx_ring + sky2->tx_cons; 1242 struct tx_ring_info *re = sky2->tx_ring + sky2->tx_cons;
1243 struct sk_buff *skb; 1243 struct sk_buff *skb;
1244 1244
1245 /* Check for partial status */ 1245 /* Check for partial status */
@@ -1248,15 +1248,17 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
1248 goto out; 1248 goto out;
1249 1249
1250 skb = re->skb; 1250 skb = re->skb;
1251 pci_unmap_single(sky2->hw->pdev, re->mapaddr, 1251 pci_unmap_single(sky2->hw->pdev,
1252 pci_unmap_addr(re, mapaddr),
1252 skb_headlen(skb), PCI_DMA_TODEVICE); 1253 skb_headlen(skb), PCI_DMA_TODEVICE);
1253 1254
1254 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 1255 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1255 struct ring_info *fre; 1256 struct tx_ring_info *fre;
1256 fre = 1257 fre =
1257 sky2->tx_ring + (sky2->tx_cons + i + 1258 sky2->tx_ring + (sky2->tx_cons + i +
1258 1) % TX_RING_SIZE; 1259 1) % TX_RING_SIZE;
1259 pci_unmap_page(sky2->hw->pdev, fre->mapaddr, 1260 pci_unmap_page(sky2->hw->pdev,
1261 pci_unmap_addr(fre, mapaddr),
1260 skb_shinfo(skb)->frags[i].size, 1262 skb_shinfo(skb)->frags[i].size,
1261 PCI_DMA_TODEVICE); 1263 PCI_DMA_TODEVICE);
1262 } 1264 }