Commit c2e2ceea authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (21 commits)
  RDMA/nes: Update iw_nes version
  RDMA/nes: Fix error path in nes_accept()
  RDMA/nes: Fix hang issues for large cluster dynamic connections
  RDMA/nes: Increase rexmit timeout interval
  RDMA/nes: Check for sequence number wrap-around
  RDMA/nes: Do not set apbvt entry for loopback
  RDMA/nes: Fix unused variable compile warning when INFINIBAND_NES_DEBUG=n
  RDMA/nes: Fix fw_ver in /sys
  RDMA/nes: Set trace length to 1 inch for SFP_D
  RDMA/nes: Enable repause timer for port 1
  RDMA/nes: Correct CDR loop filter setting for port 1
  RDMA/nes: Modify thermo mitigation to flip SerDes1 ref clk to internal
  RDMA/nes: Fix resource issues in nes_create_cq() and nes_destroy_cq()
  RDMA/nes: Remove root_256()'s unused pbl_count_256 parameter
  mlx4_core: Fix memory leak in mlx4_enable_msi_x()
  IB/mthca: Fix timeout for INIT_HCA and a few other commands
  RDMA/cxgb3: Don't zero QP attrs when moving to IDLE
  RDMA/nes: Fix bugs in nes_reg_phys_mr()
  RDMA/nes: Fix compiler warning at nes_verbs.c:1955
  IPoIB: Disable NAPI while CQ is being drained
  ...
