From patchwork Thu Dec 14 21:31:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13493710 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B5B42BCF9 for ; Thu, 14 Dec 2023 21:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="bzW3Lyjk" Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-67f09756761so8646d6.3 for ; Thu, 14 Dec 2023 13:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702589543; x=1703194343; darn=vger.kernel.org; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=fJV0FT8JUjqColvcdOWvX3p/doH64lOysFcQLSG1l7w=; b=bzW3LyjkT+Np4Zwg4UCpwoD+qQYpmNa3X6AsYJVtyydsmj/EyWKhbkhYDpSOH3bDj8 v7evix2SFZvvQCeurPs9rjgSA+G691xshGCbPlP1l9XxSQYe2jBskRaUJf43Bhk0j1vr /bpEtQePMplKlsT43w7+U6QOYIEki/4g/gNXc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702589543; x=1703194343; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=fJV0FT8JUjqColvcdOWvX3p/doH64lOysFcQLSG1l7w=; b=WGoZDzMQdKxqQLsFJaU3VpOY6owrPX9EKbWgFQNlGvRlOJVgk79eyQ9ivAM9jZ/hC0 R5NBQC5Ey6zHFxlbNSIlc+CfJoxbQqwswyMRkbKmQgNC5RJa1vOPipFAbWt5ICrpbMXc U+3DDS6Vs3CfcCns8KJzMyOicLeIgPFyGfSvsWKrFy/BE9NwIO2bKGlGJgKL4Z7xuwm7 2h+rdcGlCKxz5VkllGsMGPMG7HH5aYb1bLuKStAGsyl6r9QRvoTByyazIVFkN71z04iz OzrcRKhON9sDeNdWbdognXdj1EzKmJZHSRBHTY1bHxKEqO6CqWec6P7H0R16CI3K4uGp GUJA== X-Gm-Message-State: AOJu0Yxi3hs/Pru6UEibLzphZxulYLOuE9/5w6lqgPjx3QsA/2Xmd+hn Pa72b3Lk/4PNNhXJMd0Bcb9Kzg== X-Google-Smtp-Source: AGHT+IGfrOQRd0ahBSIV5Gmrd7fFk4BqCHumFsufzbGxl29lBFNiMUoXbM/z32oLiatu3tEPWzUwAg== X-Received: by 2002:a05:6214:1d0c:b0:67f:fb7:2682 with SMTP id e12-20020a0562141d0c00b0067f0fb72682mr1675872qvd.92.1702589543307; Thu, 14 Dec 2023 13:32:23 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id q12-20020ad4574c000000b0067f0d8cf418sm647661qvx.70.2023.12.14.13.32.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Dec 2023 13:32:22 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, bpf@vger.kernel.org, hawk@kernel.org, ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, Andy Gospodarek , Somnath Kotur Subject: [PATCH net] bnxt_en: do not map packet buffers twice Date: Thu, 14 Dec 2023 13:31:38 -0800 Message-Id: <20231214213138.98095-1-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Andy Gospodarek Remove double-mapping of DMA buffers as it can prevent page pool entries from being freed. Mapping is managed by page pool infrastructure and was previously managed by the driver in __bnxt_alloc_rx_page before allowing the page pool infrastructure to manage it. Fixes: 578fcfd26e2a ("bnxt_en: Let the page pool manage the DMA mapping") Reviewed-by: Somnath Kotur Signed-off-by: Andy Gospodarek Signed-off-by: Michael Chan Reviewed-by: David Wei --- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 96f5ca778c67..8cb9a99154aa 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -59,7 +59,6 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, for (i = 0; i < num_frags ; i++) { skb_frag_t *frag = &sinfo->frags[i]; struct bnxt_sw_tx_bd *frag_tx_buf; - struct pci_dev *pdev = bp->pdev; dma_addr_t frag_mapping; int frag_len; @@ -73,16 +72,10 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, txbd = &txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)]; frag_len = skb_frag_size(frag); - frag_mapping = skb_frag_dma_map(&pdev->dev, frag, 0, - frag_len, DMA_TO_DEVICE); - - if (unlikely(dma_mapping_error(&pdev->dev, frag_mapping))) - return NULL; - - dma_unmap_addr_set(frag_tx_buf, mapping, frag_mapping); - flags = frag_len << TX_BD_LEN_SHIFT; txbd->tx_bd_len_flags_type = cpu_to_le32(flags); + frag_mapping = page_pool_get_dma_addr(skb_frag_page(frag)) + + skb_frag_off(frag); txbd->tx_bd_haddr = cpu_to_le64(frag_mapping); len = frag_len;