Lines Matching refs:xfrm

18 #include <net/xfrm.h>
35 rcu_dereference_protected((table), lockdep_is_held(&(net)->xfrm.xfrm_state_lock))
63 return __xfrm_dst_hash(daddr, saddr, reqid, family, net->xfrm.state_hmask);
71 return __xfrm_src_hash(daddr, saddr, family, net->xfrm.state_hmask);
78 return __xfrm_spi_hash(daddr, spi, proto, family, net->xfrm.state_hmask);
119 struct net *net = container_of(work, struct net, xfrm.state_hash_work);
125 nsize = xfrm_hash_new_size(net->xfrm.state_hmask);
141 spin_lock_bh(&net->xfrm.xfrm_state_lock);
142 write_seqcount_begin(&net->xfrm.xfrm_state_hash_generation);
145 odst = xfrm_state_deref_prot(net->xfrm.state_bydst, net);
146 for (i = net->xfrm.state_hmask; i >= 0; i--)
149 osrc = xfrm_state_deref_prot(net->xfrm.state_bysrc, net);
150 ospi = xfrm_state_deref_prot(net->xfrm.state_byspi, net);
151 ohashmask = net->xfrm.state_hmask;
153 rcu_assign_pointer(net->xfrm.state_bydst, ndst);
154 rcu_assign_pointer(net->xfrm.state_bysrc, nsrc);
155 rcu_assign_pointer(net->xfrm.state_byspi, nspi);
156 net->xfrm.state_hmask = nhashmask;
158 write_seqcount_end(&net->xfrm.xfrm_state_hash_generation);
159 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
313 request_module("xfrm-type-%d-%d", family, proto);
397 request_module("xfrm-offload-%d-%d", family, proto);
663 spin_lock(&net->xfrm.xfrm_state_lock);
669 net->xfrm.state_num--;
670 spin_unlock(&net->xfrm.xfrm_state_lock);
707 for (i = 0; i <= net->xfrm.state_hmask; i++) {
710 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
727 for (i = 0; i <= net->xfrm.state_hmask; i++) {
731 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
762 spin_lock_bh(&net->xfrm.xfrm_state_lock);
768 for (i = 0; i <= net->xfrm.state_hmask; i++) {
771 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
775 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
787 spin_lock_bh(&net->xfrm.xfrm_state_lock);
793 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
805 spin_lock_bh(&net->xfrm.xfrm_state_lock);
811 for (i = 0; i <= net->xfrm.state_hmask; i++) {
815 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
820 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
829 spin_lock_bh(&net->xfrm.xfrm_state_lock);
838 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
845 spin_lock_bh(&net->xfrm.xfrm_state_lock);
846 si->sadcnt = net->xfrm.state_num;
847 si->sadhcnt = net->xfrm.state_hmask + 1;
849 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
937 hlist_for_each_entry_rcu(x, net->xfrm.state_byspi + h, byspi) {
962 hlist_for_each_entry_rcu(x, net->xfrm.state_bysrc + h, bysrc) {
998 (net->xfrm.state_hmask + 1) < xfrm_state_hashmax &&
999 net->xfrm.state_num > net->xfrm.state_hmask)
1000 schedule_work(&net->xfrm.state_hash_work);
1065 sequence = read_seqcount_begin(&net->xfrm.xfrm_state_hash_generation);
1069 hlist_for_each_entry_rcu(x, net->xfrm.state_bydst + h, bydst) {
1086 hlist_for_each_entry_rcu(x, net->xfrm.state_bydst + h_wildcard, bydst) {
1141 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1143 list_add(&x->km.all, &net->xfrm.state_all);
1144 hlist_add_head_rcu(&x->bydst, net->xfrm.state_bydst + h);
1146 hlist_add_head_rcu(&x->bysrc, net->xfrm.state_bysrc + h);
1149 hlist_add_head_rcu(&x->byspi, net->xfrm.state_byspi + h);
1151 x->lft.hard_add_expires_seconds = net->xfrm.sysctl_acq_expires;
1153 ktime_set(net->xfrm.sysctl_acq_expires, 0),
1155 net->xfrm.state_num++;
1157 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1178 if (read_seqcount_retry(&net->xfrm.xfrm_state_hash_generation, sequence)) {
1197 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1199 hlist_for_each_entry(x, net->xfrm.state_bydst+h, bydst) {
1216 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1229 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1230 list_for_each_entry(w, &net->xfrm.state_all, all) {
1237 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1240 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1250 list_add(&x->km.all, &net->xfrm.state_all);
1254 hlist_add_head_rcu(&x->bydst, net->xfrm.state_bydst + h);
1257 hlist_add_head_rcu(&x->bysrc, net->xfrm.state_bysrc + h);
1263 hlist_add_head_rcu(&x->byspi, net->xfrm.state_byspi + h);
1270 net->xfrm.state_num++;
1275 /* net->xfrm.xfrm_state_lock is held */
1287 hlist_for_each_entry(x, net->xfrm.state_bydst+h, bydst) {
1302 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1305 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1309 /* net->xfrm.xfrm_state_lock is held */
1322 hlist_for_each_entry(x, net->xfrm.state_bydst+h, bydst) {
1371 x->lft.hard_add_expires_seconds = net->xfrm.sysctl_acq_expires;
1374 ktime_set(net->xfrm.sysctl_acq_expires, 0),
1376 list_add(&x->km.all, &net->xfrm.state_all);
1377 hlist_add_head_rcu(&x->bydst, net->xfrm.state_bydst + h);
1379 hlist_add_head_rcu(&x->bysrc, net->xfrm.state_bysrc + h);
1381 net->xfrm.state_num++;
1404 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1433 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1578 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1583 hlist_for_each_entry(x, net->xfrm.state_bydst+h, bydst) {
1602 hlist_for_each_entry(x, net->xfrm.state_bysrc+h, bysrc) {
1618 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1669 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1689 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1726 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1735 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1794 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1796 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1808 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1810 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1948 for (i = 0; i <= net->xfrm.state_hmask; i++) {
1951 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
1967 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1969 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2052 spin_lock_bh(&net->xfrm.xfrm_state_lock);
2055 hlist_add_head_rcu(&x->byspi, net->xfrm.state_byspi + h);
2056 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2096 spin_lock_bh(&net->xfrm.xfrm_state_lock);
2098 x = list_first_entry(&net->xfrm.state_all, struct xfrm_state_walk, all);
2101 list_for_each_entry_from(x, &net->xfrm.state_all, all) {
2122 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2145 spin_lock_bh(&net->xfrm.xfrm_state_lock);
2147 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2535 /* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */
2676 INIT_LIST_HEAD(&net->xfrm.state_all);
2680 net->xfrm.state_bydst = xfrm_hash_alloc(sz);
2681 if (!net->xfrm.state_bydst)
2683 net->xfrm.state_bysrc = xfrm_hash_alloc(sz);
2684 if (!net->xfrm.state_bysrc)
2686 net->xfrm.state_byspi = xfrm_hash_alloc(sz);
2687 if (!net->xfrm.state_byspi)
2689 net->xfrm.state_hmask = ((sz / sizeof(struct hlist_head)) - 1);
2691 net->xfrm.state_num = 0;
2692 INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize);
2693 spin_lock_init(&net->xfrm.xfrm_state_lock);
2694 seqcount_init(&net->xfrm.xfrm_state_hash_generation);
2698 xfrm_hash_free(net->xfrm.state_bysrc, sz);
2700 xfrm_hash_free(net->xfrm.state_bydst, sz);
2709 flush_work(&net->xfrm.state_hash_work);
2713 WARN_ON(!list_empty(&net->xfrm.state_all));
2715 sz = (net->xfrm.state_hmask + 1) * sizeof(struct hlist_head);
2716 WARN_ON(!hlist_empty(net->xfrm.state_byspi));
2717 xfrm_hash_free(net->xfrm.state_byspi, sz);
2718 WARN_ON(!hlist_empty(net->xfrm.state_bysrc));
2719 xfrm_hash_free(net->xfrm.state_bysrc, sz);
2720 WARN_ON(!hlist_empty(net->xfrm.state_bydst));
2721 xfrm_hash_free(net->xfrm.state_bydst, sz);