From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; spf=pass (mailfrom) smtp.mailfrom=linux.dev (client-ip=2001:41d0:203:375::c; helo=out-12.mta1.migadu.com; envelope-from=martin.lau@linux.dev; receiver=) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=uyKlIPAe Received: from out-12.mta1.migadu.com (out-12.mta1.migadu.com [IPv6:2001:41d0:203:375::c]) by mail.toke.dk (Postfix) with ESMTPS id 8310B9EC4CB for ; Tue, 21 Feb 2023 20:04:04 +0100 (CET) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1677006238; 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=fHZ9uFeGd1/sPkvqg90pH/bhVbOnjEvOk51cW9TJEMw=; b=uyKlIPAeUQHKi4b2oNKrhj6HdBBAlXco3IByyMOZl4wXZR8dsxwxwiHGBFh9R0207ki0Y1 KylNQV5Crh9hVjUcZKZovfjJ/m8EeNcTe5/Bl6Fywwk78wZaTUR0QdDCvliy25kjv8XO/T fVRRQZSDAeXSf7HENmjKQuZ77I1Pb7U= Date: Tue, 21 Feb 2023 11:03:52 -0800 MIME-Version: 1.0 Content-Language: en-US To: Stanislav Fomichev , Jesper Dangaard Brouer References: <167673444093.2179692.14745621008776172374.stgit@firesoul> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Message-ID-Hash: 722UA2RJGDRPCZEOJAJM2AUCL45OBKVR X-Message-ID-Hash: 722UA2RJGDRPCZEOJAJM2AUCL45OBKVR X-MailFrom: martin.lau@linux.dev 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: 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 2/21/23 9:13 AM, Stanislav Fomichev wrote: > On Sat, Feb 18, 2023 at 7:34 AM Jesper Dangaard Brouer > wrote: >> >> 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. 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? Beside, it is more like a load time decision which should not need a runtime return error value to decide. eg. With xdp-features, the bpf prog can check a global const which can be set based on the query result from xdp-features. It will then be dead code removed by verifier. This could also handle the older kernel that does not have xdp-metadata support (ie. missing bpf_xdp_metadata_rx_{timestamp,hash}).