Skip to content

Commit 1a8552b

Browse files
hadarhenzionSaeed Mahameed
authored andcommitted
net/mlx5e: Remove output device parameter from create encap header helpers definition
Passing output device parameter to the helper functions that deal with creation of encapsulation headers is redundant. Output device parameter can be defined inside those helpers, no need to pass it. Refactor the code by removing the parameter from the function signature. This patch doesn't change any functionality. Signed-off-by: Hadar Hen Zion <[email protected]> Reviewed-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent c1ae115 commit 1a8552b

File tree

1 file changed

+14
-15
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+14
-15
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,12 +1211,12 @@ static void gen_vxlan_header_ipv6(struct net_device *out_dev,
12111211

12121212
static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
12131213
struct net_device *mirred_dev,
1214-
struct mlx5e_encap_entry *e,
1215-
struct net_device **out_dev)
1214+
struct mlx5e_encap_entry *e)
12161215
{
12171216
int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size);
12181217
int ipv4_encap_size = ETH_HLEN + sizeof(struct iphdr) + VXLAN_HLEN;
12191218
struct ip_tunnel_key *tun_key = &e->tun_info.key;
1219+
struct net_device *out_dev;
12201220
struct neighbour *n = NULL;
12211221
struct flowi4 fl4 = {};
12221222
char *encap_header;
@@ -1245,7 +1245,7 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
12451245
fl4.daddr = tun_key->u.ipv4.dst;
12461246
fl4.saddr = tun_key->u.ipv4.src;
12471247

1248-
err = mlx5e_route_lookup_ipv4(priv, mirred_dev, out_dev,
1248+
err = mlx5e_route_lookup_ipv4(priv, mirred_dev, &out_dev,
12491249
&fl4, &n, &ttl);
12501250
if (err)
12511251
goto out;
@@ -1257,13 +1257,13 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
12571257
}
12581258

12591259
e->n = n;
1260-
e->out_dev = *out_dev;
1260+
e->out_dev = out_dev;
12611261

1262-
neigh_ha_snapshot(e->h_dest, n, *out_dev);
1262+
neigh_ha_snapshot(e->h_dest, n, out_dev);
12631263

12641264
switch (e->tunnel_type) {
12651265
case MLX5_HEADER_TYPE_VXLAN:
1266-
gen_vxlan_header_ipv4(*out_dev, encap_header,
1266+
gen_vxlan_header_ipv4(out_dev, encap_header,
12671267
ipv4_encap_size, e->h_dest, ttl,
12681268
fl4.daddr,
12691269
fl4.saddr, tun_key->tp_dst,
@@ -1285,12 +1285,12 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
12851285

12861286
static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
12871287
struct net_device *mirred_dev,
1288-
struct mlx5e_encap_entry *e,
1289-
struct net_device **out_dev)
1288+
struct mlx5e_encap_entry *e)
12901289
{
12911290
int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size);
12921291
int ipv6_encap_size = ETH_HLEN + sizeof(struct ipv6hdr) + VXLAN_HLEN;
12931292
struct ip_tunnel_key *tun_key = &e->tun_info.key;
1293+
struct net_device *out_dev;
12941294
struct neighbour *n = NULL;
12951295
struct flowi6 fl6 = {};
12961296
char *encap_header;
@@ -1320,7 +1320,7 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
13201320
fl6.daddr = tun_key->u.ipv6.dst;
13211321
fl6.saddr = tun_key->u.ipv6.src;
13221322

1323-
err = mlx5e_route_lookup_ipv6(priv, mirred_dev, out_dev,
1323+
err = mlx5e_route_lookup_ipv6(priv, mirred_dev, &out_dev,
13241324
&fl6, &n, &ttl);
13251325
if (err)
13261326
goto out;
@@ -1332,13 +1332,13 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
13321332
}
13331333

13341334
e->n = n;
1335-
e->out_dev = *out_dev;
1335+
e->out_dev = out_dev;
13361336

1337-
neigh_ha_snapshot(e->h_dest, n, *out_dev);
1337+
neigh_ha_snapshot(e->h_dest, n, out_dev);
13381338

13391339
switch (e->tunnel_type) {
13401340
case MLX5_HEADER_TYPE_VXLAN:
1341-
gen_vxlan_header_ipv6(*out_dev, encap_header,
1341+
gen_vxlan_header_ipv6(out_dev, encap_header,
13421342
ipv6_encap_size, e->h_dest, ttl,
13431343
&fl6.daddr,
13441344
&fl6.saddr, tun_key->tp_dst,
@@ -1371,7 +1371,6 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
13711371
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
13721372
struct ip_tunnel_key *key = &tun_info->key;
13731373
struct mlx5e_encap_entry *e;
1374-
struct net_device *out_dev;
13751374
int tunnel_type, err = 0;
13761375
uintptr_t hash_key;
13771376
bool found = false;
@@ -1419,9 +1418,9 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
14191418
INIT_LIST_HEAD(&e->flows);
14201419

14211420
if (family == AF_INET)
1422-
err = mlx5e_create_encap_header_ipv4(priv, mirred_dev, e, &out_dev);
1421+
err = mlx5e_create_encap_header_ipv4(priv, mirred_dev, e);
14231422
else if (family == AF_INET6)
1424-
err = mlx5e_create_encap_header_ipv6(priv, mirred_dev, e, &out_dev);
1423+
err = mlx5e_create_encap_header_ipv6(priv, mirred_dev, e);
14251424

14261425
if (err)
14271426
goto out_err;

0 commit comments

Comments
 (0)