Lines Matching refs:c
366 struct mfc_cache *c = (struct mfc_cache *)ptr; in ipmr_hash_cmp() local
368 return cmparg->mfc_mcastgrp != c->mfc_mcastgrp || in ipmr_hash_cmp()
369 cmparg->mfc_origin != c->mfc_origin; in ipmr_hash_cmp()
707 struct mr_mfc *c = container_of(head, struct mr_mfc, rcu); in ipmr_cache_free_rcu() local
709 kmem_cache_free(mrt_cachep, (struct mfc_cache *)c); in ipmr_cache_free_rcu()
712 static void ipmr_cache_free(struct mfc_cache *c) in ipmr_cache_free() argument
714 call_rcu(&c->_c.rcu, ipmr_cache_free_rcu); in ipmr_cache_free()
720 static void ipmr_destroy_unres(struct mr_table *mrt, struct mfc_cache *c) in ipmr_destroy_unres() argument
728 while ((skb = skb_dequeue(&c->_c.mfc_un.unres.unresolved))) { in ipmr_destroy_unres()
745 ipmr_cache_free(c); in ipmr_destroy_unres()
752 struct mr_mfc *c, *next; in ipmr_expire_process() local
767 list_for_each_entry_safe(c, next, &mrt->mfc_unres_queue, list) { in ipmr_expire_process()
768 if (time_after(c->mfc_un.unres.expires, now)) { in ipmr_expire_process()
769 unsigned long interval = c->mfc_un.unres.expires - now; in ipmr_expire_process()
775 list_del(&c->list); in ipmr_expire_process()
776 mroute_netlink_event(mrt, (struct mfc_cache *)c, RTM_DELROUTE); in ipmr_expire_process()
777 ipmr_destroy_unres(mrt, (struct mfc_cache *)c); in ipmr_expire_process()
953 struct mfc_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL); in ipmr_cache_alloc() local
955 if (c) { in ipmr_cache_alloc()
956 c->_c.mfc_un.res.last_assert = jiffies - MFC_ASSERT_THRESH - 1; in ipmr_cache_alloc()
957 c->_c.mfc_un.res.minvif = MAXVIFS; in ipmr_cache_alloc()
958 c->_c.free = ipmr_cache_free_rcu; in ipmr_cache_alloc()
959 refcount_set(&c->_c.mfc_un.res.refcount, 1); in ipmr_cache_alloc()
961 return c; in ipmr_cache_alloc()
966 struct mfc_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC); in ipmr_cache_alloc_unres() local
968 if (c) { in ipmr_cache_alloc_unres()
969 skb_queue_head_init(&c->_c.mfc_un.unres.unresolved); in ipmr_cache_alloc_unres()
970 c->_c.mfc_un.unres.expires = jiffies + 10 * HZ; in ipmr_cache_alloc_unres()
972 return c; in ipmr_cache_alloc_unres()
977 struct mfc_cache *uc, struct mfc_cache *c) in ipmr_cache_resolve() argument
988 if (mr_fill_mroute(mrt, skb, &c->_c, in ipmr_cache_resolve()
1003 ip_mr_forward(net, mrt, skb->dev, skb, c, 0); in ipmr_cache_resolve()
1099 struct mfc_cache *c; in ipmr_cache_unresolved() local
1104 list_for_each_entry(c, &mrt->mfc_unres_queue, _c.list) { in ipmr_cache_unresolved()
1105 if (c->mfc_mcastgrp == iph->daddr && in ipmr_cache_unresolved()
1106 c->mfc_origin == iph->saddr) { in ipmr_cache_unresolved()
1114 c = ipmr_cache_alloc_unres(); in ipmr_cache_unresolved()
1115 if (!c) { in ipmr_cache_unresolved()
1123 c->_c.mfc_parent = -1; in ipmr_cache_unresolved()
1124 c->mfc_origin = iph->saddr; in ipmr_cache_unresolved()
1125 c->mfc_mcastgrp = iph->daddr; in ipmr_cache_unresolved()
1136 ipmr_cache_free(c); in ipmr_cache_unresolved()
1142 list_add(&c->_c.list, &mrt->mfc_unres_queue); in ipmr_cache_unresolved()
1143 mroute_netlink_event(mrt, c, RTM_NEWROUTE); in ipmr_cache_unresolved()
1147 c->_c.mfc_un.unres.expires); in ipmr_cache_unresolved()
1151 if (c->_c.mfc_un.unres.unresolved.qlen > 3) { in ipmr_cache_unresolved()
1159 skb_queue_tail(&c->_c.mfc_un.unres.unresolved, skb); in ipmr_cache_unresolved()
1172 struct mfc_cache *c; in ipmr_mfc_delete() local
1176 c = ipmr_cache_find_parent(mrt, mfc->mfcc_origin.s_addr, in ipmr_mfc_delete()
1179 if (!c) in ipmr_mfc_delete()
1181 rhltable_remove(&mrt->mfc_hash, &c->_c.mnode, ipmr_rht_params); in ipmr_mfc_delete()
1182 list_del_rcu(&c->_c.list); in ipmr_mfc_delete()
1183 call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, c, mrt->id); in ipmr_mfc_delete()
1184 mroute_netlink_event(mrt, c, RTM_DELROUTE); in ipmr_mfc_delete()
1185 mr_cache_put(&c->_c); in ipmr_mfc_delete()
1193 struct mfc_cache *uc, *c; in ipmr_mfc_add() local
1203 c = ipmr_cache_find_parent(mrt, mfc->mfcc_origin.s_addr, in ipmr_mfc_add()
1206 if (c) { in ipmr_mfc_add()
1208 c->_c.mfc_parent = mfc->mfcc_parent; in ipmr_mfc_add()
1209 ipmr_update_thresholds(mrt, &c->_c, mfc->mfcc_ttls); in ipmr_mfc_add()
1211 c->_c.mfc_flags |= MFC_STATIC; in ipmr_mfc_add()
1213 call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE, c, in ipmr_mfc_add()
1215 mroute_netlink_event(mrt, c, RTM_NEWROUTE); in ipmr_mfc_add()
1223 c = ipmr_cache_alloc(); in ipmr_mfc_add()
1224 if (!c) in ipmr_mfc_add()
1227 c->mfc_origin = mfc->mfcc_origin.s_addr; in ipmr_mfc_add()
1228 c->mfc_mcastgrp = mfc->mfcc_mcastgrp.s_addr; in ipmr_mfc_add()
1229 c->_c.mfc_parent = mfc->mfcc_parent; in ipmr_mfc_add()
1230 ipmr_update_thresholds(mrt, &c->_c, mfc->mfcc_ttls); in ipmr_mfc_add()
1232 c->_c.mfc_flags |= MFC_STATIC; in ipmr_mfc_add()
1234 ret = rhltable_insert_key(&mrt->mfc_hash, &c->cmparg, &c->_c.mnode, in ipmr_mfc_add()
1238 ipmr_cache_free(c); in ipmr_mfc_add()
1241 list_add_tail_rcu(&c->_c.list, &mrt->mfc_cache_list); in ipmr_mfc_add()
1249 if (uc->mfc_origin == c->mfc_origin && in ipmr_mfc_add()
1250 uc->mfc_mcastgrp == c->mfc_mcastgrp) { in ipmr_mfc_add()
1262 ipmr_cache_resolve(net, mrt, uc, c); in ipmr_mfc_add()
1265 call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_ADD, c, mrt->id); in ipmr_mfc_add()
1266 mroute_netlink_event(mrt, c, RTM_NEWROUTE); in ipmr_mfc_add()
1274 struct mr_mfc *c, *tmp; in mroute_clean_tables() local
1293 list_for_each_entry_safe(c, tmp, &mrt->mfc_cache_list, list) { in mroute_clean_tables()
1294 if (((c->mfc_flags & MFC_STATIC) && !(flags & MRT_FLUSH_MFC_STATIC)) || in mroute_clean_tables()
1295 (!(c->mfc_flags & MFC_STATIC) && !(flags & MRT_FLUSH_MFC))) in mroute_clean_tables()
1297 rhltable_remove(&mrt->mfc_hash, &c->mnode, ipmr_rht_params); in mroute_clean_tables()
1298 list_del_rcu(&c->list); in mroute_clean_tables()
1299 cache = (struct mfc_cache *)c; in mroute_clean_tables()
1303 mr_cache_put(c); in mroute_clean_tables()
1310 list_for_each_entry_safe(c, tmp, &mrt->mfc_unres_queue, list) { in mroute_clean_tables()
1311 list_del(&c->list); in mroute_clean_tables()
1312 cache = (struct mfc_cache *)c; in mroute_clean_tables()
1592 struct mfc_cache *c; in ipmr_ioctl() local
1627 c = ipmr_cache_find(mrt, sr.src.s_addr, sr.grp.s_addr); in ipmr_ioctl()
1628 if (c) { in ipmr_ioctl()
1629 sr.pktcnt = c->_c.mfc_un.res.pkt; in ipmr_ioctl()
1630 sr.bytecnt = c->_c.mfc_un.res.bytes; in ipmr_ioctl()
1631 sr.wrong_if = c->_c.mfc_un.res.wrong_if; in ipmr_ioctl()
1667 struct mfc_cache *c; in ipmr_compat_ioctl() local
1702 c = ipmr_cache_find(mrt, sr.src.s_addr, sr.grp.s_addr); in ipmr_compat_ioctl()
1703 if (c) { in ipmr_compat_ioctl()
1704 sr.pktcnt = c->_c.mfc_un.res.pkt; in ipmr_compat_ioctl()
1705 sr.bytecnt = c->_c.mfc_un.res.bytes; in ipmr_compat_ioctl()
1706 sr.wrong_if = c->_c.mfc_un.res.wrong_if; in ipmr_compat_ioctl()
1929 struct mfc_cache *c, int local) in ip_mr_forward() argument
1935 vif = c->_c.mfc_parent; in ip_mr_forward()
1936 c->_c.mfc_un.res.pkt++; in ip_mr_forward()
1937 c->_c.mfc_un.res.bytes += skb->len; in ip_mr_forward()
1938 c->_c.mfc_un.res.lastuse = jiffies; in ip_mr_forward()
1940 if (c->mfc_origin == htonl(INADDR_ANY) && true_vifi >= 0) { in ip_mr_forward()
1969 c->_c.mfc_un.res.wrong_if++; in ip_mr_forward()
1978 c->_c.mfc_un.res.ttls[true_vifi] < 255) && in ip_mr_forward()
1980 c->_c.mfc_un.res.last_assert + in ip_mr_forward()
1982 c->_c.mfc_un.res.last_assert = jiffies; in ip_mr_forward()
1996 if (c->mfc_origin == htonl(INADDR_ANY) && in ip_mr_forward()
1997 c->mfc_mcastgrp == htonl(INADDR_ANY)) { in ip_mr_forward()
1999 true_vifi != c->_c.mfc_parent && in ip_mr_forward()
2001 c->_c.mfc_un.res.ttls[c->_c.mfc_parent]) { in ip_mr_forward()
2006 psend = c->_c.mfc_parent; in ip_mr_forward()
2011 for (ct = c->_c.mfc_un.res.maxvif - 1; in ip_mr_forward()
2012 ct >= c->_c.mfc_un.res.minvif; ct--) { in ip_mr_forward()
2014 if ((c->mfc_origin != htonl(INADDR_ANY) || in ip_mr_forward()
2016 ip_hdr(skb)->ttl > c->_c.mfc_un.res.ttls[ct]) { in ip_mr_forward()
2299 u32 portid, u32 seq, struct mfc_cache *c, int cmd, in ipmr_fill_mroute() argument
2320 if (c->_c.mfc_flags & MFC_STATIC) in ipmr_fill_mroute()
2326 if (nla_put_in_addr(skb, RTA_SRC, c->mfc_origin) || in ipmr_fill_mroute()
2327 nla_put_in_addr(skb, RTA_DST, c->mfc_mcastgrp)) in ipmr_fill_mroute()
2329 err = mr_fill_mroute(mrt, skb, &c->_c, rtm); in ipmr_fill_mroute()
2343 u32 portid, u32 seq, struct mr_mfc *c, int cmd, in _ipmr_fill_mroute() argument
2346 return ipmr_fill_mroute(mrt, skb, portid, seq, (struct mfc_cache *)c, in _ipmr_fill_mroute()