Skip to content

Commit 0afd220

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma updates from Jason Gunthorpe: "Lighter that normal, but the now usual collection of driver fixes and small improvements: - Small fixes and minor improvements to cxgb4, bnxt_re, rxe, srp, efa, cxgb4 - Update mlx4 to use the new umem APIs, avoiding direct use of scatterlist - Support ROCEv2 in erdma - Remove various uncalled functions, constify bin_attribute - Provide core infrastructure to catch netdev events and route them to drivers, consolidating duplicated driver code - Fix rare race condition crashes in mlx5 ODP flows" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (63 commits) RDMA/mlx5: Fix implicit ODP use after free RDMA/mlx5: Fix a race for an ODP MR which leads to CQE with error RDMA/qib: Constify 'struct bin_attribute' RDMA/hfi1: Constify 'struct bin_attribute' RDMA/rxe: Fix the warning "__rxe_cleanup+0x12c/0x170 [rdma_rxe]" RDMA/cxgb4: Notify rdma stack for IB_EVENT_QP_LAST_WQE_REACHED event RDMA/bnxt_re: Allocate dev_attr information dynamically RDMA/bnxt_re: Pass the context for ulp_irq_stop RDMA/bnxt_re: Add support to handle DCB_CONFIG_CHANGE event RDMA/bnxt_re: Query firmware defaults of CC params during probe RDMA/bnxt_re: Add Async event handling support bnxt_en: Add ULP call to notify async events RDMA/mlx5: Fix indirect mkey ODP page count MAINTAINERS: Update the bnxt_re maintainers RDMA/hns: Clean up the legacy CONFIG_INFINIBAND_HNS RDMA/rtrs: Add missing deinit() call RDMA/efa: Align interrupt related fields to same type RDMA/bnxt_re: Fix to drop reference to the mmap entry in case of error RDMA/mlx5: Fix link status down event for MPV RDMA/erdma: Support create_ah/destroy_ah in non-sleepable contexts ...
2 parents aa44198 + d3d9304 commit 0afd220

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2009
-1254
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4800,6 +4800,7 @@ F: drivers/scsi/mpi3mr/
48004800

48014801
BROADCOM NETXTREME-E ROCE DRIVER
48024802
M: Selvin Xavier <[email protected]>
4803+
M: Kalesh AP <[email protected]>
48034804
48044805
S: Supported
48054806
W: http://www.broadcom.com

drivers/infiniband/core/cache.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,41 +1127,6 @@ int ib_find_cached_pkey(struct ib_device *device, u32 port_num,
11271127
}
11281128
EXPORT_SYMBOL(ib_find_cached_pkey);
11291129

