aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_txrx.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_txrx.h')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_txrx.h42
1 files changed, 28 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.h b/drivers/net/ethernet/intel/ice/ice_txrx.h
index 567067b650c4..75d0eaf6c9dd 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.h
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.h
@@ -22,8 +22,21 @@
22#define ICE_RX_BUF_WRITE 16 /* Must be power of 2 */ 22#define ICE_RX_BUF_WRITE 16 /* Must be power of 2 */
23#define ICE_MAX_TXQ_PER_TXQG 128 23#define ICE_MAX_TXQ_PER_TXQG 128
24 24
25/* Tx Descriptors needed, worst case */ 25/* We are assuming that the cache line is always 64 Bytes here for ice.
26#define DESC_NEEDED (MAX_SKB_FRAGS + 4) 26 * In order to make sure that is a correct assumption there is a check in probe
27 * to print a warning if the read from GLPCI_CNF2 tells us that the cache line
28 * size is 128 bytes. We do it this way because we do not want to read the
29 * GLPCI_CNF2 register or a variable containing the value on every pass through
30 * the Tx path.
31 */
32#define ICE_CACHE_LINE_BYTES 64
33#define ICE_DESCS_PER_CACHE_LINE (ICE_CACHE_LINE_BYTES / \
34 sizeof(struct ice_tx_desc))
35#define ICE_DESCS_FOR_CTX_DESC 1
36#define ICE_DESCS_FOR_SKB_DATA_PTR 1
37/* Tx descriptors needed, worst case */
38#define DESC_NEEDED (MAX_SKB_FRAGS + ICE_DESCS_FOR_CTX_DESC + \
39 ICE_DESCS_PER_CACHE_LINE + ICE_DESCS_FOR_SKB_DATA_PTR)
27#define ICE_DESC_UNUSED(R) \ 40#define ICE_DESC_UNUSED(R) \
28 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ 41 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
29 (R)->next_to_clean - (R)->next_to_use - 1) 42 (R)->next_to_clean - (R)->next_to_use - 1)
@@ -71,6 +84,7 @@ struct ice_txq_stats {
71 u64 restart_q; 84 u64 restart_q;
72 u64 tx_busy; 85 u64 tx_busy;
73 u64 tx_linearize; 86 u64 tx_linearize;
87 int prev_pkt; /* negative if no pending Tx descriptors */
74}; 88};
75 89
76struct ice_rxq_stats { 90struct ice_rxq_stats {
@@ -103,10 +117,17 @@ enum ice_rx_dtype {
103#define ICE_RX_ITR ICE_IDX_ITR0 117#define ICE_RX_ITR ICE_IDX_ITR0
104#define ICE_TX_ITR ICE_IDX_ITR1 118#define ICE_TX_ITR ICE_IDX_ITR1
105#define ICE_ITR_DYNAMIC 0x8000 /* use top bit as a flag */ 119#define ICE_ITR_DYNAMIC 0x8000 /* use top bit as a flag */
106#define ICE_ITR_8K 0x003E 120#define ICE_ITR_8K 125
121#define ICE_ITR_20K 50
122#define ICE_DFLT_TX_ITR ICE_ITR_20K
123#define ICE_DFLT_RX_ITR ICE_ITR_20K
124/* apply ITR granularity translation to program the register. itr_gran is either
125 * 2 or 4 usecs so we need to divide by 2 first then shift by that value
126 */
127#define ITR_TO_REG(val, itr_gran) (((val) & ~ICE_ITR_DYNAMIC) >> \
128 ((itr_gran) / 2))
107 129
108/* apply ITR HW granularity translation to program the HW registers */ 130#define ICE_DFLT_INTRL 0
109#define ITR_TO_REG(val, itr_gran) (((val) & ~ICE_ITR_DYNAMIC) >> (itr_gran))
110 131
111/* Legacy or Advanced Mode Queue */ 132/* Legacy or Advanced Mode Queue */
112#define ICE_TX_ADVANCED 0 133#define ICE_TX_ADVANCED 0
@@ -128,14 +149,6 @@ struct ice_ring {
128 u16 q_index; /* Queue number of ring */ 149 u16 q_index; /* Queue number of ring */
129 u32 txq_teid; /* Added Tx queue TEID */ 150 u32 txq_teid; /* Added Tx queue TEID */
130 151
131 /* high bit set means dynamic, use accessor routines to read/write.
132 * hardware supports 2us/1us resolution for the ITR registers.
133 * these values always store the USER setting, and must be converted
134 * before programming to a register.
135 */
136 u16 rx_itr_setting;
137 u16 tx_itr_setting;
138
139 u16 count; /* Number of descriptors */ 152 u16 count; /* Number of descriptors */
140 u16 reg_idx; /* HW register index of the ring */ 153 u16 reg_idx; /* HW register index of the ring */
141 154
@@ -143,7 +156,7 @@ struct ice_ring {
143 u16 next_to_use; 156 u16 next_to_use;
144 u16 next_to_clean; 157 u16 next_to_clean;
145 158
146 bool ring_active; /* is ring online or not */ 159 u8 ring_active; /* is ring online or not */
147 160
148 /* stats structs */ 161 /* stats structs */
149 struct ice_q_stats stats; 162 struct ice_q_stats stats;
@@ -172,6 +185,7 @@ struct ice_ring_container {
172 unsigned int total_bytes; /* total bytes processed this int */ 185 unsigned int total_bytes; /* total bytes processed this int */
173 unsigned int total_pkts; /* total packets processed this int */ 186 unsigned int total_pkts; /* total packets processed this int */
174 enum ice_latency_range latency_range; 187 enum ice_latency_range latency_range;
188 int itr_idx; /* index in the interrupt vector */
175 u16 itr; 189 u16 itr;
176}; 190};
177 191