Dropped vs. missed packets in the ixgbe driver

Dmitrij Tejblum tejblum at yandex-team.ru
Sat Sep 5 18:00:37 UTC 2009


Jack,

The code you committed does not look right with respect to missed 
packets counting:


	for (int i = 0; i < 8; i++) {
		/* missed_rx tallies misses for the gprc workaround */
		missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(i));
         	adapter->stats.mpc[i] += missed_rx;
		/* Running comprehensive total for stats display */
		total_missed_rx += adapter->stats.mpc[i];
		if (hw->mac.type == ixgbe_mac_82598EB)
			adapter->stats.rnbc[i] +=
			    IXGBE_READ_REG(hw, IXGBE_RNBC(i));
	}

You see, the value of the MPC(0) register also added to mpc[1], mpc[2], 
... mpc[7], and thus gets added to total_missed_rx 8 times. The MPC(1) 
register gets added to total_missed_rx 7 times, and so on.


I would suggest something like this:

         for (int i = 0; i < 8; i++) {
                 u32 mp;
                 mp = IXGBE_READ_REG(hw, IXGBE_MPC(i));
                 /* missed_rx tallies misses for the gprc workaround */
                 missed_rx += mp;
                 adapter->stats.mpc[i] += mp;
                 /* Running comprehensive total for stats display */
                 total_missed_rx += adapter->stats.mpc[i];
                 if (hw->mac.type == ixgbe_mac_82598EB)
                         adapter->stats.rnbc[i] +=
                             IXGBE_READ_REG(hw, IXGBE_RNBC(i));
         }

Also, there was PR kern/127834 on this issue, that should be closed as 
the issue fixed.




-- 
Dima


More information about the freebsd-net mailing list