diff options
20 files changed, 81 insertions, 91 deletions
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 6e1f5959a654..9ca45dcba755 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c | |||
@@ -2179,9 +2179,10 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2179 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 2179 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
2180 | 2180 | ||
2181 | vp->tx_ring[entry].frag[i+1].addr = | 2181 | vp->tx_ring[entry].frag[i+1].addr = |
2182 | cpu_to_le32(pci_map_single(VORTEX_PCI(vp), | 2182 | cpu_to_le32(pci_map_single( |
2183 | (void*)page_address(frag->page) + frag->page_offset, | 2183 | VORTEX_PCI(vp), |
2184 | frag->size, PCI_DMA_TODEVICE)); | 2184 | (void *)skb_frag_address(frag), |
2185 | frag->size, PCI_DMA_TODEVICE)); | ||
2185 | 2186 | ||
2186 | if (i == skb_shinfo(skb)->nr_frags-1) | 2187 | if (i == skb_shinfo(skb)->nr_frags-1) |
2187 | vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(frag->size|LAST_FRAG); | 2188 | vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(frag->size|LAST_FRAG); |
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index a5f6b07f8f3e..bc3bd34c43f1 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c | |||
@@ -113,9 +113,8 @@ static void greth_print_tx_packet(struct sk_buff *skb) | |||
113 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 113 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
114 | 114 | ||
115 | print_hex_dump(KERN_DEBUG, "TX: ", DUMP_PREFIX_OFFSET, 16, 1, | 115 | print_hex_dump(KERN_DEBUG, "TX: ", DUMP_PREFIX_OFFSET, 16, 1, |
116 | phys_to_virt(page_to_phys(skb_shinfo(skb)->frags[i].page)) + | 116 | skb_frag_address(&skb_shinfo(skb)->frags[i]), |
117 | skb_shinfo(skb)->frags[i].page_offset, | 117 | skb_shinfo(skb)->frags[i].size, true); |
118 | length, true); | ||
119 | } | 118 | } |
120 | } | 119 | } |
121 | 120 | ||
@@ -528,11 +527,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | |||
528 | 527 | ||
529 | greth_write_bd(&bdp->stat, status); | 528 | greth_write_bd(&bdp->stat, status); |
530 | 529 | ||
531 | dma_addr = dma_map_page(greth->dev, | 530 | dma_addr = skb_frag_dma_map(greth->dev, frag, 0, frag->size, |
532 | frag->page, | 531 | DMA_TO_DEVICE); |
533 | frag->page_offset, | ||
534 | frag->size, | ||
535 | DMA_TO_DEVICE); | ||
536 | 532 | ||
537 | if (unlikely(dma_mapping_error(greth->dev, dma_addr))) | 533 | if (unlikely(dma_mapping_error(greth->dev, dma_addr))) |
538 | goto frag_map_error; | 534 | goto frag_map_error; |
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c index 1d6f2db794fd..8794cf831bd0 100644 --- a/drivers/net/ethernet/alteon/acenic.c +++ b/drivers/net/ethernet/alteon/acenic.c | |||
@@ -2485,9 +2485,9 @@ restart: | |||
2485 | info = ap->skb->tx_skbuff + idx; | 2485 | info = ap->skb->tx_skbuff + idx; |
2486 | desc = ap->tx_ring + idx; | 2486 | desc = ap->tx_ring + idx; |
2487 | 2487 | ||
2488 | mapping = pci_map_page(ap->pdev, frag->page, | 2488 | mapping = skb_frag_dma_map(&ap->pdev->dev, frag, 0, |
2489 | frag->page_offset, frag->size, | 2489 | frag->size, |
2490 | PCI_DMA_TODEVICE); | 2490 | PCI_DMA_TODEVICE); |
2491 | 2491 | ||
2492 | flagsize = (frag->size << 16); | 2492 | flagsize = (frag->size << 16); |
2493 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 2493 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index acb4c1098cae..2b9f925fdfc0 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
@@ -2180,11 +2180,10 @@ static void atl1c_tx_map(struct atl1c_adapter *adapter, | |||
2180 | 2180 | ||
2181 | buffer_info = atl1c_get_tx_buffer(adapter, use_tpd); | 2181 | buffer_info = atl1c_get_tx_buffer(adapter, use_tpd); |
2182 | buffer_info->length = frag->size; | 2182 | buffer_info->length = frag->size; |
2183 | buffer_info->dma = | 2183 | buffer_info->dma = skb_frag_dma_map(&adapter->pdev->dev, |
2184 | pci_map_page(adapter->pdev, frag->page, | 2184 | frag, 0, |
2185 | frag->page_offset, | 2185 | buffer_info->length, |
2186 | buffer_info->length, | 2186 | PCI_DMA_TODEVICE); |
2187 | PCI_DMA_TODEVICE); | ||
2188 | ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY); | 2187 | ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY); |
2189 | ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_PAGE, | 2188 | ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_PAGE, |
2190 | ATL1C_PCIMAP_TODEVICE); | 2189 | ATL1C_PCIMAP_TODEVICE); |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 1b5dc799348d..7e27eb354f10 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c | |||
@@ -1765,12 +1765,11 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter, | |||
1765 | MAX_TX_BUF_LEN : buf_len; | 1765 | MAX_TX_BUF_LEN : buf_len; |
1766 | buf_len -= tx_buffer->length; | 1766 | buf_len -= tx_buffer->length; |
1767 | 1767 | ||
1768 | tx_buffer->dma = | 1768 | tx_buffer->dma = skb_frag_dma_map(&adapter->pdev->dev, |
1769 | pci_map_page(adapter->pdev, frag->page, | 1769 | frag, |
1770 | frag->page_offset + | 1770 | (i * MAX_TX_BUF_LEN), |
1771 | (i * MAX_TX_BUF_LEN), | 1771 | tx_buffer->length, |
1772 | tx_buffer->length, | 1772 | PCI_DMA_TODEVICE); |
1773 | PCI_DMA_TODEVICE); | ||
1774 | ATL1E_SET_PCIMAP_TYPE(tx_buffer, ATL1E_TX_PCIMAP_PAGE); | 1773 | ATL1E_SET_PCIMAP_TYPE(tx_buffer, ATL1E_TX_PCIMAP_PAGE); |
1775 | use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma); | 1774 | use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma); |
1776 | use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) | | 1775 | use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) | |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index c34e82391f75..edf826a50281 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c | |||
@@ -2283,9 +2283,8 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
2283 | buffer_info->length = (buf_len > ATL1_MAX_TX_BUF_LEN) ? | 2283 | buffer_info->length = (buf_len > ATL1_MAX_TX_BUF_LEN) ? |
2284 | ATL1_MAX_TX_BUF_LEN : buf_len; | 2284 | ATL1_MAX_TX_BUF_LEN : buf_len; |
2285 | buf_len -= buffer_info->length; | 2285 | buf_len -= buffer_info->length; |
2286 | buffer_info->dma = pci_map_page(adapter->pdev, | 2286 | buffer_info->dma = skb_frag_dma_map(&adapter->pdev->dev, |
2287 | frag->page, | 2287 | frag, i * ATL1_MAX_TX_BUF_LEN, |
2288 | frag->page_offset + (i * ATL1_MAX_TX_BUF_LEN), | ||
2289 | buffer_info->length, PCI_DMA_TODEVICE); | 2288 | buffer_info->length, PCI_DMA_TODEVICE); |
2290 | 2289 | ||
2291 | if (++next_to_use == tpd_ring->count) | 2290 | if (++next_to_use == tpd_ring->count) |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 3a409172992e..b7f96ab8b30c 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -2753,8 +2753,8 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
2753 | 2753 | ||
2754 | BUG_ON(!(size <= BFI_TX_MAX_DATA_PER_VECTOR)); | 2754 | BUG_ON(!(size <= BFI_TX_MAX_DATA_PER_VECTOR)); |
2755 | txqent->vector[vect_id].length = htons(size); | 2755 | txqent->vector[vect_id].length = htons(size); |
2756 | dma_addr = dma_map_page(&bnad->pcidev->dev, frag->page, | 2756 | dma_addr = skb_frag_dma_map(&bnad->pcidev->dev, frag, |
2757 | frag->page_offset, size, DMA_TO_DEVICE); | 2757 | 0, size, DMA_TO_DEVICE); |
2758 | dma_unmap_addr_set(&unmap_q->unmap_array[unmap_prod], dma_addr, | 2758 | dma_unmap_addr_set(&unmap_q->unmap_array[unmap_prod], dma_addr, |
2759 | dma_addr); | 2759 | dma_addr); |
2760 | BNA_SET_DMA_ADDR(dma_addr, &txqent->vector[vect_id].host_addr); | 2760 | BNA_SET_DMA_ADDR(dma_addr, &txqent->vector[vect_id].host_addr); |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index c751c25d301e..19c9272b8f12 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -591,9 +591,9 @@ static inline void enic_queue_wq_skb_cont(struct enic *enic, | |||
591 | for (frag = skb_shinfo(skb)->frags; len_left; frag++) { | 591 | for (frag = skb_shinfo(skb)->frags; len_left; frag++) { |
592 | len_left -= frag->size; | 592 | len_left -= frag->size; |
593 | enic_queue_wq_desc_cont(wq, skb, | 593 | enic_queue_wq_desc_cont(wq, skb, |
594 | pci_map_page(enic->pdev, frag->page, | 594 | skb_frag_dma_map(&enic->pdev->dev, |
595 | frag->page_offset, frag->size, | 595 | frag, 0, frag->size, |
596 | PCI_DMA_TODEVICE), | 596 | PCI_DMA_TODEVICE), |
597 | frag->size, | 597 | frag->size, |
598 | (len_left == 0), /* EOP? */ | 598 | (len_left == 0), /* EOP? */ |
599 | loopback); | 599 | loopback); |
@@ -705,14 +705,14 @@ static inline void enic_queue_wq_skb_tso(struct enic *enic, | |||
705 | for (frag = skb_shinfo(skb)->frags; len_left; frag++) { | 705 | for (frag = skb_shinfo(skb)->frags; len_left; frag++) { |
706 | len_left -= frag->size; | 706 | len_left -= frag->size; |
707 | frag_len_left = frag->size; | 707 | frag_len_left = frag->size; |
708 | offset = frag->page_offset; | 708 | offset = 0; |
709 | 709 | ||
710 | while (frag_len_left) { | 710 | while (frag_len_left) { |
711 | len = min(frag_len_left, | 711 | len = min(frag_len_left, |
712 | (unsigned int)WQ_ENET_MAX_DESC_LEN); | 712 | (unsigned int)WQ_ENET_MAX_DESC_LEN); |
713 | dma_addr = pci_map_page(enic->pdev, frag->page, | 713 | dma_addr = skb_frag_dma_map(&enic->pdev->dev, frag, |
714 | offset, len, | 714 | offset, len, |
715 | PCI_DMA_TODEVICE); | 715 | PCI_DMA_TODEVICE); |
716 | enic_queue_wq_desc_cont(wq, skb, | 716 | enic_queue_wq_desc_cont(wq, skb, |
717 | dma_addr, | 717 | dma_addr, |
718 | len, | 718 | len, |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 3d55b4767ae4..2b7d1ba1e13b 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -638,8 +638,8 @@ static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq, | |||
638 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 638 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
639 | struct skb_frag_struct *frag = | 639 | struct skb_frag_struct *frag = |
640 | &skb_shinfo(skb)->frags[i]; | 640 | &skb_shinfo(skb)->frags[i]; |
641 | busaddr = dma_map_page(dev, frag->page, frag->page_offset, | 641 | busaddr = skb_frag_dma_map(dev, frag, 0, |
642 | frag->size, DMA_TO_DEVICE); | 642 | frag->size, DMA_TO_DEVICE); |
643 | if (dma_mapping_error(dev, busaddr)) | 643 | if (dma_mapping_error(dev, busaddr)) |
644 | goto dma_err; | 644 | goto dma_err; |
645 | wrb = queue_head_node(txq); | 645 | wrb = queue_head_node(txq); |
@@ -1066,7 +1066,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter, struct be_rx_obj *rxo, | |||
1066 | skb->tail += curr_frag_len; | 1066 | skb->tail += curr_frag_len; |
1067 | } else { | 1067 | } else { |
1068 | skb_shinfo(skb)->nr_frags = 1; | 1068 | skb_shinfo(skb)->nr_frags = 1; |
1069 | skb_shinfo(skb)->frags[0].page = page_info->page; | 1069 | skb_frag_set_page(skb, 0, page_info->page); |
1070 | skb_shinfo(skb)->frags[0].page_offset = | 1070 | skb_shinfo(skb)->frags[0].page_offset = |
1071 | page_info->page_offset + hdr_len; | 1071 | page_info->page_offset + hdr_len; |
1072 | skb_shinfo(skb)->frags[0].size = curr_frag_len - hdr_len; | 1072 | skb_shinfo(skb)->frags[0].size = curr_frag_len - hdr_len; |
@@ -1091,7 +1091,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter, struct be_rx_obj *rxo, | |||
1091 | if (page_info->page_offset == 0) { | 1091 | if (page_info->page_offset == 0) { |
1092 | /* Fresh page */ | 1092 | /* Fresh page */ |
1093 | j++; | 1093 | j++; |
1094 | skb_shinfo(skb)->frags[j].page = page_info->page; | 1094 | skb_frag_set_page(skb, j, page_info->page); |
1095 | skb_shinfo(skb)->frags[j].page_offset = | 1095 | skb_shinfo(skb)->frags[j].page_offset = |
1096 | page_info->page_offset; | 1096 | page_info->page_offset; |
1097 | skb_shinfo(skb)->frags[j].size = 0; | 1097 | skb_shinfo(skb)->frags[j].size = 0; |
@@ -1173,7 +1173,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter, | |||
1173 | if (i == 0 || page_info->page_offset == 0) { | 1173 | if (i == 0 || page_info->page_offset == 0) { |
1174 | /* First frag or Fresh page */ | 1174 | /* First frag or Fresh page */ |
1175 | j++; | 1175 | j++; |
1176 | skb_shinfo(skb)->frags[j].page = page_info->page; | 1176 | skb_frag_set_page(skb, j, page_info->page); |
1177 | skb_shinfo(skb)->frags[j].page_offset = | 1177 | skb_shinfo(skb)->frags[j].page_offset = |
1178 | page_info->page_offset; | 1178 | page_info->page_offset; |
1179 | skb_shinfo(skb)->frags[j].size = 0; | 1179 | skb_shinfo(skb)->frags[j].size = 0; |
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 81d409d08c97..83199fd0d62b 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -2140,11 +2140,11 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2140 | if (i == nr_frags - 1) | 2140 | if (i == nr_frags - 1) |
2141 | lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT); | 2141 | lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT); |
2142 | 2142 | ||
2143 | bufaddr = dma_map_page(&priv->ofdev->dev, | 2143 | bufaddr = skb_frag_dma_map(&priv->ofdev->dev, |
2144 | skb_shinfo(skb)->frags[i].page, | 2144 | &skb_shinfo(skb)->frags[i], |
2145 | skb_shinfo(skb)->frags[i].page_offset, | 2145 | 0, |
2146 | length, | 2146 | length, |
2147 | DMA_TO_DEVICE); | 2147 | DMA_TO_DEVICE); |
2148 | 2148 | ||
2149 | /* set the TxBD length and buffer pointer */ | 2149 | /* set the TxBD length and buffer pointer */ |
2150 | txbdp->bufPtr = bufaddr; | 2150 | txbdp->bufPtr = bufaddr; |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 4a32c15524c9..27f586afcc34 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -2911,9 +2911,10 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
2911 | 2911 | ||
2912 | frag = &skb_shinfo(skb)->frags[f]; | 2912 | frag = &skb_shinfo(skb)->frags[f]; |
2913 | len = frag->size; | 2913 | len = frag->size; |
2914 | offset = frag->page_offset; | 2914 | offset = 0; |
2915 | 2915 | ||
2916 | while (len) { | 2916 | while (len) { |
2917 | unsigned long bufend; | ||
2917 | i++; | 2918 | i++; |
2918 | if (unlikely(i == tx_ring->count)) | 2919 | if (unlikely(i == tx_ring->count)) |
2919 | i = 0; | 2920 | i = 0; |
@@ -2927,18 +2928,19 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
2927 | /* Workaround for potential 82544 hang in PCI-X. | 2928 | /* Workaround for potential 82544 hang in PCI-X. |
2928 | * Avoid terminating buffers within evenly-aligned | 2929 | * Avoid terminating buffers within evenly-aligned |
2929 | * dwords. */ | 2930 | * dwords. */ |
2931 | bufend = (unsigned long) | ||
2932 | page_to_phys(skb_frag_page(frag)); | ||
2933 | bufend += offset + size - 1; | ||
2930 | if (unlikely(adapter->pcix_82544 && | 2934 | if (unlikely(adapter->pcix_82544 && |
2931 | !((unsigned long)(page_to_phys(frag->page) + offset | 2935 | !(bufend & 4) && |
2932 | + size - 1) & 4) && | 2936 | size > 4)) |
2933 | size > 4)) | ||
2934 | size -= 4; | 2937 | size -= 4; |
2935 | 2938 | ||
2936 | buffer_info->length = size; | 2939 | buffer_info->length = size; |
2937 | buffer_info->time_stamp = jiffies; | 2940 | buffer_info->time_stamp = jiffies; |
2938 | buffer_info->mapped_as_page = true; | 2941 | buffer_info->mapped_as_page = true; |
2939 | buffer_info->dma = dma_map_page(&pdev->dev, frag->page, | 2942 | buffer_info->dma = skb_frag_dma_map(&pdev->dev, frag, |
2940 | offset, size, | 2943 | offset, size, DMA_TO_DEVICE); |
2941 | DMA_TO_DEVICE); | ||
2942 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) | 2944 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
2943 | goto dma_error; | 2945 | goto dma_error; |
2944 | buffer_info->next_to_watch = i; | 2946 | buffer_info->next_to_watch = i; |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 4f669995623f..78c5d21fa34b 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -4677,7 +4677,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
4677 | 4677 | ||
4678 | frag = &skb_shinfo(skb)->frags[f]; | 4678 | frag = &skb_shinfo(skb)->frags[f]; |
4679 | len = frag->size; | 4679 | len = frag->size; |
4680 | offset = frag->page_offset; | 4680 | offset = 0; |
4681 | 4681 | ||
4682 | while (len) { | 4682 | while (len) { |
4683 | i++; | 4683 | i++; |
@@ -4690,9 +4690,8 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
4690 | buffer_info->length = size; | 4690 | buffer_info->length = size; |
4691 | buffer_info->time_stamp = jiffies; | 4691 | buffer_info->time_stamp = jiffies; |
4692 | buffer_info->next_to_watch = i; | 4692 | buffer_info->next_to_watch = i; |
4693 | buffer_info->dma = dma_map_page(&pdev->dev, frag->page, | 4693 | buffer_info->dma = skb_frag_dma_map(&pdev->dev, frag, |
4694 | offset, size, | 4694 | offset, size, DMA_TO_DEVICE); |
4695 | DMA_TO_DEVICE); | ||
4696 | buffer_info->mapped_as_page = true; | 4695 | buffer_info->mapped_as_page = true; |
4697 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) | 4696 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
4698 | goto dma_error; | 4697 | goto dma_error; |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 801608497409..3cb1bc96bf70 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -4174,10 +4174,7 @@ static inline int igb_tx_map_adv(struct igb_ring *tx_ring, struct sk_buff *skb, | |||
4174 | buffer_info->time_stamp = jiffies; | 4174 | buffer_info->time_stamp = jiffies; |
4175 | buffer_info->next_to_watch = i; | 4175 | buffer_info->next_to_watch = i; |
4176 | buffer_info->mapped_as_page = true; | 4176 | buffer_info->mapped_as_page = true; |
4177 | buffer_info->dma = dma_map_page(dev, | 4177 | buffer_info->dma = skb_frag_dma_map(dev, frag, 0, len, |
4178 | frag->page, | ||
4179 | frag->page_offset, | ||
4180 | len, | ||
4181 | DMA_TO_DEVICE); | 4178 | DMA_TO_DEVICE); |
4182 | if (dma_mapping_error(dev, buffer_info->dma)) | 4179 | if (dma_mapping_error(dev, buffer_info->dma)) |
4183 | goto dma_error; | 4180 | goto dma_error; |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index a6bdb3c744f0..b3d760b08a5f 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -2061,10 +2061,7 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter, | |||
2061 | buffer_info->time_stamp = jiffies; | 2061 | buffer_info->time_stamp = jiffies; |
2062 | buffer_info->next_to_watch = i; | 2062 | buffer_info->next_to_watch = i; |
2063 | buffer_info->mapped_as_page = true; | 2063 | buffer_info->mapped_as_page = true; |
2064 | buffer_info->dma = dma_map_page(&pdev->dev, | 2064 | buffer_info->dma = skb_frag_dma_map(&pdev->dev, frag, 0, len, |
2065 | frag->page, | ||
2066 | frag->page_offset, | ||
2067 | len, | ||
2068 | DMA_TO_DEVICE); | 2065 | DMA_TO_DEVICE); |
2069 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) | 2066 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
2070 | goto dma_error; | 2067 | goto dma_error; |
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index b8ef2c0fc5d0..c8b9c9028bc0 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c | |||
@@ -1341,7 +1341,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, | |||
1341 | 1341 | ||
1342 | frag = &skb_shinfo(skb)->frags[f]; | 1342 | frag = &skb_shinfo(skb)->frags[f]; |
1343 | len = frag->size; | 1343 | len = frag->size; |
1344 | offset = frag->page_offset; | 1344 | offset = 0; |
1345 | 1345 | ||
1346 | while (len) { | 1346 | while (len) { |
1347 | i++; | 1347 | i++; |
@@ -1361,8 +1361,8 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, | |||
1361 | buffer_info->time_stamp = jiffies; | 1361 | buffer_info->time_stamp = jiffies; |
1362 | buffer_info->mapped_as_page = true; | 1362 | buffer_info->mapped_as_page = true; |
1363 | buffer_info->dma = | 1363 | buffer_info->dma = |
1364 | dma_map_page(&pdev->dev, frag->page, | 1364 | skb_frag_dma_map(&pdev->dev, frag, offset, size, |
1365 | offset, size, DMA_TO_DEVICE); | 1365 | DMA_TO_DEVICE); |
1366 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) | 1366 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
1367 | goto dma_error; | 1367 | goto dma_error; |
1368 | buffer_info->next_to_watch = 0; | 1368 | buffer_info->next_to_watch = 0; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index a30f8266df00..d20e8040d855 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -6494,8 +6494,7 @@ static void ixgbe_tx_map(struct ixgbe_ring *tx_ring, | |||
6494 | offset = 0; | 6494 | offset = 0; |
6495 | tx_flags |= IXGBE_TX_FLAGS_MAPPED_AS_PAGE; | 6495 | tx_flags |= IXGBE_TX_FLAGS_MAPPED_AS_PAGE; |
6496 | 6496 | ||
6497 | dma = dma_map_page(dev, frag->page, frag->page_offset, | 6497 | dma = skb_frag_dma_map(dev, frag, 0, size, DMA_TO_DEVICE); |
6498 | size, DMA_TO_DEVICE); | ||
6499 | if (dma_mapping_error(dev, dma)) | 6498 | if (dma_mapping_error(dev, dma)) |
6500 | goto dma_error; | 6499 | goto dma_error; |
6501 | 6500 | ||
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 98963970206e..d72905b77aba 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -2918,18 +2918,16 @@ static int ixgbevf_tx_map(struct ixgbevf_adapter *adapter, | |||
2918 | 2918 | ||
2919 | frag = &skb_shinfo(skb)->frags[f]; | 2919 | frag = &skb_shinfo(skb)->frags[f]; |
2920 | len = min((unsigned int)frag->size, total); | 2920 | len = min((unsigned int)frag->size, total); |
2921 | offset = frag->page_offset; | 2921 | offset = 0; |
2922 | 2922 | ||
2923 | while (len) { | 2923 | while (len) { |
2924 | tx_buffer_info = &tx_ring->tx_buffer_info[i]; | 2924 | tx_buffer_info = &tx_ring->tx_buffer_info[i]; |
2925 | size = min(len, (unsigned int)IXGBE_MAX_DATA_PER_TXD); | 2925 | size = min(len, (unsigned int)IXGBE_MAX_DATA_PER_TXD); |
2926 | 2926 | ||
2927 | tx_buffer_info->length = size; | 2927 | tx_buffer_info->length = size; |
2928 | tx_buffer_info->dma = dma_map_page(&adapter->pdev->dev, | 2928 | tx_buffer_info->dma = |
2929 | frag->page, | 2929 | skb_frag_dma_map(&adapter->pdev->dev, frag, |
2930 | offset, | 2930 | offset, size, DMA_TO_DEVICE); |
2931 | size, | ||
2932 | DMA_TO_DEVICE); | ||
2933 | tx_buffer_info->mapped_as_page = true; | 2931 | tx_buffer_info->mapped_as_page = true; |
2934 | if (dma_mapping_error(&pdev->dev, tx_buffer_info->dma)) | 2932 | if (dma_mapping_error(&pdev->dev, tx_buffer_info->dma)) |
2935 | goto dma_error; | 2933 | goto dma_error; |
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 98bb64bc24d9..4e39b8c04397 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c | |||
@@ -2146,8 +2146,11 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2146 | prev_tx = put_tx; | 2146 | prev_tx = put_tx; |
2147 | prev_tx_ctx = np->put_tx_ctx; | 2147 | prev_tx_ctx = np->put_tx_ctx; |
2148 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; | 2148 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
2149 | np->put_tx_ctx->dma = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt, | 2149 | np->put_tx_ctx->dma = skb_frag_dma_map( |
2150 | PCI_DMA_TODEVICE); | 2150 | &np->pci_dev->dev, |
2151 | frag, offset, | ||
2152 | bcnt, | ||
2153 | PCI_DMA_TODEVICE); | ||
2151 | np->put_tx_ctx->dma_len = bcnt; | 2154 | np->put_tx_ctx->dma_len = bcnt; |
2152 | np->put_tx_ctx->dma_single = 0; | 2155 | np->put_tx_ctx->dma_single = 0; |
2153 | put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); | 2156 | put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); |
@@ -2257,8 +2260,11 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb, | |||
2257 | prev_tx = put_tx; | 2260 | prev_tx = put_tx; |
2258 | prev_tx_ctx = np->put_tx_ctx; | 2261 | prev_tx_ctx = np->put_tx_ctx; |
2259 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; | 2262 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
2260 | np->put_tx_ctx->dma = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt, | 2263 | np->put_tx_ctx->dma = skb_frag_dma_map( |
2261 | PCI_DMA_TODEVICE); | 2264 | &np->pci_dev->dev, |
2265 | frag, offset, | ||
2266 | bcnt, | ||
2267 | PCI_DMA_TODEVICE); | ||
2262 | np->put_tx_ctx->dma_len = bcnt; | 2268 | np->put_tx_ctx->dma_len = bcnt; |
2263 | np->put_tx_ctx->dma_single = 0; | 2269 | np->put_tx_ctx->dma_single = 0; |
2264 | put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); | 2270 | put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 5d2d1b8678f6..c77d5af676a1 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -784,8 +784,7 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | |||
784 | 784 | ||
785 | len = this_frag->size; | 785 | len = this_frag->size; |
786 | mapping = dma_map_single(&cp->pdev->dev, | 786 | mapping = dma_map_single(&cp->pdev->dev, |
787 | ((void *) page_address(this_frag->page) + | 787 | skb_frag_address(this_frag), |
788 | this_frag->page_offset), | ||
789 | len, PCI_DMA_TODEVICE); | 788 | len, PCI_DMA_TODEVICE); |
790 | eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; | 789 | eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; |
791 | 790 | ||
diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c index 1776a37b7aed..f07a72150c63 100644 --- a/drivers/net/ethernet/sun/cassini.c +++ b/drivers/net/ethernet/sun/cassini.c | |||
@@ -2048,8 +2048,8 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, | |||
2048 | skb->truesize += hlen - swivel; | 2048 | skb->truesize += hlen - swivel; |
2049 | skb->len += hlen - swivel; | 2049 | skb->len += hlen - swivel; |
2050 | 2050 | ||
2051 | get_page(page->buffer); | 2051 | __skb_frag_set_page(frag, page->buffer); |
2052 | frag->page = page->buffer; | 2052 | __skb_frag_ref(frag); |
2053 | frag->page_offset = off; | 2053 | frag->page_offset = off; |
2054 | frag->size = hlen - swivel; | 2054 | frag->size = hlen - swivel; |
2055 | 2055 | ||
@@ -2072,8 +2072,8 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, | |||
2072 | skb->len += hlen; | 2072 | skb->len += hlen; |
2073 | frag++; | 2073 | frag++; |
2074 | 2074 | ||
2075 | get_page(page->buffer); | 2075 | __skb_frag_set_page(frag, page->buffer); |
2076 | frag->page = page->buffer; | 2076 | __skb_frag_ref(frag); |
2077 | frag->page_offset = 0; | 2077 | frag->page_offset = 0; |
2078 | frag->size = hlen; | 2078 | frag->size = hlen; |
2079 | RX_USED_ADD(page, hlen + cp->crc_size); | 2079 | RX_USED_ADD(page, hlen + cp->crc_size); |
@@ -2830,9 +2830,8 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring, | |||
2830 | skb_frag_t *fragp = &skb_shinfo(skb)->frags[frag]; | 2830 | skb_frag_t *fragp = &skb_shinfo(skb)->frags[frag]; |
2831 | 2831 | ||
2832 | len = fragp->size; | 2832 | len = fragp->size; |
2833 | mapping = pci_map_page(cp->pdev, fragp->page, | 2833 | mapping = skb_frag_dma_map(&cp->pdev->dev, fragp, 0, len, |
2834 | fragp->page_offset, len, | 2834 | PCI_DMA_TODEVICE); |
2835 | PCI_DMA_TODEVICE); | ||
2836 | 2835 | ||
2837 | tabort = cas_calc_tabort(cp, fragp->page_offset, len); | 2836 | tabort = cas_calc_tabort(cp, fragp->page_offset, len); |
2838 | if (unlikely(tabort)) { | 2837 | if (unlikely(tabort)) { |
@@ -2843,7 +2842,7 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring, | |||
2843 | ctrl, 0); | 2842 | ctrl, 0); |
2844 | entry = TX_DESC_NEXT(ring, entry); | 2843 | entry = TX_DESC_NEXT(ring, entry); |
2845 | 2844 | ||
2846 | addr = cas_page_map(fragp->page); | 2845 | addr = cas_page_map(skb_frag_page(fragp)); |
2847 | memcpy(tx_tiny_buf(cp, ring, entry), | 2846 | memcpy(tx_tiny_buf(cp, ring, entry), |
2848 | addr + fragp->page_offset + len - tabort, | 2847 | addr + fragp->page_offset + len - tabort, |
2849 | tabort); | 2848 | tabort); |