Skip to content

Commit fe8875e

Browse files
author
Roland Dreier
committed
Merge branch 'misc' into for-next
Conflicts: drivers/infiniband/core/uverbs_main.c
2 parents f577215 + a265e55 commit fe8875e

8 files changed

Lines changed: 15 additions & 71 deletions

File tree

‎drivers/infiniband/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ config INFINIBAND_USER_MAD
2020

2121
config INFINIBAND_USER_ACCESS
2222
tristate "InfiniBand userspace access (verbs and CM)"
23+
select ANON_INODES
2324
---help---
2425
Userspace InfiniBand access support. This enables the
2526
kernel side of userspace verbs and the userspace

‎drivers/infiniband/core/ud_header.c‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ static const struct ib_field deth_table[] = {
181181
* ib_ud_header_init - Initialize UD header structure
182182
* @payload_bytes:Length of packet payload
183183
* @grh_present:GRH flag (if non-zero, GRH will be included)
184+
* @immediate_present: specify if immediate data should be used
184185
* @header:Structure to initialize
185186
*
186187
* ib_ud_header_init() initializes the lrh.link_version, lrh.link_next_header,
@@ -191,21 +192,13 @@ static const struct ib_field deth_table[] = {
191192
*/
192193
void ib_ud_header_init(int payload_bytes,
193194
int grh_present,
195+
int immediate_present,
194196
struct ib_ud_header *header)
195197
{
196-
int header_len;
197198
u16 packet_length;
198199

199200
memset(header, 0, sizeof *header);
200201

201-
header_len =
202-
IB_LRH_BYTES +
203-
IB_BTH_BYTES +
204-
IB_DETH_BYTES;
205-
if (grh_present) {
206-
header_len += IB_GRH_BYTES;
207-
}
208-
209202
header->lrh.link_version = 0;
210203
header->lrh.link_next_header =
211204
grh_present ? IB_LNH_IBA_GLOBAL : IB_LNH_IBA_LOCAL;
@@ -231,7 +224,8 @@ void ib_ud_header_init(int payload_bytes,
231224

232225
header->lrh.packet_length = cpu_to_be16(packet_length);
233226

234-
if (header->immediate_present)
227+
header->immediate_present = immediate_present;
228+
if (immediate_present)
235229
header->bth.opcode = IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE;
236230
else
237231
header->bth.opcode = IB_OPCODE_UD_SEND_ONLY;

‎drivers/infiniband/core/umem.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
136136
down_write(&current->mm->mmap_sem);
137137

138138
locked = npages + current->mm->locked_vm;
139-
lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT;
139+
lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
140140

141141
if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
142142
ret = -ENOMEM;

‎drivers/infiniband/core/uverbs_main.c‎

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
#include <linux/poll.h>
4343
#include <linux/sched.h>
4444
#include <linux/file.h>
45-
#include <linux/mount.h>
45+
#include <linux/cdev.h>
46+
#include <linux/anon_inodes.h>
4647

4748
#include <asm/uaccess.h>
4849

@@ -52,8 +53,6 @@ MODULE_AUTHOR("Roland Dreier");
5253
MODULE_DESCRIPTION("InfiniBand userspace verbs access");
5354
MODULE_LICENSE("Dual BSD/GPL");
5455

55-
#define INFINIBANDEVENTFS_MAGIC 0x49426576 /* "IBev" */
56-
5756
enum {
5857
IB_UVERBS_MAJOR = 231,
5958
IB_UVERBS_BASE_MINOR = 192,
@@ -109,8 +108,6 @@ static ssize_t (*uverbs_cmd_table[])(struct ib_uverbs_file *file,
109108
[IB_USER_VERBS_CMD_DESTROY_SRQ] = ib_uverbs_destroy_srq,
110109
};
111110

112-
static struct vfsmount *uverbs_event_mnt;
113-
114111
static void ib_uverbs_add_one(struct ib_device *device);
115112
static void ib_uverbs_remove_one(struct ib_device *device);
116113

@@ -490,7 +487,6 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
490487
int is_async, int *fd)
491488
{
492489
struct ib_uverbs_event_file *ev_file;
493-
struct path path;
494490
struct file *filp;
495491
int ret;
496492

@@ -513,27 +509,16 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
513509
goto err;
514510
}
515511

516-
/*
517-
* fops_get() can't fail here, because we're coming from a
518-
* system call on a uverbs file, which will already have a
519-
* module reference.
520-
*/
521-
path.mnt = uverbs_event_mnt;
522-
path.dentry = uverbs_event_mnt->mnt_root;
523-
path_get(&path);
524-
filp = alloc_file(&path, FMODE_READ, fops_get(&uverbs_event_fops));
512+
filp = anon_inode_getfile("[uverbs-event]", &uverbs_event_fops,
513+
ev_file, O_RDONLY);
525514
if (!filp) {
526515
ret = -ENFILE;
527516
goto err_fd;
528517
}
529518

530-
filp->private_data = ev_file;
531-
532519
return filp;
533520

534521
err_fd:
535-
fops_put(&uverbs_event_fops);
536-
path_put(&path);
537522
put_unused_fd(*fd);
538523

539524
err:
@@ -854,21 +839,6 @@ static void ib_uverbs_remove_one(struct ib_device *device)
854839
kfree(uverbs_dev);
855840
}
856841

857-
static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags,
858-
const char *dev_name, void *data,
859-
struct vfsmount *mnt)
860-
{
861-
return get_sb_pseudo(fs_type, "infinibandevent:", NULL,
862-
INFINIBANDEVENTFS_MAGIC, mnt);
863-
}
864-
865-
static struct file_system_type uverbs_event_fs = {
866-
/* No owner field so module can be unloaded */
867-
.name = "infinibandeventfs",
868-
.get_sb = uverbs_event_get_sb,
869-
.kill_sb = kill_litter_super
870-
};
871-
872842
static int __init ib_uverbs_init(void)
873843
{
874844
int ret;
@@ -893,33 +863,14 @@ static int __init ib_uverbs_init(void)
893863
goto out_class;
894864
}
895865

896-
ret = register_filesystem(&uverbs_event_fs);
897-
if (ret) {
898-
printk(KERN_ERR "user_verbs: couldn't register infinibandeventfs\n");
899-
goto out_class;
900-
}
901-
902-
uverbs_event_mnt = kern_mount(&uverbs_event_fs);
903-
if (IS_ERR(uverbs_event_mnt)) {
904-
ret = PTR_ERR(uverbs_event_mnt);
905-
printk(KERN_ERR "user_verbs: couldn't mount infinibandeventfs\n");
906-
goto out_fs;
907-
}
908-
909866
ret = ib_register_client(&uverbs_client);
910867
if (ret) {
911868
printk(KERN_ERR "user_verbs: couldn't register client\n");
912-
goto out_mnt;
869+
goto out_class;
913870
}
914871

915872
return 0;
916873

917-
out_mnt:
918-
mntput(uverbs_event_mnt);
919-
920-
out_fs:
921-
unregister_filesystem(&uverbs_event_fs);
922-
923874
out_class:
924875
class_destroy(uverbs_class);
925876

@@ -933,8 +884,6 @@ static int __init ib_uverbs_init(void)
933884
static void __exit ib_uverbs_cleanup(void)
934885
{
935886
ib_unregister_client(&uverbs_client);
936-
mntput(uverbs_event_mnt);
937-
unregister_filesystem(&uverbs_event_fs);
938887
class_destroy(uverbs_class);
939888
unregister_chrdev_region(IB_UVERBS_BASE_DEV, IB_UVERBS_MAX_DEVICES);
940889
if (overflow_maj)

‎drivers/infiniband/hw/ipath/ipath_user_pages.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ static int __get_user_pages(unsigned long start_page, size_t num_pages,
5959
size_t got;
6060
int ret;
6161

62-
lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >>
63-
PAGE_SHIFT;
62+
lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
6463

6564
if (num_pages > lock_limit) {
6665
ret = -ENOMEM;

‎drivers/infiniband/hw/mlx4/qp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr,
12281228
for (i = 0; i < wr->num_sge; ++i)
12291229
send_size += wr->sg_list[i].length;
12301230

1231-
ib_ud_header_init(send_size, mlx4_ib_ah_grh_present(ah), &sqp->ud_header);
1231+
ib_ud_header_init(send_size, mlx4_ib_ah_grh_present(ah), 0, &sqp->ud_header);
12321232

12331233
sqp->ud_header.lrh.service_level =
12341234
be32_to_cpu(ah->av.sl_tclass_flowlabel) >> 28;

‎drivers/infiniband/hw/mthca/mthca_qp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@ static int build_mlx_header(struct mthca_dev *dev, struct mthca_sqp *sqp,
14941494
u16 pkey;
14951495

14961496
ib_ud_header_init(256, /* assume a MAD */
1497-
mthca_ah_grh_present(to_mah(wr->wr.ud.ah)),
1497+
mthca_ah_grh_present(to_mah(wr->wr.ud.ah)), 0,
14981498
&sqp->ud_header);
14991499

15001500
err = mthca_read_ah(dev, to_mah(wr->wr.ud.ah), &sqp->ud_header);

‎include/rdma/ib_pack.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ void ib_unpack(const struct ib_field *desc,
232232

233233
void ib_ud_header_init(int payload_bytes,
234234
int grh_present,
235+
int immediate_present,
235236
struct ib_ud_header *header);
236237

237238
int ib_ud_header_pack(struct ib_ud_header *header,

0 commit comments

Comments
 (0)