From f59e8082fb57c0009be7c01acb4aedd4bdc15523 Mon Sep 17 00:00:00 2001 From: Tushar Dave Date: Wed, 9 Dec 2015 17:16:25 -0800 Subject: [PATCH] i40e: Temporary workaround for DMA map issue This is a quick temporary workaround for Bug 22107931. iommu DMA map failure occurs when i40e saturate iommu with large number of DMA map requests. e.g. System running 128 CPUs can maximum have 256K-1 entries in iommu table considering 8K page size and 32bit iommu (i.e. 2^31/PAGE_SIZE). On this system, i40e driver by default has 128 Queue Pairs (QP) per interface. For each Rx queues, i40e by default, allocates 512 Rx buffers which generates 64K DMA map requests. Four i40e interfaces will generates total of 256K DMA map requests. That is beyond iommu can accommodate and therefor results into DMA map failure. The correct fix would be that i40e driver should not saturate iommu resources and graciously bailout when DMA map failure occurs. However, due severity of the issue and complexity involved implementing correct resolution, this patch provides quick temporary workaround by just limiting number of QP not to exceed 32. For the record, QP equals 32 chosen because QP has to be power of 2 and we can't have QP equals 64 because in that case number of DMA map requests for Rx and Tx will be 256K and iommu can only accommodate 256K-1. i.e. 64 RX queues * 512 RX buffers = 32K , for 4 interfaces = 128K 64 TX queues * 512 TX buffers = 32K , for 4 interfaces = 128K When an appropriate fix (as mentioned above) is ready, this quick temporary workaround will be removed. Note:this temporary workaround can have negative impact on i40e network performance. Signed-off-by: Tushar Dave --- drivers/net/ethernet/intel/i40e/i40e_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 36d55f0bff97..eeddad8956e2 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -1604,6 +1604,13 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, vsi->num_queue_pairs = pf->num_lan_msix; } +#ifdef CONFIG_SPARC + if (vsi->num_queue_pairs > 32) { + dev_warn(&pf->pdev->dev, "default QP is %d, limiting QP to 32\n", + vsi->num_queue_pairs); + vsi->num_queue_pairs = 32; + } +#endif /* Scheduler section valid can only be set for ADD VSI */ if (is_add) { sections |= I40E_AQ_VSI_PROP_SCHED_VALID; -- 2.49.0