Lines Matching refs:slwt
39 int (*input)(struct sk_buff *skb, struct seg6_local_lwt *slwt);
219 static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end() argument
239 static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end_x() argument
249 seg6_lookup_nexthop(skb, &slwt->nh6, 0); in input_action_end_x()
258 static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end_t() argument
268 seg6_lookup_nexthop(skb, NULL, slwt->table); in input_action_end_t()
279 struct seg6_local_lwt *slwt) in input_action_end_dx2() argument
301 odev = dev_get_by_index_rcu(net, slwt->oif); in input_action_end_dx2()
336 struct seg6_local_lwt *slwt) in input_action_end_dx6() argument
357 if (!ipv6_addr_any(&slwt->nh6)) in input_action_end_dx6()
358 nhaddr = &slwt->nh6; in input_action_end_dx6()
371 struct seg6_local_lwt *slwt) in input_action_end_dx4() argument
387 nhaddr = slwt->nh4.s_addr ?: iph->daddr; in input_action_end_dx4()
405 struct seg6_local_lwt *slwt) in input_action_end_dt6() argument
415 seg6_lookup_any_nexthop(skb, NULL, slwt->table, true); in input_action_end_dt6()
425 static int input_action_end_b6(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end_b6() argument
434 err = seg6_do_srh_inline(skb, slwt->srh); in input_action_end_b6()
451 struct seg6_local_lwt *slwt) in input_action_end_b6_encap() argument
465 err = seg6_do_srh_encap(skb, slwt->srh, IPPROTO_IPV6); in input_action_end_b6_encap()
506 struct seg6_local_lwt *slwt) in input_action_end_bpf() argument
530 ret = bpf_prog_run_save_cb(slwt->bpf.prog, skb); in input_action_end_bpf()
633 struct seg6_local_lwt *slwt; in seg6_local_input() local
640 slwt = seg6_local_lwtunnel(orig_dst->lwtstate); in seg6_local_input()
641 desc = slwt->desc; in seg6_local_input()
643 return desc->input(skb, slwt); in seg6_local_input()
659 static int parse_nla_srh(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_srh() argument
674 slwt->srh = kmemdup(srh, len, GFP_KERNEL); in parse_nla_srh()
675 if (!slwt->srh) in parse_nla_srh()
678 slwt->headroom += len; in parse_nla_srh()
683 static int put_nla_srh(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_srh() argument
689 srh = slwt->srh; in put_nla_srh()
711 static int parse_nla_table(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_table() argument
713 slwt->table = nla_get_u32(attrs[SEG6_LOCAL_TABLE]); in parse_nla_table()
718 static int put_nla_table(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_table() argument
720 if (nla_put_u32(skb, SEG6_LOCAL_TABLE, slwt->table)) in put_nla_table()
734 static int parse_nla_nh4(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_nh4() argument
736 memcpy(&slwt->nh4, nla_data(attrs[SEG6_LOCAL_NH4]), in parse_nla_nh4()
742 static int put_nla_nh4(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_nh4() argument
750 memcpy(nla_data(nla), &slwt->nh4, sizeof(struct in_addr)); in put_nla_nh4()
760 static int parse_nla_nh6(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_nh6() argument
762 memcpy(&slwt->nh6, nla_data(attrs[SEG6_LOCAL_NH6]), in parse_nla_nh6()
768 static int put_nla_nh6(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_nh6() argument
776 memcpy(nla_data(nla), &slwt->nh6, sizeof(struct in6_addr)); in put_nla_nh6()
786 static int parse_nla_iif(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_iif() argument
788 slwt->iif = nla_get_u32(attrs[SEG6_LOCAL_IIF]); in parse_nla_iif()
793 static int put_nla_iif(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_iif() argument
795 if (nla_put_u32(skb, SEG6_LOCAL_IIF, slwt->iif)) in put_nla_iif()
809 static int parse_nla_oif(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_oif() argument
811 slwt->oif = nla_get_u32(attrs[SEG6_LOCAL_OIF]); in parse_nla_oif()
816 static int put_nla_oif(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_oif() argument
818 if (nla_put_u32(skb, SEG6_LOCAL_OIF, slwt->oif)) in put_nla_oif()
839 static int parse_nla_bpf(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_bpf() argument
855 slwt->bpf.name = nla_memdup(tb[SEG6_LOCAL_BPF_PROG_NAME], GFP_KERNEL); in parse_nla_bpf()
856 if (!slwt->bpf.name) in parse_nla_bpf()
862 kfree(slwt->bpf.name); in parse_nla_bpf()
866 slwt->bpf.prog = p; in parse_nla_bpf()
870 static int put_nla_bpf(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_bpf() argument
874 if (!slwt->bpf.prog) in put_nla_bpf()
881 if (nla_put_u32(skb, SEG6_LOCAL_BPF_PROG, slwt->bpf.prog->aux->id)) in put_nla_bpf()
884 if (slwt->bpf.name && in put_nla_bpf()
885 nla_put_string(skb, SEG6_LOCAL_BPF_PROG_NAME, slwt->bpf.name)) in put_nla_bpf()
903 int (*parse)(struct nlattr **attrs, struct seg6_local_lwt *slwt);
904 int (*put)(struct sk_buff *skb, struct seg6_local_lwt *slwt);
939 static int parse_nla_action(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_action() argument
945 desc = __get_action_desc(slwt->action); in parse_nla_action()
952 slwt->desc = desc; in parse_nla_action()
953 slwt->headroom += desc->static_headroom; in parse_nla_action()
962 err = param->parse(attrs, slwt); in parse_nla_action()
978 struct seg6_local_lwt *slwt; in seg6_local_build_state() local
993 newts = lwtunnel_state_alloc(sizeof(*slwt)); in seg6_local_build_state()
997 slwt = seg6_local_lwtunnel(newts); in seg6_local_build_state()
998 slwt->action = nla_get_u32(tb[SEG6_LOCAL_ACTION]); in seg6_local_build_state()
1000 err = parse_nla_action(tb, slwt); in seg6_local_build_state()
1006 newts->headroom = slwt->headroom; in seg6_local_build_state()
1013 kfree(slwt->srh); in seg6_local_build_state()
1020 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt); in seg6_local_destroy_state() local
1022 kfree(slwt->srh); in seg6_local_destroy_state()
1024 if (slwt->desc->attrs & (1 << SEG6_LOCAL_BPF)) { in seg6_local_destroy_state()
1025 kfree(slwt->bpf.name); in seg6_local_destroy_state()
1026 bpf_prog_put(slwt->bpf.prog); in seg6_local_destroy_state()
1035 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt); in seg6_local_fill_encap() local
1039 if (nla_put_u32(skb, SEG6_LOCAL_ACTION, slwt->action)) in seg6_local_fill_encap()
1043 if (slwt->desc->attrs & (1 << i)) { in seg6_local_fill_encap()
1045 err = param->put(skb, slwt); in seg6_local_fill_encap()
1056 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt); in seg6_local_get_encap_size() local
1062 attrs = slwt->desc->attrs; in seg6_local_get_encap_size()
1065 nlsize += nla_total_size((slwt->srh->hdrlen + 1) << 3); in seg6_local_get_encap_size()