From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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 3FF5A199CA for ; Tue, 19 Dec 2023 12:16:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=daynix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b="RAneCU9w" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-28b62c6317dso1120228a91.0 for ; Tue, 19 Dec 2023 04:16:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1702988199; x=1703592999; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=pdERbfWd8axs3o2A8KOivOOsBTH7eU7jDtQCQU5TR64=; b=RAneCU9wXoqkp9sJKB3vJwk+9/S5DscO15PpEqNV94MOxjOqcGkbmJq92FLtm07lf1 btXH/h2kapHoettWj7tXmDhw8BybJ3HwzCFMIYT3KB0nAAR1TwaP96hFHo0vF9GsGt+w SMjITtrm39RTTdE/UTAmaNAu6Fee/tYjvknt3QHI5vYw2HiTc5d0mUDpgNidFidPUUR3 2DVAxwx3hZ1Opa9qTJl64XXAQvgzGSezCQPKoomV/OTK6Pt6gX71ng0zBC0FVrR3xUqC 2vdZ4Toauj1JoRWM48Ba+HC3+dJNA6VFdA8yn7HIhjdmQIyLIvy23etcwNDXmP3k9WTD 8NsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702988199; x=1703592999; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pdERbfWd8axs3o2A8KOivOOsBTH7eU7jDtQCQU5TR64=; b=ZBs1RZa8HF0KMaoi8O6S900Ome2HDt8w/6psC3icGW4JshBOsfvTON0NEF7hfZoBvd 0Yx8oyu5b8hFvOOrDPy3NbzrAg4KyUMZyk2r6So8tm/6UlZnVDYKxoYbnS2GVf5y4Y0E ZP2lpnY6zjluvY/7isAluACncyupAZvwEMzPagV6syuR7eQddXPc7HN2eNSeEE/PIOYj dzejuEproNVn/JfyEMWQDzF+p4xzK6ORTOqL54LjqS6WWeXf3BZm88Jl39jAf0dSCIZg 07qDr49JeXzd+8jzjxGzXzbLORhasdcg+iEHXxjrXAdyklgJ92I2At4w4S5AKQqs/O8w SpmA== X-Gm-Message-State: AOJu0Yxx4XQbbsqJn9zeTiBbz3ZO0TqE+LvpbzE7QFYi9ffPTy4UDBWH nY+Nc8tfdhweM+Y7qyi1nJj7jQ== X-Google-Smtp-Source: AGHT+IFYjl+Fut6DF10AvB+rC8c9j309BtUc82beTcI2OpnuUGu9er2HNCKWhRNTJ7qi3gFQPi0b+g== X-Received: by 2002:a17:90a:303:b0:28a:f0bc:2a9f with SMTP id 3-20020a17090a030300b0028af0bc2a9fmr2996731pje.21.1702988199587; Tue, 19 Dec 2023 04:16:39 -0800 (PST) Received: from [157.82.205.15] ([157.82.205.15]) by smtp.gmail.com with ESMTPSA id g15-20020a17090a4b0f00b0028bb87b2378sm1385953pjh.49.2023.12.19.04.16.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Dec 2023 04:16:39 -0800 (PST) Message-ID: <87ae3eae-84b4-40eb-a637-b65161bdc1ed@daynix.com> Date: Tue, 19 Dec 2023 21:16:32 +0900 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Should I add BPF kfuncs for userspace apps? And how? Content-Language: en-US To: Song Liu Cc: Alexei Starovoitov , Jason Wang , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Jonathan Corbet , Willem de Bruijn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Xuan Zhuo , Mykola Lysenko , Shuah Khan , Yuri Benditovich , Andrew Melnychenko , Benjamin Tissoires , bpf , "open list:DOCUMENTATION" , kvm@vger.kernel.org, LKML , virtualization@lists.linux-foundation.org, "open list:KERNEL SELFTEST FRAMEWORK" , Network Development References: <2f33be45-fe11-4b69-8e89-4d2824a0bf01@daynix.com> From: Akihiko Odaki In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2023/12/19 4:56, Song Liu wrote: > Hi Akihiko, > > On Tue, Dec 12, 2023 at 12:05 AM Akihiko Odaki wrote: >> > [...] >> --- >> >> I'm working on a new feature that aids virtio-net implementations using >> tuntap virtual network device. You can see [1] for details, but >> basically it's to extend BPF_PROG_TYPE_SOCKET_FILTER to report four more >> bytes. > > AFAICT, [1] adds a new program type, which is really hard to ship. However, > you mentioned it is basically "extend BPF_PROG_TYPE_SOCKET_FILTER to > report four more bytes", which confuses me. > > Can we achieve the same goal by extending BPF_PROG_TYPE_SOCKET_FILTER > (without adding a new program type)? Does this require extending > __sk_buff, which > is also not an option any more? It is certainly possible to achieve the same result by extending BPF_PROG_TYPE_SOCKET_FILTER. It is not required to extend __sk_buff; we can repurpose the cb member. But I think such an API will be error-prone than new members dedicated for this particular purpose. Regards, Akihiko Odaki