Main index | Section 4 | Options |
#include <sys/types.h>
#include <netgraph/ng_one2many.h>
Each of the connected many links may be considered to be up or down. Packets are never delivered out a many hook that is down. How a link is determined to be up or down depends on the node's configured link failure detection algorithm.
Before an interface or link can be plumbed into a group, its status must be marked as being "up". This is normally setup during the initial boot stages by rc.conf(5). It is also possible to change an interface's status to "up" by using the ifconfig(8) utility.
NG_ONE2MANY_XMIT_ROUNDROBIN | |
Packets are delivered out the many hooks in sequential order. Each packet goes out on a different many hook. | |
NG_ONE2MANY_XMIT_ALL | |
Packets are delivered out all the many hooks. Each packet goes out each many hook. | |
NG_ONE2MANY_XMIT_FAILOVER | |
Packets are delivered out the first active many hook. | |
In the future other algorithms may be added as well.
NG_ONE2MANY_FAIL_MANUAL | |
The node is explicitly told which of the links are up via the NGM_ONE2MANY_SET_CONFIG control message (see below). Newly connected links are down until configured otherwise. | |
NG_ONE2MANY_FAIL_NOTIFY | |
The node listens to flow control message from many hooks, and considers link failed if NGM_LINK_IS_DOWN is received. If the NGM_LINK_IS_UP message is received, node considers link active. | |
In the future other algorithms may be added as well.
When all links are considered failed, node sends the NGM_LINK_IS_DOWN message towards the one hook. When at least one link comes up, node sends the NGM_LINK_IS_UP message towards the one hook.
NGM_ONE2MANY_SET_CONFIG ( setconfig) | |
Sets the node configuration using a
struct ng_one2many_link_config
as the control message argument:
/* Node configuration structure */ struct ng_one2many_config { uint32_t xmitAlg; /* how to distribute packets */ uint32_t failAlg; /* how to detect link failure */ u_char enabledLinks[NG_ONE2MANY_MAX_LINKS]; }; Currently, the valid settings for the xmitAlg field are NG_ONE2MANY_XMIT_ROUNDROBIN (default) or NG_ONE2MANY_XMIT_ALL. The valid settings for failAlg are NG_ONE2MANY_FAIL_MANUAL (default) or NG_ONE2MANY_FAIL_NOTIFY. | |
NGM_ONE2MANY_GET_CONFIG ( getconfig) | |
Returns the current node configuration in a struct ng_one2many_link_config. | |
NGM_ONE2MANY_GET_STATS ( getstats) | |
This command takes a 32 bit link number as an argument and
returns a
struct ng_one2many_link_stats
containing statistics for the corresponding
many
link, which may or may not be currently connected:
/* Statistics structure (one for each link) */ struct ng_one2many_link_stats { uint64_t recvOctets; /* total octets rec'd on link */ uint64_t recvPackets; /* total pkts rec'd on link */ uint64_t xmitOctets; /* total octets xmit'd on link */ uint64_t xmitPackets; /* total pkts xmit'd on link */ uint64_t memoryFailures; /* times couldn't get mem or mbuf */ }; To access statistics for the one link, use the link number -1. | |
NGM_ONE2MANY_CLR_STATS ( clrstats) | |
This command takes a 32 bit link number as an argument and clears the statistics for that link. | |
NGM_ONE2MANY_GETCLR_STATS ( getclrstats) | |
Same as NGM_ONE2MANY_GET_STATS, but also atomically clears the statistics for the link as well. | |
# Plumb nodes togetherngctl mkpeer fxp0: one2many upper one ngctl connect fxp0: fxp0:upper lower many0 ngctl connect fxp1: fxp0:upper lower many1 ngctl connect fxp2: fxp0:upper lower many2 ngctl connect fxp3: fxp0:upper lower many3
# Allow fxp1 through fxp3 to xmit/recv fxp0 frames
ngctl msg fxp1: setpromisc 1 ngctl msg fxp2: setpromisc 1 ngctl msg fxp3: setpromisc 1 ngctl msg fxp1: setautosrc 0 ngctl msg fxp2: setautosrc 0 ngctl msg fxp3: setautosrc 0
# Configure all four links as up
ngctl msg fxp0:upper \ setconfig "{ xmitAlg=1 failAlg=1 enabledLinks=[ 1 1 1 1 ] }"
# Bring up interface
ifconfig fxp0 192.168.1.1 netmask 0xfffffffc
With a similar setup on a peer machine (using the address 192.168.1.2), a point-to-point Ethernet connection with four times normal bandwidth is achieved.
NG_ONE2MANY (4) | November 13, 2012 |
Main index | Section 4 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.