e1000e: fix division by zero on jumbo MTUs
authorDmitry Fleytman <dmitry@daynix.com>
Tue, 13 Oct 2015 09:48:18 +0000 (12:48 +0300)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sun, 13 Dec 2015 07:14:21 +0000 (23:14 -0800)
This patch fixes possible division by zero in receive
interrupt handler when working without adaptive interrupt
moderation.

The adaptive interrupt moderation mechanism is typically
disabled on jumbo MTUs.

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Leonid Bloch <leonid@daynix.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/e1000e/netdev.c

index 0003bf61b211b4958686e72d0ae8770c19bcea2a..772447306c133999a6e5a8974bca79b5735ccb4f 100644 (file)
@@ -1959,8 +1959,10 @@ static irqreturn_t e1000_intr_msix_rx(int __always_unused irq, void *data)
         * previous interrupt.
         */
        if (rx_ring->set_itr) {
-               writel(1000000000 / (rx_ring->itr_val * 256),
-                      rx_ring->itr_register);
+               u32 itr = rx_ring->itr_val ?
+                         1000000000 / (rx_ring->itr_val * 256) : 0;
+
+               writel(itr, rx_ring->itr_register);
                rx_ring->set_itr = 0;
        }