bsnmpd 64bits counters problem

2008-12-16 Thread Sergey Matveychuk

Hello.

Some weird thing has happened with 64bit counters:

% snmpwalk -v2c -cpublic localhost ifInOctets
IF-MIB::ifInOctets.1 = Counter32: 4107815474
...
IF-MIB::ifInOctets.16 = Counter32: 2894713654

% snmpwalk -v2c -cpublic localhost ifHCInOctets
IF-MIB::ifHCInOctets.1 = Counter64: 7911064279758
...
IF-MIB::ifHCInOctets.4 = Counter64: 13143091216588

There are all 16 32bits counters but only 4 64bits. That's less than 
physical interfaces on this router (em0-em5).


7.1-PRERELEASE

--
Dixi.
Sem.
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: bsnmpd 64bits counters problem

2008-12-16 Thread Sergey Matveychuk

Sergey Matveychuk wrote:

Hello.

Some weird thing has happened with 64bit counters:

% snmpwalk -v2c -cpublic localhost ifInOctets
IF-MIB::ifInOctets.1 = Counter32: 4107815474
...
IF-MIB::ifInOctets.16 = Counter32: 2894713654

% snmpwalk -v2c -cpublic localhost ifHCInOctets
IF-MIB::ifHCInOctets.1 = Counter64: 7911064279758
...
IF-MIB::ifHCInOctets.4 = Counter64: 13143091216588

There are all 16 32bits counters but only 4 64bits. That's less than 
physical interfaces on this router (em0-em5).


7.1-PRERELEASE



Looks like this is a reason:
# ifconfig em4
em4: flags=8802BROADCAST,SIMPLEX,MULTICAST metric 0 mtu 1500
 options=19bRXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4
ether 00:15:17:80:f5:ee
media: Ethernet autoselect
status: no carrier
# ifconfig em5
em5: flags=8802BROADCAST,SIMPLEX,MULTICAST metric 0 mtu 1500
 options=19bRXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4
ether 00:15:17:80:f5:ef
media: Ethernet autoselect
status: no carrier

No 64bits counters returned for interfaces bellow them.
--
Dixi.
Sem.
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: bsnmpd 64bits counters problem

2008-12-16 Thread Harti Brandt
On Tue, 16 Dec 2008, Sergey Matveychuk wrote:

SMHello.
SM
SMSome weird thing has happened with 64bit counters:
SM
SM% snmpwalk -v2c -cpublic localhost ifInOctets
SMIF-MIB::ifInOctets.1 = Counter32: 4107815474
SM...
SMIF-MIB::ifInOctets.16 = Counter32: 2894713654
SM
SM% snmpwalk -v2c -cpublic localhost ifHCInOctets
SMIF-MIB::ifHCInOctets.1 = Counter64: 7911064279758
SM...
SMIF-MIB::ifHCInOctets.4 = Counter64: 13143091216588
SM
SMThere are all 16 32bits counters but only 4 64bits. That's less than physical
SMinterfaces on this router (em0-em5).
SM
SM7.1-PRERELEASE

The highspeed counters are only there if this is a high-speed interface. 
High speed means that the baudrate in the interface MIB (the one in the 
kernel) must be larger than 20Mbaud.

harti
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: bsnmpd 64bits counters problem

2008-12-16 Thread Sergey Matveychuk

Harti Brandt wrote:

On Tue, 16 Dec 2008, Sergey Matveychuk wrote:

SMHello.
SM
SMSome weird thing has happened with 64bit counters:
SM
SM% snmpwalk -v2c -cpublic localhost ifInOctets
SMIF-MIB::ifInOctets.1 = Counter32: 4107815474
SM...
SMIF-MIB::ifInOctets.16 = Counter32: 2894713654
SM
SM% snmpwalk -v2c -cpublic localhost ifHCInOctets
SMIF-MIB::ifHCInOctets.1 = Counter64: 7911064279758
SM...
SMIF-MIB::ifHCInOctets.4 = Counter64: 13143091216588
SM
SMThere are all 16 32bits counters but only 4 64bits. That's less than physical
SMinterfaces on this router (em0-em5).
SM
SM7.1-PRERELEASE

The highspeed counters are only there if this is a high-speed interface. 
High speed means that the baudrate in the interface MIB (the one in the 
kernel) must be larger than 20Mbaud.


