net/mlx5_core: Introduce modify flow table command
authorMaor Gottlieb <maorg@mellanox.com>
Mon, 11 Jan 2016 08:26:00 +0000 (10:26 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Jan 2016 22:48:52 +0000 (17:48 -0500)
Introduce the modify flow table command. This command is used when
we want to change the next flow table of an existing flow table.
The next flow table is defined as the table we search (in order
to find a match), if we couldn't find a match in any of the flow table
entries in the current flow table.

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h
include/linux/mlx5/mlx5_ifc.h

index d8b1195fba3dda53e9029e771828f523ee7b8a87..2b5562553f2d4d6a780fdc19c618f1991b0d7560 100644 (file)
@@ -101,6 +101,33 @@ int mlx5_cmd_destroy_flow_table(struct mlx5_core_dev *dev,
                                          sizeof(out));
 }
 
+int mlx5_cmd_modify_flow_table(struct mlx5_core_dev *dev,
+                              struct mlx5_flow_table *ft,
+                              struct mlx5_flow_table *next_ft)
+{
+       u32 in[MLX5_ST_SZ_DW(modify_flow_table_in)];
+       u32 out[MLX5_ST_SZ_DW(modify_flow_table_out)];
+
+       memset(in, 0, sizeof(in));
+       memset(out, 0, sizeof(out));
+
+       MLX5_SET(modify_flow_table_in, in, opcode,
+                MLX5_CMD_OP_MODIFY_FLOW_TABLE);
+       MLX5_SET(modify_flow_table_in, in, table_type, ft->type);
+       MLX5_SET(modify_flow_table_in, in, table_id, ft->id);
+       MLX5_SET(modify_flow_table_in, in, modify_field_select,
+                MLX5_MODIFY_FLOW_TABLE_MISS_TABLE_ID);
+       if (next_ft) {
+               MLX5_SET(modify_flow_table_in, in, table_miss_mode, 1);
+               MLX5_SET(modify_flow_table_in, in, table_miss_id, next_ft->id);
+       } else {
+               MLX5_SET(modify_flow_table_in, in, table_miss_mode, 0);
+       }
+
+       return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out,
+                                         sizeof(out));
+}
+
 int mlx5_cmd_create_flow_group(struct mlx5_core_dev *dev,
                               struct mlx5_flow_table *ft,
                               u32 *in,
index 70d18ec145c2df07461e6b576643209d5486a931..1ae9b685c78322a103ad1034ff92d085d4d3dc89 100644 (file)
@@ -40,6 +40,10 @@ int mlx5_cmd_create_flow_table(struct mlx5_core_dev *dev,
 int mlx5_cmd_destroy_flow_table(struct mlx5_core_dev *dev,
                                struct mlx5_flow_table *ft);
 
+int mlx5_cmd_modify_flow_table(struct mlx5_core_dev *dev,
+                              struct mlx5_flow_table *ft,
+                              struct mlx5_flow_table *next_ft);
+
 int mlx5_cmd_create_flow_group(struct mlx5_core_dev *dev,
                               struct mlx5_flow_table *ft,
                               u32 *in, unsigned int *group_id);
index 323e713c44ba0202c7d8413bee1b219ac8c36300..7f166955d4c9b442c9c7a42c24798d9c58d7c1b5 100644 (file)
@@ -194,7 +194,8 @@ enum {
        MLX5_CMD_OP_QUERY_FLOW_GROUP              = 0x935,
        MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY          = 0x936,
        MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY        = 0x937,
-       MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY       = 0x938
+       MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY       = 0x938,
+       MLX5_CMD_OP_MODIFY_FLOW_TABLE             = 0x93c
 };
 
 struct mlx5_ifc_flow_table_fields_supported_bits {
@@ -260,7 +261,9 @@ struct mlx5_ifc_flow_table_prop_layout_bits {
        u8         reserved_0[0x2];
        u8         flow_modify_en[0x1];
        u8         modify_root[0x1];
-       u8         reserved_1[0x1b];
+       u8         identified_miss_table_mode[0x1];
+       u8         flow_table_modify[0x1];
+       u8         reserved_1[0x19];
 
        u8         reserved_2[0x2];
        u8         log_max_ft_size[0x6];
@@ -5669,12 +5672,16 @@ struct mlx5_ifc_create_flow_table_in_bits {
 
        u8         reserved_4[0x20];
 
-       u8         reserved_5[0x8];
+       u8         reserved_5[0x4];
+       u8         table_miss_mode[0x4];
        u8         level[0x8];
        u8         reserved_6[0x8];
        u8         log_size[0x8];
 
-       u8         reserved_7[0x120];
+       u8         reserved_7[0x8];
+       u8         table_miss_id[0x18];
+
+       u8         reserved_8[0x100];
 };
 
 struct mlx5_ifc_create_flow_group_out_bits {
@@ -6975,4 +6982,45 @@ struct mlx5_ifc_set_flow_table_root_in_bits {
        u8         reserved_5[0x140];
 };
 
+enum {
+       MLX5_MODIFY_FLOW_TABLE_MISS_TABLE_ID = 0x1,
+};
+
+struct mlx5_ifc_modify_flow_table_out_bits {
+       u8         status[0x8];
+       u8         reserved_0[0x18];
+
+       u8         syndrome[0x20];
+
+       u8         reserved_1[0x40];
+};
+
+struct mlx5_ifc_modify_flow_table_in_bits {
+       u8         opcode[0x10];
+       u8         reserved_0[0x10];
+
+       u8         reserved_1[0x10];
+       u8         op_mod[0x10];
+
+       u8         reserved_2[0x20];
+
+       u8         reserved_3[0x10];
+       u8         modify_field_select[0x10];
+
+       u8         table_type[0x8];
+       u8         reserved_4[0x18];
+
+       u8         reserved_5[0x8];
+       u8         table_id[0x18];
+
+       u8         reserved_6[0x4];
+       u8         table_miss_mode[0x4];
+       u8         reserved_7[0x18];
+
+       u8         reserved_8[0x8];
+       u8         table_miss_id[0x18];
+
+       u8         reserved_9[0x100];
+};
+
 #endif /* MLX5_IFC_H */