All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC ABI 0/8] Netlink-based IOCTLs RDMA ABI
@ 2016-05-24 14:35 Leon Romanovsky
       [not found] ` <1464100526-31730-1-git-send-email-leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 41+ messages in thread
From: Leon Romanovsky @ 2016-05-24 14:35 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

The following patch set comes to enrich security model as a follow up
to commit e6bd18f57aad ('IB/security: Restrict use of the write() interface').

This patch series add ioctl() interface to the existing write() interface and
provide an easy route to backport this change to legacy supported systems.

The proposed code was initially tested with ibv_devinfo application
and supplementary part of libibverbs, which will be posted next.

In a response to the ABI discussion [1] and the summary posted [2], two ioctl()
calls were introduced: IB_IOCTL_VERBS and IB_IOCTL_DIRECT.

* IB_IOCTL_VERBS command will perform all validation and parsing
  supplied by IB CORE logic, before serving the request.
* IB_IOCTL_DIRECT command will bypass IB core logic and it
  is intended for vendor specific channel operations.

Such separation will simplify the user space development by working with
limited and constant number of ioctl numbers without limiting the
ability to expand the vendor's interface in the future.

In order to fully utilize such opportunity to extend ABI while converting
write() to ioctl() interfaces, the community decision was to introduce
netlink-based ABI for ioctl() data [3].

IB_IOCTL_VERBS commands start with generic header:

struct ib_uverbs_ioctl_hdr {
	__u32 length;
	__u16 flags;
	__u16 object_type;
	__u16 reserved;
	/* First 8 actions are common to all objects */
	__u16 action;
	__u32 user_handler;
	/*
	 * These fields represent core response only,
	 * provider's response is given as a netlink attribute.
	 */
	struct ib_uverbs_uptr resp;
};

struct ib_uverbs_uptr {
	__u64 ptr;
	__u32 len;
};

After the header, a stream of netlink attributes (TLVs) are given. These
attributes represent the command itself.

Every command validates its attributes using a generic way by ensure:
1. Attributes are known
2. Attributes' sizes are correct
3. Mandatory attributes exist

The actual uverbs implementation get an array of pointers to
netlink attributes represents the core command, a udata attribute
which the response will be written to (the response starts with a
header identical to netlink nested attribute header) and a udata
represents the vendor data.

Commands and responses are now extensible by nature, as new netlink
attributes could be added when required.

Vendor commands and responses which have udata will use pointers to a
different buffer (using a new netlink uptr attribute). Such separation
will allow to retain backward compatibility with current user-space vendor
drivers.

Thanks,
	Matan, Haggai and Leon.

[1] http://www.spinics.net/lists/linux-rdma/msg36295.html
[2] http://marc.info/?l=linux-rdma&m=146403269100691&w=2
[3] http://lists.openfabrics.org/pipermail/ofvwg/attachments/20160517/0ddbded9/attachment-0002.pdf

Leon Romanovsky (2):
  IB/core: Export RDMA IOCTL declarations
  IB/core: Add DIRECT ioctl call to vendor

Matan Barak (6):
  lib/nlattr: Add parsing netlink and validate using callback
  IB/core: Adding netlink based udata
  IB/core: Add new ioctl for VERBS commands with netlink style parsing
  IB/core: Add outptr to udata in order to track the output size
  IB/core: Refactor idr to a shared file
  IB/core: Implement device_create with the new ABI

 drivers/infiniband/core/Makefile            |   3 +-
 drivers/infiniband/core/user_mad.c          |   2 +-
 drivers/infiniband/core/uverbs.h            |  64 +++-
 drivers/infiniband/core/uverbs_cmd.c        | 558 ++++++++--------------------
 drivers/infiniband/core/uverbs_cmd_common.c | 280 ++++++++++++++
 drivers/infiniband/core/uverbs_cmd_nl.c     | 151 ++++++++
 drivers/infiniband/core/uverbs_main.c       | 322 +++++++++++++++-
 drivers/infiniband/core/uverbs_nl.c         |  92 +++++
 include/linux/netlink.h                     |   1 -
 include/net/netlink.h                       |   5 +
 include/rdma/ib_ioctl.h                     |  49 +++
 include/rdma/ib_verbs.h                     |  10 +-
 include/uapi/rdma/Kbuild                    |   1 +
 include/uapi/rdma/ib_user_ioctl.h           | 126 +++++++
 include/uapi/rdma/ib_user_mad.h             |  12 -
 lib/nlattr.c                                |  43 ++-
 16 files changed, 1290 insertions(+), 429 deletions(-)
 create mode 100644 drivers/infiniband/core/uverbs_cmd_common.c
 create mode 100644 drivers/infiniband/core/uverbs_cmd_nl.c
 create mode 100644 drivers/infiniband/core/uverbs_nl.c
 create mode 100644 include/rdma/ib_ioctl.h
 create mode 100644 include/uapi/rdma/ib_user_ioctl.h

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2016-06-01 11:18 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-24 14:35 [RFC ABI 0/8] Netlink-based IOCTLs RDMA ABI Leon Romanovsky
     [not found] ` <1464100526-31730-1-git-send-email-leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-05-24 14:35   ` [RFC ABI 1/8] IB/core: Export RDMA IOCTL declarations Leon Romanovsky
     [not found]     ` <1464100526-31730-2-git-send-email-leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-05-24 19:46       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AB05008A-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-24 19:49           ` Leon Romanovsky
2016-05-24 14:35   ` [RFC ABI 2/8] lib/nlattr: Add parsing netlink and validate using callback Leon Romanovsky
2016-05-24 14:35   ` [RFC ABI 3/8] IB/core: Adding netlink based udata Leon Romanovsky
2016-05-24 14:35   ` [RFC ABI 4/8] IB/core: Add DIRECT ioctl call to vendor Leon Romanovsky
2016-05-24 14:35   ` [RFC ABI 5/8] IB/core: Add new ioctl for VERBS commands with netlink style parsing Leon Romanovsky
2016-05-24 14:35   ` [RFC ABI 6/8] IB/core: Add outptr to udata in order to track the output size Leon Romanovsky
2016-05-24 14:35   ` [RFC ABI 7/8] IB/core: Refactor idr to a shared file Leon Romanovsky
2016-05-24 14:35   ` [RFC ABI 8/8] IB/core: Implement device_create with the new ABI Leon Romanovsky
     [not found]     ` <1464100526-31730-9-git-send-email-leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-05-24 20:04       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AB0500F1-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-24 21:53           ` Jason Gunthorpe
     [not found]             ` <20160524215335.GE7950-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-24 22:02               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A82373AB05024F-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-24 22:11                   ` Jason Gunthorpe
     [not found]                     ` <20160524221118.GG7950-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-24 22:24                       ` Hefty, Sean
