James Carlson writes: > Andrew Gallatin writes: > > My NIC doesn't do most of the critical path counters in > > mac_driver_stat, so I need to maintain them in the driver. > > > > When doing LSO, is it acceptable for MAC_STAT_OPACKETS to be > > incremented by 1 for an LSO send, or must it be incremented by the > > number of frames sent on the wire? > > > > Similarly, may MAC_STAT_OBYTES just reflect what was sent to the NIC, > > or must it reflect what was sent on the wire? > > I don't know that there's a "must" here, but as an administrator, I'd > be highly confused if my network statistics were orders of magnitude > away from what I expect -- which is what would happen if you counted > just 1 for each to-be-fragmented packet. > > I'd think that if you know the real link MTU (somewhere?), it wouldn't > be too hard to compute the actual number of packets with something > like (size+MTU-1)/MTU, and then figure size + 14*npackets for the > amount sent.
Actually, the MTU can be misleading (consider sending to a host with a standard MTU from a device with a jumbo MTU). All you need to do is to figure out the packet header sizes. The driver is given the payload size, so it is trivial. However, to do it correctly requires adding a field to my tx status information, potentially increasing cache misses. This is why I was trying to avoid it. But you've convinced me. I think Solaris will be the first OS where we report the correct stats for TSO. Elsewhere it is all done incorrectly above the driver. Drew _______________________________________________ networking-discuss mailing list [email protected]
