Skip to content

Commit

Permalink
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/rdma/rdma

Pull more rdma updates from Doug Ledford:
 "Items of note:

   - two patches fix a regression in the 4.15 kernel. The 4.14 kernel
     worked fine with NVMe over Fabrics and mlx5 adapters. That broke in
     4.15. The fix is here.

   - one of the patches (the endian notation patch from Lijun) looks
     like a lot of lines of change, but it's mostly mechanical in
     nature. It amounts to the biggest chunk of change in it (it's about
     2/3rds of the overall pull request).

  Summary:

   - Clean up some function signatures in rxe for clarity

   - Tidy the RDMA netlink header to remove unimplemented constants

   - bnxt_re driver fixes, one is a regression this window.

   - Minor hns driver fixes

   - Various fixes from Dan Carpenter and his tool

   - Fix IRQ cleanup race in HFI1

   - HF1 performance optimizations and a fix to report counters in the right units

   - Fix for an IPoIB startup sequence race with the external manager

   - Oops fix for the new kabi path

   - Endian cleanups for hns

   - Fix for mlx5 related to the new automatic affinity support"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (38 commits)
  net/mlx5: increase async EQ to avoid EQ overrun
  mlx5: fix mlx5_get_vector_affinity to start from completion vector 0
  RDMA/hns: Fix the endian problem for hns
  IB/uverbs: Use the standard kConfig format for experimental
  IB: Update references to libibverbs
  IB/hfi1: Add 16B rcvhdr trace support
  IB/hfi1: Convert kzalloc_node and kcalloc to use kcalloc_node
  IB/core: Avoid a potential OOPs for an unused optional parameter
  IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
  IB/ipoib: Fix for potential no-carrier state
  IB/hfi1: Show fault stats in both TX and RX directions
  IB/hfi1: Remove blind constants from 16B update
  IB/hfi1: Convert PortXmitWait/PortVLXmitWait counters to flit times
  IB/hfi1: Do not override given pcie_pset value
  IB/hfi1: Optimize process_receive_ib()
  IB/hfi1: Remove unnecessary fecn and becn fields
  IB/hfi1: Look up ibport using a pointer in receive path
  IB/hfi1: Optimize packet type comparison using 9B and bypass code paths
  IB/hfi1: Compute BTH only for RDMA_WRITE_LAST/SEND_LAST packet
  IB/hfi1: Remove dependence on qp->s_hdrwords
  ...
  • Loading branch information
Linus Torvalds committed Feb 6, 2018
2 parents 3ff1b28 + 03ecdd2 commit 2246edf
Show file tree
Hide file tree
Showing 55 changed files with 919 additions and 644 deletions.
2 changes: 1 addition & 1 deletion Documentation/infiniband/user_verbs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ USERSPACE VERBS ACCESS
described in chapter 11 of the InfiniBand Architecture Specification.

To use the verbs, the libibverbs library, available from
http://www.openfabrics.org/, is required. libibverbs contains a
https://github.com/linux-rdma/rdma-core, is required. libibverbs contains a
device-independent API for using the ib_uverbs interface.
libibverbs also requires appropriate device-dependent kernel and
userspace driver for your InfiniBand hardware. For example, to use
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6946,7 +6946,7 @@ INFINIBAND SUBSYSTEM
M: Doug Ledford <dledford@redhat.com>
M: Jason Gunthorpe <jgg@mellanox.com>
L: linux-rdma@vger.kernel.org
W: http://www.openfabrics.org/
W: https://github.com/linux-rdma/rdma-core
Q: http://patchwork.kernel.org/project/linux-rdma/list/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git
S: Supported
Expand Down
7 changes: 4 additions & 3 deletions drivers/infiniband/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ config INFINIBAND_USER_MAD
Userspace InfiniBand Management Datagram (MAD) support. This
is the kernel side of the userspace MAD support, which allows
userspace processes to send and receive MADs. You will also
need libibumad from <http://www.openfabrics.org/downloads/management/>.
need libibumad from rdma-core
<https://github.com/linux-rdma/rdma-core>.

