Beispiel #1
0
void mlx4_do_sense_ports(struct mlx4_dev *dev,
			 enum mlx4_port_type *stype,
			 enum mlx4_port_type *defaults)
{
	struct mlx4_sense *sense = &mlx4_priv(dev)->sense;
	int err;
	int i;

	for (i = 1; i <= dev->caps.num_ports; i++) {
		stype[i - 1] = 0;
		if (sense->do_sense_port[i] && sense->sense_allowed[i] &&
		    dev->caps.possible_type[i] == MLX4_PORT_TYPE_AUTO) {
			err = mlx4_SENSE_PORT(dev, i, &stype[i - 1]);
			if (err)
				stype[i - 1] = defaults[i - 1];
		} else
			stype[i - 1] = defaults[i - 1];
	}

	/*
	 * If sensed nothing, remain in current configuration.
	 */
	for (i = 0; i < dev->caps.num_ports; i++)
		stype[i] = stype[i] ? stype[i] : defaults[i];

}
Beispiel #2
0
void mlx4_do_sense_ports(struct mlx4_dev *dev,
			 enum mlx4_port_type *stype,
			 enum mlx4_port_type *defaults)
{
	struct mlx4_sense *sense = &mlx4_priv(dev)->sense;
	int err;
	int i;

	for (i = 1; i <= dev->caps.num_ports; i++) {
		stype[i - 1] = 0;
		if (sense->do_sense_port[i] && sense->sense_allowed[i] &&
		    dev->caps.possible_type[i] == MLX4_PORT_TYPE_AUTO) {
			err = mlx4_SENSE_PORT(dev, i, &stype[i - 1]);
			if (err)
				stype[i - 1] = defaults[i - 1];
		} else
			stype[i - 1] = defaults[i - 1];
	}

	
	if (stype[0] == MLX4_PORT_TYPE_ETH) {
		for (i = 1; i < dev->caps.num_ports; i++)
			stype[i] = stype[i] ? stype[i] : MLX4_PORT_TYPE_ETH;
	}
	if (stype[dev->caps.num_ports - 1] == MLX4_PORT_TYPE_IB) {
		for (i = 0; i < dev->caps.num_ports - 1; i++)
			stype[i] = stype[i] ? stype[i] : MLX4_PORT_TYPE_IB;
	}

	
	for (i = 0; i < dev->caps.num_ports; i++)
		stype[i] = stype[i] ? stype[i] : defaults[i];

}
Beispiel #3
0
void mlx4_do_sense_ports(struct mlx4_dev *dev,
			 enum mlx4_port_type *stype,
			 enum mlx4_port_type *defaults)
{
	struct mlx4_sense *sense = &mlx4_priv(dev)->sense;
	int err;
	int i;

	for (i = 1; i <= dev->caps.num_ports; i++) {
		stype[i - 1] = 0;
		if (sense->do_sense_port[i] && sense->sense_allowed[i] &&
		    dev->caps.possible_type[i] == MLX4_PORT_TYPE_AUTO) {
			err = mlx4_SENSE_PORT(dev, i, &stype[i - 1]);
			if (err)
				stype[i - 1] = defaults[i - 1];
		} else
			stype[i - 1] = defaults[i - 1];
	}

	/*
	 * Adjust port configuration:
	 * If port 1 sensed nothing and port 2 is IB, set both as IB
	 * If port 2 sensed nothing and port 1 is Eth, set both as Eth
	 */
	if (stype[0] == MLX4_PORT_TYPE_ETH) {
		for (i = 1; i < dev->caps.num_ports; i++)
			stype[i] = stype[i] ? stype[i] : MLX4_PORT_TYPE_ETH;
	}
	if (stype[dev->caps.num_ports - 1] == MLX4_PORT_TYPE_IB) {
		for (i = 0; i < dev->caps.num_ports - 1; i++)
			stype[i] = stype[i] ? stype[i] : MLX4_PORT_TYPE_IB;
	}

	/*
	 * If sensed nothing, remain in current configuration.
	 */
	for (i = 0; i < dev->caps.num_ports; i++)
		stype[i] = stype[i] ? stype[i] : defaults[i];

}