Lines Matching refs:p
213 struct ipoib_cm_rx *p; in ipoib_cm_start_rx_drain() local
225 p = list_entry(priv->cm.rx_flush_list.next, typeof(*p), list); in ipoib_cm_start_rx_drain()
227 if (ib_post_send(p->qp, &ipoib_cm_rx_drain_wr, NULL)) in ipoib_cm_start_rx_drain()
235 struct ipoib_cm_rx *p = ctx; in ipoib_cm_rx_event_handler() local
236 struct ipoib_dev_priv *priv = ipoib_priv(p->dev); in ipoib_cm_rx_event_handler()
243 list_move(&p->list, &priv->cm.rx_flush_list); in ipoib_cm_rx_event_handler()
244 p->state = IPOIB_CM_RX_FLUSH; in ipoib_cm_rx_event_handler()
250 struct ipoib_cm_rx *p) in ipoib_cm_create_rx_qp() argument
262 .qp_context = p, in ipoib_cm_create_rx_qp()
447 struct ipoib_cm_rx *p; in ipoib_cm_req_handler() local
452 p = kzalloc(sizeof(*p), GFP_KERNEL); in ipoib_cm_req_handler()
453 if (!p) in ipoib_cm_req_handler()
455 p->dev = dev; in ipoib_cm_req_handler()
456 p->id = cm_id; in ipoib_cm_req_handler()
457 cm_id->context = p; in ipoib_cm_req_handler()
458 p->state = IPOIB_CM_RX_LIVE; in ipoib_cm_req_handler()
459 p->jiffies = jiffies; in ipoib_cm_req_handler()
460 INIT_LIST_HEAD(&p->list); in ipoib_cm_req_handler()
462 p->qp = ipoib_cm_create_rx_qp(dev, p); in ipoib_cm_req_handler()
463 if (IS_ERR(p->qp)) { in ipoib_cm_req_handler()
464 ret = PTR_ERR(p->qp); in ipoib_cm_req_handler()
469 ret = ipoib_cm_modify_rx_qp(dev, cm_id, p->qp, psn); in ipoib_cm_req_handler()
474 ret = ipoib_cm_nonsrq_init_rx(dev, cm_id, p); in ipoib_cm_req_handler()
484 p->jiffies = jiffies; in ipoib_cm_req_handler()
485 if (p->state == IPOIB_CM_RX_LIVE) in ipoib_cm_req_handler()
486 list_move(&p->list, &priv->cm.passive_ids); in ipoib_cm_req_handler()
489 ret = ipoib_cm_send_rep(dev, cm_id, p->qp, &event->param.req_rcvd, psn); in ipoib_cm_req_handler()
492 if (ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE)) in ipoib_cm_req_handler()
498 ib_destroy_qp(p->qp); in ipoib_cm_req_handler()
500 kfree(p); in ipoib_cm_req_handler()
507 struct ipoib_cm_rx *p; in ipoib_cm_rx_handler() local
517 p = cm_id->context; in ipoib_cm_rx_handler()
518 priv = ipoib_priv(p->dev); in ipoib_cm_rx_handler()
519 if (ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE)) in ipoib_cm_rx_handler()
566 struct ipoib_cm_rx *p; in ipoib_cm_handle_rx_wc() local
589 p = wc->qp->qp_context; in ipoib_cm_handle_rx_wc()
592 rx_ring = has_srq ? priv->cm.srq_ring : p->rx_ring; in ipoib_cm_handle_rx_wc()
604 if (!--p->recv_count) { in ipoib_cm_handle_rx_wc()
606 list_move(&p->list, &priv->cm.rx_reap_list); in ipoib_cm_handle_rx_wc()
615 if (p && time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_UPDATE_TIME)) { in ipoib_cm_handle_rx_wc()
617 p->jiffies = jiffies; in ipoib_cm_handle_rx_wc()
620 if (p->state == IPOIB_CM_RX_LIVE) in ipoib_cm_handle_rx_wc()
621 list_move(&p->list, &priv->cm.passive_ids); in ipoib_cm_handle_rx_wc()
685 if (unlikely(ipoib_cm_post_receive_nonsrq(dev, p, in ipoib_cm_handle_rx_wc()
689 --p->recv_count; in ipoib_cm_handle_rx_wc()
930 struct ipoib_cm_rx *p; in ipoib_cm_dev_stop() local
942 p = list_entry(priv->cm.passive_ids.next, typeof(*p), list); in ipoib_cm_dev_stop()
943 list_move(&p->list, &priv->cm.rx_error_list); in ipoib_cm_dev_stop()
944 p->state = IPOIB_CM_RX_ERROR; in ipoib_cm_dev_stop()
946 ret = ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE); in ipoib_cm_dev_stop()
988 struct ipoib_cm_tx *p = cm_id->context; in ipoib_cm_rep_handler() local
989 struct ipoib_dev_priv *priv = ipoib_priv(p->dev); in ipoib_cm_rep_handler()
996 p->mtu = be32_to_cpu(data->mtu); in ipoib_cm_rep_handler()
998 if (p->mtu <= IPOIB_ENCAP_LEN) { in ipoib_cm_rep_handler()
1000 p->mtu, IPOIB_ENCAP_LEN); in ipoib_cm_rep_handler()
1012 ret = ib_modify_qp(p->qp, &qp_attr, qp_attr_mask); in ipoib_cm_rep_handler()
1024 ret = ib_modify_qp(p->qp, &qp_attr, qp_attr_mask); in ipoib_cm_rep_handler()
1032 netif_tx_lock_bh(p->dev); in ipoib_cm_rep_handler()
1034 set_bit(IPOIB_FLAG_OPER_UP, &p->flags); in ipoib_cm_rep_handler()
1035 if (p->neigh) in ipoib_cm_rep_handler()
1036 while ((skb = __skb_dequeue(&p->neigh->queue))) in ipoib_cm_rep_handler()
1039 netif_tx_unlock_bh(p->dev); in ipoib_cm_rep_handler()
1042 skb->dev = p->dev; in ipoib_cm_rep_handler()
1140 static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn, in ipoib_cm_tx_init() argument
1143 struct ipoib_dev_priv *priv = ipoib_priv(p->dev); in ipoib_cm_tx_init()
1148 p->tx_ring = vzalloc(array_size(ipoib_sendq_size, sizeof(*p->tx_ring))); in ipoib_cm_tx_init()
1149 if (!p->tx_ring) { in ipoib_cm_tx_init()
1155 p->qp = ipoib_cm_create_tx_qp(p->dev, p); in ipoib_cm_tx_init()
1157 if (IS_ERR(p->qp)) { in ipoib_cm_tx_init()
1158 ret = PTR_ERR(p->qp); in ipoib_cm_tx_init()
1163 p->id = ib_create_cm_id(priv->ca, ipoib_cm_tx_handler, p); in ipoib_cm_tx_init()
1164 if (IS_ERR(p->id)) { in ipoib_cm_tx_init()
1165 ret = PTR_ERR(p->id); in ipoib_cm_tx_init()
1170 ret = ipoib_cm_modify_tx_init(p->dev, p->id, p->qp); in ipoib_cm_tx_init()
1176 ret = ipoib_cm_send_req(p->dev, p->id, p->qp, qpn, pathrec); in ipoib_cm_tx_init()
1183 p->qp->qp_num, pathrec->dgid.raw, qpn); in ipoib_cm_tx_init()
1188 ib_destroy_cm_id(p->id); in ipoib_cm_tx_init()
1190 p->id = NULL; in ipoib_cm_tx_init()
1191 ib_destroy_qp(p->qp); in ipoib_cm_tx_init()
1193 p->qp = NULL; in ipoib_cm_tx_init()
1194 vfree(p->tx_ring); in ipoib_cm_tx_init()
1199 static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p) in ipoib_cm_tx_destroy() argument
1201 struct ipoib_dev_priv *priv = ipoib_priv(p->dev); in ipoib_cm_tx_destroy()
1206 p->qp ? p->qp->qp_num : 0, p->tx_head, p->tx_tail); in ipoib_cm_tx_destroy()
1208 if (p->id) in ipoib_cm_tx_destroy()
1209 ib_destroy_cm_id(p->id); in ipoib_cm_tx_destroy()
1211 if (p->tx_ring) { in ipoib_cm_tx_destroy()
1214 while ((int) p->tx_tail - (int) p->tx_head < 0) { in ipoib_cm_tx_destroy()
1217 p->tx_head - p->tx_tail); in ipoib_cm_tx_destroy()
1227 while ((int) p->tx_tail - (int) p->tx_head < 0) { in ipoib_cm_tx_destroy()
1228 tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)]; in ipoib_cm_tx_destroy()
1231 netif_tx_lock_bh(p->dev); in ipoib_cm_tx_destroy()
1232 ++p->tx_tail; in ipoib_cm_tx_destroy()
1236 netif_queue_stopped(p->dev) && in ipoib_cm_tx_destroy()
1238 netif_wake_queue(p->dev); in ipoib_cm_tx_destroy()
1239 netif_tx_unlock_bh(p->dev); in ipoib_cm_tx_destroy()
1242 if (p->qp) in ipoib_cm_tx_destroy()
1243 ib_destroy_qp(p->qp); in ipoib_cm_tx_destroy()
1245 vfree(p->tx_ring); in ipoib_cm_tx_destroy()
1246 kfree(p); in ipoib_cm_tx_destroy()
1343 struct ipoib_cm_tx *p; in ipoib_cm_tx_start() local
1355 p = list_entry(priv->cm.start_list.next, typeof(*p), list); in ipoib_cm_tx_start()
1356 list_del_init(&p->list); in ipoib_cm_tx_start()
1357 neigh = p->neigh; in ipoib_cm_tx_start()
1376 ret = ipoib_cm_tx_init(p, qpn, &pathrec); in ipoib_cm_tx_start()
1383 neigh = p->neigh; in ipoib_cm_tx_start()
1388 list_del(&p->list); in ipoib_cm_tx_start()
1389 kfree(p); in ipoib_cm_tx_start()
1402 struct ipoib_cm_tx *p; in ipoib_cm_tx_reap() local
1409 p = list_entry(priv->cm.reap_list.next, typeof(*p), list); in ipoib_cm_tx_reap()
1410 list_del_init(&p->list); in ipoib_cm_tx_reap()
1413 ipoib_cm_tx_destroy(p); in ipoib_cm_tx_reap()
1481 struct ipoib_cm_rx *p; in ipoib_cm_stale_task() local
1488 p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list); in ipoib_cm_stale_task()
1489 if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT)) in ipoib_cm_stale_task()
1491 list_move(&p->list, &priv->cm.rx_error_list); in ipoib_cm_stale_task()
1492 p->state = IPOIB_CM_RX_ERROR; in ipoib_cm_stale_task()
1494 ret = ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE); in ipoib_cm_stale_task()