inet_frag.h (787bea7748a76130566f881c2342a0be4127d182) inet_frag.h (093ba72914b696521e4885756a68a3332782c8de)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __NET_FRAG_H__
3#define __NET_FRAG_H__
4
5struct netns_frags {
6 /* Keep atomic mem on separate cachelines in structs that include it */
7 atomic_t mem ____cacheline_aligned_in_smp;
8 /* sysctls */
9 int timeout;
10 int high_thresh;
11 int low_thresh;
12 int max_dist;
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __NET_FRAG_H__
3#define __NET_FRAG_H__
4
5struct netns_frags {
6 /* Keep atomic mem on separate cachelines in structs that include it */
7 atomic_t mem ____cacheline_aligned_in_smp;
8 /* sysctls */
9 int timeout;
10 int high_thresh;
11 int low_thresh;
12 int max_dist;
13 struct inet_frags *f;
13};
14
15/**
16 * fragment queue flags
17 *
18 * @INET_FRAG_FIRST_IN: first fragment has arrived
19 * @INET_FRAG_LAST_IN: final fragment has arrived
20 * @INET_FRAG_COMPLETE: frag queue has been processed and is due for destruction

--- 83 unchanged lines hidden (view full) ---

104int inet_frags_init(struct inet_frags *);
105void inet_frags_fini(struct inet_frags *);
106
107static inline int inet_frags_init_net(struct netns_frags *nf)
108{
109 atomic_set(&nf->mem, 0);
110 return 0;
111}
14};
15
16/**
17 * fragment queue flags
18 *
19 * @INET_FRAG_FIRST_IN: first fragment has arrived
20 * @INET_FRAG_LAST_IN: final fragment has arrived
21 * @INET_FRAG_COMPLETE: frag queue has been processed and is due for destruction

--- 83 unchanged lines hidden (view full) ---

105int inet_frags_init(struct inet_frags *);
106void inet_frags_fini(struct inet_frags *);
107
108static inline int inet_frags_init_net(struct netns_frags *nf)
109{
110 atomic_set(&nf->mem, 0);
111 return 0;
112}
112void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f);
113void inet_frags_exit_net(struct netns_frags *nf);
113
114
114void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
115void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f);
115void inet_frag_kill(struct inet_frag_queue *q);
116void inet_frag_destroy(struct inet_frag_queue *q);
116struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
117 struct inet_frags *f, void *key, unsigned int hash);
118
119void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
120 const char *prefix);
121
117struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
118 struct inet_frags *f, void *key, unsigned int hash);
119
120void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
121 const char *prefix);
122
122static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
123static inline void inet_frag_put(struct inet_frag_queue *q)
123{
124 if (refcount_dec_and_test(&q->refcnt))
124{
125 if (refcount_dec_and_test(&q->refcnt))
125 inet_frag_destroy(q, f);
126 inet_frag_destroy(q);
126}
127
128static inline bool inet_frag_evicting(struct inet_frag_queue *q)
129{
130 return !hlist_unhashed(&q->list_evictor);
131}
132
133/* Memory Tracking Functions. */

--- 33 unchanged lines hidden ---
127}
128
129static inline bool inet_frag_evicting(struct inet_frag_queue *q)
130{
131 return !hlist_unhashed(&q->list_evictor);
132}
133
134/* Memory Tracking Functions. */

--- 33 unchanged lines hidden ---