Commit 5a6f8aef authored by Achiad Shochat's avatar Achiad Shochat Committed by David S. Miller

net/mlx5e: Cosmetics: use BIT() instead of "1 <<", and others

No logical change in this commit.
Signed-off-by: default avatarAchiad Shochat <achiad@mellanox.com>
Signed-off-by: default avatarAmir Vadai <amirv@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 88a85f99
...@@ -330,14 +330,14 @@ struct mlx5e_channel { ...@@ -330,14 +330,14 @@ struct mlx5e_channel {
}; };
enum mlx5e_traffic_types { enum mlx5e_traffic_types {
MLX5E_TT_IPV4_TCP = 0, MLX5E_TT_IPV4_TCP,
MLX5E_TT_IPV6_TCP = 1, MLX5E_TT_IPV6_TCP,
MLX5E_TT_IPV4_UDP = 2, MLX5E_TT_IPV4_UDP,
MLX5E_TT_IPV6_UDP = 3, MLX5E_TT_IPV6_UDP,
MLX5E_TT_IPV4 = 4, MLX5E_TT_IPV4,
MLX5E_TT_IPV6 = 5, MLX5E_TT_IPV6,
MLX5E_TT_ANY = 6, MLX5E_TT_ANY,
MLX5E_NUM_TT = 7, MLX5E_NUM_TT,
}; };
enum { enum {
......
...@@ -105,25 +105,25 @@ static void mlx5e_del_eth_addr_from_flow_table(struct mlx5e_priv *priv, ...@@ -105,25 +105,25 @@ static void mlx5e_del_eth_addr_from_flow_table(struct mlx5e_priv *priv,
{ {
void *ft = priv->ft.main; void *ft = priv->ft.main;
if (ai->tt_vec & (1 << MLX5E_TT_IPV6_TCP)) if (ai->tt_vec & BIT(MLX5E_TT_IPV6_TCP))
mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV6_TCP]); mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV6_TCP]);
if (ai->tt_vec & (1 << MLX5E_TT_IPV4_TCP)) if (ai->tt_vec & BIT(MLX5E_TT_IPV4_TCP))
mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV4_TCP]); mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV4_TCP]);
if (ai->tt_vec & (1 << MLX5E_TT_IPV6_UDP)) if (ai->tt_vec & BIT(MLX5E_TT_IPV6_UDP))
mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV6_UDP]); mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV6_UDP]);
if (ai->tt_vec & (1 << MLX5E_TT_IPV4_UDP)) if (ai->tt_vec & BIT(MLX5E_TT_IPV4_UDP))
mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV4_UDP]); mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV4_UDP]);
if (ai->tt_vec & (1 << MLX5E_TT_IPV6)) if (ai->tt_vec & BIT(MLX5E_TT_IPV6))
mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV6]); mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV6]);
if (ai->tt_vec & (1 << MLX5E_TT_IPV4)) if (ai->tt_vec & BIT(MLX5E_TT_IPV4))
mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV4]); mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_IPV4]);
if (ai->tt_vec & (1 << MLX5E_TT_ANY)) if (ai->tt_vec & BIT(MLX5E_TT_ANY))
mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_ANY]); mlx5_del_flow_table_entry(ft, ai->ft_ix[MLX5E_TT_ANY]);
} }
...@@ -156,33 +156,33 @@ static u32 mlx5e_get_tt_vec(struct mlx5e_eth_addr_info *ai, int type) ...@@ -156,33 +156,33 @@ static u32 mlx5e_get_tt_vec(struct mlx5e_eth_addr_info *ai, int type)
switch (eth_addr_type) { switch (eth_addr_type) {
case MLX5E_UC: case MLX5E_UC:
ret = ret =
(1 << MLX5E_TT_IPV4_TCP) | BIT(MLX5E_TT_IPV4_TCP) |
(1 << MLX5E_TT_IPV6_TCP) | BIT(MLX5E_TT_IPV6_TCP) |
(1 << MLX5E_TT_IPV4_UDP) | BIT(MLX5E_TT_IPV4_UDP) |
(1 << MLX5E_TT_IPV6_UDP) | BIT(MLX5E_TT_IPV6_UDP) |
(1 << MLX5E_TT_IPV4) | BIT(MLX5E_TT_IPV4) |
(1 << MLX5E_TT_IPV6) | BIT(MLX5E_TT_IPV6) |
(1 << MLX5E_TT_ANY) | BIT(MLX5E_TT_ANY) |
0; 0;
break; break;
case MLX5E_MC_IPV4: case MLX5E_MC_IPV4:
ret = ret =
(1 << MLX5E_TT_IPV4_UDP) | BIT(MLX5E_TT_IPV4_UDP) |
(1 << MLX5E_TT_IPV4) | BIT(MLX5E_TT_IPV4) |
0; 0;
break; break;
case MLX5E_MC_IPV6: case MLX5E_MC_IPV6:
ret = ret =
(1 << MLX5E_TT_IPV6_UDP) | BIT(MLX5E_TT_IPV6_UDP) |
(1 << MLX5E_TT_IPV6) | BIT(MLX5E_TT_IPV6) |
0; 0;
break; break;
case MLX5E_MC_OTHER: case MLX5E_MC_OTHER:
ret = ret =
(1 << MLX5E_TT_ANY) | BIT(MLX5E_TT_ANY) |
0; 0;
break; break;
} }
...@@ -191,23 +191,23 @@ static u32 mlx5e_get_tt_vec(struct mlx5e_eth_addr_info *ai, int type) ...@@ -191,23 +191,23 @@ static u32 mlx5e_get_tt_vec(struct mlx5e_eth_addr_info *ai, int type)
case MLX5E_ALLMULTI: case MLX5E_ALLMULTI:
ret = ret =
(1 << MLX5E_TT_IPV4_UDP) | BIT(MLX5E_TT_IPV4_UDP) |
(1 << MLX5E_TT_IPV6_UDP) | BIT(MLX5E_TT_IPV6_UDP) |
(1 << MLX5E_TT_IPV4) | BIT(MLX5E_TT_IPV4) |
(1 << MLX5E_TT_IPV6) | BIT(MLX5E_TT_IPV6) |
(1 << MLX5E_TT_ANY) | BIT(MLX5E_TT_ANY) |
0; 0;
break; break;
default: /* MLX5E_PROMISC */ default: /* MLX5E_PROMISC */
ret = ret =
(1 << MLX5E_TT_IPV4_TCP) | BIT(MLX5E_TT_IPV4_TCP) |
(1 << MLX5E_TT_IPV6_TCP) | BIT(MLX5E_TT_IPV6_TCP) |
(1 << MLX5E_TT_IPV4_UDP) | BIT(MLX5E_TT_IPV4_UDP) |
(1 << MLX5E_TT_IPV6_UDP) | BIT(MLX5E_TT_IPV6_UDP) |
(1 << MLX5E_TT_IPV4) | BIT(MLX5E_TT_IPV4) |
(1 << MLX5E_TT_IPV6) | BIT(MLX5E_TT_IPV6) |
(1 << MLX5E_TT_ANY) | BIT(MLX5E_TT_ANY) |
0; 0;
break; break;
} }
...@@ -226,6 +226,7 @@ static int __mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv, ...@@ -226,6 +226,7 @@ static int __mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv,
u8 *match_criteria_dmac; u8 *match_criteria_dmac;
void *ft = priv->ft.main; void *ft = priv->ft.main;
u32 *tirn = priv->tirn; u32 *tirn = priv->tirn;
u32 *ft_ix;
u32 tt_vec; u32 tt_vec;
int err; int err;
...@@ -261,51 +262,51 @@ static int __mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv, ...@@ -261,51 +262,51 @@ static int __mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv,
tt_vec = mlx5e_get_tt_vec(ai, type); tt_vec = mlx5e_get_tt_vec(ai, type);
if (tt_vec & (1 << MLX5E_TT_ANY)) { ft_ix = &ai->ft_ix[MLX5E_TT_ANY];
if (tt_vec & BIT(MLX5E_TT_ANY)) {
MLX5_SET(dest_format_struct, dest, destination_id, MLX5_SET(dest_format_struct, dest, destination_id,
tirn[MLX5E_TT_ANY]); tirn[MLX5E_TT_ANY]);
err = mlx5_add_flow_table_entry(ft, match_criteria_enable, err = mlx5_add_flow_table_entry(ft, match_criteria_enable,
match_criteria, flow_context, match_criteria, flow_context,
&ai->ft_ix[MLX5E_TT_ANY]); ft_ix);
if (err) { if (err)
mlx5e_del_eth_addr_from_flow_table(priv, ai); goto err_del_ai;
return err;
} ai->tt_vec |= BIT(MLX5E_TT_ANY);
ai->tt_vec |= (1 << MLX5E_TT_ANY);
} }
match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
MLX5_SET_TO_ONES(fte_match_param, match_criteria, MLX5_SET_TO_ONES(fte_match_param, match_criteria,
outer_headers.ethertype); outer_headers.ethertype);
if (tt_vec & (1 << MLX5E_TT_IPV4)) { ft_ix = &ai->ft_ix[MLX5E_TT_IPV4];
if (tt_vec & BIT(MLX5E_TT_IPV4)) {
MLX5_SET(fte_match_param, match_value, outer_headers.ethertype, MLX5_SET(fte_match_param, match_value, outer_headers.ethertype,
ETH_P_IP); ETH_P_IP);
MLX5_SET(dest_format_struct, dest, destination_id, MLX5_SET(dest_format_struct, dest, destination_id,
tirn[MLX5E_TT_IPV4]); tirn[MLX5E_TT_IPV4]);
err = mlx5_add_flow_table_entry(ft, match_criteria_enable, err = mlx5_add_flow_table_entry(ft, match_criteria_enable,
match_criteria, flow_context, match_criteria, flow_context,
&ai->ft_ix[MLX5E_TT_IPV4]); ft_ix);
if (err) { if (err)
mlx5e_del_eth_addr_from_flow_table(priv, ai); goto err_del_ai;
return err;
} ai->tt_vec |= BIT(MLX5E_TT_IPV4);
ai->tt_vec |= (1 << MLX5E_TT_IPV4);
} }
if (tt_vec & (1 << MLX5E_TT_IPV6)) { ft_ix = &ai->ft_ix[MLX5E_TT_IPV6];
if (tt_vec & BIT(MLX5E_TT_IPV6)) {
MLX5_SET(fte_match_param, match_value, outer_headers.ethertype, MLX5_SET(fte_match_param, match_value, outer_headers.ethertype,
ETH_P_IPV6); ETH_P_IPV6);
MLX5_SET(dest_format_struct, dest, destination_id, MLX5_SET(dest_format_struct, dest, destination_id,
tirn[MLX5E_TT_IPV6]); tirn[MLX5E_TT_IPV6]);
err = mlx5_add_flow_table_entry(ft, match_criteria_enable, err = mlx5_add_flow_table_entry(ft, match_criteria_enable,
match_criteria, flow_context, match_criteria, flow_context,
&ai->ft_ix[MLX5E_TT_IPV6]); ft_ix);
if (err) { if (err)
mlx5e_del_eth_addr_from_flow_table(priv, ai); goto err_del_ai;
return err;
} ai->tt_vec |= BIT(MLX5E_TT_IPV6);
ai->tt_vec |= (1 << MLX5E_TT_IPV6);
} }
MLX5_SET_TO_ONES(fte_match_param, match_criteria, MLX5_SET_TO_ONES(fte_match_param, match_criteria,
...@@ -313,70 +314,75 @@ static int __mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv, ...@@ -313,70 +314,75 @@ static int __mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv,
MLX5_SET(fte_match_param, match_value, outer_headers.ip_protocol, MLX5_SET(fte_match_param, match_value, outer_headers.ip_protocol,
IPPROTO_UDP); IPPROTO_UDP);
if (tt_vec & (1 << MLX5E_TT_IPV4_UDP)) { ft_ix = &ai->ft_ix[MLX5E_TT_IPV4_UDP];
if (tt_vec & BIT(MLX5E_TT_IPV4_UDP)) {
MLX5_SET(fte_match_param, match_value, outer_headers.ethertype, MLX5_SET(fte_match_param, match_value, outer_headers.ethertype,
ETH_P_IP); ETH_P_IP);
MLX5_SET(dest_format_struct, dest, destination_id, MLX5_SET(dest_format_struct, dest, destination_id,
tirn[MLX5E_TT_IPV4_UDP]); tirn[MLX5E_TT_IPV4_UDP]);
err = mlx5_add_flow_table_entry(ft, match_criteria_enable, err = mlx5_add_flow_table_entry(ft, match_criteria_enable,
match_criteria, flow_context, match_criteria, flow_context,
&ai->ft_ix[MLX5E_TT_IPV4_UDP]); ft_ix);
if (err) { if (err)
mlx5e_del_eth_addr_from_flow_table(priv, ai); goto err_del_ai;
return err;
} ai->tt_vec |= BIT(MLX5E_TT_IPV4_UDP);
ai->tt_vec |= (1 << MLX5E_TT_IPV4_UDP);
} }
if (tt_vec & (1 << MLX5E_TT_IPV6_UDP)) { ft_ix = &ai->ft_ix[MLX5E_TT_IPV6_UDP];
if (tt_vec & BIT(MLX5E_TT_IPV6_UDP)) {
MLX5_SET(fte_match_param, match_value, outer_headers.ethertype, MLX5_SET(fte_match_param, match_value, outer_headers.ethertype,
ETH_P_IPV6); ETH_P_IPV6);
MLX5_SET(dest_format_struct, dest, destination_id, MLX5_SET(dest_format_struct, dest, destination_id,
tirn[MLX5E_TT_IPV6_UDP]); tirn[MLX5E_TT_IPV6_UDP]);
err = mlx5_add_flow_table_entry(ft, match_criteria_enable, err = mlx5_add_flow_table_entry(ft, match_criteria_enable,
match_criteria, flow_context, match_criteria, flow_context,
&ai->ft_ix[MLX5E_TT_IPV6_UDP]); ft_ix);
if (err) { if (err)
mlx5e_del_eth_addr_from_flow_table(priv, ai); goto err_del_ai;
return err;
} ai->tt_vec |= BIT(MLX5E_TT_IPV6_UDP);
ai->tt_vec |= (1 << MLX5E_TT_IPV6_UDP);
} }
MLX5_SET(fte_match_param, match_value, outer_headers.ip_protocol, MLX5_SET(fte_match_param, match_value, outer_headers.ip_protocol,
IPPROTO_TCP); IPPROTO_TCP);
if (tt_vec & (1 << MLX5E_TT_IPV4_TCP)) { ft_ix = &ai->ft_ix[MLX5E_TT_IPV4_TCP];
if (tt_vec & BIT(MLX5E_TT_IPV4_TCP)) {
MLX5_SET(fte_match_param, match_value, outer_headers.ethertype, MLX5_SET(fte_match_param, match_value, outer_headers.ethertype,
ETH_P_IP); ETH_P_IP);
MLX5_SET(dest_format_struct, dest, destination_id, MLX5_SET(dest_format_struct, dest, destination_id,
tirn[MLX5E_TT_IPV4_TCP]); tirn[MLX5E_TT_IPV4_TCP]);
err = mlx5_add_flow_table_entry(ft, match_criteria_enable, err = mlx5_add_flow_table_entry(ft, match_criteria_enable,
match_criteria, flow_context, match_criteria, flow_context,
&ai->ft_ix[MLX5E_TT_IPV4_TCP]); ft_ix);
if (err) { if (err)
mlx5e_del_eth_addr_from_flow_table(priv, ai); goto err_del_ai;
return err;
} ai->tt_vec |= BIT(MLX5E_TT_IPV4_TCP);
ai->tt_vec |= (1 << MLX5E_TT_IPV4_TCP);
} }
if (tt_vec & (1 << MLX5E_TT_IPV6_TCP)) { ft_ix = &ai->ft_ix[MLX5E_TT_IPV6_TCP];
if (tt_vec & BIT(MLX5E_TT_IPV6_TCP)) {
MLX5_SET(fte_match_param, match_value, outer_headers.ethertype, MLX5_SET(fte_match_param, match_value, outer_headers.ethertype,
ETH_P_IPV6); ETH_P_IPV6);
MLX5_SET(dest_format_struct, dest, destination_id, MLX5_SET(dest_format_struct, dest, destination_id,
tirn[MLX5E_TT_IPV6_TCP]); tirn[MLX5E_TT_IPV6_TCP]);
err = mlx5_add_flow_table_entry(ft, match_criteria_enable, err = mlx5_add_flow_table_entry(ft, match_criteria_enable,
match_criteria, flow_context, match_criteria, flow_context,
&ai->ft_ix[MLX5E_TT_IPV6_TCP]); ft_ix);
if (err) { if (err)
mlx5e_del_eth_addr_from_flow_table(priv, ai); goto err_del_ai;
return err;
} ai->tt_vec |= BIT(MLX5E_TT_IPV6_TCP);
ai->tt_vec |= (1 << MLX5E_TT_IPV6_TCP);
} }
return 0; return 0;
err_del_ai:
mlx5e_del_eth_addr_from_flow_table(priv, ai);
return err;
} }
static int mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv, static int mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv,
......
...@@ -1252,13 +1252,13 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt) ...@@ -1252,13 +1252,13 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt)
#define ROUGH_MAX_L2_L3_HDR_SZ 256 #define ROUGH_MAX_L2_L3_HDR_SZ 256
#define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\ #define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\
MLX5_HASH_FIELD_SEL_DST_IP) MLX5_HASH_FIELD_SEL_DST_IP)
#define MLX5_HASH_ALL (MLX5_HASH_FIELD_SEL_SRC_IP |\ #define MLX5_HASH_IP_L4PORTS (MLX5_HASH_FIELD_SEL_SRC_IP |\
MLX5_HASH_FIELD_SEL_DST_IP |\ MLX5_HASH_FIELD_SEL_DST_IP |\
MLX5_HASH_FIELD_SEL_L4_SPORT |\ MLX5_HASH_FIELD_SEL_L4_SPORT |\
MLX5_HASH_FIELD_SEL_L4_DPORT) MLX5_HASH_FIELD_SEL_L4_DPORT)
if (priv->params.lro_en) { if (priv->params.lro_en) {
MLX5_SET(tirc, tirc, lro_enable_mask, MLX5_SET(tirc, tirc, lro_enable_mask,
...@@ -1305,7 +1305,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt) ...@@ -1305,7 +1305,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt)
MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
MLX5_L4_PROT_TYPE_TCP); MLX5_L4_PROT_TYPE_TCP);
MLX5_SET(rx_hash_field_select, hfso, selected_fields, MLX5_SET(rx_hash_field_select, hfso, selected_fields,
MLX5_HASH_ALL); MLX5_HASH_IP_L4PORTS);
break; break;
case MLX5E_TT_IPV6_TCP: case MLX5E_TT_IPV6_TCP:
...@@ -1314,7 +1314,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt) ...@@ -1314,7 +1314,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt)
MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
MLX5_L4_PROT_TYPE_TCP); MLX5_L4_PROT_TYPE_TCP);
MLX5_SET(rx_hash_field_select, hfso, selected_fields, MLX5_SET(rx_hash_field_select, hfso, selected_fields,
MLX5_HASH_ALL); MLX5_HASH_IP_L4PORTS);
break; break;
case MLX5E_TT_IPV4_UDP: case MLX5E_TT_IPV4_UDP:
...@@ -1323,7 +1323,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt) ...@@ -1323,7 +1323,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt)
MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
MLX5_L4_PROT_TYPE_UDP); MLX5_L4_PROT_TYPE_UDP);
MLX5_SET(rx_hash_field_select, hfso, selected_fields, MLX5_SET(rx_hash_field_select, hfso, selected_fields,
MLX5_HASH_ALL); MLX5_HASH_IP_L4PORTS);
break; break;
case MLX5E_TT_IPV6_UDP: case MLX5E_TT_IPV6_UDP:
...@@ -1332,7 +1332,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt) ...@@ -1332,7 +1332,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt)
MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
MLX5_L4_PROT_TYPE_UDP); MLX5_L4_PROT_TYPE_UDP);
MLX5_SET(rx_hash_field_select, hfso, selected_fields, MLX5_SET(rx_hash_field_select, hfso, selected_fields,
MLX5_HASH_ALL); MLX5_HASH_IP_L4PORTS);
break; break;
case MLX5E_TT_IPV4: case MLX5E_TT_IPV4:
......
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