diff options
author | glebius <glebius@FreeBSD.org> | 2013-10-09 19:04:40 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2013-10-09 19:04:40 +0000 |
commit | 75528d8e36fb23734af42c83fe710155dc3e2d5c (patch) | |
tree | a73da61112c51368ee56913bcb5771167291b7ca | |
parent | 57b95400601bfa18b78d342b43a877efa06e81d1 (diff) | |
download | FreeBSD-src-75528d8e36fb23734af42c83fe710155dc3e2d5c.zip FreeBSD-src-75528d8e36fb23734af42c83fe710155dc3e2d5c.tar.gz |
There are some high performance NICs that count statistics in hardware,
and there are ifnets, that do that via counter(9). Provide a flag that
would skip cache line trashing '+=' operation in ether_input().
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
Reviewed by: melifaro, adrian
Approved by: re (marius)
-rw-r--r-- | sys/dev/cxgbe/t4_main.c | 2 | ||||
-rw-r--r-- | sys/dev/ixgbe/ixgbe.c | 3 | ||||
-rw-r--r-- | sys/net/if.h | 1 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 3 | ||||
-rw-r--r-- | sys/net/if_lagg.c | 1 |
5 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index d905cd5..c46ed5a0 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -950,7 +950,7 @@ cxgbe_probe(device_t dev) #define T4_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \ IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \ - IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6) + IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6 | IFCAP_HWSTATS) #define T4_CAP_ENABLE (T4_CAP) static int diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c index 3434125..e913bd5 100644 --- a/sys/dev/ixgbe/ixgbe.c +++ b/sys/dev/ixgbe/ixgbe.c @@ -2662,7 +2662,8 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter) ifp->if_capabilities |= IFCAP_LRO; ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO - | IFCAP_VLAN_MTU; + | IFCAP_VLAN_MTU + | IFCAP_HWSTATS; ifp->if_capenable = ifp->if_capabilities; /* diff --git a/sys/net/if.h b/sys/net/if.h index ab98ec0..80a7112 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -231,6 +231,7 @@ struct if_data { #define IFCAP_NETMAP 0x100000 /* netmap mode supported/enabled */ #define IFCAP_RXCSUM_IPV6 0x200000 /* can offload checksum on IPv6 RX */ #define IFCAP_TXCSUM_IPV6 0x400000 /* can offload checksum on IPv6 TX */ +#define IFCAP_HWSTATS 0x800000 /* manages counters internally */ #define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 638b364..d5c5521 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -528,7 +528,8 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m) m->m_flags &= ~M_HASFCS; } - ifp->if_ibytes += m->m_pkthdr.len; + if (!(ifp->if_capenable & IFCAP_HWSTATS)) + ifp->if_ibytes += m->m_pkthdr.len; /* Allow monitor mode to claim this frame, after stats are updated. */ if (ifp->if_flags & IFF_MONITOR) { diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 27bab87..258c2f9 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -347,6 +347,7 @@ lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params) ifp->if_init = lagg_init; ifp->if_ioctl = lagg_ioctl; ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; + ifp->if_capenable = ifp->if_capabilities = IFCAP_HWSTATS; /* * Attach as an ordinary ethernet device, children will be attached |