Esempio n. 1
0
void qman_test_high(void)
{
	int flags, res;
	struct qman_fq *fq = &fq_base;

	pr_info("qman_test_high starting\n");
	fd_init(&fd);
	fd_init(&fd_dq);

	/* Initialise (parked) FQ */
	if (qman_create_fq(0, FQ_FLAGS, fq))
		panic("qman_create_fq() failed\n");
	if (qman_init_fq(fq, QMAN_INITFQ_FLAG_LOCAL, NULL))
		panic("qman_init_fq() failed\n");

	/* Do enqueues + VDQCR, twice. (Parked FQ) */
	do_enqueues(fq);
	pr_info("VDQCR (till-empty);\n");
	if (qman_volatile_dequeue(fq, VDQCR_FLAGS,
			QM_VDQCR_NUMFRAMES_TILLEMPTY))
		panic("qman_volatile_dequeue() failed\n");
	do_enqueues(fq);
	pr_info("VDQCR (%d of %d);\n", NUM_PARTIAL, NUM_ENQUEUES);
	if (qman_volatile_dequeue(fq, VDQCR_FLAGS,
			QM_VDQCR_NUMFRAMES_SET(NUM_PARTIAL)))
		panic("qman_volatile_dequeue() failed\n");
	pr_info("VDQCR (%d of %d);\n", NUM_ENQUEUES - NUM_PARTIAL,
					NUM_ENQUEUES);
	if (qman_volatile_dequeue(fq, VDQCR_FLAGS,
			QM_VDQCR_NUMFRAMES_SET(NUM_ENQUEUES - NUM_PARTIAL)))
		panic("qman_volatile_dequeue() failed\n");

	do_enqueues(fq);
	pr_info("scheduled dequeue (till-empty)\n");
	if (qman_schedule_fq(fq))
		panic("qman_schedule_fq() failed\n");
	wait_event(waitqueue, sdqcr_complete);

	/* Retire and OOS the FQ */
	res = qman_retire_fq(fq, &flags);
	if (res < 0)
		panic("qman_retire_fq() failed\n");
	wait_event(waitqueue, retire_complete);
	if (flags & QMAN_FQ_STATE_BLOCKOOS)
		panic("leaking frames\n");
	if (qman_oos_fq(fq))
		panic("qman_oos_fq() failed\n");
	qman_destroy_fq(fq, 0);
	pr_info("qman_test_high finished\n");
}
Esempio n. 2
0
static int kill_fq(struct device *qidev, struct qman_fq *fq)
{
	enum qman_fq_state state;
	u32 flags;
	int ret;

	ret = qman_retire_fq(fq, &flags);
	if (ret < 0) {
		dev_err(qidev, "qman_retire_fq failed\n");
		return ret;
	}

	if (!ret)
		goto empty_fq;

	/* Async FQ retirement condition */
	if (1 == ret) {
		/* Retry till FQ gets in retired state */
		do {
			msleep(20);
			qman_fq_state(fq, &state, &flags);
		} while (qman_fq_state_retired != state);

		WARN_ON(flags & QMAN_FQ_STATE_BLOCKOOS);
		WARN_ON(flags & QMAN_FQ_STATE_ORL);
	}

empty_fq:
	if (flags & QMAN_FQ_STATE_NE) {
		ret = empty_retired_fq(qidev, fq);
		if (ret) {
			dev_err(qidev, "empty_retired_fq fail for FQ: %u\n",
				fq->fqid);
			return ret;
		}
	}

	ret = qman_oos_fq(fq);
	if (ret)
		dev_err(qidev, "OOS of FQID: %u failed\n", fq->fqid);

	qman_destroy_fq(fq, 0);

	return ret;
}
Esempio n. 3
0
/* Destroys Frame Queues */
static void oh_fq_destroy(struct qman_fq *fq)
{
	int _errno = 0;

	_errno = qman_retire_fq(fq, NULL);
	if (unlikely(_errno < 0))
		pr_err(KBUILD_MODNAME": %s:%hu:%s(): qman_retire_fq(%u)=%d\n",
			KBUILD_BASENAME".c", __LINE__, __func__,
			qman_fq_fqid(fq), _errno);

	_errno = qman_oos_fq(fq);
	if (unlikely(_errno < 0)) {
		pr_err(KBUILD_MODNAME": %s:%hu:%s(): qman_oos_fq(%u)=%d\n",
			KBUILD_BASENAME".c", __LINE__, __func__,
			qman_fq_fqid(fq), _errno);
	}

	qman_destroy_fq(fq, 0);
}
Esempio n. 4
0
int qman_test_api(void)
{
    unsigned int flags, frmcnt;
    int err;
    struct qman_fq *fq = &fq_base;

    pr_info("%s(): Starting\n", __func__);
    fd_init(&fd);
    fd_init(&fd_dq);

    /* Initialise (parked) FQ */
    err = qman_create_fq(0, FQ_FLAGS, fq);
    if (err) {
        pr_crit("qman_create_fq() failed\n");
        goto failed;
    }
    err = qman_init_fq(fq, QMAN_INITFQ_FLAG_LOCAL, NULL);
    if (err) {
        pr_crit("qman_init_fq() failed\n");
        goto failed;
    }
    /* Do enqueues + VDQCR, twice. (Parked FQ) */
    err = do_enqueues(fq);
    if (err)
        goto failed;
    pr_info("VDQCR (till-empty);\n");
    frmcnt = QM_VDQCR_NUMFRAMES_TILLEMPTY;
    err = qman_volatile_dequeue(fq, VDQCR_FLAGS, frmcnt);
    if (err) {
        pr_crit("qman_volatile_dequeue() failed\n");
        goto failed;
    }
    err = do_enqueues(fq);
    if (err)
        goto failed;
    pr_info("VDQCR (%d of %d);\n", NUM_PARTIAL, NUM_ENQUEUES);
    frmcnt = QM_VDQCR_NUMFRAMES_SET(NUM_PARTIAL);
    err = qman_volatile_dequeue(fq, VDQCR_FLAGS, frmcnt);
    if (err) {
        pr_crit("qman_volatile_dequeue() failed\n");
        goto failed;
    }
    pr_info("VDQCR (%d of %d);\n", NUM_ENQUEUES - NUM_PARTIAL,
            NUM_ENQUEUES);
    frmcnt = QM_VDQCR_NUMFRAMES_SET(NUM_ENQUEUES - NUM_PARTIAL);
    err = qman_volatile_dequeue(fq, VDQCR_FLAGS, frmcnt);
    if (err) {
        pr_err("qman_volatile_dequeue() failed\n");
        goto failed;
    }

    err = do_enqueues(fq);
    if (err)
        goto failed;
    pr_info("scheduled dequeue (till-empty)\n");
    err = qman_schedule_fq(fq);
    if (err) {
        pr_crit("qman_schedule_fq() failed\n");
        goto failed;
    }
    wait_event(waitqueue, sdqcr_complete);

    /* Retire and OOS the FQ */
    err = qman_retire_fq(fq, &flags);
    if (err < 0) {
        pr_crit("qman_retire_fq() failed\n");
        goto failed;
    }
    wait_event(waitqueue, retire_complete);
    if (flags & QMAN_FQ_STATE_BLOCKOOS) {
        err = -EIO;
        pr_crit("leaking frames\n");
        goto failed;
    }
    err = qman_oos_fq(fq);
    if (err) {
        pr_crit("qman_oos_fq() failed\n");
        goto failed;
    }
    qman_destroy_fq(fq);
    pr_info("%s(): Finished\n", __func__);
    return 0;

failed:
    WARN_ON(1);
    return err;
}