]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/rdma/ib_verbs.h
Merge branches 'x86/early-printk', 'x86/microcode' and 'core/objtool' into x86/urgent...
[linux.git] / include / rdma / ib_verbs.h
index 7ce617d77f8f67b0714623ad9c550e4c74c8a4a1..9c0c2132a2d68a012ce3c7f3f12c2f966c040e43 100644 (file)
@@ -2225,6 +2225,16 @@ struct rdma_netdev {
                            union ib_gid *gid, u16 mlid);
 };
 
+struct rdma_netdev_alloc_params {
+       size_t sizeof_priv;
+       unsigned int txqs;
+       unsigned int rxqs;
+       void *param;
+
+       int (*initialize_rdma_netdev)(struct ib_device *device, u8 port_num,
+                                     struct net_device *netdev, void *param);
+};
+
 struct ib_port_pkey_list {
        /* Lock to hold while modifying the list. */
        spinlock_t                    list_lock;
@@ -2526,8 +2536,8 @@ struct ib_device {
        /**
         * rdma netdev operation
         *
-        * Driver implementing alloc_rdma_netdev must return -EOPNOTSUPP if it
-        * doesn't support the specified rdma netdev type.
+        * Driver implementing alloc_rdma_netdev or rdma_netdev_get_params
+        * must return -EOPNOTSUPP if it doesn't support the specified type.
         */
        struct net_device *(*alloc_rdma_netdev)(
                                        struct ib_device *device,
@@ -2537,12 +2547,19 @@ struct ib_device {
                                        unsigned char name_assign_type,
                                        void (*setup)(struct net_device *));
 
+       int (*rdma_netdev_get_params)(struct ib_device *device, u8 port_num,
+                                     enum rdma_netdev_t type,
+                                     struct rdma_netdev_alloc_params *params);
+
        struct module               *owner;
        struct device                dev;
-       /* First group for device attributes, NULL terminated array */
-       const struct attribute_group    *groups[2];
+       /* First group for device attributes,
+        * Second group for driver provided attributes (optional).
+        * It is NULL terminated array.
+        */
+       const struct attribute_group    *groups[3];
 
-       struct kobject               *ports_parent;
+       struct kobject                  *ports_kobj;
        struct list_head             port_list;
 
        enum {
@@ -4191,4 +4208,38 @@ struct ib_ucontext *ib_uverbs_get_ucontext(struct ib_uverbs_file *ufile);
 
 int uverbs_destroy_def_handler(struct ib_uverbs_file *file,
                               struct uverbs_attr_bundle *attrs);
+
+struct net_device *rdma_alloc_netdev(struct ib_device *device, u8 port_num,
+                                    enum rdma_netdev_t type, const char *name,
+                                    unsigned char name_assign_type,
+                                    void (*setup)(struct net_device *));
+
+int rdma_init_netdev(struct ib_device *device, u8 port_num,
+                    enum rdma_netdev_t type, const char *name,
+                    unsigned char name_assign_type,
+                    void (*setup)(struct net_device *),
+                    struct net_device *netdev);
+
+/**
+ * rdma_set_device_sysfs_group - Set device attributes group to have
+ *                              driver specific sysfs entries at
+ *                              for infiniband class.
+ *
+ * @device:    device pointer for which attributes to be created
+ * @group:     Pointer to group which should be added when device
+ *             is registered with sysfs.
+ * rdma_set_device_sysfs_group() allows existing drivers to expose one
+ * group per device to have sysfs attributes.
+ *
+ * NOTE: New drivers should not make use of this API; instead new device
+ * parameter should be exposed via netlink command. This API and mechanism
+ * exist only for existing drivers.
+ */
+static inline void
+rdma_set_device_sysfs_group(struct ib_device *dev,
+                           const struct attribute_group *group)
+{
+       dev->groups[1] = group;
+}
+
 #endif /* IB_VERBS_H */