Well, these is lagg interfaces:
lagg0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 9000
options=19bRXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4
ether 00:30:48:67:d4:68
media: Ethernet autoselect
status: active
laggproto lacp
laggport: em2 flags=1cACTIVE,COLLECTING,DISTRIBUTING
laggport: em0 flags=1cACTIVE,COLLECTING,DISTRIBUTING

There is no baudrate on them. But they are really high-speed however.

--
Dixi.
Sem.
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: bsnmpd 64bits counters problem

2008-12-16 Thread Bruce Simpson

Harti Brandt wrote:
The highspeed counters are only there if this is a high-speed interface. 
High speed means that the baudrate in the interface MIB (the one in the 
kernel) must be larger than 20Mbaud.
  


Does it look at the if_baudrate member?

em(4) and other drivers will set if_baudrate according to the speed 
detected from Ethernet link beat, this could be creating a situation 
where bsnmpd is not exposing the high-speed counters at runtime?


I imagine this could really confuse an SNMP-oriented Network Management 
System such as Nagios or OpenNMS.


cheers
BMS
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: bsnmpd 64bits counters problem

2008-12-16 Thread Harti Brandt
On Tue, 16 Dec 2008, Sergey Matveychuk wrote:

SMHarti Brandt wrote:
SM On Tue, 16 Dec 2008, Sergey Matveychuk wrote:
SM 
SM SMHello.
SM SM
SM SMSome weird thing has happened with 64bit counters:
SM SM
SM SM% snmpwalk -v2c -cpublic localhost ifInOctets
SM SMIF-MIB::ifInOctets.1 = Counter32: 4107815474
SM SM...
SM SMIF-MIB::ifInOctets.16 = Counter32: 2894713654
SM SM
SM SM% snmpwalk -v2c -cpublic localhost ifHCInOctets
SM SMIF-MIB::ifHCInOctets.1 = Counter64: 7911064279758
SM SM...
SM SMIF-MIB::ifHCInOctets.4 = Counter64: 13143091216588
SM SM
SM SMThere are all 16 32bits counters but only 4 64bits. That's less than
SM physical
SM SMinterfaces on this router (em0-em5).
SM SM
SM SM7.1-PRERELEASE
SM 
SM The highspeed counters are only there if this is a high-speed interface.
SM High speed means that the baudrate in the interface MIB (the one in the
SM kernel) must be larger than 20Mbaud.
SM
SMWell, these is lagg interfaces:
SMlagg0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 9000
SMoptions=19bRXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4
SMether 00:30:48:67:d4:68
SMmedia: Ethernet autoselect
SMstatus: active
SMlaggproto lacp
SMlaggport: em2 flags=1cACTIVE,COLLECTING,DISTRIBUTING
SMlaggport: em0 flags=1cACTIVE,COLLECTING,DISTRIBUTING
SM
SMThere is no baudrate on them. But they are really high-speed however.

All interfaces have a baudrate. Its in net/if.h ifi_baudrate. We had the 
problem in the past with other interface types. 'virtual' interfaces must 
take care to somehow propagate the rate of the underlying physical 
interfaces up to the virtual one.

harti
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: bsnmpd 64bits counters problem

2008-12-16 Thread Harti Brandt
On Tue, 16 Dec 2008, Bruce Simpson wrote:

BSHarti Brandt wrote:
BS The highspeed counters are only there if this is a high-speed interface.
BS High speed means that the baudrate in the interface MIB (the one in the
BS kernel) must be larger than 20Mbaud.
BS   
BS
BSDoes it look at the if_baudrate member?
BS
BSem(4) and other drivers will set if_baudrate according to the speed detected
BSfrom Ethernet link beat, this could be creating a situation where bsnmpd is
BSnot exposing the high-speed counters at runtime?
BS
BSI imagine this could really confuse an SNMP-oriented Network Management
BSSystem such as Nagios or OpenNMS.

Yes, it looks at ifi_baudrate. The reason is that the HC counters are 
mandatory only for interfaces with  20MBit/second according to the 
compliance statememnt of the MIB. The HC counters come add additional 
cost, because the daemon has to poll the kernel's 32 bit counters and 
detect wrap arounds. So the daemon adapts dynamically based on the 
interface with the highest speed.

And in any case, network management tools must be prepared to handle both 
cases.

See also RFC2233: For interfaces that operate at 20,000,000 (20 million) 
bits per second or less, 32-bit byte and packet counters MUST be used.

