From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B454DC433DB for ; Tue, 2 Feb 2021 16:19:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 908B964F55 for ; Tue, 2 Feb 2021 16:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235014AbhBBQTJ (ORCPT ); Tue, 2 Feb 2021 11:19:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24174 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234282AbhBBOPw (ORCPT ); Tue, 2 Feb 2021 09:15:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612275265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KunqakVn1xJ0m1dnFKxNWc2BsmU6toTjQEsO1J2kZn0=; b=dvXX87s46ErATuYVv6yMSIKiTkIC4ajh8wJEzaNydNXyObOdKUOxiGYNYBCl46s6qaLTzU NLP0jMYtKWrMDpzrMLFtaKc1fOF54RRiPMDQZ6aoQF5x8/kBcdYnMPqJqKW83SIumqM5zm 31O/6IMn8ubc8XTBIfGNWrrFosiZAuU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-505-B9QHKUKmMfmP75dYQNcZFA-1; Tue, 02 Feb 2021 09:14:22 -0500 X-MC-Unique: B9QHKUKmMfmP75dYQNcZFA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7F8F281620; Tue, 2 Feb 2021 14:14:20 +0000 (UTC) Received: from carbon.lan (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BD4F4D; Tue, 2 Feb 2021 14:14:03 +0000 (UTC) Date: Tue, 2 Feb 2021 15:14:00 +0100 From: Jesper Dangaard Brouer To: Lorenzo Bianconi Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, ast@kernel.org, daniel@iogearbox.net, toshiaki.makita1@gmail.com, lorenzo.bianconi@redhat.com, toke@redhat.com, brouer@redhat.com Subject: Re: [PATCH v3 bpf-next] net: veth: alloc skb in bulk for ndo_xdp_xmit Message-ID: <20210202151400.00e36ff7@carbon.lan> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, 29 Jan 2021 23:04:08 +0100 Lorenzo Bianconi wrote: > Split ndo_xdp_xmit and ndo_start_xmit use cases in veth_xdp_rcv routine > in order to alloc skbs in bulk for XDP_PASS verdict. > Introduce xdp_alloc_skb_bulk utility routine to alloc skb bulk list. > The proposed approach has been tested in the following scenario: > > eth (ixgbe) --> XDP_REDIRECT --> veth0 --> (remote-ns) veth1 --> XDP_PASS > > XDP_REDIRECT: xdp_redirect_map bpf sample > XDP_PASS: xdp_rxq_info bpf sample > > traffic generator: pkt_gen sending udp traffic on a remote device > > bpf-next master: ~3.64Mpps > bpf-next + skb bulking allocation: ~3.79Mpps > > Signed-off-by: Lorenzo Bianconi > --- I wanted Lorenzo to test 8 vs 16 bulking, but after much testing and IRC dialog, we cannot find and measure any difference with enough accuracy. Thus: Acked-by: Jesper Dangaard Brouer > Changes since v2: > - use __GFP_ZERO flag instead of memset > - move some veth_xdp_rcv_batch() logic in veth_xdp_rcv_skb() > > Changes since v1: > - drop patch 2/3, squash patch 1/3 and 3/3 > - set VETH_XDP_BATCH to 16 > - rework veth_xdp_rcv to use __ptr_ring_consume > --- > drivers/net/veth.c | 78 ++++++++++++++++++++++++++++++++++------------ > include/net/xdp.h | 1 + > net/core/xdp.c | 11 +++++++ > 3 files changed, 70 insertions(+), 20 deletions(-) > > diff --git a/drivers/net/veth.c b/drivers/net/veth.c > index 6e03b619c93c..aa1a66ad2ce5 100644 > --- a/drivers/net/veth.c > +++ b/drivers/net/veth.c > @@ -35,6 +35,7 @@ > #define VETH_XDP_HEADROOM (XDP_PACKET_HEADROOM + NET_IP_ALIGN) > > #define VETH_XDP_TX_BULK_SIZE 16 > +#define VETH_XDP_BATCH 16 > -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer