aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorEli Cohen <eli@dev.mellanox.co.il>2008-07-15 02:48:52 -0400
committerRoland Dreier <rolandd@cisco.com>2008-07-15 02:48:52 -0400
commite112373fd6aa280bd2cbc0d5cc3809115325a1be (patch)
treeaaefb13c2558ab1041e63035b71ee6d114b8c906 /drivers/infiniband/ulp
parentdf8666198dd058b9498ebdbc52c61957206d30a5 (diff)
IPoIB/cm: Reduce connected mode TX object size
Since IPoIB connected mode does not NETIF_F_SG, we only have one DMA mapping per send, so we don't need a mapping[] array. Define a new struct with a single u64 mapping member and use it for the CM tx_ring. Signed-off-by: Eli Cohen <eli@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h7
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c12
2 files changed, 12 insertions, 7 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index a89b9fbe1ef4..0281c8fecc90 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -157,6 +157,11 @@ struct ipoib_tx_buf {
157 u64 mapping[MAX_SKB_FRAGS + 1]; 157 u64 mapping[MAX_SKB_FRAGS + 1];
158}; 158};
159 159
160struct ipoib_cm_tx_buf {
161 struct sk_buff *skb;
162 u64 mapping;
163};
164
160struct ib_cm_id; 165struct ib_cm_id;
161 166
162struct ipoib_cm_data { 167struct ipoib_cm_data {
@@ -215,7 +220,7 @@ struct ipoib_cm_tx {
215 struct net_device *dev; 220 struct net_device *dev;
216 struct ipoib_neigh *neigh; 221 struct ipoib_neigh *neigh;
217 struct ipoib_path *path; 222 struct ipoib_path *path;
218 struct ipoib_tx_buf *tx_ring; 223 struct ipoib_cm_tx_buf *tx_ring;
219 unsigned tx_head; 224 unsigned tx_head;
220 unsigned tx_tail; 225 unsigned tx_tail;
221 unsigned long flags; 226 unsigned long flags;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 87f9f3ef3b2d..0f2d3045061a 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -703,7 +703,7 @@ static inline int post_send(struct ipoib_dev_priv *priv,
703void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx) 703void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx)
704{ 704{
705 struct ipoib_dev_priv *priv = netdev_priv(dev); 705 struct ipoib_dev_priv *priv = netdev_priv(dev);
706 struct ipoib_tx_buf *tx_req; 706 struct ipoib_cm_tx_buf *tx_req;
707 u64 addr; 707 u64 addr;
708 708
709 if (unlikely(skb->len > tx->mtu)) { 709 if (unlikely(skb->len > tx->mtu)) {
@@ -734,7 +734,7 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
734 return; 734 return;
735 } 735 }
736 736
737 tx_req->mapping[0] = addr; 737 tx_req->mapping = addr;
738 738
739 if (unlikely(post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1), 739 if (unlikely(post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1),
740 addr, skb->len))) { 740 addr, skb->len))) {
@@ -759,7 +759,7 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
759 struct ipoib_dev_priv *priv = netdev_priv(dev); 759 struct ipoib_dev_priv *priv = netdev_priv(dev);
760 struct ipoib_cm_tx *tx = wc->qp->qp_context; 760 struct ipoib_cm_tx *tx = wc->qp->qp_context;
761 unsigned int wr_id = wc->wr_id & ~IPOIB_OP_CM; 761 unsigned int wr_id = wc->wr_id & ~IPOIB_OP_CM;
762 struct ipoib_tx_buf *tx_req; 762 struct ipoib_cm_tx_buf *tx_req;
763 unsigned long flags; 763 unsigned long flags;
764 764
765 ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n", 765 ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n",
@@ -773,7 +773,7 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
773 773
774 tx_req = &tx->tx_ring[wr_id]; 774 tx_req = &tx->tx_ring[wr_id];
775 775
776 ib_dma_unmap_single(priv->ca, tx_req->mapping[0], tx_req->skb->len, DMA_TO_DEVICE); 776 ib_dma_unmap_single(priv->ca, tx_req->mapping, tx_req->skb->len, DMA_TO_DEVICE);
777 777
778 /* FIXME: is this right? Shouldn't we only increment on success? */ 778 /* FIXME: is this right? Shouldn't we only increment on success? */
779 ++dev->stats.tx_packets; 779 ++dev->stats.tx_packets;
@@ -1143,7 +1143,7 @@ err_tx:
1143static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p) 1143static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
1144{ 1144{
1145 struct ipoib_dev_priv *priv = netdev_priv(p->dev); 1145 struct ipoib_dev_priv *priv = netdev_priv(p->dev);
1146 struct ipoib_tx_buf *tx_req; 1146 struct ipoib_cm_tx_buf *tx_req;
1147 unsigned long flags; 1147 unsigned long flags;
1148 unsigned long begin; 1148 unsigned long begin;
1149 1149
@@ -1171,7 +1171,7 @@ timeout:
1171 1171
1172 while ((int) p->tx_tail - (int) p->tx_head < 0) { 1172 while ((int) p->tx_tail - (int) p->tx_head < 0) {
1173 tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)]; 1173 tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)];
1174 ib_dma_unmap_single(priv->ca, tx_req->mapping[0], tx_req->skb->len, 1174 ib_dma_unmap_single(priv->ca, tx_req->mapping, tx_req->skb->len,
1175 DMA_TO_DEVICE); 1175 DMA_TO_DEVICE);
1176 dev_kfree_skb_any(tx_req->skb); 1176 dev_kfree_skb_any(tx_req->skb);
1177 ++p->tx_tail; 1177 ++p->tx_tail;