All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>,
	 Jamal Hadi Salim <jhs@mojatatu.com>,
	 netdev@vger.kernel.org
Cc: deb.chatterjee@intel.com,  anjali.singhai@intel.com,
	 namrata.limaye@intel.com,  tom@sipanda.io,  mleitner@redhat.com,
	 Mahesh.Shirshyad@amd.com,  Vipin.Jain@amd.com,
	 tomasz.osinski@intel.com,  jiri@resnulli.us,
	 xiyou.wangcong@gmail.com,  davem@davemloft.net,
	 edumazet@google.com,  kuba@kernel.org,  pabeni@redhat.com,
	 vladbu@nvidia.com,  horms@kernel.org,  khalidm@nvidia.com,
	 toke@redhat.com,  martin.lau@linux.dev,  victor@mojatatu.com,
	 pctammela@mojatatu.com,  alexei.starovoitov@gmail.com,
	 bpf@vger.kernel.org
Subject: Re: [PATCH net-next v15 14/15] p4tc: add set of P4TC table kfuncs
Date: Mon, 08 Apr 2024 12:24:40 -0700	[thread overview]
Message-ID: <661444789fccf_49a6208ec@john.notmuch> (raw)
In-Reply-To: <f27bfc4d-8985-6d3d-01f5-782ae1ccb9ee@iogearbox.net>

Daniel Borkmann wrote:
> On 4/8/24 2:19 PM, Jamal Hadi Salim wrote:
> > We add an initial set of kfuncs to allow interactions from eBPF programs
> > to the P4TC domain.
> > 
> > - bpf_p4tc_tbl_read: Used to lookup a table entry from a BPF
> > program installed in TC. To find the table entry we take in an skb, the
> > pipeline ID, the table ID, a key and a key size.
> > We use the skb to get the network namespace structure where all the
> > pipelines are stored. After that we use the pipeline ID and the table
> > ID, to find the table. We then use the key to search for the entry.
> > We return an entry on success and NULL on failure.
> > 
> > - xdp_p4tc_tbl_read: Used to lookup a table entry from a BPF
> > program installed in XDP. To find the table entry we take in an xdp_md,
> > the pipeline ID, the table ID, a key and a key size.
> > We use struct xdp_md to get the network namespace structure where all
> > the pipelines are stored. After that we use the pipeline ID and the table
> > ID, to find the table. We then use the key to search for the entry.
> > We return an entry on success and NULL on failure.
> > 
> > - bpf_p4tc_entry_create: Used to create a table entry from a BPF
> > program installed in TC. To create the table entry we take an skb, the
> > pipeline ID, the table ID, a key and its size, and an action which will
> > be associated with the new entry.
> > We return 0 on success and a negative errno on failure
> > 
> > - xdp_p4tc_entry_create: Used to create a table entry from a BPF
> > program installed in XDP. To create the table entry we take an xdp_md, the
> > pipeline ID, the table ID, a key and its size, and an action which will
> > be associated with the new entry.
> > We return 0 on success and a negative errno on failure
> > 
> > - bpf_p4tc_entry_create_on_miss: conforms to PNA "add on miss".
> > First does a lookup using the passed key and upon a miss will add the entry
> > to the table.
> > We return 0 on success and a negative errno on failure
> > 
> > - xdp_p4tc_entry_create_on_miss: conforms to PNA "add on miss".
> > First does a lookup using the passed key and upon a miss will add the entry
> > to the table.
> > We return 0 on success and a negative errno on failure
> > 
> > - bpf_p4tc_entry_update: Used to update a table entry from a BPF
> > program installed in TC. To update the table entry we take an skb, the
> > pipeline ID, the table ID, a key and its size, and an action which will
> > be associated with the new entry.
> > We return 0 on success and a negative errno on failure
> > 
> > - xdp_p4tc_entry_update: Used to update a table entry from a BPF
> > program installed in XDP. To update the table entry we take an xdp_md, the
> > pipeline ID, the table ID, a key and its size, and an action which will
> > be associated with the new entry.
> > We return 0 on success and a negative errno on failure
> > 
> > - bpf_p4tc_entry_delete: Used to delete a table entry from a BPF
> > program installed in TC. To delete the table entry we take an skb, the
> > pipeline ID, the table ID, a key and a key size.
> > We return 0 on success and a negative errno on failure
> > 
> > - xdp_p4tc_entry_delete: Used to delete a table entry from a BPF
> > program installed in XDP. To delete the table entry we take an xdp_md, the
> > pipeline ID, the table ID, a key and a key size.
> > We return 0 on success and a negative errno on failure
> > 
> > Note:
> > All P4 objects are owned and reside on the P4TC side. IOW, they are
> > controlled via TC netlink interfaces and their resources are managed
> > (created, updated, freed, etc) by the TC side. As an example, the structure
> > p4tc_table_entry_act is returned to the ebpf side on table lookup. On the
> > TC side that struct is wrapped around p4tc_table_entry_act_bpf_kern.
> > A multitude of these structure p4tc_table_entry_act_bpf_kern are
> > preallocated (to match the P4 architecture, patch #9 describes some of
> > the subtleties involved) by the P4TC control plane and put in a kernel
> > pool. Their purpose is to hold the action parameters for either a table
> > entry, a global per-table "miss" and "hit" action, etc - which are
> > instantiated and updated via netlink per runtime requests. An instance of
> > the p4tc_table_entry_act_bpf_kern.p4tc_table_entry_act is returned
> > to ebpf when there is a un/successful table lookup depending on how the
> > P4 program is written. When the table entry is deleted the instance of
> > the struct p4tc_table_entry_act_bpf_kern is recycled to the pool to be
> > reused for a future table entry. The only time the pool memory is released
> > is when the pipeline is deleted.
> > 
> > Co-developed-by: Victor Nogueira <victor@mojatatu.com>
> > Signed-off-by: Victor Nogueira <victor@mojatatu.com>
> > Co-developed-by: Pedro Tammela <pctammela@mojatatu.com>
> > Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
> > Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> > Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> > Nacked-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> > Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
> 
> Given the many reasons stated earlier & for the record:
> 
> Nacked-by: Daniel Borkmann <daniel@iogearbox.net>
> 

