Lines Matching refs:nn
221 struct nfp_net *nn = netdev_priv(prog->aux->offload->netdev); in nfp_bpf_translate() local
230 max_instr = nn_readw(nn, NFP_NET_CFG_BPF_MAX_LEN); in nfp_bpf_translate()
425 int nfp_ndo_bpf(struct nfp_app *app, struct nfp_net *nn, struct netdev_bpf *bpf) in nfp_ndo_bpf() argument
484 bool nfp_bpf_offload_check_mtu(struct nfp_net *nn, struct bpf_prog *prog, in nfp_bpf_offload_check_mtu() argument
489 fw_mtu = nn_readb(nn, NFP_NET_CFG_BPF_INL_MTU) * 64 - 32; in nfp_bpf_offload_check_mtu()
496 nfp_net_bpf_load(struct nfp_net *nn, struct bpf_prog *prog, in nfp_net_bpf_load() argument
505 if (nfp_bpf_offload_check_mtu(nn, prog, nn->dp.netdev->mtu)) { in nfp_net_bpf_load()
510 max_stack = nn_readb(nn, NFP_NET_CFG_BPF_STACK_SZ) * 64; in nfp_net_bpf_load()
516 max_prog_len = nn_readw(nn, NFP_NET_CFG_BPF_MAX_LEN); in nfp_net_bpf_load()
522 img = nfp_bpf_relo_for_vnic(nfp_prog, nn->app_priv); in nfp_net_bpf_load()
526 dma_addr = dma_map_single(nn->dp.dev, img, in nfp_net_bpf_load()
529 if (dma_mapping_error(nn->dp.dev, dma_addr)) { in nfp_net_bpf_load()
534 nn_writew(nn, NFP_NET_CFG_BPF_SIZE, nfp_prog->prog_len); in nfp_net_bpf_load()
535 nn_writeq(nn, NFP_NET_CFG_BPF_ADDR, dma_addr); in nfp_net_bpf_load()
538 err = nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_BPF); in nfp_net_bpf_load()
543 dma_unmap_single(nn->dp.dev, dma_addr, nfp_prog->prog_len * sizeof(u64), in nfp_net_bpf_load()
551 nfp_net_bpf_start(struct nfp_net *nn, struct netlink_ext_ack *extack) in nfp_net_bpf_start() argument
556 nn->dp.ctrl |= NFP_NET_CFG_CTRL_BPF; in nfp_net_bpf_start()
557 nn_writel(nn, NFP_NET_CFG_CTRL, nn->dp.ctrl); in nfp_net_bpf_start()
558 err = nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_GEN); in nfp_net_bpf_start()
564 static int nfp_net_bpf_stop(struct nfp_net *nn) in nfp_net_bpf_stop() argument
566 if (!(nn->dp.ctrl & NFP_NET_CFG_CTRL_BPF)) in nfp_net_bpf_stop()
569 nn->dp.ctrl &= ~NFP_NET_CFG_CTRL_BPF; in nfp_net_bpf_stop()
570 nn_writel(nn, NFP_NET_CFG_CTRL, nn->dp.ctrl); in nfp_net_bpf_stop()
572 return nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_GEN); in nfp_net_bpf_stop()
575 int nfp_net_bpf_offload(struct nfp_net *nn, struct bpf_prog *prog, in nfp_net_bpf_offload() argument
580 if (prog && !bpf_offload_dev_match(prog, nn->dp.netdev)) in nfp_net_bpf_offload()
586 cap = nn_readb(nn, NFP_NET_CFG_BPF_CAP); in nfp_net_bpf_offload()
595 if (!old_prog && nn->dp.ctrl & NFP_NET_CFG_CTRL_BPF) in nfp_net_bpf_offload()
599 return nfp_net_bpf_stop(nn); in nfp_net_bpf_offload()
601 err = nfp_net_bpf_load(nn, prog, extack); in nfp_net_bpf_offload()
606 nfp_net_bpf_start(nn, extack); in nfp_net_bpf_offload()