mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
hw/rdma: Switch to generic error reporting way
Utilize error_report for all pr_err calls and some pr_dbg that are considered as errors. For the remaining pr_dbg calls, the important ones were replaced by trace points while other deleted. Some of the functions got renamed to include prefix "rdma/pvrdma" in the function name. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Message-Id: <1552300155-25216-2-git-send-email-yuval.shaia@oracle.com> Reviewed-by: Kamal Heib <kamalheib1@gmail.com> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
This commit is contained in:
parent
ade0075523
commit
4d71b38ae8
13 changed files with 364 additions and 578 deletions
|
@ -17,6 +17,8 @@
|
|||
#include "hw/pci/pci.h"
|
||||
#include "cpu.h"
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
#include "../rdma_utils.h"
|
||||
#include "standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h"
|
||||
#include "pvrdma_dev_ring.h"
|
||||
|
@ -30,13 +32,10 @@ int pvrdma_ring_init(PvrdmaRing *ring, const char *name, PCIDevice *dev,
|
|||
|
||||
strncpy(ring->name, name, MAX_RING_NAME_SZ);
|
||||
ring->name[MAX_RING_NAME_SZ - 1] = 0;
|
||||
pr_dbg("Initializing %s ring\n", ring->name);
|
||||
ring->dev = dev;
|
||||
ring->ring_state = ring_state;
|
||||
ring->max_elems = max_elems;
|
||||
ring->elem_sz = elem_sz;
|
||||
pr_dbg("ring->elem_sz=%zu\n", ring->elem_sz);
|
||||
pr_dbg("npages=%d\n", npages);
|
||||
/* TODO: Give a moment to think if we want to redo driver settings
|
||||
atomic_set(&ring->ring_state->prod_tail, 0);
|
||||
atomic_set(&ring->ring_state->cons_head, 0);
|
||||
|
@ -46,14 +45,14 @@ int pvrdma_ring_init(PvrdmaRing *ring, const char *name, PCIDevice *dev,
|
|||
|
||||
for (i = 0; i < npages; i++) {
|
||||
if (!tbl[i]) {
|
||||
pr_err("npages=%ld but tbl[%d] is NULL\n", (long)npages, i);
|
||||
rdma_error_report("npages=%d but tbl[%d] is NULL", npages, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
ring->pages[i] = rdma_pci_dma_map(dev, tbl[i], TARGET_PAGE_SIZE);
|
||||
if (!ring->pages[i]) {
|
||||
rc = -ENOMEM;
|
||||
pr_dbg("Failed to map to page %d\n", i);
|
||||
rdma_error_report("Failed to map to page %d in ring %s", i, name);
|
||||
goto out_free;
|
||||
}
|
||||
memset(ring->pages[i], 0, TARGET_PAGE_SIZE);
|
||||
|
@ -78,7 +77,7 @@ void *pvrdma_ring_next_elem_read(PvrdmaRing *ring)
|
|||
|
||||
e = pvrdma_idx_ring_has_data(ring->ring_state, ring->max_elems, &idx);
|
||||
if (e <= 0) {
|
||||
pr_dbg("No more data in ring\n");
|
||||
trace_pvrdma_ring_next_elem_read_no_data(ring->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -89,11 +88,6 @@ void *pvrdma_ring_next_elem_read(PvrdmaRing *ring)
|
|||
void pvrdma_ring_read_inc(PvrdmaRing *ring)
|
||||
{
|
||||
pvrdma_idx_ring_inc(&ring->ring_state->cons_head, ring->max_elems);
|
||||
/*
|
||||
pr_dbg("%s: t=%d, h=%d, m=%ld\n", ring->name,
|
||||
ring->ring_state->prod_tail, ring->ring_state->cons_head,
|
||||
ring->max_elems);
|
||||
*/
|
||||
}
|
||||
|
||||
void *pvrdma_ring_next_elem_write(PvrdmaRing *ring)
|
||||
|
@ -103,13 +97,13 @@ void *pvrdma_ring_next_elem_write(PvrdmaRing *ring)
|
|||
|
||||
idx = pvrdma_idx_ring_has_space(ring->ring_state, ring->max_elems, &tail);
|
||||
if (idx <= 0) {
|
||||
pr_dbg("CQ is full\n");
|
||||
rdma_error_report("CQ is full");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
idx = pvrdma_idx(&ring->ring_state->prod_tail, ring->max_elems);
|
||||
if (idx < 0 || tail != idx) {
|
||||
pr_dbg("invalid idx\n");
|
||||
rdma_error_report("Invalid idx %d", idx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -120,11 +114,6 @@ void *pvrdma_ring_next_elem_write(PvrdmaRing *ring)
|
|||
void pvrdma_ring_write_inc(PvrdmaRing *ring)
|
||||
{
|
||||
pvrdma_idx_ring_inc(&ring->ring_state->prod_tail, ring->max_elems);
|
||||
/*
|
||||
pr_dbg("%s: t=%d, h=%d, m=%ld\n", ring->name,
|
||||
ring->ring_state->prod_tail, ring->ring_state->cons_head,
|
||||
ring->max_elems);
|
||||
*/
|
||||
}
|
||||
|
||||
void pvrdma_ring_free(PvrdmaRing *ring)
|
||||
|
@ -137,7 +126,6 @@ void pvrdma_ring_free(PvrdmaRing *ring)
|
|||
return;
|
||||
}
|
||||
|
||||
pr_dbg("ring->npages=%d\n", ring->npages);
|
||||
while (ring->npages--) {
|
||||
rdma_pci_dma_unmap(ring->dev, ring->pages[ring->npages],
|
||||
TARGET_PAGE_SIZE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue