| .. | .. |
|---|
| 32 | 32 | #define __DPAA_H |
|---|
| 33 | 33 | |
|---|
| 34 | 34 | #include <linux/netdevice.h> |
|---|
| 35 | +#include <linux/refcount.h> |
|---|
| 35 | 36 | #include <soc/fsl/qman.h> |
|---|
| 36 | 37 | #include <soc/fsl/bman.h> |
|---|
| 37 | 38 | |
|---|
| .. | .. |
|---|
| 45 | 46 | #define DPAA_TC_TXQ_NUM NR_CPUS |
|---|
| 46 | 47 | /* Total number of Tx queues */ |
|---|
| 47 | 48 | #define DPAA_ETH_TXQ_NUM (DPAA_TC_NUM * DPAA_TC_TXQ_NUM) |
|---|
| 48 | | - |
|---|
| 49 | | -#define DPAA_BPS_NUM 3 /* number of bpools per interface */ |
|---|
| 50 | 49 | |
|---|
| 51 | 50 | /* More detailed FQ types - used for fine-grained WQ assignments */ |
|---|
| 52 | 51 | enum dpaa_fq_type { |
|---|
| .. | .. |
|---|
| 79 | 78 | struct qman_fq egress_ern; |
|---|
| 80 | 79 | }; |
|---|
| 81 | 80 | |
|---|
| 81 | +struct dpaa_priv; |
|---|
| 82 | + |
|---|
| 82 | 83 | struct dpaa_bp { |
|---|
| 83 | | - /* device used in the DMA mapping operations */ |
|---|
| 84 | | - struct device *dev; |
|---|
| 84 | + /* used in the DMA mapping operations */ |
|---|
| 85 | + struct dpaa_priv *priv; |
|---|
| 85 | 86 | /* current number of buffers in the buffer pool alloted to each CPU */ |
|---|
| 86 | 87 | int __percpu *percpu_count; |
|---|
| 87 | 88 | /* all buffers allocated for this pool have this raw size */ |
|---|
| .. | .. |
|---|
| 99 | 100 | int (*seed_cb)(struct dpaa_bp *); |
|---|
| 100 | 101 | /* bpool can be emptied before freeing by this cb */ |
|---|
| 101 | 102 | void (*free_buf_cb)(const struct dpaa_bp *, struct bm_buffer *); |
|---|
| 102 | | - atomic_t refs; |
|---|
| 103 | + refcount_t refs; |
|---|
| 103 | 104 | }; |
|---|
| 104 | 105 | |
|---|
| 105 | 106 | struct dpaa_rx_errors { |
|---|
| .. | .. |
|---|
| 145 | 146 | |
|---|
| 146 | 147 | struct dpaa_priv { |
|---|
| 147 | 148 | struct dpaa_percpu_priv __percpu *percpu_priv; |
|---|
| 148 | | - struct dpaa_bp *dpaa_bps[DPAA_BPS_NUM]; |
|---|
| 149 | + struct dpaa_bp *dpaa_bp; |
|---|
| 149 | 150 | /* Store here the needed Tx headroom for convenience and speed |
|---|
| 150 | 151 | * (even though it can be computed based on the fields of buf_layout) |
|---|
| 151 | 152 | */ |
|---|
| 152 | 153 | u16 tx_headroom; |
|---|
| 153 | 154 | struct net_device *net_dev; |
|---|
| 154 | 155 | struct mac_device *mac_dev; |
|---|
| 156 | + struct device *rx_dma_dev; |
|---|
| 157 | + struct device *tx_dma_dev; |
|---|
| 155 | 158 | struct qman_fq *egress_fqs[DPAA_ETH_TXQ_NUM]; |
|---|
| 156 | 159 | struct qman_fq *conf_fqs[DPAA_ETH_TXQ_NUM]; |
|---|
| 157 | 160 | |
|---|