1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

Properly parse 40G media types from newer Mellanox adapters that are

40G capable.  For now, map all 40G links to 40GBase-CR4.

MFC after:	2 weeks
This commit is contained in:
John Baldwin 2012-04-10 14:01:09 +00:00
parent 19a3210a66
commit efbebba22a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=234099
3 changed files with 35 additions and 10 deletions

View File

@ -991,12 +991,20 @@ static int mlx4_en_calc_media(struct mlx4_en_priv *priv)
active |= IFM_FDX; active |= IFM_FDX;
trans_type = priv->port_state.transciver; trans_type = priv->port_state.transciver;
/* XXX I don't know all of the transceiver values. */ /* XXX I don't know all of the transceiver values. */
if (priv->port_state.link_speed == 1000) switch (priv->port_state.link_speed) {
case 1000:
active |= IFM_1000_T; active |= IFM_1000_T;
else if (trans_type > 0 && trans_type <= 0xC) break;
case 10000:
if (trans_type > 0 && trans_type <= 0xC)
active |= IFM_10G_SR; active |= IFM_10G_SR;
else if (trans_type == 0x80 || trans_type == 0) else if (trans_type == 0x80 || trans_type == 0)
active |= IFM_10G_CX4; active |= IFM_10G_CX4;
break;
case 40000:
active |= IFM_40G_CR4;
break;
}
if (priv->prof->tx_pause) if (priv->prof->tx_pause)
active |= IFM_ETH_TXPAUSE; active |= IFM_ETH_TXPAUSE;
if (priv->prof->rx_pause) if (priv->prof->rx_pause)

View File

@ -152,11 +152,21 @@ int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port)
/* This command is always accessed from Ethtool context /* This command is always accessed from Ethtool context
* already synchronized, no need in locking */ * already synchronized, no need in locking */
state->link_state = !!(qport_context->link_up & MLX4_EN_LINK_UP_MASK); state->link_state = !!(qport_context->link_up & MLX4_EN_LINK_UP_MASK);
if ((qport_context->link_speed & MLX4_EN_SPEED_MASK) == switch (qport_context->link_speed & MLX4_EN_SPEED_MASK) {
MLX4_EN_1G_SPEED) case MLX4_EN_1G_SPEED:
state->link_speed = 1000; state->link_speed = 1000;
else break;
case MLX4_EN_10G_SPEED_XAUI:
case MLX4_EN_10G_SPEED_XFI:
state->link_speed = 10000; state->link_speed = 10000;
break;
case MLX4_EN_40G_SPEED:
state->link_speed = 40000;
break;
default:
state->link_speed = -1;
break;
}
state->transciver = qport_context->transceiver; state->transciver = qport_context->transceiver;
if (be32_to_cpu(qport_context->transceiver_code_hi) & 0x400) if (be32_to_cpu(qport_context->transceiver_code_hi) & 0x400)
state->transciver = 0x80; state->transciver = 0x80;

View File

@ -85,6 +85,14 @@ enum {
MLX4_MCAST_ENABLE = 2, MLX4_MCAST_ENABLE = 2,
}; };
enum {
MLX4_EN_1G_SPEED = 0x02,
MLX4_EN_10G_SPEED_XFI = 0x01,
MLX4_EN_10G_SPEED_XAUI = 0x00,
MLX4_EN_40G_SPEED = 0x40,
MLX4_EN_OTHER_SPEED = 0x0f,
};
struct mlx4_en_query_port_context { struct mlx4_en_query_port_context {
u8 link_up; u8 link_up;
#define MLX4_EN_LINK_UP_MASK 0x80 #define MLX4_EN_LINK_UP_MASK 0x80
@ -92,8 +100,7 @@ struct mlx4_en_query_port_context {
__be16 mtu; __be16 mtu;
u8 reserved2; u8 reserved2;
u8 link_speed; u8 link_speed;
#define MLX4_EN_SPEED_MASK 0x3 #define MLX4_EN_SPEED_MASK 0x43
#define MLX4_EN_1G_SPEED 0x2
u16 reserved3[5]; u16 reserved3[5];
__be64 mac; __be64 mac;
u8 transceiver; u8 transceiver;