mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-28 07:04:00 +08:00
IB/core: Add don't trap flag to flow creation
Don't trap flag (i.e. IB_FLOW_ATTR_FLAGS_DONT_TRAP) indicates that QP will receive traffic, but will not steal it. When a packet matches a flow steering rule that was created with the don't trap flag, the QPs assigned to this rule will get this packet, but matching will continue to other equal/lower priority rules. This will let other QPs assigned to those rules to get the packet too. If both don't trap rule and other rules have the same priority and match the same packet, the behavior is undefined. The don't trap flag can't be set with default rule types (i.e. IB_FLOW_ATTR_ALL_DEFAULT, IB_FLOW_ATTR_MC_DEFAULT) as default rules don't have rules after them and don't trap has no meaning here. Signed-off-by: Marina Varshaver <marinav@mellanox.com> Reviewed-by: Matan Barak <matanb@mellanox.com> Reviewed-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
571e09eeff
commit
a3100a7879
@ -3085,6 +3085,14 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
|
||||
!capable(CAP_NET_ADMIN)) || !capable(CAP_NET_RAW))
|
||||
return -EPERM;
|
||||
|
||||
if (cmd.flow_attr.flags >= IB_FLOW_ATTR_FLAGS_RESERVED)
|
||||
return -EINVAL;
|
||||
|
||||
if ((cmd.flow_attr.flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) &&
|
||||
((cmd.flow_attr.type == IB_FLOW_ATTR_ALL_DEFAULT) ||
|
||||
(cmd.flow_attr.type == IB_FLOW_ATTR_MC_DEFAULT)))
|
||||
return -EINVAL;
|
||||
|
||||
if (cmd.flow_attr.num_of_specs > IB_FLOW_SPEC_SUPPORT_LAYERS)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -1653,6 +1653,9 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
||||
struct mlx4_dev *dev = (to_mdev(qp->device))->dev;
|
||||
int is_bonded = mlx4_is_bonded(dev);
|
||||
|
||||
if (flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP)
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
|
||||
memset(type, 0, sizeof(type));
|
||||
|
||||
mflow = kzalloc(sizeof(*mflow), GFP_KERNEL);
|
||||
|
@ -1487,6 +1487,11 @@ enum ib_flow_domain {
|
||||
IB_FLOW_DOMAIN_NUM /* Must be last */
|
||||
};
|
||||
|
||||
enum ib_flow_flags {
|
||||
IB_FLOW_ATTR_FLAGS_DONT_TRAP = 1UL << 1, /* Continue match, no steal */
|
||||
IB_FLOW_ATTR_FLAGS_RESERVED = 1UL << 2 /* Must be last */
|
||||
};
|
||||
|
||||
struct ib_flow_eth_filter {
|
||||
u8 dst_mac[6];
|
||||
u8 src_mac[6];
|
||||
|
Loading…
Reference in New Issue
Block a user