From patchwork Thu Apr 6 09:42:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13203064 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E8DBC7618D for ; Thu, 6 Apr 2023 09:43:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4582F6B009E; Thu, 6 Apr 2023 05:43:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 407F56B009F; Thu, 6 Apr 2023 05:43:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2AAE56B00A0; Thu, 6 Apr 2023 05:43:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1B3E46B009E for ; Thu, 6 Apr 2023 05:43:51 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D0C13120C85 for ; Thu, 6 Apr 2023 09:43:50 +0000 (UTC) X-FDA: 80650479420.02.D9E621F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 241ACC001E for ; Thu, 6 Apr 2023 09:43:48 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=bnqHUXKF; spf=pass (imf10.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680774229; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=g8CQfKCAD+XBsRHySlPh9qrpCvVJgKV8Pnbt38JTMEY=; b=zFn6zhdK9mYhMMEluD1nUstiNPpK8T7RkPH7xOqUCJtMK/Wae9w77oQHqIT9IsyV+vBt0D YuXKFu7GNzFvqKhlaMch2MpQ8OZTadgdAwLUcWIuIPBfAnBu4Z+U/uG+fQCZfIitXTKJvQ eD3gLqlCFIwRSl4BLisWoejRP8+ZaEs= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=bnqHUXKF; spf=pass (imf10.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680774229; a=rsa-sha256; cv=none; b=zfqOyvkxbc1yrpNcS9c++V9sbZ5E6Ok6jXY30NME7BkGeOBByr9wwjNOoy/Sd8ToyHa3JD QsbySsa5S41Eo81g67Ql2odELgBpGzYaUMvHGNyuKqThI9ha5XljncgWB5T2tgzlf8ILXL yN6Oa5VEBTLHTGP/wVFCRKqFif4C6cU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680774228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g8CQfKCAD+XBsRHySlPh9qrpCvVJgKV8Pnbt38JTMEY=; b=bnqHUXKFWKfrXYuA6F/stfgidelSWH/1ztdtnfRuNz/UQpzs9hPnIeEbwFWBRTBImORlcB erRdaHIL2c9f4eZSRWgOhrgenqFhLz+IVi60FXn68FIPMuKiYJLkHyFjv2jAVGKw5zpouO kPej0wYSoMQB9Sw7Z7wbwbcrQmHNWjU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-74-HgBLwesAP063aPz_uGijkA-1; Thu, 06 Apr 2023 05:43:43 -0400 X-MC-Unique: HgBLwesAP063aPz_uGijkA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F0B048996E2; Thu, 6 Apr 2023 09:43:41 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD68D40C83AC; Thu, 6 Apr 2023 09:43:39 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Matthew Wilcox , Al Viro , Christoph Hellwig , Jens Axboe , Jeff Layton , Christian Brauner , Chuck Lever III , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, David Ahern Subject: [PATCH net-next v5 17/19] ip: Remove ip_append_page() Date: Thu, 6 Apr 2023 10:42:43 +0100 Message-Id: <20230406094245.3633290-18-dhowells@redhat.com> In-Reply-To: <20230406094245.3633290-1-dhowells@redhat.com> References: <20230406094245.3633290-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Queue-Id: 241ACC001E X-Stat-Signature: je3yhrr3tx76ye6ohbxoysyxsbu1u55g X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1680774228-346091 X-HE-Meta: U2F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ZmKYgVS3QgVp178UnbeRmzY92FbTgn5zN7FritXBs2r/IHhzMn7f4EyeYqu9mLEhzN9kBlRjx+mEmgE1vDdnB+b3yYYUQJ1ZqTkB2pLQSTIuedINaWd32h+1DV5zhDqd3woCCWJtIhLroH+HJTI5jrG4wEhAFiGE5m++61CVagdrh3MqvWnV6ADaE3aqhIEFl3mu66D0WDTFcbwhE1aweEkbaMM39IhjR6lHLiG4Xhiff6BuvjjcJJ7Y8DLNet6O2vHG/t4EfY8EQHax1OtpbuvnBccHWeU7TGB9xYQBpN0O4SHkPKre0KFL6lD0kurRqXX1vImAsauW8U7tTtC4cbw+V+QupuKAvz6zb2d32iaazmdTyorkHyo5oeyleOOUsJXpMIs/vlBTUqmxxURTxA4DDzh7v0Q8JqAecyQ8vS8UojnLg0OIumaq78cwpUA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: ip_append_page() is no longer used with the removal of udp_sendpage(), so remove it. Signed-off-by: David Howells cc: Willem de Bruijn cc: David Ahern cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: netdev@vger.kernel.org --- include/net/ip.h | 2 - net/ipv4/ip_output.c | 136 ++----------------------------------------- 2 files changed, 4 insertions(+), 134 deletions(-) diff --git a/include/net/ip.h b/include/net/ip.h index dcbedeffab60..8a50341007bf 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -221,8 +221,6 @@ int ip_append_data(struct sock *sk, struct flowi4 *fl4, unsigned int flags); int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); -ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, - int offset, size_t size, int flags); struct sk_buff *__ip_make_skb(struct sock *sk, struct flowi4 *fl4, struct sk_buff_head *queue, struct inet_cork *cork); diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 5b66c28c2e41..241a78d82766 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1376,10 +1376,10 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, } /* - * ip_append_data() and ip_append_page() can make one large IP datagram - * from many pieces of data. Each pieces will be holded on the socket - * until ip_push_pending_frames() is called. Each piece can be a page - * or non-page data. + * ip_append_data() can make one large IP datagram from many pieces of + * data. Each piece will be held on the socket until + * ip_push_pending_frames() is called. Each piece can be a page or + * non-page data. * * Not only UDP, other transport protocols - e.g. raw sockets - can use * this interface potentially. @@ -1412,134 +1412,6 @@ int ip_append_data(struct sock *sk, struct flowi4 *fl4, from, length, transhdrlen, flags); } -ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, - int offset, size_t size, int flags) -{ - struct inet_sock *inet = inet_sk(sk); - struct sk_buff *skb; - struct rtable *rt; - struct ip_options *opt = NULL; - struct inet_cork *cork; - int hh_len; - int mtu; - int len; - int err; - unsigned int maxfraglen, fragheaderlen, fraggap, maxnonfragsize; - - if (inet->hdrincl) - return -EPERM; - - if (flags&MSG_PROBE) - return 0; - - if (skb_queue_empty(&sk->sk_write_queue)) - return -EINVAL; - - cork = &inet->cork.base; - rt = (struct rtable *)cork->dst; - if (cork->flags & IPCORK_OPT) - opt = cork->opt; - - if (!(rt->dst.dev->features & NETIF_F_SG)) - return -EOPNOTSUPP; - - hh_len = LL_RESERVED_SPACE(rt->dst.dev); - mtu = cork->gso_size ? IP_MAX_MTU : cork->fragsize; - - fragheaderlen = sizeof(struct iphdr) + (opt ? opt->optlen : 0); - maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; - maxnonfragsize = ip_sk_ignore_df(sk) ? 0xFFFF : mtu; - - if (cork->length + size > maxnonfragsize - fragheaderlen) { - ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport, - mtu - (opt ? opt->optlen : 0)); - return -EMSGSIZE; - } - - skb = skb_peek_tail(&sk->sk_write_queue); - if (!skb) - return -EINVAL; - - cork->length += size; - - while (size > 0) { - /* Check if the remaining data fits into current packet. */ - len = mtu - skb->len; - if (len < size) - len = maxfraglen - skb->len; - - if (len <= 0) { - struct sk_buff *skb_prev; - int alloclen; - - skb_prev = skb; - fraggap = skb_prev->len - maxfraglen; - - alloclen = fragheaderlen + hh_len + fraggap + 15; - skb = sock_wmalloc(sk, alloclen, 1, sk->sk_allocation); - if (unlikely(!skb)) { - err = -ENOBUFS; - goto error; - } - - /* - * Fill in the control structures - */ - skb->ip_summed = CHECKSUM_NONE; - skb->csum = 0; - skb_reserve(skb, hh_len); - - /* - * Find where to start putting bytes. - */ - skb_put(skb, fragheaderlen + fraggap); - skb_reset_network_header(skb); - skb->transport_header = (skb->network_header + - fragheaderlen); - if (fraggap) { - skb->csum = skb_copy_and_csum_bits(skb_prev, - maxfraglen, - skb_transport_header(skb), - fraggap); - skb_prev->csum = csum_sub(skb_prev->csum, - skb->csum); - pskb_trim_unique(skb_prev, maxfraglen); - } - - /* - * Put the packet on the pending queue. - */ - __skb_queue_tail(&sk->sk_write_queue, skb); - continue; - } - - if (len > size) - len = size; - - if (skb_append_pagefrags(skb, page, offset, len)) { - err = -EMSGSIZE; - goto error; - } - - if (skb->ip_summed == CHECKSUM_NONE) { - __wsum csum; - csum = csum_page(page, offset, len); - skb->csum = csum_block_add(skb->csum, csum, skb->len); - } - - skb_len_add(skb, len); - refcount_add(len, &sk->sk_wmem_alloc); - offset += len; - size -= len; - } - return 0; - -error: - cork->length -= size; - IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS); - return err; -} - static void ip_cork_release(struct inet_cork *cork) { cork->flags &= ~IPCORK_OPT;