| 1 |
.TH "actions in tc" 8 "1 Aug 2017" "iproute2" "Linux" |
| 2 |
|
| 3 |
.SH NAME |
| 4 |
actions \- independently defined actions in tc |
| 5 |
.SH SYNOPSIS |
| 6 |
.B tc |
| 7 |
[ |
| 8 |
.I TC_OPTIONS |
| 9 |
] |
| 10 |
.B actions |
| 11 |
.BR add " | " change " | " replace |
| 12 |
.I ACTSPEC |
| 13 |
|
| 14 |
.B tc |
| 15 |
[ |
| 16 |
.I TC_OPTIONS |
| 17 |
] |
| 18 |
.B actions |
| 19 |
.BR get " | " delete |
| 20 |
.I ACTISPEC |
| 21 |
|
| 22 |
.B tc |
| 23 |
[ |
| 24 |
.I TC_OPTIONS |
| 25 |
] |
| 26 |
.B actions flush |
| 27 |
.I ACTNAMESPEC |
| 28 |
|
| 29 |
.B tc |
| 30 |
[ |
| 31 |
.I TC_OPTIONS |
| 32 |
] |
| 33 |
.B actions |
| 34 |
.BR ls " | " list |
| 35 |
.I ACTNAMESPEC |
| 36 |
[ |
| 37 |
.I ACTFILTER |
| 38 |
] |
| 39 |
|
| 40 |
.in +8 |
| 41 |
.I ACTSPEC |
| 42 |
:= |
| 43 |
.B action |
| 44 |
.I ACTDETAIL |
| 45 |
[ |
| 46 |
.I INDEXSPEC |
| 47 |
] [ |
| 48 |
.I COOKIESPEC |
| 49 |
] [ |
| 50 |
.I FLAGS |
| 51 |
] [ |
| 52 |
.I HWSTATSSPEC |
| 53 |
] [ |
| 54 |
.I CONTROL |
| 55 |
] [ |
| 56 |
.I SKIPSPEC |
| 57 |
] |
| 58 |
|
| 59 |
.I ACTISPEC |
| 60 |
:= |
| 61 |
.I ACTNAMESPEC INDEXSPEC |
| 62 |
|
| 63 |
.I ACTNAMESPEC |
| 64 |
:= |
| 65 |
.B action |
| 66 |
ACTNAME |
| 67 |
|
| 68 |
.I INDEXSPEC |
| 69 |
:= |
| 70 |
.BI index " INDEX" |
| 71 |
|
| 72 |
.I ACTFILTER |
| 73 |
:= |
| 74 |
.BI since " MSTIME" |
| 75 |
|
| 76 |
.I COOKIESPEC |
| 77 |
:= |
| 78 |
.BI cookie " COOKIE" |
| 79 |
|
| 80 |
.I FLAGS |
| 81 |
:= |
| 82 |
.I no_percpu |
| 83 |
|
| 84 |
.I HWSTATSSPEC |
| 85 |
:= |
| 86 |
.BR hw_stats " {" |
| 87 |
.IR immediate " | " delayed " | " disabled " }" |
| 88 |
|
| 89 |
.I ACTDETAIL |
| 90 |
:= |
| 91 |
.I ACTNAME ACTPARAMS |
| 92 |
|
| 93 |
.I ACTNAME |
| 94 |
may be any valid action type: gact, mirred, bpf, connmark, csum, police, etc. |
| 95 |
|
| 96 |
.I MSTIME |
| 97 |
Time since last update. |
| 98 |
|
| 99 |
.I CONTROL |
| 100 |
:= { |
| 101 |
.IR reclassify " | " pipe " | " drop " | " continue " | " ok |
| 102 |
} |
| 103 |
|
| 104 |
.I SKIPSPEC |
| 105 |
:= { |
| 106 |
.IR skip_sw " | " skip_hw |
| 107 |
} |
| 108 |
|
| 109 |
.I TC_OPTIONS |
| 110 |
These are the options that are specific to |
| 111 |
.B tc |
| 112 |
and not only the options. Refer to |
| 113 |
.BR tc(8) |
| 114 |
for more information. |
| 115 |
.in |
| 116 |
|
| 117 |
.SH DESCRIPTION |
| 118 |
|
| 119 |
The |
| 120 |
.B actions |
| 121 |
object in |
| 122 |
.B tc |
| 123 |
allows a user to define actions independently of a classifier (filter). These |
| 124 |
actions can then be assigned to one or more filters, with any |
| 125 |
packets matching the classifier's criteria having that action performed |
| 126 |
on them. |
| 127 |
|
| 128 |
Each action type (mirred, police, etc.) will have its own table to store |
| 129 |
all created actions. |
| 130 |
|
| 131 |
.SH OPERATIONS |
| 132 |
.TP |
| 133 |
.B add |
| 134 |
Create a new action in that action's table. |
| 135 |
|
| 136 |
.TP |
| 137 |
.B change |
| 138 |
.TQ |
| 139 |
.B replace |
| 140 |
Make modifications to an existing action. |
| 141 |
.TP |
| 142 |
.B get |
| 143 |
Display the action with the specified index value. When combined with the |
| 144 |
.B -s |
| 145 |
option for |
| 146 |
.BR tc "," |
| 147 |
display the statistics for that action. |
| 148 |
.TP |
| 149 |
.B delete |
| 150 |
Delete the action with the specified index value. If the action is already |
| 151 |
associated with a classifier, it does not delete the classifier. |
| 152 |
.TP |
| 153 |
.B ls |
| 154 |
.TQ |
| 155 |
.B list |
| 156 |
List all the actions in the specified table. When combined with the |
| 157 |
.B -s |
| 158 |
option for |
| 159 |
.BR tc "," |
| 160 |
display the statistics for all actions in the specified table. |
| 161 |
When combined with the option |
| 162 |
.B since |
| 163 |
allows doing a millisecond time-filter since the last time an |
| 164 |
action was used in the datapath. |
| 165 |
.TP |
| 166 |
.B flush |
| 167 |
Delete all actions stored in the specified table. |
| 168 |
|
| 169 |
.SH ACTION OPTIONS |
| 170 |
Note that these options are available to all action types. |
| 171 |
.TP |
| 172 |
.BI index " INDEX" |
| 173 |
Specify the table index value of an action. |
| 174 |
.I INDEX |
| 175 |
is a 32-bit value that is unique to the specific type of action referenced. |
| 176 |
|
| 177 |
.RS |
| 178 |
For |
| 179 |
.BR add ", " change ", and" |
| 180 |
.B replace |
| 181 |
operations, the index is |
| 182 |
.BR optional. |
| 183 |
When adding a new action, |
| 184 |
specifying an index value will assign the action to that index unless that |
| 185 |
index value has already been assigned. Omitting the index value for an add |
| 186 |
operation will cause the kernel to assign a value to the new action. |
| 187 |
.RE |
| 188 |
|
| 189 |
.RS |
| 190 |
For |
| 191 |
.BR get " and " delete |
| 192 |
operations, the index is |
| 193 |
.B required |
| 194 |
to identify the specific action to be displayed or deleted. |
| 195 |
.RE |
| 196 |
|
| 197 |
.TP |
| 198 |
.BI cookie " COOKIE" |
| 199 |
In addition to the specific action, mark the matching packet with the value |
| 200 |
specified by |
| 201 |
.IR COOKIE "." |
| 202 |
The |
| 203 |
.I COOKIE |
| 204 |
is a 128-bit value that will not be interpreted by the kernel whatsoever. |
| 205 |
As such, it can be used as a correlating value for maintaining user state. |
| 206 |
The value to be stored is completely arbitrary and does not require a specific |
| 207 |
format. It is stored inside the action structure itself. |
| 208 |
|
| 209 |
.TP |
| 210 |
.I FLAGS |
| 211 |
Action-specific flags. Currently, the only supported flag is |
| 212 |
.I no_percpu |
| 213 |
which indicates that action is expected to have minimal software data-path |
| 214 |
traffic and doesn't need to allocate stat counters with percpu allocator. |
| 215 |
This option is intended to be used by hardware-offloaded actions. |
| 216 |
|
| 217 |
.TP |
| 218 |
.BI hw_stats " HW_STATS" |
| 219 |
Specifies the type of HW stats of new action. If omitted, any stats counter type |
| 220 |
is going to be used, according to driver and its resources. |
| 221 |
The |
| 222 |
.I HW_STATS |
| 223 |
indicates the type. Any of the following are valid: |
| 224 |
.RS |
| 225 |
.TP |
| 226 |
.B immediate |
| 227 |
Means that in dump, user gets the current HW stats state from the device |
| 228 |
queried at the dump time. |
| 229 |
.TP |
| 230 |
.B delayed |
| 231 |
Means that in dump, user gets HW stats that might be out of date for |
| 232 |
some time, maybe couple of seconds. This is the case when driver polls |
| 233 |
stats updates periodically or when it gets async stats update |
| 234 |
from the device. |
| 235 |
.TP |
| 236 |
.B disabled |
| 237 |
No HW stats are going to be available in dump. |
| 238 |
.RE |
| 239 |
|
| 240 |
.TP |
| 241 |
.BI since " MSTIME" |
| 242 |
When dumping large number of actions, a millisecond time-filter can be |
| 243 |
specified |
| 244 |
.IR MSTIME "." |
| 245 |
The |
| 246 |
.I MSTIME |
| 247 |
is a millisecond count since last time a packet hit the action. |
| 248 |
As an example specifying "since 20000" implies to dump all actions |
| 249 |
that have seen packets in the last 20 seconds. This option is useful |
| 250 |
when the kernel has a large number of actions and you are only interested |
| 251 |
in recently used actions. |
| 252 |
|
| 253 |
.TP |
| 254 |
.I CONTROL |
| 255 |
The |
| 256 |
.I CONTROL |
| 257 |
indicates how |
| 258 |
.B tc |
| 259 |
should proceed after executing the action. Any of the following are valid: |
| 260 |
.RS |
| 261 |
.TP |
| 262 |
.B reclassify |
| 263 |
Restart the classifiction by jumping back to the first filter attached to |
| 264 |
the action's parent. |
| 265 |
.TP |
| 266 |
.B pipe |
| 267 |
Continue with the next action. This is the default control. |
| 268 |
.TP |
| 269 |
.B drop |
| 270 |
Drop the packet without running any further actions. |
| 271 |
.TP |
| 272 |
.B continue |
| 273 |
Continue the classification with the next filter. |
| 274 |
.TP |
| 275 |
.B pass |
| 276 |
Return to the calling qdisc for packet processing, and end classification of |
| 277 |
this packet. |
| 278 |
.RE |
| 279 |
|
| 280 |
.TP |
| 281 |
.I SKIPSPEC |
| 282 |
The |
| 283 |
.I SKIPSPEC |
| 284 |
indicates how |
| 285 |
.B tc |
| 286 |
should proceed when executing the action. Any of the following are valid: |
| 287 |
.RS |
| 288 |
.TP |
| 289 |
.B skip_sw |
| 290 |
Do not process action by software. If hardware has no offload support for this |
| 291 |
action, operation will fail. |
| 292 |
.TP |
| 293 |
.B skip_hw |
| 294 |
Do not process action by hardware. |
| 295 |
.RE |
| 296 |
|
| 297 |
.SH SEE ALSO |
| 298 |
.BR tc (8), |
| 299 |
.BR tc-bpf (8), |
| 300 |
.BR tc-connmark (8), |
| 301 |
.BR tc-csum (8), |
| 302 |
.BR tc-ife (8), |
| 303 |
.BR tc-mirred (8), |
| 304 |
.BR tc-nat (8), |
| 305 |
.BR tc-pedit (8), |
| 306 |
.BR tc-police (8), |
| 307 |
.BR tc-simple (8), |
| 308 |
.BR tc-skbedit (8), |
| 309 |
.BR tc-skbmod (8), |
| 310 |
.BR tc-tunnel_key (8), |
| 311 |
.BR tc-vlan (8), |
| 312 |
.BR tc-xt (8) |