* [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag
@ 2016-04-19 7:10 Xin Long
2016-04-19 9:13 ` Jakub Sitnicki
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Xin Long @ 2016-04-19 7:10 UTC (permalink / raw)
To: network dev, linux-sctp
Cc: Marcelo Ricardo Leitner, Vlad Yasevich, daniel, davem,
eric.dumazet, jsitnick
EXPIRES_IN_MS macro comes from net/ipv4/inet_diag.c and dates
back to before jiffies_to_msecs() has been introduced.
Now we can remove it and use jiffies_to_msecs().
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/ipv4/inet_diag.c | 12 ++++++------
net/sctp/sctp_diag.c | 6 ++----
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 70212bd..ad7956f 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -197,27 +197,27 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
goto out;
}
-#define EXPIRES_IN_MS(tmo) DIV_ROUND_UP((tmo - jiffies) * 1000, HZ)
-
if (icsk->icsk_pending == ICSK_TIME_RETRANS ||
icsk->icsk_pending == ICSK_TIME_EARLY_RETRANS ||
icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) {
r->idiag_timer = 1;
r->idiag_retrans = icsk->icsk_retransmits;
- r->idiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout);
+ r->idiag_expires =
+ jiffies_to_msecs(icsk->icsk_timeout - jiffies);
} else if (icsk->icsk_pending == ICSK_TIME_PROBE0) {
r->idiag_timer = 4;
r->idiag_retrans = icsk->icsk_probes_out;
- r->idiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout);
+ r->idiag_expires =
+ jiffies_to_msecs(icsk->icsk_timeout - jiffies);
} else if (timer_pending(&sk->sk_timer)) {
r->idiag_timer = 2;
r->idiag_retrans = icsk->icsk_probes_out;
- r->idiag_expires = EXPIRES_IN_MS(sk->sk_timer.expires);
+ r->idiag_expires =
+ jiffies_to_msecs(sk->sk_timer.expires - jiffies);
} else {
r->idiag_timer = 0;
r->idiag_expires = 0;
}
-#undef EXPIRES_IN_MS
if ((ext & (1 << (INET_DIAG_INFO - 1))) && handler->idiag_info_size) {
attr = nla_reserve(skb, INET_DIAG_INFO,
diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
index 98ecd16..bb2d8d9 100644
--- a/net/sctp/sctp_diag.c
+++ b/net/sctp/sctp_diag.c
@@ -48,10 +48,8 @@ static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
r->idiag_state = asoc->state;
r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
r->idiag_retrans = asoc->rtx_data_chunks;
-#define EXPIRES_IN_MS(tmo) DIV_ROUND_UP((tmo - jiffies) * 1000, HZ)
- r->idiag_expires =
- EXPIRES_IN_MS(asoc->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX]);
-#undef EXPIRES_IN_MS
+ r->idiag_expires = jiffies_to_msecs(
+ asoc->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] - jiffies);
}
static int inet_diag_msg_sctpladdrs_fill(struct sk_buff *skb,
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag
2016-04-19 7:10 [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag Xin Long
@ 2016-04-19 9:13 ` Jakub Sitnicki
2016-04-19 11:59 ` Marcelo Ricardo Leitner
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Jakub Sitnicki @ 2016-04-19 9:13 UTC (permalink / raw)
To: Xin Long
Cc: network dev, linux-sctp, Marcelo Ricardo Leitner, Vlad Yasevich,
daniel, davem, eric.dumazet
On Tue, Apr 19, 2016 at 09:10 AM CEST, Xin Long <lucien.xin@gmail.com> wrote:
> EXPIRES_IN_MS macro comes from net/ipv4/inet_diag.c and dates
> back to before jiffies_to_msecs() has been introduced.
>
> Now we can remove it and use jiffies_to_msecs().
>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
Acked-by: Jakub Sitnicki <jkbs@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag
2016-04-19 7:10 [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag Xin Long
2016-04-19 9:13 ` Jakub Sitnicki
@ 2016-04-19 11:59 ` Marcelo Ricardo Leitner
2016-04-19 12:25 ` Eric Dumazet
2016-04-21 17:56 ` David Miller
3 siblings, 0 replies; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2016-04-19 11:59 UTC (permalink / raw)
To: Xin Long
Cc: network dev, linux-sctp, Vlad Yasevich, daniel, davem,
eric.dumazet, jsitnick
Re $tags, this is actually the 1st version of the patch, not the 3rd.
On Tue, Apr 19, 2016 at 03:10:01PM +0800, Xin Long wrote:
> EXPIRES_IN_MS macro comes from net/ipv4/inet_diag.c and dates
> back to before jiffies_to_msecs() has been introduced.
>
> Now we can remove it and use jiffies_to_msecs().
>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
> net/ipv4/inet_diag.c | 12 ++++++------
> net/sctp/sctp_diag.c | 6 ++----
> 2 files changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> index 70212bd..ad7956f 100644
> --- a/net/ipv4/inet_diag.c
> +++ b/net/ipv4/inet_diag.c
> @@ -197,27 +197,27 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
> goto out;
> }
>
> -#define EXPIRES_IN_MS(tmo) DIV_ROUND_UP((tmo - jiffies) * 1000, HZ)
> -
> if (icsk->icsk_pending == ICSK_TIME_RETRANS ||
> icsk->icsk_pending == ICSK_TIME_EARLY_RETRANS ||
> icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) {
> r->idiag_timer = 1;
> r->idiag_retrans = icsk->icsk_retransmits;
> - r->idiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout);
> + r->idiag_expires =
> + jiffies_to_msecs(icsk->icsk_timeout - jiffies);
> } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) {
> r->idiag_timer = 4;
> r->idiag_retrans = icsk->icsk_probes_out;
> - r->idiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout);
> + r->idiag_expires =
> + jiffies_to_msecs(icsk->icsk_timeout - jiffies);
> } else if (timer_pending(&sk->sk_timer)) {
> r->idiag_timer = 2;
> r->idiag_retrans = icsk->icsk_probes_out;
> - r->idiag_expires = EXPIRES_IN_MS(sk->sk_timer.expires);
> + r->idiag_expires =
> + jiffies_to_msecs(sk->sk_timer.expires - jiffies);
> } else {
> r->idiag_timer = 0;
> r->idiag_expires = 0;
> }
> -#undef EXPIRES_IN_MS
>
> if ((ext & (1 << (INET_DIAG_INFO - 1))) && handler->idiag_info_size) {
> attr = nla_reserve(skb, INET_DIAG_INFO,
> diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
> index 98ecd16..bb2d8d9 100644
> --- a/net/sctp/sctp_diag.c
> +++ b/net/sctp/sctp_diag.c
> @@ -48,10 +48,8 @@ static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
> r->idiag_state = asoc->state;
> r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
> r->idiag_retrans = asoc->rtx_data_chunks;
> -#define EXPIRES_IN_MS(tmo) DIV_ROUND_UP((tmo - jiffies) * 1000, HZ)
> - r->idiag_expires =
> - EXPIRES_IN_MS(asoc->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX]);
> -#undef EXPIRES_IN_MS
> + r->idiag_expires = jiffies_to_msecs(
> + asoc->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] - jiffies);
Indentation here is tricky but I don't see any better way.
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> }
>
> static int inet_diag_msg_sctpladdrs_fill(struct sk_buff *skb,
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag
2016-04-19 7:10 [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag Xin Long
2016-04-19 9:13 ` Jakub Sitnicki
2016-04-19 11:59 ` Marcelo Ricardo Leitner
@ 2016-04-19 12:25 ` Eric Dumazet
2016-04-19 12:37 ` Xin Long
2016-04-21 17:56 ` David Miller
3 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2016-04-19 12:25 UTC (permalink / raw)
To: Xin Long
Cc: network dev, linux-sctp, Marcelo Ricardo Leitner, Vlad Yasevich,
daniel, davem, jsitnick
On Tue, 2016-04-19 at 15:10 +0800, Xin Long wrote:
> EXPIRES_IN_MS macro comes from net/ipv4/inet_diag.c and dates
> back to before jiffies_to_msecs() has been introduced.
>
> Now we can remove it and use jiffies_to_msecs().
>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
Ok. Note that you could have mentioned this was
Suggested-by: Jakub Sitnicki <jkbs@redhat.com>
Even coworkers deserve credits ;)
Acked-by: Eric Dumazet <edumazet@google.com>
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag
2016-04-19 12:25 ` Eric Dumazet
@ 2016-04-19 12:37 ` Xin Long
0 siblings, 0 replies; 6+ messages in thread
From: Xin Long @ 2016-04-19 12:37 UTC (permalink / raw)
To: Eric Dumazet
Cc: network dev, linux-sctp, Marcelo Ricardo Leitner, Vlad Yasevich,
daniel, davem, jsitnick
On Tue, Apr 19, 2016 at 8:25 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2016-04-19 at 15:10 +0800, Xin Long wrote:
>> EXPIRES_IN_MS macro comes from net/ipv4/inet_diag.c and dates
>> back to before jiffies_to_msecs() has been introduced.
>>
>> Now we can remove it and use jiffies_to_msecs().
>>
>> Signed-off-by: Xin Long <lucien.xin@gmail.com>
>> ---
>
> Ok. Note that you could have mentioned this was
>
> Suggested-by: Jakub Sitnicki <jkbs@redhat.com>
>
> Even coworkers deserve credits ;)
yeah, didn't know the tag "Suggested-by:" before.
Thanks. :D
>
> Acked-by: Eric Dumazet <edumazet@google.com>
>
> Thanks.
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag
2016-04-19 7:10 [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag Xin Long
` (2 preceding siblings ...)
2016-04-19 12:25 ` Eric Dumazet
@ 2016-04-21 17:56 ` David Miller
3 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-04-21 17:56 UTC (permalink / raw)
To: lucien.xin
Cc: netdev, linux-sctp, marcelo.leitner, vyasevich, daniel,
eric.dumazet, jsitnick
From: Xin Long <lucien.xin@gmail.com>
Date: Tue, 19 Apr 2016 15:10:01 +0800
> EXPIRES_IN_MS macro comes from net/ipv4/inet_diag.c and dates
> back to before jiffies_to_msecs() has been introduced.
>
> Now we can remove it and use jiffies_to_msecs().
>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-21 17:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-19 7:10 [PATCHv3 net-next] net: use jiffies_to_msecs to replace EXPIRES_IN_MS in inet/sctp_diag Xin Long
2016-04-19 9:13 ` Jakub Sitnicki
2016-04-19 11:59 ` Marcelo Ricardo Leitner
2016-04-19 12:25 ` Eric Dumazet
2016-04-19 12:37 ` Xin Long
2016-04-21 17:56 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).