Lines Matching refs:slwt

42 	int (*build_state)(struct seg6_local_lwt *slwt, const void *cfg,
44 void (*destroy_state)(struct seg6_local_lwt *slwt);
65 int (*input)(struct sk_buff *skb, struct seg6_local_lwt *slwt);
368 struct seg6_local_lwt *slwt) in input_action_end_core() argument
387 static int end_next_csid_core(struct sk_buff *skb, struct seg6_local_lwt *slwt) in end_next_csid_core() argument
389 const struct seg6_flavors_info *finfo = &slwt->flv_info; in end_next_csid_core()
393 return input_action_end_core(skb, slwt); in end_next_csid_core()
409 static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end() argument
411 const struct seg6_flavors_info *finfo = &slwt->flv_info; in input_action_end()
414 return end_next_csid_core(skb, slwt); in input_action_end()
416 return input_action_end_core(skb, slwt); in input_action_end()
420 static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end_x() argument
430 seg6_lookup_nexthop(skb, &slwt->nh6, 0); in input_action_end_x()
439 static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end_t() argument
449 seg6_lookup_nexthop(skb, NULL, slwt->table); in input_action_end_t()
460 struct seg6_local_lwt *slwt) in input_action_end_dx2() argument
482 odev = dev_get_by_index_rcu(net, slwt->oif); in input_action_end_dx2()
520 struct seg6_local_lwt *slwt; in input_action_end_dx6_finish() local
522 slwt = seg6_local_lwtunnel(orig_dst->lwtstate); in input_action_end_dx6_finish()
530 if (!ipv6_addr_any(&slwt->nh6)) in input_action_end_dx6_finish()
531 nhaddr = &slwt->nh6; in input_action_end_dx6_finish()
540 struct seg6_local_lwt *slwt) in input_action_end_dx6() argument
570 struct seg6_local_lwt *slwt; in input_action_end_dx4_finish() local
575 slwt = seg6_local_lwtunnel(orig_dst->lwtstate); in input_action_end_dx4_finish()
579 nhaddr = slwt->nh4.s_addr ?: iph->daddr; in input_action_end_dx4_finish()
593 struct seg6_local_lwt *slwt) in input_action_end_dx4() argument
624 static int __seg6_end_dt_vrf_build(struct seg6_local_lwt *slwt, const void *cfg, in __seg6_end_dt_vrf_build() argument
627 struct seg6_end_dt_info *info = &slwt->dt_info; in __seg6_end_dt_vrf_build()
742 struct seg6_local_lwt *slwt, u16 family) in end_dt_vrf_core() argument
744 struct seg6_end_dt_info *info = &slwt->dt_info; in end_dt_vrf_core()
788 struct seg6_local_lwt *slwt) in input_action_end_dt4() argument
799 skb = end_dt_vrf_core(skb, slwt, AF_INET); in input_action_end_dt4()
820 static int seg6_end_dt4_build(struct seg6_local_lwt *slwt, const void *cfg, in seg6_end_dt4_build() argument
823 return __seg6_end_dt_vrf_build(slwt, cfg, AF_INET, extack); in seg6_end_dt4_build()
827 seg6_end_dt_mode seg6_end_dt6_parse_mode(struct seg6_local_lwt *slwt) in seg6_end_dt6_parse_mode() argument
829 unsigned long parsed_optattrs = slwt->parsed_optattrs; in seg6_end_dt6_parse_mode()
842 static enum seg6_end_dt_mode seg6_end_dt6_get_mode(struct seg6_local_lwt *slwt) in seg6_end_dt6_get_mode() argument
844 struct seg6_end_dt_info *info = &slwt->dt_info; in seg6_end_dt6_get_mode()
849 static int seg6_end_dt6_build(struct seg6_local_lwt *slwt, const void *cfg, in seg6_end_dt6_build() argument
852 enum seg6_end_dt_mode mode = seg6_end_dt6_parse_mode(slwt); in seg6_end_dt6_build()
853 struct seg6_end_dt_info *info = &slwt->dt_info; in seg6_end_dt6_build()
860 return __seg6_end_dt_vrf_build(slwt, cfg, AF_INET6, extack); in seg6_end_dt6_build()
869 struct seg6_local_lwt *slwt) in input_action_end_dt6() argument
878 if (seg6_end_dt6_get_mode(slwt) == DT_LEGACY_MODE) in input_action_end_dt6()
882 skb = end_dt_vrf_core(skb, slwt, AF_INET6); in input_action_end_dt6()
901 seg6_lookup_any_nexthop(skb, NULL, slwt->table, true); in input_action_end_dt6()
911 static int seg6_end_dt46_build(struct seg6_local_lwt *slwt, const void *cfg, in seg6_end_dt46_build() argument
914 return __seg6_end_dt_vrf_build(slwt, cfg, AF_UNSPEC, extack); in seg6_end_dt46_build()
918 struct seg6_local_lwt *slwt) in input_action_end_dt46() argument
929 return input_action_end_dt4(skb, slwt); in input_action_end_dt46()
931 return input_action_end_dt6(skb, slwt); in input_action_end_dt46()
941 static int input_action_end_b6(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end_b6() argument
950 err = seg6_do_srh_inline(skb, slwt->srh); in input_action_end_b6()
967 struct seg6_local_lwt *slwt) in input_action_end_b6_encap() argument
981 err = seg6_do_srh_encap(skb, slwt->srh, IPPROTO_IPV6); in input_action_end_b6_encap()
1022 struct seg6_local_lwt *slwt) in input_action_end_bpf() argument
1046 ret = bpf_prog_run_save_cb(slwt->bpf.prog, skb); in input_action_end_bpf()
1188 static bool seg6_lwtunnel_counters_enabled(struct seg6_local_lwt *slwt) in seg6_lwtunnel_counters_enabled() argument
1190 return slwt->parsed_optattrs & SEG6_F_LOCAL_COUNTERS; in seg6_lwtunnel_counters_enabled()
1193 static void seg6_local_update_counters(struct seg6_local_lwt *slwt, in seg6_local_update_counters() argument
1198 pcounters = this_cpu_ptr(slwt->pcpu_counters); in seg6_local_update_counters()
1216 struct seg6_local_lwt *slwt; in seg6_local_input_core() local
1220 slwt = seg6_local_lwtunnel(orig_dst->lwtstate); in seg6_local_input_core()
1221 desc = slwt->desc; in seg6_local_input_core()
1223 rc = desc->input(skb, slwt); in seg6_local_input_core()
1225 if (!seg6_lwtunnel_counters_enabled(slwt)) in seg6_local_input_core()
1228 seg6_local_update_counters(slwt, len, rc); in seg6_local_input_core()
1264 static int parse_nla_srh(struct nlattr **attrs, struct seg6_local_lwt *slwt, in parse_nla_srh() argument
1280 slwt->srh = kmemdup(srh, len, GFP_KERNEL); in parse_nla_srh()
1281 if (!slwt->srh) in parse_nla_srh()
1284 slwt->headroom += len; in parse_nla_srh()
1289 static int put_nla_srh(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_srh() argument
1295 srh = slwt->srh; in put_nla_srh()
1317 static void destroy_attr_srh(struct seg6_local_lwt *slwt) in destroy_attr_srh() argument
1319 kfree(slwt->srh); in destroy_attr_srh()
1322 static int parse_nla_table(struct nlattr **attrs, struct seg6_local_lwt *slwt, in parse_nla_table() argument
1325 slwt->table = nla_get_u32(attrs[SEG6_LOCAL_TABLE]); in parse_nla_table()
1330 static int put_nla_table(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_table() argument
1332 if (nla_put_u32(skb, SEG6_LOCAL_TABLE, slwt->table)) in put_nla_table()
1347 seg6_end_dt_info *seg6_possible_end_dt_info(struct seg6_local_lwt *slwt) in seg6_possible_end_dt_info() argument
1350 return &slwt->dt_info; in seg6_possible_end_dt_info()
1357 struct seg6_local_lwt *slwt, in parse_nla_vrftable() argument
1360 struct seg6_end_dt_info *info = seg6_possible_end_dt_info(slwt); in parse_nla_vrftable()
1370 static int put_nla_vrftable(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_vrftable() argument
1372 struct seg6_end_dt_info *info = seg6_possible_end_dt_info(slwt); in put_nla_vrftable()
1394 static int parse_nla_nh4(struct nlattr **attrs, struct seg6_local_lwt *slwt, in parse_nla_nh4() argument
1397 memcpy(&slwt->nh4, nla_data(attrs[SEG6_LOCAL_NH4]), in parse_nla_nh4()
1403 static int put_nla_nh4(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_nh4() argument
1411 memcpy(nla_data(nla), &slwt->nh4, sizeof(struct in_addr)); in put_nla_nh4()
1421 static int parse_nla_nh6(struct nlattr **attrs, struct seg6_local_lwt *slwt, in parse_nla_nh6() argument
1424 memcpy(&slwt->nh6, nla_data(attrs[SEG6_LOCAL_NH6]), in parse_nla_nh6()
1430 static int put_nla_nh6(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_nh6() argument
1438 memcpy(nla_data(nla), &slwt->nh6, sizeof(struct in6_addr)); in put_nla_nh6()
1448 static int parse_nla_iif(struct nlattr **attrs, struct seg6_local_lwt *slwt, in parse_nla_iif() argument
1451 slwt->iif = nla_get_u32(attrs[SEG6_LOCAL_IIF]); in parse_nla_iif()
1456 static int put_nla_iif(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_iif() argument
1458 if (nla_put_u32(skb, SEG6_LOCAL_IIF, slwt->iif)) in put_nla_iif()
1472 static int parse_nla_oif(struct nlattr **attrs, struct seg6_local_lwt *slwt, in parse_nla_oif() argument
1475 slwt->oif = nla_get_u32(attrs[SEG6_LOCAL_OIF]); in parse_nla_oif()
1480 static int put_nla_oif(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_oif() argument
1482 if (nla_put_u32(skb, SEG6_LOCAL_OIF, slwt->oif)) in put_nla_oif()
1503 static int parse_nla_bpf(struct nlattr **attrs, struct seg6_local_lwt *slwt, in parse_nla_bpf() argument
1520 slwt->bpf.name = nla_memdup(tb[SEG6_LOCAL_BPF_PROG_NAME], GFP_KERNEL); in parse_nla_bpf()
1521 if (!slwt->bpf.name) in parse_nla_bpf()
1527 kfree(slwt->bpf.name); in parse_nla_bpf()
1531 slwt->bpf.prog = p; in parse_nla_bpf()
1535 static int put_nla_bpf(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_bpf() argument
1539 if (!slwt->bpf.prog) in put_nla_bpf()
1546 if (nla_put_u32(skb, SEG6_LOCAL_BPF_PROG, slwt->bpf.prog->aux->id)) in put_nla_bpf()
1549 if (slwt->bpf.name && in put_nla_bpf()
1550 nla_put_string(skb, SEG6_LOCAL_BPF_PROG_NAME, slwt->bpf.name)) in put_nla_bpf()
1567 static void destroy_attr_bpf(struct seg6_local_lwt *slwt) in destroy_attr_bpf() argument
1569 kfree(slwt->bpf.name); in destroy_attr_bpf()
1570 if (slwt->bpf.prog) in destroy_attr_bpf()
1571 bpf_prog_put(slwt->bpf.prog); in destroy_attr_bpf()
1582 struct seg6_local_lwt *slwt, in parse_nla_counters() argument
1607 slwt->pcpu_counters = pcounters; in parse_nla_counters()
1630 static int put_nla_counters(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_counters() argument
1645 pcounters = per_cpu_ptr(slwt->pcpu_counters, i); in put_nla_counters()
1676 static void destroy_attr_counters(struct seg6_local_lwt *slwt) in destroy_attr_counters() argument
1678 free_percpu(slwt->pcpu_counters); in destroy_attr_counters()
1741 static int parse_nla_flavors(struct nlattr **attrs, struct seg6_local_lwt *slwt, in parse_nla_flavors() argument
1744 struct seg6_flavors_info *finfo = &slwt->flv_info; in parse_nla_flavors()
1795 static int put_nla_flavors(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_flavors() argument
1797 struct seg6_flavors_info *finfo = &slwt->flv_info; in put_nla_flavors()
1852 static int encap_size_flavors(struct seg6_local_lwt *slwt) in encap_size_flavors() argument
1854 struct seg6_flavors_info *finfo = &slwt->flv_info; in encap_size_flavors()
1868 int (*parse)(struct nlattr **attrs, struct seg6_local_lwt *slwt,
1870 int (*put)(struct sk_buff *skb, struct seg6_local_lwt *slwt);
1877 void (*destroy)(struct seg6_local_lwt *slwt);
1930 struct seg6_local_lwt *slwt) in __destroy_attrs() argument
1951 param->destroy(slwt); in __destroy_attrs()
1958 static void destroy_attrs(struct seg6_local_lwt *slwt) in destroy_attrs() argument
1960 unsigned long attrs = slwt->desc->attrs | slwt->parsed_optattrs; in destroy_attrs()
1962 __destroy_attrs(attrs, SEG6_LOCAL_MAX + 1, slwt); in destroy_attrs()
1966 struct seg6_local_lwt *slwt, in parse_nla_optional_attrs() argument
1969 struct seg6_action_desc *desc = slwt->desc; in parse_nla_optional_attrs()
1983 err = param->parse(attrs, slwt, extack); in parse_nla_optional_attrs()
1994 slwt->parsed_optattrs = parsed_optattrs; in parse_nla_optional_attrs()
1999 __destroy_attrs(parsed_optattrs, i, slwt); in parse_nla_optional_attrs()
2008 seg6_local_lwtunnel_build_state(struct seg6_local_lwt *slwt, const void *cfg, in seg6_local_lwtunnel_build_state() argument
2011 struct seg6_action_desc *desc = slwt->desc; in seg6_local_lwtunnel_build_state()
2018 return ops->build_state(slwt, cfg, extack); in seg6_local_lwtunnel_build_state()
2024 static void seg6_local_lwtunnel_destroy_state(struct seg6_local_lwt *slwt) in seg6_local_lwtunnel_destroy_state() argument
2026 struct seg6_action_desc *desc = slwt->desc; in seg6_local_lwtunnel_destroy_state()
2033 ops->destroy_state(slwt); in seg6_local_lwtunnel_destroy_state()
2036 static int parse_nla_action(struct nlattr **attrs, struct seg6_local_lwt *slwt, in parse_nla_action() argument
2044 desc = __get_action_desc(slwt->action); in parse_nla_action()
2051 slwt->desc = desc; in parse_nla_action()
2052 slwt->headroom += desc->static_headroom; in parse_nla_action()
2081 err = param->parse(attrs, slwt, extack); in parse_nla_action()
2088 err = parse_nla_optional_attrs(attrs, slwt, extack); in parse_nla_action()
2098 __destroy_attrs(desc->attrs, i, slwt); in parse_nla_action()
2110 struct seg6_local_lwt *slwt; in seg6_local_build_state() local
2125 newts = lwtunnel_state_alloc(sizeof(*slwt)); in seg6_local_build_state()
2129 slwt = seg6_local_lwtunnel(newts); in seg6_local_build_state()
2130 slwt->action = nla_get_u32(tb[SEG6_LOCAL_ACTION]); in seg6_local_build_state()
2132 err = parse_nla_action(tb, slwt, extack); in seg6_local_build_state()
2136 err = seg6_local_lwtunnel_build_state(slwt, cfg, extack); in seg6_local_build_state()
2142 newts->headroom = slwt->headroom; in seg6_local_build_state()
2149 destroy_attrs(slwt); in seg6_local_build_state()
2157 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt); in seg6_local_destroy_state() local
2159 seg6_local_lwtunnel_destroy_state(slwt); in seg6_local_destroy_state()
2161 destroy_attrs(slwt); in seg6_local_destroy_state()
2169 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt); in seg6_local_fill_encap() local
2174 if (nla_put_u32(skb, SEG6_LOCAL_ACTION, slwt->action)) in seg6_local_fill_encap()
2177 attrs = slwt->desc->attrs | slwt->parsed_optattrs; in seg6_local_fill_encap()
2182 err = param->put(skb, slwt); in seg6_local_fill_encap()
2193 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt); in seg6_local_get_encap_size() local
2199 attrs = slwt->desc->attrs | slwt->parsed_optattrs; in seg6_local_get_encap_size()
2202 nlsize += nla_total_size((slwt->srh->hdrlen + 1) << 3); in seg6_local_get_encap_size()
2237 nlsize += encap_size_flavors(slwt); in seg6_local_get_encap_size()