Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278263
b: refs/heads/master
c: b90e579
h: refs/heads/master
i:
  278261: 78290ac
  278259: b96311a
  278255: fb0f4cc
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 29, 2011
1 parent b32bc1d commit 77feafc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 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: db62f684deeb291ab2533b99843d5df9a36b1f19
refs/heads/master: b90e5794c5bdef91d26c623e992257947c506e35
23 changes: 23 additions & 0 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,15 +1441,38 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
EXPORT_SYMBOL(call_netdevice_notifiers);

static struct jump_label_key netstamp_needed __read_mostly;
#ifdef HAVE_JUMP_LABEL
/* We are not allowed to call jump_label_dec() from irq context
* If net_disable_timestamp() is called from irq context, defer the
* jump_label_dec() calls.
*/
static atomic_t netstamp_needed_deferred;
#endif

void net_enable_timestamp(void)
{
#ifdef HAVE_JUMP_LABEL
int deferred = atomic_xchg(&netstamp_needed_deferred, 0);

if (deferred) {
while (--deferred)
jump_label_dec(&netstamp_needed);
return;
}
#endif
WARN_ON(in_interrupt());
jump_label_inc(&netstamp_needed);
}
EXPORT_SYMBOL(net_enable_timestamp);

void net_disable_timestamp(void)
{
#ifdef HAVE_JUMP_LABEL
if (in_interrupt()) {
atomic_inc(&netstamp_needed_deferred);
return;
}
#endif
jump_label_dec(&netstamp_needed);
}
EXPORT_SYMBOL(net_disable_timestamp);
Expand Down
6 changes: 4 additions & 2 deletions trunk/net/ipv4/netfilter/ip_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ __ipq_rcv_skb(struct sk_buff *skb)
int status, type, pid, flags;
unsigned int nlmsglen, skblen;
struct nlmsghdr *nlh;
bool enable_timestamp = false;

skblen = skb->len;
if (skblen < sizeof(*nlh))
Expand Down Expand Up @@ -441,12 +442,13 @@ __ipq_rcv_skb(struct sk_buff *skb)
RCV_SKB_FAIL(-EBUSY);
}
} else {
net_enable_timestamp();
enable_timestamp = true;
peer_pid = pid;
}

spin_unlock_bh(&queue_lock);

if (enable_timestamp)
net_enable_timestamp();
status = ipq_receive_peer(NLMSG_DATA(nlh), type,
nlmsglen - NLMSG_LENGTH(0));
if (status < 0)
Expand Down
5 changes: 4 additions & 1 deletion trunk/net/ipv6/netfilter/ip6_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ __ipq_rcv_skb(struct sk_buff *skb)
int status, type, pid, flags;
unsigned int nlmsglen, skblen;
struct nlmsghdr *nlh;
bool enable_timestamp = false;

skblen = skb->len;
if (skblen < sizeof(*nlh))
Expand Down Expand Up @@ -442,11 +443,13 @@ __ipq_rcv_skb(struct sk_buff *skb)
RCV_SKB_FAIL(-EBUSY);
}
} else {
net_enable_timestamp();
enable_timestamp = true;
peer_pid = pid;
}

spin_unlock_bh(&queue_lock);
if (enable_timestamp)
net_enable_timestamp();

status = ipq_receive_peer(NLMSG_DATA(nlh), type,
nlmsglen - NLMSG_LENGTH(0));
Expand Down

0 comments on commit 77feafc

Please sign in to comment.