0001
0002
0003
0004
0005
0006 #ifndef __DPAA_H
0007 #define __DPAA_H
0008
0009 #include <linux/netdevice.h>
0010 #include <linux/refcount.h>
0011 #include <soc/fsl/qman.h>
0012 #include <soc/fsl/bman.h>
0013
0014 #include "fman.h"
0015 #include "mac.h"
0016 #include "dpaa_eth_trace.h"
0017
0018
0019 #define DPAA_TC_NUM 4
0020
0021 #define DPAA_TC_TXQ_NUM NR_CPUS
0022
0023 #define DPAA_ETH_TXQ_NUM (DPAA_TC_NUM * DPAA_TC_TXQ_NUM)
0024
0025
0026 enum dpaa_fq_type {
0027 FQ_TYPE_RX_DEFAULT = 1,
0028 FQ_TYPE_RX_ERROR,
0029 FQ_TYPE_RX_PCD,
0030 FQ_TYPE_TX,
0031 FQ_TYPE_TX_CONFIRM,
0032 FQ_TYPE_TX_CONF_MQ,
0033 FQ_TYPE_TX_ERROR,
0034 };
0035
0036 struct dpaa_fq {
0037 struct qman_fq fq_base;
0038 struct list_head list;
0039 struct net_device *net_dev;
0040 bool init;
0041 u32 fqid;
0042 u32 flags;
0043 u16 channel;
0044 u8 wq;
0045 enum dpaa_fq_type fq_type;
0046 struct xdp_rxq_info xdp_rxq;
0047 };
0048
0049 struct dpaa_fq_cbs {
0050 struct qman_fq rx_defq;
0051 struct qman_fq tx_defq;
0052 struct qman_fq rx_errq;
0053 struct qman_fq tx_errq;
0054 struct qman_fq egress_ern;
0055 };
0056
0057 struct dpaa_priv;
0058
0059 struct dpaa_bp {
0060
0061 struct dpaa_priv *priv;
0062
0063 int __percpu *percpu_count;
0064
0065 size_t raw_size;
0066
0067 size_t size;
0068
0069
0070
0071
0072 u16 config_count;
0073 u8 bpid;
0074 struct bman_pool *pool;
0075
0076 int (*seed_cb)(struct dpaa_bp *);
0077
0078 void (*free_buf_cb)(const struct dpaa_bp *, struct bm_buffer *);
0079 refcount_t refs;
0080 };
0081
0082 struct dpaa_rx_errors {
0083 u64 dme;
0084 u64 fpe;
0085 u64 fse;
0086 u64 phe;
0087 };
0088
0089
0090 struct dpaa_ern_cnt {
0091 u64 cg_tdrop;
0092 u64 wred;
0093 u64 err_cond;
0094 u64 early_window;
0095 u64 late_window;
0096 u64 fq_tdrop;
0097 u64 fq_retired;
0098 u64 orp_zero;
0099 };
0100
0101 struct dpaa_napi_portal {
0102 struct napi_struct napi;
0103 struct qman_portal *p;
0104 bool down;
0105 int xdp_act;
0106 };
0107
0108 struct dpaa_percpu_priv {
0109 struct net_device *net_dev;
0110 struct dpaa_napi_portal np;
0111 u64 in_interrupt;
0112 u64 tx_confirm;
0113
0114 u64 tx_frag_skbuffs;
0115 struct rtnl_link_stats64 stats;
0116 struct dpaa_rx_errors rx_errors;
0117 struct dpaa_ern_cnt ern_cnt;
0118 };
0119
0120 struct dpaa_buffer_layout {
0121 u16 priv_data_size;
0122 };
0123
0124
0125
0126
0127
0128 struct dpaa_eth_swbp {
0129 struct sk_buff *skb;
0130 struct xdp_frame *xdpf;
0131 };
0132
0133 struct dpaa_priv {
0134 struct dpaa_percpu_priv __percpu *percpu_priv;
0135 struct dpaa_bp *dpaa_bp;
0136
0137
0138
0139 u16 tx_headroom;
0140 struct net_device *net_dev;
0141 struct mac_device *mac_dev;
0142 struct device *rx_dma_dev;
0143 struct device *tx_dma_dev;
0144 struct qman_fq *egress_fqs[DPAA_ETH_TXQ_NUM];
0145 struct qman_fq *conf_fqs[DPAA_ETH_TXQ_NUM];
0146
0147 u16 channel;
0148 struct list_head dpaa_fq_list;
0149
0150 u8 num_tc;
0151 bool keygen_in_use;
0152 u32 msg_enable;
0153
0154 struct {
0155
0156
0157
0158 struct qman_cgr cgr;
0159
0160 u32 congestion_start_jiffies;
0161
0162 u32 congested_jiffies;
0163
0164
0165
0166 u32 cgr_congested_count;
0167 } cgr_data;
0168
0169 bool use_ingress_cgr;
0170 struct qman_cgr ingress_cgr;
0171
0172 struct dpaa_buffer_layout buf_layout[2];
0173 u16 rx_headroom;
0174
0175 bool tx_tstamp;
0176 bool rx_tstamp;
0177
0178 struct bpf_prog *xdp_prog;
0179 };
0180
0181
0182 extern const struct ethtool_ops dpaa_ethtool_ops;
0183
0184
0185 void dpaa_eth_sysfs_remove(struct device *dev);
0186 void dpaa_eth_sysfs_init(struct device *dev);
0187 #endif