{
struct nfp_net *nn = netdev_priv(netdev);
- if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS))
- return -EOPNOTSUPP;
- if (proto != htons(ETH_P_ALL))
+ if (type != TC_SETUP_CLSBPF || !nfp_net_ebpf_capable(nn) ||
+ TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS) ||
+ proto != htons(ETH_P_ALL))
return -EOPNOTSUPP;
- if (type == TC_SETUP_CLSBPF && nfp_net_ebpf_capable(nn)) {
- if (!nn->dp.bpf_offload_xdp)
- return nfp_net_bpf_offload(nn, tc->cls_bpf);
- else
- return -EBUSY;
- }
+ if (nn->dp.bpf_offload_xdp)
+ return -EBUSY;
- return -EINVAL;
+ return nfp_net_bpf_offload(nn, tc->cls_bpf);
}
static bool nfp_bpf_tc_busy(struct nfp_app *app, struct nfp_net *nn)
enum tc_setup_type type, u32 handle, __be16 proto,
struct tc_to_netdev *tc)
{
- if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS))
+ if (type != TC_SETUP_CLSFLOWER ||
+ TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS) ||
+ !eth_proto_is_802_3(proto))
return -EOPNOTSUPP;
- if (!eth_proto_is_802_3(proto))
- return -EOPNOTSUPP;
-
- if (type != TC_SETUP_CLSFLOWER)
- return -EINVAL;
-
return nfp_flower_repr_offload(app, netdev, tc->cls_flower);
}