net/mlx5e: Change parse attr struct to accommodate multiple tunnel infos
authorEli Britstein <elibr@mellanox.com>
Sun, 18 Nov 2018 11:16:52 +0000 (13:16 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Tue, 11 Dec 2018 22:52:20 +0000 (14:52 -0800)
Currently the driver can support only a single TC tunnel_set action.
Change the tunnel info fields to arrays, as a pre-step to support
multiple encapsulations for a single flow, with no functional change.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

index 4030462f56dc3f8aaadd4413deb81cf9a50571c5..67b3c6f1aeaeae9c438f8e44e92400dd24acc7b8 100644 (file)
@@ -94,12 +94,12 @@ struct mlx5e_tc_flow {
 };
 
 struct mlx5e_tc_flow_parse_attr {
-       struct ip_tunnel_info tun_info;
+       struct ip_tunnel_info tun_info[MLX5_MAX_FLOW_FWD_VPORTS];
        struct net_device *filter_dev;
        struct mlx5_flow_spec spec;
        int num_mod_hdr_actions;
        void *mod_hdr_actions;
-       int mirred_ifindex;
+       int mirred_ifindex[MLX5_MAX_FLOW_FWD_VPORTS];
 };
 
 #define MLX5E_TC_TABLE_NUM_GROUPS 4
@@ -571,7 +571,7 @@ static int mlx5e_hairpin_flow_add(struct mlx5e_priv *priv,
                                  struct mlx5e_tc_flow_parse_attr *parse_attr,
                                  struct netlink_ext_ack *extack)
 {
-       int peer_ifindex = parse_attr->mirred_ifindex;
+       int peer_ifindex = parse_attr->mirred_ifindex[0];
        struct mlx5_hairpin_params params;
        struct mlx5_core_dev *peer_mdev;
        struct mlx5e_hairpin_entry *hpe;
@@ -933,8 +933,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
                        continue;
 
                out_dev = __dev_get_by_index(dev_net(priv->netdev),
-                                            attr->parse_attr->mirred_ifindex);
-               encap_err = mlx5e_attach_encap(priv, &parse_attr->tun_info,
+                                            attr->parse_attr->mirred_ifindex[0]);
+               encap_err = mlx5e_attach_encap(priv, &parse_attr->tun_info[0],
                                               out_dev, &encap_dev, flow,
                                               extack);
                if (encap_err && encap_err != -EAGAIN) {
@@ -2220,7 +2220,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
 
                        if (priv->netdev->netdev_ops == peer_dev->netdev_ops &&
                            same_hw_devs(priv, netdev_priv(peer_dev))) {
-                               parse_attr->mirred_ifindex = peer_dev->ifindex;
+                               parse_attr->mirred_ifindex[0] = peer_dev->ifindex;
                                flow->flags |= MLX5E_TC_FLOW_HAIRPIN;
                                action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
                                          MLX5_FLOW_CONTEXT_ACTION_COUNT;
@@ -2482,8 +2482,8 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
                                attr->dests[attr->out_count].mdev = out_priv->mdev;
                                attr->out_count++;
                        } else if (encap) {
-                               parse_attr->mirred_ifindex = out_dev->ifindex;
-                               parse_attr->tun_info = *info;
+                               parse_attr->mirred_ifindex[0] = out_dev->ifindex;
+                               parse_attr->tun_info[0] = *info;
                                attr->parse_attr = parse_attr;
                                attr->dests[attr->out_count].flags |=
                                        MLX5_ESW_DEST_ENCAP;