harti
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: bsnmpd 64bits counters problem

2008-12-16 Thread Andrew Thompson
On Tue, Dec 16, 2008 at 07:12:24PM +0100, Harti Brandt wrote:
 On Tue, 16 Dec 2008, Sergey Matveychuk wrote:
 SM 
 SM The highspeed counters are only there if this is a high-speed interface.
 SM High speed means that the baudrate in the interface MIB (the one in the
 SM kernel) must be larger than 20Mbaud.
 SM
 SMWell, these is lagg interfaces:
 SMlagg0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu 9000
 SMoptions=19bRXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4
 SMether 00:30:48:67:d4:68
 SMmedia: Ethernet autoselect
 SMstatus: active
 SMlaggproto lacp
 SMlaggport: em2 flags=1cACTIVE,COLLECTING,DISTRIBUTING
 SMlaggport: em0 flags=1cACTIVE,COLLECTING,DISTRIBUTING
 SM
 SMThere is no baudrate on them. But they are really high-speed however.
 
 All interfaces have a baudrate. Its in net/if.h ifi_baudrate. We had the 
 problem in the past with other interface types. 'virtual' interfaces must 
 take care to somehow propagate the rate of the underlying physical 
 interfaces up to the virtual one.

This patch should fix it for the lacp case. What is the correct value to
use for a collection of interfaces with possibly different speeds?
highest/lowest?


Andrew
Index: ieee8023ad_lacp.c
===
--- ieee8023ad_lacp.c	(revision 186188)
+++ ieee8023ad_lacp.c	(working copy)
@@ -901,6 +901,7 @@ lacp_aggregator_bandwidth(struct lacp_aggregator *
 static void
 lacp_select_active_aggregator(struct lacp_softc *lsc)
 {
+	struct lagg_softc *sc = lsc-lsc_softc;
 	struct lacp_aggregator *la;
 	struct lacp_aggregator *best_la = NULL;
 	uint64_t best_speed = 0;
@@ -956,6 +957,7 @@ lacp_select_active_aggregator(struct lacp_softc *l
 #endif /* defined(LACP_DEBUG) */
 
 	if (lsc-lsc_active_aggregator != best_la) {
+		sc-sc_ifp-if_baudrate = speed;
 		lsc-lsc_active_aggregator = best_la;
 		lacp_update_portmap(lsc);
 		if (best_la) {
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org

Re: bsnmpd 64bits counters problem

2008-12-16 Thread Max Laier
On Tuesday 16 December 2008 19:27:49 Andrew Thompson wrote:
 On Tue, Dec 16, 2008 at 07:12:24PM +0100, Harti Brandt wrote:
  On Tue, 16 Dec 2008, Sergey Matveychuk wrote:
  SM
  SM The highspeed counters are only there if this is a high-speed
  interface. SM High speed means that the baudrate in the interface MIB
  (the one in the SM kernel) must be larger than 20Mbaud.
  SM
  SMWell, these is lagg interfaces:
  SMlagg0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu
  9000 SM   
  options=19bRXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4 SM  
   ether 00:30:48:67:d4:68
  SMmedia: Ethernet autoselect
  SMstatus: active
  SMlaggproto lacp
  SMlaggport: em2 flags=1cACTIVE,COLLECTING,DISTRIBUTING
  SMlaggport: em0 flags=1cACTIVE,COLLECTING,DISTRIBUTING
  SM
  SMThere is no baudrate on them. But they are really high-speed however.
 
  All interfaces have a baudrate. Its in net/if.h ifi_baudrate. We had the
  problem in the past with other interface types. 'virtual' interfaces must
  take care to somehow propagate the rate of the underlying physical
  interfaces up to the virtual one.

 This patch should fix it for the lacp case. What is the correct value to
 use for a collection of interfaces with possibly different speeds?
 highest/lowest?

If aggregation is used you should add the individual speeds (as this is the 
highest rate at which the interface counter could be increased).  If it's in 
failover you should propagate the speed of the active interface.  When in 
doubt, always report the highest value - at least for the purpose discussed 
here.

-- 
/\  Best regards,  | mla...@freebsd.org
\ /  Max Laier  | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mla...@efnet
/ \  ASCII Ribbon Campaign  | Against HTML Mail and News
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org


Re: bsnmpd 64bits counters problem

2008-12-16 Thread Andrew Thompson
On Tue, Dec 16, 2008 at 08:08:00PM +0100, Max Laier wrote:
 On Tuesday 16 December 2008 19:27:49 Andrew Thompson wrote:
  On Tue, Dec 16, 2008 at 07:12:24PM +0100, Harti Brandt wrote:
   On Tue, 16 Dec 2008, Sergey Matveychuk wrote:
   SM
   SM The highspeed counters are only there if this is a high-speed
   interface. SM High speed means that the baudrate in the interface MIB
   (the one in the SM kernel) must be larger than 20Mbaud.
   SM
   SMWell, these is lagg interfaces:
   SMlagg0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST metric 0 mtu
   9000 SM   
   options=19bRXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4 SM  
ether 00:30:48:67:d4:68
   SMmedia: Ethernet autoselect
   SMstatus: active
   SMlaggproto lacp
   SMlaggport: em2 flags=1cACTIVE,COLLECTING,DISTRIBUTING
   SMlaggport: em0 flags=1cACTIVE,COLLECTING,DISTRIBUTING
   SM
   SMThere is no baudrate on them. But they are really high-speed however.
  
   All interfaces have a baudrate. Its in net/if.h ifi_baudrate. We had the
   problem in the past with other interface types. 'virtual' interfaces must
   take care to somehow propagate the rate of the underlying physical
   interfaces up to the virtual one.
 
  This patch should fix it for the lacp case. What is the correct value to
  use for a collection of interfaces with possibly different speeds?
  highest/lowest?
 
 If aggregation is used you should add the individual speeds (as this is the 
 highest rate at which the interface counter could be increased).  If it's in 
 failover you should propagate the speed of the active interface.  When in 
 doubt, always report the highest value - at least for the purpose discussed 
 here.

Patch updated, should work as you described.

Andrew
Index: if_lagg.c
===
--- if_lagg.c	(revision 186188)
+++ if_lagg.c	(working copy)
@@ -1206,6 +1206,7 @@ lagg_linkstate(struct lagg_softc *sc)
 {
 	struct lagg_port *lp;
 	int new_link = LINK_STATE_DOWN;
+	uint64_t speed = 0;
 
 	/* Our link is considered up if at least one of our ports is active */
 	SLIST_FOREACH(lp, sc-sc_ports, lp_entries) {
@@ -1215,6 +1216,24 @@ lagg_linkstate(struct lagg_softc *sc)
 		}
 	}
 	if_link_state_change(sc-sc_ifp, new_link);
+
+	/* Update if_baudrate to reflect the max possible speed */
+	switch (sc-sc_proto) {
+		case LAGG_PROTO_FAILOVER:
+			sc-sc_ifp-if_baudrate =
+			sc-sc_primary-lp_ifp-if_baudrate;
+			break;
+		case LAGG_PROTO_ROUNDROBIN:
+		case LAGG_PROTO_LOADBALANCE:
+		case LAGG_PROTO_ETHERCHANNEL:
+			SLIST_FOREACH(lp, sc-sc_ports, lp_entries)
+speed += lp-lp_ifp-if_baudrate;
+			sc-sc_ifp-if_baudrate = speed;
+			break;
+		case LAGG_PROTO_LACP:
+			/* LACP updates if_baudrate itself */
+			break;
+	}
 }
 
 static void
Index: ieee8023ad_lacp.c
===
--- ieee8023ad_lacp.c	(revision 186188)
+++ ieee8023ad_lacp.c	(working copy)
@@ -901,6 +901,7 @@ lacp_aggregator_bandwidth(struct lacp_aggregator *
 static void
 lacp_select_active_aggregator(struct lacp_softc *lsc)
 {
+	struct lagg_softc *sc = lsc-lsc_softc;
 	struct lacp_aggregator *la;
 	struct lacp_aggregator *best_la = NULL;
 	uint64_t best_speed = 0;
@@ -956,6 +957,7 @@ lacp_select_active_aggregator(struct lacp_softc *l
 #endif /* defined(LACP_DEBUG) */
 
 	if (lsc-lsc_active_aggregator != best_la) {
+		sc-sc_ifp-if_baudrate = best_speed;
 		lsc-lsc_active_aggregator = best_la;
 		lacp_update_portmap(lsc);
 		if (best_la) {
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to freebsd-net-unsubscr...@freebsd.org