From patchwork Tue Dec 4 01:52:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 10711025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C35415A6 for ; Tue, 4 Dec 2018 01:52:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F9CB2A8F0 for ; Tue, 4 Dec 2018 01:52:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11D8E2A959; Tue, 4 Dec 2018 01:52:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A2082A8F0 for ; Tue, 4 Dec 2018 01:52:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725996AbeLDBwU (ORCPT ); Mon, 3 Dec 2018 20:52:20 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:39014 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbeLDBwU (ORCPT ); Mon, 3 Dec 2018 20:52:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=bYaZ4qlIQDKGcnjv76hOkv1dLfD9fJnppYA9pfY+0qE=; b=PIfw1Yd3X082vcelUypqH2guP KW0XRCxacAWM4x3VNb4O88mK2i90/uc7xr/MhZaxrioUYj5jJ5RFXSAmTlernvL3cAgYrQJWlsTix 2VMOiaApx00EnVRYabve5OnRldxF6dHd+xv95qNPJsm+Ku+VDEgMLkiYP7Pts99Ubo3oyzGYh8WLg Gdnh1sMSjjATS5vMuFHC8+SvyUNhX53RyQCPnTm0BXrbElBmJaFusGIffbpnQAxxn5WrD5FKRrcQS nwYHXA4HVmrqzN/unK76lHSRLqqg0Eloh94PUT0HUOGETZC7qfLd8qIqP4ABjVGsS4DtXywbLEdN+ 0QIAfxKqw==; Received: from [2600:1700:65a0:78e0:514:7862:1503:8e4d] (helo=sagi-Latitude-E7470.lbits) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTzsq-0003Zq-0l; Tue, 04 Dec 2018 01:52:20 +0000 From: Sagi Grimberg To: linux-nvme@lists.infradead.org Cc: linux-block@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Keith Busch , "David S. Miller" Subject: [PATCH v5 02/13] datagram: open-code copy_page_to_iter Date: Mon, 3 Dec 2018 17:52:06 -0800 Message-Id: <20181204015217.16613-3-sagi@grimberg.me> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181204015217.16613-1-sagi@grimberg.me> References: <20181204015217.16613-1-sagi@grimberg.me> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sagi Grimberg This will be useful to consolidate skb_copy_and_hash_datagram_iter and skb_copy_and_csum_datagram to a single code path. Acked-by: David S. Miller Signed-off-by: Sagi Grimberg --- net/core/datagram.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/core/datagram.c b/net/core/datagram.c index 57f3a6fcfc1e..abe642181b64 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -445,11 +445,14 @@ int skb_copy_datagram_iter(const struct sk_buff *skb, int offset, end = start + skb_frag_size(frag); if ((copy = end - offset) > 0) { + struct page *page = skb_frag_page(frag); + u8 *vaddr = kmap(page); + if (copy > len) copy = len; - n = copy_page_to_iter(skb_frag_page(frag), - frag->page_offset + offset - - start, copy, to); + n = copy_to_iter(vaddr + frag->page_offset + + offset - start, copy, to); + kunmap(page); offset += n; if (n != copy) goto short_copy;