dpio-service.c (976e3645923bdd2fe7893aae33fd7a21098bfb28) dpio-service.c (9d98809711ae0ebcfb8115a0bc54604c59908710)
1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/*
3 * Copyright 2014-2016 Freescale Semiconductor Inc.
1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/*
3 * Copyright 2014-2016 Freescale Semiconductor Inc.
4 * Copyright 2016 NXP
4 * Copyright 2016-2019 NXP
5 *
6 */
7#include <linux/types.h>
8#include <linux/fsl/mc.h>
9#include <soc/fsl/dpaa2-io.h>
10#include <linux/init.h>
11#include <linux/module.h>
12#include <linux/platform_device.h>

--- 415 unchanged lines hidden (view full) ---

428 qbman_eq_desc_set_no_orp(&ed, 0);
429 qbman_eq_desc_set_fq(&ed, fqid);
430
431 return qbman_swp_enqueue(d->swp, &ed, fd);
432}
433EXPORT_SYMBOL(dpaa2_io_service_enqueue_fq);
434
435/**
5 *
6 */
7#include <linux/types.h>
8#include <linux/fsl/mc.h>
9#include <soc/fsl/dpaa2-io.h>
10#include <linux/init.h>
11#include <linux/module.h>
12#include <linux/platform_device.h>

--- 415 unchanged lines hidden (view full) ---

428 qbman_eq_desc_set_no_orp(&ed, 0);
429 qbman_eq_desc_set_fq(&ed, fqid);
430
431 return qbman_swp_enqueue(d->swp, &ed, fd);
432}
433EXPORT_SYMBOL(dpaa2_io_service_enqueue_fq);
434
435/**
436 * dpaa2_io_service_enqueue_multiple_fq() - Enqueue multiple frames
437 * to a frame queue using one fqid.
438 * @d: the given DPIO service.
439 * @fqid: the given frame queue id.
440 * @fd: the frame descriptor which is enqueued.
441 * @nb: number of frames to be enqueud
442 *
443 * Return 0 for successful enqueue, -EBUSY if the enqueue ring is not ready,
444 * or -ENODEV if there is no dpio service.
445 */
446int dpaa2_io_service_enqueue_multiple_fq(struct dpaa2_io *d,
447 u32 fqid,
448 const struct dpaa2_fd *fd,
449 int nb)
450{
451 struct qbman_eq_desc ed;
452
453 d = service_select(d);
454 if (!d)
455 return -ENODEV;
456
457 qbman_eq_desc_clear(&ed);
458 qbman_eq_desc_set_no_orp(&ed, 0);
459 qbman_eq_desc_set_fq(&ed, fqid);
460
461 return qbman_swp_enqueue_multiple(d->swp, &ed, fd, 0, nb);
462}
463EXPORT_SYMBOL(dpaa2_io_service_enqueue_multiple_fq);
464
465/**
466 * dpaa2_io_service_enqueue_multiple_desc_fq() - Enqueue multiple frames
467 * to different frame queue using a list of fqids.
468 * @d: the given DPIO service.
469 * @fqid: the given list of frame queue ids.
470 * @fd: the frame descriptor which is enqueued.
471 * @nb: number of frames to be enqueud
472 *
473 * Return 0 for successful enqueue, -EBUSY if the enqueue ring is not ready,
474 * or -ENODEV if there is no dpio service.
475 */
476int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d,
477 u32 *fqid,
478 const struct dpaa2_fd *fd,
479 int nb)
480{
481 int i;
482 struct qbman_eq_desc ed[32];
483
484 d = service_select(d);
485 if (!d)
486 return -ENODEV;
487
488 for (i = 0; i < nb; i++) {
489 qbman_eq_desc_clear(&ed[i]);
490 qbman_eq_desc_set_no_orp(&ed[i], 0);
491 qbman_eq_desc_set_fq(&ed[i], fqid[i]);
492 }
493
494 return qbman_swp_enqueue_multiple_desc(d->swp, &ed[0], fd, nb);
495}
496EXPORT_SYMBOL(dpaa2_io_service_enqueue_multiple_desc_fq);
497
498/**
436 * dpaa2_io_service_enqueue_qd() - Enqueue a frame to a QD.
437 * @d: the given DPIO service.
438 * @qdid: the given queuing destination id.
439 * @prio: the given queuing priority.
440 * @qdbin: the given queuing destination bin.
441 * @fd: the frame descriptor which is enqueued.
442 *
443 * Return 0 for successful enqueue, or -EBUSY if the enqueue ring is not ready,

--- 77 unchanged lines hidden (view full) ---

521
522/*
523 * 'Stores' are reusable memory blocks for holding dequeue results, and to
524 * assist with parsing those results.
525 */
526
527/**
528 * dpaa2_io_store_create() - Create the dma memory storage for dequeue result.
499 * dpaa2_io_service_enqueue_qd() - Enqueue a frame to a QD.
500 * @d: the given DPIO service.
501 * @qdid: the given queuing destination id.
502 * @prio: the given queuing priority.
503 * @qdbin: the given queuing destination bin.
504 * @fd: the frame descriptor which is enqueued.
505 *
506 * Return 0 for successful enqueue, or -EBUSY if the enqueue ring is not ready,

--- 77 unchanged lines hidden (view full) ---

584
585/*
586 * 'Stores' are reusable memory blocks for holding dequeue results, and to
587 * assist with parsing those results.
588 */
589
590/**
591 * dpaa2_io_store_create() - Create the dma memory storage for dequeue result.
529 * @max_frames: the maximum number of dequeued result for frames, must be <= 16.
592 * @max_frames: the maximum number of dequeued result for frames, must be <= 32.
530 * @dev: the device to allow mapping/unmapping the DMAable region.
531 *
532 * The size of the storage is "max_frames*sizeof(struct dpaa2_dq)".
533 * The 'dpaa2_io_store' returned is a DPIO service managed object.
534 *
535 * Return pointer to dpaa2_io_store struct for successfully created storage
536 * memory, or NULL on error.
537 */
538struct dpaa2_io_store *dpaa2_io_store_create(unsigned int max_frames,
539 struct device *dev)
540{
541 struct dpaa2_io_store *ret;
542 size_t size;
543
593 * @dev: the device to allow mapping/unmapping the DMAable region.
594 *
595 * The size of the storage is "max_frames*sizeof(struct dpaa2_dq)".
596 * The 'dpaa2_io_store' returned is a DPIO service managed object.
597 *
598 * Return pointer to dpaa2_io_store struct for successfully created storage
599 * memory, or NULL on error.
600 */
601struct dpaa2_io_store *dpaa2_io_store_create(unsigned int max_frames,
602 struct device *dev)
603{
604 struct dpaa2_io_store *ret;
605 size_t size;
606
544 if (!max_frames || (max_frames > 16))
607 if (!max_frames || (max_frames > 32))
545 return NULL;
546
547 ret = kmalloc(sizeof(*ret), GFP_KERNEL);
548 if (!ret)
549 return NULL;
550
551 ret->max = max_frames;
552 size = max_frames * sizeof(struct dpaa2_dq) + 64;

--- 153 unchanged lines hidden ---
608 return NULL;
609
610 ret = kmalloc(sizeof(*ret), GFP_KERNEL);
611 if (!ret)
612 return NULL;
613
614 ret->max = max_frames;
615 size = max_frames * sizeof(struct dpaa2_dq) + 64;

--- 153 unchanged lines hidden ---