config INFINIBAND_USER_ACCESS
tristate "InfiniBand userspace access (verbs and CM)"
Expand All @@ -32,10 +33,10 @@ config INFINIBAND_USER_ACCESS
to set up connections and directly access InfiniBand
hardware for fast-path operations. You will also need
libibverbs, libibcm and a hardware driver library from
<http://www.openfabrics.org/git/>.
rdma-core <https://github.com/linux-rdma/rdma-core>.

config INFINIBAND_EXP_USER_ACCESS
bool "Allow experimental support for Infiniband ABI"
bool "Enable the full uverbs ioctl interface (EXPERIMENTAL)"
depends on INFINIBAND_USER_ACCESS
---help---
IOCTL based ABI support for Infiniband. This allows userspace
Expand Down
4 changes: 3 additions & 1 deletion drivers/infiniband/core/nldev.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,10 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
return -EINVAL;

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!msg)
if (!msg) {
ret = -ENOMEM;
goto err;
}

nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET),
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/core/uverbs_std_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ static int uverbs_create_cq_handler(struct ib_device *ib_dev,
cq->uobject = &obj->uobject;
cq->comp_handler = ib_uverbs_comp_handler;
cq->event_handler = ib_uverbs_cq_event_handler;
cq->cq_context = &ev_file->ev_queue;
cq->cq_context = ev_file ? &ev_file->ev_queue : NULL;
obj->uobject.object = cq;
obj->uobject.user_handle = user_handle;
atomic_set(&cq->usecnt, 0);
Expand Down
7 changes: 2 additions & 5 deletions drivers/infiniband/hw/bnxt_re/ib_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ int bnxt_re_destroy_srq(struct ib_srq *ib_srq)
return rc;
}

if (srq->umem && !IS_ERR(srq->umem))
if (srq->umem)
ib_umem_release(srq->umem);
kfree(srq);
atomic_dec(&rdev->srq_count);
Expand Down Expand Up @@ -1430,11 +1430,8 @@ struct ib_srq *bnxt_re_create_srq(struct ib_pd *ib_pd,
return &srq->ib_srq;

fail:
if (udata && srq->umem && !IS_ERR(srq->umem)) {
if (srq->umem)
ib_umem_release(srq->umem);
srq->umem = NULL;
}

kfree(srq);
exit:
return ERR_PTR(rc);
Expand Down
4 changes: 3 additions & 1 deletion drivers/infiniband/hw/bnxt_re/qplib_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,10 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,

srq->swq = kcalloc(srq->hwq.max_elements, sizeof(*srq->swq),
GFP_KERNEL);
if (!srq->swq)
if (!srq->swq) {
rc = -ENOMEM;
goto fail;
}

RCFW_CMD_PREP(req, CREATE_SRQ, cmd_flags);

Expand Down
18 changes: 7 additions & 11 deletions drivers/infiniband/hw/bnxt_re/qplib_res.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,31 +705,27 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res,
dpit->max = dbr_len / PAGE_SIZE;

dpit->app_tbl = kcalloc(dpit->max, sizeof(void *), GFP_KERNEL);
if (!dpit->app_tbl) {
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
dev_err(&res->pdev->dev,
"QPLIB: DPI app tbl allocation failed");
return -ENOMEM;
}
if (!dpit->app_tbl)
goto unmap_io;

bytes = dpit->max >> 3;
if (!bytes)
bytes = 1;

dpit->tbl = kmalloc(bytes, GFP_KERNEL);
if (!dpit->tbl) {
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
kfree(dpit->app_tbl);
dpit->app_tbl = NULL;
dev_err(&res->pdev->dev,
"QPLIB: DPI tbl allocation failed for size = %d",
bytes);
return -ENOMEM;
goto unmap_io;
}

memset((u8 *)dpit->tbl, 0xFF, bytes);

return 0;

unmap_io:
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
return -ENOMEM;
}

