]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5e: Introduce create/destroy RSS indir table access functions
authorAchiad Shochat <achiad@mellanox.com>
Wed, 29 Jul 2015 12:05:45 +0000 (15:05 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Jul 2015 06:04:47 +0000 (23:04 -0700)
Introduce access functions to create/destroy RSS indrection table
and use it in the Ethernet driver.

Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/transobj.c
drivers/net/ethernet/mellanox/mlx5/core/transobj.h

index 6581f5896d928d92e7ef2222889ed7999cc2fd6a..8ddb2a026ed9e5843927a39949eb95de309cc369 100644 (file)
@@ -1188,7 +1188,6 @@ static int mlx5e_open_rqt(struct mlx5e_priv *priv)
 {
        struct mlx5_core_dev *mdev = priv->mdev;
        u32 *in;
-       u32 out[MLX5_ST_SZ_DW(create_rqt_out)];
        void *rqtc;
        int inlen;
        int err;
@@ -1216,12 +1215,7 @@ static int mlx5e_open_rqt(struct mlx5e_priv *priv)
                MLX5_SET(rqtc, rqtc, rq_num[i], priv->channel[ix]->rq.rqn);
        }
 
-       MLX5_SET(create_rqt_in, in, opcode, MLX5_CMD_OP_CREATE_RQT);
-
-       memset(out, 0, sizeof(out));
-       err = mlx5_cmd_exec_check_status(mdev, in, inlen, out, sizeof(out));
-       if (!err)
-               priv->rqtn = MLX5_GET(create_rqt_out, out, rqtn);
+       err = mlx5_core_create_rqt(mdev, in, inlen, &priv->rqtn);
 
        kvfree(in);
 
@@ -1230,16 +1224,7 @@ static int mlx5e_open_rqt(struct mlx5e_priv *priv)
 
 static void mlx5e_close_rqt(struct mlx5e_priv *priv)
 {
-       u32 in[MLX5_ST_SZ_DW(destroy_rqt_in)];
-       u32 out[MLX5_ST_SZ_DW(destroy_rqt_out)];
-
-       memset(in, 0, sizeof(in));
-
-       MLX5_SET(destroy_rqt_in, in, opcode, MLX5_CMD_OP_DESTROY_RQT);
-       MLX5_SET(destroy_rqt_in, in, rqtn, priv->rqtn);
-
-       mlx5_cmd_exec_check_status(priv->mdev, in, sizeof(in), out,
-                                  sizeof(out));
+       mlx5_core_destroy_rqt(priv->mdev, priv->rqtn);
 }
 
 static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt)
index 8d98b03026d5db588eee7de23f04611f268b4543..c4f3f74908ec220254137ea7893cd373c6c3b507 100644 (file)
@@ -358,3 +358,32 @@ int mlx5_core_arm_xsrq(struct mlx5_core_dev *dev, u32 xsrqn, u16 lwm)
        return  mlx5_cmd_exec_check_status(dev, in, sizeof(in), out,
                                           sizeof(out));
 }
+
+int mlx5_core_create_rqt(struct mlx5_core_dev *dev, u32 *in, int inlen,
+                        u32 *rqtn)
+{
+       u32 out[MLX5_ST_SZ_DW(create_rqt_out)];
+       int err;
+
+       MLX5_SET(create_rqt_in, in, opcode, MLX5_CMD_OP_CREATE_RQT);
+
+       memset(out, 0, sizeof(out));
+       err = mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
+       if (!err)
+               *rqtn = MLX5_GET(create_rqt_out, out, rqtn);
+
+       return err;
+}
+
+void mlx5_core_destroy_rqt(struct mlx5_core_dev *dev, u32 rqtn)
+{
+       u32 in[MLX5_ST_SZ_DW(destroy_rqt_in)];
+       u32 out[MLX5_ST_SZ_DW(destroy_rqt_out)];
+
+       memset(in, 0, sizeof(in));
+
+       MLX5_SET(destroy_rqt_in, in, opcode, MLX5_CMD_OP_DESTROY_RQT);
+       MLX5_SET(destroy_rqt_in, in, rqtn, rqtn);
+
+       mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
+}
index f9ef244710d534b5e22bddd313d1497b36da12fa..10bd75e7d9b1dd3f44fab37bc274bbe219040677 100644 (file)
@@ -61,4 +61,8 @@ int mlx5_core_destroy_xsrq(struct mlx5_core_dev *dev, u32 rmpn);
 int mlx5_core_query_xsrq(struct mlx5_core_dev *dev, u32 rmpn, u32 *out);
 int mlx5_core_arm_xsrq(struct mlx5_core_dev *dev, u32 rmpn, u16 lwm);
 
+int mlx5_core_create_rqt(struct mlx5_core_dev *dev, u32 *in, int inlen,
+                        u32 *rqtn);
+void mlx5_core_destroy_rqt(struct mlx5_core_dev *dev, u32 rqtn);
+
 #endif /* __TRANSOBJ_H__ */