提交 91615f76 编写于 作者: J Jesse Brandeburg 提交者: David S. Miller

igb: fix unmap length bug

driver was mixing NET_IP_ALIGN count bytes in map/unmap calls
unevenly. Only map the bytes that the hardware might dma into

also fix unmap related bug where ->dma was not being cleared
after unmap
Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4f57ca6e
...@@ -4549,11 +4549,12 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring, ...@@ -4549,11 +4549,12 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
cleaned = true; cleaned = true;
cleaned_count++; cleaned_count++;
/* this is the fast path for the non-packet split case */
if (!adapter->rx_ps_hdr_size) { if (!adapter->rx_ps_hdr_size) {
pci_unmap_single(pdev, buffer_info->dma, pci_unmap_single(pdev, buffer_info->dma,
adapter->rx_buffer_len + adapter->rx_buffer_len,
NET_IP_ALIGN,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
buffer_info->dma = 0;
skb_put(skb, length); skb_put(skb, length);
goto send_up; goto send_up;
} }
...@@ -4570,8 +4571,9 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring, ...@@ -4570,8 +4571,9 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
if (!skb_shinfo(skb)->nr_frags) { if (!skb_shinfo(skb)->nr_frags) {
pci_unmap_single(pdev, buffer_info->dma, pci_unmap_single(pdev, buffer_info->dma,
adapter->rx_ps_hdr_size + NET_IP_ALIGN, adapter->rx_ps_hdr_size,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
buffer_info->dma = 0;
skb_put(skb, hlen); skb_put(skb, hlen);
} }
...@@ -4713,7 +4715,6 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, ...@@ -4713,7 +4715,6 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
bufsz = adapter->rx_ps_hdr_size; bufsz = adapter->rx_ps_hdr_size;
else else
bufsz = adapter->rx_buffer_len; bufsz = adapter->rx_buffer_len;
bufsz += NET_IP_ALIGN;
while (cleaned_count--) { while (cleaned_count--) {
rx_desc = E1000_RX_DESC_ADV(*rx_ring, i); rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
...@@ -4737,7 +4738,7 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, ...@@ -4737,7 +4738,7 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
} }
if (!buffer_info->skb) { if (!buffer_info->skb) {
skb = netdev_alloc_skb(netdev, bufsz); skb = netdev_alloc_skb(netdev, bufsz + NET_IP_ALIGN);
if (!skb) { if (!skb) {
adapter->alloc_rx_buff_failed++; adapter->alloc_rx_buff_failed++;
goto no_buffers; goto no_buffers;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册