Commit 6ce3b4dc authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

inet: rename netns_frags to fqdir



1) struct netns_frags is renamed to struct fqdir
  This structure is really holding many frag queues in a hash table.

2) (struct inet_frag_queue)->net field is renamed to fqdir
  since net is generally associated to a 'struct net' pointer
  in networking stack.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ddf6ddb0
Loading
Loading
Loading
Loading
+15 −14
Original line number Original line Diff line number Diff line
@@ -4,7 +4,8 @@


#include <linux/rhashtable-types.h>
#include <linux/rhashtable-types.h>


struct netns_frags {
/* Per netns frag queues directory */
struct fqdir {
	/* sysctls */
	/* sysctls */
	long			high_thresh;
	long			high_thresh;
	long			low_thresh;
	long			low_thresh;
@@ -64,7 +65,7 @@ struct frag_v6_compare_key {
 * @meat: length of received fragments so far
 * @meat: length of received fragments so far
 * @flags: fragment queue flags
 * @flags: fragment queue flags
 * @max_size: maximum received fragment size
 * @max_size: maximum received fragment size
 * @net: namespace that this frag belongs to
 * @fqdir: pointer to struct fqdir
 * @rcu: rcu head for freeing deferall
 * @rcu: rcu head for freeing deferall
 */
 */
struct inet_frag_queue {
struct inet_frag_queue {
@@ -84,7 +85,7 @@ struct inet_frag_queue {
	int			meat;
	int			meat;
	__u8			flags;
	__u8			flags;
	u16			max_size;
	u16			max_size;
	struct netns_frags      *net;
	struct fqdir		*fqdir;
	struct rcu_head		rcu;
	struct rcu_head		rcu;
};
};


@@ -103,16 +104,16 @@ struct inet_frags {
int inet_frags_init(struct inet_frags *);
int inet_frags_init(struct inet_frags *);
void inet_frags_fini(struct inet_frags *);
void inet_frags_fini(struct inet_frags *);


static inline int inet_frags_init_net(struct netns_frags *nf)
static inline int inet_frags_init_net(struct fqdir *fqdir)
{
{
	atomic_long_set(&nf->mem, 0);
	atomic_long_set(&fqdir->mem, 0);
	return rhashtable_init(&nf->rhashtable, &nf->f->rhash_params);
	return rhashtable_init(&fqdir->rhashtable, &fqdir->f->rhash_params);
}
}
void inet_frags_exit_net(struct netns_frags *nf);
void inet_frags_exit_net(struct fqdir *fqdir);


void inet_frag_kill(struct inet_frag_queue *q);
void inet_frag_kill(struct inet_frag_queue *q);
void inet_frag_destroy(struct inet_frag_queue *q);
void inet_frag_destroy(struct inet_frag_queue *q);
struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, void *key);
struct inet_frag_queue *inet_frag_find(struct fqdir *fqdir, void *key);


/* Free all skbs in the queue; return the sum of their truesizes. */
/* Free all skbs in the queue; return the sum of their truesizes. */
unsigned int inet_frag_rbtree_purge(struct rb_root *root);
unsigned int inet_frag_rbtree_purge(struct rb_root *root);
@@ -125,19 +126,19 @@ static inline void inet_frag_put(struct inet_frag_queue *q)


/* Memory Tracking Functions. */
/* Memory Tracking Functions. */


static inline long frag_mem_limit(const struct netns_frags *nf)
static inline long frag_mem_limit(const struct fqdir *fqdir)
{
{
	return atomic_long_read(&nf->mem);
	return atomic_long_read(&fqdir->mem);
}
}


static inline void sub_frag_mem_limit(struct netns_frags *nf, long val)
static inline void sub_frag_mem_limit(struct fqdir *fqdir, long val)
{
{
	atomic_long_sub(val, &nf->mem);
	atomic_long_sub(val, &fqdir->mem);
}
}


static inline void add_frag_mem_limit(struct netns_frags *nf, long val)
static inline void add_frag_mem_limit(struct fqdir *fqdir, long val)
{
{
	atomic_long_add(val, &nf->mem);
	atomic_long_add(val, &fqdir->mem);
}
}


/* RFC 3168 support :
/* RFC 3168 support :
+1 −1
Original line number Original line Diff line number Diff line
@@ -16,7 +16,7 @@ struct netns_sysctl_lowpan {


struct netns_ieee802154_lowpan {
struct netns_ieee802154_lowpan {
	struct netns_sysctl_lowpan sysctl;
	struct netns_sysctl_lowpan sysctl;
	struct netns_frags	frags;
	struct fqdir	frags;
};
};


#endif
#endif
+1 −1
Original line number Original line Diff line number Diff line
@@ -72,7 +72,7 @@ struct netns_ipv4 {


	struct inet_peer_base	*peers;
	struct inet_peer_base	*peers;
	struct sock  * __percpu	*tcp_sk;
	struct sock  * __percpu	*tcp_sk;
	struct netns_frags	frags;
	struct fqdir	frags;
#ifdef CONFIG_NETFILTER
#ifdef CONFIG_NETFILTER
	struct xt_table		*iptable_filter;
	struct xt_table		*iptable_filter;
	struct xt_table		*iptable_mangle;
	struct xt_table		*iptable_mangle;
+2 −2
Original line number Original line Diff line number Diff line
@@ -58,7 +58,7 @@ struct netns_ipv6 {
	struct ipv6_devconf	*devconf_all;
	struct ipv6_devconf	*devconf_all;
	struct ipv6_devconf	*devconf_dflt;
	struct ipv6_devconf	*devconf_dflt;
	struct inet_peer_base	*peers;
	struct inet_peer_base	*peers;
	struct netns_frags	frags;
	struct fqdir	frags;
#ifdef CONFIG_NETFILTER
#ifdef CONFIG_NETFILTER
	struct xt_table		*ip6table_filter;
	struct xt_table		*ip6table_filter;
	struct xt_table		*ip6table_mangle;
	struct xt_table		*ip6table_mangle;
@@ -116,7 +116,7 @@ struct netns_ipv6 {


#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
struct netns_nf_frag {
struct netns_nf_frag {
	struct netns_frags	frags;
	struct fqdir	frags;
};
};
#endif
#endif


+1 −1
Original line number Original line Diff line number Diff line
@@ -139,7 +139,7 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq,
		fq->q.flags |= INET_FRAG_FIRST_IN;
		fq->q.flags |= INET_FRAG_FIRST_IN;


	fq->q.meat += skb->len;
	fq->q.meat += skb->len;
	add_frag_mem_limit(fq->q.net, skb->truesize);
	add_frag_mem_limit(fq->q.fqdir, skb->truesize);


	if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
	if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
	    fq->q.meat == fq->q.len) {
	    fq->q.meat == fq->q.len) {
Loading