Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0c5dadf authored by Emil Tantilov's avatar Emil Tantilov Committed by Peter P Waskiewicz Jr
Browse files

e1000e: fix panic while dumping packets on Tx hang with IOMMU



This patch resolves a "BUG: unable to handle kernel paging request at ..."
oops while dumping packet data. The issue occurs with IOMMU enabled due to
the address provided by phys_to_virt().

This patch avoids phys_to_virt() by using skb->data and the address of the
pages allocated for Rx.

Signed-off-by: default avatarEmil Tantilov <emil.s.tantilov@intel.com>
Tested-by: default avatarJeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
parent b669588a
Loading
Loading
Loading
Loading
+26 −10
Original line number Diff line number Diff line
@@ -178,6 +178,24 @@ static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo)
	pr_info("%-15s %08x %08x\n", rname, regs[0], regs[1]);
}

static void e1000e_dump_ps_pages(struct e1000_adapter *adapter,
				 struct e1000_buffer *bi)
{
	int i;
	struct e1000_ps_page *ps_page;

	for (i = 0; i < adapter->rx_ps_pages; i++) {
		ps_page = &bi->ps_pages[i];

		if (ps_page->page) {
			pr_info("packet dump for ps_page %d:\n", i);
			print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
				       16, 1, page_address(ps_page->page),
				       PAGE_SIZE, true);
		}
	}
}

/*
 * e1000e_dump - Print registers, Tx-ring and Rx-ring
 */
@@ -299,10 +317,10 @@ static void e1000e_dump(struct e1000_adapter *adapter)
			(unsigned long long)buffer_info->time_stamp,
			buffer_info->skb, next_desc);

		if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
		if (netif_msg_pktdata(adapter) && buffer_info->skb)
			print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
				       16, 1, phys_to_virt(buffer_info->dma),
				       buffer_info->length, true);
				       16, 1, buffer_info->skb->data,
				       buffer_info->skb->len, true);
	}

	/* Print Rx Ring Summary */
@@ -381,10 +399,8 @@ rx_ring_summary:
					buffer_info->skb, next_desc);

				if (netif_msg_pktdata(adapter))
					print_hex_dump(KERN_INFO, "",
						DUMP_PREFIX_ADDRESS, 16, 1,
						phys_to_virt(buffer_info->dma),
						adapter->rx_ps_bsize0, true);
					e1000e_dump_ps_pages(adapter,
							     buffer_info);
			}
		}
		break;
@@ -444,12 +460,12 @@ rx_ring_summary:
					(unsigned long long)buffer_info->dma,
					buffer_info->skb, next_desc);

				if (netif_msg_pktdata(adapter))
				if (netif_msg_pktdata(adapter) &&
				    buffer_info->skb)
					print_hex_dump(KERN_INFO, "",
						       DUMP_PREFIX_ADDRESS, 16,
						       1,
						       phys_to_virt
						       (buffer_info->dma),
						       buffer_info->skb->data,
						       adapter->rx_buffer_len,
						       true);
			}