Deleted Added
full compact
ng_source.c (141745) ng_source.c (143387)
1/*
2 * ng_source.c
3 */
4
5/*-
6 * Copyright 2002 Sandvine Inc.
7 * All rights reserved.
8 *

--- 24 unchanged lines hidden (view full) ---

33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF SANDVINE IS ADVISED OF THE POSSIBILITY OF SUCH
35 * DAMAGE.
36 *
37 * Author: Dave Chapeskie <dchapeskie@sandvine.com>
38 */
39
40#include <sys/cdefs.h>
1/*
2 * ng_source.c
3 */
4
5/*-
6 * Copyright 2002 Sandvine Inc.
7 * All rights reserved.
8 *

--- 24 unchanged lines hidden (view full) ---

33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF SANDVINE IS ADVISED OF THE POSSIBILITY OF SUCH
35 * DAMAGE.
36 *
37 * Author: Dave Chapeskie <dchapeskie@sandvine.com>
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/netgraph/ng_source.c 141745 2005-02-12 17:03:01Z ru $");
41__FBSDID("$FreeBSD: head/sys/netgraph/ng_source.c 143387 2005-03-10 21:50:50Z bmilekic $");
42
43/*
44 * This node is used for high speed packet geneneration. It queues
42
43/*
44 * This node is used for high speed packet geneneration. It queues
45 * all data recieved on it's 'input' hook and when told to start via
46 * a control message it sends the packets out it's 'output' hook. In
47 * this way this node can be preloaded with a packet stream which is
48 * continuously sent.
45 * all data recieved on its 'input' hook and when told to start via
46 * a control message it sends the packets out its 'output' hook. In
47 * this way this node can be preloaded with a packet stream which it
48 * can then send continuously as fast as possible.
49 *
50 * Currently it just copies the mbufs as required. It could do various
51 * tricks to try and avoid this. Probably the best performance would
52 * be achieved by modifying the appropriate drivers to be told to
53 * self-re-enqueue packets (e.g. the if_bge driver could reuse the same
54 * transmit descriptors) under control of this node; perhaps via some
49 *
50 * Currently it just copies the mbufs as required. It could do various
51 * tricks to try and avoid this. Probably the best performance would
52 * be achieved by modifying the appropriate drivers to be told to
53 * self-re-enqueue packets (e.g. the if_bge driver could reuse the same
54 * transmit descriptors) under control of this node; perhaps via some
55 * flag in the mbuf or some such. The node would peak at an appropriate
55 * flag in the mbuf or some such. The node could peek at an appropriate
56 * ifnet flag to see if such support is available for the connected
57 * interface.
58 */
59
60#include <sys/param.h>
61#include <sys/systm.h>
62#include <sys/errno.h>
63#include <sys/kernel.h>

--- 6 unchanged lines hidden (view full) ---

70#include <netgraph/netgraph.h>
71#include <netgraph/ng_parse.h>
72#include <netgraph/ng_ether.h>
73#include <netgraph/ng_source.h>
74
75#define NG_SOURCE_INTR_TICKS 1
76#define NG_SOURCE_DRIVER_IFQ_MAXLEN (4*1024)
77
56 * ifnet flag to see if such support is available for the connected
57 * interface.
58 */
59
60#include <sys/param.h>
61#include <sys/systm.h>
62#include <sys/errno.h>
63#include <sys/kernel.h>

--- 6 unchanged lines hidden (view full) ---

70#include <netgraph/netgraph.h>
71#include <netgraph/ng_parse.h>
72#include <netgraph/ng_ether.h>
73#include <netgraph/ng_source.h>
74
75#define NG_SOURCE_INTR_TICKS 1
76#define NG_SOURCE_DRIVER_IFQ_MAXLEN (4*1024)
77
78
79/* Per hook info */
80struct source_hookinfo {
81 hook_p hook;
82};
83
84/* Per node info */
85struct privdata {
86 node_p node;

--- 24 unchanged lines hidden (view full) ---

111static int ng_source_request_output_ifp (sc_p);
112static void ng_source_clr_data (sc_p);
113static void ng_source_start (sc_p);
114static void ng_source_stop (sc_p);
115static int ng_source_send (sc_p, int, int *);
116static int ng_source_store_output_ifp(sc_p sc,
117 struct ng_mesg *msg);
118
78/* Per hook info */
79struct source_hookinfo {
80 hook_p hook;
81};
82
83/* Per node info */
84struct privdata {
85 node_p node;

--- 24 unchanged lines hidden (view full) ---

110static int ng_source_request_output_ifp (sc_p);
111static void ng_source_clr_data (sc_p);
112static void ng_source_start (sc_p);
113static void ng_source_stop (sc_p);
114static int ng_source_send (sc_p, int, int *);
115static int ng_source_store_output_ifp(sc_p sc,
116 struct ng_mesg *msg);
117
119
120/* Parse type for timeval */
121static const struct ng_parse_struct_field ng_source_timeval_type_fields[] = {
122 { "tv_sec", &ng_parse_int32_type },
123 { "tv_usec", &ng_parse_int32_type },
124 { NULL }
125};
126const struct ng_parse_type ng_source_timeval_type = {
127 &ng_parse_struct_type,

--- 570 unchanged lines hidden ---
118/* Parse type for timeval */
119static const struct ng_parse_struct_field ng_source_timeval_type_fields[] = {
120 { "tv_sec", &ng_parse_int32_type },
121 { "tv_usec", &ng_parse_int32_type },
122 { NULL }
123};
124const struct ng_parse_type ng_source_timeval_type = {
125 &ng_parse_struct_type,

--- 570 unchanged lines hidden ---