From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mail.toke.dk (Postfix) with ESMTPS id 85E7E9FD45D for ; Wed, 12 Apr 2023 19:52:50 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HERI1+tm DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681321969; 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=iI47pUzxcqmCcEC2rps2dXJyXHbQhHmBAwXMcIIXiyw=; b=HERI1+tmmXnO1oPb+2TQ8Kh5jl+lfGNNQfMQSLrgABLoZyz0NiGjuITrvNXqMmY8BTbvmO lEh/j4eH0xPaczpkS6/yGznirG3C6fMEsgkvx8gne1/mScFrVB9kXgJ9acfQJssccIx2NF nas875KyXOWdSQDslBvY8rkMziBxAs4= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-596-vzO1MpOPMvyVcJFIQCaoXw-1; Wed, 12 Apr 2023 13:52:48 -0400 X-MC-Unique: vzO1MpOPMvyVcJFIQCaoXw-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5048993067dso9537067a12.0 for ; Wed, 12 Apr 2023 10:52:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681321967; x=1683913967; h=content-transfer-encoding:in-reply-to:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iI47pUzxcqmCcEC2rps2dXJyXHbQhHmBAwXMcIIXiyw=; b=l6EVlzn7j544pFhiXaglje11ilcTSbmART/udgRa9hMC/hip4AYXhgJRQ3KUq70x8h cSWq1doxrjhdWI6k5JNMv+xrE/hRRpbvg7R/cYvfQ/GFbtBLa9j2NqoK5nLcgFf/blv1 PgUcqp9Hc6ngavB0Yf4WM66h1WhZA63sY9X0zDTD02mvEA8UYmDYJ6cpybTN8oOWPqGb 47rf7F8e3Pffkm8YueNkmWGPMaHnpa11B8632izefNecc4tpdWLgy2hfIzVxCWOz+UzR tNCVBW3qR1dDTWTVaWyyRCcgXDT/DwRbe6s+oBR4ZQlfnun5udRJpCE5gZPxFXhvDis5 UeQA== X-Gm-Message-State: AAQBX9e/a9zbvyC+o8o5r9+e1hbhVEEhIaZZwHDlUKSDkq3CRdbHqTcy MmbS/Y1B3IwLaGIh27ZnLK9vM0FUnF9c4J0huHmgCMsTow3/DUrh1hEgMHP2LDe/sd1HrNZ5TCv EYerLHB0KcXFcbLuThSAr X-Received: by 2002:a05:6402:5186:b0:4bf:b2b1:84d8 with SMTP id q6-20020a056402518600b004bfb2b184d8mr3511175edd.19.1681321967069; Wed, 12 Apr 2023 10:52:47 -0700 (PDT) X-Google-Smtp-Source: AKy350Y0MTpGveF2HoFghji3+UpGQyjGIi40MatPabg821fgSW3yWZotqgAFPc2Jo3Kxr8gD41BAKQ== X-Received: by 2002:a05:6402:5186:b0:4bf:b2b1:84d8 with SMTP id q6-20020a056402518600b004bfb2b184d8mr3511145edd.19.1681321966733; Wed, 12 Apr 2023 10:52:46 -0700 (PDT) Received: from [192.168.42.222] (194-45-78-10.static.kviknet.net. [194.45.78.10]) by smtp.gmail.com with ESMTPSA id e14-20020a50d4ce000000b00502b0b0d75csm7149567edj.46.2023.04.12.10.52.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Apr 2023 10:52:46 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: <34152b76-88c8-0848-9f30-bd9755b1ee25@redhat.com> Date: Wed, 12 Apr 2023 19:52:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 To: Stanislav Fomichev References: <168130333143.150247.11159481574477358816.stgit@firesoul> <168130336725.150247.12193228778654006957.stgit@firesoul> In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: ABTP62RUHMMAMUO3NMSJVOIWMHQ5QTYK X-Message-ID-Hash: ABTP62RUHMMAMUO3NMSJVOIWMHQ5QTYK X-MailFrom: jbrouer@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: brouer@redhat.com, bpf@vger.kernel.org, =?UTF-8?Q?Toke_H=c3=b8iland-J=c3=b8rgensen?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net, alexandr.lobakin@intel.com, larysa.zaremba@intel.com, xdp-hints@xdp-project.net, anthony.l.nguyen@intel.com, yoong.siang.song@intel.com, boon.leong.ong@intel.com, intel-wired-lan@lists.osuosl.org, pabeni@redhat.com, jesse.brandeburg@intel.com, kuba@kernel.org, edumazet@google.com, john.fastabend@gmail.com, hawk@kernel.org, davem@davemloft.net, tariqt@nvidia.com, saeedm@nvidia.com, leon@kernel.org, linux-rdma@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf V8 2/7] selftests/bpf: Add counters to xdp_hw_metadata List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 12/04/2023 18.56, Stanislav Fomichev wrote: > On 04/12, Jesper Dangaard Brouer wrote: >> Add counters for skipped, failed and redirected packets. >> The xdp_hw_metadata program only redirects UDP port 9091. >> This helps users to quickly identify then packets are >> skipped and identify failures of bpf_xdp_adjust_meta. >> >> Signed-off-by: Jesper Dangaard Brouer >> --- >> .../testing/selftests/bpf/progs/xdp_hw_metadata.c | 15 +++++++++++++-- >> tools/testing/selftests/bpf/xdp_hw_metadata.c | 4 +++- >> 2 files changed, 16 insertions(+), 3 deletions(-) >> >> diff --git a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c >> index b0104763405a..a07ef7534013 100644 >> --- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c >> +++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c >> @@ -25,6 +25,10 @@ struct { >> __type(value, __u32); >> } xsk SEC(".maps"); >> >> +volatile __u64 pkts_skip = 0; >> +volatile __u64 pkts_fail = 0; >> +volatile __u64 pkts_redir = 0; >> + >> extern int bpf_xdp_metadata_rx_timestamp(const struct xdp_md *ctx, >> __u64 *timestamp) __ksym; >> extern int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, >> @@ -59,16 +63,21 @@ int rx(struct xdp_md *ctx) >> udp = NULL; >> } >> >> - if (!udp) >> + if (!udp) { >> + pkts_skip++; >> return XDP_PASS; >> + } >> >> /* Forwarding UDP:9091 to AF_XDP */ >> - if (udp->dest != bpf_htons(9091)) >> + if (udp->dest != bpf_htons(9091)) { >> + pkts_skip++; >> return XDP_PASS; >> + } >> >> ret = bpf_xdp_adjust_meta(ctx, -(int)sizeof(struct xdp_meta)); >> if (ret != 0) { > > [..] > >> bpf_printk("bpf_xdp_adjust_meta returned %d", ret); > > Maybe let's remove these completely? Merge patch 1 and 2, remove printk, > add counters. We can add more counters in the future if the existing > ones are not enough.. WDYT? > Sure, lets just remove all of the bpf_printk, and add these counter instead. Rolling V9. >> + pkts_fail++; This fail counter should be enough for driver devel to realize that they also need to implement/setup XDP metadata pointers correctly (for bpf_xdp_adjust_meta to work). >> return XDP_PASS; >> }