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;
|
||||
}
|
||||
|
||||
flow_id = qp->device->ops.create_flow(
|
||||
qp, flow_attr, IB_FLOW_DOMAIN_USER, &attrs->driver_udata);
|
||||
flow_id = qp->device->ops.create_flow(qp, flow_attr,
|
||||
&attrs->driver_udata);
|
||||
|
||||
if (IS_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;
|
||||
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) {
|
||||
pr_err("Invalid priority value %d\n", flow_attr->priority);
|
||||
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)
|
||||
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);
|
||||
ctrl = mailbox->buf;
|
||||
|
||||
ctrl->prio = cpu_to_be16(__mlx4_domain[domain] |
|
||||
flow_attr->priority);
|
||||
ctrl->prio = cpu_to_be16(domain | flow_attr->priority);
|
||||
ctrl->type = mlx4_map_sw_to_hw_steering_mode(mdev->dev, flow_type);
|
||||
ctrl->port = flow_attr->port;
|
||||
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,
|
||||
struct ib_flow_attr *flow_attr,
|
||||
int domain, struct ib_udata *udata)
|
||||
struct ib_flow_attr *flow_attr,
|
||||
struct ib_udata *udata)
|
||||
{
|
||||
int err = 0, i = 0, j = 0;
|
||||
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]) {
|
||||
err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i],
|
||||
&mflow->reg_id[i].id);
|
||||
err = __mlx4_ib_create_flow(qp, flow_attr, MLX4_DOMAIN_UVERBS,
|
||||
type[i], &mflow->reg_id[i].id);
|
||||
if (err)
|
||||
goto err_create_flow;
|
||||
if (is_bonded) {
|
||||
|
@ -1777,7 +1764,7 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
|||
*/
|
||||
flow_attr->port = 2;
|
||||
err = __mlx4_ib_create_flow(qp, flow_attr,
|
||||
domain, type[j],
|
||||
MLX4_DOMAIN_UVERBS, type[j],
|
||||
&mflow->reg_id[j].mirror);
|
||||
flow_attr->port = 1;
|
||||
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 */
|
||||
memset(&ib_spec->mask, 0, sizeof(ib_spec->mask));
|
||||
|
||||
err = __mlx4_ib_create_flow(&mqp->ibqp, flow,
|
||||
IB_FLOW_DOMAIN_NIC,
|
||||
MLX4_FS_REGULAR,
|
||||
&mqp->reg_id);
|
||||
err = __mlx4_ib_create_flow(&mqp->ibqp, flow, MLX4_DOMAIN_NIC,
|
||||
MLX4_FS_REGULAR, &mqp->reg_id);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
|
||||
struct ib_flow_attr *flow_attr,
|
||||
int domain,
|
||||
struct ib_udata *udata)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if (domain != IB_FLOW_DOMAIN_USER ||
|
||||
flow_attr->port > dev->num_ports ||
|
||||
(flow_attr->flags & ~(IB_FLOW_ATTR_FLAGS_DONT_TRAP |
|
||||
IB_FLOW_ATTR_FLAGS_EGRESS))) {
|
||||
if (flow_attr->port > dev->num_ports ||
|
||||
(flow_attr->flags &
|
||||
~(IB_FLOW_ATTR_FLAGS_DONT_TRAP | IB_FLOW_ATTR_FLAGS_EGRESS))) {
|
||||
err = -EINVAL;
|
||||
goto free_ucmd;
|
||||
}
|
||||
|
|
|
@ -1863,17 +1863,6 @@ enum ib_flow_spec_type {
|
|||
#define IB_FLOW_SPEC_LAYER_MASK 0xF0
|
||||
#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 {
|
||||
IB_FLOW_ATTR_FLAGS_DONT_TRAP = 1UL << 1, /* Continue match, no steal */
|
||||
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);
|
||||
struct ib_flow *(*create_flow)(struct ib_qp *qp,
|
||||
struct ib_flow_attr *flow_attr,
|
||||
int domain, struct ib_udata *udata);
|
||||
struct ib_udata *udata);
|
||||
int (*destroy_flow)(struct ib_flow *flow_id);
|
||||
struct ib_flow_action *(*create_flow_action_esp)(
|
||||
struct ib_device *device,
|
||||
|
|
Loading…
Reference in New Issue
Block a user