113 lines · c
1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */2/* Copyright (C) 2018 Netronome Systems, Inc. */3 4#ifndef __NFP_ABI__5#define __NFP_ABI__ 16 7#include <linux/types.h>8 9#define NFP_MBOX_SYM_NAME "_abi_nfd_pf%u_mbox"10#define NFP_MBOX_SYM_MIN_SIZE 16 /* When no data needed */11 12#define NFP_MBOX_CMD 0x0013#define NFP_MBOX_RET 0x0414#define NFP_MBOX_DATA_LEN 0x0815#define NFP_MBOX_RESERVED 0x0c16#define NFP_MBOX_DATA 0x1017 18/**19 * enum nfp_mbox_cmd - PF mailbox commands20 *21 * @NFP_MBOX_NO_CMD: null command22 * Used to indicate previous command has finished.23 *24 * @NFP_MBOX_POOL_GET: get shared buffer pool info/config25 * Input - struct nfp_shared_buf_pool_id26 * Output - struct nfp_shared_buf_pool_info_get27 *28 * @NFP_MBOX_POOL_SET: set shared buffer pool info/config29 * Input - struct nfp_shared_buf_pool_info_set30 * Output - None31 *32 * @NFP_MBOX_PCIE_ABM_ENABLE: enable PCIe-side advanced buffer management33 * Enable advanced buffer management of the PCIe block. If ABM is disabled34 * PCIe block maintains a very short queue of buffers and does tail drop.35 * ABM allows more advanced buffering and priority control.36 * Input - None37 * Output - None38 *39 * @NFP_MBOX_PCIE_ABM_DISABLE: disable PCIe-side advanced buffer management40 * Input - None41 * Output - None42 */43enum nfp_mbox_cmd {44 NFP_MBOX_NO_CMD = 0x00,45 46 NFP_MBOX_POOL_GET = 0x01,47 NFP_MBOX_POOL_SET = 0x02,48 49 NFP_MBOX_PCIE_ABM_ENABLE = 0x03,50 NFP_MBOX_PCIE_ABM_DISABLE = 0x04,51};52 53#define NFP_SHARED_BUF_COUNT_SYM_NAME "_abi_nfd_pf%u_sb_cnt"54#define NFP_SHARED_BUF_TABLE_SYM_NAME "_abi_nfd_pf%u_sb_tbl"55 56/**57 * struct nfp_shared_buf - NFP shared buffer description58 * @id: numerical user-visible id of the shared buffer59 * @size: size in bytes of the buffer60 * @ingress_pools_count: number of ingress pools61 * @egress_pools_count: number of egress pools62 * @ingress_tc_count: number of ingress trafic classes63 * @egress_tc_count: number of egress trafic classes64 * @pool_size_unit: pool size may be in credits, each credit is65 * @pool_size_unit bytes66 */67struct nfp_shared_buf {68 __le32 id;69 __le32 size;70 __le16 ingress_pools_count;71 __le16 egress_pools_count;72 __le16 ingress_tc_count;73 __le16 egress_tc_count;74 75 __le32 pool_size_unit;76};77 78/**79 * struct nfp_shared_buf_pool_id - shared buffer pool identification80 * @shared_buf: shared buffer id81 * @pool: pool index82 */83struct nfp_shared_buf_pool_id {84 __le32 shared_buf;85 __le32 pool;86};87 88/**89 * struct nfp_shared_buf_pool_info_get - struct devlink_sb_pool_info mirror90 * @pool_type: one of enum devlink_sb_pool_type91 * @size: pool size in units of SB's @pool_size_unit92 * @threshold_type: one of enum devlink_sb_threshold_type93 */94struct nfp_shared_buf_pool_info_get {95 __le32 pool_type;96 __le32 size;97 __le32 threshold_type;98};99 100/**101 * struct nfp_shared_buf_pool_info_set - packed args of sb_pool_set102 * @id: pool identification info103 * @size: pool size in units of SB's @pool_size_unit104 * @threshold_type: one of enum devlink_sb_threshold_type105 */106struct nfp_shared_buf_pool_info_set {107 struct nfp_shared_buf_pool_id id;108 __le32 size;109 __le32 threshold_type;110};111 112#endif113