mirror of https://gitee.com/openkylin/linux.git
mlx5-updates-2018-10-17
======================================================================== From Or Gerlitz <ogerlitz@mellanox.com>: This series from Paul adds support to mlx5 e-switch tc offloading of multiple priorities and chains. This is made of four building blocks (along with few minor driver refactors): [1] Split FDB fast path prio to multiple namespaces Currently the FDB name-space contains two priorities, fast path (p0) and slow path (p1). The slow path contains the per representor SQ send-to-vport TX rule and the match-all RX miss rule. As a pre-step to support multi-chains and priorities, we split the FDB fast path to multiple namespaces (sub namespaces), each with multiple priorities. [2] E-Switch chains and priorities A chain is a group of priorities. We use the fdb parallel sub-namespaces to implement chains, and a flow table for each priority in them. Because these namespaces are parallel and in series to the slow path fdb, the chains aren't connected to each other (but to the slow path), and one must use a explicit goto action to reach a different chain. Flow tables for the priorities are created on demand and destroyed once not used. [3] Add a no-append flow insertion mode, use it for TC offloads Enhance the driver fs core, such that if a no-append flag is set by the caller, we add a new FTE, instead of appending the actions of the inserted rule when the same match already exists. For encap rules, we defer the HW offloading till we have a valid neighbor. This can result in the packet hitting a lower priority rule in the HW DP. Use the no-append API to push these packets to the slow path FDB table, so they go to the TC kernel DP as done before priorities where supported. [4] Offloading tc priorities and chains for eswitch flows Using [1], [2] and [3] above we add the support for offloading both chains and priorities. To get to a new chain, use the tc goto action. We support a fixed prio range 1-16, and chains 0-3. ============================================================================= -----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJbx6k1AAoJEEg/ir3gV/o+l40H/14rNaV27vefjuALgOvNX4DY iSI5UFv9ILnAemcD2xkVfJeGolwdzoRhCXJ5oyCylCPnP4tb9zgDgwu9V/WmIRG+ DOaPLu+0V6jqfEGO5sXJPMhJNUR8WWAjfu66htJ0Nc1HV2OM5eYrcvjaYCfW4Egr QFWGyq4sPyYcpbb7wURbhmkfs8Vwxcj9c2cZIfXo3VJsKxULqU9Mj5hZnirI1OAy UhjLssb/8wfHmwNcqETI9ae7O+vPDMLkxdQvpviEBI+HJ7vZ6op2X4lVEsn/Bx2E /KrHGQObkwim8thTOYkQeJtqptWbiRvkpNnwryUV1fwjWPl6X1r3bXH7RdeRwCg= =aFCc -----END PGP SIGNATURE----- Merge tag 'mlx5-updates-2018-10-17' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux mlx5-updates-2018-10-17 ======================================================================== From Or Gerlitz <ogerlitz@mellanox.com>: This series from Paul adds support to mlx5 e-switch tc offloading of multiple priorities and chains. This is made of four building blocks (along with few minor driver refactors): [1] Split FDB fast path prio to multiple namespaces Currently the FDB name-space contains two priorities, fast path (p0) and slow path (p1). The slow path contains the per representor SQ send-to-vport TX rule and the match-all RX miss rule. As a pre-step to support multi-chains and priorities, we split the FDB fast path to multiple namespaces (sub namespaces), each with multiple priorities. [2] E-Switch chains and priorities A chain is a group of priorities. We use the fdb parallel sub-namespaces to implement chains, and a flow table for each priority in them. Because these namespaces are parallel and in series to the slow path fdb, the chains aren't connected to each other (but to the slow path), and one must use a explicit goto action to reach a different chain. Flow tables for the priorities are created on demand and destroyed once not used. [3] Add a no-append flow insertion mode, use it for TC offloads Enhance the driver fs core, such that if a no-append flag is set by the caller, we add a new FTE, instead of appending the actions of the inserted rule when the same match already exists. For encap rules, we defer the HW offloading till we have a valid neighbor. This can result in the packet hitting a lower priority rule in the HW DP. Use the no-append API to push these packets to the slow path FDB table, so they go to the TC kernel DP as done before priorities where supported. [4] Offloading tc priorities and chains for eswitch flows Using [1], [2] and [3] above we add the support for offloading both chains and priorities. To get to a new chain, use the tc goto action. We support a fixed prio range 1-16, and chains 0-3. ============================================================================= Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
99e9acd85c
|
@ -284,7 +284,7 @@ static bool devx_is_obj_create_cmd(const void *in)
|
||||||
case MLX5_CMD_OP_CREATE_FLOW_TABLE:
|
case MLX5_CMD_OP_CREATE_FLOW_TABLE:
|
||||||
case MLX5_CMD_OP_CREATE_FLOW_GROUP:
|
case MLX5_CMD_OP_CREATE_FLOW_GROUP:
|
||||||
case MLX5_CMD_OP_ALLOC_FLOW_COUNTER:
|
case MLX5_CMD_OP_ALLOC_FLOW_COUNTER:
|
||||||
case MLX5_CMD_OP_ALLOC_ENCAP_HEADER:
|
case MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT:
|
||||||
case MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT:
|
case MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT:
|
||||||
case MLX5_CMD_OP_CREATE_SCHEDULING_ELEMENT:
|
case MLX5_CMD_OP_CREATE_SCHEDULING_ELEMENT:
|
||||||
case MLX5_CMD_OP_ADD_VXLAN_UDP_DPORT:
|
case MLX5_CMD_OP_ADD_VXLAN_UDP_DPORT:
|
||||||
|
@ -627,9 +627,9 @@ static void devx_obj_build_destroy_cmd(void *in, void *out, void *din,
|
||||||
MLX5_SET(general_obj_in_cmd_hdr, din, opcode,
|
MLX5_SET(general_obj_in_cmd_hdr, din, opcode,
|
||||||
MLX5_CMD_OP_DEALLOC_FLOW_COUNTER);
|
MLX5_CMD_OP_DEALLOC_FLOW_COUNTER);
|
||||||
break;
|
break;
|
||||||
case MLX5_CMD_OP_ALLOC_ENCAP_HEADER:
|
case MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT:
|
||||||
MLX5_SET(general_obj_in_cmd_hdr, din, opcode,
|
MLX5_SET(general_obj_in_cmd_hdr, din, opcode,
|
||||||
MLX5_CMD_OP_DEALLOC_ENCAP_HEADER);
|
MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT);
|
||||||
break;
|
break;
|
||||||
case MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT:
|
case MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT:
|
||||||
MLX5_SET(general_obj_in_cmd_hdr, din, opcode,
|
MLX5_SET(general_obj_in_cmd_hdr, din, opcode,
|
||||||
|
|
|
@ -2793,7 +2793,7 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, u32 *match_c,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
action->flow_tag = ib_spec->flow_tag.tag_id;
|
action->flow_tag = ib_spec->flow_tag.tag_id;
|
||||||
action->has_flow_tag = true;
|
action->flags |= FLOW_ACT_HAS_TAG;
|
||||||
break;
|
break;
|
||||||
case IB_FLOW_SPEC_ACTION_DROP:
|
case IB_FLOW_SPEC_ACTION_DROP:
|
||||||
if (FIELDS_NOT_SUPPORTED(ib_spec->drop,
|
if (FIELDS_NOT_SUPPORTED(ib_spec->drop,
|
||||||
|
@ -2886,7 +2886,7 @@ is_valid_esp_aes_gcm(struct mlx5_core_dev *mdev,
|
||||||
return egress ? VALID_SPEC_INVALID : VALID_SPEC_NA;
|
return egress ? VALID_SPEC_INVALID : VALID_SPEC_NA;
|
||||||
|
|
||||||
return is_crypto && is_ipsec &&
|
return is_crypto && is_ipsec &&
|
||||||
(!egress || (!is_drop && !flow_act->has_flow_tag)) ?
|
(!egress || (!is_drop && !(flow_act->flags & FLOW_ACT_HAS_TAG))) ?
|
||||||
VALID_SPEC_VALID : VALID_SPEC_INVALID;
|
VALID_SPEC_VALID : VALID_SPEC_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3320,15 +3320,18 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
|
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
|
||||||
|
struct mlx5_ib_mcounters *mcounters;
|
||||||
|
|
||||||
err = flow_counters_set_data(flow_act.counters, ucmd);
|
err = flow_counters_set_data(flow_act.counters, ucmd);
|
||||||
if (err)
|
if (err)
|
||||||
goto free;
|
goto free;
|
||||||
|
|
||||||
|
mcounters = to_mcounters(flow_act.counters);
|
||||||
handler->ibcounters = flow_act.counters;
|
handler->ibcounters = flow_act.counters;
|
||||||
dest_arr[dest_num].type =
|
dest_arr[dest_num].type =
|
||||||
MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
||||||
dest_arr[dest_num].counter =
|
dest_arr[dest_num].counter_id =
|
||||||
to_mcounters(flow_act.counters)->hw_cntrs_hndl;
|
mlx5_fc_id(mcounters->hw_cntrs_hndl);
|
||||||
dest_num++;
|
dest_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3346,7 +3349,7 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev,
|
||||||
MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO;
|
MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flow_act.has_flow_tag &&
|
if ((flow_act.flags & FLOW_ACT_HAS_TAG) &&
|
||||||
(flow_attr->type == IB_FLOW_ATTR_ALL_DEFAULT ||
|
(flow_attr->type == IB_FLOW_ATTR_ALL_DEFAULT ||
|
||||||
flow_attr->type == IB_FLOW_ATTR_MC_DEFAULT)) {
|
flow_attr->type == IB_FLOW_ATTR_MC_DEFAULT)) {
|
||||||
mlx5_ib_warn(dev, "Flow tag %u and attribute type %x isn't allowed in leftovers\n",
|
mlx5_ib_warn(dev, "Flow tag %u and attribute type %x isn't allowed in leftovers\n",
|
||||||
|
|
|
@ -1279,7 +1279,7 @@ static int create_raw_packet_qp_tir(struct mlx5_ib_dev *dev,
|
||||||
|
|
||||||
if (dev->rep)
|
if (dev->rep)
|
||||||
MLX5_SET(tirc, tirc, self_lb_block,
|
MLX5_SET(tirc, tirc, self_lb_block,
|
||||||
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST_);
|
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST);
|
||||||
|
|
||||||
err = mlx5_core_create_tir(dev->mdev, in, inlen, &rq->tirn);
|
err = mlx5_core_create_tir(dev->mdev, in, inlen, &rq->tirn);
|
||||||
|
|
||||||
|
@ -1582,7 +1582,7 @@ static int create_rss_raw_qp_tir(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
|
||||||
create_tir:
|
create_tir:
|
||||||
if (dev->rep)
|
if (dev->rep)
|
||||||
MLX5_SET(tirc, tirc, self_lb_block,
|
MLX5_SET(tirc, tirc, self_lb_block,
|
||||||
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST_);
|
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST);
|
||||||
|
|
||||||
err = mlx5_core_create_tir(dev->mdev, in, inlen, &qp->rss_qp.tirn);
|
err = mlx5_core_create_tir(dev->mdev, in, inlen, &qp->rss_qp.tirn);
|
||||||
|
|
||||||
|
|
|
@ -308,10 +308,11 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
|
||||||
case MLX5_CMD_OP_MODIFY_FLOW_TABLE:
|
case MLX5_CMD_OP_MODIFY_FLOW_TABLE:
|
||||||
case MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY:
|
case MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY:
|
||||||
case MLX5_CMD_OP_SET_FLOW_TABLE_ROOT:
|
case MLX5_CMD_OP_SET_FLOW_TABLE_ROOT:
|
||||||
case MLX5_CMD_OP_DEALLOC_ENCAP_HEADER:
|
case MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT:
|
||||||
case MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT:
|
case MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT:
|
||||||
case MLX5_CMD_OP_FPGA_DESTROY_QP:
|
case MLX5_CMD_OP_FPGA_DESTROY_QP:
|
||||||
case MLX5_CMD_OP_DESTROY_GENERAL_OBJECT:
|
case MLX5_CMD_OP_DESTROY_GENERAL_OBJECT:
|
||||||
|
case MLX5_CMD_OP_DEALLOC_MEMIC:
|
||||||
return MLX5_CMD_STAT_OK;
|
return MLX5_CMD_STAT_OK;
|
||||||
|
|
||||||
case MLX5_CMD_OP_QUERY_HCA_CAP:
|
case MLX5_CMD_OP_QUERY_HCA_CAP:
|
||||||
|
@ -426,7 +427,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
|
||||||
case MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY:
|
case MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY:
|
||||||
case MLX5_CMD_OP_ALLOC_FLOW_COUNTER:
|
case MLX5_CMD_OP_ALLOC_FLOW_COUNTER:
|
||||||
case MLX5_CMD_OP_QUERY_FLOW_COUNTER:
|
case MLX5_CMD_OP_QUERY_FLOW_COUNTER:
|
||||||
case MLX5_CMD_OP_ALLOC_ENCAP_HEADER:
|
case MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT:
|
||||||
case MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT:
|
case MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT:
|
||||||
case MLX5_CMD_OP_FPGA_CREATE_QP:
|
case MLX5_CMD_OP_FPGA_CREATE_QP:
|
||||||
case MLX5_CMD_OP_FPGA_MODIFY_QP:
|
case MLX5_CMD_OP_FPGA_MODIFY_QP:
|
||||||
|
@ -435,6 +436,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
|
||||||
case MLX5_CMD_OP_CREATE_GENERAL_OBJECT:
|
case MLX5_CMD_OP_CREATE_GENERAL_OBJECT:
|
||||||
case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT:
|
case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT:
|
||||||
case MLX5_CMD_OP_QUERY_GENERAL_OBJECT:
|
case MLX5_CMD_OP_QUERY_GENERAL_OBJECT:
|
||||||
|
case MLX5_CMD_OP_ALLOC_MEMIC:
|
||||||
*status = MLX5_DRIVER_STATUS_ABORTED;
|
*status = MLX5_DRIVER_STATUS_ABORTED;
|
||||||
*synd = MLX5_DRIVER_SYND;
|
*synd = MLX5_DRIVER_SYND;
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -599,8 +601,8 @@ const char *mlx5_command_str(int command)
|
||||||
MLX5_COMMAND_STR_CASE(DEALLOC_FLOW_COUNTER);
|
MLX5_COMMAND_STR_CASE(DEALLOC_FLOW_COUNTER);
|
||||||
MLX5_COMMAND_STR_CASE(QUERY_FLOW_COUNTER);
|
MLX5_COMMAND_STR_CASE(QUERY_FLOW_COUNTER);
|
||||||
MLX5_COMMAND_STR_CASE(MODIFY_FLOW_TABLE);
|
MLX5_COMMAND_STR_CASE(MODIFY_FLOW_TABLE);
|
||||||
MLX5_COMMAND_STR_CASE(ALLOC_ENCAP_HEADER);
|
MLX5_COMMAND_STR_CASE(ALLOC_PACKET_REFORMAT_CONTEXT);
|
||||||
MLX5_COMMAND_STR_CASE(DEALLOC_ENCAP_HEADER);
|
MLX5_COMMAND_STR_CASE(DEALLOC_PACKET_REFORMAT_CONTEXT);
|
||||||
MLX5_COMMAND_STR_CASE(ALLOC_MODIFY_HEADER_CONTEXT);
|
MLX5_COMMAND_STR_CASE(ALLOC_MODIFY_HEADER_CONTEXT);
|
||||||
MLX5_COMMAND_STR_CASE(DEALLOC_MODIFY_HEADER_CONTEXT);
|
MLX5_COMMAND_STR_CASE(DEALLOC_MODIFY_HEADER_CONTEXT);
|
||||||
MLX5_COMMAND_STR_CASE(FPGA_CREATE_QP);
|
MLX5_COMMAND_STR_CASE(FPGA_CREATE_QP);
|
||||||
|
@ -617,6 +619,8 @@ const char *mlx5_command_str(int command)
|
||||||
MLX5_COMMAND_STR_CASE(MODIFY_GENERAL_OBJECT);
|
MLX5_COMMAND_STR_CASE(MODIFY_GENERAL_OBJECT);
|
||||||
MLX5_COMMAND_STR_CASE(QUERY_GENERAL_OBJECT);
|
MLX5_COMMAND_STR_CASE(QUERY_GENERAL_OBJECT);
|
||||||
MLX5_COMMAND_STR_CASE(QUERY_MODIFY_HEADER_CONTEXT);
|
MLX5_COMMAND_STR_CASE(QUERY_MODIFY_HEADER_CONTEXT);
|
||||||
|
MLX5_COMMAND_STR_CASE(ALLOC_MEMIC);
|
||||||
|
MLX5_COMMAND_STR_CASE(DEALLOC_MEMIC);
|
||||||
default: return "unknown command opcode";
|
default: return "unknown command opcode";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
|
||||||
cq->cons_index = 0;
|
cq->cons_index = 0;
|
||||||
cq->arm_sn = 0;
|
cq->arm_sn = 0;
|
||||||
cq->eq = eq;
|
cq->eq = eq;
|
||||||
|
cq->uid = MLX5_GET(create_cq_in, in, uid);
|
||||||
refcount_set(&cq->refcount, 1);
|
refcount_set(&cq->refcount, 1);
|
||||||
init_completion(&cq->free);
|
init_completion(&cq->free);
|
||||||
if (!cq->comp)
|
if (!cq->comp)
|
||||||
|
@ -144,6 +145,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
|
||||||
memset(dout, 0, sizeof(dout));
|
memset(dout, 0, sizeof(dout));
|
||||||
MLX5_SET(destroy_cq_in, din, opcode, MLX5_CMD_OP_DESTROY_CQ);
|
MLX5_SET(destroy_cq_in, din, opcode, MLX5_CMD_OP_DESTROY_CQ);
|
||||||
MLX5_SET(destroy_cq_in, din, cqn, cq->cqn);
|
MLX5_SET(destroy_cq_in, din, cqn, cq->cqn);
|
||||||
|
MLX5_SET(destroy_cq_in, din, uid, cq->uid);
|
||||||
mlx5_cmd_exec(dev, din, sizeof(din), dout, sizeof(dout));
|
mlx5_cmd_exec(dev, din, sizeof(din), dout, sizeof(dout));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -165,6 +167,7 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)
|
||||||
|
|
||||||
MLX5_SET(destroy_cq_in, in, opcode, MLX5_CMD_OP_DESTROY_CQ);
|
MLX5_SET(destroy_cq_in, in, opcode, MLX5_CMD_OP_DESTROY_CQ);
|
||||||
MLX5_SET(destroy_cq_in, in, cqn, cq->cqn);
|
MLX5_SET(destroy_cq_in, in, cqn, cq->cqn);
|
||||||
|
MLX5_SET(destroy_cq_in, in, uid, cq->uid);
|
||||||
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -196,6 +199,7 @@ int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
|
||||||
u32 out[MLX5_ST_SZ_DW(modify_cq_out)] = {0};
|
u32 out[MLX5_ST_SZ_DW(modify_cq_out)] = {0};
|
||||||
|
|
||||||
MLX5_SET(modify_cq_in, in, opcode, MLX5_CMD_OP_MODIFY_CQ);
|
MLX5_SET(modify_cq_in, in, opcode, MLX5_CMD_OP_MODIFY_CQ);
|
||||||
|
MLX5_SET(modify_cq_in, in, uid, cq->uid);
|
||||||
return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
|
return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mlx5_core_modify_cq);
|
EXPORT_SYMBOL(mlx5_core_modify_cq);
|
||||||
|
|
|
@ -133,7 +133,7 @@ TRACE_EVENT(mlx5_fs_del_fg,
|
||||||
{MLX5_FLOW_CONTEXT_ACTION_DROP, "DROP"},\
|
{MLX5_FLOW_CONTEXT_ACTION_DROP, "DROP"},\
|
||||||
{MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, "FWD"},\
|
{MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, "FWD"},\
|
||||||
{MLX5_FLOW_CONTEXT_ACTION_COUNT, "CNT"},\
|
{MLX5_FLOW_CONTEXT_ACTION_COUNT, "CNT"},\
|
||||||
{MLX5_FLOW_CONTEXT_ACTION_ENCAP, "ENCAP"},\
|
{MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT, "REFORMAT"},\
|
||||||
{MLX5_FLOW_CONTEXT_ACTION_DECAP, "DECAP"},\
|
{MLX5_FLOW_CONTEXT_ACTION_DECAP, "DECAP"},\
|
||||||
{MLX5_FLOW_CONTEXT_ACTION_MOD_HDR, "MOD_HDR"},\
|
{MLX5_FLOW_CONTEXT_ACTION_MOD_HDR, "MOD_HDR"},\
|
||||||
{MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH, "VLAN_PUSH"},\
|
{MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH, "VLAN_PUSH"},\
|
||||||
|
@ -252,10 +252,10 @@ TRACE_EVENT(mlx5_fs_add_rule,
|
||||||
memcpy(__entry->destination,
|
memcpy(__entry->destination,
|
||||||
&rule->dest_attr,
|
&rule->dest_attr,
|
||||||
sizeof(__entry->destination));
|
sizeof(__entry->destination));
|
||||||
if (rule->dest_attr.type & MLX5_FLOW_DESTINATION_TYPE_COUNTER &&
|
if (rule->dest_attr.type &
|
||||||
rule->dest_attr.counter)
|
MLX5_FLOW_DESTINATION_TYPE_COUNTER)
|
||||||
__entry->counter_id =
|
__entry->counter_id =
|
||||||
rule->dest_attr.counter->id;
|
rule->dest_attr.counter_id;
|
||||||
),
|
),
|
||||||
TP_printk("rule=%p fte=%p index=%u sw_action=<%s> [dst] %s\n",
|
TP_printk("rule=%p fte=%p index=%u sw_action=<%s> [dst] %s\n",
|
||||||
__entry->rule, __entry->fte, __entry->index,
|
__entry->rule, __entry->fte, __entry->index,
|
||||||
|
|
|
@ -153,7 +153,7 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb)
|
||||||
|
|
||||||
if (enable_uc_lb)
|
if (enable_uc_lb)
|
||||||
MLX5_SET(modify_tir_in, in, ctx.self_lb_block,
|
MLX5_SET(modify_tir_in, in, ctx.self_lb_block,
|
||||||
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST_);
|
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST);
|
||||||
|
|
||||||
MLX5_SET(modify_tir_in, in, bitmask.self_lb_en, 1);
|
MLX5_SET(modify_tir_in, in, bitmask.self_lb_en, 1);
|
||||||
|
|
||||||
|
|
|
@ -3392,9 +3392,6 @@ static int mlx5e_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = cb_priv;
|
struct mlx5e_priv *priv = cb_priv;
|
||||||
|
|
||||||
if (!tc_cls_can_offload_and_chain0(priv->netdev, type_data))
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TC_SETUP_CLSFLOWER:
|
case TC_SETUP_CLSFLOWER:
|
||||||
return mlx5e_setup_tc_cls_flower(priv, type_data, MLX5E_TC_INGRESS);
|
return mlx5e_setup_tc_cls_flower(priv, type_data, MLX5E_TC_INGRESS);
|
||||||
|
|
|
@ -853,9 +853,6 @@ static int mlx5e_rep_setup_tc_cb_egdev(enum tc_setup_type type, void *type_data,
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = cb_priv;
|
struct mlx5e_priv *priv = cb_priv;
|
||||||
|
|
||||||
if (!tc_cls_can_offload_and_chain0(priv->netdev, type_data))
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TC_SETUP_CLSFLOWER:
|
case TC_SETUP_CLSFLOWER:
|
||||||
return mlx5e_rep_setup_tc_cls_flower(priv, type_data, MLX5E_TC_EGRESS);
|
return mlx5e_rep_setup_tc_cls_flower(priv, type_data, MLX5E_TC_EGRESS);
|
||||||
|
@ -869,9 +866,6 @@ static int mlx5e_rep_setup_tc_cb(enum tc_setup_type type, void *type_data,
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = cb_priv;
|
struct mlx5e_priv *priv = cb_priv;
|
||||||
|
|
||||||
if (!tc_cls_can_offload_and_chain0(priv->netdev, type_data))
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TC_SETUP_CLSFLOWER:
|
case TC_SETUP_CLSFLOWER:
|
||||||
return mlx5e_rep_setup_tc_cls_flower(priv, type_data, MLX5E_TC_INGRESS);
|
return mlx5e_rep_setup_tc_cls_flower(priv, type_data, MLX5E_TC_INGRESS);
|
||||||
|
|
|
@ -61,6 +61,7 @@ struct mlx5_nic_flow_attr {
|
||||||
u32 hairpin_tirn;
|
u32 hairpin_tirn;
|
||||||
u8 match_level;
|
u8 match_level;
|
||||||
struct mlx5_flow_table *hairpin_ft;
|
struct mlx5_flow_table *hairpin_ft;
|
||||||
|
struct mlx5_fc *counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MLX5E_TC_FLOW_BASE (MLX5E_TC_LAST_EXPORTED_BIT + 1)
|
#define MLX5E_TC_FLOW_BASE (MLX5E_TC_LAST_EXPORTED_BIT + 1)
|
||||||
|
@ -73,6 +74,7 @@ enum {
|
||||||
MLX5E_TC_FLOW_OFFLOADED = BIT(MLX5E_TC_FLOW_BASE + 2),
|
MLX5E_TC_FLOW_OFFLOADED = BIT(MLX5E_TC_FLOW_BASE + 2),
|
||||||
MLX5E_TC_FLOW_HAIRPIN = BIT(MLX5E_TC_FLOW_BASE + 3),
|
MLX5E_TC_FLOW_HAIRPIN = BIT(MLX5E_TC_FLOW_BASE + 3),
|
||||||
MLX5E_TC_FLOW_HAIRPIN_RSS = BIT(MLX5E_TC_FLOW_BASE + 4),
|
MLX5E_TC_FLOW_HAIRPIN_RSS = BIT(MLX5E_TC_FLOW_BASE + 4),
|
||||||
|
MLX5E_TC_FLOW_SLOW = BIT(MLX5E_TC_FLOW_BASE + 5),
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MLX5E_TC_MAX_SPLITS 1
|
#define MLX5E_TC_MAX_SPLITS 1
|
||||||
|
@ -81,7 +83,7 @@ struct mlx5e_tc_flow {
|
||||||
struct rhash_head node;
|
struct rhash_head node;
|
||||||
struct mlx5e_priv *priv;
|
struct mlx5e_priv *priv;
|
||||||
u64 cookie;
|
u64 cookie;
|
||||||
u8 flags;
|
u16 flags;
|
||||||
struct mlx5_flow_handle *rule[MLX5E_TC_MAX_SPLITS + 1];
|
struct mlx5_flow_handle *rule[MLX5E_TC_MAX_SPLITS + 1];
|
||||||
struct list_head encap; /* flows sharing the same encap ID */
|
struct list_head encap; /* flows sharing the same encap ID */
|
||||||
struct list_head mod_hdr; /* flows sharing the same mod hdr ID */
|
struct list_head mod_hdr; /* flows sharing the same mod hdr ID */
|
||||||
|
@ -100,11 +102,6 @@ struct mlx5e_tc_flow_parse_attr {
|
||||||
int mirred_ifindex;
|
int mirred_ifindex;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
MLX5_HEADER_TYPE_VXLAN = 0x0,
|
|
||||||
MLX5_HEADER_TYPE_NVGRE = 0x1,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define MLX5E_TC_TABLE_NUM_GROUPS 4
|
#define MLX5E_TC_TABLE_NUM_GROUPS 4
|
||||||
#define MLX5E_TC_TABLE_MAX_GROUP_SIZE BIT(16)
|
#define MLX5E_TC_TABLE_MAX_GROUP_SIZE BIT(16)
|
||||||
|
|
||||||
|
@ -677,7 +674,7 @@ static void mlx5e_hairpin_flow_del(struct mlx5e_priv *priv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mlx5_flow_handle *
|
static int
|
||||||
mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
|
mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
|
||||||
struct mlx5e_tc_flow_parse_attr *parse_attr,
|
struct mlx5e_tc_flow_parse_attr *parse_attr,
|
||||||
struct mlx5e_tc_flow *flow,
|
struct mlx5e_tc_flow *flow,
|
||||||
|
@ -688,19 +685,17 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
|
||||||
struct mlx5_flow_destination dest[2] = {};
|
struct mlx5_flow_destination dest[2] = {};
|
||||||
struct mlx5_flow_act flow_act = {
|
struct mlx5_flow_act flow_act = {
|
||||||
.action = attr->action,
|
.action = attr->action,
|
||||||
.has_flow_tag = true,
|
|
||||||
.flow_tag = attr->flow_tag,
|
.flow_tag = attr->flow_tag,
|
||||||
.encap_id = 0,
|
.reformat_id = 0,
|
||||||
|
.flags = FLOW_ACT_HAS_TAG | FLOW_ACT_NO_APPEND,
|
||||||
};
|
};
|
||||||
struct mlx5_fc *counter = NULL;
|
struct mlx5_fc *counter = NULL;
|
||||||
struct mlx5_flow_handle *rule;
|
|
||||||
bool table_created = false;
|
bool table_created = false;
|
||||||
int err, dest_ix = 0;
|
int err, dest_ix = 0;
|
||||||
|
|
||||||
if (flow->flags & MLX5E_TC_FLOW_HAIRPIN) {
|
if (flow->flags & MLX5E_TC_FLOW_HAIRPIN) {
|
||||||
err = mlx5e_hairpin_flow_add(priv, flow, parse_attr, extack);
|
err = mlx5e_hairpin_flow_add(priv, flow, parse_attr, extack);
|
||||||
if (err) {
|
if (err) {
|
||||||
rule = ERR_PTR(err);
|
|
||||||
goto err_add_hairpin_flow;
|
goto err_add_hairpin_flow;
|
||||||
}
|
}
|
||||||
if (flow->flags & MLX5E_TC_FLOW_HAIRPIN_RSS) {
|
if (flow->flags & MLX5E_TC_FLOW_HAIRPIN_RSS) {
|
||||||
|
@ -720,22 +715,21 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
|
||||||
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
|
||||||
counter = mlx5_fc_create(dev, true);
|
counter = mlx5_fc_create(dev, true);
|
||||||
if (IS_ERR(counter)) {
|
if (IS_ERR(counter)) {
|
||||||
rule = ERR_CAST(counter);
|
err = PTR_ERR(counter);
|
||||||
goto err_fc_create;
|
goto err_fc_create;
|
||||||
}
|
}
|
||||||
dest[dest_ix].type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
dest[dest_ix].type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
||||||
dest[dest_ix].counter = counter;
|
dest[dest_ix].counter_id = mlx5_fc_id(counter);
|
||||||
dest_ix++;
|
dest_ix++;
|
||||||
|
attr->counter = counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
|
||||||
err = mlx5e_attach_mod_hdr(priv, flow, parse_attr);
|
err = mlx5e_attach_mod_hdr(priv, flow, parse_attr);
|
||||||
flow_act.modify_id = attr->mod_hdr_id;
|
flow_act.modify_id = attr->mod_hdr_id;
|
||||||
kfree(parse_attr->mod_hdr_actions);
|
kfree(parse_attr->mod_hdr_actions);
|
||||||
if (err) {
|
if (err)
|
||||||
rule = ERR_PTR(err);
|
|
||||||
goto err_create_mod_hdr_id;
|
goto err_create_mod_hdr_id;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ERR_OR_NULL(priv->fs.tc.t)) {
|
if (IS_ERR_OR_NULL(priv->fs.tc.t)) {
|
||||||
|
@ -761,7 +755,7 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
|
||||||
"Failed to create tc offload table\n");
|
"Failed to create tc offload table\n");
|
||||||
netdev_err(priv->netdev,
|
netdev_err(priv->netdev,
|
||||||
"Failed to create tc offload table\n");
|
"Failed to create tc offload table\n");
|
||||||
rule = ERR_CAST(priv->fs.tc.t);
|
err = PTR_ERR(priv->fs.tc.t);
|
||||||
goto err_create_ft;
|
goto err_create_ft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,13 +765,15 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
|
||||||
if (attr->match_level != MLX5_MATCH_NONE)
|
if (attr->match_level != MLX5_MATCH_NONE)
|
||||||
parse_attr->spec.match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
|
parse_attr->spec.match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
|
||||||
|
|
||||||
rule = mlx5_add_flow_rules(priv->fs.tc.t, &parse_attr->spec,
|
flow->rule[0] = mlx5_add_flow_rules(priv->fs.tc.t, &parse_attr->spec,
|
||||||
&flow_act, dest, dest_ix);
|
&flow_act, dest, dest_ix);
|
||||||
|
|
||||||
if (IS_ERR(rule))
|
if (IS_ERR(flow->rule[0])) {
|
||||||
|
err = PTR_ERR(flow->rule[0]);
|
||||||
goto err_add_rule;
|
goto err_add_rule;
|
||||||
|
}
|
||||||
|
|
||||||
return rule;
|
return 0;
|
||||||
|
|
||||||
err_add_rule:
|
err_add_rule:
|
||||||
if (table_created) {
|
if (table_created) {
|
||||||
|
@ -793,7 +789,7 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
|
||||||
if (flow->flags & MLX5E_TC_FLOW_HAIRPIN)
|
if (flow->flags & MLX5E_TC_FLOW_HAIRPIN)
|
||||||
mlx5e_hairpin_flow_del(priv, flow);
|
mlx5e_hairpin_flow_del(priv, flow);
|
||||||
err_add_hairpin_flow:
|
err_add_hairpin_flow:
|
||||||
return rule;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
|
static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
|
||||||
|
@ -802,7 +798,7 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
|
||||||
struct mlx5_nic_flow_attr *attr = flow->nic_attr;
|
struct mlx5_nic_flow_attr *attr = flow->nic_attr;
|
||||||
struct mlx5_fc *counter = NULL;
|
struct mlx5_fc *counter = NULL;
|
||||||
|
|
||||||
counter = mlx5_flow_rule_counter(flow->rule[0]);
|
counter = attr->counter;
|
||||||
mlx5_del_flow_rules(flow->rule[0]);
|
mlx5_del_flow_rules(flow->rule[0]);
|
||||||
mlx5_fc_destroy(priv->mdev, counter);
|
mlx5_fc_destroy(priv->mdev, counter);
|
||||||
|
|
||||||
|
@ -829,28 +825,115 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
|
||||||
struct netlink_ext_ack *extack);
|
struct netlink_ext_ack *extack);
|
||||||
|
|
||||||
static struct mlx5_flow_handle *
|
static struct mlx5_flow_handle *
|
||||||
|
mlx5e_tc_offload_fdb_rules(struct mlx5_eswitch *esw,
|
||||||
|
struct mlx5e_tc_flow *flow,
|
||||||
|
struct mlx5_flow_spec *spec,
|
||||||
|
struct mlx5_esw_flow_attr *attr)
|
||||||
|
{
|
||||||
|
struct mlx5_flow_handle *rule;
|
||||||
|
|
||||||
|
rule = mlx5_eswitch_add_offloaded_rule(esw, spec, attr);
|
||||||
|
if (IS_ERR(rule))
|
||||||
|
return rule;
|
||||||
|
|
||||||
|
if (attr->mirror_count) {
|
||||||
|
flow->rule[1] = mlx5_eswitch_add_fwd_rule(esw, spec, attr);
|
||||||
|
if (IS_ERR(flow->rule[1])) {
|
||||||
|
mlx5_eswitch_del_offloaded_rule(esw, rule, attr);
|
||||||
|
return flow->rule[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mlx5e_tc_unoffload_fdb_rules(struct mlx5_eswitch *esw,
|
||||||
|
struct mlx5e_tc_flow *flow,
|
||||||
|
struct mlx5_esw_flow_attr *attr)
|
||||||
|
{
|
||||||
|
flow->flags &= ~MLX5E_TC_FLOW_OFFLOADED;
|
||||||
|
|
||||||
|
if (attr->mirror_count)
|
||||||
|
mlx5_eswitch_del_fwd_rule(esw, flow->rule[1], attr);
|
||||||
|
|
||||||
|
mlx5_eswitch_del_offloaded_rule(esw, flow->rule[0], attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct mlx5_flow_handle *
|
||||||
|
mlx5e_tc_offload_to_slow_path(struct mlx5_eswitch *esw,
|
||||||
|
struct mlx5e_tc_flow *flow,
|
||||||
|
struct mlx5_flow_spec *spec,
|
||||||
|
struct mlx5_esw_flow_attr *slow_attr)
|
||||||
|
{
|
||||||
|
struct mlx5_flow_handle *rule;
|
||||||
|
|
||||||
|
memcpy(slow_attr, flow->esw_attr, sizeof(*slow_attr));
|
||||||
|
slow_attr->action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
|
||||||
|
slow_attr->mirror_count = 0,
|
||||||
|
slow_attr->dest_chain = FDB_SLOW_PATH_CHAIN,
|
||||||
|
|
||||||
|
rule = mlx5e_tc_offload_fdb_rules(esw, flow, spec, slow_attr);
|
||||||
|
if (!IS_ERR(rule))
|
||||||
|
flow->flags |= MLX5E_TC_FLOW_SLOW;
|
||||||
|
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mlx5e_tc_unoffload_from_slow_path(struct mlx5_eswitch *esw,
|
||||||
|
struct mlx5e_tc_flow *flow,
|
||||||
|
struct mlx5_esw_flow_attr *slow_attr)
|
||||||
|
{
|
||||||
|
memcpy(slow_attr, flow->esw_attr, sizeof(*slow_attr));
|
||||||
|
mlx5e_tc_unoffload_fdb_rules(esw, flow, slow_attr);
|
||||||
|
flow->flags &= ~MLX5E_TC_FLOW_SLOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
|
mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
|
||||||
struct mlx5e_tc_flow_parse_attr *parse_attr,
|
struct mlx5e_tc_flow_parse_attr *parse_attr,
|
||||||
struct mlx5e_tc_flow *flow,
|
struct mlx5e_tc_flow *flow,
|
||||||
struct netlink_ext_ack *extack)
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
||||||
|
u32 max_chain = mlx5_eswitch_get_chain_range(esw);
|
||||||
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
||||||
|
u16 max_prio = mlx5_eswitch_get_prio_range(esw);
|
||||||
struct net_device *out_dev, *encap_dev = NULL;
|
struct net_device *out_dev, *encap_dev = NULL;
|
||||||
struct mlx5_flow_handle *rule = NULL;
|
struct mlx5_fc *counter = NULL;
|
||||||
struct mlx5e_rep_priv *rpriv;
|
struct mlx5e_rep_priv *rpriv;
|
||||||
struct mlx5e_priv *out_priv;
|
struct mlx5e_priv *out_priv;
|
||||||
int err;
|
int err = 0, encap_err = 0;
|
||||||
|
|
||||||
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) {
|
/* if prios are not supported, keep the old behaviour of using same prio
|
||||||
|
* for all offloaded rules.
|
||||||
|
*/
|
||||||
|
if (!mlx5_eswitch_prios_supported(esw))
|
||||||
|
attr->prio = 1;
|
||||||
|
|
||||||
|
if (attr->chain > max_chain) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Requested chain is out of supported range");
|
||||||
|
err = -EOPNOTSUPP;
|
||||||
|
goto err_max_prio_chain;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attr->prio > max_prio) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Requested priority is out of supported range");
|
||||||
|
err = -EOPNOTSUPP;
|
||||||
|
goto err_max_prio_chain;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT) {
|
||||||
out_dev = __dev_get_by_index(dev_net(priv->netdev),
|
out_dev = __dev_get_by_index(dev_net(priv->netdev),
|
||||||
attr->parse_attr->mirred_ifindex);
|
attr->parse_attr->mirred_ifindex);
|
||||||
err = mlx5e_attach_encap(priv, &parse_attr->tun_info,
|
encap_err = mlx5e_attach_encap(priv, &parse_attr->tun_info,
|
||||||
out_dev, &encap_dev, flow, extack);
|
out_dev, &encap_dev, flow,
|
||||||
if (err) {
|
extack);
|
||||||
rule = ERR_PTR(err);
|
if (encap_err && encap_err != -EAGAIN) {
|
||||||
if (err != -EAGAIN)
|
err = encap_err;
|
||||||
goto err_attach_encap;
|
goto err_attach_encap;
|
||||||
}
|
}
|
||||||
out_priv = netdev_priv(encap_dev);
|
out_priv = netdev_priv(encap_dev);
|
||||||
rpriv = out_priv->ppriv;
|
rpriv = out_priv->ppriv;
|
||||||
|
@ -859,49 +942,58 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = mlx5_eswitch_add_vlan_action(esw, attr);
|
err = mlx5_eswitch_add_vlan_action(esw, attr);
|
||||||
if (err) {
|
if (err)
|
||||||
rule = ERR_PTR(err);
|
|
||||||
goto err_add_vlan;
|
goto err_add_vlan;
|
||||||
}
|
|
||||||
|
|
||||||
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
|
||||||
err = mlx5e_attach_mod_hdr(priv, flow, parse_attr);
|
err = mlx5e_attach_mod_hdr(priv, flow, parse_attr);
|
||||||
kfree(parse_attr->mod_hdr_actions);
|
kfree(parse_attr->mod_hdr_actions);
|
||||||
if (err) {
|
if (err)
|
||||||
rule = ERR_PTR(err);
|
|
||||||
goto err_mod_hdr;
|
goto err_mod_hdr;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we get here if (1) there's no error (rule being null) or when
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
|
||||||
|
counter = mlx5_fc_create(esw->dev, true);
|
||||||
|
if (IS_ERR(counter)) {
|
||||||
|
err = PTR_ERR(counter);
|
||||||
|
goto err_create_counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
attr->counter = counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we get here if (1) there's no error or when
|
||||||
* (2) there's an encap action and we're on -EAGAIN (no valid neigh)
|
* (2) there's an encap action and we're on -EAGAIN (no valid neigh)
|
||||||
*/
|
*/
|
||||||
if (rule != ERR_PTR(-EAGAIN)) {
|
if (encap_err == -EAGAIN) {
|
||||||
rule = mlx5_eswitch_add_offloaded_rule(esw, &parse_attr->spec, attr);
|
/* continue with goto slow path rule instead */
|
||||||
if (IS_ERR(rule))
|
struct mlx5_esw_flow_attr slow_attr;
|
||||||
goto err_add_rule;
|
|
||||||
|
|
||||||
if (attr->mirror_count) {
|
flow->rule[0] = mlx5e_tc_offload_to_slow_path(esw, flow, &parse_attr->spec, &slow_attr);
|
||||||
flow->rule[1] = mlx5_eswitch_add_fwd_rule(esw, &parse_attr->spec, attr);
|
} else {
|
||||||
if (IS_ERR(flow->rule[1]))
|
flow->rule[0] = mlx5e_tc_offload_fdb_rules(esw, flow, &parse_attr->spec, attr);
|
||||||
goto err_fwd_rule;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return rule;
|
|
||||||
|
|
||||||
err_fwd_rule:
|
if (IS_ERR(flow->rule[0])) {
|
||||||
mlx5_eswitch_del_offloaded_rule(esw, rule, attr);
|
err = PTR_ERR(flow->rule[0]);
|
||||||
rule = flow->rule[1];
|
goto err_add_rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
err_add_rule:
|
err_add_rule:
|
||||||
|
mlx5_fc_destroy(esw->dev, counter);
|
||||||
|
err_create_counter:
|
||||||
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
|
||||||
mlx5e_detach_mod_hdr(priv, flow);
|
mlx5e_detach_mod_hdr(priv, flow);
|
||||||
err_mod_hdr:
|
err_mod_hdr:
|
||||||
mlx5_eswitch_del_vlan_action(esw, attr);
|
mlx5_eswitch_del_vlan_action(esw, attr);
|
||||||
err_add_vlan:
|
err_add_vlan:
|
||||||
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT)
|
||||||
mlx5e_detach_encap(priv, flow);
|
mlx5e_detach_encap(priv, flow);
|
||||||
err_attach_encap:
|
err_attach_encap:
|
||||||
return rule;
|
err_max_prio_chain:
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
|
static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
|
||||||
|
@ -909,36 +1001,43 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
|
||||||
{
|
{
|
||||||
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
||||||
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
||||||
|
struct mlx5_esw_flow_attr slow_attr;
|
||||||
|
|
||||||
if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) {
|
if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) {
|
||||||
flow->flags &= ~MLX5E_TC_FLOW_OFFLOADED;
|
if (flow->flags & MLX5E_TC_FLOW_SLOW)
|
||||||
if (attr->mirror_count)
|
mlx5e_tc_unoffload_from_slow_path(esw, flow, &slow_attr);
|
||||||
mlx5_eswitch_del_offloaded_rule(esw, flow->rule[1], attr);
|
else
|
||||||
mlx5_eswitch_del_offloaded_rule(esw, flow->rule[0], attr);
|
mlx5e_tc_unoffload_fdb_rules(esw, flow, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
mlx5_eswitch_del_vlan_action(esw, attr);
|
mlx5_eswitch_del_vlan_action(esw, attr);
|
||||||
|
|
||||||
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) {
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT) {
|
||||||
mlx5e_detach_encap(priv, flow);
|
mlx5e_detach_encap(priv, flow);
|
||||||
kvfree(attr->parse_attr);
|
kvfree(attr->parse_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
|
||||||
mlx5e_detach_mod_hdr(priv, flow);
|
mlx5e_detach_mod_hdr(priv, flow);
|
||||||
|
|
||||||
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_COUNT)
|
||||||
|
mlx5_fc_destroy(esw->dev, attr->counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
|
void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
|
||||||
struct mlx5e_encap_entry *e)
|
struct mlx5e_encap_entry *e)
|
||||||
{
|
{
|
||||||
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
||||||
struct mlx5_esw_flow_attr *esw_attr;
|
struct mlx5_esw_flow_attr slow_attr, *esw_attr;
|
||||||
|
struct mlx5_flow_handle *rule;
|
||||||
|
struct mlx5_flow_spec *spec;
|
||||||
struct mlx5e_tc_flow *flow;
|
struct mlx5e_tc_flow *flow;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = mlx5_encap_alloc(priv->mdev, e->tunnel_type,
|
err = mlx5_packet_reformat_alloc(priv->mdev, e->tunnel_type,
|
||||||
e->encap_size, e->encap_header,
|
e->encap_size, e->encap_header,
|
||||||
&e->encap_id);
|
MLX5_FLOW_NAMESPACE_FDB,
|
||||||
|
&e->encap_id);
|
||||||
if (err) {
|
if (err) {
|
||||||
mlx5_core_warn(priv->mdev, "Failed to offload cached encapsulation header, %d\n",
|
mlx5_core_warn(priv->mdev, "Failed to offload cached encapsulation header, %d\n",
|
||||||
err);
|
err);
|
||||||
|
@ -950,26 +1049,20 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
|
||||||
list_for_each_entry(flow, &e->flows, encap) {
|
list_for_each_entry(flow, &e->flows, encap) {
|
||||||
esw_attr = flow->esw_attr;
|
esw_attr = flow->esw_attr;
|
||||||
esw_attr->encap_id = e->encap_id;
|
esw_attr->encap_id = e->encap_id;
|
||||||
flow->rule[0] = mlx5_eswitch_add_offloaded_rule(esw, &esw_attr->parse_attr->spec, esw_attr);
|
spec = &esw_attr->parse_attr->spec;
|
||||||
if (IS_ERR(flow->rule[0])) {
|
|
||||||
err = PTR_ERR(flow->rule[0]);
|
/* update from slow path rule to encap rule */
|
||||||
|
rule = mlx5e_tc_offload_fdb_rules(esw, flow, spec, esw_attr);
|
||||||
|
if (IS_ERR(rule)) {
|
||||||
|
err = PTR_ERR(rule);
|
||||||
mlx5_core_warn(priv->mdev, "Failed to update cached encapsulation flow, %d\n",
|
mlx5_core_warn(priv->mdev, "Failed to update cached encapsulation flow, %d\n",
|
||||||
err);
|
err);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (esw_attr->mirror_count) {
|
mlx5e_tc_unoffload_from_slow_path(esw, flow, &slow_attr);
|
||||||
flow->rule[1] = mlx5_eswitch_add_fwd_rule(esw, &esw_attr->parse_attr->spec, esw_attr);
|
flow->flags |= MLX5E_TC_FLOW_OFFLOADED; /* was unset when slow path rule removed */
|
||||||
if (IS_ERR(flow->rule[1])) {
|
flow->rule[0] = rule;
|
||||||
mlx5_eswitch_del_offloaded_rule(esw, flow->rule[0], esw_attr);
|
|
||||||
err = PTR_ERR(flow->rule[1]);
|
|
||||||
mlx5_core_warn(priv->mdev, "Failed to update cached mirror flow, %d\n",
|
|
||||||
err);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,25 +1070,44 @@ void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv,
|
||||||
struct mlx5e_encap_entry *e)
|
struct mlx5e_encap_entry *e)
|
||||||
{
|
{
|
||||||
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
||||||
|
struct mlx5_esw_flow_attr slow_attr;
|
||||||
|
struct mlx5_flow_handle *rule;
|
||||||
|
struct mlx5_flow_spec *spec;
|
||||||
struct mlx5e_tc_flow *flow;
|
struct mlx5e_tc_flow *flow;
|
||||||
|
int err;
|
||||||
|
|
||||||
list_for_each_entry(flow, &e->flows, encap) {
|
list_for_each_entry(flow, &e->flows, encap) {
|
||||||
if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) {
|
spec = &flow->esw_attr->parse_attr->spec;
|
||||||
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
|
||||||
|
|
||||||
flow->flags &= ~MLX5E_TC_FLOW_OFFLOADED;
|
/* update from encap rule to slow path rule */
|
||||||
if (attr->mirror_count)
|
rule = mlx5e_tc_offload_to_slow_path(esw, flow, spec, &slow_attr);
|
||||||
mlx5_eswitch_del_offloaded_rule(esw, flow->rule[1], attr);
|
|
||||||
mlx5_eswitch_del_offloaded_rule(esw, flow->rule[0], attr);
|
if (IS_ERR(rule)) {
|
||||||
|
err = PTR_ERR(rule);
|
||||||
|
mlx5_core_warn(priv->mdev, "Failed to update slow path (encap) flow, %d\n",
|
||||||
|
err);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mlx5e_tc_unoffload_fdb_rules(esw, flow, flow->esw_attr);
|
||||||
|
flow->flags |= MLX5E_TC_FLOW_OFFLOADED; /* was unset when fast path rule removed */
|
||||||
|
flow->rule[0] = rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->flags & MLX5_ENCAP_ENTRY_VALID) {
|
if (e->flags & MLX5_ENCAP_ENTRY_VALID) {
|
||||||
e->flags &= ~MLX5_ENCAP_ENTRY_VALID;
|
e->flags &= ~MLX5_ENCAP_ENTRY_VALID;
|
||||||
mlx5_encap_dealloc(priv->mdev, e->encap_id);
|
mlx5_packet_reformat_dealloc(priv->mdev, e->encap_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct mlx5_fc *mlx5e_tc_get_counter(struct mlx5e_tc_flow *flow)
|
||||||
|
{
|
||||||
|
if (flow->flags & MLX5E_TC_FLOW_ESWITCH)
|
||||||
|
return flow->esw_attr->counter;
|
||||||
|
else
|
||||||
|
return flow->nic_attr->counter;
|
||||||
|
}
|
||||||
|
|
||||||
void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
|
void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
|
||||||
{
|
{
|
||||||
struct mlx5e_neigh *m_neigh = &nhe->m_neigh;
|
struct mlx5e_neigh *m_neigh = &nhe->m_neigh;
|
||||||
|
@ -1021,7 +1133,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
|
||||||
continue;
|
continue;
|
||||||
list_for_each_entry(flow, &e->flows, encap) {
|
list_for_each_entry(flow, &e->flows, encap) {
|
||||||
if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) {
|
if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) {
|
||||||
counter = mlx5_flow_rule_counter(flow->rule[0]);
|
counter = mlx5e_tc_get_counter(flow);
|
||||||
mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse);
|
mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse);
|
||||||
if (time_after((unsigned long)lastuse, nhe->reported_lastuse)) {
|
if (time_after((unsigned long)lastuse, nhe->reported_lastuse)) {
|
||||||
neigh_used = true;
|
neigh_used = true;
|
||||||
|
@ -1061,7 +1173,7 @@ static void mlx5e_detach_encap(struct mlx5e_priv *priv,
|
||||||
mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e);
|
mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e);
|
||||||
|
|
||||||
if (e->flags & MLX5_ENCAP_ENTRY_VALID)
|
if (e->flags & MLX5_ENCAP_ENTRY_VALID)
|
||||||
mlx5_encap_dealloc(priv->mdev, e->encap_id);
|
mlx5_packet_reformat_dealloc(priv->mdev, e->encap_id);
|
||||||
|
|
||||||
hash_del_rcu(&e->encap_hlist);
|
hash_del_rcu(&e->encap_hlist);
|
||||||
kfree(e->encap_header);
|
kfree(e->encap_header);
|
||||||
|
@ -2391,7 +2503,7 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
switch (e->tunnel_type) {
|
switch (e->tunnel_type) {
|
||||||
case MLX5_HEADER_TYPE_VXLAN:
|
case MLX5_REFORMAT_TYPE_L2_TO_VXLAN:
|
||||||
fl4.flowi4_proto = IPPROTO_UDP;
|
fl4.flowi4_proto = IPPROTO_UDP;
|
||||||
fl4.fl4_dport = tun_key->tp_dst;
|
fl4.fl4_dport = tun_key->tp_dst;
|
||||||
break;
|
break;
|
||||||
|
@ -2435,7 +2547,7 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
|
||||||
read_unlock_bh(&n->lock);
|
read_unlock_bh(&n->lock);
|
||||||
|
|
||||||
switch (e->tunnel_type) {
|
switch (e->tunnel_type) {
|
||||||
case MLX5_HEADER_TYPE_VXLAN:
|
case MLX5_REFORMAT_TYPE_L2_TO_VXLAN:
|
||||||
gen_vxlan_header_ipv4(out_dev, encap_header,
|
gen_vxlan_header_ipv4(out_dev, encap_header,
|
||||||
ipv4_encap_size, e->h_dest, tos, ttl,
|
ipv4_encap_size, e->h_dest, tos, ttl,
|
||||||
fl4.daddr,
|
fl4.daddr,
|
||||||
|
@ -2455,8 +2567,10 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = mlx5_encap_alloc(priv->mdev, e->tunnel_type,
|
err = mlx5_packet_reformat_alloc(priv->mdev, e->tunnel_type,
|
||||||
ipv4_encap_size, encap_header, &e->encap_id);
|
ipv4_encap_size, encap_header,
|
||||||
|
MLX5_FLOW_NAMESPACE_FDB,
|
||||||
|
&e->encap_id);
|
||||||
if (err)
|
if (err)
|
||||||
goto destroy_neigh_entry;
|
goto destroy_neigh_entry;
|
||||||
|
|
||||||
|
@ -2500,7 +2614,7 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
switch (e->tunnel_type) {
|
switch (e->tunnel_type) {
|
||||||
case MLX5_HEADER_TYPE_VXLAN:
|
case MLX5_REFORMAT_TYPE_L2_TO_VXLAN:
|
||||||
fl6.flowi6_proto = IPPROTO_UDP;
|
fl6.flowi6_proto = IPPROTO_UDP;
|
||||||
fl6.fl6_dport = tun_key->tp_dst;
|
fl6.fl6_dport = tun_key->tp_dst;
|
||||||
break;
|
break;
|
||||||
|
@ -2544,7 +2658,7 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
|
||||||
read_unlock_bh(&n->lock);
|
read_unlock_bh(&n->lock);
|
||||||
|
|
||||||
switch (e->tunnel_type) {
|
switch (e->tunnel_type) {
|
||||||
case MLX5_HEADER_TYPE_VXLAN:
|
case MLX5_REFORMAT_TYPE_L2_TO_VXLAN:
|
||||||
gen_vxlan_header_ipv6(out_dev, encap_header,
|
gen_vxlan_header_ipv6(out_dev, encap_header,
|
||||||
ipv6_encap_size, e->h_dest, tos, ttl,
|
ipv6_encap_size, e->h_dest, tos, ttl,
|
||||||
&fl6.daddr,
|
&fl6.daddr,
|
||||||
|
@ -2565,8 +2679,10 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = mlx5_encap_alloc(priv->mdev, e->tunnel_type,
|
err = mlx5_packet_reformat_alloc(priv->mdev, e->tunnel_type,
|
||||||
ipv6_encap_size, encap_header, &e->encap_id);
|
ipv6_encap_size, encap_header,
|
||||||
|
MLX5_FLOW_NAMESPACE_FDB,
|
||||||
|
&e->encap_id);
|
||||||
if (err)
|
if (err)
|
||||||
goto destroy_neigh_entry;
|
goto destroy_neigh_entry;
|
||||||
|
|
||||||
|
@ -2617,7 +2733,7 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
|
||||||
|
|
||||||
if (mlx5_vxlan_lookup_port(priv->mdev->vxlan, be16_to_cpu(key->tp_dst)) &&
|
if (mlx5_vxlan_lookup_port(priv->mdev->vxlan, be16_to_cpu(key->tp_dst)) &&
|
||||||
MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap)) {
|
MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap)) {
|
||||||
tunnel_type = MLX5_HEADER_TYPE_VXLAN;
|
tunnel_type = MLX5_REFORMAT_TYPE_L2_TO_VXLAN;
|
||||||
} else {
|
} else {
|
||||||
NL_SET_ERR_MSG_MOD(extack,
|
NL_SET_ERR_MSG_MOD(extack,
|
||||||
"port isn't an offloaded vxlan udp dport");
|
"port isn't an offloaded vxlan udp dport");
|
||||||
|
@ -2728,6 +2844,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
|
||||||
struct mlx5e_tc_flow *flow,
|
struct mlx5e_tc_flow *flow,
|
||||||
struct netlink_ext_ack *extack)
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
|
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
||||||
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
||||||
struct mlx5e_rep_priv *rpriv = priv->ppriv;
|
struct mlx5e_rep_priv *rpriv = priv->ppriv;
|
||||||
struct ip_tunnel_info *info = NULL;
|
struct ip_tunnel_info *info = NULL;
|
||||||
|
@ -2797,7 +2914,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
|
||||||
parse_attr->mirred_ifindex = out_dev->ifindex;
|
parse_attr->mirred_ifindex = out_dev->ifindex;
|
||||||
parse_attr->tun_info = *info;
|
parse_attr->tun_info = *info;
|
||||||
attr->parse_attr = parse_attr;
|
attr->parse_attr = parse_attr;
|
||||||
action |= MLX5_FLOW_CONTEXT_ACTION_ENCAP |
|
action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT |
|
||||||
MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
|
MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
|
||||||
MLX5_FLOW_CONTEXT_ACTION_COUNT;
|
MLX5_FLOW_CONTEXT_ACTION_COUNT;
|
||||||
/* attr->out_rep is resolved when we handle encap */
|
/* attr->out_rep is resolved when we handle encap */
|
||||||
|
@ -2836,6 +2953,25 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_tcf_gact_goto_chain(a)) {
|
||||||
|
u32 dest_chain = tcf_gact_goto_chain_index(a);
|
||||||
|
u32 max_chain = mlx5_eswitch_get_chain_range(esw);
|
||||||
|
|
||||||
|
if (dest_chain <= attr->chain) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Goto earlier chain isn't supported");
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
if (dest_chain > max_chain) {
|
||||||
|
NL_SET_ERR_MSG(extack, "Requested destination chain is out of supported range");
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
|
||||||
|
MLX5_FLOW_CONTEXT_ACTION_COUNT;
|
||||||
|
attr->dest_chain = dest_chain;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2853,9 +2989,9 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_flags(int flags, u8 *flow_flags)
|
static void get_flags(int flags, u16 *flow_flags)
|
||||||
{
|
{
|
||||||
u8 __flow_flags = 0;
|
u16 __flow_flags = 0;
|
||||||
|
|
||||||
if (flags & MLX5E_TC_INGRESS)
|
if (flags & MLX5E_TC_INGRESS)
|
||||||
__flow_flags |= MLX5E_TC_FLOW_INGRESS;
|
__flow_flags |= MLX5E_TC_FLOW_INGRESS;
|
||||||
|
@ -2884,34 +3020,15 @@ static struct rhashtable *get_tc_ht(struct mlx5e_priv *priv)
|
||||||
return &priv->fs.tc.ht;
|
return &priv->fs.tc.ht;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx5e_configure_flower(struct mlx5e_priv *priv,
|
static int
|
||||||
struct tc_cls_flower_offload *f, int flags)
|
mlx5e_alloc_flow(struct mlx5e_priv *priv, int attr_size,
|
||||||
|
struct tc_cls_flower_offload *f, u16 flow_flags,
|
||||||
|
struct mlx5e_tc_flow_parse_attr **__parse_attr,
|
||||||
|
struct mlx5e_tc_flow **__flow)
|
||||||
{
|
{
|
||||||
struct netlink_ext_ack *extack = f->common.extack;
|
|
||||||
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
|
||||||
struct mlx5e_tc_flow_parse_attr *parse_attr;
|
struct mlx5e_tc_flow_parse_attr *parse_attr;
|
||||||
struct rhashtable *tc_ht = get_tc_ht(priv);
|
|
||||||
struct mlx5e_tc_flow *flow;
|
struct mlx5e_tc_flow *flow;
|
||||||
int attr_size, err = 0;
|
int err;
|
||||||
u8 flow_flags = 0;
|
|
||||||
|
|
||||||
get_flags(flags, &flow_flags);
|
|
||||||
|
|
||||||
flow = rhashtable_lookup_fast(tc_ht, &f->cookie, tc_ht_params);
|
|
||||||
if (flow) {
|
|
||||||
NL_SET_ERR_MSG_MOD(extack,
|
|
||||||
"flow cookie already exists, ignoring");
|
|
||||||
netdev_warn_once(priv->netdev, "flow cookie %lx already exists, ignoring\n", f->cookie);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (esw && esw->mode == SRIOV_OFFLOADS) {
|
|
||||||
flow_flags |= MLX5E_TC_FLOW_ESWITCH;
|
|
||||||
attr_size = sizeof(struct mlx5_esw_flow_attr);
|
|
||||||
} else {
|
|
||||||
flow_flags |= MLX5E_TC_FLOW_NIC;
|
|
||||||
attr_size = sizeof(struct mlx5_nic_flow_attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
flow = kzalloc(sizeof(*flow) + attr_size, GFP_KERNEL);
|
flow = kzalloc(sizeof(*flow) + attr_size, GFP_KERNEL);
|
||||||
parse_attr = kvzalloc(sizeof(*parse_attr), GFP_KERNEL);
|
parse_attr = kvzalloc(sizeof(*parse_attr), GFP_KERNEL);
|
||||||
|
@ -2925,49 +3042,161 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv,
|
||||||
flow->priv = priv;
|
flow->priv = priv;
|
||||||
|
|
||||||
err = parse_cls_flower(priv, flow, &parse_attr->spec, f);
|
err = parse_cls_flower(priv, flow, &parse_attr->spec, f);
|
||||||
if (err < 0)
|
if (err)
|
||||||
goto err_free;
|
goto err_free;
|
||||||
|
|
||||||
if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
|
*__flow = flow;
|
||||||
err = parse_tc_fdb_actions(priv, f->exts, parse_attr, flow,
|
*__parse_attr = parse_attr;
|
||||||
extack);
|
|
||||||
if (err < 0)
|
|
||||||
goto err_free;
|
|
||||||
flow->rule[0] = mlx5e_tc_add_fdb_flow(priv, parse_attr, flow,
|
|
||||||
extack);
|
|
||||||
} else {
|
|
||||||
err = parse_tc_nic_actions(priv, f->exts, parse_attr, flow,
|
|
||||||
extack);
|
|
||||||
if (err < 0)
|
|
||||||
goto err_free;
|
|
||||||
flow->rule[0] = mlx5e_tc_add_nic_flow(priv, parse_attr, flow,
|
|
||||||
extack);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IS_ERR(flow->rule[0])) {
|
return 0;
|
||||||
err = PTR_ERR(flow->rule[0]);
|
|
||||||
if (err != -EAGAIN)
|
|
||||||
goto err_free;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err != -EAGAIN)
|
|
||||||
flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
|
|
||||||
|
|
||||||
if (!(flow->flags & MLX5E_TC_FLOW_ESWITCH) ||
|
|
||||||
!(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
|
|
||||||
kvfree(parse_attr);
|
|
||||||
|
|
||||||
err = rhashtable_insert_fast(tc_ht, &flow->node, tc_ht_params);
|
|
||||||
if (err) {
|
|
||||||
mlx5e_tc_del_flow(priv, flow);
|
|
||||||
kfree(flow);
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
|
||||||
|
|
||||||
err_free:
|
err_free:
|
||||||
kvfree(parse_attr);
|
|
||||||
kfree(flow);
|
kfree(flow);
|
||||||
|
kvfree(parse_attr);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
|
||||||
|
struct tc_cls_flower_offload *f,
|
||||||
|
u16 flow_flags,
|
||||||
|
struct mlx5e_tc_flow **__flow)
|
||||||
|
{
|
||||||
|
struct netlink_ext_ack *extack = f->common.extack;
|
||||||
|
struct mlx5e_tc_flow_parse_attr *parse_attr;
|
||||||
|
struct mlx5e_tc_flow *flow;
|
||||||
|
int attr_size, err;
|
||||||
|
|
||||||
|
flow_flags |= MLX5E_TC_FLOW_ESWITCH;
|
||||||
|
attr_size = sizeof(struct mlx5_esw_flow_attr);
|
||||||
|
err = mlx5e_alloc_flow(priv, attr_size, f, flow_flags,
|
||||||
|
&parse_attr, &flow);
|
||||||
|
if (err)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
flow->esw_attr->chain = f->common.chain_index;
|
||||||
|
flow->esw_attr->prio = TC_H_MAJ(f->common.prio) >> 16;
|
||||||
|
err = parse_tc_fdb_actions(priv, f->exts, parse_attr, flow, extack);
|
||||||
|
if (err)
|
||||||
|
goto err_free;
|
||||||
|
|
||||||
|
err = mlx5e_tc_add_fdb_flow(priv, parse_attr, flow, extack);
|
||||||
|
if (err)
|
||||||
|
goto err_free;
|
||||||
|
|
||||||
|
if (!(flow->esw_attr->action &
|
||||||
|
MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT))
|
||||||
|
kvfree(parse_attr);
|
||||||
|
|
||||||
|
*__flow = flow;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_free:
|
||||||
|
kfree(flow);
|
||||||
|
kvfree(parse_attr);
|
||||||
|
out:
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
mlx5e_add_nic_flow(struct mlx5e_priv *priv,
|
||||||
|
struct tc_cls_flower_offload *f,
|
||||||
|
u16 flow_flags,
|
||||||
|
struct mlx5e_tc_flow **__flow)
|
||||||
|
{
|
||||||
|
struct netlink_ext_ack *extack = f->common.extack;
|
||||||
|
struct mlx5e_tc_flow_parse_attr *parse_attr;
|
||||||
|
struct mlx5e_tc_flow *flow;
|
||||||
|
int attr_size, err;
|
||||||
|
|
||||||
|
/* multi-chain not supported for NIC rules */
|
||||||
|
if (!tc_cls_can_offload_and_chain0(priv->netdev, &f->common))
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
flow_flags |= MLX5E_TC_FLOW_NIC;
|
||||||
|
attr_size = sizeof(struct mlx5_nic_flow_attr);
|
||||||
|
err = mlx5e_alloc_flow(priv, attr_size, f, flow_flags,
|
||||||
|
&parse_attr, &flow);
|
||||||
|
if (err)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
err = parse_tc_nic_actions(priv, f->exts, parse_attr, flow, extack);
|
||||||
|
if (err)
|
||||||
|
goto err_free;
|
||||||
|
|
||||||
|
err = mlx5e_tc_add_nic_flow(priv, parse_attr, flow, extack);
|
||||||
|
if (err)
|
||||||
|
goto err_free;
|
||||||
|
|
||||||
|
flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
|
||||||
|
kvfree(parse_attr);
|
||||||
|
*__flow = flow;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_free:
|
||||||
|
kfree(flow);
|
||||||
|
kvfree(parse_attr);
|
||||||
|
out:
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
mlx5e_tc_add_flow(struct mlx5e_priv *priv,
|
||||||
|
struct tc_cls_flower_offload *f,
|
||||||
|
int flags,
|
||||||
|
struct mlx5e_tc_flow **flow)
|
||||||
|
{
|
||||||
|
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
||||||
|
u16 flow_flags;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
get_flags(flags, &flow_flags);
|
||||||
|
|
||||||
|
if (!tc_can_offload_extack(priv->netdev, f->common.extack))
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
if (esw && esw->mode == SRIOV_OFFLOADS)
|
||||||
|
err = mlx5e_add_fdb_flow(priv, f, flow_flags, flow);
|
||||||
|
else
|
||||||
|
err = mlx5e_add_nic_flow(priv, f, flow_flags, flow);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx5e_configure_flower(struct mlx5e_priv *priv,
|
||||||
|
struct tc_cls_flower_offload *f, int flags)
|
||||||
|
{
|
||||||
|
struct netlink_ext_ack *extack = f->common.extack;
|
||||||
|
struct rhashtable *tc_ht = get_tc_ht(priv);
|
||||||
|
struct mlx5e_tc_flow *flow;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
flow = rhashtable_lookup_fast(tc_ht, &f->cookie, tc_ht_params);
|
||||||
|
if (flow) {
|
||||||
|
NL_SET_ERR_MSG_MOD(extack,
|
||||||
|
"flow cookie already exists, ignoring");
|
||||||
|
netdev_warn_once(priv->netdev,
|
||||||
|
"flow cookie %lx already exists, ignoring\n",
|
||||||
|
f->cookie);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = mlx5e_tc_add_flow(priv, f, flags, &flow);
|
||||||
|
if (err)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
err = rhashtable_insert_fast(tc_ht, &flow->node, tc_ht_params);
|
||||||
|
if (err)
|
||||||
|
goto err_free;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_free:
|
||||||
|
mlx5e_tc_del_flow(priv, flow);
|
||||||
|
kfree(flow);
|
||||||
|
out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3018,7 +3247,7 @@ int mlx5e_stats_flower(struct mlx5e_priv *priv,
|
||||||
if (!(flow->flags & MLX5E_TC_FLOW_OFFLOADED))
|
if (!(flow->flags & MLX5E_TC_FLOW_OFFLOADED))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
counter = mlx5_flow_rule_counter(flow->rule[0]);
|
counter = mlx5e_tc_get_counter(flow);
|
||||||
if (!counter)
|
if (!counter)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -263,7 +263,7 @@ static int esw_create_legacy_fdb_table(struct mlx5_eswitch *esw)
|
||||||
esw_debug(dev, "Create FDB log_max_size(%d)\n",
|
esw_debug(dev, "Create FDB log_max_size(%d)\n",
|
||||||
MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size));
|
MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size));
|
||||||
|
|
||||||
root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
|
root_ns = mlx5_get_fdb_sub_ns(dev, 0);
|
||||||
if (!root_ns) {
|
if (!root_ns) {
|
||||||
esw_warn(dev, "Failed to get FDB flow namespace\n");
|
esw_warn(dev, "Failed to get FDB flow namespace\n");
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
@ -1198,7 +1198,7 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,
|
||||||
if (counter) {
|
if (counter) {
|
||||||
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;
|
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;
|
||||||
drop_ctr_dst.type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
drop_ctr_dst.type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
||||||
drop_ctr_dst.counter = counter;
|
drop_ctr_dst.counter_id = mlx5_fc_id(counter);
|
||||||
dst = &drop_ctr_dst;
|
dst = &drop_ctr_dst;
|
||||||
dest_num++;
|
dest_num++;
|
||||||
}
|
}
|
||||||
|
@ -1285,7 +1285,7 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,
|
||||||
if (counter) {
|
if (counter) {
|
||||||
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;
|
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;
|
||||||
drop_ctr_dst.type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
drop_ctr_dst.type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
||||||
drop_ctr_dst.counter = counter;
|
drop_ctr_dst.counter_id = mlx5_fc_id(counter);
|
||||||
dst = &drop_ctr_dst;
|
dst = &drop_ctr_dst;
|
||||||
dest_num++;
|
dest_num++;
|
||||||
}
|
}
|
||||||
|
@ -1746,7 +1746,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
|
||||||
esw->enabled_vports = 0;
|
esw->enabled_vports = 0;
|
||||||
esw->mode = SRIOV_NONE;
|
esw->mode = SRIOV_NONE;
|
||||||
esw->offloads.inline_mode = MLX5_INLINE_MODE_NONE;
|
esw->offloads.inline_mode = MLX5_INLINE_MODE_NONE;
|
||||||
if (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, encap) &&
|
if (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, reformat) &&
|
||||||
MLX5_CAP_ESW_FLOWTABLE_FDB(dev, decap))
|
MLX5_CAP_ESW_FLOWTABLE_FDB(dev, decap))
|
||||||
esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_BASIC;
|
esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_BASIC;
|
||||||
else
|
else
|
||||||
|
|
|
@ -59,6 +59,10 @@
|
||||||
#define mlx5_esw_has_fwd_fdb(dev) \
|
#define mlx5_esw_has_fwd_fdb(dev) \
|
||||||
MLX5_CAP_ESW_FLOWTABLE(dev, fdb_multi_path_to_table)
|
MLX5_CAP_ESW_FLOWTABLE(dev, fdb_multi_path_to_table)
|
||||||
|
|
||||||
|
#define FDB_MAX_CHAIN 3
|
||||||
|
#define FDB_SLOW_PATH_CHAIN (FDB_MAX_CHAIN + 1)
|
||||||
|
#define FDB_MAX_PRIO 16
|
||||||
|
|
||||||
struct vport_ingress {
|
struct vport_ingress {
|
||||||
struct mlx5_flow_table *acl;
|
struct mlx5_flow_table *acl;
|
||||||
struct mlx5_flow_group *allow_untagged_spoofchk_grp;
|
struct mlx5_flow_group *allow_untagged_spoofchk_grp;
|
||||||
|
@ -120,6 +124,13 @@ struct mlx5_vport {
|
||||||
u16 enabled_events;
|
u16 enabled_events;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum offloads_fdb_flags {
|
||||||
|
ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED = BIT(0),
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const unsigned int ESW_POOLS[4];
|
||||||
|
|
||||||
|
#define PRIO_LEVELS 2
|
||||||
struct mlx5_eswitch_fdb {
|
struct mlx5_eswitch_fdb {
|
||||||
union {
|
union {
|
||||||
struct legacy_fdb {
|
struct legacy_fdb {
|
||||||
|
@ -130,16 +141,24 @@ struct mlx5_eswitch_fdb {
|
||||||
} legacy;
|
} legacy;
|
||||||
|
|
||||||
struct offloads_fdb {
|
struct offloads_fdb {
|
||||||
struct mlx5_flow_table *fast_fdb;
|
|
||||||
struct mlx5_flow_table *fwd_fdb;
|
|
||||||
struct mlx5_flow_table *slow_fdb;
|
struct mlx5_flow_table *slow_fdb;
|
||||||
struct mlx5_flow_group *send_to_vport_grp;
|
struct mlx5_flow_group *send_to_vport_grp;
|
||||||
struct mlx5_flow_group *miss_grp;
|
struct mlx5_flow_group *miss_grp;
|
||||||
struct mlx5_flow_handle *miss_rule_uni;
|
struct mlx5_flow_handle *miss_rule_uni;
|
||||||
struct mlx5_flow_handle *miss_rule_multi;
|
struct mlx5_flow_handle *miss_rule_multi;
|
||||||
int vlan_push_pop_refcount;
|
int vlan_push_pop_refcount;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct mlx5_flow_table *fdb;
|
||||||
|
u32 num_rules;
|
||||||
|
} fdb_prio[FDB_MAX_CHAIN + 1][FDB_MAX_PRIO + 1][PRIO_LEVELS];
|
||||||
|
/* Protects fdb_prio table */
|
||||||
|
struct mutex fdb_prio_lock;
|
||||||
|
|
||||||
|
int fdb_left[ARRAY_SIZE(ESW_POOLS)];
|
||||||
} offloads;
|
} offloads;
|
||||||
};
|
};
|
||||||
|
u32 flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_esw_offload {
|
struct mlx5_esw_offload {
|
||||||
|
@ -181,6 +200,7 @@ struct mlx5_eswitch {
|
||||||
|
|
||||||
struct mlx5_esw_offload offloads;
|
struct mlx5_esw_offload offloads;
|
||||||
int mode;
|
int mode;
|
||||||
|
int nvports;
|
||||||
};
|
};
|
||||||
|
|
||||||
void esw_offloads_cleanup(struct mlx5_eswitch *esw, int nvports);
|
void esw_offloads_cleanup(struct mlx5_eswitch *esw, int nvports);
|
||||||
|
@ -228,6 +248,19 @@ void
|
||||||
mlx5_eswitch_del_offloaded_rule(struct mlx5_eswitch *esw,
|
mlx5_eswitch_del_offloaded_rule(struct mlx5_eswitch *esw,
|
||||||
struct mlx5_flow_handle *rule,
|
struct mlx5_flow_handle *rule,
|
||||||
struct mlx5_esw_flow_attr *attr);
|
struct mlx5_esw_flow_attr *attr);
|
||||||
|
void
|
||||||
|
mlx5_eswitch_del_fwd_rule(struct mlx5_eswitch *esw,
|
||||||
|
struct mlx5_flow_handle *rule,
|
||||||
|
struct mlx5_esw_flow_attr *attr);
|
||||||
|
|
||||||
|
bool
|
||||||
|
mlx5_eswitch_prios_supported(struct mlx5_eswitch *esw);
|
||||||
|
|
||||||
|
u16
|
||||||
|
mlx5_eswitch_get_prio_range(struct mlx5_eswitch *esw);
|
||||||
|
|
||||||
|
u32
|
||||||
|
mlx5_eswitch_get_chain_range(struct mlx5_eswitch *esw);
|
||||||
|
|
||||||
struct mlx5_flow_handle *
|
struct mlx5_flow_handle *
|
||||||
mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport,
|
mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport,
|
||||||
|
@ -266,6 +299,10 @@ struct mlx5_esw_flow_attr {
|
||||||
u32 encap_id;
|
u32 encap_id;
|
||||||
u32 mod_hdr_id;
|
u32 mod_hdr_id;
|
||||||
u8 match_level;
|
u8 match_level;
|
||||||
|
struct mlx5_fc *counter;
|
||||||
|
u32 chain;
|
||||||
|
u16 prio;
|
||||||
|
u32 dest_chain;
|
||||||
struct mlx5e_tc_flow_parse_attr *parse_attr;
|
struct mlx5e_tc_flow_parse_attr *parse_attr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -318,6 +355,11 @@ static inline void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) {}
|
||||||
static inline void mlx5_eswitch_vport_event(struct mlx5_eswitch *esw, struct mlx5_eqe *eqe) {}
|
static inline void mlx5_eswitch_vport_event(struct mlx5_eswitch *esw, struct mlx5_eqe *eqe) {}
|
||||||
static inline int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) { return 0; }
|
static inline int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) { return 0; }
|
||||||
static inline void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw) {}
|
static inline void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw) {}
|
||||||
|
|
||||||
|
#define FDB_MAX_CHAIN 1
|
||||||
|
#define FDB_SLOW_PATH_CHAIN (FDB_MAX_CHAIN + 1)
|
||||||
|
#define FDB_MAX_PRIO 1
|
||||||
|
|
||||||
#endif /* CONFIG_MLX5_ESWITCH */
|
#endif /* CONFIG_MLX5_ESWITCH */
|
||||||
|
|
||||||
#endif /* __MLX5_ESWITCH_H__ */
|
#endif /* __MLX5_ESWITCH_H__ */
|
||||||
|
|
|
@ -37,33 +37,59 @@
|
||||||
#include <linux/mlx5/fs.h>
|
#include <linux/mlx5/fs.h>
|
||||||
#include "mlx5_core.h"
|
#include "mlx5_core.h"
|
||||||
#include "eswitch.h"
|
#include "eswitch.h"
|
||||||
|
#include "en.h"
|
||||||
|
#include "fs_core.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FDB_FAST_PATH = 0,
|
FDB_FAST_PATH = 0,
|
||||||
FDB_SLOW_PATH
|
FDB_SLOW_PATH
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define fdb_prio_table(esw, chain, prio, level) \
|
||||||
|
(esw)->fdb_table.offloads.fdb_prio[(chain)][(prio)][(level)]
|
||||||
|
|
||||||
|
static struct mlx5_flow_table *
|
||||||
|
esw_get_prio_table(struct mlx5_eswitch *esw, u32 chain, u16 prio, int level);
|
||||||
|
static void
|
||||||
|
esw_put_prio_table(struct mlx5_eswitch *esw, u32 chain, u16 prio, int level);
|
||||||
|
|
||||||
|
bool mlx5_eswitch_prios_supported(struct mlx5_eswitch *esw)
|
||||||
|
{
|
||||||
|
return (!!(esw->fdb_table.flags & ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED));
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 mlx5_eswitch_get_chain_range(struct mlx5_eswitch *esw)
|
||||||
|
{
|
||||||
|
if (esw->fdb_table.flags & ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED)
|
||||||
|
return FDB_MAX_CHAIN;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 mlx5_eswitch_get_prio_range(struct mlx5_eswitch *esw)
|
||||||
|
{
|
||||||
|
if (esw->fdb_table.flags & ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED)
|
||||||
|
return FDB_MAX_PRIO;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
struct mlx5_flow_handle *
|
struct mlx5_flow_handle *
|
||||||
mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
|
mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
|
||||||
struct mlx5_flow_spec *spec,
|
struct mlx5_flow_spec *spec,
|
||||||
struct mlx5_esw_flow_attr *attr)
|
struct mlx5_esw_flow_attr *attr)
|
||||||
{
|
{
|
||||||
struct mlx5_flow_destination dest[MLX5_MAX_FLOW_FWD_VPORTS + 1] = {};
|
struct mlx5_flow_destination dest[MLX5_MAX_FLOW_FWD_VPORTS + 1] = {};
|
||||||
struct mlx5_flow_act flow_act = {0};
|
struct mlx5_flow_act flow_act = { .flags = FLOW_ACT_NO_APPEND, };
|
||||||
struct mlx5_flow_table *ft = NULL;
|
bool mirror = !!(attr->mirror_count);
|
||||||
struct mlx5_fc *counter = NULL;
|
|
||||||
struct mlx5_flow_handle *rule;
|
struct mlx5_flow_handle *rule;
|
||||||
|
struct mlx5_flow_table *fdb;
|
||||||
int j, i = 0;
|
int j, i = 0;
|
||||||
void *misc;
|
void *misc;
|
||||||
|
|
||||||
if (esw->mode != SRIOV_OFFLOADS)
|
if (esw->mode != SRIOV_OFFLOADS)
|
||||||
return ERR_PTR(-EOPNOTSUPP);
|
return ERR_PTR(-EOPNOTSUPP);
|
||||||
|
|
||||||
if (attr->mirror_count)
|
|
||||||
ft = esw->fdb_table.offloads.fwd_fdb;
|
|
||||||
else
|
|
||||||
ft = esw->fdb_table.offloads.fast_fdb;
|
|
||||||
|
|
||||||
flow_act.action = attr->action;
|
flow_act.action = attr->action;
|
||||||
/* if per flow vlan pop/push is emulated, don't set that into the firmware */
|
/* if per flow vlan pop/push is emulated, don't set that into the firmware */
|
||||||
if (!mlx5_eswitch_vlan_actions_supported(esw->dev, 1))
|
if (!mlx5_eswitch_vlan_actions_supported(esw->dev, 1))
|
||||||
|
@ -81,23 +107,33 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
|
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
|
||||||
for (j = attr->mirror_count; j < attr->out_count; j++) {
|
if (attr->dest_chain) {
|
||||||
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
|
struct mlx5_flow_table *ft;
|
||||||
dest[i].vport.num = attr->out_rep[j]->vport;
|
|
||||||
dest[i].vport.vhca_id =
|
ft = esw_get_prio_table(esw, attr->dest_chain, 1, 0);
|
||||||
MLX5_CAP_GEN(attr->out_mdev[j], vhca_id);
|
if (IS_ERR(ft)) {
|
||||||
dest[i].vport.vhca_id_valid = !!MLX5_CAP_ESW(esw->dev, merged_eswitch);
|
rule = ERR_CAST(ft);
|
||||||
|
goto err_create_goto_table;
|
||||||
|
}
|
||||||
|
|
||||||
|
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
|
||||||
|
dest[i].ft = ft;
|
||||||
i++;
|
i++;
|
||||||
|
} else {
|
||||||
|
for (j = attr->mirror_count; j < attr->out_count; j++) {
|
||||||
|
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
|
||||||
|
dest[i].vport.num = attr->out_rep[j]->vport;
|
||||||
|
dest[i].vport.vhca_id =
|
||||||
|
MLX5_CAP_GEN(attr->out_mdev[j], vhca_id);
|
||||||
|
dest[i].vport.vhca_id_valid =
|
||||||
|
!!MLX5_CAP_ESW(esw->dev, merged_eswitch);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
|
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
|
||||||
counter = mlx5_fc_create(esw->dev, true);
|
|
||||||
if (IS_ERR(counter)) {
|
|
||||||
rule = ERR_CAST(counter);
|
|
||||||
goto err_counter_alloc;
|
|
||||||
}
|
|
||||||
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
|
||||||
dest[i].counter = counter;
|
dest[i].counter_id = mlx5_fc_id(attr->counter);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,10 +163,16 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
|
||||||
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
|
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
|
||||||
flow_act.modify_id = attr->mod_hdr_id;
|
flow_act.modify_id = attr->mod_hdr_id;
|
||||||
|
|
||||||
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
|
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT)
|
||||||
flow_act.encap_id = attr->encap_id;
|
flow_act.reformat_id = attr->encap_id;
|
||||||
|
|
||||||
rule = mlx5_add_flow_rules(ft, spec, &flow_act, dest, i);
|
fdb = esw_get_prio_table(esw, attr->chain, attr->prio, !!mirror);
|
||||||
|
if (IS_ERR(fdb)) {
|
||||||
|
rule = ERR_CAST(fdb);
|
||||||
|
goto err_esw_get;
|
||||||
|
}
|
||||||
|
|
||||||
|
rule = mlx5_add_flow_rules(fdb, spec, &flow_act, dest, i);
|
||||||
if (IS_ERR(rule))
|
if (IS_ERR(rule))
|
||||||
goto err_add_rule;
|
goto err_add_rule;
|
||||||
else
|
else
|
||||||
|
@ -139,8 +181,11 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
|
||||||
return rule;
|
return rule;
|
||||||
|
|
||||||
err_add_rule:
|
err_add_rule:
|
||||||
mlx5_fc_destroy(esw->dev, counter);
|
esw_put_prio_table(esw, attr->chain, attr->prio, !!mirror);
|
||||||
err_counter_alloc:
|
err_esw_get:
|
||||||
|
if (attr->dest_chain)
|
||||||
|
esw_put_prio_table(esw, attr->dest_chain, 1, 0);
|
||||||
|
err_create_goto_table:
|
||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,11 +195,25 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
|
||||||
struct mlx5_esw_flow_attr *attr)
|
struct mlx5_esw_flow_attr *attr)
|
||||||
{
|
{
|
||||||
struct mlx5_flow_destination dest[MLX5_MAX_FLOW_FWD_VPORTS + 1] = {};
|
struct mlx5_flow_destination dest[MLX5_MAX_FLOW_FWD_VPORTS + 1] = {};
|
||||||
struct mlx5_flow_act flow_act = {0};
|
struct mlx5_flow_act flow_act = { .flags = FLOW_ACT_NO_APPEND, };
|
||||||
|
struct mlx5_flow_table *fast_fdb;
|
||||||
|
struct mlx5_flow_table *fwd_fdb;
|
||||||
struct mlx5_flow_handle *rule;
|
struct mlx5_flow_handle *rule;
|
||||||
void *misc;
|
void *misc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
fast_fdb = esw_get_prio_table(esw, attr->chain, attr->prio, 0);
|
||||||
|
if (IS_ERR(fast_fdb)) {
|
||||||
|
rule = ERR_CAST(fast_fdb);
|
||||||
|
goto err_get_fast;
|
||||||
|
}
|
||||||
|
|
||||||
|
fwd_fdb = esw_get_prio_table(esw, attr->chain, attr->prio, 1);
|
||||||
|
if (IS_ERR(fwd_fdb)) {
|
||||||
|
rule = ERR_CAST(fwd_fdb);
|
||||||
|
goto err_get_fwd;
|
||||||
|
}
|
||||||
|
|
||||||
flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
|
flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
|
||||||
for (i = 0; i < attr->mirror_count; i++) {
|
for (i = 0; i < attr->mirror_count; i++) {
|
||||||
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
|
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
|
||||||
|
@ -164,7 +223,7 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
|
||||||
dest[i].vport.vhca_id_valid = !!MLX5_CAP_ESW(esw->dev, merged_eswitch);
|
dest[i].vport.vhca_id_valid = !!MLX5_CAP_ESW(esw->dev, merged_eswitch);
|
||||||
}
|
}
|
||||||
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
|
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
|
||||||
dest[i].ft = esw->fdb_table.offloads.fwd_fdb,
|
dest[i].ft = fwd_fdb,
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters);
|
misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters);
|
||||||
|
@ -187,12 +246,41 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
|
||||||
spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS |
|
spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS |
|
||||||
MLX5_MATCH_MISC_PARAMETERS;
|
MLX5_MATCH_MISC_PARAMETERS;
|
||||||
|
|
||||||
rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fast_fdb, spec, &flow_act, dest, i);
|
rule = mlx5_add_flow_rules(fast_fdb, spec, &flow_act, dest, i);
|
||||||
|
|
||||||
if (!IS_ERR(rule))
|
if (IS_ERR(rule))
|
||||||
esw->offloads.num_flows++;
|
goto add_err;
|
||||||
|
|
||||||
|
esw->offloads.num_flows++;
|
||||||
|
|
||||||
return rule;
|
return rule;
|
||||||
|
add_err:
|
||||||
|
esw_put_prio_table(esw, attr->chain, attr->prio, 1);
|
||||||
|
err_get_fwd:
|
||||||
|
esw_put_prio_table(esw, attr->chain, attr->prio, 0);
|
||||||
|
err_get_fast:
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
__mlx5_eswitch_del_rule(struct mlx5_eswitch *esw,
|
||||||
|
struct mlx5_flow_handle *rule,
|
||||||
|
struct mlx5_esw_flow_attr *attr,
|
||||||
|
bool fwd_rule)
|
||||||
|
{
|
||||||
|
bool mirror = (attr->mirror_count > 0);
|
||||||
|
|
||||||
|
mlx5_del_flow_rules(rule);
|
||||||
|
esw->offloads.num_flows--;
|
||||||
|
|
||||||
|
if (fwd_rule) {
|
||||||
|
esw_put_prio_table(esw, attr->chain, attr->prio, 1);
|
||||||
|
esw_put_prio_table(esw, attr->chain, attr->prio, 0);
|
||||||
|
} else {
|
||||||
|
esw_put_prio_table(esw, attr->chain, attr->prio, !!mirror);
|
||||||
|
if (attr->dest_chain)
|
||||||
|
esw_put_prio_table(esw, attr->dest_chain, 1, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -200,12 +288,15 @@ mlx5_eswitch_del_offloaded_rule(struct mlx5_eswitch *esw,
|
||||||
struct mlx5_flow_handle *rule,
|
struct mlx5_flow_handle *rule,
|
||||||
struct mlx5_esw_flow_attr *attr)
|
struct mlx5_esw_flow_attr *attr)
|
||||||
{
|
{
|
||||||
struct mlx5_fc *counter = NULL;
|
__mlx5_eswitch_del_rule(esw, rule, attr, false);
|
||||||
|
}
|
||||||
|
|
||||||
counter = mlx5_flow_rule_counter(rule);
|
void
|
||||||
mlx5_del_flow_rules(rule);
|
mlx5_eswitch_del_fwd_rule(struct mlx5_eswitch *esw,
|
||||||
mlx5_fc_destroy(esw->dev, counter);
|
struct mlx5_flow_handle *rule,
|
||||||
esw->offloads.num_flows--;
|
struct mlx5_esw_flow_attr *attr)
|
||||||
|
{
|
||||||
|
__mlx5_eswitch_del_rule(esw, rule, attr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int esw_set_global_vlan_pop(struct mlx5_eswitch *esw, u8 val)
|
static int esw_set_global_vlan_pop(struct mlx5_eswitch *esw, u8 val)
|
||||||
|
@ -294,7 +385,8 @@ int mlx5_eswitch_add_vlan_action(struct mlx5_eswitch *esw,
|
||||||
|
|
||||||
push = !!(attr->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH);
|
push = !!(attr->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH);
|
||||||
pop = !!(attr->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP);
|
pop = !!(attr->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP);
|
||||||
fwd = !!(attr->action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST);
|
fwd = !!((attr->action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) &&
|
||||||
|
!attr->dest_chain);
|
||||||
|
|
||||||
err = esw_add_vlan_action_check(attr, push, pop, fwd);
|
err = esw_add_vlan_action_check(attr, push, pop, fwd);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -501,74 +593,170 @@ static int esw_add_fdb_miss_rule(struct mlx5_eswitch *esw)
|
||||||
|
|
||||||
#define ESW_OFFLOADS_NUM_GROUPS 4
|
#define ESW_OFFLOADS_NUM_GROUPS 4
|
||||||
|
|
||||||
static int esw_create_offloads_fast_fdb_table(struct mlx5_eswitch *esw)
|
/* Firmware currently has 4 pool of 4 sizes that it supports (ESW_POOLS),
|
||||||
|
* and a virtual memory region of 16M (ESW_SIZE), this region is duplicated
|
||||||
|
* for each flow table pool. We can allocate up to 16M of each pool,
|
||||||
|
* and we keep track of how much we used via put/get_sz_to_pool.
|
||||||
|
* Firmware doesn't report any of this for now.
|
||||||
|
* ESW_POOL is expected to be sorted from large to small
|
||||||
|
*/
|
||||||
|
#define ESW_SIZE (16 * 1024 * 1024)
|
||||||
|
const unsigned int ESW_POOLS[4] = { 4 * 1024 * 1024, 1 * 1024 * 1024,
|
||||||
|
64 * 1024, 4 * 1024 };
|
||||||
|
|
||||||
|
static int
|
||||||
|
get_sz_from_pool(struct mlx5_eswitch *esw)
|
||||||
{
|
{
|
||||||
struct mlx5_core_dev *dev = esw->dev;
|
int sz = 0, i;
|
||||||
struct mlx5_flow_namespace *root_ns;
|
|
||||||
struct mlx5_flow_table *fdb = NULL;
|
|
||||||
int esw_size, err = 0;
|
|
||||||
u32 flags = 0;
|
|
||||||
u32 max_flow_counter = (MLX5_CAP_GEN(dev, max_flow_counter_31_16) << 16) |
|
|
||||||
MLX5_CAP_GEN(dev, max_flow_counter_15_0);
|
|
||||||
|
|
||||||
root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
|
for (i = 0; i < ARRAY_SIZE(ESW_POOLS); i++) {
|
||||||
if (!root_ns) {
|
if (esw->fdb_table.offloads.fdb_left[i]) {
|
||||||
esw_warn(dev, "Failed to get FDB flow namespace\n");
|
--esw->fdb_table.offloads.fdb_left[i];
|
||||||
err = -EOPNOTSUPP;
|
sz = ESW_POOLS[i];
|
||||||
goto out_namespace;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
esw_debug(dev, "Create offloads FDB table, min (max esw size(2^%d), max counters(%d)*groups(%d))\n",
|
return sz;
|
||||||
MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size),
|
|
||||||
max_flow_counter, ESW_OFFLOADS_NUM_GROUPS);
|
|
||||||
|
|
||||||
esw_size = min_t(int, max_flow_counter * ESW_OFFLOADS_NUM_GROUPS,
|
|
||||||
1 << MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size));
|
|
||||||
|
|
||||||
if (mlx5_esw_has_fwd_fdb(dev))
|
|
||||||
esw_size >>= 1;
|
|
||||||
|
|
||||||
if (esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE)
|
|
||||||
flags |= MLX5_FLOW_TABLE_TUNNEL_EN;
|
|
||||||
|
|
||||||
fdb = mlx5_create_auto_grouped_flow_table(root_ns, FDB_FAST_PATH,
|
|
||||||
esw_size,
|
|
||||||
ESW_OFFLOADS_NUM_GROUPS, 0,
|
|
||||||
flags);
|
|
||||||
if (IS_ERR(fdb)) {
|
|
||||||
err = PTR_ERR(fdb);
|
|
||||||
esw_warn(dev, "Failed to create Fast path FDB Table err %d\n", err);
|
|
||||||
goto out_namespace;
|
|
||||||
}
|
|
||||||
esw->fdb_table.offloads.fast_fdb = fdb;
|
|
||||||
|
|
||||||
if (!mlx5_esw_has_fwd_fdb(dev))
|
|
||||||
goto out_namespace;
|
|
||||||
|
|
||||||
fdb = mlx5_create_auto_grouped_flow_table(root_ns, FDB_FAST_PATH,
|
|
||||||
esw_size,
|
|
||||||
ESW_OFFLOADS_NUM_GROUPS, 1,
|
|
||||||
flags);
|
|
||||||
if (IS_ERR(fdb)) {
|
|
||||||
err = PTR_ERR(fdb);
|
|
||||||
esw_warn(dev, "Failed to create fwd table err %d\n", err);
|
|
||||||
goto out_ft;
|
|
||||||
}
|
|
||||||
esw->fdb_table.offloads.fwd_fdb = fdb;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
|
|
||||||
out_ft:
|
|
||||||
mlx5_destroy_flow_table(esw->fdb_table.offloads.fast_fdb);
|
|
||||||
out_namespace:
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void esw_destroy_offloads_fast_fdb_table(struct mlx5_eswitch *esw)
|
static void
|
||||||
|
put_sz_to_pool(struct mlx5_eswitch *esw, int sz)
|
||||||
{
|
{
|
||||||
if (mlx5_esw_has_fwd_fdb(esw->dev))
|
int i;
|
||||||
mlx5_destroy_flow_table(esw->fdb_table.offloads.fwd_fdb);
|
|
||||||
mlx5_destroy_flow_table(esw->fdb_table.offloads.fast_fdb);
|
for (i = 0; i < ARRAY_SIZE(ESW_POOLS); i++) {
|
||||||
|
if (sz >= ESW_POOLS[i]) {
|
||||||
|
++esw->fdb_table.offloads.fdb_left[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct mlx5_flow_table *
|
||||||
|
create_next_size_table(struct mlx5_eswitch *esw,
|
||||||
|
struct mlx5_flow_namespace *ns,
|
||||||
|
u16 table_prio,
|
||||||
|
int level,
|
||||||
|
u32 flags)
|
||||||
|
{
|
||||||
|
struct mlx5_flow_table *fdb;
|
||||||
|
int sz;
|
||||||
|
|
||||||
|
sz = get_sz_from_pool(esw);
|
||||||
|
if (!sz)
|
||||||
|
return ERR_PTR(-ENOSPC);
|
||||||
|
|
||||||
|
fdb = mlx5_create_auto_grouped_flow_table(ns,
|
||||||
|
table_prio,
|
||||||
|
sz,
|
||||||
|
ESW_OFFLOADS_NUM_GROUPS,
|
||||||
|
level,
|
||||||
|
flags);
|
||||||
|
if (IS_ERR(fdb)) {
|
||||||
|
esw_warn(esw->dev, "Failed to create FDB Table err %d (table prio: %d, level: %d, size: %d)\n",
|
||||||
|
(int)PTR_ERR(fdb), table_prio, level, sz);
|
||||||
|
put_sz_to_pool(esw, sz);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fdb;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct mlx5_flow_table *
|
||||||
|
esw_get_prio_table(struct mlx5_eswitch *esw, u32 chain, u16 prio, int level)
|
||||||
|
{
|
||||||
|
struct mlx5_core_dev *dev = esw->dev;
|
||||||
|
struct mlx5_flow_table *fdb = NULL;
|
||||||
|
struct mlx5_flow_namespace *ns;
|
||||||
|
int table_prio, l = 0;
|
||||||
|
u32 flags = 0;
|
||||||
|
|
||||||
|
if (chain == FDB_SLOW_PATH_CHAIN)
|
||||||
|
return esw->fdb_table.offloads.slow_fdb;
|
||||||
|
|
||||||
|
mutex_lock(&esw->fdb_table.offloads.fdb_prio_lock);
|
||||||
|
|
||||||
|
fdb = fdb_prio_table(esw, chain, prio, level).fdb;
|
||||||
|
if (fdb) {
|
||||||
|
/* take ref on earlier levels as well */
|
||||||
|
while (level >= 0)
|
||||||
|
fdb_prio_table(esw, chain, prio, level--).num_rules++;
|
||||||
|
mutex_unlock(&esw->fdb_table.offloads.fdb_prio_lock);
|
||||||
|
return fdb;
|
||||||
|
}
|
||||||
|
|
||||||
|
ns = mlx5_get_fdb_sub_ns(dev, chain);
|
||||||
|
if (!ns) {
|
||||||
|
esw_warn(dev, "Failed to get FDB sub namespace\n");
|
||||||
|
mutex_unlock(&esw->fdb_table.offloads.fdb_prio_lock);
|
||||||
|
return ERR_PTR(-EOPNOTSUPP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE)
|
||||||
|
flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
|
||||||
|
MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
|
||||||
|
|
||||||
|
table_prio = (chain * FDB_MAX_PRIO) + prio - 1;
|
||||||
|
|
||||||
|
/* create earlier levels for correct fs_core lookup when
|
||||||
|
* connecting tables
|
||||||
|
*/
|
||||||
|
for (l = 0; l <= level; l++) {
|
||||||
|
if (fdb_prio_table(esw, chain, prio, l).fdb) {
|
||||||
|
fdb_prio_table(esw, chain, prio, l).num_rules++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
fdb = create_next_size_table(esw, ns, table_prio, l, flags);
|
||||||
|
if (IS_ERR(fdb)) {
|
||||||
|
l--;
|
||||||
|
goto err_create_fdb;
|
||||||
|
}
|
||||||
|
|
||||||
|
fdb_prio_table(esw, chain, prio, l).fdb = fdb;
|
||||||
|
fdb_prio_table(esw, chain, prio, l).num_rules = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&esw->fdb_table.offloads.fdb_prio_lock);
|
||||||
|
return fdb;
|
||||||
|
|
||||||
|
err_create_fdb:
|
||||||
|
mutex_unlock(&esw->fdb_table.offloads.fdb_prio_lock);
|
||||||
|
if (l >= 0)
|
||||||
|
esw_put_prio_table(esw, chain, prio, l);
|
||||||
|
|
||||||
|
return fdb;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
esw_put_prio_table(struct mlx5_eswitch *esw, u32 chain, u16 prio, int level)
|
||||||
|
{
|
||||||
|
int l;
|
||||||
|
|
||||||
|
if (chain == FDB_SLOW_PATH_CHAIN)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mutex_lock(&esw->fdb_table.offloads.fdb_prio_lock);
|
||||||
|
|
||||||
|
for (l = level; l >= 0; l--) {
|
||||||
|
if (--(fdb_prio_table(esw, chain, prio, l).num_rules) > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
put_sz_to_pool(esw, fdb_prio_table(esw, chain, prio, l).fdb->max_fte);
|
||||||
|
mlx5_destroy_flow_table(fdb_prio_table(esw, chain, prio, l).fdb);
|
||||||
|
fdb_prio_table(esw, chain, prio, l).fdb = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&esw->fdb_table.offloads.fdb_prio_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void esw_destroy_offloads_fast_fdb_tables(struct mlx5_eswitch *esw)
|
||||||
|
{
|
||||||
|
/* If lazy creation isn't supported, deref the fast path tables */
|
||||||
|
if (!(esw->fdb_table.flags & ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED)) {
|
||||||
|
esw_put_prio_table(esw, 0, 1, 1);
|
||||||
|
esw_put_prio_table(esw, 0, 1, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_PF_SQ 256
|
#define MAX_PF_SQ 256
|
||||||
|
@ -579,12 +767,13 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports)
|
||||||
int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
|
int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
|
||||||
struct mlx5_flow_table_attr ft_attr = {};
|
struct mlx5_flow_table_attr ft_attr = {};
|
||||||
struct mlx5_core_dev *dev = esw->dev;
|
struct mlx5_core_dev *dev = esw->dev;
|
||||||
|
u32 *flow_group_in, max_flow_counter;
|
||||||
struct mlx5_flow_namespace *root_ns;
|
struct mlx5_flow_namespace *root_ns;
|
||||||
struct mlx5_flow_table *fdb = NULL;
|
struct mlx5_flow_table *fdb = NULL;
|
||||||
int table_size, ix, err = 0;
|
int table_size, ix, err = 0, i;
|
||||||
struct mlx5_flow_group *g;
|
struct mlx5_flow_group *g;
|
||||||
|
u32 flags = 0, fdb_max;
|
||||||
void *match_criteria;
|
void *match_criteria;
|
||||||
u32 *flow_group_in;
|
|
||||||
u8 *dmac;
|
u8 *dmac;
|
||||||
|
|
||||||
esw_debug(esw->dev, "Create offloads FDB Tables\n");
|
esw_debug(esw->dev, "Create offloads FDB Tables\n");
|
||||||
|
@ -599,12 +788,29 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports)
|
||||||
goto ns_err;
|
goto ns_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = esw_create_offloads_fast_fdb_table(esw);
|
max_flow_counter = (MLX5_CAP_GEN(dev, max_flow_counter_31_16) << 16) |
|
||||||
if (err)
|
MLX5_CAP_GEN(dev, max_flow_counter_15_0);
|
||||||
goto fast_fdb_err;
|
fdb_max = 1 << MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size);
|
||||||
|
|
||||||
|
esw_debug(dev, "Create offloads FDB table, min (max esw size(2^%d), max counters(%d), groups(%d), max flow table size(2^%d))\n",
|
||||||
|
MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size),
|
||||||
|
max_flow_counter, ESW_OFFLOADS_NUM_GROUPS,
|
||||||
|
fdb_max);
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(ESW_POOLS); i++)
|
||||||
|
esw->fdb_table.offloads.fdb_left[i] =
|
||||||
|
ESW_POOLS[i] <= fdb_max ? ESW_SIZE / ESW_POOLS[i] : 0;
|
||||||
|
|
||||||
table_size = nvports * MAX_SQ_NVPORTS + MAX_PF_SQ + 2;
|
table_size = nvports * MAX_SQ_NVPORTS + MAX_PF_SQ + 2;
|
||||||
|
|
||||||
|
/* create the slow path fdb with encap set, so further table instances
|
||||||
|
* can be created at run time while VFs are probed if the FW allows that.
|
||||||
|
*/
|
||||||
|
if (esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE)
|
||||||
|
flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
|
||||||
|
MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
|
||||||
|
|
||||||
|
ft_attr.flags = flags;
|
||||||
ft_attr.max_fte = table_size;
|
ft_attr.max_fte = table_size;
|
||||||
ft_attr.prio = FDB_SLOW_PATH;
|
ft_attr.prio = FDB_SLOW_PATH;
|
||||||
|
|
||||||
|
@ -616,6 +822,18 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports)
|
||||||
}
|
}
|
||||||
esw->fdb_table.offloads.slow_fdb = fdb;
|
esw->fdb_table.offloads.slow_fdb = fdb;
|
||||||
|
|
||||||
|
/* If lazy creation isn't supported, open the fast path tables now */
|
||||||
|
if (!MLX5_CAP_ESW_FLOWTABLE(esw->dev, multi_fdb_encap) &&
|
||||||
|
esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE) {
|
||||||
|
esw->fdb_table.flags &= ~ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED;
|
||||||
|
esw_warn(dev, "Lazy creation of flow tables isn't supported, ignoring priorities\n");
|
||||||
|
esw_get_prio_table(esw, 0, 1, 0);
|
||||||
|
esw_get_prio_table(esw, 0, 1, 1);
|
||||||
|
} else {
|
||||||
|
esw_debug(dev, "Lazy creation of flow tables supported, deferring table opening\n");
|
||||||
|
esw->fdb_table.flags |= ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
/* create send-to-vport group */
|
/* create send-to-vport group */
|
||||||
memset(flow_group_in, 0, inlen);
|
memset(flow_group_in, 0, inlen);
|
||||||
MLX5_SET(create_flow_group_in, flow_group_in, match_criteria_enable,
|
MLX5_SET(create_flow_group_in, flow_group_in, match_criteria_enable,
|
||||||
|
@ -663,6 +881,7 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports)
|
||||||
if (err)
|
if (err)
|
||||||
goto miss_rule_err;
|
goto miss_rule_err;
|
||||||
|
|
||||||
|
esw->nvports = nvports;
|
||||||
kvfree(flow_group_in);
|
kvfree(flow_group_in);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -671,10 +890,9 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports)
|
||||||
miss_err:
|
miss_err:
|
||||||
mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);
|
mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);
|
||||||
send_vport_err:
|
send_vport_err:
|
||||||
|
esw_destroy_offloads_fast_fdb_tables(esw);
|
||||||
mlx5_destroy_flow_table(esw->fdb_table.offloads.slow_fdb);
|
mlx5_destroy_flow_table(esw->fdb_table.offloads.slow_fdb);
|
||||||
slow_fdb_err:
|
slow_fdb_err:
|
||||||
esw_destroy_offloads_fast_fdb_table(esw);
|
|
||||||
fast_fdb_err:
|
|
||||||
ns_err:
|
ns_err:
|
||||||
kvfree(flow_group_in);
|
kvfree(flow_group_in);
|
||||||
return err;
|
return err;
|
||||||
|
@ -682,7 +900,7 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports)
|
||||||
|
|
||||||
static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw)
|
static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw)
|
||||||
{
|
{
|
||||||
if (!esw->fdb_table.offloads.fast_fdb)
|
if (!esw->fdb_table.offloads.slow_fdb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
esw_debug(esw->dev, "Destroy offloads FDB Tables\n");
|
esw_debug(esw->dev, "Destroy offloads FDB Tables\n");
|
||||||
|
@ -692,7 +910,7 @@ static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw)
|
||||||
mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
|
mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
|
||||||
|
|
||||||
mlx5_destroy_flow_table(esw->fdb_table.offloads.slow_fdb);
|
mlx5_destroy_flow_table(esw->fdb_table.offloads.slow_fdb);
|
||||||
esw_destroy_offloads_fast_fdb_table(esw);
|
esw_destroy_offloads_fast_fdb_tables(esw);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int esw_create_offloads_table(struct mlx5_eswitch *esw)
|
static int esw_create_offloads_table(struct mlx5_eswitch *esw)
|
||||||
|
@ -949,6 +1167,8 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
mutex_init(&esw->fdb_table.offloads.fdb_prio_lock);
|
||||||
|
|
||||||
err = esw_create_offloads_fdb_tables(esw, nvports);
|
err = esw_create_offloads_fdb_tables(esw, nvports);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -1256,7 +1476,7 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8 encap,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE &&
|
if (encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE &&
|
||||||
(!MLX5_CAP_ESW_FLOWTABLE_FDB(dev, encap) ||
|
(!MLX5_CAP_ESW_FLOWTABLE_FDB(dev, reformat) ||
|
||||||
!MLX5_CAP_ESW_FLOWTABLE_FDB(dev, decap)))
|
!MLX5_CAP_ESW_FLOWTABLE_FDB(dev, decap)))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
@ -1277,16 +1497,19 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8 encap,
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
esw_destroy_offloads_fast_fdb_table(esw);
|
esw_destroy_offloads_fdb_tables(esw);
|
||||||
|
|
||||||
esw->offloads.encap = encap;
|
esw->offloads.encap = encap;
|
||||||
err = esw_create_offloads_fast_fdb_table(esw);
|
|
||||||
|
err = esw_create_offloads_fdb_tables(esw, esw->nvports);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
NL_SET_ERR_MSG_MOD(extack,
|
NL_SET_ERR_MSG_MOD(extack,
|
||||||
"Failed re-creating fast FDB table");
|
"Failed re-creating fast FDB table");
|
||||||
esw->offloads.encap = !encap;
|
esw->offloads.encap = !encap;
|
||||||
(void)esw_create_offloads_fast_fdb_table(esw);
|
(void)esw_create_offloads_fdb_tables(esw, esw->nvports);
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -650,7 +650,7 @@ static bool mlx5_is_fpga_egress_ipsec_rule(struct mlx5_core_dev *dev,
|
||||||
(match_criteria_enable &
|
(match_criteria_enable &
|
||||||
~(MLX5_MATCH_OUTER_HEADERS | MLX5_MATCH_MISC_PARAMETERS)) ||
|
~(MLX5_MATCH_OUTER_HEADERS | MLX5_MATCH_MISC_PARAMETERS)) ||
|
||||||
(flow_act->action & ~(MLX5_FLOW_CONTEXT_ACTION_ENCRYPT | MLX5_FLOW_CONTEXT_ACTION_ALLOW)) ||
|
(flow_act->action & ~(MLX5_FLOW_CONTEXT_ACTION_ENCRYPT | MLX5_FLOW_CONTEXT_ACTION_ALLOW)) ||
|
||||||
flow_act->has_flow_tag)
|
(flow_act->flags & FLOW_ACT_HAS_TAG))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -152,7 +152,8 @@ static int mlx5_cmd_create_flow_table(struct mlx5_core_dev *dev,
|
||||||
struct mlx5_flow_table *next_ft,
|
struct mlx5_flow_table *next_ft,
|
||||||
unsigned int *table_id, u32 flags)
|
unsigned int *table_id, u32 flags)
|
||||||
{
|
{
|
||||||
int en_encap_decap = !!(flags & MLX5_FLOW_TABLE_TUNNEL_EN);
|
int en_encap = !!(flags & MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT);
|
||||||
|
int en_decap = !!(flags & MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
|
||||||
u32 out[MLX5_ST_SZ_DW(create_flow_table_out)] = {0};
|
u32 out[MLX5_ST_SZ_DW(create_flow_table_out)] = {0};
|
||||||
u32 in[MLX5_ST_SZ_DW(create_flow_table_in)] = {0};
|
u32 in[MLX5_ST_SZ_DW(create_flow_table_in)] = {0};
|
||||||
int err;
|
int err;
|
||||||
|
@ -169,9 +170,9 @@ static int mlx5_cmd_create_flow_table(struct mlx5_core_dev *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
MLX5_SET(create_flow_table_in, in, flow_table_context.decap_en,
|
MLX5_SET(create_flow_table_in, in, flow_table_context.decap_en,
|
||||||
en_encap_decap);
|
en_decap);
|
||||||
MLX5_SET(create_flow_table_in, in, flow_table_context.encap_en,
|
MLX5_SET(create_flow_table_in, in, flow_table_context.reformat_en,
|
||||||
en_encap_decap);
|
en_encap);
|
||||||
|
|
||||||
switch (op_mod) {
|
switch (op_mod) {
|
||||||
case FS_FT_OP_MOD_NORMAL:
|
case FS_FT_OP_MOD_NORMAL:
|
||||||
|
@ -343,7 +344,8 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
|
||||||
|
|
||||||
MLX5_SET(flow_context, in_flow_context, flow_tag, fte->action.flow_tag);
|
MLX5_SET(flow_context, in_flow_context, flow_tag, fte->action.flow_tag);
|
||||||
MLX5_SET(flow_context, in_flow_context, action, fte->action.action);
|
MLX5_SET(flow_context, in_flow_context, action, fte->action.action);
|
||||||
MLX5_SET(flow_context, in_flow_context, encap_id, fte->action.encap_id);
|
MLX5_SET(flow_context, in_flow_context, packet_reformat_id,
|
||||||
|
fte->action.reformat_id);
|
||||||
MLX5_SET(flow_context, in_flow_context, modify_header_id,
|
MLX5_SET(flow_context, in_flow_context, modify_header_id,
|
||||||
fte->action.modify_id);
|
fte->action.modify_id);
|
||||||
|
|
||||||
|
@ -417,7 +419,7 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MLX5_SET(flow_counter_list, in_dests, flow_counter_id,
|
MLX5_SET(flow_counter_list, in_dests, flow_counter_id,
|
||||||
dst->dest_attr.counter->id);
|
dst->dest_attr.counter_id);
|
||||||
in_dests += MLX5_ST_SZ_BYTES(dest_format_struct);
|
in_dests += MLX5_ST_SZ_BYTES(dest_format_struct);
|
||||||
list_size++;
|
list_size++;
|
||||||
}
|
}
|
||||||
|
@ -594,62 +596,78 @@ void mlx5_cmd_fc_bulk_get(struct mlx5_core_dev *dev,
|
||||||
*bytes = MLX5_GET64(traffic_counter, stats, octets);
|
*bytes = MLX5_GET64(traffic_counter, stats, octets);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx5_encap_alloc(struct mlx5_core_dev *dev,
|
int mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev,
|
||||||
int header_type,
|
int reformat_type,
|
||||||
size_t size,
|
size_t size,
|
||||||
void *encap_header,
|
void *reformat_data,
|
||||||
u32 *encap_id)
|
enum mlx5_flow_namespace_type namespace,
|
||||||
|
u32 *packet_reformat_id)
|
||||||
{
|
{
|
||||||
int max_encap_size = MLX5_CAP_ESW(dev, max_encap_header_size);
|
u32 out[MLX5_ST_SZ_DW(alloc_packet_reformat_context_out)];
|
||||||
u32 out[MLX5_ST_SZ_DW(alloc_encap_header_out)];
|
void *packet_reformat_context_in;
|
||||||
void *encap_header_in;
|
int max_encap_size;
|
||||||
void *header;
|
void *reformat;
|
||||||
int inlen;
|
int inlen;
|
||||||
int err;
|
int err;
|
||||||
u32 *in;
|
u32 *in;
|
||||||
|
|
||||||
|
if (namespace == MLX5_FLOW_NAMESPACE_FDB)
|
||||||
|
max_encap_size = MLX5_CAP_ESW(dev, max_encap_header_size);
|
||||||
|
else
|
||||||
|
max_encap_size = MLX5_CAP_FLOWTABLE(dev, max_encap_header_size);
|
||||||
|
|
||||||
if (size > max_encap_size) {
|
if (size > max_encap_size) {
|
||||||
mlx5_core_warn(dev, "encap size %zd too big, max supported is %d\n",
|
mlx5_core_warn(dev, "encap size %zd too big, max supported is %d\n",
|
||||||
size, max_encap_size);
|
size, max_encap_size);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
in = kzalloc(MLX5_ST_SZ_BYTES(alloc_encap_header_in) + size,
|
in = kzalloc(MLX5_ST_SZ_BYTES(alloc_packet_reformat_context_in) + size,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!in)
|
if (!in)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
encap_header_in = MLX5_ADDR_OF(alloc_encap_header_in, in, encap_header);
|
packet_reformat_context_in = MLX5_ADDR_OF(alloc_packet_reformat_context_in,
|
||||||
header = MLX5_ADDR_OF(encap_header_in, encap_header_in, encap_header);
|
in, packet_reformat_context);
|
||||||
inlen = header - (void *)in + size;
|
reformat = MLX5_ADDR_OF(packet_reformat_context_in,
|
||||||
|
packet_reformat_context_in,
|
||||||
|
reformat_data);
|
||||||
|
inlen = reformat - (void *)in + size;
|
||||||
|
|
||||||
memset(in, 0, inlen);
|
memset(in, 0, inlen);
|
||||||
MLX5_SET(alloc_encap_header_in, in, opcode,
|
MLX5_SET(alloc_packet_reformat_context_in, in, opcode,
|
||||||
MLX5_CMD_OP_ALLOC_ENCAP_HEADER);
|
MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT);
|
||||||
MLX5_SET(encap_header_in, encap_header_in, encap_header_size, size);
|
MLX5_SET(packet_reformat_context_in, packet_reformat_context_in,
|
||||||
MLX5_SET(encap_header_in, encap_header_in, header_type, header_type);
|
reformat_data_size, size);
|
||||||
memcpy(header, encap_header, size);
|
MLX5_SET(packet_reformat_context_in, packet_reformat_context_in,
|
||||||
|
reformat_type, reformat_type);
|
||||||
|
memcpy(reformat, reformat_data, size);
|
||||||
|
|
||||||
memset(out, 0, sizeof(out));
|
memset(out, 0, sizeof(out));
|
||||||
err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
|
err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
|
||||||
|
|
||||||
*encap_id = MLX5_GET(alloc_encap_header_out, out, encap_id);
|
*packet_reformat_id = MLX5_GET(alloc_packet_reformat_context_out,
|
||||||
|
out, packet_reformat_id);
|
||||||
kfree(in);
|
kfree(in);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(mlx5_packet_reformat_alloc);
|
||||||
|
|
||||||
void mlx5_encap_dealloc(struct mlx5_core_dev *dev, u32 encap_id)
|
void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev,
|
||||||
|
u32 packet_reformat_id)
|
||||||
{
|
{
|
||||||
u32 in[MLX5_ST_SZ_DW(dealloc_encap_header_in)];
|
u32 in[MLX5_ST_SZ_DW(dealloc_packet_reformat_context_in)];
|
||||||
u32 out[MLX5_ST_SZ_DW(dealloc_encap_header_out)];
|
u32 out[MLX5_ST_SZ_DW(dealloc_packet_reformat_context_out)];
|
||||||
|
|
||||||
memset(in, 0, sizeof(in));
|
memset(in, 0, sizeof(in));
|
||||||
MLX5_SET(dealloc_encap_header_in, in, opcode,
|
MLX5_SET(dealloc_packet_reformat_context_in, in, opcode,
|
||||||
MLX5_CMD_OP_DEALLOC_ENCAP_HEADER);
|
MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT);
|
||||||
MLX5_SET(dealloc_encap_header_in, in, encap_id, encap_id);
|
MLX5_SET(dealloc_packet_reformat_context_in, in, packet_reformat_id,
|
||||||
|
packet_reformat_id);
|
||||||
|
|
||||||
mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(mlx5_packet_reformat_dealloc);
|
||||||
|
|
||||||
int mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
|
int mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
|
||||||
u8 namespace, u8 num_actions,
|
u8 namespace, u8 num_actions,
|
||||||
|
@ -667,9 +685,14 @@ int mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
|
||||||
table_type = FS_FT_FDB;
|
table_type = FS_FT_FDB;
|
||||||
break;
|
break;
|
||||||
case MLX5_FLOW_NAMESPACE_KERNEL:
|
case MLX5_FLOW_NAMESPACE_KERNEL:
|
||||||
|
case MLX5_FLOW_NAMESPACE_BYPASS:
|
||||||
max_actions = MLX5_CAP_FLOWTABLE_NIC_RX(dev, max_modify_header_actions);
|
max_actions = MLX5_CAP_FLOWTABLE_NIC_RX(dev, max_modify_header_actions);
|
||||||
table_type = FS_FT_NIC_RX;
|
table_type = FS_FT_NIC_RX;
|
||||||
break;
|
break;
|
||||||
|
case MLX5_FLOW_NAMESPACE_EGRESS:
|
||||||
|
max_actions = MLX5_CAP_FLOWTABLE_NIC_TX(dev, max_modify_header_actions);
|
||||||
|
table_type = FS_FT_NIC_TX;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
@ -702,6 +725,7 @@ int mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
|
||||||
kfree(in);
|
kfree(in);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(mlx5_modify_header_alloc);
|
||||||
|
|
||||||
void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev, u32 modify_header_id)
|
void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev, u32 modify_header_id)
|
||||||
{
|
{
|
||||||
|
@ -716,6 +740,7 @@ void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev, u32 modify_header_id)
|
||||||
|
|
||||||
mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(mlx5_modify_header_dealloc);
|
||||||
|
|
||||||
static const struct mlx5_flow_cmds mlx5_flow_cmds = {
|
static const struct mlx5_flow_cmds mlx5_flow_cmds = {
|
||||||
.create_flow_table = mlx5_cmd_create_flow_table,
|
.create_flow_table = mlx5_cmd_create_flow_table,
|
||||||
|
@ -760,8 +785,8 @@ const struct mlx5_flow_cmds *mlx5_fs_cmd_get_default(enum fs_flow_table_type typ
|
||||||
case FS_FT_FDB:
|
case FS_FT_FDB:
|
||||||
case FS_FT_SNIFFER_RX:
|
case FS_FT_SNIFFER_RX:
|
||||||
case FS_FT_SNIFFER_TX:
|
case FS_FT_SNIFFER_TX:
|
||||||
return mlx5_fs_cmd_get_fw_cmds();
|
|
||||||
case FS_FT_NIC_TX:
|
case FS_FT_NIC_TX:
|
||||||
|
return mlx5_fs_cmd_get_fw_cmds();
|
||||||
default:
|
default:
|
||||||
return mlx5_fs_cmd_get_stub_cmds();
|
return mlx5_fs_cmd_get_stub_cmds();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "diag/fs_tracepoint.h"
|
#include "diag/fs_tracepoint.h"
|
||||||
#include "accel/ipsec.h"
|
#include "accel/ipsec.h"
|
||||||
#include "fpga/ipsec.h"
|
#include "fpga/ipsec.h"
|
||||||
|
#include "eswitch.h"
|
||||||
|
|
||||||
#define INIT_TREE_NODE_ARRAY_SIZE(...) (sizeof((struct init_tree_node[]){__VA_ARGS__}) /\
|
#define INIT_TREE_NODE_ARRAY_SIZE(...) (sizeof((struct init_tree_node[]){__VA_ARGS__}) /\
|
||||||
sizeof(struct init_tree_node))
|
sizeof(struct init_tree_node))
|
||||||
|
@ -76,6 +77,14 @@
|
||||||
FS_CAP(flow_table_properties_nic_receive.identified_miss_table_mode), \
|
FS_CAP(flow_table_properties_nic_receive.identified_miss_table_mode), \
|
||||||
FS_CAP(flow_table_properties_nic_receive.flow_table_modify))
|
FS_CAP(flow_table_properties_nic_receive.flow_table_modify))
|
||||||
|
|
||||||
|
#define FS_CHAINING_CAPS_EGRESS \
|
||||||
|
FS_REQUIRED_CAPS( \
|
||||||
|
FS_CAP(flow_table_properties_nic_transmit.flow_modify_en), \
|
||||||
|
FS_CAP(flow_table_properties_nic_transmit.modify_root), \
|
||||||
|
FS_CAP(flow_table_properties_nic_transmit \
|
||||||
|
.identified_miss_table_mode), \
|
||||||
|
FS_CAP(flow_table_properties_nic_transmit.flow_table_modify))
|
||||||
|
|
||||||
#define LEFTOVERS_NUM_LEVELS 1
|
#define LEFTOVERS_NUM_LEVELS 1
|
||||||
#define LEFTOVERS_NUM_PRIOS 1
|
#define LEFTOVERS_NUM_PRIOS 1
|
||||||
|
|
||||||
|
@ -151,6 +160,17 @@ static struct init_tree_node {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct init_tree_node egress_root_fs = {
|
||||||
|
.type = FS_TYPE_NAMESPACE,
|
||||||
|
.ar_size = 1,
|
||||||
|
.children = (struct init_tree_node[]) {
|
||||||
|
ADD_PRIO(0, MLX5_BY_PASS_NUM_PRIOS, 0,
|
||||||
|
FS_CHAINING_CAPS_EGRESS,
|
||||||
|
ADD_NS(ADD_MULTIPLE_PRIO(MLX5_BY_PASS_NUM_PRIOS,
|
||||||
|
BY_PASS_PRIO_NUM_LEVELS))),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
enum fs_i_lock_class {
|
enum fs_i_lock_class {
|
||||||
FS_LOCK_GRANDPARENT,
|
FS_LOCK_GRANDPARENT,
|
||||||
FS_LOCK_PARENT,
|
FS_LOCK_PARENT,
|
||||||
|
@ -694,7 +714,7 @@ static struct mlx5_flow_table *find_closest_ft_recursive(struct fs_node *root,
|
||||||
struct fs_node *iter = list_entry(start, struct fs_node, list);
|
struct fs_node *iter = list_entry(start, struct fs_node, list);
|
||||||
struct mlx5_flow_table *ft = NULL;
|
struct mlx5_flow_table *ft = NULL;
|
||||||
|
|
||||||
if (!root)
|
if (!root || root->type == FS_TYPE_PRIO_CHAINS)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
list_for_each_advance_continue(iter, &root->children, reverse) {
|
list_for_each_advance_continue(iter, &root->children, reverse) {
|
||||||
|
@ -1388,7 +1408,7 @@ static bool check_conflicting_actions(u32 action1, u32 action2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (xored_actions & (MLX5_FLOW_CONTEXT_ACTION_DROP |
|
if (xored_actions & (MLX5_FLOW_CONTEXT_ACTION_DROP |
|
||||||
MLX5_FLOW_CONTEXT_ACTION_ENCAP |
|
MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT |
|
||||||
MLX5_FLOW_CONTEXT_ACTION_DECAP |
|
MLX5_FLOW_CONTEXT_ACTION_DECAP |
|
||||||
MLX5_FLOW_CONTEXT_ACTION_MOD_HDR |
|
MLX5_FLOW_CONTEXT_ACTION_MOD_HDR |
|
||||||
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP |
|
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP |
|
||||||
|
@ -1408,7 +1428,7 @@ static int check_conflicting_ftes(struct fs_fte *fte, const struct mlx5_flow_act
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flow_act->has_flow_tag &&
|
if ((flow_act->flags & FLOW_ACT_HAS_TAG) &&
|
||||||
fte->action.flow_tag != flow_act->flow_tag) {
|
fte->action.flow_tag != flow_act->flow_tag) {
|
||||||
mlx5_core_warn(get_dev(&fte->node),
|
mlx5_core_warn(get_dev(&fte->node),
|
||||||
"FTE flow tag %u already exists with different flow tag %u\n",
|
"FTE flow tag %u already exists with different flow tag %u\n",
|
||||||
|
@ -1455,29 +1475,8 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mlx5_fc *mlx5_flow_rule_counter(struct mlx5_flow_handle *handle)
|
static bool counter_is_valid(u32 action)
|
||||||
{
|
{
|
||||||
struct mlx5_flow_rule *dst;
|
|
||||||
struct fs_fte *fte;
|
|
||||||
|
|
||||||
fs_get_obj(fte, handle->rule[0]->node.parent);
|
|
||||||
|
|
||||||
fs_for_each_dst(dst, fte) {
|
|
||||||
if (dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER)
|
|
||||||
return dst->dest_attr.counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool counter_is_valid(struct mlx5_fc *counter, u32 action)
|
|
||||||
{
|
|
||||||
if (!(action & MLX5_FLOW_CONTEXT_ACTION_COUNT))
|
|
||||||
return !counter;
|
|
||||||
|
|
||||||
if (!counter)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (action & (MLX5_FLOW_CONTEXT_ACTION_DROP |
|
return (action & (MLX5_FLOW_CONTEXT_ACTION_DROP |
|
||||||
MLX5_FLOW_CONTEXT_ACTION_FWD_DEST));
|
MLX5_FLOW_CONTEXT_ACTION_FWD_DEST));
|
||||||
}
|
}
|
||||||
|
@ -1487,7 +1486,7 @@ static bool dest_is_valid(struct mlx5_flow_destination *dest,
|
||||||
struct mlx5_flow_table *ft)
|
struct mlx5_flow_table *ft)
|
||||||
{
|
{
|
||||||
if (dest && (dest->type == MLX5_FLOW_DESTINATION_TYPE_COUNTER))
|
if (dest && (dest->type == MLX5_FLOW_DESTINATION_TYPE_COUNTER))
|
||||||
return counter_is_valid(dest->counter, action);
|
return counter_is_valid(action);
|
||||||
|
|
||||||
if (!(action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST))
|
if (!(action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST))
|
||||||
return true;
|
return true;
|
||||||
|
@ -1629,6 +1628,8 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
|
||||||
|
|
||||||
search_again_locked:
|
search_again_locked:
|
||||||
version = matched_fgs_get_version(match_head);
|
version = matched_fgs_get_version(match_head);
|
||||||
|
if (flow_act->flags & FLOW_ACT_NO_APPEND)
|
||||||
|
goto skip_search;
|
||||||
/* Try to find a fg that already contains a matching fte */
|
/* Try to find a fg that already contains a matching fte */
|
||||||
list_for_each_entry(iter, match_head, list) {
|
list_for_each_entry(iter, match_head, list) {
|
||||||
struct fs_fte *fte_tmp;
|
struct fs_fte *fte_tmp;
|
||||||
|
@ -1645,6 +1646,11 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
|
||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip_search:
|
||||||
|
/* No group with matching fte found, or we skipped the search.
|
||||||
|
* Try to add a new fte to any matching fg.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Check the ft version, for case that new flow group
|
/* Check the ft version, for case that new flow group
|
||||||
* was added while the fgs weren't locked
|
* was added while the fgs weren't locked
|
||||||
*/
|
*/
|
||||||
|
@ -1975,12 +1981,24 @@ void mlx5_destroy_flow_group(struct mlx5_flow_group *fg)
|
||||||
fg->id);
|
fg->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct mlx5_flow_namespace *mlx5_get_fdb_sub_ns(struct mlx5_core_dev *dev,
|
||||||
|
int n)
|
||||||
|
{
|
||||||
|
struct mlx5_flow_steering *steering = dev->priv.steering;
|
||||||
|
|
||||||
|
if (!steering || !steering->fdb_sub_ns)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return steering->fdb_sub_ns[n];
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(mlx5_get_fdb_sub_ns);
|
||||||
|
|
||||||
struct mlx5_flow_namespace *mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
|
struct mlx5_flow_namespace *mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
|
||||||
enum mlx5_flow_namespace_type type)
|
enum mlx5_flow_namespace_type type)
|
||||||
{
|
{
|
||||||
struct mlx5_flow_steering *steering = dev->priv.steering;
|
struct mlx5_flow_steering *steering = dev->priv.steering;
|
||||||
struct mlx5_flow_root_namespace *root_ns;
|
struct mlx5_flow_root_namespace *root_ns;
|
||||||
int prio;
|
int prio = 0;
|
||||||
struct fs_prio *fs_prio;
|
struct fs_prio *fs_prio;
|
||||||
struct mlx5_flow_namespace *ns;
|
struct mlx5_flow_namespace *ns;
|
||||||
|
|
||||||
|
@ -1988,40 +2006,29 @@ struct mlx5_flow_namespace *mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MLX5_FLOW_NAMESPACE_BYPASS:
|
|
||||||
case MLX5_FLOW_NAMESPACE_LAG:
|
|
||||||
case MLX5_FLOW_NAMESPACE_OFFLOADS:
|
|
||||||
case MLX5_FLOW_NAMESPACE_ETHTOOL:
|
|
||||||
case MLX5_FLOW_NAMESPACE_KERNEL:
|
|
||||||
case MLX5_FLOW_NAMESPACE_LEFTOVERS:
|
|
||||||
case MLX5_FLOW_NAMESPACE_ANCHOR:
|
|
||||||
prio = type;
|
|
||||||
break;
|
|
||||||
case MLX5_FLOW_NAMESPACE_FDB:
|
case MLX5_FLOW_NAMESPACE_FDB:
|
||||||
if (steering->fdb_root_ns)
|
if (steering->fdb_root_ns)
|
||||||
return &steering->fdb_root_ns->ns;
|
return &steering->fdb_root_ns->ns;
|
||||||
else
|
return NULL;
|
||||||
return NULL;
|
|
||||||
case MLX5_FLOW_NAMESPACE_SNIFFER_RX:
|
case MLX5_FLOW_NAMESPACE_SNIFFER_RX:
|
||||||
if (steering->sniffer_rx_root_ns)
|
if (steering->sniffer_rx_root_ns)
|
||||||
return &steering->sniffer_rx_root_ns->ns;
|
return &steering->sniffer_rx_root_ns->ns;
|
||||||
else
|
return NULL;
|
||||||
return NULL;
|
|
||||||
case MLX5_FLOW_NAMESPACE_SNIFFER_TX:
|
case MLX5_FLOW_NAMESPACE_SNIFFER_TX:
|
||||||
if (steering->sniffer_tx_root_ns)
|
if (steering->sniffer_tx_root_ns)
|
||||||
return &steering->sniffer_tx_root_ns->ns;
|
return &steering->sniffer_tx_root_ns->ns;
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
case MLX5_FLOW_NAMESPACE_EGRESS:
|
|
||||||
if (steering->egress_root_ns)
|
|
||||||
return &steering->egress_root_ns->ns;
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
default:
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == MLX5_FLOW_NAMESPACE_EGRESS) {
|
||||||
|
root_ns = steering->egress_root_ns;
|
||||||
|
} else { /* Must be NIC RX */
|
||||||
|
root_ns = steering->root_ns;
|
||||||
|
prio = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
root_ns = steering->root_ns;
|
|
||||||
if (!root_ns)
|
if (!root_ns)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -2064,8 +2071,10 @@ struct mlx5_flow_namespace *mlx5_get_flow_vport_acl_namespace(struct mlx5_core_d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct fs_prio *fs_create_prio(struct mlx5_flow_namespace *ns,
|
static struct fs_prio *_fs_create_prio(struct mlx5_flow_namespace *ns,
|
||||||
unsigned int prio, int num_levels)
|
unsigned int prio,
|
||||||
|
int num_levels,
|
||||||
|
enum fs_node_type type)
|
||||||
{
|
{
|
||||||
struct fs_prio *fs_prio;
|
struct fs_prio *fs_prio;
|
||||||
|
|
||||||
|
@ -2073,7 +2082,7 @@ static struct fs_prio *fs_create_prio(struct mlx5_flow_namespace *ns,
|
||||||
if (!fs_prio)
|
if (!fs_prio)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
fs_prio->node.type = FS_TYPE_PRIO;
|
fs_prio->node.type = type;
|
||||||
tree_init_node(&fs_prio->node, NULL, del_sw_prio);
|
tree_init_node(&fs_prio->node, NULL, del_sw_prio);
|
||||||
tree_add_node(&fs_prio->node, &ns->node);
|
tree_add_node(&fs_prio->node, &ns->node);
|
||||||
fs_prio->num_levels = num_levels;
|
fs_prio->num_levels = num_levels;
|
||||||
|
@ -2083,6 +2092,19 @@ static struct fs_prio *fs_create_prio(struct mlx5_flow_namespace *ns,
|
||||||
return fs_prio;
|
return fs_prio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct fs_prio *fs_create_prio_chained(struct mlx5_flow_namespace *ns,
|
||||||
|
unsigned int prio,
|
||||||
|
int num_levels)
|
||||||
|
{
|
||||||
|
return _fs_create_prio(ns, prio, num_levels, FS_TYPE_PRIO_CHAINS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct fs_prio *fs_create_prio(struct mlx5_flow_namespace *ns,
|
||||||
|
unsigned int prio, int num_levels)
|
||||||
|
{
|
||||||
|
return _fs_create_prio(ns, prio, num_levels, FS_TYPE_PRIO);
|
||||||
|
}
|
||||||
|
|
||||||
static struct mlx5_flow_namespace *fs_init_namespace(struct mlx5_flow_namespace
|
static struct mlx5_flow_namespace *fs_init_namespace(struct mlx5_flow_namespace
|
||||||
*ns)
|
*ns)
|
||||||
{
|
{
|
||||||
|
@ -2387,6 +2409,9 @@ void mlx5_cleanup_fs(struct mlx5_core_dev *dev)
|
||||||
cleanup_egress_acls_root_ns(dev);
|
cleanup_egress_acls_root_ns(dev);
|
||||||
cleanup_ingress_acls_root_ns(dev);
|
cleanup_ingress_acls_root_ns(dev);
|
||||||
cleanup_root_ns(steering->fdb_root_ns);
|
cleanup_root_ns(steering->fdb_root_ns);
|
||||||
|
steering->fdb_root_ns = NULL;
|
||||||
|
kfree(steering->fdb_sub_ns);
|
||||||
|
steering->fdb_sub_ns = NULL;
|
||||||
cleanup_root_ns(steering->sniffer_rx_root_ns);
|
cleanup_root_ns(steering->sniffer_rx_root_ns);
|
||||||
cleanup_root_ns(steering->sniffer_tx_root_ns);
|
cleanup_root_ns(steering->sniffer_tx_root_ns);
|
||||||
cleanup_root_ns(steering->egress_root_ns);
|
cleanup_root_ns(steering->egress_root_ns);
|
||||||
|
@ -2432,27 +2457,64 @@ static int init_sniffer_rx_root_ns(struct mlx5_flow_steering *steering)
|
||||||
|
|
||||||
static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
|
static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
|
||||||
{
|
{
|
||||||
struct fs_prio *prio;
|
struct mlx5_flow_namespace *ns;
|
||||||
|
struct fs_prio *maj_prio;
|
||||||
|
struct fs_prio *min_prio;
|
||||||
|
int levels;
|
||||||
|
int chain;
|
||||||
|
int prio;
|
||||||
|
int err;
|
||||||
|
|
||||||
steering->fdb_root_ns = create_root_ns(steering, FS_FT_FDB);
|
steering->fdb_root_ns = create_root_ns(steering, FS_FT_FDB);
|
||||||
if (!steering->fdb_root_ns)
|
if (!steering->fdb_root_ns)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
prio = fs_create_prio(&steering->fdb_root_ns->ns, 0, 2);
|
steering->fdb_sub_ns = kzalloc(sizeof(steering->fdb_sub_ns) *
|
||||||
if (IS_ERR(prio))
|
FDB_MAX_CHAIN + 1, GFP_KERNEL);
|
||||||
goto out_err;
|
if (!steering->fdb_sub_ns)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
prio = fs_create_prio(&steering->fdb_root_ns->ns, 1, 1);
|
levels = 2 * FDB_MAX_PRIO * (FDB_MAX_CHAIN + 1);
|
||||||
if (IS_ERR(prio))
|
maj_prio = fs_create_prio_chained(&steering->fdb_root_ns->ns, 0,
|
||||||
|
levels);
|
||||||
|
if (IS_ERR(maj_prio)) {
|
||||||
|
err = PTR_ERR(maj_prio);
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (chain = 0; chain <= FDB_MAX_CHAIN; chain++) {
|
||||||
|
ns = fs_create_namespace(maj_prio);
|
||||||
|
if (IS_ERR(ns)) {
|
||||||
|
err = PTR_ERR(ns);
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (prio = 0; prio < FDB_MAX_PRIO * (chain + 1); prio++) {
|
||||||
|
min_prio = fs_create_prio(ns, prio, 2);
|
||||||
|
if (IS_ERR(min_prio)) {
|
||||||
|
err = PTR_ERR(min_prio);
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
steering->fdb_sub_ns[chain] = ns;
|
||||||
|
}
|
||||||
|
|
||||||
|
maj_prio = fs_create_prio(&steering->fdb_root_ns->ns, 1, 1);
|
||||||
|
if (IS_ERR(maj_prio)) {
|
||||||
|
err = PTR_ERR(maj_prio);
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
|
||||||
set_prio_attrs(steering->fdb_root_ns);
|
set_prio_attrs(steering->fdb_root_ns);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
cleanup_root_ns(steering->fdb_root_ns);
|
cleanup_root_ns(steering->fdb_root_ns);
|
||||||
|
kfree(steering->fdb_sub_ns);
|
||||||
|
steering->fdb_sub_ns = NULL;
|
||||||
steering->fdb_root_ns = NULL;
|
steering->fdb_root_ns = NULL;
|
||||||
return PTR_ERR(prio);
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_egress_acl_root_ns(struct mlx5_flow_steering *steering, int vport)
|
static int init_egress_acl_root_ns(struct mlx5_flow_steering *steering, int vport)
|
||||||
|
@ -2537,16 +2599,23 @@ static int init_ingress_acls_root_ns(struct mlx5_core_dev *dev)
|
||||||
|
|
||||||
static int init_egress_root_ns(struct mlx5_flow_steering *steering)
|
static int init_egress_root_ns(struct mlx5_flow_steering *steering)
|
||||||
{
|
{
|
||||||
struct fs_prio *prio;
|
int err;
|
||||||
|
|
||||||
steering->egress_root_ns = create_root_ns(steering,
|
steering->egress_root_ns = create_root_ns(steering,
|
||||||
FS_FT_NIC_TX);
|
FS_FT_NIC_TX);
|
||||||
if (!steering->egress_root_ns)
|
if (!steering->egress_root_ns)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* create 1 prio*/
|
err = init_root_tree(steering, &egress_root_fs,
|
||||||
prio = fs_create_prio(&steering->egress_root_ns->ns, 0, 1);
|
&steering->egress_root_ns->ns.node);
|
||||||
return PTR_ERR_OR_ZERO(prio);
|
if (err)
|
||||||
|
goto cleanup;
|
||||||
|
set_prio_attrs(steering->egress_root_ns);
|
||||||
|
return 0;
|
||||||
|
cleanup:
|
||||||
|
cleanup_root_ns(steering->egress_root_ns);
|
||||||
|
steering->egress_root_ns = NULL;
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx5_init_fs(struct mlx5_core_dev *dev)
|
int mlx5_init_fs(struct mlx5_core_dev *dev)
|
||||||
|
@ -2614,7 +2683,7 @@ int mlx5_init_fs(struct mlx5_core_dev *dev)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MLX5_IPSEC_DEV(dev)) {
|
if (MLX5_IPSEC_DEV(dev) || MLX5_CAP_FLOWTABLE_NIC_TX(dev, ft_support)) {
|
||||||
err = init_egress_root_ns(steering);
|
err = init_egress_root_ns(steering);
|
||||||
if (err)
|
if (err)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
@ -38,9 +38,21 @@
|
||||||
#include <linux/rhashtable.h>
|
#include <linux/rhashtable.h>
|
||||||
#include <linux/llist.h>
|
#include <linux/llist.h>
|
||||||
|
|
||||||
|
/* FS_TYPE_PRIO_CHAINS is a PRIO that will have namespaces only,
|
||||||
|
* and those are in parallel to one another when going over them to connect
|
||||||
|
* a new flow table. Meaning the last flow table in a TYPE_PRIO prio in one
|
||||||
|
* parallel namespace will not automatically connect to the first flow table
|
||||||
|
* found in any prio in any next namespace, but skip the entire containing
|
||||||
|
* TYPE_PRIO_CHAINS prio.
|
||||||
|
*
|
||||||
|
* This is used to implement tc chains, each chain of prios is a different
|
||||||
|
* namespace inside a containing TYPE_PRIO_CHAINS prio.
|
||||||
|
*/
|
||||||
|
|
||||||
enum fs_node_type {
|
enum fs_node_type {
|
||||||
FS_TYPE_NAMESPACE,
|
FS_TYPE_NAMESPACE,
|
||||||
FS_TYPE_PRIO,
|
FS_TYPE_PRIO,
|
||||||
|
FS_TYPE_PRIO_CHAINS,
|
||||||
FS_TYPE_FLOW_TABLE,
|
FS_TYPE_FLOW_TABLE,
|
||||||
FS_TYPE_FLOW_GROUP,
|
FS_TYPE_FLOW_GROUP,
|
||||||
FS_TYPE_FLOW_ENTRY,
|
FS_TYPE_FLOW_ENTRY,
|
||||||
|
@ -73,6 +85,7 @@ struct mlx5_flow_steering {
|
||||||
struct kmem_cache *ftes_cache;
|
struct kmem_cache *ftes_cache;
|
||||||
struct mlx5_flow_root_namespace *root_ns;
|
struct mlx5_flow_root_namespace *root_ns;
|
||||||
struct mlx5_flow_root_namespace *fdb_root_ns;
|
struct mlx5_flow_root_namespace *fdb_root_ns;
|
||||||
|
struct mlx5_flow_namespace **fdb_sub_ns;
|
||||||
struct mlx5_flow_root_namespace **esw_egress_root_ns;
|
struct mlx5_flow_root_namespace **esw_egress_root_ns;
|
||||||
struct mlx5_flow_root_namespace **esw_ingress_root_ns;
|
struct mlx5_flow_root_namespace **esw_ingress_root_ns;
|
||||||
struct mlx5_flow_root_namespace *sniffer_tx_root_ns;
|
struct mlx5_flow_root_namespace *sniffer_tx_root_ns;
|
||||||
|
|
|
@ -258,6 +258,12 @@ struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mlx5_fc_create);
|
EXPORT_SYMBOL(mlx5_fc_create);
|
||||||
|
|
||||||
|
u32 mlx5_fc_id(struct mlx5_fc *counter)
|
||||||
|
{
|
||||||
|
return counter->id;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(mlx5_fc_id);
|
||||||
|
|
||||||
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
|
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
|
||||||
{
|
{
|
||||||
struct mlx5_fc_stats *fc_stats = &dev->priv.fc_stats;
|
struct mlx5_fc_stats *fc_stats = &dev->priv.fc_stats;
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <linux/if_link.h>
|
#include <linux/if_link.h>
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/mlx5/cq.h>
|
#include <linux/mlx5/cq.h>
|
||||||
|
#include <linux/mlx5/fs.h>
|
||||||
|
|
||||||
#define DRIVER_NAME "mlx5_core"
|
#define DRIVER_NAME "mlx5_core"
|
||||||
#define DRIVER_VERSION "5.0-0"
|
#define DRIVER_VERSION "5.0-0"
|
||||||
|
@ -171,17 +172,6 @@ struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev);
|
||||||
void mlx5_dev_list_lock(void);
|
void mlx5_dev_list_lock(void);
|
||||||
void mlx5_dev_list_unlock(void);
|
void mlx5_dev_list_unlock(void);
|
||||||
int mlx5_dev_list_trylock(void);
|
int mlx5_dev_list_trylock(void);
|
||||||
int mlx5_encap_alloc(struct mlx5_core_dev *dev,
|
|
||||||
int header_type,
|
|
||||||
size_t size,
|
|
||||||
void *encap_header,
|
|
||||||
u32 *encap_id);
|
|
||||||
void mlx5_encap_dealloc(struct mlx5_core_dev *dev, u32 encap_id);
|
|
||||||
|
|
||||||
int mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
|
|
||||||
u8 namespace, u8 num_actions,
|
|
||||||
void *modify_actions, u32 *modify_header_id);
|
|
||||||
void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev, u32 modify_header_id);
|
|
||||||
|
|
||||||
bool mlx5_lag_intf_add(struct mlx5_interface *intf, struct mlx5_priv *priv);
|
bool mlx5_lag_intf_add(struct mlx5_interface *intf, struct mlx5_priv *priv);
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
qp->qpn = MLX5_GET(create_dct_out, out, dctn);
|
qp->qpn = MLX5_GET(create_dct_out, out, dctn);
|
||||||
|
qp->uid = MLX5_GET(create_dct_in, in, uid);
|
||||||
err = create_resource_common(dev, qp, MLX5_RES_DCT);
|
err = create_resource_common(dev, qp, MLX5_RES_DCT);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_cmd;
|
goto err_cmd;
|
||||||
|
@ -219,6 +220,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev,
|
||||||
err_cmd:
|
err_cmd:
|
||||||
MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT);
|
MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT);
|
||||||
MLX5_SET(destroy_dct_in, din, dctn, qp->qpn);
|
MLX5_SET(destroy_dct_in, din, dctn, qp->qpn);
|
||||||
|
MLX5_SET(destroy_dct_in, din, uid, qp->uid);
|
||||||
mlx5_cmd_exec(dev, (void *)&in, sizeof(din),
|
mlx5_cmd_exec(dev, (void *)&in, sizeof(din),
|
||||||
(void *)&out, sizeof(dout));
|
(void *)&out, sizeof(dout));
|
||||||
return err;
|
return err;
|
||||||
|
@ -240,6 +242,7 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev,
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
qp->uid = MLX5_GET(create_qp_in, in, uid);
|
||||||
qp->qpn = MLX5_GET(create_qp_out, out, qpn);
|
qp->qpn = MLX5_GET(create_qp_out, out, qpn);
|
||||||
mlx5_core_dbg(dev, "qpn = 0x%x\n", qp->qpn);
|
mlx5_core_dbg(dev, "qpn = 0x%x\n", qp->qpn);
|
||||||
|
|
||||||
|
@ -261,6 +264,7 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev,
|
||||||
memset(dout, 0, sizeof(dout));
|
memset(dout, 0, sizeof(dout));
|
||||||
MLX5_SET(destroy_qp_in, din, opcode, MLX5_CMD_OP_DESTROY_QP);
|
MLX5_SET(destroy_qp_in, din, opcode, MLX5_CMD_OP_DESTROY_QP);
|
||||||
MLX5_SET(destroy_qp_in, din, qpn, qp->qpn);
|
MLX5_SET(destroy_qp_in, din, qpn, qp->qpn);
|
||||||
|
MLX5_SET(destroy_qp_in, din, uid, qp->uid);
|
||||||
mlx5_cmd_exec(dev, din, sizeof(din), dout, sizeof(dout));
|
mlx5_cmd_exec(dev, din, sizeof(din), dout, sizeof(dout));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -275,6 +279,7 @@ static int mlx5_core_drain_dct(struct mlx5_core_dev *dev,
|
||||||
|
|
||||||
MLX5_SET(drain_dct_in, in, opcode, MLX5_CMD_OP_DRAIN_DCT);
|
MLX5_SET(drain_dct_in, in, opcode, MLX5_CMD_OP_DRAIN_DCT);
|
||||||
MLX5_SET(drain_dct_in, in, dctn, qp->qpn);
|
MLX5_SET(drain_dct_in, in, dctn, qp->qpn);
|
||||||
|
MLX5_SET(drain_dct_in, in, uid, qp->uid);
|
||||||
return mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
|
return mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
|
||||||
(void *)&out, sizeof(out));
|
(void *)&out, sizeof(out));
|
||||||
}
|
}
|
||||||
|
@ -301,6 +306,7 @@ int mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
|
||||||
destroy_resource_common(dev, &dct->mqp);
|
destroy_resource_common(dev, &dct->mqp);
|
||||||
MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT);
|
MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT);
|
||||||
MLX5_SET(destroy_dct_in, in, dctn, qp->qpn);
|
MLX5_SET(destroy_dct_in, in, dctn, qp->qpn);
|
||||||
|
MLX5_SET(destroy_dct_in, in, uid, qp->uid);
|
||||||
err = mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
|
err = mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
|
||||||
(void *)&out, sizeof(out));
|
(void *)&out, sizeof(out));
|
||||||
return err;
|
return err;
|
||||||
|
@ -320,6 +326,7 @@ int mlx5_core_destroy_qp(struct mlx5_core_dev *dev,
|
||||||
|
|
||||||
MLX5_SET(destroy_qp_in, in, opcode, MLX5_CMD_OP_DESTROY_QP);
|
MLX5_SET(destroy_qp_in, in, opcode, MLX5_CMD_OP_DESTROY_QP);
|
||||||
MLX5_SET(destroy_qp_in, in, qpn, qp->qpn);
|
MLX5_SET(destroy_qp_in, in, qpn, qp->qpn);
|
||||||
|
MLX5_SET(destroy_qp_in, in, uid, qp->uid);
|
||||||
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -373,7 +380,7 @@ static void mbox_free(struct mbox_info *mbox)
|
||||||
|
|
||||||
static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn,
|
static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn,
|
||||||
u32 opt_param_mask, void *qpc,
|
u32 opt_param_mask, void *qpc,
|
||||||
struct mbox_info *mbox)
|
struct mbox_info *mbox, u16 uid)
|
||||||
{
|
{
|
||||||
mbox->out = NULL;
|
mbox->out = NULL;
|
||||||
mbox->in = NULL;
|
mbox->in = NULL;
|
||||||
|
@ -381,26 +388,32 @@ static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn,
|
||||||
#define MBOX_ALLOC(mbox, typ) \
|
#define MBOX_ALLOC(mbox, typ) \
|
||||||
mbox_alloc(mbox, MLX5_ST_SZ_BYTES(typ##_in), MLX5_ST_SZ_BYTES(typ##_out))
|
mbox_alloc(mbox, MLX5_ST_SZ_BYTES(typ##_in), MLX5_ST_SZ_BYTES(typ##_out))
|
||||||
|
|
||||||
#define MOD_QP_IN_SET(typ, in, _opcode, _qpn) \
|
#define MOD_QP_IN_SET(typ, in, _opcode, _qpn, _uid) \
|
||||||
MLX5_SET(typ##_in, in, opcode, _opcode); \
|
do { \
|
||||||
MLX5_SET(typ##_in, in, qpn, _qpn)
|
MLX5_SET(typ##_in, in, opcode, _opcode); \
|
||||||
|
MLX5_SET(typ##_in, in, qpn, _qpn); \
|
||||||
|
MLX5_SET(typ##_in, in, uid, _uid); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define MOD_QP_IN_SET_QPC(typ, in, _opcode, _qpn, _opt_p, _qpc) \
|
#define MOD_QP_IN_SET_QPC(typ, in, _opcode, _qpn, _opt_p, _qpc, _uid) \
|
||||||
MOD_QP_IN_SET(typ, in, _opcode, _qpn); \
|
do { \
|
||||||
MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \
|
MOD_QP_IN_SET(typ, in, _opcode, _qpn, _uid); \
|
||||||
memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, MLX5_ST_SZ_BYTES(qpc))
|
MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \
|
||||||
|
memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, \
|
||||||
|
MLX5_ST_SZ_BYTES(qpc)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
/* 2RST & 2ERR */
|
/* 2RST & 2ERR */
|
||||||
case MLX5_CMD_OP_2RST_QP:
|
case MLX5_CMD_OP_2RST_QP:
|
||||||
if (MBOX_ALLOC(mbox, qp_2rst))
|
if (MBOX_ALLOC(mbox, qp_2rst))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
MOD_QP_IN_SET(qp_2rst, mbox->in, opcode, qpn);
|
MOD_QP_IN_SET(qp_2rst, mbox->in, opcode, qpn, uid);
|
||||||
break;
|
break;
|
||||||
case MLX5_CMD_OP_2ERR_QP:
|
case MLX5_CMD_OP_2ERR_QP:
|
||||||
if (MBOX_ALLOC(mbox, qp_2err))
|
if (MBOX_ALLOC(mbox, qp_2err))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
MOD_QP_IN_SET(qp_2err, mbox->in, opcode, qpn);
|
MOD_QP_IN_SET(qp_2err, mbox->in, opcode, qpn, uid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* MODIFY with QPC */
|
/* MODIFY with QPC */
|
||||||
|
@ -408,37 +421,37 @@ static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn,
|
||||||
if (MBOX_ALLOC(mbox, rst2init_qp))
|
if (MBOX_ALLOC(mbox, rst2init_qp))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
MOD_QP_IN_SET_QPC(rst2init_qp, mbox->in, opcode, qpn,
|
MOD_QP_IN_SET_QPC(rst2init_qp, mbox->in, opcode, qpn,
|
||||||
opt_param_mask, qpc);
|
opt_param_mask, qpc, uid);
|
||||||
break;
|
break;
|
||||||
case MLX5_CMD_OP_INIT2RTR_QP:
|
case MLX5_CMD_OP_INIT2RTR_QP:
|
||||||
if (MBOX_ALLOC(mbox, init2rtr_qp))
|
if (MBOX_ALLOC(mbox, init2rtr_qp))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
MOD_QP_IN_SET_QPC(init2rtr_qp, mbox->in, opcode, qpn,
|
MOD_QP_IN_SET_QPC(init2rtr_qp, mbox->in, opcode, qpn,
|
||||||
opt_param_mask, qpc);
|
opt_param_mask, qpc, uid);
|
||||||
break;
|
break;
|
||||||
case MLX5_CMD_OP_RTR2RTS_QP:
|
case MLX5_CMD_OP_RTR2RTS_QP:
|
||||||
if (MBOX_ALLOC(mbox, rtr2rts_qp))
|
if (MBOX_ALLOC(mbox, rtr2rts_qp))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
MOD_QP_IN_SET_QPC(rtr2rts_qp, mbox->in, opcode, qpn,
|
MOD_QP_IN_SET_QPC(rtr2rts_qp, mbox->in, opcode, qpn,
|
||||||
opt_param_mask, qpc);
|
opt_param_mask, qpc, uid);
|
||||||
break;
|
break;
|
||||||
case MLX5_CMD_OP_RTS2RTS_QP:
|
case MLX5_CMD_OP_RTS2RTS_QP:
|
||||||
if (MBOX_ALLOC(mbox, rts2rts_qp))
|
if (MBOX_ALLOC(mbox, rts2rts_qp))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
MOD_QP_IN_SET_QPC(rts2rts_qp, mbox->in, opcode, qpn,
|
MOD_QP_IN_SET_QPC(rts2rts_qp, mbox->in, opcode, qpn,
|
||||||
opt_param_mask, qpc);
|
opt_param_mask, qpc, uid);
|
||||||
break;
|
break;
|
||||||
case MLX5_CMD_OP_SQERR2RTS_QP:
|
case MLX5_CMD_OP_SQERR2RTS_QP:
|
||||||
if (MBOX_ALLOC(mbox, sqerr2rts_qp))
|
if (MBOX_ALLOC(mbox, sqerr2rts_qp))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
MOD_QP_IN_SET_QPC(sqerr2rts_qp, mbox->in, opcode, qpn,
|
MOD_QP_IN_SET_QPC(sqerr2rts_qp, mbox->in, opcode, qpn,
|
||||||
opt_param_mask, qpc);
|
opt_param_mask, qpc, uid);
|
||||||
break;
|
break;
|
||||||
case MLX5_CMD_OP_INIT2INIT_QP:
|
case MLX5_CMD_OP_INIT2INIT_QP:
|
||||||
if (MBOX_ALLOC(mbox, init2init_qp))
|
if (MBOX_ALLOC(mbox, init2init_qp))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
MOD_QP_IN_SET_QPC(init2init_qp, mbox->in, opcode, qpn,
|
MOD_QP_IN_SET_QPC(init2init_qp, mbox->in, opcode, qpn,
|
||||||
opt_param_mask, qpc);
|
opt_param_mask, qpc, uid);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mlx5_core_err(dev, "Unknown transition for modify QP: OP(0x%x) QPN(0x%x)\n",
|
mlx5_core_err(dev, "Unknown transition for modify QP: OP(0x%x) QPN(0x%x)\n",
|
||||||
|
@ -456,7 +469,7 @@ int mlx5_core_qp_modify(struct mlx5_core_dev *dev, u16 opcode,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = modify_qp_mbox_alloc(dev, opcode, qp->qpn,
|
err = modify_qp_mbox_alloc(dev, opcode, qp->qpn,
|
||||||
opt_param_mask, qpc, &mbox);
|
opt_param_mask, qpc, &mbox, qp->uid);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -531,6 +544,17 @@ int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mlx5_core_xrcd_dealloc);
|
EXPORT_SYMBOL_GPL(mlx5_core_xrcd_dealloc);
|
||||||
|
|
||||||
|
static void destroy_rq_tracked(struct mlx5_core_dev *dev, u32 rqn, u16 uid)
|
||||||
|
{
|
||||||
|
u32 in[MLX5_ST_SZ_DW(destroy_rq_in)] = {};
|
||||||
|
u32 out[MLX5_ST_SZ_DW(destroy_rq_out)] = {};
|
||||||
|
|
||||||
|
MLX5_SET(destroy_rq_in, in, opcode, MLX5_CMD_OP_DESTROY_RQ);
|
||||||
|
MLX5_SET(destroy_rq_in, in, rqn, rqn);
|
||||||
|
MLX5_SET(destroy_rq_in, in, uid, uid);
|
||||||
|
mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
|
}
|
||||||
|
|
||||||
int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
|
int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
|
||||||
struct mlx5_core_qp *rq)
|
struct mlx5_core_qp *rq)
|
||||||
{
|
{
|
||||||
|
@ -541,6 +565,7 @@ int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
rq->uid = MLX5_GET(create_rq_in, in, uid);
|
||||||
rq->qpn = rqn;
|
rq->qpn = rqn;
|
||||||
err = create_resource_common(dev, rq, MLX5_RES_RQ);
|
err = create_resource_common(dev, rq, MLX5_RES_RQ);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -549,7 +574,7 @@ int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_destroy_rq:
|
err_destroy_rq:
|
||||||
mlx5_core_destroy_rq(dev, rq->qpn);
|
destroy_rq_tracked(dev, rq->qpn, rq->uid);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -559,10 +584,21 @@ void mlx5_core_destroy_rq_tracked(struct mlx5_core_dev *dev,
|
||||||
struct mlx5_core_qp *rq)
|
struct mlx5_core_qp *rq)
|
||||||
{
|
{
|
||||||
destroy_resource_common(dev, rq);
|
destroy_resource_common(dev, rq);
|
||||||
mlx5_core_destroy_rq(dev, rq->qpn);
|
destroy_rq_tracked(dev, rq->qpn, rq->uid);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mlx5_core_destroy_rq_tracked);
|
EXPORT_SYMBOL(mlx5_core_destroy_rq_tracked);
|
||||||
|
|
||||||
|
static void destroy_sq_tracked(struct mlx5_core_dev *dev, u32 sqn, u16 uid)
|
||||||
|
{
|
||||||
|
u32 in[MLX5_ST_SZ_DW(destroy_sq_in)] = {};
|
||||||
|
u32 out[MLX5_ST_SZ_DW(destroy_sq_out)] = {};
|
||||||
|
|
||||||
|
MLX5_SET(destroy_sq_in, in, opcode, MLX5_CMD_OP_DESTROY_SQ);
|
||||||
|
MLX5_SET(destroy_sq_in, in, sqn, sqn);
|
||||||
|
MLX5_SET(destroy_sq_in, in, uid, uid);
|
||||||
|
mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
|
}
|
||||||
|
|
||||||
int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
|
int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
|
||||||
struct mlx5_core_qp *sq)
|
struct mlx5_core_qp *sq)
|
||||||
{
|
{
|
||||||
|
@ -573,6 +609,7 @@ int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
sq->uid = MLX5_GET(create_sq_in, in, uid);
|
||||||
sq->qpn = sqn;
|
sq->qpn = sqn;
|
||||||
err = create_resource_common(dev, sq, MLX5_RES_SQ);
|
err = create_resource_common(dev, sq, MLX5_RES_SQ);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -581,7 +618,7 @@ int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_destroy_sq:
|
err_destroy_sq:
|
||||||
mlx5_core_destroy_sq(dev, sq->qpn);
|
destroy_sq_tracked(dev, sq->qpn, sq->uid);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -591,7 +628,7 @@ void mlx5_core_destroy_sq_tracked(struct mlx5_core_dev *dev,
|
||||||
struct mlx5_core_qp *sq)
|
struct mlx5_core_qp *sq)
|
||||||
{
|
{
|
||||||
destroy_resource_common(dev, sq);
|
destroy_resource_common(dev, sq);
|
||||||
mlx5_core_destroy_sq(dev, sq->qpn);
|
destroy_sq_tracked(dev, sq->qpn, sq->uid);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mlx5_core_destroy_sq_tracked);
|
EXPORT_SYMBOL(mlx5_core_destroy_sq_tracked);
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,7 @@ static int create_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
|
||||||
if (!create_in)
|
if (!create_in)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
MLX5_SET(create_srq_in, create_in, uid, in->uid);
|
||||||
srqc = MLX5_ADDR_OF(create_srq_in, create_in, srq_context_entry);
|
srqc = MLX5_ADDR_OF(create_srq_in, create_in, srq_context_entry);
|
||||||
pas = MLX5_ADDR_OF(create_srq_in, create_in, pas);
|
pas = MLX5_ADDR_OF(create_srq_in, create_in, pas);
|
||||||
|
|
||||||
|
@ -178,8 +179,10 @@ static int create_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
|
||||||
err = mlx5_cmd_exec(dev, create_in, inlen, create_out,
|
err = mlx5_cmd_exec(dev, create_in, inlen, create_out,
|
||||||
sizeof(create_out));
|
sizeof(create_out));
|
||||||
kvfree(create_in);
|
kvfree(create_in);
|
||||||
if (!err)
|
if (!err) {
|
||||||
srq->srqn = MLX5_GET(create_srq_out, create_out, srqn);
|
srq->srqn = MLX5_GET(create_srq_out, create_out, srqn);
|
||||||
|
srq->uid = in->uid;
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -193,6 +196,7 @@ static int destroy_srq_cmd(struct mlx5_core_dev *dev,
|
||||||
MLX5_SET(destroy_srq_in, srq_in, opcode,
|
MLX5_SET(destroy_srq_in, srq_in, opcode,
|
||||||
MLX5_CMD_OP_DESTROY_SRQ);
|
MLX5_CMD_OP_DESTROY_SRQ);
|
||||||
MLX5_SET(destroy_srq_in, srq_in, srqn, srq->srqn);
|
MLX5_SET(destroy_srq_in, srq_in, srqn, srq->srqn);
|
||||||
|
MLX5_SET(destroy_srq_in, srq_in, uid, srq->uid);
|
||||||
|
|
||||||
return mlx5_cmd_exec(dev, srq_in, sizeof(srq_in),
|
return mlx5_cmd_exec(dev, srq_in, sizeof(srq_in),
|
||||||
srq_out, sizeof(srq_out));
|
srq_out, sizeof(srq_out));
|
||||||
|
@ -208,6 +212,7 @@ static int arm_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
|
||||||
MLX5_SET(arm_rq_in, srq_in, op_mod, MLX5_ARM_RQ_IN_OP_MOD_SRQ);
|
MLX5_SET(arm_rq_in, srq_in, op_mod, MLX5_ARM_RQ_IN_OP_MOD_SRQ);
|
||||||
MLX5_SET(arm_rq_in, srq_in, srq_number, srq->srqn);
|
MLX5_SET(arm_rq_in, srq_in, srq_number, srq->srqn);
|
||||||
MLX5_SET(arm_rq_in, srq_in, lwm, lwm);
|
MLX5_SET(arm_rq_in, srq_in, lwm, lwm);
|
||||||
|
MLX5_SET(arm_rq_in, srq_in, uid, srq->uid);
|
||||||
|
|
||||||
return mlx5_cmd_exec(dev, srq_in, sizeof(srq_in),
|
return mlx5_cmd_exec(dev, srq_in, sizeof(srq_in),
|
||||||
srq_out, sizeof(srq_out));
|
srq_out, sizeof(srq_out));
|
||||||
|
@ -260,6 +265,7 @@ static int create_xrc_srq_cmd(struct mlx5_core_dev *dev,
|
||||||
if (!create_in)
|
if (!create_in)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
MLX5_SET(create_xrc_srq_in, create_in, uid, in->uid);
|
||||||
xrc_srqc = MLX5_ADDR_OF(create_xrc_srq_in, create_in,
|
xrc_srqc = MLX5_ADDR_OF(create_xrc_srq_in, create_in,
|
||||||
xrc_srq_context_entry);
|
xrc_srq_context_entry);
|
||||||
pas = MLX5_ADDR_OF(create_xrc_srq_in, create_in, pas);
|
pas = MLX5_ADDR_OF(create_xrc_srq_in, create_in, pas);
|
||||||
|
@ -277,6 +283,7 @@ static int create_xrc_srq_cmd(struct mlx5_core_dev *dev,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
srq->srqn = MLX5_GET(create_xrc_srq_out, create_out, xrc_srqn);
|
srq->srqn = MLX5_GET(create_xrc_srq_out, create_out, xrc_srqn);
|
||||||
|
srq->uid = in->uid;
|
||||||
out:
|
out:
|
||||||
kvfree(create_in);
|
kvfree(create_in);
|
||||||
return err;
|
return err;
|
||||||
|
@ -291,6 +298,7 @@ static int destroy_xrc_srq_cmd(struct mlx5_core_dev *dev,
|
||||||
MLX5_SET(destroy_xrc_srq_in, xrcsrq_in, opcode,
|
MLX5_SET(destroy_xrc_srq_in, xrcsrq_in, opcode,
|
||||||
MLX5_CMD_OP_DESTROY_XRC_SRQ);
|
MLX5_CMD_OP_DESTROY_XRC_SRQ);
|
||||||
MLX5_SET(destroy_xrc_srq_in, xrcsrq_in, xrc_srqn, srq->srqn);
|
MLX5_SET(destroy_xrc_srq_in, xrcsrq_in, xrc_srqn, srq->srqn);
|
||||||
|
MLX5_SET(destroy_xrc_srq_in, xrcsrq_in, uid, srq->uid);
|
||||||
|
|
||||||
return mlx5_cmd_exec(dev, xrcsrq_in, sizeof(xrcsrq_in),
|
return mlx5_cmd_exec(dev, xrcsrq_in, sizeof(xrcsrq_in),
|
||||||
xrcsrq_out, sizeof(xrcsrq_out));
|
xrcsrq_out, sizeof(xrcsrq_out));
|
||||||
|
@ -306,6 +314,7 @@ static int arm_xrc_srq_cmd(struct mlx5_core_dev *dev,
|
||||||
MLX5_SET(arm_xrc_srq_in, xrcsrq_in, op_mod, MLX5_ARM_XRC_SRQ_IN_OP_MOD_XRC_SRQ);
|
MLX5_SET(arm_xrc_srq_in, xrcsrq_in, op_mod, MLX5_ARM_XRC_SRQ_IN_OP_MOD_XRC_SRQ);
|
||||||
MLX5_SET(arm_xrc_srq_in, xrcsrq_in, xrc_srqn, srq->srqn);
|
MLX5_SET(arm_xrc_srq_in, xrcsrq_in, xrc_srqn, srq->srqn);
|
||||||
MLX5_SET(arm_xrc_srq_in, xrcsrq_in, lwm, lwm);
|
MLX5_SET(arm_xrc_srq_in, xrcsrq_in, lwm, lwm);
|
||||||
|
MLX5_SET(arm_xrc_srq_in, xrcsrq_in, uid, srq->uid);
|
||||||
|
|
||||||
return mlx5_cmd_exec(dev, xrcsrq_in, sizeof(xrcsrq_in),
|
return mlx5_cmd_exec(dev, xrcsrq_in, sizeof(xrcsrq_in),
|
||||||
xrcsrq_out, sizeof(xrcsrq_out));
|
xrcsrq_out, sizeof(xrcsrq_out));
|
||||||
|
@ -365,10 +374,13 @@ static int create_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
|
||||||
wq = MLX5_ADDR_OF(rmpc, rmpc, wq);
|
wq = MLX5_ADDR_OF(rmpc, rmpc, wq);
|
||||||
|
|
||||||
MLX5_SET(rmpc, rmpc, state, MLX5_RMPC_STATE_RDY);
|
MLX5_SET(rmpc, rmpc, state, MLX5_RMPC_STATE_RDY);
|
||||||
|
MLX5_SET(create_rmp_in, create_in, uid, in->uid);
|
||||||
set_wq(wq, in);
|
set_wq(wq, in);
|
||||||
memcpy(MLX5_ADDR_OF(rmpc, rmpc, wq.pas), in->pas, pas_size);
|
memcpy(MLX5_ADDR_OF(rmpc, rmpc, wq.pas), in->pas, pas_size);
|
||||||
|
|
||||||
err = mlx5_core_create_rmp(dev, create_in, inlen, &srq->srqn);
|
err = mlx5_core_create_rmp(dev, create_in, inlen, &srq->srqn);
|
||||||
|
if (!err)
|
||||||
|
srq->uid = in->uid;
|
||||||
|
|
||||||
kvfree(create_in);
|
kvfree(create_in);
|
||||||
return err;
|
return err;
|
||||||
|
@ -377,7 +389,13 @@ static int create_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
|
||||||
static int destroy_rmp_cmd(struct mlx5_core_dev *dev,
|
static int destroy_rmp_cmd(struct mlx5_core_dev *dev,
|
||||||
struct mlx5_core_srq *srq)
|
struct mlx5_core_srq *srq)
|
||||||
{
|
{
|
||||||
return mlx5_core_destroy_rmp(dev, srq->srqn);
|
u32 in[MLX5_ST_SZ_DW(destroy_rmp_in)] = {};
|
||||||
|
u32 out[MLX5_ST_SZ_DW(destroy_rmp_out)] = {};
|
||||||
|
|
||||||
|
MLX5_SET(destroy_rmp_in, in, opcode, MLX5_CMD_OP_DESTROY_RMP);
|
||||||
|
MLX5_SET(destroy_rmp_in, in, rmpn, srq->srqn);
|
||||||
|
MLX5_SET(destroy_rmp_in, in, uid, srq->uid);
|
||||||
|
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int arm_rmp_cmd(struct mlx5_core_dev *dev,
|
static int arm_rmp_cmd(struct mlx5_core_dev *dev,
|
||||||
|
@ -400,6 +418,7 @@ static int arm_rmp_cmd(struct mlx5_core_dev *dev,
|
||||||
|
|
||||||
MLX5_SET(modify_rmp_in, in, rmp_state, MLX5_RMPC_STATE_RDY);
|
MLX5_SET(modify_rmp_in, in, rmp_state, MLX5_RMPC_STATE_RDY);
|
||||||
MLX5_SET(modify_rmp_in, in, rmpn, srq->srqn);
|
MLX5_SET(modify_rmp_in, in, rmpn, srq->srqn);
|
||||||
|
MLX5_SET(modify_rmp_in, in, uid, srq->uid);
|
||||||
MLX5_SET(wq, wq, lwm, lwm);
|
MLX5_SET(wq, wq, lwm, lwm);
|
||||||
MLX5_SET(rmp_bitmask, bitmask, lwm, 1);
|
MLX5_SET(rmp_bitmask, bitmask, lwm, 1);
|
||||||
MLX5_SET(rmpc, rmpc, state, MLX5_RMPC_STATE_RDY);
|
MLX5_SET(rmpc, rmpc, state, MLX5_RMPC_STATE_RDY);
|
||||||
|
@ -469,11 +488,14 @@ static int create_xrq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
|
||||||
MLX5_SET(xrqc, xrqc, user_index, in->user_index);
|
MLX5_SET(xrqc, xrqc, user_index, in->user_index);
|
||||||
MLX5_SET(xrqc, xrqc, cqn, in->cqn);
|
MLX5_SET(xrqc, xrqc, cqn, in->cqn);
|
||||||
MLX5_SET(create_xrq_in, create_in, opcode, MLX5_CMD_OP_CREATE_XRQ);
|
MLX5_SET(create_xrq_in, create_in, opcode, MLX5_CMD_OP_CREATE_XRQ);
|
||||||
|
MLX5_SET(create_xrq_in, create_in, uid, in->uid);
|
||||||
err = mlx5_cmd_exec(dev, create_in, inlen, create_out,
|
err = mlx5_cmd_exec(dev, create_in, inlen, create_out,
|
||||||
sizeof(create_out));
|
sizeof(create_out));
|
||||||
kvfree(create_in);
|
kvfree(create_in);
|
||||||
if (!err)
|
if (!err) {
|
||||||
srq->srqn = MLX5_GET(create_xrq_out, create_out, xrqn);
|
srq->srqn = MLX5_GET(create_xrq_out, create_out, xrqn);
|
||||||
|
srq->uid = in->uid;
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -485,6 +507,7 @@ static int destroy_xrq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq)
|
||||||
|
|
||||||
MLX5_SET(destroy_xrq_in, in, opcode, MLX5_CMD_OP_DESTROY_XRQ);
|
MLX5_SET(destroy_xrq_in, in, opcode, MLX5_CMD_OP_DESTROY_XRQ);
|
||||||
MLX5_SET(destroy_xrq_in, in, xrqn, srq->srqn);
|
MLX5_SET(destroy_xrq_in, in, xrqn, srq->srqn);
|
||||||
|
MLX5_SET(destroy_xrq_in, in, uid, srq->uid);
|
||||||
|
|
||||||
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
}
|
}
|
||||||
|
@ -500,6 +523,7 @@ static int arm_xrq_cmd(struct mlx5_core_dev *dev,
|
||||||
MLX5_SET(arm_rq_in, in, op_mod, MLX5_ARM_RQ_IN_OP_MOD_XRQ);
|
MLX5_SET(arm_rq_in, in, op_mod, MLX5_ARM_RQ_IN_OP_MOD_XRQ);
|
||||||
MLX5_SET(arm_rq_in, in, srq_number, srq->srqn);
|
MLX5_SET(arm_rq_in, in, srq_number, srq->srqn);
|
||||||
MLX5_SET(arm_rq_in, in, lwm, lwm);
|
MLX5_SET(arm_rq_in, in, lwm, lwm);
|
||||||
|
MLX5_SET(arm_rq_in, in, uid, srq->uid);
|
||||||
|
|
||||||
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ struct mlx5_core_cq {
|
||||||
int reset_notify_added;
|
int reset_notify_added;
|
||||||
struct list_head reset_notify;
|
struct list_head reset_notify;
|
||||||
struct mlx5_eq *eq;
|
struct mlx5_eq *eq;
|
||||||
|
u16 uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1124,6 +1124,12 @@ enum mlx5_qcam_feature_groups {
|
||||||
#define MLX5_CAP_FLOWTABLE_NIC_RX_MAX(mdev, cap) \
|
#define MLX5_CAP_FLOWTABLE_NIC_RX_MAX(mdev, cap) \
|
||||||
MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive.cap)
|
MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive.cap)
|
||||||
|
|
||||||
|
#define MLX5_CAP_FLOWTABLE_NIC_TX(mdev, cap) \
|
||||||
|
MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_transmit.cap)
|
||||||
|
|
||||||
|
#define MLX5_CAP_FLOWTABLE_NIC_TX_MAX(mdev, cap) \
|
||||||
|
MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_transmit.cap)
|
||||||
|
|
||||||
#define MLX5_CAP_FLOWTABLE_SNIFFER_RX(mdev, cap) \
|
#define MLX5_CAP_FLOWTABLE_SNIFFER_RX(mdev, cap) \
|
||||||
MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive_sniffer.cap)
|
MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive_sniffer.cap)
|
||||||
|
|
||||||
|
|
|
@ -163,10 +163,7 @@ enum mlx5_dcbx_oper_mode {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum mlx5_dct_atomic_mode {
|
enum mlx5_dct_atomic_mode {
|
||||||
MLX5_ATOMIC_MODE_DCT_OFF = 20,
|
MLX5_ATOMIC_MODE_DCT_CX = 2,
|
||||||
MLX5_ATOMIC_MODE_DCT_NONE = 0 << MLX5_ATOMIC_MODE_DCT_OFF,
|
|
||||||
MLX5_ATOMIC_MODE_DCT_IB_COMP = 1 << MLX5_ATOMIC_MODE_DCT_OFF,
|
|
||||||
MLX5_ATOMIC_MODE_DCT_CX = 2 << MLX5_ATOMIC_MODE_DCT_OFF,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -477,6 +474,7 @@ struct mlx5_core_srq {
|
||||||
|
|
||||||
atomic_t refcount;
|
atomic_t refcount;
|
||||||
struct completion free;
|
struct completion free;
|
||||||
|
u16 uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_eq_table {
|
struct mlx5_eq_table {
|
||||||
|
|
|
@ -45,7 +45,8 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MLX5_FLOW_TABLE_TUNNEL_EN = BIT(0),
|
MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT = BIT(0),
|
||||||
|
MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1),
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LEFTOVERS_RULE_NUM 2
|
#define LEFTOVERS_RULE_NUM 2
|
||||||
|
@ -91,7 +92,7 @@ struct mlx5_flow_destination {
|
||||||
u32 tir_num;
|
u32 tir_num;
|
||||||
u32 ft_num;
|
u32 ft_num;
|
||||||
struct mlx5_flow_table *ft;
|
struct mlx5_flow_table *ft;
|
||||||
struct mlx5_fc *counter;
|
u32 counter_id;
|
||||||
struct {
|
struct {
|
||||||
u16 num;
|
u16 num;
|
||||||
u16 vhca_id;
|
u16 vhca_id;
|
||||||
|
@ -100,6 +101,8 @@ struct mlx5_flow_destination {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct mlx5_flow_namespace *
|
||||||
|
mlx5_get_fdb_sub_ns(struct mlx5_core_dev *dev, int n);
|
||||||
struct mlx5_flow_namespace *
|
struct mlx5_flow_namespace *
|
||||||
mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
|
mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
|
||||||
enum mlx5_flow_namespace_type type);
|
enum mlx5_flow_namespace_type type);
|
||||||
|
@ -155,20 +158,28 @@ struct mlx5_fs_vlan {
|
||||||
|
|
||||||
#define MLX5_FS_VLAN_DEPTH 2
|
#define MLX5_FS_VLAN_DEPTH 2
|
||||||
|
|
||||||
|
enum {
|
||||||
|
FLOW_ACT_HAS_TAG = BIT(0),
|
||||||
|
FLOW_ACT_NO_APPEND = BIT(1),
|
||||||
|
};
|
||||||
|
|
||||||
struct mlx5_flow_act {
|
struct mlx5_flow_act {
|
||||||
u32 action;
|
u32 action;
|
||||||
bool has_flow_tag;
|
|
||||||
u32 flow_tag;
|
u32 flow_tag;
|
||||||
u32 encap_id;
|
u32 reformat_id;
|
||||||
u32 modify_id;
|
u32 modify_id;
|
||||||
uintptr_t esp_id;
|
uintptr_t esp_id;
|
||||||
|
u32 flags;
|
||||||
struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH];
|
struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH];
|
||||||
struct ib_counters *counters;
|
struct ib_counters *counters;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MLX5_DECLARE_FLOW_ACT(name) \
|
#define MLX5_DECLARE_FLOW_ACT(name) \
|
||||||
struct mlx5_flow_act name = {MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\
|
struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\
|
||||||
MLX5_FS_DEFAULT_FLOW_TAG, 0, 0}
|
.flow_tag = MLX5_FS_DEFAULT_FLOW_TAG, \
|
||||||
|
.reformat_id = 0, \
|
||||||
|
.modify_id = 0, \
|
||||||
|
.flags = 0, }
|
||||||
|
|
||||||
/* Single destination per rule.
|
/* Single destination per rule.
|
||||||
* Group ID is implied by the match criteria.
|
* Group ID is implied by the match criteria.
|
||||||
|
@ -185,15 +196,30 @@ int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler,
|
||||||
struct mlx5_flow_destination *new_dest,
|
struct mlx5_flow_destination *new_dest,
|
||||||
struct mlx5_flow_destination *old_dest);
|
struct mlx5_flow_destination *old_dest);
|
||||||
|
|
||||||
struct mlx5_fc *mlx5_flow_rule_counter(struct mlx5_flow_handle *handler);
|
|
||||||
struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
|
struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
|
||||||
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
|
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
|
||||||
void mlx5_fc_query_cached(struct mlx5_fc *counter,
|
void mlx5_fc_query_cached(struct mlx5_fc *counter,
|
||||||
u64 *bytes, u64 *packets, u64 *lastuse);
|
u64 *bytes, u64 *packets, u64 *lastuse);
|
||||||
int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
|
int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
|
||||||
u64 *packets, u64 *bytes);
|
u64 *packets, u64 *bytes);
|
||||||
|
u32 mlx5_fc_id(struct mlx5_fc *counter);
|
||||||
|
|
||||||
int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
|
int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
|
||||||
int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
|
int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
|
||||||
|
|
||||||
|
int mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
|
||||||
|
u8 namespace, u8 num_actions,
|
||||||
|
void *modify_actions, u32 *modify_header_id);
|
||||||
|
void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev,
|
||||||
|
u32 modify_header_id);
|
||||||
|
|
||||||
|
int mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev,
|
||||||
|
int reformat_type,
|
||||||
|
size_t size,
|
||||||
|
void *reformat_data,
|
||||||
|
enum mlx5_flow_namespace_type namespace,
|
||||||
|
u32 *packet_reformat_id);
|
||||||
|
void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev,
|
||||||
|
u32 packet_reformat_id);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -243,8 +243,8 @@ enum {
|
||||||
MLX5_CMD_OP_DEALLOC_FLOW_COUNTER = 0x93a,
|
MLX5_CMD_OP_DEALLOC_FLOW_COUNTER = 0x93a,
|
||||||
MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b,
|
MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b,
|
||||||
MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c,
|
MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c,
|
||||||
MLX5_CMD_OP_ALLOC_ENCAP_HEADER = 0x93d,
|
MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT = 0x93d,
|
||||||
MLX5_CMD_OP_DEALLOC_ENCAP_HEADER = 0x93e,
|
MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT = 0x93e,
|
||||||
MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT = 0x940,
|
MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT = 0x940,
|
||||||
MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT = 0x941,
|
MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT = 0x941,
|
||||||
MLX5_CMD_OP_QUERY_MODIFY_HEADER_CONTEXT = 0x942,
|
MLX5_CMD_OP_QUERY_MODIFY_HEADER_CONTEXT = 0x942,
|
||||||
|
@ -336,7 +336,7 @@ struct mlx5_ifc_flow_table_prop_layout_bits {
|
||||||
u8 modify_root[0x1];
|
u8 modify_root[0x1];
|
||||||
u8 identified_miss_table_mode[0x1];
|
u8 identified_miss_table_mode[0x1];
|
||||||
u8 flow_table_modify[0x1];
|
u8 flow_table_modify[0x1];
|
||||||
u8 encap[0x1];
|
u8 reformat[0x1];
|
||||||
u8 decap[0x1];
|
u8 decap[0x1];
|
||||||
u8 reserved_at_9[0x1];
|
u8 reserved_at_9[0x1];
|
||||||
u8 pop_vlan[0x1];
|
u8 pop_vlan[0x1];
|
||||||
|
@ -344,8 +344,12 @@ struct mlx5_ifc_flow_table_prop_layout_bits {
|
||||||
u8 reserved_at_c[0x1];
|
u8 reserved_at_c[0x1];
|
||||||
u8 pop_vlan_2[0x1];
|
u8 pop_vlan_2[0x1];
|
||||||
u8 push_vlan_2[0x1];
|
u8 push_vlan_2[0x1];
|
||||||
u8 reserved_at_f[0x11];
|
u8 reformat_and_vlan_action[0x1];
|
||||||
|
u8 reserved_at_10[0x2];
|
||||||
|
u8 reformat_l3_tunnel_to_l2[0x1];
|
||||||
|
u8 reformat_l2_to_l3_tunnel[0x1];
|
||||||
|
u8 reformat_and_modify_action[0x1];
|
||||||
|
u8 reserved_at_14[0xb];
|
||||||
u8 reserved_at_20[0x2];
|
u8 reserved_at_20[0x2];
|
||||||
u8 log_max_ft_size[0x6];
|
u8 log_max_ft_size[0x6];
|
||||||
u8 log_max_modify_header_context[0x8];
|
u8 log_max_modify_header_context[0x8];
|
||||||
|
@ -554,7 +558,13 @@ struct mlx5_ifc_flow_table_nic_cap_bits {
|
||||||
u8 nic_rx_multi_path_tirs[0x1];
|
u8 nic_rx_multi_path_tirs[0x1];
|
||||||
u8 nic_rx_multi_path_tirs_fts[0x1];
|
u8 nic_rx_multi_path_tirs_fts[0x1];
|
||||||
u8 allow_sniffer_and_nic_rx_shared_tir[0x1];
|
u8 allow_sniffer_and_nic_rx_shared_tir[0x1];
|
||||||
u8 reserved_at_3[0x1fd];
|
u8 reserved_at_3[0x1d];
|
||||||
|
u8 encap_general_header[0x1];
|
||||||
|
u8 reserved_at_21[0xa];
|
||||||
|
u8 log_max_packet_reformat_context[0x5];
|
||||||
|
u8 reserved_at_30[0x6];
|
||||||
|
u8 max_encap_header_size[0xa];
|
||||||
|
u8 reserved_at_40[0x1c0];
|
||||||
|
|
||||||
struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive;
|
struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_receive;
|
||||||
|
|
||||||
|
@ -574,7 +584,9 @@ struct mlx5_ifc_flow_table_nic_cap_bits {
|
||||||
struct mlx5_ifc_flow_table_eswitch_cap_bits {
|
struct mlx5_ifc_flow_table_eswitch_cap_bits {
|
||||||
u8 reserved_at_0[0x1c];
|
u8 reserved_at_0[0x1c];
|
||||||
u8 fdb_multi_path_to_table[0x1];
|
u8 fdb_multi_path_to_table[0x1];
|
||||||
u8 reserved_at_1d[0x1e3];
|
u8 reserved_at_1d[0x1];
|
||||||
|
u8 multi_fdb_encap[0x1];
|
||||||
|
u8 reserved_at_1e[0x1e1];
|
||||||
|
|
||||||
struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_esw_fdb;
|
struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_esw_fdb;
|
||||||
|
|
||||||
|
@ -599,7 +611,7 @@ struct mlx5_ifc_e_switch_cap_bits {
|
||||||
u8 vxlan_encap_decap[0x1];
|
u8 vxlan_encap_decap[0x1];
|
||||||
u8 nvgre_encap_decap[0x1];
|
u8 nvgre_encap_decap[0x1];
|
||||||
u8 reserved_at_22[0x9];
|
u8 reserved_at_22[0x9];
|
||||||
u8 log_max_encap_headers[0x5];
|
u8 log_max_packet_reformat_context[0x5];
|
||||||
u8 reserved_2b[0x6];
|
u8 reserved_2b[0x6];
|
||||||
u8 max_encap_header_size[0xa];
|
u8 max_encap_header_size[0xa];
|
||||||
|
|
||||||
|
@ -996,7 +1008,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
|
||||||
u8 umr_modify_atomic_disabled[0x1];
|
u8 umr_modify_atomic_disabled[0x1];
|
||||||
u8 umr_indirect_mkey_disabled[0x1];
|
u8 umr_indirect_mkey_disabled[0x1];
|
||||||
u8 umr_fence[0x2];
|
u8 umr_fence[0x2];
|
||||||
u8 reserved_at_20c[0x3];
|
u8 dc_req_scat_data_cqe[0x1];
|
||||||
|
u8 reserved_at_20d[0x2];
|
||||||
u8 drain_sigerr[0x1];
|
u8 drain_sigerr[0x1];
|
||||||
u8 cmdif_checksum[0x2];
|
u8 cmdif_checksum[0x2];
|
||||||
u8 sigerr_cqe[0x1];
|
u8 sigerr_cqe[0x1];
|
||||||
|
@ -1281,7 +1294,9 @@ struct mlx5_ifc_wq_bits {
|
||||||
u8 reserved_at_118[0x3];
|
u8 reserved_at_118[0x3];
|
||||||
u8 log_wq_sz[0x5];
|
u8 log_wq_sz[0x5];
|
||||||
|
|
||||||
u8 reserved_at_120[0x3];
|
u8 dbr_umem_valid[0x1];
|
||||||
|
u8 wq_umem_valid[0x1];
|
||||||
|
u8 reserved_at_122[0x1];
|
||||||
u8 log_hairpin_num_packets[0x5];
|
u8 log_hairpin_num_packets[0x5];
|
||||||
u8 reserved_at_128[0x3];
|
u8 reserved_at_128[0x3];
|
||||||
u8 log_hairpin_data_sz[0x5];
|
u8 log_hairpin_data_sz[0x5];
|
||||||
|
@ -2355,7 +2370,10 @@ struct mlx5_ifc_qpc_bits {
|
||||||
|
|
||||||
u8 dc_access_key[0x40];
|
u8 dc_access_key[0x40];
|
||||||
|
|
||||||
u8 reserved_at_680[0xc0];
|
u8 reserved_at_680[0x3];
|
||||||
|
u8 dbr_umem_valid[0x1];
|
||||||
|
|
||||||
|
u8 reserved_at_684[0xbc];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_roce_addr_layout_bits {
|
struct mlx5_ifc_roce_addr_layout_bits {
|
||||||
|
@ -2395,7 +2413,7 @@ enum {
|
||||||
MLX5_FLOW_CONTEXT_ACTION_DROP = 0x2,
|
MLX5_FLOW_CONTEXT_ACTION_DROP = 0x2,
|
||||||
MLX5_FLOW_CONTEXT_ACTION_FWD_DEST = 0x4,
|
MLX5_FLOW_CONTEXT_ACTION_FWD_DEST = 0x4,
|
||||||
MLX5_FLOW_CONTEXT_ACTION_COUNT = 0x8,
|
MLX5_FLOW_CONTEXT_ACTION_COUNT = 0x8,
|
||||||
MLX5_FLOW_CONTEXT_ACTION_ENCAP = 0x10,
|
MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT = 0x10,
|
||||||
MLX5_FLOW_CONTEXT_ACTION_DECAP = 0x20,
|
MLX5_FLOW_CONTEXT_ACTION_DECAP = 0x20,
|
||||||
MLX5_FLOW_CONTEXT_ACTION_MOD_HDR = 0x40,
|
MLX5_FLOW_CONTEXT_ACTION_MOD_HDR = 0x40,
|
||||||
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP = 0x80,
|
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP = 0x80,
|
||||||
|
@ -2428,7 +2446,7 @@ struct mlx5_ifc_flow_context_bits {
|
||||||
u8 reserved_at_a0[0x8];
|
u8 reserved_at_a0[0x8];
|
||||||
u8 flow_counter_list_size[0x18];
|
u8 flow_counter_list_size[0x18];
|
||||||
|
|
||||||
u8 encap_id[0x20];
|
u8 packet_reformat_id[0x20];
|
||||||
|
|
||||||
u8 modify_header_id[0x20];
|
u8 modify_header_id[0x20];
|
||||||
|
|
||||||
|
@ -2455,7 +2473,7 @@ struct mlx5_ifc_xrc_srqc_bits {
|
||||||
|
|
||||||
u8 wq_signature[0x1];
|
u8 wq_signature[0x1];
|
||||||
u8 cont_srq[0x1];
|
u8 cont_srq[0x1];
|
||||||
u8 reserved_at_22[0x1];
|
u8 dbr_umem_valid[0x1];
|
||||||
u8 rlky[0x1];
|
u8 rlky[0x1];
|
||||||
u8 basic_cyclic_rcv_wqe[0x1];
|
u8 basic_cyclic_rcv_wqe[0x1];
|
||||||
u8 log_rq_stride[0x3];
|
u8 log_rq_stride[0x3];
|
||||||
|
@ -2550,8 +2568,8 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST_ = 0x1,
|
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST = 0x1,
|
||||||
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_MULTICAST_ = 0x2,
|
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_MULTICAST = 0x2,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_tirc_bits {
|
struct mlx5_ifc_tirc_bits {
|
||||||
|
@ -3119,7 +3137,9 @@ enum {
|
||||||
|
|
||||||
struct mlx5_ifc_cqc_bits {
|
struct mlx5_ifc_cqc_bits {
|
||||||
u8 status[0x4];
|
u8 status[0x4];
|
||||||
u8 reserved_at_4[0x4];
|
u8 reserved_at_4[0x2];
|
||||||
|
u8 dbr_umem_valid[0x1];
|
||||||
|
u8 reserved_at_7[0x1];
|
||||||
u8 cqe_sz[0x3];
|
u8 cqe_sz[0x3];
|
||||||
u8 cc[0x1];
|
u8 cc[0x1];
|
||||||
u8 reserved_at_c[0x1];
|
u8 reserved_at_c[0x1];
|
||||||
|
@ -3386,7 +3406,7 @@ struct mlx5_ifc_sqerr2rts_qp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_sqerr2rts_qp_in_bits {
|
struct mlx5_ifc_sqerr2rts_qp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -3416,7 +3436,7 @@ struct mlx5_ifc_sqd2rts_qp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_sqd2rts_qp_in_bits {
|
struct mlx5_ifc_sqd2rts_qp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -3621,7 +3641,7 @@ struct mlx5_ifc_rts2rts_qp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_rts2rts_qp_in_bits {
|
struct mlx5_ifc_rts2rts_qp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -3651,7 +3671,7 @@ struct mlx5_ifc_rtr2rts_qp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_rtr2rts_qp_in_bits {
|
struct mlx5_ifc_rtr2rts_qp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -3681,7 +3701,7 @@ struct mlx5_ifc_rst2init_qp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_rst2init_qp_in_bits {
|
struct mlx5_ifc_rst2init_qp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -4804,19 +4824,19 @@ struct mlx5_ifc_query_eq_in_bits {
|
||||||
u8 reserved_at_60[0x20];
|
u8 reserved_at_60[0x20];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_encap_header_in_bits {
|
struct mlx5_ifc_packet_reformat_context_in_bits {
|
||||||
u8 reserved_at_0[0x5];
|
u8 reserved_at_0[0x5];
|
||||||
u8 header_type[0x3];
|
u8 reformat_type[0x3];
|
||||||
u8 reserved_at_8[0xe];
|
u8 reserved_at_8[0xe];
|
||||||
u8 encap_header_size[0xa];
|
u8 reformat_data_size[0xa];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 encap_header[2][0x8];
|
u8 reformat_data[2][0x8];
|
||||||
|
|
||||||
u8 more_encap_header[0][0x8];
|
u8 more_reformat_data[0][0x8];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_query_encap_header_out_bits {
|
struct mlx5_ifc_query_packet_reformat_context_out_bits {
|
||||||
u8 status[0x8];
|
u8 status[0x8];
|
||||||
u8 reserved_at_8[0x18];
|
u8 reserved_at_8[0x18];
|
||||||
|
|
||||||
|
@ -4824,33 +4844,41 @@ struct mlx5_ifc_query_encap_header_out_bits {
|
||||||
|
|
||||||
u8 reserved_at_40[0xa0];
|
u8 reserved_at_40[0xa0];
|
||||||
|
|
||||||
struct mlx5_ifc_encap_header_in_bits encap_header[0];
|
struct mlx5_ifc_packet_reformat_context_in_bits packet_reformat_context[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_query_encap_header_in_bits {
|
struct mlx5_ifc_query_packet_reformat_context_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 reserved_at_10[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
|
||||||
u8 encap_id[0x20];
|
u8 packet_reformat_id[0x20];
|
||||||
|
|
||||||
u8 reserved_at_60[0xa0];
|
u8 reserved_at_60[0xa0];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_alloc_encap_header_out_bits {
|
struct mlx5_ifc_alloc_packet_reformat_context_out_bits {
|
||||||
u8 status[0x8];
|
u8 status[0x8];
|
||||||
u8 reserved_at_8[0x18];
|
u8 reserved_at_8[0x18];
|
||||||
|
|
||||||
u8 syndrome[0x20];
|
u8 syndrome[0x20];
|
||||||
|
|
||||||
u8 encap_id[0x20];
|
u8 packet_reformat_id[0x20];
|
||||||
|
|
||||||
u8 reserved_at_60[0x20];
|
u8 reserved_at_60[0x20];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_alloc_encap_header_in_bits {
|
enum {
|
||||||
|
MLX5_REFORMAT_TYPE_L2_TO_VXLAN = 0x0,
|
||||||
|
MLX5_REFORMAT_TYPE_L2_TO_NVGRE = 0x1,
|
||||||
|
MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL = 0x2,
|
||||||
|
MLX5_REFORMAT_TYPE_L3_TUNNEL_TO_L2 = 0x3,
|
||||||
|
MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL = 0x4,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mlx5_ifc_alloc_packet_reformat_context_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 reserved_at_10[0x10];
|
||||||
|
|
||||||
|
@ -4859,10 +4887,10 @@ struct mlx5_ifc_alloc_encap_header_in_bits {
|
||||||
|
|
||||||
u8 reserved_at_40[0xa0];
|
u8 reserved_at_40[0xa0];
|
||||||
|
|
||||||
struct mlx5_ifc_encap_header_in_bits encap_header;
|
struct mlx5_ifc_packet_reformat_context_in_bits packet_reformat_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_dealloc_encap_header_out_bits {
|
struct mlx5_ifc_dealloc_packet_reformat_context_out_bits {
|
||||||
u8 status[0x8];
|
u8 status[0x8];
|
||||||
u8 reserved_at_8[0x18];
|
u8 reserved_at_8[0x18];
|
||||||
|
|
||||||
|
@ -4871,14 +4899,14 @@ struct mlx5_ifc_dealloc_encap_header_out_bits {
|
||||||
u8 reserved_at_40[0x40];
|
u8 reserved_at_40[0x40];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_dealloc_encap_header_in_bits {
|
struct mlx5_ifc_dealloc_packet_reformat_context_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 reserved_at_10[0x10];
|
||||||
|
|
||||||
u8 reserved_20[0x10];
|
u8 reserved_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
|
||||||
u8 encap_id[0x20];
|
u8 packet_reformat_id[0x20];
|
||||||
|
|
||||||
u8 reserved_60[0x20];
|
u8 reserved_60[0x20];
|
||||||
};
|
};
|
||||||
|
@ -5176,7 +5204,7 @@ struct mlx5_ifc_qp_2rst_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_qp_2rst_in_bits {
|
struct mlx5_ifc_qp_2rst_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5198,7 +5226,7 @@ struct mlx5_ifc_qp_2err_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_qp_2err_in_bits {
|
struct mlx5_ifc_qp_2err_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5298,7 +5326,7 @@ struct mlx5_ifc_modify_tis_bitmask_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_modify_tis_in_bits {
|
struct mlx5_ifc_modify_tis_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5337,7 +5365,7 @@ struct mlx5_ifc_modify_tir_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_modify_tir_in_bits {
|
struct mlx5_ifc_modify_tir_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5365,7 +5393,7 @@ struct mlx5_ifc_modify_sq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_modify_sq_in_bits {
|
struct mlx5_ifc_modify_sq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5438,7 +5466,7 @@ struct mlx5_ifc_rqt_bitmask_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_modify_rqt_in_bits {
|
struct mlx5_ifc_modify_rqt_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5472,7 +5500,7 @@ enum {
|
||||||
|
|
||||||
struct mlx5_ifc_modify_rq_in_bits {
|
struct mlx5_ifc_modify_rq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5508,7 +5536,7 @@ struct mlx5_ifc_rmp_bitmask_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_modify_rmp_in_bits {
|
struct mlx5_ifc_modify_rmp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5613,7 +5641,7 @@ enum {
|
||||||
|
|
||||||
struct mlx5_ifc_modify_cq_in_bits {
|
struct mlx5_ifc_modify_cq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5625,7 +5653,10 @@ struct mlx5_ifc_modify_cq_in_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_cqc_bits cq_context;
|
struct mlx5_ifc_cqc_bits cq_context;
|
||||||
|
|
||||||
u8 reserved_at_280[0x600];
|
u8 reserved_at_280[0x40];
|
||||||
|
|
||||||
|
u8 cq_umem_valid[0x1];
|
||||||
|
u8 reserved_at_2c1[0x5bf];
|
||||||
|
|
||||||
u8 pas[0][0x40];
|
u8 pas[0][0x40];
|
||||||
};
|
};
|
||||||
|
@ -5773,7 +5804,7 @@ struct mlx5_ifc_init2rtr_qp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_init2rtr_qp_in_bits {
|
struct mlx5_ifc_init2rtr_qp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5803,7 +5834,7 @@ struct mlx5_ifc_init2init_qp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_init2init_qp_in_bits {
|
struct mlx5_ifc_init2init_qp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5902,7 +5933,7 @@ struct mlx5_ifc_drain_dct_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_drain_dct_in_bits {
|
struct mlx5_ifc_drain_dct_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5946,7 +5977,7 @@ struct mlx5_ifc_detach_from_mcg_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_detach_from_mcg_in_bits {
|
struct mlx5_ifc_detach_from_mcg_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5970,7 +6001,7 @@ struct mlx5_ifc_destroy_xrq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_xrq_in_bits {
|
struct mlx5_ifc_destroy_xrq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -5992,7 +6023,7 @@ struct mlx5_ifc_destroy_xrc_srq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_xrc_srq_in_bits {
|
struct mlx5_ifc_destroy_xrc_srq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6014,7 +6045,7 @@ struct mlx5_ifc_destroy_tis_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_tis_in_bits {
|
struct mlx5_ifc_destroy_tis_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6036,7 +6067,7 @@ struct mlx5_ifc_destroy_tir_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_tir_in_bits {
|
struct mlx5_ifc_destroy_tir_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6058,7 +6089,7 @@ struct mlx5_ifc_destroy_srq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_srq_in_bits {
|
struct mlx5_ifc_destroy_srq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6080,7 +6111,7 @@ struct mlx5_ifc_destroy_sq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_sq_in_bits {
|
struct mlx5_ifc_destroy_sq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6126,7 +6157,7 @@ struct mlx5_ifc_destroy_rqt_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_rqt_in_bits {
|
struct mlx5_ifc_destroy_rqt_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6148,7 +6179,7 @@ struct mlx5_ifc_destroy_rq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_rq_in_bits {
|
struct mlx5_ifc_destroy_rq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6192,7 +6223,7 @@ struct mlx5_ifc_destroy_rmp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_rmp_in_bits {
|
struct mlx5_ifc_destroy_rmp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6214,7 +6245,7 @@ struct mlx5_ifc_destroy_qp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_qp_in_bits {
|
struct mlx5_ifc_destroy_qp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6366,7 +6397,7 @@ struct mlx5_ifc_destroy_dct_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_dct_in_bits {
|
struct mlx5_ifc_destroy_dct_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6388,7 +6419,7 @@ struct mlx5_ifc_destroy_cq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_destroy_cq_in_bits {
|
struct mlx5_ifc_destroy_cq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6491,7 +6522,7 @@ struct mlx5_ifc_dealloc_xrcd_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_dealloc_xrcd_in_bits {
|
struct mlx5_ifc_dealloc_xrcd_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6579,7 +6610,7 @@ struct mlx5_ifc_dealloc_pd_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_dealloc_pd_in_bits {
|
struct mlx5_ifc_dealloc_pd_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6625,7 +6656,7 @@ struct mlx5_ifc_create_xrq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_xrq_in_bits {
|
struct mlx5_ifc_create_xrq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6649,7 +6680,7 @@ struct mlx5_ifc_create_xrc_srq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_xrc_srq_in_bits {
|
struct mlx5_ifc_create_xrc_srq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6658,7 +6689,9 @@ struct mlx5_ifc_create_xrc_srq_in_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_xrc_srqc_bits xrc_srq_context_entry;
|
struct mlx5_ifc_xrc_srqc_bits xrc_srq_context_entry;
|
||||||
|
|
||||||
u8 reserved_at_280[0x600];
|
u8 reserved_at_280[0x40];
|
||||||
|
u8 xrc_srq_umem_valid[0x1];
|
||||||
|
u8 reserved_at_2c1[0x5bf];
|
||||||
|
|
||||||
u8 pas[0][0x40];
|
u8 pas[0][0x40];
|
||||||
};
|
};
|
||||||
|
@ -6677,7 +6710,7 @@ struct mlx5_ifc_create_tis_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_tis_in_bits {
|
struct mlx5_ifc_create_tis_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6701,7 +6734,7 @@ struct mlx5_ifc_create_tir_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_tir_in_bits {
|
struct mlx5_ifc_create_tir_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6725,7 +6758,7 @@ struct mlx5_ifc_create_srq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_srq_in_bits {
|
struct mlx5_ifc_create_srq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6753,7 +6786,7 @@ struct mlx5_ifc_create_sq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_sq_in_bits {
|
struct mlx5_ifc_create_sq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6807,7 +6840,7 @@ struct mlx5_ifc_create_rqt_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_rqt_in_bits {
|
struct mlx5_ifc_create_rqt_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6831,7 +6864,7 @@ struct mlx5_ifc_create_rq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_rq_in_bits {
|
struct mlx5_ifc_create_rq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6855,7 +6888,7 @@ struct mlx5_ifc_create_rmp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_rmp_in_bits {
|
struct mlx5_ifc_create_rmp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6879,7 +6912,7 @@ struct mlx5_ifc_create_qp_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_qp_in_bits {
|
struct mlx5_ifc_create_qp_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -6892,7 +6925,10 @@ struct mlx5_ifc_create_qp_in_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_qpc_bits qpc;
|
struct mlx5_ifc_qpc_bits qpc;
|
||||||
|
|
||||||
u8 reserved_at_800[0x80];
|
u8 reserved_at_800[0x60];
|
||||||
|
|
||||||
|
u8 wq_umem_valid[0x1];
|
||||||
|
u8 reserved_at_861[0x1f];
|
||||||
|
|
||||||
u8 pas[0][0x40];
|
u8 pas[0][0x40];
|
||||||
};
|
};
|
||||||
|
@ -6954,7 +6990,8 @@ struct mlx5_ifc_create_mkey_in_bits {
|
||||||
u8 reserved_at_40[0x20];
|
u8 reserved_at_40[0x20];
|
||||||
|
|
||||||
u8 pg_access[0x1];
|
u8 pg_access[0x1];
|
||||||
u8 reserved_at_61[0x1f];
|
u8 mkey_umem_valid[0x1];
|
||||||
|
u8 reserved_at_62[0x1e];
|
||||||
|
|
||||||
struct mlx5_ifc_mkc_bits memory_key_mkey_entry;
|
struct mlx5_ifc_mkc_bits memory_key_mkey_entry;
|
||||||
|
|
||||||
|
@ -6980,7 +7017,7 @@ struct mlx5_ifc_create_flow_table_out_bits {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_flow_table_context_bits {
|
struct mlx5_ifc_flow_table_context_bits {
|
||||||
u8 encap_en[0x1];
|
u8 reformat_en[0x1];
|
||||||
u8 decap_en[0x1];
|
u8 decap_en[0x1];
|
||||||
u8 reserved_at_2[0x2];
|
u8 reserved_at_2[0x2];
|
||||||
u8 table_miss_action[0x4];
|
u8 table_miss_action[0x4];
|
||||||
|
@ -7122,7 +7159,7 @@ struct mlx5_ifc_create_dct_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_dct_in_bits {
|
struct mlx5_ifc_create_dct_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -7148,7 +7185,7 @@ struct mlx5_ifc_create_cq_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_create_cq_in_bits {
|
struct mlx5_ifc_create_cq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -7157,7 +7194,10 @@ struct mlx5_ifc_create_cq_in_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_cqc_bits cq_context;
|
struct mlx5_ifc_cqc_bits cq_context;
|
||||||
|
|
||||||
u8 reserved_at_280[0x600];
|
u8 reserved_at_280[0x60];
|
||||||
|
|
||||||
|
u8 cq_umem_valid[0x1];
|
||||||
|
u8 reserved_at_2e1[0x59f];
|
||||||
|
|
||||||
u8 pas[0][0x40];
|
u8 pas[0][0x40];
|
||||||
};
|
};
|
||||||
|
@ -7205,7 +7245,7 @@ struct mlx5_ifc_attach_to_mcg_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_attach_to_mcg_in_bits {
|
struct mlx5_ifc_attach_to_mcg_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -7256,7 +7296,7 @@ enum {
|
||||||
|
|
||||||
struct mlx5_ifc_arm_xrc_srq_in_bits {
|
struct mlx5_ifc_arm_xrc_srq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -7284,7 +7324,7 @@ enum {
|
||||||
|
|
||||||
struct mlx5_ifc_arm_rq_in_bits {
|
struct mlx5_ifc_arm_rq_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -7332,7 +7372,7 @@ struct mlx5_ifc_alloc_xrcd_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_alloc_xrcd_in_bits {
|
struct mlx5_ifc_alloc_xrcd_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
@ -7420,7 +7460,7 @@ struct mlx5_ifc_alloc_pd_out_bits {
|
||||||
|
|
||||||
struct mlx5_ifc_alloc_pd_in_bits {
|
struct mlx5_ifc_alloc_pd_in_bits {
|
||||||
u8 opcode[0x10];
|
u8 opcode[0x10];
|
||||||
u8 reserved_at_10[0x10];
|
u8 uid[0x10];
|
||||||
|
|
||||||
u8 reserved_at_20[0x10];
|
u8 reserved_at_20[0x10];
|
||||||
u8 op_mod[0x10];
|
u8 op_mod[0x10];
|
||||||
|
|
|
@ -471,6 +471,7 @@ struct mlx5_core_qp {
|
||||||
int qpn;
|
int qpn;
|
||||||
struct mlx5_rsc_debug *dbg;
|
struct mlx5_rsc_debug *dbg;
|
||||||
int pid;
|
int pid;
|
||||||
|
u16 uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_core_dct {
|
struct mlx5_core_dct {
|
||||||
|
|
|
@ -61,6 +61,7 @@ struct mlx5_srq_attr {
|
||||||
u32 tm_next_tag;
|
u32 tm_next_tag;
|
||||||
u32 tm_hw_phase_cnt;
|
u32 tm_hw_phase_cnt;
|
||||||
u32 tm_sw_phase_cnt;
|
u32 tm_sw_phase_cnt;
|
||||||
|
u16 uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_core_dev;
|
struct mlx5_core_dev;
|
||||||
|
|
Loading…
Reference in New Issue