diff options
author | Or Gerlitz <ogerlitz@mellanox.com> | 2012-01-11 12:03:51 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-03-08 15:34:27 -0500 |
commit | d927d505c59a0c7353343174e6225c43c61fba6d (patch) | |
tree | 8fe928291acb9c6975f7c03514566933edeef7d5 | |
parent | 3eae7c9f97415ac1f5ab5db4eeb03cde689eb427 (diff) |
IB: Change CQE "csum_ok" field to a bit flag
Use a bit in wc_flags rather then a whole integer to hold the
"checksum OK" flag. By itself, this change doesn't reduce the size of
struct ib_wc on 64bit machines -- it stays on 56 bytes because of
padding. However, it will allow to add more fields in the future
without enlarging the struct. Also, it will let us have a unified
approach with future libibverbs checksum offload reporting, because a
bit flag doesn't break the library ABI.
This patch was suggested during conversation with Liran Liss
<liranl@mellanox.com>.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/hw/mlx4/cq.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_cq.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_rc.c | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_uc.c | 1 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ib.c | 3 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 2 |
6 files changed, 7 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 5ecf38d97269..09eb1d19e72d 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -720,7 +720,8 @@ repoll: | |||
720 | wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; | 720 | wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; |
721 | wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IB_WC_GRH : 0; | 721 | wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IB_WC_GRH : 0; |
722 | wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f; | 722 | wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f; |
723 | wc->csum_ok = mlx4_ib_ipoib_csum_ok(cqe->status, cqe->checksum); | 723 | wc->wc_flags |= mlx4_ib_ipoib_csum_ok(cqe->status, |
724 | cqe->checksum) ? IB_WC_IP_CSUM_OK : 0; | ||
724 | if (rdma_port_get_link_layer(wc->qp->device, | 725 | if (rdma_port_get_link_layer(wc->qp->device, |
725 | (*cur_qp)->port) == IB_LINK_LAYER_ETHERNET) | 726 | (*cur_qp)->port) == IB_LINK_LAYER_ETHERNET) |
726 | wc->sl = be16_to_cpu(cqe->sl_vid) >> 13; | 727 | wc->sl = be16_to_cpu(cqe->sl_vid) >> 13; |
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c index 53157b86a1ba..40ba83338155 100644 --- a/drivers/infiniband/hw/mthca/mthca_cq.c +++ b/drivers/infiniband/hw/mthca/mthca_cq.c | |||
@@ -643,7 +643,8 @@ static inline int mthca_poll_one(struct mthca_dev *dev, | |||
643 | entry->wc_flags |= cqe->g_mlpath & 0x80 ? IB_WC_GRH : 0; | 643 | entry->wc_flags |= cqe->g_mlpath & 0x80 ? IB_WC_GRH : 0; |
644 | checksum = (be32_to_cpu(cqe->rqpn) >> 24) | | 644 | checksum = (be32_to_cpu(cqe->rqpn) >> 24) | |
645 | ((be32_to_cpu(cqe->my_ee) >> 16) & 0xff00); | 645 | ((be32_to_cpu(cqe->my_ee) >> 16) & 0xff00); |
646 | entry->csum_ok = (cqe->sl_ipok & 1 && checksum == 0xffff); | 646 | entry->wc_flags |= (cqe->sl_ipok & 1 && checksum == 0xffff) ? |
647 | IB_WC_IP_CSUM_OK : 0; | ||
647 | } | 648 | } |
648 | 649 | ||
649 | entry->status = IB_WC_SUCCESS; | 650 | entry->status = IB_WC_SUCCESS; |
diff --git a/drivers/infiniband/hw/qib/qib_rc.c b/drivers/infiniband/hw/qib/qib_rc.c index 894afac26f3b..765b4cbaa020 100644 --- a/drivers/infiniband/hw/qib/qib_rc.c +++ b/drivers/infiniband/hw/qib/qib_rc.c | |||
@@ -2048,7 +2048,6 @@ send_last: | |||
2048 | wc.pkey_index = 0; | 2048 | wc.pkey_index = 0; |
2049 | wc.dlid_path_bits = 0; | 2049 | wc.dlid_path_bits = 0; |
2050 | wc.port_num = 0; | 2050 | wc.port_num = 0; |
2051 | wc.csum_ok = 0; | ||
2052 | /* Signal completion event if the solicited bit is set. */ | 2051 | /* Signal completion event if the solicited bit is set. */ |
2053 | qib_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, | 2052 | qib_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, |
2054 | (ohdr->bth[0] & | 2053 | (ohdr->bth[0] & |
diff --git a/drivers/infiniband/hw/qib/qib_uc.c b/drivers/infiniband/hw/qib/qib_uc.c index 847e7afdfd94..7ce2ac2ed219 100644 --- a/drivers/infiniband/hw/qib/qib_uc.c +++ b/drivers/infiniband/hw/qib/qib_uc.c | |||
@@ -422,7 +422,6 @@ last_imm: | |||
422 | wc.pkey_index = 0; | 422 | wc.pkey_index = 0; |
423 | wc.dlid_path_bits = 0; | 423 | wc.dlid_path_bits = 0; |
424 | wc.port_num = 0; | 424 | wc.port_num = 0; |
425 | wc.csum_ok = 0; | ||
426 | /* Signal completion event if the solicited bit is set. */ | 425 | /* Signal completion event if the solicited bit is set. */ |
427 | qib_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, | 426 | qib_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, |
428 | (ohdr->bth[0] & | 427 | (ohdr->bth[0] & |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 4115be54ba3b..5c1bc995e560 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -296,7 +296,8 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc) | |||
296 | dev->stats.rx_bytes += skb->len; | 296 | dev->stats.rx_bytes += skb->len; |
297 | 297 | ||
298 | skb->dev = dev; | 298 | skb->dev = dev; |
299 | if ((dev->features & NETIF_F_RXCSUM) && likely(wc->csum_ok)) | 299 | if ((dev->features & NETIF_F_RXCSUM) && |
300 | likely(wc->wc_flags & IB_WC_IP_CSUM_OK)) | ||
300 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 301 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
301 | 302 | ||
302 | napi_gro_receive(&priv->napi, skb); | 303 | napi_gro_receive(&priv->napi, skb); |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index ff22a73e0937..c3cca5a4dacd 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -518,6 +518,7 @@ enum ib_wc_flags { | |||
518 | IB_WC_GRH = 1, | 518 | IB_WC_GRH = 1, |
519 | IB_WC_WITH_IMM = (1<<1), | 519 | IB_WC_WITH_IMM = (1<<1), |
520 | IB_WC_WITH_INVALIDATE = (1<<2), | 520 | IB_WC_WITH_INVALIDATE = (1<<2), |
521 | IB_WC_IP_CSUM_OK = (1<<3), | ||
521 | }; | 522 | }; |
522 | 523 | ||
523 | struct ib_wc { | 524 | struct ib_wc { |
@@ -538,7 +539,6 @@ struct ib_wc { | |||
538 | u8 sl; | 539 | u8 sl; |
539 | u8 dlid_path_bits; | 540 | u8 dlid_path_bits; |
540 | u8 port_num; /* valid only for DR SMPs on switches */ | 541 | u8 port_num; /* valid only for DR SMPs on switches */ |
541 | int csum_ok; | ||
542 | }; | 542 | }; |
543 | 543 | ||
544 | enum ib_cq_notify_flags { | 544 | enum ib_cq_notify_flags { |