aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/ipoib/ipoib_cm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/ulp/ipoib/ipoib_cm.c')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 91c959299910..6223fc39af70 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -523,6 +523,7 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
523 u64 mapping[IPOIB_CM_RX_SG]; 523 u64 mapping[IPOIB_CM_RX_SG];
524 int frags; 524 int frags;
525 int has_srq; 525 int has_srq;
526 struct sk_buff *small_skb;
526 527
527 ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n", 528 ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n",
528 wr_id, wc->status); 529 wr_id, wc->status);
@@ -577,6 +578,23 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
577 } 578 }
578 } 579 }
579 580
581 if (wc->byte_len < IPOIB_CM_COPYBREAK) {
582 int dlen = wc->byte_len;
583
584 small_skb = dev_alloc_skb(dlen + 12);
585 if (small_skb) {
586 skb_reserve(small_skb, 12);
587 ib_dma_sync_single_for_cpu(priv->ca, rx_ring[wr_id].mapping[0],
588 dlen, DMA_FROM_DEVICE);
589 skb_copy_from_linear_data(skb, small_skb->data, dlen);
590 ib_dma_sync_single_for_device(priv->ca, rx_ring[wr_id].mapping[0],
591 dlen, DMA_FROM_DEVICE);
592 skb_put(small_skb, dlen);
593 skb = small_skb;
594 goto copied;
595 }
596 }
597
580 frags = PAGE_ALIGN(wc->byte_len - min(wc->byte_len, 598 frags = PAGE_ALIGN(wc->byte_len - min(wc->byte_len,
581 (unsigned)IPOIB_CM_HEAD_SIZE)) / PAGE_SIZE; 599 (unsigned)IPOIB_CM_HEAD_SIZE)) / PAGE_SIZE;
582 600
@@ -599,6 +617,7 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
599 617
600 skb_put_frags(skb, IPOIB_CM_HEAD_SIZE, wc->byte_len, newskb); 618 skb_put_frags(skb, IPOIB_CM_HEAD_SIZE, wc->byte_len, newskb);
601 619
620copied:
602 skb->protocol = ((struct ipoib_header *) skb->data)->proto; 621 skb->protocol = ((struct ipoib_header *) skb->data)->proto;
603 skb_reset_mac_header(skb); 622 skb_reset_mac_header(skb);
604 skb_pull(skb, IPOIB_ENCAP_LEN); 623 skb_pull(skb, IPOIB_ENCAP_LEN);