Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315435
b: refs/heads/master
c: 4895c77
h: refs/heads/master
i:
  315433: 9c1972c
  315431: b60be8e
v: v3
  • Loading branch information
David S. Miller committed Jul 17, 2012
1 parent 32cc1b1 commit 6ef5e07
Show file tree
Hide file tree
Showing 4 changed files with 267 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6700c2709c08d74ae2c3c29b84a30da012dbc7f1
refs/heads/master: 4895c771c7f006b4b90f9d6b1d2210939ba57b38
18 changes: 18 additions & 0 deletions trunk/include/net/ip_fib.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <net/flow.h>
#include <linux/seq_file.h>
#include <linux/rcupdate.h>
#include <net/fib_rules.h>
#include <net/inetpeer.h>

Expand Down Expand Up @@ -46,6 +47,22 @@ struct fib_config {

struct fib_info;

struct fib_nh_exception {
struct fib_nh_exception __rcu *fnhe_next;
__be32 fnhe_daddr;
u32 fnhe_pmtu;
u32 fnhe_gw;
unsigned long fnhe_expires;
unsigned long fnhe_stamp;
};

struct fnhe_hash_bucket {
struct fib_nh_exception __rcu *chain;
};

#define FNHE_HASH_SIZE 2048
#define FNHE_RECLAIM_DEPTH 5

struct fib_nh {
struct net_device *nh_dev;
struct hlist_node nh_hash;
Expand All @@ -63,6 +80,7 @@ struct fib_nh {
__be32 nh_gw;
__be32 nh_saddr;
int nh_saddr_genid;
struct fnhe_hash_bucket *nh_exceptions;
};

/*
Expand Down
23 changes: 23 additions & 0 deletions trunk/net/ipv4/fib_semantics.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,27 @@ const struct fib_prop fib_props[RTN_MAX + 1] = {
},
};

static void free_nh_exceptions(struct fib_nh *nh)
{
struct fnhe_hash_bucket *hash = nh->nh_exceptions;
int i;

for (i = 0; i < FNHE_HASH_SIZE; i++) {
struct fib_nh_exception *fnhe;

fnhe = rcu_dereference(hash[i].chain);
while (fnhe) {
struct fib_nh_exception *next;

next = rcu_dereference(fnhe->fnhe_next);
kfree(fnhe);

fnhe = next;
}
}
kfree(hash);
}

/* Release a nexthop info record */
static void free_fib_info_rcu(struct rcu_head *head)
{
Expand All @@ -148,6 +169,8 @@ static void free_fib_info_rcu(struct rcu_head *head)
change_nexthops(fi) {
if (nexthop_nh->nh_dev)
dev_put(nexthop_nh->nh_dev);
if (nexthop_nh->nh_exceptions)
free_nh_exceptions(nexthop_nh);
} endfor_nexthops(fi);

release_net(fi->fib_net);
Expand Down
Loading

0 comments on commit 6ef5e07

Please sign in to comment.