]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nfp: bpf: require ETH table
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 8 Feb 2018 04:55:22 +0000 (20:55 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Feb 2018 15:01:27 +0000 (10:01 -0500)
Upcoming changes will require all netdevs supporting TC offloads
to have a full struct nfp_port.  Require those for BPF offload.
The operation without management FW reporting information about
Ethernet ports is something we only support for very old and very
basic NIC firmwares anyway.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Tested-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/bpf/main.c

index 322027792fe8137ba20d478e5275daebf3faffe9..61898dda11cf5a8077fa7603c8de48a24f6cf2da 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "../nfpcore/nfp_cpp.h"
 #include "../nfpcore/nfp_nffw.h"
+#include "../nfpcore/nfp_nsp.h"
 #include "../nfp_app.h"
 #include "../nfp_main.h"
 #include "../nfp_net.h"
@@ -87,9 +88,20 @@ static const char *nfp_bpf_extra_cap(struct nfp_app *app, struct nfp_net *nn)
 static int
 nfp_bpf_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, unsigned int id)
 {
+       struct nfp_pf *pf = app->pf;
        struct nfp_bpf_vnic *bv;
        int err;
 
+       if (!pf->eth_tbl) {
+               nfp_err(pf->cpp, "No ETH table\n");
+               return -EINVAL;
+       }
+       if (pf->max_data_vnics != pf->eth_tbl->count) {
+               nfp_err(pf->cpp, "ETH entries don't match vNICs (%d vs %d)\n",
+                       pf->max_data_vnics, pf->eth_tbl->count);
+               return -EINVAL;
+       }
+
        bv = kzalloc(sizeof(*bv), GFP_KERNEL);
        if (!bv)
                return -ENOMEM;