aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4/en_port.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/mlx4/en_port.c')
-rw-r--r--drivers/net/mlx4/en_port.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/drivers/net/mlx4/en_port.c b/drivers/net/mlx4/en_port.c
index a29abe845d2e..f2a4f5dd313d 100644
--- a/drivers/net/mlx4/en_port.c
+++ b/drivers/net/mlx4/en_port.c
@@ -119,6 +119,10 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
119 struct mlx4_set_port_rqp_calc_context *context; 119 struct mlx4_set_port_rqp_calc_context *context;
120 int err; 120 int err;
121 u32 in_mod; 121 u32 in_mod;
122 u32 m_promisc = (dev->caps.vep_mc_steering) ? MCAST_DIRECT : MCAST_DEFAULT;
123
124 if (dev->caps.vep_mc_steering && dev->caps.vep_uc_steering)
125 return 0;
122 126
123 mailbox = mlx4_alloc_cmd_mailbox(dev); 127 mailbox = mlx4_alloc_cmd_mailbox(dev);
124 if (IS_ERR(mailbox)) 128 if (IS_ERR(mailbox))
@@ -127,8 +131,11 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
127 memset(context, 0, sizeof *context); 131 memset(context, 0, sizeof *context);
128 132
129 context->base_qpn = cpu_to_be32(base_qpn); 133 context->base_qpn = cpu_to_be32(base_qpn);
130 context->promisc = cpu_to_be32(promisc << SET_PORT_PROMISC_SHIFT | base_qpn); 134 context->n_mac = 0x7;
131 context->mcast = cpu_to_be32(1 << SET_PORT_PROMISC_SHIFT | base_qpn); 135 context->promisc = cpu_to_be32(promisc << SET_PORT_PROMISC_SHIFT |
136 base_qpn);
137 context->mcast = cpu_to_be32(m_promisc << SET_PORT_MC_PROMISC_SHIFT |
138 base_qpn);
132 context->intra_no_vlan = 0; 139 context->intra_no_vlan = 0;
133 context->no_vlan = MLX4_NO_VLAN_IDX; 140 context->no_vlan = MLX4_NO_VLAN_IDX;
134 context->intra_vlan_miss = 0; 141 context->intra_vlan_miss = 0;
@@ -142,6 +149,38 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
142 return err; 149 return err;
143} 150}
144 151
152int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port)
153{
154 struct mlx4_en_query_port_context *qport_context;
155 struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]);
156 struct mlx4_en_port_state *state = &priv->port_state;
157 struct mlx4_cmd_mailbox *mailbox;
158 int err;
159
160 mailbox = mlx4_alloc_cmd_mailbox(mdev->dev);
161 if (IS_ERR(mailbox))
162 return PTR_ERR(mailbox);
163 memset(mailbox->buf, 0, sizeof(*qport_context));
164 err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, port, 0,
165 MLX4_CMD_QUERY_PORT, MLX4_CMD_TIME_CLASS_B);
166 if (err)
167 goto out;
168 qport_context = mailbox->buf;
169
170 /* This command is always accessed from Ethtool context
171 * already synchronized, no need in locking */
172 state->link_state = !!(qport_context->link_up & MLX4_EN_LINK_UP_MASK);
173 if ((qport_context->link_speed & MLX4_EN_SPEED_MASK) ==
174 MLX4_EN_1G_SPEED)
175 state->link_speed = 1000;
176 else
177 state->link_speed = 10000;
178 state->transciver = qport_context->transceiver;
179
180out:
181 mlx4_free_cmd_mailbox(mdev->dev, mailbox);
182 return err;
183}
145 184
146int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) 185int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
147{ 186{
@@ -174,7 +213,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
174 } 213 }
175 stats->tx_packets = 0; 214 stats->tx_packets = 0;
176 stats->tx_bytes = 0; 215 stats->tx_bytes = 0;
177 for (i = 0; i <= priv->tx_ring_num; i++) { 216 for (i = 0; i < priv->tx_ring_num; i++) {
178 stats->tx_packets += priv->tx_ring[i].packets; 217 stats->tx_packets += priv->tx_ring[i].packets;
179 stats->tx_bytes += priv->tx_ring[i].bytes; 218 stats->tx_bytes += priv->tx_ring[i].bytes;
180 } 219 }