Merge tag 'v5.3-rc8' into rdma.git for-next
[linux-2.6-block.git] / drivers / net / ethernet / mellanox / mlx5 / core / eswitch.h
index 04685dbb280cfad006007a070ac0d2414a5fd894..5ec7c6dfb88f0f79adae1034a0898c005583cf07 100644 (file)
@@ -101,6 +101,13 @@ struct mlx5_vport_info {
        bool                    trusted;
 };
 
+/* Vport context events */
+enum mlx5_eswitch_vport_event {
+       MLX5_VPORT_UC_ADDR_CHANGE = BIT(0),
+       MLX5_VPORT_MC_ADDR_CHANGE = BIT(1),
+       MLX5_VPORT_PROMISC_CHANGE = BIT(3),
+};
+
 struct mlx5_vport {
        struct mlx5_core_dev    *dev;
        int                     vport;
@@ -122,7 +129,7 @@ struct mlx5_vport {
        } qos;
 
        bool                    enabled;
-       u16                     enabled_events;
+       enum mlx5_eswitch_vport_event enabled_events;
 };
 
 enum offloads_fdb_flags {
@@ -207,8 +214,11 @@ enum {
 struct mlx5_eswitch {
        struct mlx5_core_dev    *dev;
        struct mlx5_nb          nb;
+       /* legacy data structures */
        struct mlx5_eswitch_fdb fdb_table;
        struct hlist_head       mc_table[MLX5_L2_ADDR_HASH_SIZE];
+       struct esw_mc_addr mc_promisc;
+       /* end of legacy */
        struct workqueue_struct *work_queue;
        struct mlx5_vport       *vports;
        u32 flags;
@@ -218,7 +228,6 @@ struct mlx5_eswitch {
         * and async SRIOV admin state changes
         */
        struct mutex            state_lock;
-       struct esw_mc_addr      mc_promisc;
 
        struct {
                bool            enabled;
@@ -233,8 +242,8 @@ struct mlx5_eswitch {
        struct mlx5_esw_functions esw_funcs;
 };
 
-void esw_offloads_cleanup(struct mlx5_eswitch *esw);
-int esw_offloads_init(struct mlx5_eswitch *esw);
+void esw_offloads_disable(struct mlx5_eswitch *esw);
+int esw_offloads_enable(struct mlx5_eswitch *esw);
 void esw_offloads_cleanup_reps(struct mlx5_eswitch *esw);
 int esw_offloads_init_reps(struct mlx5_eswitch *esw);
 void esw_vport_cleanup_ingress_rules(struct mlx5_eswitch *esw,
@@ -513,6 +522,11 @@ void mlx5e_tc_clean_fdb_peer_flows(struct mlx5_eswitch *esw);
             (vport) = &(esw)->vports[i],               \
             (i) < (esw)->total_vports; (i)++)
 
+#define mlx5_esw_for_all_vports_reverse(esw, i, vport) \
+       for ((i) = (esw)->total_vports - 1;             \
+            (vport) = &(esw)->vports[i],               \
+            (i) >= MLX5_VPORT_PF; (i)--)
+
 #define mlx5_esw_for_each_vf_vport(esw, i, vport, nvfs)        \
        for ((i) = MLX5_VPORT_FIRST_VF;                 \
             (vport) = &(esw)->vports[(i)],             \
@@ -574,6 +588,11 @@ bool mlx5_eswitch_is_vf_vport(const struct mlx5_eswitch *esw, u16 vport_num);
 void mlx5_eswitch_update_num_of_vfs(struct mlx5_eswitch *esw, const int num_vfs);
 int mlx5_esw_funcs_changed_handler(struct notifier_block *nb, unsigned long type, void *data);
 
+void
+mlx5_eswitch_enable_pf_vf_vports(struct mlx5_eswitch *esw,
+                                enum mlx5_eswitch_vport_event enabled_events);
+void mlx5_eswitch_disable_pf_vf_vports(struct mlx5_eswitch *esw);
+
 #else  /* CONFIG_MLX5_ESWITCH */
 /* eswitch API stubs */
 static inline int  mlx5_eswitch_init(struct mlx5_core_dev *dev) { return 0; }