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.129.124]) by mail.toke.dk (Postfix) with ESMTPS id 352239EC4F7 for ; Tue, 21 Feb 2023 21:39:36 +0100 (CET) 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=GgYIJ3NM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677011975; 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=YdDNg00iZDLT5J47DaIV5Cp6ABia2XUtMExirMnXrTw=; b=GgYIJ3NMfap/c8dcMvUWXIF0oYj9gddNwRSq/7FYKM4X/xKXwM+VyTF3Sb1NiAq05jRLhj Sm6DvOEUnJ7XS65f22XjKjKf1PGYFI5tkVhfLadnUNkYUxBsVqeRLP8Vnj9mze6Nmy7l1Q gp2bVabIT01WlJuCbol6kgs15c5fBg4= 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_128_GCM_SHA256) id us-mta-631-WaAYDJXGObalBmmW3Ffa6w-1; Tue, 21 Feb 2023 15:39:33 -0500 X-MC-Unique: WaAYDJXGObalBmmW3Ffa6w-1 Received: by mail-ed1-f71.google.com with SMTP id dk16-20020a0564021d9000b004aaa054d189so7454925edb.11 for ; Tue, 21 Feb 2023 12:39:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=YdDNg00iZDLT5J47DaIV5Cp6ABia2XUtMExirMnXrTw=; b=C7cAvghdvQy08soDrdFzZUMl9IjEyxPJFE5qm1UAZP4rmlZVSnGGPK5lgG+s8HL1vI +zGxB5n1yLc5WtRIvINo5cf5+0yuwCx5AkClzCTQqIflOWNcBG2ZIoEd1TDH0mWCkCYP lzMwsOedj63/1uOxzK9vj/t4T4G2LDSbubS/uK5n8rVZQofJpuDBfVaPZFzmvpe4N5tL s39LanAqQtJgW0dkOdJU44aO3hoHyrNnDfzbK8o42Pj1VRkesgvw9MeJ2OIYz2kgt3Hi MCnjG/IhJ9Hf3544yka3lIVHg6q7Zer9xekx6tyXzepYl5KdT3SXd9RLl06McUDsWIT8 HCVQ== X-Gm-Message-State: AO0yUKUF3Eh7YXKu2LwAhTPwCfFBw4+phKwwvVstSDYGpRzKjziGpTP0 flxNVXVHKu3jGut5hXEkporKiF4YWzogsDrp9BekKuPjt9l4RqYD3RRVv7GoDCBnszjZnENVic3 10o729ZndXbQ9ofdD/gAX X-Received: by 2002:a17:907:10d4:b0:8b2:abc7:1ef9 with SMTP id rv20-20020a17090710d400b008b2abc71ef9mr16128575ejb.68.1677011972383; Tue, 21 Feb 2023 12:39:32 -0800 (PST) X-Google-Smtp-Source: AK7set9nOVg3U99yGFw2+SlKsMkpS0fRMtupqBJv0UiozrsOwvtrTX4oFk1IAIZPOdTvhDDoW0o0XQ== X-Received: by 2002:a17:907:10d4:b0:8b2:abc7:1ef9 with SMTP id rv20-20020a17090710d400b008b2abc71ef9mr16128557ejb.68.1677011972026; Tue, 21 Feb 2023 12:39:32 -0800 (PST) Received: from [192.168.42.100] (nat-cgn9-185-107-15-52.static.kviknet.net. [185.107.15.52]) by smtp.gmail.com with ESMTPSA id n21-20020a170906119500b008e09deb6610sm1019154eja.200.2023.02.21.12.39.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Feb 2023 12:39:31 -0800 (PST) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: <613bbdb0-e7b0-59df-f2ee-6c689b15fe41@redhat.com> Date: Tue, 21 Feb 2023 21:39:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 To: Martin KaFai Lau , Stanislav Fomichev References: <167673444093.2179692.14745621008776172374.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: BHAKKGFBIUULGMLVNTLOGHVBTEML4HPW X-Message-ID-Hash: BHAKKGFBIUULGMLVNTLOGHVBTEML4HPW 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, netdev@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 X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next V3] xdp: bpf_xdp_metadata use EOPNOTSUPP for no driver support List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 21/02/2023 20.03, Martin KaFai Lau wrote: > On 2/21/23 9:13 AM, Stanislav Fomichev wrote: >> On Sat, Feb 18, 2023 at 7:34 AM Jesper Dangaard Brouer >>> >>> When driver doesn't implement a bpf_xdp_metadata kfunc the default >>> implementation returns EOPNOTSUPP, which indicate device driver doesn't >>> implement this kfunc. >>> >>> Currently many drivers also return EOPNOTSUPP when the hint isn't >>> available. Instead change drivers to return ENODATA in these cases. >>> There can be natural cases why a driver doesn't provide any hardware >>> info for a specific hint, even on a frame to frame basis (e.g. PTP). >>> Lets keep these cases as separate return codes. > >> Long term probably still makes sense to export this info via >> xdp-features? >> Not sure how long we can 100% ensure EOPNOTSUPP vs ENODATA convention :-) > > I am also not sure if it makes the xdp-hints adoption easier for other > drivers by enforcing ENODATA or what other return values a driver should > or should not return while EOPNOTSUPP is a more common errno to use. May > be the driver experts can prove me wrong here. Which is why I suggested an errno (ENODEV) that drivers will not want to use by accident. > iiuc, it is for debugging if the bpf prog has been patched with the > driver's xdp kfunc. Others have suggested method like dumping the bpf > prog insn. It could also trace the driver xdp kfunc and see if it is > actually called. Why these won't work? I regret talking about this as a debugging tool. IMHO it have steered the conversation in a wrong direction, sorry. There are (obviously) other metods for debugging this. For me this is more about the API we are giving the BPF-programmer. There can be natural cases why a driver doesn't provide any hardware info for a specific hint. The RX-timestamp is a good practical example, as often only PTP packets will be timestamped by hardware. I can write a BPF-prog that create a stats-map for counting RX-timestamps, expecting to catch any PTP packets with timestamps. The problem is my stats-map cannot record the difference of EOPNOTSUPP vs ENODATA. Thus, the user of my RX-timestamps stats program can draw the wrong conclusion, that there are no packets with (PTP) timestamps, when this was actually a case of driver not implementing this. I hope this simple stats example make is clearer that the BPF-prog can make use of this info runtime. It is simply a question of keeping these cases as separate return codes. Is that too much to ask for from an API? --Jesper