linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx5:using swap() instead of tmp variable
@ 2021-11-03  6:21 Yihao Han
  2021-11-03  6:57 ` Roi Dayan
  0 siblings, 1 reply; 4+ messages in thread
From: Yihao Han @ 2021-11-03  6:21 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, David S. Miller, Jakub Kicinski,
	Roi Dayan, Paul Blakey, Oz Shlomo, Ariel Levkovich, Vlad Buslov,
	Chris Mi, netdev, linux-rdma, linux-kernel
  Cc: kernel, Yihao Han

swap() was used instead of the tmp variable to swap values

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
index 740cd6f088b8..d4b4f32603f2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
@@ -907,12 +907,9 @@ mlx5_tc_ct_shared_counter_get(struct mlx5_tc_ct_priv *ct_priv,
 	struct mlx5_ct_tuple rev_tuple = entry->tuple;
 	struct mlx5_ct_counter *shared_counter;
 	struct mlx5_ct_entry *rev_entry;
-	__be16 tmp_port;
 
 	/* get the reversed tuple */
-	tmp_port = rev_tuple.port.src;
-	rev_tuple.port.src = rev_tuple.port.dst;
-	rev_tuple.port.dst = tmp_port;
+	swap(rev_tuple.port.src, rev_tuple.port.dst);
 
 	if (rev_tuple.addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
 		__be32 tmp_addr = rev_tuple.ip.src_v4;
-- 
2.17.1


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

* Re: [PATCH] net/mlx5:using swap() instead of tmp variable
  2021-11-03  6:21 [PATCH] net/mlx5:using swap() instead of tmp variable Yihao Han
@ 2021-11-03  6:57 ` Roi Dayan
  2021-11-03 19:33   ` Saeed Mahameed
  2021-11-16 20:55   ` Saeed Mahameed
  0 siblings, 2 replies; 4+ messages in thread
From: Roi Dayan @ 2021-11-03  6:57 UTC (permalink / raw)
  To: Yihao Han, Saeed Mahameed, Leon Romanovsky, David S. Miller,
	Jakub Kicinski, Paul Blakey, Oz Shlomo, Ariel Levkovich,
	Vlad Buslov, Chris Mi, netdev, linux-rdma, linux-kernel
  Cc: kernel



