summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-02-20 08:26:27 +0000
committerpjd <pjd@FreeBSD.org>2004-02-20 08:26:27 +0000
commit4a0eb3ce03d54ff9fbd72770cfd1c15a032c3393 (patch)
tree899a8124743aa5214cabafa8d2bc1c81bdf053dd
parentbf4ea3aa0d6dbae1deda3f2e95d4ed3c77866ef7 (diff)
downloadFreeBSD-src-4a0eb3ce03d54ff9fbd72770cfd1c15a032c3393.zip
FreeBSD-src-4a0eb3ce03d54ff9fbd72770cfd1c15a032c3393.tar.gz
Backout previous change, it breaks build and it is not needed
layering violation. As pointed out, there is much better way to do this. Sorry guys, I need to find a better way to force reviews. Requested by: harti, julian, scottl (mentor) Pointy hat to: pjd
-rw-r--r--sys/netgraph/ng_ether.c13
-rw-r--r--sys/netgraph/ng_ether.h12
-rw-r--r--sys/netgraph/ng_one2many.c89
-rw-r--r--sys/netgraph/ng_one2many.h6
4 files changed, 13 insertions, 107 deletions
diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
index 642676d..db8e941 100644
--- a/sys/netgraph/ng_ether.c
+++ b/sys/netgraph/ng_ether.c
@@ -67,7 +67,18 @@
#define IFP2AC(IFP) ((struct arpcom *)IFP)
#define IFP2NG(ifp) ((struct ng_node *)((struct arpcom *)(ifp))->ac_netgraph)
-typedef struct ng_ether_private *priv_p;
+/* Per-node private data */
+struct private {
+ struct ifnet *ifp; /* associated interface */
+ hook_p upper; /* upper hook connection */
+ hook_p lower; /* lower OR orphan hook connection */
+ u_char lowerOrphan; /* whether lower is lower or orphan */
+ u_char autoSrcAddr; /* always overwrite source address */
+ u_char promisc; /* promiscuous mode enabled */
+ u_long hwassist; /* hardware checksum capabilities */
+ u_int flags; /* flags e.g. really die */
+};
+typedef struct private *priv_p;
/* Hook pointers used by if_ethersubr.c to callback to netgraph */
extern void (*ng_ether_input_p)(struct ifnet *ifp, struct mbuf **mp);
diff --git a/sys/netgraph/ng_ether.h b/sys/netgraph/ng_ether.h
index 7dbb419..98a0b4c 100644
--- a/sys/netgraph/ng_ether.h
+++ b/sys/netgraph/ng_ether.h
@@ -65,17 +65,5 @@ enum {
NGM_ETHER_SET_AUTOSRC, /* enable/disable src addr override */
};
-/* Per-node private data */
-struct ng_ether_private {
- struct ifnet *ifp; /* associated interface */
- hook_p upper; /* upper hook connection */
- hook_p lower; /* lower OR orphan hook connection */
- u_char lowerOrphan; /* whether lower is lower or orphan */
- u_char autoSrcAddr; /* always overwrite source address */
- u_char promisc; /* promiscuous mode enabled */
- u_long hwassist; /* hardware checksum capabilities */
- u_int flags; /* flags e.g. really die */
-};
-
#endif /* _NETGRAPH_NG_ETHER_H_ */
diff --git a/sys/netgraph/ng_one2many.c b/sys/netgraph/ng_one2many.c
index a11a0b7..927bb77 100644
--- a/sys/netgraph/ng_one2many.c
+++ b/sys/netgraph/ng_one2many.c
@@ -53,17 +53,11 @@
#include <sys/malloc.h>
#include <sys/ctype.h>
#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
#include <sys/errno.h>
-#include <net/if.h>
-#include <net/if_media.h>
-
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_parse.h>
-#include <netgraph/ng_ether.h>
#include <netgraph/ng_one2many.h>
/* Per-link private data */
@@ -80,7 +74,6 @@ struct ng_one2many_private {
u_int16_t nextMany; /* next round-robin */
u_int16_t numActiveMany; /* # active "many" */
u_int16_t activeMany[NG_ONE2MANY_MAX_LINKS];
- struct callout_handle callout;
};
typedef struct ng_one2many_private *priv_p;
@@ -93,8 +86,6 @@ static ng_rcvdata_t ng_one2many_rcvdata;
static ng_disconnect_t ng_one2many_disconnect;
/* Other functions */
-static void ng_one2many_scan(node_p node, hook_p hook __unused,
- void *arg1 __unused, int arg2 __unused);
static void ng_one2many_update_many(priv_p priv);
/* Store each hook's link number in the private field */
@@ -204,15 +195,9 @@ ng_one2many_constructor(node_p node)
return (ENOMEM);
priv->conf.xmitAlg = NG_ONE2MANY_XMIT_ROUNDROBIN;
priv->conf.failAlg = NG_ONE2MANY_FAIL_MANUAL;
- priv->conf.interval = 5;
NG_NODE_SET_PRIVATE(node, priv);
- if (priv->conf.failAlg == NG_ONE2MANY_FAIL_IFACE_LINK) {
- priv->callout = ng_timeout(node, NULL, priv->conf.interval * hz,
- ng_one2many_scan, NULL, 0);
- }
-
/* Done */
return (0);
}
@@ -301,7 +286,6 @@ ng_one2many_rcvmsg(node_p node, item_p item, hook_p lasthook)
}
switch (conf->failAlg) {
case NG_ONE2MANY_FAIL_MANUAL:
- case NG_ONE2MANY_FAIL_IFACE_LINK:
break;
default:
error = EINVAL;
@@ -317,13 +301,6 @@ ng_one2many_rcvmsg(node_p node, item_p item, hook_p lasthook)
/* Copy config and reset */
bcopy(conf, &priv->conf, sizeof(*conf));
ng_one2many_update_many(priv);
-
- ng_untimeout(priv->callout, node);
- if (priv->conf.failAlg == NG_ONE2MANY_FAIL_IFACE_LINK) {
- priv->callout = ng_timeout(node, NULL,
- priv->conf.interval * hz, ng_one2many_scan,
- NULL, 0);
- }
break;
}
case NGM_ONE2MANY_GET_CONFIG:
@@ -499,8 +476,6 @@ ng_one2many_shutdown(node_p node)
KASSERT(priv->numActiveMany == 0,
("%s: numActiveMany=%d", __func__, priv->numActiveMany));
- if (priv->conf.failAlg == NG_ONE2MANY_FAIL_IFACE_LINK)
- ng_untimeout(priv->callout, node);
FREE(priv, M_NETGRAPH);
NG_NODE_SET_PRIVATE(node, NULL);
NG_NODE_UNREF(node);
@@ -542,63 +517,6 @@ ng_one2many_disconnect(hook_p hook)
OTHER FUNCTIONS
******************************************************************/
-#if 0
-/*
- * Get interface name.
- */
-static const char *
-ng_one2many_ifname(struct ng_one2many_link *link)
-{
- node_p node;
-
- node = link->hook->hk_peer->hk_node;
- if (strcmp(node->nd_type->name, "ether") != 0)
- return ("unknown");
- return (node->nd_name);
-}
-#endif
-
-/*
- * Check if interface related to given node is active.
- */
-static int
-ng_one2many_active(struct ng_one2many_link *link)
-{
- struct ng_ether_private *ethpriv;
- struct ifmediareq ifmr;
- struct ifnet *ifp;
- node_p node;
- int error;
-
- node = link->hook->hk_peer->hk_node;
- if (strcmp(node->nd_type->name, "ether") != 0)
- return (0);
- ethpriv = NG_NODE_PRIVATE(node);
- ifp = ethpriv->ifp;
- bzero(&ifmr, sizeof(ifmr));
- error = ifp->if_ioctl(ifp, SIOCGIFMEDIA, (char *)&ifmr);
- if (error != 0)
- return (0);
- if ((ifmr.ifm_status & IFM_ACTIVE) == 0)
- return (0);
- return (1);
-}
-
-/*
- * Check every priv->conf.interval seconds for active links.
- */
-static void
-ng_one2many_scan(node_p node, hook_p hook __unused, void *arg1 __unused,
- int arg2 __unused)
-{
- const priv_p priv = NG_NODE_PRIVATE(node);
-
- ng_one2many_update_many(priv);
-
- priv->callout = ng_timeout(node, NULL, priv->conf.interval * hz,
- ng_one2many_scan, NULL, 0);
-}
-
/*
* Update internal state after the addition or removal of a "many" link
*/
@@ -618,13 +536,6 @@ ng_one2many_update_many(priv_p priv)
priv->numActiveMany++;
}
break;
- case NG_ONE2MANY_FAIL_IFACE_LINK:
- if (priv->many[linkNum].hook != NULL &&
- ng_one2many_active(&priv->many[linkNum])) {
- priv->activeMany[priv->numActiveMany] = linkNum;
- priv->numActiveMany++;
- }
- break;
#ifdef INVARIANTS
default:
panic("%s: invalid failAlg", __func__);
diff --git a/sys/netgraph/ng_one2many.h b/sys/netgraph/ng_one2many.h
index 3f7ceec..bf79859 100644
--- a/sys/netgraph/ng_one2many.h
+++ b/sys/netgraph/ng_one2many.h
@@ -61,16 +61,13 @@
#define NG_ONE2MANY_XMIT_ROUNDROBIN 1 /* round-robin delivery */
#define NG_ONE2MANY_XMIT_ALL 2 /* send packets to all many hooks */
-/* Algorithms for detecting link failure */
+/* Algorithms for detecting link failure (XXX only one so far) */
#define NG_ONE2MANY_FAIL_MANUAL 1 /* use enabledLinks[] array */
-#define NG_ONE2MANY_FAIL_IFACE_LINK 2 /* use interface state */
/* Node configuration structure */
struct ng_one2many_config {
u_int32_t xmitAlg; /* how to distribute packets */
u_int32_t failAlg; /* how to detect link failure */
- u_int32_t interval; /* interval for IFACE_LINK
- failure algorithm */
u_char enabledLinks[NG_ONE2MANY_MAX_LINKS];
};
@@ -78,7 +75,6 @@ struct ng_one2many_config {
#define NG_ONE2MANY_CONFIG_TYPE_INFO(atype) { \
{ "xmitAlg", &ng_parse_uint32_type }, \
{ "failAlg", &ng_parse_uint32_type }, \
- { "interval", &ng_parse_uint32_type }, \
{ "enabledLinks", (atype) }, \
{ NULL } \
}
OpenPOWER on IntegriCloud