diff options
| -rw-r--r-- | drivers/net/mlx4/Makefile | 2 | ||||
| -rw-r--r-- | drivers/net/mlx4/en_ethtool.c | 79 | ||||
| -rw-r--r-- | drivers/net/mlx4/en_netdev.c | 2 | ||||
| -rw-r--r-- | drivers/net/mlx4/en_port.c | 32 | ||||
| -rw-r--r-- | drivers/net/mlx4/en_port.h | 14 | ||||
| -rw-r--r-- | drivers/net/mlx4/en_rx.c | 20 | ||||
| -rw-r--r-- | drivers/net/mlx4/en_selftest.c | 179 | ||||
| -rw-r--r-- | drivers/net/mlx4/en_tx.c | 16 | ||||
| -rw-r--r-- | drivers/net/mlx4/eq.c | 44 | ||||
| -rw-r--r-- | drivers/net/mlx4/fw.c | 3 | ||||
| -rw-r--r-- | drivers/net/mlx4/fw.h | 1 | ||||
| -rw-r--r-- | drivers/net/mlx4/main.c | 1 | ||||
| -rw-r--r-- | drivers/net/mlx4/mlx4_en.h | 19 | ||||
| -rw-r--r-- | include/linux/mlx4/cmd.h | 1 | ||||
| -rw-r--r-- | include/linux/mlx4/device.h | 2 |
15 files changed, 388 insertions, 27 deletions
diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile index 1fd068e1d930..d1aa45a15854 100644 --- a/drivers/net/mlx4/Makefile +++ b/drivers/net/mlx4/Makefile | |||
| @@ -6,4 +6,4 @@ mlx4_core-y := alloc.o catas.o cmd.o cq.o eq.o fw.o icm.o intf.o main.o mcg.o \ | |||
| 6 | obj-$(CONFIG_MLX4_EN) += mlx4_en.o | 6 | obj-$(CONFIG_MLX4_EN) += mlx4_en.o |
| 7 | 7 | ||
| 8 | mlx4_en-y := en_main.o en_tx.o en_rx.o en_ethtool.o en_port.o en_cq.o \ | 8 | mlx4_en-y := en_main.o en_tx.o en_rx.o en_ethtool.o en_port.o en_cq.o \ |
| 9 | en_resources.o en_netdev.o | 9 | en_resources.o en_netdev.o en_selftest.o |
diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c index 398d54136967..f7d72d7a8704 100644 --- a/drivers/net/mlx4/en_ethtool.c +++ b/drivers/net/mlx4/en_ethtool.c | |||
| @@ -125,6 +125,14 @@ static const char main_strings[][ETH_GSTRING_LEN] = { | |||
| 125 | #define NUM_MAIN_STATS 21 | 125 | #define NUM_MAIN_STATS 21 |
| 126 | #define NUM_ALL_STATS (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + NUM_PERF_STATS) | 126 | #define NUM_ALL_STATS (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + NUM_PERF_STATS) |
| 127 | 127 | ||
| 128 | static const char mlx4_en_test_names[][ETH_GSTRING_LEN]= { | ||
| 129 | "Interupt Test", | ||
| 130 | "Link Test", | ||
| 131 | "Speed Test", | ||
| 132 | "Register Test", | ||
| 133 | "Loopback Test", | ||
| 134 | }; | ||
| 135 | |||
| 128 | static u32 mlx4_en_get_msglevel(struct net_device *dev) | 136 | static u32 mlx4_en_get_msglevel(struct net_device *dev) |
| 129 | { | 137 | { |
| 130 | return ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable; | 138 | return ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable; |
| @@ -146,10 +154,15 @@ static int mlx4_en_get_sset_count(struct net_device *dev, int sset) | |||
| 146 | { | 154 | { |
| 147 | struct mlx4_en_priv *priv = netdev_priv(dev); | 155 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 148 | 156 | ||
| 149 | if (sset != ETH_SS_STATS) | 157 | switch (sset) { |
| 158 | case ETH_SS_STATS: | ||
| 159 | return NUM_ALL_STATS + | ||
| 160 | (priv->tx_ring_num + priv->rx_ring_num) * 2; | ||
| 161 | case ETH_SS_TEST: | ||
| 162 | return MLX4_EN_NUM_SELF_TEST - !(priv->mdev->dev->caps.loopback_support) * 2; | ||
| 163 | default: | ||
| 150 | return -EOPNOTSUPP; | 164 | return -EOPNOTSUPP; |
| 151 | 165 | } | |
| 152 | return NUM_ALL_STATS + (priv->tx_ring_num + priv->rx_ring_num) * 2; | ||
| 153 | } | 166 | } |
| 154 | 167 | ||
| 155 | static void mlx4_en_get_ethtool_stats(struct net_device *dev, | 168 | static void mlx4_en_get_ethtool_stats(struct net_device *dev, |
| @@ -181,6 +194,12 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev, | |||
| 181 | 194 | ||
| 182 | } | 195 | } |
| 183 | 196 | ||
| 197 | static void mlx4_en_self_test(struct net_device *dev, | ||
| 198 | struct ethtool_test *etest, u64 *buf) | ||
| 199 | { | ||
| 200 | mlx4_en_ex_selftest(dev, &etest->flags, buf); | ||
| 201 | } | ||
| 202 | |||
| 184 | static void mlx4_en_get_strings(struct net_device *dev, | 203 | static void mlx4_en_get_strings(struct net_device *dev, |
| 185 | uint32_t stringset, uint8_t *data) | 204 | uint32_t stringset, uint8_t *data) |
| 186 | { | 205 | { |
| @@ -188,30 +207,39 @@ static void mlx4_en_get_strings(struct net_device *dev, | |||
| 188 | int index = 0; | 207 | int index = 0; |
| 189 | int i; | 208 | int i; |
| 190 | 209 | ||
| 191 | if (stringset != ETH_SS_STATS) | 210 | switch (stringset) { |
| 192 | return; | 211 | case ETH_SS_TEST: |
| 193 | 212 | for (i = 0; i < MLX4_EN_NUM_SELF_TEST - 2; i++) | |
| 194 | /* Add main counters */ | 213 | strcpy(data + i * ETH_GSTRING_LEN, mlx4_en_test_names[i]); |
| 195 | for (i = 0; i < NUM_MAIN_STATS; i++) | 214 | if (priv->mdev->dev->caps.loopback_support) |
| 196 | strcpy(data + (index++) * ETH_GSTRING_LEN, main_strings[i]); | 215 | for (; i < MLX4_EN_NUM_SELF_TEST; i++) |
| 197 | for (i = 0; i < NUM_PORT_STATS; i++) | 216 | strcpy(data + i * ETH_GSTRING_LEN, mlx4_en_test_names[i]); |
| 198 | strcpy(data + (index++) * ETH_GSTRING_LEN, | 217 | break; |
| 218 | |||
| 219 | case ETH_SS_STATS: | ||
| 220 | /* Add main counters */ | ||
| 221 | for (i = 0; i < NUM_MAIN_STATS; i++) | ||
| 222 | strcpy(data + (index++) * ETH_GSTRING_LEN, main_strings[i]); | ||
| 223 | for (i = 0; i< NUM_PORT_STATS; i++) | ||
| 224 | strcpy(data + (index++) * ETH_GSTRING_LEN, | ||
| 199 | main_strings[i + NUM_MAIN_STATS]); | 225 | main_strings[i + NUM_MAIN_STATS]); |
| 200 | for (i = 0; i < priv->tx_ring_num; i++) { | 226 | for (i = 0; i < priv->tx_ring_num; i++) { |
| 201 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 227 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
| 202 | "tx%d_packets", i); | 228 | "tx%d_packets", i); |
| 203 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 229 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
| 204 | "tx%d_bytes", i); | 230 | "tx%d_bytes", i); |
| 205 | } | 231 | } |
| 206 | for (i = 0; i < priv->rx_ring_num; i++) { | 232 | for (i = 0; i < priv->rx_ring_num; i++) { |
| 207 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 233 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
| 208 | "rx%d_packets", i); | 234 | "rx%d_packets", i); |
| 209 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 235 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
| 210 | "rx%d_bytes", i); | 236 | "rx%d_bytes", i); |
| 211 | } | 237 | } |
| 212 | for (i = 0; i < NUM_PKT_STATS; i++) | 238 | for (i = 0; i< NUM_PKT_STATS; i++) |
| 213 | strcpy(data + (index++) * ETH_GSTRING_LEN, | 239 | strcpy(data + (index++) * ETH_GSTRING_LEN, |
| 214 | main_strings[i + NUM_MAIN_STATS + NUM_PORT_STATS]); | 240 | main_strings[i + NUM_MAIN_STATS + NUM_PORT_STATS]); |
| 241 | break; | ||
| 242 | } | ||
| 215 | } | 243 | } |
| 216 | 244 | ||
| 217 | static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 245 | static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
| @@ -439,6 +467,7 @@ const struct ethtool_ops mlx4_en_ethtool_ops = { | |||
| 439 | .get_strings = mlx4_en_get_strings, | 467 | .get_strings = mlx4_en_get_strings, |
| 440 | .get_sset_count = mlx4_en_get_sset_count, | 468 | .get_sset_count = mlx4_en_get_sset_count, |
| 441 | .get_ethtool_stats = mlx4_en_get_ethtool_stats, | 469 | .get_ethtool_stats = mlx4_en_get_ethtool_stats, |
| 470 | .self_test = mlx4_en_self_test, | ||
| 442 | .get_wol = mlx4_en_get_wol, | 471 | .get_wol = mlx4_en_get_wol, |
| 443 | .get_msglevel = mlx4_en_get_msglevel, | 472 | .get_msglevel = mlx4_en_get_msglevel, |
| 444 | .set_msglevel = mlx4_en_set_msglevel, | 473 | .set_msglevel = mlx4_en_set_msglevel, |
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c index 34cfa3cfbdae..968e75b7acf4 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c | |||
| @@ -109,7 +109,7 @@ static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
| 109 | mutex_unlock(&mdev->state_lock); | 109 | mutex_unlock(&mdev->state_lock); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | static u64 mlx4_en_mac_to_u64(u8 *addr) | 112 | u64 mlx4_en_mac_to_u64(u8 *addr) |
| 113 | { | 113 | { |
| 114 | u64 mac = 0; | 114 | u64 mac = 0; |
| 115 | int i; | 115 | int i; |
diff --git a/drivers/net/mlx4/en_port.c b/drivers/net/mlx4/en_port.c index a29abe845d2e..aa3ef2aee5bf 100644 --- a/drivers/net/mlx4/en_port.c +++ b/drivers/net/mlx4/en_port.c | |||
| @@ -142,6 +142,38 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, | |||
| 142 | return err; | 142 | return err; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port) | ||
| 146 | { | ||
| 147 | struct mlx4_en_query_port_context *qport_context; | ||
| 148 | struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); | ||
| 149 | struct mlx4_en_port_state *state = &priv->port_state; | ||
| 150 | struct mlx4_cmd_mailbox *mailbox; | ||
| 151 | int err; | ||
| 152 | |||
| 153 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); | ||
| 154 | if (IS_ERR(mailbox)) | ||
| 155 | return PTR_ERR(mailbox); | ||
| 156 | memset(mailbox->buf, 0, sizeof(*qport_context)); | ||
| 157 | err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, port, 0, | ||
| 158 | MLX4_CMD_QUERY_PORT, MLX4_CMD_TIME_CLASS_B); | ||
| 159 | if (err) | ||
| 160 | goto out; | ||
| 161 | qport_context = mailbox->buf; | ||
| 162 | |||
| 163 | /* This command is always accessed from Ethtool context | ||
| 164 | * already synchronized, no need in locking */ | ||
