net/mlx5: Make RoCE and SR-IOV LAG modes explicit
With the introduction of SR-IOV LAG, checking whether LAG is active is no longer good enough, since RoCE and SR-IOV LAG each entails different behavior by both the core and infiniband drivers. This patch introduces facilities to discern LAG type, in addition to mlx5_lag_is_active(). These are implemented in such a way as to allow more complex mode combinations in the future. Signed-off-by: Aviv Heller <avivh@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:

committed by
Saeed Mahameed

parent
292612d68c
commit
7c34ec19e1
@@ -445,7 +445,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
|
||||
if (!ndev)
|
||||
goto out;
|
||||
|
||||
if (mlx5_lag_is_active(dev->mdev)) {
|
||||
if (dev->lag_active) {
|
||||
rcu_read_lock();
|
||||
upper = netdev_master_upper_dev_get_rcu(ndev);
|
||||
if (upper) {
|
||||
@@ -1848,7 +1848,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,
|
||||
context->lib_caps = req.lib_caps;
|
||||
print_lib_caps(dev, context->lib_caps);
|
||||
|
||||
if (mlx5_lag_is_active(dev->mdev)) {
|
||||
if (dev->lag_active) {
|
||||
u8 port = mlx5_core_native_port_num(dev->mdev);
|
||||
|
||||
atomic_set(&context->tx_port_affinity,
|
||||
@@ -4841,7 +4841,7 @@ static int mlx5_eth_lag_init(struct mlx5_ib_dev *dev)
|
||||
struct mlx5_flow_table *ft;
|
||||
int err;
|
||||
|
||||
if (!ns || !mlx5_lag_is_active(mdev))
|
||||
if (!ns || !mlx5_lag_is_roce(mdev))
|
||||
return 0;
|
||||
|
||||
err = mlx5_cmd_create_vport_lag(mdev);
|
||||
@@ -4855,6 +4855,7 @@ static int mlx5_eth_lag_init(struct mlx5_ib_dev *dev)
|
||||
}
|
||||
|
||||
dev->flow_db->lag_demux_ft = ft;
|
||||
dev->lag_active = true;
|
||||
return 0;
|
||||
|
||||
err_destroy_vport_lag:
|
||||
@@ -4866,7 +4867,9 @@ static void mlx5_eth_lag_cleanup(struct mlx5_ib_dev *dev)
|
||||
{
|
||||
struct mlx5_core_dev *mdev = dev->mdev;
|
||||
|
||||
if (dev->flow_db->lag_demux_ft) {
|
||||
if (dev->lag_active) {
|
||||
dev->lag_active = false;
|
||||
|
||||
mlx5_destroy_flow_table(dev->flow_db->lag_demux_ft);
|
||||
dev->flow_db->lag_demux_ft = NULL;
|
||||
|
||||
@@ -6173,7 +6176,7 @@ int mlx5_ib_stage_ib_reg_init(struct mlx5_ib_dev *dev)
|
||||
const char *name;
|
||||
|
||||
rdma_set_device_sysfs_group(&dev->ib_dev, &mlx5_attr_group);
|
||||
if (!mlx5_lag_is_active(dev->mdev))
|
||||
if (!mlx5_lag_is_roce(dev->mdev))
|
||||
name = "mlx5_%d";
|
||||
else
|
||||
name = "mlx5_bond_%d";
|
||||
|
@@ -936,6 +936,7 @@ struct mlx5_ib_dev {
|
||||
struct mlx5_ib_delay_drop delay_drop;
|
||||
const struct mlx5_ib_profile *profile;
|
||||
struct mlx5_eswitch_rep *rep;
|
||||
int lag_active;
|
||||
|
||||
struct mlx5_ib_lb_state lb;
|
||||
u8 umr_fence;
|
||||
|
@@ -3258,7 +3258,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
|
||||
(ibqp->qp_type == IB_QPT_RAW_PACKET) ||
|
||||
(ibqp->qp_type == IB_QPT_XRC_INI) ||
|
||||
(ibqp->qp_type == IB_QPT_XRC_TGT)) {
|
||||
if (mlx5_lag_is_active(dev->mdev)) {
|
||||
if (dev->lag_active) {
|
||||
u8 p = mlx5_core_native_port_num(dev->mdev);
|
||||
tx_affinity = get_tx_affinity(dev, pd, base, p);
|
||||
context->flags |= cpu_to_be32(tx_affinity << 24);
|
||||
|
Reference in New Issue
Block a user