Same for me. For reasons already given tldr,

 . p4 can be done already in xdp/tc with p4c backend
 . not clear how hardware offload would be done
 . shimming control path through 'tc' seems unnecessary
 . related kfuncs duplicate map operations already there
 . disagree with pipeline design e.g. single xdp.o is optimal
 . keeping control path in userspace will be more flexible.

Nacked-by: John Fastabend <john.fastabend@gmail.com>


  reply	other threads:[~2024-04-08 19:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08 12:19 [PATCH net-next v15 00/15] Introducing P4TC (series 1) Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 01/15] net: sched: act_api: Introduce P4 actions list Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 02/15] net/sched: act_api: increase action kind string length Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 03/15] net/sched: act_api: Update tc_action_ops to account for P4 actions Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 04/15] net/sched: act_api: add struct p4tc_action_ops as a parameter to lookup callback Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 05/15] net: sched: act_api: Add support for preallocated P4 action instances Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 06/15] p4tc: add P4 data types Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 07/15] p4tc: add template API Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 08/15] p4tc: add template pipeline create, get, update, delete Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 09/15] p4tc: add template action create, update, delete, get, flush and dump Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 10/15] p4tc: add runtime action support Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 11/15] p4tc: add template table create, update, delete, get, flush and dump Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 12/15] p4tc: add runtime table entry create and update Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 13/15] p4tc: add runtime table entry get, delete, flush and dump Jamal Hadi Salim
2024-04-08 12:19 ` [PATCH net-next v15 14/15] p4tc: add set of P4TC table kfuncs Jamal Hadi Salim
2024-04-08 17:35   ` Daniel Borkmann
2024-04-08 19:24     ` John Fastabend [this message]
2024-04-08 12:20 ` [PATCH net-next v15 15/15] p4tc: add P4 classifier Jamal Hadi Salim

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=661444789fccf_49a6208ec@john.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=Mahesh.Shirshyad@amd.com \
    --cc=Vipin.Jain@amd.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=anjali.singhai@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=deb.chatterjee@intel.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=khalidm@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mleitner@redhat.com \
    --cc=namrata.limaye@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pctammela@mojatatu.com \
    --cc=toke@redhat.com \
    --cc=tom@sipanda.io \
    --cc=tomasz.osinski@intel.com \
    --cc=victor@mojatatu.com \
    --cc=vladbu@nvidia.com \
    --cc=xiyou.wangcong@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.