]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
net/mlx5: E-Switch, Add support for the sriov offloads mode
[mirror_ubuntu-zesty-kernel.git] / drivers / net / ethernet / mellanox / mlx5 / core / eswitch.h
index fd6800256d4a316cfcb7d49c9f4529355e5d7b8e..2360180c26c29f8043467cfd9aeb9ad47d4ee7e3 100644 (file)
@@ -134,9 +134,24 @@ struct mlx5_l2_table {
 
 struct mlx5_eswitch_fdb {
        void *fdb;
-       struct mlx5_flow_group *addr_grp;
-       struct mlx5_flow_group *allmulti_grp;
-       struct mlx5_flow_group *promisc_grp;
+       union {
+               struct legacy_fdb {
+                       struct mlx5_flow_group *addr_grp;
+                       struct mlx5_flow_group *allmulti_grp;
+                       struct mlx5_flow_group *promisc_grp;
+               } legacy;
+
+               struct offloads_fdb {
+                       struct mlx5_flow_group *send_to_vport_grp;
+                       struct mlx5_flow_group *miss_grp;
+               } offloads;
+       };
+};
+
+enum {
+       SRIOV_NONE,
+       SRIOV_LEGACY,
+       SRIOV_OFFLOADS
 };
 
 struct mlx5_eswitch {
@@ -153,13 +168,14 @@ struct mlx5_eswitch {
         */
        struct mutex            state_lock;
        struct esw_mc_addr      *mc_promisc;
+       int                     mode;
 };
 
 /* E-Switch API */
 int mlx5_eswitch_init(struct mlx5_core_dev *dev);
 void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw);
 void mlx5_eswitch_vport_event(struct mlx5_eswitch *esw, struct mlx5_eqe *eqe);
-int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs);
+int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode);
 void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw);
 int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
                               int vport, u8 mac[ETH_ALEN]);
@@ -177,4 +193,15 @@ int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,
                                 int vport,
                                 struct ifla_vf_stats *vf_stats);
 
+#define MLX5_DEBUG_ESWITCH_MASK BIT(3)
+
+#define esw_info(dev, format, ...)                             \
+       pr_info("(%s): E-Switch: " format, (dev)->priv.name, ##__VA_ARGS__)
+
+#define esw_warn(dev, format, ...)                             \
+       pr_warn("(%s): E-Switch: " format, (dev)->priv.name, ##__VA_ARGS__)
+
+#define esw_debug(dev, format, ...)                            \
+       mlx5_core_dbg_mask(dev, MLX5_DEBUG_ESWITCH_MASK, format, ##__VA_ARGS__)
+
 #endif /* __MLX5_ESWITCH_H__ */