net: dpaa2-eth: update the dpni_set_pools() API to support per QDBIN pools
Update the dpni_set_pool() firmware API so that in the next patches we can configure per Rx queue (per QDBIN) buffer pools. This is a hard requirement of the AF_XDP, thus we need the newer API version. Signed-off-by: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b1dd9bf6ea
commit
801c76dd06
|
@ -13,10 +13,12 @@
|
|||
#define DPNI_VER_MINOR 0
|
||||
#define DPNI_CMD_BASE_VERSION 1
|
||||
#define DPNI_CMD_2ND_VERSION 2
|
||||
#define DPNI_CMD_3RD_VERSION 3
|
||||
#define DPNI_CMD_ID_OFFSET 4
|
||||
|
||||
#define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION)
|
||||
#define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_2ND_VERSION)
|
||||
#define DPNI_CMD_V3(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_3RD_VERSION)
|
||||
|
||||
#define DPNI_CMDID_OPEN DPNI_CMD(0x801)
|
||||
#define DPNI_CMDID_CLOSE DPNI_CMD(0x800)
|
||||
|
@ -39,7 +41,7 @@
|
|||
#define DPNI_CMDID_GET_IRQ_STATUS DPNI_CMD(0x016)
|
||||
#define DPNI_CMDID_CLEAR_IRQ_STATUS DPNI_CMD(0x017)
|
||||
|
||||
#define DPNI_CMDID_SET_POOLS DPNI_CMD(0x200)
|
||||
#define DPNI_CMDID_SET_POOLS DPNI_CMD_V3(0x200)
|
||||
#define DPNI_CMDID_SET_ERRORS_BEHAVIOR DPNI_CMD(0x20B)
|
||||
|
||||
#define DPNI_CMDID_GET_QDID DPNI_CMD(0x210)
|
||||
|
@ -115,14 +117,19 @@ struct dpni_cmd_open {
|
|||
};
|
||||
|
||||
#define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order))
|
||||
|
||||
struct dpni_cmd_pool {
|
||||
__le16 dpbp_id;
|
||||
u8 priority_mask;
|
||||
u8 pad;
|
||||
};
|
||||
|
||||
struct dpni_cmd_set_pools {
|
||||
/* cmd word 0 */
|
||||
u8 num_dpbp;
|
||||
u8 backup_pool_mask;
|
||||
__le16 pad;
|
||||
/* cmd word 0..4 */
|
||||
__le32 dpbp_id[DPNI_MAX_DPBP];
|
||||
/* cmd word 4..6 */
|
||||
u8 pad;
|
||||
u8 pool_options;
|
||||
struct dpni_cmd_pool pool[DPNI_MAX_DPBP];
|
||||
__le16 buffer_size[DPNI_MAX_DPBP];
|
||||
};
|
||||
|
||||
|
|
|
@ -173,8 +173,12 @@ int dpni_set_pools(struct fsl_mc_io *mc_io,
|
|||
token);
|
||||
cmd_params = (struct dpni_cmd_set_pools *)cmd.params;
|
||||
cmd_params->num_dpbp = cfg->num_dpbp;
|
||||
cmd_params->pool_options = cfg->pool_options;
|
||||
for (i = 0; i < DPNI_MAX_DPBP; i++) {
|
||||
cmd_params->dpbp_id[i] = cpu_to_le32(cfg->pools[i].dpbp_id);
|
||||
cmd_params->pool[i].dpbp_id =
|
||||
cpu_to_le16(cfg->pools[i].dpbp_id);
|
||||
cmd_params->pool[i].priority_mask =
|
||||
cfg->pools[i].priority_mask;
|
||||
cmd_params->buffer_size[i] =
|
||||
cpu_to_le16(cfg->pools[i].buffer_size);
|
||||
cmd_params->backup_pool_mask |=
|
||||
|
|
|
@ -92,19 +92,28 @@ int dpni_close(struct fsl_mc_io *mc_io,
|
|||
u32 cmd_flags,
|
||||
u16 token);
|
||||
|
||||
#define DPNI_POOL_ASSOC_QPRI 0
|
||||
#define DPNI_POOL_ASSOC_QDBIN 1
|
||||
|
||||
/**
|
||||
* struct dpni_pools_cfg - Structure representing buffer pools configuration
|
||||
* @num_dpbp: Number of DPBPs
|
||||
* @pool_options: Buffer assignment options.
|
||||
* This field is a combination of DPNI_POOL_ASSOC_flags
|
||||
* @pools: Array of buffer pools parameters; The number of valid entries
|
||||
* must match 'num_dpbp' value
|
||||
* @pools.dpbp_id: DPBP object ID
|
||||
* @pools.priority: Priority mask that indicates TC's used with this buffer.
|
||||
* If set to 0x00 MC will assume value 0xff.
|
||||
* @pools.buffer_size: Buffer size
|
||||
* @pools.backup_pool: Backup pool
|
||||
*/
|
||||
struct dpni_pools_cfg {
|
||||
u8 num_dpbp;
|
||||
u8 pool_options;
|
||||
struct {
|
||||
int dpbp_id;
|
||||
u8 priority_mask;
|
||||
u16 buffer_size;
|
||||
int backup_pool;
|
||||
} pools[DPNI_MAX_DPBP];
|
||||
|
|
Loading…
Reference in New Issue