Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Mar 2011 13:10:56 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r219127 - in head: share/man/man4 sys/netgraph
Message-ID:  <201103011310.p21DAu39027049@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Tue Mar  1 13:10:56 2011
New Revision: 219127
URL: http://svn.freebsd.org/changeset/base/219127

Log:
  Add XMIT_FAILOVER transmit algorithm to ng_one2many node. Packets are
  delivered out the first active "many" hook.
  
  PR:		kern/137775
  Submitted by:	Maxim Ignatenko
  MFC after:	2 weeks

Modified:
  head/share/man/man4/ng_one2many.4
  head/sys/netgraph/ng_one2many.c
  head/sys/netgraph/ng_one2many.h

Modified: head/share/man/man4/ng_one2many.4
==============================================================================
--- head/share/man/man4/ng_one2many.4	Tue Mar  1 11:47:51 2011	(r219126)
+++ head/share/man/man4/ng_one2many.4	Tue Mar  1 13:10:56 2011	(r219127)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 19, 2006
+.Dd March 1, 2011
 .Dt NG_ONE2MANY 4
 .Os
 .Sh NAME
@@ -96,6 +96,10 @@ hooks.
 Each packet goes out each
 .Dv many
 hook.
+.It Dv NG_ONE2MANY_XMIT_FAILOVER
+Packets are delivered out the first active
+.Dv many
+hook.
 .El
 .Pp
 In the future other algorithms may be added as well.

Modified: head/sys/netgraph/ng_one2many.c
==============================================================================
--- head/sys/netgraph/ng_one2many.c	Tue Mar  1 11:47:51 2011	(r219126)
+++ head/sys/netgraph/ng_one2many.c	Tue Mar  1 13:10:56 2011	(r219127)
@@ -278,6 +278,7 @@ ng_one2many_rcvmsg(node_p node, item_p i
 			switch (conf->xmitAlg) {
 			case NG_ONE2MANY_XMIT_ROUNDROBIN:
 			case NG_ONE2MANY_XMIT_ALL:
+			case NG_ONE2MANY_XMIT_FAILOVER:
 				break;
 			default:
 				error = EINVAL;
@@ -473,6 +474,9 @@ ng_one2many_rcvdata(hook_p hook, item_p 
 				NG_SEND_DATA_ONLY(error, mdst->hook, m2);
 			}
 			break;
+		case NG_ONE2MANY_XMIT_FAILOVER:
+			dst = &priv->many[priv->activeMany[0]];
+			break;
 #ifdef INVARIANTS
 		default:
 			panic("%s: invalid xmitAlg", __func__);
@@ -583,6 +587,7 @@ ng_one2many_update_many(priv_p priv)
 			priv->nextMany %= priv->numActiveMany;
 		break;
 	case NG_ONE2MANY_XMIT_ALL:
+	case NG_ONE2MANY_XMIT_FAILOVER:
 		break;
 #ifdef INVARIANTS
 	default:

Modified: head/sys/netgraph/ng_one2many.h
==============================================================================
--- head/sys/netgraph/ng_one2many.h	Tue Mar  1 11:47:51 2011	(r219126)
+++ head/sys/netgraph/ng_one2many.h	Tue Mar  1 13:10:56 2011	(r219127)
@@ -61,6 +61,7 @@
 /* Algorithms for outgoing packet distribution (XXX only one so far) */
 #define NG_ONE2MANY_XMIT_ROUNDROBIN	1	/* round-robin delivery */
 #define NG_ONE2MANY_XMIT_ALL		2	/* send packets to all many hooks */
+#define	NG_ONE2MANY_XMIT_FAILOVER	3	/* send packets to first active "many" */
 
 /* Algorithms for detecting link failure (XXX only one so far) */
 #define NG_ONE2MANY_FAIL_MANUAL		1	/* use enabledLinks[] array */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103011310.p21DAu39027049>