Skip to content

Commit

Permalink
Change ice zc ring initialization (ICE_INIT_V2)
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigliano committed Aug 26, 2024
1 parent 1821243 commit a4e76ea
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
24 changes: 23 additions & 1 deletion drivers/intel/ice/ice-1.12.7-zc/src/ice_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9019,8 +9019,10 @@ int notify_callback(void *rx_data, void *tx_data, u_int8_t device_in_use)
if ((n = atomic_inc_return(&adapter->pfring_zc.usage_counter)) == 1 /* first interface user */) {
try_module_get(THIS_MODULE); /* ++ */

#ifndef ICE_INIT_V2
/* wait for ice_clean_rx_irq to complete the current receive if any */
usleep_range(100, 200);
#endif

/* Stopping all queues in kernel space on first user - this avoids receiving
* high-pps traffic in kernel space in promiscuous mode */
Expand All @@ -9034,6 +9036,25 @@ int notify_callback(void *rx_data, void *tx_data, u_int8_t device_in_use)
/* Wait enough to make sure there is no concurrent insertion */
usleep_range(100, 200);

#ifdef ICE_INIT_V2
/*
* Initialization steps:
* 1. increase and check interface usage counter
* 2. disable all the queues
* 3. wait a bit to let the kernel driver (ice_clean_rx_irq) dequeue enqueued packets
* 4. cleanup the ring
*/

ice_for_each_rxq(vsi, i) {
struct ice_rx_ring *rx_ring_i = vsi->rx_rings[i];

atomic_inc_return(&rx_ring_i->pfring_zc.queue_in_use);
}

/* Wait enough to make sure there is no concurrent insertion */
usleep_range(100, 200);
#endif

ice_for_each_rxq(vsi, i) {
struct ice_rx_ring *rx_ring_i = vsi->rx_rings[i];
u_int32_t *shadow_tail_ptr = (u_int32_t *) ICE_RX_DESC(rx_ring_i, rx_ring_i->count);
Expand All @@ -9057,10 +9078,11 @@ int notify_callback(void *rx_data, void *tx_data, u_int8_t device_in_use)
}
}

#ifndef ICE_INIT_V2
if (rx_ring != NULL && atomic_inc_return(&rx_ring->pfring_zc.queue_in_use) == 1 /* first queue user */) {

}
#endif

#ifdef ICE_TX_ENABLE
if (tx_ring != NULL && atomic_inc_return(&tx_ring->pfring_zc.queue_in_use) == 1 /* first user */) {
Expand Down
4 changes: 4 additions & 0 deletions drivers/intel/ice/ice-1.12.7-zc/src/ice_txrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,11 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget)
// printk("[PF_RING-ZC] %s(%s) called [usage_counter=%u]\n", __FUNCTION__, rx_ring->netdev->name,
// atomic_read(&ice_netdev_to_pf(rx_ring->netdev)->pfring_zc.usage_counter));

#ifdef ICE_INIT_V2
if (atomic_read(&rx_ring->pfring_zc.queue_in_use) > 0) {
#else
if (rx_ring->netdev && atomic_read(&ice_netdev_to_pf(rx_ring->netdev)->pfring_zc.usage_counter) > 0) {
#endif
wake_up_pfring_zc_socket(rx_ring);
/* Note: returning budget napi will call us again (keeping interrupts disabled),
* returning budget-1 will tell napi that we are done (this usually also reenable interrupts, not with ZC) */
Expand Down
1 change: 1 addition & 0 deletions drivers/intel/ice/ice-1.12.7-zc/src/kcompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#define ICE_ZC_IRQ
#define ICE_TX_ENABLE
//#define ICE_RX_TAIL_RESET
#define ICE_INIT_V2
#define ICE_USER_TO_KERNEL_RESET

#define PCI_DEVICE_CACHE_LINE_SIZE 0x0C
Expand Down

0 comments on commit a4e76ea

Please sign in to comment.