bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <kafai@fb.com>
To: Tyler Wear <quic_twear@quicinc.com>
Cc: <netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
	<maze@google.com>, <yhs@fb.com>, <toke@redhat.com>,
	<daniel@iogearbox.net>, <song@kernel.org>
Subject: Re: [PATCH bpf-next v5 1/2] Add skb_store_bytes() for BPF_PROG_TYPE_CGROUP_SKB
Date: Wed, 12 Jan 2022 11:57:32 -0800	[thread overview]
Message-ID: <20220112195732.4vlkuowaiyc4k24t@kafai-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <20220111000001.3118189-1-quic_twear@quicinc.com>

On Mon, Jan 10, 2022 at 04:00:00PM -0800, Tyler Wear wrote:
> Need to modify the ds field to support upcoming Wifi QoS Alliance spec.
> Instead of adding generic function for just modifying the ds field,
> add skb_store_bytes for BPF_PROG_TYPE_CGROUP_SKB.
> This allows other fields in the network and transport header to be
> modified in the future.
> 
> Checksum API's also need to be added for completeness.
> 
> It is not possible to use CGROUP_(SET|GET)SOCKOPT since
> the policy may change during runtime and would result
> in a large number of entries with wildcards.
> 
> V4 patch fixes warnings and errors from checkpatch.
> 
> The existing check for bpf_try_make_writable() should mean that
> skb_share_check() is not needed.
> 
> Signed-off-by: Tyler Wear <quic_twear@quicinc.com>
> ---
>  net/core/filter.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 6102f093d59a..ce01a8036361 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -7299,6 +7299,16 @@ cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
>  		return &bpf_sk_storage_delete_proto;
>  	case BPF_FUNC_perf_event_output:
>  		return &bpf_skb_event_output_proto;
> +	case BPF_FUNC_skb_store_bytes:
> +		return &bpf_skb_store_bytes_proto;
> +	case BPF_FUNC_csum_update:
> +		return &bpf_csum_update_proto;
> +	case BPF_FUNC_csum_level:
> +		return &bpf_csum_level_proto;
> +	case BPF_FUNC_l3_csum_replace:
> +		return &bpf_l3_csum_replace_proto;
> +	case BPF_FUNC_l4_csum_replace:
> +		return &bpf_l4_csum_replace_proto;
BPF_FUNC_csum_diff should also be added to support
updating >4 bytes (e.g. ipv6 addr).

      parent reply	other threads:[~2022-01-12 20:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  0:00 [PATCH bpf-next v5 1/2] Add skb_store_bytes() for BPF_PROG_TYPE_CGROUP_SKB Tyler Wear
2022-01-11  0:00 ` [PATCH bpf-next v5 2/2] selftests/bpf: CGROUP_SKB test for skb_store_bytes() Tyler Wear
2022-01-12 21:01   ` Martin KaFai Lau
2022-01-12 19:57 ` Martin KaFai Lau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220112195732.4vlkuowaiyc4k24t@kafai-mbp.dhcp.thefacebook.com \
    --to=kafai@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=quic_twear@quicinc.com \
    --cc=song@kernel.org \
    --cc=toke@redhat.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).