nfp: bpf: fall back to core NIC app if BPF not selected
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 2 Nov 2017 08:31:33 +0000 (01:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Nov 2017 11:27:11 +0000 (20:27 +0900)
If kernel config does not include BPF just replace the BPF
app handler with the handler for basic NIC.  The BPF app
will now be built only if BPF infrastructure is selected
in kernel config.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/Makefile
drivers/net/ethernet/netronome/nfp/bpf/offload.c
drivers/net/ethernet/netronome/nfp/nfp_app.c

index bd3b2bd408bcf2437fee22a7bdf332df8849358e..9e8d30cb1517ad4df2c94309ec9c408c45008886 100644 (file)
@@ -27,8 +27,6 @@ nfp-objs := \
            nfp_net_sriov.o \
            nfp_netvf_main.o \
            nfp_port.o \
-           bpf/main.o \
-           bpf/offload.o \
            nic/main.o
 
 ifeq ($(CONFIG_NFP_APP_FLOWER),y)
@@ -44,6 +42,8 @@ endif
 
 ifeq ($(CONFIG_BPF_SYSCALL),y)
 nfp-objs += \
+           bpf/main.o \
+           bpf/offload.o \
            bpf/verifier.o \
            bpf/jit.o
 endif
index 63c8f784705448b62228e782453f0b8dba35f8b1..6d576f63139208a4cee0992175ad89424ca9e131 100644 (file)
@@ -150,9 +150,6 @@ nfp_net_bpf_offload_prepare(struct nfp_net *nn,
        unsigned int max_mtu;
        int ret;
 
-       if (!IS_ENABLED(CONFIG_BPF_SYSCALL))
-               return -EOPNOTSUPP;
-
        ret = nfp_net_bpf_get_act(nn, cls_bpf);
        if (ret < 0)
                return ret;
index 085c5151c6010752528f038e4f742f6e617b459b..3644d74fe3042383b1668e688bd52f19fe530fe5 100644 (file)
 
 static const struct nfp_app_type *apps[] = {
        [NFP_APP_CORE_NIC]      = &app_nic,
+#ifdef CONFIG_BPF_SYSCALL
        [NFP_APP_BPF_NIC]       = &app_bpf,
+#else
+       [NFP_APP_BPF_NIC]       = &app_nic,
+#endif
 #ifdef CONFIG_NFP_APP_FLOWER
        [NFP_APP_FLOWER_NIC]    = &app_flower,
 #endif