Skip to content

Commit

Permalink
Add supported features lists
Browse files Browse the repository at this point in the history
  • Loading branch information
rpt committed Jun 6, 2012
1 parent 0460bef commit 87c3ace
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 22 deletions.
33 changes: 33 additions & 0 deletions apps/of_switch/include/ofs_userspace.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,39 @@
-include_lib("of_protocol/include/of_protocol.hrl").
-include_lib("of_switch/include/of_switch.hrl").

-define(SUPPORTED_WRITE_ACTIONS, [output, group, set_queue
%% set_mpls_ttl, dec_mpls_ttl,
%% set_nw_ttl, dec_nw_ttl,
%% copy_ttl_out, copy_ttl_in,
%% push_vlan, pop_vlan,
%% push_mpls, pop_mpls,
%% set_field,
%% experimenter
]).
-define(SUPPORTED_APPLY_ACTIONS, ?SUPPORTED_WRITE_ACTIONS).
-define(SUPPORTED_MATCH_FIELDS, [in_port, %% in_phy_port, metadata,
eth_dst, eth_src, eth_type,
vlan_vid, vlan_pcp,
ip_dscp, ip_ecn, ip_proto,
ipv4_src, ipv4_dst,
tcp_src, tcp_dst,
udp_src, udp_dst,
sctp_src, sctp_dst,
icmpv4_type, icmpv4_code,
arp_op, arp_spa, arp_tpa, arp_sha, arp_tha,
ipv6_src, ipv6_dst, ipv6_flabel,
icmpv6_type, icmpv6_code,
ipv6_nd_target, ipv6_nd_sll, ipv6_nd_tll,
mpls_label, mpls_tc]).
-define(SUPPORTED_WILDCARDS, ?SUPPORTED_MATCH_FIELDS).
-define(SUPPORTED_WRITE_SETFIELDS, []).
-define(SUPPORTED_APPLY_SETFIELDS, ?SUPPORTED_WRITE_SETFIELDS).
-define(SUPPORTED_INSTRUCTIONS, [goto_table,
%% write_metadata,
write_actions, apply_actions, clear_actions
%% experimenter
]).

-record(flow_entry, {
priority :: integer(),
match :: ofp_match(),
Expand Down
29 changes: 7 additions & 22 deletions apps/of_switch/src/ofs_userspace_stats.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,25 @@

-define(MAX_FLOW_TABLE_ENTRIES, (1 bsl 24)). %% some arbitrary big number

-define(SUPPORTED_FIELD_TYPES, [in_port,
eth_dst,
eth_src,
eth_type,
ip_proto,
ipv4_src,
ipv4_dst,
tcp_src,
tcp_dst,
udp_src,
udp_dst,
ipv6_src,
ipv6_dst]).

%%% Stats functions ------------------------------------------------------------

table_stats(#flow_table{id = Id, entries = Entries, config = Config}) ->
TableName = list_to_binary(io_lib:format("Flow Table 0x~2.16.0b", [Id])),
Instructions = [goto_table, write_actions, apply_actions, clear_actions],
ActiveCount = length(Entries),
[#flow_table_counter{packet_lookups = LookupCount,
packet_matches = MatchedCount}] =
ets:lookup(flow_table_counters, Id),
#ofp_table_stats{table_id = Id,
name = TableName,
match = ?SUPPORTED_FIELD_TYPES,
wildcards = ?SUPPORTED_FIELD_TYPES,
write_actions = [output, group],
apply_actions = [output, group],
write_setfields = [],
apply_setfields = [],
match = ?SUPPORTED_MATCH_FIELDS,
wildcards = ?SUPPORTED_WILDCARDS,
write_actions = ?SUPPORTED_WRITE_ACTIONS,
apply_actions = ?SUPPORTED_APPLY_ACTIONS,
write_setfields = ?SUPPORTED_WRITE_SETFIELDS,
apply_setfields = ?SUPPORTED_APPLY_SETFIELDS,
metadata_match = <<-1:64>>,
metadata_write = <<-1:64>>,
instructions = Instructions,
instructions = ?SUPPORTED_INSTRUCTIONS,
config = Config,
max_entries = ?MAX_FLOW_TABLE_ENTRIES,
active_count = ActiveCount,
Expand Down

0 comments on commit 87c3ace

Please sign in to comment.