summaryrefslogtreecommitdiffstats
path: root/build-root/emacs-lisp/pipe-skel.el
blob: 8ad25c0482d9aab4cfe29eb1ccd0f41a1102357d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
;;; pipe-skel.el - pipelined graph node skeleton

(require 'skeleton)

(define-skeleton pipeline-node-skel
"Insert a skeleton pipelined graph node"
nil
'(setq node-name (skeleton-read "Node Name: "))
'(setq uc-node-name (upcase node-name))
'(setq nstages (skeleton-read "Number of pipeline stages: "))
"
#include <vlib/vlib.h>
#include <clib/error.h>

/*
 * Dump these counters via the \"show error\" CLI command 
 * FIXME: Add packet counter / error strings as desired
 */

#define foreach_" node-name "_error \\
_(ERROR1, \"sample counter/ error string\")

static char * " node-name "_error_strings[] = {
#define _(sym,string) string,
  foreach_" node-name "_error
#undef _
};

/*
 * packet error / counter enumeration
 *
 * To count and drop a vlib_buffer_t *b:
 *
 *     Set b->error = node->errors[" uc-node-name "_ERROR_xxx];
 *     last_stage returns a disposition index bound to \"error-drop\"
 * 
 * To manually increment the specific counter " uc-node-name "_ERROR1
 *
 *  vlib_node_t *n = vlib_get_node (vm, " node-name ".index);
 *  u32 node_counter_base_index = n->error_heap_index;
 *  vlib_error_main_t * em = &vm->error_main;
 *  em->counters[node_counter_base_index + " uc-node-name "_ERROR1] += 1;
 * 
 */

typedef enum {
#define _(sym,str) " uc-node-name "_ERROR_##sym,
    foreach_" node-name "_error
#undef _
    " uc-node-name "_N_ERROR,
} " node-name "_error_t;

/*
 * enumeration of per-packet dispositions
 * FIXME: add dispositions as desired
 */

typedef enum { \n"
"    " uc-node-name "_NEXT_NORMAL,\n"
"    " uc-node-name "_N_NEXT,
} " node-name "_next_t;

#define NSTAGES " nstages "

/* 
 * Use the generic buffer metadata + first line of packet data prefetch
 * stage function from <api/pipeline.h>. This is usually a Good Idea.
 */
#define stage0 generic_stage0

/* 
 * FIXME: add stage functions. Here is the function prototype:
 * 
 * static inline void stageN (vlib_main_t * vm,
 *                            vlib_node_runtime_t * node,
 *                            u32 buffer_index)
 */

/*
 * FIXME: the last pipeline stage returns the desired pkt next node index,
 * from the " node-name "_next_t enum above
 */
static inline u32 last_stage (vlib_main_t *vm, vlib_node_runtime_t *node,
                              u32 bi)
{
    vlib_buffer_t *b = vlib_get_buffer (vm, bi);

    b->error = node->errors[EXAMPLE_ERROR_ERROR1];

    return " uc-node-name "_NEXT_NORMAL;
}

#include <api/pipeline.h>

static uword " node-name "_node_fn (vlib_main_t * vm,
                              vlib_node_runtime_t * node,
                              vlib_frame_t * frame)
{
    return dispatch_pipeline (vm, node, frame);
}

static VLIB_REGISTER_NODE (example_node) = {
  .function = " node-name "_node_fn,
  .name = \"" node-name "-node\",
  .vector_size = sizeof (u32),
  .type = VLIB_NODE_TYPE_INTERNAL,
  
  .n_errors = ARRAY_LEN(" node-name "_error_strings),
  .error_strings = " node-name "_error_strings,

  .n_next_nodes = " uc-node-name "_N_NEXT,

  /* edit / add dispositions here */
  .next_nodes = {
        [" uc-node-name "_NEXT_NORMAL] = \"error-drop\",
  },
};

/* 
 * packet generator definition to push superframes of data into the
 * new graph node. Cut and paste into <file>, then
 * \"exec <file>\", \"pa enable test\" at the QVNET prompt...
 * 
packet-generator new {
  name test
  limit 100
  node " node-name "-node
  size 374-374
  data { hex 0x02b46b96000100096978676265000500bf436973636f20494f5320536f6674776172652c2043333735304520536f66747761726520284333373530452d554e4956455253414c2d4d292c2056657273696f6e2031322e32283335295345352c2052454c4541534520534f4654574152452028666331290a436f707972696768742028632920313938362d3230303720627920436973636f2053797374656d732c20496e632e0a436f6d70696c6564205468752031392d4a756c2d30372031363a3137206279206e616368656e00060018636973636f2057532d4333373530452d3234544400020011000000010101cc0004000000000003001b54656e4769676162697445746865726e6574312f302f3100040008000000280008002400000c011200000000ffffffff010221ff000000000000001e7a50f000ff000000090004000a00060001000b0005010012000500001300050000160011000000010101cc000400000000001a00100000000100000000ffffffff }
}
 */
")
an> | ... | *[Enc] Packet Encapsulations:* Eth-IPv4 for IPv4 routing. | ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with IPv4 | ... | routing, two static IPv4 /24 routes and IPv4 iAcl security whitelist | ... | ingress /24 filter entries applied on links TG - DUT1 and DUT2 - TG. | ... | DUT1 and DUT2 tested with ${nic_name}.\ | ... | *[Ver] TG verification:* TG finds and reports throughput NDR (Non Drop\ | ... | Rate) with zero packet loss tolerance and throughput PDR (Partial Drop\ | ... | Rate) with non-zero packet loss tolerance (LT) expressed in percentage\ | ... | of packets transmitted. NDR and PDR are discovered for different\ | ... | Ethernet L2 frame sizes using MLRsearch library.\ | ... | Test packets are generated by TG on links to DUTs. TG traffic profile | ... | contains two L3 flow-groups (flow-group per direction, 253 flows per | ... | flow-group) with all packets containing Ethernet header, IPv6 header | ... | and generated payload. MAC addresses are matching MAC addresses | ... | of the TG node interfaces. | ... | *[Ref] Applicable standard specifications:* RFC2544. *** Variables *** | @{plugins_to_enable}= | dpdk_plugin.so | ${crypto_type}= | ${None} | ${nic_name}= | Intel-X710 | ${nic_driver}= | vfio-pci | ${nic_rxq_size}= | 0 | ${nic_txq_size}= | 0 | ${nic_pfs}= | 2 | ${nic_vfs}= | 0 | ${osi_layer}= | L3 | ${overhead}= | ${0} # Traffic profile | ${traffic_profile}= | trex-stl-3n-ethip4-ip4src253 *** Keywords *** | Local Template | | [Documentation] | | ... | [Cfg] DUT runs IPv4 routing config. | | ... | Each DUT uses ${phy_cores} physical core(s) for worker threads. | | ... | [Ver] Measure NDR and PDR values using MLRsearch algorithm.\ | | | | ... | *Arguments:* | | ... | - frame_size - Framesize in Bytes in integer or string (IMIX_v4_1). | | ... | Type: integer, string | | ... | - phy_cores - Number of physical cores. Type: integer | | ... | - rxq - Number of RX queues, default value: ${None}. Type: integer | | | | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${None} | | | | Set Test Variable | \${frame_size} | | | | Given Set Max Rate And Jumbo | | And Add worker threads to all DUTs | ${phy_cores} | ${rxq} | | And Pre-initialize layer driver | ${nic_driver} | | And Apply startup configuration on all VPP DUTs | | When Initialize layer driver | ${nic_driver} | | And Initialize layer interface | | And Initialize IPv4 forwarding in circular topology | | ${table_idx} | ${skip_n} | ${match_n}= | And Vpp Creates Classify Table L3 | | ... | ${dut1} | ip4 | dst | 255.255.255.0 | | And Vpp Configures Classify Session L3 | | ... | ${dut1} | permit | ${table_idx} | ${skip_n} | ${match_n} | ip4 | dst | | ... | 20.20.20.0 | | And Vpp Enable Input Acl Interface | | ... | ${dut1} | ${DUT1_${int}1}[0] | ip4 | ${table_idx} | | ${table_idx} | ${skip_n} | ${match_n}= | And Vpp Creates Classify Table L3 | | ... | ${dut2} | ip4 | dst | 255.255.255.0 | | And Vpp Configures Classify Session L3 | | ... | ${dut2} | permit | ${table_idx} | ${skip_n} | ${match_n} | ip4 | dst | | ... | 10.10.10.0 | | And Vpp Enable Input Acl Interface | | ... | ${dut2} | ${DUT2_${int}2}[0] | ip4 | ${table_idx} | | Then Find NDR and PDR intervals using optimized search *** Test Cases *** | 64B-1c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | 64B | 1C | | frame_size=${64} | phy_cores=${1} | 64B-2c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | 64B | 2C | | frame_size=${64} | phy_cores=${2} | 64B-4c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | 64B | 4C | | frame_size=${64} | phy_cores=${4} | 1518B-1c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | 1518B | 1C | | frame_size=${1518} | phy_cores=${1} | 1518B-2c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | 1518B | 2C | | frame_size=${1518} | phy_cores=${2} | 1518B-4c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | 1518B | 4C | | frame_size=${1518} | phy_cores=${4} | 9000B-1c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | 9000B | 1C | | frame_size=${9000} | phy_cores=${1} | 9000B-2c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | 9000B | 2C | | frame_size=${9000} | phy_cores=${2} | 9000B-4c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | 9000B | 4C | | frame_size=${9000} | phy_cores=${4} | IMIX-1c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | IMIX | 1C | | frame_size=IMIX_v4_1 | phy_cores=${1} | IMIX-2c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | IMIX | 2C | | frame_size=IMIX_v4_1 | phy_cores=${2} | IMIX-4c-ethip4-ip4base-iacldstbase-ndrpdr | | [Tags] | IMIX | 4C | | frame_size=IMIX_v4_1 | phy_cores=${4}