Lines Matching refs:xfrm

19 #include <net/xfrm.h>
36 rcu_dereference_protected((table), lockdep_is_held(&(net)->xfrm.xfrm_state_lock))
64 return __xfrm_dst_hash(daddr, saddr, reqid, family, net->xfrm.state_hmask);
72 return __xfrm_src_hash(daddr, saddr, family, net->xfrm.state_hmask);
79 return __xfrm_spi_hash(daddr, spi, proto, family, net->xfrm.state_hmask);
84 return __xfrm_seq_hash(seq, net->xfrm.state_hmask);
152 struct net *net = container_of(work, struct net, xfrm.state_hash_work);
158 nsize = xfrm_hash_new_size(net->xfrm.state_hmask);
181 spin_lock_bh(&net->xfrm.xfrm_state_lock);
182 write_seqcount_begin(&net->xfrm.xfrm_state_hash_generation);
185 odst = xfrm_state_deref_prot(net->xfrm.state_bydst, net);
186 for (i = net->xfrm.state_hmask; i >= 0; i--)
189 osrc = xfrm_state_deref_prot(net->xfrm.state_bysrc, net);
190 ospi = xfrm_state_deref_prot(net->xfrm.state_byspi, net);
191 oseq = xfrm_state_deref_prot(net->xfrm.state_byseq, net);
192 ohashmask = net->xfrm.state_hmask;
194 rcu_assign_pointer(net->xfrm.state_bydst, ndst);
195 rcu_assign_pointer(net->xfrm.state_bysrc, nsrc);
196 rcu_assign_pointer(net->xfrm.state_byspi, nspi);
197 rcu_assign_pointer(net->xfrm.state_byseq, nseq);
198 net->xfrm.state_hmask = nhashmask;
200 write_seqcount_end(&net->xfrm.xfrm_state_hash_generation);
201 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
356 request_module("xfrm-type-%d-%d", family, proto);
440 request_module("xfrm-offload-%d-%d", family, proto);
709 spin_lock(&net->xfrm.xfrm_state_lock);
717 net->xfrm.state_num--;
718 spin_unlock(&net->xfrm.xfrm_state_lock);
755 for (i = 0; i <= net->xfrm.state_hmask; i++) {
758 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
775 for (i = 0; i <= net->xfrm.state_hmask; i++) {
779 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
810 spin_lock_bh(&net->xfrm.xfrm_state_lock);
816 for (i = 0; i <= net->xfrm.state_hmask; i++) {
819 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
823 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
835 spin_lock_bh(&net->xfrm.xfrm_state_lock);
841 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
853 spin_lock_bh(&net->xfrm.xfrm_state_lock);
859 for (i = 0; i <= net->xfrm.state_hmask; i++) {
863 hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
868 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
877 spin_lock_bh(&net->xfrm.xfrm_state_lock);
886 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
893 spin_lock_bh(&net->xfrm.xfrm_state_lock);
894 si->sadcnt = net->xfrm.state_num;
895 si->sadhcnt = net->xfrm.state_hmask + 1;
897 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
986 hlist_for_each_entry_rcu(x, net->xfrm.state_byspi + h, byspi) {
1028 hlist_for_each_entry_rcu(x, net->xfrm.state_byspi + h, byspi) {
1053 hlist_for_each_entry_rcu(x, net->xfrm.state_bysrc + h, bysrc) {
1089 (net->xfrm.state_hmask + 1) < xfrm_state_hashmax &&
1090 net->xfrm.state_num > net->xfrm.state_hmask)
1091 schedule_work(&net->xfrm.state_hash_work);
1156 sequence = read_seqcount_begin(&net->xfrm.xfrm_state_hash_generation);
1160 hlist_for_each_entry_rcu(x, net->xfrm.state_bydst + h, bydst) {
1194 hlist_for_each_entry_rcu(x, net->xfrm.state_bydst + h_wildcard, bydst) {
1293 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1295 list_add(&x->km.all, &net->xfrm.state_all);
1297 net->xfrm.state_bydst + h,
1301 net->xfrm.state_bysrc + h,
1306 net->xfrm.state_byspi + h,
1312 net->xfrm.state_byseq + h,
1315 x->lft.hard_add_expires_seconds = net->xfrm.sysctl_acq_expires;
1317 ktime_set(net->xfrm.sysctl_acq_expires, 0),
1319 net->xfrm.state_num++;
1321 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1350 if (read_seqcount_retry(&net->xfrm.xfrm_state_hash_generation, sequence)) {
1369 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1371 hlist_for_each_entry(x, net->xfrm.state_bydst+h, bydst) {
1388 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1401 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1402 list_for_each_entry(w, &net->xfrm.state_all, all) {
1409 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1412 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1422 list_add(&x->km.all, &net->xfrm.state_all);
1426 XFRM_STATE_INSERT(bydst, &x->bydst, net->xfrm.state_bydst + h,
1430 XFRM_STATE_INSERT(bysrc, &x->bysrc, net->xfrm.state_bysrc + h,
1437 XFRM_STATE_INSERT(byspi, &x->byspi, net->xfrm.state_byspi + h,
1444 XFRM_STATE_INSERT(byseq, &x->byseq, net->xfrm.state_byseq + h,
1452 net->xfrm.state_num++;
1457 /* net->xfrm.xfrm_state_lock is held */
1469 hlist_for_each_entry(x, net->xfrm.state_bydst+h, bydst) {
1484 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1487 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1491 /* net->xfrm.xfrm_state_lock is held */
1504 hlist_for_each_entry(x, net->xfrm.state_bydst+h, bydst) {
1553 x->lft.hard_add_expires_seconds = net->xfrm.sysctl_acq_expires;
1556 ktime_set(net->xfrm.sysctl_acq_expires, 0),
1558 list_add(&x->km.all, &net->xfrm.state_all);
1559 XFRM_STATE_INSERT(bydst, &x->bydst, net->xfrm.state_bydst + h,
1562 XFRM_STATE_INSERT(bysrc, &x->bysrc, net->xfrm.state_bysrc + h,
1565 net->xfrm.state_num++;
1588 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1617 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1762 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1767 hlist_for_each_entry(x, net->xfrm.state_bydst+h, bydst) {
1786 hlist_for_each_entry(x, net->xfrm.state_bysrc+h, bysrc) {
1802 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1853 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1873 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1910 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1919 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1980 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1982 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
1994 spin_lock_bh(&net->xfrm.xfrm_state_lock);
1996 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2135 hlist_for_each_entry_rcu(x, net->xfrm.state_byseq + h, byseq) {
2151 spin_lock_bh(&net->xfrm.xfrm_state_lock);
2153 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2245 spin_lock_bh(&net->xfrm.xfrm_state_lock);
2248 XFRM_STATE_INSERT(byspi, &x->byspi, net->xfrm.state_byspi + h,
2250 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2292 spin_lock_bh(&net->xfrm.xfrm_state_lock);
2294 x = list_first_entry(&net->xfrm.state_all, struct xfrm_state_walk, all);
2297 list_for_each_entry_from(x, &net->xfrm.state_all, all) {
2318 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2341 spin_lock_bh(&net->xfrm.xfrm_state_lock);
2343 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
2729 /* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */
2880 INIT_LIST_HEAD(&net->xfrm.state_all);
2884 net->xfrm.state_bydst = xfrm_hash_alloc(sz);
2885 if (!net->xfrm.state_bydst)
2887 net->xfrm.state_bysrc = xfrm_hash_alloc(sz);
2888 if (!net->xfrm.state_bysrc)
2890 net->xfrm.state_byspi = xfrm_hash_alloc(sz);
2891 if (!net->xfrm.state_byspi)
2893 net->xfrm.state_byseq = xfrm_hash_alloc(sz);
2894 if (!net->xfrm.state_byseq)
2896 net->xfrm.state_hmask = ((sz / sizeof(struct hlist_head)) - 1);
2898 net->xfrm.state_num = 0;
2899 INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize);
2900 spin_lock_init(&net->xfrm.xfrm_state_lock);
2901 seqcount_spinlock_init(&net->xfrm.xfrm_state_hash_generation,
2902 &net->xfrm.xfrm_state_lock);
2906 xfrm_hash_free(net->xfrm.state_byspi, sz);
2908 xfrm_hash_free(net->xfrm.state_bysrc, sz);
2910 xfrm_hash_free(net->xfrm.state_bydst, sz);
2919 flush_work(&net->xfrm.state_hash_work);
2923 WARN_ON(!list_empty(&net->xfrm.state_all));
2925 sz = (net->xfrm.state_hmask + 1) * sizeof(struct hlist_head);
2926 WARN_ON(!hlist_empty(net->xfrm.state_byseq));
2927 xfrm_hash_free(net->xfrm.state_byseq, sz);
2928 WARN_ON(!hlist_empty(net->xfrm.state_byspi));
2929 xfrm_hash_free(net->xfrm.state_byspi, sz);
2930 WARN_ON(!hlist_empty(net->xfrm.state_bysrc));
2931 xfrm_hash_free(net->xfrm.state_bysrc, sz);
2932 WARN_ON(!hlist_empty(net->xfrm.state_bydst));
2933 xfrm_hash_free(net->xfrm.state_bydst, sz);