[net-next,3/8] nfp: bpf: reject TC offload if XDP loaded

Message ID 20171102083136.2096-4-jakub.kicinski@netronome.com
State Accepted
Delegated to: David Miller
Headers show
Series
  • nfp: TC block fixes, app fallback and dev_alloc()
Related show

Commit Message

Jakub Kicinski Nov. 2, 2017, 8:31 a.m.
Recent TC changes dropped the check protecting us from trying
to offload a TC program if XDP programs are already loaded.

Fixes: 90d97315b3e7 ("nfp: bpf: Convert ndo_setup_tc offloads to block callbacks")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/bpf/main.c | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.c b/drivers/net/ethernet/netronome/nfp/bpf/main.c
index 04424db24b80..8e3e89cace8d 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/main.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/main.c
@@ -130,6 +130,9 @@  static int nfp_bpf_setup_tc_block_cb(enum tc_setup_type type,
 		    cls_bpf->common.protocol != htons(ETH_P_ALL) ||
 		    cls_bpf->common.chain_index)
 			return -EOPNOTSUPP;
+		if (nn->dp.bpf_offload_xdp)
+			return -EBUSY;
+
 		return nfp_net_bpf_offload(nn, cls_bpf);
 	default:
 		return -EOPNOTSUPP;