Skip to content

Commit e112373

Browse files
Eli CohenRoland Dreier
authored andcommitted
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 <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent df86661 commit e112373

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

drivers/infiniband/ulp/ipoib/ipoib.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ struct ipoib_tx_buf {
157157
u64 mapping[MAX_SKB_FRAGS + 1];
158158
};
159159

160+
struct ipoib_cm_tx_buf {
161+
struct sk_buff *skb;
162+
u64 mapping;
163+
};
164+
160165
struct ib_cm_id;
161166

162167
struct ipoib_cm_data {
@@ -215,7 +220,7 @@ struct ipoib_cm_tx {
215220
struct net_device *dev;
216221
struct ipoib_neigh *neigh;
217222
struct ipoib_path *path;
218-
struct ipoib_tx_buf *tx_ring;
223+
struct ipoib_cm_tx_buf *tx_ring;
219224
unsigned tx_head;
220225
unsigned tx_tail;
221226
unsigned long flags;

drivers/infiniband/ulp/ipoib/ipoib_cm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ static inline int post_send(struct ipoib_dev_priv *priv,
703703
void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx)
704704
{
705705
struct ipoib_dev_priv *priv = netdev_priv(dev);
706-
struct ipoib_tx_buf *tx_req;
706+
struct ipoib_cm_tx_buf *tx_req;
707707
u64 addr;
708708

709709
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_
734734
return;
735735
}
736736

737-
tx_req->mapping[0] = addr;
737+
tx_req->mapping = addr;
738738

739739
if (unlikely(post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1),
740740
addr, skb->len))) {
@@ -759,7 +759,7 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
759759
struct ipoib_dev_priv *priv = netdev_priv(dev);
760760
struct ipoib_cm_tx *tx = wc->qp->qp_context;
761761
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;
763763
unsigned long flags;
764764

765765
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)
773773

774774
tx_req = &tx->tx_ring[wr_id];
775775

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);
777777

778778
/* FIXME: is this right? Shouldn't we only increment on success? */
779779
++dev->stats.tx_packets;
@@ -1143,7 +1143,7 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
11431143
static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
11441144
{
11451145
struct ipoib_dev_priv *priv = netdev_priv(p->dev);
1146-
struct ipoib_tx_buf *tx_req;
1146+
struct ipoib_cm_tx_buf *tx_req;
11471147
unsigned long flags;
11481148
unsigned long begin;
11491149

@@ -1171,7 +1171,7 @@ static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
11711171

11721172
while ((int) p->tx_tail - (int) p->tx_head < 0) {
11731173
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,
11751175
DMA_TO_DEVICE);
11761176
dev_kfree_skb_any(tx_req->skb);
11771177
++p->tx_tail;

0 commit comments

Comments
 (0)