Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp367143rdd; Tue, 9 Jan 2024 06:44:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnh/bCOd1OmNhTmaU4VQ+hp616OVJi7HXZiQ4HnjFGcMrPk3oW8ZKlFX6i+Hjvu1bRi7GR X-Received: by 2002:a0c:e5c1:0:b0:680:d66d:8af0 with SMTP id u1-20020a0ce5c1000000b00680d66d8af0mr5437215qvm.80.1704811456578; Tue, 09 Jan 2024 06:44:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704811456; cv=none; d=google.com; s=arc-20160816; b=UFPWpPNoWOkQG8W8OShoZsq3v+wm4LN32D7rFzTBedz7KNeI5GLzAUA/z4+vplrY6G RQJEMi6u7ZII97ASaCeI68jeegY1GufLXhyZzG0FhYlFpKluVLlc0GTWIuQOyaunLsVC cPgw0mvrsVqGlfCxzXUDuPNHeBEXwbxYX1ISLTv/zKY/+TtCexnU8Q7v6TS2BGj6myEt dNYsgh8lW6KaaaF5gZfR7Px/pHKu9eC3BS8UnIUItMOPmt0YA4Ot2+4+shzi0XzCyppu /Q29vNMuIJpPrOcGDCiyBiFjeyDLd7B7Fk5z/fEFUj/5ETktjX5fZo4twsSkHYC/TfuZ U1Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=7hTSp/621JuWdOzYoBlVmVqh7hDK5oBkPf++B3jV4j8=; fh=qDXPp9liS6fbrGkfD+/gBOWogMbFgvKdfIzJ4REobnQ=; b=MybqXEVj+NL8H/z9JbesEJ3QAkIr1FmIwaAEnjvTniWzinz6ll0A1KRLBdDBb2WjI9 z0++jtzx8iLGQxLLgNf7mmbbZ9QqeKOXa2r+JuZTRubwqYLgXSWo08vu08VFH1NJDFDp ndpTJ2//1tGKK/L3r073peIT1ZQz0SQ0Wbjei4VnLo1F2eGnhAqlEk16YXXbwvm4Fg2V VRhoHQxjP7WxB93ASA+XJivdnRkg/xZyQHtUBsKhJRWbiuZXaS5MAF5u2e/JJzNskORu mNgm/eRm05nU2OG9x4ZctKI6S8hK+LUn1JN9MdJGBannrFFgdIYjU87GFoEH0HVEhxPl HDlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HcP9Zxmu; spf=pass (google.com: domain of linux-kernel+bounces-21008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21008-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a5-20020a0cb345000000b0067f6a7d8042si2419254qvf.316.2024.01.09.06.44.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 06:44:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HcP9Zxmu; spf=pass (google.com: domain of linux-kernel+bounces-21008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21008-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 565941C2457A for ; Tue, 9 Jan 2024 14:44:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B359D39FF9; Tue, 9 Jan 2024 14:43:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HcP9Zxmu" Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 7763A39FEE for ; Tue, 9 Jan 2024 14:43:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5534180f0e9so10479a12.1 for ; Tue, 09 Jan 2024 06:43:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1704811425; x=1705416225; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7hTSp/621JuWdOzYoBlVmVqh7hDK5oBkPf++B3jV4j8=; b=HcP9Zxmu9/16084eHJ+NmuGWlYUcc3QFeS8uSSZikkoUXQ2UL34hLVUWuyh8LCzKqo cjOWd9oOovsMQdqebHbAnSNlQ4dwOvx579RlYjeYArqv8zP1jgbFYBC/GxZ4UryfpigA iKnRxmjHY1Sv0SMZpzdwk+E/sxXNheVudyV4VghUE6HoJ1gf2p7pruFQVUPiOPcqzH+m Hc3Ca43z67IPYoB/WQCIYSOrKh5zR17Ajyx+qZKltH/zKdWuAhpZTt4YUWmlSw0fkjJj wqBbs67uGIg65/6wc0iL7qeaU/vz+2uWc6RQkQVu7fSPF0CMqzsSUEMA/Br6QS/wjKQg KgNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704811425; x=1705416225; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7hTSp/621JuWdOzYoBlVmVqh7hDK5oBkPf++B3jV4j8=; b=lwnXp3n4MEsbrjCsbTKKwfFvl62EGQMep3/yLEleUbtYpcxLEymgksmkX1SFwMfcqT LJn2TN098Umr4AL+1t5FT7TSLRTx4jkWy6BzNdIe/SLF3DkLROxpR0c/blRqivF235zs NqKljzImXF1/JJhozEhlAsNyGbL2weKwyysgiLtDMyGUPdAmLRkGgapKY+heDyUfCagC alNpL3uiDRy72gl1Q6Y45CC6hoqceJm868TUlUXIQRb7KjbDqDOZ49zks6DCkBG0pPrZ eOqKMB6pZU2+diHLIWcX38N7Jn8HDMib65p/YgFGdFIu3EWLeVyAmWr0CaYTwNSD3px9 Mq2Q== X-Gm-Message-State: AOJu0Ywhla8RaSVe6L6koFrbLDM/bxB3OgTjFgAKfmb6HH7rLN0MFyj9 Kc+fFaNu9JVtObP5Ln0E282+35o2dDl69cF7jVTi42Utyb1a X-Received: by 2002:a50:9548:0:b0:554:1b1c:72c4 with SMTP id v8-20020a509548000000b005541b1c72c4mr101455eda.1.1704811424481; Tue, 09 Jan 2024 06:43:44 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231223025554.2316836-1-aleksander.lobakin@intel.com> <20231223025554.2316836-6-aleksander.lobakin@intel.com> In-Reply-To: <20231223025554.2316836-6-aleksander.lobakin@intel.com> From: Eric Dumazet Date: Tue, 9 Jan 2024 15:43:30 +0100 Message-ID: Subject: Re: [PATCH RFC net-next 05/34] idpf: convert header split mode to libie + napi_build_skb() To: Alexander Lobakin Cc: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Maciej Fijalkowski , Michal Kubiak , Larysa Zaremba , Alexei Starovoitov , Daniel Borkmann , Willem de Bruijn , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Dec 23, 2023 at 3:58=E2=80=AFAM Alexander Lobakin wrote: > > Currently, idpf uses the following model for the header buffers: > > * buffers are allocated via dma_alloc_coherent(); > * when receiving, napi_alloc_skb() is called and then the header is > copied to the newly allocated linear part. > > This is far from optimal as DMA coherent zone is slow on many systems > and memcpy() neutralizes the idea and benefits of the header split. > Instead, use libie to create page_pools for the header buffers, allocate > them dynamically and then build an skb via napi_build_skb() around them > with no memory copy. With one exception... > When you enable header split, you except you'll always have a separate > header buffer, so that you could reserve headroom and tailroom only > there and then use full buffers for the data. For example, this is how > TCP zerocopy works -- you have to have the payload aligned to PAGE_SIZE. > The current hardware running idpf does *not* guarantee that you'll > always have headers placed separately. For example, on my setup, even > ICMP packets are written as one piece to the data buffers. You can't > build a valid skb around a data buffer in this case. > To not complicate things and not lose TCP zerocopy etc., when such thing > happens, use the empty header buffer and pull either full frame (if it's > short) or the Ethernet header there and build an skb around it. GRO > layer will pull more from the data buffer later. This W/A will hopefully > be removed one day. We definitely want performance numbers here, for systems that truly matter. We spent a lot of time trying to make idpf slightly better than it was, we do not want regressions. Thank you.