Re: [for-next 10/14] net/mlx5: Add shim layer between fs and cmd

2018-03-06 Thread Saeed Mahameed
On Mon, 2018-03-05 at 14:03 -0700, Jason Gunthorpe wrote:
> On Mon, Mar 05, 2018 at 12:46:33PM -0800, Saeed Mahameed wrote:
> 
> > +static struct mlx5_flow_cmds mlx5_flow_cmds = {
> 
> 'static const' on these new static structs?
> 

Yes, Will fix.

> Jason



Re: [for-next 10/14] net/mlx5: Add shim layer between fs and cmd

2018-03-05 Thread Jason Gunthorpe
On Mon, Mar 05, 2018 at 12:46:33PM -0800, Saeed Mahameed wrote:

> +static struct mlx5_flow_cmds mlx5_flow_cmds = {

'static const' on these new static structs?

Jason


[for-next 10/14] net/mlx5: Add shim layer between fs and cmd

2018-03-05 Thread Saeed Mahameed
From: Matan Barak 

The shim layer allows each namespace to define possibly different
functionality for add/delete/update commands. The shim layer
introduced here, will be used to support flow steering with the FPGA.

Signed-off-by: Matan Barak 
Signed-off-by: Aviad Yehezkel 
Signed-off-by: Boris Pismenny 
Signed-off-by: Saeed Mahameed 
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c  | 192 ++
 drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h  |  72 
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |  84 ++
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.h |   1 +
 4 files changed, 249 insertions(+), 100 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c 
b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
index 881e2e55840c..1b24ad876db2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
@@ -39,9 +39,81 @@
 #include "mlx5_core.h"
 #include "eswitch.h"
 
-int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev,
-   struct mlx5_flow_table *ft, u32 underlay_qpn,
-   bool disconnect)
+static int mlx5_cmd_stub_update_root_ft(struct mlx5_core_dev *dev,
+   struct mlx5_flow_table *ft,
+   u32 underlay_qpn,
+   bool disconnect)
+{
+   return 0;
+}
+
+static int mlx5_cmd_stub_create_flow_table(struct mlx5_core_dev *dev,
+  u16 vport,
+  enum fs_flow_table_op_mod op_mod,
+  enum fs_flow_table_type type,
+  unsigned int level,
+  unsigned int log_size,
+  struct mlx5_flow_table *next_ft,
+  unsigned int *table_id, u32 flags)
+{
+   return 0;
+}
+
+static int mlx5_cmd_stub_destroy_flow_table(struct mlx5_core_dev *dev,
+   struct mlx5_flow_table *ft)
+{
+   return 0;
+}
+
+static int mlx5_cmd_stub_modify_flow_table(struct mlx5_core_dev *dev,
+  struct mlx5_flow_table *ft,
+  struct mlx5_flow_table *next_ft)
+{
+   return 0;
+}
+
+static int mlx5_cmd_stub_create_flow_group(struct mlx5_core_dev *dev,
+  struct mlx5_flow_table *ft,
+  u32 *in,
+  unsigned int *group_id)
+{
+   return 0;
+}
+
+static int mlx5_cmd_stub_destroy_flow_group(struct mlx5_core_dev *dev,
+   struct mlx5_flow_table *ft,
+   unsigned int group_id)
+{
+   return 0;
+}
+
+static int mlx5_cmd_stub_create_fte(struct mlx5_core_dev *dev,
+   struct mlx5_flow_table *ft,
+   struct mlx5_flow_group *group,
+   struct fs_fte *fte)
+{
+   return 0;
+}
+
+static int mlx5_cmd_stub_update_fte(struct mlx5_core_dev *dev,
+   struct mlx5_flow_table *ft,
+   unsigned int group_id,
+   int modify_mask,
+   struct fs_fte *fte)
+{
+   return -EOPNOTSUPP;
+}
+
+static int mlx5_cmd_stub_delete_fte(struct mlx5_core_dev *dev,
+   struct mlx5_flow_table *ft,
+   unsigned int index)
+{
+   return 0;
+}
+
+static int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev,
+  struct mlx5_flow_table *ft, u32 underlay_qpn,
+  bool disconnect)
 {
u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)]   = {0};
u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)] = {0};
@@ -71,12 +143,14 @@ int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev,
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
 }
 
-int mlx5_cmd_create_flow_table(struct mlx5_core_dev *dev,
-  u16 vport,
-  enum fs_flow_table_op_mod op_mod,
-  enum fs_flow_table_type type, unsigned int level,
-  unsigned int log_size, struct mlx5_flow_table
-  *next_ft, unsigned int *table_id, u32 flags)
+static int mlx5_cmd_create_flow_table(struct mlx5_core_dev *dev,
+ u16 vport,
+ enum fs_flow_table_op_mod op_mod,
+