diff options
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_cmd.c | 16 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes.h | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_cm.c | 84 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_cm.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_hw.c | 30 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_verbs.c | 67 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_verbs.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ib.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 5 | ||||
-rw-r--r-- | drivers/net/mlx4/main.c | 2 |
10 files changed, 122 insertions, 94 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c index c33e1c53c799..6d55f9d748f6 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c | |||
@@ -157,13 +157,15 @@ enum { | |||
157 | enum { | 157 | enum { |
158 | CMD_TIME_CLASS_A = (HZ + 999) / 1000 + 1, | 158 | CMD_TIME_CLASS_A = (HZ + 999) / 1000 + 1, |
159 | CMD_TIME_CLASS_B = (HZ + 99) / 100 + 1, | 159 | CMD_TIME_CLASS_B = (HZ + 99) / 100 + 1, |
160 | CMD_TIME_CLASS_C = (HZ + 9) / 10 + 1 | 160 | CMD_TIME_CLASS_C = (HZ + 9) / 10 + 1, |
161 | CMD_TIME_CLASS_D = 60 * HZ | ||
161 | }; | 162 | }; |
162 | #else | 163 | #else |
163 | enum { | 164 | enum { |
164 | CMD_TIME_CLASS_A = 60 * HZ, | 165 | CMD_TIME_CLASS_A = 60 * HZ, |
165 | CMD_TIME_CLASS_B = 60 * HZ, | 166 | CMD_TIME_CLASS_B = 60 * HZ, |
166 | CMD_TIME_CLASS_C = 60 * HZ | 167 | CMD_TIME_CLASS_C = 60 * HZ, |
168 | CMD_TIME_CLASS_D = 60 * HZ | ||
167 | }; | 169 | }; |
168 | #endif | 170 | #endif |
169 | 171 | ||
@@ -598,7 +600,7 @@ int mthca_SYS_EN(struct mthca_dev *dev, u8 *status) | |||
598 | u64 out; | 600 | u64 out; |
599 | int ret; | 601 | int ret; |
600 | 602 | ||
601 | ret = mthca_cmd_imm(dev, 0, &out, 0, 0, CMD_SYS_EN, HZ, status); | 603 | ret = mthca_cmd_imm(dev, 0, &out, 0, 0, CMD_SYS_EN, CMD_TIME_CLASS_D, status); |
602 | 604 | ||
603 | if (*status == MTHCA_CMD_STAT_DDR_MEM_ERR) | 605 | if (*status == MTHCA_CMD_STAT_DDR_MEM_ERR) |
604 | mthca_warn(dev, "SYS_EN DDR error: syn=%x, sock=%d, " | 606 | mthca_warn(dev, "SYS_EN DDR error: syn=%x, sock=%d, " |
@@ -611,7 +613,7 @@ int mthca_SYS_EN(struct mthca_dev *dev, u8 *status) | |||
611 | 613 | ||
612 | int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status) | 614 | int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status) |
613 | { | 615 | { |
614 | return mthca_cmd(dev, 0, 0, 0, CMD_SYS_DIS, HZ, status); | 616 | return mthca_cmd(dev, 0, 0, 0, CMD_SYS_DIS, CMD_TIME_CLASS_C, status); |
615 | } | 617 | } |
616 | 618 | ||
617 | static int mthca_map_cmd(struct mthca_dev *dev, u16 op, struct mthca_icm *icm, | 619 | static int mthca_map_cmd(struct mthca_dev *dev, u16 op, struct mthca_icm *icm, |
@@ -1390,7 +1392,7 @@ int mthca_INIT_HCA(struct mthca_dev *dev, | |||
1390 | MTHCA_PUT(inbox, param->uarc_base, INIT_HCA_UAR_CTX_BASE_OFFSET); | 1392 | MTHCA_PUT(inbox, param->uarc_base, INIT_HCA_UAR_CTX_BASE_OFFSET); |
1391 | } | 1393 | } |
1392 | 1394 | ||
1393 | err = mthca_cmd(dev, mailbox->dma, 0, 0, CMD_INIT_HCA, HZ, status); | 1395 | err = mthca_cmd(dev, mailbox->dma, 0, 0, CMD_INIT_HCA, CMD_TIME_CLASS_D, status); |
1394 | 1396 | ||
1395 | mthca_free_mailbox(dev, mailbox); | 1397 | mthca_free_mailbox(dev, mailbox); |
1396 | return err; | 1398 | return err; |
@@ -1450,12 +1452,12 @@ int mthca_INIT_IB(struct mthca_dev *dev, | |||
1450 | 1452 | ||
1451 | int mthca_CLOSE_IB(struct mthca_dev *dev, int port, u8 *status) | 1453 | int mthca_CLOSE_IB(struct mthca_dev *dev, int port, u8 *status) |
1452 | { | 1454 | { |
1453 | return mthca_cmd(dev, 0, port, 0, CMD_CLOSE_IB, HZ, status); | 1455 | return mthca_cmd(dev, 0, port, 0, CMD_CLOSE_IB, CMD_TIME_CLASS_A, status); |
1454 | } | 1456 | } |
1455 | 1457 | ||
1456 | int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic, u8 *status) | 1458 | int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic, u8 *status) |
1457 | { | 1459 | { |
1458 | return mthca_cmd(dev, 0, 0, panic, CMD_CLOSE_HCA, HZ, status); | 1460 | return mthca_cmd(dev, 0, 0, panic, CMD_CLOSE_HCA, CMD_TIME_CLASS_C, status); |
1459 | } | 1461 | } |
1460 | 1462 | ||
1461 | int mthca_SET_IB(struct mthca_dev *dev, struct mthca_set_ib_param *param, | 1463 | int mthca_SET_IB(struct mthca_dev *dev, struct mthca_set_ib_param *param, |
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h index 17621de54a9f..bf1720f7f35f 100644 --- a/drivers/infiniband/hw/nes/nes.h +++ b/drivers/infiniband/hw/nes/nes.h | |||
@@ -56,10 +56,8 @@ | |||
56 | 56 | ||
57 | #define QUEUE_DISCONNECTS | 57 | #define QUEUE_DISCONNECTS |
58 | 58 | ||
59 | #define DRV_BUILD "1" | ||
60 | |||
61 | #define DRV_NAME "iw_nes" | 59 | #define DRV_NAME "iw_nes" |
62 | #define DRV_VERSION "1.0 KO Build " DRV_BUILD | 60 | #define DRV_VERSION "1.5.0.0" |
63 | #define PFX DRV_NAME ": " | 61 | #define PFX DRV_NAME ": " |
64 | 62 | ||
65 | /* | 63 | /* |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index dbd9a75474e3..11c7d6642014 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <net/neighbour.h> | 56 | #include <net/neighbour.h> |
57 | #include <net/route.h> | 57 | #include <net/route.h> |
58 | #include <net/ip_fib.h> | 58 | #include <net/ip_fib.h> |
59 | #include <net/tcp.h> | ||
59 | 60 | ||
60 | #include "nes.h" | 61 | #include "nes.h" |
61 | 62 | ||
@@ -540,6 +541,7 @@ static void nes_cm_timer_tick(unsigned long pass) | |||
540 | struct list_head *list_node; | 541 | struct list_head *list_node; |
541 | struct nes_cm_core *cm_core = g_cm_core; | 542 | struct nes_cm_core *cm_core = g_cm_core; |
542 | u32 settimer = 0; | 543 | u32 settimer = 0; |
544 | unsigned long timetosend; | ||
543 | int ret = NETDEV_TX_OK; | 545 | int ret = NETDEV_TX_OK; |
544 | 546 | ||
545 | struct list_head timer_list; | 547 | struct list_head timer_list; |
@@ -644,8 +646,11 @@ static void nes_cm_timer_tick(unsigned long pass) | |||
644 | send_entry->retrycount); | 646 | send_entry->retrycount); |
645 | if (send_entry->send_retrans) { | 647 | if (send_entry->send_retrans) { |
646 | send_entry->retranscount--; | 648 | send_entry->retranscount--; |
649 | timetosend = (NES_RETRY_TIMEOUT << | ||
650 | (NES_DEFAULT_RETRANS - send_entry->retranscount)); | ||
651 | |||
647 | send_entry->timetosend = jiffies + | 652 | send_entry->timetosend = jiffies + |
648 | NES_RETRY_TIMEOUT; | 653 | min(timetosend, NES_MAX_TIMEOUT); |
649 | if (nexttimeout > send_entry->timetosend || | 654 | if (nexttimeout > send_entry->timetosend || |
650 | !settimer) { | 655 | !settimer) { |
651 | nexttimeout = send_entry->timetosend; | 656 | nexttimeout = send_entry->timetosend; |
@@ -854,7 +859,6 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, | |||
854 | { | 859 | { |
855 | unsigned long flags; | 860 | unsigned long flags; |
856 | struct nes_cm_listener *listen_node; | 861 | struct nes_cm_listener *listen_node; |
857 | __be32 tmp_addr = cpu_to_be32(dst_addr); | ||
858 | 862 | ||
859 | /* walk list and find cm_node associated with this session ID */ | 863 | /* walk list and find cm_node associated with this session ID */ |
860 | spin_lock_irqsave(&cm_core->listen_list_lock, flags); | 864 | spin_lock_irqsave(&cm_core->listen_list_lock, flags); |
@@ -871,9 +875,6 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, | |||
871 | } | 875 | } |
872 | spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); | 876 | spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); |
873 | 877 | ||
874 | nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n", | ||
875 | &tmp_addr, dst_port); | ||
876 | |||
877 | /* no listener */ | 878 | /* no listener */ |
878 | return NULL; | 879 | return NULL; |
879 | } | 880 | } |
@@ -1325,18 +1326,20 @@ static void handle_fin_pkt(struct nes_cm_node *cm_node) | |||
1325 | nes_debug(NES_DBG_CM, "Received FIN, cm_node = %p, state = %u. " | 1326 | nes_debug(NES_DBG_CM, "Received FIN, cm_node = %p, state = %u. " |
1326 | "refcnt=%d\n", cm_node, cm_node->state, | 1327 | "refcnt=%d\n", cm_node, cm_node->state, |
1327 | atomic_read(&cm_node->ref_count)); | 1328 | atomic_read(&cm_node->ref_count)); |
1328 | cm_node->tcp_cntxt.rcv_nxt++; | ||
1329 | cleanup_retrans_entry(cm_node); | ||
1330 | switch (cm_node->state) { | 1329 | switch (cm_node->state) { |
1331 | case NES_CM_STATE_SYN_RCVD: | 1330 | case NES_CM_STATE_SYN_RCVD: |
1332 | case NES_CM_STATE_SYN_SENT: | 1331 | case NES_CM_STATE_SYN_SENT: |
1333 | case NES_CM_STATE_ESTABLISHED: | 1332 | case NES_CM_STATE_ESTABLISHED: |
1334 | case NES_CM_STATE_MPAREQ_SENT: | 1333 | case NES_CM_STATE_MPAREQ_SENT: |
1335 | case NES_CM_STATE_MPAREJ_RCVD: | 1334 | case NES_CM_STATE_MPAREJ_RCVD: |
1335 | cm_node->tcp_cntxt.rcv_nxt++; | ||
1336 | cleanup_retrans_entry(cm_node); | ||
1336 | cm_node->state = NES_CM_STATE_LAST_ACK; | 1337 | cm_node->state = NES_CM_STATE_LAST_ACK; |
1337 | send_fin(cm_node, NULL); | 1338 | send_fin(cm_node, NULL); |
1338 | break; | 1339 | break; |
1339 | case NES_CM_STATE_FIN_WAIT1: | 1340 | case NES_CM_STATE_FIN_WAIT1: |
1341 | cm_node->tcp_cntxt.rcv_nxt++; | ||
1342 | cleanup_retrans_entry(cm_node); | ||
1340 | cm_node->state = NES_CM_STATE_CLOSING; | 1343 | cm_node->state = NES_CM_STATE_CLOSING; |
1341 | send_ack(cm_node, NULL); | 1344 | send_ack(cm_node, NULL); |
1342 | /* Wait for ACK as this is simultanous close.. | 1345 | /* Wait for ACK as this is simultanous close.. |
@@ -1344,11 +1347,15 @@ static void handle_fin_pkt(struct nes_cm_node *cm_node) | |||
1344 | * Just rm the node.. Done.. */ | 1347 | * Just rm the node.. Done.. */ |
1345 | break; | 1348 | break; |
1346 | case NES_CM_STATE_FIN_WAIT2: | 1349 | case NES_CM_STATE_FIN_WAIT2: |
1350 | cm_node->tcp_cntxt.rcv_nxt++; | ||
1351 | cleanup_retrans_entry(cm_node); | ||
1347 | cm_node->state = NES_CM_STATE_TIME_WAIT; | 1352 | cm_node->state = NES_CM_STATE_TIME_WAIT; |
1348 | send_ack(cm_node, NULL); | 1353 | send_ack(cm_node, NULL); |
1349 | schedule_nes_timer(cm_node, NULL, NES_TIMER_TYPE_CLOSE, 1, 0); | 1354 | schedule_nes_timer(cm_node, NULL, NES_TIMER_TYPE_CLOSE, 1, 0); |
1350 | break; | 1355 | break; |
1351 | case NES_CM_STATE_TIME_WAIT: | 1356 | case NES_CM_STATE_TIME_WAIT: |
1357 | cm_node->tcp_cntxt.rcv_nxt++; | ||
1358 | cleanup_retrans_entry(cm_node); | ||
1352 | cm_node->state = NES_CM_STATE_CLOSED; | 1359 | cm_node->state = NES_CM_STATE_CLOSED; |
1353 | rem_ref_cm_node(cm_node->cm_core, cm_node); | 1360 | rem_ref_cm_node(cm_node->cm_core, cm_node); |
1354 | break; | 1361 | break; |
@@ -1384,7 +1391,6 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
1384 | passive_state = atomic_add_return(1, &cm_node->passive_state); | 1391 | passive_state = atomic_add_return(1, &cm_node->passive_state); |
1385 | if (passive_state == NES_SEND_RESET_EVENT) | 1392 | if (passive_state == NES_SEND_RESET_EVENT) |
1386 | create_event(cm_node, NES_CM_EVENT_RESET); | 1393 | create_event(cm_node, NES_CM_EVENT_RESET); |
1387 | cleanup_retrans_entry(cm_node); | ||
1388 | cm_node->state = NES_CM_STATE_CLOSED; | 1394 | cm_node->state = NES_CM_STATE_CLOSED; |
1389 | dev_kfree_skb_any(skb); | 1395 | dev_kfree_skb_any(skb); |
1390 | break; | 1396 | break; |
@@ -1398,17 +1404,16 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
1398 | active_open_err(cm_node, skb, reset); | 1404 | active_open_err(cm_node, skb, reset); |
1399 | break; | 1405 | break; |
1400 | case NES_CM_STATE_CLOSED: | 1406 | case NES_CM_STATE_CLOSED: |
1401 | cleanup_retrans_entry(cm_node); | ||
1402 | drop_packet(skb); | 1407 | drop_packet(skb); |
1403 | break; | 1408 | break; |
1409 | case NES_CM_STATE_LAST_ACK: | ||
1410 | cm_node->cm_id->rem_ref(cm_node->cm_id); | ||
1404 | case NES_CM_STATE_TIME_WAIT: | 1411 | case NES_CM_STATE_TIME_WAIT: |
1405 | cleanup_retrans_entry(cm_node); | ||
1406 | cm_node->state = NES_CM_STATE_CLOSED; | 1412 | cm_node->state = NES_CM_STATE_CLOSED; |
1407 | rem_ref_cm_node(cm_node->cm_core, cm_node); | 1413 | rem_ref_cm_node(cm_node->cm_core, cm_node); |
1408 | drop_packet(skb); | 1414 | drop_packet(skb); |
1409 | break; | 1415 | break; |
1410 | case NES_CM_STATE_FIN_WAIT1: | 1416 | case NES_CM_STATE_FIN_WAIT1: |
1411 | cleanup_retrans_entry(cm_node); | ||
1412 | nes_debug(NES_DBG_CM, "Bad state %s[%u]\n", __func__, __LINE__); | 1417 | nes_debug(NES_DBG_CM, "Bad state %s[%u]\n", __func__, __LINE__); |
1413 | default: | 1418 | default: |
1414 | drop_packet(skb); | 1419 | drop_packet(skb); |
@@ -1455,6 +1460,7 @@ static void handle_rcv_mpa(struct nes_cm_node *cm_node, struct sk_buff *skb) | |||
1455 | NES_PASSIVE_STATE_INDICATED); | 1460 | NES_PASSIVE_STATE_INDICATED); |
1456 | break; | 1461 | break; |
1457 | case NES_CM_STATE_MPAREQ_SENT: | 1462 | case NES_CM_STATE_MPAREQ_SENT: |
1463 | cleanup_retrans_entry(cm_node); | ||
1458 | if (res_type == NES_MPA_REQUEST_REJECT) { | 1464 | if (res_type == NES_MPA_REQUEST_REJECT) { |
1459 | type = NES_CM_EVENT_MPA_REJECT; | 1465 | type = NES_CM_EVENT_MPA_REJECT; |
1460 | cm_node->state = NES_CM_STATE_MPAREJ_RCVD; | 1466 | cm_node->state = NES_CM_STATE_MPAREJ_RCVD; |
@@ -1518,7 +1524,7 @@ static int check_seq(struct nes_cm_node *cm_node, struct tcphdr *tcph, | |||
1518 | rcv_wnd = cm_node->tcp_cntxt.rcv_wnd; | 1524 | rcv_wnd = cm_node->tcp_cntxt.rcv_wnd; |
1519 | if (ack_seq != loc_seq_num) | 1525 | if (ack_seq != loc_seq_num) |
1520 | err = 1; | 1526 | err = 1; |
1521 | else if ((seq + rcv_wnd) < rcv_nxt) | 1527 | else if (!between(seq, rcv_nxt, (rcv_nxt+rcv_wnd))) |
1522 | err = 1; | 1528 | err = 1; |
1523 | if (err) { | 1529 | if (err) { |
1524 | nes_debug(NES_DBG_CM, "%s[%u] create abort for cm_node=%p " | 1530 | nes_debug(NES_DBG_CM, "%s[%u] create abort for cm_node=%p " |
@@ -1652,49 +1658,39 @@ static void handle_synack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
1652 | } | 1658 | } |
1653 | } | 1659 | } |
1654 | 1660 | ||
1655 | static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, | 1661 | static int handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, |
1656 | struct tcphdr *tcph) | 1662 | struct tcphdr *tcph) |
1657 | { | 1663 | { |
1658 | int datasize = 0; | 1664 | int datasize = 0; |
1659 | u32 inc_sequence; | 1665 | u32 inc_sequence; |
1660 | u32 rem_seq_ack; | 1666 | u32 rem_seq_ack; |
1661 | u32 rem_seq; | 1667 | u32 rem_seq; |
1662 | int ret; | 1668 | int ret = 0; |
1663 | int optionsize; | 1669 | int optionsize; |
1664 | optionsize = (tcph->doff << 2) - sizeof(struct tcphdr); | 1670 | optionsize = (tcph->doff << 2) - sizeof(struct tcphdr); |
1665 | 1671 | ||
1666 | if (check_seq(cm_node, tcph, skb)) | 1672 | if (check_seq(cm_node, tcph, skb)) |
1667 | return; | 1673 | return -EINVAL; |
1668 | 1674 | ||
1669 | skb_pull(skb, tcph->doff << 2); | 1675 | skb_pull(skb, tcph->doff << 2); |
1670 | inc_sequence = ntohl(tcph->seq); | 1676 | inc_sequence = ntohl(tcph->seq); |
1671 | rem_seq = ntohl(tcph->seq); | 1677 | rem_seq = ntohl(tcph->seq); |
1672 | rem_seq_ack = ntohl(tcph->ack_seq); | 1678 | rem_seq_ack = ntohl(tcph->ack_seq); |
1673 | datasize = skb->len; | 1679 | datasize = skb->len; |
1674 | cleanup_retrans_entry(cm_node); | ||
1675 | switch (cm_node->state) { | 1680 | switch (cm_node->state) { |
1676 | case NES_CM_STATE_SYN_RCVD: | 1681 | case NES_CM_STATE_SYN_RCVD: |
1677 | /* Passive OPEN */ | 1682 | /* Passive OPEN */ |
1683 | cleanup_retrans_entry(cm_node); | ||
1678 | ret = handle_tcp_options(cm_node, tcph, skb, optionsize, 1); | 1684 | ret = handle_tcp_options(cm_node, tcph, skb, optionsize, 1); |
1679 | if (ret) | 1685 | if (ret) |
1680 | break; | 1686 | break; |
1681 | cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); | 1687 | cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); |
1682 | if (cm_node->tcp_cntxt.rem_ack_num != | ||
1683 | cm_node->tcp_cntxt.loc_seq_num) { | ||
1684 | nes_debug(NES_DBG_CM, "rem_ack_num != loc_seq_num\n"); | ||
1685 | cleanup_retrans_entry(cm_node); | ||
1686 | send_reset(cm_node, skb); | ||
1687 | return; | ||
1688 | } | ||
1689 | cm_node->state = NES_CM_STATE_ESTABLISHED; | 1688 | cm_node->state = NES_CM_STATE_ESTABLISHED; |
1690 | cleanup_retrans_entry(cm_node); | ||
1691 | if (datasize) { | 1689 | if (datasize) { |
1692 | cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; | 1690 | cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; |
1693 | handle_rcv_mpa(cm_node, skb); | 1691 | handle_rcv_mpa(cm_node, skb); |
1694 | } else { /* rcvd ACK only */ | 1692 | } else /* rcvd ACK only */ |
1695 | dev_kfree_skb_any(skb); | 1693 | dev_kfree_skb_any(skb); |
1696 | cleanup_retrans_entry(cm_node); | ||
1697 | } | ||
1698 | break; | 1694 | break; |
1699 | case NES_CM_STATE_ESTABLISHED: | 1695 | case NES_CM_STATE_ESTABLISHED: |
1700 | /* Passive OPEN */ | 1696 | /* Passive OPEN */ |
@@ -1706,15 +1702,12 @@ static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
1706 | drop_packet(skb); | 1702 | drop_packet(skb); |
1707 | break; | 1703 | break; |
1708 | case NES_CM_STATE_MPAREQ_SENT: | 1704 | case NES_CM_STATE_MPAREQ_SENT: |
1709 | cleanup_retrans_entry(cm_node); | ||
1710 | cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); | 1705 | cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); |
1711 | if (datasize) { | 1706 | if (datasize) { |
1712 | cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; | 1707 | cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; |
1713 | handle_rcv_mpa(cm_node, skb); | 1708 | handle_rcv_mpa(cm_node, skb); |
1714 | } else { /* Could be just an ack pkt.. */ | 1709 | } else /* Could be just an ack pkt.. */ |
1715 | cleanup_retrans_entry(cm_node); | ||
1716 | dev_kfree_skb_any(skb); | 1710 | dev_kfree_skb_any(skb); |
1717 | } | ||
1718 | break; | 1711 | break; |
1719 | case NES_CM_STATE_LISTENING: | 1712 | case NES_CM_STATE_LISTENING: |
1720 | case NES_CM_STATE_CLOSED: | 1713 | case NES_CM_STATE_CLOSED: |
@@ -1722,11 +1715,10 @@ static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
1722 | send_reset(cm_node, skb); | 1715 | send_reset(cm_node, skb); |
1723 | break; | 1716 | break; |
1724 | case NES_CM_STATE_LAST_ACK: | 1717 | case NES_CM_STATE_LAST_ACK: |
1718 | case NES_CM_STATE_CLOSING: | ||
1725 | cleanup_retrans_entry(cm_node); | 1719 | cleanup_retrans_entry(cm_node); |
1726 | cm_node->state = NES_CM_STATE_CLOSED; | 1720 | cm_node->state = NES_CM_STATE_CLOSED; |
1727 | cm_node->cm_id->rem_ref(cm_node->cm_id); | 1721 | cm_node->cm_id->rem_ref(cm_node->cm_id); |
1728 | case NES_CM_STATE_CLOSING: | ||
1729 | cleanup_retrans_entry(cm_node); | ||
1730 | rem_ref_cm_node(cm_node->cm_core, cm_node); | 1722 | rem_ref_cm_node(cm_node->cm_core, cm_node); |
1731 | drop_packet(skb); | 1723 | drop_packet(skb); |
1732 | break; | 1724 | break; |
@@ -1741,9 +1733,11 @@ static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
1741 | case NES_CM_STATE_MPAREQ_RCVD: | 1733 | case NES_CM_STATE_MPAREQ_RCVD: |
1742 | case NES_CM_STATE_UNKNOWN: | 1734 | case NES_CM_STATE_UNKNOWN: |
1743 | default: | 1735 | default: |
1736 | cleanup_retrans_entry(cm_node); | ||
1744 | drop_packet(skb); | 1737 | drop_packet(skb); |
1745 | break; | 1738 | break; |
1746 | } | 1739 | } |
1740 | return ret; | ||
1747 | } | 1741 | } |
1748 | 1742 | ||
1749 | 1743 | ||
@@ -1849,6 +1843,7 @@ static void process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
1849 | enum nes_tcpip_pkt_type pkt_type = NES_PKT_TYPE_UNKNOWN; | 1843 | enum nes_tcpip_pkt_type pkt_type = NES_PKT_TYPE_UNKNOWN; |
1850 | struct tcphdr *tcph = tcp_hdr(skb); | 1844 | struct tcphdr *tcph = tcp_hdr(skb); |
1851 | u32 fin_set = 0; | 1845 | u32 fin_set = 0; |
1846 | int ret = 0; | ||
1852 | skb_pull(skb, ip_hdr(skb)->ihl << 2); | 1847 | skb_pull(skb, ip_hdr(skb)->ihl << 2); |
1853 | 1848 | ||
1854 | nes_debug(NES_DBG_CM, "process_packet: cm_node=%p state =%d syn=%d " | 1849 | nes_debug(NES_DBG_CM, "process_packet: cm_node=%p state =%d syn=%d " |
@@ -1874,17 +1869,17 @@ static void process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
1874 | handle_synack_pkt(cm_node, skb, tcph); | 1869 | handle_synack_pkt(cm_node, skb, tcph); |
1875 | break; | 1870 | break; |
1876 | case NES_PKT_TYPE_ACK: | 1871 | case NES_PKT_TYPE_ACK: |
1877 | handle_ack_pkt(cm_node, skb, tcph); | 1872 | ret = handle_ack_pkt(cm_node, skb, tcph); |
1878 | if (fin_set) | 1873 | if (fin_set && !ret) |
1879 | handle_fin_pkt(cm_node); | 1874 | handle_fin_pkt(cm_node); |
1880 | break; | 1875 | break; |
1881 | case NES_PKT_TYPE_RST: | 1876 | case NES_PKT_TYPE_RST: |
1882 | handle_rst_pkt(cm_node, skb, tcph); | 1877 | handle_rst_pkt(cm_node, skb, tcph); |
1883 | break; | 1878 | break; |
1884 | default: | 1879 | default: |
1885 | drop_packet(skb); | 1880 | if ((fin_set) && (!check_seq(cm_node, tcph, skb))) |
1886 | if (fin_set) | ||
1887 | handle_fin_pkt(cm_node); | 1881 | handle_fin_pkt(cm_node); |
1882 | drop_packet(skb); | ||
1888 | break; | 1883 | break; |
1889 | } | 1884 | } |
1890 | } | 1885 | } |
@@ -2710,7 +2705,6 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2710 | /* associate the node with the QP */ | 2705 | /* associate the node with the QP */ |
2711 | nesqp->cm_node = (void *)cm_node; | 2706 | nesqp->cm_node = (void *)cm_node; |
2712 | cm_node->nesqp = nesqp; | 2707 | cm_node->nesqp = nesqp; |
2713 | nes_add_ref(&nesqp->ibqp); | ||
2714 | 2708 | ||
2715 | nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n", | 2709 | nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n", |
2716 | nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener); | 2710 | nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener); |
@@ -2763,6 +2757,9 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2763 | nes_debug(NES_DBG_CM, "Unable to register memory region" | 2757 | nes_debug(NES_DBG_CM, "Unable to register memory region" |
2764 | "for lSMM for cm_node = %p \n", | 2758 | "for lSMM for cm_node = %p \n", |
2765 | cm_node); | 2759 | cm_node); |
2760 | pci_free_consistent(nesdev->pcidev, | ||
2761 | nesqp->private_data_len+sizeof(struct ietf_mpa_frame), | ||
2762 | nesqp->ietf_frame, nesqp->ietf_frame_pbase); | ||
2766 | return -ENOMEM; | 2763 | return -ENOMEM; |
2767 | } | 2764 | } |
2768 | 2765 | ||
@@ -2879,6 +2876,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2879 | 2876 | ||
2880 | /* notify OF layer that accept event was successful */ | 2877 | /* notify OF layer that accept event was successful */ |
2881 | cm_id->add_ref(cm_id); | 2878 | cm_id->add_ref(cm_id); |
2879 | nes_add_ref(&nesqp->ibqp); | ||
2882 | 2880 | ||
2883 | cm_event.event = IW_CM_EVENT_ESTABLISHED; | 2881 | cm_event.event = IW_CM_EVENT_ESTABLISHED; |
2884 | cm_event.status = IW_CM_EVENT_STATUS_ACCEPTED; | 2882 | cm_event.status = IW_CM_EVENT_STATUS_ACCEPTED; |
@@ -2959,6 +2957,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2959 | struct nes_device *nesdev; | 2957 | struct nes_device *nesdev; |
2960 | struct nes_cm_node *cm_node; | 2958 | struct nes_cm_node *cm_node; |
2961 | struct nes_cm_info cm_info; | 2959 | struct nes_cm_info cm_info; |
2960 | int apbvt_set = 0; | ||
2962 | 2961 | ||
2963 | ibqp = nes_get_qp(cm_id->device, conn_param->qpn); | 2962 | ibqp = nes_get_qp(cm_id->device, conn_param->qpn); |
2964 | if (!ibqp) | 2963 | if (!ibqp) |
@@ -2996,9 +2995,11 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2996 | conn_param->private_data_len); | 2995 | conn_param->private_data_len); |
2997 | 2996 | ||
2998 | if (cm_id->local_addr.sin_addr.s_addr != | 2997 | if (cm_id->local_addr.sin_addr.s_addr != |
2999 | cm_id->remote_addr.sin_addr.s_addr) | 2998 | cm_id->remote_addr.sin_addr.s_addr) { |
3000 | nes_manage_apbvt(nesvnic, ntohs(cm_id->local_addr.sin_port), | 2999 | nes_manage_apbvt(nesvnic, ntohs(cm_id->local_addr.sin_port), |
3001 | PCI_FUNC(nesdev->pcidev->devfn), NES_MANAGE_APBVT_ADD); | 3000 | PCI_FUNC(nesdev->pcidev->devfn), NES_MANAGE_APBVT_ADD); |
3001 | apbvt_set = 1; | ||
3002 | } | ||
3002 | 3003 | ||
3003 | /* set up the connection params for the node */ | 3004 | /* set up the connection params for the node */ |
3004 | cm_info.loc_addr = htonl(cm_id->local_addr.sin_addr.s_addr); | 3005 | cm_info.loc_addr = htonl(cm_id->local_addr.sin_addr.s_addr); |
@@ -3015,8 +3016,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
3015 | conn_param->private_data_len, (void *)conn_param->private_data, | 3016 | conn_param->private_data_len, (void *)conn_param->private_data, |
3016 | &cm_info); | 3017 | &cm_info); |
3017 | if (!cm_node) { | 3018 | if (!cm_node) { |
3018 | if (cm_id->local_addr.sin_addr.s_addr != | 3019 | if (apbvt_set) |
3019 | cm_id->remote_addr.sin_addr.s_addr) | ||
3020 | nes_manage_apbvt(nesvnic, ntohs(cm_id->local_addr.sin_port), | 3020 | nes_manage_apbvt(nesvnic, ntohs(cm_id->local_addr.sin_port), |
3021 | PCI_FUNC(nesdev->pcidev->devfn), | 3021 | PCI_FUNC(nesdev->pcidev->devfn), |
3022 | NES_MANAGE_APBVT_DEL); | 3022 | NES_MANAGE_APBVT_DEL); |
@@ -3025,7 +3025,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
3025 | return -ENOMEM; | 3025 | return -ENOMEM; |
3026 | } | 3026 | } |
3027 | 3027 | ||
3028 | cm_node->apbvt_set = 1; | 3028 | cm_node->apbvt_set = apbvt_set; |
3029 | nesqp->cm_node = cm_node; | 3029 | nesqp->cm_node = cm_node; |
3030 | cm_node->nesqp = nesqp; | 3030 | cm_node->nesqp = nesqp; |
3031 | nes_add_ref(&nesqp->ibqp); | 3031 | nes_add_ref(&nesqp->ibqp); |
diff --git a/drivers/infiniband/hw/nes/nes_cm.h b/drivers/infiniband/hw/nes/nes_cm.h index 80bba1892571..8b7e7c0e496e 100644 --- a/drivers/infiniband/hw/nes/nes_cm.h +++ b/drivers/infiniband/hw/nes/nes_cm.h | |||
@@ -149,6 +149,7 @@ struct nes_timer_entry { | |||
149 | #endif | 149 | #endif |
150 | #define NES_SHORT_TIME (10) | 150 | #define NES_SHORT_TIME (10) |
151 | #define NES_LONG_TIME (2000*HZ/1000) | 151 | #define NES_LONG_TIME (2000*HZ/1000) |
152 | #define NES_MAX_TIMEOUT ((unsigned long) (12*HZ)) | ||
152 | 153 | ||
153 | #define NES_CM_HASHTABLE_SIZE 1024 | 154 | #define NES_CM_HASHTABLE_SIZE 1024 |
154 | #define NES_CM_TCP_TIMER_INTERVAL 3000 | 155 | #define NES_CM_TCP_TIMER_INTERVAL 3000 |
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index d6fc9ae44062..b832a7b814a2 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -550,11 +550,8 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { | |||
550 | msleep(1); | 550 | msleep(1); |
551 | } | 551 | } |
552 | if (int_cnt > 1) { | 552 | if (int_cnt > 1) { |
553 | u32 sds; | ||
554 | spin_lock_irqsave(&nesadapter->phy_lock, flags); | 553 | spin_lock_irqsave(&nesadapter->phy_lock, flags); |
555 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); | 554 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, 0x0000F0C8); |
556 | sds |= 0x00000040; | ||
557 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); | ||
558 | mh_detected++; | 555 | mh_detected++; |
559 | reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); | 556 | reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); |
560 | reset_value |= 0x0000003d; | 557 | reset_value |= 0x0000003d; |
@@ -579,7 +576,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { | |||
579 | if (++ext_cnt > int_cnt) { | 576 | if (++ext_cnt > int_cnt) { |
580 | spin_lock_irqsave(&nesadapter->phy_lock, flags); | 577 | spin_lock_irqsave(&nesadapter->phy_lock, flags); |
581 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, | 578 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, |
582 | 0x0000F0C8); | 579 | 0x0000F088); |
583 | mh_detected++; | 580 | mh_detected++; |
584 | reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); | 581 | reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); |
585 | reset_value |= 0x0000003d; | 582 | reset_value |= 0x0000003d; |
@@ -764,6 +761,9 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count, | |||
764 | return 0; | 761 | return 0; |
765 | 762 | ||
766 | /* init serdes 1 */ | 763 | /* init serdes 1 */ |
764 | if (!(OneG_Mode && (nesadapter->phy_type[1] != NES_PHY_TYPE_PUMA_1G))) | ||
765 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000000FF); | ||
766 | |||
767 | switch (nesadapter->phy_type[1]) { | 767 | switch (nesadapter->phy_type[1]) { |
768 | case NES_PHY_TYPE_ARGUS: | 768 | case NES_PHY_TYPE_ARGUS: |
769 | case NES_PHY_TYPE_SFP_D: | 769 | case NES_PHY_TYPE_SFP_D: |
@@ -771,21 +771,20 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count, | |||
771 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_EMP1, 0x00000000); | 771 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_EMP1, 0x00000000); |
772 | break; | 772 | break; |
773 | case NES_PHY_TYPE_CX4: | 773 | case NES_PHY_TYPE_CX4: |
774 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); | ||
775 | sds &= 0xFFFFFFBF; | ||
776 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); | ||
777 | if (wide_ppm_offset) | 774 | if (wide_ppm_offset) |
778 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000FFFAA); | 775 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000FFFAA); |
779 | else | ||
780 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000000FF); | ||
781 | break; | 776 | break; |
782 | case NES_PHY_TYPE_PUMA_1G: | 777 | case NES_PHY_TYPE_PUMA_1G: |
783 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); | 778 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); |
784 | sds |= 0x000000100; | 779 | sds |= 0x000000100; |
785 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); | 780 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); |
786 | } | 781 | } |
787 | if (!OneG_Mode) | 782 | if (!OneG_Mode) { |
788 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE1, 0x11110000); | 783 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE1, 0x11110000); |
784 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); | ||
785 | sds &= 0xFFFFFFBF; | ||
786 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); | ||
787 | } | ||
789 | } else { | 788 | } else { |
790 | /* init serdes 0 */ | 789 | /* init serdes 0 */ |
791 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, 0x00000008); | 790 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, 0x00000008); |
@@ -913,6 +912,12 @@ static void nes_init_csr_ne020(struct nes_device *nesdev, u8 hw_rev, u8 port_cou | |||
913 | u32temp &= 0x7fffffff; | 912 | u32temp &= 0x7fffffff; |
914 | u32temp |= 0x7fff0010; | 913 | u32temp |= 0x7fff0010; |
915 | nes_write_indexed(nesdev, 0x000021f8, u32temp); | 914 | nes_write_indexed(nesdev, 0x000021f8, u32temp); |
915 | if (port_count > 1) { | ||
916 | u32temp = nes_read_indexed(nesdev, 0x000023f8); | ||
917 | u32temp &= 0x7fffffff; | ||
918 | u32temp |= 0x7fff0010; | ||
919 | nes_write_indexed(nesdev, 0x000023f8, u32temp); | ||
920 | } | ||
916 | } | 921 | } |
917 | } | 922 | } |
918 | 923 | ||
@@ -1366,13 +1371,14 @@ int nes_init_phy(struct nes_device *nesdev) | |||
1366 | if (phy_type == NES_PHY_TYPE_ARGUS) { | 1371 | if (phy_type == NES_PHY_TYPE_ARGUS) { |
1367 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x000C); | 1372 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x000C); |
1368 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0008); | 1373 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0008); |
1374 | nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0001); | ||
1369 | } else { | 1375 | } else { |
1370 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x0004); | 1376 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x0004); |
1371 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0038); | 1377 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0038); |
1378 | nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0013); | ||
1372 | } | 1379 | } |
1373 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc31a, 0x0098); | 1380 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc31a, 0x0098); |
1374 | nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0026, 0x0E00); | 1381 | nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0026, 0x0E00); |
1375 | nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0001); | ||
1376 | 1382 | ||
1377 | /* setup LEDs */ | 1383 | /* setup LEDs */ |
1378 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd006, 0x0007); | 1384 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd006, 0x0007); |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 7e5b5ba13a74..64d5cfd8f380 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -1627,6 +1627,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, | |||
1627 | nescq->hw_cq.cq_number = nes_ucontext->mcrqf & 0xffff; | 1627 | nescq->hw_cq.cq_number = nes_ucontext->mcrqf & 0xffff; |
1628 | else | 1628 | else |
1629 | nescq->hw_cq.cq_number = nesvnic->mcrq_qp_id + nes_ucontext->mcrqf-1; | 1629 | nescq->hw_cq.cq_number = nesvnic->mcrq_qp_id + nes_ucontext->mcrqf-1; |
1630 | nescq->mcrqf = nes_ucontext->mcrqf; | ||
1630 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); | 1631 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); |
1631 | } | 1632 | } |
1632 | nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n", | 1633 | nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n", |
@@ -1682,6 +1683,12 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, | |||
1682 | if (!context) | 1683 | if (!context) |
1683 | pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, | 1684 | pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, |
1684 | nescq->hw_cq.cq_pbase); | 1685 | nescq->hw_cq.cq_pbase); |
1686 | else { | ||
1687 | pci_free_consistent(nesdev->pcidev, nespbl->pbl_size, | ||
1688 | nespbl->pbl_vbase, nespbl->pbl_pbase); | ||
1689 | kfree(nespbl); | ||
1690 | } | ||
1691 | |||
1685 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); | 1692 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); |
1686 | kfree(nescq); | 1693 | kfree(nescq); |
1687 | return ERR_PTR(-ENOMEM); | 1694 | return ERR_PTR(-ENOMEM); |
@@ -1705,6 +1712,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, | |||
1705 | if (!context) | 1712 | if (!context) |
1706 | pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, | 1713 | pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, |
1707 | nescq->hw_cq.cq_pbase); | 1714 | nescq->hw_cq.cq_pbase); |
1715 | else { | ||
1716 | pci_free_consistent(nesdev->pcidev, nespbl->pbl_size, | ||
1717 | nespbl->pbl_vbase, nespbl->pbl_pbase); | ||
1718 | kfree(nespbl); | ||
1719 | } | ||
1708 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); | 1720 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); |
1709 | kfree(nescq); | 1721 | kfree(nescq); |
1710 | return ERR_PTR(-ENOMEM); | 1722 | return ERR_PTR(-ENOMEM); |
@@ -1722,6 +1734,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, | |||
1722 | if (!context) | 1734 | if (!context) |
1723 | pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, | 1735 | pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, |
1724 | nescq->hw_cq.cq_pbase); | 1736 | nescq->hw_cq.cq_pbase); |
1737 | else { | ||
1738 | pci_free_consistent(nesdev->pcidev, nespbl->pbl_size, | ||
1739 | nespbl->pbl_vbase, nespbl->pbl_pbase); | ||
1740 | kfree(nespbl); | ||
1741 | } | ||
1725 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); | 1742 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); |
1726 | kfree(nescq); | 1743 | kfree(nescq); |
1727 | return ERR_PTR(-ENOMEM); | 1744 | return ERR_PTR(-ENOMEM); |
@@ -1774,6 +1791,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, | |||
1774 | if (!context) | 1791 | if (!context) |
1775 | pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, | 1792 | pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, |
1776 | nescq->hw_cq.cq_pbase); | 1793 | nescq->hw_cq.cq_pbase); |
1794 | else { | ||
1795 | pci_free_consistent(nesdev->pcidev, nespbl->pbl_size, | ||
1796 | nespbl->pbl_vbase, nespbl->pbl_pbase); | ||
1797 | kfree(nespbl); | ||
1798 | } | ||
1777 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); | 1799 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); |
1778 | kfree(nescq); | 1800 | kfree(nescq); |
1779 | return ERR_PTR(-EIO); | 1801 | return ERR_PTR(-EIO); |
@@ -1855,7 +1877,9 @@ static int nes_destroy_cq(struct ib_cq *ib_cq) | |||
1855 | set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_OPCODE_IDX, opcode); | 1877 | set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_OPCODE_IDX, opcode); |
1856 | set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_ID_IDX, | 1878 | set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_ID_IDX, |
1857 | (nescq->hw_cq.cq_number | ((u32)PCI_FUNC(nesdev->pcidev->devfn) << 16))); | 1879 | (nescq->hw_cq.cq_number | ((u32)PCI_FUNC(nesdev->pcidev->devfn) << 16))); |
1858 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, nescq->hw_cq.cq_number); | 1880 | if (!nescq->mcrqf) |
1881 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, nescq->hw_cq.cq_number); | ||
1882 | |||
1859 | atomic_set(&cqp_request->refcount, 2); | 1883 | atomic_set(&cqp_request->refcount, 2); |
1860 | nes_post_cqp_request(nesdev, cqp_request); | 1884 | nes_post_cqp_request(nesdev, cqp_request); |
1861 | 1885 | ||
@@ -1895,8 +1919,7 @@ static int nes_destroy_cq(struct ib_cq *ib_cq) | |||
1895 | static u32 root_256(struct nes_device *nesdev, | 1919 | static u32 root_256(struct nes_device *nesdev, |
1896 | struct nes_root_vpbl *root_vpbl, | 1920 | struct nes_root_vpbl *root_vpbl, |
1897 | struct nes_root_vpbl *new_root, | 1921 | struct nes_root_vpbl *new_root, |
1898 | u16 pbl_count_4k, | 1922 | u16 pbl_count_4k) |
1899 | u16 pbl_count_256) | ||
1900 | { | 1923 | { |
1901 | u64 leaf_pbl; | 1924 | u64 leaf_pbl; |
1902 | int i, j, k; | 1925 | int i, j, k; |
@@ -1952,7 +1975,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd, | |||
1952 | int ret; | 1975 | int ret; |
1953 | struct nes_adapter *nesadapter = nesdev->nesadapter; | 1976 | struct nes_adapter *nesadapter = nesdev->nesadapter; |
1954 | uint pg_cnt = 0; | 1977 | uint pg_cnt = 0; |
1955 | u16 pbl_count_256; | 1978 | u16 pbl_count_256 = 0; |
1956 | u16 pbl_count = 0; | 1979 | u16 pbl_count = 0; |
1957 | u8 use_256_pbls = 0; | 1980 | u8 use_256_pbls = 0; |
1958 | u8 use_4k_pbls = 0; | 1981 | u8 use_4k_pbls = 0; |
@@ -2012,7 +2035,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd, | |||
2012 | } | 2035 | } |
2013 | 2036 | ||
2014 | if (use_256_pbls && use_two_level) { | 2037 | if (use_256_pbls && use_two_level) { |
2015 | if (root_256(nesdev, root_vpbl, &new_root, pbl_count_4k, pbl_count_256) == 1) { | 2038 | if (root_256(nesdev, root_vpbl, &new_root, pbl_count_4k) == 1) { |
2016 | if (new_root.pbl_pbase != 0) | 2039 | if (new_root.pbl_pbase != 0) |
2017 | root_vpbl = &new_root; | 2040 | root_vpbl = &new_root; |
2018 | } else { | 2041 | } else { |
@@ -2122,6 +2145,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, | |||
2122 | struct nes_root_vpbl root_vpbl; | 2145 | struct nes_root_vpbl root_vpbl; |
2123 | u32 stag; | 2146 | u32 stag; |
2124 | u32 i; | 2147 | u32 i; |
2148 | unsigned long mask; | ||
2125 | u32 stag_index = 0; | 2149 | u32 stag_index = 0; |
2126 | u32 next_stag_index = 0; | 2150 | u32 next_stag_index = 0; |
2127 | u32 driver_key = 0; | 2151 | u32 driver_key = 0; |
@@ -2150,6 +2174,9 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, | |||
2150 | return ERR_PTR(-E2BIG); | 2174 | return ERR_PTR(-E2BIG); |
2151 | } | 2175 | } |
2152 | 2176 | ||
2177 | if ((buffer_list[0].addr ^ *iova_start) & ~PAGE_MASK) | ||
2178 | return ERR_PTR(-EINVAL); | ||
2179 | |||
2153 | err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr, | 2180 | err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr, |
2154 | &stag_index, &next_stag_index); | 2181 | &stag_index, &next_stag_index); |
2155 | if (err) { | 2182 | if (err) { |
@@ -2215,19 +2242,16 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, | |||
2215 | root_pbl_index++; | 2242 | root_pbl_index++; |
2216 | cur_pbl_index = 0; | 2243 | cur_pbl_index = 0; |
2217 | } | 2244 | } |
2218 | if (buffer_list[i].addr & ~PAGE_MASK) { | ||
2219 | /* TODO: Unwind allocated buffers */ | ||
2220 | nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); | ||
2221 | nes_debug(NES_DBG_MR, "Unaligned Memory Buffer: 0x%x\n", | ||
2222 | (unsigned int) buffer_list[i].addr); | ||
2223 | ibmr = ERR_PTR(-EINVAL); | ||
2224 | kfree(nesmr); | ||
2225 | goto reg_phys_err; | ||
2226 | } | ||
2227 | 2245 | ||
2228 | if (!buffer_list[i].size) { | 2246 | mask = !buffer_list[i].size; |
2247 | if (i != 0) | ||
2248 | mask |= buffer_list[i].addr; | ||
2249 | if (i != num_phys_buf - 1) | ||
2250 | mask |= buffer_list[i].addr + buffer_list[i].size; | ||
2251 | |||
2252 | if (mask & ~PAGE_MASK) { | ||
2229 | nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); | 2253 | nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); |
2230 | nes_debug(NES_DBG_MR, "Invalid Buffer Size\n"); | 2254 | nes_debug(NES_DBG_MR, "Invalid buffer addr or size\n"); |
2231 | ibmr = ERR_PTR(-EINVAL); | 2255 | ibmr = ERR_PTR(-EINVAL); |
2232 | kfree(nesmr); | 2256 | kfree(nesmr); |
2233 | goto reg_phys_err; | 2257 | goto reg_phys_err; |
@@ -2238,7 +2262,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, | |||
2238 | if ((buffer_list[i-1].addr+PAGE_SIZE) != buffer_list[i].addr) | 2262 | if ((buffer_list[i-1].addr+PAGE_SIZE) != buffer_list[i].addr) |
2239 | single_page = 0; | 2263 | single_page = 0; |
2240 | } | 2264 | } |
2241 | vpbl.pbl_vbase[cur_pbl_index].pa_low = cpu_to_le32((u32)buffer_list[i].addr); | 2265 | vpbl.pbl_vbase[cur_pbl_index].pa_low = cpu_to_le32((u32)buffer_list[i].addr & PAGE_MASK); |
2242 | vpbl.pbl_vbase[cur_pbl_index++].pa_high = | 2266 | vpbl.pbl_vbase[cur_pbl_index++].pa_high = |
2243 | cpu_to_le32((u32)((((u64)buffer_list[i].addr) >> 32))); | 2267 | cpu_to_le32((u32)((((u64)buffer_list[i].addr) >> 32))); |
2244 | } | 2268 | } |
@@ -2251,8 +2275,6 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, | |||
2251 | " length = 0x%016lX, index = 0x%08X\n", | 2275 | " length = 0x%016lX, index = 0x%08X\n", |
2252 | stag, (unsigned long)*iova_start, (unsigned long)region_length, stag_index); | 2276 | stag, (unsigned long)*iova_start, (unsigned long)region_length, stag_index); |
2253 | 2277 | ||
2254 | region_length -= (*iova_start)&PAGE_MASK; | ||
2255 | |||
2256 | /* Make the leaf PBL the root if only one PBL */ | 2278 | /* Make the leaf PBL the root if only one PBL */ |
2257 | if (root_pbl_index == 1) { | 2279 | if (root_pbl_index == 1) { |
2258 | root_vpbl.pbl_pbase = vpbl.pbl_pbase; | 2280 | root_vpbl.pbl_pbase = vpbl.pbl_pbase; |
@@ -2786,10 +2808,9 @@ static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr, | |||
2786 | struct nes_vnic *nesvnic = nesibdev->nesvnic; | 2808 | struct nes_vnic *nesvnic = nesibdev->nesvnic; |
2787 | 2809 | ||
2788 | nes_debug(NES_DBG_INIT, "\n"); | 2810 | nes_debug(NES_DBG_INIT, "\n"); |
2789 | return sprintf(buf, "%x.%x.%x\n", | 2811 | return sprintf(buf, "%u.%u\n", |
2790 | (int)(nesvnic->nesdev->nesadapter->fw_ver >> 32), | 2812 | (nesvnic->nesdev->nesadapter->firmware_version >> 16), |
2791 | (int)(nesvnic->nesdev->nesadapter->fw_ver >> 16) & 0xffff, | 2813 | (nesvnic->nesdev->nesadapter->firmware_version & 0x000000ff)); |
2792 | (int)(nesvnic->nesdev->nesadapter->fw_ver & 0xffff)); | ||
2793 | } | 2814 | } |
2794 | 2815 | ||
2795 | 2816 | ||
diff --git a/drivers/infiniband/hw/nes/nes_verbs.h b/drivers/infiniband/hw/nes/nes_verbs.h index 5e48f67fbe8d..41c07f29f7c9 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.h +++ b/drivers/infiniband/hw/nes/nes_verbs.h | |||
@@ -112,6 +112,7 @@ struct nes_cq { | |||
112 | spinlock_t lock; | 112 | spinlock_t lock; |
113 | u8 virtual_cq; | 113 | u8 virtual_cq; |
114 | u8 pad[3]; | 114 | u8 pad[3]; |
115 | u32 mcrqf; | ||
115 | }; | 116 | }; |
116 | 117 | ||
117 | struct nes_wq { | 118 | struct nes_wq { |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index da6082739839..e7e5adf84e84 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -685,7 +685,8 @@ int ipoib_ib_dev_open(struct net_device *dev) | |||
685 | queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task, | 685 | queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task, |
686 | round_jiffies_relative(HZ)); | 686 | round_jiffies_relative(HZ)); |
687 | 687 | ||
688 | set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); | 688 | if (!test_and_set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) |
689 | napi_enable(&priv->napi); | ||
689 | 690 | ||
690 | return 0; | 691 | return 0; |
691 | } | 692 | } |
@@ -804,7 +805,8 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush) | |||
804 | struct ipoib_tx_buf *tx_req; | 805 | struct ipoib_tx_buf *tx_req; |
805 | int i; | 806 | int i; |
806 | 807 | ||
807 | clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); | 808 | if (test_and_clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) |
809 | napi_disable(&priv->napi); | ||
808 | 810 | ||
809 | ipoib_cm_dev_stop(dev); | 811 | ipoib_cm_dev_stop(dev); |
810 | 812 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 421a6640c9bd..ab2c192c76bc 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -106,8 +106,7 @@ int ipoib_open(struct net_device *dev) | |||
106 | 106 | ||
107 | ipoib_dbg(priv, "bringing up interface\n"); | 107 | ipoib_dbg(priv, "bringing up interface\n"); |
108 | 108 | ||
109 | if (!test_and_set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) | 109 | set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); |
110 | napi_enable(&priv->napi); | ||
111 | 110 | ||
112 | if (ipoib_pkey_dev_delay_open(dev)) | 111 | if (ipoib_pkey_dev_delay_open(dev)) |
113 | return 0; | 112 | return 0; |
@@ -143,7 +142,6 @@ err_stop: | |||
143 | ipoib_ib_dev_stop(dev, 1); | 142 | ipoib_ib_dev_stop(dev, 1); |
144 | 143 | ||
145 | err_disable: | 144 | err_disable: |
146 | napi_disable(&priv->napi); | ||
147 | clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); | 145 | clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); |
148 | 146 | ||
149 | return -EINVAL; | 147 | return -EINVAL; |
@@ -156,7 +154,6 @@ static int ipoib_stop(struct net_device *dev) | |||
156 | ipoib_dbg(priv, "stopping interface\n"); | 154 | ipoib_dbg(priv, "stopping interface\n"); |
157 | 155 | ||
158 | clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); | 156 | clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); |
159 | napi_disable(&priv->napi); | ||
160 | 157 | ||
161 | netif_stop_queue(dev); | 158 | netif_stop_queue(dev); |
162 | 159 | ||
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 102bac90a302..30bea9689694 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -976,7 +976,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev) | |||
976 | nreq = err; | 976 | nreq = err; |
977 | goto retry; | 977 | goto retry; |
978 | } | 978 | } |
979 | 979 | kfree(entries); | |
980 | goto no_msi; | 980 | goto no_msi; |
981 | } | 981 | } |
982 | 982 | ||