diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-24 18:51:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-24 18:51:40 -0500 |
commit | 701b259f446be2f3625fb852bceb93afe76e206d (patch) | |
tree | 93f15bcd00bd59c38b4e59fed9af7ddf6b06c8b3 /drivers/net/ethernet/mellanox/mlx4 | |
parent | d2346963bfcbb9a8ee783ca3c3b3bdd7448ec9d5 (diff) | |
parent | efc3dbc37412c027e363736b4f4c74ee5e8ecffc (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Davem says:
1) Fix JIT code generation on x86-64 for divide by zero, from Eric Dumazet.
2) tg3 header length computation correction from Eric Dumazet.
3) More build and reference counting fixes for socket memory cgroup
code from Glauber Costa.
4) module.h snuck back into a core header after all the hard work we
did to remove that, from Paul Gortmaker and Jesper Dangaard Brouer.
5) Fix PHY naming regression and add some new PCI IDs in stmmac, from
Alessandro Rubini.
6) Netlink message generation fix in new team driver, should only advertise
the entries that changed during events, from Jiri Pirko.
7) SRIOV VF registration and unregistration fixes, and also add a
missing PCI ID, from Roopa Prabhu.
8) Fix infinite loop in tx queue flush code of brcmsmac, from Stanislaw Gruszka.
9) ftgmac100/ftmac100 build fix, missing interrupt.h include.
10) Memory leak fix in net/hyperv do_set_mutlicast() handling, from Wei Yongjun.
11) Off by one fix in netem packet scheduler, from Vijay Subramanian.
12) TCP loss detection fix from Yuchung Cheng.
13) TCP reset packet MD5 calculation uses wrong address, fix from Shawn Lu.
14) skge carrier assertion and DMA mapping fixes from Stephen Hemminger.
15) Congestion recovery undo performed at the wrong spot in BIC and CUBIC
congestion control modules, fix from Neal Cardwell.
16) Ethtool ETHTOOL_GSSET_INFO is unnecessarily restrictive, from Michał Mirosław.
17) Fix triggerable race in ipv6 sysctl handling, from Francesco Ruggeri.
18) Statistics bug fixes in mlx4 from Eugenia Emantayev.
19) rds locking bug fix during info dumps, from your's truly.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (67 commits)
rds: Make rds_sock_lock BH rather than IRQ safe.
netprio_cgroup.h: dont include module.h from other includes
net: flow_dissector.c missing include linux/export.h
team: send only changed options/ports via netlink
net/hyperv: fix possible memory leak in do_set_multicast()
drivers/net: dsa/mv88e6xxx.c files need linux/module.h
stmmac: added PCI identifiers
llc: Fix race condition in llc_ui_recvmsg
stmmac: fix phy naming inconsistency
dsa: Add reporting of silicon revision for Marvell 88E6123/88E6161/88E6165 switches.
tg3: fix ipv6 header length computation
skge: add byte queue limit support
mv643xx_eth: Add Rx Discard and Rx Overrun statistics
bnx2x: fix compilation error with SOE in fw_dump
bnx2x: handle CHIP_REVISION during init_one
bnx2x: allow user to change ring size in ISCSI SD mode
bnx2x: fix Big-Endianess in ethtool -t
bnx2x: fixed ethtool statistics for MF modes
bnx2x: credit-leakage fixup on vlan_mac_del_all
macvlan: fix a possible use after free
...
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4')
19 files changed, 234 insertions, 106 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 978f593094c0..405e6ac3faf6 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -1247,6 +1247,7 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd, | |||
1247 | u32 reply; | 1247 | u32 reply; |
1248 | u32 slave_status = 0; | 1248 | u32 slave_status = 0; |
1249 | u8 is_going_down = 0; | 1249 | u8 is_going_down = 0; |
1250 | int i; | ||
1250 | 1251 | ||
1251 | slave_state[slave].comm_toggle ^= 1; | 1252 | slave_state[slave].comm_toggle ^= 1; |
1252 | reply = (u32) slave_state[slave].comm_toggle << 31; | 1253 | reply = (u32) slave_state[slave].comm_toggle << 31; |
@@ -1258,6 +1259,10 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd, | |||
1258 | if (cmd == MLX4_COMM_CMD_RESET) { | 1259 | if (cmd == MLX4_COMM_CMD_RESET) { |
1259 | mlx4_warn(dev, "Received reset from slave:%d\n", slave); | 1260 | mlx4_warn(dev, "Received reset from slave:%d\n", slave); |
1260 | slave_state[slave].active = false; | 1261 | slave_state[slave].active = false; |
1262 | for (i = 0; i < MLX4_EVENT_TYPES_NUM; ++i) { | ||
1263 | slave_state[slave].event_eq[i].eqn = -1; | ||
1264 | slave_state[slave].event_eq[i].token = 0; | ||
1265 | } | ||
1261 | /*check if we are in the middle of FLR process, | 1266 | /*check if we are in the middle of FLR process, |
1262 | if so return "retry" status to the slave*/ | 1267 | if so return "retry" status to the slave*/ |
1263 | if (MLX4_COMM_CMD_FLR == slave_state[slave].last_cmd) { | 1268 | if (MLX4_COMM_CMD_FLR == slave_state[slave].last_cmd) { |
@@ -1452,7 +1457,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev) | |||
1452 | { | 1457 | { |
1453 | struct mlx4_priv *priv = mlx4_priv(dev); | 1458 | struct mlx4_priv *priv = mlx4_priv(dev); |
1454 | struct mlx4_slave_state *s_state; | 1459 | struct mlx4_slave_state *s_state; |
1455 | int i, err, port; | 1460 | int i, j, err, port; |
1456 | 1461 | ||
1457 | priv->mfunc.vhcr = dma_alloc_coherent(&(dev->pdev->dev), PAGE_SIZE, | 1462 | priv->mfunc.vhcr = dma_alloc_coherent(&(dev->pdev->dev), PAGE_SIZE, |
1458 | &priv->mfunc.vhcr_dma, | 1463 | &priv->mfunc.vhcr_dma, |
@@ -1485,6 +1490,8 @@ int mlx4_multi_func_init(struct mlx4_dev *dev) | |||
1485 | for (i = 0; i < dev->num_slaves; ++i) { | 1490 | for (i = 0; i < dev->num_slaves; ++i) { |
1486 | s_state = &priv->mfunc.master.slave_state[i]; | 1491 | s_state = &priv->mfunc.master.slave_state[i]; |
1487 | s_state->last_cmd = MLX4_COMM_CMD_RESET; | 1492 | s_state->last_cmd = MLX4_COMM_CMD_RESET; |
1493 | for (j = 0; j < MLX4_EVENT_TYPES_NUM; ++j) | ||
1494 | s_state->event_eq[j].eqn = -1; | ||
1488 | __raw_writel((__force u32) 0, | 1495 | __raw_writel((__force u32) 0, |
1489 | &priv->mfunc.comm[i].slave_write); | 1496 | &priv->mfunc.comm[i].slave_write); |
1490 | __raw_writel((__force u32) 0, | 1497 | __raw_writel((__force u32) 0, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c index 475f9d6af955..7e64033d7de3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/cq.c | |||
@@ -96,7 +96,7 @@ void mlx4_cq_event(struct mlx4_dev *dev, u32 cqn, int event_type) | |||
96 | static int mlx4_SW2HW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | 96 | static int mlx4_SW2HW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, |
97 | int cq_num) | 97 | int cq_num) |
98 | { | 98 | { |
99 | return mlx4_cmd(dev, mailbox->dma | dev->caps.function, cq_num, 0, | 99 | return mlx4_cmd(dev, mailbox->dma, cq_num, 0, |
100 | MLX4_CMD_SW2HW_CQ, MLX4_CMD_TIME_CLASS_A, | 100 | MLX4_CMD_SW2HW_CQ, MLX4_CMD_TIME_CLASS_A, |
101 | MLX4_CMD_WRAPPED); | 101 | MLX4_CMD_WRAPPED); |
102 | } | 102 | } |
@@ -111,7 +111,7 @@ static int mlx4_MODIFY_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox | |||
111 | static int mlx4_HW2SW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | 111 | static int mlx4_HW2SW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, |
112 | int cq_num) | 112 | int cq_num) |
113 | { | 113 | { |
114 | return mlx4_cmd_box(dev, dev->caps.function, mailbox ? mailbox->dma : 0, | 114 | return mlx4_cmd_box(dev, 0, mailbox ? mailbox->dma : 0, |
115 | cq_num, mailbox ? 0 : 1, MLX4_CMD_HW2SW_CQ, | 115 | cq_num, mailbox ? 0 : 1, MLX4_CMD_HW2SW_CQ, |
116 | MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED); | 116 | MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED); |
117 | } | 117 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 7dbc6a230779..70346fd7f9c4 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
@@ -183,10 +183,11 @@ static int mlx4_en_set_wol(struct net_device *netdev, | |||
183 | static int mlx4_en_get_sset_count(struct net_device *dev, int sset) | 183 | static int mlx4_en_get_sset_count(struct net_device *dev, int sset) |
184 | { | 184 | { |
185 | struct mlx4_en_priv *priv = netdev_priv(dev); | 185 | struct mlx4_en_priv *priv = netdev_priv(dev); |
186 | int bit_count = hweight64(priv->stats_bitmap); | ||
186 | 187 | ||
187 | switch (sset) { | 188 | switch (sset) { |
188 | case ETH_SS_STATS: | 189 | case ETH_SS_STATS: |
189 | return NUM_ALL_STATS + | 190 | return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) + |
190 | (priv->tx_ring_num + priv->rx_ring_num) * 2; | 191 | (priv->tx_ring_num + priv->rx_ring_num) * 2; |
191 | case ETH_SS_TEST: | 192 | case ETH_SS_TEST: |
192 | return MLX4_EN_NUM_SELF_TEST - !(priv->mdev->dev->caps.flags | 193 | return MLX4_EN_NUM_SELF_TEST - !(priv->mdev->dev->caps.flags |
@@ -201,14 +202,34 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev, | |||
201 | { | 202 | { |
202 | struct mlx4_en_priv *priv = netdev_priv(dev); | 203 | struct mlx4_en_priv *priv = netdev_priv(dev); |
203 | int index = 0; | 204 | int index = 0; |
204 | int i; | 205 | int i, j = 0; |
205 | 206 | ||
206 | spin_lock_bh(&priv->stats_lock); | 207 | spin_lock_bh(&priv->stats_lock); |
207 | 208 | ||
208 | for (i = 0; i < NUM_MAIN_STATS; i++) | 209 | if (!(priv->stats_bitmap)) { |
209 | data[index++] = ((unsigned long *) &priv->stats)[i]; | 210 | for (i = 0; i < NUM_MAIN_STATS; i++) |
210 | for (i = 0; i < NUM_PORT_STATS; i++) | 211 | data[index++] = |
211 | data[index++] = ((unsigned long *) &priv->port_stats)[i]; | 212 | ((unsigned long *) &priv->stats)[i]; |
213 | for (i = 0; i < NUM_PORT_STATS; i++) | ||
214 | data[index++] = | ||
215 | ((unsigned long *) &priv->port_stats)[i]; | ||
216 | for (i = 0; i < NUM_PKT_STATS; i++) | ||
217 | data[index++] = | ||
218 | ((unsigned long *) &priv->pkstats)[i]; | ||
219 | } else { | ||
220 | for (i = 0; i < NUM_MAIN_STATS; i++) { | ||
221 | if ((priv->stats_bitmap >> j) & 1) | ||
222 | data[index++] = | ||
223 | ((unsigned long *) &priv->stats)[i]; | ||
224 | j++; | ||
225 | } | ||
226 | for (i = 0; i < NUM_PORT_STATS; i++) { | ||
227 | if ((priv->stats_bitmap >> j) & 1) | ||
228 | data[index++] = | ||
229 | ((unsigned long *) &priv->port_stats)[i]; | ||
230 | j++; | ||
231 | } | ||
232 | } | ||
212 | for (i = 0; i < priv->tx_ring_num; i++) { | 233 | for (i = 0; i < priv->tx_ring_num; i++) { |
213 | data[index++] = priv->tx_ring[i].packets; | 234 | data[index++] = priv->tx_ring[i].packets; |
214 | data[index++] = priv->tx_ring[i].bytes; | 235 | data[index++] = priv->tx_ring[i].bytes; |
@@ -217,8 +238,6 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev, | |||
217 | data[index++] = priv->rx_ring[i].packets; | 238 | data[index++] = priv->rx_ring[i].packets; |
218 | data[index++] = priv->rx_ring[i].bytes; | 239 | data[index++] = priv->rx_ring[i].bytes; |
219 | } | 240 | } |
220 | for (i = 0; i < NUM_PKT_STATS; i++) | ||
221 | data[index++] = ((unsigned long *) &priv->pkstats)[i]; | ||
222 | spin_unlock_bh(&priv->stats_lock); | 241 | spin_unlock_bh(&priv->stats_lock); |
223 | 242 | ||
224 | } | 243 | } |
@@ -247,11 +266,29 @@ static void mlx4_en_get_strings(struct net_device *dev, | |||
247 | 266 | ||
248 | case ETH_SS_STATS: | 267 | case ETH_SS_STATS: |
249 | /* Add main counters */ | 268 | /* Add main counters */ |
250 | for (i = 0; i < NUM_MAIN_STATS; i++) | 269 | if (!priv->stats_bitmap) { |
251 | strcpy(data + (index++) * ETH_GSTRING_LEN, main_strings[i]); | 270 | for (i = 0; i < NUM_MAIN_STATS; i++) |
252 | for (i = 0; i< NUM_PORT_STATS; i++) | 271 | strcpy(data + (index++) * ETH_GSTRING_LEN, |
253 | strcpy(data + (index++) * ETH_GSTRING_LEN, | 272 | main_strings[i]); |
254 | main_strings[i + NUM_MAIN_STATS]); | 273 | for (i = 0; i < NUM_PORT_STATS; i++) |
274 | strcpy(data + (index++) * ETH_GSTRING_LEN, | ||
275 | main_strings[i + | ||
276 | NUM_MAIN_STATS]); | ||
277 | for (i = 0; i < NUM_PKT_STATS; i++) | ||
278 | strcpy(data + (index++) * ETH_GSTRING_LEN, | ||
279 | main_strings[i + | ||
280 | NUM_MAIN_STATS + | ||
281 | NUM_PORT_STATS]); | ||
282 | } else | ||
283 | for (i = 0; i < NUM_MAIN_STATS + NUM_PORT_STATS; i++) { | ||
284 | if ((priv->stats_bitmap >> i) & 1) { | ||
285 | strcpy(data + | ||
286 | (index++) * ETH_GSTRING_LEN, | ||
287 | main_strings[i]); | ||
288 | } | ||
289 | if (!(priv->stats_bitmap >> i)) | ||
290 | break; | ||
291 | } | ||
255 | for (i = 0; i < priv->tx_ring_num; i++) { | 292 | for (i = 0; i < priv->tx_ring_num; i++) { |
256 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 293 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
257 | "tx%d_packets", i); | 294 | "tx%d_packets", i); |
@@ -264,9 +301,6 @@ static void mlx4_en_get_strings(struct net_device *dev, | |||
264 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 301 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
265 | "rx%d_bytes", i); | 302 | "rx%d_bytes", i); |
266 | } | 303 | } |
267 | for (i = 0; i< NUM_PKT_STATS; i++) | ||
268 | strcpy(data + (index++) * ETH_GSTRING_LEN, | ||
269 | main_strings[i + NUM_MAIN_STATS + NUM_PORT_STATS]); | ||
270 | break; | 304 | break; |
271 | } | 305 | } |
272 | } | 306 | } |
@@ -479,6 +513,95 @@ static void mlx4_en_get_ringparam(struct net_device *dev, | |||
479 | param->tx_pending = priv->tx_ring[0].size; | 513 | param->tx_pending = priv->tx_ring[0].size; |
480 | } | 514 | } |
481 | 515 | ||
516 | static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev) | ||
517 | { | ||
518 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
519 | |||
520 | return priv->rx_ring_num; | ||
521 | } | ||
522 | |||
523 | static int mlx4_en_get_rxfh_indir(struct net_device *dev, u32 *ring_index) | ||
524 | { | ||
525 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
526 | struct mlx4_en_rss_map *rss_map = &priv->rss_map; | ||
527 | int rss_rings; | ||
528 | size_t n = priv->rx_ring_num; | ||
529 | int err = 0; | ||
530 | |||
531 | rss_rings = priv->prof->rss_rings ?: priv->rx_ring_num; | ||
532 | |||
533 | while (n--) { | ||
534 | ring_index[n] = rss_map->qps[n % rss_rings].qpn - | ||
535 | rss_map->base_qpn; | ||
536 | } | ||
537 | |||
538 | return err; | ||
539 | } | ||
540 | |||
541 | static int mlx4_en_set_rxfh_indir(struct net_device *dev, | ||
542 | const u32 *ring_index) | ||
543 | { | ||
544 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
545 | struct mlx4_en_dev *mdev = priv->mdev; | ||
546 | int port_up = 0; | ||
547 | int err = 0; | ||
548 | int i; | ||
549 | int rss_rings = 0; | ||
550 | |||
551 | /* Calculate RSS table size and make sure flows are spread evenly | ||
552 | * between rings | ||
553 | */ | ||
554 | for (i = 0; i < priv->rx_ring_num; i++) { | ||
555 | if (i > 0 && !ring_index[i] && !rss_rings) | ||
556 | rss_rings = i; | ||
557 | |||
558 | if (ring_index[i] != (i % (rss_rings ?: priv->rx_ring_num))) | ||
559 | return -EINVAL; | ||
560 | } | ||
561 | |||
562 | if (!rss_rings) | ||
563 | rss_rings = priv->rx_ring_num; | ||
564 | |||
565 | /* RSS table size must be an order of 2 */ | ||
566 | if (!is_power_of_2(rss_rings)) | ||
567 | return -EINVAL; | ||
568 | |||
569 | mutex_lock(&mdev->state_lock); | ||
570 | if (priv->port_up) { | ||
571 | port_up = 1; | ||
572 | mlx4_en_stop_port(dev); | ||
573 | } | ||
574 | |||
575 | priv->prof->rss_rings = rss_rings; | ||
576 | |||
577 | if (port_up) { | ||
578 | err = mlx4_en_start_port(dev); | ||
579 | if (err) | ||
580 | en_err(priv, "Failed starting port\n"); | ||
581 | } | ||
582 | |||
583 | mutex_unlock(&mdev->state_lock); | ||
584 | return err; | ||
585 | } | ||
586 | |||
587 | static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, | ||
588 | u32 *rule_locs) | ||
589 | { | ||
590 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
591 | int err = 0; | ||
592 | |||
593 | switch (cmd->cmd) { | ||
594 | case ETHTOOL_GRXRINGS: | ||
595 | cmd->data = priv->rx_ring_num; | ||
596 | break; | ||
597 | default: | ||
598 | err = -EOPNOTSUPP; | ||
599 | break; | ||
600 | } | ||
601 | |||
602 | return err; | ||
603 | } | ||
604 | |||
482 | const struct ethtool_ops mlx4_en_ethtool_ops = { | 605 | const struct ethtool_ops mlx4_en_ethtool_ops = { |
483 | .get_drvinfo = mlx4_en_get_drvinfo, | 606 | .get_drvinfo = mlx4_en_get_drvinfo, |
484 | .get_settings = mlx4_en_get_settings, | 607 | .get_settings = mlx4_en_get_settings, |
@@ -498,6 +621,10 @@ const struct ethtool_ops mlx4_en_ethtool_ops = { | |||
498 | .set_pauseparam = mlx4_en_set_pauseparam, | 621 | .set_pauseparam = mlx4_en_set_pauseparam, |
499 | .get_ringparam = mlx4_en_get_ringparam, | 622 | .get_ringparam = mlx4_en_get_ringparam, |
500 | .set_ringparam = mlx4_en_set_ringparam, | 623 | .set_ringparam = mlx4_en_set_ringparam, |
624 | .get_rxnfc = mlx4_en_get_rxnfc, | ||
625 | .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size, | ||
626 | .get_rxfh_indir = mlx4_en_get_rxfh_indir, | ||
627 | .set_rxfh_indir = mlx4_en_set_rxfh_indir, | ||
501 | }; | 628 | }; |
502 | 629 | ||
503 | 630 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c index a06096fcc0b8..2097a7d3c5b8 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c | |||
@@ -62,10 +62,6 @@ static const char mlx4_en_version[] = | |||
62 | * Device scope module parameters | 62 | * Device scope module parameters |
63 | */ | 63 | */ |
64 | 64 | ||
65 | |||
66 | /* Enable RSS TCP traffic */ | ||
67 | MLX4_EN_PARM_INT(tcp_rss, 1, | ||
68 | "Enable RSS for incomming TCP traffic or disabled (0)"); | ||
69 | /* Enable RSS UDP traffic */ | 65 | /* Enable RSS UDP traffic */ |
70 | MLX4_EN_PARM_INT(udp_rss, 1, | 66 | MLX4_EN_PARM_INT(udp_rss, 1, |
71 | "Enable RSS for incomming UDP traffic or disabled (0)"); | 67 | "Enable RSS for incomming UDP traffic or disabled (0)"); |
@@ -104,7 +100,6 @@ static int mlx4_en_get_profile(struct mlx4_en_dev *mdev) | |||
104 | struct mlx4_en_profile *params = &mdev->profile; | 100 | struct mlx4_en_profile *params = &mdev->profile; |
105 | int i; | 101 | int i; |
106 | 102 | ||
107 | params->tcp_rss = tcp_rss; | ||
108 | params->udp_rss = udp_rss; | 103 | params->udp_rss = udp_rss; |
109 | if (params->udp_rss && !(mdev->dev->caps.flags | 104 | if (params->udp_rss && !(mdev->dev->caps.flags |
110 | & MLX4_DEV_CAP_FLAG_UDP_RSS)) { | 105 | & MLX4_DEV_CAP_FLAG_UDP_RSS)) { |
@@ -120,6 +115,7 @@ static int mlx4_en_get_profile(struct mlx4_en_dev *mdev) | |||
120 | params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE; | 115 | params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE; |
121 | params->prof[i].tx_ring_num = MLX4_EN_NUM_TX_RINGS + | 116 | params->prof[i].tx_ring_num = MLX4_EN_NUM_TX_RINGS + |
122 | (!!pfcrx) * MLX4_EN_NUM_PPP_RINGS; | 117 | (!!pfcrx) * MLX4_EN_NUM_PPP_RINGS; |
118 | params->prof[i].rss_rings = 0; | ||
123 | } | 119 | } |
124 | 120 | ||
125 | return 0; | 121 | return 0; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 72fa807b69ce..467ae5824875 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -702,6 +702,8 @@ int mlx4_en_start_port(struct net_device *dev) | |||
702 | /* Schedule multicast task to populate multicast list */ | 702 | /* Schedule multicast task to populate multicast list */ |
703 | queue_work(mdev->workqueue, &priv->mcast_task); | 703 | queue_work(mdev->workqueue, &priv->mcast_task); |
704 | 704 | ||
705 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | ||
706 | |||
705 | priv->port_up = true; | 707 | priv->port_up = true; |
706 | netif_tx_start_all_queues(dev); | 708 | netif_tx_start_all_queues(dev); |
707 | return 0; | 709 | return 0; |
@@ -807,38 +809,50 @@ static void mlx4_en_restart(struct work_struct *work) | |||
807 | mutex_unlock(&mdev->state_lock); | 809 | mutex_unlock(&mdev->state_lock); |
808 | } | 810 | } |
809 | 811 | ||
810 | 812 | static void mlx4_en_clear_stats(struct net_device *dev) | |
811 | static int mlx4_en_open(struct net_device *dev) | ||
812 | { | 813 | { |
813 | struct mlx4_en_priv *priv = netdev_priv(dev); | 814 | struct mlx4_en_priv *priv = netdev_priv(dev); |
814 | struct mlx4_en_dev *mdev = priv->mdev; | 815 | struct mlx4_en_dev *mdev = priv->mdev; |
815 | int i; | 816 | int i; |
816 | int err = 0; | ||
817 | |||
818 | mutex_lock(&mdev->state_lock); | ||
819 | |||
820 | if (!mdev->device_up) { | ||
821 | en_err(priv, "Cannot open - device down/disabled\n"); | ||
822 | err = -EBUSY; | ||
823 | goto out; | ||
824 | } | ||
825 | 817 | ||
826 | /* Reset HW statistics and performance counters */ | ||
827 | if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1)) | 818 | if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1)) |
828 | en_dbg(HW, priv, "Failed dumping statistics\n"); | 819 | en_dbg(HW, priv, "Failed dumping statistics\n"); |
829 | 820 | ||
830 | memset(&priv->stats, 0, sizeof(priv->stats)); | 821 | memset(&priv->stats, 0, sizeof(priv->stats)); |
831 | memset(&priv->pstats, 0, sizeof(priv->pstats)); | 822 | memset(&priv->pstats, 0, sizeof(priv->pstats)); |
823 | memset(&priv->pkstats, 0, sizeof(priv->pkstats)); | ||
824 | memset(&priv->port_stats, 0, sizeof(priv->port_stats)); | ||
832 | 825 | ||
833 | for (i = 0; i < priv->tx_ring_num; i++) { | 826 | for (i = 0; i < priv->tx_ring_num; i++) { |
834 | priv->tx_ring[i].bytes = 0; | 827 | priv->tx_ring[i].bytes = 0; |
835 | priv->tx_ring[i].packets = 0; | 828 | priv->tx_ring[i].packets = 0; |
829 | priv->tx_ring[i].tx_csum = 0; | ||
836 | } | 830 | } |
837 | for (i = 0; i < priv->rx_ring_num; i++) { | 831 | for (i = 0; i < priv->rx_ring_num; i++) { |
838 | priv->rx_ring[i].bytes = 0; | 832 | priv->rx_ring[i].bytes = 0; |
839 | priv->rx_ring[i].packets = 0; | 833 | priv->rx_ring[i].packets = 0; |
834 | priv->rx_ring[i].csum_ok = 0; | ||
835 | priv->rx_ring[i].csum_none = 0; | ||
836 | } | ||
837 | } | ||
838 | |||
839 | static int mlx4_en_open(struct net_device *dev) | ||
840 | { | ||
841 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
842 | struct mlx4_en_dev *mdev = priv->mdev; | ||
843 | int err = 0; | ||
844 | |||
845 | mutex_lock(&mdev->state_lock); | ||
846 | |||
847 | if (!mdev->device_up) { | ||
848 | en_err(priv, "Cannot open - device down/disabled\n"); | ||
849 | err = -EBUSY; | ||
850 | goto out; | ||
840 | } | 851 | } |
841 | 852 | ||
853 | /* Reset HW statistics and SW counters */ | ||
854 | mlx4_en_clear_stats(dev); | ||
855 | |||
842 | err = mlx4_en_start_port(dev); | 856 | err = mlx4_en_start_port(dev); |
843 | if (err) | 857 | if (err) |
844 | en_err(priv, "Failed starting port:%d\n", priv->port); | 858 | en_err(priv, "Failed starting port:%d\n", priv->port); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index e8d6ad2dce0a..971d4b6b8dfe 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
@@ -853,6 +853,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv) | |||
853 | struct mlx4_en_rss_map *rss_map = &priv->rss_map; | 853 | struct mlx4_en_rss_map *rss_map = &priv->rss_map; |
854 | struct mlx4_qp_context context; | 854 | struct mlx4_qp_context context; |
855 | struct mlx4_rss_context *rss_context; | 855 | struct mlx4_rss_context *rss_context; |
856 | int rss_rings; | ||
856 | void *ptr; | 857 | void *ptr; |
857 | u8 rss_mask = (MLX4_RSS_IPV4 | MLX4_RSS_TCP_IPV4 | MLX4_RSS_IPV6 | | 858 | u8 rss_mask = (MLX4_RSS_IPV4 | MLX4_RSS_TCP_IPV4 | MLX4_RSS_IPV6 | |
858 | MLX4_RSS_TCP_IPV6); | 859 | MLX4_RSS_TCP_IPV6); |
@@ -893,10 +894,15 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv) | |||
893 | mlx4_en_fill_qp_context(priv, 0, 0, 0, 1, priv->base_qpn, | 894 | mlx4_en_fill_qp_context(priv, 0, 0, 0, 1, priv->base_qpn, |
894 | priv->rx_ring[0].cqn, &context); | 895 | priv->rx_ring[0].cqn, &context); |
895 | 896 | ||
897 | if (!priv->prof->rss_rings || priv->prof->rss_rings > priv->rx_ring_num) | ||
898 | rss_rings = priv->rx_ring_num; | ||
899 | else | ||
900 | rss_rings = priv->prof->rss_rings; | ||
901 | |||
896 | ptr = ((void *) &context) + offsetof(struct mlx4_qp_context, pri_path) | 902 | ptr = ((void *) &context) + offsetof(struct mlx4_qp_context, pri_path) |
897 | + MLX4_RSS_OFFSET_IN_QPC_PRI_PATH; | 903 | + MLX4_RSS_OFFSET_IN_QPC_PRI_PATH; |
898 | rss_context = ptr; | 904 | rss_context = ptr; |
899 | rss_context->base_qpn = cpu_to_be32(ilog2(priv->rx_ring_num) << 24 | | 905 | rss_context->base_qpn = cpu_to_be32(ilog2(rss_rings) << 24 | |
900 | (rss_map->base_qpn)); | 906 | (rss_map->base_qpn)); |
901 | rss_context->default_qpn = cpu_to_be32(rss_map->base_qpn); | 907 | rss_context->default_qpn = cpu_to_be32(rss_map->base_qpn); |
902 | if (priv->mdev->profile.udp_rss) { | 908 | if (priv->mdev->profile.udp_rss) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index 1e9b55eb7217..55d7bd4e210a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -513,25 +513,22 @@ int mlx4_MAP_EQ_wrapper(struct mlx4_dev *dev, int slave, | |||
513 | { | 513 | { |
514 | struct mlx4_priv *priv = mlx4_priv(dev); | 514 | struct mlx4_priv *priv = mlx4_priv(dev); |
515 | struct mlx4_slave_event_eq_info *event_eq = | 515 | struct mlx4_slave_event_eq_info *event_eq = |
516 | &priv->mfunc.master.slave_state[slave].event_eq; | 516 | priv->mfunc.master.slave_state[slave].event_eq; |
517 | u32 in_modifier = vhcr->in_modifier; | 517 | u32 in_modifier = vhcr->in_modifier; |
518 | u32 eqn = in_modifier & 0x1FF; | 518 | u32 eqn = in_modifier & 0x1FF; |
519 | u64 in_param = vhcr->in_param; | 519 | u64 in_param = vhcr->in_param; |
520 | int err = 0; | 520 | int err = 0; |
521 | int i; | ||
521 | 522 | ||
522 | if (slave == dev->caps.function) | 523 | if (slave == dev->caps.function) |
523 | err = mlx4_cmd(dev, in_param, (in_modifier & 0x80000000) | eqn, | 524 | err = mlx4_cmd(dev, in_param, (in_modifier & 0x80000000) | eqn, |
524 | 0, MLX4_CMD_MAP_EQ, MLX4_CMD_TIME_CLASS_B, | 525 | 0, MLX4_CMD_MAP_EQ, MLX4_CMD_TIME_CLASS_B, |
525 | MLX4_CMD_NATIVE); | 526 | MLX4_CMD_NATIVE); |
526 | if (!err) { | 527 | if (!err) |
527 | if (in_modifier >> 31) { | 528 | for (i = 0; i < MLX4_EVENT_TYPES_NUM; ++i) |
528 | /* unmap */ | 529 | if (in_param & (1LL << i)) |
529 | event_eq->event_type &= ~in_param; | 530 | event_eq[i].eqn = in_modifier >> 31 ? -1 : eqn; |
530 | } else { | 531 | |
531 | event_eq->eqn = eqn; | ||
532 | event_eq->event_type = in_param; | ||
533 | } | ||
534 | } | ||
535 | return err; | 532 | return err; |
536 | } | 533 | } |
537 | 534 | ||
@@ -546,7 +543,7 @@ static int mlx4_MAP_EQ(struct mlx4_dev *dev, u64 event_mask, int unmap, | |||
546 | static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | 543 | static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, |
547 | int eq_num) | 544 | int eq_num) |
548 | { | 545 | { |
549 | return mlx4_cmd(dev, mailbox->dma | dev->caps.function, eq_num, 0, | 546 | return mlx4_cmd(dev, mailbox->dma, eq_num, 0, |
550 | MLX4_CMD_SW2HW_EQ, MLX4_CMD_TIME_CLASS_A, | 547 | MLX4_CMD_SW2HW_EQ, MLX4_CMD_TIME_CLASS_A, |
551 | MLX4_CMD_WRAPPED); | 548 | MLX4_CMD_WRAPPED); |
552 | } | 549 | } |
@@ -554,7 +551,7 @@ static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | |||
554 | static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | 551 | static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, |
555 | int eq_num) | 552 | int eq_num) |
556 | { | 553 | { |
557 | return mlx4_cmd_box(dev, dev->caps.function, mailbox->dma, eq_num, | 554 | return mlx4_cmd_box(dev, 0, mailbox->dma, eq_num, |
558 | 0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A, | 555 | 0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A, |
559 | MLX4_CMD_WRAPPED); | 556 | MLX4_CMD_WRAPPED); |
560 | } | 557 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index a424a19280cc..8a21e10952ea 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -158,7 +158,6 @@ int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave, | |||
158 | 158 | ||
159 | #define QUERY_FUNC_CAP_FLAGS_OFFSET 0x0 | 159 | #define QUERY_FUNC_CAP_FLAGS_OFFSET 0x0 |
160 | #define QUERY_FUNC_CAP_NUM_PORTS_OFFSET 0x1 | 160 | #define QUERY_FUNC_CAP_NUM_PORTS_OFFSET 0x1 |
161 | #define QUERY_FUNC_CAP_FUNCTION_OFFSET 0x3 | ||
162 | #define QUERY_FUNC_CAP_PF_BHVR_OFFSET 0x4 | 161 | #define QUERY_FUNC_CAP_PF_BHVR_OFFSET 0x4 |
163 | #define QUERY_FUNC_CAP_QP_QUOTA_OFFSET 0x10 | 162 | #define QUERY_FUNC_CAP_QP_QUOTA_OFFSET 0x10 |
164 | #define QUERY_FUNC_CAP_CQ_QUOTA_OFFSET 0x14 | 163 | #define QUERY_FUNC_CAP_CQ_QUOTA_OFFSET 0x14 |
@@ -182,9 +181,6 @@ int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave, | |||
182 | field = 1 << 7; /* enable only ethernet interface */ | 181 | field = 1 << 7; /* enable only ethernet interface */ |
183 | MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FLAGS_OFFSET); | 182 | MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FLAGS_OFFSET); |
184 | 183 | ||
185 | field = slave; | ||
186 | MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FUNCTION_OFFSET); | ||
187 | |||
188 | field = dev->caps.num_ports; | 184 | field = dev->caps.num_ports; |
189 | MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_NUM_PORTS_OFFSET); | 185 | MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_NUM_PORTS_OFFSET); |
190 | 186 | ||
@@ -249,9 +245,6 @@ int mlx4_QUERY_FUNC_CAP(struct mlx4_dev *dev, struct mlx4_func_cap *func_cap) | |||
249 | goto out; | 245 | goto out; |
250 | } | 246 | } |
251 | 247 | ||
252 | MLX4_GET(field, outbox, QUERY_FUNC_CAP_FUNCTION_OFFSET); | ||
253 | func_cap->function = field; | ||
254 | |||
255 | MLX4_GET(field, outbox, QUERY_FUNC_CAP_NUM_PORTS_OFFSET); | 248 | MLX4_GET(field, outbox, QUERY_FUNC_CAP_NUM_PORTS_OFFSET); |
256 | func_cap->num_ports = field; | 249 | func_cap->num_ports = field; |
257 | 250 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h index 119e0cc9fab3..e1a5fa56bcbc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.h +++ b/drivers/net/ethernet/mellanox/mlx4/fw.h | |||
@@ -119,7 +119,6 @@ struct mlx4_dev_cap { | |||
119 | }; | 119 | }; |
120 | 120 | ||
121 | struct mlx4_func_cap { | 121 | struct mlx4_func_cap { |
122 | u8 function; | ||
123 | u8 num_ports; | 122 | u8 num_ports; |
124 | u8 flags; | 123 | u8 flags; |
125 | u32 pf_context_behaviour; | 124 | u32 pf_context_behaviour; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 6bb62c580e2d..678558b502fc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -108,7 +108,7 @@ static struct mlx4_profile default_profile = { | |||
108 | .num_cq = 1 << 16, | 108 | .num_cq = 1 << 16, |
109 | .num_mcg = 1 << 13, | 109 | .num_mcg = 1 << 13, |
110 | .num_mpt = 1 << 19, | 110 | .num_mpt = 1 << 19, |
111 | .num_mtt = 1 << 20, | 111 | .num_mtt = 1 << 20, /* It is really num mtt segements */ |
112 | }; | 112 | }; |
113 | 113 | ||
114 | static int log_num_mac = 7; | 114 | static int log_num_mac = 7; |
@@ -471,7 +471,6 @@ static int mlx4_slave_cap(struct mlx4_dev *dev) | |||
471 | return -ENOSYS; | 471 | return -ENOSYS; |
472 | } | 472 | } |
473 | 473 | ||
474 | dev->caps.function = func_cap.function; | ||
475 | dev->caps.num_ports = func_cap.num_ports; | 474 | dev->caps.num_ports = func_cap.num_ports; |
476 | dev->caps.num_qps = func_cap.qp_quota; | 475 | dev->caps.num_qps = func_cap.qp_quota; |
477 | dev->caps.num_srqs = func_cap.srq_quota; | 476 | dev->caps.num_srqs = func_cap.srq_quota; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index a80121a2b519..c92269f8c057 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
@@ -388,9 +388,8 @@ struct mlx4_slave_eqe { | |||
388 | }; | 388 | }; |
389 | 389 | ||
390 | struct mlx4_slave_event_eq_info { | 390 | struct mlx4_slave_event_eq_info { |
391 | u32 eqn; | 391 | int eqn; |
392 | u16 token; | 392 | u16 token; |
393 | u64 event_type; | ||
394 | }; | 393 | }; |
395 | 394 | ||
396 | struct mlx4_profile { | 395 | struct mlx4_profile { |
@@ -449,6 +448,8 @@ struct mlx4_steer_index { | |||
449 | struct list_head duplicates; | 448 | struct list_head duplicates; |
450 | }; | 449 | }; |
451 | 450 | ||
451 | #define MLX4_EVENT_TYPES_NUM 64 | ||
452 | |||
452 | struct mlx4_slave_state { | 453 | struct mlx4_slave_state { |
453 | u8 comm_toggle; | 454 | u8 comm_toggle; |
454 | u8 last_cmd; | 455 | u8 last_cmd; |
@@ -461,7 +462,8 @@ struct mlx4_slave_state { | |||
461 | struct mlx4_slave_eqe eq[MLX4_MFUNC_MAX_EQES]; | 462 | struct mlx4_slave_eqe eq[MLX4_MFUNC_MAX_EQES]; |
462 | struct list_head mcast_filters[MLX4_MAX_PORTS + 1]; | 463 | struct list_head mcast_filters[MLX4_MAX_PORTS + 1]; |
463 | struct mlx4_vlan_fltr *vlan_filter[MLX4_MAX_PORTS + 1]; | 464 | struct mlx4_vlan_fltr *vlan_filter[MLX4_MAX_PORTS + 1]; |
464 | struct mlx4_slave_event_eq_info event_eq; | 465 | /* event type to eq number lookup */ |
466 | struct mlx4_slave_event_eq_info event_eq[MLX4_EVENT_TYPES_NUM]; | ||
465 | u16 eq_pi; | 467 | u16 eq_pi; |
466 | u16 eq_ci; | 468 | u16 eq_ci; |
467 | spinlock_t lock; | 469 | spinlock_t lock; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index f2a8e65f5f88..35f08840813c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -325,11 +325,11 @@ struct mlx4_en_port_profile { | |||
325 | u8 rx_ppp; | 325 | u8 rx_ppp; |
326 | u8 tx_pause; | 326 | u8 tx_pause; |
327 | u8 tx_ppp; | 327 | u8 tx_ppp; |
328 | int rss_rings; | ||
328 | }; | 329 | }; |
329 | 330 | ||
330 | struct mlx4_en_profile { | 331 | struct mlx4_en_profile { |
331 | int rss_xor; | 332 | int rss_xor; |
332 | int tcp_rss; | ||
333 | int udp_rss; | 333 | int udp_rss; |
334 | u8 rss_mask; | 334 | u8 rss_mask; |
335 | u32 active_ports; | 335 | u32 active_ports; |
@@ -476,6 +476,7 @@ struct mlx4_en_priv { | |||
476 | struct mlx4_en_perf_stats pstats; | 476 | struct mlx4_en_perf_stats pstats; |
477 | struct mlx4_en_pkt_stats pkstats; | 477 | struct mlx4_en_pkt_stats pkstats; |
478 | struct mlx4_en_port_stats port_stats; | 478 | struct mlx4_en_port_stats port_stats; |
479 | u64 stats_bitmap; | ||
479 | char *mc_addrs; | 480 | char *mc_addrs; |
480 | int mc_addrs_cnt; | 481 | int mc_addrs_cnt; |
481 | struct mlx4_en_stat_out_mbox hw_stats; | 482 | struct mlx4_en_stat_out_mbox hw_stats; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c index 01df5567e16e..8deeef98280c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mr.c +++ b/drivers/net/ethernet/mellanox/mlx4/mr.c | |||
@@ -291,7 +291,7 @@ static u32 key_to_hw_index(u32 key) | |||
291 | static int mlx4_SW2HW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | 291 | static int mlx4_SW2HW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, |
292 | int mpt_index) | 292 | int mpt_index) |
293 | { | 293 | { |
294 | return mlx4_cmd(dev, mailbox->dma | dev->caps.function , mpt_index, | 294 | return mlx4_cmd(dev, mailbox->dma, mpt_index, |
295 | 0, MLX4_CMD_SW2HW_MPT, MLX4_CMD_TIME_CLASS_B, | 295 | 0, MLX4_CMD_SW2HW_MPT, MLX4_CMD_TIME_CLASS_B, |
296 | MLX4_CMD_WRAPPED); | 296 | MLX4_CMD_WRAPPED); |
297 | } | 297 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/pd.c b/drivers/net/ethernet/mellanox/mlx4/pd.c index 5c9a54df17ab..db4746d0dca7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/pd.c +++ b/drivers/net/ethernet/mellanox/mlx4/pd.c | |||
@@ -52,8 +52,7 @@ int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn) | |||
52 | *pdn = mlx4_bitmap_alloc(&priv->pd_bitmap); | 52 | *pdn = mlx4_bitmap_alloc(&priv->pd_bitmap); |
53 | if (*pdn == -1) | 53 | if (*pdn == -1) |
54 | return -ENOMEM; | 54 | return -ENOMEM; |
55 | if (mlx4_is_mfunc(dev)) | 55 | |
56 | *pdn |= (dev->caps.function + 1) << NOT_MASKED_PD_BITS; | ||
57 | return 0; | 56 | return 0; |
58 | } | 57 | } |
59 | EXPORT_SYMBOL_GPL(mlx4_pd_alloc); | 58 | EXPORT_SYMBOL_GPL(mlx4_pd_alloc); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 88b52e547524..f44ae555bf43 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
@@ -44,6 +44,11 @@ | |||
44 | #define MLX4_VLAN_VALID (1u << 31) | 44 | #define MLX4_VLAN_VALID (1u << 31) |
45 | #define MLX4_VLAN_MASK 0xfff | 45 | #define MLX4_VLAN_MASK 0xfff |
46 | 46 | ||
47 | #define MLX4_STATS_TRAFFIC_COUNTERS_MASK 0xfULL | ||
48 | #define MLX4_STATS_TRAFFIC_DROPS_MASK 0xc0ULL | ||
49 | #define MLX4_STATS_ERROR_COUNTERS_MASK 0x1ffc30ULL | ||
50 | #define MLX4_STATS_PORT_COUNTERS_MASK 0x1fe00000ULL | ||
51 | |||
47 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) | 52 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) |
48 | { | 53 | { |
49 | int i; | 54 | int i; |
@@ -898,6 +903,24 @@ int mlx4_DUMP_ETH_STATS_wrapper(struct mlx4_dev *dev, int slave, | |||
898 | struct mlx4_cmd_mailbox *outbox, | 903 | struct mlx4_cmd_mailbox *outbox, |
899 | struct mlx4_cmd_info *cmd) | 904 | struct mlx4_cmd_info *cmd) |
900 | { | 905 | { |
906 | if (slave != dev->caps.function) | ||
907 | return 0; | ||
901 | return mlx4_common_dump_eth_stats(dev, slave, | 908 | return mlx4_common_dump_eth_stats(dev, slave, |
902 | vhcr->in_modifier, outbox); | 909 | vhcr->in_modifier, outbox); |
903 | } | 910 | } |
911 | |||
912 | void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap) | ||
913 | { | ||
914 | if (!mlx4_is_mfunc(dev)) { | ||
915 | *stats_bitmap = 0; | ||
916 | return; | ||
917 | } | ||
918 | |||
919 | *stats_bitmap = (MLX4_STATS_TRAFFIC_COUNTERS_MASK | | ||
920 | MLX4_STATS_TRAFFIC_DROPS_MASK | | ||
921 | MLX4_STATS_PORT_COUNTERS_MASK); | ||
922 | |||
923 | if (mlx4_is_master(dev)) | ||
924 | *stats_bitmap |= MLX4_STATS_ERROR_COUNTERS_MASK; | ||
925 | } | ||
926 | EXPORT_SYMBOL(mlx4_set_stats_bitmap); | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/profile.c b/drivers/net/ethernet/mellanox/mlx4/profile.c index 66f91ca7a7c6..1129677daa62 100644 --- a/drivers/net/ethernet/mellanox/mlx4/profile.c +++ b/drivers/net/ethernet/mellanox/mlx4/profile.c | |||
@@ -110,7 +110,7 @@ u64 mlx4_make_profile(struct mlx4_dev *dev, | |||
110 | profile[MLX4_RES_EQ].num = min_t(unsigned, dev_cap->max_eqs, MAX_MSIX); | 110 | profile[MLX4_RES_EQ].num = min_t(unsigned, dev_cap->max_eqs, MAX_MSIX); |
111 | profile[MLX4_RES_DMPT].num = request->num_mpt; | 111 | profile[MLX4_RES_DMPT].num = request->num_mpt; |
112 | profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS; | 112 | profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS; |
113 | profile[MLX4_RES_MTT].num = request->num_mtt; | 113 | profile[MLX4_RES_MTT].num = request->num_mtt * (1 << log_mtts_per_seg); |
114 | profile[MLX4_RES_MCG].num = request->num_mcg; | 114 | profile[MLX4_RES_MCG].num = request->num_mcg; |
115 | 115 | ||
116 | for (i = 0; i < MLX4_RES_NUM; ++i) { | 116 | for (i = 0; i < MLX4_RES_NUM; ++i) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c index 6b03ac8b9002..738f950a1ce5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/qp.c +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c | |||
@@ -162,7 +162,7 @@ static int __mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | |||
162 | ((struct mlx4_qp_context *) (mailbox->buf + 8))->local_qpn = | 162 | ((struct mlx4_qp_context *) (mailbox->buf + 8))->local_qpn = |
163 | cpu_to_be32(qp->qpn); | 163 | cpu_to_be32(qp->qpn); |
164 | 164 | ||
165 | ret = mlx4_cmd(dev, mailbox->dma | dev->caps.function, | 165 | ret = mlx4_cmd(dev, mailbox->dma, |
166 | qp->qpn | (!!sqd_event << 31), | 166 | qp->qpn | (!!sqd_event << 31), |
167 | new_state == MLX4_QP_STATE_RST ? 2 : 0, | 167 | new_state == MLX4_QP_STATE_RST ? 2 : 0, |
168 | op[cur_state][new_state], MLX4_CMD_TIME_CLASS_C, native); | 168 | op[cur_state][new_state], MLX4_CMD_TIME_CLASS_C, native); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index ed20751a057d..dcd819bfb2f0 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -1561,11 +1561,6 @@ static int mr_get_mtt_size(struct mlx4_mpt_entry *mpt) | |||
1561 | return be32_to_cpu(mpt->mtt_sz); | 1561 | return be32_to_cpu(mpt->mtt_sz); |
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | static int mr_get_pdn(struct mlx4_mpt_entry *mpt) | ||
1565 | { | ||
1566 | return be32_to_cpu(mpt->pd_flags) & 0xffffff; | ||
1567 | } | ||
1568 | |||
1569 | static int qp_get_mtt_addr(struct mlx4_qp_context *qpc) | 1564 | static int qp_get_mtt_addr(struct mlx4_qp_context *qpc) |
1570 | { | 1565 | { |
1571 | return be32_to_cpu(qpc->mtt_base_addr_l) & 0xfffffff8; | 1566 | return be32_to_cpu(qpc->mtt_base_addr_l) & 0xfffffff8; |
@@ -1602,16 +1597,6 @@ static int qp_get_mtt_size(struct mlx4_qp_context *qpc) | |||
1602 | return total_pages; | 1597 | return total_pages; |
1603 | } | 1598 | } |
1604 | 1599 | ||
1605 | static int qp_get_pdn(struct mlx4_qp_context *qpc) | ||
1606 | { | ||
1607 | return be32_to_cpu(qpc->pd) & 0xffffff; | ||
1608 | } | ||
1609 | |||
1610 | static int pdn2slave(int pdn) | ||
1611 | { | ||
1612 | return (pdn >> NOT_MASKED_PD_BITS) - 1; | ||
1613 | } | ||
1614 | |||
1615 | static int check_mtt_range(struct mlx4_dev *dev, int slave, int start, | 1600 | static int check_mtt_range(struct mlx4_dev *dev, int slave, int start, |
1616 | int size, struct res_mtt *mtt) | 1601 | int size, struct res_mtt *mtt) |
1617 | { | 1602 | { |
@@ -1656,11 +1641,6 @@ int mlx4_SW2HW_MPT_wrapper(struct mlx4_dev *dev, int slave, | |||
1656 | mpt->mtt = mtt; | 1641 | mpt->mtt = mtt; |
1657 | } | 1642 | } |
1658 | 1643 | ||
1659 | if (pdn2slave(mr_get_pdn(inbox->buf)) != slave) { | ||
1660 | err = -EPERM; | ||
1661 | goto ex_put; | ||
1662 | } | ||
1663 | |||
1664 | err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); | 1644 | err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); |
1665 | if (err) | 1645 | if (err) |
1666 | goto ex_put; | 1646 | goto ex_put; |
@@ -1792,11 +1772,6 @@ int mlx4_RST2INIT_QP_wrapper(struct mlx4_dev *dev, int slave, | |||
1792 | if (err) | 1772 | if (err) |
1793 | goto ex_put_mtt; | 1773 | goto ex_put_mtt; |
1794 | 1774 | ||
1795 | if (pdn2slave(qp_get_pdn(qpc)) != slave) { | ||
1796 | err = -EPERM; | ||
1797 | goto ex_put_mtt; | ||
1798 | } | ||
1799 | |||
1800 | err = get_res(dev, slave, rcqn, RES_CQ, &rcq); | 1775 | err = get_res(dev, slave, rcqn, RES_CQ, &rcq); |
1801 | if (err) | 1776 | if (err) |
1802 | goto ex_put_mtt; | 1777 | goto ex_put_mtt; |
@@ -2048,10 +2023,10 @@ int mlx4_GEN_EQE(struct mlx4_dev *dev, int slave, struct mlx4_eqe *eqe) | |||
2048 | if (!priv->mfunc.master.slave_state) | 2023 | if (!priv->mfunc.master.slave_state) |
2049 | return -EINVAL; | 2024 | return -EINVAL; |
2050 | 2025 | ||
2051 | event_eq = &priv->mfunc.master.slave_state[slave].event_eq; | 2026 | event_eq = &priv->mfunc.master.slave_state[slave].event_eq[eqe->type]; |
2052 | 2027 | ||
2053 | /* Create the event only if the slave is registered */ | 2028 | /* Create the event only if the slave is registered */ |
2054 | if ((event_eq->event_type & (1 << eqe->type)) == 0) | 2029 | if (event_eq->eqn < 0) |
2055 | return 0; | 2030 | return 0; |
2056 | 2031 | ||
2057 | mutex_lock(&priv->mfunc.master.gen_eqe_mutex[slave]); | 2032 | mutex_lock(&priv->mfunc.master.gen_eqe_mutex[slave]); |
@@ -2289,11 +2264,6 @@ ex_put: | |||
2289 | return err; | 2264 | return err; |
2290 | } | 2265 | } |
2291 | 2266 | ||
2292 | static int srq_get_pdn(struct mlx4_srq_context *srqc) | ||
2293 | { | ||
2294 | return be32_to_cpu(srqc->pd) & 0xffffff; | ||
2295 | } | ||
2296 | |||
2297 | static int srq_get_mtt_size(struct mlx4_srq_context *srqc) | 2267 | static int srq_get_mtt_size(struct mlx4_srq_context *srqc) |
2298 | { | 2268 | { |
2299 | int log_srq_size = (be32_to_cpu(srqc->state_logsize_srqn) >> 24) & 0xf; | 2269 | int log_srq_size = (be32_to_cpu(srqc->state_logsize_srqn) >> 24) & 0xf; |
@@ -2333,11 +2303,6 @@ int mlx4_SW2HW_SRQ_wrapper(struct mlx4_dev *dev, int slave, | |||
2333 | if (err) | 2303 | if (err) |
2334 | goto ex_put_mtt; | 2304 | goto ex_put_mtt; |
2335 | 2305 | ||
2336 | if (pdn2slave(srq_get_pdn(srqc)) != slave) { | ||
2337 | err = -EPERM; | ||
2338 | goto ex_put_mtt; | ||
2339 | } | ||
2340 | |||
2341 | err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); | 2306 | err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); |
2342 | if (err) | 2307 | if (err) |
2343 | goto ex_put_mtt; | 2308 | goto ex_put_mtt; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c index 2823fffc6383..feda6c00829f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/srq.c +++ b/drivers/net/ethernet/mellanox/mlx4/srq.c | |||
@@ -67,7 +67,7 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type) | |||
67 | static int mlx4_SW2HW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | 67 | static int mlx4_SW2HW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, |
68 | int srq_num) | 68 | int srq_num) |
69 | { | 69 | { |
70 | return mlx4_cmd(dev, mailbox->dma | dev->caps.function, srq_num, 0, | 70 | return mlx4_cmd(dev, mailbox->dma, srq_num, 0, |
71 | MLX4_CMD_SW2HW_SRQ, MLX4_CMD_TIME_CLASS_A, | 71 | MLX4_CMD_SW2HW_SRQ, MLX4_CMD_TIME_CLASS_A, |
72 | MLX4_CMD_WRAPPED); | 72 | MLX4_CMD_WRAPPED); |
73 | } | 73 | } |