Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
0002 /* Copyright (C) 2015-2018 Netronome Systems, Inc. */
0003 
0004 /*
0005  * nfp.h
0006  * Interface for NFP device access and query functions.
0007  */
0008 
0009 #ifndef __NFP_H__
0010 #define __NFP_H__
0011 
0012 #include <linux/device.h>
0013 #include <linux/types.h>
0014 
0015 #include "nfp_cpp.h"
0016 
0017 /* Implemented in nfp_hwinfo.c */
0018 
0019 struct nfp_hwinfo;
0020 struct nfp_hwinfo *nfp_hwinfo_read(struct nfp_cpp *cpp);
0021 const char *nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, const char *lookup);
0022 char *nfp_hwinfo_get_packed_strings(struct nfp_hwinfo *hwinfo);
0023 u32 nfp_hwinfo_get_packed_str_size(struct nfp_hwinfo *hwinfo);
0024 
0025 /* Implemented in nfp_nsp.c, low level functions */
0026 
0027 struct nfp_nsp;
0028 
0029 struct nfp_cpp *nfp_nsp_cpp(struct nfp_nsp *state);
0030 bool nfp_nsp_config_modified(struct nfp_nsp *state);
0031 void nfp_nsp_config_set_modified(struct nfp_nsp *state, bool modified);
0032 void *nfp_nsp_config_entries(struct nfp_nsp *state);
0033 unsigned int nfp_nsp_config_idx(struct nfp_nsp *state);
0034 void nfp_nsp_config_set_state(struct nfp_nsp *state, void *entries,
0035                   unsigned int idx);
0036 void nfp_nsp_config_clear_state(struct nfp_nsp *state);
0037 int nfp_nsp_read_eth_table(struct nfp_nsp *state, void *buf, unsigned int size);
0038 int nfp_nsp_write_eth_table(struct nfp_nsp *state,
0039                 const void *buf, unsigned int size);
0040 int nfp_nsp_read_identify(struct nfp_nsp *state, void *buf, unsigned int size);
0041 int nfp_nsp_read_sensors(struct nfp_nsp *state, unsigned int sensor_mask,
0042              void *buf, unsigned int size);
0043 
0044 /* Implemented in nfp_resource.c */
0045 
0046 /* All keys are CRC32-POSIX of the 8-byte identification string */
0047 
0048 /* ARM/PCI vNIC Interfaces 0..3 */
0049 #define NFP_RESOURCE_VNIC_PCI_0     "vnic.p0"
0050 #define NFP_RESOURCE_VNIC_PCI_1     "vnic.p1"
0051 #define NFP_RESOURCE_VNIC_PCI_2     "vnic.p2"
0052 #define NFP_RESOURCE_VNIC_PCI_3     "vnic.p3"
0053 
0054 /* NFP Hardware Info Database */
0055 #define NFP_RESOURCE_NFP_HWINFO     "nfp.info"
0056 
0057 /* Service Processor */
0058 #define NFP_RESOURCE_NSP        "nfp.sp"
0059 #define NFP_RESOURCE_NSP_DIAG       "arm.diag"
0060 
0061 /* Netronone Flow Firmware Table */
0062 #define NFP_RESOURCE_NFP_NFFW       "nfp.nffw"
0063 
0064 /* MAC Statistics Accumulator */
0065 #define NFP_RESOURCE_MAC_STATISTICS "mac.stat"
0066 
0067 int nfp_resource_table_init(struct nfp_cpp *cpp);
0068 
0069 struct nfp_resource *
0070 nfp_resource_acquire(struct nfp_cpp *cpp, const char *name);
0071 
0072 void nfp_resource_release(struct nfp_resource *res);
0073 
0074 int nfp_resource_wait(struct nfp_cpp *cpp, const char *name, unsigned int secs);
0075 
0076 u32 nfp_resource_cpp_id(struct nfp_resource *res);
0077 
0078 const char *nfp_resource_name(struct nfp_resource *res);
0079 
0080 u64 nfp_resource_address(struct nfp_resource *res);
0081 
0082 u64 nfp_resource_size(struct nfp_resource *res);
0083 
0084 #endif /* !__NFP_H__ */