All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] nfp: bpf: allocate vNIC priv for keeping track of the offloaded program
@ 2017-12-27 23:36 Jakub Kicinski
  2017-12-28  1:38 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2017-12-27 23:36 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, Jakub Kicinski

After TC offloads were converted to callbacks we have no choice
but keep track of the offloaded filter in the driver.

Since this change came a little late in the release cycle
there were a number of conflicts and allocation of vNIC priv
structure seems to have slipped away in linux-next.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/bpf/main.c | 30 ++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.c b/drivers/net/ethernet/netronome/nfp/bpf/main.c
index 214b02a3acdd..4b63167906ca 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/main.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/main.c
@@ -84,6 +84,33 @@ static const char *nfp_bpf_extra_cap(struct nfp_app *app, struct nfp_net *nn)
 	return nfp_net_ebpf_capable(nn) ? "BPF" : "";
 }
 
+static int
+nfp_bpf_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, unsigned int id)
+{
+	int err;
+
+	nn->app_priv = kzalloc(sizeof(struct nfp_bpf_vnic), GFP_KERNEL);
+	if (!nn->app_priv)
+		return -ENOMEM;
+
+	err = nfp_app_nic_vnic_alloc(app, nn, id);
+	if (err)
+		goto err_free_priv;
+
+	return 0;
+err_free_priv:
+	kfree(nn->app_priv);
+	return err;
+}
+
+static void nfp_bpf_vnic_free(struct nfp_app *app, struct nfp_net *nn)
+{
+	struct nfp_bpf_vnic *bv = nn->app_priv;
+
+	WARN_ON(bv->tc_prog);
+	kfree(bv);
+}
+
 static int nfp_bpf_setup_tc_block_cb(enum tc_setup_type type,
 				     void *type_data, void *cb_priv)
 {
@@ -286,7 +313,8 @@ const struct nfp_app_type app_bpf = {
 
 	.extra_cap	= nfp_bpf_extra_cap,
 
-	.vnic_alloc	= nfp_app_nic_vnic_alloc,
+	.vnic_alloc	= nfp_bpf_vnic_alloc,
+	.vnic_free	= nfp_bpf_vnic_free,
 
 	.setup_tc	= nfp_bpf_setup_tc,
 	.tc_busy	= nfp_bpf_tc_busy,
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] nfp: bpf: allocate vNIC priv for keeping track of the offloaded program
  2017-12-27 23:36 [PATCH net-next] nfp: bpf: allocate vNIC priv for keeping track of the offloaded program Jakub Kicinski
@ 2017-12-28  1:38 ` David Miller
  2017-12-28  4:11   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2017-12-28  1:38 UTC (permalink / raw)
  To: jakub.kicinski; +Cc: netdev, oss-drivers

From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Wed, 27 Dec 2017 15:36:49 -0800

> After TC offloads were converted to callbacks we have no choice
> but keep track of the offloaded filter in the driver.
> 
> Since this change came a little late in the release cycle
> there were a number of conflicts and allocation of vNIC priv
> structure seems to have slipped away in linux-next.
> 
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Oh well, I thought I resolved the merge conflict properly in this
case.  Apparently not :-)

Applied, thanks Jakub.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] nfp: bpf: allocate vNIC priv for keeping track of the offloaded program
  2017-12-28  1:38 ` David Miller
@ 2017-12-28  4:11   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2017-12-28  4:11 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, oss-drivers

On Wed, 27 Dec 2017 20:38:11 -0500 (EST), David Miller wrote:
> From: Jakub Kicinski <jakub.kicinski@netronome.com>
> Date: Wed, 27 Dec 2017 15:36:49 -0800
> 
> > After TC offloads were converted to callbacks we have no choice
> > but keep track of the offloaded filter in the driver.
> > 
> > Since this change came a little late in the release cycle
> > there were a number of conflicts and allocation of vNIC priv
> > structure seems to have slipped away in linux-next.
> > 
> > Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>  
> 
> Oh well, I thought I resolved the merge conflict properly in this
> case.  Apparently not :-)

The resolution looks suspiciously similar to what Stephen did in
linux-next, but I wasn't sure if you reuse his resolutions hence 
no Fixes: 903628bbc3a7 ;)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-28  4:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-27 23:36 [PATCH net-next] nfp: bpf: allocate vNIC priv for keeping track of the offloaded program Jakub Kicinski
2017-12-28  1:38 ` David Miller
2017-12-28  4:11   ` Jakub Kicinski

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.