// SPDX-License-Identifier: GPL-2.0-only /* * IBM Accelerator Family 'GenWQE' * * (C) Copyright IBM Corp. 2013 * * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> * Author: Michael Jung <mijung@gmx.net> * Author: Michael Ruettger <michael@ibmra.de>
*/
/* * Device Driver Control Block (DDCB) queue support. Definition of * interrupt handlers for queue support as well as triggering the * health monitor code in case of problems. The current hardware uses * an MSI interrupt which is shared between error handling and * functional code.
*/
/* * N: next DDCB, this is where the next DDCB will be put. * A: active DDCB, this is where the code will look for the next completion. * x: DDCB is enqueued, we are waiting for its completion.
* Situation (1): Empty queue * +---+---+---+---+---+---+---+---+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * | | | | | | | | | * +---+---+---+---+---+---+---+---+ * A/N * enqueued_ddcbs = A - N = 2 - 2 = 0 * * Situation (2): Wrapped, N > A * +---+---+---+---+---+---+---+---+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * | | | x | x | | | | | * +---+---+---+---+---+---+---+---+ * A N * enqueued_ddcbs = N - A = 4 - 2 = 2 * * Situation (3): Queue wrapped, A > N * +---+---+---+---+---+---+---+---+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * | x | x | | | x | x | x | x | * +---+---+---+---+---+---+---+---+ * N A * enqueued_ddcbs = queue_max - (A - N) = 8 - (4 - 2) = 6 * * Situation (4a): Queue full N > A * +---+---+---+---+---+---+---+---+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * | x | x | x | x | x | x | x | | * +---+---+---+---+---+---+---+---+ * A N * * enqueued_ddcbs = N - A = 7 - 0 = 7 * * Situation (4a): Queue full A > N * +---+---+---+---+---+---+---+---+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * | x | x | x | | x | x | x | x | * +---+---+---+---+---+---+---+---+ * N A * enqueued_ddcbs = queue_max - (A - N) = 8 - (4 - 3) = 7
*/
if (WARN_ON_ONCE(free_ddcbs < 0)) { /* must never ever happen! */ return 0;
} return free_ddcbs;
}
/* * Use of the PRIV field in the DDCB for queue debugging: * * (1) Trying to get rid of a DDCB which saw a timeout: * pddcb->priv[6] = 0xcc; # cleared * * (2) Append a DDCB via NEXT bit: * pddcb->priv[7] = 0xaa; # appended * * (3) DDCB needed tapping: * pddcb->priv[7] = 0xbb; # tapped * * (4) DDCB marked as correctly finished: * pddcb->priv[6] = 0xff; # finished
*/
/** * ddcb_requ_finished() - Returns the hardware state of the associated DDCB * @cd: pointer to genwqe device descriptor * @req: DDCB work request * * Status of ddcb_requ mirrors this hardware state, but is copied in * the ddcb_requ on interrupt/polling function. The lowlevel code * should check the hardware state directly, the higher level code * should check the copy. * * This function will also return true if the state of the queue is * not GENWQE_CARD_USED. This enables us to purge all DDCBs in the * shutdown case.
*/ staticint ddcb_requ_finished(struct genwqe_dev *cd, struct ddcb_requ *req)
{ return (ddcb_requ_get_state(req) == GENWQE_REQU_FINISHED) ||
(cd->card_state != GENWQE_CARD_USED);
}
#define RET_DDCB_APPENDED 1 #define RET_DDCB_TAPPED 2 /** * enqueue_ddcb() - Enqueue a DDCB * @cd: pointer to genwqe device descriptor * @queue: queue this operation should be done on * @pddcb: pointer to ddcb structure * @ddcb_no: pointer to ddcb number being tapped * * Start execution of DDCB by tapping or append to queue via NEXT * bit. This is done by an atomic 'compare and swap' instruction and * checking SHI and HSI of the previous DDCB. * * This function must only be called with ddcb_lock held. * * Return: 1 if new DDCB is appended to previous * 2 if DDCB queue is tapped via register/simulation
*/ staticint enqueue_ddcb(struct genwqe_dev *cd, struct ddcb_queue *queue, struct ddcb *pddcb, int ddcb_no)
{ unsignedinttry; int prev_no; struct ddcb *prev_ddcb;
__be32 old, new, icrc_hsi_shi;
u64 num;
/* * For performance checks a Dispatch Timestamp can be put into * DDCB It is supposed to use the SLU's free running counter, * but this requires PCIe cycles.
*/
ddcb_mark_unused(pddcb);
/* * It might have happened that the HSI.FETCHED bit is * set. Retry in this case. Therefore I expect maximum 2 times * trying.
*/
ddcb_mark_appended(pddcb); for (try = 0; try < 2; try++) {
old = prev_ddcb->icrc_hsi_shi_32; /* read SHI/HSI in BE32 */
/* try to append via NEXT bit if prev DDCB is not completed */ if ((old & DDCB_COMPLETED_BE32) != 0x00000000) break;
new = (old | DDCB_NEXT_BE32);
wmb(); /* need to ensure write ordering */
icrc_hsi_shi = cmpxchg(&prev_ddcb->icrc_hsi_shi_32, old, new);
if (icrc_hsi_shi == old) return RET_DDCB_APPENDED; /* appended to queue */
}
/* Queue must be re-started by updating QUEUE_OFFSET */
ddcb_mark_tapped(pddcb);
num = (u64)ddcb_no << 8;
wmb(); /* need to ensure write ordering */
__genwqe_writeq(cd, queue->IO_QUEUE_OFFSET, num); /* start queue */
return RET_DDCB_TAPPED;
}
/** * copy_ddcb_results() - Copy output state from real DDCB to request * @req: pointer to requested DDCB parameters * @ddcb_no: pointer to ddcb number being tapped * * Copy DDCB ASV to request struct. There is no endian * conversion made, since data structure in ASV is still * unknown here. * * This is needed by: * - genwqe_purge_ddcb() * - genwqe_check_ddcb_queue()
*/ staticvoid copy_ddcb_results(struct ddcb_requ *req, int ddcb_no)
{ struct ddcb_queue *queue = req->queue; struct ddcb *pddcb = &queue->ddcb_vaddr[req->num];
/* copy status flags of the variant part */
req->cmd.vcrc = be16_to_cpu(pddcb->vcrc_16);
req->cmd.deque_ts = be64_to_cpu(pddcb->deque_ts_64);
req->cmd.cmplt_ts = be64_to_cpu(pddcb->cmplt_ts_64);
if ((pddcb->icrc_hsi_shi_32 & DDCB_COMPLETED_BE32) ==
0x00000000) goto go_home; /* not completed, continue waiting */
wmb(); /* Add sync to decouple prev. read operations */
/* Note: DDCB could be purged */
req = queue->ddcb_req[queue->ddcb_act]; if (req == NULL) { /* this occurs if DDCB is purged, not an error */ /* Move active DDCB further; Nothing to do anymore. */ goto pick_next_one;
}
/* * HSI=0x44 (fetched and completed), but RETC is * 0x101, or even worse 0x000. * * In case of seeing the queue in inconsistent state * we read the errcnts and the queue status to provide * a trigger for our PCIe analyzer stop capturing.
*/
retc_16 = be16_to_cpu(pddcb->retc_16); if ((pddcb->hsi == 0x44) && (retc_16 <= 0x101)) {
u64 errcnts, status;
u64 ddcb_offs = (u64)pddcb - (u64)queue->ddcb_vaddr;
errcnts = __genwqe_readq(cd, queue->IO_QUEUE_ERRCNTS);
status = __genwqe_readq(cd, queue->IO_QUEUE_STATUS);
/* wake up process waiting for this DDCB, and
processes on the busy queue */
wake_up_interruptible(&queue->ddcb_waitqs[queue->ddcb_act]);
wake_up_interruptible(&queue->busy_waitq);
/** * __genwqe_wait_ddcb(): Waits until DDCB is completed * @cd: pointer to genwqe device descriptor * @req: pointer to requsted DDCB parameters * * The Service Layer will update the RETC in DDCB when processing is * pending or done. * * Return: > 0 remaining jiffies, DDCB completed * -ETIMEDOUT when timeout * -ERESTARTSYS when ^C * -EINVAL when unknown error condition * * When an error is returned the called needs to ensure that * purge_ddcb() is being called to get the &req removed from the * queue.
*/ int __genwqe_wait_ddcb(struct genwqe_dev *cd, struct ddcb_requ *req)
{ int rc; unsignedint ddcb_no; struct ddcb_queue *queue; struct pci_dev *pci_dev = cd->pci_dev;
if (req == NULL) return -EINVAL;
queue = req->queue; if (queue == NULL) return -EINVAL;
ddcb_no = req->num; if (ddcb_no >= queue->ddcb_max) return -EINVAL;
/* * We need to distinguish 3 cases here: * 1. rc == 0 timeout occurred * 2. rc == -ERESTARTSYS signal received * 3. rc > 0 remaining jiffies condition is true
*/ if (rc == 0) { struct ddcb_queue *queue = req->queue; struct ddcb *pddcb;
/* * Timeout may be caused by long task switching time. * When timeout happens, check if the request has * meanwhile completed.
*/
genwqe_check_ddcb_queue(cd, req->queue); if (ddcb_requ_finished(cd, req)) return rc;
/* Severe error occured. Driver is forced to stop operation */ if (cd->card_state != GENWQE_CARD_USED) {
dev_err(&pci_dev->dev, "[%s] err: DDCB#%d forced to stop (rc=%d)\n",
__func__, req->num, rc); return -EIO;
} return rc;
}
/** * get_next_ddcb() - Get next available DDCB * @cd: pointer to genwqe device descriptor * @queue: DDCB queue * @num: internal DDCB number * * DDCB's content is completely cleared but presets for PRE and * SEQNUM. This function must only be called when ddcb_lock is held. * * Return: NULL if no empty DDCB available otherwise ptr to next DDCB.
*/ staticstruct ddcb *get_next_ddcb(struct genwqe_dev *cd, struct ddcb_queue *queue, int *num)
{
u64 *pu64; struct ddcb *pddcb;
if (queue_free_ddcbs(queue) == 0) /* queue is full */ return NULL;
/* find new ddcb */
pddcb = &queue->ddcb_vaddr[queue->ddcb_next];
/* if it is not completed, we are not allowed to use it */ /* barrier(); */ if ((pddcb->icrc_hsi_shi_32 & DDCB_COMPLETED_BE32) == 0x00000000) return NULL;
/** * __genwqe_purge_ddcb() - Remove a DDCB from the workqueue * @cd: genwqe device descriptor * @req: DDCB request * * This will fail when the request was already FETCHED. In this case * we need to wait until it is finished. Else the DDCB can be * reused. This function also ensures that the request data structure * is removed from ddcb_req[]. * * Do not forget to call this function when genwqe_wait_ddcb() fails, * such that the request gets really removed from ddcb_req[]. * * Return: 0 success
*/ int __genwqe_purge_ddcb(struct genwqe_dev *cd, struct ddcb_requ *req)
{ struct ddcb *pddcb = NULL; unsignedint t; unsignedlong flags; struct ddcb_queue *queue = req->queue; struct pci_dev *pci_dev = cd->pci_dev;
u64 queue_status;
__be32 icrc_hsi_shi = 0x0000;
__be32 old, new;
/* unsigned long flags; */ if (GENWQE_DDCB_SOFTWARE_TIMEOUT <= 0) {
dev_err(&pci_dev->dev, "[%s] err: software timeout is not set!\n", __func__); return -EFAULT;
}
pddcb = &queue->ddcb_vaddr[req->num];
for (t = 0; t < GENWQE_DDCB_SOFTWARE_TIMEOUT * 10; t++) {
spin_lock_irqsave(&queue->ddcb_lock, flags);
/* Check if req was meanwhile finished */ if (ddcb_requ_get_state(req) == GENWQE_REQU_FINISHED) goto go_home;
/* try to set PURGE bit if FETCHED/COMPLETED are not set */
old = pddcb->icrc_hsi_shi_32; /* read SHI/HSI in BE32 */ if ((old & DDCB_FETCHED_BE32) == 0x00000000) {
new = (old | DDCB_PURGE_BE32);
icrc_hsi_shi = cmpxchg(&pddcb->icrc_hsi_shi_32,
old, new); if (icrc_hsi_shi == old) goto finish_ddcb;
}
/* normal finish with HSI bit */
barrier();
icrc_hsi_shi = pddcb->icrc_hsi_shi_32; if (icrc_hsi_shi & DDCB_COMPLETED_BE32) goto finish_ddcb;
spin_unlock_irqrestore(&queue->ddcb_lock, flags);
/* * Here the check_ddcb() function will most likely * discover this DDCB to be finished some point in * time. It will mark the req finished and free it up * in the list.
*/
copy_ddcb_results(req, req->num); /* for the failing case */
msleep(100); /* sleep for 1/10 second and try again */ continue;
/* Move active DDCB further; Nothing to do here anymore. */
/* * We need to ensure that there is at least one free * DDCB in the queue. To do that, we must update * ddcb_act only if the COMPLETED bit is set for the * DDCB we are working on else we treat that DDCB even * if we PURGED it as occupied (hardware is supposed * to set the COMPLETED bit yet!).
*/
icrc_hsi_shi = pddcb->icrc_hsi_shi_32; if ((icrc_hsi_shi & DDCB_COMPLETED_BE32) &&
(queue->ddcb_act == req->num)) {
queue->ddcb_act = ((queue->ddcb_act + 1) %
queue->ddcb_max);
}
go_home:
spin_unlock_irqrestore(&queue->ddcb_lock, flags); return 0;
}
/* * If the card is dead and the queue is forced to stop, we * might see this in the queue status register.
*/
queue_status = __genwqe_readq(cd, queue->IO_QUEUE_STATUS);
dev_err(&pci_dev->dev, "[%s] err: DDCB#%d not purged and not completed after %d seconds QSTAT=%016llx!!\n",
__func__, req->num, GENWQE_DDCB_SOFTWARE_TIMEOUT,
queue_status);
print_ddcb_info(cd, req->queue);
return -EFAULT;
}
int genwqe_init_debug_data(struct genwqe_dev *cd, struct genwqe_debug_data *d)
{ int len; struct pci_dev *pci_dev = cd->pci_dev;
if (d == NULL) {
dev_err(&pci_dev->dev, "[%s] err: invalid memory for debug data!\n",
__func__); return -EFAULT;
}
/** * __genwqe_enqueue_ddcb() - Enqueue a DDCB * @cd: pointer to genwqe device descriptor * @req: pointer to DDCB execution request * @f_flags: file mode: blocking, non-blocking * * Return: 0 if enqueuing succeeded * -EIO if card is unusable/PCIe problems * -EBUSY if enqueuing failed
*/ int __genwqe_enqueue_ddcb(struct genwqe_dev *cd, struct ddcb_requ *req, unsignedint f_flags)
{ struct ddcb *pddcb; unsignedlong flags; struct ddcb_queue *queue; struct pci_dev *pci_dev = cd->pci_dev;
u16 icrc;
retry: if (cd->card_state != GENWQE_CARD_USED) {
printk_ratelimited(KERN_ERR "%s %s: [%s] Card is unusable/PCIe problem Req#%d\n",
GENWQE_DEVNAME, dev_name(&pci_dev->dev),
__func__, req->num); return -EIO;
}
queue = req->queue = &cd->queue;
/* FIXME circumvention to improve performance when no irq is * there.
*/ if (GENWQE_POLLING_ENABLED)
genwqe_check_ddcb_queue(cd, queue);
/* * It must be ensured to process all DDCBs in successive * order. Use a lock here in order to prevent nested DDCB * enqueuing.
*/
spin_lock_irqsave(&queue->ddcb_lock, flags);
pddcb = get_next_ddcb(cd, queue, &req->num); /* get ptr and num */ if (pddcb == NULL) { int rc;
spin_unlock_irqrestore(&queue->ddcb_lock, flags);
if (f_flags & O_NONBLOCK) {
queue->return_on_busy++; return -EBUSY;
}
queue->wait_on_busy++;
rc = wait_event_interruptible(queue->busy_waitq,
queue_free_ddcbs(queue) != 0);
dev_dbg(&pci_dev->dev, "[%s] waiting for free DDCB: rc=%d\n",
__func__, rc); if (rc == -ERESTARTSYS) return rc; /* interrupted by a signal */
goto retry;
}
if (queue->ddcb_req[req->num] != NULL) {
spin_unlock_irqrestore(&queue->ddcb_lock, flags);
dev_err(&pci_dev->dev, "[%s] picked DDCB %d with req=%p still in use!!\n",
__func__, req->num, req); return -EFAULT;
}
ddcb_requ_set_state(req, GENWQE_REQU_ENQUEUED);
queue->ddcb_req[req->num] = req;
/* * We know that we can get retc 0x104 with CRC error, do not * stop the queue in those cases for this command. XDIR = 1 * does not work for old SLU versions. * * Last bitstream with the old XDIR behavior had SLU_ID * 0x34199.
*/ if ((cd->slu_unitcfg & 0xFFFF0ull) > 0x34199ull)
pddcb->xdir = 0x1; else
pddcb->xdir = 0x0;
/* * If copying the whole DDCB_ASIV_LENGTH is impacting * performance we need to change it to * req->cmd.asiv_length. But simulation benefits from some * non-architectured bits behind the architectured content. * * How much data is copied depends on the availability of the * ATS field, which was introduced late. If the ATS field is * supported ASIV is 8 bytes shorter than it used to be. Since * the ATS field is copied too, the code should do exactly * what it did before, but I wanted to make copying of the ATS * field very explicit.
*/ if (genwqe_get_slu_id(cd) <= 0x2) {
memcpy(&pddcb->__asiv[0], /* destination */
&req->cmd.__asiv[0], /* source */
DDCB_ASIV_LENGTH); /* req->cmd.asiv_length */
} else {
pddcb->n.ats_64 = cpu_to_be64(req->cmd.ats);
memcpy(&pddcb->n.asiv[0], /* destination */
&req->cmd.asiv[0], /* source */
DDCB_ASIV_LENGTH_ATS); /* req->cmd.asiv_length */
}
pddcb->icrc_hsi_shi_32 = cpu_to_be32(0x00000000); /* for crc */
/* * Calculate CRC_16 for corresponding range PSP(7:4). Include * empty 4 bytes prior to the data.
*/
icrc = genwqe_crc16((const u8 *)pddcb,
ICRC_LENGTH(req->cmd.asiv_length), 0xffff);
pddcb->icrc_hsi_shi_32 = cpu_to_be32((u32)icrc << 16);
if (cmd->asiv_length > DDCB_ASIV_LENGTH) {
dev_err(&pci_dev->dev, "[%s] err: wrong asiv_length of %d\n",
__func__, cmd->asiv_length); return -EINVAL;
} if (cmd->asv_length > DDCB_ASV_LENGTH) {
dev_err(&pci_dev->dev, "[%s] err: wrong asv_length of %d\n",
__func__, cmd->asv_length); return -EINVAL;
}
rc = __genwqe_enqueue_ddcb(cd, req, f_flags); if (rc != 0) return rc;
rc = __genwqe_wait_ddcb(cd, req); if (rc < 0) /* error or signal interrupt */ goto err_exit;
if (ddcb_requ_collect_debug_data(req)) { if (copy_to_user((struct genwqe_debug_data __user *)
(unsignedlong)cmd->ddata_addr,
&req->debug_data, sizeof(struct genwqe_debug_data))) return -EFAULT;
}
/* * Higher values than 0x102 indicate completion with faults, * lower values than 0x102 indicate processing faults. Note * that DDCB might have been purged. E.g. Cntl+C.
*/ if (cmd->retc != DDCB_RETC_COMPLETE) { /* This might happen e.g. flash read, and needs to be
handled by the upper layer code. */
rc = -EBADMSG; /* not processed/error retc */
}
return rc;
err_exit:
__genwqe_purge_ddcb(cd, req);
if (ddcb_requ_collect_debug_data(req)) { if (copy_to_user((struct genwqe_debug_data __user *)
(unsignedlong)cmd->ddata_addr,
&req->debug_data, sizeof(struct genwqe_debug_data))) return -EFAULT;
} return rc;
}
/** * genwqe_next_ddcb_ready() - Figure out if the next DDCB is already finished * @cd: pointer to genwqe device descriptor * * We use this as condition for our wait-queue code.
*/ staticint genwqe_next_ddcb_ready(struct genwqe_dev *cd)
{ unsignedlong flags; struct ddcb *pddcb; struct ddcb_queue *queue = &cd->queue;
/** * genwqe_ddcbs_in_flight() - Check how many DDCBs are in flight * @cd: pointer to genwqe device descriptor * * Keep track on the number of DDCBs which ware currently in the * queue. This is needed for statistics as well as condition if we want * to wait or better do polling in case of no interrupts available.
*/ int genwqe_ddcbs_in_flight(struct genwqe_dev *cd)
{ unsignedlong flags; int ddcbs_in_flight = 0; struct ddcb_queue *queue = &cd->queue;
/* * In case of fatal FIR error the queue is stopped, such that * we can safely check it without risking anything.
*/
cd->irqs_processed++;
wake_up_interruptible(&cd->queue_waitq);
/* * Checking for errors before kicking the queue might be * safer, but slower for the good-case ... See above.
*/
gfir = __genwqe_readq(cd, IO_SLC_CFGREG_GFIR); if (((gfir & GFIR_ERR_TRIGGER) != 0x0) &&
!pci_channel_offline(pci_dev)) {
if (cd->use_platform_recovery) { /* * Since we use raw accessors, EEH errors won't be * detected by the platform until we do a non-raw * MMIO or config space read
*/
readq(cd->mmio + IO_SLC_CFGREG_GFIR);
/* Don't do anything if the PCI channel is frozen */ if (pci_channel_offline(pci_dev)) gotoexit;
}
wake_up_interruptible(&cd->health_waitq);
/* * By default GFIRs causes recovery actions. This * count is just for debug when recovery is masked.
*/
dev_err_ratelimited(&pci_dev->dev, "[%s] GFIR=%016llx\n",
__func__, gfir);
}
/** * genwqe_card_thread() - Work thread for the DDCB queue * @data: pointer to genwqe device descriptor * * The idea is to check if there are DDCBs in processing. If there are * some finished DDCBs, we process them and wakeup the * requestors. Otherwise we give other processes time using * cond_resched().
*/ staticint genwqe_card_thread(void *data)
{ int should_stop = 0; struct genwqe_dev *cd = (struct genwqe_dev *)data;
rc = genwqe_set_interrupt_capability(cd, GENWQE_MSI_IRQS); if (rc) goto stop_kthread;
/* * We must have all wait-queues initialized when we enable the * interrupts. Otherwise we might crash if we get an early * irq.
*/
init_waitqueue_head(&cd->health_waitq);
/** * queue_wake_up_all() - Handles fatal error case * @cd: pointer to genwqe device descriptor * * The PCI device got unusable and we have to stop all pending * requests as fast as we can. The code after this must purge the * DDCBs in question and ensure that all mappings are freed.
*/ staticint queue_wake_up_all(struct genwqe_dev *cd)
{ unsignedint i; unsignedlong flags; struct ddcb_queue *queue = &cd->queue;
spin_lock_irqsave(&queue->ddcb_lock, flags);
for (i = 0; i < queue->ddcb_max; i++)
wake_up_interruptible(&queue->ddcb_waitqs[queue->ddcb_act]);
/** * genwqe_finish_queue() - Remove any genwqe devices and user-interfaces * @cd: pointer to genwqe device descriptor * * Relies on the pre-condition that there are no users of the card * device anymore e.g. with open file-descriptors. * * This function must be robust enough to be called twice.
*/ int genwqe_finish_queue(struct genwqe_dev *cd)
{ int i, rc = 0, in_flight; int waitmax = GENWQE_DDCB_SOFTWARE_TIMEOUT; struct pci_dev *pci_dev = cd->pci_dev; struct ddcb_queue *queue = &cd->queue;
if (!ddcb_queue_initialized(queue)) return 0;
/* Do not wipe out the error state. */ if (cd->card_state == GENWQE_CARD_USED)
cd->card_state = GENWQE_CARD_UNUSED;
/* Wake up all requests in the DDCB queue such that they
should be removed nicely. */
queue_wake_up_all(cd);
/* We must wait to get rid of the DDCBs in flight */ for (i = 0; i < waitmax; i++) {
in_flight = genwqe_ddcbs_in_flight(cd);
if (in_flight == 0) break;
dev_dbg(&pci_dev->dev, " DEBUG [%d/%d] waiting for queue to get empty: %d requests!\n",
i, waitmax, in_flight);
/* * Severe severe error situation: The card itself has * 16 DDCB queues, each queue has e.g. 32 entries, * each DDBC has a hardware timeout of currently 250 * msec but the PFs have a hardware timeout of 8 sec * ... so I take something large.
*/
msleep(1000);
} if (i == waitmax) {
dev_err(&pci_dev->dev, " [%s] err: queue is not empty!!\n",
__func__);
rc = -EIO;
} return rc;
}
/** * genwqe_release_service_layer() - Shutdown DDCB queue * @cd: genwqe device descriptor * * This function must be robust enough to be called twice.
*/ int genwqe_release_service_layer(struct genwqe_dev *cd)
{ struct pci_dev *pci_dev = cd->pci_dev;
if (!ddcb_queue_initialized(&cd->queue)) return 1;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.