linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipvs: replace atomic_add_return()
@ 2020-11-16  8:01 Yejune Deng
  2020-11-17 20:57 ` Julian Anastasov
  0 siblings, 1 reply; 3+ messages in thread
From: Yejune Deng @ 2020-11-16  8:01 UTC (permalink / raw)
  To: wensong, horms, ja, pablo, kadlec, fw, davem, kuba
  Cc: netdev, lvs-devel, netfilter-devel, linux-kernel, yejune.deng

atomic_inc_return() looks better

Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
---
 net/netfilter/ipvs/ip_vs_core.c | 2 +-
 net/netfilter/ipvs/ip_vs_sync.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index c0b8215..54e086c 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -2137,7 +2137,7 @@ static int ip_vs_in_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb,
 	if (cp->flags & IP_VS_CONN_F_ONE_PACKET)
 		pkts = sysctl_sync_threshold(ipvs);
 	else
-		pkts = atomic_add_return(1, &cp->in_pkts);
+		pkts = atomic_inc_return(&cp->in_pkts);
 
 	if (ipvs->sync_state & IP_VS_STATE_MASTER)
 		ip_vs_sync_conn(ipvs, cp, pkts);
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index 16b4806..9d43277 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -615,7 +615,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
 	cp = cp->control;
 	if (cp) {
 		if (cp->flags & IP_VS_CONN_F_TEMPLATE)
-			pkts = atomic_add_return(1, &cp->in_pkts);
+			pkts = atomic_inc_return(&cp->in_pkts);
 		else
 			pkts = sysctl_sync_threshold(ipvs);
 		ip_vs_sync_conn(ipvs, cp, pkts);
@@ -776,7 +776,7 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
 	if (!cp)
 		return;
 	if (cp->flags & IP_VS_CONN_F_TEMPLATE)
-		pkts = atomic_add_return(1, &cp->in_pkts);
+		pkts = atomic_inc_return(&cp->in_pkts);
 	else
 		pkts = sysctl_sync_threshold(ipvs);
 	goto sloop;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipvs: replace atomic_add_return()
  2020-11-16  8:01 [PATCH] ipvs: replace atomic_add_return() Yejune Deng
@ 2020-11-17 20:57 ` Julian Anastasov
  2020-11-22 12:46   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Anastasov @ 2020-11-17 20:57 UTC (permalink / raw)
  To: Yejune Deng
  Cc: wensong, horms, pablo, kadlec, fw, davem, kuba, netdev,
	lvs-devel, netfilter-devel, linux-kernel


	Hello,

On Mon, 16 Nov 2020, Yejune Deng wrote:

> atomic_inc_return() looks better
> 
> Signed-off-by: Yejune Deng <yejune.deng@gmail.com>

	Looks good to me for -next, thanks!

Acked-by: Julian Anastasov <ja@ssi.bg>

> ---
>  net/netfilter/ipvs/ip_vs_core.c | 2 +-
>  net/netfilter/ipvs/ip_vs_sync.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
> index c0b8215..54e086c 100644
> --- a/net/netfilter/ipvs/ip_vs_core.c
> +++ b/net/netfilter/ipvs/ip_vs_core.c
> @@ -2137,7 +2137,7 @@ static int ip_vs_in_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb,
>  	if (cp->flags & IP_VS_CONN_F_ONE_PACKET)
>  		pkts = sysctl_sync_threshold(ipvs);
>  	else
> -		pkts = atomic_add_return(1, &cp->in_pkts);
> +		pkts = atomic_inc_return(&cp->in_pkts);
>  
>  	if (ipvs->sync_state & IP_VS_STATE_MASTER)
>  		ip_vs_sync_conn(ipvs, cp, pkts);
> diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
> index 16b4806..9d43277 100644
> --- a/net/netfilter/ipvs/ip_vs_sync.c
> +++ b/net/netfilter/ipvs/ip_vs_sync.c
> @@ -615,7 +615,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
>  	cp = cp->control;
>  	if (cp) {
>  		if (cp->flags & IP_VS_CONN_F_TEMPLATE)
> -			pkts = atomic_add_return(1, &cp->in_pkts);
> +			pkts = atomic_inc_return(&cp->in_pkts);
>  		else
>  			pkts = sysctl_sync_threshold(ipvs);
>  		ip_vs_sync_conn(ipvs, cp, pkts);
> @@ -776,7 +776,7 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
>  	if (!cp)
>  		return;
>  	if (cp->flags & IP_VS_CONN_F_TEMPLATE)
> -		pkts = atomic_add_return(1, &cp->in_pkts);
> +		pkts = atomic_inc_return(&cp->in_pkts);
>  	else
>  		pkts = sysctl_sync_threshold(ipvs);
>  	goto sloop;
> -- 
> 1.9.1

Regards

--
Julian Anastasov <ja@ssi.bg>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipvs: replace atomic_add_return()
  2020-11-17 20:57 ` Julian Anastasov
@ 2020-11-22 12:46   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2020-11-22 12:46 UTC (permalink / raw)
  To: Julian Anastasov
  Cc: Yejune Deng, wensong, horms, kadlec, fw, davem, kuba, netdev,
	lvs-devel, netfilter-devel, linux-kernel

On Tue, Nov 17, 2020 at 10:57:52PM +0200, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Mon, 16 Nov 2020, Yejune Deng wrote:
> 
> > atomic_inc_return() looks better
> > 
> > Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
> 
> 	Looks good to me for -next, thanks!
> 
> Acked-by: Julian Anastasov <ja@ssi.bg>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-22 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16  8:01 [PATCH] ipvs: replace atomic_add_return() Yejune Deng
2020-11-17 20:57 ` Julian Anastasov
2020-11-22 12:46   ` Pablo Neira Ayuso

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).