1130-
int ib_find_exact_cached_pkey(struct ib_device *device, u32 port_num,
1131-
u16 pkey, u16 *index)
1132-
{
1133-
struct ib_pkey_cache *cache;
1134-
unsigned long flags;
1135-
int i;
1136-
int ret = -ENOENT;
1137-
1138-
if (!rdma_is_port_valid(device, port_num))
1139-
return -EINVAL;
1140-
1141-
read_lock_irqsave(&device->cache_lock, flags);
1142-
1143-
cache = device->port_data[port_num].cache.pkey;
1144-
if (!cache) {
1145-
ret = -EINVAL;
1146-
goto err;
1147-
}
1148-
1149-
*index = -1;
1150-
1151-
for (i = 0; i < cache->table_len; ++i)
1152-
if (cache->table[i] == pkey) {
1153-
*index = i;
1154-
ret = 0;
1155-
break;
1156-
}
1157-
1158-
err:
1159-
read_unlock_irqrestore(&device->cache_lock, flags);
1160-
1161-
return ret;
1162-
}
1163-
EXPORT_SYMBOL(ib_find_exact_cached_pkey);
1164-
11651130
int ib_get_cached_lmc(struct ib_device *device, u32 port_num, u8 *lmc)
11661131
{
11671132
unsigned long flags;

drivers/infiniband/core/device.c

Lines changed: 92 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,6 @@ static void __ibdev_printk(const char *level, const struct ib_device *ibdev,
209209
printk("%s(NULL ib_device): %pV", level, vaf);
210210
}
211211

212-
void ibdev_printk(const char *level, const struct ib_device *ibdev,
213-
const char *format, ...)
214-
{
215-
struct va_format vaf;
216-
va_list args;
217-
218-
va_start(args, format);
219-
220-
vaf.fmt = format;
221-
vaf.va = &args;
222-
223-
__ibdev_printk(level, ibdev, &vaf);
224-
225-
va_end(args);
226-
}
227-
EXPORT_SYMBOL(ibdev_printk);
228-
229212
#define define_ibdev_printk_level(func, level) \
230213
void func(const struct ib_device *ibdev, const char *fmt, ...) \
231214
{ \
@@ -2295,6 +2278,33 @@ struct net_device *ib_device_get_netdev(struct ib_device *ib_dev,
22952278
}
22962279
EXPORT_SYMBOL(ib_device_get_netdev);
22972280

2281+
/**
2282+
* ib_query_netdev_port - Query the port number of a net_device
2283+
* associated with an ibdev
2284+
* @ibdev: IB device
2285+
* @ndev: Network device
2286+
* @port: IB port the net_device is connected to
2287+
*/
2288+
int ib_query_netdev_port(struct ib_device *ibdev, struct net_device *ndev,
2289+
u32 *port)
2290+
{
2291+
struct net_device *ib_ndev;
2292+
u32 port_num;
2293+
2294+
rdma_for_each_port(ibdev, port_num) {
2295+
ib_ndev = ib_device_get_netdev(ibdev, port_num);
2296+
if (ndev == ib_ndev) {
2297+
*port = port_num;
2298+
dev_put(ib_ndev);
2299+
return 0;
2300+
}
2301+
dev_put(ib_ndev);
2302+
}
2303+
2304+
return -ENOENT;
2305+
}
2306+
EXPORT_SYMBOL(ib_query_netdev_port);
2307+
22982308
/**
22992309
* ib_device_get_by_netdev - Find an IB device associated with a netdev
23002310
* @ndev: netdev to locate
@@ -2761,6 +2771,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
27612771
SET_DEVICE_OP(dev_ops, set_vf_guid);
27622772
SET_DEVICE_OP(dev_ops, set_vf_link_state);
27632773
SET_DEVICE_OP(dev_ops, ufile_hw_cleanup);
2774+
SET_DEVICE_OP(dev_ops, report_port_event);
27642775

27652776
SET_OBJ_SIZE(dev_ops, ib_ah);
27662777
SET_OBJ_SIZE(dev_ops, ib_counters);
@@ -2854,11 +2865,62 @@ static const struct rdma_nl_cbs ibnl_ls_cb_table[RDMA_NL_LS_NUM_OPS] = {
28542865
},
28552866
};
28562867

2868+
void ib_dispatch_port_state_event(struct ib_device *ibdev, struct net_device *ndev)
2869+
{
2870+
enum ib_port_state curr_state;
2871+
struct ib_event ibevent = {};
2872+
u32 port;
2873+
2874+
if (ib_query_netdev_port(ibdev, ndev, &port))
2875+
return;
2876+
2877+
curr_state = ib_get_curr_port_state(ndev);
2878+
2879+
write_lock_irq(&ibdev->cache_lock);
2880+
if (ibdev->port_data[port].cache.last_port_state == curr_state) {
2881+
write_unlock_irq(&ibdev->cache_lock);
2882+
return;
2883+
}
2884+
ibdev->port_data[port].cache.last_port_state = curr_state;
2885+
write_unlock_irq(&ibdev->cache_lock);
2886+
2887+
ibevent.event = (curr_state == IB_PORT_DOWN) ?
2888+
IB_EVENT_PORT_ERR : IB_EVENT_PORT_ACTIVE;
2889+
ibevent.device = ibdev;
2890+
ibevent.element.port_num = port;
2891+
ib_dispatch_event(&ibevent);
2892+
}
2893+
EXPORT_SYMBOL(ib_dispatch_port_state_event);
2894+
2895+
static void handle_port_event(struct net_device *ndev, unsigned long event)
2896+
{
2897+
struct ib_device *ibdev;
2898+
2899+
/* Currently, link events in bonding scenarios are still
2900+
* reported by drivers that support bonding.
2901+
*/
2902+
if (netif_is_lag_master(ndev) || netif_is_lag_port(ndev))
2903+
return;
2904+
2905+
ibdev = ib_device_get_by_netdev(ndev, RDMA_DRIVER_UNKNOWN);
2906+
if (!ibdev)
2907+
return;
2908+
2909+
if (ibdev->ops.report_port_event) {
2910+
ibdev->ops.report_port_event(ibdev, ndev, event);
2911+
goto put_ibdev;
2912+
}
2913+
2914+
ib_dispatch_port_state_event(ibdev, ndev);
2915+
2916+
put_ibdev:
2917+
ib_device_put(ibdev);
2918+
};
2919+
28572920
static int ib_netdevice_event(struct notifier_block *this,
28582921
unsigned long event, void *ptr)
28592922
{
28602923
struct net_device *ndev = netdev_notifier_info_to_dev(ptr);
2861-
struct net_device *ib_ndev;
28622924
struct ib_device *ibdev;
28632925
u32 port;
28642926

@@ -2868,15 +2930,21 @@ static int ib_netdevice_event(struct notifier_block *this,
28682930
if (!ibdev)
28692931
return NOTIFY_DONE;
28702932

2871-
rdma_for_each_port(ibdev, port) {
2872-
ib_ndev = ib_device_get_netdev(ibdev, port);
2873-
if (ndev == ib_ndev)
2874-
rdma_nl_notify_event(ibdev, port,
2875-
RDMA_NETDEV_RENAME_EVENT);
2876-
dev_put(ib_ndev);
2933+
if (ib_query_netdev_port(ibdev, ndev, &port)) {
2934+
ib_device_put(ibdev);
2935+
break;
28772936
}
2937+
2938+
rdma_nl_notify_event(ibdev, port, RDMA_NETDEV_RENAME_EVENT);
28782939
ib_device_put(ibdev);
28792940
break;
2941+
2942+
case NETDEV_UP:
2943+
case NETDEV_CHANGE:
2944+
case NETDEV_DOWN:
2945+
handle_port_event(ndev, event);
2946+
break;
2947+
28802948
default:
28812949
break;
28822950
}

drivers/infiniband/core/ud_header.c

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -462,86 +462,3 @@ int ib_ud_header_pack(struct ib_ud_header *header,
462462
return len;
463463
}
464464
EXPORT_SYMBOL(ib_ud_header_pack);
465-
466-
/**
467-
* ib_ud_header_unpack - Unpack UD header struct from wire format
468-
* @header:UD header struct
469-
* @buf:Buffer to pack into
470-
*
471-
* ib_ud_header_pack() unpacks the UD header structure @header from wire
472-
* format in the buffer @buf.
473-
*/
474-
int ib_ud_header_unpack(void *buf,
475-
struct ib_ud_header *header)
476-
{
477-
ib_unpack(lrh_table, ARRAY_SIZE(lrh_table),
478-
buf, &header->lrh);
479-
buf += IB_LRH_BYTES;
480-
481-
if (header->lrh.link_version != 0) {
482-
pr_warn("Invalid LRH.link_version %u\n",
483-
header->lrh.link_version);
484-
return -EINVAL;
485-
}
486-
487-
switch (header->lrh.link_next_header) {
488-
case IB_LNH_IBA_LOCAL:
489-
header->grh_present = 0;
490-
break;
491-
492-
case IB_LNH_IBA_GLOBAL:
493-
header->grh_present = 1;
494-
ib_unpack(grh_table, ARRAY_SIZE(grh_table),
495-
buf, &header->grh);
496-
buf += IB_GRH_BYTES;
497-
498-
if (header->grh.ip_version != 6) {
499-
pr_warn("Invalid GRH.ip_version %u\n",
500-
header->grh.ip_version);
501-
return -EINVAL;
502-
}
503-
if (header->grh.next_header != 0x1b) {
504-
pr_warn("Invalid GRH.next_header 0x%02x\n",
505-
header->grh.next_header);
506-
return -EINVAL;
507-
}
508-
break;
509-
510-
default:
511-
pr_warn("Invalid LRH.link_next_header %u\n",
512-
header->lrh.link_next_header);
513-
return -EINVAL;
514-
}
515-
516-
ib_unpack(bth_table, ARRAY_SIZE(bth_table),
517-
buf, &header->bth);
518-
buf += IB_BTH_BYTES;
519-
520-
switch (header->bth.opcode) {
521-
case IB_OPCODE_UD_SEND_ONLY:
522-
header->immediate_present = 0;
523-
break;
524-
case IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE:
525-
header->immediate_present = 1;
526-
break;
527-
default:
528-
pr_warn("Invalid BTH.opcode 0x%02x\n", header->bth.opcode);
529-
return -EINVAL;
530-
}
531-
532-
if (header->bth.transport_header_version != 0) {
533-
pr_warn("Invalid BTH.transport_header_version %u\n",
534-
header->bth.transport_header_version);
535-
return -EINVAL;
536-
}
537-
538-
ib_unpack(deth_table, ARRAY_SIZE(deth_table),
539-
buf, &header->deth);
540-
buf += IB_DETH_BYTES;
541-
542-
if (header->immediate_present)
543-
memcpy(&header->immediate_data, buf, sizeof header->immediate_data);
544-
545-
return 0;
546-
}
547-
EXPORT_SYMBOL(ib_ud_header_unpack);

drivers/infiniband/core/uverbs_marshall.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -171,45 +171,3 @@ void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst,
171171
__ib_copy_path_rec_to_user(dst, src);
172172
}
173173
EXPORT_SYMBOL(ib_copy_path_rec_to_user);
174-
175-
void ib_copy_path_rec_from_user(struct sa_path_rec *dst,
176-
struct ib_user_path_rec *src)
177-
{
178-
u32 slid, dlid;
179-
180-
memset(dst, 0, sizeof(*dst));
181-
if ((ib_is_opa_gid((union ib_gid *)src->sgid)) ||
182-
(ib_is_opa_gid((union ib_gid *)src->dgid))) {
183-
dst->rec_type = SA_PATH_REC_TYPE_OPA;
184-
slid = opa_get_lid_from_gid((union ib_gid *)src->sgid);
185-
dlid = opa_get_lid_from_gid((union ib_gid *)src->dgid);
186-
} else {
187-
dst->rec_type = SA_PATH_REC_TYPE_IB;
188-
slid = ntohs(src->slid);
189-
dlid = ntohs(src->dlid);
190-
}
191-
memcpy(dst->dgid.raw, src->dgid, sizeof dst->dgid);
192-
memcpy(dst->sgid.raw, src->sgid, sizeof dst->sgid);
193-
194-
sa_path_set_dlid(dst, dlid);
195-
sa_path_set_slid(dst, slid);
196-
sa_path_set_raw_traffic(dst, src->raw_traffic);
197-
dst->flow_label = src->flow_label;
198-
dst->hop_limit = src->hop_limit;
199-
dst->traffic_class = src->traffic_class;
200-
dst->reversible = src->reversible;
201-
dst->numb_path = src->numb_path;
202-
dst->pkey = src->pkey;
203-
dst->sl = src->sl;
204-
dst->mtu_selector = src->mtu_selector;
205-
dst->mtu = src->mtu;
206-
dst->rate_selector = src->rate_selector;
207-
dst->rate = src->rate;
208-
dst->packet_life_time = src->packet_life_time;
209-
dst->preference = src->preference;
210-
dst->packet_life_time_selector = src->packet_life_time_selector;
211-
212-
/* TODO: No need to set this */
213-
sa_path_set_dmac_zero(dst);
214-
}
215-
EXPORT_SYMBOL(ib_copy_path_rec_from_user);

drivers/infiniband/hw/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ obj-$(CONFIG_INFINIBAND_OCRDMA) += ocrdma/
1111
obj-$(CONFIG_INFINIBAND_VMWARE_PVRDMA) += vmw_pvrdma/
1212
obj-$(CONFIG_INFINIBAND_USNIC) += usnic/
1313
obj-$(CONFIG_INFINIBAND_HFI1) += hfi1/
14-
obj-$(CONFIG_INFINIBAND_HNS) += hns/
14+
obj-$(CONFIG_INFINIBAND_HNS_HIP08) += hns/
1515
obj-$(CONFIG_INFINIBAND_QEDR) += qedr/
1616
obj-$(CONFIG_INFINIBAND_BNXT_RE) += bnxt_re/
1717
obj-$(CONFIG_INFINIBAND_ERDMA) += erdma/

drivers/infiniband/hw/bnxt_re/bnxt_re.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ struct bnxt_re_dev {
204204
struct bnxt_re_nq_record *nqr;
205205

206206
/* Device Resources */
207-
struct bnxt_qplib_dev_attr dev_attr;
207+
struct bnxt_qplib_dev_attr *dev_attr;
208208
struct bnxt_qplib_ctx qplib_ctx;
209209
struct bnxt_qplib_res qplib_res;
210210
struct bnxt_qplib_dpi dpi_privileged;
@@ -229,6 +229,9 @@ struct bnxt_re_dev {
229229
DECLARE_HASHTABLE(srq_hash, MAX_SRQ_HASH_BITS);
230230
struct dentry *dbg_root;
231231
struct dentry *qp_debugfs;
232+
unsigned long event_bitmap;
233+
struct bnxt_qplib_cc_param cc_param;
234+
struct workqueue_struct *dcb_wq;
232235
};
233236

234237
#define to_bnxt_re_dev(ptr, member) \

drivers/infiniband/hw/bnxt_re/hw_counters.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,9 @@
3737
*
3838
*/
3939

40-
#include <linux/interrupt.h>
4140
#include <linux/types.h>
42-
#include <linux/spinlock.h>
43-
#include <linux/sched.h>
44-
#include <linux/slab.h>
4541
#include <linux/pci.h>
46-
#include <linux/prefetch.h>
47-
#include <linux/delay.h>
4842

49-
#include <rdma/ib_addr.h>
50-
51-
#include "bnxt_ulp.h"
5243
#include "roce_hsi.h"
5344
#include "qplib_res.h"
5445
#include "qplib_sp.h"
@@ -357,7 +348,7 @@ int bnxt_re_ib_get_hw_stats(struct ib_device *ibdev,
357348
goto done;
358349
}
359350
bnxt_re_copy_err_stats(rdev, stats, err_s);
360-
if (_is_ext_stats_supported(rdev->dev_attr.dev_cap_flags) &&
351+
if (_is_ext_stats_supported(rdev->dev_attr->dev_cap_flags) &&
361352
!rdev->is_virtfn) {
362353
rc = bnxt_re_get_ext_stat(rdev, stats);
363354
if (rc) {

0 commit comments

Comments
 (0)