Changeset View
Changeset View
Standalone View
Standalone View
sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | |||||
ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) | ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) | ||||
{ | { | ||||
m_adj(mb, -(mb->m_pkthdr.len - length)); | m_adj(mb, -(mb->m_pkthdr.len - length)); | ||||
} | } | ||||
struct mbuf * | struct mbuf * | ||||
ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, | ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, | ||||
int size) | int align, int size) | ||||
{ | { | ||||
struct mbuf *mb, *m; | struct mbuf *mb, *m; | ||||
int i, j; | int i, j; | ||||
rx_req->mb = NULL; | rx_req->mb = NULL; | ||||
mb = m_getm2(NULL, size, M_NOWAIT, MT_DATA, M_PKTHDR); | mb = m_getm2(NULL, align + size, M_NOWAIT, MT_DATA, M_PKTHDR); | ||||
if (mb == NULL) | if (mb == NULL) | ||||
return (NULL); | return (NULL); | ||||
for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { | for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { | ||||
m->m_len = M_SIZE(m); | m->m_len = M_SIZE(m) - align; | ||||
m->m_data += align; | |||||
align = 0; | |||||
mb->m_pkthdr.len += m->m_len; | mb->m_pkthdr.len += m->m_len; | ||||
rx_req->mapping[i] = ib_dma_map_single(priv->ca, | rx_req->mapping[i] = ib_dma_map_single(priv->ca, | ||||
mtod(m, void *), m->m_len, DMA_FROM_DEVICE); | mtod(m, void *), m->m_len, DMA_FROM_DEVICE); | ||||
if (unlikely(ib_dma_mapping_error(priv->ca, | if (unlikely(ib_dma_mapping_error(priv->ca, | ||||
rx_req->mapping[i]))) | rx_req->mapping[i]))) | ||||
goto error; | goto error; | ||||
} | } | ||||
Show All 35 Lines | static int ipoib_ib_post_receive(struct ipoib_dev_priv *priv, int id) | ||||
return ret; | return ret; | ||||
} | } | ||||
static struct mbuf * | static struct mbuf * | ||||
ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) | ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) | ||||
{ | { | ||||
return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], | return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], | ||||
priv->max_ib_mtu + IB_GRH_BYTES); | 0, priv->max_ib_mtu + IB_GRH_BYTES); | ||||
} | } | ||||
static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) | static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) | ||||
{ | { | ||||
int i; | int i; | ||||
for (i = 0; i < ipoib_recvq_size; ++i) { | for (i = 0; i < ipoib_recvq_size; ++i) { | ||||
if (!ipoib_alloc_rx_mb(priv, i)) { | if (!ipoib_alloc_rx_mb(priv, i)) { | ||||
▲ Show 20 Lines • Show All 848 Lines • Show Last 20 Lines |