mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge branches 'core', 'cxgb4', 'ip-roce', 'iser', 'misc', 'mlx4', 'nes', 'ocrdma', 'qib', 'sgwrapper', 'srp' and 'usnic' into for-next
This commit is contained in:
65 files changed
+2972
-882
No files matched your search
@@ -349,23 +349,6 @@ static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
|
||||
grh, &av->ah_attr);
|
||||
}
|
||||
|
||||
int ib_update_cm_av(struct ib_cm_id *id, const u8 *smac, const u8 *alt_smac)
|
||||
{
|
||||
struct cm_id_private *cm_id_priv;
|
||||
|
||||
cm_id_priv = container_of(id, struct cm_id_private, id);
|
||||
|
||||
if (smac != NULL)
|
||||
memcpy(cm_id_priv->av.smac, smac, sizeof(cm_id_priv->av.smac));
|
||||
|
||||
if (alt_smac != NULL)
|
||||
memcpy(cm_id_priv->alt_av.smac, alt_smac,
|
||||
sizeof(cm_id_priv->alt_av.smac));
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(ib_update_cm_av);
|
||||
|
||||
static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
|
||||
{
|
||||
struct cm_device *cm_dev;
|
||||
|
||||
@@ -1284,15 +1284,6 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
|
||||
struct rdma_id_private *listen_id, *conn_id;
|
||||
struct rdma_cm_event event;
|
||||
int offset, ret;
|
||||
u8 smac[ETH_ALEN];
|
||||
u8 alt_smac[ETH_ALEN];
|
||||
u8 *psmac = smac;
|
||||
u8 *palt_smac = alt_smac;
|
||||
int is_iboe = ((rdma_node_get_transport(cm_id->device->node_type) ==
|
||||
RDMA_TRANSPORT_IB) &&
|
||||
(rdma_port_get_link_layer(cm_id->device,
|
||||
ib_event->param.req_rcvd.port) ==
|
||||
IB_LINK_LAYER_ETHERNET));
|
||||
|
||||
listen_id = cm_id->context;
|
||||
if (!cma_check_req_qp_type(&listen_id->id, ib_event))
|
||||
@@ -1336,28 +1327,11 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
|
||||
ret = conn_id->id.event_handler(&conn_id->id, &event);
|
||||
if (ret)
|
||||
goto err3;
|
||||
|
||||
if (is_iboe) {
|
||||
if (ib_event->param.req_rcvd.primary_path != NULL)
|
||||
rdma_addr_find_smac_by_sgid(
|
||||
&ib_event->param.req_rcvd.primary_path->sgid,
|
||||
psmac, NULL);
|
||||
else
|
||||
psmac = NULL;
|
||||
if (ib_event->param.req_rcvd.alternate_path != NULL)
|
||||
rdma_addr_find_smac_by_sgid(
|
||||
&ib_event->param.req_rcvd.alternate_path->sgid,
|
||||
palt_smac, NULL);
|
||||
else
|
||||
palt_smac = NULL;
|
||||
}
|
||||
/*
|
||||
* Acquire mutex to prevent user executing rdma_destroy_id()
|
||||
* while we're accessing the cm_id.
|
||||
*/
|
||||
mutex_lock(&lock);
|
||||
if (is_iboe)
|
||||
ib_update_cm_av(cm_id, psmac, palt_smac);
|
||||
if (cma_comp(conn_id, RDMA_CM_CONNECT) &&
|
||||
(conn_id->id.qp_type != IB_QPT_UD))
|
||||
ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0);
|
||||
|
||||
@@ -1022,12 +1022,21 @@ int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr)
|
||||
mad_send_wr->send_buf.mad,
|
||||
sge[0].length,
|
||||
DMA_TO_DEVICE);
|
||||
if (unlikely(ib_dma_mapping_error(mad_agent->device, sge[0].addr)))
|
||||
return -ENOMEM;
|
||||
|
||||
mad_send_wr->header_mapping = sge[0].addr;
|
||||
|
||||
sge[1].addr = ib_dma_map_single(mad_agent->device,
|
||||
ib_get_payload(mad_send_wr),
|
||||
sge[1].length,
|
||||
DMA_TO_DEVICE);
|
||||
if (unlikely(ib_dma_mapping_error(mad_agent->device, sge[1].addr))) {
|
||||
ib_dma_unmap_single(mad_agent->device,
|
||||
mad_send_wr->header_mapping,
|
||||
sge[0].length, DMA_TO_DEVICE);
|
||||
return -ENOMEM;
|
||||
}
|
||||
mad_send_wr->payload_mapping = sge[1].addr;
|
||||
|
||||
spin_lock_irqsave(&qp_info->send_queue.lock, flags);
|
||||
@@ -2590,6 +2599,11 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info,
|
||||
sizeof *mad_priv -
|
||||
sizeof mad_priv->header,
|
||||
DMA_FROM_DEVICE);
|
||||
if (unlikely(ib_dma_mapping_error(qp_info->port_priv->device,
|
||||
sg_list.addr))) {
|
||||
ret = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
mad_priv->header.mapping = sg_list.addr;
|
||||
recv_wr.wr_id = (unsigned long)&mad_priv->header.mad_list;
|
||||
mad_priv->header.mad_list.mad_queue = recv_queue;
|
||||
|
||||
@@ -98,9 +98,9 @@ int c4iw_debug;
|
||||
module_param(c4iw_debug, int, 0644);
|
||||
MODULE_PARM_DESC(c4iw_debug, "Enable debug logging (default=0)");
|
||||
|
||||
static int peer2peer;
|
||||
static int peer2peer = 1;
|
||||
module_param(peer2peer, int, 0644);
|
||||
MODULE_PARM_DESC(peer2peer, "Support peer2peer ULPs (default=0)");
|
||||
MODULE_PARM_DESC(peer2peer, "Support peer2peer ULPs (default=1)");
|
||||
|
||||
static int p2p_type = FW_RI_INIT_P2PTYPE_READ_REQ;
|
||||
module_param(p2p_type, int, 0644);
|
||||
@@ -400,7 +400,8 @@ static struct dst_entry *find_route(struct c4iw_dev *dev, __be32 local_ip,
|
||||
n = dst_neigh_lookup(&rt->dst, &peer_ip);
|
||||
if (!n)
|
||||
return NULL;
|
||||
if (!our_interface(dev, n->dev)) {
|
||||
if (!our_interface(dev, n->dev) &&
|
||||
!(n->dev->flags & IFF_LOOPBACK)) {
|
||||
dst_release(&rt->dst);
|
||||
return NULL;
|
||||
}
|
||||
@@ -759,8 +760,9 @@ static void send_mpa_req(struct c4iw_ep *ep, struct sk_buff *skb,
|
||||
ep->mpa_skb = skb;
|
||||
c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t);
|
||||
start_ep_timer(ep);
|
||||
state_set(&ep->com, MPA_REQ_SENT);
|
||||
__state_set(&ep->com, MPA_REQ_SENT);
|
||||
ep->mpa_attr.initiator = 1;
|
||||
ep->snd_seq += mpalen;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -840,6 +842,7 @@ static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen)
|
||||
t4_set_arp_err_handler(skb, NULL, arp_failure_discard);
|
||||
BUG_ON(ep->mpa_skb);
|
||||
ep->mpa_skb = skb;
|
||||
ep->snd_seq += mpalen;
|
||||
return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t);
|
||||
}
|
||||
|
||||
@@ -923,7 +926,8 @@ static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen)
|
||||
skb_get(skb);
|
||||
t4_set_arp_err_handler(skb, NULL, arp_failure_discard);
|
||||
ep->mpa_skb = skb;
|
||||
state_set(&ep->com, MPA_REP_SENT);
|
||||
__state_set(&ep->com, MPA_REP_SENT);
|
||||
ep->snd_seq += mpalen;
|
||||
return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t);
|
||||
}
|
||||
|
||||
@@ -940,6 +944,7 @@ static int act_establish(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
PDBG("%s ep %p tid %u snd_isn %u rcv_isn %u\n", __func__, ep, tid,
|
||||
be32_to_cpu(req->snd_isn), be32_to_cpu(req->rcv_isn));
|
||||
|
||||
mutex_lock(&ep->com.mutex);
|
||||
dst_confirm(ep->dst);
|
||||
|
||||
/* setup the hwtid for this connection */
|
||||
@@ -963,17 +968,18 @@ static int act_establish(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
send_mpa_req(ep, skb, 1);
|
||||
else
|
||||
send_mpa_req(ep, skb, mpa_rev);
|
||||
|
||||
mutex_unlock(&ep->com.mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void close_complete_upcall(struct c4iw_ep *ep)
|
||||
static void close_complete_upcall(struct c4iw_ep *ep, int status)
|
||||
{
|
||||
struct iw_cm_event event;
|
||||
|
||||
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.event = IW_CM_EVENT_CLOSE;
|
||||
event.status = status;
|
||||
if (ep->com.cm_id) {
|
||||
PDBG("close complete delivered ep %p cm_id %p tid %u\n",
|
||||
ep, ep->com.cm_id, ep->hwtid);
|
||||
@@ -987,7 +993,6 @@ static void close_complete_upcall(struct c4iw_ep *ep)
|
||||
static int abort_connection(struct c4iw_ep *ep, struct sk_buff *skb, gfp_t gfp)
|
||||
{
|
||||
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
|
||||
close_complete_upcall(ep);
|
||||
state_set(&ep->com, ABORTING);
|
||||
set_bit(ABORT_CONN, &ep->com.history);
|
||||
return send_abort(ep, skb, gfp);
|
||||
@@ -1066,9 +1071,10 @@ static void connect_reply_upcall(struct c4iw_ep *ep, int status)
|
||||
}
|
||||
}
|
||||
|
||||
static void connect_request_upcall(struct c4iw_ep *ep)
|
||||
static int connect_request_upcall(struct c4iw_ep *ep)
|
||||
{
|
||||
struct iw_cm_event event;
|
||||
int ret;
|
||||
|
||||
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
|
||||
memset(&event, 0, sizeof(event));
|
||||
@@ -1093,15 +1099,14 @@ static void connect_request_upcall(struct c4iw_ep *ep)
|
||||
event.private_data_len = ep->plen;
|
||||
event.private_data = ep->mpa_pkt + sizeof(struct mpa_message);
|
||||
}
|
||||
if (state_read(&ep->parent_ep->com) != DEAD) {
|
||||
c4iw_get_ep(&ep->com);
|
||||
ep->parent_ep->com.cm_id->event_handler(
|
||||
ep->parent_ep->com.cm_id,
|
||||
&event);
|
||||
}
|
||||
c4iw_get_ep(&ep->com);
|
||||
ret = ep->parent_ep->com.cm_id->event_handler(ep->parent_ep->com.cm_id,
|
||||
&event);
|
||||
if (ret)
|
||||
c4iw_put_ep(&ep->com);
|
||||
set_bit(CONNREQ_UPCALL, &ep->com.history);
|
||||
c4iw_put_ep(&ep->parent_ep->com);
|
||||
ep->parent_ep = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void established_upcall(struct c4iw_ep *ep)
|
||||
@@ -1165,7 +1170,7 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb)
|
||||
* the connection.
|
||||
*/
|
||||
stop_ep_timer(ep);
|
||||
if (state_read(&ep->com) != MPA_REQ_SENT)
|
||||
if (ep->com.state != MPA_REQ_SENT)
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -1240,7 +1245,7 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb)
|
||||
* start reply message including private data. And
|
||||
* the MPA header is valid.
|
||||
*/
|
||||
state_set(&ep->com, FPDU_MODE);
|
||||
__state_set(&ep->com, FPDU_MODE);
|
||||
ep->mpa_attr.crc_enabled = (mpa->flags & MPA_CRC) | crc_enabled ? 1 : 0;
|
||||
ep->mpa_attr.recv_marker_enabled = markers_enabled;
|
||||
ep->mpa_attr.xmit_marker_enabled = mpa->flags & MPA_MARKERS ? 1 : 0;
|
||||
@@ -1355,7 +1360,7 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb)
|
||||
}
|
||||
goto out;
|
||||
err:
|
||||
state_set(&ep->com, ABORTING);
|
||||
__state_set(&ep->com, ABORTING);
|
||||
send_abort(ep, skb, GFP_KERNEL);
|
||||
out:
|
||||
connect_reply_upcall(ep, err);
|
||||
@@ -1370,7 +1375,7 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb)
|
||||
|
||||
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
|
||||
|
||||
if (state_read(&ep->com) != MPA_REQ_WAIT)
|
||||
if (ep->com.state != MPA_REQ_WAIT)
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -1400,7 +1405,6 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb)
|
||||
return;
|
||||
|
||||
PDBG("%s enter (%s line %u)\n", __func__, __FILE__, __LINE__);
|
||||
stop_ep_timer(ep);
|
||||
mpa = (struct mpa_message *) ep->mpa_pkt;
|
||||
|
||||
/*
|
||||
@@ -1492,10 +1496,18 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb)
|
||||
ep->mpa_attr.xmit_marker_enabled, ep->mpa_attr.version,
|
||||
ep->mpa_attr.p2p_type);
|
||||
|
||||
state_set(&ep->com, MPA_REQ_RCVD);
|
||||
__state_set(&ep->com, MPA_REQ_RCVD);
|
||||
stop_ep_timer(ep);
|
||||
|
||||
/* drive upcall */
|
||||
connect_request_upcall(ep);
|
||||
mutex_lock(&ep->parent_ep->com.mutex);
|
||||
if (ep->parent_ep->com.state != DEAD) {
|
||||
if (connect_request_upcall(ep))
|
||||
abort_connection(ep, skb, GFP_KERNEL);
|
||||
} else {
|
||||
abort_connection(ep, skb, GFP_KERNEL);
|
||||
}
|
||||
mutex_unlock(&ep->parent_ep->com.mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1509,14 +1521,17 @@ static int rx_data(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
__u8 status = hdr->status;
|
||||
|
||||
ep = lookup_tid(t, tid);
|
||||
if (!ep)
|
||||
return 0;
|
||||
PDBG("%s ep %p tid %u dlen %u\n", __func__, ep, ep->hwtid, dlen);
|
||||
skb_pull(skb, sizeof(*hdr));
|
||||
skb_trim(skb, dlen);
|
||||
mutex_lock(&ep->com.mutex);
|
||||
|
||||
/* update RX credits */
|
||||
update_rx_credits(ep, dlen);
|
||||
|
||||
switch (state_read(&ep->com)) {
|
||||
switch (ep->com.state) {
|
||||
case MPA_REQ_SENT:
|
||||
ep->rcv_seq += dlen;
|
||||
process_mpa_reply(ep, skb);
|
||||
@@ -1532,7 +1547,7 @@ static int rx_data(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
pr_err("%s Unexpected streaming data." \
|
||||
" qpid %u ep %p state %d tid %u status %d\n",
|
||||
__func__, ep->com.qp->wq.sq.qid, ep,
|
||||
state_read(&ep->com), ep->hwtid, status);
|
||||
ep->com.state, ep->hwtid, status);
|
||||
attrs.next_state = C4IW_QP_STATE_TERMINATE;
|
||||
c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp,
|
||||
C4IW_QP_ATTR_NEXT_STATE, &attrs, 0);
|
||||
@@ -1541,6 +1556,7 @@ static int rx_data(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&ep->com.mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2246,7 +2262,7 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp,
|
||||
C4IW_QP_ATTR_NEXT_STATE, &attrs, 1);
|
||||
}
|
||||
close_complete_upcall(ep);
|
||||
close_complete_upcall(ep, 0);
|
||||
__state_set(&ep->com, DEAD);
|
||||
release = 1;
|
||||
disconnect = 0;
|
||||
@@ -2425,7 +2441,7 @@ static int close_con_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
C4IW_QP_ATTR_NEXT_STATE,
|
||||
&attrs, 1);
|
||||
}
|
||||
close_complete_upcall(ep);
|
||||
close_complete_upcall(ep, 0);
|
||||
__state_set(&ep->com, DEAD);
|
||||
release = 1;
|
||||
break;
|
||||
@@ -2500,22 +2516,28 @@ static int fw4_ack(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
|
||||
int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
|
||||
{
|
||||
int err;
|
||||
int err = 0;
|
||||
int disconnect = 0;
|
||||
struct c4iw_ep *ep = to_ep(cm_id);
|
||||
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
|
||||
|
||||
if (state_read(&ep->com) == DEAD) {
|
||||
mutex_lock(&ep->com.mutex);
|
||||
if (ep->com.state == DEAD) {
|
||||
mutex_unlock(&ep->com.mutex);
|
||||
c4iw_put_ep(&ep->com);
|
||||
return -ECONNRESET;
|
||||
}
|
||||
set_bit(ULP_REJECT, &ep->com.history);
|
||||
BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD);
|
||||
BUG_ON(ep->com.state != MPA_REQ_RCVD);
|
||||
if (mpa_rev == 0)
|
||||
abort_connection(ep, NULL, GFP_KERNEL);
|
||||
else {
|
||||
err = send_mpa_reject(ep, pdata, pdata_len);
|
||||
err = c4iw_ep_disconnect(ep, 0, GFP_KERNEL);
|
||||
disconnect = 1;
|
||||
}
|
||||
mutex_unlock(&ep->com.mutex);
|
||||
if (disconnect)
|
||||
err = c4iw_ep_disconnect(ep, 0, GFP_KERNEL);
|
||||
c4iw_put_ep(&ep->com);
|
||||
return 0;
|
||||
}
|
||||
@@ -2530,12 +2552,14 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
struct c4iw_qp *qp = get_qhp(h, conn_param->qpn);
|
||||
|
||||
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
|
||||
if (state_read(&ep->com) == DEAD) {
|
||||
|
||||
mutex_lock(&ep->com.mutex);
|
||||
if (ep->com.state == DEAD) {
|
||||
err = -ECONNRESET;
|
||||
goto err;
|
||||
}
|
||||
|
||||
BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD);
|
||||
BUG_ON(ep->com.state != MPA_REQ_RCVD);
|
||||
BUG_ON(!qp);
|
||||
|
||||
set_bit(ULP_ACCEPT, &ep->com.history);
|
||||
@@ -2604,14 +2628,16 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
if (err)
|
||||
goto err1;
|
||||
|
||||
state_set(&ep->com, FPDU_MODE);
|
||||
__state_set(&ep->com, FPDU_MODE);
|
||||
established_upcall(ep);
|
||||
mutex_unlock(&ep->com.mutex);
|
||||
c4iw_put_ep(&ep->com);
|
||||
return 0;
|
||||
err1:
|
||||
ep->com.cm_id = NULL;
|
||||
cm_id->rem_ref(cm_id);
|
||||
err:
|
||||
mutex_unlock(&ep->com.mutex);
|
||||
c4iw_put_ep(&ep->com);
|
||||
return err;
|
||||
}
|
||||
@@ -2980,7 +3006,7 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)
|
||||
rdev = &ep->com.dev->rdev;
|
||||
if (c4iw_fatal_error(rdev)) {
|
||||
fatal = 1;
|
||||
close_complete_upcall(ep);
|
||||
close_complete_upcall(ep, -EIO);
|
||||
ep->com.state = DEAD;
|
||||
}
|
||||
switch (ep->com.state) {
|
||||
@@ -3022,7 +3048,7 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)
|
||||
if (close) {
|
||||
if (abrupt) {
|
||||
set_bit(EP_DISC_ABORT, &ep->com.history);
|
||||
close_complete_upcall(ep);
|
||||
close_complete_upcall(ep, -ECONNRESET);
|
||||
ret = send_abort(ep, NULL, gfp);
|
||||
} else {
|
||||
set_bit(EP_DISC_CLOSE, &ep->com.history);
|
||||
@@ -3203,6 +3229,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb,
|
||||
struct sk_buff *req_skb;
|
||||
struct fw_ofld_connection_wr *req;
|
||||
struct cpl_pass_accept_req *cpl = cplhdr(skb);
|
||||
int ret;
|
||||
|
||||
req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL);
|
||||
req = (struct fw_ofld_connection_wr *)__skb_put(req_skb, sizeof(*req));
|
||||
@@ -3239,7 +3266,13 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb,
|
||||
req->cookie = (unsigned long)skb;
|
||||
|
||||
set_wr_txq(req_skb, CPL_PRIORITY_CONTROL, port_id);
|
||||
cxgb4_ofld_send(dev->rdev.lldi.ports[0], req_skb);
|
||||
ret = cxgb4_ofld_send(dev->rdev.lldi.ports[0], req_skb);
|
||||
if (ret < 0) {
|
||||
pr_err("%s - cxgb4_ofld_send error %d - dropping\n", __func__,
|
||||
ret);
|
||||
kfree_skb(skb);
|
||||
kfree_skb(req_skb);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3346,13 +3379,13 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
pi = (struct port_info *)netdev_priv(pdev);
|
||||
tx_chan = cxgb4_port_chan(pdev);
|
||||
}
|
||||
neigh_release(neigh);
|
||||
if (!e) {
|
||||
pr_err("%s - failed to allocate l2t entry!\n",
|
||||
__func__);
|
||||
goto free_dst;
|
||||
}
|
||||
|
||||
neigh_release(neigh);
|
||||
step = dev->rdev.lldi.nrxq / dev->rdev.lldi.nchan;
|
||||
rss_qid = dev->rdev.lldi.rxq_ids[pi->port_id * step];
|
||||
window = (__force u16) htons((__force u16)tcph->window);
|
||||
@@ -3427,6 +3460,7 @@ static void process_timeout(struct c4iw_ep *ep)
|
||||
&attrs, 1);
|
||||
}
|
||||
__state_set(&ep->com, ABORTING);
|
||||
close_complete_upcall(ep, -ETIMEDOUT);
|
||||
break;
|
||||
default:
|
||||
WARN(1, "%s unexpected state ep %p tid %u state %u\n",
|
||||
|
||||
@@ -365,8 +365,14 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp)
|
||||
|
||||
if (CQE_OPCODE(hw_cqe) == FW_RI_READ_RESP) {
|
||||
|
||||
/*
|
||||
* drop peer2peer RTR reads.
|
||||
/* If we have reached here because of async
|
||||
* event or other error, and have egress error
|
||||
* then drop
|
||||
*/
|
||||
if (CQE_TYPE(hw_cqe) == 1)
|
||||
goto next_cqe;
|
||||
|
||||
/* drop peer2peer RTR reads.
|
||||
*/
|
||||
if (CQE_WRID_STAG(hw_cqe) == 1)
|
||||
goto next_cqe;
|
||||
@@ -511,8 +517,18 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe,
|
||||
*/
|
||||
if (RQ_TYPE(hw_cqe) && (CQE_OPCODE(hw_cqe) == FW_RI_READ_RESP)) {
|
||||
|
||||
/*
|
||||
* If this is an unsolicited read response, then the read
|
||||
/* If we have reached here because of async
|
||||
* event or other error, and have egress error
|
||||
* then drop
|
||||
*/
|
||||
if (CQE_TYPE(hw_cqe) == 1) {
|
||||
if (CQE_STATUS(hw_cqe))
|
||||
t4_set_wq_in_error(wq);
|
||||
ret = -EAGAIN;
|
||||
goto skip_cqe;
|
||||
}
|
||||
|
||||
/* If this is an unsolicited read response, then the read
|
||||
* was generated by the kernel driver as part of peer-2-peer
|
||||
* connection setup. So ignore the completion.
|
||||
*/
|
||||
@@ -603,7 +619,7 @@ proc_cqe:
|
||||
*/
|
||||
if (SQ_TYPE(hw_cqe)) {
|
||||
int idx = CQE_WRID_SQ_IDX(hw_cqe);
|
||||
BUG_ON(idx > wq->sq.size);
|
||||
BUG_ON(idx >= wq->sq.size);
|
||||
|
||||
/*
|
||||
* Account for any unsignaled completions completed by
|
||||
@@ -617,7 +633,7 @@ proc_cqe:
|
||||
wq->sq.in_use -= wq->sq.size + idx - wq->sq.cidx;
|
||||
else
|
||||
wq->sq.in_use -= idx - wq->sq.cidx;
|
||||
BUG_ON(wq->sq.in_use < 0 && wq->sq.in_use < wq->sq.size);
|
||||
BUG_ON(wq->sq.in_use <= 0 && wq->sq.in_use >= wq->sq.size);
|
||||
|
||||
wq->sq.cidx = (uint16_t)idx;
|
||||
PDBG("%s completing sq idx %u\n", __func__, wq->sq.cidx);
|
||||
@@ -881,7 +897,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
|
||||
/*
|
||||
* Make actual HW queue 2x to avoid cdix_inc overflows.
|
||||
*/
|
||||
hwentries = entries * 2;
|
||||
hwentries = min(entries * 2, T4_MAX_IQ_SIZE);
|
||||
|
||||
/*
|
||||
* Make HW queue at least 64 entries so GTS updates aren't too
|
||||
@@ -930,6 +946,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
|
||||
if (!mm2)
|
||||
goto err4;
|
||||
|
||||
memset(&uresp, 0, sizeof(uresp));
|
||||
uresp.qid_mask = rhp->rdev.cqmask;
|
||||
uresp.cqid = chp->cq.cqid;
|
||||
uresp.size = chp->cq.size;
|
||||
|
||||
@@ -897,11 +897,13 @@ static int c4iw_uld_rx_handler(void *handle, const __be64 *rsp,
|
||||
}
|
||||
|
||||
opcode = *(u8 *)rsp;
|
||||
if (c4iw_handlers[opcode])
|
||||
if (c4iw_handlers[opcode]) {
|
||||
c4iw_handlers[opcode](dev, skb);
|
||||
else
|
||||
} else {
|
||||
pr_info("%s no handler opcode 0x%x...\n", __func__,
|
||||
opcode);
|
||||
kfree_skb(skb);
|
||||
}
|
||||
|
||||
return 0;
|
||||
nomem:
|
||||
|
||||
@@ -369,6 +369,7 @@ struct c4iw_fr_page_list {
|
||||
DEFINE_DMA_UNMAP_ADDR(mapping);
|
||||
dma_addr_t dma_addr;
|
||||
struct c4iw_dev *dev;
|
||||
int pll_len;
|
||||
};
|
||||
|
||||
static inline struct c4iw_fr_page_list *to_c4iw_fr_page_list(
|
||||
@@ -441,6 +442,7 @@ struct c4iw_qp {
|
||||
atomic_t refcnt;
|
||||
wait_queue_head_t wait;
|
||||
struct timer_list timer;
|
||||
int sq_sig_all;
|
||||
};
|
||||
|
||||
static inline struct c4iw_qp *to_c4iw_qp(struct ib_qp *ibqp)
|
||||
|
||||
@@ -37,9 +37,9 @@
|
||||
|
||||
#include "iw_cxgb4.h"
|
||||
|
||||
int use_dsgl = 1;
|
||||
int use_dsgl = 0;
|
||||
module_param(use_dsgl, int, 0644);
|
||||
MODULE_PARM_DESC(use_dsgl, "Use DSGL for PBL/FastReg (default=1)");
|
||||
MODULE_PARM_DESC(use_dsgl, "Use DSGL for PBL/FastReg (default=0)");
|
||||
|
||||
#define T4_ULPTX_MIN_IO 32
|
||||
#define C4IW_MAX_INLINE_SIZE 96
|
||||
@@ -898,7 +898,11 @@ struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(struct ib_device *device,
|
||||
dma_unmap_addr_set(c4pl, mapping, dma_addr);
|
||||
c4pl->dma_addr = dma_addr;
|
||||
c4pl->dev = dev;
|
||||
c4pl->ibpl.max_page_list_len = pll_len;
|
||||
c4pl->pll_len = pll_len;
|
||||
|
||||
PDBG("%s c4pl %p pll_len %u page_list %p dma_addr %pad\n",
|
||||
__func__, c4pl, c4pl->pll_len, c4pl->ibpl.page_list,
|
||||
&c4pl->dma_addr);
|
||||
|
||||
return &c4pl->ibpl;
|
||||
}
|
||||
@@ -907,8 +911,12 @@ void c4iw_free_fastreg_pbl(struct ib_fast_reg_page_list *ibpl)
|
||||
{
|
||||
struct c4iw_fr_page_list *c4pl = to_c4iw_fr_page_list(ibpl);
|
||||
|
||||
PDBG("%s c4pl %p pll_len %u page_list %p dma_addr %pad\n",
|
||||
__func__, c4pl, c4pl->pll_len, c4pl->ibpl.page_list,
|
||||
&c4pl->dma_addr);
|
||||
|
||||
dma_free_coherent(&c4pl->dev->rdev.lldi.pdev->dev,
|
||||
c4pl->ibpl.max_page_list_len,
|
||||
c4pl->pll_len,
|
||||
c4pl->ibpl.page_list, dma_unmap_addr(c4pl, mapping));
|
||||
kfree(c4pl);
|
||||
}
|
||||
|
||||
@@ -675,7 +675,7 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
|
||||
fw_flags = 0;
|
||||
if (wr->send_flags & IB_SEND_SOLICITED)
|
||||
fw_flags |= FW_RI_SOLICITED_EVENT_FLAG;
|
||||
if (wr->send_flags & IB_SEND_SIGNALED)
|
||||
if (wr->send_flags & IB_SEND_SIGNALED || qhp->sq_sig_all)
|
||||
fw_flags |= FW_RI_COMPLETION_FLAG;
|
||||
swsqe = &qhp->wq.sq.sw_sq[qhp->wq.sq.pidx];
|
||||
switch (wr->opcode) {
|
||||
@@ -736,7 +736,8 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
|
||||
}
|
||||
swsqe->idx = qhp->wq.sq.pidx;
|
||||
swsqe->complete = 0;
|
||||
swsqe->signaled = (wr->send_flags & IB_SEND_SIGNALED);
|
||||
swsqe->signaled = (wr->send_flags & IB_SEND_SIGNALED) ||
|
||||
qhp->sq_sig_all;
|
||||
swsqe->flushed = 0;
|
||||
swsqe->wr_id = wr->wr_id;
|
||||
|
||||
@@ -1533,7 +1534,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
|
||||
struct c4iw_cq *schp;
|
||||
struct c4iw_cq *rchp;
|
||||
struct c4iw_create_qp_resp uresp;
|
||||
int sqsize, rqsize;
|
||||
unsigned int sqsize, rqsize;
|
||||
struct c4iw_ucontext *ucontext;
|
||||
int ret;
|
||||
struct c4iw_mm_entry *mm1, *mm2, *mm3, *mm4, *mm5 = NULL;
|
||||
@@ -1605,6 +1606,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
|
||||
qhp->attr.enable_bind = 1;
|
||||
qhp->attr.max_ord = 1;
|
||||
qhp->attr.max_ird = 1;
|
||||
qhp->sq_sig_all = attrs->sq_sig_type == IB_SIGNAL_ALL_WR;
|
||||
spin_lock_init(&qhp->lock);
|
||||
mutex_init(&qhp->mutex);
|
||||
init_waitqueue_head(&qhp->wait);
|
||||
|
||||
@@ -283,6 +283,7 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
|
||||
(my_cq->galpas.user.fw_handle & (PAGE_SIZE - 1));
|
||||
if (ib_copy_to_udata(udata, &resp, sizeof(resp))) {
|
||||
ehca_err(device, "Copy to udata failed.");
|
||||
cq = ERR_PTR(-EFAULT);
|
||||
goto create_cq_exit4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2534,16 +2534,6 @@ static void ehca_dma_unmap_sg(struct ib_device *dev, struct scatterlist *sg,
|
||||
/* This is only a stub; nothing to be done here */
|
||||
}
|
||||
|
||||
static u64 ehca_dma_address(struct ib_device *dev, struct scatterlist *sg)
|
||||
{
|
||||
return sg->dma_address;
|
||||
}
|
||||
|
||||
static unsigned int ehca_dma_len(struct ib_device *dev, struct scatterlist *sg)
|
||||
{
|
||||
return sg->length;
|
||||
}
|
||||
|
||||
static void ehca_dma_sync_single_for_cpu(struct ib_device *dev, u64 addr,
|
||||
size_t size,
|
||||
enum dma_data_direction dir)
|
||||
@@ -2596,8 +2586,6 @@ struct ib_dma_mapping_ops ehca_dma_mapping_ops = {
|
||||
.unmap_page = ehca_dma_unmap_page,
|
||||
.map_sg = ehca_dma_map_sg,
|
||||
.unmap_sg = ehca_dma_unmap_sg,
|
||||
.dma_address = ehca_dma_address,
|
||||
.dma_len = ehca_dma_len,
|
||||
.sync_single_for_cpu = ehca_dma_sync_single_for_cpu,
|
||||
.sync_single_for_device = ehca_dma_sync_single_for_device,
|
||||
.alloc_coherent = ehca_dma_alloc_coherent,
|
||||
|
||||
@@ -326,7 +326,7 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
|
||||
size_t count, loff_t *off)
|
||||
{
|
||||
u32 __iomem *piobuf;
|
||||
u32 plen, clen, pbufn;
|
||||
u32 plen, pbufn, maxlen_reserve;
|
||||
struct ipath_diag_pkt odp;
|
||||
struct ipath_diag_xpkt dp;
|
||||
u32 *tmpbuf = NULL;
|
||||
@@ -335,51 +335,29 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
|
||||
u64 val;
|
||||
u32 l_state, lt_state; /* LinkState, LinkTrainingState */
|
||||
|
||||
if (count < sizeof(odp)) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (count == sizeof(dp)) {
|
||||
if (copy_from_user(&dp, data, sizeof(dp))) {
|
||||
ret = -EFAULT;
|
||||
goto bail;
|
||||
}
|
||||
} else if (copy_from_user(&odp, data, sizeof(odp))) {
|
||||
ret = -EFAULT;
|
||||
} else if (count == sizeof(odp)) {
|
||||
if (copy_from_user(&odp, data, sizeof(odp))) {
|
||||
ret = -EFAULT;
|
||||
goto bail;
|
||||
}
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Due to padding/alignment issues (lessened with new struct)
|
||||
* the old and new structs are the same length. We need to
|
||||
* disambiguate them, which we can do because odp.len has never
|
||||
* been less than the total of LRH+BTH+DETH so far, while
|
||||
* dp.unit (same offset) unit is unlikely to get that high.
|
||||
* Similarly, dp.data, the pointer to user at the same offset
|
||||
* as odp.unit, is almost certainly at least one (512byte)page
|
||||
* "above" NULL. The if-block below can be omitted if compatibility
|
||||
* between a new driver and older diagnostic code is unimportant.
|
||||
* compatibility the other direction (new diags, old driver) is
|
||||
* handled in the diagnostic code, with a warning.
|
||||
*/
|
||||
if (dp.unit >= 20 && dp.data < 512) {
|
||||
/* very probable version mismatch. Fix it up */
|
||||
memcpy(&odp, &dp, sizeof(odp));
|
||||
/* We got a legacy dp, copy elements to dp */
|
||||
dp.unit = odp.unit;
|
||||
dp.data = odp.data;
|
||||
dp.len = odp.len;
|
||||
dp.pbc_wd = 0; /* Indicate we need to compute PBC wd */
|
||||
}
|
||||
|
||||
/* send count must be an exact number of dwords */
|
||||
if (dp.len & 3) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
clen = dp.len >> 2;
|
||||
plen = dp.len >> 2;
|
||||
|
||||
dd = ipath_lookup(dp.unit);
|
||||
if (!dd || !(dd->ipath_flags & IPATH_PRESENT) ||
|
||||
@@ -422,16 +400,22 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* need total length before first word written */
|
||||
/* +1 word is for the qword padding */
|
||||
/*
|
||||
* need total length before first word written, plus 2 Dwords. One Dword
|
||||
* is for padding so we get the full user data when not aligned on
|
||||
* a word boundary. The other Dword is to make sure we have room for the
|
||||
* ICRC which gets tacked on later.
|
||||
*/
|
||||
maxlen_reserve = 2 * sizeof(u32);
|
||||
if (dp.len > dd->ipath_ibmaxlen - maxlen_reserve) {
|
||||
ipath_dbg("Pkt len 0x%x > ibmaxlen %x\n",
|
||||
dp.len, dd->ipath_ibmaxlen);
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
plen = sizeof(u32) + dp.len;
|
||||
|
||||
if ((plen + 4) > dd->ipath_ibmaxlen) {
|
||||
ipath_dbg("Pkt len 0x%x > ibmaxlen %x\n",
|
||||
plen - 4, dd->ipath_ibmaxlen);
|
||||
ret = -EINVAL;
|
||||
goto bail; /* before writing pbc */
|
||||
}
|
||||
tmpbuf = vmalloc(plen);
|
||||
if (!tmpbuf) {
|
||||
dev_info(&dd->pcidev->dev, "Unable to allocate tmp buffer, "
|
||||
@@ -473,11 +457,11 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
|
||||
*/
|
||||
if (dd->ipath_flags & IPATH_PIO_FLUSH_WC) {
|
||||
ipath_flush_wc();
|
||||
__iowrite32_copy(piobuf + 2, tmpbuf, clen - 1);
|
||||
__iowrite32_copy(piobuf + 2, tmpbuf, plen - 1);
|
||||
ipath_flush_wc();
|
||||
__raw_writel(tmpbuf[clen - 1], piobuf + clen + 1);
|
||||
__raw_writel(tmpbuf[plen - 1], piobuf + plen + 1);
|
||||
} else
|
||||
__iowrite32_copy(piobuf + 2, tmpbuf, clen);
|
||||
__iowrite32_copy(piobuf + 2, tmpbuf, plen);
|
||||
|
||||
ipath_flush_wc();
|
||||
|
||||
|
||||
@@ -115,6 +115,10 @@ static int ipath_map_sg(struct ib_device *dev, struct scatterlist *sgl,
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
sg->dma_address = addr + sg->offset;
|
||||
#ifdef CONFIG_NEED_SG_DMA_LENGTH
|
||||
sg->dma_length = sg->length;
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -126,21 +130,6 @@ static void ipath_unmap_sg(struct ib_device *dev,
|
||||
BUG_ON(!valid_dma_direction(direction));
|
||||
}
|
||||
|
||||
static u64 ipath_sg_dma_address(struct ib_device *dev, struct scatterlist *sg)
|
||||
{
|
||||
u64 addr = (u64) page_address(sg_page(sg));
|
||||
|
||||
if (addr)
|
||||
addr += sg->offset;
|
||||
return addr;
|
||||
}
|
||||
|
||||
static unsigned int ipath_sg_dma_len(struct ib_device *dev,
|
||||
struct scatterlist *sg)
|
||||
{
|
||||
return sg->length;
|
||||
}
|
||||
|
||||
static void ipath_sync_single_for_cpu(struct ib_device *dev,
|
||||
u64 addr,
|
||||
size_t size,
|
||||
@@ -176,17 +165,15 @@ static void ipath_dma_free_coherent(struct ib_device *dev, size_t size,
|
||||
}
|
||||
|
||||
struct ib_dma_mapping_ops ipath_dma_mapping_ops = {
|
||||
ipath_mapping_error,
|
||||
ipath_dma_map_single,
|
||||
ipath_dma_unmap_single,
|
||||
ipath_dma_map_page,
|
||||
ipath_dma_unmap_page,
|
||||
ipath_map_sg,
|
||||
ipath_unmap_sg,
|
||||
ipath_sg_dma_address,
|
||||
ipath_sg_dma_len,
|
||||
ipath_sync_single_for_cpu,
|
||||
ipath_sync_single_for_device,
|
||||
ipath_dma_alloc_coherent,
|
||||
ipath_dma_free_coherent
|
||||
.mapping_error = ipath_mapping_error,
|
||||
.map_single = ipath_dma_map_single,
|
||||
.unmap_single = ipath_dma_unmap_single,
|
||||
.map_page = ipath_dma_map_page,
|
||||
.unmap_page = ipath_dma_unmap_page,
|
||||
.map_sg = ipath_map_sg,
|
||||
.unmap_sg = ipath_unmap_sg,
|
||||
.sync_single_for_cpu = ipath_sync_single_for_cpu,
|
||||
.sync_single_for_device = ipath_sync_single_for_device,
|
||||
.alloc_coherent = ipath_dma_alloc_coherent,
|
||||
.free_coherent = ipath_dma_free_coherent
|
||||
};
|
||||
@@ -1803,7 +1803,7 @@ static void init_pkeys(struct mlx4_ib_dev *ibdev)
|
||||
|
||||
static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
|
||||
{
|
||||
char name[32];
|
||||
char name[80];
|
||||
int eq_per_port = 0;
|
||||
int added_eqs = 0;
|
||||
int total_eqs = 0;
|
||||
@@ -1833,8 +1833,8 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
|
||||
eq = 0;
|
||||
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) {
|
||||
for (j = 0; j < eq_per_port; j++) {
|
||||
sprintf(name, "mlx4-ib-%d-%d@%s",
|
||||
i, j, dev->pdev->bus->name);
|
||||
snprintf(name, sizeof(name), "mlx4-ib-%d-%d@%s",
|
||||
i, j, dev->pdev->bus->name);
|
||||
/* Set IRQ for specific name (per ring) */
|
||||
if (mlx4_assign_eq(dev, name, NULL,
|
||||
&ibdev->eq_table[eq])) {
|
||||
@@ -2056,8 +2056,9 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
|
||||
err = mlx4_counter_alloc(ibdev->dev, &ibdev->counters[i]);
|
||||
if (err)
|
||||
ibdev->counters[i] = -1;
|
||||
} else
|
||||
ibdev->counters[i] = -1;
|
||||
} else {
|
||||
ibdev->counters[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
|
||||
|
||||
@@ -1882,7 +1882,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr,
|
||||
return err;
|
||||
}
|
||||
|
||||
if (ah->av.eth.vlan != 0xffff) {
|
||||
if (ah->av.eth.vlan != cpu_to_be16(0xffff)) {
|
||||
vlan = be16_to_cpu(ah->av.eth.vlan) & 0x0fff;
|
||||
is_vlan = 1;
|
||||
}
|
||||
|
||||
@@ -695,6 +695,7 @@ static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries,
|
||||
|
||||
if (context && ib_copy_to_udata(udata, &cq->cqn, sizeof (__u32))) {
|
||||
mthca_free_cq(to_mdev(ibdev), cq);
|
||||
err = -EFAULT;
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,7 @@ static void build_mpa_v1(struct nes_cm_node *, void *, u8);
|
||||
static void build_rdma0_msg(struct nes_cm_node *, struct nes_qp **);
|
||||
|
||||
static void print_core(struct nes_cm_core *core);
|
||||
static void record_ird_ord(struct nes_cm_node *, u16, u16);
|
||||
|
||||
/* External CM API Interface */
|
||||
/* instance of function pointers for client API */
|
||||
@@ -317,7 +318,6 @@ static int parse_mpa(struct nes_cm_node *cm_node, u8 *buffer, u32 *type,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (priv_data_len + mpa_hdr_len != len) {
|
||||
nes_debug(NES_DBG_CM, "The received ietf buffer was not right"
|
||||
" complete (%x + %x != %x)\n",
|
||||
@@ -356,25 +356,57 @@ static int parse_mpa(struct nes_cm_node *cm_node, u8 *buffer, u32 *type,
|
||||
/* send reset */
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ird_size == IETF_NO_IRD_ORD || ord_size == IETF_NO_IRD_ORD)
|
||||
cm_node->mpav2_ird_ord = IETF_NO_IRD_ORD;
|
||||
|
||||
if (cm_node->state != NES_CM_STATE_MPAREQ_SENT) {
|
||||
if (cm_node->mpav2_ird_ord != IETF_NO_IRD_ORD) {
|
||||
/* responder */
|
||||
if (cm_node->ord_size > ird_size)
|
||||
cm_node->ord_size = ird_size;
|
||||
} else {
|
||||
/* initiator */
|
||||
if (cm_node->ord_size > ird_size)
|
||||
cm_node->ord_size = ird_size;
|
||||
if (cm_node->state != NES_CM_STATE_MPAREQ_SENT) {
|
||||
/* we are still negotiating */
|
||||
if (ord_size > NES_MAX_IRD) {
|
||||
cm_node->ird_size = NES_MAX_IRD;
|
||||
} else {
|
||||
cm_node->ird_size = ord_size;
|
||||
if (ord_size == 0 &&
|
||||
(rtr_ctrl_ord & IETF_RDMA0_READ)) {
|
||||
cm_node->ird_size = 1;
|
||||
nes_debug(NES_DBG_CM,
|
||||
"%s: Remote peer doesn't support RDMA0_READ (ord=%u)\n",
|
||||
__func__, ord_size);
|
||||
}
|
||||
}
|
||||
if (ird_size > NES_MAX_ORD)
|
||||
cm_node->ord_size = NES_MAX_ORD;
|
||||
else
|
||||
cm_node->ord_size = ird_size;
|
||||
} else { /* initiator */
|
||||
if (ord_size > NES_MAX_IRD) {
|
||||
nes_debug(NES_DBG_CM,
|
||||
"%s: Unable to support the requested (ord =%u)\n",
|
||||
__func__, ord_size);
|
||||
return -EINVAL;
|
||||
}
|
||||
cm_node->ird_size = ord_size;
|
||||
|
||||
if (cm_node->ird_size < ord_size) {
|
||||
/* no resources available */
|
||||
/* send terminate message */
|
||||
return -EINVAL;
|
||||
if (ird_size > NES_MAX_ORD) {
|
||||
cm_node->ord_size = NES_MAX_ORD;
|
||||
} else {
|
||||
if (ird_size == 0 &&
|
||||
(rtr_ctrl_ord & IETF_RDMA0_READ)) {
|
||||
nes_debug(NES_DBG_CM,
|
||||
"%s: Remote peer doesn't support RDMA0_READ (ird=%u)\n",
|
||||
__func__, ird_size);
|
||||
return -EINVAL;
|
||||
} else {
|
||||
cm_node->ord_size = ird_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rtr_ctrl_ord & IETF_RDMA0_READ) {
|
||||
cm_node->send_rdma0_op = SEND_RDMA_READ_ZERO;
|
||||
|
||||
} else if (rtr_ctrl_ord & IETF_RDMA0_WRITE) {
|
||||
cm_node->send_rdma0_op = SEND_RDMA_WRITE_ZERO;
|
||||
} else { /* Not supported RDMA0 operation */
|
||||
@@ -514,6 +546,19 @@ static void print_core(struct nes_cm_core *core)
|
||||
nes_debug(NES_DBG_CM, "-------------- end core ---------------\n");
|
||||
}
|
||||
|
||||
static void record_ird_ord(struct nes_cm_node *cm_node,
|
||||
u16 conn_ird, u16 conn_ord)
|
||||
{
|
||||
if (conn_ird > NES_MAX_IRD)
|
||||
conn_ird = NES_MAX_IRD;
|
||||
|
||||
if (conn_ord > NES_MAX_ORD)
|
||||
conn_ord = NES_MAX_ORD;
|
||||
|
||||
cm_node->ird_size = conn_ird;
|
||||
cm_node->ord_size = conn_ord;
|
||||
}
|
||||
|
||||
/**
|
||||
* cm_build_mpa_frame - build a MPA V1 frame or MPA V2 frame
|
||||
*/
|
||||
@@ -557,11 +602,13 @@ static void build_mpa_v2(struct nes_cm_node *cm_node,
|
||||
mpa_frame->priv_data_len += htons(IETF_RTR_MSG_SIZE);
|
||||
|
||||
/* initialize RTR msg */
|
||||
ctrl_ird = (cm_node->ird_size > IETF_NO_IRD_ORD) ?
|
||||
IETF_NO_IRD_ORD : cm_node->ird_size;
|
||||
ctrl_ord = (cm_node->ord_size > IETF_NO_IRD_ORD) ?
|
||||
IETF_NO_IRD_ORD : cm_node->ord_size;
|
||||
|
||||
if (cm_node->mpav2_ird_ord == IETF_NO_IRD_ORD) {
|
||||
ctrl_ird = IETF_NO_IRD_ORD;
|
||||
ctrl_ord = IETF_NO_IRD_ORD;
|
||||
} else {
|
||||
ctrl_ird = cm_node->ird_size & IETF_NO_IRD_ORD;
|
||||
ctrl_ord = cm_node->ord_size & IETF_NO_IRD_ORD;
|
||||
}
|
||||
ctrl_ird |= IETF_PEER_TO_PEER;
|
||||
ctrl_ird |= IETF_FLPDU_ZERO_LEN;
|
||||
|
||||
@@ -610,7 +657,7 @@ static void build_rdma0_msg(struct nes_cm_node *cm_node, struct nes_qp **nesqp_a
|
||||
struct nes_qp *nesqp = *nesqp_addr;
|
||||
struct nes_hw_qp_wqe *wqe = &nesqp->hwqp.sq_vbase[0];
|
||||
|
||||
u64temp = (unsigned long)nesqp;
|
||||
u64temp = (unsigned long)nesqp->nesuqp_addr;
|
||||
u64temp |= NES_SW_CONTEXT_ALIGN >> 1;
|
||||
set_wqe_64bit_value(wqe->wqe_words, NES_IWARP_SQ_WQE_COMP_CTX_LOW_IDX, u64temp);
|
||||
|
||||
@@ -1409,8 +1456,9 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
|
||||
|
||||
cm_node->mpa_frame_rev = mpa_version;
|
||||
cm_node->send_rdma0_op = SEND_RDMA_READ_ZERO;
|
||||
cm_node->ird_size = IETF_NO_IRD_ORD;
|
||||
cm_node->ord_size = IETF_NO_IRD_ORD;
|
||||
cm_node->mpav2_ird_ord = 0;
|
||||
cm_node->ird_size = 0;
|
||||
cm_node->ord_size = 0;
|
||||
|
||||
nes_debug(NES_DBG_CM, "Make node addresses : loc = %pI4:%x, rem = %pI4:%x\n",
|
||||
&cm_node->loc_addr, cm_node->loc_port,
|
||||
@@ -3027,11 +3075,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
rem_ref_cm_node(cm_node->cm_core, cm_node);
|
||||
return -ECONNRESET;
|
||||
}
|
||||
|
||||
/* associate the node with the QP */
|
||||
nesqp->cm_node = (void *)cm_node;
|
||||
cm_node->nesqp = nesqp;
|
||||
|
||||
|
||||
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);
|
||||
atomic_inc(&cm_accepts);
|
||||
@@ -3054,6 +3102,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
if (cm_node->mpa_frame_rev == IETF_MPA_V1)
|
||||
mpa_frame_offset = 4;
|
||||
|
||||
if (cm_node->mpa_frame_rev == IETF_MPA_V1 ||
|
||||
cm_node->mpav2_ird_ord == IETF_NO_IRD_ORD) {
|
||||
record_ird_ord(cm_node, (u16)conn_param->ird, (u16)conn_param->ord);
|
||||
}
|
||||
|
||||
memcpy(mpa_v2_frame->priv_data, conn_param->private_data,
|
||||
conn_param->private_data_len);
|
||||
|
||||
@@ -3117,7 +3170,6 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
}
|
||||
nesqp->skip_lsmm = 1;
|
||||
|
||||
|
||||
/* Cache the cm_id in the qp */
|
||||
nesqp->cm_id = cm_id;
|
||||
cm_node->cm_id = cm_id;
|
||||
@@ -3154,7 +3206,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
nesqp->nesqp_context->ird_ord_sizes |= cpu_to_le32(
|
||||
((u32)1 << NES_QPCONTEXT_ORDIRD_IWARP_MODE_SHIFT));
|
||||
nesqp->nesqp_context->ird_ord_sizes |=
|
||||
cpu_to_le32((u32)conn_param->ord);
|
||||
cpu_to_le32((u32)cm_node->ord_size);
|
||||
|
||||
memset(&nes_quad, 0, sizeof(nes_quad));
|
||||
nes_quad.DstIpAdrIndex =
|
||||
@@ -3194,6 +3246,9 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
cm_event.remote_addr = cm_id->remote_addr;
|
||||
cm_event.private_data = NULL;
|
||||
cm_event.private_data_len = 0;
|
||||
cm_event.ird = cm_node->ird_size;
|
||||
cm_event.ord = cm_node->ord_size;
|
||||
|
||||
ret = cm_id->event_handler(cm_id, &cm_event);
|
||||
attr.qp_state = IB_QPS_RTS;
|
||||
nes_modify_qp(&nesqp->ibqp, &attr, IB_QP_STATE, NULL);
|
||||
@@ -3290,14 +3345,8 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
|
||||
/* cache the cm_id in the qp */
|
||||
nesqp->cm_id = cm_id;
|
||||
|
||||
cm_id->provider_data = nesqp;
|
||||
|
||||
nesqp->private_data_len = conn_param->private_data_len;
|
||||
nesqp->nesqp_context->ird_ord_sizes |= cpu_to_le32((u32)conn_param->ord);
|
||||
/* space for rdma0 read msg */
|
||||
if (conn_param->ord == 0)
|
||||
nesqp->nesqp_context->ird_ord_sizes |= cpu_to_le32(1);
|
||||
|
||||
nes_debug(NES_DBG_CM, "requested ord = 0x%08X.\n", (u32)conn_param->ord);
|
||||
nes_debug(NES_DBG_CM, "mpa private data len =%u\n",
|
||||
@@ -3334,6 +3383,11 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
record_ird_ord(cm_node, (u16)conn_param->ird, (u16)conn_param->ord);
|
||||
if (cm_node->send_rdma0_op == SEND_RDMA_READ_ZERO &&
|
||||
cm_node->ord_size == 0)
|
||||
cm_node->ord_size = 1;
|
||||
|
||||
cm_node->apbvt_set = apbvt_set;
|
||||
nesqp->cm_node = cm_node;
|
||||
cm_node->nesqp = nesqp;
|
||||
@@ -3530,6 +3584,8 @@ static void cm_event_connected(struct nes_cm_event *event)
|
||||
nesqp->nesqp_context->ird_ord_sizes |=
|
||||
cpu_to_le32((u32)1 <<
|
||||
NES_QPCONTEXT_ORDIRD_IWARP_MODE_SHIFT);
|
||||
nesqp->nesqp_context->ird_ord_sizes |=
|
||||
cpu_to_le32((u32)cm_node->ord_size);
|
||||
|
||||
/* Adjust tail for not having a LSMM */
|
||||
/*nesqp->hwqp.sq_tail = 1;*/
|
||||
@@ -3742,8 +3798,13 @@ static void cm_event_mpa_req(struct nes_cm_event *event)
|
||||
cm_event_raddr->sin_addr.s_addr = htonl(event->cm_info.rem_addr);
|
||||
cm_event.private_data = cm_node->mpa_frame_buf;
|
||||
cm_event.private_data_len = (u8)cm_node->mpa_frame_size;
|
||||
if (cm_node->mpa_frame_rev == IETF_MPA_V1) {
|
||||
cm_event.ird = NES_MAX_IRD;
|
||||
cm_event.ord = NES_MAX_ORD;
|
||||
} else {
|
||||
cm_event.ird = cm_node->ird_size;
|
||||
cm_event.ord = cm_node->ord_size;
|
||||
}
|
||||
|
||||
ret = cm_id->event_handler(cm_id, &cm_event);
|
||||
if (ret)
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
#define IETF_RDMA0_WRITE 0x8000
|
||||
#define IETF_RDMA0_READ 0x4000
|
||||
#define IETF_NO_IRD_ORD 0x3FFF
|
||||
#define NES_MAX_IRD 0x40
|
||||
#define NES_MAX_ORD 0x7F
|
||||
|
||||
enum ietf_mpa_flags {
|
||||
IETF_MPA_FLAGS_MARKERS = 0x80, /* receive Markers */
|
||||
@@ -333,6 +335,7 @@ struct nes_cm_node {
|
||||
enum mpa_frame_version mpa_frame_rev;
|
||||
u16 ird_size;
|
||||
u16 ord_size;
|
||||
u16 mpav2_ird_ord;
|
||||
|
||||
u16 mpa_frame_size;
|
||||
struct iw_cm_id *cm_id;
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define NES_ABI_USERSPACE_VER 1
|
||||
#define NES_ABI_KERNEL_VER 1
|
||||
#define NES_ABI_USERSPACE_VER 2
|
||||
#define NES_ABI_KERNEL_VER 2
|
||||
|
||||
/*
|
||||
* Make sure that all structs defined in this file remain laid out so
|
||||
@@ -78,6 +78,7 @@ struct nes_create_cq_req {
|
||||
|
||||
struct nes_create_qp_req {
|
||||
__u64 user_wqe_buffers;
|
||||
__u64 user_qp_buffer;
|
||||
};
|
||||
|
||||
enum iwnes_memreg_type {
|
||||
|
||||
@@ -1186,11 +1186,13 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
|
||||
nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
|
||||
kfree(nesqp->allocated_buffer);
|
||||
nes_debug(NES_DBG_QP, "ib_copy_from_udata() Failed \n");
|
||||
return NULL;
|
||||
return ERR_PTR(-EFAULT);
|
||||
}
|
||||
if (req.user_wqe_buffers) {
|
||||
virt_wqs = 1;
|
||||
}
|
||||
if (req.user_qp_buffer)
|
||||
nesqp->nesuqp_addr = req.user_qp_buffer;
|
||||
if ((ibpd->uobject) && (ibpd->uobject->context)) {
|
||||
nesqp->user_mode = 1;
|
||||
nes_ucontext = to_nesucontext(ibpd->uobject->context);
|
||||
@@ -3135,9 +3137,7 @@ int nes_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
" original_last_aeq = 0x%04X. last_aeq = 0x%04X.\n",
|
||||
nesqp->hwqp.qp_id, atomic_read(&nesqp->refcount),
|
||||
original_last_aeq, nesqp->last_aeq);
|
||||
if ((!ret) ||
|
||||
((original_last_aeq != NES_AEQE_AEID_RDMAP_ROE_BAD_LLP_CLOSE) &&
|
||||
(ret))) {
|
||||
if (!ret || original_last_aeq != NES_AEQE_AEID_RDMAP_ROE_BAD_LLP_CLOSE) {
|
||||
if (dont_wait) {
|
||||
if (nesqp->cm_id && nesqp->hw_tcp_state != 0) {
|
||||
nes_debug(NES_DBG_MOD_QP, "QP%u Queuing fake disconnect for QP refcount (%d),"
|
||||
|
||||
Loaded 20 of 65 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user