diff options
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_port.c | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_port.h | 11 |
2 files changed, 22 insertions, 5 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_port.c b/drivers/net/ethernet/mellanox/mlx4/en_port.c index 8824309bb625..9d275558094a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_port.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_port.c | |||
@@ -167,11 +167,21 @@ int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port) | |||
167 | /* This command is always accessed from Ethtool context | 167 | /* This command is always accessed from Ethtool context |
168 | * already synchronized, no need in locking */ | 168 | * already synchronized, no need in locking */ |
169 | state->link_state = !!(qport_context->link_up & MLX4_EN_LINK_UP_MASK); | 169 | state->link_state = !!(qport_context->link_up & MLX4_EN_LINK_UP_MASK); |
170 | if ((qport_context->link_speed & MLX4_EN_SPEED_MASK) == | 170 | switch (qport_context->link_speed & MLX4_EN_SPEED_MASK) { |
171 | MLX4_EN_1G_SPEED) | 171 | case MLX4_EN_1G_SPEED: |
172 | state->link_speed = 1000; | 172 | state->link_speed = 1000; |
173 | else | 173 | break; |
174 | case MLX4_EN_10G_SPEED_XAUI: | ||
175 | case MLX4_EN_10G_SPEED_XFI: | ||
174 | state->link_speed = 10000; | 176 | state->link_speed = 10000; |
177 | break; | ||
178 | case MLX4_EN_40G_SPEED: | ||
179 | state->link_speed = 40000; | ||
180 | break; | ||
181 | default: | ||
182 | state->link_speed = -1; | ||
183 | break; | ||
184 | } | ||
175 | state->transciver = qport_context->transceiver; | 185 | state->transciver = qport_context->transceiver; |
176 | 186 | ||
177 | out: | 187 | out: |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_port.h b/drivers/net/ethernet/mellanox/mlx4/en_port.h index e3d73e41c567..19eb244f5165 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_port.h +++ b/drivers/net/ethernet/mellanox/mlx4/en_port.h | |||
@@ -94,6 +94,14 @@ enum { | |||
94 | MLX4_MCAST_ENABLE = 2, | 94 | MLX4_MCAST_ENABLE = 2, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | enum { | ||
98 | MLX4_EN_1G_SPEED = 0x02, | ||
99 | MLX4_EN_10G_SPEED_XFI = 0x01, | ||
100 | MLX4_EN_10G_SPEED_XAUI = 0x00, | ||
101 | MLX4_EN_40G_SPEED = 0x40, | ||
102 | MLX4_EN_OTHER_SPEED = 0x0f, | ||
103 | }; | ||
104 | |||
97 | struct mlx4_en_query_port_context { | 105 | struct mlx4_en_query_port_context { |
98 | u8 link_up; | 106 | u8 link_up; |
99 | #define MLX4_EN_LINK_UP_MASK 0x80 | 107 | #define MLX4_EN_LINK_UP_MASK 0x80 |
@@ -101,8 +109,7 @@ struct mlx4_en_query_port_context { | |||
101 | __be16 mtu; | 109 | __be16 mtu; |
102 | u8 reserved2; | 110 | u8 reserved2; |
103 | u8 link_speed; | 111 | u8 link_speed; |
104 | #define MLX4_EN_SPEED_MASK 0x3 | 112 | #define MLX4_EN_SPEED_MASK 0x43 |
105 | #define MLX4_EN_1G_SPEED 0x2 | ||
106 | u16 reserved3[5]; | 113 | u16 reserved3[5]; |
107 | __be64 mac; | 114 | __be64 mac; |
108 | u8 transceiver; | 115 | u8 transceiver; |