forked from luck/tmp_suning_uos_patched
RDMA: Remove constant domain argument from flow creation call
The "domain" argument is constant and modern device (mlx5) doesn't support anything except IB_FLOW_DOMAIN_USER, so delete this extra parameter and simplify code. Link: https://lore.kernel.org/r/20200730081235.1581127-4-leon@kernel.org Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
70c1430fba
commit
d6673746d6
|
@ -3232,8 +3232,8 @@ static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs)
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
flow_id = qp->device->ops.create_flow(
|
flow_id = qp->device->ops.create_flow(qp, flow_attr,
|
||||||
qp, flow_attr, IB_FLOW_DOMAIN_USER, &attrs->driver_udata);
|
&attrs->driver_udata);
|
||||||
|
|
||||||
if (IS_ERR(flow_id)) {
|
if (IS_ERR(flow_id)) {
|
||||||
err = PTR_ERR(flow_id);
|
err = PTR_ERR(flow_id);
|
||||||
|
|
|
@ -1532,23 +1532,11 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
|
||||||
struct mlx4_net_trans_rule_hw_ctrl *ctrl;
|
struct mlx4_net_trans_rule_hw_ctrl *ctrl;
|
||||||
int default_flow;
|
int default_flow;
|
||||||
|
|
||||||
static const u16 __mlx4_domain[] = {
|
|
||||||
[IB_FLOW_DOMAIN_USER] = MLX4_DOMAIN_UVERBS,
|
|
||||||
[IB_FLOW_DOMAIN_ETHTOOL] = MLX4_DOMAIN_ETHTOOL,
|
|
||||||
[IB_FLOW_DOMAIN_RFS] = MLX4_DOMAIN_RFS,
|
|
||||||
[IB_FLOW_DOMAIN_NIC] = MLX4_DOMAIN_NIC,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (flow_attr->priority > MLX4_IB_FLOW_MAX_PRIO) {
|
if (flow_attr->priority > MLX4_IB_FLOW_MAX_PRIO) {
|
||||||
pr_err("Invalid priority value %d\n", flow_attr->priority);
|
pr_err("Invalid priority value %d\n", flow_attr->priority);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (domain >= IB_FLOW_DOMAIN_NUM) {
|
|
||||||
pr_err("Invalid domain value %d\n", domain);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mlx4_map_sw_to_hw_steering_mode(mdev->dev, flow_type) < 0)
|
if (mlx4_map_sw_to_hw_steering_mode(mdev->dev, flow_type) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -1557,8 +1545,7 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
|
||||||
return PTR_ERR(mailbox);
|
return PTR_ERR(mailbox);
|
||||||
ctrl = mailbox->buf;
|
ctrl = mailbox->buf;
|
||||||
|
|
||||||
ctrl->prio = cpu_to_be16(__mlx4_domain[domain] |
|
ctrl->prio = cpu_to_be16(domain | flow_attr->priority);
|
||||||
flow_attr->priority);
|
|
||||||
ctrl->type = mlx4_map_sw_to_hw_steering_mode(mdev->dev, flow_type);
|
ctrl->type = mlx4_map_sw_to_hw_steering_mode(mdev->dev, flow_type);
|
||||||
ctrl->port = flow_attr->port;
|
ctrl->port = flow_attr->port;
|
||||||
ctrl->qpn = cpu_to_be32(qp->qp_num);
|
ctrl->qpn = cpu_to_be32(qp->qp_num);
|
||||||
|
@ -1700,8 +1687,8 @@ static int mlx4_ib_add_dont_trap_rule(struct mlx4_dev *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
||||||
struct ib_flow_attr *flow_attr,
|
struct ib_flow_attr *flow_attr,
|
||||||
int domain, struct ib_udata *udata)
|
struct ib_udata *udata)
|
||||||
{
|
{
|
||||||
int err = 0, i = 0, j = 0;
|
int err = 0, i = 0, j = 0;
|
||||||
struct mlx4_ib_flow *mflow;
|
struct mlx4_ib_flow *mflow;
|
||||||
|
@ -1767,8 +1754,8 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < ARRAY_SIZE(type) && type[i]) {
|
while (i < ARRAY_SIZE(type) && type[i]) {
|
||||||
err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i],
|
err = __mlx4_ib_create_flow(qp, flow_attr, MLX4_DOMAIN_UVERBS,
|
||||||
&mflow->reg_id[i].id);
|
type[i], &mflow->reg_id[i].id);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_create_flow;
|
goto err_create_flow;
|
||||||
if (is_bonded) {
|
if (is_bonded) {
|
||||||
|
@ -1777,7 +1764,7 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
||||||
*/
|
*/
|
||||||
flow_attr->port = 2;
|
flow_attr->port = 2;
|
||||||
err = __mlx4_ib_create_flow(qp, flow_attr,
|
err = __mlx4_ib_create_flow(qp, flow_attr,
|
||||||
domain, type[j],
|
MLX4_DOMAIN_UVERBS, type[j],
|
||||||
&mflow->reg_id[j].mirror);
|
&mflow->reg_id[j].mirror);
|
||||||
flow_attr->port = 1;
|
flow_attr->port = 1;
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -2988,10 +2975,8 @@ int mlx4_ib_steer_qp_reg(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp,
|
||||||
/* Add an empty rule for IB L2 */
|
/* Add an empty rule for IB L2 */
|
||||||
memset(&ib_spec->mask, 0, sizeof(ib_spec->mask));
|
memset(&ib_spec->mask, 0, sizeof(ib_spec->mask));
|
||||||
|
|
||||||
err = __mlx4_ib_create_flow(&mqp->ibqp, flow,
|
err = __mlx4_ib_create_flow(&mqp->ibqp, flow, MLX4_DOMAIN_NIC,
|
||||||
IB_FLOW_DOMAIN_NIC,
|
MLX4_FS_REGULAR, &mqp->reg_id);
|
||||||
MLX4_FS_REGULAR,
|
|
||||||
&mqp->reg_id);
|
|
||||||
} else {
|
} else {
|
||||||
err = __mlx4_ib_destroy_flow(mdev->dev, mqp->reg_id);
|
err = __mlx4_ib_destroy_flow(mdev->dev, mqp->reg_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1142,10 +1142,8 @@ static struct mlx5_ib_flow_handler *create_sniffer_rule(struct mlx5_ib_dev *dev,
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
|
static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
|
||||||
struct ib_flow_attr *flow_attr,
|
struct ib_flow_attr *flow_attr,
|
||||||
int domain,
|
|
||||||
struct ib_udata *udata)
|
struct ib_udata *udata)
|
||||||
{
|
{
|
||||||
struct mlx5_ib_dev *dev = to_mdev(qp->device);
|
struct mlx5_ib_dev *dev = to_mdev(qp->device);
|
||||||
|
@ -1195,10 +1193,9 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
|
||||||
goto free_ucmd;
|
goto free_ucmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (domain != IB_FLOW_DOMAIN_USER ||
|
if (flow_attr->port > dev->num_ports ||
|
||||||
flow_attr->port > dev->num_ports ||
|
(flow_attr->flags &
|
||||||
(flow_attr->flags & ~(IB_FLOW_ATTR_FLAGS_DONT_TRAP |
|
~(IB_FLOW_ATTR_FLAGS_DONT_TRAP | IB_FLOW_ATTR_FLAGS_EGRESS))) {
|
||||||
IB_FLOW_ATTR_FLAGS_EGRESS))) {
|
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto free_ucmd;
|
goto free_ucmd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1863,17 +1863,6 @@ enum ib_flow_spec_type {
|
||||||
#define IB_FLOW_SPEC_LAYER_MASK 0xF0
|
#define IB_FLOW_SPEC_LAYER_MASK 0xF0
|
||||||
#define IB_FLOW_SPEC_SUPPORT_LAYERS 10
|
#define IB_FLOW_SPEC_SUPPORT_LAYERS 10
|
||||||
|
|
||||||
/* Flow steering rule priority is set according to it's domain.
|
|
||||||
* Lower domain value means higher priority.
|
|
||||||
*/
|
|
||||||
enum ib_flow_domain {
|
|
||||||
IB_FLOW_DOMAIN_USER,
|
|
||||||
IB_FLOW_DOMAIN_ETHTOOL,
|
|
||||||
IB_FLOW_DOMAIN_RFS,
|
|
||||||
IB_FLOW_DOMAIN_NIC,
|
|
||||||
IB_FLOW_DOMAIN_NUM /* Must be last */
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ib_flow_flags {
|
enum ib_flow_flags {
|
||||||
IB_FLOW_ATTR_FLAGS_DONT_TRAP = 1UL << 1, /* Continue match, no steal */
|
IB_FLOW_ATTR_FLAGS_DONT_TRAP = 1UL << 1, /* Continue match, no steal */
|
||||||
IB_FLOW_ATTR_FLAGS_EGRESS = 1UL << 2, /* Egress flow */
|
IB_FLOW_ATTR_FLAGS_EGRESS = 1UL << 2, /* Egress flow */
|
||||||
|
@ -2471,7 +2460,7 @@ struct ib_device_ops {
|
||||||
void (*dealloc_xrcd)(struct ib_xrcd *xrcd, struct ib_udata *udata);
|
void (*dealloc_xrcd)(struct ib_xrcd *xrcd, struct ib_udata *udata);
|
||||||
struct ib_flow *(*create_flow)(struct ib_qp *qp,
|
struct ib_flow *(*create_flow)(struct ib_qp *qp,
|
||||||
struct ib_flow_attr *flow_attr,
|
struct ib_flow_attr *flow_attr,
|
||||||
int domain, struct ib_udata *udata);
|
struct ib_udata *udata);
|
||||||
int (*destroy_flow)(struct ib_flow *flow_id);
|
int (*destroy_flow)(struct ib_flow *flow_id);
|
||||||
struct ib_flow_action *(*create_flow_action_esp)(
|
struct ib_flow_action *(*create_flow_action_esp)(
|
||||||
struct ib_device *device,
|
struct ib_device *device,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user