22// License, v. 2.0. If a copy of the MPL was not distributed with this
33// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
5- // Copyright 2025 Oxide Computer Company
5+ // Copyright 2026 Oxide Computer Company
66
77use super :: API_VERSION ;
88use super :: RuleId ;
@@ -25,40 +25,95 @@ pub const XDE_IOC_OPTE_CMD: i32 = XDE_IOC as i32 | 0x01;
2525#[ derive( Clone , Copy , Debug ) ]
2626#[ repr( C ) ]
2727pub enum OpteCmd {
28- ListPorts = 1 , // list all ports
29- AddFwRule = 20 , // add firewall rule
30- RemFwRule = 21 , // remove firewall rule
31- SetFwRules = 22 , // set/replace all firewall rules at once
32- DumpTcpFlows = 30 , // dump TCP flows
33- DumpLayer = 31 , // dump the specified Layer
34- DumpUft = 32 , // dump the Unified Flow Table
35- ListLayers = 33 , // list the layers on a given port
36- ClearUft = 40 , // clear the UFT
37- ClearLft = 41 , // clear the given Layer's Flow Table
38- SetVirt2Phys = 50 , // set a v2p mapping
39- DumpVirt2Phys = 51 , // dump the v2p mappings
40- SetVirt2Boundary = 52 , // set a v2b mapping
41- ClearVirt2Boundary = 53 , // clear a v2b mapping
42- DumpVirt2Boundary = 54 , // dump the v2b mappings
43- ClearVirt2Phys = 55 , // clear a v2p mapping
44- AddRouterEntry = 60 , // add a router entry for IP dest
45- DelRouterEntry = 61 , // remove a router entry for IP dest
46- CreateXde = 70 , // create a new xde device
47- DeleteXde = 71 , // delete an xde device
48- SetXdeUnderlay = 72 , // set xde underlay devices
49- ClearXdeUnderlay = 73 , // clear xde underlay devices
50- SetExternalIps = 80 , // set xde external IPs for a port
51- AllowCidr = 90 , // allow ip block through gateway tx/rx
52- RemoveCidr = 91 , // deny ip block through gateway tx/rx
53- SetMcastForwarding = 100 , // set multicast forwarding entries
54- ClearMcastForwarding = 101 , // clear multicast forwarding entries
55- DumpMcastForwarding = 102 , // dump multicast forwarding table
56- McastSubscribe = 103 , // subscribe a port to a multicast group
57- McastUnsubscribe = 104 , // unsubscribe a port from a multicast group
58- SetMcast2Phys = 105 , // set M2P mapping (group -> underlay mcast)
59- ClearMcast2Phys = 106 , // clear M2P mapping
60- DumpMcastSubscriptions = 107 , // dump multicast subscription table
61- McastUnsubscribeAll = 108 , // unsubscribe all ports from a multicast group
28+ /// List all ports.
29+ ListPorts = 1 ,
30+
31+ /// Add a firewall rule.
32+ AddFwRule = 20 ,
33+ /// Remove a firewall rule.
34+ RemFwRule = 21 ,
35+ /// Set/replace all firewall rules at once.
36+ SetFwRules = 22 ,
37+
38+ /// Read out TCP flows and statistics.
39+ DumpTcpFlows = 30 ,
40+ /// Read out installed rules and hit counters in a given layer.
41+ DumpLayer = 31 ,
42+ /// Read out UFT (fastpath) flow entries and their associated counters.
43+ DumpUft = 32 ,
44+ /// List the layers on a given port.
45+ ListLayers = 33 ,
46+
47+ /// Clear the UFT (fastpath) for a port.
48+ ClearUft = 40 ,
49+ /// Clear a layer's flow table.
50+ ClearLft = 41 ,
51+
52+ /// Set a V2P mapping.
53+ SetVirt2Phys = 50 ,
54+ /// Read out all V2P mappings.
55+ DumpVirt2Phys = 51 ,
56+ /// Set a V2B mapping.
57+ SetVirt2Boundary = 52 ,
58+ /// Remove a V2B mapping.
59+ ClearVirt2Boundary = 53 ,
60+ /// Read out all V2B mappings.
61+ DumpVirt2Boundary = 54 ,
62+ /// Remove a V2P mapping.
63+ ClearVirt2Phys = 55 ,
64+
65+ /// Add a router entry for an IP destination CIDR.
66+ AddRouterEntry = 60 ,
67+ /// Remove a router entry for an IP destination CIDR.
68+ DelRouterEntry = 61 ,
69+
70+ /// Create a new XDE device.
71+ ///
72+ /// Requires that `SetXdeUnderlay` has been successfully called.
73+ CreateXde = 70 ,
74+ /// Delete an XDE device.
75+ DeleteXde = 71 ,
76+ /// Set the physical devices which XDE should transmit over.
77+ SetXdeUnderlay = 72 ,
78+ /// Unbind the underlay devices.
79+ ///
80+ /// Requires that no XDE ports exist.
81+ ClearXdeUnderlay = 73 ,
82+
83+ /// Set all external IP config for a port.
84+ SetExternalIps = 80 ,
85+
86+ /// Add a transit IP CIDR to this port's allow list.
87+ ///
88+ /// NOOPs if the given CIDR is an attached subnet.
89+ AllowCidr = 90 ,
90+ /// Remove a transit IP CIDR from this port's allow list.
91+ ///
92+ /// NOOPs if the given CIDR is an attached subnet.
93+ RemoveCidr = 91 ,
94+ /// Add or set the config of an attached subnet.
95+ AttachSubnet = 92 ,
96+ /// Remove an attached subnet.
97+ DetachSubnet = 93 ,
98+
99+ /// Set multicast forwarding entries.
100+ SetMcastForwarding = 100 ,
101+ /// Clear multicast forwarding entries.
102+ ClearMcastForwarding = 101 ,
103+ /// Read out the multicast forwarding table.
104+ DumpMcastForwarding = 102 ,
105+ /// Subscribe a port to a multicast group.
106+ McastSubscribe = 103 ,
107+ /// Unsubscribe a port to a multicast group.
108+ McastUnsubscribe = 104 ,
109+ /// Set an M2P mapping (group -> underlay mcast).
110+ SetMcast2Phys = 105 ,
111+ /// Remove an M2P mapping.
112+ ClearMcast2Phys = 106 ,
113+ /// Read out the table of multicast subscriptions.
114+ DumpMcastSubscriptions = 107 ,
115+ /// Unsubscribe all ports from a multicast group.
116+ McastUnsubscribeAll = 108 ,
62117}
63118
64119impl TryFrom < c_int > for OpteCmd {
0 commit comments