parents 16752e2e 9308f96c
...@@ -1830,6 +1830,10 @@ int iwch_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -1830,6 +1830,10 @@ int iwch_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
ep->com.rpl_err = 0; ep->com.rpl_err = 0;
ep->ird = conn_param->ird; ep->ird = conn_param->ird;
ep->ord = conn_param->ord; ep->ord = conn_param->ord;
if (peer2peer && ep->ird == 0)
ep->ird = 1;
PDBG("%s %d ird %d ord %d\n", __func__, __LINE__, ep->ird, ep->ord); PDBG("%s %d ird %d ord %d\n", __func__, __LINE__, ep->ird, ep->ord);
get_ep(&ep->com); get_ep(&ep->com);
...@@ -1915,6 +1919,10 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -1915,6 +1919,10 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
conn_param->private_data, ep->plen); conn_param->private_data, ep->plen);
ep->ird = conn_param->ird; ep->ird = conn_param->ird;
ep->ord = conn_param->ord; ep->ord = conn_param->ord;
if (peer2peer && ep->ord == 0)
ep->ord = 1;
ep->com.tdev = h->rdev.t3cdev_p; ep->com.tdev = h->rdev.t3cdev_p;
cm_id->add_ref(cm_id); cm_id->add_ref(cm_id);
......
...@@ -1069,7 +1069,6 @@ int iwch_modify_qp(struct iwch_dev *rhp, struct iwch_qp *qhp, ...@@ -1069,7 +1069,6 @@ int iwch_modify_qp(struct iwch_dev *rhp, struct iwch_qp *qhp,
goto out; goto out;
} }
qhp->attr.state = IWCH_QP_STATE_IDLE; qhp->attr.state = IWCH_QP_STATE_IDLE;
memset(&qhp->attr, 0, sizeof(qhp->attr));
break; break;
case IWCH_QP_STATE_TERMINATE: case IWCH_QP_STATE_TERMINATE:
if (!internal) { if (!internal) {
......
...@@ -157,13 +157,15 @@ enum { ...@@ -157,13 +157,15 @@ enum {
enum { enum {
CMD_TIME_CLASS_A = (HZ + 999) / 1000 + 1, CMD_TIME_CLASS_A = (HZ + 999) / 1000 + 1,
CMD_TIME_CLASS_B = (HZ + 99) / 100 + 1, CMD_TIME_CLASS_B = (HZ + 99) / 100 + 1,
CMD_TIME_CLASS_C = (HZ + 9) / 10 + 1 CMD_TIME_CLASS_C = (HZ + 9) / 10 + 1,
CMD_TIME_CLASS_D = 60 * HZ
}; };
#else #else
enum { enum {
CMD_TIME_CLASS_A = 60 * HZ, CMD_TIME_CLASS_A = 60 * HZ,
CMD_TIME_CLASS_B = 60 * HZ, CMD_TIME_CLASS_B = 60 * HZ,
CMD_TIME_CLASS_C = 60 * HZ CMD_TIME_CLASS_C = 60 * HZ,
CMD_TIME_CLASS_D = 60 * HZ
}; };
#endif #endif
...@@ -598,7 +600,7 @@ int mthca_SYS_EN(struct mthca_dev *dev, u8 *status) ...@@ -598,7 +600,7 @@ int mthca_SYS_EN(struct mthca_dev *dev, u8 *status)
u64 out; u64 out;
int ret; int ret;
ret = mthca_cmd_imm(dev, 0, &out, 0, 0, CMD_SYS_EN, HZ, status); ret = mthca_cmd_imm(dev, 0, &out, 0, 0, CMD_SYS_EN, CMD_TIME_CLASS_D, status);
if (*status == MTHCA_CMD_STAT_DDR_MEM_ERR) if (*status == MTHCA_CMD_STAT_DDR_MEM_ERR)
mthca_warn(dev, "SYS_EN DDR error: syn=%x, sock=%d, " 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,7 +613,7 @@ int mthca_SYS_EN(struct mthca_dev *dev, u8 *status)
int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status) int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status)
{ {
return mthca_cmd(dev, 0, 0, 0, CMD_SYS_DIS, HZ, status); return mthca_cmd(dev, 0, 0, 0, CMD_SYS_DIS, CMD_TIME_CLASS_C, status);
} }
static int mthca_map_cmd(struct mthca_dev *dev, u16 op, struct mthca_icm *icm, 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,7 +1392,7 @@ int mthca_INIT_HCA(struct mthca_dev *dev,
MTHCA_PUT(inbox, param->uarc_base, INIT_HCA_UAR_CTX_BASE_OFFSET); MTHCA_PUT(inbox, param->uarc_base, INIT_HCA_UAR_CTX_BASE_OFFSET);
} }
err = mthca_cmd(dev, mailbox->dma, 0, 0, CMD_INIT_HCA, HZ, status); err = mthca_cmd(dev, mailbox->dma, 0, 0, CMD_INIT_HCA, CMD_TIME_CLASS_D, status);
mthca_free_mailbox(dev, mailbox); mthca_free_mailbox(dev, mailbox);
return err; return err;
...@@ -1450,12 +1452,12 @@ int mthca_INIT_IB(struct mthca_dev *dev, ...@@ -1450,12 +1452,12 @@ int mthca_INIT_IB(struct mthca_dev *dev,
int mthca_CLOSE_IB(struct mthca_dev *dev, int port, u8 *status) int mthca_CLOSE_IB(struct mthca_dev *dev, int port, u8 *status)
{ {
return mthca_cmd(dev, 0, port, 0, CMD_CLOSE_IB, HZ, status); return mthca_cmd(dev, 0, port, 0, CMD_CLOSE_IB, CMD_TIME_CLASS_A, status);
} }
int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic, u8 *status) int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic, u8 *status)
{ {
return mthca_cmd(dev, 0, 0, panic, CMD_CLOSE_HCA, HZ, status); return mthca_cmd(dev, 0, 0, panic, CMD_CLOSE_HCA, CMD_TIME_CLASS_C, status);
} }
int mthca_SET_IB(struct mthca_dev *dev, struct mthca_set_ib_param *param, int mthca_SET_IB(struct mthca_dev *dev, struct mthca_set_ib_param *param,
......
...@@ -56,10 +56,8 @@ ...@@ -56,10 +56,8 @@
#define QUEUE_DISCONNECTS #define QUEUE_DISCONNECTS
#define DRV_BUILD "1"
#define DRV_NAME "iw_nes" #define DRV_NAME "iw_nes"
#define DRV_VERSION "1.0 KO Build " DRV_BUILD #define DRV_VERSION "1.5.0.0"
#define PFX DRV_NAME ": " #define PFX DRV_NAME ": "
/* /*
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include <net/neighbour.h> #include <net/neighbour.h>
#include <net/route.h> #include <net/route.h>
#include <net/ip_fib.h> #include <net/ip_fib.h>
#include <net/tcp.h>
#include "nes.h" #include "nes.h"
...@@ -540,6 +541,7 @@ static void nes_cm_timer_tick(unsigned long pass) ...@@ -540,6 +541,7 @@ static void nes_cm_timer_tick(unsigned long pass)
struct list_head *list_node; struct list_head *list_node;
struct nes_cm_core *cm_core = g_cm_core; struct nes_cm_core *cm_core = g_cm_core;
u32 settimer = 0; u32 settimer = 0;
unsigned long timetosend;
int ret = NETDEV_TX_OK; int ret = NETDEV_TX_OK;
struct list_head timer_list; struct list_head timer_list;
...@@ -644,8 +646,11 @@ static void nes_cm_timer_tick(unsigned long pass) ...@@ -644,8 +646,11 @@ static void nes_cm_timer_tick(unsigned long pass)
send_entry->retrycount); send_entry->retrycount);
if (send_entry->send_retrans) { if (send_entry->send_retrans) {
send_entry->retranscount--; send_entry->retranscount--;
timetosend = (NES_RETRY_TIMEOUT <<
(NES_DEFAULT_RETRANS - send_entry->retranscount));
send_entry->timetosend = jiffies + send_entry->timetosend = jiffies +
NES_RETRY_TIMEOUT; min(timetosend, NES_MAX_TIMEOUT);
if (nexttimeout > send_entry->timetosend || if (nexttimeout > send_entry->timetosend ||
!settimer) { !settimer) {
nexttimeout = send_entry->timetosend; nexttimeout = send_entry->timetosend;
...@@ -854,7 +859,6 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, ...@@ -854,7 +859,6 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
{ {
unsigned long flags; unsigned long flags;
struct nes_cm_listener *listen_node; struct nes_cm_listener *listen_node;
__be32 tmp_addr = cpu_to_be32(dst_addr);
/* walk list and find cm_node associated with this session ID */ /* walk list and find cm_node associated with this session ID */
spin_lock_irqsave(&cm_core->listen_list_lock, flags); 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,9 +875,6 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
} }
spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); spin_unlock_irqrestore(&cm_core->listen_list_lock, flags);
nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n",
&tmp_addr, dst_port);
/* no listener */ /* no listener */
return NULL; return NULL;
} }
...@@ -1325,18 +1326,20 @@ static void handle_fin_pkt(struct nes_cm_node *cm_node) ...@@ -1325,18 +1326,20 @@ static void handle_fin_pkt(struct nes_cm_node *cm_node)
nes_debug(NES_DBG_CM, "Received FIN, cm_node = %p, state = %u. " nes_debug(NES_DBG_CM, "Received FIN, cm_node = %p, state = %u. "
"refcnt=%d\n", cm_node, cm_node->state, "refcnt=%d\n", cm_node, cm_node->state,
atomic_read(&cm_node->ref_count)); atomic_read(&cm_node->ref_count));
cm_node->tcp_cntxt.rcv_nxt++;
cleanup_retrans_entry(cm_node);
switch (cm_node->state) { switch (cm_node->state) {
case NES_CM_STATE_SYN_RCVD: case NES_CM_STATE_SYN_RCVD:
case NES_CM_STATE_SYN_SENT: case NES_CM_STATE_SYN_SENT:
case NES_CM_STATE_ESTABLISHED: case NES_CM_STATE_ESTABLISHED:
case NES_CM_STATE_MPAREQ_SENT: case NES_CM_STATE_MPAREQ_SENT:
case NES_CM_STATE_MPAREJ_RCVD: case NES_CM_STATE_MPAREJ_RCVD:
cm_node->tcp_cntxt.rcv_nxt++;
cleanup_retrans_entry(cm_node);
cm_node->state = NES_CM_STATE_LAST_ACK; cm_node->state = NES_CM_STATE_LAST_ACK;
send_fin(cm_node, NULL); send_fin(cm_node, NULL);
break; break;
case NES_CM_STATE_FIN_WAIT1: case NES_CM_STATE_FIN_WAIT1:
cm_node->tcp_cntxt.rcv_nxt++;
cleanup_retrans_entry(cm_node);
cm_node->state = NES_CM_STATE_CLOSING; cm_node->state = NES_CM_STATE_CLOSING;
send_ack(cm_node, NULL); send_ack(cm_node, NULL);
/* Wait for ACK as this is simultanous close.. /* Wait for ACK as this is simultanous close..
...@@ -1344,11 +1347,15 @@ static void handle_fin_pkt(struct nes_cm_node *cm_node) ...@@ -1344,11 +1347,15 @@ static void handle_fin_pkt(struct nes_cm_node *cm_node)
* Just rm the node.. Done.. */ * Just rm the node.. Done.. */
break; break;
case NES_CM_STATE_FIN_WAIT2: case NES_CM_STATE_FIN_WAIT2:
cm_node->tcp_cntxt.rcv_nxt++;
cleanup_retrans_entry(cm_node);
cm_node->state = NES_CM_STATE_TIME_WAIT; cm_node->state = NES_CM_STATE_TIME_WAIT;
send_ack(cm_node, NULL); send_ack(cm_node, NULL);
schedule_nes_timer(cm_node, NULL, NES_TIMER_TYPE_CLOSE, 1, 0); schedule_nes_timer(cm_node, NULL, NES_TIMER_TYPE_CLOSE, 1, 0);
break; break;
case NES_CM_STATE_TIME_WAIT: case NES_CM_STATE_TIME_WAIT:
cm_node->tcp_cntxt.rcv_nxt++;
cleanup_retrans_entry(cm_node);
cm_node->state = NES_CM_STATE_CLOSED; cm_node->state = NES_CM_STATE_CLOSED;
rem_ref_cm_node(cm_node->cm_core, cm_node); rem_ref_cm_node(cm_node->cm_core, cm_node);
break; break;
...@@ -1384,7 +1391,6 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, ...@@ -1384,7 +1391,6 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
passive_state = atomic_add_return(1, &cm_node->passive_state); passive_state = atomic_add_return(1, &cm_node->passive_state);
if (passive_state == NES_SEND_RESET_EVENT) if (passive_state == NES_SEND_RESET_EVENT)
create_event(cm_node, NES_CM_EVENT_RESET); create_event(cm_node, NES_CM_EVENT_RESET);
cleanup_retrans_entry(cm_node);
cm_node->state = NES_CM_STATE_CLOSED; cm_node->state = NES_CM_STATE_CLOSED;
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
break; break;
...@@ -1398,17 +1404,16 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, ...@@ -1398,17 +1404,16 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
active_open_err(cm_node, skb, reset); active_open_err(cm_node, skb, reset);
break; break;
case NES_CM_STATE_CLOSED: case NES_CM_STATE_CLOSED:
cleanup_retrans_entry(cm_node);
drop_packet(skb); drop_packet(skb);
break; break;
case NES_CM_STATE_LAST_ACK:
cm_node->cm_id->rem_ref(cm_node->cm_id);
case NES_CM_STATE_TIME_WAIT: case NES_CM_STATE_TIME_WAIT:
cleanup_retrans_entry(cm_node);
cm_node->state = NES_CM_STATE_CLOSED; cm_node->state = NES_CM_STATE_CLOSED;
rem_ref_cm_node(cm_node->cm_core, cm_node); rem_ref_cm_node(cm_node->cm_core, cm_node);
drop_packet(skb); drop_packet(skb);
break; break;
case NES_CM_STATE_FIN_WAIT1: case NES_CM_STATE_FIN_WAIT1:
cleanup_retrans_entry(cm_node);
nes_debug(NES_DBG_CM, "Bad state %s[%u]\n", __func__, __LINE__); nes_debug(NES_DBG_CM, "Bad state %s[%u]\n", __func__, __LINE__);
default: default:
drop_packet(skb); drop_packet(skb);
...@@ -1455,6 +1460,7 @@ static void handle_rcv_mpa(struct nes_cm_node *cm_node, struct sk_buff *skb) ...@@ -1455,6 +1460,7 @@ static void handle_rcv_mpa(struct nes_cm_node *cm_node, struct sk_buff *skb)
NES_PASSIVE_STATE_INDICATED); NES_PASSIVE_STATE_INDICATED);
break; break;
case NES_CM_STATE_MPAREQ_SENT: case NES_CM_STATE_MPAREQ_SENT:
cleanup_retrans_entry(cm_node);
if (res_type == NES_MPA_REQUEST_REJECT) { if (res_type == NES_MPA_REQUEST_REJECT) {
type = NES_CM_EVENT_MPA_REJECT; type = NES_CM_EVENT_MPA_REJECT;
cm_node->state = NES_CM_STATE_MPAREJ_RCVD; 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,7 +1524,7 @@ static int check_seq(struct nes_cm_node *cm_node, struct tcphdr *tcph,
rcv_wnd = cm_node->tcp_cntxt.rcv_wnd; rcv_wnd = cm_node->tcp_cntxt.rcv_wnd;
if (ack_seq != loc_seq_num) if (ack_seq != loc_seq_num)
err = 1; err = 1;
else if ((seq + rcv_wnd) < rcv_nxt) else if (!between(seq, rcv_nxt, (rcv_nxt+rcv_wnd)))
err = 1; err = 1;
if (err) { if (err) {
nes_debug(NES_DBG_CM, "%s[%u] create abort for cm_node=%p " 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,49 +1658,39 @@ static void handle_synack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
} }
} }
static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, static int handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
struct tcphdr *tcph) struct tcphdr *tcph)
{ {
int datasize = 0; int datasize = 0;
u32 inc_sequence; u32 inc_sequence;
u32 rem_seq_ack; u32 rem_seq_ack;
u32 rem_seq; u32 rem_seq;
int ret; int ret = 0;
int optionsize; int optionsize;
optionsize = (tcph->doff << 2) - sizeof(struct tcphdr); optionsize = (tcph->doff << 2) - sizeof(struct tcphdr);
if (check_seq(cm_node, tcph, skb)) if (check_seq(cm_node, tcph, skb))
return; return -EINVAL;
skb_pull(skb, tcph->doff << 2); skb_pull(skb, tcph->doff << 2);
inc_sequence = ntohl(tcph->seq); inc_sequence = ntohl(tcph->seq);
rem_seq = ntohl(tcph->seq); rem_seq = ntohl(tcph->seq);
rem_seq_ack = ntohl(tcph->ack_seq); rem_seq_ack = ntohl(tcph->ack_seq);
datasize = skb->len; datasize = skb->len;
cleanup_retrans_entry(cm_node);
switch (cm_node->state) { switch (cm_node->state) {
case NES_CM_STATE_SYN_RCVD: case NES_CM_STATE_SYN_RCVD:
/* Passive OPEN */ /* Passive OPEN */
cleanup_retrans_entry(cm_node);
ret = handle_tcp_options(cm_node, tcph, skb, optionsize, 1); ret = handle_tcp_options(cm_node, tcph, skb, optionsize, 1);
if (ret) if (ret)
break; break;
cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq);
if (cm_node->tcp_cntxt.rem_ack_num !=
cm_node->tcp_cntxt.loc_seq_num) {
nes_debug(NES_DBG_CM, "rem_ack_num != loc_seq_num\n");
cleanup_retrans_entry(cm_node);
send_reset(cm_node, skb);
return;
}
cm_node->state = NES_CM_STATE_ESTABLISHED; cm_node->state = NES_CM_STATE_ESTABLISHED;
cleanup_retrans_entry(cm_node);
if (datasize) { if (datasize) {
cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize;
handle_rcv_mpa(cm_node, skb); handle_rcv_mpa(cm_node, skb);
} else { /* rcvd ACK only */ } else /* rcvd ACK only */
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
cleanup_retrans_entry(cm_node);
}
break; break;
case NES_CM_STATE_ESTABLISHED: case NES_CM_STATE_ESTABLISHED:
/* Passive OPEN */ /* Passive OPEN */
...@@ -1706,15 +1702,12 @@ static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, ...@@ -1706,15 +1702,12 @@ static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
drop_packet(skb); drop_packet(skb);
break; break;
case NES_CM_STATE_MPAREQ_SENT: case NES_CM_STATE_MPAREQ_SENT:
cleanup_retrans_entry(cm_node);
cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq);
if (datasize) { if (datasize) {
cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize;
handle_rcv_mpa(cm_node, skb); handle_rcv_mpa(cm_node, skb);
} else { /* Could be just an ack pkt.. */ } else /* Could be just an ack pkt.. */
cleanup_retrans_entry(cm_node);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
}
break; break;
case NES_CM_STATE_LISTENING: case NES_CM_STATE_LISTENING:
case NES_CM_STATE_CLOSED: 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,11 +1715,10 @@ static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
send_reset(cm_node, skb); send_reset(cm_node, skb);
break; break;
case NES_CM_STATE_LAST_ACK: case NES_CM_STATE_LAST_ACK:
case NES_CM_STATE_CLOSING:
cleanup_retrans_entry(cm_node); cleanup_retrans_entry(cm_node);
cm_node->state = NES_CM_STATE_CLOSED; cm_node->state = NES_CM_STATE_CLOSED;
cm_node->cm_id->rem_ref(cm_node->cm_id); cm_node->cm_id->rem_ref(cm_node->cm_id);
case NES_CM_STATE_CLOSING:
cleanup_retrans_entry(cm_node);
rem_ref_cm_node(cm_node->cm_core, cm_node); rem_ref_cm_node(cm_node->cm_core, cm_node);
drop_packet(skb); drop_packet(skb);
break; break;
...@@ -1741,9 +1733,11 @@ static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, ...@@ -1741,9 +1733,11 @@ static void handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
case NES_CM_STATE_MPAREQ_RCVD: case NES_CM_STATE_MPAREQ_RCVD:
case NES_CM_STATE_UNKNOWN: case NES_CM_STATE_UNKNOWN:
default: default:
cleanup_retrans_entry(cm_node);
drop_packet(skb); drop_packet(skb);
break; break;
} }
return ret;
} }
...@@ -1849,6 +1843,7 @@ static void process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb, ...@@ -1849,6 +1843,7 @@ static void process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb,
enum nes_tcpip_pkt_type pkt_type = NES_PKT_TYPE_UNKNOWN; enum nes_tcpip_pkt_type pkt_type = NES_PKT_TYPE_UNKNOWN;
struct tcphdr *tcph = tcp_hdr(skb); struct tcphdr *tcph = tcp_hdr(skb);
u32 fin_set = 0; u32 fin_set = 0;
int ret = 0;
skb_pull(skb, ip_hdr(skb)->ihl << 2); skb_pull(skb, ip_hdr(skb)->ihl << 2);
nes_debug(NES_DBG_CM, "process_packet: cm_node=%p state =%d syn=%d " 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,17 +1869,17 @@ static void process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb,
handle_synack_pkt(cm_node, skb, tcph); handle_synack_pkt(cm_node, skb, tcph);
break; break;
case NES_PKT_TYPE_ACK: case NES_PKT_TYPE_ACK:
handle_ack_pkt(cm_node, skb, tcph); ret = handle_ack_pkt(cm_node, skb, tcph);
if (fin_set) if (fin_set && !ret)
handle_fin_pkt(cm_node); handle_fin_pkt(cm_node);
break; break;
case NES_PKT_TYPE_RST: case NES_PKT_TYPE_RST:
handle_rst_pkt(cm_node, skb, tcph); handle_rst_pkt(cm_node, skb, tcph);
break; break;
default: default:
drop_packet(skb); if ((fin_set) && (!check_seq(cm_node, tcph, skb)))
if (fin_set)
handle_fin_pkt(cm_node); handle_fin_pkt(cm_node);
drop_packet(skb);
break; break;
} }
} }
...@@ -2710,7 +2705,6 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -2710,7 +2705,6 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
/* associate the node with the QP */ /* associate the node with the QP */
nesqp->cm_node = (void *)cm_node; nesqp->cm_node = (void *)cm_node;
cm_node->nesqp = nesqp; cm_node->nesqp = nesqp;
nes_add_ref(&nesqp->ibqp);
nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n", nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n",
nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener); 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,6 +2757,9 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
nes_debug(NES_DBG_CM, "Unable to register memory region" nes_debug(NES_DBG_CM, "Unable to register memory region"
"for lSMM for cm_node = %p \n", "for lSMM for cm_node = %p \n",
cm_node); cm_node);
pci_free_consistent(nesdev->pcidev,
nesqp->private_data_len+sizeof(struct ietf_mpa_frame),
nesqp->ietf_frame, nesqp->ietf_frame_pbase);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2879,6 +2876,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -2879,6 +2876,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
/* notify OF layer that accept event was successful */ /* notify OF layer that accept event was successful */
cm_id->add_ref(cm_id); cm_id->add_ref(cm_id);
nes_add_ref(&nesqp->ibqp);
cm_event.event = IW_CM_EVENT_ESTABLISHED; cm_event.event = IW_CM_EVENT_ESTABLISHED;
cm_event.status = IW_CM_EVENT_STATUS_ACCEPTED; 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,6 +2957,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
struct nes_device *nesdev; struct nes_device *nesdev;
struct nes_cm_node *cm_node; struct nes_cm_node *cm_node;
struct nes_cm_info cm_info; struct nes_cm_info cm_info;
int apbvt_set = 0;
ibqp = nes_get_qp(cm_id->device, conn_param->qpn); ibqp = nes_get_qp(cm_id->device, conn_param->qpn);
if (!ibqp) if (!ibqp)
...@@ -2996,9 +2995,11 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -2996,9 +2995,11 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
conn_param->private_data_len); conn_param->private_data_len);
if (cm_id->local_addr.sin_addr.s_addr != if (cm_id->local_addr.sin_addr.s_addr !=
cm_id->remote_addr.sin_addr.s_addr) cm_id->remote_addr.sin_addr.s_addr) {
nes_manage_apbvt(nesvnic, ntohs(cm_id->local_addr.sin_port), nes_manage_apbvt(nesvnic, ntohs(cm_id->local_addr.sin_port),
PCI_FUNC(nesdev->pcidev->devfn), NES_MANAGE_APBVT_ADD); PCI_FUNC(nesdev->pcidev->devfn), NES_MANAGE_APBVT_ADD);
apbvt_set = 1;
}
/* set up the connection params for the node */ /* set up the connection params for the node */
cm_info.loc_addr = htonl(cm_id->local_addr.sin_addr.s_addr); 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,8 +3016,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
conn_param->private_data_len, (void *)conn_param->private_data, conn_param->private_data_len, (void *)conn_param->private_data,
&cm_info); &cm_info);
if (!cm_node) { if (!cm_node) {
if (cm_id->local_addr.sin_addr.s_addr != if (apbvt_set)
cm_id->remote_addr.sin_addr.s_addr)
nes_manage_apbvt(nesvnic, ntohs(cm_id->local_addr.sin_port), nes_manage_apbvt(nesvnic, ntohs(cm_id->local_addr.sin_port),
PCI_FUNC(nesdev->pcidev->devfn), PCI_FUNC(nesdev->pcidev->devfn),
NES_MANAGE_APBVT_DEL); 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,7 +3025,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
return -ENOMEM; return -ENOMEM;
} }
cm_node->apbvt_set = 1; cm_node->apbvt_set = apbvt_set;
nesqp->cm_node = cm_node; nesqp->cm_node = cm_node;
cm_node->nesqp = nesqp; cm_node->nesqp = nesqp;
nes_add_ref(&nesqp->ibqp); nes_add_ref(&nesqp->ibqp);
......
...@@ -149,6 +149,7 @@ struct nes_timer_entry { ...@@ -149,6 +149,7 @@ struct nes_timer_entry {
#endif #endif
#define NES_SHORT_TIME (10) #define NES_SHORT_TIME (10)
#define NES_LONG_TIME (2000*HZ/1000) #define NES_LONG_TIME (2000*HZ/1000)
#define NES_MAX_TIMEOUT ((unsigned long) (12*HZ))
#define NES_CM_HASHTABLE_SIZE 1024 #define NES_CM_HASHTABLE_SIZE 1024
#define NES_CM_TCP_TIMER_INTERVAL 3000 #define NES_CM_TCP_TIMER_INTERVAL 3000
......
...@@ -550,11 +550,8 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { ...@@ -550,11 +550,8 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) {
msleep(1); msleep(1);
} }
if (int_cnt > 1) { if (int_cnt > 1) {
u32 sds;
spin_lock_irqsave(&nesadapter->phy_lock, flags); spin_lock_irqsave(&nesadapter->phy_lock, flags);
sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, 0x0000F0C8);
sds |= 0x00000040;
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds);
mh_detected++; mh_detected++;
reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET);
reset_value |= 0x0000003d; reset_value |= 0x0000003d;
...@@ -579,7 +576,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { ...@@ -579,7 +576,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) {
if (++ext_cnt > int_cnt) { if (++ext_cnt > int_cnt) {
spin_lock_irqsave(&nesadapter->phy_lock, flags); spin_lock_irqsave(&nesadapter->phy_lock, flags);
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1,
0x0000F0C8); 0x0000F088);
mh_detected++; mh_detected++;
reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET);
reset_value |= 0x0000003d; reset_value |= 0x0000003d;
...@@ -764,6 +761,9 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count, ...@@ -764,6 +761,9 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count,
return 0; return 0;
/* init serdes 1 */ /* init serdes 1 */
if (!(OneG_Mode && (nesadapter->phy_type[1] != NES_PHY_TYPE_PUMA_1G)))
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000000FF);
switch (nesadapter->phy_type[1]) { switch (nesadapter->phy_type[1]) {
case NES_PHY_TYPE_ARGUS: case NES_PHY_TYPE_ARGUS:
case NES_PHY_TYPE_SFP_D: 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,21 +771,20 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count,
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_EMP1, 0x00000000); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_EMP1, 0x00000000);
break; break;
case NES_PHY_TYPE_CX4: case NES_PHY_TYPE_CX4:
sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1);
sds &= 0xFFFFFFBF;
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds);
if (wide_ppm_offset) if (wide_ppm_offset)
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000FFFAA); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000FFFAA);
else
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000000FF);
break; break;
case NES_PHY_TYPE_PUMA_1G: case NES_PHY_TYPE_PUMA_1G:
sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1);
sds |= 0x000000100; sds |= 0x000000100;
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds);
} }
if (!OneG_Mode) if (!OneG_Mode) {
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE1, 0x11110000); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE1, 0x11110000);
sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1);
sds &= 0xFFFFFFBF;
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds);
}
} else { } else {
/* init serdes 0 */ /* init serdes 0 */
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, 0x00000008); 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,6 +912,12 @@ static void nes_init_csr_ne020(struct nes_device *nesdev, u8 hw_rev, u8 port_cou
u32temp &= 0x7fffffff; u32temp &= 0x7fffffff;
u32temp |= 0x7fff0010; u32temp |= 0x7fff0010;
nes_write_indexed(nesdev, 0x000021f8, u32temp); nes_write_indexed(nesdev, 0x000021f8, u32temp);
if (port_count > 1) {
u32temp = nes_read_indexed(nesdev, 0x000023f8);
u32temp &= 0x7fffffff;
u32temp |= 0x7fff0010;
nes_write_indexed(nesdev, 0x000023f8, u32temp);
}
} }
} }
...@@ -1366,13 +1371,14 @@ int nes_init_phy(struct nes_device *nesdev) ...@@ -1366,13 +1371,14 @@ int nes_init_phy(struct nes_device *nesdev)
if (phy_type == NES_PHY_TYPE_ARGUS) { if (phy_type == NES_PHY_TYPE_ARGUS) {
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x000C); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x000C);
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0008); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0008);
nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0001);
} else { } else {
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x0004); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x0004);
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0038); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0038);
nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0013);
} }
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc31a, 0x0098); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc31a, 0x0098);
nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0026, 0x0E00); nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0026, 0x0E00);
nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0001);
/* setup LEDs */ /* setup LEDs */
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd006, 0x0007); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd006, 0x0007);
......
...@@ -1627,6 +1627,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, ...@@ -1627,6 +1627,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
nescq->hw_cq.cq_number = nes_ucontext->mcrqf & 0xffff; nescq->hw_cq.cq_number = nes_ucontext->mcrqf & 0xffff;
else else
nescq->hw_cq.cq_number = nesvnic->mcrq_qp_id + nes_ucontext->mcrqf-1; nescq->hw_cq.cq_number = nesvnic->mcrq_qp_id + nes_ucontext->mcrqf-1;
nescq->mcrqf = nes_ucontext->mcrqf;
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
} }
nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n", 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,6 +1683,12 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
if (!context) if (!context)
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
nescq->hw_cq.cq_pbase); nescq->hw_cq.cq_pbase);
else {
pci_free_consistent(nesdev->pcidev, nespbl->pbl_size,
nespbl->pbl_vbase, nespbl->pbl_pbase);
kfree(nespbl);
}
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
kfree(nescq); kfree(nescq);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1705,6 +1712,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, ...@@ -1705,6 +1712,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
if (!context) if (!context)
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
nescq->hw_cq.cq_pbase); nescq->hw_cq.cq_pbase);
else {
pci_free_consistent(nesdev->pcidev, nespbl->pbl_size,
nespbl->pbl_vbase, nespbl->pbl_pbase);
kfree(nespbl);
}
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
kfree(nescq); kfree(nescq);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1722,6 +1734,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, ...@@ -1722,6 +1734,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
if (!context) if (!context)
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
nescq->hw_cq.cq_pbase); nescq->hw_cq.cq_pbase);
else {
pci_free_consistent(nesdev->pcidev, nespbl->pbl_size,
nespbl->pbl_vbase, nespbl->pbl_pbase);
kfree(nespbl);
}
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
kfree(nescq); kfree(nescq);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1774,6 +1791,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, ...@@ -1774,6 +1791,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
if (!context) if (!context)
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
nescq->hw_cq.cq_pbase); nescq->hw_cq.cq_pbase);
else {
pci_free_consistent(nesdev->pcidev, nespbl->pbl_size,
nespbl->pbl_vbase, nespbl->pbl_pbase);
kfree(nespbl);
}
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
kfree(nescq); kfree(nescq);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
...@@ -1855,7 +1877,9 @@ static int nes_destroy_cq(struct ib_cq *ib_cq) ...@@ -1855,7 +1877,9 @@ static int nes_destroy_cq(struct ib_cq *ib_cq)
set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_OPCODE_IDX, opcode); set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_OPCODE_IDX, opcode);
set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_ID_IDX, set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_ID_IDX,
(nescq->hw_cq.cq_number | ((u32)PCI_FUNC(nesdev->pcidev->devfn) << 16))); (nescq->hw_cq.cq_number | ((u32)PCI_FUNC(nesdev->pcidev->devfn) << 16)));
if (!nescq->mcrqf)
nes_free_resource(nesadapter, nesadapter->allocated_cqs, nescq->hw_cq.cq_number); nes_free_resource(nesadapter, nesadapter->allocated_cqs, nescq->hw_cq.cq_number);
atomic_set(&cqp_request->refcount, 2); atomic_set(&cqp_request->refcount, 2);
nes_post_cqp_request(nesdev, cqp_request); nes_post_cqp_request(nesdev, cqp_request);
...@@ -1895,8 +1919,7 @@ static int nes_destroy_cq(struct ib_cq *ib_cq) ...@@ -1895,8 +1919,7 @@ static int nes_destroy_cq(struct ib_cq *ib_cq)
static u32 root_256(struct nes_device *nesdev, static u32 root_256(struct nes_device *nesdev,
struct nes_root_vpbl *root_vpbl, struct nes_root_vpbl *root_vpbl,
struct nes_root_vpbl *new_root, struct nes_root_vpbl *new_root,
u16 pbl_count_4k, u16 pbl_count_4k)
u16 pbl_count_256)
{ {
u64 leaf_pbl; u64 leaf_pbl;
int i, j, k; int i, j, k;
...@@ -1952,7 +1975,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd, ...@@ -1952,7 +1975,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
int ret; int ret;
struct nes_adapter *nesadapter = nesdev->nesadapter; struct nes_adapter *nesadapter = nesdev->nesadapter;
uint pg_cnt = 0; uint pg_cnt = 0;
u16 pbl_count_256; u16 pbl_count_256 = 0;
u16 pbl_count = 0; u16 pbl_count = 0;
u8 use_256_pbls = 0; u8 use_256_pbls = 0;
u8 use_4k_pbls = 0; u8 use_4k_pbls = 0;
...@@ -2012,7 +2035,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd, ...@@ -2012,7 +2035,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
} }
if (use_256_pbls && use_two_level) { if (use_256_pbls && use_two_level) {
if (root_256(nesdev, root_vpbl, &new_root, pbl_count_4k, pbl_count_256) == 1) { if (root_256(nesdev, root_vpbl, &new_root, pbl_count_4k) == 1) {
if (new_root.pbl_pbase != 0) if (new_root.pbl_pbase != 0)
root_vpbl = &new_root; root_vpbl = &new_root;
} else { } else {
...@@ -2122,6 +2145,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2122,6 +2145,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
struct nes_root_vpbl root_vpbl; struct nes_root_vpbl root_vpbl;
u32 stag; u32 stag;
u32 i; u32 i;
unsigned long mask;
u32 stag_index = 0; u32 stag_index = 0;
u32 next_stag_index = 0; u32 next_stag_index = 0;
u32 driver_key = 0; u32 driver_key = 0;
...@@ -2150,6 +2174,9 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2150,6 +2174,9 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
return ERR_PTR(-E2BIG); return ERR_PTR(-E2BIG);
} }
if ((buffer_list[0].addr ^ *iova_start) & ~PAGE_MASK)
return ERR_PTR(-EINVAL);
err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr, err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr,
&stag_index, &next_stag_index); &stag_index, &next_stag_index);
if (err) { if (err) {
...@@ -2215,19 +2242,16 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2215,19 +2242,16 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
root_pbl_index++; root_pbl_index++;
cur_pbl_index = 0; cur_pbl_index = 0;
} }
if (buffer_list[i].addr & ~PAGE_MASK) {
/* TODO: Unwind allocated buffers */
nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
nes_debug(NES_DBG_MR, "Unaligned Memory Buffer: 0x%x\n",
(unsigned int) buffer_list[i].addr);
ibmr = ERR_PTR(-EINVAL);
kfree(nesmr);
goto reg_phys_err;
}
if (!buffer_list[i].size) { mask = !buffer_list[i].size;
if (i != 0)
mask |= buffer_list[i].addr;
if (i != num_phys_buf - 1)
mask |= buffer_list[i].addr + buffer_list[i].size;
if (mask & ~PAGE_MASK) {
nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
nes_debug(NES_DBG_MR, "Invalid Buffer Size\n"); nes_debug(NES_DBG_MR, "Invalid buffer addr or size\n");
ibmr = ERR_PTR(-EINVAL); ibmr = ERR_PTR(-EINVAL);
kfree(nesmr); kfree(nesmr);
goto reg_phys_err; goto reg_phys_err;
...@@ -2238,7 +2262,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2238,7 +2262,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
if ((buffer_list[i-1].addr+PAGE_SIZE) != buffer_list[i].addr) if ((buffer_list[i-1].addr+PAGE_SIZE) != buffer_list[i].addr)
single_page = 0; single_page = 0;
} }
vpbl.pbl_vbase[cur_pbl_index].pa_low = cpu_to_le32((u32)buffer_list[i].addr); vpbl.pbl_vbase[cur_pbl_index].pa_low = cpu_to_le32((u32)buffer_list[i].addr & PAGE_MASK);
vpbl.pbl_vbase[cur_pbl_index++].pa_high = vpbl.pbl_vbase[cur_pbl_index++].pa_high =
cpu_to_le32((u32)((((u64)buffer_list[i].addr) >> 32))); cpu_to_le32((u32)((((u64)buffer_list[i].addr) >> 32)));
} }
...@@ -2251,8 +2275,6 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2251,8 +2275,6 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
" length = 0x%016lX, index = 0x%08X\n", " length = 0x%016lX, index = 0x%08X\n",
stag, (unsigned long)*iova_start, (unsigned long)region_length, stag_index); stag, (unsigned long)*iova_start, (unsigned long)region_length, stag_index);
region_length -= (*iova_start)&PAGE_MASK;
/* Make the leaf PBL the root if only one PBL */ /* Make the leaf PBL the root if only one PBL */
if (root_pbl_index == 1) { if (root_pbl_index == 1) {
root_vpbl.pbl_pbase = vpbl.pbl_pbase; 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,10 +2808,9 @@ static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr,
struct nes_vnic *nesvnic = nesibdev->nesvnic; struct nes_vnic *nesvnic = nesibdev->nesvnic;
nes_debug(NES_DBG_INIT, "\n"); nes_debug(NES_DBG_INIT, "\n");
return sprintf(buf, "%x.%x.%x\n", return sprintf(buf, "%u.%u\n",
(int)(nesvnic->nesdev->nesadapter->fw_ver >> 32), (nesvnic->nesdev->nesadapter->firmware_version >> 16),
(int)(nesvnic->nesdev->nesadapter->fw_ver >> 16) & 0xffff, (nesvnic->nesdev->nesadapter->firmware_version & 0x000000ff));
(int)(nesvnic->nesdev->nesadapter->fw_ver & 0xffff));
} }
......
...@@ -112,6 +112,7 @@ struct nes_cq { ...@@ -112,6 +112,7 @@ struct nes_cq {
spinlock_t lock; spinlock_t lock;
u8 virtual_cq; u8 virtual_cq;
u8 pad[3]; u8 pad[3];
u32 mcrqf;
}; };
struct nes_wq { struct nes_wq {
......
...@@ -685,7 +685,8 @@ int ipoib_ib_dev_open(struct net_device *dev) ...@@ -685,7 +685,8 @@ int ipoib_ib_dev_open(struct net_device *dev)
queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task, queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task,
round_jiffies_relative(HZ)); round_jiffies_relative(HZ));
set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); if (!test_and_set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))
napi_enable(&priv->napi);
return 0; return 0;
} }
...@@ -804,7 +805,8 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush) ...@@ -804,7 +805,8 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush)
struct ipoib_tx_buf *tx_req; struct ipoib_tx_buf *tx_req;
int i; int i;
clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); if (test_and_clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))
napi_disable(&priv->napi);
ipoib_cm_dev_stop(dev); ipoib_cm_dev_stop(dev);
......
...@@ -106,8 +106,7 @@ int ipoib_open(struct net_device *dev) ...@@ -106,8 +106,7 @@ int ipoib_open(struct net_device *dev)
ipoib_dbg(priv, "bringing up interface\n"); ipoib_dbg(priv, "bringing up interface\n");
if (!test_and_set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
napi_enable(&priv->napi);
if (ipoib_pkey_dev_delay_open(dev)) if (ipoib_pkey_dev_delay_open(dev))
return 0; return 0;
...@@ -143,7 +142,6 @@ int ipoib_open(struct net_device *dev) ...@@ -143,7 +142,6 @@ int ipoib_open(struct net_device *dev)
ipoib_ib_dev_stop(dev, 1); ipoib_ib_dev_stop(dev, 1);
err_disable: err_disable:
napi_disable(&priv->napi);
clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
return -EINVAL; return -EINVAL;
...@@ -156,7 +154,6 @@ static int ipoib_stop(struct net_device *dev) ...@@ -156,7 +154,6 @@ static int ipoib_stop(struct net_device *dev)
ipoib_dbg(priv, "stopping interface\n"); ipoib_dbg(priv, "stopping interface\n");
clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
napi_disable(&priv->napi);
netif_stop_queue(dev); netif_stop_queue(dev);
......
...@@ -976,7 +976,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev) ...@@ -976,7 +976,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
nreq = err; nreq = err;
goto retry; goto retry;
} }
kfree(entries);
goto no_msi; goto no_msi;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment