From patchwork Tue Dec 19 21:03:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13499095 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (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 CBAF13B78E for ; Tue, 19 Dec 2023 21:04:06 +0000 (UTC) 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="089NnUHM" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-5cda3e35b26so1332291a12.1 for ; Tue, 19 Dec 2023 13:04:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1703019846; x=1703624646; 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=Oy9uiiKwbsIgKaUJ3odB6F3vW7RFsVN49w7UGQoPJaI=; b=089NnUHMEUakuL6hga0Fo8qZzebYOmm7mMBnZfsWGRQ0DqlmgnDelkwSUHj8OIbR99 BPcdYhfZ5ULvq46KjyRvfSIXs6vUOzJhVSX8CQMjmWyPqxYQRiwk5uIdR+9cTJGtexZm HDA7GZNzhteNZkT4NU6yyCDMxZmUvvqb2EWGKyE4Xg4MWiXSxCv+8C1suSseacLEjDpF NeXV1VBiLrfzgrVPeU1uv1kerIE40Tin8I4e5M46hZ8au+0botfKCi7kR3N//QBCWoWR 0AMBPdj01lLnco1MKEw7NPqsbGb3i+1rQ70TablD0wwjMZjTqZf40k6ufu2G06TovMmv U1fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703019846; x=1703624646; 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=Oy9uiiKwbsIgKaUJ3odB6F3vW7RFsVN49w7UGQoPJaI=; b=j4SEFHO/e/tKHO2FlQTHIouWcx/mESh0Uo/0tnPtjW5I3mWxZ90n3Y0sWOK3S5ajQE K6XH1Qxd1OUFfHs0LMzkTTmfvlbd6WxSNRqs047Vu+5pa3GV/YuPJ6VHrvhzSp0VLoHE Pi9BCYiKptFVsc9nYJDhTI8SL/NJR55+fp84qQnfJBDyFjCBR0Beta68CYiZN3WBSll5 G7BWPAaWpB3P9X7JzJZfbDp+YVWdejPESupGOEopdtHEynhN8bUwkXLVJTuj75+Rhdl/ 0vpEyBXcPnsVa0cXQ4vsC9sA4G1qZsrm9v6ADWrBhHHxc55zfXhvpVwc1kC6QN7+gngt vMdw== X-Gm-Message-State: AOJu0YyI+qZj+ES84tcwa57ck0xSJqJXh3h+nNMmaiFPN+eEtXyG96Od 6uUNjc0cGpTyyepK7nhkKx+Gxg== X-Google-Smtp-Source: AGHT+IHVEYep/1woYWBS9dt/9XVd4k3yjoZczvwC+R6/pD8ybviMhpX1EJ68kXcXPjNNtknzMGKX6A== X-Received: by 2002:a17:90b:19c6:b0:28b:49d7:e746 with SMTP id nm6-20020a17090b19c600b0028b49d7e746mr2598512pjb.65.1703019846088; Tue, 19 Dec 2023 13:04:06 -0800 (PST) Received: from localhost (fwdproxy-prn-016.fbsv.net. [2a03:2880:ff:10::face:b00c]) by smtp.gmail.com with ESMTPSA id u12-20020a17090adb4c00b002867594de40sm2086062pjx.14.2023.12.19.13.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 13:04:05 -0800 (PST) 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 v3 01/20] net: page_pool: add ppiov mangling helper Date: Tue, 19 Dec 2023 13:03:38 -0800 Message-Id: <20231219210357.4029713-2-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231219210357.4029713-1-dw@davidwei.uk> References: <20231219210357.4029713-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 NOT FOR UPSTREAM The final version will depend on how ppiov looks like, but add a convenience helper for now. Signed-off-by: Pavel Begunkov Signed-off-by: David Wei --- include/net/page_pool/helpers.h | 5 +++++ net/core/page_pool.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h index 95f4d579cbc4..92804c499833 100644 --- a/include/net/page_pool/helpers.h +++ b/include/net/page_pool/helpers.h @@ -86,6 +86,11 @@ static inline u64 *page_pool_ethtool_stats_get(u64 *data, void *stats) /* page_pool_iov support */ +static inline struct page *page_pool_mangle_ppiov(struct page_pool_iov *ppiov) +{ + return (struct page *)((unsigned long)ppiov | PP_DEVMEM); +} + static inline struct dmabuf_genpool_chunk_owner * page_pool_iov_owner(const struct page_pool_iov *ppiov) { diff --git a/net/core/page_pool.c b/net/core/page_pool.c index c0bc62ee77c6..38eff947f679 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -1074,7 +1074,7 @@ static struct page *mp_dmabuf_devmem_alloc_pages(struct page_pool *pool, pool->pages_state_hold_cnt++; trace_page_pool_state_hold(pool, (struct page *)ppiov, pool->pages_state_hold_cnt); - return (struct page *)((unsigned long)ppiov | PP_DEVMEM); + return page_pool_mangle_ppiov(ppiov); } static void mp_dmabuf_devmem_destroy(struct page_pool *pool)