Skip to content

Commit 5536d21

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
igb: Combine q_vector and ring allocation into a single function
This change combines the the allocation of q_vectors and rings into a single function. The advantage of this is that we are guaranteed we will avoid overlap in the L1 cache sets. Signed-off-by: Alexander Duyck <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent de78d1f commit 5536d21

File tree

2 files changed

+215
-202
lines changed

2 files changed

+215
-202
lines changed

drivers/net/ethernet/intel/igb/igb.h

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -204,22 +204,6 @@ struct igb_ring_container {
204204
u8 itr; /* current ITR setting for ring */
205205
};
206206

207-
struct igb_q_vector {
208-
struct igb_adapter *adapter; /* backlink */
209-
int cpu; /* CPU for DCA */
210-
u32 eims_value; /* EIMS mask value */
211-
212-
struct igb_ring_container rx, tx;
213-
214-
struct napi_struct napi;
215-
216-
u16 itr_val;
217-
u8 set_itr;
218-
void __iomem *itr_register;
219-
220-
char name[IFNAMSIZ + 9];
221-
};
222-
223207
struct igb_ring {
224208
struct igb_q_vector *q_vector; /* backlink to q_vector */
225209
struct net_device *netdev; /* back pointer to net_device */
@@ -231,14 +215,15 @@ struct igb_ring {
231215
void *desc; /* descriptor ring memory */
232216
unsigned long flags; /* ring specific flags */
233217
void __iomem *tail; /* pointer to ring tail register */
218+
dma_addr_t dma; /* phys address of the ring */
219+
unsigned int size; /* length of desc. ring in bytes */
234220

235221
u16 count; /* number of desc. in the ring */
236222
u8 queue_index; /* logical index of the ring*/
237223
u8 reg_idx; /* physical index of the ring */
238-
u32 size; /* length of desc. ring in bytes */
239224

240225
/* everything past this point are written often */
241-
u16 next_to_clean ____cacheline_aligned_in_smp;
226+
u16 next_to_clean;
242227
u16 next_to_use;
243228
u16 next_to_alloc;
244229

@@ -256,8 +241,25 @@ struct igb_ring {
256241
struct u64_stats_sync rx_syncp;
257242
};
258243
};
259-
/* Items past this point are only used during ring alloc / free */
260-
dma_addr_t dma; /* phys address of the ring */
244+
} ____cacheline_internodealigned_in_smp;
245+
246+
struct igb_q_vector {
247+
struct igb_adapter *adapter; /* backlink */
248+
int cpu; /* CPU for DCA */
249+
u32 eims_value; /* EIMS mask value */
250+
251+
u16 itr_val;
252+
u8 set_itr;
253+
void __iomem *itr_register;
254+
255+
struct igb_ring_container rx, tx;
256+
257+
struct napi_struct napi;
258+
struct rcu_head rcu; /* to avoid race with update stats on free */
259+
char name[IFNAMSIZ + 9];
260+
261+
/* for dynamic allocation of rings associated with this q_vector */
262+
struct igb_ring ring[0] ____cacheline_internodealigned_in_smp;
261263
};
262264

263265
enum e1000_ring_flags_t {

0 commit comments

Comments
 (0)