From nobody Wed Nov 27 21:30:44 2024 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA8A01DEFE6; Tue, 8 Oct 2024 11:27:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728386839; cv=none; b=YfkUijL0hx4J3Wc5/rVZ5Jvp4NwD0yMHqoF6Q/0UIjbcrkppQJgEeCeIyQXXxQkNwk5ZY8YAoT7LWFltePMoRKAz2Z20BHhs3rfHRUrAb4v2Hw9lUp0kY/JIZOf1HABZyORvu2chNsix+YXusw4iCjAdJR/QzypcnL5cO7gjHlU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728386839; c=relaxed/simple; bh=dGWUhl4iqmWJ8vKMG5IyKU6pptgKZYIOPEFiXyYd1CY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BDvG9kzW68SdO6TLH+7FxirtqzEDtEnLjw5v0zGwgk5cUgMQuvOSdGZxBndzOIFSykB9OOnwojVII9rBhrOd7aZmOP7780xG/jED13ZUchVASrxpSZsQebdmTeMMf0ptqDQ+k9EXuesa7eDyv2niknYf0rKF4hukkMqQ5dSjiu4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4XNDJR2gQzz1ymgk; Tue, 8 Oct 2024 19:27:19 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 20B6E1A0188; Tue, 8 Oct 2024 19:27:15 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 8 Oct 2024 19:27:14 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Alexander Duyck , Eric Dumazet , David Ahern Subject: [PATCH net-next v20 09/14] net: rename skb_copy_to_page_nocache() helper Date: Tue, 8 Oct 2024 19:20:43 +0800 Message-ID: <20241008112049.2279307-10-linyunsheng@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20241008112049.2279307-1-linyunsheng@huawei.com> References: <20241008112049.2279307-1-linyunsheng@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemf200006.china.huawei.com (7.185.36.61) Content-Type: text/plain; charset="utf-8" Rename skb_copy_to_page_nocache() to skb_add_frag_nocache() to avoid calling virt_to_page() as we are about to pass virtual address directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- include/net/sock.h | 9 +++------ net/ipv4/tcp.c | 7 +++---- net/kcm/kcmsock.c | 7 +++---- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index e282127092ab..e0b4e2daca5d 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2192,15 +2192,12 @@ static inline int skb_add_data_nocache(struct sock = *sk, struct sk_buff *skb, return err; } =20 -static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_ite= r *from, - struct sk_buff *skb, - struct page *page, - int off, int copy) +static inline int skb_add_frag_nocache(struct sock *sk, struct iov_iter *f= rom, + struct sk_buff *skb, char *va, int copy) { int err; =20 - err =3D skb_do_copy_data_nocache(sk, skb, from, page_address(page) + off, - copy, skb->len); + err =3D skb_do_copy_data_nocache(sk, skb, from, va, copy, skb->len); if (err) return err; =20 diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 82cc4a5633ce..bc36f02cac0d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1219,10 +1219,9 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghd= r *msg, size_t size) if (!copy) goto wait_for_space; =20 - err =3D skb_copy_to_page_nocache(sk, &msg->msg_iter, skb, - pfrag->page, - pfrag->offset, - copy); + err =3D skb_add_frag_nocache(sk, &msg->msg_iter, skb, + page_address(pfrag->page) + + pfrag->offset, copy); if (err) goto do_error; =20 diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index d4118c796290..e74ad63f0189 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -856,10 +856,9 @@ static int kcm_sendmsg(struct socket *sock, struct msg= hdr *msg, size_t len) if (!sk_wmem_schedule(sk, copy)) goto wait_for_memory; =20 - err =3D skb_copy_to_page_nocache(sk, &msg->msg_iter, skb, - pfrag->page, - pfrag->offset, - copy); + err =3D skb_add_frag_nocache(sk, &msg->msg_iter, skb, + page_address(pfrag->page) + + pfrag->offset, copy); if (err) goto out_error; =20 --=20 2.33.0