2005-07-08 08:57:13 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2005 Topspin Communications. All rights reserved.
|
2006-01-31 06:29:21 +08:00
|
|
|
* Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
|
2005-08-11 14:03:10 +08:00
|
|
|
* Copyright (c) 2005 Mellanox Technologies. All rights reserved.
|
|
|
|
* Copyright (c) 2005 Voltaire, Inc. All rights reserved.
|
2005-10-15 06:26:04 +08:00
|
|
|
* Copyright (c) 2005 PathScale, Inc. All rights reserved.
|
2005-07-08 08:57:13 +08:00
|
|
|
*
|
|
|
|
* This software is available to you under a choice of one of two
|
|
|
|
* licenses. You may choose to be licensed under the terms of the GNU
|
|
|
|
* General Public License (GPL) Version 2, available from the file
|
|
|
|
* COPYING in the main directory of this source tree, or the
|
|
|
|
* OpenIB.org BSD license below:
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or
|
|
|
|
* without modification, are permitted provided that the following
|
|
|
|
* conditions are met:
|
|
|
|
*
|
|
|
|
* - Redistributions of source code must retain the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer.
|
|
|
|
*
|
|
|
|
* - Redistributions in binary form must reproduce the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer in the documentation and/or other materials
|
|
|
|
* provided with the distribution.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef UVERBS_H
|
|
|
|
#define UVERBS_H
|
|
|
|
|
|
|
|
#include <linux/kref.h>
|
|
|
|
#include <linux/idr.h>
|
2006-01-14 06:51:39 +08:00
|
|
|
#include <linux/mutex.h>
|
2006-08-04 01:56:42 +08:00
|
|
|
#include <linux/completion.h>
|
2010-02-03 03:07:49 +08:00
|
|
|
#include <linux/cdev.h>
|
2005-07-08 08:57:13 +08:00
|
|
|
|
2005-08-26 04:40:04 +08:00
|
|
|
#include <rdma/ib_verbs.h>
|
2007-03-05 08:15:11 +08:00
|
|
|
#include <rdma/ib_umem.h>
|
2005-08-26 04:40:04 +08:00
|
|
|
#include <rdma/ib_user_verbs.h>
|
2018-03-19 21:02:37 +08:00
|
|
|
#include <rdma/uverbs_std_types.h>
|
2005-07-08 08:57:13 +08:00
|
|
|
|
2018-03-19 21:02:33 +08:00
|
|
|
#define UVERBS_MODULE_NAME ib_uverbs
|
|
|
|
#include <rdma/uverbs_named_ioctl.h>
|
|
|
|
|
2017-09-07 05:34:26 +08:00
|
|
|
static inline void
|
|
|
|
ib_uverbs_init_udata(struct ib_udata *udata,
|
|
|
|
const void __user *ibuf,
|
|
|
|
void __user *obuf,
|
|
|
|
size_t ilen, size_t olen)
|
|
|
|
{
|
|
|
|
udata->inbuf = ibuf;
|
|
|
|
udata->outbuf = obuf;
|
|
|
|
udata->inlen = ilen;
|
|
|
|
udata->outlen = olen;
|
|
|
|
}
|
IB/core: extended command: an improved infrastructure for uverbs commands
Commit 400dbc96583f ("IB/core: Infrastructure for extensible uverbs
commands") added an infrastructure for extensible uverbs commands
while later commit 436f2ad05a0b ("IB/core: Export ib_create/destroy_flow
through uverbs") exported ib_create_flow()/ib_destroy_flow() functions
using this new infrastructure.
According to the commit 400dbc96583f, the purpose of this
infrastructure is to support passing around provider (eg. hardware)
specific buffers when userspace issue commands to the kernel, so that
it would be possible to extend uverbs (eg. core) buffers independently
from the provider buffers.
But the new kernel command function prototypes were not modified to
take advantage of this extension. This issue was exposed by Roland
Dreier in a previous review[1].
So the following patch is an attempt to a revised extensible command
infrastructure.
This improved extensible command infrastructure distinguish between
core (eg. legacy)'s command/response buffers from provider
(eg. hardware)'s command/response buffers: each extended command
implementing function is given a struct ib_udata to hold core
(eg. uverbs) input and output buffers, and another struct ib_udata to
hold the hw (eg. provider) input and output buffers.
Having those buffers identified separately make it easier to increase
one buffer to support extension without having to add some code to
guess the exact size of each command/response parts: This should make
the extended functions more reliable.
Additionally, instead of relying on command identifier being greater
than IB_USER_VERBS_CMD_THRESHOLD, the proposed infrastructure rely on
unused bits in command field: on the 32 bits provided by command
field, only 6 bits are really needed to encode the identifier of
commands currently supported by the kernel. (Even using only 6 bits
leaves room for about 23 new commands).
So this patch makes use of some high order bits in command field to
store flags, leaving enough room for more command identifiers than one
will ever need (eg. 256).
The new flags are used to specify if the command should be processed
as an extended one or a legacy one. While designing the new command
format, care was taken to make usage of flags itself extensible.
Using high order bits of the commands field ensure that newer
libibverbs on older kernel will properly fail when trying to call
extended commands. On the other hand, older libibverbs on newer kernel
will never be able to issue calls to extended commands.
The extended command header includes the optional response pointer so
that output buffer length and output buffer pointer are located
together in the command, allowing proper parameters checking. This
should make implementing functions easier and safer.
Additionally the extended header ensure 64bits alignment, while making
all sizes multiple of 8 bytes, extending the maximum buffer size:
legacy extended
Maximum command buffer: 256KBytes 1024KBytes (512KBytes + 512KBytes)
Maximum response buffer: 256KBytes 1024KBytes (512KBytes + 512KBytes)
For the purpose of doing proper buffer size accounting, the headers
size are no more taken in account in "in_words".
One of the odds of the current extensible infrastructure, reading
twice the "legacy" command header, is fixed by removing the "legacy"
command header from the extended command header: they are processed as
two different parts of the command: memory is read once and
information are not duplicated: it's making clear that's an extended
command scheme and not a different command scheme.
The proposed scheme will format input (command) and output (response)
buffers this way:
- command:
legacy header +
extended header +
command data (core + hw):
+----------------------------------------+
| flags | 00 00 | command |
| in_words | out_words |
+----------------------------------------+
| response |
| response |
| provider_in_words | provider_out_words |
| padding |
+----------------------------------------+
| |
. <uverbs input> .
. (in_words * 8) .
| |
+----------------------------------------+
| |
. <provider input> .
. (provider_in_words * 8) .
| |
+----------------------------------------+
- response, if present:
+----------------------------------------+
| |
. <uverbs output space> .
. (out_words * 8) .
| |
+----------------------------------------+
| |
. <provider output space> .
. (provider_out_words * 8) .
| |
+----------------------------------------+
The overall design is to ensure that the extensible infrastructure is
itself extensible while begin more reliable with more input and bound
checking.
Note:
The unused field in the extended header would be perfect candidate to
hold the command "comp_mask" (eg. bit field used to handle
compatibility). This was suggested by Roland Dreier in a previous
review[2]. But "comp_mask" field is likely to be present in the uverb
input and/or provider input, likewise for the response, as noted by
Matan Barak[3], so it doesn't make sense to put "comp_mask" in the
header.
[1]:
http://marc.info/?i=CAL1RGDWxmM17W2o_era24A-TTDeKyoL6u3NRu_=t_dhV_ZA9MA@mail.gmail.com
[2]:
http://marc.info/?i=CAL1RGDXJtrc849M6_XNZT5xO1+ybKtLWGq6yg6LhoSsKpsmkYA@mail.gmail.com
[3]:
http://marc.info/?i=525C1149.6000701@mellanox.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Link: http://marc.info/?i=cover.1383773832.git.ydroneaud@opteya.com
[ Convert "ret ? ret : 0" to the equivalent "ret". - Roland ]
Signed-off-by: Roland Dreier <roland@purestorage.com>
2013-11-07 06:21:49 +08:00
|
|
|
|
2017-09-07 05:34:25 +08:00
|
|
|
static inline void
|
|
|
|
ib_uverbs_init_udata_buf_or_null(struct ib_udata *udata,
|
|
|
|
const void __user *ibuf,
|
|
|
|
void __user *obuf,
|
|
|
|
size_t ilen, size_t olen)
|
|
|
|
{
|
2017-09-07 05:34:26 +08:00
|
|
|
ib_uverbs_init_udata(udata,
|
|
|
|
ilen ? ibuf : NULL, olen ? obuf : NULL,
|
|
|
|
ilen, olen);
|
2017-09-07 05:34:25 +08:00
|
|
|
}
|
2013-12-20 00:37:03 +08:00
|
|
|
|
2005-10-29 06:38:26 +08:00
|
|
|
/*
|
|
|
|
* Our lifetime rules for these structs are the following:
|
|
|
|
*
|
|
|
|
* struct ib_uverbs_device: One reference is held by the module and
|
|
|
|
* released in ib_uverbs_remove_one(). Another reference is taken by
|
|
|
|
* ib_uverbs_open() each time the character special file is opened,
|
|
|
|
* and released in ib_uverbs_release_file() when the file is released.
|
|
|
|
*
|
|
|
|
* struct ib_uverbs_file: One reference is held by the VFS and
|
|
|
|
* released when the file is closed. Another reference is taken when
|
|
|
|
* an asynchronous event queue file is created and released when the
|
|
|
|
* event file is closed.
|
|
|
|
*
|
2017-04-18 17:03:42 +08:00
|
|
|
* struct ib_uverbs_event_queue: Base structure for
|
|
|
|
* struct ib_uverbs_async_event_file and struct ib_uverbs_completion_event_file.
|
|
|
|
* One reference is held by the VFS and released when the file is closed.
|
|
|
|
* For asynchronous event files, another reference is held by the corresponding
|
|
|
|
* main context file and released when that file is closed. For completion
|
|
|
|
* event files, a reference is taken when a CQ is created that uses the file,
|
|
|
|
* and released when the CQ is destroyed.
|
2005-10-29 06:38:26 +08:00
|
|
|
*/
|
|
|
|
|
2005-07-08 08:57:13 +08:00
|
|
|
struct ib_uverbs_device {
|
2015-08-13 23:32:03 +08:00
|
|
|
atomic_t refcount;
|
2019-10-11 21:34:19 +08:00
|
|
|
u32 num_comp_vectors;
|
2006-08-04 01:56:42 +08:00
|
|
|
struct completion comp;
|
2018-09-05 14:47:59 +08:00
|
|
|
struct device dev;
|
2018-09-05 14:48:00 +08:00
|
|
|
/* First group for device attributes, NULL terminated array */
|
|
|
|
const struct attribute_group *groups[2];
|
2015-08-13 23:32:05 +08:00
|
|
|
struct ib_device __rcu *ib_dev;
|
2010-02-03 03:07:49 +08:00
|
|
|
int devnum;
|
|
|
|
struct cdev cdev;
|
2011-05-24 23:33:46 +08:00
|
|
|
struct rb_root xrcd_tree;
|
|
|
|
struct mutex xrcd_tree_mutex;
|
2015-08-13 23:32:05 +08:00
|
|
|
struct srcu_struct disassociate_srcu;
|
|
|
|
struct mutex lists_mutex; /* protect lists */
|
|
|
|
struct list_head uverbs_file_list;
|
2018-08-10 10:14:36 +08:00
|
|
|
struct uverbs_api *uapi;
|
2005-07-08 08:57:13 +08:00
|
|
|
};
|
|
|
|
|
2017-04-18 17:03:42 +08:00
|
|
|
struct ib_uverbs_event_queue {
|
2005-07-08 08:57:13 +08:00
|
|
|
spinlock_t lock;
|
2010-02-03 03:08:14 +08:00
|
|
|
int is_closed;
|
2005-07-08 08:57:13 +08:00
|
|
|
wait_queue_head_t poll_wait;
|
2005-07-28 05:40:00 +08:00
|
|
|
struct fasync_struct *async_queue;
|
2005-07-08 08:57:13 +08:00
|
|
|
struct list_head event_list;
|
2017-04-04 18:31:47 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ib_uverbs_async_event_file {
|
2020-01-09 01:22:05 +08:00
|
|
|
struct ib_uobject uobj;
|
2017-04-18 17:03:42 +08:00
|
|
|
struct ib_uverbs_event_queue ev_queue;
|
2020-01-09 01:22:05 +08:00
|
|
|
struct ib_event_handler event_handler;
|
2005-07-08 08:57:13 +08:00
|
|
|
};
|
|
|
|
|
2017-04-04 18:31:47 +08:00
|
|
|
struct ib_uverbs_completion_event_file {
|
2018-07-04 16:32:11 +08:00
|
|
|
struct ib_uobject uobj;
|
2017-04-18 17:03:42 +08:00
|
|
|
struct ib_uverbs_event_queue ev_queue;
|
2017-04-04 18:31:47 +08:00
|
|
|
};
|
|
|
|
|
2005-07-08 08:57:13 +08:00
|
|
|
struct ib_uverbs_file {
|
|
|
|
struct kref ref;
|
|
|
|
struct ib_uverbs_device *device;
|
2018-07-11 10:55:19 +08:00
|
|
|
struct mutex ucontext_lock;
|
2018-07-11 03:43:06 +08:00
|
|
|
/*
|
|
|
|
* ucontext must be accessed via ib_uverbs_get_ucontext() or with
|
|
|
|
* ucontext_lock held
|
|
|
|
*/
|
2005-07-08 08:57:13 +08:00
|
|
|
struct ib_ucontext *ucontext;
|
2020-01-09 01:22:05 +08:00
|
|
|
struct ib_uverbs_async_event_file *async_file;
|
2015-08-13 23:32:05 +08:00
|
|
|
struct list_head list;
|
2017-04-04 18:31:41 +08:00
|
|
|
|
2018-07-11 10:55:18 +08:00
|
|
|
/*
|
|
|
|
* To access the uobjects list hw_destroy_rwsem must be held for write
|
|
|
|
* OR hw_destroy_rwsem held for read AND uobjects_lock held.
|
|
|
|
* hw_destroy_rwsem should be called across any destruction of the HW
|
|
|
|
* object of an associated uobject.
|
|
|
|
*/
|
|
|
|
struct rw_semaphore hw_destroy_rwsem;
|
|
|
|
spinlock_t uobjects_lock;
|
2018-07-04 16:32:07 +08:00
|
|
|
struct list_head uobjects;
|
|
|
|
|
2018-09-17 01:43:08 +08:00
|
|
|
struct mutex umap_lock;
|
|
|
|
struct list_head umaps;
|
2019-04-16 19:07:28 +08:00
|
|
|
struct page *disassociate_page;
|
2018-09-17 01:43:08 +08:00
|
|
|
|
2019-02-21 08:20:45 +08:00
|
|
|
struct xarray idr;
|
2005-07-08 08:57:13 +08:00
|
|
|
};
|
|
|
|
|
2005-09-10 06:55:08 +08:00
|
|
|
struct ib_uverbs_event {
|
|
|
|
union {
|
|
|
|
struct ib_uverbs_async_event_desc async;
|
|
|
|
struct ib_uverbs_comp_event_desc comp;
|
|
|
|
} desc;
|
2005-07-08 08:57:13 +08:00
|
|
|
struct list_head list;
|
2005-09-10 06:55:08 +08:00
|
|
|
struct list_head obj_list;
|
|
|
|
u32 *counter;
|
2005-07-08 08:57:13 +08:00
|
|
|
};
|
|
|
|
|
2005-11-30 08:57:01 +08:00
|
|
|
struct ib_uverbs_mcast_entry {
|
|
|
|
struct list_head list;
|
|
|
|
union ib_gid gid;
|
|
|
|
u16 lid;
|
|
|
|
};
|
|
|
|
|
2005-09-10 06:55:08 +08:00
|
|
|
struct ib_uevent_object {
|
|
|
|
struct ib_uobject uobject;
|
2020-01-09 01:21:57 +08:00
|
|
|
/* List member for ib_uverbs_async_event_file list */
|
2005-09-10 06:55:08 +08:00
|
|
|
struct list_head event_list;
|
|
|
|
u32 events_reported;
|
2005-07-08 08:57:13 +08:00
|
|
|
};
|
|
|
|
|
2011-05-24 23:33:46 +08:00
|
|
|
struct ib_uxrcd_object {
|
|
|
|
struct ib_uobject uobject;
|
|
|
|
atomic_t refcnt;
|
|
|
|
};
|
|
|
|
|
2011-05-26 08:08:38 +08:00
|
|
|
struct ib_usrq_object {
|
|
|
|
struct ib_uevent_object uevent;
|
|
|
|
struct ib_uxrcd_object *uxrcd;
|
|
|
|
};
|
|
|
|
|
2005-11-30 08:57:01 +08:00
|
|
|
struct ib_uqp_object {
|
|
|
|
struct ib_uevent_object uevent;
|
2017-04-04 18:31:45 +08:00
|
|
|
/* lock for mcast list */
|
|
|
|
struct mutex mcast_lock;
|
2005-11-30 08:57:01 +08:00
|
|
|
struct list_head mcast_list;
|
2013-08-01 23:49:54 +08:00
|
|
|
struct ib_uxrcd_object *uxrcd;
|
2005-11-30 08:57:01 +08:00
|
|
|
};
|
|
|
|
|
2016-05-23 20:20:49 +08:00
|
|
|
struct ib_uwq_object {
|
|
|
|
struct ib_uevent_object uevent;
|
|
|
|
};
|
|
|
|
|
2005-09-10 06:55:08 +08:00
|
|
|
struct ib_ucq_object {
|
2020-01-09 01:21:57 +08:00
|
|
|
struct ib_uevent_object uevent;
|
2005-09-10 06:55:08 +08:00
|
|
|
struct list_head comp_list;
|
|
|
|
u32 comp_events_reported;
|
2005-07-08 08:57:13 +08:00
|
|
|
};
|
|
|
|
|
2017-04-04 18:31:47 +08:00
|
|
|
extern const struct file_operations uverbs_event_fops;
|
2020-01-09 01:22:05 +08:00
|
|
|
extern const struct file_operations uverbs_async_event_fops;
|
2017-04-18 17:03:42 +08:00
|
|
|
void ib_uverbs_init_event_queue(struct ib_uverbs_event_queue *ev_queue);
|
2020-01-09 01:22:05 +08:00
|
|
|
void ib_uverbs_init_async_event_file(struct ib_uverbs_async_event_file *ev_file);
|
|
|
|
void ib_uverbs_free_event_queue(struct ib_uverbs_event_queue *event_queue);
|
2018-03-28 14:27:46 +08:00
|
|
|
void ib_uverbs_flow_resources_free(struct ib_uflow_resources *uflow_res);
|
2005-09-27 04:53:25 +08:00
|
|
|
|
2020-01-09 02:05:34 +08:00
|
|
|
int ib_alloc_ucontext(struct uverbs_attr_bundle *attrs);
|
|
|
|
int ib_init_ucontext(struct uverbs_attr_bundle *attrs);
|
|
|
|
|
2020-01-09 01:22:06 +08:00
|
|
|
void ib_uverbs_release_ucq(struct ib_uverbs_completion_event_file *ev_file,
|
2005-10-29 06:38:26 +08:00
|
|
|
struct ib_ucq_object *uobj);
|
2020-01-09 01:22:06 +08:00
|
|
|
void ib_uverbs_release_uevent(struct ib_uevent_object *uobj);
|
2017-04-04 18:31:46 +08:00
|
|
|
void ib_uverbs_release_file(struct kref *ref);
|
2005-10-29 06:38:26 +08:00
|
|
|
|
2005-07-08 08:57:13 +08:00
|
|
|
void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context);
|
|
|
|
void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr);
|
|
|
|
void ib_uverbs_qp_event_handler(struct ib_event *event, void *context_ptr);
|
2016-05-23 20:20:49 +08:00
|
|
|
void ib_uverbs_wq_event_handler(struct ib_event *event, void *context_ptr);
|
2005-08-19 03:24:13 +08:00
|
|
|
void ib_uverbs_srq_event_handler(struct ib_event *event, void *context_ptr);
|
2018-06-20 22:11:39 +08:00
|
|
|
int ib_uverbs_dealloc_xrcd(struct ib_uobject *uobject, struct ib_xrcd *xrcd,
|
2019-04-01 00:10:06 +08:00
|
|
|
enum rdma_remove_reason why,
|
|
|
|
struct uverbs_attr_bundle *attrs);
|
2005-07-08 08:57:13 +08:00
|
|
|
|
2015-12-24 02:12:48 +08:00
|
|
|
int uverbs_dealloc_mw(struct ib_mw *mw);
|
2017-04-04 18:31:43 +08:00
|
|
|
void ib_uverbs_detach_umcast(struct ib_qp *qp,
|
|
|
|
struct ib_uqp_object *uobj);
|
2015-12-24 02:12:48 +08:00
|
|
|
|
2017-08-03 21:07:07 +08:00
|
|
|
long ib_uverbs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
|
|
|
|
|
2013-11-07 06:21:48 +08:00
|
|
|
struct ib_uverbs_flow_spec {
|
|
|
|
union {
|
|
|
|
union {
|
|
|
|
struct ib_uverbs_flow_spec_hdr hdr;
|
|
|
|
struct {
|
|
|
|
__u32 type;
|
|
|
|
__u16 size;
|
|
|
|
__u16 reserved;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
struct ib_uverbs_flow_spec_eth eth;
|
|
|
|
struct ib_uverbs_flow_spec_ipv4 ipv4;
|
2018-03-28 14:27:49 +08:00
|
|
|
struct ib_uverbs_flow_spec_esp esp;
|
2013-11-07 06:21:48 +08:00
|
|
|
struct ib_uverbs_flow_spec_tcp_udp tcp_udp;
|
2016-06-17 20:14:50 +08:00
|
|
|
struct ib_uverbs_flow_spec_ipv6 ipv6;
|
2017-01-18 20:59:49 +08:00
|
|
|
struct ib_uverbs_flow_spec_action_tag flow_tag;
|
2017-04-03 18:13:51 +08:00
|
|
|
struct ib_uverbs_flow_spec_action_drop drop;
|
2018-03-28 14:27:46 +08:00
|
|
|
struct ib_uverbs_flow_spec_action_handle action;
|
2018-05-31 21:43:37 +08:00
|
|
|
struct ib_uverbs_flow_spec_action_count flow_count;
|
2013-11-07 06:21:48 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-03-28 14:27:44 +08:00
|
|
|
int ib_uverbs_kern_spec_to_ib_spec_filter(enum ib_flow_spec_type type,
|
|
|
|
const void *kern_spec_mask,
|
|
|
|
const void *kern_spec_val,
|
|
|
|
size_t kern_filter_sz,
|
|
|
|
union ib_flow_spec *ib_spec);
|
|
|
|
|
2018-03-19 21:02:37 +08:00
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_DEVICE);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_PD);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_MR);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_COMP_CHANNEL);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_CQ);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_QP);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_AH);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_MW);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_SRQ);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_FLOW);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_WQ);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_RWQ_IND_TBL);
|
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_XRCD);
|
IB/uverbs: Add flow_action create and destroy verbs
A verbs application may receive and transmits packets using a data
path pipeline. Sometimes, the first stage in the receive pipeline or
the last stage in the transmit pipeline involves transforming a
packet, either in order to make it easier for later stages to process
it or to prepare it for transmission over the wire. Such transformation
could be stripping/encapsulating the packet (i.e. vxlan),
decrypting/encrypting it (i.e. ipsec), altering headers, doing some
complex FPGA changes, etc.
Some hardware could do such transformations without software data path
intervention at all. The flow steering API supports steering a
packet (either to a QP or dropping it) and some simple packet
immutable actions (i.e. tagging a packet). Complex actions, that may
change the packet, could bloat the flow steering API extensively.
Sometimes the same action should be applied to several flows.
In this case, it's easier to bind several flows to the same action and
modify it than change all matching flows.
Introducing a new flow_action object that abstracts any packet
transformation (out of a standard and well defined set of actions).
This flow_action object could be tied to a flow steering rule via a
new specification.
Currently, we support esp flow_action, which encrypts or decrypts a
packet according to the given parameters. However, we present a
flexible schema that could be used to other transformation actions tied
to flow rules.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2018-03-28 14:27:45 +08:00
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_FLOW_ACTION);
|
2018-04-05 23:53:24 +08:00
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_DM);
|
2018-05-31 21:43:32 +08:00
|
|
|
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_COUNTERS);
|
2018-03-19 21:02:37 +08:00
|
|
|
|
2018-12-09 17:58:06 +08:00
|
|
|
/*
|
|
|
|
* ib_uverbs_query_port_resp.port_cap_flags started out as just a copy of the
|
|
|
|
* PortInfo CapabilityMask, but was extended with unique bits.
|
|
|
|
*/
|
|
|
|
static inline u32 make_port_cap_flags(const struct ib_port_attr *attr)
|
|
|
|
{
|
|
|
|
u32 res;
|
|
|
|
|
|
|
|
/* All IBA CapabilityMask bits are passed through here, except bit 26,
|
|
|
|
* which is overridden with IP_BASED_GIDS. This is due to a historical
|
|
|
|
* mistake in the implementation of IP_BASED_GIDS. Otherwise all other
|
|
|
|
* bits match the IBA definition across all kernel versions.
|
|
|
|
*/
|
|
|
|
res = attr->port_cap_flags & ~(u32)IB_UVERBS_PCF_IP_BASED_GIDS;
|
|
|
|
|
|
|
|
if (attr->ip_gids)
|
|
|
|
res |= IB_UVERBS_PCF_IP_BASED_GIDS;
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void copy_port_attr_to_resp(struct ib_port_attr *attr,
|
|
|
|
struct ib_uverbs_query_port_resp *resp,
|
|
|
|
struct ib_device *ib_dev, u8 port_num);
|
2005-07-08 08:57:13 +08:00
|
|
|
#endif /* UVERBS_H */
|