diff --git a/drivers/intel/ice/ice-1.12.7-zc/src/ice_main.c b/drivers/intel/ice/ice-1.12.7-zc/src/ice_main.c index 0f06f42f6..183c61727 100644 --- a/drivers/intel/ice/ice-1.12.7-zc/src/ice_main.c +++ b/drivers/intel/ice/ice-1.12.7-zc/src/ice_main.c @@ -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 */ @@ -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); @@ -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 */) { diff --git a/drivers/intel/ice/ice-1.12.7-zc/src/ice_txrx.c b/drivers/intel/ice/ice-1.12.7-zc/src/ice_txrx.c index a8282eb5d..4ea41dbbc 100644 --- a/drivers/intel/ice/ice-1.12.7-zc/src/ice_txrx.c +++ b/drivers/intel/ice/ice-1.12.7-zc/src/ice_txrx.c @@ -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) */ diff --git a/drivers/intel/ice/ice-1.12.7-zc/src/kcompat.h b/drivers/intel/ice/ice-1.12.7-zc/src/kcompat.h index ff981a43c..5f00a8cdf 100644 --- a/drivers/intel/ice/ice-1.12.7-zc/src/kcompat.h +++ b/drivers/intel/ice/ice-1.12.7-zc/src/kcompat.h @@ -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