MCPcopy Create free account
hub / github.com/F-Stack/f-stack / memif_disconnect

Function memif_disconnect

dpdk/drivers/net/memif/memif_socket.c:525–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525void
526memif_disconnect(struct rte_eth_dev *dev)
527{
528 struct pmd_internals *pmd = dev->data->dev_private;
529 struct memif_msg_queue_elt *elt, *next;
530 struct memif_queue *mq;
531 struct rte_intr_handle *ih;
532 int i;
533 int ret;
534
535 dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN;
536 pmd->flags &= ~ETH_MEMIF_FLAG_CONNECTING;
537 pmd->flags &= ~ETH_MEMIF_FLAG_CONNECTED;
538
539 rte_spinlock_lock(&pmd->cc_lock);
540 if (pmd->cc != NULL) {
541 /* Clear control message queue (except disconnect message if any). */
542 for (elt = TAILQ_FIRST(&pmd->cc->msg_queue); elt != NULL; elt = next) {
543 next = TAILQ_NEXT(elt, next);
544 if (elt->msg.type != MEMIF_MSG_TYPE_DISCONNECT) {
545 TAILQ_REMOVE(&pmd->cc->msg_queue, elt, next);
546 rte_free(elt);
547 }
548 }
549 /* send disconnect message (if there is any in queue) */
550 memif_msg_send_from_queue(pmd->cc);
551
552 /* at this point, there should be no more messages in queue */
553 if (TAILQ_FIRST(&pmd->cc->msg_queue) != NULL) {
554 MIF_LOG(WARNING,
555 "Unexpected message(s) in message queue.");
556 }
557
558 ih = pmd->cc->intr_handle;
559 if (rte_intr_fd_get(ih) > 0) {
560 ret = rte_intr_callback_unregister(ih,
561 memif_intr_handler,
562 pmd->cc);
563 /*
564 * If callback is active (disconnecting based on
565 * received control message).
566 */
567 if (ret == -EAGAIN) {
568 ret = rte_intr_callback_unregister_pending(ih,
569 memif_intr_handler,
570 pmd->cc,
571 memif_intr_unregister_handler);
572 } else if (ret > 0) {
573 close(rte_intr_fd_get(ih));
574 rte_intr_instance_free(ih);
575 rte_free(pmd->cc);
576 }
577 pmd->cc = NULL;
578 if (ret <= 0)
579 MIF_LOG(WARNING,
580 "Failed to unregister control channel callback.");
581 }
582 }

Callers 3

memif_dev_stopFunction · 0.85
memif_intr_handlerFunction · 0.85

Calls 12

rte_freeFunction · 0.85
rte_intr_fd_getFunction · 0.85
rte_intr_instance_freeFunction · 0.85
rte_intr_fd_setFunction · 0.85
memif_free_regionsFunction · 0.85
memsetFunction · 0.85
rte_spinlock_lockFunction · 0.50
closeFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected