Date: Tue, 1 Oct 2013 04:02:36 +0900 From: Takuya ASADA <syuu@dokukino.com> To: FreeBSD Net <freebsd-net@freebsd.org> Subject: Flow Director statistics for ixgbe(4) Message-ID: <CALG4x-W302xOS0P3580UCdJaTDsKq5NiZgcoFBi2jyv9CoQ3%2Bw@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Hi, This is originally part of "ixgbetool" patch, but I think it can be discuss separately: http://freebsd.1045724.n5.nabble.com/Adding-Flow-Director-sysctls-to-ixgbe-4-was-netmap-traffic-distribution-tp5847066p5847789.html I implemented sysctls to expose Flow Director statistics. It works like this: $ sysctl dev.ix.0.mac_stats|grep fdir dev.ix.0.mac_stats.fdirfree_free: 8192 dev.ix.0.mac_stats.fdirfree_coll: 0 dev.ix.0.mac_stats.fdirustat_add: 0 dev.ix.0.mac_stats.fdirustat_remove: 0 dev.ix.0.mac_stats.fdirfstat_fadd: 0 dev.ix.0.mac_stats.fdirfstat_fremove: 0 dev.ix.0.mac_stats.fdirmatch: 0 dev.ix.0.mac_stats.fdirmiss: 23 [-- Attachment #2 --] diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c index b65df72..4e5322a 100644 --- a/sys/dev/ixgbe/ixgbe.c +++ b/sys/dev/ixgbe/ixgbe.c @@ -5270,13 +5270,33 @@ ixgbe_update_stats_counters(struct adapter *adapter) adapter->stats.xec += IXGBE_READ_REG(hw, IXGBE_XEC); adapter->stats.fccrc += IXGBE_READ_REG(hw, IXGBE_FCCRC); adapter->stats.fclast += IXGBE_READ_REG(hw, IXGBE_FCLAST); - /* Only read FCOE on 82599 */ + /* Only read FCOE/FDIR on 82599 */ if (hw->mac.type != ixgbe_mac_82598EB) { adapter->stats.fcoerpdc += IXGBE_READ_REG(hw, IXGBE_FCOERPDC); adapter->stats.fcoeprc += IXGBE_READ_REG(hw, IXGBE_FCOEPRC); adapter->stats.fcoeptc += IXGBE_READ_REG(hw, IXGBE_FCOEPTC); adapter->stats.fcoedwrc += IXGBE_READ_REG(hw, IXGBE_FCOEDWRC); adapter->stats.fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC); + adapter->stats.fdirfree_free = + (IXGBE_READ_REG(hw, IXGBE_FDIRFREE) & IXGBE_FDIRFREE_FREE_MASK) + >> IXGBE_FDIRFREE_FREE_SHIFT; + adapter->stats.fdirfree_coll = + (IXGBE_READ_REG(hw, IXGBE_FDIRFREE) & IXGBE_FDIRFREE_COLL_MASK) + >> IXGBE_FDIRFREE_COLL_SHIFT; + adapter->stats.fdirustat_add += + (IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT) & IXGBE_FDIRUSTAT_ADD_MASK) + >> IXGBE_FDIRUSTAT_ADD_SHIFT; + adapter->stats.fdirustat_remove += + (IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT) & IXGBE_FDIRUSTAT_REMOVE_MASK) + >> IXGBE_FDIRUSTAT_REMOVE_SHIFT; + adapter->stats.fdirfstat_fadd += + (IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT) & IXGBE_FDIRFSTAT_FADD_MASK) + >> IXGBE_FDIRFSTAT_FADD_SHIFT; + adapter->stats.fdirfstat_fremove += + (IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT) & IXGBE_FDIRFSTAT_FREMOVE_MASK) + >> IXGBE_FDIRFSTAT_FREMOVE_SHIFT; + adapter->stats.fdirmatch += IXGBE_READ_REG(hw, IXGBE_FDIRMATCH); + adapter->stats.fdirmiss += IXGBE_READ_REG(hw, IXGBE_FDIRMISS); } /* Fill out the OS statistics structure */ @@ -5642,6 +5662,32 @@ ixgbe_add_hw_stats(struct adapter *adapter) SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "tx_frames_1024_1522", CTLFLAG_RD, &stats->ptc1522, "1024-1522 byte frames transmitted"); + + /* fdir stats */ + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fdirfree_free", + CTLFLAG_RD, &stats->fdirfree_free, + ""); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fdirfree_coll", + CTLFLAG_RD, &stats->fdirfree_coll, + ""); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fdirustat_add", + CTLFLAG_RD, &stats->fdirustat_add, + ""); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fdirustat_remove", + CTLFLAG_RD, &stats->fdirustat_remove, + ""); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fdirfstat_fadd", + CTLFLAG_RD, &stats->fdirfstat_fadd, + ""); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fdirfstat_fremove", + CTLFLAG_RD, &stats->fdirfstat_fremove, + ""); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fdirmatch", + CTLFLAG_RD, &stats->fdirmatch, + ""); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fdirmiss", + CTLFLAG_RD, &stats->fdirmiss, + ""); } /* diff --git a/sys/dev/ixgbe/ixgbe_82599.c b/sys/dev/ixgbe/ixgbe_82599.c index 3cc8cd7..2b12f70 100644 --- a/sys/dev/ixgbe/ixgbe_82599.c +++ b/sys/dev/ixgbe/ixgbe_82599.c @@ -1482,7 +1482,8 @@ s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl) * Set the maximum length per hash bucket to 0xA filters * Send interrupt when 64 filters are left */ - fdirctrl |= (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT) | + fdirctrl |= IXGBE_FDIRCTRL_REPORT_STATUS | + (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT) | (0xA << IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT) | (4 << IXGBE_FDIRCTRL_FULL_THRESH_SHIFT); diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index 49f5bc0..c5f29bb 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -2997,6 +2997,8 @@ struct ixgbe_hw_stats { u64 qbtc[16]; u64 qprdc[16]; u64 pxon2offc[8]; + u64 fdirfree_free; + u64 fdirfree_coll; u64 fdirustat_add; u64 fdirustat_remove; u64 fdirfstat_fadd;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALG4x-W302xOS0P3580UCdJaTDsKq5NiZgcoFBi2jyv9CoQ3%2Bw>
