devlink: Add extack for eswitch operations
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / eswitch_offloads.c
index 3028e8d90920e2940cc3247775bd7a498fd906ef..eee34ffcf2428141da42c3a60ec265c114399986 100644 (file)
@@ -775,10 +775,10 @@ static void esw_destroy_vport_rx_group(struct mlx5_eswitch *esw)
 }
 
 struct mlx5_flow_handle *
-mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport, u32 tirn)
+mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport,
+                                 struct mlx5_flow_destination *dest)
 {
        struct mlx5_flow_act flow_act = {0};
-       struct mlx5_flow_destination dest = {};
        struct mlx5_flow_handle *flow_rule;
        struct mlx5_flow_spec *spec;
        void *misc;
@@ -796,12 +796,10 @@ mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport, u32 tirn)
        MLX5_SET_TO_ONES(fte_match_set_misc, misc, source_port);
 
        spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS;
-       dest.type = MLX5_FLOW_DESTINATION_TYPE_TIR;
-       dest.tir_num = tirn;
 
        flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
        flow_rule = mlx5_add_flow_rules(esw->offloads.ft_offloads, spec,
-                                       &flow_act, &dest, 1);
+                                       &flow_act, dest, 1);
        if (IS_ERR(flow_rule)) {
                esw_warn(esw->dev, "fs offloads: Failed to add vport rx rule err %ld\n", PTR_ERR(flow_rule));
                goto out;
@@ -812,7 +810,8 @@ out:
        return flow_rule;
 }
 
-static int esw_offloads_start(struct mlx5_eswitch *esw)
+static int esw_offloads_start(struct mlx5_eswitch *esw,
+                             struct netlink_ext_ack *extack)
 {
        int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs;
 
@@ -975,7 +974,8 @@ create_ft_err:
        return err;
 }
 
-static int esw_offloads_stop(struct mlx5_eswitch *esw)
+static int esw_offloads_stop(struct mlx5_eswitch *esw,
+                            struct netlink_ext_ack *extack)
 {
        int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs;
 
@@ -1094,7 +1094,8 @@ static int mlx5_devlink_eswitch_check(struct devlink *devlink)
        return 0;
 }
 
-int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode)
+int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
+                                 struct netlink_ext_ack *extack)
 {
        struct mlx5_core_dev *dev = devlink_priv(devlink);
        u16 cur_mlx5_mode, mlx5_mode = 0;
@@ -1113,9 +1114,9 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode)
                return 0;
 
        if (mode == DEVLINK_ESWITCH_MODE_SWITCHDEV)
-               return esw_offloads_start(dev->priv.eswitch);
+               return esw_offloads_start(dev->priv.eswitch, extack);
        else if (mode == DEVLINK_ESWITCH_MODE_LEGACY)
-               return esw_offloads_stop(dev->priv.eswitch);
+               return esw_offloads_stop(dev->priv.eswitch, extack);
        else
                return -EINVAL;
 }
@@ -1132,7 +1133,8 @@ int mlx5_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode)
        return esw_mode_to_devlink(dev->priv.eswitch->mode, mode);
 }
 
-int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode)
+int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,
+                                        struct netlink_ext_ack *extack)
 {
        struct mlx5_core_dev *dev = devlink_priv(devlink);
        struct mlx5_eswitch *esw = dev->priv.eswitch;
@@ -1234,7 +1236,8 @@ out:
        return 0;
 }
 
-int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8 encap)
+int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8 encap,
+                                       struct netlink_ext_ack *extack)
 {
        struct mlx5_core_dev *dev = devlink_priv(devlink);
        struct mlx5_eswitch *esw = dev->priv.eswitch;