Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78132
b: refs/heads/master
c: 8dbde28
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 28, 2008
1 parent bc3949f commit b1e0412
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 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: 68f8353b480e5f2e136c38a511abdbb88eaa8ce2
refs/heads/master: 8dbde28d9711475adfe0e9c88505e38743cdc2a7
2 changes: 1 addition & 1 deletion trunk/net/ipv4/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static int ip_rcv_finish(struct sk_buff *skb)

#ifdef CONFIG_NET_CLS_ROUTE
if (unlikely(skb->dst->tclassid)) {
struct ip_rt_acct *st = ip_rt_acct + 256*smp_processor_id();
struct ip_rt_acct *st = per_cpu_ptr(ip_rt_acct, smp_processor_id());
u32 idx = skb->dst->tclassid;
st[idx&0xFF].o_packets++;
st[idx&0xFF].o_bytes+=skb->len;
Expand Down
15 changes: 3 additions & 12 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2858,12 +2858,10 @@ ctl_table ipv4_route_table[] = {
#endif

#ifdef CONFIG_NET_CLS_ROUTE
struct ip_rt_acct *ip_rt_acct;

/* This code sucks. But you should have seen it before! --RR */
struct ip_rt_acct *ip_rt_acct __read_mostly;

/* IP route accounting ptr for this logical cpu number. */
#define IP_RT_ACCT_CPU(i) (ip_rt_acct + i * 256)
#define IP_RT_ACCT_CPU(cpu) (per_cpu_ptr(ip_rt_acct, cpu))

#ifdef CONFIG_PROC_FS
static int ip_rt_acct_read(char *buffer, char **start, off_t offset,
Expand Down Expand Up @@ -2923,16 +2921,9 @@ int __init ip_rt_init(void)
(jiffies ^ (jiffies >> 7)));

#ifdef CONFIG_NET_CLS_ROUTE
{
int order;
for (order = 0;
(PAGE_SIZE << order) < 256 * sizeof(struct ip_rt_acct) * NR_CPUS; order++)
/* NOTHING */;
ip_rt_acct = (struct ip_rt_acct *)__get_free_pages(GFP_KERNEL, order);
ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct));
if (!ip_rt_acct)
panic("IP: failed to allocate ip_rt_acct\n");
memset(ip_rt_acct, 0, PAGE_SIZE << order);
}
#endif

ipv4_dst_ops.kmem_cachep =
Expand Down

0 comments on commit b1e0412

Please sign in to comment.