From fab6f778eecbc2f0f5d0fc8feb96eaf041cb343d Mon Sep 17 00:00:00 2001 From: Vladimir Sokolovsky Date: Wed, 28 Aug 2019 11:41:03 -0500 Subject: [PATCH] Fixed IB core backport Signed-off-by: Vladimir Sokolovsky --- patches/0002-BACKPORT-ib_core.patch | 85 ++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/patches/0002-BACKPORT-ib_core.patch b/patches/0002-BACKPORT-ib_core.patch index 268ac52..1f3db54 100644 --- a/patches/0002-BACKPORT-ib_core.patch +++ b/patches/0002-BACKPORT-ib_core.patch @@ -28,14 +28,14 @@ Signed-off-by: Vladimir Sokolovsky drivers/infiniband/core/uverbs_ioctl.c | 6 + drivers/infiniband/core/uverbs_main.c | 75 ++++++ drivers/infiniband/core/uverbs_uapi.c | 8 + - drivers/infiniband/core/verbs.c | 14 ++ + drivers/infiniband/core/verbs.c | 35 +++ include/rdma/ib_addr.h | 31 +++ - include/rdma/ib_verbs.h | 155 ++++++++++++ + include/rdma/ib_verbs.h | 163 ++++++++++++ include/rdma/rdma_netlink.h | 4 + include/rdma/restrack.h | 9 + include/rdma/uverbs_ioctl.h | 3 + include/trace/events/ib_mad.h | 7 + - 32 files changed, 1528 insertions(+), 7 deletions(-) + 32 files changed, 1557 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index xxxxxxx..xxxxxxx 100644 @@ -3241,6 +3241,31 @@ index xxxxxxx..xxxxxxx 100644 /** * ib_map_mr_sg_pi() - Map the dma mapped SG lists for PI (protection +@@ -2865,3 +2879,24 @@ bool __rdma_block_iter_next(struct ib_block_iter *biter) + return true; + } + EXPORT_SYMBOL(__rdma_block_iter_next); ++ ++#ifndef HAVE_NET_DEVICE_NEEDS_FREE_NETDEV ++int rdma_uninit_netdev(struct ib_device *device, struct net_device *netdev, ++ u8 port_num, enum rdma_netdev_t type) ++{ ++ struct rdma_netdev_alloc_params params; ++ int rc; ++ ++ if (!device->ops.rdma_netdev_get_params) ++ return -EOPNOTSUPP; ++ ++ rc = device->ops.rdma_netdev_get_params(device, port_num, type, ¶ms); ++ if (rc) ++ return rc; ++ ++ params.uninitialize_rdma_netdev(netdev); ++ ++ return rc; ++} ++EXPORT_SYMBOL(rdma_uninit_netdev); ++#endif diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index xxxxxxx..xxxxxxx 100644 --- a/include/rdma/ib_addr.h @@ -3441,7 +3466,17 @@ index xxxxxxx..xxxxxxx 100644 struct ib_port_immutable { int pkey_tbl_len; int gid_tbl_len; -@@ -2396,6 +2467,7 @@ struct ib_device_ops { +@@ -2172,6 +2243,9 @@ struct rdma_netdev_alloc_params { + + int (*initialize_rdma_netdev)(struct ib_device *device, u8 port_num, + struct net_device *netdev, void *param); ++#ifndef HAVE_NET_DEVICE_NEEDS_FREE_NETDEV ++ void (*uninitialize_rdma_netdev)(struct net_device *netdev); ++#endif + }; + + struct ib_counters { +@@ -2396,6 +2470,7 @@ struct ib_device_ops { struct ib_flow_action *action, const struct ib_flow_action_attrs_esp *attr, struct uverbs_attr_bundle *attrs); @@ -3449,7 +3484,7 @@ index xxxxxxx..xxxxxxx 100644 int (*set_vf_link_state)(struct ib_device *device, int vf, u8 port, int state); int (*get_vf_config)(struct ib_device *device, int vf, u8 port, -@@ -2404,6 +2476,7 @@ struct ib_device_ops { +@@ -2404,6 +2479,7 @@ struct ib_device_ops { struct ifla_vf_stats *stats); int (*set_vf_guid)(struct ib_device *device, int vf, u8 port, u64 guid, int type); @@ -3457,7 +3492,7 @@ index xxxxxxx..xxxxxxx 100644 struct ib_wq *(*create_wq)(struct ib_pd *pd, struct ib_wq_init_attr *init_attr, struct ib_udata *udata); -@@ -2594,6 +2667,9 @@ struct ib_device { +@@ -2594,6 +2670,9 @@ struct ib_device { struct rdma_restrack_root *res; const struct uapi_definition *driver_def; @@ -3467,7 +3502,7 @@ index xxxxxxx..xxxxxxx 100644 /* * Positive refcount indicates that the device is currently -@@ -3251,14 +3327,18 @@ static inline unsigned int rdma_find_pg_bit(unsigned long addr, +@@ -3251,14 +3330,18 @@ static inline unsigned int rdma_find_pg_bit(unsigned long addr, return __fls(pgsz); } @@ -3486,7 +3521,7 @@ index xxxxxxx..xxxxxxx 100644 int ib_query_pkey(struct ib_device *device, u8 port_num, u16 index, u16 *pkey); -@@ -3863,6 +3943,10 @@ static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt) +@@ -3863,6 +3946,10 @@ static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt) */ static inline int ib_dma_mapping_error(struct ib_device *dev, u64 dma_addr) { @@ -3497,7 +3532,7 @@ index xxxxxxx..xxxxxxx 100644 return dma_mapping_error(dev->dma_device, dma_addr); } -@@ -3877,6 +3961,10 @@ static inline u64 ib_dma_map_single(struct ib_device *dev, +@@ -3877,6 +3964,10 @@ static inline u64 ib_dma_map_single(struct ib_device *dev, void *cpu_addr, size_t size, enum dma_data_direction direction) { @@ -3508,7 +3543,7 @@ index xxxxxxx..xxxxxxx 100644 return dma_map_single(dev->dma_device, cpu_addr, size, direction); } -@@ -3891,6 +3979,11 @@ static inline void ib_dma_unmap_single(struct ib_device *dev, +@@ -3891,6 +3982,11 @@ static inline void ib_dma_unmap_single(struct ib_device *dev, u64 addr, size_t size, enum dma_data_direction direction) { @@ -3520,7 +3555,7 @@ index xxxxxxx..xxxxxxx 100644 dma_unmap_single(dev->dma_device, addr, size, direction); } -@@ -3908,6 +4001,10 @@ static inline u64 ib_dma_map_page(struct ib_device *dev, +@@ -3908,6 +4004,10 @@ static inline u64 ib_dma_map_page(struct ib_device *dev, size_t size, enum dma_data_direction direction) { @@ -3531,7 +3566,7 @@ index xxxxxxx..xxxxxxx 100644 return dma_map_page(dev->dma_device, page, offset, size, direction); } -@@ -3922,6 +4019,11 @@ static inline void ib_dma_unmap_page(struct ib_device *dev, +@@ -3922,6 +4022,11 @@ static inline void ib_dma_unmap_page(struct ib_device *dev, u64 addr, size_t size, enum dma_data_direction direction) { @@ -3543,7 +3578,7 @@ index xxxxxxx..xxxxxxx 100644 dma_unmap_page(dev->dma_device, addr, size, direction); } -@@ -3936,6 +4038,10 @@ static inline int ib_dma_map_sg(struct ib_device *dev, +@@ -3936,6 +4041,10 @@ static inline int ib_dma_map_sg(struct ib_device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction) { @@ -3554,7 +3589,7 @@ index xxxxxxx..xxxxxxx 100644 return dma_map_sg(dev->dma_device, sg, nents, direction); } -@@ -3950,14 +4056,28 @@ static inline void ib_dma_unmap_sg(struct ib_device *dev, +@@ -3950,14 +4059,28 @@ static inline void ib_dma_unmap_sg(struct ib_device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction) { @@ -3583,7 +3618,7 @@ index xxxxxxx..xxxxxxx 100644 return dma_map_sg_attrs(dev->dma_device, sg, nents, direction, dma_attrs); } -@@ -3965,8 +4085,18 @@ static inline int ib_dma_map_sg_attrs(struct ib_device *dev, +@@ -3965,8 +4088,18 @@ static inline int ib_dma_map_sg_attrs(struct ib_device *dev, static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction, @@ -3602,7 +3637,7 @@ index xxxxxxx..xxxxxxx 100644 dma_unmap_sg_attrs(dev->dma_device, sg, nents, direction, dma_attrs); } -@@ -3995,6 +4125,11 @@ static inline void ib_dma_sync_single_for_cpu(struct ib_device *dev, +@@ -3995,6 +4128,11 @@ static inline void ib_dma_sync_single_for_cpu(struct ib_device *dev, size_t size, enum dma_data_direction dir) { @@ -3614,7 +3649,7 @@ index xxxxxxx..xxxxxxx 100644 dma_sync_single_for_cpu(dev->dma_device, addr, size, dir); } -@@ -4010,6 +4145,11 @@ static inline void ib_dma_sync_single_for_device(struct ib_device *dev, +@@ -4010,6 +4148,11 @@ static inline void ib_dma_sync_single_for_device(struct ib_device *dev, size_t size, enum dma_data_direction dir) { @@ -3626,7 +3661,7 @@ index xxxxxxx..xxxxxxx 100644 dma_sync_single_for_device(dev->dma_device, addr, size, dir); } -@@ -4025,6 +4165,16 @@ static inline void *ib_dma_alloc_coherent(struct ib_device *dev, +@@ -4025,6 +4168,16 @@ static inline void *ib_dma_alloc_coherent(struct ib_device *dev, dma_addr_t *dma_handle, gfp_t flag) { @@ -3643,7 +3678,7 @@ index xxxxxxx..xxxxxxx 100644 return dma_alloc_coherent(dev->dma_device, size, dma_handle, flag); } -@@ -4039,6 +4189,11 @@ static inline void ib_dma_free_coherent(struct ib_device *dev, +@@ -4039,6 +4192,11 @@ static inline void ib_dma_free_coherent(struct ib_device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle) { @@ -3655,6 +3690,18 @@ index xxxxxxx..xxxxxxx 100644 dma_free_coherent(dev->dma_device, size, cpu_addr, dma_handle); } +@@ -4541,6 +4699,11 @@ int rdma_init_netdev(struct ib_device *device, u8 port_num, + void (*setup)(struct net_device *), + struct net_device *netdev); + ++#ifndef HAVE_NET_DEVICE_NEEDS_FREE_NETDEV ++int rdma_uninit_netdev(struct ib_device *device, struct net_device *netdev, ++ u8 port_num, enum rdma_netdev_t type); ++#endif ++ + /** + * rdma_set_device_sysfs_group - Set device attributes group to have + * driver specific sysfs entries at diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h index xxxxxxx..xxxxxxx 100644 --- a/include/rdma/rdma_netlink.h -- 2.46.0