Changeset View
Changeset View
Standalone View
Standalone View
sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | static int ipoib_cm_post_receive_nonsrq(struct ipoib_dev_priv *priv, | ||||
return ret; | return ret; | ||||
} | } | ||||
static struct mbuf * | static struct mbuf * | ||||
ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) | ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) | ||||
{ | { | ||||
return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, | return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, | ||||
priv->cm.max_cm_mtu); | sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu); | ||||
} | } | ||||
static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, | static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, | ||||
struct ipoib_cm_rx_buf *rx_ring) | struct ipoib_cm_rx_buf *rx_ring) | ||||
{ | { | ||||
int i; | int i; | ||||
for (i = 0; i < ipoib_recvq_size; ++i) | for (i = 0; i < ipoib_recvq_size; ++i) | ||||
▲ Show 20 Lines • Show All 314 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct ipoib_cm_rx_buf saverx; | struct ipoib_cm_rx_buf saverx; | ||||
struct ipoib_cm_rx_buf *rx_ring; | struct ipoib_cm_rx_buf *rx_ring; | ||||
unsigned int wr_id = wc->wr_id & ~(IPOIB_OP_CM | IPOIB_OP_RECV); | unsigned int wr_id = wc->wr_id & ~(IPOIB_OP_CM | IPOIB_OP_RECV); | ||||
struct ifnet *dev = priv->dev; | struct ifnet *dev = priv->dev; | ||||
struct mbuf *mb, *newmb; | struct mbuf *mb, *newmb; | ||||
struct ipoib_cm_rx *p; | struct ipoib_cm_rx *p; | ||||
int has_srq; | int has_srq; | ||||
u_short proto; | |||||
CURVNET_SET_QUIET(dev->if_vnet); | |||||
ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n", | ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n", | ||||
wr_id, wc->status); | wr_id, wc->status); | ||||
if (unlikely(wr_id >= ipoib_recvq_size)) { | if (unlikely(wr_id >= ipoib_recvq_size)) { | ||||
if (wr_id == (IPOIB_CM_RX_DRAIN_WRID & ~(IPOIB_OP_CM | IPOIB_OP_RECV))) { | if (wr_id == (IPOIB_CM_RX_DRAIN_WRID & ~(IPOIB_OP_CM | IPOIB_OP_RECV))) { | ||||
spin_lock(&priv->lock); | spin_lock(&priv->lock); | ||||
list_splice_init(&priv->cm.rx_drain_list, &priv->cm.rx_reap_list); | list_splice_init(&priv->cm.rx_drain_list, &priv->cm.rx_reap_list); | ||||
ipoib_cm_start_rx_drain(priv); | ipoib_cm_start_rx_drain(priv); | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc) | ||||
ipoib_cm_dma_unmap_rx(priv, &saverx); | ipoib_cm_dma_unmap_rx(priv, &saverx); | ||||
ipoib_dbg_data(priv, "received %d bytes, SLID 0x%04x\n", | ipoib_dbg_data(priv, "received %d bytes, SLID 0x%04x\n", | ||||
wc->byte_len, wc->slid); | wc->byte_len, wc->slid); | ||||
ipoib_dma_mb(priv, mb, wc->byte_len); | ipoib_dma_mb(priv, mb, wc->byte_len); | ||||
mb->m_pkthdr.rcvif = dev; | |||||
M_PREPEND(mb, sizeof(struct ipoib_pseudoheader), M_NOWAIT); | |||||
if (likely(mb != NULL)) { | |||||
struct ipoib_header *ibh; | |||||
if_inc_counter(dev, IFCOUNTER_IPACKETS, 1); | if_inc_counter(dev, IFCOUNTER_IPACKETS, 1); | ||||
if_inc_counter(dev, IFCOUNTER_IBYTES, mb->m_pkthdr.len); | if_inc_counter(dev, IFCOUNTER_IBYTES, mb->m_pkthdr.len); | ||||
mb->m_pkthdr.rcvif = dev; | /* fixup destination infiniband address */ | ||||
proto = *mtod(mb, uint16_t *); | ibh = mtod(mb, struct ipoib_header *); | ||||
m_adj(mb, IPOIB_ENCAP_LEN); | memset(ibh->hwaddr, 0, 4); | ||||
memcpy(ibh->hwaddr + 4, priv->local_gid.raw, sizeof(union ib_gid)); | |||||
IPOIB_MTAP_PROTO(dev, mb, proto); | dev->if_input(dev, mb); | ||||
ipoib_demux(dev, mb, ntohs(proto)); | } else { | ||||
if_inc_counter(dev, IFCOUNTER_IERRORS, 1); | |||||
} | |||||
repost: | repost: | ||||
if (has_srq) { | if (has_srq) { | ||||
if (unlikely(ipoib_cm_post_receive_srq(priv, wr_id))) | if (unlikely(ipoib_cm_post_receive_srq(priv, wr_id))) | ||||
ipoib_warn(priv, "ipoib_cm_post_receive_srq failed " | ipoib_warn(priv, "ipoib_cm_post_receive_srq failed " | ||||
"for buf %d\n", wr_id); | "for buf %d\n", wr_id); | ||||
} else { | } else { | ||||
if (unlikely(ipoib_cm_post_receive_nonsrq(priv, p, | if (unlikely(ipoib_cm_post_receive_nonsrq(priv, p, | ||||
&priv->cm.rx_wr, | &priv->cm.rx_wr, | ||||
priv->cm.rx_sge, | priv->cm.rx_sge, | ||||
wr_id))) { | wr_id))) { | ||||
--p->recv_count; | --p->recv_count; | ||||
ipoib_warn(priv, "ipoib_cm_post_receive_nonsrq failed " | ipoib_warn(priv, "ipoib_cm_post_receive_nonsrq failed " | ||||
"for buf %d\n", wr_id); | "for buf %d\n", wr_id); | ||||
} | } | ||||
} | } | ||||
done: | done: | ||||
CURVNET_RESTORE(); | |||||
return; | return; | ||||
} | } | ||||
static inline int post_send(struct ipoib_dev_priv *priv, | static inline int post_send(struct ipoib_dev_priv *priv, | ||||
struct ipoib_cm_tx *tx, | struct ipoib_cm_tx *tx, | ||||
struct ipoib_cm_tx_buf *tx_req, | struct ipoib_cm_tx_buf *tx_req, | ||||
unsigned int wr_id) | unsigned int wr_id) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 868 Lines • Show Last 20 Lines |