diff options
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r-- | trafgen_parser.y | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y index 6526756..8ebf464 100644 --- a/trafgen_parser.y +++ b/trafgen_parser.y @@ -461,7 +461,7 @@ static void proto_field_expr_eval(void) %token K_CPU K_CSUMIP K_CSUMUDP K_CSUMTCP K_CSUMUDP6 K_CSUMTCP6 K_CONST8 K_CONST16 K_CONST32 K_CONST64 %token K_DADDR K_SADDR K_ETYPE K_TYPE -%token K_TIME +%token K_TIME K_PRIO %token K_OPER K_SHA K_SPA K_THA K_TPA K_REQUEST K_REPLY K_PTYPE K_HTYPE %token K_PROT K_TTL K_DSCP K_ECN K_TOS K_LEN K_ID K_FLAGS K_FRAG K_IHL K_VER K_CSUM K_DF K_MF %token K_FLOW K_NEXT_HDR K_HOP_LIMIT @@ -475,6 +475,7 @@ static void proto_field_expr_eval(void) %token K_ETH %token K_PAUSE +%token K_PFC %token K_VLAN K_MPLS %token K_ARP %token K_IP4 K_IP6 @@ -702,6 +703,7 @@ ddec proto : eth_proto { } | pause_proto { } + | pfc_proto { } | vlan_proto { } | mpls_proto { } | arp_proto { } @@ -806,6 +808,42 @@ pause_expr { proto_field_expr_eval(); } ; +pfc_proto + : pfc '(' pfc_param_list ')' { } + ; + +pfc + : K_PFC { proto_add(PROTO_PFC); } + ; + +pfc_param_list + : { } + | pfc_expr { } + | pfc_expr delimiter pfc_param_list { } + ; + +pfc_field + : K_CODE { proto_field_set(PFC_OPCODE); } + | K_PRIO { proto_field_set(PFC_PRIO); } + | K_PRIO '(' number ')' + { if ($3 > 7) { + yyerror("pfc: Invalid prio(index) parameter"); + panic("pfc: prio(0)..prio(7) is allowed only\n"); + } + proto_field_set(PFC_PRIO_0 + $3); } + | K_TIME '(' number ')' + { if ($3 > 7) { + yyerror("pfc: Invalid time(index) parameter"); + panic("pfc: time(0)..time(7) is allowed only\n"); + } + proto_field_set(PFC_TIME_0 + $3); } + ; + +pfc_expr + : pfc_field skip_white '=' skip_white field_expr + { proto_field_expr_eval(); } + ; + vlan_proto : vlan '(' vlan_param_list ')' { } ; |