Lines Matching refs:slwt

41 	int (*build_state)(struct seg6_local_lwt *slwt, const void *cfg,
43 void (*destroy_state)(struct seg6_local_lwt *slwt);
64 int (*input)(struct sk_buff *skb, struct seg6_local_lwt *slwt);
273 static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end() argument
293 static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end_x() argument
303 seg6_lookup_nexthop(skb, &slwt->nh6, 0); in input_action_end_x()
312 static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end_t() argument
322 seg6_lookup_nexthop(skb, NULL, slwt->table); in input_action_end_t()
333 struct seg6_local_lwt *slwt) in input_action_end_dx2() argument
355 odev = dev_get_by_index_rcu(net, slwt->oif); in input_action_end_dx2()
393 struct seg6_local_lwt *slwt; in input_action_end_dx6_finish() local
395 slwt = seg6_local_lwtunnel(orig_dst->lwtstate); in input_action_end_dx6_finish()
403 if (!ipv6_addr_any(&slwt->nh6)) in input_action_end_dx6_finish()
404 nhaddr = &slwt->nh6; in input_action_end_dx6_finish()
413 struct seg6_local_lwt *slwt) in input_action_end_dx6() argument
443 struct seg6_local_lwt *slwt; in input_action_end_dx4_finish() local
448 slwt = seg6_local_lwtunnel(orig_dst->lwtstate); in input_action_end_dx4_finish()
452 nhaddr = slwt->nh4.s_addr ?: iph->daddr; in input_action_end_dx4_finish()
466 struct seg6_local_lwt *slwt) in input_action_end_dx4() argument
497 static int __seg6_end_dt_vrf_build(struct seg6_local_lwt *slwt, const void *cfg, in __seg6_end_dt_vrf_build() argument
500 struct seg6_end_dt_info *info = &slwt->dt_info; in __seg6_end_dt_vrf_build()
615 struct seg6_local_lwt *slwt, u16 family) in end_dt_vrf_core() argument
617 struct seg6_end_dt_info *info = &slwt->dt_info; in end_dt_vrf_core()
661 struct seg6_local_lwt *slwt) in input_action_end_dt4() argument
672 skb = end_dt_vrf_core(skb, slwt, AF_INET); in input_action_end_dt4()
693 static int seg6_end_dt4_build(struct seg6_local_lwt *slwt, const void *cfg, in seg6_end_dt4_build() argument
696 return __seg6_end_dt_vrf_build(slwt, cfg, AF_INET, extack); in seg6_end_dt4_build()
700 seg6_end_dt_mode seg6_end_dt6_parse_mode(struct seg6_local_lwt *slwt) in seg6_end_dt6_parse_mode() argument
702 unsigned long parsed_optattrs = slwt->parsed_optattrs; in seg6_end_dt6_parse_mode()
715 static enum seg6_end_dt_mode seg6_end_dt6_get_mode(struct seg6_local_lwt *slwt) in seg6_end_dt6_get_mode() argument
717 struct seg6_end_dt_info *info = &slwt->dt_info; in seg6_end_dt6_get_mode()
722 static int seg6_end_dt6_build(struct seg6_local_lwt *slwt, const void *cfg, in seg6_end_dt6_build() argument
725 enum seg6_end_dt_mode mode = seg6_end_dt6_parse_mode(slwt); in seg6_end_dt6_build()
726 struct seg6_end_dt_info *info = &slwt->dt_info; in seg6_end_dt6_build()
733 return __seg6_end_dt_vrf_build(slwt, cfg, AF_INET6, extack); in seg6_end_dt6_build()
742 struct seg6_local_lwt *slwt) in input_action_end_dt6() argument
751 if (seg6_end_dt6_get_mode(slwt) == DT_LEGACY_MODE) in input_action_end_dt6()
755 skb = end_dt_vrf_core(skb, slwt, AF_INET6); in input_action_end_dt6()
774 seg6_lookup_any_nexthop(skb, NULL, slwt->table, true); in input_action_end_dt6()
784 static int seg6_end_dt46_build(struct seg6_local_lwt *slwt, const void *cfg, in seg6_end_dt46_build() argument
787 return __seg6_end_dt_vrf_build(slwt, cfg, AF_UNSPEC, extack); in seg6_end_dt46_build()
791 struct seg6_local_lwt *slwt) in input_action_end_dt46() argument
802 return input_action_end_dt4(skb, slwt); in input_action_end_dt46()
804 return input_action_end_dt6(skb, slwt); in input_action_end_dt46()
814 static int input_action_end_b6(struct sk_buff *skb, struct seg6_local_lwt *slwt) in input_action_end_b6() argument
823 err = seg6_do_srh_inline(skb, slwt->srh); in input_action_end_b6()
841 struct seg6_local_lwt *slwt) in input_action_end_b6_encap() argument
855 err = seg6_do_srh_encap(skb, slwt->srh, IPPROTO_IPV6); in input_action_end_b6_encap()
897 struct seg6_local_lwt *slwt) in input_action_end_bpf() argument
921 ret = bpf_prog_run_save_cb(slwt->bpf.prog, skb); in input_action_end_bpf()
1062 static bool seg6_lwtunnel_counters_enabled(struct seg6_local_lwt *slwt) in seg6_lwtunnel_counters_enabled() argument
1064 return slwt->parsed_optattrs & SEG6_F_LOCAL_COUNTERS; in seg6_lwtunnel_counters_enabled()
1067 static void seg6_local_update_counters(struct seg6_local_lwt *slwt, in seg6_local_update_counters() argument
1072 pcounters = this_cpu_ptr(slwt->pcpu_counters); in seg6_local_update_counters()
1090 struct seg6_local_lwt *slwt; in seg6_local_input_core() local
1094 slwt = seg6_local_lwtunnel(orig_dst->lwtstate); in seg6_local_input_core()
1095 desc = slwt->desc; in seg6_local_input_core()
1097 rc = desc->input(skb, slwt); in seg6_local_input_core()
1099 if (!seg6_lwtunnel_counters_enabled(slwt)) in seg6_local_input_core()
1102 seg6_local_update_counters(slwt, len, rc); in seg6_local_input_core()
1137 static int parse_nla_srh(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_srh() argument
1152 slwt->srh = kmemdup(srh, len, GFP_KERNEL); in parse_nla_srh()
1153 if (!slwt->srh) in parse_nla_srh()
1156 slwt->headroom += len; in parse_nla_srh()
1161 static int put_nla_srh(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_srh() argument
1167 srh = slwt->srh; in put_nla_srh()
1189 static void destroy_attr_srh(struct seg6_local_lwt *slwt) in destroy_attr_srh() argument
1191 kfree(slwt->srh); in destroy_attr_srh()
1194 static int parse_nla_table(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_table() argument
1196 slwt->table = nla_get_u32(attrs[SEG6_LOCAL_TABLE]); in parse_nla_table()
1201 static int put_nla_table(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_table() argument
1203 if (nla_put_u32(skb, SEG6_LOCAL_TABLE, slwt->table)) in put_nla_table()
1218 seg6_end_dt_info *seg6_possible_end_dt_info(struct seg6_local_lwt *slwt) in seg6_possible_end_dt_info() argument
1221 return &slwt->dt_info; in seg6_possible_end_dt_info()
1228 struct seg6_local_lwt *slwt) in parse_nla_vrftable() argument
1230 struct seg6_end_dt_info *info = seg6_possible_end_dt_info(slwt); in parse_nla_vrftable()
1240 static int put_nla_vrftable(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_vrftable() argument
1242 struct seg6_end_dt_info *info = seg6_possible_end_dt_info(slwt); in put_nla_vrftable()
1264 static int parse_nla_nh4(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_nh4() argument
1266 memcpy(&slwt->nh4, nla_data(attrs[SEG6_LOCAL_NH4]), in parse_nla_nh4()
1272 static int put_nla_nh4(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_nh4() argument
1280 memcpy(nla_data(nla), &slwt->nh4, sizeof(struct in_addr)); in put_nla_nh4()
1290 static int parse_nla_nh6(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_nh6() argument
1292 memcpy(&slwt->nh6, nla_data(attrs[SEG6_LOCAL_NH6]), in parse_nla_nh6()
1298 static int put_nla_nh6(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_nh6() argument
1306 memcpy(nla_data(nla), &slwt->nh6, sizeof(struct in6_addr)); in put_nla_nh6()
1316 static int parse_nla_iif(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_iif() argument
1318 slwt->iif = nla_get_u32(attrs[SEG6_LOCAL_IIF]); in parse_nla_iif()
1323 static int put_nla_iif(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_iif() argument
1325 if (nla_put_u32(skb, SEG6_LOCAL_IIF, slwt->iif)) in put_nla_iif()
1339 static int parse_nla_oif(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_oif() argument
1341 slwt->oif = nla_get_u32(attrs[SEG6_LOCAL_OIF]); in parse_nla_oif()
1346 static int put_nla_oif(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_oif() argument
1348 if (nla_put_u32(skb, SEG6_LOCAL_OIF, slwt->oif)) in put_nla_oif()
1369 static int parse_nla_bpf(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_bpf() argument
1385 slwt->bpf.name = nla_memdup(tb[SEG6_LOCAL_BPF_PROG_NAME], GFP_KERNEL); in parse_nla_bpf()
1386 if (!slwt->bpf.name) in parse_nla_bpf()
1392 kfree(slwt->bpf.name); in parse_nla_bpf()
1396 slwt->bpf.prog = p; in parse_nla_bpf()
1400 static int put_nla_bpf(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_bpf() argument
1404 if (!slwt->bpf.prog) in put_nla_bpf()
1411 if (nla_put_u32(skb, SEG6_LOCAL_BPF_PROG, slwt->bpf.prog->aux->id)) in put_nla_bpf()
1414 if (slwt->bpf.name && in put_nla_bpf()
1415 nla_put_string(skb, SEG6_LOCAL_BPF_PROG_NAME, slwt->bpf.name)) in put_nla_bpf()
1432 static void destroy_attr_bpf(struct seg6_local_lwt *slwt) in destroy_attr_bpf() argument
1434 kfree(slwt->bpf.name); in destroy_attr_bpf()
1435 if (slwt->bpf.prog) in destroy_attr_bpf()
1436 bpf_prog_put(slwt->bpf.prog); in destroy_attr_bpf()
1447 struct seg6_local_lwt *slwt) in parse_nla_counters() argument
1471 slwt->pcpu_counters = pcounters; in parse_nla_counters()
1494 static int put_nla_counters(struct sk_buff *skb, struct seg6_local_lwt *slwt) in put_nla_counters() argument
1509 pcounters = per_cpu_ptr(slwt->pcpu_counters, i); in put_nla_counters()
1540 static void destroy_attr_counters(struct seg6_local_lwt *slwt) in destroy_attr_counters() argument
1542 free_percpu(slwt->pcpu_counters); in destroy_attr_counters()
1546 int (*parse)(struct nlattr **attrs, struct seg6_local_lwt *slwt);
1547 int (*put)(struct sk_buff *skb, struct seg6_local_lwt *slwt);
1554 void (*destroy)(struct seg6_local_lwt *slwt);
1603 struct seg6_local_lwt *slwt) in __destroy_attrs() argument
1624 param->destroy(slwt); in __destroy_attrs()
1631 static void destroy_attrs(struct seg6_local_lwt *slwt) in destroy_attrs() argument
1633 unsigned long attrs = slwt->desc->attrs | slwt->parsed_optattrs; in destroy_attrs()
1635 __destroy_attrs(attrs, SEG6_LOCAL_MAX + 1, slwt); in destroy_attrs()
1639 struct seg6_local_lwt *slwt) in parse_nla_optional_attrs() argument
1641 struct seg6_action_desc *desc = slwt->desc; in parse_nla_optional_attrs()
1655 err = param->parse(attrs, slwt); in parse_nla_optional_attrs()
1666 slwt->parsed_optattrs = parsed_optattrs; in parse_nla_optional_attrs()
1671 __destroy_attrs(parsed_optattrs, i, slwt); in parse_nla_optional_attrs()
1680 seg6_local_lwtunnel_build_state(struct seg6_local_lwt *slwt, const void *cfg, in seg6_local_lwtunnel_build_state() argument
1683 struct seg6_action_desc *desc = slwt->desc; in seg6_local_lwtunnel_build_state()
1690 return ops->build_state(slwt, cfg, extack); in seg6_local_lwtunnel_build_state()
1696 static void seg6_local_lwtunnel_destroy_state(struct seg6_local_lwt *slwt) in seg6_local_lwtunnel_destroy_state() argument
1698 struct seg6_action_desc *desc = slwt->desc; in seg6_local_lwtunnel_destroy_state()
1705 ops->destroy_state(slwt); in seg6_local_lwtunnel_destroy_state()
1708 static int parse_nla_action(struct nlattr **attrs, struct seg6_local_lwt *slwt) in parse_nla_action() argument
1715 desc = __get_action_desc(slwt->action); in parse_nla_action()
1722 slwt->desc = desc; in parse_nla_action()
1723 slwt->headroom += desc->static_headroom; in parse_nla_action()
1752 err = param->parse(attrs, slwt); in parse_nla_action()
1759 err = parse_nla_optional_attrs(attrs, slwt); in parse_nla_action()
1769 __destroy_attrs(desc->attrs, i, slwt); in parse_nla_action()
1781 struct seg6_local_lwt *slwt; in seg6_local_build_state() local
1796 newts = lwtunnel_state_alloc(sizeof(*slwt)); in seg6_local_build_state()
1800 slwt = seg6_local_lwtunnel(newts); in seg6_local_build_state()
1801 slwt->action = nla_get_u32(tb[SEG6_LOCAL_ACTION]); in seg6_local_build_state()
1803 err = parse_nla_action(tb, slwt); in seg6_local_build_state()
1807 err = seg6_local_lwtunnel_build_state(slwt, cfg, extack); in seg6_local_build_state()
1813 newts->headroom = slwt->headroom; in seg6_local_build_state()
1820 destroy_attrs(slwt); in seg6_local_build_state()
1828 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt); in seg6_local_destroy_state() local
1830 seg6_local_lwtunnel_destroy_state(slwt); in seg6_local_destroy_state()
1832 destroy_attrs(slwt); in seg6_local_destroy_state()
1840 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt); in seg6_local_fill_encap() local
1845 if (nla_put_u32(skb, SEG6_LOCAL_ACTION, slwt->action)) in seg6_local_fill_encap()
1848 attrs = slwt->desc->attrs | slwt->parsed_optattrs; in seg6_local_fill_encap()
1853 err = param->put(skb, slwt); in seg6_local_fill_encap()
1864 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt); in seg6_local_get_encap_size() local
1870 attrs = slwt->desc->attrs | slwt->parsed_optattrs; in seg6_local_get_encap_size()
1873 nlsize += nla_total_size((slwt->srh->hdrlen + 1) << 3); in seg6_local_get_encap_size()