Lines Matching defs: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);
382 struct seg6_local_lwt *slwt)
390 struct seg6_local_lwt *slwt)
400 return input_action_end_finish(skb, slwt);
407 static int end_next_csid_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)
409 const struct seg6_flavors_info *finfo = &slwt->flv_info;
413 return input_action_end_core(skb, slwt);
418 return input_action_end_finish(skb, slwt);
422 struct seg6_local_lwt *slwt)
424 seg6_lookup_any_nexthop(skb, &slwt->nh6, 0, false, slwt->oif);
430 struct seg6_local_lwt *slwt)
440 return input_action_end_x_finish(skb, slwt);
448 struct seg6_local_lwt *slwt)
450 const struct seg6_flavors_info *finfo = &slwt->flv_info;
454 return input_action_end_x_core(skb, slwt);
459 return input_action_end_x_finish(skb, slwt);
742 static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)
744 const struct seg6_flavors_info *finfo = &slwt->flv_info;
788 return input_action_end_finish(skb, slwt);
796 static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
798 const struct seg6_flavors_info *finfo = &slwt->flv_info;
802 return input_action_end_core(skb, slwt);
806 return end_next_csid_core(skb, slwt);
813 return end_flv8986_core(skb, slwt);
817 static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)
819 const struct seg6_flavors_info *finfo = &slwt->flv_info;
824 return end_x_next_csid_core(skb, slwt);
826 return input_action_end_x_core(skb, slwt);
829 static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt)
839 seg6_lookup_nexthop(skb, NULL, slwt->table);
850 struct seg6_local_lwt *slwt)
872 odev = dev_get_by_index_rcu(net, slwt->oif);
910 struct seg6_local_lwt *slwt;
912 slwt = seg6_local_lwtunnel(orig_dst->lwtstate);
917 * If slwt->nh6 is set to ::, then lookup the nexthop for the
920 if (!ipv6_addr_any(&slwt->nh6))
921 nhaddr = &slwt->nh6;
930 struct seg6_local_lwt *slwt)
961 struct seg6_local_lwt *slwt;
965 slwt = seg6_local_lwtunnel(orig_dst->lwtstate);
969 nhaddr = slwt->nh4.s_addr ?: iph->daddr;
983 struct seg6_local_lwt *slwt)
1014 static int __seg6_end_dt_vrf_build(struct seg6_local_lwt *slwt, const void *cfg,
1017 struct seg6_end_dt_info *info = &slwt->dt_info;
1132 struct seg6_local_lwt *slwt, u16 family)
1134 struct seg6_end_dt_info *info = &slwt->dt_info;
1178 struct seg6_local_lwt *slwt)
1189 skb = end_dt_vrf_core(skb, slwt, AF_INET);
1210 static int seg6_end_dt4_build(struct seg6_local_lwt *slwt, const void *cfg,
1213 return __seg6_end_dt_vrf_build(slwt, cfg, AF_INET, extack);
1217 seg6_end_dt_mode seg6_end_dt6_parse_mode(struct seg6_local_lwt *slwt)
1219 unsigned long parsed_optattrs = slwt->parsed_optattrs;
1232 static enum seg6_end_dt_mode seg6_end_dt6_get_mode(struct seg6_local_lwt *slwt)
1234 struct seg6_end_dt_info *info = &slwt->dt_info;
1239 static int seg6_end_dt6_build(struct seg6_local_lwt *slwt, const void *cfg,
1242 enum seg6_end_dt_mode mode = seg6_end_dt6_parse_mode(slwt);
1243 struct seg6_end_dt_info *info = &slwt->dt_info;
1250 return __seg6_end_dt_vrf_build(slwt, cfg, AF_INET6, extack);
1259 struct seg6_local_lwt *slwt)
1268 if (seg6_end_dt6_get_mode(slwt) == DT_LEGACY_MODE)
1272 skb = end_dt_vrf_core(skb, slwt, AF_INET6);
1291 seg6_lookup_any_nexthop(skb, NULL, slwt->table, true, 0);
1301 static int seg6_end_dt46_build(struct seg6_local_lwt *slwt, const void *cfg,
1304 return __seg6_end_dt_vrf_build(slwt, cfg, AF_UNSPEC, extack);
1308 struct seg6_local_lwt *slwt)
1319 return input_action_end_dt4(skb, slwt);
1321 return input_action_end_dt6(skb, slwt);
1331 static int input_action_end_b6(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1340 err = seg6_do_srh_inline(skb, slwt->srh);
1357 struct seg6_local_lwt *slwt)
1371 err = seg6_do_srh_encap(skb, slwt->srh, IPPROTO_IPV6);
1415 struct seg6_local_lwt *slwt)
1442 ret = bpf_prog_run_save_cb(slwt->bpf.prog, skb);
1586 static bool seg6_lwtunnel_counters_enabled(struct seg6_local_lwt *slwt)
1588 return slwt->parsed_optattrs & SEG6_F_LOCAL_COUNTERS;
1591 static void seg6_local_update_counters(struct seg6_local_lwt *slwt,
1596 pcounters = this_cpu_ptr(slwt->pcpu_counters);
1614 struct seg6_local_lwt *slwt;
1618 slwt = seg6_local_lwtunnel(orig_dst->lwtstate);
1619 desc = slwt->desc;
1621 rc = desc->input(skb, slwt);
1623 if (!seg6_lwtunnel_counters_enabled(slwt))
1626 seg6_local_update_counters(slwt, len, rc);
1660 static int parse_nla_srh(struct nlattr **attrs, struct seg6_local_lwt *slwt,
1676 slwt->srh = kmemdup(srh, len, GFP_KERNEL);
1677 if (!slwt->srh)
1680 slwt->headroom += len;
1685 static int put_nla_srh(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1691 srh = slwt->srh;
1713 static void destroy_attr_srh(struct seg6_local_lwt *slwt)
1715 kfree(slwt->srh);
1718 static int parse_nla_table(struct nlattr **attrs, struct seg6_local_lwt *slwt,
1721 slwt->table = nla_get_u32(attrs[SEG6_LOCAL_TABLE]);
1726 static int put_nla_table(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1728 if (nla_put_u32(skb, SEG6_LOCAL_TABLE, slwt->table))
1743 seg6_end_dt_info *seg6_possible_end_dt_info(struct seg6_local_lwt *slwt)
1746 return &slwt->dt_info;
1753 struct seg6_local_lwt *slwt,
1756 struct seg6_end_dt_info *info = seg6_possible_end_dt_info(slwt);
1766 static int put_nla_vrftable(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1768 struct seg6_end_dt_info *info = seg6_possible_end_dt_info(slwt);
1790 static int parse_nla_nh4(struct nlattr **attrs, struct seg6_local_lwt *slwt,
1793 memcpy(&slwt->nh4, nla_data(attrs[SEG6_LOCAL_NH4]),
1799 static int put_nla_nh4(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1807 memcpy(nla_data(nla), &slwt->nh4, sizeof(struct in_addr));
1817 static int parse_nla_nh6(struct nlattr **attrs, struct seg6_local_lwt *slwt,
1820 memcpy(&slwt->nh6, nla_data(attrs[SEG6_LOCAL_NH6]),
1826 static int put_nla_nh6(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1834 memcpy(nla_data(nla), &slwt->nh6, sizeof(struct in6_addr));
1844 static int parse_nla_iif(struct nlattr **attrs, struct seg6_local_lwt *slwt,
1847 slwt->iif = nla_get_u32(attrs[SEG6_LOCAL_IIF]);
1852 static int put_nla_iif(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1854 if (nla_put_u32(skb, SEG6_LOCAL_IIF, slwt->iif))
1868 static int parse_nla_oif(struct nlattr **attrs, struct seg6_local_lwt *slwt,
1871 slwt->oif = nla_get_u32(attrs[SEG6_LOCAL_OIF]);
1876 static int put_nla_oif(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1878 if (nla_put_u32(skb, SEG6_LOCAL_OIF, slwt->oif))
1899 static int parse_nla_bpf(struct nlattr **attrs, struct seg6_local_lwt *slwt,
1916 slwt->bpf.name = nla_memdup(tb[SEG6_LOCAL_BPF_PROG_NAME], GFP_KERNEL);
1917 if (!slwt->bpf.name)
1923 kfree(slwt->bpf.name);
1927 slwt->bpf.prog = p;
1931 static int put_nla_bpf(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1935 if (!slwt->bpf.prog)
1942 if (nla_put_u32(skb, SEG6_LOCAL_BPF_PROG, slwt->bpf.prog->aux->id))
1945 if (slwt->bpf.name &&
1946 nla_put_string(skb, SEG6_LOCAL_BPF_PROG_NAME, slwt->bpf.name))
1963 static void destroy_attr_bpf(struct seg6_local_lwt *slwt)
1965 kfree(slwt->bpf.name);
1966 if (slwt->bpf.prog)
1967 bpf_prog_put(slwt->bpf.prog);
1978 struct seg6_local_lwt *slwt,
2003 slwt->pcpu_counters = pcounters;
2026 static int put_nla_counters(struct sk_buff *skb, struct seg6_local_lwt *slwt)
2041 pcounters = per_cpu_ptr(slwt->pcpu_counters, i);
2072 static void destroy_attr_counters(struct seg6_local_lwt *slwt)
2074 free_percpu(slwt->pcpu_counters);
2137 static int parse_nla_flavors(struct nlattr **attrs, struct seg6_local_lwt *slwt,
2140 struct seg6_flavors_info *finfo = &slwt->flv_info;
2142 int action = slwt->action;
2193 static int put_nla_flavors(struct sk_buff *skb, struct seg6_local_lwt *slwt)
2195 struct seg6_flavors_info *finfo = &slwt->flv_info;
2250 static int encap_size_flavors(struct seg6_local_lwt *slwt)
2252 struct seg6_flavors_info *finfo = &slwt->flv_info;
2266 int (*parse)(struct nlattr **attrs, struct seg6_local_lwt *slwt,
2268 int (*put)(struct sk_buff *skb, struct seg6_local_lwt *slwt);
2275 void (*destroy)(struct seg6_local_lwt *slwt);
2328 struct seg6_local_lwt *slwt)
2349 param->destroy(slwt);
2356 static void destroy_attrs(struct seg6_local_lwt *slwt)
2358 unsigned long attrs = slwt->desc->attrs | slwt->parsed_optattrs;
2360 __destroy_attrs(attrs, SEG6_LOCAL_MAX + 1, slwt);
2364 struct seg6_local_lwt *slwt,
2367 struct seg6_action_desc *desc = slwt->desc;
2381 err = param->parse(attrs, slwt, extack);
2392 slwt->parsed_optattrs = parsed_optattrs;
2397 __destroy_attrs(parsed_optattrs, i, slwt);
2406 seg6_local_lwtunnel_build_state(struct seg6_local_lwt *slwt, const void *cfg,
2409 struct seg6_action_desc *desc = slwt->desc;
2416 return ops->build_state(slwt, cfg, extack);
2422 static void seg6_local_lwtunnel_destroy_state(struct seg6_local_lwt *slwt)
2424 struct seg6_action_desc *desc = slwt->desc;
2431 ops->destroy_state(slwt);
2434 static int parse_nla_action(struct nlattr **attrs, struct seg6_local_lwt *slwt,
2442 desc = __get_action_desc(slwt->action);
2449 slwt->desc = desc;
2450 slwt->headroom += desc->static_headroom;
2479 err = param->parse(attrs, slwt, extack);
2486 err = parse_nla_optional_attrs(attrs, slwt, extack);
2496 __destroy_attrs(desc->attrs, i, slwt);
2508 struct seg6_local_lwt *slwt;
2523 newts = lwtunnel_state_alloc(sizeof(*slwt));
2527 slwt = seg6_local_lwtunnel(newts);
2528 slwt->action = nla_get_u32(tb[SEG6_LOCAL_ACTION]);
2530 err = parse_nla_action(tb, slwt, extack);
2534 err = seg6_local_lwtunnel_build_state(slwt, cfg, extack);
2540 newts->headroom = slwt->headroom;
2547 destroy_attrs(slwt);
2555 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt);
2557 seg6_local_lwtunnel_destroy_state(slwt);
2559 destroy_attrs(slwt);
2567 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt);
2572 if (nla_put_u32(skb, SEG6_LOCAL_ACTION, slwt->action))
2575 attrs = slwt->desc->attrs | slwt->parsed_optattrs;
2580 err = param->put(skb, slwt);
2591 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt);
2597 attrs = slwt->desc->attrs | slwt->parsed_optattrs;
2600 nlsize += nla_total_size((slwt->srh->hdrlen + 1) << 3);
2635 nlsize += encap_size_flavors(slwt);