Lines Matching defs:info

100 static int nh_notifier_single_info_init(struct nh_notifier_info *info,
105 info->type = NH_NOTIFIER_INFO_TYPE_SINGLE;
106 info->nh = kzalloc(sizeof(*info->nh), GFP_KERNEL);
107 if (!info->nh)
110 __nh_notifier_single_info_init(info->nh, nhi);
115 static void nh_notifier_single_info_fini(struct nh_notifier_info *info)
117 kfree(info->nh);
120 static int nh_notifier_mpath_info_init(struct nh_notifier_info *info,
126 info->type = NH_NOTIFIER_INFO_TYPE_GRP;
127 info->nh_grp = kzalloc(struct_size(info->nh_grp, nh_entries, num_nh),
129 if (!info->nh_grp)
132 info->nh_grp->num_nh = num_nh;
133 info->nh_grp->is_fdb = nhg->fdb_nh;
140 info->nh_grp->nh_entries[i].id = nhge->nh->id;
141 info->nh_grp->nh_entries[i].weight = nhge->weight;
142 __nh_notifier_single_info_init(&info->nh_grp->nh_entries[i].nh,
149 static int nh_notifier_res_table_info_init(struct nh_notifier_info *info,
157 info->type = NH_NOTIFIER_INFO_TYPE_RES_TABLE;
158 size = struct_size(info->nh_res_table, nhs, num_nh_buckets);
159 info->nh_res_table = __vmalloc(size, GFP_KERNEL | __GFP_ZERO |
161 if (!info->nh_res_table)
164 info->nh_res_table->num_nh_buckets = num_nh_buckets;
173 __nh_notifier_single_info_init(&info->nh_res_table->nhs[i],
180 static int nh_notifier_grp_info_init(struct nh_notifier_info *info,
186 return nh_notifier_mpath_info_init(info, nhg);
188 return nh_notifier_res_table_info_init(info, nhg);
192 static void nh_notifier_grp_info_fini(struct nh_notifier_info *info,
198 kfree(info->nh_grp);
200 vfree(info->nh_res_table);
203 static int nh_notifier_info_init(struct nh_notifier_info *info,
206 info->id = nh->id;
209 return nh_notifier_grp_info_init(info, nh);
211 return nh_notifier_single_info_init(info, nh);
214 static void nh_notifier_info_fini(struct nh_notifier_info *info,
218 nh_notifier_grp_info_fini(info, nh);
220 nh_notifier_single_info_fini(info);
228 struct nh_notifier_info info = {
239 err = nh_notifier_info_init(&info, nh);
241 NL_SET_ERR_MSG(extack, "Failed to initialize nexthop notifier info");
246 event_type, &info);
247 nh_notifier_info_fini(&info, nh);
253 nh_notifier_res_bucket_idle_timer_get(const struct nh_notifier_info *info,
277 nh = nexthop_find_by_id(info->net, info->id);
293 static int nh_notifier_res_bucket_info_init(struct nh_notifier_info *info,
301 err = nh_notifier_res_bucket_idle_timer_get(info, force,
306 info->type = NH_NOTIFIER_INFO_TYPE_RES_BUCKET;
307 info->nh_res_bucket = kzalloc(sizeof(*info->nh_res_bucket),
309 if (!info->nh_res_bucket)
312 info->nh_res_bucket->bucket_index = bucket_index;
313 info->nh_res_bucket->idle_timer_ms = idle_timer_ms;
314 info->nh_res_bucket->force = force;
315 __nh_notifier_single_info_init(&info->nh_res_bucket->old_nh, oldi);
316 __nh_notifier_single_info_init(&info->nh_res_bucket->new_nh, newi);
320 static void nh_notifier_res_bucket_info_fini(struct nh_notifier_info *info)
322 kfree(info->nh_res_bucket);
331 struct nh_notifier_info info = {
341 err = nh_notifier_res_bucket_info_init(&info, bucket_index, force,
347 NEXTHOP_EVENT_BUCKET_REPLACE, &info);
348 nh_notifier_res_bucket_info_fini(&info);
393 struct nh_notifier_info info = {
410 err = nh_notifier_mpath_info_init(&info, nhg);
412 NL_SET_ERR_MSG(extack, "Failed to initialize nexthop notifier info");
418 &info);
419 kfree(info.nh_grp);
429 struct nh_notifier_info info = {
435 err = nh_notifier_info_init(&info, nh);
439 err = nb->notifier_call(nb, event_type, &info);
440 nh_notifier_info_fini(&info, nh);
841 static void nexthop_notify(int event, struct nexthop *nh, struct nl_info *info)
843 unsigned int nlflags = info->nlh ? info->nlh->nlmsg_flags : 0;
844 u32 seq = info->nlh ? info->nlh->nlmsg_seq : 0;
852 err = nh_fill_node(skb, nh, event, info->portid, seq, nlflags);
860 rtnl_notify(skb, info->nl_net, info->portid, RTNLGRP_NEXTHOP,
861 info->nlh, gfp_any());
865 rtnl_set_sk_err(info->nl_net, RTNLGRP_NEXTHOP, err);
2204 struct nl_info *info)
2218 fib_info_notify_update(net, info);
2225 ipv6_stub->fib6_rt_update(net, f6i, info);
2233 struct nl_info *info)
2237 __nexthop_replace_notify(net, nh, info);
2240 __nexthop_replace_notify(net, nhge->nh_parent, info);