Whamcloud - gitweb
LU-15092 o2iblnd: Fix logic for unaligned transfer
[fs/lustre-release.git] / lnet / klnds / o2iblnd / o2iblnd.c
index 3407c22..e3a8845 100644 (file)
@@ -34,6 +34,7 @@
  */
 
 #include <asm/page.h>
+#include <linux/ethtool.h>
 #include <linux/inetdevice.h>
 
 #include "o2iblnd.h"
@@ -1463,7 +1464,7 @@ static int kiblnd_alloc_fmr_pool(struct kib_fmr_poolset *fps,
                                 struct kib_fmr_pool *fpo)
 {
        struct ib_fmr_pool_param param = {
-               .max_pages_per_fmr = LNET_MAX_IOV,
+               .max_pages_per_fmr = IBLND_MAX_RDMA_FRAGS,
                .page_shift        = PAGE_SHIFT,
                .access            = (IB_ACCESS_LOCAL_WRITE |
                                      IB_ACCESS_REMOTE_WRITE),
@@ -1514,7 +1515,7 @@ static int kiblnd_alloc_freg_pool(struct kib_fmr_poolset *fps,
 
 #ifndef HAVE_IB_MAP_MR_SG
                frd->frd_frpl = ib_alloc_fast_reg_page_list(fpo->fpo_hdev->ibh_ibdev,
-                                                           LNET_MAX_IOV);
+                                                           IBLND_MAX_RDMA_FRAGS);
                if (IS_ERR(frd->frd_frpl)) {
                        rc = PTR_ERR(frd->frd_frpl);
                        CERROR("Failed to allocate ib_fast_reg_page_list: %d\n",
@@ -1526,7 +1527,7 @@ static int kiblnd_alloc_freg_pool(struct kib_fmr_poolset *fps,
 
 #ifdef HAVE_IB_ALLOC_FAST_REG_MR
                frd->frd_mr = ib_alloc_fast_reg_mr(fpo->fpo_hdev->ibh_pd,
-                                                  LNET_MAX_IOV);
+                                                  IBLND_MAX_RDMA_FRAGS);
 #else
                /*
                 * it is expected to get here if this is an MLX-5 card.
@@ -1544,7 +1545,7 @@ static int kiblnd_alloc_freg_pool(struct kib_fmr_poolset *fps,
 #else
                                                IB_MR_TYPE_MEM_REG,
 #endif
-                                         LNET_MAX_IOV);
+                                         IBLND_MAX_RDMA_FRAGS);
                if ((*kiblnd_tunables.kib_use_fastreg_gaps == 1) &&
                    (dev_caps & IBLND_DEV_CAPS_FASTREG_GAPS_SUPPORT))
                        CWARN("using IB_MR_TYPE_SG_GAPS, expect a performance drop\n");
@@ -2222,13 +2223,13 @@ kiblnd_destroy_tx_pool(struct kib_pool *pool)
                        CFS_FREE_PTR_ARRAY(tx->tx_pages, LNET_MAX_IOV);
                if (tx->tx_frags != NULL)
                        CFS_FREE_PTR_ARRAY(tx->tx_frags,
-                                          (1 + IBLND_MAX_RDMA_FRAGS));
+                                          IBLND_MAX_RDMA_FRAGS);
                if (tx->tx_wrq != NULL)
                        CFS_FREE_PTR_ARRAY(tx->tx_wrq,
-                                          (1 + IBLND_MAX_RDMA_FRAGS));
+                                          IBLND_MAX_RDMA_FRAGS);
                if (tx->tx_sge != NULL)
                        CFS_FREE_PTR_ARRAY(tx->tx_sge,
-                                          (1 + IBLND_MAX_RDMA_FRAGS) *
+                                          IBLND_MAX_RDMA_FRAGS *
                                           wrq_sge);
                if (tx->tx_rd != NULL)
                        LIBCFS_FREE(tx->tx_rd,
@@ -2303,21 +2304,21 @@ kiblnd_create_tx_pool(struct kib_poolset *ps, int size, struct kib_pool **pp_po)
                }
 
                LIBCFS_CPT_ALLOC(tx->tx_frags, lnet_cpt_table(), ps->ps_cpt,
-                                (1 + IBLND_MAX_RDMA_FRAGS) *
+                                IBLND_MAX_RDMA_FRAGS *
                                 sizeof(*tx->tx_frags));
                if (tx->tx_frags == NULL)
                        break;
 
-               sg_init_table(tx->tx_frags, IBLND_MAX_RDMA_FRAGS + 1);
+               sg_init_table(tx->tx_frags, IBLND_MAX_RDMA_FRAGS);
 
                LIBCFS_CPT_ALLOC(tx->tx_wrq, lnet_cpt_table(), ps->ps_cpt,
-                                (1 + IBLND_MAX_RDMA_FRAGS) *
+                                IBLND_MAX_RDMA_FRAGS *
                                 sizeof(*tx->tx_wrq));
                if (tx->tx_wrq == NULL)
                        break;
 
                LIBCFS_CPT_ALLOC(tx->tx_sge, lnet_cpt_table(), ps->ps_cpt,
-                                (1 + IBLND_MAX_RDMA_FRAGS) * wrq_sge *
+                                IBLND_MAX_RDMA_FRAGS * wrq_sge *
                                 sizeof(*tx->tx_sge));
                if (tx->tx_sge == NULL)
                        break;