/* PKEYs */
Expand Down
82 changes: 70 additions & 12 deletions drivers/infiniband/hw/hfi1/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ static int qos_rmt_entries(struct hfi1_devdata *dd, unsigned int *mp,
static void clear_full_mgmt_pkey(struct hfi1_pportdata *ppd);
static int wait_link_transfer_active(struct hfi1_devdata *dd, int wait_ms);
static void clear_rsm_rule(struct hfi1_devdata *dd, u8 rule_index);
static void update_xmit_counters(struct hfi1_pportdata *ppd, u16 link_width);

/*
* Error interrupt table entry. This is used as input to the interrupt
Expand Down Expand Up @@ -6905,6 +6906,32 @@ void handle_freeze(struct work_struct *work)
/* no longer frozen */
}

/**
* update_xmit_counters - update PortXmitWait/PortVlXmitWait
* counters.
* @ppd: info of physical Hfi port
* @link_width: new link width after link up or downgrade
*
* Update the PortXmitWait and PortVlXmitWait counters after
* a link up or downgrade event to reflect a link width change.
*/
static void update_xmit_counters(struct hfi1_pportdata *ppd, u16 link_width)
{
int i;
u16 tx_width;
u16 link_speed;

tx_width = tx_link_width(link_width);
link_speed = get_link_speed(ppd->link_speed_active);

/*
* There are C_VL_COUNT number of PortVLXmitWait counters.
* Adding 1 to C_VL_COUNT to include the PortXmitWait counter.
*/
for (i = 0; i < C_VL_COUNT + 1; i++)
get_xmit_wait_counters(ppd, tx_width, link_speed, i);
}

/*
* Handle a link up interrupt from the 8051.
*
Expand Down Expand Up @@ -7526,18 +7553,29 @@ void handle_verify_cap(struct work_struct *work)
set_link_state(ppd, HLS_GOING_UP);
}

/*
* Apply the link width downgrade enabled policy against the current active
* link widths.
/**
* apply_link_downgrade_policy - Apply the link width downgrade enabled
* policy against the current active link widths.
* @ppd: info of physical Hfi port
* @refresh_widths: True indicates link downgrade event
* @return: True indicates a successful link downgrade. False indicates
* link downgrade event failed and the link will bounce back to
* default link width.
*
* Called when the enabled policy changes or the active link widths change.
* Called when the enabled policy changes or the active link widths
* change.
* Refresh_widths indicates that a link downgrade occurred. The
* link_downgraded variable is set by refresh_widths and
* determines the success/failure of the policy application.
*/
void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths)
bool apply_link_downgrade_policy(struct hfi1_pportdata *ppd,
bool refresh_widths)
{
int do_bounce = 0;
int tries;
u16 lwde;
u16 tx, rx;
bool link_downgraded = refresh_widths;

/* use the hls lock to avoid a race with actual link up */
tries = 0;
Expand Down Expand Up @@ -7571,6 +7609,7 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths)
ppd->link_width_downgrade_rx_active == 0) {
/* the 8051 reported a dead link as a downgrade */
dd_dev_err(ppd->dd, "Link downgrade is really a link down, ignoring\n");
link_downgraded = false;
} else if (lwde == 0) {
/* downgrade is disabled */

Expand All @@ -7587,6 +7626,7 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths)
ppd->link_width_downgrade_tx_active,
ppd->link_width_downgrade_rx_active);
do_bounce = 1;
link_downgraded = false;
}
} else if ((lwde & ppd->link_width_downgrade_tx_active) == 0 ||
(lwde & ppd->link_width_downgrade_rx_active) == 0) {
Expand All @@ -7598,6 +7638,7 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths)
lwde, ppd->link_width_downgrade_tx_active,
ppd->link_width_downgrade_rx_active);
do_bounce = 1;
link_downgraded = false;
}

done:
Expand All @@ -7609,6 +7650,8 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths)
set_link_state(ppd, HLS_DN_OFFLINE);
start_link(ppd);
}

return link_downgraded;
}

