| @@ -3719,34 +3719,54 @@ free_ucmd: · 3718 unmodified lines |
| 3719 | 3719 | return ERR_PTR(err); |
| 3720 | 3720 | } |
| 3721 | 3721 | |
| 3722 | | −static struct mlx5_ib_flow_prio *_get_flow_table(struct mlx5_ib_dev *dev, |
| 3723 | | − int priority, bool mcast) |
| 3722 | +static struct mlx5_ib_flow_prio * |
| 3723 | +_get_flow_table(struct mlx5_ib_dev *dev, |
| 3724 | + struct mlx5_ib_flow_matcher *fs_matcher, |
| 3725 | + bool mcast) |
| 3724 | 3726 | { |
| 3725 | | − int max_table_size; |
| 3726 | 3727 | struct mlx5_flow_namespace *ns = NULL; |
| 3727 | 3728 | struct mlx5_ib_flow_prio *prio; |
| 3729 | + int max_table_size; |
| 3730 | + u32 flags = 0; |
| 3731 | + int priority; |
| 3732 | + |
| 3733 | + if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_BYPASS) { |
| 3734 | + max_table_size = BIT(MLX5_CAP_FLOWTABLE_NIC_RX(dev->mdev, |
| 3735 | + log_max_ft_size)); |
| 3736 | + if (MLX5_CAP_FLOWTABLE_NIC_RX(dev->mdev, decap)) |
| 3737 | + flags |= MLX5_FLOW_TABLE_TUNNEL_EN_DECAP; |
| 3738 | + if (MLX5_CAP_FLOWTABLE_NIC_RX(dev->mdev, |
| 3739 | + reformat_l3_tunnel_to_l2)) |
| 3740 | + flags |= MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT; |
| 3741 | + } else { /* Can only be MLX5_FLOW_NAMESPACE_EGRESS */ |
| 3742 | + max_table_size = BIT(MLX5_CAP_FLOWTABLE_NIC_TX(dev->mdev, |
| 3743 | + log_max_ft_size)); |
| 3744 | + if (MLX5_CAP_FLOWTABLE_NIC_TX(dev->mdev, reformat)) |
| 3745 | + flags |= MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT; |
| 3746 | + } |
| 3728 | 3747 | |
| 3729 | | − max_table_size = BIT(MLX5_CAP_FLOWTABLE_NIC_RX(dev->mdev, |
| 3730 | | − log_max_ft_size)); |
| 3731 | 3748 | if (max_table_size < MLX5_FS_MAX_ENTRIES) |
| 3732 | 3749 | return ERR_PTR(-ENOMEM); |
| 3733 | 3750 | |
| 3734 | 3751 | if (mcast) |
| 3735 | 3752 | priority = MLX5_IB_FLOW_MCAST_PRIO; |
| 3736 | 3753 | else |
| 3737 | | − priority = ib_prio_to_core_prio(priority, false); |
| 3754 | + priority = ib_prio_to_core_prio(fs_matcher->priority, false); |
| 3738 | 3755 | |
| 3739 | | − ns = mlx5_get_flow_namespace(dev->mdev, MLX5_FLOW_NAMESPACE_BYPASS); |
| 3756 | + ns = mlx5_get_flow_namespace(dev->mdev, fs_matcher->ns_type); |
| 3740 | 3757 | if (!ns) |
| 3741 | 3758 | return ERR_PTR(-ENOTSUPP); |
| 3742 | 3759 | |
| 3743 | | − prio = &dev->flow_db->prios[priority]; |
| 3760 | + if (fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_BYPASS) |
| 3761 | + prio = &dev->flow_db->prios[priority]; |
| 3762 | + else |
| 3763 | + prio = &dev->flow_db->egress_prios[priority]; |
| 3744 | 3764 | |
| 3745 | 3765 | if (prio->flow_table) |
| 3746 | 3766 | return prio; |
| 3747 | 3767 | |
| 3748 | 3768 | return _get_prio(ns, prio, priority, MLX5_FS_MAX_ENTRIES, |
| 3749 | | − MLX5_FS_MAX_TYPES, 0); |
| 3769 | + MLX5_FS_MAX_TYPES, flags); |
| 3750 | 3770 | } |
| 3751 | 3771 | |
| 3752 | 3772 | static struct mlx5_ib_flow_handler * |
| @@ -3845,7 +3865,6 @@ mlx5_ib_raw_fs_rule_add(struct mlx5_ib_dev *dev, · 92 unmodified lines |
| 3845 | 3865 | { |
| 3846 | 3866 | struct mlx5_flow_destination *dst; |
| 3847 | 3867 | struct mlx5_ib_flow_prio *ft_prio; |
| 3848 | | − int priority = fs_matcher->priority; |
| 3849 | 3868 | struct mlx5_ib_flow_handler *handler; |
| 3850 | 3869 | bool mcast; |
| 3851 | 3870 | int err; |
| @@ -3863,7 +3882,7 @@ mlx5_ib_raw_fs_rule_add(struct mlx5_ib_dev *dev, · 11 unmodified lines |
| 3863 | 3882 | mcast = raw_fs_is_multicast(fs_matcher, cmd_in); |
| 3864 | 3883 | mutex_lock(&dev->flow_db->lock); |
| 3865 | 3884 | |
| 3866 | | − ft_prio = _get_flow_table(dev, priority, mcast); |
| 3885 | + ft_prio = _get_flow_table(dev, fs_matcher, mcast); |
| 3867 | 3886 | if (IS_ERR(ft_prio)) { |
| 3868 | 3887 | err = PTR_ERR(ft_prio); |
| 3869 | 3888 | goto unlock; |