On 2021-11-03 8:21 AM, Yihao Han wrote:
> swap() was used instead of the tmp variable to swap values
> 
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> index 740cd6f088b8..d4b4f32603f2 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> @@ -907,12 +907,9 @@ mlx5_tc_ct_shared_counter_get(struct mlx5_tc_ct_priv *ct_priv,
>   	struct mlx5_ct_tuple rev_tuple = entry->tuple;
>   	struct mlx5_ct_counter *shared_counter;
>   	struct mlx5_ct_entry *rev_entry;
> -	__be16 tmp_port;
>   
>   	/* get the reversed tuple */
> -	tmp_port = rev_tuple.port.src;
> -	rev_tuple.port.src = rev_tuple.port.dst;
> -	rev_tuple.port.dst = tmp_port;
> +	swap(rev_tuple.port.src, rev_tuple.port.dst);
>   
>   	if (rev_tuple.addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
>   		__be32 tmp_addr = rev_tuple.ip.src_v4;
> 


just small comment on the title.
missing a space in the commit title after the colon.
I also think the prefix should be "net/mlx5e: CT, ..."

Reviewed-by: Roi Dayan <roid@nvidia.com>

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

* Re: [PATCH] net/mlx5:using swap() instead of tmp variable
  2021-11-03  6:57 ` Roi Dayan
@ 2021-11-03 19:33   ` Saeed Mahameed
  2021-11-16 20:55   ` Saeed Mahameed
  1 sibling, 0 replies; 4+ messages in thread
From: Saeed Mahameed @ 2021-11-03 19:33 UTC (permalink / raw)
  To: linux-rdma, Oz Shlomo, Roi Dayan, Ariel Levkovich, Paul Blakey,
	Vlad Buslov, linux-kernel, davem, kuba, netdev, leon, hanyihao,
	Chris Mi
  Cc: kernel

On Wed, 2021-11-03 at 08:57 +0200, Roi Dayan wrote:
> 
> 
> On 2021-11-03 8:21 AM, Yihao Han wrote:
> > swap() was used instead of the tmp variable to swap values
> > 
> > Signed-off-by: Yihao Han <hanyihao@vivo.com>
> > ---
> >   drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 5 +----
> >   1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> > index 740cd6f088b8..d4b4f32603f2 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> > @@ -907,12 +907,9 @@ mlx5_tc_ct_shared_counter_get(struct
> > mlx5_tc_ct_priv *ct_priv,
> >         struct mlx5_ct_tuple rev_tuple = entry->tuple;
> >         struct mlx5_ct_counter *shared_counter;
> >         struct mlx5_ct_entry *rev_entry;
> > -       __be16 tmp_port;
> >   
> >         /* get the reversed tuple */
> > -       tmp_port = rev_tuple.port.src;
> > -       rev_tuple.port.src = rev_tuple.port.dst;
> > -       rev_tuple.port.dst = tmp_port;
> > +       swap(rev_tuple.port.src, rev_tuple.port.dst);
> >   
> >         if (rev_tuple.addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
> >                 __be32 tmp_addr = rev_tuple.ip.src_v4;
> > 
> 
> 
> just small comment on the title.
> missing a space in the commit title after the colon.
> I also think the prefix should be "net/mlx5e: CT, ..."
> 
> Reviewed-by: Roi Dayan <roid@nvidia.com>

Fixed-up the commit message and applied to net-next-mlx5

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

* Re: [PATCH] net/mlx5:using swap() instead of tmp variable
  2021-11-03  6:57 ` Roi Dayan
  2021-11-03 19:33   ` Saeed Mahameed
@ 2021-11-16 20:55   ` Saeed Mahameed
  1 sibling, 0 replies; 4+ messages in thread
From: Saeed Mahameed @ 2021-11-16 20:55 UTC (permalink / raw)
  To: linux-rdma, Oz Shlomo, Roi Dayan, Ariel Levkovich, Paul Blakey,
	Vlad Buslov, linux-kernel, davem, kuba, netdev, leon, hanyihao,
	Chris Mi
  Cc: kernel

On Wed, 2021-11-03 at 08:57 +0200, Roi Dayan wrote:
> 
> 
> On 2021-11-03 8:21 AM, Yihao Han wrote:
> > swap() was used instead of the tmp variable to swap values
> > 
> > Signed-off-by: Yihao Han <hanyihao@vivo.com>
> > ---
> >   drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 5 +----
> >   1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> > index 740cd6f088b8..d4b4f32603f2 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> > @@ -907,12 +907,9 @@ mlx5_tc_ct_shared_counter_get(struct
> > mlx5_tc_ct_priv *ct_priv,
> >         struct mlx5_ct_tuple rev_tuple = entry->tuple;
> >         struct mlx5_ct_counter *shared_counter;
> >         struct mlx5_ct_entry *rev_entry;
> > -       __be16 tmp_port;
> >   
> >         /* get the reversed tuple */
> > -       tmp_port = rev_tuple.port.src;
> > -       rev_tuple.port.src = rev_tuple.port.dst;
> > -       rev_tuple.port.dst = tmp_port;
> > +       swap(rev_tuple.port.src, rev_tuple.port.dst);
> >   
> >         if (rev_tuple.addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
> >                 __be32 tmp_addr = rev_tuple.ip.src_v4;
> > 
> 
> 
> just small comment on the title.
> missing a space in the commit title after the colon.
> I also think the prefix should be "net/mlx5e: CT, ..."
> 
> Reviewed-by: Roi Dayan <roid@nvidia.com>

Fixed up and applied to net-next-mlx5.


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

end of thread, other threads:[~2021-11-16 20:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03  6:21 [PATCH] net/mlx5:using swap() instead of tmp variable Yihao Han
2021-11-03  6:57 ` Roi Dayan
2021-11-03 19:33   ` Saeed Mahameed
2021-11-16 20:55   ` Saeed Mahameed

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