/*
Expand All @@ -7622,7 +7665,8 @@ void handle_link_downgrade(struct work_struct *work)
link_downgrade_work);

dd_dev_info(ppd->dd, "8051: Link width downgrade\n");
apply_link_downgrade_policy(ppd, 1);
if (apply_link_downgrade_policy(ppd, true))
update_xmit_counters(ppd, ppd->link_width_downgrade_tx_active);
}

static char *dcc_err_string(char *buf, int buf_len, u64 flags)
Expand Down Expand Up @@ -8264,8 +8308,8 @@ static irqreturn_t sdma_interrupt(int irq, void *data)
/* handle the interrupt(s) */
sdma_engine_interrupt(sde, status);
} else {
dd_dev_err_ratelimited(dd, "SDMA engine %u interrupt, but no status bits set\n",
sde->this_idx);
dd_dev_info_ratelimited(dd, "SDMA engine %u interrupt, but no status bits set\n",
sde->this_idx);
}
return IRQ_HANDLED;
}
Expand Down Expand Up @@ -10597,6 +10641,14 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state)
add_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);

handle_linkup_change(dd, 1);

/*
* After link up, a new link width will have been set.
* Update the xmit counters with regards to the new
* link width.
*/
update_xmit_counters(ppd, ppd->link_width_active);

ppd->host_link_state = HLS_UP_INIT;
update_statusp(ppd, IB_PORT_INIT);
break;
Expand Down Expand Up @@ -12960,7 +13012,14 @@ static void disable_intx(struct pci_dev *pdev)
pci_intx(pdev, 0);
}

static void clean_up_interrupts(struct hfi1_devdata *dd)
/**
* hfi1_clean_up_interrupts() - Free all IRQ resources
* @dd: valid device data data structure
*
* Free the MSI or INTx IRQs and assoicated PCI resources,
* if they have been allocated.
*/
void hfi1_clean_up_interrupts(struct hfi1_devdata *dd)
{
int i;

Expand Down Expand Up @@ -13321,7 +13380,7 @@ static int set_up_interrupts(struct hfi1_devdata *dd)
return 0;

fail:
clean_up_interrupts(dd);
hfi1_clean_up_interrupts(dd);
return ret;
}

Expand Down Expand Up @@ -14748,7 +14807,6 @@ void hfi1_start_cleanup(struct hfi1_devdata *dd)
aspm_exit(dd);
free_cntrs(dd);
free_rcverr(dd);
clean_up_interrupts(dd);
finish_chip_resources(dd);
}

Expand Down Expand Up @@ -15204,7 +15262,7 @@ struct hfi1_devdata *hfi1_init_dd(struct pci_dev *pdev,
bail_free_cntrs:
free_cntrs(dd);
bail_clear_intr:
clean_up_interrupts(dd);
hfi1_clean_up_interrupts(dd);
bail_cleanup:
hfi1_pcie_ddcleanup(dd);
bail_free:
Expand Down
4 changes: 2 additions & 2 deletions drivers/infiniband/hw/hfi1/chip.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,8 @@ int read_8051_config(struct hfi1_devdata *, u8, u8, u32 *);
int start_link(struct hfi1_pportdata *ppd);
int bringup_serdes(struct hfi1_pportdata *ppd);
void set_intr_state(struct hfi1_devdata *dd, u32 enable);
void apply_link_downgrade_policy(struct hfi1_pportdata *ppd,
int refresh_widths);
bool apply_link_downgrade_policy(struct hfi1_pportdata *ppd,
bool refresh_widths);
void update_usrhead(struct hfi1_ctxtdata *rcd, u32 hd, u32 updegr, u32 egrhd,
u32 intr_adjust, u32 npkts);
int stop_drain_data_vls(struct hfi1_devdata *dd);
Expand Down
9 changes: 8 additions & 1 deletion drivers/infiniband/hw/hfi1/debugfs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(c) 2015-2017 Intel Corporation.
* Copyright(c) 2015-2018 Intel Corporation.
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
Expand Down Expand Up @@ -1201,6 +1201,13 @@ static int _fault_stats_seq_show(struct seq_file *s, void *v)
}
hfi1_rcd_put(rcd);
}
for_each_possible_cpu(j) {
struct hfi1_opcode_stats_perctx *sp =
per_cpu_ptr(dd->tx_opstats, j);

n_packets += sp->stats[i].n_packets;
n_bytes += sp->stats[i].n_bytes;
}
if (!n_packets && !n_bytes)
return SEQ_SKIP;
if (!ibd->fault_opcode->n_rxfaults[i] &&
Expand Down
Loading

0 comments on commit 2246edf

Please sign in to comment.