2 * Copyright IBM Corp. 2016
3 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
5 * Adjunct processor bus, queue related code.
8 #define KMSG_COMPONENT "ap"
9 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
11 #include <linux/init.h>
12 #include <linux/slab.h>
13 #include <asm/facility.h>
19 * ap_queue_enable_interruption(): Enable interruption on an AP queue.
20 * @qid: The AP queue number
21 * @ind: the notification indicator byte
23 * Enables interruption on AP queue via ap_aqic(). Based on the return
24 * value it waits a while and tests the AP queue if interrupts
25 * have been switched on using ap_test_queue().
27 static int ap_queue_enable_interruption(struct ap_queue
*aq
, void *ind
)
29 struct ap_queue_status status
;
31 status
= ap_aqic(aq
->qid
, ind
);
32 switch (status
.response_code
) {
33 case AP_RESPONSE_NORMAL
:
34 case AP_RESPONSE_OTHERWISE_CHANGED
:
36 case AP_RESPONSE_Q_NOT_AVAIL
:
37 case AP_RESPONSE_DECONFIGURED
:
38 case AP_RESPONSE_CHECKSTOPPED
:
39 case AP_RESPONSE_INVALID_ADDRESS
:
40 pr_err("Registering adapter interrupts for AP device %02x.%04x failed\n",
42 AP_QID_QUEUE(aq
->qid
));
44 case AP_RESPONSE_RESET_IN_PROGRESS
:
45 case AP_RESPONSE_BUSY
:
52 * __ap_send(): Send message to adjunct processor queue.
53 * @qid: The AP queue number
54 * @psmid: The program supplied message identifier
55 * @msg: The message text
56 * @length: The message length
57 * @special: Special Bit
59 * Returns AP queue status structure.
60 * Condition code 1 on NQAP can't happen because the L bit is 1.
61 * Condition code 2 on NQAP also means the send is incomplete,
62 * because a segment boundary was reached. The NQAP is repeated.
64 static inline struct ap_queue_status
65 __ap_send(ap_qid_t qid
, unsigned long long psmid
, void *msg
, size_t length
,
70 return ap_nqap(qid
, psmid
, msg
, length
);
73 int ap_send(ap_qid_t qid
, unsigned long long psmid
, void *msg
, size_t length
)
75 struct ap_queue_status status
;
77 status
= __ap_send(qid
, psmid
, msg
, length
, 0);
78 switch (status
.response_code
) {
79 case AP_RESPONSE_NORMAL
:
81 case AP_RESPONSE_Q_FULL
:
82 case AP_RESPONSE_RESET_IN_PROGRESS
:
84 case AP_RESPONSE_REQ_FAC_NOT_INST
:
86 default: /* Device is gone. */
90 EXPORT_SYMBOL(ap_send
);
92 int ap_recv(ap_qid_t qid
, unsigned long long *psmid
, void *msg
, size_t length
)
94 struct ap_queue_status status
;
98 status
= ap_dqap(qid
, psmid
, msg
, length
);
99 switch (status
.response_code
) {
100 case AP_RESPONSE_NORMAL
:
102 case AP_RESPONSE_NO_PENDING_REPLY
:
103 if (status
.queue_empty
)
106 case AP_RESPONSE_RESET_IN_PROGRESS
:
112 EXPORT_SYMBOL(ap_recv
);
114 /* State machine definitions and helpers */
116 static enum ap_wait
ap_sm_nop(struct ap_queue
*aq
)
122 * ap_sm_recv(): Receive pending reply messages from an AP queue but do
123 * not change the state of the device.
124 * @aq: pointer to the AP queue
126 * Returns AP_WAIT_NONE, AP_WAIT_AGAIN, or AP_WAIT_INTERRUPT
128 static struct ap_queue_status
ap_sm_recv(struct ap_queue
*aq
)
130 struct ap_queue_status status
;
131 struct ap_message
*ap_msg
;
133 status
= ap_dqap(aq
->qid
, &aq
->reply
->psmid
,
134 aq
->reply
->message
, aq
->reply
->length
);
135 switch (status
.response_code
) {
136 case AP_RESPONSE_NORMAL
:
138 if (aq
->queue_count
> 0)
139 mod_timer(&aq
->timeout
,
140 jiffies
+ aq
->request_timeout
);
141 list_for_each_entry(ap_msg
, &aq
->pendingq
, list
) {
142 if (ap_msg
->psmid
!= aq
->reply
->psmid
)
144 list_del_init(&ap_msg
->list
);
145 aq
->pendingq_count
--;
146 ap_msg
->receive(aq
, ap_msg
, aq
->reply
);
149 case AP_RESPONSE_NO_PENDING_REPLY
:
150 if (!status
.queue_empty
|| aq
->queue_count
<= 0)
152 /* The card shouldn't forget requests but who knows. */
154 list_splice_init(&aq
->pendingq
, &aq
->requestq
);
155 aq
->requestq_count
+= aq
->pendingq_count
;
156 aq
->pendingq_count
= 0;
165 * ap_sm_read(): Receive pending reply messages from an AP queue.
166 * @aq: pointer to the AP queue
168 * Returns AP_WAIT_NONE, AP_WAIT_AGAIN, or AP_WAIT_INTERRUPT
170 static enum ap_wait
ap_sm_read(struct ap_queue
*aq
)
172 struct ap_queue_status status
;
176 status
= ap_sm_recv(aq
);
177 switch (status
.response_code
) {
178 case AP_RESPONSE_NORMAL
:
179 if (aq
->queue_count
> 0) {
180 aq
->state
= AP_STATE_WORKING
;
181 return AP_WAIT_AGAIN
;
183 aq
->state
= AP_STATE_IDLE
;
185 case AP_RESPONSE_NO_PENDING_REPLY
:
186 if (aq
->queue_count
> 0)
187 return AP_WAIT_INTERRUPT
;
188 aq
->state
= AP_STATE_IDLE
;
191 aq
->state
= AP_STATE_BORKED
;
197 * ap_sm_suspend_read(): Receive pending reply messages from an AP queue
198 * without changing the device state in between. In suspend mode we don't
199 * allow sending new requests, therefore just fetch pending replies.
200 * @aq: pointer to the AP queue
202 * Returns AP_WAIT_NONE or AP_WAIT_AGAIN
204 static enum ap_wait
ap_sm_suspend_read(struct ap_queue
*aq
)
206 struct ap_queue_status status
;
210 status
= ap_sm_recv(aq
);
211 switch (status
.response_code
) {
212 case AP_RESPONSE_NORMAL
:
213 if (aq
->queue_count
> 0)
214 return AP_WAIT_AGAIN
;
222 * ap_sm_write(): Send messages from the request queue to an AP queue.
223 * @aq: pointer to the AP queue
225 * Returns AP_WAIT_NONE, AP_WAIT_AGAIN, or AP_WAIT_INTERRUPT
227 static enum ap_wait
ap_sm_write(struct ap_queue
*aq
)
229 struct ap_queue_status status
;
230 struct ap_message
*ap_msg
;
232 if (aq
->requestq_count
<= 0)
234 /* Start the next request on the queue. */
235 ap_msg
= list_entry(aq
->requestq
.next
, struct ap_message
, list
);
236 status
= __ap_send(aq
->qid
, ap_msg
->psmid
,
237 ap_msg
->message
, ap_msg
->length
, ap_msg
->special
);
238 switch (status
.response_code
) {
239 case AP_RESPONSE_NORMAL
:
241 if (aq
->queue_count
== 1)
242 mod_timer(&aq
->timeout
, jiffies
+ aq
->request_timeout
);
243 list_move_tail(&ap_msg
->list
, &aq
->pendingq
);
244 aq
->requestq_count
--;
245 aq
->pendingq_count
++;
246 if (aq
->queue_count
< aq
->card
->queue_depth
) {
247 aq
->state
= AP_STATE_WORKING
;
248 return AP_WAIT_AGAIN
;
251 case AP_RESPONSE_Q_FULL
:
252 aq
->state
= AP_STATE_QUEUE_FULL
;
253 return AP_WAIT_INTERRUPT
;
254 case AP_RESPONSE_RESET_IN_PROGRESS
:
255 aq
->state
= AP_STATE_RESET_WAIT
;
256 return AP_WAIT_TIMEOUT
;
257 case AP_RESPONSE_MESSAGE_TOO_BIG
:
258 case AP_RESPONSE_REQ_FAC_NOT_INST
:
259 list_del_init(&ap_msg
->list
);
260 aq
->requestq_count
--;
261 ap_msg
->rc
= -EINVAL
;
262 ap_msg
->receive(aq
, ap_msg
, NULL
);
263 return AP_WAIT_AGAIN
;
265 aq
->state
= AP_STATE_BORKED
;
271 * ap_sm_read_write(): Send and receive messages to/from an AP queue.
272 * @aq: pointer to the AP queue
274 * Returns AP_WAIT_NONE, AP_WAIT_AGAIN, or AP_WAIT_INTERRUPT
276 static enum ap_wait
ap_sm_read_write(struct ap_queue
*aq
)
278 return min(ap_sm_read(aq
), ap_sm_write(aq
));
282 * ap_sm_reset(): Reset an AP queue.
283 * @qid: The AP queue number
285 * Submit the Reset command to an AP queue.
287 static enum ap_wait
ap_sm_reset(struct ap_queue
*aq
)
289 struct ap_queue_status status
;
291 status
= ap_rapq(aq
->qid
);
292 switch (status
.response_code
) {
293 case AP_RESPONSE_NORMAL
:
294 case AP_RESPONSE_RESET_IN_PROGRESS
:
295 aq
->state
= AP_STATE_RESET_WAIT
;
296 aq
->interrupt
= AP_INTR_DISABLED
;
297 return AP_WAIT_TIMEOUT
;
298 case AP_RESPONSE_BUSY
:
299 return AP_WAIT_TIMEOUT
;
300 case AP_RESPONSE_Q_NOT_AVAIL
:
301 case AP_RESPONSE_DECONFIGURED
:
302 case AP_RESPONSE_CHECKSTOPPED
:
304 aq
->state
= AP_STATE_BORKED
;
310 * ap_sm_reset_wait(): Test queue for completion of the reset operation
311 * @aq: pointer to the AP queue
313 * Returns AP_POLL_IMMEDIATELY, AP_POLL_AFTER_TIMEROUT or 0.
315 static enum ap_wait
ap_sm_reset_wait(struct ap_queue
*aq
)
317 struct ap_queue_status status
;
320 if (aq
->queue_count
> 0 && aq
->reply
)
321 /* Try to read a completed message and get the status */
322 status
= ap_sm_recv(aq
);
324 /* Get the status with TAPQ */
325 status
= ap_tapq(aq
->qid
, NULL
);
327 switch (status
.response_code
) {
328 case AP_RESPONSE_NORMAL
:
329 lsi_ptr
= ap_airq_ptr();
330 if (lsi_ptr
&& ap_queue_enable_interruption(aq
, lsi_ptr
) == 0)
331 aq
->state
= AP_STATE_SETIRQ_WAIT
;
333 aq
->state
= (aq
->queue_count
> 0) ?
334 AP_STATE_WORKING
: AP_STATE_IDLE
;
335 return AP_WAIT_AGAIN
;
336 case AP_RESPONSE_BUSY
:
337 case AP_RESPONSE_RESET_IN_PROGRESS
:
338 return AP_WAIT_TIMEOUT
;
339 case AP_RESPONSE_Q_NOT_AVAIL
:
340 case AP_RESPONSE_DECONFIGURED
:
341 case AP_RESPONSE_CHECKSTOPPED
:
343 aq
->state
= AP_STATE_BORKED
;
349 * ap_sm_setirq_wait(): Test queue for completion of the irq enablement
350 * @aq: pointer to the AP queue
352 * Returns AP_POLL_IMMEDIATELY, AP_POLL_AFTER_TIMEROUT or 0.
354 static enum ap_wait
ap_sm_setirq_wait(struct ap_queue
*aq
)
356 struct ap_queue_status status
;
358 if (aq
->queue_count
> 0 && aq
->reply
)
359 /* Try to read a completed message and get the status */
360 status
= ap_sm_recv(aq
);
362 /* Get the status with TAPQ */
363 status
= ap_tapq(aq
->qid
, NULL
);
365 if (status
.int_enabled
== 1) {
366 /* Irqs are now enabled */
367 aq
->interrupt
= AP_INTR_ENABLED
;
368 aq
->state
= (aq
->queue_count
> 0) ?
369 AP_STATE_WORKING
: AP_STATE_IDLE
;
372 switch (status
.response_code
) {
373 case AP_RESPONSE_NORMAL
:
374 if (aq
->queue_count
> 0)
375 return AP_WAIT_AGAIN
;
377 case AP_RESPONSE_NO_PENDING_REPLY
:
378 return AP_WAIT_TIMEOUT
;
380 aq
->state
= AP_STATE_BORKED
;
386 * AP state machine jump table
388 static ap_func_t
*ap_jumptable
[NR_AP_STATES
][NR_AP_EVENTS
] = {
389 [AP_STATE_RESET_START
] = {
390 [AP_EVENT_POLL
] = ap_sm_reset
,
391 [AP_EVENT_TIMEOUT
] = ap_sm_nop
,
393 [AP_STATE_RESET_WAIT
] = {
394 [AP_EVENT_POLL
] = ap_sm_reset_wait
,
395 [AP_EVENT_TIMEOUT
] = ap_sm_nop
,
397 [AP_STATE_SETIRQ_WAIT
] = {
398 [AP_EVENT_POLL
] = ap_sm_setirq_wait
,
399 [AP_EVENT_TIMEOUT
] = ap_sm_nop
,
402 [AP_EVENT_POLL
] = ap_sm_write
,
403 [AP_EVENT_TIMEOUT
] = ap_sm_nop
,
405 [AP_STATE_WORKING
] = {
406 [AP_EVENT_POLL
] = ap_sm_read_write
,
407 [AP_EVENT_TIMEOUT
] = ap_sm_reset
,
409 [AP_STATE_QUEUE_FULL
] = {
410 [AP_EVENT_POLL
] = ap_sm_read
,
411 [AP_EVENT_TIMEOUT
] = ap_sm_reset
,
413 [AP_STATE_SUSPEND_WAIT
] = {
414 [AP_EVENT_POLL
] = ap_sm_suspend_read
,
415 [AP_EVENT_TIMEOUT
] = ap_sm_nop
,
417 [AP_STATE_BORKED
] = {
418 [AP_EVENT_POLL
] = ap_sm_nop
,
419 [AP_EVENT_TIMEOUT
] = ap_sm_nop
,
423 enum ap_wait
ap_sm_event(struct ap_queue
*aq
, enum ap_event event
)
425 return ap_jumptable
[aq
->state
][event
](aq
);
428 enum ap_wait
ap_sm_event_loop(struct ap_queue
*aq
, enum ap_event event
)
432 while ((wait
= ap_sm_event(aq
, event
)) == AP_WAIT_AGAIN
)
438 * Power management for queue devices
440 void ap_queue_suspend(struct ap_device
*ap_dev
)
442 struct ap_queue
*aq
= to_ap_queue(&ap_dev
->device
);
444 /* Poll on the device until all requests are finished. */
445 spin_lock_bh(&aq
->lock
);
446 aq
->state
= AP_STATE_SUSPEND_WAIT
;
447 while (ap_sm_event(aq
, AP_EVENT_POLL
) != AP_WAIT_NONE
)
449 aq
->state
= AP_STATE_BORKED
;
450 spin_unlock_bh(&aq
->lock
);
452 EXPORT_SYMBOL(ap_queue_suspend
);
454 void ap_queue_resume(struct ap_device
*ap_dev
)
457 EXPORT_SYMBOL(ap_queue_resume
);
460 * AP queue related attributes.
462 static ssize_t
ap_req_count_show(struct device
*dev
,
463 struct device_attribute
*attr
,
466 struct ap_queue
*aq
= to_ap_queue(dev
);
467 unsigned int req_cnt
;
469 spin_lock_bh(&aq
->lock
);
470 req_cnt
= aq
->total_request_count
;
471 spin_unlock_bh(&aq
->lock
);
472 return snprintf(buf
, PAGE_SIZE
, "%d\n", req_cnt
);
475 static ssize_t
ap_req_count_store(struct device
*dev
,
476 struct device_attribute
*attr
,
477 const char *buf
, size_t count
)
479 struct ap_queue
*aq
= to_ap_queue(dev
);
481 spin_lock_bh(&aq
->lock
);
482 aq
->total_request_count
= 0;
483 spin_unlock_bh(&aq
->lock
);
488 static DEVICE_ATTR(request_count
, 0644, ap_req_count_show
, ap_req_count_store
);
490 static ssize_t
ap_requestq_count_show(struct device
*dev
,
491 struct device_attribute
*attr
, char *buf
)
493 struct ap_queue
*aq
= to_ap_queue(dev
);
494 unsigned int reqq_cnt
= 0;
496 spin_lock_bh(&aq
->lock
);
497 reqq_cnt
= aq
->requestq_count
;
498 spin_unlock_bh(&aq
->lock
);
499 return snprintf(buf
, PAGE_SIZE
, "%d\n", reqq_cnt
);
502 static DEVICE_ATTR(requestq_count
, 0444, ap_requestq_count_show
, NULL
);
504 static ssize_t
ap_pendingq_count_show(struct device
*dev
,
505 struct device_attribute
*attr
, char *buf
)
507 struct ap_queue
*aq
= to_ap_queue(dev
);
508 unsigned int penq_cnt
= 0;
510 spin_lock_bh(&aq
->lock
);
511 penq_cnt
= aq
->pendingq_count
;
512 spin_unlock_bh(&aq
->lock
);
513 return snprintf(buf
, PAGE_SIZE
, "%d\n", penq_cnt
);
516 static DEVICE_ATTR(pendingq_count
, 0444, ap_pendingq_count_show
, NULL
);
518 static ssize_t
ap_reset_show(struct device
*dev
,
519 struct device_attribute
*attr
, char *buf
)
521 struct ap_queue
*aq
= to_ap_queue(dev
);
524 spin_lock_bh(&aq
->lock
);
526 case AP_STATE_RESET_START
:
527 case AP_STATE_RESET_WAIT
:
528 rc
= snprintf(buf
, PAGE_SIZE
, "Reset in progress.\n");
530 case AP_STATE_WORKING
:
531 case AP_STATE_QUEUE_FULL
:
532 rc
= snprintf(buf
, PAGE_SIZE
, "Reset Timer armed.\n");
535 rc
= snprintf(buf
, PAGE_SIZE
, "No Reset Timer set.\n");
537 spin_unlock_bh(&aq
->lock
);
541 static DEVICE_ATTR(reset
, 0444, ap_reset_show
, NULL
);
543 static ssize_t
ap_interrupt_show(struct device
*dev
,
544 struct device_attribute
*attr
, char *buf
)
546 struct ap_queue
*aq
= to_ap_queue(dev
);
549 spin_lock_bh(&aq
->lock
);
550 if (aq
->state
== AP_STATE_SETIRQ_WAIT
)
551 rc
= snprintf(buf
, PAGE_SIZE
, "Enable Interrupt pending.\n");
552 else if (aq
->interrupt
== AP_INTR_ENABLED
)
553 rc
= snprintf(buf
, PAGE_SIZE
, "Interrupts enabled.\n");
555 rc
= snprintf(buf
, PAGE_SIZE
, "Interrupts disabled.\n");
556 spin_unlock_bh(&aq
->lock
);
560 static DEVICE_ATTR(interrupt
, 0444, ap_interrupt_show
, NULL
);
562 static struct attribute
*ap_queue_dev_attrs
[] = {
563 &dev_attr_request_count
.attr
,
564 &dev_attr_requestq_count
.attr
,
565 &dev_attr_pendingq_count
.attr
,
566 &dev_attr_reset
.attr
,
567 &dev_attr_interrupt
.attr
,
571 static struct attribute_group ap_queue_dev_attr_group
= {
572 .attrs
= ap_queue_dev_attrs
575 static const struct attribute_group
*ap_queue_dev_attr_groups
[] = {
576 &ap_queue_dev_attr_group
,
580 static struct device_type ap_queue_type
= {
582 .groups
= ap_queue_dev_attr_groups
,
585 static void ap_queue_device_release(struct device
*dev
)
587 kfree(to_ap_queue(dev
));
590 struct ap_queue
*ap_queue_create(ap_qid_t qid
, int device_type
)
594 aq
= kzalloc(sizeof(*aq
), GFP_KERNEL
);
597 aq
->ap_dev
.device
.release
= ap_queue_device_release
;
598 aq
->ap_dev
.device
.type
= &ap_queue_type
;
599 aq
->ap_dev
.device_type
= device_type
;
600 /* CEX6 toleration: map to CEX5 */
601 if (device_type
== AP_DEVICE_TYPE_CEX6
)
602 aq
->ap_dev
.device_type
= AP_DEVICE_TYPE_CEX5
;
604 aq
->state
= AP_STATE_RESET_START
;
605 aq
->interrupt
= AP_INTR_DISABLED
;
606 spin_lock_init(&aq
->lock
);
607 INIT_LIST_HEAD(&aq
->pendingq
);
608 INIT_LIST_HEAD(&aq
->requestq
);
609 setup_timer(&aq
->timeout
, ap_request_timeout
, (unsigned long) aq
);
614 void ap_queue_init_reply(struct ap_queue
*aq
, struct ap_message
*reply
)
618 spin_lock_bh(&aq
->lock
);
619 ap_wait(ap_sm_event(aq
, AP_EVENT_POLL
));
620 spin_unlock_bh(&aq
->lock
);
622 EXPORT_SYMBOL(ap_queue_init_reply
);
625 * ap_queue_message(): Queue a request to an AP device.
626 * @aq: The AP device to queue the message to
627 * @ap_msg: The message that is to be added
629 void ap_queue_message(struct ap_queue
*aq
, struct ap_message
*ap_msg
)
631 /* For asynchronous message handling a valid receive-callback
634 BUG_ON(!ap_msg
->receive
);
636 spin_lock_bh(&aq
->lock
);
637 /* Queue the message. */
638 list_add_tail(&ap_msg
->list
, &aq
->requestq
);
639 aq
->requestq_count
++;
640 aq
->total_request_count
++;
641 atomic_inc(&aq
->card
->total_request_count
);
642 /* Send/receive as many request from the queue as possible. */
643 ap_wait(ap_sm_event_loop(aq
, AP_EVENT_POLL
));
644 spin_unlock_bh(&aq
->lock
);
646 EXPORT_SYMBOL(ap_queue_message
);
649 * ap_cancel_message(): Cancel a crypto request.
650 * @aq: The AP device that has the message queued
651 * @ap_msg: The message that is to be removed
653 * Cancel a crypto request. This is done by removing the request
654 * from the device pending or request queue. Note that the
655 * request stays on the AP queue. When it finishes the message
656 * reply will be discarded because the psmid can't be found.
658 void ap_cancel_message(struct ap_queue
*aq
, struct ap_message
*ap_msg
)
660 struct ap_message
*tmp
;
662 spin_lock_bh(&aq
->lock
);
663 if (!list_empty(&ap_msg
->list
)) {
664 list_for_each_entry(tmp
, &aq
->pendingq
, list
)
665 if (tmp
->psmid
== ap_msg
->psmid
) {
666 aq
->pendingq_count
--;
669 aq
->requestq_count
--;
671 list_del_init(&ap_msg
->list
);
673 spin_unlock_bh(&aq
->lock
);
675 EXPORT_SYMBOL(ap_cancel_message
);
678 * __ap_flush_queue(): Flush requests.
679 * @aq: Pointer to the AP queue
681 * Flush all requests from the request/pending queue of an AP device.
683 static void __ap_flush_queue(struct ap_queue
*aq
)
685 struct ap_message
*ap_msg
, *next
;
687 list_for_each_entry_safe(ap_msg
, next
, &aq
->pendingq
, list
) {
688 list_del_init(&ap_msg
->list
);
689 aq
->pendingq_count
--;
690 ap_msg
->rc
= -EAGAIN
;
691 ap_msg
->receive(aq
, ap_msg
, NULL
);
693 list_for_each_entry_safe(ap_msg
, next
, &aq
->requestq
, list
) {
694 list_del_init(&ap_msg
->list
);
695 aq
->requestq_count
--;
696 ap_msg
->rc
= -EAGAIN
;
697 ap_msg
->receive(aq
, ap_msg
, NULL
);
701 void ap_flush_queue(struct ap_queue
*aq
)
703 spin_lock_bh(&aq
->lock
);
704 __ap_flush_queue(aq
);
705 spin_unlock_bh(&aq
->lock
);
707 EXPORT_SYMBOL(ap_flush_queue
);
709 void ap_queue_remove(struct ap_queue
*aq
)
712 del_timer_sync(&aq
->timeout
);
714 EXPORT_SYMBOL(ap_queue_remove
);