提交 24f5d33d 编写于 作者: R Rasesh Mody 提交者: David S. Miller

bna: Embed SKB Length in TX Vector

- Store the length of the skb buffer mapped along with the handle and use it
   while unmapping the buffer.
Signed-off-by: NRasesh Mody <rmody@brocade.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f29eeb79
...@@ -142,7 +142,8 @@ bnad_tx_buff_unmap(struct bnad *bnad, ...@@ -142,7 +142,8 @@ bnad_tx_buff_unmap(struct bnad *bnad,
dma_unmap_page(&bnad->pcidev->dev, dma_unmap_page(&bnad->pcidev->dev,
dma_unmap_addr(&unmap->vectors[vector], dma_addr), dma_unmap_addr(&unmap->vectors[vector], dma_addr),
skb_shinfo(skb)->frags[nvecs].size, DMA_TO_DEVICE); dma_unmap_len(&unmap->vectors[vector], dma_len),
DMA_TO_DEVICE);
dma_unmap_addr_set(&unmap->vectors[vector], dma_addr, 0); dma_unmap_addr_set(&unmap->vectors[vector], dma_addr, 0);
nvecs--; nvecs--;
} }
...@@ -3045,7 +3046,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -3045,7 +3046,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
for (i = 0, vect_id = 0; i < vectors - 1; i++) { for (i = 0, vect_id = 0; i < vectors - 1; i++) {
const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
u16 size = skb_frag_size(frag); u32 size = skb_frag_size(frag);
if (unlikely(size == 0)) { if (unlikely(size == 0)) {
/* Undo the changes starting at tcb->producer_index */ /* Undo the changes starting at tcb->producer_index */
...@@ -3070,6 +3071,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -3070,6 +3071,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
dma_addr = skb_frag_dma_map(&bnad->pcidev->dev, frag, dma_addr = skb_frag_dma_map(&bnad->pcidev->dev, frag,
0, size, DMA_TO_DEVICE); 0, size, DMA_TO_DEVICE);
unmap->vectors[vect_id].dma_len = size;
BNA_SET_DMA_ADDR(dma_addr, &txqent->vector[vect_id].host_addr); BNA_SET_DMA_ADDR(dma_addr, &txqent->vector[vect_id].host_addr);
txqent->vector[vect_id].length = htons(size); txqent->vector[vect_id].length = htons(size);
dma_unmap_addr_set(&unmap->vectors[vect_id], dma_addr, dma_unmap_addr_set(&unmap->vectors[vect_id], dma_addr,
......
...@@ -222,6 +222,7 @@ struct bnad_rx_info { ...@@ -222,6 +222,7 @@ struct bnad_rx_info {
struct bnad_tx_vector { struct bnad_tx_vector {
DEFINE_DMA_UNMAP_ADDR(dma_addr); DEFINE_DMA_UNMAP_ADDR(dma_addr);
DEFINE_DMA_UNMAP_LEN(dma_len);
}; };
struct bnad_tx_unmap { struct bnad_tx_unmap {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册