From patchwork Tue Mar 12 21:44:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13590631 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 8AB1F143C75 for ; Tue, 12 Mar 2024 21:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710279876; cv=none; b=Yl0EukIVRHgvZr8IReKiQpckUXuGiQX0cAK7NhY1Gx+LPYYbctuKtIv3k6IVBjWi3M7jAr0LG0XLYur1Nr9wW7E8MWB158a24lmzZsCj15+U1slpNhNzJHx/5p80+ajfrfeW8oxUVqpldUmhvAniBbSZYCyAk+MGZ/xJ5EnQcjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710279876; c=relaxed/simple; bh=5LIz+n21IO/BI82JjqRprXHon+WApM+Js27POLGqQWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lpoHZAnoNx/t8MHhc0Ou9AmA3y9VDdsAIrNKvXr6V2RN1/8lw/qf4sRTrHro3+6X2cXsCBxuqbJ6itlk9EYihbVbmLAbagpFOhGoUnjvu6cjoG2o9VRmdi60FNwEmeEOHVbe+7+S2h3t5nhH3pAVOTkC5eSHHNd5W0A4GQ+HbME= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=Pwv0Gfy7; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="Pwv0Gfy7" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6e6ac741ff7so787777b3a.0 for ; Tue, 12 Mar 2024 14:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1710279875; x=1710884675; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ki4E7PMtuF4SSoJCESY70J5JzUkN3PrG7EZAs5PtLHg=; b=Pwv0Gfy7BNKH8v92w1sXPteJAvi/mSXFv/Id3cgoo9jYzp3kDNMgrmxH383koBD2Jh 3r7LYUZXfrAfe0qzZXewMdwnaZX6XU4K/XosLjCYJ4vsJQHYyMYyJw6f5ApP0GaFpOMn 7pqA/DRHAmqYPMXUACUh2o1AsGe+bshtL21jquYGxTCTmEFSLNQhD5o9RFd6znB+QK6S EbgNlb2i/tDEAytbupO1pKZU0POvVmw65OQSiddT1M/5XoZNCcZbFjTY+q6Zx+zdpOLZ pzSbuqIoy7VDkRyS1Xq1d5uplwzcUZOJK1oi0IIJnpg1SU22hkShOzGpF27O5kH0G8rx 9DnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710279875; x=1710884675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ki4E7PMtuF4SSoJCESY70J5JzUkN3PrG7EZAs5PtLHg=; b=uGnVXHKa34Z1AeYPabwzkGQ67XN7K6adbpfRlwVOBmM78UI2WLfvIy6v5hIGhMC/Tf VTu4HYepfcmQ/YDsRtL5AF5bCpxyFsL/4ZSvWumAv5FkLBdC7/8YJOrAA0KLwmNetd0i 9RZJW3UejE+ns0p6yU5chqQ89LzYjcCggrmmXnHRm50tXZZVLcQoGOvUNPl5m+CbDcGA FaXiNAWg1gxCbNZMt3KqviFCNarWCCNpq7pGMwggMMIBy0UAHAvPyAouXd5EiXLPHhNG B5ai1MV4nn1GN7aTtnkBRnDSt5QWSqgyodEMCiRDL1X46uSMz9PFGC2lhvQ+uIBRmrhD fVAw== X-Forwarded-Encrypted: i=1; AJvYcCXEDCeCXxBZNN1mS/5d6EVf40yQQwZSkoNL/hU/TbmmruF5iewaNiLI17DWu3FvI5QPTQBlMXJwGY+iuwhHITI0IJACG/Od X-Gm-Message-State: AOJu0YyUMLfLyiWLeL4JWWoVe8nys+SYfRSaBky+aZYf/opk8W55Ivzj 0BQeWTFcsfLkP8DMs4AiXTiAirFBgzbRmH0e/VF+BxDoXDuzplcX9Vsvs+bGeWQ= X-Google-Smtp-Source: AGHT+IEytnLFhFfxcOEd6KuDVTAKRKneRq76aXN3P/JDiA9CUmXL59+Us4Nkh7nNStj0CDihdR7Ksw== X-Received: by 2002:a05:6a00:c95:b0:6e5:696d:9eb8 with SMTP id a21-20020a056a000c9500b006e5696d9eb8mr916681pfv.3.1710279874793; Tue, 12 Mar 2024 14:44:34 -0700 (PDT) Received: from localhost (fwdproxy-prn-024.fbsv.net. [2a03:2880:ff:18::face:b00c]) by smtp.gmail.com with ESMTPSA id t64-20020a628143000000b006e6aee6807dsm985326pfd.22.2024.03.12.14.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 14:44:34 -0700 (PDT) From: David Wei To: io-uring@vger.kernel.org, netdev@vger.kernel.org Cc: Jens Axboe , Pavel Begunkov , Jakub Kicinski , Paolo Abeni , "David S. Miller" , Eric Dumazet , Jesper Dangaard Brouer , David Ahern , Mina Almasry Subject: [RFC PATCH v4 01/16] net: generalise pp provider params passing Date: Tue, 12 Mar 2024 14:44:15 -0700 Message-ID: <20240312214430.2923019-2-dw@davidwei.uk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240312214430.2923019-1-dw@davidwei.uk> References: <20240312214430.2923019-1-dw@davidwei.uk> 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 X-Patchwork-State: RFC From: Pavel Begunkov RFC only, not for upstream Add a way to pass custom page pool parameters, but the final version should converge with devmem. Signed-off-by: Pavel Begunkov Signed-off-by: David Wei --- include/net/netdev_rx_queue.h | 3 +++ net/core/dev.c | 2 +- net/core/page_pool.c | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/net/netdev_rx_queue.h b/include/net/netdev_rx_queue.h index 5dc35628633a..41f8c4e049bb 100644 --- a/include/net/netdev_rx_queue.h +++ b/include/net/netdev_rx_queue.h @@ -26,6 +26,9 @@ struct netdev_rx_queue { */ struct napi_struct *napi; struct netdev_dmabuf_binding *binding; + + const struct memory_provider_ops *pp_ops; + void *pp_private; } ____cacheline_aligned_in_smp; /* diff --git a/net/core/dev.c b/net/core/dev.c index 255a38cf59b1..2096ff57685a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2189,7 +2189,7 @@ int netdev_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx, rxq = __netif_get_rx_queue(dev, rxq_idx); - if (rxq->binding) + if (rxq->binding || rxq->pp_ops) return -EEXIST; err = xa_alloc(&binding->bound_rxq_list, &xa_idx, rxq, xa_limit_32b, diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 53039d2f8514..5d5b78878473 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -262,6 +262,9 @@ static int page_pool_init(struct page_pool *pool, if (binding) { pool->mp_ops = &dmabuf_devmem_ops; pool->mp_priv = binding; + } else if (pool->p.queue && pool->p.queue->pp_ops) { + pool->mp_ops = pool->p.queue->pp_ops; + pool->mp_priv = pool->p.queue->pp_private; } if (pool->mp_ops) {