summaryrefslogtreecommitdiffstats
path: root/linux/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-05-05 08:47:39 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-23 09:23:59 +0200
commitcd089b9e05aad31244059ba88988afbe1db02e5e (patch)
tree81d344bb292ff39e60f74ac4df5f1621eca77c05 /linux/include
parent28ee86a9b0f2e980beeb637da4f787065c74a39e (diff)
downloadrtems-libbsd-cd089b9e05aad31244059ba88988afbe1db02e5e.tar.bz2
Linux update to 4.11-rc5
Linux baseline a71c9a1c779f2499fb2afc0553e543f18aff6edf (4.11-rc5).
Diffstat (limited to 'linux/include')
-rw-r--r--linux/include/soc/fsl/bman.h469
-rw-r--r--linux/include/soc/fsl/qman.h1785
2 files changed, 478 insertions, 1776 deletions
diff --git a/linux/include/soc/fsl/bman.h b/linux/include/soc/fsl/bman.h
index 16f4efaa..eaaf56df 100644
--- a/linux/include/soc/fsl/bman.h
+++ b/linux/include/soc/fsl/bman.h
@@ -1,4 +1,4 @@
-/* Copyright 2008 - 2015 Freescale Semiconductor, Inc.
+/* Copyright 2008 - 2016 Freescale Semiconductor, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,436 +31,87 @@
#ifndef __FSL_BMAN_H
#define __FSL_BMAN_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enable blocking waits */
-#define FSL_DPA_CAN_WAIT 1
-#define FSL_DPA_CAN_WAIT_SYNC 1
-
-/* Last updated for v00.79 of the BG */
-
-/* Portal processing (interrupt) sources */
-#define BM_PIRQ_RCRI 0x00000002 /* RCR Ring (below threshold) */
-#define BM_PIRQ_BSCN 0x00000001 /* Buffer depletion State Change */
-
-/* This wrapper represents a bit-array for the depletion state of the 64 BMan
- * buffer pools. */
-struct bman_depletion {
- u32 __state[2];
-};
-#define BMAN_DEPLETION_EMPTY { { 0x00000000, 0x00000000 } }
-#define BMAN_DEPLETION_FULL { { 0xffffffff, 0xffffffff } }
-#define __bmdep_word(x) ((x) >> 5)
-#define __bmdep_shift(x) ((x) & 0x1f)
-#define __bmdep_bit(x) (0x80000000 >> __bmdep_shift(x))
-static inline void bman_depletion_init(struct bman_depletion *c)
-{
- c->__state[0] = c->__state[1] = 0;
-}
-static inline void bman_depletion_fill(struct bman_depletion *c)
-{
- c->__state[0] = c->__state[1] = ~0;
-}
-static inline int bman_depletion_get(const struct bman_depletion *c, u8 bpid)
-{
- return c->__state[__bmdep_word(bpid)] & __bmdep_bit(bpid);
-}
-static inline void bman_depletion_set(struct bman_depletion *c, u8 bpid)
-{
- c->__state[__bmdep_word(bpid)] |= __bmdep_bit(bpid);
-}
-static inline void bman_depletion_unset(struct bman_depletion *c, u8 bpid)
-{
- c->__state[__bmdep_word(bpid)] &= ~__bmdep_bit(bpid);
-}
-
-/* --- BMan data structures (and associated constants) --- */
-
-/* Represents s/w corenet portal mapped data structures */
-struct bm_rcr_entry; /* RCR (Release Command Ring) entries */
-struct bm_mc_command; /* MC (Management Command) command */
-struct bm_mc_result; /* MC result */
-
-/* Code-reduction, define a wrapper for 48-bit buffers. In cases where a buffer
- * pool id specific to this buffer is needed (BM_RCR_VERB_CMD_BPID_MULTI,
- * BM_MCC_VERB_ACQUIRE), the 'bpid' field is used. */
+/* wrapper for 48-bit buffers */
struct bm_buffer {
union {
struct {
- u8 __reserved1;
- u8 bpid;
- u16 hi; /* High 16-bits of 48-bit address */
- u32 lo; /* Low 32-bits of 48-bit address */
- };
- struct {
- u64 __notaddress:16;
- u64 addr:48;
+ __be16 bpid; /* hi 8-bits reserved */
+ __be16 hi; /* High 16-bits of 48-bit address */
+ __be32 lo; /* Low 32-bits of 48-bit address */
};
+ __be64 data;
};
} __aligned(8);
-static inline u64 bm_buffer_get64(const struct bm_buffer *buf)
-{
- return buf->addr;
-}
+/*
+ * Restore the 48 bit address previously stored in BMan
+ * hardware pools as a dma_addr_t
+ */
static inline dma_addr_t bm_buf_addr(const struct bm_buffer *buf)
{
- return (dma_addr_t)buf->addr;
+ return be64_to_cpu(buf->data) & 0xffffffffffffLLU;
}
-/* Macro, so we compile better if 'v' isn't always 64-bit */
-#define bm_buffer_set64(buf, v) \
- do { \
- struct bm_buffer *__buf931 = (buf); \
- __buf931->hi = upper_32_bits(v); \
- __buf931->lo = lower_32_bits(v); \
- } while (0)
-
-/* See 1.5.3.5.4: "Release Command" */
-struct bm_rcr_entry {
- union {
- struct {
- u8 __dont_write_directly__verb;
- u8 bpid; /* used with BM_RCR_VERB_CMD_BPID_SINGLE */
- u8 __reserved1[62];
- };
- struct bm_buffer bufs[8];
- };
-} __packed;
-#define BM_RCR_VERB_VBIT 0x80
-#define BM_RCR_VERB_CMD_MASK 0x70 /* one of two values; */
-#define BM_RCR_VERB_CMD_BPID_SINGLE 0x20
-#define BM_RCR_VERB_CMD_BPID_MULTI 0x30
-#define BM_RCR_VERB_BUFCOUNT_MASK 0x0f /* values 1..8 */
-/* See 1.5.3.1: "Acquire Command" */
-/* See 1.5.3.2: "Query Command" */
-struct bm_mcc_acquire {
- u8 bpid;
- u8 __reserved1[62];
-} __packed;
-struct bm_mcc_query {
- u8 __reserved2[63];
-} __packed;
-struct bm_mc_command {
- u8 __dont_write_directly__verb;
- union {
- struct bm_mcc_acquire acquire;
- struct bm_mcc_query query;
- };
-} __packed;
-#define BM_MCC_VERB_VBIT 0x80
-#define BM_MCC_VERB_CMD_MASK 0x70 /* where the verb contains; */
-#define BM_MCC_VERB_CMD_ACQUIRE 0x10
-#define BM_MCC_VERB_CMD_QUERY 0x40
-#define BM_MCC_VERB_ACQUIRE_BUFCOUNT 0x0f /* values 1..8 go here */
-
-/* See 1.5.3.3: "Acquire Response" */
-/* See 1.5.3.4: "Query Response" */
-struct bm_pool_state {
- u8 __reserved1[32];
- /* "availability state" and "depletion state" */
- struct {
- u8 __reserved1[8];
- /* Access using bman_depletion_***() */
- struct bman_depletion state;
- } as, ds;
-};
-struct bm_mc_result {
- union {
- struct {
- u8 verb;
- u8 __reserved1[63];
- };
- union {
- struct {
- u8 __reserved1;
- u8 bpid;
- u8 __reserved2[62];
- };
- struct bm_buffer bufs[8];
- } acquire;
- struct bm_pool_state query;
- };
-} __packed;
-#define BM_MCR_VERB_VBIT 0x80
-#define BM_MCR_VERB_CMD_MASK BM_MCC_VERB_CMD_MASK
-#define BM_MCR_VERB_CMD_ACQUIRE BM_MCC_VERB_CMD_ACQUIRE
-#define BM_MCR_VERB_CMD_QUERY BM_MCC_VERB_CMD_QUERY
-#define BM_MCR_VERB_CMD_ERR_INVALID 0x60
-#define BM_MCR_VERB_CMD_ERR_ECC 0x70
-#define BM_MCR_VERB_ACQUIRE_BUFCOUNT BM_MCC_VERB_ACQUIRE_BUFCOUNT /* 0..8 */
-/* Determine the "availability state" of pool 'p' from a query result 'r' */
-#define BM_MCR_QUERY_AVAILABILITY(r, p) \
- bman_depletion_get(&r->query.as.state, p)
-/* Determine the "depletion state" of pool 'p' from a query result 'r' */
-#define BM_MCR_QUERY_DEPLETION(r, p) \
- bman_depletion_get(&r->query.ds.state, p)
-
-/* Managed (aka "shared" or "mux/demux") portal, high-level i/face */
-
-/* Portal and Buffer Pools */
-
-/* Represents a managed portal */
-struct bman_portal;
-
-/* This object type represents BMan buffer pools. */
-struct bman_pool;
-
-struct bman_portal_config {
- /* This is used for any "core-affine" portals, ie. default portals
- * associated to the corresponding cpu. -1 implies that there is no core
- * affinity configured. */
- int cpu;
- /* portal interrupt line */
- int irq;
-#ifndef __rtems__
- /* Is this portal shared? (If so, it has coarser locking and demuxes
- * processing on behalf of other CPUs.) */
- int is_shared;
-#endif /* __rtems__ */
- /* These are the buffer pool IDs that may be used via this portal. */
- struct bman_depletion mask;
-};
-
-/* This callback type is used when handling pool depletion entry/exit. The
- * 'cb_ctx' value is the opaque value associated with the pool object in
- * bman_new_pool(). 'depleted' is non-zero on depletion-entry, and zero on
- * depletion-exit. */
-typedef void (*bman_cb_depletion)(struct bman_portal *bm,
- struct bman_pool *pool, void *cb_ctx, int depleted);
-
-/* This struct specifies parameters for a bman_pool object. */
-struct bman_pool_params {
- /* index of the buffer pool to encapsulate (0-63), ignored if
- * BMAN_POOL_FLAG_DYNAMIC_BPID is set. */
- u32 bpid;
- /* bit-mask of BMAN_POOL_FLAG_*** options */
- u32 flags;
- /* depletion-entry/exit callback, if BMAN_POOL_FLAG_DEPLETION is set */
- bman_cb_depletion cb;
- /* opaque user value passed as a parameter to 'cb' */
- void *cb_ctx;
- /* depletion-entry/exit thresholds, if BMAN_POOL_FLAG_THRESH is set. NB:
- * this is only allowed if BMAN_POOL_FLAG_DYNAMIC_BPID is used *and*
- * when run in the control plane (which controls BMan CCSR). This array
- * matches the definition of bm_pool_set(). */
- u32 thresholds[4];
-};
-
-/* Flags to bman_new_pool() */
-#define BMAN_POOL_FLAG_NO_RELEASE 0x00000001 /* can't release to pool */
-#define BMAN_POOL_FLAG_ONLY_RELEASE 0x00000002 /* can only release to pool */
-#define BMAN_POOL_FLAG_DEPLETION 0x00000004 /* track depletion entry/exit */
-#define BMAN_POOL_FLAG_DYNAMIC_BPID 0x00000008 /* (de)allocate bpid */
-#define BMAN_POOL_FLAG_THRESH 0x00000010 /* set depletion thresholds */
-#define BMAN_POOL_FLAG_STOCKPILE 0x00000020 /* stockpile to reduce hw ops */
-
-/* Flags to bman_release() */
-#ifdef FSL_DPA_CAN_WAIT
-#define BMAN_RELEASE_FLAG_WAIT 0x00000001 /* wait if RCR is full */
-#ifndef __rtems__
-#define BMAN_RELEASE_FLAG_WAIT_INT 0x00000002 /* if we wait, interruptible? */
-#endif /* __rtems__ */
-#ifdef FSL_DPA_CAN_WAIT_SYNC
-#define BMAN_RELEASE_FLAG_WAIT_SYNC 0x00000004 /* if wait, until consumed? */
-#endif
-#endif
-#define BMAN_RELEASE_FLAG_NOW 0x00000008 /* issue immediate release */
-
-/* Flags to bman_acquire() */
-#define BMAN_ACQUIRE_FLAG_STOCKPILE 0x00000001 /* no hw op, stockpile only */
-
-/* Portal Management */
-
-/**
- * bman_get_portal_config - get portal configuration settings
- *
- * This returns a read-only view of the current cpu's affine portal settings.
- */
-const struct bman_portal_config *bman_get_portal_config(void);
-
-/**
- * bman_irqsource_get - return the portal work that is interrupt-driven
- *
- * Returns a bitmask of BM_PIRQ_**I processing sources that are currently
- * enabled for interrupt handling on the current cpu's affine portal. These
- * sources will trigger the portal interrupt and the interrupt handler (or a
- * tasklet/bottom-half it defers to) will perform the corresponding processing
- * work. The bman_poll_***() functions will only process sources that are not in
- * this bitmask. If the current CPU is sharing a portal hosted on another CPU,
- * this always returns zero.
- */
-u32 bman_irqsource_get(void);
-
-/**
- * bman_irqsource_add - add processing sources to be interrupt-driven
- * @bits: bitmask of BM_PIRQ_**I processing sources
- *
- * Adds processing sources that should be interrupt-driven (rather than
- * processed via bman_poll_***() functions). Returns zero for success, or
- * -EINVAL if the current CPU is sharing a portal hosted on another CPU. */
-int bman_irqsource_add(u32 bits);
-
-/**
- * bman_irqsource_remove - remove processing sources from being interrupt-driven
- * @bits: bitmask of BM_PIRQ_**I processing sources
- *
- * Removes processing sources from being interrupt-driven, so that they will
- * instead be processed via bman_poll_***() functions. Returns zero for success,
- * or -EINVAL if the current CPU is sharing a portal hosted on another CPU. */
-int bman_irqsource_remove(u32 bits);
-
-#ifndef __rtems__
-/**
- * bman_affine_cpus - return a mask of cpus that have affine portals
- */
-const cpumask_t *bman_affine_cpus(void);
-#endif /* __rtems__ */
-
-/**
- * bman_poll_slow - process anything that isn't interrupt-driven.
- *
- * This function does any portal processing that isn't interrupt-driven. If the
- * current CPU is sharing a portal hosted on another CPU, this function will
- * return -EINVAL, otherwise the return value is a bitmask of BM_PIRQ_* sources
- * indicating what interrupt sources were actually processed by the call.
- *
- * NB, unlike the legacy wrapper bman_poll(), this function will
- * deterministically check for the presence of portal processing work and do it,
- * which implies some latency even if there's nothing to do. The bman_poll()
- * wrapper on the other hand (like the qman_poll() wrapper) attenuates this by
- * checking for (and doing) portal processing infrequently. Ie. such that
- * qman_poll() and bman_poll() can be called from core-processing loops. Use
- * bman_poll_slow() when you yourself are deciding when to incur the overhead of
- * processing.
- */
-u32 bman_poll_slow(void);
-
-/**
- * bman_poll - process anything that isn't interrupt-driven.
- *
- * Dispatcher logic on a cpu can use this to trigger any maintenance of the
- * affine portal. This function does whatever processing is not triggered by
- * interrupts. This is a legacy wrapper that can be used in core-processing
- * loops but mitigates the performance overhead of portal processing by
- * adaptively bypassing true portal processing most of the time. (Processing is
- * done once every 10 calls if the previous processing revealed that work needed
- * to be done, or once very 1000 calls if the previous processing revealed no
- * work needed doing.) If you wish to control this yourself, call
- * bman_poll_slow() instead, which always checks for portal processing work.
- */
-void bman_poll(void);
-
-/**
- * bman_rcr_is_empty - Determine if portal's RCR is empty
- *
- * For use in situations where a cpu-affine caller needs to determine when all
- * releases for the local portal have been processed by BMan but can't use the
- * BMAN_RELEASE_FLAG_WAIT_SYNC flag to do this from the final bman_release().
- * The function forces tracking of RCR consumption (which normally doesn't
- * happen until release processing needs to find space to put new release
- * commands), and returns zero if the ring still has unprocessed entries,
- * non-zero if it is empty.
- */
-int bman_rcr_is_empty(void);
-
-/**
- * bman_alloc_bpid_range - Allocate a contiguous range of BPIDs
- * @result: is set by the API to the base BPID of the allocated range
- * @count: the number of BPIDs required
- * @align: required alignment of the allocated range
- * @partial: non-zero if the API can return fewer than @count BPIDs
- *
- * Returns the number of buffer pools allocated, or a negative error code. If
- * @partial is non zero, the allocation request may return a smaller range of
- * BPs than requested (though alignment will be as requested). If @partial is
- * zero, the return value will either be 'count' or negative.
- */
-int bman_alloc_bpid_range(u32 *result, u32 count, u32 align, int partial);
-static inline int bman_alloc_bpid(u32 *result)
+static inline u64 bm_buffer_get64(const struct bm_buffer *buf)
{
- int ret = bman_alloc_bpid_range(result, 1, 0, 0);
-
- return (ret > 0) ? 0 : ret;
+ return be64_to_cpu(buf->data) & 0xffffffffffffLLU;
}
-/**
- * bman_release_bpid_range - Release the specified range of buffer pool IDs
- * @bpid: the base BPID of the range to deallocate
- * @count: the number of BPIDs in the range
- *
- * This function can also be used to seed the allocator with ranges of BPIDs
- * that it can subsequently allocate from.
- */
-void bman_release_bpid_range(u32 bpid, u32 count);
-static inline void bman_release_bpid(u32 bpid)
+static inline void bm_buffer_set64(struct bm_buffer *buf, u64 addr)
{
- bman_release_bpid_range(bpid, 1);
+ buf->hi = cpu_to_be16(upper_32_bits(addr));
+ buf->lo = cpu_to_be32(lower_32_bits(addr));
}
-int bman_reserve_bpid_range(u32 bpid, u32 count);
-static inline int bman_reserve_bpid(u32 bpid)
+static inline u8 bm_buffer_get_bpid(const struct bm_buffer *buf)
{
- return bman_reserve_bpid_range(bpid, 1);
+ return be16_to_cpu(buf->bpid) & 0xff;
}
-void bman_seed_bpid_range(u32 bpid, u32 count);
+static inline void bm_buffer_set_bpid(struct bm_buffer *buf, int bpid)
+{
+ buf->bpid = cpu_to_be16(bpid & 0xff);
+}
+/* Managed portal, high-level i/face */
-int bman_shutdown_pool(u32 bpid);
+/* Portal and Buffer Pools */
+struct bman_portal;
+struct bman_pool;
-/* Pool management */
+#define BM_POOL_MAX 64 /* max # of buffer pools */
/**
* bman_new_pool - Allocates a Buffer Pool object
- * @params: parameters specifying the buffer pool ID and behaviour
*
- * Creates a pool object for the given @params. A portal and the depletion
- * callback field of @params are only used if the BMAN_POOL_FLAG_DEPLETION flag
- * is set. NB, the fields from @params are copied into the new pool object, so
- * the structure provided by the caller can be released or reused after the
- * function returns.
+ * Creates a pool object, and returns a reference to it or NULL on error.
*/
-struct bman_pool *bman_new_pool(const struct bman_pool_params *params);
+struct bman_pool *bman_new_pool(void);
/**
* bman_free_pool - Deallocates a Buffer Pool object
* @pool: the pool object to release
- *
*/
void bman_free_pool(struct bman_pool *pool);
/**
- * bman_get_params - Returns a pool object's parameters.
+ * bman_get_bpid - Returns a pool object's BPID.
* @pool: the pool object
*
- * The returned pointer refers to state within the pool object so must not be
- * modified and can no longer be read once the pool object is destroyed.
+ * The returned value is the index of the encapsulated buffer pool,
+ * in the range of [0, @BM_POOL_MAX-1].
*/
-const struct bman_pool_params *bman_get_params(const struct bman_pool *pool);
+int bman_get_bpid(const struct bman_pool *pool);
/**
* bman_release - Release buffer(s) to the buffer pool
* @pool: the buffer pool object to release to
* @bufs: an array of buffers to release
* @num: the number of buffers in @bufs (1-8)
- * @flags: bit-mask of BMAN_RELEASE_FLAG_*** options
*
- * Adds the given buffers to RCR entries. If the portal @p was created with the
- * "COMPACT" flag, then it will be using a compaction algorithm to improve
- * utilisation of RCR. As such, these buffers may join an existing ring entry
- * and/or it may not be issued right away so as to allow future releases to join
- * the same ring entry. Use the BMAN_RELEASE_FLAG_NOW flag to override this
- * behaviour by committing the RCR entry (or entries) right away. If the RCR
- * ring is full, the function will return -EBUSY unless BMAN_RELEASE_FLAG_WAIT
- * is selected, in which case it will sleep waiting for space to become
- * available in RCR. If the function receives a signal before such time (and
- * BMAN_RELEASE_FLAG_WAIT_INT is set), the function returns -EINTR. Otherwise,
- * it returns zero.
+ * Adds the given buffers to RCR entries. If the RCR ring is unresponsive,
+ * the function will return -ETIMEDOUT. Otherwise, it returns zero.
*/
-int bman_release(struct bman_pool *pool, const struct bm_buffer *bufs, u8 num,
- u32 flags);
+int bman_release(struct bman_pool *pool, const struct bm_buffer *bufs, u8 num);
/**
* bman_acquire - Acquire buffer(s) from a buffer pool
@@ -473,52 +124,6 @@ int bman_release(struct bman_pool *pool, const struct bm_buffer *bufs, u8 num,
* negative error code if a h/w error or pool starvation was encountered. In
* the latter case, the content of @bufs is undefined.
*/
-int bman_acquire(struct bman_pool *pool, struct bm_buffer *bufs, u8 num,
- u32 flags);
-
-/**
- * bman_flush_stockpile - Flush stockpile buffer(s) to the buffer pool
- * @pool: the buffer pool object the stockpile belongs
- * @flags: bit-mask of BMAN_RELEASE_FLAG_*** options
- *
- * Adds stockpile buffers to RCR entries until the stockpile is empty.
- * The return value will be a negative error code if a h/w error occurred.
- * If BMAN_RELEASE_FLAG_NOW flag is passed and RCR ring is full,
- * -EAGAIN will be returned.
- */
-int bman_flush_stockpile(struct bman_pool *pool, u32 flags);
-
-/**
- * bman_query_pools - Query all buffer pool states
- * @state: storage for the queried availability and depletion states
- */
-int bman_query_pools(struct bm_pool_state *state);
-
-#ifdef CONFIG_FSL_BMAN
-/**
- * bman_query_free_buffers - Query how many free buffers are in buffer pool
- * @pool: the buffer pool object to query
- *
- * Return the number of the free buffers
- */
-u32 bman_query_free_buffers(struct bman_pool *pool);
-
-/**
- * bman_update_pool_thresholds - Change the buffer pool's depletion thresholds
- * @pool: the buffer pool object to which the thresholds will be set
- * @thresholds: the new thresholds
- */
-int bman_update_pool_thresholds(struct bman_pool *pool, const u32 *thresholds);
-#endif
-
-/**
- * The below bman_p_***() variant might be called in a situation that the cpu
- * which the portal affine to is not online yet.
- * @bman_portal specifies which portal the API will use.
-*/
-int bman_p_irqsource_add(struct bman_portal *p, __maybe_unused u32 bits);
-#ifdef __cplusplus
-}
-#endif
+int bman_acquire(struct bman_pool *pool, struct bm_buffer *bufs, u8 num);
#endif /* __FSL_BMAN_H */
diff --git a/linux/include/soc/fsl/qman.h b/linux/include/soc/fsl/qman.h
index f63feb89..92909dc4 100644
--- a/linux/include/soc/fsl/qman.h
+++ b/linux/include/soc/fsl/qman.h
@@ -1,4 +1,4 @@
-/* Copyright 2008 - 2015 Freescale Semiconductor, Inc.
+/* Copyright 2008 - 2016 Freescale Semiconductor, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,43 +31,14 @@
#ifndef __FSL_QMAN_H
#define __FSL_QMAN_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <linux/bitops.h>
#include <linux/rbtree.h>
-/* Extra lookup is needed on 64 bit machines */
-#if (BITS_PER_LONG == 64)
-#define CONFIG_FSL_QMAN_FQ_LOOKUP 1
-#endif
-
-/* Enable blocking waits */
-#define FSL_DPA_CAN_WAIT 1
-#define FSL_DPA_CAN_WAIT_SYNC 1
-
/* Hardware constants */
#define QM_CHANNEL_SWPORTAL0 0
#define QMAN_CHANNEL_POOL1 0x21
-#define QMAN_CHANNEL_CAAM 0x80
-#define QMAN_CHANNEL_PME 0xa0
#define QMAN_CHANNEL_POOL1_REV3 0x401
-#define QMAN_CHANNEL_CAAM_REV3 0x840
-#define QMAN_CHANNEL_PME_REV3 0x860
-#define QMAN_CHANNEL_DCE 0x8a0
extern u16 qm_channel_pool1;
-extern u16 qm_channel_caam;
-extern u16 qm_channel_pme;
-extern u16 qm_channel_dce;
-enum qm_dc_portal {
- qm_dc_portal_fman0 = 0,
- qm_dc_portal_fman1 = 1,
- qm_dc_portal_caam = 2,
- qm_dc_portal_pme = 3,
- qm_dc_portal_rman = 4,
- qm_dc_portal_dce = 5
-};
/* Portal processing (interrupt) sources */
#define QM_PIRQ_CSCI 0x00100000 /* Congestion State Change */
@@ -75,26 +46,13 @@ enum qm_dc_portal {
#define QM_PIRQ_EQRI 0x00040000 /* EQCR Ring (below threshold) */
#define QM_PIRQ_DQRI 0x00020000 /* DQRR Ring (non-empty) */
#define QM_PIRQ_MRI 0x00010000 /* MR Ring (non-empty) */
-/* This mask contains all the interrupt sources that need handling except DQRI,
- * ie. that if present should trigger slow-path processing. */
+/*
+ * This mask contains all the interrupt sources that need handling except DQRI,
+ * ie. that if present should trigger slow-path processing.
+ */
#define QM_PIRQ_SLOW (QM_PIRQ_CSCI | QM_PIRQ_EQCI | QM_PIRQ_EQRI | \
QM_PIRQ_MRI)
-/* --- Clock speed --- */
-/* A qman driver instance may or may not know the current qman clock speed.
- * However, certain CEETM calculations may not be possible if this is not known.
- * The 'set' function will only succeed (return zero) if the driver did not
- * already know the clock speed. Likewise, the 'get' function will only succeed
- * if the driver does know the clock speed (either because it knew when booting,
- * or was told via 'set'). In cases where software is running on a driver
- * instance that does not know the clock speed (eg. on a hypervised data-plane),
- * and the user can obtain the current qman clock speed by other means (eg. from
- * a message sent from the control-plane), then the 'set' function can be used
- * to enable rate-calculations in a driver where it would otherwise not be
- * possible. */
-int qm_get_clock(u64 *clock_hz);
-int qm_set_clock(u64 clock_hz);
-
/* For qman_static_dequeue_*** APIs */
#define QM_SDQCR_CHANNELS_POOL_MASK 0x00007fff
/* for n in [1,15] */
@@ -105,40 +63,46 @@ static inline u32 QM_SDQCR_CHANNELS_POOL_CONV(u16 channel)
return QM_SDQCR_CHANNELS_POOL(channel + 1 - qm_channel_pool1);
}
-/* For qman_volatile_dequeue(); Choose one PRECEDENCE. EXACT is optional. Use
- * NUMFRAMES(n) (6-bit) or NUMFRAMES_TILLEMPTY to fill in the frame-count. Use
- * FQID(n) to fill in the frame queue ID. */
-#define QM_VDQCR_PRECEDENCE_VDQCR 0x0
-#define QM_VDQCR_PRECEDENCE_SDQCR 0x80000000
-#define QM_VDQCR_EXACT 0x40000000
-#define QM_VDQCR_NUMFRAMES_MASK 0x3f000000
-#define QM_VDQCR_NUMFRAMES_SET(n) (((n) & 0x3f) << 24)
-#define QM_VDQCR_NUMFRAMES_GET(n) (((n) >> 24) & 0x3f)
-#define QM_VDQCR_NUMFRAMES_TILLEMPTY QM_VDQCR_NUMFRAMES_SET(0)
+/* --- QMan data structures (and associated constants) --- */
+/* "Frame Descriptor (FD)" */
+struct qm_fd {
+ union {
+ struct {
+ u8 cfg8b_w1;
+ u8 bpid; /* Buffer Pool ID */
+ u8 cfg8b_w3;
+ u8 addr_hi; /* high 8-bits of 40-bit address */
+ __be32 addr_lo; /* low 32-bits of 40-bit address */
+ } __packed;
+ __be64 data;
+ };
+ __be32 cfg; /* format, offset, length / congestion */
+ union {
+ __be32 cmd;
+ __be32 status;
+ };
+} __aligned(8);
-/* ------------------------------------------------------- */
-/* --- QMan data structures (and associated constants) --- */
+#define QM_FD_FORMAT_SG BIT(31)
+#define QM_FD_FORMAT_LONG BIT(30)
+#define QM_FD_FORMAT_COMPOUND BIT(29)
+#define QM_FD_FORMAT_MASK GENMASK(31, 29)
+#define QM_FD_OFF_SHIFT 20
+#define QM_FD_OFF_MASK GENMASK(28, 20)
+#define QM_FD_LEN_MASK GENMASK(19, 0)
+#define QM_FD_LEN_BIG_MASK GENMASK(28, 0)
-/* Represents s/w corenet portal mapped data structures */
-struct qm_eqcr_entry; /* EQCR (EnQueue Command Ring) entries */
-struct qm_dqrr_entry; /* DQRR (DeQueue Response Ring) entries */
-struct qm_mr_entry; /* MR (Message Ring) entries */
-struct qm_mc_command; /* MC (Management Command) command */
-struct qm_mc_result; /* MC result */
-
-/* See David Lapp's "Frame formats" document, "dpateam", Jan 07, 2008 */
-#define QM_FD_FORMAT_SG 0x4
-#define QM_FD_FORMAT_LONG 0x2
-#define QM_FD_FORMAT_COMPOUND 0x1
enum qm_fd_format {
- /* 'contig' implies a contiguous buffer, whereas 'sg' implies a
+ /*
+ * 'contig' implies a contiguous buffer, whereas 'sg' implies a
* scatter-gather table. 'big' implies a 29-bit length with no offset
* field, otherwise length is 20-bit and offset is 9-bit. 'compound'
* implies a s/g-like table, where each entry itself represents a frame
* (contiguous or scatter-gather) and the 29-bit "length" is
* interpreted purely for congestion calculations, ie. a "congestion
- * weight". */
+ * weight".
+ */
qm_fd_contig = 0,
qm_fd_contig_big = QM_FD_FORMAT_LONG,
qm_fd_sg = QM_FD_FORMAT_SG,
@@ -146,173 +110,149 @@ enum qm_fd_format {
qm_fd_compound = QM_FD_FORMAT_COMPOUND
};
-/* Capitalised versions are un-typed but can be used in static expressions */
-#define QM_FD_CONTIG 0
-#define QM_FD_CONTIG_BIG QM_FD_FORMAT_LONG
-#define QM_FD_SG QM_FD_FORMAT_SG
-#define QM_FD_SG_BIG (QM_FD_FORMAT_SG | QM_FD_FORMAT_LONG)
-#define QM_FD_COMPOUND QM_FD_FORMAT_COMPOUND
+static inline dma_addr_t qm_fd_addr(const struct qm_fd *fd)
+{
+ return be64_to_cpu(fd->data) & 0xffffffffffLLU;
+}
-/* See 1.5.1.1: "Frame Descriptor (FD)" */
-struct qm_fd {
- union {
- struct {
- u8 dd:2; /* dynamic debug */
- u8 liodn_offset:6;
- u8 bpid:8; /* Buffer Pool ID */
- u8 eliodn_offset:4;
- u8 __reserved:4;
- u8 addr_hi; /* high 8-bits of 40-bit address */
- u32 addr_lo; /* low 32-bits of 40-bit address */
- };
- struct {
- u64 __notaddress:24;
- /* More efficient address accessor */
- u64 addr:40;
- };
- u64 opaque_addr;
- };
- /* The 'format' field indicates the interpretation of the remaining 29
- * bits of the 32-bit word. For packing reasons, it is duplicated in the
- * other union elements. Note, union'd structs are difficult to use with
- * static initialisation under gcc, in which case use the "opaque" form
- * with one of the macros. */
- union {
- /* For easier/faster copying of this part of the fd (eg. from a
- * DQRR entry to an EQCR entry) copy 'opaque' */
- u32 opaque;
- /* If 'format' is _contig or _sg, 20b length and 9b offset */
- struct {
- enum qm_fd_format format:3;
- u16 offset:9;
- u32 length20:20;
- };
- /* If 'format' is _contig_big or _sg_big, 29b length */
- struct {
- enum qm_fd_format _format1:3;
- u32 length29:29;
- };
- /* If 'format' is _compound, 29b "congestion weight" */
- struct {
- enum qm_fd_format _format2:3;
- u32 cong_weight:29;
- };
- };
- union {
- u32 cmd;
- u32 status;
- };
-} __aligned(8);
-#define QM_FD_DD_NULL 0x00
-#define QM_FD_PID_MASK 0x3f
static inline u64 qm_fd_addr_get64(const struct qm_fd *fd)
{
- return fd->addr;
+ return be64_to_cpu(fd->data) & 0xffffffffffLLU;
}
-static inline dma_addr_t qm_fd_addr(const struct qm_fd *fd)
+static inline void qm_fd_addr_set64(struct qm_fd *fd, u64 addr)
{
- return (dma_addr_t)fd->addr;
+ fd->addr_hi = upper_32_bits(addr);
+ fd->addr_lo = cpu_to_be32(lower_32_bits(addr));
}
-/* Macro, so we compile better if 'v' isn't always 64-bit */
-#define qm_fd_addr_set64(fd, v) \
- do { \
- struct qm_fd *__fd931 = (fd); \
- __fd931->addr = v; \
- } while (0)
-
-/* For static initialisation of FDs (which is complicated by the use of unions
- * in "struct qm_fd"), use the following macros. Note that;
- * - 'dd', 'pid' and 'bpid' are ignored because there's no static initialisation
- * use-case),
- * - use capitalised QM_FD_*** formats for static initialisation.
+
+/*
+ * The 'format' field indicates the interpretation of the remaining
+ * 29 bits of the 32-bit word.
+ * If 'format' is _contig or _sg, 20b length and 9b offset.
+ * If 'format' is _contig_big or _sg_big, 29b length.
+ * If 'format' is _compound, 29b "congestion weight".
*/
-#define QM_FD_FMT_20(cmd, addr_hi, addr_lo, fmt, off, len) \
- { 0, 0, 0, 0, 0, addr_hi, addr_lo, \
- { (((fmt)&0x7) << 29) | (((off)&0x1ff) << 20) | ((len)&0xfffff) }, \
- { cmd } }
-#define QM_FD_FMT_29(cmd, addr_hi, addr_lo, fmt, len) \
- { 0, 0, 0, 0, 0, addr_hi, addr_lo, \
- { (((fmt)&0x7) << 29) | ((len)&0x1fffffff) }, \
- { cmd } }
-
-/* See 2.2.1.3 Multi-Core Datapath Acceleration Architecture */
+static inline enum qm_fd_format qm_fd_get_format(const struct qm_fd *fd)
+{
+ return be32_to_cpu(fd->cfg) & QM_FD_FORMAT_MASK;
+}
+
+static inline int qm_fd_get_offset(const struct qm_fd *fd)
+{
+ return (be32_to_cpu(fd->cfg) & QM_FD_OFF_MASK) >> QM_FD_OFF_SHIFT;
+}
+
+static inline int qm_fd_get_length(const struct qm_fd *fd)
+{
+ return be32_to_cpu(fd->cfg) & QM_FD_LEN_MASK;
+}
+
+static inline int qm_fd_get_len_big(const struct qm_fd *fd)
+{
+ return be32_to_cpu(fd->cfg) & QM_FD_LEN_BIG_MASK;
+}
+
+static inline void qm_fd_set_param(struct qm_fd *fd, enum qm_fd_format fmt,
+ int off, int len)
+{
+ fd->cfg = cpu_to_be32(fmt | (len & QM_FD_LEN_BIG_MASK) |
+ ((off << QM_FD_OFF_SHIFT) & QM_FD_OFF_MASK));
+}
+
+#define qm_fd_set_contig(fd, off, len) \
+ qm_fd_set_param(fd, qm_fd_contig, off, len)
+#define qm_fd_set_sg(fd, off, len) qm_fd_set_param(fd, qm_fd_sg, off, len)
+#define qm_fd_set_contig_big(fd, len) \
+ qm_fd_set_param(fd, qm_fd_contig_big, 0, len)
+#define qm_fd_set_sg_big(fd, len) qm_fd_set_param(fd, qm_fd_sg_big, 0, len)
+
+static inline void qm_fd_clear_fd(struct qm_fd *fd)
+{
+ fd->data = 0;
+ fd->cfg = 0;
+ fd->cmd = 0;
+}
+
+/* Scatter/Gather table entry */
struct qm_sg_entry {
union {
struct {
u8 __reserved1[3];
u8 addr_hi; /* high 8-bits of 40-bit address */
- u32 addr_lo; /* low 32-bits of 40-bit address */
- };
- struct {
- u64 __notaddress:24;
- u64 addr:40;
+ __be32 addr_lo; /* low 32-bits of 40-bit address */
};
+ __be64 data;
};
- u32 extension:1; /* Extension bit */
- u32 final:1; /* Final bit */
- u32 length:30;
+ __be32 cfg; /* E bit, F bit, length */
u8 __reserved2;
u8 bpid;
- u16 __reserved3:3;
- u16 offset:13;
+ __be16 offset; /* 13-bit, _res[13-15]*/
} __packed;
+
+#define QM_SG_LEN_MASK GENMASK(29, 0)
+#define QM_SG_OFF_MASK GENMASK(12, 0)
+#define QM_SG_FIN BIT(30)
+#define QM_SG_EXT BIT(31)
+
+static inline dma_addr_t qm_sg_addr(const struct qm_sg_entry *sg)
+{
+ return be64_to_cpu(sg->data) & 0xffffffffffLLU;
+}
+
static inline u64 qm_sg_entry_get64(const struct qm_sg_entry *sg)
{
- return sg->addr;
+ return be64_to_cpu(sg->data) & 0xffffffffffLLU;
}
-static inline dma_addr_t qm_sg_addr(const struct qm_sg_entry *sg)
+
+static inline void qm_sg_entry_set64(struct qm_sg_entry *sg, u64 addr)
{
- return (dma_addr_t)sg->addr;
+ sg->addr_hi = upper_32_bits(addr);
+ sg->addr_lo = cpu_to_be32(lower_32_bits(addr));
}
-/* Macro, so we compile better if 'v' isn't always 64-bit */
-#define qm_sg_entry_set64(sg, v) \
- do { \
- struct qm_sg_entry *__sg931 = (sg); \
- __sg931->addr = v; \
- } while (0)
-
-/* See 1.5.8.1: "Enqueue Command" */
-struct qm_eqcr_entry {
- u8 __dont_write_directly__verb;
- u8 dca;
- u16 seqnum;
- u32 orp; /* 24-bit */
- u32 fqid; /* 24-bit */
- u32 tag;
- struct qm_fd fd;
- u8 __reserved3[32];
-} __packed;
-#define QM_EQCR_VERB_VBIT 0x80
-#define QM_EQCR_VERB_CMD_MASK 0x61 /* but only one value; */
-#define QM_EQCR_VERB_CMD_ENQUEUE 0x01
-#define QM_EQCR_VERB_COLOUR_MASK 0x18 /* 4 possible values; */
-#define QM_EQCR_VERB_COLOUR_GREEN 0x00
-#define QM_EQCR_VERB_COLOUR_YELLOW 0x08
-#define QM_EQCR_VERB_COLOUR_RED 0x10
-#define QM_EQCR_VERB_COLOUR_OVERRIDE 0x18
-#define QM_EQCR_VERB_INTERRUPT 0x04 /* on command consumption */
-#define QM_EQCR_VERB_ORP 0x02 /* enable order restoration */
-#define QM_EQCR_DCA_ENABLE 0x80
-#define QM_EQCR_DCA_PARK 0x40
-#define QM_EQCR_DCA_IDXMASK 0x0f /* "DQRR::idx" goes here */
-#define QM_EQCR_SEQNUM_NESN 0x8000 /* Advance NESN */
-#define QM_EQCR_SEQNUM_NLIS 0x4000 /* More fragments to come */
-#define QM_EQCR_SEQNUM_SEQMASK 0x3fff /* sequence number goes here */
-#define QM_EQCR_FQID_NULL 0 /* eg. for an ORP seqnum hole */
-
-/* See 1.5.8.2: "Frame Dequeue Response" */
+
+static inline bool qm_sg_entry_is_final(const struct qm_sg_entry *sg)
+{
+ return be32_to_cpu(sg->cfg) & QM_SG_FIN;
+}
+
+static inline bool qm_sg_entry_is_ext(const struct qm_sg_entry *sg)
+{
+ return be32_to_cpu(sg->cfg) & QM_SG_EXT;
+}
+
+static inline int qm_sg_entry_get_len(const struct qm_sg_entry *sg)
+{
+ return be32_to_cpu(sg->cfg) & QM_SG_LEN_MASK;
+}
+
+static inline void qm_sg_entry_set_len(struct qm_sg_entry *sg, int len)
+{
+ sg->cfg = cpu_to_be32(len & QM_SG_LEN_MASK);
+}
+
+static inline void qm_sg_entry_set_f(struct qm_sg_entry *sg, int len)
+{
+ sg->cfg = cpu_to_be32(QM_SG_FIN | (len & QM_SG_LEN_MASK));
+}
+
+static inline int qm_sg_entry_get_off(const struct qm_sg_entry *sg)
+{
+ return be32_to_cpu(sg->offset) & QM_SG_OFF_MASK;
+}
+
+/* "Frame Dequeue Response" */
struct qm_dqrr_entry {
u8 verb;
u8 stat;
- u16 seqnum; /* 15-bit */
+ __be16 seqnum; /* 15-bit */
u8 tok;
u8 __reserved2[3];
- u32 fqid; /* 24-bit */
- u32 contextB;
+ __be32 fqid; /* 24-bit */
+ __be32 context_b;
struct qm_fd fd;
u8 __reserved4[32];
-};
+} __packed;
#define QM_DQRR_VERB_VBIT 0x80
#define QM_DQRR_VERB_MASK 0x7f /* where the verb contains; */
#define QM_DQRR_VERB_FRAME_DEQUEUE 0x60 /* "this format" */
@@ -323,46 +263,44 @@ struct qm_dqrr_entry {
#define QM_DQRR_STAT_UNSCHEDULED 0x02 /* Unscheduled dequeue */
#define QM_DQRR_STAT_DQCR_EXPIRED 0x01 /* VDQCR or PDQCR expired*/
-/* See 1.5.8.3: "ERN Message Response" */
-/* See 1.5.8.4: "FQ State Change Notification" */
-struct qm_mr_entry {
- u8 verb;
- union {
- struct {
- u8 dca;
- u16 seqnum;
- u8 rc; /* Rejection Code */
- u32 orp:24;
- u32 fqid; /* 24-bit */
- u32 tag;
- struct qm_fd fd;
- } __packed ern;
- struct {
- u8 colour:2; /* See QM_MR_DCERN_COLOUR_* */
- u8 __reserved1:3;
- enum qm_dc_portal portal:3;
- u16 __reserved2;
- u8 rc; /* Rejection Code */
- u32 __reserved3:24;
- u32 fqid; /* 24-bit */
- u32 tag;
- struct qm_fd fd;
- } __packed dcern;
- struct {
- u8 fqs; /* Frame Queue Status */
- u8 __reserved1[6];
- u32 fqid; /* 24-bit */
- u32 contextB;
- u8 __reserved2[16];
- } __packed fq; /* FQRN/FQRNI/FQRL/FQPN */
+/* 'fqid' is a 24-bit field in every h/w descriptor */
+#define QM_FQID_MASK GENMASK(23, 0)
+#define qm_fqid_set(p, v) ((p)->fqid = cpu_to_be32((v) & QM_FQID_MASK))
+#define qm_fqid_get(p) (be32_to_cpu((p)->fqid) & QM_FQID_MASK)
+
+/* "ERN Message Response" */
+/* "FQ State Change Notification" */
+union qm_mr_entry {
+ struct {
+ u8 verb;
+ u8 __reserved[63];
};
- u8 __reserved2[32];
-} __packed;
+ struct {
+ u8 verb;
+ u8 dca;
+ __be16 seqnum;
+ u8 rc; /* Rej Code: 8-bit */
+ u8 __reserved[3];
+ __be32 fqid; /* 24-bit */
+ __be32 tag;
+ struct qm_fd fd;
+ u8 __reserved1[32];
+ } __packed ern;
+ struct {
+ u8 verb;
+ u8 fqs; /* Frame Queue Status */
+ u8 __reserved1[6];
+ __be32 fqid; /* 24-bit */
+ __be32 context_b;
+ u8 __reserved2[48];
+ } __packed fq; /* FQRN/FQRNI/FQRL/FQPN */
+};
#define QM_MR_VERB_VBIT 0x80
-/* The "ern" VERB bits match QM_EQCR_VERB_*** so aren't reproduced here. ERNs
- * originating from direct-connect portals ("dcern") use 0x20 as a verb which
- * would be invalid as a s/w enqueue verb. A s/w ERN can be distinguished from
- * the other MR types by noting if the 0x20 bit is unset. */
+/*
+ * ERNs originating from direct-connect portals ("dcern") use 0x20 as a verb
+ * which would be invalid as a s/w enqueue verb. A s/w ERN can be distinguished
+ * from the other MR types by noting if the 0x20 bit is unset.
+ */
#define QM_MR_VERB_TYPE_MASK 0x27
#define QM_MR_VERB_DC_ERN 0x20
#define QM_MR_VERB_FQRN 0x21
@@ -380,146 +318,185 @@ struct qm_mr_entry {
#define QM_MR_RC_ORP_ZERO 0x70
#define QM_MR_FQS_ORLPRESENT 0x02 /* ORL fragments to come */
#define QM_MR_FQS_NOTEMPTY 0x01 /* FQ has enqueued frames */
-#define QM_MR_DCERN_COLOUR_GREEN 0x00
-#define QM_MR_DCERN_COLOUR_YELLOW 0x01
-#define QM_MR_DCERN_COLOUR_RED 0x02
-#define QM_MR_DCERN_COLOUR_OVERRIDE 0x03
-/* An identical structure of FQD fields is present in the "Init FQ" command and
+/*
+ * An identical structure of FQD fields is present in the "Init FQ" command and
* the "Query FQ" result, it's suctioned out into the "struct qm_fqd" type.
* Within that, the 'stashing' and 'taildrop' pieces are also factored out, the
* latter has two inlines to assist with converting to/from the mant+exp
- * representation. */
+ * representation.
+ */
struct qm_fqd_stashing {
/* See QM_STASHING_EXCL_<...> */
u8 exclusive;
- u8 __reserved1:2;
/* Numbers of cachelines */
- u8 annotation_cl:2;
- u8 data_cl:2;
- u8 context_cl:2;
-} __packed;
-struct qm_fqd_taildrop {
- u16 __reserved1:3;
- u16 mant:8;
- u16 exp:5;
-} __packed;
+ u8 cl; /* _res[6-7], as[4-5], ds[2-3], cs[0-1] */
+};
+
struct qm_fqd_oac {
- /* See QM_OAC_<...> */
- u8 oac:2; /* "Overhead Accounting Control" */
- u8 __reserved1:6;
+ /* "Overhead Accounting Control", see QM_OAC_<...> */
+ u8 oac; /* oac[6-7], _res[0-5] */
/* Two's-complement value (-128 to +127) */
- signed char oal; /* "Overhead Accounting Length" */
-} __packed;
+ s8 oal; /* "Overhead Accounting Length" */
+};
+
struct qm_fqd {
- union {
- u8 orpc;
- struct {
- u8 __reserved1:2;
- u8 orprws:3;
- u8 oa:1;
- u8 olws:2;
- } __packed;
- };
+ /* _res[6-7], orprws[3-5], oa[2], olws[0-1] */
+ u8 orpc;
u8 cgid;
- u16 fq_ctrl; /* See QM_FQCTRL_<...> */
- union {
- u16 dest_wq;
- struct {
- u16 channel:13; /* qm_channel */
- u16 wq:3;
- } __packed dest;
- };
- u16 __reserved2:1;
- u16 ics_cred:15;
- /* For "Initialize Frame Queue" commands, the write-enable mask
+ __be16 fq_ctrl; /* See QM_FQCTRL_<...> */
+ __be16 dest_wq; /* channel[3-15], wq[0-2] */
+ __be16 ics_cred; /* 15-bit */
+ /*
+ * For "Initialize Frame Queue" commands, the write-enable mask
* determines whether 'td' or 'oac_init' is observed. For query
* commands, this field is always 'td', and 'oac_query' (below) reflects
- * the Overhead ACcounting values. */
+ * the Overhead ACcounting values.
+ */
union {
- struct qm_fqd_taildrop td;
+ __be16 td; /* "Taildrop": _res[13-15], mant[5-12], exp[0-4] */
struct qm_fqd_oac oac_init;
};
- u32 context_b;
+ __be32 context_b;
union {
/* Treat it as 64-bit opaque */
- u64 opaque;
+ __be64 opaque;
struct {
- u32 hi;
- u32 lo;
+ __be32 hi;
+ __be32 lo;
};
/* Treat it as s/w portal stashing config */
- /* See 1.5.6.7.1: "FQD Context_A field used for [...] */
+ /* see "FQD Context_A field used for [...]" */
struct {
struct qm_fqd_stashing stashing;
- /* 48-bit address of FQ context to
- * stash, must be cacheline-aligned */
- u16 context_hi;
- u32 context_lo;
+ /*
+ * 48-bit address of FQ context to
+ * stash, must be cacheline-aligned
+ */
+ __be16 context_hi;
+ __be32 context_lo;
} __packed;
} context_a;
struct qm_fqd_oac oac_query;
} __packed;
+
+#define QM_FQD_CHAN_OFF 3
+#define QM_FQD_WQ_MASK GENMASK(2, 0)
+#define QM_FQD_TD_EXP_MASK GENMASK(4, 0)
+#define QM_FQD_TD_MANT_OFF 5
+#define QM_FQD_TD_MANT_MASK GENMASK(12, 5)
+#define QM_FQD_TD_MAX 0xe0000000
+#define QM_FQD_TD_MANT_MAX 0xff
+#define QM_FQD_OAC_OFF 6
+#define QM_FQD_AS_OFF 4
+#define QM_FQD_DS_OFF 2
+#define QM_FQD_XS_MASK 0x3
+
/* 64-bit converters for context_hi/lo */
static inline u64 qm_fqd_stashing_get64(const struct qm_fqd *fqd)
{
- return ((u64)fqd->context_a.context_hi << 32) |
- (u64)fqd->context_a.context_lo;
+ return be64_to_cpu(fqd->context_a.opaque) & 0xffffffffffffULL;
}
+
static inline dma_addr_t qm_fqd_stashing_addr(const struct qm_fqd *fqd)
{
- return (dma_addr_t)qm_fqd_stashing_get64(fqd);
+ return be64_to_cpu(fqd->context_a.opaque) & 0xffffffffffffULL;
}
+
static inline u64 qm_fqd_context_a_get64(const struct qm_fqd *fqd)
{
- return ((u64)fqd->context_a.hi << 32) |
- (u64)fqd->context_a.lo;
+ return qm_fqd_stashing_get64(fqd);
+}
+
+static inline void qm_fqd_stashing_set64(struct qm_fqd *fqd, u64 addr)
+{
+ fqd->context_a.context_hi = cpu_to_be16(upper_32_bits(addr));
+ fqd->context_a.context_lo = cpu_to_be32(lower_32_bits(addr));
}
-/* Macro, so we compile better when 'v' isn't necessarily 64-bit */
-#define qm_fqd_stashing_set64(fqd, v) \
- do { \
- struct qm_fqd *__fqd931 = (fqd); \
- __fqd931->context_a.context_hi = upper_32_bits(v); \
- __fqd931->context_a.context_lo = lower_32_bits(v); \
- } while (0)
-#define qm_fqd_context_a_set64(fqd, v) \
- do { \
- struct qm_fqd *__fqd931 = (fqd); \
- __fqd931->context_a.hi = upper_32_bits(v); \
- __fqd931->context_a.lo = lower_32_bits(v); \
- } while (0)
+
+static inline void qm_fqd_context_a_set64(struct qm_fqd *fqd, u64 addr)
+{
+ fqd->context_a.hi = cpu_to_be32(upper_32_bits(addr));
+ fqd->context_a.lo = cpu_to_be32(lower_32_bits(addr));
+}
+
/* convert a threshold value into mant+exp representation */
-static inline int qm_fqd_taildrop_set(struct qm_fqd_taildrop *td, u32 val,
- int roundup)
+static inline int qm_fqd_set_taildrop(struct qm_fqd *fqd, u32 val,
+ int roundup)
{
u32 e = 0;
- int oddbit = 0;
+ int td, oddbit = 0;
- if (val > 0xe0000000)
+ if (val > QM_FQD_TD_MAX)
return -ERANGE;
- while (val > 0xff) {
+
+ while (val > QM_FQD_TD_MANT_MAX) {
oddbit = val & 1;
val >>= 1;
e++;
if (roundup && oddbit)
val++;
}
- td->exp = e;
- td->mant = val;
+
+ td = (val << QM_FQD_TD_MANT_OFF) & QM_FQD_TD_MANT_MASK;
+ td |= (e & QM_FQD_TD_EXP_MASK);
+ fqd->td = cpu_to_be16(td);
return 0;
}
/* and the other direction */
-static inline u32 qm_fqd_taildrop_get(const struct qm_fqd_taildrop *td)
+static inline int qm_fqd_get_taildrop(const struct qm_fqd *fqd)
+{
+ int td = be16_to_cpu(fqd->td);
+
+ return ((td & QM_FQD_TD_MANT_MASK) >> QM_FQD_TD_MANT_OFF)
+ << (td & QM_FQD_TD_EXP_MASK);
+}
+
+static inline void qm_fqd_set_stashing(struct qm_fqd *fqd, u8 as, u8 ds, u8 cs)
+{
+ struct qm_fqd_stashing *st = &fqd->context_a.stashing;
+
+ st->cl = ((as & QM_FQD_XS_MASK) << QM_FQD_AS_OFF) |
+ ((ds & QM_FQD_XS_MASK) << QM_FQD_DS_OFF) |
+ (cs & QM_FQD_XS_MASK);
+}
+
+static inline u8 qm_fqd_get_stashing(const struct qm_fqd *fqd)
+{
+ return fqd->context_a.stashing.cl;
+}
+
+static inline void qm_fqd_set_oac(struct qm_fqd *fqd, u8 val)
+{
+ fqd->oac_init.oac = val << QM_FQD_OAC_OFF;
+}
+
+static inline void qm_fqd_set_oal(struct qm_fqd *fqd, s8 val)
+{
+ fqd->oac_init.oal = val;
+}
+
+static inline void qm_fqd_set_destwq(struct qm_fqd *fqd, int ch, int wq)
+{
+ fqd->dest_wq = cpu_to_be16((ch << QM_FQD_CHAN_OFF) |
+ (wq & QM_FQD_WQ_MASK));
+}
+
+static inline int qm_fqd_get_chan(const struct qm_fqd *fqd)
+{
+ return be16_to_cpu(fqd->dest_wq) >> QM_FQD_CHAN_OFF;
+}
+
+static inline int qm_fqd_get_wq(const struct qm_fqd *fqd)
{
- return (u32)td->mant << td->exp;
+ return be16_to_cpu(fqd->dest_wq) & QM_FQD_WQ_MASK;
}
-/* See 1.5.2.2: "Frame Queue Descriptor (FQD)" */
+/* See "Frame Queue Descriptor (FQD)" */
/* Frame Queue Descriptor (FQD) field 'fq_ctrl' uses these constants */
#define QM_FQCTRL_MASK 0x07ff /* 'fq_ctrl' flags; */
#define QM_FQCTRL_CGE 0x0400 /* Congestion Group Enable */
#define QM_FQCTRL_TDE 0x0200 /* Tail-Drop Enable */
-#define QM_FQCTRL_ORP 0x0100 /* ORP Enable */
#define QM_FQCTRL_CTXASTASHING 0x0080 /* Context-A stashing */
#define QM_FQCTRL_CPCSTASH 0x0040 /* CPC Stash Enable */
#define QM_FQCTRL_FORCESFDR 0x0008 /* High-priority SFDRs */
@@ -528,19 +505,19 @@ static inline u32 qm_fqd_taildrop_get(const struct qm_fqd_taildrop *td)
#define QM_FQCTRL_PREFERINCACHE 0x0001 /* Aggressively cache FQD */
#define QM_FQCTRL_LOCKINCACHE QM_FQCTRL_PREFERINCACHE /* older naming */
-/* See 1.5.6.7.1: "FQD Context_A field used for [...] */
+/* See "FQD Context_A field used for [...] */
/* Frame Queue Descriptor (FQD) field 'CONTEXT_A' uses these constants */
#define QM_STASHING_EXCL_ANNOTATION 0x04
#define QM_STASHING_EXCL_DATA 0x02
#define QM_STASHING_EXCL_CTX 0x01
-/* See 1.5.5.3: "Intra Class Scheduling" */
+/* See "Intra Class Scheduling" */
/* FQD field 'OAC' (Overhead ACcounting) uses these constants */
#define QM_OAC_ICS 0x2 /* Accounting for Intra-Class Scheduling */
#define QM_OAC_CG 0x1 /* Accounting for Congestion Groups */
-/* See 1.5.8.4: "FQ State Change Notification" */
-/* This struct represents the 32-bit "WR_PARM_[GYR]" parameters in CGR fields
+/*
+ * This struct represents the 32-bit "WR_PARM_[GYR]" parameters in CGR fields
* and associated commands/responses. The WRED parameters are calculated from
* these fields as follows;
* MaxTH = MA * (2 ^ Mn)
@@ -548,31 +525,25 @@ static inline u32 qm_fqd_taildrop_get(const struct qm_fqd_taildrop *td)
* MaxP = 4 * (Pn + 1)
*/
struct qm_cgr_wr_parm {
- union {
- u32 word;
- struct {
- u32 MA:8;
- u32 Mn:5;
- u32 SA:7; /* must be between 64-127 */
- u32 Sn:6;
- u32 Pn:6;
- } __packed;
- };
-} __packed;
-/* This struct represents the 13-bit "CS_THRES" CGR field. In the corresponding
+ /* MA[24-31], Mn[19-23], SA[12-18], Sn[6-11], Pn[0-5] */
+ __be32 word;
+};
+/*
+ * This struct represents the 13-bit "CS_THRES" CGR field. In the corresponding
* management commands, this is padded to a 16-bit structure field, so that's
* how we represent it here. The congestion state threshold is calculated from
* these fields as follows;
* CS threshold = TA * (2 ^ Tn)
*/
struct qm_cgr_cs_thres {
- u16 __reserved:3;
- u16 TA:8;
- u16 Tn:5;
-} __packed;
-/* This identical structure of CGR fields is present in the "Init/Modify CGR"
+ /* _res[13-15], TA[5-12], Tn[0-4] */
+ __be16 word;
+};
+/*
+ * This identical structure of CGR fields is present in the "Init/Modify CGR"
* commands and the "Query CGR" result. It's suctioned out here into its own
- * struct. */
+ * struct.
+ */
struct __qm_mc_cgr {
struct qm_cgr_wr_parm wr_parm_g;
struct qm_cgr_wr_parm wr_parm_y;
@@ -583,10 +554,10 @@ struct __qm_mc_cgr {
u8 cscn_en; /* boolean, use QM_CGR_EN */
union {
struct {
- u16 cscn_targ_upd_ctrl; /* use QM_CSCN_TARG_UDP_ */
- u16 cscn_targ_dcp_low; /* CSCN_TARG_DCP low-16bits */
+ __be16 cscn_targ_upd_ctrl; /* use QM_CGR_TARG_UDP_* */
+ __be16 cscn_targ_dcp_low;
};
- u32 cscn_targ; /* use QM_CGR_TARG_* */
+ __be32 cscn_targ; /* use QM_CGR_TARG_* */
};
u8 cstd_en; /* boolean, use QM_CGR_EN */
u8 cs; /* boolean, only used in query response */
@@ -602,8 +573,11 @@ struct __qm_mc_cgr {
/* Convert CGR thresholds to/from "cs_thres" format */
static inline u64 qm_cgr_cs_thres_get64(const struct qm_cgr_cs_thres *th)
{
- return (u64)th->TA << th->Tn;
+ int thres = be16_to_cpu(th->word);
+
+ return ((thres >> 5) & 0xff) << (thres & 0x1f);
}
+
static inline int qm_cgr_cs_thres_set64(struct qm_cgr_cs_thres *th, u64 val,
int roundup)
{
@@ -617,116 +591,29 @@ static inline int qm_cgr_cs_thres_set64(struct qm_cgr_cs_thres *th, u64 val,
if (roundup && oddbit)
val++;
}
- th->Tn = e;
- th->TA = val;
+ th->word = cpu_to_be16(((val & 0xff) << 5) | (e & 0x1f));
return 0;
}
-/* See 1.5.8.5.1: "Initialize FQ" */
-/* See 1.5.8.5.2: "Query FQ" */
-/* See 1.5.8.5.3: "Query FQ Non-Programmable Fields" */
-/* See 1.5.8.5.4: "Alter FQ State Commands " */
-/* See 1.5.8.6.1: "Initialize/Modify CGR" */
-/* See 1.5.8.6.2: "CGR Test Write" */
-/* See 1.5.8.6.3: "Query CGR" */
-/* See 1.5.8.6.4: "Query Congestion Group State" */
+/* "Initialize FQ" */
struct qm_mcc_initfq {
- u8 __reserved1;
- u16 we_mask; /* Write Enable Mask */
- u32 fqid; /* 24-bit */
- u16 count; /* Initialises 'count+1' FQDs */
+ u8 __reserved1[2];
+ __be16 we_mask; /* Write Enable Mask */
+ __be32 fqid; /* 24-bit */
+ __be16 count; /* Initialises 'count+1' FQDs */
struct qm_fqd fqd; /* the FQD fields go here */
- u8 __reserved3[30];
-} __packed;
-struct qm_mcc_queryfq {
- u8 __reserved1[3];
- u32 fqid; /* 24-bit */
- u8 __reserved2[56];
-} __packed;
-struct qm_mcc_queryfq_np {
- u8 __reserved1[3];
- u32 fqid; /* 24-bit */
- u8 __reserved2[56];
-} __packed;
-struct qm_mcc_alterfq {
- u8 __reserved1[3];
- u32 fqid; /* 24-bit */
- u8 __reserved2;
- u8 count; /* number of consecutive FQID */
- u8 __reserved3[10];
- u32 context_b; /* frame queue context b */
- u8 __reserved4[40];
+ u8 __reserved2[30];
} __packed;
+/* "Initialize/Modify CGR" */
struct qm_mcc_initcgr {
- u8 __reserved1;
- u16 we_mask; /* Write Enable Mask */
+ u8 __reserve1[2];
+ __be16 we_mask; /* Write Enable Mask */
struct __qm_mc_cgr cgr; /* CGR fields */
u8 __reserved2[2];
u8 cgid;
- u8 __reserved4[32];
-} __packed;
-struct qm_mcc_cgrtestwrite {
- u8 __reserved1[2];
- u8 i_bcnt_hi:8;/* high 8-bits of 40-bit "Instant" */
- u32 i_bcnt_lo; /* low 32-bits of 40-bit */
- u8 __reserved2[23];
- u8 cgid;
u8 __reserved3[32];
} __packed;
-struct qm_mcc_querycgr {
- u8 __reserved1[30];
- u8 cgid;
- u8 __reserved2[32];
-} __packed;
-struct qm_mcc_querycongestion {
- u8 __reserved[63];
-} __packed;
-struct qm_mcc_querywq {
- u8 __reserved;
- /* select channel if verb != QUERYWQ_DEDICATED */
- union {
- u16 channel_wq; /* ignores wq (3 lsbits) */
- struct {
- u16 id:13; /* qm_channel */
- u16 __reserved1:3;
- } __packed channel;
- };
- u8 __reserved2[60];
-} __packed;
-struct qm_mc_command {
- u8 __dont_write_directly__verb;
- union {
- struct qm_mcc_initfq initfq;
- struct qm_mcc_queryfq queryfq;
- struct qm_mcc_queryfq_np queryfq_np;
- struct qm_mcc_alterfq alterfq;
- struct qm_mcc_initcgr initcgr;
- struct qm_mcc_cgrtestwrite cgrtestwrite;
- struct qm_mcc_querycgr querycgr;
- struct qm_mcc_querycongestion querycongestion;
- struct qm_mcc_querywq querywq;
- };
-} __packed;
-#define QM_MCC_VERB_VBIT 0x80
-#define QM_MCC_VERB_MASK 0x7f /* where the verb contains; */
-#define QM_MCC_VERB_INITFQ_PARKED 0x40
-#define QM_MCC_VERB_INITFQ_SCHED 0x41
-#define QM_MCC_VERB_QUERYFQ 0x44
-#define QM_MCC_VERB_QUERYFQ_NP 0x45 /* "non-programmable" fields */
-#define QM_MCC_VERB_QUERYWQ 0x46
-#define QM_MCC_VERB_QUERYWQ_DEDICATED 0x47
-#define QM_MCC_VERB_ALTER_SCHED 0x48 /* Schedule FQ */
-#define QM_MCC_VERB_ALTER_FE 0x49 /* Force Eligible FQ */
-#define QM_MCC_VERB_ALTER_RETIRE 0x4a /* Retire FQ */
-#define QM_MCC_VERB_ALTER_OOS 0x4b /* Take FQ out of service */
-#define QM_MCC_VERB_ALTER_FQXON 0x4d /* FQ XON */
-#define QM_MCC_VERB_ALTER_FQXOFF 0x4e /* FQ XOFF */
-#define QM_MCC_VERB_INITCGR 0x50
-#define QM_MCC_VERB_MODIFYCGR 0x51
-#define QM_MCC_VERB_CGRTESTWRITE 0x52
-#define QM_MCC_VERB_QUERYCGR 0x58
-#define QM_MCC_VERB_QUERYCONGESTION 0x59
/* INITFQ-specific flags */
#define QM_INITFQ_WE_MASK 0x01ff /* 'Write Enable' flags; */
#define QM_INITFQ_WE_OAC 0x0100
@@ -752,293 +639,45 @@ struct qm_mc_command {
#define QM_CGR_WE_CS_THRES 0x0002
#define QM_CGR_WE_MODE 0x0001
-/* See 1.5.8.5.1: "Initialize FQ" */
-/* See 1.5.8.5.2: "Query FQ" */
-/* See 1.5.8.5.3: "Query FQ Non-Programmable Fields" */
-/* See 1.5.8.5.4: "Alter FQ State Commands " */
-/* See 1.5.8.6.1: "Initialize/Modify CGR" */
-/* See 1.5.8.6.2: "CGR Test Write" */
-/* See 1.5.8.6.3: "Query CGR" */
-/* See 1.5.8.6.4: "Query Congestion Group State" */
-struct qm_mcr_initfq {
- u8 __reserved1[62];
-} __packed;
-struct qm_mcr_queryfq {
- u8 __reserved1[8];
- struct qm_fqd fqd; /* the FQD fields are here */
- u8 __reserved2[30];
-} __packed;
-struct qm_mcr_queryfq_np {
- u8 __reserved1;
- u8 state; /* QM_MCR_NP_STATE_*** */
- u8 __reserved2;
- u32 fqd_link:24;
- u16 __reserved3:2;
- u16 odp_seq:14;
- u16 __reserved4:2;
- u16 orp_nesn:14;
- u16 __reserved5:1;
- u16 orp_ea_hseq:15;
- u16 __reserved6:1;
- u16 orp_ea_tseq:15;
- u8 __reserved7;
- u32 orp_ea_hptr:24;
- u8 __reserved8;
- u32 orp_ea_tptr:24;
- u8 __reserved9;
- u32 pfdr_hptr:24;
- u8 __reserved10;
- u32 pfdr_tptr:24;
- u8 __reserved11[5];
- u8 __reserved12:7;
- u8 is:1;
- u16 ics_surp;
- u32 byte_cnt;
- u8 __reserved13;
- u32 frm_cnt:24;
- u32 __reserved14;
- u16 ra1_sfdr; /* QM_MCR_NP_RA1_*** */
- u16 ra2_sfdr; /* QM_MCR_NP_RA2_*** */
- u16 __reserved15;
- u16 od1_sfdr; /* QM_MCR_NP_OD1_*** */
- u16 od2_sfdr; /* QM_MCR_NP_OD2_*** */
- u16 od3_sfdr; /* QM_MCR_NP_OD3_*** */
-} __packed;
-struct qm_mcr_alterfq {
- u8 fqs; /* Frame Queue Status */
- u8 __reserved1[61];
-} __packed;
-struct qm_mcr_initcgr {
- u8 __reserved1[62];
-} __packed;
-struct qm_mcr_cgrtestwrite {
- u16 __reserved1;
- struct __qm_mc_cgr cgr; /* CGR fields */
- u8 __reserved2[3];
- u32 __reserved3:24;
- u32 i_bcnt_hi:8;/* high 8-bits of 40-bit "Instant" */
- u32 i_bcnt_lo; /* low 32-bits of 40-bit */
- u32 __reserved4:24;
- u32 a_bcnt_hi:8;/* high 8-bits of 40-bit "Average" */
- u32 a_bcnt_lo; /* low 32-bits of 40-bit */
- u16 lgt; /* Last Group Tick */
- u16 wr_prob_g;
- u16 wr_prob_y;
- u16 wr_prob_r;
- u8 __reserved5[8];
-} __packed;
-struct qm_mcr_querycgr {
- u16 __reserved1;
- struct __qm_mc_cgr cgr; /* CGR fields */
- u8 __reserved2[3];
- u32 __reserved3:24;
- u32 i_bcnt_hi:8;/* high 8-bits of 40-bit "Instant" */
- u32 i_bcnt_lo; /* low 32-bits of 40-bit */
- u32 __reserved4:24;
- u32 a_bcnt_hi:8;/* high 8-bits of 40-bit "Average" */
- u32 a_bcnt_lo; /* low 32-bits of 40-bit */
- union {
- u32 cscn_targ_swp[4];
- u8 __reserved5[16];
- };
-} __packed;
-static inline u64 qm_mcr_querycgr_i_get64(const struct qm_mcr_querycgr *q)
-{
- return ((u64)q->i_bcnt_hi << 32) | (u64)q->i_bcnt_lo;
-}
-static inline u64 qm_mcr_querycgr_a_get64(const struct qm_mcr_querycgr *q)
-{
- return ((u64)q->a_bcnt_hi << 32) | (u64)q->a_bcnt_lo;
-}
-static inline u64 qm_mcr_cgrtestwrite_i_get64(
- const struct qm_mcr_cgrtestwrite *q)
-{
- return ((u64)q->i_bcnt_hi << 32) | (u64)q->i_bcnt_lo;
-}
-static inline u64 qm_mcr_cgrtestwrite_a_get64(
- const struct qm_mcr_cgrtestwrite *q)
-{
- return ((u64)q->a_bcnt_hi << 32) | (u64)q->a_bcnt_lo;
-}
-/* Macro, so we compile better if 'v' isn't always 64-bit */
-#define qm_mcr_querycgr_i_set64(q, v) \
- do { \
- struct qm_mcr_querycgr *__q931 = (fd); \
- __q931->i_bcnt_hi = upper_32_bits(v); \
- __q931->i_bcnt_lo = lower_32_bits(v); \
- } while (0)
-#define qm_mcr_querycgr_a_set64(q, v) \
- do { \
- struct qm_mcr_querycgr *__q931 = (fd); \
- __q931->a_bcnt_hi = upper_32_bits(v); \
- __q931->a_bcnt_lo = lower_32_bits(v); \
- } while (0)
-struct __qm_mcr_querycongestion {
- u32 __state[8];
-};
-struct qm_mcr_querycongestion {
- u8 __reserved[30];
- /* Access this struct using QM_MCR_QUERYCONGESTION() */
- struct __qm_mcr_querycongestion state;
-} __packed;
-struct qm_mcr_querywq {
- union {
- u16 channel_wq; /* ignores wq (3 lsbits) */
- struct {
- u16 id:13; /* qm_channel */
- u16 __reserved:3;
- } __packed channel;
- };
- u8 __reserved[28];
- u32 wq_len[8];
-} __packed;
-
-struct qm_mc_result {
- u8 verb;
- u8 result;
- union {
- struct qm_mcr_initfq initfq;
- struct qm_mcr_queryfq queryfq;
- struct qm_mcr_queryfq_np queryfq_np;
- struct qm_mcr_alterfq alterfq;
- struct qm_mcr_initcgr initcgr;
- struct qm_mcr_cgrtestwrite cgrtestwrite;
- struct qm_mcr_querycgr querycgr;
- struct qm_mcr_querycongestion querycongestion;
- struct qm_mcr_querywq querywq;
- };
-} __packed;
-
-#define QM_MCR_VERB_RRID 0x80
-#define QM_MCR_VERB_MASK QM_MCC_VERB_MASK
-#define QM_MCR_VERB_INITFQ_PARKED QM_MCC_VERB_INITFQ_PARKED
-#define QM_MCR_VERB_INITFQ_SCHED QM_MCC_VERB_INITFQ_SCHED
-#define QM_MCR_VERB_QUERYFQ QM_MCC_VERB_QUERYFQ
-#define QM_MCR_VERB_QUERYFQ_NP QM_MCC_VERB_QUERYFQ_NP
-#define QM_MCR_VERB_QUERYWQ QM_MCC_VERB_QUERYWQ
-#define QM_MCR_VERB_QUERYWQ_DEDICATED QM_MCC_VERB_QUERYWQ_DEDICATED
-#define QM_MCR_VERB_ALTER_SCHED QM_MCC_VERB_ALTER_SCHED
-#define QM_MCR_VERB_ALTER_FE QM_MCC_VERB_ALTER_FE
-#define QM_MCR_VERB_ALTER_RETIRE QM_MCC_VERB_ALTER_RETIRE
-#define QM_MCR_VERB_ALTER_OOS QM_MCC_VERB_ALTER_OOS
-#define QM_MCR_RESULT_NULL 0x00
-#define QM_MCR_RESULT_OK 0xf0
-#define QM_MCR_RESULT_ERR_FQID 0xf1
-#define QM_MCR_RESULT_ERR_FQSTATE 0xf2
-#define QM_MCR_RESULT_ERR_NOTEMPTY 0xf3 /* OOS fails if FQ is !empty */
-#define QM_MCR_RESULT_ERR_BADCHANNEL 0xf4
-#define QM_MCR_RESULT_PENDING 0xf8
-#define QM_MCR_RESULT_ERR_BADCOMMAND 0xff
-#define QM_MCR_NP_STATE_FE 0x10
-#define QM_MCR_NP_STATE_R 0x08
-#define QM_MCR_NP_STATE_MASK 0x07 /* Reads FQD::STATE; */
-#define QM_MCR_NP_STATE_OOS 0x00
-#define QM_MCR_NP_STATE_RETIRED 0x01
-#define QM_MCR_NP_STATE_TEN_SCHED 0x02
-#define QM_MCR_NP_STATE_TRU_SCHED 0x03
-#define QM_MCR_NP_STATE_PARKED 0x04
-#define QM_MCR_NP_STATE_ACTIVE 0x05
-#define QM_MCR_NP_PTR_MASK 0x07ff /* for RA[12] & OD[123] */
-#define QM_MCR_NP_RA1_NRA(v) (((v) >> 14) & 0x3) /* FQD::NRA */
-#define QM_MCR_NP_RA2_IT(v) (((v) >> 14) & 0x1) /* FQD::IT */
-#define QM_MCR_NP_OD1_NOD(v) (((v) >> 14) & 0x3) /* FQD::NOD */
-#define QM_MCR_NP_OD3_NPC(v) (((v) >> 14) & 0x3) /* FQD::NPC */
-#define QM_MCR_FQS_ORLPRESENT 0x02 /* ORL fragments to come */
-#define QM_MCR_FQS_NOTEMPTY 0x01 /* FQ has enqueued frames */
-/* This extracts the state for congestion group 'n' from a query response.
- * Eg.
- * u8 cgr = [...];
- * struct qm_mc_result *res = [...];
- * printf("congestion group %d congestion state: %d\n", cgr,
- * QM_MCR_QUERYCONGESTION(&res->querycongestion.state, cgr));
- */
-#define __CGR_WORD(num) (num >> 5)
-#define __CGR_SHIFT(num) (num & 0x1f)
-#define __CGR_NUM (sizeof(struct __qm_mcr_querycongestion) << 3)
-static inline int QM_MCR_QUERYCONGESTION(struct __qm_mcr_querycongestion *p,
- u8 cgr)
-{
- return p->__state[__CGR_WORD(cgr)] & (0x80000000 >> __CGR_SHIFT(cgr));
-}
-
-
-/*********************/
-/* Utility interface */
-/*********************/
-
-/* Represents an allocator over a range of FQIDs. NB, accesses are not locked,
- * spinlock them yourself if needed. */
-struct qman_fqid_pool;
-
-/* Create/destroy a FQID pool, num must be a multiple of 32. NB, _destroy()
- * always succeeds, but returns non-zero if there were "leaked" FQID
- * allocations. */
-struct qman_fqid_pool *qman_fqid_pool_create(u32 fqid_start, u32 num);
-int qman_fqid_pool_destroy(struct qman_fqid_pool *pool);
-/* Alloc/free a FQID from the range. _alloc() returns zero for success. */
-int qman_fqid_pool_alloc(struct qman_fqid_pool *pool, u32 *fqid);
-void qman_fqid_pool_free(struct qman_fqid_pool *pool, u32 fqid);
-u32 qman_fqid_pool_used(struct qman_fqid_pool *pool);
-
-/*******************************************************************/
-/* Managed (aka "shared" or "mux/demux") portal, high-level i/face */
-/*******************************************************************/
+#define QMAN_CGR_FLAG_USE_INIT 0x00000001
/* Portal and Frame Queues */
- /* ----------------------- */
/* Represents a managed portal */
struct qman_portal;
-/* This object type represents QMan frame queue descriptors (FQD), it is
+/*
+ * This object type represents QMan frame queue descriptors (FQD), it is
* cacheline-aligned, and initialised by qman_create_fq(). The structure is
- * defined further down. */
+ * defined further down.
+ */
struct qman_fq;
-/* This object type represents a QMan congestion group, it is defined further
- * down. */
+/*
+ * This object type represents a QMan congestion group, it is defined further
+ * down.
+ */
struct qman_cgr;
-struct qman_portal_config {
- /* If the caller enables DQRR stashing (and thus wishes to operate the
- * portal from only one cpu), this is the logical CPU that the portal
- * will stash to. Whether stashing is enabled or not, this setting is
- * also used for any "core-affine" portals, ie. default portals
- * associated to the corresponding cpu. -1 implies that there is no core
- * affinity configured. */
- int cpu;
- /* portal interrupt line */
- int irq;
-#ifndef __rtems__
- /* Is this portal shared? (If so, it has coarser locking and demuxes
- * processing on behalf of other CPUs.) */
- int is_shared;
-#endif /* __rtems__ */
- /* The portal's dedicated channel id, use this value for initialising
- * frame queues to target this portal when scheduled. */
- u16 channel;
- /* A mask of which pool channels this portal has dequeue access to
- * (using QM_SDQCR_CHANNELS_POOL(n) for the bitmask) */
- u32 pools;
-};
-
-/* This enum, and the callback type that returns it, are used when handling
+/*
+ * This enum, and the callback type that returns it, are used when handling
* dequeued frames via DQRR. Note that for "null" callbacks registered with the
- * portal object (for handling dequeues that do not demux because contextB is
- * NULL), the return value *MUST* be qman_cb_dqrr_consume. */
+ * portal object (for handling dequeues that do not demux because context_b is
+ * NULL), the return value *MUST* be qman_cb_dqrr_consume.
+ */
enum qman_cb_dqrr_result {
/* DQRR entry can be consumed */
qman_cb_dqrr_consume,
/* Like _consume, but requests parking - FQ must be held-active */
qman_cb_dqrr_park,
- /* Does not consume, for DCA mode only. This allows out-of-order
- * consumes by explicit calls to qman_dca() and/or the use of implicit
- * DCA via EQCR entries. */
+ /* Does not consume, for DCA mode only. */
qman_cb_dqrr_defer,
- /* Stop processing without consuming this ring entry. Exits the current
- * qman_poll_dqrr() or interrupt-handling, as appropriate. If within an
- * interrupt handler, the callback would typically call
+ /*
+ * Stop processing without consuming this ring entry. Exits the current
+ * qman_p_poll_dqrr() or interrupt-handling, as appropriate. If within
+ * an interrupt handler, the callback would typically call
* qman_irqsource_remove(QM_PIRQ_DQRI) before returning this value,
- * otherwise the interrupt will reassert immediately. */
+ * otherwise the interrupt will reassert immediately.
+ */
qman_cb_dqrr_stop,
/* Like qman_cb_dqrr_stop, but consumes the current entry. */
qman_cb_dqrr_consume_stop
@@ -1047,16 +686,15 @@ typedef enum qman_cb_dqrr_result (*qman_cb_dqrr)(struct qman_portal *qm,
struct qman_fq *fq,
const struct qm_dqrr_entry *dqrr);
-/* This callback type is used when handling ERNs, FQRNs and FQRLs via MR. They
- * are always consumed after the callback returns. */
+/*
+ * This callback type is used when handling ERNs, FQRNs and FQRLs via MR. They
+ * are always consumed after the callback returns.
+ */
typedef void (*qman_cb_mr)(struct qman_portal *qm, struct qman_fq *fq,
- const struct qm_mr_entry *msg);
-
-/* This callback type is used when handling DCP ERNs */
-typedef void (*qman_cb_dc_ern)(struct qman_portal *qm,
- const struct qm_mr_entry *msg);
+ const union qm_mr_entry *msg);
-/* s/w-visible states. Ie. tentatively scheduled + truly scheduled + active +
+/*
+ * s/w-visible states. Ie. tentatively scheduled + truly scheduled + active +
* held-active + held-suspended are just "sched". Things like "retired" will not
* be assumed until it is complete (ie. QMAN_FQ_STATE_CHANGING is set until
* then, to indicate it's completing and to gate attempts to retry the retire
@@ -1065,7 +703,8 @@ typedef void (*qman_cb_dc_ern)(struct qman_portal *qm,
* index rather than the FQ that ring entry corresponds to), so repeated park
* commands are allowed (if you're silly enough to try) but won't change FQ
* state, and the resulting park notifications move FQs from "sched" to
- * "parked". */
+ * "parked".
+ */
enum qman_fq_state {
qman_fq_state_oos,
qman_fq_state_parked,
@@ -1073,7 +712,15 @@ enum qman_fq_state {
qman_fq_state_retired
};
-/* Frame queue objects (struct qman_fq) are stored within memory passed to
+#define QMAN_FQ_STATE_CHANGING 0x80000000 /* 'state' is changing */
+#define QMAN_FQ_STATE_NE 0x40000000 /* retired FQ isn't empty */
+#define QMAN_FQ_STATE_ORL 0x20000000 /* retired FQ has ORL */
+#define QMAN_FQ_STATE_BLOCKOOS 0xe0000000 /* if any are set, no OOS */
+#define QMAN_FQ_STATE_CGR_EN 0x10000000 /* CGR enabled */
+#define QMAN_FQ_STATE_VDQCR 0x08000000 /* being volatile dequeued */
+
+/*
+ * Frame queue objects (struct qman_fq) are stored within memory passed to
* qman_create_fq(), as this allows stashing of caller-provided demux callback
* pointers at no extra cost to stashing of (driver-internal) FQ state. If the
* caller wishes to add per-FQ state and have it benefit from dequeue-stashing,
@@ -1108,24 +755,23 @@ struct qman_fq_cb {
struct qman_fq {
/* Caller of qman_create_fq() provides these demux callbacks */
struct qman_fq_cb cb;
- /* These are internal to the driver, don't touch. In particular, they
+ /*
+ * These are internal to the driver, don't touch. In particular, they
* may change, be removed, or extended (so you shouldn't rely on
- * sizeof(qman_fq) being a constant). */
- spinlock_t fqlock;
- u32 fqid;
- volatile unsigned long flags;
+ * sizeof(qman_fq) being a constant).
+ */
+ u32 fqid, idx;
+ unsigned long flags;
enum qman_fq_state state;
int cgr_groupid;
- struct rb_node node;
-#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP
- u32 key;
-#endif
};
-/* This callback type is used when handling congestion group entry/exit.
- * 'congested' is non-zero on congestion-entry, and zero on congestion-exit. */
+/*
+ * This callback type is used when handling congestion group entry/exit.
+ * 'congested' is non-zero on congestion-entry, and zero on congestion-exit.
+ */
typedef void (*qman_cb_cgr)(struct qman_portal *qm,
- struct qman_cgr *cgr, int congested);
+ struct qman_cgr *cgr, int congested);
struct qman_cgr {
/* Set these prior to qman_create_cgr() */
@@ -1140,111 +786,30 @@ struct qman_cgr {
#define QMAN_FQ_FLAG_NO_ENQUEUE 0x00000001 /* can't enqueue */
#define QMAN_FQ_FLAG_NO_MODIFY 0x00000002 /* can only enqueue */
#define QMAN_FQ_FLAG_TO_DCPORTAL 0x00000004 /* consumed by CAAM/PME/Fman */
-#define QMAN_FQ_FLAG_LOCKED 0x00000008 /* multi-core locking */
-#define QMAN_FQ_FLAG_AS_IS 0x00000010 /* query h/w state */
#define QMAN_FQ_FLAG_DYNAMIC_FQID 0x00000020 /* (de)allocate fqid */
-/* Flags to qman_destroy_fq() */
-#define QMAN_FQ_DESTROY_PARKED 0x00000001 /* FQ can be parked or OOS */
-
-/* Flags from qman_fq_state() */
-#define QMAN_FQ_STATE_CHANGING 0x80000000 /* 'state' is changing */
-#define QMAN_FQ_STATE_NE 0x40000000 /* retired FQ isn't empty */
-#define QMAN_FQ_STATE_ORL 0x20000000 /* retired FQ has ORL */
-#define QMAN_FQ_STATE_BLOCKOOS 0xe0000000 /* if any are set, no OOS */
-#define QMAN_FQ_STATE_CGR_EN 0x10000000 /* CGR enabled */
-#define QMAN_FQ_STATE_VDQCR 0x08000000 /* being volatile dequeued */
-
/* Flags to qman_init_fq() */
#define QMAN_INITFQ_FLAG_SCHED 0x00000001 /* schedule rather than park */
#define QMAN_INITFQ_FLAG_LOCAL 0x00000004 /* set dest portal */
-/* Flags to qman_volatile_dequeue() */
-#ifdef FSL_DPA_CAN_WAIT
-#define QMAN_VOLATILE_FLAG_WAIT 0x00000001 /* wait if VDQCR is in use */
-#ifndef __rtems__
-#define QMAN_VOLATILE_FLAG_WAIT_INT 0x00000002 /* if wait, interruptible? */
-#endif /* __rtems__ */
-#define QMAN_VOLATILE_FLAG_FINISH 0x00000004 /* wait till VDQCR completes */
-#endif
-
-/* Flags to qman_enqueue(). NB, the strange numbering is to align with hardware,
- * bit-wise. (NB: the PME API is sensitive to these precise numberings too, so
- * any change here should be audited in PME.) */
-#ifdef FSL_DPA_CAN_WAIT
-#define QMAN_ENQUEUE_FLAG_WAIT 0x00010000 /* wait if EQCR is full */
-#ifndef __rtems__
-#define QMAN_ENQUEUE_FLAG_WAIT_INT 0x00020000 /* if wait, interruptible? */
-#endif /* __rtems__ */
-#ifdef FSL_DPA_CAN_WAIT_SYNC
-#define QMAN_ENQUEUE_FLAG_WAIT_SYNC 0x00000004 /* if wait, until consumed? */
-#endif
-#endif
-#define QMAN_ENQUEUE_FLAG_WATCH_CGR 0x00080000 /* watch congestion state */
-#define QMAN_ENQUEUE_FLAG_DCA 0x00008000 /* perform enqueue-DCA */
-#define QMAN_ENQUEUE_FLAG_DCA_PARK 0x00004000 /* If DCA, requests park */
-#define QMAN_ENQUEUE_FLAG_DCA_PTR(p) /* If DCA, p is DQRR entry */ \
- (((u32)(p) << 2) & 0x00000f00)
-#define QMAN_ENQUEUE_FLAG_C_GREEN 0x00000000 /* choose one C_*** flag */
-#define QMAN_ENQUEUE_FLAG_C_YELLOW 0x00000008
-#define QMAN_ENQUEUE_FLAG_C_RED 0x00000010
-#define QMAN_ENQUEUE_FLAG_C_OVERRIDE 0x00000018
-/* For the ORP-specific qman_enqueue_orp() variant;
- * - this flag indicates "Not Last In Sequence", ie. all but the final fragment
- * of a frame. */
-#define QMAN_ENQUEUE_FLAG_NLIS 0x01000000
-/* - this flag performs no enqueue but fills in an ORP sequence number that
- * would otherwise block it (eg. if a frame has been dropped). */
-#define QMAN_ENQUEUE_FLAG_HOLE 0x02000000
-/* - this flag performs no enqueue but advances NESN to the given sequence
- * number. */
-#define QMAN_ENQUEUE_FLAG_NESN 0x04000000
-
-/* Flags to qman_modify_cgr() */
-#define QMAN_CGR_FLAG_USE_INIT 0x00000001
-#define QMAN_CGR_MODE_FRAME 0x00000001
-
/* Portal Management */
- /* ----------------- */
/**
- * qman_get_portal_config - get portal configuration settings
- *
- * This returns a read-only view of the current cpu's affine portal settings.
- */
-const struct qman_portal_config *qman_get_portal_config(void);
-
-/**
- * qman_irqsource_get - return the portal work that is interrupt-driven
- *
- * Returns a bitmask of QM_PIRQ_**I processing sources that are currently
- * enabled for interrupt handling on the current cpu's affine portal. These
- * sources will trigger the portal interrupt and the interrupt handler (or a
- * tasklet/bottom-half it defers to) will perform the corresponding processing
- * work. The qman_poll_***() functions will only process sources that are not in
- * this bitmask. If the current CPU is sharing a portal hosted on another CPU,
- * this always returns zero.
- */
-u32 qman_irqsource_get(void);
-
-/**
- * qman_irqsource_add - add processing sources to be interrupt-driven
+ * qman_p_irqsource_add - add processing sources to be interrupt-driven
* @bits: bitmask of QM_PIRQ_**I processing sources
*
* Adds processing sources that should be interrupt-driven (rather than
- * processed via qman_poll_***() functions). Returns zero for success, or
- * -EINVAL if the current CPU is sharing a portal hosted on another CPU.
+ * processed via qman_poll_***() functions).
*/
-int qman_irqsource_add(u32 bits);
+void qman_p_irqsource_add(struct qman_portal *p, u32 bits);
/**
- * qman_irqsource_remove - remove processing sources from being interrupt-driven
+ * qman_p_irqsource_remove - remove processing sources from being int-driven
* @bits: bitmask of QM_PIRQ_**I processing sources
*
* Removes processing sources from being interrupt-driven, so that they will
- * instead be processed via qman_poll_***() functions. Returns zero for success,
- * or -EINVAL if the current CPU is sharing a portal hosted on another CPU.
+ * instead be processed via qman_poll_***() functions.
*/
-int qman_irqsource_remove(u32 bits);
+void qman_p_irqsource_remove(struct qman_portal *p, u32 bits);
#ifndef __rtems__
/**
@@ -1266,145 +831,29 @@ u16 qman_affine_channel(int cpu);
/**
* qman_get_affine_portal - return the portal pointer affine to cpu
* @cpu: the cpu whose affine portal is the subject of the query
- *
*/
-void *qman_get_affine_portal(int cpu);
+struct qman_portal *qman_get_affine_portal(int cpu);
/**
- * qman_poll_dqrr - process DQRR (fast-path) entries
+ * qman_p_poll_dqrr - process DQRR (fast-path) entries
* @limit: the maximum number of DQRR entries to process
*
* Use of this function requires that DQRR processing not be interrupt-driven.
- * Ie. the value returned by qman_irqsource_get() should not include
- * QM_PIRQ_DQRI. If the current CPU is sharing a portal hosted on another CPU,
- * this function will return -EINVAL, otherwise the return value is >=0 and
- * represents the number of DQRR entries processed.
- */
-int qman_poll_dqrr(unsigned int limit);
-
-/**
- * qman_poll_slow - process anything (except DQRR) that isn't interrupt-driven.
- *
- * This function does any portal processing that isn't interrupt-driven. If the
- * current CPU is sharing a portal hosted on another CPU, this function will
- * return (u32)-1, otherwise the return value is a bitmask of QM_PIRQ_* sources
- * indicating what interrupt sources were actually processed by the call.
- */
-u32 qman_poll_slow(void);
-
-/**
- * qman_poll - legacy wrapper for qman_poll_dqrr() and qman_poll_slow()
- *
- * Dispatcher logic on a cpu can use this to trigger any maintenance of the
- * affine portal. There are two classes of portal processing in question;
- * fast-path (which involves demuxing dequeue ring (DQRR) entries and tracking
- * enqueue ring (EQCR) consumption), and slow-path (which involves EQCR
- * thresholds, congestion state changes, etc). This function does whatever
- * processing is not triggered by interrupts.
- *
- * Note, if DQRR and some slow-path processing are poll-driven (rather than
- * interrupt-driven) then this function uses a heuristic to determine how often
- * to run slow-path processing - as slow-path processing introduces at least a
- * minimum latency each time it is run, whereas fast-path (DQRR) processing is
- * close to zero-cost if there is no work to be done. Applications can tune this
- * behaviour themselves by using qman_poll_dqrr() and qman_poll_slow() directly
- * rather than going via this wrapper.
- */
-void qman_poll(void);
-
-/**
- * qman_stop_dequeues - Stop h/w dequeuing to the s/w portal
- *
- * Disables DQRR processing of the portal. This is reference-counted, so
- * qman_start_dequeues() must be called as many times as qman_stop_dequeues() to
- * truly re-enable dequeuing.
- */
-void qman_stop_dequeues(void);
-
-/**
- * qman_start_dequeues - (Re)start h/w dequeuing to the s/w portal
- *
- * Enables DQRR processing of the portal. This is reference-counted, so
- * qman_start_dequeues() must be called as many times as qman_stop_dequeues() to
- * truly re-enable dequeuing.
+ * The return value represents the number of DQRR entries processed.
*/
-void qman_start_dequeues(void);
+int qman_p_poll_dqrr(struct qman_portal *p, unsigned int limit);
/**
- * qman_static_dequeue_add - Add pool channels to the portal SDQCR
+ * qman_p_static_dequeue_add - Add pool channels to the portal SDQCR
* @pools: bit-mask of pool channels, using QM_SDQCR_CHANNELS_POOL(n)
*
* Adds a set of pool channels to the portal's static dequeue command register
* (SDQCR). The requested pools are limited to those the portal has dequeue
* access to.
*/
-void qman_static_dequeue_add(u32 pools);
-
-/**
- * qman_static_dequeue_del - Remove pool channels from the portal SDQCR
- * @pools: bit-mask of pool channels, using QM_SDQCR_CHANNELS_POOL(n)
- *
- * Removes a set of pool channels from the portal's static dequeue command
- * register (SDQCR). The requested pools are limited to those the portal has
- * dequeue access to.
- */
-void qman_static_dequeue_del(u32 pools);
-
-/**
- * qman_static_dequeue_get - return the portal's current SDQCR
- *
- * Returns the portal's current static dequeue command register (SDQCR). The
- * entire register is returned, so if only the currently-enabled pool channels
- * are desired, mask the return value with QM_SDQCR_CHANNELS_POOL_MASK.
- */
-u32 qman_static_dequeue_get(void);
-
-/**
- * qman_dca - Perform a Discrete Consumption Acknowledgment
- * @dq: the DQRR entry to be consumed
- * @park_request: indicates whether the held-active @fq should be parked
- *
- * Only allowed in DCA-mode portals, for DQRR entries whose handler callback had
- * previously returned 'qman_cb_dqrr_defer'. NB, as with the other APIs, this
- * does not take a 'portal' argument but implies the core affine portal from the
- * cpu that is currently executing the function. For reasons of locking, this
- * function must be called from the same CPU as that which processed the DQRR
- * entry in the first place.
- */
-void qman_dca(struct qm_dqrr_entry *dq, int park_request);
-
-/**
- * qman_eqcr_is_empty - Determine if portal's EQCR is empty
- *
- * For use in situations where a cpu-affine caller needs to determine when all
- * enqueues for the local portal have been processed by QMan but can't use the
- * QMAN_ENQUEUE_FLAG_WAIT_SYNC flag to do this from the final qman_enqueue().
- * The function forces tracking of EQCR consumption (which normally doesn't
- * happen until enqueue processing needs to find space to put new enqueue
- * commands), and returns zero if the ring still has unprocessed entries,
- * non-zero if it is empty.
- */
-int qman_eqcr_is_empty(void);
-
-/**
- * qman_set_dc_ern - Set the handler for DCP enqueue rejection notifications
- * @handler: callback for processing DCP ERNs
- * @affine: whether this handler is specific to the locally affine portal
- *
- * If a hardware block's interface to QMan (ie. its direct-connect portal, or
- * DCP) is configured not to receive enqueue rejections, then any enqueues
- * through that DCP that are rejected will be sent to a given software portal.
- * If @affine is non-zero, then this handler will only be used for DCP ERNs
- * received on the portal affine to the current CPU. If multiple CPUs share a
- * portal and they all call this function, they will be setting the handler for
- * the same portal! If @affine is zero, then this handler will be global to all
- * portals handled by this instance of the driver. Only those portals that do
- * not have their own affine handler will use the global handler.
- */
-void qman_set_dc_ern(qman_cb_dc_ern handler, int affine);
+void qman_p_static_dequeue_add(struct qman_portal *p, u32 pools);
/* FQ management */
- /* ------------- */
/**
* qman_create_fq - Allocates a FQ
* @fqid: the index of the FQD to encapsulate, must be "Out of Service"
@@ -1419,28 +868,23 @@ void qman_set_dc_ern(qman_cb_dc_ern handler, int affine);
* qman_fq" for more info). NO_MODIFY is only intended for enqueuing to
* pre-existing frame-queues that aren't to be otherwise interfered with, it
* prevents all other modifications to the frame queue. The TO_DCPORTAL flag
- * causes the driver to honour any contextB modifications requested in the
+ * causes the driver to honour any context_b modifications requested in the
* qm_init_fq() API, as this indicates the frame queue will be consumed by a
* direct-connect portal (PME, CAAM, or Fman). When frame queues are consumed by
- * software portals, the contextB field is controlled by the driver and can't be
- * modified by the caller. If the AS_IS flag is specified, management commands
- * will be used on portal @p to query state for frame queue @fqid and construct
- * a frame queue object based on that, rather than assuming/requiring that it be
- * Out of Service.
+ * software portals, the context_b field is controlled by the driver and can't
+ * be modified by the caller.
*/
int qman_create_fq(u32 fqid, u32 flags, struct qman_fq *fq);
/**
* qman_destroy_fq - Deallocates a FQ
* @fq: the frame queue object to release
- * @flags: bit-mask of QMAN_FQ_FREE_*** options
*
* The memory for this frame queue object ('fq' provided in qman_create_fq()) is
* not deallocated but the caller regains ownership, to do with as desired. The
- * FQ must be in the 'out-of-service' state unless the QMAN_FQ_FREE_PARKED flag
- * is specified, in which case it may also be in the 'parked' state.
+ * FQ must be in the 'out-of-service' or in the 'parked' state.
*/
-void qman_destroy_fq(struct qman_fq *fq, u32 flags);
+void qman_destroy_fq(struct qman_fq *fq);
/**
* qman_fq_fqid - Queries the frame queue ID of a FQ object
@@ -1449,18 +893,6 @@ void qman_destroy_fq(struct qman_fq *fq, u32 flags);
u32 qman_fq_fqid(struct qman_fq *fq);
/**
- * qman_fq_state - Queries the state of a FQ object
- * @fq: the frame queue object to query
- * @state: pointer to state enum to return the FQ scheduling state
- * @flags: pointer to state flags to receive QMAN_FQ_STATE_*** bitmask
- *
- * Queries the state of the FQ object, without performing any h/w commands.
- * This captures the state, as seen by the driver, at the time the function
- * executes.
- */
-void qman_fq_state(struct qman_fq *fq, enum qman_fq_state *state, u32 *flags);
-
-/**
* qman_init_fq - Initialises FQ fields, leaves the FQ "parked" or "scheduled"
* @fq: the frame queue object to modify, must be 'parked' or new.
* @flags: bit-mask of QMAN_INITFQ_FLAG_*** options
@@ -1508,7 +940,7 @@ int qman_schedule_fq(struct qman_fq *fq);
/**
* qman_retire_fq - Retires a FQ
* @fq: the frame queue object to retire
- * @flags: FQ flags (as per qman_fq_state) if retirement completes immediately
+ * @flags: FQ flags (QMAN_FQ_STATE*) if retirement completes immediately
*
* Retires the frame queue. This returns zero if it succeeds immediately, +1 if
* the retirement was started asynchronously, otherwise it returns negative for
@@ -1535,249 +967,58 @@ int qman_retire_fq(struct qman_fq *fq, u32 *flags);
int qman_oos_fq(struct qman_fq *fq);
/**
- * qman_fq_flow_control - Set the XON/XOFF state of a FQ
- * @fq: the frame queue object to be set to XON/XOFF state, must not be 'oos',
- * or 'retired' or 'parked' state
- * @xon: boolean to set fq in XON or XOFF state
- *
- * The frame should be in Tentatively Scheduled state or Truly Schedule sate,
- * otherwise the IFSI interrupt will be asserted.
- */
-int qman_fq_flow_control(struct qman_fq *fq, int xon);
-
-/**
- * qman_query_fq - Queries FQD fields (via h/w query command)
- * @fq: the frame queue object to be queried
- * @fqd: storage for the queried FQD fields
- */
-int qman_query_fq(struct qman_fq *fq, struct qm_fqd *fqd);
-
-/**
- * qman_query_fq_np - Queries non-programmable FQD fields
- * @fq: the frame queue object to be queried
- * @np: storage for the queried FQD fields
- */
-int qman_query_fq_np(struct qman_fq *fq, struct qm_mcr_queryfq_np *np);
-
-/**
- * qman_query_wq - Queries work queue lengths
- * @query_dedicated: If non-zero, query length of WQs in the channel dedicated
- * to this software portal. Otherwise, query length of WQs in a
- * channel specified in wq.
- * @wq: storage for the queried WQs lengths. Also specified the channel to
- * to query if query_dedicated is zero.
- */
-int qman_query_wq(u8 query_dedicated, struct qm_mcr_querywq *wq);
-
-/**
- * qman_volatile_dequeue - Issue a volatile dequeue command
- * @fq: the frame queue object to dequeue from
- * @flags: a bit-mask of QMAN_VOLATILE_FLAG_*** options
- * @vdqcr: bit mask of QM_VDQCR_*** options, as per qm_dqrr_vdqcr_set()
- *
- * Attempts to lock access to the portal's VDQCR volatile dequeue functionality.
- * The function will block and sleep if QMAN_VOLATILE_FLAG_WAIT is specified and
- * the VDQCR is already in use, otherwise returns non-zero for failure. If
- * QMAN_VOLATILE_FLAG_FINISH is specified, the function will only return once
- * the VDQCR command has finished executing (ie. once the callback for the last
- * DQRR entry resulting from the VDQCR command has been called). If not using
- * the FINISH flag, completion can be determined either by detecting the
- * presence of the QM_DQRR_STAT_UNSCHEDULED and QM_DQRR_STAT_DQCR_EXPIRED bits
- * in the "stat" field of the "struct qm_dqrr_entry" passed to the FQ's dequeue
- * callback, or by waiting for the QMAN_FQ_STATE_VDQCR bit to disappear from the
- * "flags" retrieved from qman_fq_state().
- */
-int qman_volatile_dequeue(struct qman_fq *fq, u32 flags, u32 vdqcr);
-
-/**
* qman_enqueue - Enqueue a frame to a frame queue
* @fq: the frame queue object to enqueue to
* @fd: a descriptor of the frame to be enqueued
- * @flags: bit-mask of QMAN_ENQUEUE_FLAG_*** options
*
* Fills an entry in the EQCR of portal @qm to enqueue the frame described by
* @fd. The descriptor details are copied from @fd to the EQCR entry, the 'pid'
- * field is ignored. The return value is non-zero on error, such as ring full
- * (and FLAG_WAIT not specified), congestion avoidance (FLAG_WATCH_CGR
- * specified), etc. If the ring is full and FLAG_WAIT is specified, this
- * function will block. If FLAG_INTERRUPT is set, the EQCI bit of the portal
- * interrupt will assert when QMan consumes the EQCR entry (subject to "status
- * disable", "enable", and "inhibit" registers). If FLAG_DCA is set, QMan will
- * perform an implied "discrete consumption acknowledgment" on the dequeue
- * ring's (DQRR) entry, at the ring index specified by the FLAG_DCA_IDX(x)
- * macro. (As an alternative to issuing explicit DCA actions on DQRR entries,
- * this implicit DCA can delay the release of a "held active" frame queue
- * corresponding to a DQRR entry until QMan consumes the EQCR entry - providing
- * order-preservation semantics in packet-forwarding scenarios.) If FLAG_DCA is
- * set, then FLAG_DCA_PARK can also be set to imply that the DQRR consumption
- * acknowledgment should "park request" the "held active" frame queue. Ie.
- * when the portal eventually releases that frame queue, it will be left in the
- * Parked state rather than Tentatively Scheduled or Truly Scheduled. If the
- * portal is watching congestion groups, the QMAN_ENQUEUE_FLAG_WATCH_CGR flag
- * is requested, and the FQ is a member of a congestion group, then this
- * function returns -EAGAIN if the congestion group is currently congested.
- * Note, this does not eliminate ERNs, as the async interface means we can be
- * sending enqueue commands to an un-congested FQ that becomes congested before
- * the enqueue commands are processed, but it does minimise needless thrashing
- * of an already busy hardware resource by throttling many of the to-be-dropped
- * enqueues "at the source".
- */
-int qman_enqueue(struct qman_fq *fq, const struct qm_fd *fd, u32 flags);
-
-typedef int (*qman_cb_precommit) (void *arg);
-/**
- * qman_enqueue_precommit - Enqueue a frame to a frame queue and call cb
- * @fq: the frame queue object to enqueue to
- * @fd: a descriptor of the frame to be enqueued
- * @flags: bit-mask of QMAN_ENQUEUE_FLAG_*** options
- * @cb: user supplied callback function to invoke before writing commit verb.
- * @cb_arg: callback function argument
- *
- * This is similar to qman_enqueue except that it will invoke a user supplied
- * callback function just before writng the commit verb. This is useful
- * when the user want to do something *just before* enqueuing the request and
- * the enqueue can't fail.
+ * field is ignored. The return value is non-zero on error, such as ring full.
*/
-int qman_enqueue_precommit(struct qman_fq *fq, const struct qm_fd *fd,
- u32 flags, qman_cb_precommit cb, void *cb_arg);
-
-/**
- * qman_enqueue_orp - Enqueue a frame to a frame queue using an ORP
- * @fq: the frame queue object to enqueue to
- * @fd: a descriptor of the frame to be enqueued
- * @flags: bit-mask of QMAN_ENQUEUE_FLAG_*** options
- * @orp: the frame queue object used as an order restoration point.
- * @orp_seqnum: the sequence number of this frame in the order restoration path
- *
- * Similar to qman_enqueue(), but with the addition of an Order Restoration
- * Point (@orp) and corresponding sequence number (@orp_seqnum) for this
- * enqueue operation to employ order restoration. Each frame queue object acts
- * as an Order Definition Point (ODP) by providing each frame dequeued from it
- * with an incrementing sequence number, this value is generally ignored unless
- * that sequence of dequeued frames will need order restoration later. Each
- * frame queue object also encapsulates an Order Restoration Point (ORP), which
- * is a re-assembly context for re-ordering frames relative to their sequence
- * numbers as they are enqueued. The ORP does not have to be within the frame
- * queue that receives the enqueued frame, in fact it is usually the frame
- * queue from which the frames were originally dequeued. For the purposes of
- * order restoration, multiple frames (or "fragments") can be enqueued for a
- * single sequence number by setting the QMAN_ENQUEUE_FLAG_NLIS flag for all
- * enqueues except the final fragment of a given sequence number. Ordering
- * between sequence numbers is guaranteed, even if fragments of different
- * sequence numbers are interlaced with one another. Fragments of the same
- * sequence number will retain the order in which they are enqueued. If no
- * enqueue is to performed, QMAN_ENQUEUE_FLAG_HOLE indicates that the given
- * sequence number is to be "skipped" by the ORP logic (eg. if a frame has been
- * dropped from a sequence), or QMAN_ENQUEUE_FLAG_NESN indicates that the given
- * sequence number should become the ORP's "Next Expected Sequence Number".
- *
- * Side note: a frame queue object can be used purely as an ORP, without
- * carrying any frames at all. Care should be taken not to deallocate a frame
- * queue object that is being actively used as an ORP, as a future allocation
- * of the frame queue object may start using the internal ORP before the
- * previous use has finished.
- */
-int qman_enqueue_orp(struct qman_fq *fq, const struct qm_fd *fd, u32 flags,
- struct qman_fq *orp, u16 orp_seqnum);
+int qman_enqueue(struct qman_fq *fq, const struct qm_fd *fd);
/**
* qman_alloc_fqid_range - Allocate a contiguous range of FQIDs
* @result: is set by the API to the base FQID of the allocated range
* @count: the number of FQIDs required
- * @align: required alignment of the allocated range
- * @partial: non-zero if the API can return fewer than @count FQIDs
*
- * Returns the number of frame queues allocated, or a negative error code. If
- * @partial is non zero, the allocation request may return a smaller range of
- * FQs than requested (though alignment will be as requested). If @partial is
- * zero, the return value will either be 'count' or negative.
+ * Returns 0 on success, or a negative error code.
*/
-int qman_alloc_fqid_range(u32 *result, u32 count, u32 align, int partial);
-static inline int qman_alloc_fqid(u32 *result)
-{
- int ret = qman_alloc_fqid_range(result, 1, 0, 0);
-
- return (ret > 0) ? 0 : ret;
-}
+int qman_alloc_fqid_range(u32 *result, u32 count);
+#define qman_alloc_fqid(result) qman_alloc_fqid_range(result, 1)
/**
- * qman_release_fqid_range - Release the specified range of frame queue IDs
- * @fqid: the base FQID of the range to deallocate
- * @count: the number of FQIDs in the range
+ * qman_release_fqid - Release the specified frame queue ID
+ * @fqid: the FQID to be released back to the resource pool
*
- * This function can also be used to seed the allocator with ranges of FQIDs
- * that it can subsequently allocate from.
- */
-void qman_release_fqid_range(u32 fqid, u32 count);
-static inline void qman_release_fqid(u32 fqid)
-{
- qman_release_fqid_range(fqid, 1);
-}
-
-void qman_seed_fqid_range(u32 fqid, u32 count);
-
-
-int qman_shutdown_fq(u32 fqid);
-
-/**
- * qman_reserve_fqid_range - Reserve the specified range of frame queue IDs
- * @fqid: the base FQID of the range to deallocate
- * @count: the number of FQIDs in the range
+ * This function can also be used to seed the allocator with
+ * FQID ranges that it can subsequently allocate from.
+ * Returns 0 on success, or a negative error code.
*/
-int qman_reserve_fqid_range(u32 fqid, u32 count);
-static inline int qman_reserve_fqid(u32 fqid)
-{
- return qman_reserve_fqid_range(fqid, 1);
-}
+int qman_release_fqid(u32 fqid);
/* Pool-channel management */
- /* ----------------------- */
/**
* qman_alloc_pool_range - Allocate a contiguous range of pool-channel IDs
* @result: is set by the API to the base pool-channel ID of the allocated range
* @count: the number of pool-channel IDs required
- * @align: required alignment of the allocated range
- * @partial: non-zero if the API can return fewer than @count
*
- * Returns the number of pool-channel IDs allocated, or a negative error code.
- * If @partial is non zero, the allocation request may return a smaller range of
- * than requested (though alignment will be as requested). If @partial is zero,
- * the return value will either be 'count' or negative.
- */
-int qman_alloc_pool_range(u32 *result, u32 count, u32 align, int partial);
-static inline int qman_alloc_pool(u32 *result)
-{
- int ret = qman_alloc_pool_range(result, 1, 0, 0);
-
- return (ret > 0) ? 0 : ret;
-}
-
-/**
- * qman_release_pool_range - Release the specified range of pool-channel IDs
- * @id: the base pool-channel ID of the range to deallocate
- * @count: the number of pool-channel IDs in the range
+ * Returns 0 on success, or a negative error code.
*/
-void qman_release_pool_range(u32 id, u32 count);
-static inline void qman_release_pool(u32 id)
-{
- qman_release_pool_range(id, 1);
-}
+int qman_alloc_pool_range(u32 *result, u32 count);
+#define qman_alloc_pool(result) qman_alloc_pool_range(result, 1)
/**
- * qman_reserve_pool_range - Reserve the specified range of pool-channel IDs
- * @id: the base pool-channel ID of the range to reserve
- * @count: the number of pool-channel IDs in the range
+ * qman_release_pool - Release the specified pool-channel ID
+ * @id: the pool-chan ID to be released back to the resource pool
+ *
+ * This function can also be used to seed the allocator with
+ * pool-channel ID ranges that it can subsequently allocate from.
+ * Returns 0 on success, or a negative error code.
*/
-int qman_reserve_pool_range(u32 id, u32 count);
-static inline int qman_reserve_pool(u32 id)
-{
- return qman_reserve_pool_range(id, 1);
-}
-
-void qman_seed_pool_range(u32 id, u32 count);
+int qman_release_pool(u32 id);
/* CGR management */
- /* -------------- */
/**
* qman_create_cgr - Register a congestion group object
* @cgr: the 'cgr' object, with fields filled in
@@ -1792,18 +1033,7 @@ void qman_seed_pool_range(u32 id, u32 count);
* (which only modifies the specified parameters).
*/
int qman_create_cgr(struct qman_cgr *cgr, u32 flags,
- struct qm_mcc_initcgr *opts);
-
-/**
- * qman_create_cgr_to_dcp - Register a congestion group object to DCP portal
- * @cgr: the 'cgr' object, with fields filled in
- * @flags: QMAN_CGR_FLAG_* values
- * @dcp_portal: the DCP portal to which the cgr object is registered.
- * @opts: optional state of CGR settings
- *
- */
-int qman_create_cgr_to_dcp(struct qman_cgr *cgr, u32 flags, u16 dcp_portal,
- struct qm_mcc_initcgr *opts);
+ struct qm_mcc_initcgr *opts);
/**
* qman_delete_cgr - Deregisters a congestion group object
@@ -1824,163 +1054,30 @@ int qman_delete_cgr(struct qman_cgr *cgr);
void qman_delete_cgr_safe(struct qman_cgr *cgr);
/**
- * qman_modify_cgr - Modify CGR fields
- * @cgr: the 'cgr' object to modify
- * @flags: QMAN_CGR_FLAG_* values
- * @opts: the CGR-modification settings
- *
- * The @opts parameter comes from the low-level portal API, and can be NULL.
- * Note that some fields and options within @opts may be ignored or overwritten
- * by the driver, in particular the 'cgrid' field is ignored (this operation
- * only affects the given CGR object). If @flags contains
- * QMAN_CGR_FLAG_USE_INIT, then an init hw command (which will reset any
- * unspecified parameters) will be used rather than a modify hw hardware (which
- * only modifies the specified parameters).
+ * qman_query_cgr_congested - Queries CGR's congestion status
+ * @cgr: the 'cgr' object to query
+ * @result: returns 'cgr's congestion status, 1 (true) if congested
*/
-int qman_modify_cgr(struct qman_cgr *cgr, u32 flags,
- struct qm_mcc_initcgr *opts);
-
-/**
-* qman_query_cgr - Queries CGR fields
-* @cgr: the 'cgr' object to query
-* @result: storage for the queried congestion group record
-*/
-int qman_query_cgr(struct qman_cgr *cgr, struct qm_mcr_querycgr *result);
-
-/**
- * qman_query_congestion - Queries the state of all congestion groups
- * @congestion: storage for the queried state of all congestion groups
- */
-int qman_query_congestion(struct qm_mcr_querycongestion *congestion);
+int qman_query_cgr_congested(struct qman_cgr *cgr, bool *result);
/**
* qman_alloc_cgrid_range - Allocate a contiguous range of CGR IDs
* @result: is set by the API to the base CGR ID of the allocated range
* @count: the number of CGR IDs required
- * @align: required alignment of the allocated range
- * @partial: non-zero if the API can return fewer than @count
- *
- * Returns the number of CGR IDs allocated, or a negative error code.
- * If @partial is non zero, the allocation request may return a smaller range of
- * than requested (though alignment will be as requested). If @partial is zero,
- * the return value will either be 'count' or negative.
- */
-int qman_alloc_cgrid_range(u32 *result, u32 count, u32 align, int partial);
-static inline int qman_alloc_cgrid(u32 *result)
-{
- int ret = qman_alloc_cgrid_range(result, 1, 0, 0);
-
- return (ret > 0) ? 0 : ret;
-}
-
-/**
- * qman_release_cgrid_range - Release the specified range of CGR IDs
- * @id: the base CGR ID of the range to deallocate
- * @count: the number of CGR IDs in the range
- */
-void qman_release_cgrid_range(u32 id, u32 count);
-static inline void qman_release_cgrid(u32 id)
-{
- qman_release_cgrid_range(id, 1);
-}
-
-/**
- * qman_reserve_cgrid_range - Reserve the specified range of CGR ID
- * @id: the base CGR ID of the range to reserve
- * @count: the number of CGR IDs in the range
- */
-int qman_reserve_cgrid_range(u32 id, u32 count);
-static inline int qman_reserve_cgrid(u32 id)
-{
- return qman_reserve_cgrid_range(id, 1);
-}
-
-void qman_seed_cgrid_range(u32 id, u32 count);
-
-
- /* Helpers */
- /* ------- */
-/**
- * qman_poll_fq_for_init - Check if an FQ has been initialised from OOS
- * @fqid: the FQID that will be initialised by other s/w
*
- * In many situations, a FQID is provided for communication between s/w
- * entities, and whilst the consumer is responsible for initialising and
- * scheduling the FQ, the producer(s) generally create a wrapper FQ object using
- * and only call qman_enqueue() (no FQ initialisation, scheduling, etc). Ie;
- * qman_create_fq(..., QMAN_FQ_FLAG_NO_MODIFY, ...);
- * However, data can not be enqueued to the FQ until it is initialised out of
- * the OOS state - this function polls for that condition. It is particularly
- * useful for users of IPC functions - each endpoint's Rx FQ is the other
- * endpoint's Tx FQ, so each side can initialise and schedule their Rx FQ object
- * and then use this API on the (NO_MODIFY) Tx FQ object in order to
- * synchronise. The function returns zero for success, +1 if the FQ is still in
- * the OOS state, or negative if there was an error.
+ * Returns 0 on success, or a negative error code.
*/
-static inline int qman_poll_fq_for_init(struct qman_fq *fq)
-{
- struct qm_mcr_queryfq_np np;
- int err;
-
- err = qman_query_fq_np(fq, &np);
- if (err)
- return err;
- if ((np.state & QM_MCR_NP_STATE_MASK) == QM_MCR_NP_STATE_OOS)
- return 1;
- return 0;
-}
+int qman_alloc_cgrid_range(u32 *result, u32 count);
+#define qman_alloc_cgrid(result) qman_alloc_cgrid_range(result, 1)
/**
- * qman_set_wpm - Set waterfall power management
+ * qman_release_cgrid - Release the specified CGR ID
+ * @id: the CGR ID to be released back to the resource pool
*
- * @wpm_enable: boolean, 1 = enable wpm, 0 = disable wpm.
- *
- * Return 0 for success, return -ENODEV if QMan misc_cfg register is not
- * accessible.
+ * This function can also be used to seed the allocator with
+ * CGR ID ranges that it can subsequently allocate from.
+ * Returns 0 on success, or a negative error code.
*/
-int qman_set_wpm(int wpm_enable);
-
-/**
- * qman_get_swp - Query the waterfall power management setting
- *
- * @wpm_enable: boolean, 1 = enable wpm, 0 = disable wpm.
- *
- * Return 0 for success, return -ENODEV if QMan misc_cfg register is not
- * accessible.
- */
-int qman_get_wpm(int *wpm_enable);
-
-/* The below qman_p_***() variants might be called in a migration situation
- * (e.g. cpu hotplug). They are used to continue accessing the portal that
- * execution was affine to prior to migration.
- * @qman_portal specifies which portal the APIs will use.
-*/
-const struct qman_portal_config *qman_p_get_portal_config(struct qman_portal
- *p);
-int qman_p_irqsource_add(struct qman_portal *p, u32 bits);
-int qman_p_irqsource_remove(struct qman_portal *p, u32 bits);
-int qman_p_poll_dqrr(struct qman_portal *p, unsigned int limit);
-u32 qman_p_poll_slow(struct qman_portal *p);
-void qman_p_poll(struct qman_portal *p);
-void qman_p_stop_dequeues(struct qman_portal *p);
-void qman_p_start_dequeues(struct qman_portal *p);
-void qman_p_static_dequeue_add(struct qman_portal *p, u32 pools);
-void qman_p_static_dequeue_del(struct qman_portal *p, u32 pools);
-u32 qman_p_static_dequeue_get(struct qman_portal *p);
-void qman_p_dca(struct qman_portal *p, struct qm_dqrr_entry *dq,
- int park_request);
-int qman_p_volatile_dequeue(struct qman_portal *p, struct qman_fq *fq,
- u32 flags __maybe_unused, u32 vdqcr);
-int qman_p_enqueue(struct qman_portal *p, struct qman_fq *fq,
- const struct qm_fd *fd, u32 flags);
-int qman_p_enqueue_orp(struct qman_portal *p, struct qman_fq *fq,
- const struct qm_fd *fd, u32 flags,
- struct qman_fq *orp, u16 orp_seqnum);
-int qman_p_enqueue_precommit(struct qman_portal *p, struct qman_fq *fq,
- const struct qm_fd *fd, u32 flags,
- qman_cb_precommit cb, void *cb_arg);
-#ifdef __cplusplus
-}
-#endif
+int qman_release_cgrid(u32 id);
#endif /* __FSL_QMAN_H */