aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@ZenIV.linux.org.uk>2014-11-20 03:13:57 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-21 14:58:18 -0500
commit479163f4608214d18bc3266ab6e4b578897a3052 (patch)
treecf8433299f46dc9118a293f47fa4aa16db554fac
parentc92d418f97aa2a35591601dc0b90cfc5fa8c603c (diff)
mlx5: don't duplicate kvfree()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Eli Cohen <eli@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/infiniband/hw/mlx5/cq.c8
-rw-r--r--drivers/infiniband/hw/mlx5/mr.c4
-rw-r--r--drivers/infiniband/hw/mlx5/qp.c8
-rw-r--r--drivers/infiniband/hw/mlx5/srq.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eq.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/port.c4
-rw-r--r--include/linux/mlx5/driver.h8
8 files changed, 19 insertions, 27 deletions
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index 10cfce5119a9..c463e7bba5f4 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -805,14 +805,14 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int entries,
805 } 805 }
806 806
807 807
808 mlx5_vfree(cqb); 808 kvfree(cqb);
809 return &cq->ibcq; 809 return &cq->ibcq;
810 810
811err_cmd: 811err_cmd:
812 mlx5_core_destroy_cq(dev->mdev, &cq->mcq); 812 mlx5_core_destroy_cq(dev->mdev, &cq->mcq);
813 813
814err_cqb: 814err_cqb:
815 mlx5_vfree(cqb); 815 kvfree(cqb);
816 if (context) 816 if (context)
817 destroy_cq_user(cq, context); 817 destroy_cq_user(cq, context);
818 else 818 else
@@ -1159,11 +1159,11 @@ int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
1159 } 1159 }
1160 mutex_unlock(&cq->resize_mutex); 1160 mutex_unlock(&cq->resize_mutex);
1161 1161
1162 mlx5_vfree(in); 1162 kvfree(in);
1163 return 0; 1163 return 0;
1164 1164
1165ex_alloc: 1165ex_alloc:
1166 mlx5_vfree(in); 1166 kvfree(in);
1167 1167
1168ex_resize: 1168ex_resize:
1169 if (udata) 1169 if (udata)
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 8ee7cb46e059..4c89b64aa9cf 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -853,14 +853,14 @@ static struct mlx5_ib_mr *reg_create(struct ib_pd *pd, u64 virt_addr,
853 goto err_2; 853 goto err_2;
854 } 854 }
855 mr->umem = umem; 855 mr->umem = umem;
856 mlx5_vfree(in); 856 kvfree(in);
857 857
858 mlx5_ib_dbg(dev, "mkey = 0x%x\n", mr->mmr.key); 858 mlx5_ib_dbg(dev, "mkey = 0x%x\n", mr->mmr.key);
859 859
860 return mr; 860 return mr;
861 861
862err_2: 862err_2:
863 mlx5_vfree(in); 863 kvfree(in);
864 864
865err_1: 865err_1:
866 kfree(mr); 866 kfree(mr);
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index e261a53f9a02..0e2ef9fe0e29 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -647,7 +647,7 @@ err_unmap:
647 mlx5_ib_db_unmap_user(context, &qp->db); 647 mlx5_ib_db_unmap_user(context, &qp->db);
648 648
649err_free: 649err_free:
650 mlx5_vfree(*in); 650 kvfree(*in);
651 651
652err_umem: 652err_umem:
653 if (qp->umem) 653 if (qp->umem)
@@ -761,7 +761,7 @@ err_wrid:
761 kfree(qp->rq.wrid); 761 kfree(qp->rq.wrid);
762 762
763err_free: 763err_free:
764 mlx5_vfree(*in); 764 kvfree(*in);
765 765
766err_buf: 766err_buf:
767 mlx5_buf_free(dev->mdev, &qp->buf); 767 mlx5_buf_free(dev->mdev, &qp->buf);
@@ -971,7 +971,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
971 goto err_create; 971 goto err_create;
972 } 972 }
973 973
974 mlx5_vfree(in); 974 kvfree(in);
975 /* Hardware wants QPN written in big-endian order (after 975 /* Hardware wants QPN written in big-endian order (after
976 * shifting) for send doorbell. Precompute this value to save 976 * shifting) for send doorbell. Precompute this value to save
977 * a little bit when posting sends. 977 * a little bit when posting sends.
@@ -988,7 +988,7 @@ err_create:
988 else if (qp->create_type == MLX5_QP_KERNEL) 988 else if (qp->create_type == MLX5_QP_KERNEL)
989 destroy_qp_kernel(dev, qp); 989 destroy_qp_kernel(dev, qp);
990 990
991 mlx5_vfree(in); 991 kvfree(in);
992 return err; 992 return err;
993} 993}
994 994
diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c
index 97cc1baaa8e3..41fec66217dd 100644
--- a/drivers/infiniband/hw/mlx5/srq.c
+++ b/drivers/infiniband/hw/mlx5/srq.c
@@ -141,7 +141,7 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq,
141 return 0; 141 return 0;
142 142
143err_in: 143err_in:
144 mlx5_vfree(*in); 144 kvfree(*in);
145 145
146err_umem: 146err_umem:
147 ib_umem_release(srq->umem); 147 ib_umem_release(srq->umem);
@@ -209,7 +209,7 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq,
209 return 0; 209 return 0;
210 210
211err_in: 211err_in:
212 mlx5_vfree(*in); 212 kvfree(*in);
213 213
214err_buf: 214err_buf:
215 mlx5_buf_free(dev->mdev, &srq->buf); 215 mlx5_buf_free(dev->mdev, &srq->buf);
@@ -306,7 +306,7 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,
306 in->ctx.pd = cpu_to_be32(to_mpd(pd)->pdn); 306 in->ctx.pd = cpu_to_be32(to_mpd(pd)->pdn);
307 in->ctx.db_record = cpu_to_be64(srq->db.dma); 307 in->ctx.db_record = cpu_to_be64(srq->db.dma);
308 err = mlx5_core_create_srq(dev->mdev, &srq->msrq, in, inlen); 308 err = mlx5_core_create_srq(dev->mdev, &srq->msrq, in, inlen);
309 mlx5_vfree(in); 309 kvfree(in);
310 if (err) { 310 if (err) {
311 mlx5_ib_dbg(dev, "create SRQ failed, err %d\n", err); 311 mlx5_ib_dbg(dev, "create SRQ failed, err %d\n", err);
312 goto err_usr_kern_srq; 312 goto err_usr_kern_srq;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index ad2c96a02a53..dfd3ad0a39c1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -390,7 +390,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
390 */ 390 */
391 eq_update_ci(eq, 1); 391 eq_update_ci(eq, 1);
392 392
393 mlx5_vfree(in); 393 kvfree(in);
394 return 0; 394 return 0;
395 395
396err_irq: 396err_irq:
@@ -400,7 +400,7 @@ err_eq:
400 mlx5_cmd_destroy_eq(dev, eq->eqn); 400 mlx5_cmd_destroy_eq(dev, eq->eqn);
401 401
402err_in: 402err_in:
403 mlx5_vfree(in); 403 kvfree(in);
404 404
405err_buf: 405err_buf:
406 mlx5_buf_free(dev, &eq->buf); 406 mlx5_buf_free(dev, &eq->buf);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index d476918ef269..4fdaae9b54d9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -349,7 +349,7 @@ out_4k:
349 for (i--; i >= 0; i--) 349 for (i--; i >= 0; i--)
350 free_4k(dev, be64_to_cpu(in->pas[i])); 350 free_4k(dev, be64_to_cpu(in->pas[i]));
351out_free: 351out_free:
352 mlx5_vfree(in); 352 kvfree(in);
353 return err; 353 return err;
354} 354}
355 355
@@ -400,7 +400,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages,
400 } 400 }
401 401
402out_free: 402out_free:
403 mlx5_vfree(out); 403 kvfree(out);
404 return err; 404 return err;
405} 405}
406 406
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
index 313965853e10..72c2d002c3b8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
@@ -68,9 +68,9 @@ int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
68 memcpy(data_out, out->data, size_out); 68 memcpy(data_out, out->data, size_out);
69 69
70ex2: 70ex2:
71 mlx5_vfree(out); 71 kvfree(out);
72ex1: 72ex1:
73 mlx5_vfree(in); 73 kvfree(in);
74 return err; 74 return err;
75} 75}
76EXPORT_SYMBOL_GPL(mlx5_core_access_reg); 76EXPORT_SYMBOL_GPL(mlx5_core_access_reg);
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 246310dc8bef..b1bf41556b32 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -633,14 +633,6 @@ static inline void *mlx5_vzalloc(unsigned long size)
633 return rtn; 633 return rtn;
634} 634}
635 635
636static inline void mlx5_vfree(const void *addr)
637{
638 if (addr && is_vmalloc_addr(addr))
639 vfree(addr);
640 else
641 kfree(addr);
642}
643
644static inline u32 mlx5_base_mkey(const u32 key) 636static inline u32 mlx5_base_mkey(const u32 key)
645{ 637{
646 return key & 0xffffff00u; 638 return key & 0xffffff00u;