Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193900
b: refs/heads/master
c: 598ed93
h: refs/heads/master
v: v3
  • Loading branch information
laurent chavey authored and David S. Miller committed Mar 31, 2010
1 parent 26e4f2c commit 1ebdf3d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 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: b00fabb4020d17bda4bea59507e09fadf573088d
refs/heads/master: 598ed9367a36ee1fd4ae3271a54a3547a33975a5
41 changes: 20 additions & 21 deletions trunk/net/core/dst.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ static atomic_t dst_total = ATOMIC_INIT(0);
*/
static struct {
spinlock_t lock;
struct dst_entry *list;
struct dst_entry *list;
unsigned long timer_inc;
unsigned long timer_expires;
} dst_garbage = {
.lock = __SPIN_LOCK_UNLOCKED(dst_garbage.lock),
.timer_inc = DST_GC_MAX,
};
static void dst_gc_task(struct work_struct *work);
static void ___dst_free(struct dst_entry * dst);
static void ___dst_free(struct dst_entry *dst);

static DECLARE_DELAYED_WORK(dst_gc_work, dst_gc_task);

Expand Down Expand Up @@ -135,8 +135,8 @@ static void dst_gc_task(struct work_struct *work)
}
expires = dst_garbage.timer_expires;
/*
* if the next desired timer is more than 4 seconds in the future
* then round the timer to whole seconds
* if the next desired timer is more than 4 seconds in the
* future then round the timer to whole seconds
*/
if (expires > 4*HZ)
expires = round_jiffies_relative(expires);
Expand All @@ -151,7 +151,8 @@ static void dst_gc_task(struct work_struct *work)
" expires: %lu elapsed: %lu us\n",
atomic_read(&dst_total), delayed, work_performed,
expires,
elapsed.tv_sec * USEC_PER_SEC + elapsed.tv_nsec / NSEC_PER_USEC);
elapsed.tv_sec * USEC_PER_SEC +
elapsed.tv_nsec / NSEC_PER_USEC);
#endif
}

Expand All @@ -162,9 +163,9 @@ int dst_discard(struct sk_buff *skb)
}
EXPORT_SYMBOL(dst_discard);

void * dst_alloc(struct dst_ops * ops)
void *dst_alloc(struct dst_ops *ops)
{
struct dst_entry * dst;
struct dst_entry *dst;

if (ops->gc && atomic_read(&ops->entries) > ops->gc_thresh) {
if (ops->gc(ops))
Expand All @@ -184,19 +185,20 @@ void * dst_alloc(struct dst_ops * ops)
atomic_inc(&ops->entries);
return dst;
}
EXPORT_SYMBOL(dst_alloc);

static void ___dst_free(struct dst_entry * dst)
static void ___dst_free(struct dst_entry *dst)
{
/* The first case (dev==NULL) is required, when
protocol module is unloaded.
*/
if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) {
if (dst->dev == NULL || !(dst->dev->flags&IFF_UP))
dst->input = dst->output = dst_discard;
}
dst->obsolete = 2;
}
EXPORT_SYMBOL(__dst_free);

void __dst_free(struct dst_entry * dst)
void __dst_free(struct dst_entry *dst)
{
spin_lock_bh(&dst_garbage.lock);
___dst_free(dst);
Expand Down Expand Up @@ -261,15 +263,16 @@ struct dst_entry *dst_destroy(struct dst_entry * dst)
}
return NULL;
}
EXPORT_SYMBOL(dst_destroy);

void dst_release(struct dst_entry *dst)
{
if (dst) {
int newrefcnt;
int newrefcnt;

smp_mb__before_atomic_dec();
newrefcnt = atomic_dec_return(&dst->__refcnt);
WARN_ON(newrefcnt < 0);
newrefcnt = atomic_dec_return(&dst->__refcnt);
WARN_ON(newrefcnt < 0);
}
}
EXPORT_SYMBOL(dst_release);
Expand Down Expand Up @@ -305,7 +308,8 @@ static inline void dst_ifdown(struct dst_entry *dst, struct net_device *dev,
}
}

static int dst_dev_event(struct notifier_block *this, unsigned long event, void *ptr)
static int dst_dev_event(struct notifier_block *this, unsigned long event,
void *ptr)
{
struct net_device *dev = ptr;
struct dst_entry *dst, *last = NULL;
Expand All @@ -328,9 +332,8 @@ static int dst_dev_event(struct notifier_block *this, unsigned long event, void
last->next = dst;
else
dst_busy_list = dst;
for (; dst; dst = dst->next) {
for (; dst; dst = dst->next)
dst_ifdown(dst, dev, event != NETDEV_DOWN);
}
mutex_unlock(&dst_gc_mutex);
break;
}
Expand All @@ -345,7 +348,3 @@ void __init dst_init(void)
{
register_netdevice_notifier(&dst_dev_notifier);
}

EXPORT_SYMBOL(__dst_free);
EXPORT_SYMBOL(dst_alloc);
EXPORT_SYMBOL(dst_destroy);

0 comments on commit 1ebdf3d

Please sign in to comment.