Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mlx4/mlx4_core/mlx4_main.c
Show First 20 Lines • Show All 1,158 Lines • ▼ Show 20 Lines | |||||
out: | out: | ||||
mutex_unlock(&priv->port_mutex); | mutex_unlock(&priv->port_mutex); | ||||
mlx4_start_sense(mdev); | mlx4_start_sense(mdev); | ||||
err_sup: | err_sup: | ||||
return err; | return err; | ||||
} | } | ||||
static DEFINE_MUTEX(mlx4_set_port_type_mutex); | |||||
static ssize_t set_port_type(struct device *dev, | static ssize_t set_port_type(struct device *dev, | ||||
struct device_attribute *attr, | struct device_attribute *attr, | ||||
const char *buf, size_t count) | const char *buf, size_t count) | ||||
{ | { | ||||
struct mlx4_port_info *info = container_of(attr, struct mlx4_port_info, | struct mlx4_port_info *info = container_of(attr, struct mlx4_port_info, | ||||
port_attr); | port_attr); | ||||
struct mlx4_dev *mdev = info->dev; | struct mlx4_dev *mdev = info->dev; | ||||
enum mlx4_port_type port_type; | enum mlx4_port_type port_type; | ||||
static DEFINE_MUTEX(set_port_type_mutex); | |||||
int err; | int err; | ||||
mutex_lock(&set_port_type_mutex); | mutex_lock(&mlx4_set_port_type_mutex); | ||||
if (!strcmp(buf, "ib\n")) { | if (!strcmp(buf, "ib\n")) { | ||||
port_type = MLX4_PORT_TYPE_IB; | port_type = MLX4_PORT_TYPE_IB; | ||||
} else if (!strcmp(buf, "eth\n")) { | } else if (!strcmp(buf, "eth\n")) { | ||||
port_type = MLX4_PORT_TYPE_ETH; | port_type = MLX4_PORT_TYPE_ETH; | ||||
} else if (!strcmp(buf, "auto\n")) { | } else if (!strcmp(buf, "auto\n")) { | ||||
port_type = MLX4_PORT_TYPE_AUTO; | port_type = MLX4_PORT_TYPE_AUTO; | ||||
} else { | } else { | ||||
mlx4_err(mdev, "%s is not supported port type\n", buf); | mlx4_err(mdev, "%s is not supported port type\n", buf); | ||||
err = -EINVAL; | err = -EINVAL; | ||||
goto err_out; | goto err_out; | ||||
} | } | ||||
err = __set_port_type(info, port_type); | err = __set_port_type(info, port_type); | ||||
err_out: | err_out: | ||||
mutex_unlock(&set_port_type_mutex); | mutex_unlock(&mlx4_set_port_type_mutex); | ||||
return err ? err : count; | return err ? err : count; | ||||
} | } | ||||
enum ibta_mtu { | enum ibta_mtu { | ||||
IB_MTU_256 = 1, | IB_MTU_256 = 1, | ||||
IB_MTU_512 = 2, | IB_MTU_512 = 2, | ||||
IB_MTU_1024 = 3, | IB_MTU_1024 = 3, | ||||
▲ Show 20 Lines • Show All 3,040 Lines • Show Last 20 Lines |