summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/netronome/nfp/flower/main.c
diff options
context:
space:
mode:
authorPieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>2017-06-29 22:08:17 +0200
committerDavid S. Miller <davem@davemloft.net>2017-07-01 08:51:32 -0700
commit43f84b72c50d40c3eb2f59070e40ef51bfd483cc (patch)
treeabcc230d86867c1739904a08df399a04e950e09c /drivers/net/ethernet/netronome/nfp/flower/main.c
parent1a1e586f54bfe54a0ba7ea0ac9b8c7b1d3e655f6 (diff)
downloadblackbird-op-linux-43f84b72c50d40c3eb2f59070e40ef51bfd483cc.tar.gz
blackbird-op-linux-43f84b72c50d40c3eb2f59070e40ef51bfd483cc.zip
nfp: add metadata to each flow offload
Adds metadata describing the mask id of each flow and keeps track of flows installed in hardware. Previously a flow could not be removed from hardware as there was no way of knowing if that a specific flow was installed. This is solved by storing the offloaded flows in a hash table. Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/flower/main.c')
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/main.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.c b/drivers/net/ethernet/netronome/nfp/flower/main.c
index 7bf994ceb9c1..5fe6d3582597 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/main.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/main.c
@@ -34,6 +34,7 @@
#include <linux/etherdevice.h>
#include <linux/pci.h>
#include <linux/skbuff.h>
+#include <linux/vmalloc.h>
#include <net/devlink.h>
#include <net/dst_metadata.h>
@@ -50,14 +51,6 @@
#define NFP_FLOWER_ALLOWED_VER 0x0001000000010000UL
-/**
- * struct nfp_flower_priv - Flower APP per-vNIC priv data
- * @nn: Pointer to vNIC
- */
-struct nfp_flower_priv {
- struct nfp_net *nn;
-};
-
static const char *nfp_flower_extra_cap(struct nfp_app *app, struct nfp_net *nn)
{
return "FLOWER";
@@ -347,16 +340,24 @@ static int nfp_flower_init(struct nfp_app *app)
return -EINVAL;
}
- app->priv = kzalloc(sizeof(struct nfp_flower_priv), GFP_KERNEL);
+ app->priv = vzalloc(sizeof(struct nfp_flower_priv));
if (!app->priv)
return -ENOMEM;
+ err = nfp_flower_metadata_init(app);
+ if (err)
+ goto err_free_app_priv;
+
return 0;
+
+err_free_app_priv:
+ vfree(app->priv);
+ return err;
}
static void nfp_flower_clean(struct nfp_app *app)
{
- kfree(app->priv);
+ vfree(app->priv);
app->priv = NULL;
}
OpenPOWER on IntegriCloud