Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
0002 /* Copyright (C) 2018 Netronome Systems, Inc. */
0003 
0004 #ifndef __NFP_ABI__
0005 #define __NFP_ABI__ 1
0006 
0007 #include <linux/types.h>
0008 
0009 #define NFP_MBOX_SYM_NAME       "_abi_nfd_pf%u_mbox"
0010 #define NFP_MBOX_SYM_MIN_SIZE       16 /* When no data needed */
0011 
0012 #define NFP_MBOX_CMD        0x00
0013 #define NFP_MBOX_RET        0x04
0014 #define NFP_MBOX_DATA_LEN   0x08
0015 #define NFP_MBOX_RESERVED   0x0c
0016 #define NFP_MBOX_DATA       0x10
0017 
0018 /**
0019  * enum nfp_mbox_cmd - PF mailbox commands
0020  *
0021  * @NFP_MBOX_NO_CMD:    null command
0022  * Used to indicate previous command has finished.
0023  *
0024  * @NFP_MBOX_POOL_GET:  get shared buffer pool info/config
0025  * Input  - struct nfp_shared_buf_pool_id
0026  * Output - struct nfp_shared_buf_pool_info_get
0027  *
0028  * @NFP_MBOX_POOL_SET:  set shared buffer pool info/config
0029  * Input  - struct nfp_shared_buf_pool_info_set
0030  * Output - None
0031  *
0032  * @NFP_MBOX_PCIE_ABM_ENABLE:   enable PCIe-side advanced buffer management
0033  * Enable advanced buffer management of the PCIe block.  If ABM is disabled
0034  * PCIe block maintains a very short queue of buffers and does tail drop.
0035  * ABM allows more advanced buffering and priority control.
0036  * Input  - None
0037  * Output - None
0038  *
0039  * @NFP_MBOX_PCIE_ABM_DISABLE:  disable PCIe-side advanced buffer management
0040  * Input  - None
0041  * Output - None
0042  */
0043 enum nfp_mbox_cmd {
0044     NFP_MBOX_NO_CMD         = 0x00,
0045 
0046     NFP_MBOX_POOL_GET       = 0x01,
0047     NFP_MBOX_POOL_SET       = 0x02,
0048 
0049     NFP_MBOX_PCIE_ABM_ENABLE    = 0x03,
0050     NFP_MBOX_PCIE_ABM_DISABLE   = 0x04,
0051 };
0052 
0053 #define NFP_SHARED_BUF_COUNT_SYM_NAME   "_abi_nfd_pf%u_sb_cnt"
0054 #define NFP_SHARED_BUF_TABLE_SYM_NAME   "_abi_nfd_pf%u_sb_tbl"
0055 
0056 /**
0057  * struct nfp_shared_buf - NFP shared buffer description
0058  * @id:             numerical user-visible id of the shared buffer
0059  * @size:           size in bytes of the buffer
0060  * @ingress_pools_count:    number of ingress pools
0061  * @egress_pools_count:     number of egress pools
0062  * @ingress_tc_count:       number of ingress trafic classes
0063  * @egress_tc_count:        number of egress trafic classes
0064  * @pool_size_unit:     pool size may be in credits, each credit is
0065  *              @pool_size_unit bytes
0066  */
0067 struct nfp_shared_buf {
0068     __le32 id;
0069     __le32 size;
0070     __le16 ingress_pools_count;
0071     __le16 egress_pools_count;
0072     __le16 ingress_tc_count;
0073     __le16 egress_tc_count;
0074 
0075     __le32 pool_size_unit;
0076 };
0077 
0078 /**
0079  * struct nfp_shared_buf_pool_id - shared buffer pool identification
0080  * @shared_buf:     shared buffer id
0081  * @pool:       pool index
0082  */
0083 struct nfp_shared_buf_pool_id {
0084     __le32 shared_buf;
0085     __le32 pool;
0086 };
0087 
0088 /**
0089  * struct nfp_shared_buf_pool_info_get - struct devlink_sb_pool_info mirror
0090  * @pool_type:      one of enum devlink_sb_pool_type
0091  * @size:       pool size in units of SB's @pool_size_unit
0092  * @threshold_type: one of enum devlink_sb_threshold_type
0093  */
0094 struct nfp_shared_buf_pool_info_get {
0095     __le32 pool_type;
0096     __le32 size;
0097     __le32 threshold_type;
0098 };
0099 
0100 /**
0101  * struct nfp_shared_buf_pool_info_set - packed args of sb_pool_set
0102  * @id:         pool identification info
0103  * @size:       pool size in units of SB's @pool_size_unit
0104  * @threshold_type: one of enum devlink_sb_threshold_type
0105  */
0106 struct nfp_shared_buf_pool_info_set {
0107     struct nfp_shared_buf_pool_id id;
0108     __le32 size;
0109     __le32 threshold_type;
0110 };
0111 
0112 #endif