2017-08-03 13:06:55 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017, Mellanox Technologies inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* 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_IOCTL_
|
|
|
|
#define _UVERBS_IOCTL_
|
|
|
|
|
|
|
|
#include <rdma/uverbs_types.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* =======================================
|
|
|
|
* Verbs action specifications
|
|
|
|
* =======================================
|
|
|
|
*/
|
|
|
|
|
IB/core: Add support to finalize objects in one transaction
The new ioctl based infrastructure either commits or rollbacks
all objects of the method as one transaction. In order to do
that, we introduce a notion of dealing with a collection of
objects that are related to a specific method.
This also requires adding a notion of a method and attribute.
A method contains a hash of attributes, where each bucket
contains several attributes. The attributes are hashed according
to their namespace which resides in the four upper bits of the id.
For example, an object could be a CQ, which has an action of CREATE_CQ.
This action has multiple attributes. For example, the CQ's new handle
and the comp_channel. Each layer in this hierarchy - objects, methods
and attributes is split into namespaces. The basic example for that is
one namespace representing the default entities and another one
representing the driver specific entities.
When declaring these methods and attributes, we actually declare
their specifications. When a method is executed, we actually
allocates some space to hold auxiliary information. This auxiliary
information contains meta-data about the required objects, such
as pointers to their type information, pointers to the uobjects
themselves (if exist), etc.
The specification, along with the auxiliary information we allocated
and filled is given to the finalize_objects function.
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2017-08-03 13:06:56 +00:00
|
|
|
enum uverbs_attr_type {
|
|
|
|
UVERBS_ATTR_TYPE_NA,
|
|
|
|
UVERBS_ATTR_TYPE_IDR,
|
|
|
|
UVERBS_ATTR_TYPE_FD,
|
|
|
|
};
|
|
|
|
|
2017-08-03 13:06:55 +00:00
|
|
|
enum uverbs_obj_access {
|
|
|
|
UVERBS_ACCESS_READ,
|
|
|
|
UVERBS_ACCESS_WRITE,
|
|
|
|
UVERBS_ACCESS_NEW,
|
|
|
|
UVERBS_ACCESS_DESTROY
|
|
|
|
};
|
|
|
|
|
IB/core: Add support to finalize objects in one transaction
The new ioctl based infrastructure either commits or rollbacks
all objects of the method as one transaction. In order to do
that, we introduce a notion of dealing with a collection of
objects that are related to a specific method.
This also requires adding a notion of a method and attribute.
A method contains a hash of attributes, where each bucket
contains several attributes. The attributes are hashed according
to their namespace which resides in the four upper bits of the id.
For example, an object could be a CQ, which has an action of CREATE_CQ.
This action has multiple attributes. For example, the CQ's new handle
and the comp_channel. Each layer in this hierarchy - objects, methods
and attributes is split into namespaces. The basic example for that is
one namespace representing the default entities and another one
representing the driver specific entities.
When declaring these methods and attributes, we actually declare
their specifications. When a method is executed, we actually
allocates some space to hold auxiliary information. This auxiliary
information contains meta-data about the required objects, such
as pointers to their type information, pointers to the uobjects
themselves (if exist), etc.
The specification, along with the auxiliary information we allocated
and filled is given to the finalize_objects function.
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2017-08-03 13:06:56 +00:00
|
|
|
struct uverbs_attr_spec {
|
|
|
|
enum uverbs_attr_type type;
|
|
|
|
struct {
|
|
|
|
/*
|
|
|
|
* higher bits mean the namespace and lower bits mean
|
|
|
|
* the type id within the namespace.
|
|
|
|
*/
|
|
|
|
u16 obj_type;
|
|
|
|
u8 access;
|
|
|
|
} obj;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uverbs_attr_spec_hash {
|
|
|
|
size_t num_attrs;
|
|
|
|
struct uverbs_attr_spec attrs[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uverbs_obj_attr {
|
|
|
|
struct ib_uobject *uobject;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uverbs_attr {
|
|
|
|
struct uverbs_obj_attr obj_attr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uverbs_attr_bundle_hash {
|
|
|
|
/* if bit i is set, it means attrs[i] contains valid information */
|
|
|
|
unsigned long *valid_bitmap;
|
|
|
|
size_t num_attrs;
|
|
|
|
/*
|
|
|
|
* arrays of attributes, each element corresponds to the specification
|
|
|
|
* of the attribute in the same index.
|
|
|
|
*/
|
|
|
|
struct uverbs_attr *attrs;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uverbs_attr_bundle {
|
|
|
|
size_t num_buckets;
|
|
|
|
struct uverbs_attr_bundle_hash hash[];
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline bool uverbs_attr_is_valid_in_hash(const struct uverbs_attr_bundle_hash *attrs_hash,
|
|
|
|
unsigned int idx)
|
|
|
|
{
|
|
|
|
return test_bit(idx, attrs_hash->valid_bitmap);
|
|
|
|
}
|
|
|
|
|
2017-08-03 13:06:55 +00:00
|
|
|
#endif
|
|
|
|
|