2016-05-24 22:07       ` Jason Gunthorpe
     [not found]         ` <20160524220720.GF7950-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-26  6:00           ` Leon Romanovsky
2016-05-26 13:24           ` Matan Barak
     [not found]             ` <CAAKD3BDVFs4rivq1qEih-Z5uOMSVp=OuwDaVroK=UjAhcj6wsg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-26 17:30               ` Jason Gunthorpe
2016-05-24 19:37   ` [RFC ABI 0/8] Netlink-based IOCTLs RDMA ABI Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A82373AB05004F-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-24 21:01       ` Jason Gunthorpe
     [not found]         ` <20160524210132.GB7950-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-24 21:16           ` Hefty, Sean
     [not found]             ` <1828884A29C6694DAF28B7E6B8A82373AB0501E2-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-24 21:31               ` Steve Wise
2016-05-24 21:49               ` Jason Gunthorpe
     [not found]                 ` <20160524214951.GC7950-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-24 21:59                   ` Hefty, Sean
     [not found]                     ` <1828884A29C6694DAF28B7E6B8A82373AB05023F-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-24 22:30                       ` Jason Gunthorpe
     [not found]                         ` <20160524223052.GI7950-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-24 22:44                           ` Hefty, Sean
2016-05-26 15:18                           ` Matan Barak
     [not found]                             ` <CAAKD3BA3fxgHwSXg__9LAPo7E4-7NY7h7Gea5+1GCg11ydn2kQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-26 17:22                               ` Jason Gunthorpe
     [not found]                                 ` <20160526172244.GC27115-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-26 22:53                                   ` Hefty, Sean
     [not found]                                     ` <1828884A29C6694DAF28B7E6B8A82373AB05BB5D-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-26 23:36                                       ` Jason Gunthorpe
     [not found]                                         ` <20160526233612.GA4396-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-27  0:46                                           ` Hefty, Sean
     [not found]                                             ` <1828884A29C6694DAF28B7E6B8A82373AB05BC0C-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-27 13:19                                               ` Leon Romanovsky
     [not found]                                                 ` <20160527131956.GY25500-2ukJVAZIZ/Y@public.gmane.org>
2016-05-27 15:04                                                   ` Hefty, Sean
     [not found]                                                     ` <1828884A29C6694DAF28B7E6B8A82373AB05BD12-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-29  8:16                                                       ` Leon Romanovsky
     [not found]                                                         ` <20160529081646.GA25500-2ukJVAZIZ/Y@public.gmane.org>
2016-05-31 17:56                                                           ` Hefty, Sean
     [not found]                                                             ` <1828884A29C6694DAF28B7E6B8A82373AB05CA92-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-31 18:10                                                               ` Leon Romanovsky
     [not found]                                                                 ` <20160531181012.GD7477-2ukJVAZIZ/Y@public.gmane.org>
2016-05-31 20:01                                                                   ` Hefty, Sean
     [not found]                                                                     ` <1828884A29C6694DAF28B7E6B8A82373AB05CBD5-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-06-01 11:18                                                                       ` Leon Romanovsky
2016-05-25 13:14       ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.