Commit 9d729f72 authored by James Morris's avatar James Morris Committed by David S. Miller

[NET]: Convert xtime.tv_sec to get_seconds()

Where appropriate, convert references to xtime.tv_sec to the
get_seconds() helper function.
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39df232f
...@@ -1014,7 +1014,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int ...@@ -1014,7 +1014,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
{ {
if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0)
return 0; return 0;
if (xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)
return 0; return 0;
/* RST segments are not recommended to carry timestamp, /* RST segments are not recommended to carry timestamp,
...@@ -1029,7 +1029,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int ...@@ -1029,7 +1029,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
However, we can relax time bounds for RST segments to MSL. However, we can relax time bounds for RST segments to MSL.
*/ */
if (rst && xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
return 0; return 0;
return 1; return 1;
} }
......
...@@ -2683,7 +2683,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, ...@@ -2683,7 +2683,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
id = rt->peer->ip_id_count; id = rt->peer->ip_id_count;
if (rt->peer->tcp_ts_stamp) { if (rt->peer->tcp_ts_stamp) {
ts = rt->peer->tcp_ts; ts = rt->peer->tcp_ts;
tsage = xtime.tv_sec - rt->peer->tcp_ts_stamp; tsage = get_seconds() - rt->peer->tcp_ts_stamp;
} }
} }
......
...@@ -2933,7 +2933,7 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th, ...@@ -2933,7 +2933,7 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th,
static inline void tcp_store_ts_recent(struct tcp_sock *tp) static inline void tcp_store_ts_recent(struct tcp_sock *tp)
{ {
tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval; tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
tp->rx_opt.ts_recent_stamp = xtime.tv_sec; tp->rx_opt.ts_recent_stamp = get_seconds();
} }
static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
...@@ -2947,7 +2947,7 @@ static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) ...@@ -2947,7 +2947,7 @@ static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
*/ */
if((s32)(tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent) >= 0 || if((s32)(tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent) >= 0 ||
xtime.tv_sec >= tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS) get_seconds() >= tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS)
tcp_store_ts_recent(tp); tcp_store_ts_recent(tp);
} }
} }
...@@ -2999,7 +2999,7 @@ static inline int tcp_paws_discard(const struct sock *sk, const struct sk_buff * ...@@ -2999,7 +2999,7 @@ static inline int tcp_paws_discard(const struct sock *sk, const struct sk_buff *
{ {
const struct tcp_sock *tp = tcp_sk(sk); const struct tcp_sock *tp = tcp_sk(sk);
return ((s32)(tp->rx_opt.ts_recent - tp->rx_opt.rcv_tsval) > TCP_PAWS_WINDOW && return ((s32)(tp->rx_opt.ts_recent - tp->rx_opt.rcv_tsval) > TCP_PAWS_WINDOW &&
xtime.tv_sec < tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS && get_seconds() < tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS &&
!tcp_disordered_ack(sk, skb)); !tcp_disordered_ack(sk, skb));
} }
......
...@@ -149,7 +149,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) ...@@ -149,7 +149,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
*/ */
if (tcptw->tw_ts_recent_stamp && if (tcptw->tw_ts_recent_stamp &&
(twp == NULL || (sysctl_tcp_tw_reuse && (twp == NULL || (sysctl_tcp_tw_reuse &&
xtime.tv_sec - tcptw->tw_ts_recent_stamp > 1))) { get_seconds() - tcptw->tw_ts_recent_stamp > 1))) {
tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2;
if (tp->write_seq == 0) if (tp->write_seq == 0)
tp->write_seq = 1; tp->write_seq = 1;
...@@ -224,7 +224,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -224,7 +224,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
* when trying new connection. * when trying new connection.
*/ */
if (peer != NULL && if (peer != NULL &&
peer->tcp_ts_stamp + TCP_PAWS_MSL >= xtime.tv_sec) { peer->tcp_ts_stamp + TCP_PAWS_MSL >= get_seconds()) {
tp->rx_opt.ts_recent_stamp = peer->tcp_ts_stamp; tp->rx_opt.ts_recent_stamp = peer->tcp_ts_stamp;
tp->rx_opt.ts_recent = peer->tcp_ts; tp->rx_opt.ts_recent = peer->tcp_ts;
} }
...@@ -1351,7 +1351,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -1351,7 +1351,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
(dst = inet_csk_route_req(sk, req)) != NULL && (dst = inet_csk_route_req(sk, req)) != NULL &&
(peer = rt_get_peer((struct rtable *)dst)) != NULL && (peer = rt_get_peer((struct rtable *)dst)) != NULL &&
peer->v4daddr == saddr) { peer->v4daddr == saddr) {
if (xtime.tv_sec < peer->tcp_ts_stamp + TCP_PAWS_MSL && if (get_seconds() < peer->tcp_ts_stamp + TCP_PAWS_MSL &&
(s32)(peer->tcp_ts - req->ts_recent) > (s32)(peer->tcp_ts - req->ts_recent) >
TCP_PAWS_WINDOW) { TCP_PAWS_WINDOW) {
NET_INC_STATS_BH(LINUX_MIB_PAWSPASSIVEREJECTED); NET_INC_STATS_BH(LINUX_MIB_PAWSPASSIVEREJECTED);
...@@ -1770,7 +1770,7 @@ int tcp_v4_remember_stamp(struct sock *sk) ...@@ -1770,7 +1770,7 @@ int tcp_v4_remember_stamp(struct sock *sk)
if (peer) { if (peer) {
if ((s32)(peer->tcp_ts - tp->rx_opt.ts_recent) <= 0 || if ((s32)(peer->tcp_ts - tp->rx_opt.ts_recent) <= 0 ||
(peer->tcp_ts_stamp + TCP_PAWS_MSL < xtime.tv_sec && (peer->tcp_ts_stamp + TCP_PAWS_MSL < get_seconds() &&
peer->tcp_ts_stamp <= tp->rx_opt.ts_recent_stamp)) { peer->tcp_ts_stamp <= tp->rx_opt.ts_recent_stamp)) {
peer->tcp_ts_stamp = tp->rx_opt.ts_recent_stamp; peer->tcp_ts_stamp = tp->rx_opt.ts_recent_stamp;
peer->tcp_ts = tp->rx_opt.ts_recent; peer->tcp_ts = tp->rx_opt.ts_recent;
...@@ -1791,7 +1791,7 @@ int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw) ...@@ -1791,7 +1791,7 @@ int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw)
const struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw); const struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw);
if ((s32)(peer->tcp_ts - tcptw->tw_ts_recent) <= 0 || if ((s32)(peer->tcp_ts - tcptw->tw_ts_recent) <= 0 ||
(peer->tcp_ts_stamp + TCP_PAWS_MSL < xtime.tv_sec && (peer->tcp_ts_stamp + TCP_PAWS_MSL < get_seconds() &&
peer->tcp_ts_stamp <= tcptw->tw_ts_recent_stamp)) { peer->tcp_ts_stamp <= tcptw->tw_ts_recent_stamp)) {
peer->tcp_ts_stamp = tcptw->tw_ts_recent_stamp; peer->tcp_ts_stamp = tcptw->tw_ts_recent_stamp;
peer->tcp_ts = tcptw->tw_ts_recent; peer->tcp_ts = tcptw->tw_ts_recent;
......
...@@ -149,7 +149,7 @@ kill_with_rst: ...@@ -149,7 +149,7 @@ kill_with_rst:
tw->tw_substate = TCP_TIME_WAIT; tw->tw_substate = TCP_TIME_WAIT;
tcptw->tw_rcv_nxt = TCP_SKB_CB(skb)->end_seq; tcptw->tw_rcv_nxt = TCP_SKB_CB(skb)->end_seq;
if (tmp_opt.saw_tstamp) { if (tmp_opt.saw_tstamp) {
tcptw->tw_ts_recent_stamp = xtime.tv_sec; tcptw->tw_ts_recent_stamp = get_seconds();
tcptw->tw_ts_recent = tmp_opt.rcv_tsval; tcptw->tw_ts_recent = tmp_opt.rcv_tsval;
} }
...@@ -208,7 +208,7 @@ kill: ...@@ -208,7 +208,7 @@ kill:
if (tmp_opt.saw_tstamp) { if (tmp_opt.saw_tstamp) {
tcptw->tw_ts_recent = tmp_opt.rcv_tsval; tcptw->tw_ts_recent = tmp_opt.rcv_tsval;
tcptw->tw_ts_recent_stamp = xtime.tv_sec; tcptw->tw_ts_recent_stamp = get_seconds();
} }
inet_twsk_put(tw); inet_twsk_put(tw);
...@@ -458,7 +458,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, ...@@ -458,7 +458,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
if (newtp->rx_opt.tstamp_ok) { if (newtp->rx_opt.tstamp_ok) {
newtp->rx_opt.ts_recent = req->ts_recent; newtp->rx_opt.ts_recent = req->ts_recent;
newtp->rx_opt.ts_recent_stamp = xtime.tv_sec; newtp->rx_opt.ts_recent_stamp = get_seconds();
newtp->tcp_header_len = sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED; newtp->tcp_header_len = sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED;
} else { } else {
newtp->rx_opt.ts_recent_stamp = 0; newtp->rx_opt.ts_recent_stamp = 0;
...@@ -504,7 +504,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, ...@@ -504,7 +504,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
* it can be estimated (approximately) * it can be estimated (approximately)
* from another data. * from another data.
*/ */
tmp_opt.ts_recent_stamp = xtime.tv_sec - ((TCP_TIMEOUT_INIT/HZ)<<req->retrans); tmp_opt.ts_recent_stamp = get_seconds() - ((TCP_TIMEOUT_INIT/HZ)<<req->retrans);
paws_reject = tcp_paws_check(&tmp_opt, th->rst); paws_reject = tcp_paws_check(&tmp_opt, th->rst);
} }
} }
......
...@@ -76,7 +76,7 @@ static int xfrm6_output_one(struct sk_buff *skb) ...@@ -76,7 +76,7 @@ static int xfrm6_output_one(struct sk_buff *skb)
x->curlft.bytes += skb->len; x->curlft.bytes += skb->len;
x->curlft.packets++; x->curlft.packets++;
if (x->props.mode == XFRM_MODE_ROUTEOPTIMIZATION) if (x->props.mode == XFRM_MODE_ROUTEOPTIMIZATION)
x->lastused = (u64)xtime.tv_sec; x->lastused = get_seconds();
spin_unlock_bh(&x->lock); spin_unlock_bh(&x->lock);
......
...@@ -37,7 +37,7 @@ static int __init rxrpc_initialise(void) ...@@ -37,7 +37,7 @@ static int __init rxrpc_initialise(void)
int ret; int ret;
/* my epoch value */ /* my epoch value */
rxrpc_epoch = htonl(xtime.tv_sec); rxrpc_epoch = htonl(get_seconds());
/* register the /proc interface */ /* register the /proc interface */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
......
...@@ -268,7 +268,7 @@ static inline unsigned long make_jiffies(long secs) ...@@ -268,7 +268,7 @@ static inline unsigned long make_jiffies(long secs)
static void xfrm_policy_timer(unsigned long data) static void xfrm_policy_timer(unsigned long data)
{ {
struct xfrm_policy *xp = (struct xfrm_policy*)data; struct xfrm_policy *xp = (struct xfrm_policy*)data;
unsigned long now = (unsigned long)xtime.tv_sec; unsigned long now = get_seconds();
long next = LONG_MAX; long next = LONG_MAX;
int warn = 0; int warn = 0;
int dir; int dir;
...@@ -690,7 +690,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) ...@@ -690,7 +690,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
} }
policy->index = delpol ? delpol->index : xfrm_gen_index(policy->type, dir); policy->index = delpol ? delpol->index : xfrm_gen_index(policy->type, dir);
hlist_add_head(&policy->byidx, xfrm_policy_byidx+idx_hash(policy->index)); hlist_add_head(&policy->byidx, xfrm_policy_byidx+idx_hash(policy->index));
policy->curlft.add_time = (unsigned long)xtime.tv_sec; policy->curlft.add_time = get_seconds();
policy->curlft.use_time = 0; policy->curlft.use_time = 0;
if (!mod_timer(&policy->timer, jiffies + HZ)) if (!mod_timer(&policy->timer, jiffies + HZ))
xfrm_pol_hold(policy); xfrm_pol_hold(policy);
...@@ -1133,7 +1133,7 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol) ...@@ -1133,7 +1133,7 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
old_pol = sk->sk_policy[dir]; old_pol = sk->sk_policy[dir];
sk->sk_policy[dir] = pol; sk->sk_policy[dir] = pol;
if (pol) { if (pol) {
pol->curlft.add_time = (unsigned long)xtime.tv_sec; pol->curlft.add_time = get_seconds();
pol->index = xfrm_gen_index(pol->type, XFRM_POLICY_MAX+dir); pol->index = xfrm_gen_index(pol->type, XFRM_POLICY_MAX+dir);
__xfrm_policy_link(pol, XFRM_POLICY_MAX+dir); __xfrm_policy_link(pol, XFRM_POLICY_MAX+dir);
} }
...@@ -1386,7 +1386,7 @@ restart: ...@@ -1386,7 +1386,7 @@ restart:
return 0; return 0;
family = dst_orig->ops->family; family = dst_orig->ops->family;
policy->curlft.use_time = (unsigned long)xtime.tv_sec; policy->curlft.use_time = get_seconds();
pols[0] = policy; pols[0] = policy;
npols ++; npols ++;
xfrm_nr += pols[0]->xfrm_nr; xfrm_nr += pols[0]->xfrm_nr;
...@@ -1682,7 +1682,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, ...@@ -1682,7 +1682,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
return 1; return 1;
} }
pol->curlft.use_time = (unsigned long)xtime.tv_sec; pol->curlft.use_time = get_seconds();
pols[0] = pol; pols[0] = pol;
npols ++; npols ++;
...@@ -1694,7 +1694,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, ...@@ -1694,7 +1694,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
if (pols[1]) { if (pols[1]) {
if (IS_ERR(pols[1])) if (IS_ERR(pols[1]))
return 0; return 0;
pols[1]->curlft.use_time = (unsigned long)xtime.tv_sec; pols[1]->curlft.use_time = get_seconds();
npols ++; npols ++;
} }
} }
......
...@@ -233,7 +233,7 @@ static inline unsigned long make_jiffies(long secs) ...@@ -233,7 +233,7 @@ static inline unsigned long make_jiffies(long secs)
static void xfrm_timer_handler(unsigned long data) static void xfrm_timer_handler(unsigned long data)
{ {
struct xfrm_state *x = (struct xfrm_state*)data; struct xfrm_state *x = (struct xfrm_state*)data;
unsigned long now = (unsigned long)xtime.tv_sec; unsigned long now = get_seconds();
long next = LONG_MAX; long next = LONG_MAX;
int warn = 0; int warn = 0;
int err = 0; int err = 0;
...@@ -326,7 +326,7 @@ struct xfrm_state *xfrm_state_alloc(void) ...@@ -326,7 +326,7 @@ struct xfrm_state *xfrm_state_alloc(void)
init_timer(&x->rtimer); init_timer(&x->rtimer);
x->rtimer.function = xfrm_replay_timer_handler; x->rtimer.function = xfrm_replay_timer_handler;
x->rtimer.data = (unsigned long)x; x->rtimer.data = (unsigned long)x;
x->curlft.add_time = (unsigned long)xtime.tv_sec; x->curlft.add_time = get_seconds();
x->lft.soft_byte_limit = XFRM_INF; x->lft.soft_byte_limit = XFRM_INF;
x->lft.soft_packet_limit = XFRM_INF; x->lft.soft_packet_limit = XFRM_INF;
x->lft.hard_byte_limit = XFRM_INF; x->lft.hard_byte_limit = XFRM_INF;
...@@ -1051,7 +1051,7 @@ EXPORT_SYMBOL(xfrm_state_update); ...@@ -1051,7 +1051,7 @@ EXPORT_SYMBOL(xfrm_state_update);
int xfrm_state_check_expire(struct xfrm_state *x) int xfrm_state_check_expire(struct xfrm_state *x)
{ {
if (!x->curlft.use_time) if (!x->curlft.use_time)
x->curlft.use_time = (unsigned long)xtime.tv_sec; x->curlft.use_time = get_seconds();
if (x->km.state != XFRM_STATE_VALID) if (x->km.state != XFRM_STATE_VALID)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment