Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'devlink-finish-conversion-to-generated-split_ops'

Jiri Pirko says:

====================
devlink: finish conversion to generated split_ops

This patchset converts the remaining genetlink commands to generated
split_ops and removes the existing small_ops arrays entirely
alongside with shared netlink attribute policy.

Patches #1-#6 are just small preparations and small fixes on multiple
places. Note that couple of patches contain the "Fixes"
tag but no need to put them into -net tree.
Patch #7 is a simple rename preparation
Patch #8 is the main one in this set and adds actual definitions of cmds
in to yaml file.
Patches #9-#10 finalize the change removing bits that are no longer in
use.
====================

Link: https://lore.kernel.org/r/20231021112711.660606-1-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+9542 -558
+1474 -84
Documentation/netlink/specs/devlink.yaml
··· 15 15 name: ingress 16 16 - 17 17 name: egress 18 + - 19 + type: enum 20 + name: port-type 21 + entries: 22 + - 23 + name: notset 24 + - 25 + name: auto 26 + - 27 + name: eth 28 + - 29 + name: ib 30 + - 31 + type: enum 32 + name: port-flavour 33 + entries: 34 + - 35 + name: physical 36 + - 37 + name: cpu 38 + - 39 + name: dsa 40 + - 41 + name: pci_pf 42 + - 43 + name: pci_vf 44 + - 45 + name: virtual 46 + - 47 + name: unused 48 + - 49 + name: pci_sf 50 + - 51 + type: enum 52 + name: port-fn-state 53 + entries: 54 + - 55 + name: inactive 56 + - 57 + name: active 58 + - 59 + type: enum 60 + name: port-fn-opstate 61 + entries: 62 + - 63 + name: detached 64 + - 65 + name: attached 66 + - 67 + type: enum 68 + name: port-fn-attr-cap 69 + entries: 70 + - 71 + name: roce-bit 72 + - 73 + name: migratable-bit 74 + - 75 + type: enum 76 + name: sb-threshold-type 77 + entries: 78 + - 79 + name: static 80 + - 81 + name: dynamic 82 + - 83 + type: enum 84 + name: eswitch-mode 85 + entries: 86 + - 87 + name: legacy 88 + - 89 + name: switchdev 90 + - 91 + type: enum 92 + name: eswitch-inline-mode 93 + entries: 94 + - 95 + name: none 96 + - 97 + name: link 98 + - 99 + name: network 100 + - 101 + name: transport 102 + - 103 + type: enum 104 + name: eswitch-encap-mode 105 + entries: 106 + - 107 + name: none 108 + - 109 + name: basic 110 + - 111 + type: enum 112 + name: dpipe-match-type 113 + entries: 114 + - 115 + name: field-exact 116 + - 117 + type: enum 118 + name: dpipe-action-type 119 + entries: 120 + - 121 + name: field-modify 122 + - 123 + type: enum 124 + name: dpipe-field-mapping-type 125 + entries: 126 + - 127 + name: none 128 + - 129 + name: ifindex 130 + - 131 + type: enum 132 + name: resource-unit 133 + entries: 134 + - 135 + name: entry 136 + - 137 + type: enum 138 + name: reload-action 139 + entries: 140 + - 141 + name: driver-reinit 142 + value: 1 143 + - 144 + name: fw-activate 145 + - 146 + type: enum 147 + name: param-cmode 148 + entries: 149 + - 150 + name: runtime 151 + - 152 + name: driverinit 153 + - 154 + name: permanent 155 + - 156 + type: enum 157 + name: flash-overwrite 158 + entries: 159 + - 160 + name: settings-bit 161 + - 162 + name: identifiers-bit 163 + - 164 + type: enum 165 + name: trap-action 166 + entries: 167 + - 168 + name: drop 169 + - 170 + name: trap 171 + - 172 + name: mirror 18 173 19 174 attribute-sets: 20 175 - ··· 186 31 - 187 32 name: port-index 188 33 type: u32 34 + - 35 + name: port-type 36 + type: u16 37 + enum: port-type 38 + 39 + # TODO: fill in the attributes in between 40 + 41 + - 42 + name: port-split-count 43 + type: u32 44 + value: 9 189 45 190 46 # TODO: fill in the attributes in between 191 47 ··· 211 45 name: sb-pool-index 212 46 type: u16 213 47 value: 17 214 - 215 48 - 216 49 name: sb-pool-type 217 50 type: u8 218 51 enum: sb-pool-type 219 - 220 - # TODO: fill in the attributes in between 221 - 52 + - 53 + name: sb-pool-size 54 + type: u32 55 + - 56 + name: sb-pool-threshold-type 57 + type: u8 58 + enum: sb-threshold-type 59 + - 60 + name: sb-threshold 61 + type: u32 222 62 - 223 63 name: sb-tc-index 224 64 type: u16 225 65 value: 22 66 + 67 + # TODO: fill in the attributes in between 68 + 69 + - 70 + name: eswitch-mode 71 + type: u16 72 + value: 25 73 + enum: eswitch-mode 74 + 75 + - 76 + name: eswitch-inline-mode 77 + type: u16 78 + enum: eswitch-inline-mode 79 + - 80 + name: dpipe-tables 81 + type: nest 82 + nested-attributes: dl-dpipe-tables 83 + - 84 + name: dpipe-table 85 + type: nest 86 + multi-attr: true 87 + nested-attributes: dl-dpipe-table 88 + - 89 + name: dpipe-table-name 90 + type: string 91 + - 92 + name: dpipe-table-size 93 + type: u64 94 + - 95 + name: dpipe-table-matches 96 + type: nest 97 + nested-attributes: dl-dpipe-table-matches 98 + - 99 + name: dpipe-table-actions 100 + type: nest 101 + nested-attributes: dl-dpipe-table-actions 102 + - 103 + name: dpipe-table-counters-enabled 104 + type: u8 105 + - 106 + name: dpipe-entries 107 + type: nest 108 + nested-attributes: dl-dpipe-entries 109 + - 110 + name: dpipe-entry 111 + type: nest 112 + multi-attr: true 113 + nested-attributes: dl-dpipe-entry 114 + - 115 + name: dpipe-entry-index 116 + type: u64 117 + - 118 + name: dpipe-entry-match-values 119 + type: nest 120 + nested-attributes: dl-dpipe-entry-match-values 121 + - 122 + name: dpipe-entry-action-values 123 + type: nest 124 + nested-attributes: dl-dpipe-entry-action-values 125 + - 126 + name: dpipe-entry-counter 127 + type: u64 128 + - 129 + name: dpipe-match 130 + type: nest 131 + multi-attr: true 132 + nested-attributes: dl-dpipe-match 133 + - 134 + name: dpipe-match-value 135 + type: nest 136 + multi-attr: true 137 + nested-attributes: dl-dpipe-match-value 138 + - 139 + name: dpipe-match-type 140 + type: u32 141 + enum: dpipe-match-type 142 + - 143 + name: dpipe-action 144 + type: nest 145 + multi-attr: true 146 + nested-attributes: dl-dpipe-action 147 + - 148 + name: dpipe-action-value 149 + type: nest 150 + multi-attr: true 151 + nested-attributes: dl-dpipe-action-value 152 + - 153 + name: dpipe-action-type 154 + type: u32 155 + enum: dpipe-action-type 156 + - 157 + name: dpipe-value 158 + type: binary 159 + - 160 + name: dpipe-value-mask 161 + type: binary 162 + - 163 + name: dpipe-value-mapping 164 + type: u32 165 + - 166 + name: dpipe-headers 167 + type: nest 168 + nested-attributes: dl-dpipe-headers 169 + - 170 + name: dpipe-header 171 + type: nest 172 + multi-attr: true 173 + nested-attributes: dl-dpipe-header 174 + - 175 + name: dpipe-header-name 176 + type: string 177 + - 178 + name: dpipe-header-id 179 + type: u32 180 + - 181 + name: dpipe-header-fields 182 + type: nest 183 + nested-attributes: dl-dpipe-header-fields 184 + - 185 + name: dpipe-header-global 186 + type: u8 187 + - 188 + name: dpipe-header-index 189 + type: u32 190 + - 191 + name: dpipe-field 192 + type: nest 193 + multi-attr: true 194 + nested-attributes: dl-dpipe-field 195 + - 196 + name: dpipe-field-name 197 + type: string 198 + - 199 + name: dpipe-field-id 200 + type: u32 201 + - 202 + name: dpipe-field-bitwidth 203 + type: u32 204 + - 205 + name: dpipe-field-mapping-type 206 + type: u32 207 + enum: dpipe-field-mapping-type 208 + - 209 + name: pad 210 + type: pad 211 + - 212 + name: eswitch-encap-mode 213 + type: u8 214 + value: 62 215 + enum: eswitch-encap-mode 216 + - 217 + name: resource-list 218 + type: nest 219 + nested-attributes: dl-resource-list 220 + - 221 + name: resource 222 + type: nest 223 + multi-attr: true 224 + nested-attributes: dl-resource 225 + - 226 + name: resource-name 227 + type: string 228 + - 229 + name: resource-id 230 + type: u64 231 + - 232 + name: resource-size 233 + type: u64 234 + - 235 + name: resource-size-new 236 + type: u64 237 + - 238 + name: resource-size-valid 239 + type: u8 240 + - 241 + name: resource-size-min 242 + type: u64 243 + - 244 + name: resource-size-max 245 + type: u64 246 + - 247 + name: resource-size-gran 248 + type: u64 249 + - 250 + name: resource-unit 251 + type: u8 252 + enum: resource-unit 253 + - 254 + name: resource-occ 255 + type: u64 256 + - 257 + name: dpipe-table-resource-id 258 + type: u64 259 + - 260 + name: dpipe-table-resource-units 261 + type: u64 262 + - 263 + name: port-flavour 264 + type: u16 265 + enum: port-flavour 226 266 227 267 # TODO: fill in the attributes in between 228 268 ··· 440 68 # TODO: fill in the attributes in between 441 69 442 70 - 443 - name: region-name 444 - type: string 445 - value: 88 71 + name: param-type 72 + type: u8 73 + value: 83 446 74 447 75 # TODO: fill in the attributes in between 448 76 449 77 - 78 + name: param-value-cmode 79 + type: u8 80 + enum: param-cmode 81 + value: 87 82 + - 83 + name: region-name 84 + type: string 85 + 86 + # TODO: fill in the attributes in between 87 + 88 + - 89 + name: region-snapshot-id 90 + type: u32 91 + value: 92 92 + 93 + # TODO: fill in the attributes in between 94 + 95 + - 96 + name: region-chunk-addr 97 + type: u64 98 + value: 96 99 + - 100 + name: region-chunk-len 101 + type: u64 102 + - 450 103 name: info-driver-name 451 104 type: string 452 - value: 98 453 105 - 454 106 name: info-serial-number 455 107 type: string ··· 502 106 # TODO: fill in the attributes in between 503 107 504 108 - 109 + name: fmsg 110 + type: nest 111 + nested-attributes: dl-fmsg 112 + value: 106 113 + - 114 + name: fmsg-obj-nest-start 115 + type: flag 116 + - 117 + name: fmsg-pair-nest-start 118 + type: flag 119 + - 120 + name: fmsg-arr-nest-start 121 + type: flag 122 + - 123 + name: fmsg-nest-end 124 + type: flag 125 + - 126 + name: fmsg-obj-name 127 + type: string 128 + 129 + # TODO: fill in the attributes in between 130 + 131 + - 505 132 name: health-reporter-name 506 133 type: string 507 134 value: 115 ··· 532 113 # TODO: fill in the attributes in between 533 114 534 115 - 116 + name: health-reporter-graceful-period 117 + type: u64 118 + value: 120 119 + - 120 + name: health-reporter-auto-recover 121 + type: u8 122 + - 123 + name: flash-update-file-name 124 + type: string 125 + - 126 + name: flash-update-component 127 + type: string 128 + 129 + # TODO: fill in the attributes in between 130 + 131 + - 132 + name: port-pci-pf-number 133 + type: u16 134 + value: 127 135 + 136 + # TODO: fill in the attributes in between 137 + 138 + - 535 139 name: trap-name 536 140 type: string 537 141 value: 130 142 + - 143 + name: trap-action 144 + type: u8 145 + enum: trap-action 538 146 539 147 # TODO: fill in the attributes in between 540 148 ··· 577 131 # TODO: fill in the attributes in between 578 132 579 133 - 580 - name: trap-policer-id 134 + name: netns-fd 581 135 type: u32 582 - value: 142 136 + value: 138 137 + - 138 + name: netns-pid 139 + type: u32 140 + - 141 + name: netns-id 142 + type: u32 583 143 584 144 # TODO: fill in the attributes in between 585 145 146 + - 147 + name: health-reporter-auto-dump 148 + type: u8 149 + value: 141 150 + - 151 + name: trap-policer-id 152 + type: u32 153 + - 154 + name: trap-policer-rate 155 + type: u64 156 + - 157 + name: trap-policer-burst 158 + type: u64 159 + - 160 + name: port-function 161 + type: nest 162 + nested-attributes: dl-port-function 163 + 164 + # TODO: fill in the attributes in between 165 + 166 + - 167 + name: port-controller-number 168 + type: u32 169 + value: 150 170 + 171 + # TODO: fill in the attributes in between 172 + 173 + - 174 + name: flash-update-overwrite-mask 175 + type: bitfield32 176 + enum: flash-overwrite 177 + enum-as-flags: True 178 + value: 152 586 179 - 587 180 name: reload-action 588 181 type: u8 589 - value: 153 590 - 591 - # TODO: fill in the attributes in between 592 - 182 + enum: reload-action 183 + - 184 + name: reload-actions-performed 185 + type: bitfield32 186 + enum: reload-action 187 + enum-as-flags: True 188 + - 189 + name: reload-limits 190 + type: bitfield32 191 + enum: reload-action 192 + enum-as-flags: True 593 193 - 594 194 name: dev-stats 595 195 type: nest 596 - value: 156 597 196 nested-attributes: dl-dev-stats 598 197 - 599 198 name: reload-stats ··· 673 182 # TODO: fill in the attributes in between 674 183 675 184 - 185 + name: port-pci-sf-number 186 + type: u32 187 + value: 164 188 + 189 + # TODO: fill in the attributes in between 190 + 191 + - 192 + name: rate-tx-share 193 + type: u64 194 + value: 166 195 + - 196 + name: rate-tx-max 197 + type: u64 198 + - 676 199 name: rate-node-name 677 200 type: string 678 - value: 168 201 + - 202 + name: rate-parent-node-name 203 + type: string 679 204 680 205 # TODO: fill in the attributes in between 681 206 ··· 699 192 name: linecard-index 700 193 type: u32 701 194 value: 171 195 + 196 + # TODO: fill in the attributes in between 197 + 198 + - 199 + name: linecard-type 200 + type: string 201 + value: 173 202 + 203 + # TODO: fill in the attributes in between 204 + 205 + - 206 + name: selftests 207 + type: nest 208 + value: 176 209 + nested-attributes: dl-selftest-id 210 + - 211 + name: rate-tx-priority 212 + type: u32 213 + - 214 + name: rate-tx-weight 215 + type: u32 216 + - 217 + name: region-direct 218 + type: flag 702 219 703 220 - 704 221 name: dl-dev-stats ··· 768 237 name: info-version-name 769 238 - 770 239 name: info-version-value 240 + - 241 + name: dl-port-function 242 + name-prefix: devlink-port-fn-attr- 243 + attr-max-name: devlink-port-function-attr-max 244 + attributes: 245 + - 246 + name-prefix: devlink-port-function-attr- 247 + name: hw-addr 248 + type: binary 249 + value: 1 250 + - 251 + name: state 252 + type: u8 253 + enum: port-fn-state 254 + - 255 + name: opstate 256 + type: u8 257 + enum: port-fn-opstate 258 + - 259 + name: caps 260 + type: bitfield32 261 + enum: port-fn-attr-cap 262 + enum-as-flags: True 263 + 264 + - 265 + name: dl-dpipe-tables 266 + subset-of: devlink 267 + attributes: 268 + - 269 + name: dpipe-table 270 + 271 + - 272 + name: dl-dpipe-table 273 + subset-of: devlink 274 + attributes: 275 + - 276 + name: dpipe-table-name 277 + - 278 + name: dpipe-table-size 279 + - 280 + name: dpipe-table-name 281 + - 282 + name: dpipe-table-size 283 + - 284 + name: dpipe-table-matches 285 + - 286 + name: dpipe-table-actions 287 + - 288 + name: dpipe-table-counters-enabled 289 + - 290 + name: dpipe-table-resource-id 291 + - 292 + name: dpipe-table-resource-units 293 + 294 + - 295 + name: dl-dpipe-table-matches 296 + subset-of: devlink 297 + attributes: 298 + - 299 + name: dpipe-match 300 + 301 + - 302 + name: dl-dpipe-table-actions 303 + subset-of: devlink 304 + attributes: 305 + - 306 + name: dpipe-action 307 + 308 + - 309 + name: dl-dpipe-entries 310 + subset-of: devlink 311 + attributes: 312 + - 313 + name: dpipe-entry 314 + 315 + - 316 + name: dl-dpipe-entry 317 + subset-of: devlink 318 + attributes: 319 + - 320 + name: dpipe-entry-index 321 + - 322 + name: dpipe-entry-match-values 323 + - 324 + name: dpipe-entry-action-values 325 + - 326 + name: dpipe-entry-counter 327 + 328 + - 329 + name: dl-dpipe-entry-match-values 330 + subset-of: devlink 331 + attributes: 332 + - 333 + name: dpipe-match-value 334 + 335 + - 336 + name: dl-dpipe-entry-action-values 337 + subset-of: devlink 338 + attributes: 339 + - 340 + name: dpipe-action-value 341 + 342 + - 343 + name: dl-dpipe-match 344 + subset-of: devlink 345 + attributes: 346 + - 347 + name: dpipe-match-type 348 + - 349 + name: dpipe-header-id 350 + - 351 + name: dpipe-header-global 352 + - 353 + name: dpipe-header-index 354 + - 355 + name: dpipe-field-id 356 + 357 + - 358 + name: dl-dpipe-match-value 359 + subset-of: devlink 360 + attributes: 361 + - 362 + name: dpipe-match 363 + - 364 + name: dpipe-value 365 + - 366 + name: dpipe-value-mask 367 + - 368 + name: dpipe-value-mapping 369 + 370 + - 371 + name: dl-dpipe-action 372 + subset-of: devlink 373 + attributes: 374 + - 375 + name: dpipe-action-type 376 + - 377 + name: dpipe-header-id 378 + - 379 + name: dpipe-header-global 380 + - 381 + name: dpipe-header-index 382 + - 383 + name: dpipe-field-id 384 + 385 + - 386 + name: dl-dpipe-action-value 387 + subset-of: devlink 388 + attributes: 389 + - 390 + name: dpipe-action 391 + - 392 + name: dpipe-value 393 + - 394 + name: dpipe-value-mask 395 + - 396 + name: dpipe-value-mapping 397 + 398 + - 399 + name: dl-dpipe-headers 400 + subset-of: devlink 401 + attributes: 402 + - 403 + name: dpipe-header 404 + 405 + - 406 + name: dl-dpipe-header 407 + subset-of: devlink 408 + attributes: 409 + - 410 + name: dpipe-header-name 411 + - 412 + name: dpipe-header-id 413 + - 414 + name: dpipe-header-global 415 + - 416 + name: dpipe-header-fields 417 + 418 + - 419 + name: dl-dpipe-header-fields 420 + subset-of: devlink 421 + attributes: 422 + - 423 + name: dpipe-field 424 + 425 + - 426 + name: dl-dpipe-field 427 + subset-of: devlink 428 + attributes: 429 + - 430 + name: dpipe-field-name 431 + - 432 + name: dpipe-field-id 433 + - 434 + name: dpipe-field-bitwidth 435 + - 436 + name: dpipe-field-mapping-type 437 + 438 + - 439 + name: dl-resource 440 + subset-of: devlink 441 + attributes: 442 + # - 443 + # name: resource-list 444 + # This is currently unsupported due to circular dependency 445 + - 446 + name: resource-name 447 + - 448 + name: resource-id 449 + - 450 + name: resource-size 451 + - 452 + name: resource-size-new 453 + - 454 + name: resource-size-valid 455 + - 456 + name: resource-size-min 457 + - 458 + name: resource-size-max 459 + - 460 + name: resource-size-gran 461 + - 462 + name: resource-unit 463 + - 464 + name: resource-occ 465 + 466 + - 467 + name: dl-resource-list 468 + subset-of: devlink 469 + attributes: 470 + - 471 + name: resource 472 + 473 + - 474 + name: dl-fmsg 475 + subset-of: devlink 476 + attributes: 477 + - 478 + name: fmsg-obj-nest-start 479 + - 480 + name: fmsg-pair-nest-start 481 + - 482 + name: fmsg-arr-nest-start 483 + - 484 + name: fmsg-nest-end 485 + - 486 + name: fmsg-obj-name 487 + 488 + - 489 + name: dl-selftest-id 490 + name-prefix: devlink-attr-selftest-id- 491 + attributes: 492 + - 493 + name: flash 494 + type: flag 771 495 772 496 operations: 773 497 enum-model: directional ··· 1031 245 name: get 1032 246 doc: Get devlink instances. 1033 247 attribute-set: devlink 1034 - dont-validate: 1035 - - strict 1036 - - dump 1037 - 248 + dont-validate: [ strict, dump ] 1038 249 do: 1039 250 pre: devlink-nl-pre-doit 1040 251 post: devlink-nl-post-doit ··· 1046 263 - bus-name 1047 264 - dev-name 1048 265 - reload-failed 1049 - - reload-action 1050 266 - dev-stats 1051 267 dump: 1052 268 reply: *get-reply ··· 1054 272 name: port-get 1055 273 doc: Get devlink port instances. 1056 274 attribute-set: devlink 1057 - dont-validate: 1058 - - strict 1059 - 275 + dont-validate: [ strict ] 1060 276 do: 1061 277 pre: devlink-nl-pre-doit-port 1062 278 post: devlink-nl-post-doit ··· 1073 293 reply: 1074 294 value: 3 # due to a bug, port dump returns DEVLINK_CMD_NEW 1075 295 attributes: *port-id-attrs 296 + - 297 + name: port-set 298 + doc: Set devlink port instances. 299 + attribute-set: devlink 300 + dont-validate: [ strict ] 301 + flags: [ admin-perm ] 302 + do: 303 + pre: devlink-nl-pre-doit-port 304 + post: devlink-nl-post-doit 305 + request: 306 + attributes: 307 + - bus-name 308 + - dev-name 309 + - port-index 310 + - port-type 311 + - port-function 1076 312 1077 - # TODO: fill in the operations in between 313 + - 314 + name: port-new 315 + doc: Create devlink port instances. 316 + attribute-set: devlink 317 + dont-validate: [ strict ] 318 + flags: [ admin-perm ] 319 + do: 320 + pre: devlink-nl-pre-doit 321 + post: devlink-nl-post-doit 322 + request: 323 + attributes: 324 + - bus-name 325 + - dev-name 326 + - port-index 327 + - port-flavour 328 + - port-pci-pf-number 329 + - port-pci-sf-number 330 + - port-controller-number 331 + reply: 332 + value: 7 333 + attributes: *port-id-attrs 334 + 335 + - 336 + name: port-del 337 + doc: Delete devlink port instances. 338 + attribute-set: devlink 339 + dont-validate: [ strict ] 340 + flags: [ admin-perm ] 341 + do: 342 + pre: devlink-nl-pre-doit-port 343 + post: devlink-nl-post-doit 344 + request: 345 + attributes: *port-id-attrs 346 + 347 + - 348 + name: port-split 349 + doc: Split devlink port instances. 350 + attribute-set: devlink 351 + dont-validate: [ strict ] 352 + flags: [ admin-perm ] 353 + do: 354 + pre: devlink-nl-pre-doit-port 355 + post: devlink-nl-post-doit 356 + request: 357 + attributes: 358 + - bus-name 359 + - dev-name 360 + - port-index 361 + - port-split-count 362 + 363 + - 364 + name: port-unsplit 365 + doc: Unplit devlink port instances. 366 + attribute-set: devlink 367 + dont-validate: [ strict ] 368 + flags: [ admin-perm ] 369 + do: 370 + pre: devlink-nl-pre-doit-port 371 + post: devlink-nl-post-doit 372 + request: 373 + attributes: *port-id-attrs 1078 374 1079 375 - 1080 376 name: sb-get 1081 377 doc: Get shared buffer instances. 1082 378 attribute-set: devlink 1083 - dont-validate: 1084 - - strict 1085 - 379 + dont-validate: [ strict ] 1086 380 do: 1087 381 pre: devlink-nl-pre-doit 1088 382 post: devlink-nl-post-doit ··· 1174 320 attributes: *dev-id-attrs 1175 321 reply: *sb-get-reply 1176 322 1177 - # TODO: fill in the operations in between 1178 - 1179 323 - 1180 324 name: sb-pool-get 1181 325 doc: Get shared buffer pool instances. 1182 326 attribute-set: devlink 1183 - dont-validate: 1184 - - strict 1185 - 327 + dont-validate: [ strict ] 1186 328 do: 1187 329 pre: devlink-nl-pre-doit 1188 330 post: devlink-nl-post-doit ··· 1197 347 attributes: *dev-id-attrs 1198 348 reply: *sb-pool-get-reply 1199 349 1200 - # TODO: fill in the operations in between 350 + - 351 + name: sb-pool-set 352 + doc: Set shared buffer pool instances. 353 + attribute-set: devlink 354 + dont-validate: [ strict ] 355 + flags: [ admin-perm ] 356 + do: 357 + pre: devlink-nl-pre-doit 358 + post: devlink-nl-post-doit 359 + request: 360 + attributes: 361 + - bus-name 362 + - dev-name 363 + - sb-index 364 + - sb-pool-index 365 + - sb-pool-threshold-type 366 + - sb-pool-size 1201 367 1202 368 - 1203 369 name: sb-port-pool-get 1204 370 doc: Get shared buffer port-pool combinations and threshold. 1205 371 attribute-set: devlink 1206 - dont-validate: 1207 - - strict 1208 - 372 + dont-validate: [ strict ] 1209 373 do: 1210 374 pre: devlink-nl-pre-doit-port 1211 375 post: devlink-nl-post-doit ··· 1239 375 attributes: *dev-id-attrs 1240 376 reply: *sb-port-pool-get-reply 1241 377 1242 - # TODO: fill in the operations in between 378 + - 379 + name: sb-port-pool-set 380 + doc: Set shared buffer port-pool combinations and threshold. 381 + attribute-set: devlink 382 + dont-validate: [ strict ] 383 + flags: [ admin-perm ] 384 + do: 385 + pre: devlink-nl-pre-doit-port 386 + post: devlink-nl-post-doit 387 + request: 388 + attributes: 389 + - bus-name 390 + - dev-name 391 + - port-index 392 + - sb-index 393 + - sb-pool-index 394 + - sb-threshold 1243 395 1244 396 - 1245 397 name: sb-tc-pool-bind-get 1246 398 doc: Get shared buffer port-TC to pool bindings and threshold. 1247 399 attribute-set: devlink 1248 - dont-validate: 1249 - - strict 1250 - 400 + dont-validate: [ strict ] 1251 401 do: 1252 402 pre: devlink-nl-pre-doit-port 1253 403 post: devlink-nl-post-doit ··· 1282 404 attributes: *dev-id-attrs 1283 405 reply: *sb-tc-pool-bind-get-reply 1284 406 1285 - # TODO: fill in the operations in between 407 + - 408 + name: sb-tc-pool-bind-set 409 + doc: Set shared buffer port-TC to pool bindings and threshold. 410 + attribute-set: devlink 411 + dont-validate: [ strict ] 412 + flags: [ admin-perm ] 413 + do: 414 + pre: devlink-nl-pre-doit-port 415 + post: devlink-nl-post-doit 416 + request: 417 + attributes: 418 + - bus-name 419 + - dev-name 420 + - port-index 421 + - sb-index 422 + - sb-pool-index 423 + - sb-pool-type 424 + - sb-tc-index 425 + - sb-threshold 426 + 427 + - 428 + name: sb-occ-snapshot 429 + doc: Take occupancy snapshot of shared buffer. 430 + attribute-set: devlink 431 + dont-validate: [ strict ] 432 + flags: [ admin-perm ] 433 + do: 434 + pre: devlink-nl-pre-doit 435 + post: devlink-nl-post-doit 436 + request: 437 + value: 27 438 + attributes: 439 + - bus-name 440 + - dev-name 441 + - sb-index 442 + 443 + - 444 + name: sb-occ-max-clear 445 + doc: Clear occupancy watermarks of shared buffer. 446 + attribute-set: devlink 447 + dont-validate: [ strict ] 448 + flags: [ admin-perm ] 449 + do: 450 + pre: devlink-nl-pre-doit 451 + post: devlink-nl-post-doit 452 + request: 453 + attributes: 454 + - bus-name 455 + - dev-name 456 + - sb-index 457 + 458 + - 459 + name: eswitch-get 460 + doc: Get eswitch attributes. 461 + attribute-set: devlink 462 + dont-validate: [ strict ] 463 + flags: [ admin-perm ] 464 + do: 465 + pre: devlink-nl-pre-doit 466 + post: devlink-nl-post-doit 467 + request: 468 + attributes: *dev-id-attrs 469 + reply: 470 + value: 29 471 + attributes: &eswitch-attrs 472 + - bus-name 473 + - dev-name 474 + - eswitch-mode 475 + - eswitch-inline-mode 476 + - eswitch-encap-mode 477 + 478 + - 479 + name: eswitch-set 480 + doc: Set eswitch attributes. 481 + attribute-set: devlink 482 + dont-validate: [ strict ] 483 + flags: [ admin-perm ] 484 + do: 485 + pre: devlink-nl-pre-doit 486 + post: devlink-nl-post-doit 487 + request: 488 + attributes: *eswitch-attrs 489 + 490 + - 491 + name: dpipe-table-get 492 + doc: Get dpipe table attributes. 493 + attribute-set: devlink 494 + dont-validate: [ strict ] 495 + do: 496 + pre: devlink-nl-pre-doit 497 + post: devlink-nl-post-doit 498 + request: 499 + attributes: 500 + - bus-name 501 + - dev-name 502 + - dpipe-table-name 503 + reply: 504 + value: 31 505 + attributes: 506 + - bus-name 507 + - dev-name 508 + - dpipe-tables 509 + 510 + - 511 + name: dpipe-entries-get 512 + doc: Get dpipe entries attributes. 513 + attribute-set: devlink 514 + dont-validate: [ strict ] 515 + do: 516 + pre: devlink-nl-pre-doit 517 + post: devlink-nl-post-doit 518 + request: 519 + attributes: 520 + - bus-name 521 + - dev-name 522 + - dpipe-table-name 523 + reply: 524 + attributes: 525 + - bus-name 526 + - dev-name 527 + - dpipe-entries 528 + 529 + - 530 + name: dpipe-headers-get 531 + doc: Get dpipe headers attributes. 532 + attribute-set: devlink 533 + dont-validate: [ strict ] 534 + do: 535 + pre: devlink-nl-pre-doit 536 + post: devlink-nl-post-doit 537 + request: 538 + attributes: 539 + - bus-name 540 + - dev-name 541 + reply: 542 + attributes: 543 + - bus-name 544 + - dev-name 545 + - dpipe-headers 546 + 547 + - 548 + name: dpipe-table-counters-set 549 + doc: Set dpipe counter attributes. 550 + attribute-set: devlink 551 + dont-validate: [ strict ] 552 + flags: [ admin-perm ] 553 + do: 554 + pre: devlink-nl-pre-doit 555 + post: devlink-nl-post-doit 556 + request: 557 + attributes: 558 + - bus-name 559 + - dev-name 560 + - dpipe-table-name 561 + - dpipe-table-counters-enabled 562 + 563 + - 564 + name: resource-set 565 + doc: Set resource attributes. 566 + attribute-set: devlink 567 + dont-validate: [ strict ] 568 + flags: [ admin-perm ] 569 + do: 570 + pre: devlink-nl-pre-doit 571 + post: devlink-nl-post-doit 572 + request: 573 + attributes: 574 + - bus-name 575 + - dev-name 576 + - resource-id 577 + - resource-size 578 + 579 + - 580 + name: resource-dump 581 + doc: Get resource attributes. 582 + attribute-set: devlink 583 + dont-validate: [ strict ] 584 + do: 585 + pre: devlink-nl-pre-doit 586 + post: devlink-nl-post-doit 587 + request: 588 + attributes: 589 + - bus-name 590 + - dev-name 591 + reply: 592 + value: 36 593 + attributes: 594 + - bus-name 595 + - dev-name 596 + - resource-list 597 + 598 + - 599 + name: reload 600 + doc: Reload devlink. 601 + attribute-set: devlink 602 + dont-validate: [ strict ] 603 + flags: [ admin-perm ] 604 + do: 605 + pre: devlink-nl-pre-doit 606 + post: devlink-nl-post-doit 607 + request: 608 + attributes: 609 + - bus-name 610 + - dev-name 611 + - reload-action 612 + - reload-limits 613 + - netns-pid 614 + - netns-fd 615 + - netns-id 616 + reply: 617 + attributes: 618 + - bus-name 619 + - dev-name 620 + - reload-actions-performed 1286 621 1287 622 - 1288 623 name: param-get 1289 624 doc: Get param instances. 1290 625 attribute-set: devlink 1291 - dont-validate: 1292 - - strict 1293 - 626 + dont-validate: [ strict ] 1294 627 do: 1295 628 pre: devlink-nl-pre-doit 1296 629 post: devlink-nl-post-doit 1297 630 request: 1298 - value: 38 1299 631 attributes: &param-id-attrs 1300 632 - bus-name 1301 633 - dev-name 1302 634 - param-name 1303 635 reply: &param-get-reply 1304 - value: 38 1305 636 attributes: *param-id-attrs 1306 637 dump: 1307 638 request: 1308 639 attributes: *dev-id-attrs 1309 640 reply: *param-get-reply 1310 641 1311 - # TODO: fill in the operations in between 642 + - 643 + name: param-set 644 + doc: Set param instances. 645 + attribute-set: devlink 646 + dont-validate: [ strict ] 647 + flags: [ admin-perm ] 648 + do: 649 + pre: devlink-nl-pre-doit 650 + post: devlink-nl-post-doit 651 + request: 652 + attributes: 653 + - bus-name 654 + - dev-name 655 + - param-name 656 + - param-type 657 + # param-value-data is missing here as the type is variable 658 + - param-value-cmode 1312 659 1313 660 - 1314 661 name: region-get 1315 662 doc: Get region instances. 1316 663 attribute-set: devlink 1317 - dont-validate: 1318 - - strict 1319 - 664 + dont-validate: [ strict ] 1320 665 do: 1321 666 pre: devlink-nl-pre-doit-port-optional 1322 667 post: devlink-nl-post-doit ··· 1558 457 attributes: *dev-id-attrs 1559 458 reply: *region-get-reply 1560 459 1561 - # TODO: fill in the operations in between 460 + - 461 + name: region-new 462 + doc: Create region snapshot. 463 + attribute-set: devlink 464 + dont-validate: [ strict ] 465 + flags: [ admin-perm ] 466 + do: 467 + pre: devlink-nl-pre-doit-port-optional 468 + post: devlink-nl-post-doit 469 + request: 470 + value: 44 471 + attributes: &region-snapshot-id-attrs 472 + - bus-name 473 + - dev-name 474 + - port-index 475 + - region-name 476 + - region-snapshot-id 477 + reply: 478 + value: 44 479 + attributes: *region-snapshot-id-attrs 480 + 481 + - 482 + name: region-del 483 + doc: Delete region snapshot. 484 + attribute-set: devlink 485 + dont-validate: [ strict ] 486 + flags: [ admin-perm ] 487 + do: 488 + pre: devlink-nl-pre-doit-port-optional 489 + post: devlink-nl-post-doit 490 + request: 491 + attributes: *region-snapshot-id-attrs 492 + 493 + - 494 + name: region-read 495 + doc: Read region data. 496 + attribute-set: devlink 497 + dont-validate: [ dump-strict ] 498 + flags: [ admin-perm ] 499 + dump: 500 + request: 501 + attributes: 502 + - bus-name 503 + - dev-name 504 + - port-index 505 + - region-name 506 + - region-snapshot-id 507 + - region-direct 508 + - region-chunk-addr 509 + - region-chunk-len 510 + reply: 511 + value: 46 512 + attributes: 513 + - bus-name 514 + - dev-name 515 + - port-index 516 + - region-name 517 + 518 + - 519 + name: port-param-get 520 + doc: Get port param instances. 521 + attribute-set: devlink 522 + dont-validate: [ strict, dump-strict ] 523 + do: 524 + pre: devlink-nl-pre-doit-port 525 + post: devlink-nl-post-doit 526 + request: 527 + attributes: *port-id-attrs 528 + reply: 529 + attributes: *port-id-attrs 530 + dump: 531 + reply: 532 + attributes: *port-id-attrs 533 + 534 + - 535 + name: port-param-set 536 + doc: Set port param instances. 537 + attribute-set: devlink 538 + dont-validate: [ strict ] 539 + flags: [ admin-perm ] 540 + do: 541 + pre: devlink-nl-pre-doit-port 542 + post: devlink-nl-post-doit 543 + request: 544 + attributes: *port-id-attrs 1562 545 1563 546 - 1564 547 name: info-get 1565 548 doc: Get device information, like driver name, hardware and firmware versions etc. 1566 549 attribute-set: devlink 1567 - dont-validate: 1568 - - strict 1569 - - dump 1570 - 550 + dont-validate: [ strict, dump ] 1571 551 do: 1572 552 pre: devlink-nl-pre-doit 1573 553 post: devlink-nl-post-doit ··· 1672 490 name: health-reporter-get 1673 491 doc: Get health reporter instances. 1674 492 attribute-set: devlink 1675 - dont-validate: 1676 - - strict 1677 - 493 + dont-validate: [ strict ] 1678 494 do: 1679 495 pre: devlink-nl-pre-doit-port-optional 1680 496 post: devlink-nl-post-doit ··· 1689 509 attributes: *port-id-attrs 1690 510 reply: *health-reporter-get-reply 1691 511 1692 - # TODO: fill in the operations in between 512 + - 513 + name: health-reporter-set 514 + doc: Set health reporter instances. 515 + attribute-set: devlink 516 + dont-validate: [ strict ] 517 + flags: [ admin-perm ] 518 + do: 519 + pre: devlink-nl-pre-doit-port-optional 520 + post: devlink-nl-post-doit 521 + request: 522 + attributes: 523 + - bus-name 524 + - dev-name 525 + - port-index 526 + - health-reporter-name 527 + - health-reporter-graceful-period 528 + - health-reporter-auto-recover 529 + - health-reporter-auto-dump 530 + 531 + - 532 + name: health-reporter-recover 533 + doc: Recover health reporter instances. 534 + attribute-set: devlink 535 + dont-validate: [ strict ] 536 + flags: [ admin-perm ] 537 + do: 538 + pre: devlink-nl-pre-doit-port-optional 539 + post: devlink-nl-post-doit 540 + request: 541 + attributes: *health-reporter-id-attrs 542 + 543 + - 544 + name: health-reporter-diagnose 545 + doc: Diagnose health reporter instances. 546 + attribute-set: devlink 547 + dont-validate: [ strict ] 548 + flags: [ admin-perm ] 549 + do: 550 + pre: devlink-nl-pre-doit-port-optional 551 + post: devlink-nl-post-doit 552 + request: 553 + attributes: *health-reporter-id-attrs 554 + 555 + - 556 + name: health-reporter-dump-get 557 + doc: Dump health reporter instances. 558 + attribute-set: devlink 559 + dont-validate: [ dump-strict ] 560 + flags: [ admin-perm ] 561 + dump: 562 + request: 563 + attributes: *health-reporter-id-attrs 564 + reply: 565 + value: 56 566 + attributes: 567 + - fmsg 568 + 569 + - 570 + name: health-reporter-dump-clear 571 + doc: Clear dump of health reporter instances. 572 + attribute-set: devlink 573 + dont-validate: [ strict ] 574 + flags: [ admin-perm ] 575 + do: 576 + pre: devlink-nl-pre-doit-port-optional 577 + post: devlink-nl-post-doit 578 + request: 579 + attributes: *health-reporter-id-attrs 580 + 581 + - 582 + name: flash-update 583 + doc: Flash update devlink instances. 584 + attribute-set: devlink 585 + dont-validate: [ strict ] 586 + flags: [ admin-perm ] 587 + do: 588 + pre: devlink-nl-pre-doit 589 + post: devlink-nl-post-doit 590 + request: 591 + attributes: 592 + - bus-name 593 + - dev-name 594 + - flash-update-file-name 595 + - flash-update-component 596 + - flash-update-overwrite-mask 1693 597 1694 598 - 1695 599 name: trap-get 1696 600 doc: Get trap instances. 1697 601 attribute-set: devlink 1698 - dont-validate: 1699 - - strict 1700 - 602 + dont-validate: [ strict ] 1701 603 do: 1702 604 pre: devlink-nl-pre-doit 1703 605 post: devlink-nl-post-doit ··· 1797 535 attributes: *dev-id-attrs 1798 536 reply: *trap-get-reply 1799 537 1800 - # TODO: fill in the operations in between 538 + - 539 + name: trap-set 540 + doc: Set trap instances. 541 + attribute-set: devlink 542 + dont-validate: [ strict ] 543 + flags: [ admin-perm ] 544 + do: 545 + pre: devlink-nl-pre-doit 546 + post: devlink-nl-post-doit 547 + request: 548 + attributes: 549 + - bus-name 550 + - dev-name 551 + - trap-name 552 + - trap-action 1801 553 1802 554 - 1803 555 name: trap-group-get 1804 556 doc: Get trap group instances. 1805 557 attribute-set: devlink 1806 - dont-validate: 1807 - - strict 1808 - 558 + dont-validate: [ strict ] 1809 559 do: 1810 560 pre: devlink-nl-pre-doit 1811 561 post: devlink-nl-post-doit ··· 1835 561 attributes: *dev-id-attrs 1836 562 reply: *trap-group-get-reply 1837 563 1838 - # TODO: fill in the operations in between 564 + - 565 + name: trap-group-set 566 + doc: Set trap group instances. 567 + attribute-set: devlink 568 + dont-validate: [ strict ] 569 + flags: [ admin-perm ] 570 + do: 571 + pre: devlink-nl-pre-doit 572 + post: devlink-nl-post-doit 573 + request: 574 + attributes: 575 + - bus-name 576 + - dev-name 577 + - trap-group-name 578 + - trap-action 579 + - trap-policer-id 1839 580 1840 581 - 1841 582 name: trap-policer-get 1842 583 doc: Get trap policer instances. 1843 584 attribute-set: devlink 1844 - dont-validate: 1845 - - strict 1846 - 585 + dont-validate: [ strict ] 1847 586 do: 1848 587 pre: devlink-nl-pre-doit 1849 588 post: devlink-nl-post-doit ··· 1874 587 attributes: *dev-id-attrs 1875 588 reply: *trap-policer-get-reply 1876 589 1877 - # TODO: fill in the operations in between 590 + - 591 + name: trap-policer-set 592 + doc: Get trap policer instances. 593 + attribute-set: devlink 594 + dont-validate: [ strict ] 595 + flags: [ admin-perm ] 596 + do: 597 + pre: devlink-nl-pre-doit 598 + post: devlink-nl-post-doit 599 + request: 600 + attributes: 601 + - bus-name 602 + - dev-name 603 + - trap-policer-id 604 + - trap-policer-rate 605 + - trap-policer-burst 606 + 607 + - 608 + name: health-reporter-test 609 + doc: Test health reporter instances. 610 + attribute-set: devlink 611 + dont-validate: [ strict ] 612 + flags: [ admin-perm ] 613 + do: 614 + pre: devlink-nl-pre-doit-port-optional 615 + post: devlink-nl-post-doit 616 + request: 617 + value: 73 618 + attributes: *health-reporter-id-attrs 1878 619 1879 620 - 1880 621 name: rate-get 1881 622 doc: Get rate instances. 1882 623 attribute-set: devlink 1883 - dont-validate: 1884 - - strict 1885 - 624 + dont-validate: [ strict ] 1886 625 do: 1887 626 pre: devlink-nl-pre-doit 1888 627 post: devlink-nl-post-doit ··· 1927 614 attributes: *dev-id-attrs 1928 615 reply: *rate-get-reply 1929 616 1930 - # TODO: fill in the operations in between 617 + - 618 + name: rate-set 619 + doc: Set rate instances. 620 + attribute-set: devlink 621 + dont-validate: [ strict ] 622 + flags: [ admin-perm ] 623 + do: 624 + pre: devlink-nl-pre-doit 625 + post: devlink-nl-post-doit 626 + request: 627 + attributes: 628 + - bus-name 629 + - dev-name 630 + - rate-node-name 631 + - rate-tx-share 632 + - rate-tx-max 633 + - rate-tx-priority 634 + - rate-tx-weight 635 + - rate-parent-node-name 636 + 637 + - 638 + name: rate-new 639 + doc: Create rate instances. 640 + attribute-set: devlink 641 + dont-validate: [ strict ] 642 + flags: [ admin-perm ] 643 + do: 644 + pre: devlink-nl-pre-doit 645 + post: devlink-nl-post-doit 646 + request: 647 + attributes: 648 + - bus-name 649 + - dev-name 650 + - rate-node-name 651 + - rate-tx-share 652 + - rate-tx-max 653 + - rate-tx-priority 654 + - rate-tx-weight 655 + - rate-parent-node-name 656 + 657 + - 658 + name: rate-del 659 + doc: Delete rate instances. 660 + attribute-set: devlink 661 + dont-validate: [ strict ] 662 + flags: [ admin-perm ] 663 + do: 664 + pre: devlink-nl-pre-doit 665 + post: devlink-nl-post-doit 666 + request: 667 + attributes: 668 + - bus-name 669 + - dev-name 670 + - rate-node-name 1931 671 1932 672 - 1933 673 name: linecard-get 1934 674 doc: Get line card instances. 1935 675 attribute-set: devlink 1936 - dont-validate: 1937 - - strict 1938 - 676 + dont-validate: [ strict ] 1939 677 do: 1940 678 pre: devlink-nl-pre-doit 1941 679 post: devlink-nl-post-doit ··· 2004 640 attributes: *dev-id-attrs 2005 641 reply: *linecard-get-reply 2006 642 2007 - # TODO: fill in the operations in between 643 + - 644 + name: linecard-set 645 + doc: Set line card instances. 646 + attribute-set: devlink 647 + dont-validate: [ strict ] 648 + flags: [ admin-perm ] 649 + do: 650 + pre: devlink-nl-pre-doit 651 + post: devlink-nl-post-doit 652 + request: 653 + attributes: 654 + - bus-name 655 + - dev-name 656 + - linecard-index 657 + - linecard-type 2008 658 2009 659 - 2010 660 name: selftests-get 2011 661 doc: Get device selftest instances. 2012 662 attribute-set: devlink 2013 - dont-validate: 2014 - - strict 2015 - - dump 2016 - 663 + dont-validate: [ strict, dump ] 2017 664 do: 2018 665 pre: devlink-nl-pre-doit 2019 666 post: devlink-nl-post-doit ··· 2036 661 attributes: *dev-id-attrs 2037 662 dump: 2038 663 reply: *selftests-get-reply 664 + 665 + - 666 + name: selftests-run 667 + doc: Run device selftest instances. 668 + attribute-set: devlink 669 + dont-validate: [ strict ] 670 + flags: [ admin-perm ] 671 + do: 672 + pre: devlink-nl-pre-doit 673 + post: devlink-nl-post-doit 674 + request: 675 + attributes: 676 + - bus-name 677 + - dev-name 678 + - selftests
+1 -1
include/uapi/linux/devlink.h
··· 265 265 * Documentation/networking/devlink/devlink-flash.rst 266 266 * 267 267 */ 268 - enum { 268 + enum devlink_flash_overwrite { 269 269 DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT, 270 270 DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT, 271 271
+5 -5
net/devlink/dev.c
··· 492 492 return -EMSGSIZE; 493 493 } 494 494 495 - int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info) 495 + int devlink_nl_reload_doit(struct sk_buff *skb, struct genl_info *info) 496 496 { 497 497 struct devlink *devlink = info->user_ptr[0]; 498 498 enum devlink_reload_action action; ··· 658 658 return err; 659 659 } 660 660 661 - int devlink_nl_cmd_eswitch_get_doit(struct sk_buff *skb, struct genl_info *info) 661 + int devlink_nl_eswitch_get_doit(struct sk_buff *skb, struct genl_info *info) 662 662 { 663 663 struct devlink *devlink = info->user_ptr[0]; 664 664 struct sk_buff *msg; ··· 679 679 return genlmsg_reply(msg, info); 680 680 } 681 681 682 - int devlink_nl_cmd_eswitch_set_doit(struct sk_buff *skb, struct genl_info *info) 682 + int devlink_nl_eswitch_set_doit(struct sk_buff *skb, struct genl_info *info) 683 683 { 684 684 struct devlink *devlink = info->user_ptr[0]; 685 685 const struct devlink_ops *ops = devlink->ops; ··· 1108 1108 return 0; 1109 1109 } 1110 1110 1111 - int devlink_nl_cmd_flash_update(struct sk_buff *skb, struct genl_info *info) 1111 + int devlink_nl_flash_update_doit(struct sk_buff *skb, struct genl_info *info) 1112 1112 { 1113 1113 struct nlattr *nla_overwrite_mask, *nla_file_name; 1114 1114 struct devlink_flash_update_params params = {}; ··· 1351 1351 [DEVLINK_ATTR_SELFTEST_ID_FLASH] = { .type = NLA_FLAG }, 1352 1352 }; 1353 1353 1354 - int devlink_nl_cmd_selftests_run(struct sk_buff *skb, struct genl_info *info) 1354 + int devlink_nl_selftests_run_doit(struct sk_buff *skb, struct genl_info *info) 1355 1355 { 1356 1356 struct nlattr *tb[DEVLINK_ATTR_SELFTEST_ID_MAX + 1]; 1357 1357 struct devlink *devlink = info->user_ptr[0];
-64
net/devlink/devl_internal.h
··· 227 227 228 228 /* Linecards */ 229 229 unsigned int devlink_linecard_index(struct devlink_linecard *linecard); 230 - 231 - /* Devlink nl cmds */ 232 - int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info); 233 - int devlink_nl_cmd_eswitch_get_doit(struct sk_buff *skb, struct genl_info *info); 234 - int devlink_nl_cmd_eswitch_set_doit(struct sk_buff *skb, struct genl_info *info); 235 - int devlink_nl_cmd_flash_update(struct sk_buff *skb, struct genl_info *info); 236 - int devlink_nl_cmd_selftests_run(struct sk_buff *skb, struct genl_info *info); 237 - int devlink_nl_cmd_port_set_doit(struct sk_buff *skb, struct genl_info *info); 238 - int devlink_nl_cmd_port_split_doit(struct sk_buff *skb, struct genl_info *info); 239 - int devlink_nl_cmd_port_unsplit_doit(struct sk_buff *skb, 240 - struct genl_info *info); 241 - int devlink_nl_cmd_port_new_doit(struct sk_buff *skb, struct genl_info *info); 242 - int devlink_nl_cmd_port_del_doit(struct sk_buff *skb, struct genl_info *info); 243 - int devlink_nl_cmd_sb_pool_set_doit(struct sk_buff *skb, struct genl_info *info); 244 - int devlink_nl_cmd_sb_port_pool_set_doit(struct sk_buff *skb, 245 - struct genl_info *info); 246 - int devlink_nl_cmd_sb_tc_pool_bind_set_doit(struct sk_buff *skb, 247 - struct genl_info *info); 248 - int devlink_nl_cmd_sb_occ_snapshot_doit(struct sk_buff *skb, 249 - struct genl_info *info); 250 - int devlink_nl_cmd_sb_occ_max_clear_doit(struct sk_buff *skb, 251 - struct genl_info *info); 252 - int devlink_nl_cmd_dpipe_table_get(struct sk_buff *skb, struct genl_info *info); 253 - int devlink_nl_cmd_dpipe_entries_get(struct sk_buff *skb, 254 - struct genl_info *info); 255 - int devlink_nl_cmd_dpipe_headers_get(struct sk_buff *skb, 256 - struct genl_info *info); 257 - int devlink_nl_cmd_dpipe_table_counters_set(struct sk_buff *skb, 258 - struct genl_info *info); 259 - int devlink_nl_cmd_resource_set(struct sk_buff *skb, struct genl_info *info); 260 - int devlink_nl_cmd_resource_dump(struct sk_buff *skb, struct genl_info *info); 261 - int devlink_nl_cmd_param_set_doit(struct sk_buff *skb, struct genl_info *info); 262 - int devlink_nl_cmd_port_param_get_dumpit(struct sk_buff *msg, 263 - struct netlink_callback *cb); 264 - int devlink_nl_cmd_port_param_get_doit(struct sk_buff *skb, 265 - struct genl_info *info); 266 - int devlink_nl_cmd_port_param_set_doit(struct sk_buff *skb, 267 - struct genl_info *info); 268 - int devlink_nl_cmd_region_new(struct sk_buff *skb, struct genl_info *info); 269 - int devlink_nl_cmd_region_del(struct sk_buff *skb, struct genl_info *info); 270 - int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb, 271 - struct netlink_callback *cb); 272 - int devlink_nl_cmd_health_reporter_set_doit(struct sk_buff *skb, 273 - struct genl_info *info); 274 - int devlink_nl_cmd_health_reporter_recover_doit(struct sk_buff *skb, 275 - struct genl_info *info); 276 - int devlink_nl_cmd_health_reporter_diagnose_doit(struct sk_buff *skb, 277 - struct genl_info *info); 278 - int devlink_nl_cmd_health_reporter_dump_get_dumpit(struct sk_buff *skb, 279 - struct netlink_callback *cb); 280 - int devlink_nl_cmd_health_reporter_dump_clear_doit(struct sk_buff *skb, 281 - struct genl_info *info); 282 - int devlink_nl_cmd_health_reporter_test_doit(struct sk_buff *skb, 283 - struct genl_info *info); 284 - int devlink_nl_cmd_trap_set_doit(struct sk_buff *skb, struct genl_info *info); 285 - int devlink_nl_cmd_trap_group_set_doit(struct sk_buff *skb, 286 - struct genl_info *info); 287 - int devlink_nl_cmd_trap_policer_set_doit(struct sk_buff *skb, 288 - struct genl_info *info); 289 - int devlink_nl_cmd_rate_set_doit(struct sk_buff *skb, struct genl_info *info); 290 - int devlink_nl_cmd_rate_new_doit(struct sk_buff *skb, struct genl_info *info); 291 - int devlink_nl_cmd_rate_del_doit(struct sk_buff *skb, struct genl_info *info); 292 - int devlink_nl_cmd_linecard_set_doit(struct sk_buff *skb, 293 - struct genl_info *info);
+7 -7
net/devlink/dpipe.c
··· 289 289 return err; 290 290 } 291 291 292 - int devlink_nl_cmd_dpipe_table_get(struct sk_buff *skb, struct genl_info *info) 292 + int devlink_nl_dpipe_table_get_doit(struct sk_buff *skb, struct genl_info *info) 293 293 { 294 294 struct devlink *devlink = info->user_ptr[0]; 295 295 const char *table_name = NULL; ··· 562 562 return genlmsg_reply(dump_ctx.skb, info); 563 563 } 564 564 565 - int devlink_nl_cmd_dpipe_entries_get(struct sk_buff *skb, 566 - struct genl_info *info) 565 + int devlink_nl_dpipe_entries_get_doit(struct sk_buff *skb, 566 + struct genl_info *info) 567 567 { 568 568 struct devlink *devlink = info->user_ptr[0]; 569 569 struct devlink_dpipe_table *table; ··· 712 712 return err; 713 713 } 714 714 715 - int devlink_nl_cmd_dpipe_headers_get(struct sk_buff *skb, 716 - struct genl_info *info) 715 + int devlink_nl_dpipe_headers_get_doit(struct sk_buff *skb, 716 + struct genl_info *info) 717 717 { 718 718 struct devlink *devlink = info->user_ptr[0]; 719 719 ··· 746 746 return 0; 747 747 } 748 748 749 - int devlink_nl_cmd_dpipe_table_counters_set(struct sk_buff *skb, 750 - struct genl_info *info) 749 + int devlink_nl_dpipe_table_counters_set_doit(struct sk_buff *skb, 750 + struct genl_info *info) 751 751 { 752 752 struct devlink *devlink = info->user_ptr[0]; 753 753 const char *table_name;
+12 -12
net/devlink/health.c
··· 452 452 devlink_nl_health_reporter_get_dump_one); 453 453 } 454 454 455 - int devlink_nl_cmd_health_reporter_set_doit(struct sk_buff *skb, 456 - struct genl_info *info) 455 + int devlink_nl_health_reporter_set_doit(struct sk_buff *skb, 456 + struct genl_info *info) 457 457 { 458 458 struct devlink *devlink = info->user_ptr[0]; 459 459 struct devlink_health_reporter *reporter; ··· 655 655 } 656 656 EXPORT_SYMBOL_GPL(devlink_health_reporter_state_update); 657 657 658 - int devlink_nl_cmd_health_reporter_recover_doit(struct sk_buff *skb, 659 - struct genl_info *info) 658 + int devlink_nl_health_reporter_recover_doit(struct sk_buff *skb, 659 + struct genl_info *info) 660 660 { 661 661 struct devlink *devlink = info->user_ptr[0]; 662 662 struct devlink_health_reporter *reporter; ··· 1108 1108 return err; 1109 1109 } 1110 1110 1111 - int devlink_nl_cmd_health_reporter_diagnose_doit(struct sk_buff *skb, 1112 - struct genl_info *info) 1111 + int devlink_nl_health_reporter_diagnose_doit(struct sk_buff *skb, 1112 + struct genl_info *info) 1113 1113 { 1114 1114 struct devlink *devlink = info->user_ptr[0]; 1115 1115 struct devlink_health_reporter *reporter; ··· 1163 1163 return reporter; 1164 1164 } 1165 1165 1166 - int devlink_nl_cmd_health_reporter_dump_get_dumpit(struct sk_buff *skb, 1167 - struct netlink_callback *cb) 1166 + int devlink_nl_health_reporter_dump_get_dumpit(struct sk_buff *skb, 1167 + struct netlink_callback *cb) 1168 1168 { 1169 1169 struct devlink_nl_dump_state *state = devlink_dump_state(cb); 1170 1170 struct devlink_health_reporter *reporter; ··· 1202 1202 return err; 1203 1203 } 1204 1204 1205 - int devlink_nl_cmd_health_reporter_dump_clear_doit(struct sk_buff *skb, 1206 - struct genl_info *info) 1205 + int devlink_nl_health_reporter_dump_clear_doit(struct sk_buff *skb, 1206 + struct genl_info *info) 1207 1207 { 1208 1208 struct devlink *devlink = info->user_ptr[0]; 1209 1209 struct devlink_health_reporter *reporter; ··· 1219 1219 return 0; 1220 1220 } 1221 1221 1222 - int devlink_nl_cmd_health_reporter_test_doit(struct sk_buff *skb, 1223 - struct genl_info *info) 1222 + int devlink_nl_health_reporter_test_doit(struct sk_buff *skb, 1223 + struct genl_info *info) 1224 1224 { 1225 1225 struct devlink *devlink = info->user_ptr[0]; 1226 1226 struct devlink_health_reporter *reporter;
+1 -2
net/devlink/linecard.c
··· 369 369 return err; 370 370 } 371 371 372 - int devlink_nl_cmd_linecard_set_doit(struct sk_buff *skb, 373 - struct genl_info *info) 372 + int devlink_nl_linecard_set_doit(struct sk_buff *skb, struct genl_info *info) 374 373 { 375 374 struct netlink_ext_ack *extack = info->extack; 376 375 struct devlink *devlink = info->user_ptr[0];
+1 -327
net/devlink/netlink.c
··· 13 13 [DEVLINK_MCGRP_CONFIG] = { .name = DEVLINK_GENL_MCGRP_CONFIG_NAME }, 14 14 }; 15 15 16 - static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = { 17 - [DEVLINK_ATTR_UNSPEC] = { .strict_start_type = 18 - DEVLINK_ATTR_TRAP_POLICER_ID }, 19 - [DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING }, 20 - [DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING }, 21 - [DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32 }, 22 - [DEVLINK_ATTR_PORT_TYPE] = NLA_POLICY_RANGE(NLA_U16, DEVLINK_PORT_TYPE_AUTO, 23 - DEVLINK_PORT_TYPE_IB), 24 - [DEVLINK_ATTR_PORT_SPLIT_COUNT] = { .type = NLA_U32 }, 25 - [DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32 }, 26 - [DEVLINK_ATTR_SB_POOL_INDEX] = { .type = NLA_U16 }, 27 - [DEVLINK_ATTR_SB_POOL_TYPE] = { .type = NLA_U8 }, 28 - [DEVLINK_ATTR_SB_POOL_SIZE] = { .type = NLA_U32 }, 29 - [DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE] = { .type = NLA_U8 }, 30 - [DEVLINK_ATTR_SB_THRESHOLD] = { .type = NLA_U32 }, 31 - [DEVLINK_ATTR_SB_TC_INDEX] = { .type = NLA_U16 }, 32 - [DEVLINK_ATTR_ESWITCH_MODE] = NLA_POLICY_RANGE(NLA_U16, DEVLINK_ESWITCH_MODE_LEGACY, 33 - DEVLINK_ESWITCH_MODE_SWITCHDEV), 34 - [DEVLINK_ATTR_ESWITCH_INLINE_MODE] = { .type = NLA_U8 }, 35 - [DEVLINK_ATTR_ESWITCH_ENCAP_MODE] = { .type = NLA_U8 }, 36 - [DEVLINK_ATTR_DPIPE_TABLE_NAME] = { .type = NLA_NUL_STRING }, 37 - [DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED] = { .type = NLA_U8 }, 38 - [DEVLINK_ATTR_RESOURCE_ID] = { .type = NLA_U64}, 39 - [DEVLINK_ATTR_RESOURCE_SIZE] = { .type = NLA_U64}, 40 - [DEVLINK_ATTR_PARAM_NAME] = { .type = NLA_NUL_STRING }, 41 - [DEVLINK_ATTR_PARAM_TYPE] = { .type = NLA_U8 }, 42 - [DEVLINK_ATTR_PARAM_VALUE_CMODE] = { .type = NLA_U8 }, 43 - [DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING }, 44 - [DEVLINK_ATTR_REGION_SNAPSHOT_ID] = { .type = NLA_U32 }, 45 - [DEVLINK_ATTR_REGION_CHUNK_ADDR] = { .type = NLA_U64 }, 46 - [DEVLINK_ATTR_REGION_CHUNK_LEN] = { .type = NLA_U64 }, 47 - [DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING }, 48 - [DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD] = { .type = NLA_U64 }, 49 - [DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER] = { .type = NLA_U8 }, 50 - [DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME] = { .type = NLA_NUL_STRING }, 51 - [DEVLINK_ATTR_FLASH_UPDATE_COMPONENT] = { .type = NLA_NUL_STRING }, 52 - [DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK] = 53 - NLA_POLICY_BITFIELD32(DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS), 54 - [DEVLINK_ATTR_TRAP_NAME] = { .type = NLA_NUL_STRING }, 55 - [DEVLINK_ATTR_TRAP_ACTION] = { .type = NLA_U8 }, 56 - [DEVLINK_ATTR_TRAP_GROUP_NAME] = { .type = NLA_NUL_STRING }, 57 - [DEVLINK_ATTR_NETNS_PID] = { .type = NLA_U32 }, 58 - [DEVLINK_ATTR_NETNS_FD] = { .type = NLA_U32 }, 59 - [DEVLINK_ATTR_NETNS_ID] = { .type = NLA_U32 }, 60 - [DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP] = { .type = NLA_U8 }, 61 - [DEVLINK_ATTR_TRAP_POLICER_ID] = { .type = NLA_U32 }, 62 - [DEVLINK_ATTR_TRAP_POLICER_RATE] = { .type = NLA_U64 }, 63 - [DEVLINK_ATTR_TRAP_POLICER_BURST] = { .type = NLA_U64 }, 64 - [DEVLINK_ATTR_PORT_FUNCTION] = { .type = NLA_NESTED }, 65 - [DEVLINK_ATTR_RELOAD_ACTION] = NLA_POLICY_RANGE(NLA_U8, DEVLINK_RELOAD_ACTION_DRIVER_REINIT, 66 - DEVLINK_RELOAD_ACTION_MAX), 67 - [DEVLINK_ATTR_RELOAD_LIMITS] = NLA_POLICY_BITFIELD32(DEVLINK_RELOAD_LIMITS_VALID_MASK), 68 - [DEVLINK_ATTR_PORT_FLAVOUR] = { .type = NLA_U16 }, 69 - [DEVLINK_ATTR_PORT_PCI_PF_NUMBER] = { .type = NLA_U16 }, 70 - [DEVLINK_ATTR_PORT_PCI_SF_NUMBER] = { .type = NLA_U32 }, 71 - [DEVLINK_ATTR_PORT_CONTROLLER_NUMBER] = { .type = NLA_U32 }, 72 - [DEVLINK_ATTR_RATE_TYPE] = { .type = NLA_U16 }, 73 - [DEVLINK_ATTR_RATE_TX_SHARE] = { .type = NLA_U64 }, 74 - [DEVLINK_ATTR_RATE_TX_MAX] = { .type = NLA_U64 }, 75 - [DEVLINK_ATTR_RATE_NODE_NAME] = { .type = NLA_NUL_STRING }, 76 - [DEVLINK_ATTR_RATE_PARENT_NODE_NAME] = { .type = NLA_NUL_STRING }, 77 - [DEVLINK_ATTR_LINECARD_INDEX] = { .type = NLA_U32 }, 78 - [DEVLINK_ATTR_LINECARD_TYPE] = { .type = NLA_NUL_STRING }, 79 - [DEVLINK_ATTR_SELFTESTS] = { .type = NLA_NESTED }, 80 - [DEVLINK_ATTR_RATE_TX_PRIORITY] = { .type = NLA_U32 }, 81 - [DEVLINK_ATTR_RATE_TX_WEIGHT] = { .type = NLA_U32 }, 82 - [DEVLINK_ATTR_REGION_DIRECT] = { .type = NLA_FLAG }, 83 - }; 84 - 85 16 int devlink_nl_put_nested_handle(struct sk_buff *msg, struct net *net, 86 17 struct devlink *devlink, int attrtype) 87 18 { ··· 122 191 int devlink_nl_pre_doit(const struct genl_split_ops *ops, 123 192 struct sk_buff *skb, struct genl_info *info) 124 193 { 125 - return __devlink_nl_pre_doit(skb, info, ops->internal_flags); 194 + return __devlink_nl_pre_doit(skb, info, 0); 126 195 } 127 196 128 197 int devlink_nl_pre_doit_port(const struct genl_split_ops *ops, ··· 218 287 return devlink_nl_inst_iter_dumpit(msg, cb, flags, dump_one); 219 288 } 220 289 221 - static const struct genl_small_ops devlink_nl_small_ops[40] = { 222 - { 223 - .cmd = DEVLINK_CMD_PORT_SET, 224 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 225 - .doit = devlink_nl_cmd_port_set_doit, 226 - .flags = GENL_ADMIN_PERM, 227 - .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, 228 - }, 229 - { 230 - .cmd = DEVLINK_CMD_RATE_SET, 231 - .doit = devlink_nl_cmd_rate_set_doit, 232 - .flags = GENL_ADMIN_PERM, 233 - }, 234 - { 235 - .cmd = DEVLINK_CMD_RATE_NEW, 236 - .doit = devlink_nl_cmd_rate_new_doit, 237 - .flags = GENL_ADMIN_PERM, 238 - }, 239 - { 240 - .cmd = DEVLINK_CMD_RATE_DEL, 241 - .doit = devlink_nl_cmd_rate_del_doit, 242 - .flags = GENL_ADMIN_PERM, 243 - }, 244 - { 245 - .cmd = DEVLINK_CMD_PORT_SPLIT, 246 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 247 - .doit = devlink_nl_cmd_port_split_doit, 248 - .flags = GENL_ADMIN_PERM, 249 - .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, 250 - }, 251 - { 252 - .cmd = DEVLINK_CMD_PORT_UNSPLIT, 253 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 254 - .doit = devlink_nl_cmd_port_unsplit_doit, 255 - .flags = GENL_ADMIN_PERM, 256 - .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, 257 - }, 258 - { 259 - .cmd = DEVLINK_CMD_PORT_NEW, 260 - .doit = devlink_nl_cmd_port_new_doit, 261 - .flags = GENL_ADMIN_PERM, 262 - }, 263 - { 264 - .cmd = DEVLINK_CMD_PORT_DEL, 265 - .doit = devlink_nl_cmd_port_del_doit, 266 - .flags = GENL_ADMIN_PERM, 267 - .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, 268 - }, 269 - 270 - { 271 - .cmd = DEVLINK_CMD_LINECARD_SET, 272 - .doit = devlink_nl_cmd_linecard_set_doit, 273 - .flags = GENL_ADMIN_PERM, 274 - }, 275 - { 276 - .cmd = DEVLINK_CMD_SB_POOL_SET, 277 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 278 - .doit = devlink_nl_cmd_sb_pool_set_doit, 279 - .flags = GENL_ADMIN_PERM, 280 - }, 281 - { 282 - .cmd = DEVLINK_CMD_SB_PORT_POOL_SET, 283 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 284 - .doit = devlink_nl_cmd_sb_port_pool_set_doit, 285 - .flags = GENL_ADMIN_PERM, 286 - .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, 287 - }, 288 - { 289 - .cmd = DEVLINK_CMD_SB_TC_POOL_BIND_SET, 290 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 291 - .doit = devlink_nl_cmd_sb_tc_pool_bind_set_doit, 292 - .flags = GENL_ADMIN_PERM, 293 - .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, 294 - }, 295 - { 296 - .cmd = DEVLINK_CMD_SB_OCC_SNAPSHOT, 297 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 298 - .doit = devlink_nl_cmd_sb_occ_snapshot_doit, 299 - .flags = GENL_ADMIN_PERM, 300 - }, 301 - { 302 - .cmd = DEVLINK_CMD_SB_OCC_MAX_CLEAR, 303 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 304 - .doit = devlink_nl_cmd_sb_occ_max_clear_doit, 305 - .flags = GENL_ADMIN_PERM, 306 - }, 307 - { 308 - .cmd = DEVLINK_CMD_ESWITCH_GET, 309 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 310 - .doit = devlink_nl_cmd_eswitch_get_doit, 311 - .flags = GENL_ADMIN_PERM, 312 - }, 313 - { 314 - .cmd = DEVLINK_CMD_ESWITCH_SET, 315 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 316 - .doit = devlink_nl_cmd_eswitch_set_doit, 317 - .flags = GENL_ADMIN_PERM, 318 - }, 319 - { 320 - .cmd = DEVLINK_CMD_DPIPE_TABLE_GET, 321 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 322 - .doit = devlink_nl_cmd_dpipe_table_get, 323 - /* can be retrieved by unprivileged users */ 324 - }, 325 - { 326 - .cmd = DEVLINK_CMD_DPIPE_ENTRIES_GET, 327 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 328 - .doit = devlink_nl_cmd_dpipe_entries_get, 329 - /* can be retrieved by unprivileged users */ 330 - }, 331 - { 332 - .cmd = DEVLINK_CMD_DPIPE_HEADERS_GET, 333 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 334 - .doit = devlink_nl_cmd_dpipe_headers_get, 335 - /* can be retrieved by unprivileged users */ 336 - }, 337 - { 338 - .cmd = DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET, 339 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 340 - .doit = devlink_nl_cmd_dpipe_table_counters_set, 341 - .flags = GENL_ADMIN_PERM, 342 - }, 343 - { 344 - .cmd = DEVLINK_CMD_RESOURCE_SET, 345 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 346 - .doit = devlink_nl_cmd_resource_set, 347 - .flags = GENL_ADMIN_PERM, 348 - }, 349 - { 350 - .cmd = DEVLINK_CMD_RESOURCE_DUMP, 351 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 352 - .doit = devlink_nl_cmd_resource_dump, 353 - /* can be retrieved by unprivileged users */ 354 - }, 355 - { 356 - .cmd = DEVLINK_CMD_RELOAD, 357 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 358 - .doit = devlink_nl_cmd_reload, 359 - .flags = GENL_ADMIN_PERM, 360 - }, 361 - { 362 - .cmd = DEVLINK_CMD_PARAM_SET, 363 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 364 - .doit = devlink_nl_cmd_param_set_doit, 365 - .flags = GENL_ADMIN_PERM, 366 - }, 367 - { 368 - .cmd = DEVLINK_CMD_PORT_PARAM_GET, 369 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 370 - .doit = devlink_nl_cmd_port_param_get_doit, 371 - .dumpit = devlink_nl_cmd_port_param_get_dumpit, 372 - .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, 373 - /* can be retrieved by unprivileged users */ 374 - }, 375 - { 376 - .cmd = DEVLINK_CMD_PORT_PARAM_SET, 377 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 378 - .doit = devlink_nl_cmd_port_param_set_doit, 379 - .flags = GENL_ADMIN_PERM, 380 - .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, 381 - }, 382 - { 383 - .cmd = DEVLINK_CMD_REGION_NEW, 384 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 385 - .doit = devlink_nl_cmd_region_new, 386 - .flags = GENL_ADMIN_PERM, 387 - }, 388 - { 389 - .cmd = DEVLINK_CMD_REGION_DEL, 390 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 391 - .doit = devlink_nl_cmd_region_del, 392 - .flags = GENL_ADMIN_PERM, 393 - }, 394 - { 395 - .cmd = DEVLINK_CMD_REGION_READ, 396 - .validate = GENL_DONT_VALIDATE_STRICT | 397 - GENL_DONT_VALIDATE_DUMP_STRICT, 398 - .dumpit = devlink_nl_cmd_region_read_dumpit, 399 - .flags = GENL_ADMIN_PERM, 400 - }, 401 - { 402 - .cmd = DEVLINK_CMD_HEALTH_REPORTER_SET, 403 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 404 - .doit = devlink_nl_cmd_health_reporter_set_doit, 405 - .flags = GENL_ADMIN_PERM, 406 - .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT, 407 - }, 408 - { 409 - .cmd = DEVLINK_CMD_HEALTH_REPORTER_RECOVER, 410 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 411 - .doit = devlink_nl_cmd_health_reporter_recover_doit, 412 - .flags = GENL_ADMIN_PERM, 413 - .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT, 414 - }, 415 - { 416 - .cmd = DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE, 417 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 418 - .doit = devlink_nl_cmd_health_reporter_diagnose_doit, 419 - .flags = GENL_ADMIN_PERM, 420 - .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT, 421 - }, 422 - { 423 - .cmd = DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET, 424 - .validate = GENL_DONT_VALIDATE_STRICT | 425 - GENL_DONT_VALIDATE_DUMP_STRICT, 426 - .dumpit = devlink_nl_cmd_health_reporter_dump_get_dumpit, 427 - .flags = GENL_ADMIN_PERM, 428 - }, 429 - { 430 - .cmd = DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR, 431 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 432 - .doit = devlink_nl_cmd_health_reporter_dump_clear_doit, 433 - .flags = GENL_ADMIN_PERM, 434 - .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT, 435 - }, 436 - { 437 - .cmd = DEVLINK_CMD_HEALTH_REPORTER_TEST, 438 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 439 - .doit = devlink_nl_cmd_health_reporter_test_doit, 440 - .flags = GENL_ADMIN_PERM, 441 - .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT, 442 - }, 443 - { 444 - .cmd = DEVLINK_CMD_FLASH_UPDATE, 445 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 446 - .doit = devlink_nl_cmd_flash_update, 447 - .flags = GENL_ADMIN_PERM, 448 - }, 449 - { 450 - .cmd = DEVLINK_CMD_TRAP_SET, 451 - .doit = devlink_nl_cmd_trap_set_doit, 452 - .flags = GENL_ADMIN_PERM, 453 - }, 454 - { 455 - .cmd = DEVLINK_CMD_TRAP_GROUP_SET, 456 - .doit = devlink_nl_cmd_trap_group_set_doit, 457 - .flags = GENL_ADMIN_PERM, 458 - }, 459 - { 460 - .cmd = DEVLINK_CMD_TRAP_POLICER_SET, 461 - .doit = devlink_nl_cmd_trap_policer_set_doit, 462 - .flags = GENL_ADMIN_PERM, 463 - }, 464 - { 465 - .cmd = DEVLINK_CMD_SELFTESTS_RUN, 466 - .doit = devlink_nl_cmd_selftests_run, 467 - .flags = GENL_ADMIN_PERM, 468 - }, 469 - /* -- No new ops here! Use split ops going forward! -- */ 470 - }; 471 - 472 290 struct genl_family devlink_nl_family __ro_after_init = { 473 291 .name = DEVLINK_GENL_NAME, 474 292 .version = DEVLINK_GENL_VERSION, 475 - .maxattr = DEVLINK_ATTR_MAX, 476 - .policy = devlink_nl_policy, 477 293 .netnsok = true, 478 294 .parallel_ops = true, 479 - .pre_doit = devlink_nl_pre_doit, 480 - .post_doit = devlink_nl_post_doit, 481 295 .module = THIS_MODULE, 482 - .small_ops = devlink_nl_small_ops, 483 - .n_small_ops = ARRAY_SIZE(devlink_nl_small_ops), 484 296 .split_ops = devlink_nl_ops, 485 297 .n_split_ops = ARRAY_SIZE(devlink_nl_ops), 486 298 .resv_start_op = DEVLINK_CMD_SELFTESTS_RUN + 1,
+7 -7
net/devlink/param.c
··· 581 581 return 0; 582 582 } 583 583 584 - int devlink_nl_cmd_param_set_doit(struct sk_buff *skb, struct genl_info *info) 584 + int devlink_nl_param_set_doit(struct sk_buff *skb, struct genl_info *info) 585 585 { 586 586 struct devlink *devlink = info->user_ptr[0]; 587 587 ··· 589 589 info, DEVLINK_CMD_PARAM_NEW); 590 590 } 591 591 592 - int devlink_nl_cmd_port_param_get_dumpit(struct sk_buff *msg, 593 - struct netlink_callback *cb) 592 + int devlink_nl_port_param_get_dumpit(struct sk_buff *msg, 593 + struct netlink_callback *cb) 594 594 { 595 595 NL_SET_ERR_MSG(cb->extack, "Port params are not supported"); 596 596 return msg->len; 597 597 } 598 598 599 - int devlink_nl_cmd_port_param_get_doit(struct sk_buff *skb, 600 - struct genl_info *info) 599 + int devlink_nl_port_param_get_doit(struct sk_buff *skb, 600 + struct genl_info *info) 601 601 { 602 602 NL_SET_ERR_MSG(info->extack, "Port params are not supported"); 603 603 return -EINVAL; 604 604 } 605 605 606 - int devlink_nl_cmd_port_param_set_doit(struct sk_buff *skb, 607 - struct genl_info *info) 606 + int devlink_nl_port_param_set_doit(struct sk_buff *skb, 607 + struct genl_info *info) 608 608 { 609 609 NL_SET_ERR_MSG(info->extack, "Port params are not supported"); 610 610 return -EINVAL;
+5 -6
net/devlink/port.c
··· 772 772 return err; 773 773 } 774 774 775 - int devlink_nl_cmd_port_set_doit(struct sk_buff *skb, struct genl_info *info) 775 + int devlink_nl_port_set_doit(struct sk_buff *skb, struct genl_info *info) 776 776 { 777 777 struct devlink_port *devlink_port = info->user_ptr[1]; 778 778 int err; ··· 798 798 return 0; 799 799 } 800 800 801 - int devlink_nl_cmd_port_split_doit(struct sk_buff *skb, struct genl_info *info) 801 + int devlink_nl_port_split_doit(struct sk_buff *skb, struct genl_info *info) 802 802 { 803 803 struct devlink_port *devlink_port = info->user_ptr[1]; 804 804 struct devlink *devlink = info->user_ptr[0]; ··· 829 829 info->extack); 830 830 } 831 831 832 - int devlink_nl_cmd_port_unsplit_doit(struct sk_buff *skb, 833 - struct genl_info *info) 832 + int devlink_nl_port_unsplit_doit(struct sk_buff *skb, struct genl_info *info) 834 833 { 835 834 struct devlink_port *devlink_port = info->user_ptr[1]; 836 835 struct devlink *devlink = info->user_ptr[0]; ··· 839 840 return devlink_port->ops->port_unsplit(devlink, devlink_port, info->extack); 840 841 } 841 842 842 - int devlink_nl_cmd_port_new_doit(struct sk_buff *skb, struct genl_info *info) 843 + int devlink_nl_port_new_doit(struct sk_buff *skb, struct genl_info *info) 843 844 { 844 845 struct netlink_ext_ack *extack = info->extack; 845 846 struct devlink_port_new_attrs new_attrs = {}; ··· 903 904 return err; 904 905 } 905 906 906 - int devlink_nl_cmd_port_del_doit(struct sk_buff *skb, struct genl_info *info) 907 + int devlink_nl_port_del_doit(struct sk_buff *skb, struct genl_info *info) 907 908 { 908 909 struct devlink_port *devlink_port = info->user_ptr[1]; 909 910 struct netlink_ext_ack *extack = info->extack;
+3 -3
net/devlink/rate.c
··· 458 458 return true; 459 459 } 460 460 461 - int devlink_nl_cmd_rate_set_doit(struct sk_buff *skb, struct genl_info *info) 461 + int devlink_nl_rate_set_doit(struct sk_buff *skb, struct genl_info *info) 462 462 { 463 463 struct devlink *devlink = info->user_ptr[0]; 464 464 struct devlink_rate *devlink_rate; ··· 480 480 return err; 481 481 } 482 482 483 - int devlink_nl_cmd_rate_new_doit(struct sk_buff *skb, struct genl_info *info) 483 + int devlink_nl_rate_new_doit(struct sk_buff *skb, struct genl_info *info) 484 484 { 485 485 struct devlink *devlink = info->user_ptr[0]; 486 486 struct devlink_rate *rate_node; ··· 536 536 return err; 537 537 } 538 538 539 - int devlink_nl_cmd_rate_del_doit(struct sk_buff *skb, struct genl_info *info) 539 + int devlink_nl_rate_del_doit(struct sk_buff *skb, struct genl_info *info) 540 540 { 541 541 struct devlink *devlink = info->user_ptr[0]; 542 542 struct devlink_rate *rate_node;
+4 -4
net/devlink/region.c
··· 588 588 return devlink_nl_dumpit(skb, cb, devlink_nl_region_get_dump_one); 589 589 } 590 590 591 - int devlink_nl_cmd_region_del(struct sk_buff *skb, struct genl_info *info) 591 + int devlink_nl_region_del_doit(struct sk_buff *skb, struct genl_info *info) 592 592 { 593 593 struct devlink *devlink = info->user_ptr[0]; 594 594 struct devlink_snapshot *snapshot; ··· 633 633 return 0; 634 634 } 635 635 636 - int devlink_nl_cmd_region_new(struct sk_buff *skb, struct genl_info *info) 636 + int devlink_nl_region_new_doit(struct sk_buff *skb, struct genl_info *info) 637 637 { 638 638 struct devlink *devlink = info->user_ptr[0]; 639 639 struct devlink_snapshot *snapshot; ··· 863 863 curr_offset, chunk_size, chunk); 864 864 } 865 865 866 - int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb, 867 - struct netlink_callback *cb) 866 + int devlink_nl_region_read_dumpit(struct sk_buff *skb, 867 + struct netlink_callback *cb) 868 868 { 869 869 const struct genl_dumpit_info *info = genl_dumpit_info(cb); 870 870 struct devlink_nl_dump_state *state = devlink_dump_state(cb);
+2 -2
net/devlink/resource.c
··· 105 105 return err; 106 106 } 107 107 108 - int devlink_nl_cmd_resource_set(struct sk_buff *skb, struct genl_info *info) 108 + int devlink_nl_resource_set_doit(struct sk_buff *skb, struct genl_info *info) 109 109 { 110 110 struct devlink *devlink = info->user_ptr[0]; 111 111 struct devlink_resource *resource; ··· 285 285 return err; 286 286 } 287 287 288 - int devlink_nl_cmd_resource_dump(struct sk_buff *skb, struct genl_info *info) 288 + int devlink_nl_resource_dump_doit(struct sk_buff *skb, struct genl_info *info) 289 289 { 290 290 struct devlink *devlink = info->user_ptr[0]; 291 291
+8 -9
net/devlink/sb.c
··· 413 413 return -EOPNOTSUPP; 414 414 } 415 415 416 - int devlink_nl_cmd_sb_pool_set_doit(struct sk_buff *skb, struct genl_info *info) 416 + int devlink_nl_sb_pool_set_doit(struct sk_buff *skb, struct genl_info *info) 417 417 { 418 418 struct devlink *devlink = info->user_ptr[0]; 419 419 enum devlink_sb_threshold_type threshold_type; ··· 621 621 return -EOPNOTSUPP; 622 622 } 623 623 624 - int devlink_nl_cmd_sb_port_pool_set_doit(struct sk_buff *skb, 625 - struct genl_info *info) 624 + int devlink_nl_sb_port_pool_set_doit(struct sk_buff *skb, 625 + struct genl_info *info) 626 626 { 627 627 struct devlink_port *devlink_port = info->user_ptr[1]; 628 628 struct devlink *devlink = info->user_ptr[0]; ··· 861 861 return -EOPNOTSUPP; 862 862 } 863 863 864 - int devlink_nl_cmd_sb_tc_pool_bind_set_doit(struct sk_buff *skb, 865 - struct genl_info *info) 864 + int devlink_nl_sb_tc_pool_bind_set_doit(struct sk_buff *skb, 865 + struct genl_info *info) 866 866 { 867 867 struct devlink_port *devlink_port = info->user_ptr[1]; 868 868 struct devlink *devlink = info->user_ptr[0]; ··· 900 900 pool_index, threshold, info->extack); 901 901 } 902 902 903 - int devlink_nl_cmd_sb_occ_snapshot_doit(struct sk_buff *skb, 904 - struct genl_info *info) 903 + int devlink_nl_sb_occ_snapshot_doit(struct sk_buff *skb, struct genl_info *info) 905 904 { 906 905 struct devlink *devlink = info->user_ptr[0]; 907 906 const struct devlink_ops *ops = devlink->ops; ··· 915 916 return -EOPNOTSUPP; 916 917 } 917 918 918 - int devlink_nl_cmd_sb_occ_max_clear_doit(struct sk_buff *skb, 919 - struct genl_info *info) 919 + int devlink_nl_sb_occ_max_clear_doit(struct sk_buff *skb, 920 + struct genl_info *info) 920 921 { 921 922 struct devlink *devlink = info->user_ptr[0]; 922 923 const struct devlink_ops *ops = devlink->ops;
+4 -5
net/devlink/trap.c
··· 414 414 info->extack); 415 415 } 416 416 417 - int devlink_nl_cmd_trap_set_doit(struct sk_buff *skb, struct genl_info *info) 417 + int devlink_nl_trap_set_doit(struct sk_buff *skb, struct genl_info *info) 418 418 { 419 419 struct netlink_ext_ack *extack = info->extack; 420 420 struct devlink *devlink = info->user_ptr[0]; ··· 684 684 return 0; 685 685 } 686 686 687 - int devlink_nl_cmd_trap_group_set_doit(struct sk_buff *skb, 688 - struct genl_info *info) 687 + int devlink_nl_trap_group_set_doit(struct sk_buff *skb, struct genl_info *info) 689 688 { 690 689 struct netlink_ext_ack *extack = info->extack; 691 690 struct devlink *devlink = info->user_ptr[0]; ··· 925 926 return 0; 926 927 } 927 928 928 - int devlink_nl_cmd_trap_policer_set_doit(struct sk_buff *skb, 929 - struct genl_info *info) 929 + int devlink_nl_trap_policer_set_doit(struct sk_buff *skb, 930 + struct genl_info *info) 930 931 { 931 932 struct devlink_trap_policer_item *policer_item; 932 933 struct netlink_ext_ack *extack = info->extack;
+2 -1
net/netlink/genetlink.c
··· 225 225 } 226 226 227 227 if (i + cnt < family->n_split_ops && 228 - family->split_ops[i + cnt].flags & GENL_CMD_CAP_DUMP) { 228 + family->split_ops[i + cnt].flags & GENL_CMD_CAP_DUMP && 229 + (!cnt || family->split_ops[i + cnt].cmd == iter->doit.cmd)) { 229 230 iter->dumpit = family->split_ops[i + cnt]; 230 231 genl_op_fill_in_reject_policy_split(family, &iter->dumpit); 231 232 cnt++;
+6
tools/net/ynl/lib/ynl.c
··· 379 379 yerr(yarg->ys, YNL_ERROR_ATTR_INVALID, 380 380 "Invalid attribute (string %s)", policy->name); 381 381 return -1; 382 + case YNL_PT_BITFIELD32: 383 + if (len == sizeof(struct nla_bitfield32)) 384 + break; 385 + yerr(yarg->ys, YNL_ERROR_ATTR_INVALID, 386 + "Invalid attribute (bitfield32 %s)", policy->name); 387 + return -1; 382 388 default: 383 389 yerr(yarg->ys, YNL_ERROR_ATTR_INVALID, 384 390 "Invalid attribute (unknown %s)", policy->name);
+1
tools/net/ynl/lib/ynl.h
··· 135 135 YNL_PT_U64, 136 136 YNL_PT_UINT, 137 137 YNL_PT_NUL_STR, 138 + YNL_PT_BITFIELD32, 138 139 }; 139 140 140 141 struct ynl_policy_attr {
+10 -3
tools/net/ynl/lib/ynl.py
··· 478 478 elif attr['type'] in NlAttr.type_formats: 479 479 format = NlAttr.get_format(attr['type'], attr.byte_order) 480 480 attr_payload = format.pack(int(value)) 481 + elif attr['type'] in "bitfield32": 482 + attr_payload = struct.pack("II", int(value["value"]), int(value["selector"])) 481 483 else: 482 484 raise Exception(f'Unknown type at {space} {name} {value} {attr["type"]}') 483 485 ··· 547 545 decoded = attr.as_auto_scalar(attr_spec['type'], attr_spec.byte_order) 548 546 elif attr_spec["type"] in NlAttr.type_formats: 549 547 decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order) 548 + if 'enum' in attr_spec: 549 + decoded = self._decode_enum(decoded, attr_spec) 550 550 elif attr_spec["type"] == 'array-nest': 551 551 decoded = self._decode_array_nest(attr, attr_spec) 552 + elif attr_spec["type"] == 'bitfield32': 553 + value, selector = struct.unpack("II", attr.raw) 554 + if 'enum' in attr_spec: 555 + value = self._decode_enum(value, attr_spec) 556 + selector = self._decode_enum(selector, attr_spec) 557 + decoded = {"value": value, "selector": selector} 552 558 else: 553 559 raise Exception(f'Unknown {attr_spec["type"]} with name {attr_spec["name"]}') 554 - 555 - if 'enum' in attr_spec: 556 - decoded = self._decode_enum(decoded, attr_spec) 557 560 558 561 if not attr_spec.is_multi: 559 562 rsp[attr_spec['name']] = decoded
+46 -4
tools/net/ynl/ynl-gen-c.py
··· 488 488 f'memcpy({member}, {self.c_name}, {presence}_len);'] 489 489 490 490 491 + class TypeBitfield32(Type): 492 + def _complex_member_type(self, ri): 493 + return "struct nla_bitfield32" 494 + 495 + def _attr_typol(self): 496 + return f'.type = YNL_PT_BITFIELD32, ' 497 + 498 + def _attr_policy(self, policy): 499 + if not 'enum' in self.attr: 500 + raise Exception('Enum required for bitfield32 attr') 501 + enum = self.family.consts[self.attr['enum']] 502 + mask = enum.get_mask(as_flags=True) 503 + return f"NLA_POLICY_BITFIELD32({mask})" 504 + 505 + def attr_put(self, ri, var): 506 + line = f"mnl_attr_put(nlh, {self.enum_name}, sizeof(struct nla_bitfield32), &{var}->{self.c_name})" 507 + self._attr_put_line(ri, var, line) 508 + 509 + def _attr_get(self, ri, var): 510 + return f"memcpy(&{var}->{self.c_name}, mnl_attr_get_payload(attr), sizeof(struct nla_bitfield32));", None, None 511 + 512 + def _setter_lines(self, ri, member, presence): 513 + return [f"memcpy(&{member}, {self.c_name}, sizeof(struct nla_bitfield32));"] 514 + 515 + 491 516 class TypeNest(Type): 492 517 def _complex_member_type(self, ri): 493 518 return self.nested_struct_type ··· 811 786 t = TypeString(self.family, self, elem, value) 812 787 elif elem['type'] == 'binary': 813 788 t = TypeBinary(self.family, self, elem, value) 789 + elif elem['type'] == 'bitfield32': 790 + t = TypeBitfield32(self.family, self, elem, value) 814 791 elif elem['type'] == 'nest': 815 792 t = TypeNest(self.family, self, elem, value) 816 793 elif elem['type'] == 'array-nest': ··· 1112 1085 1113 1086 # 'do' and 'dump' response parsing is identical 1114 1087 self.type_consistent = True 1115 - if op_mode != 'do' and 'dump' in op and 'do' in op: 1116 - if ('reply' in op['do']) != ('reply' in op["dump"]): 1117 - self.type_consistent = False 1118 - elif 'reply' in op['do'] and op["do"]["reply"] != op["dump"]["reply"]: 1088 + if op_mode != 'do' and 'dump' in op: 1089 + if 'do' in op: 1090 + if ('reply' in op['do']) != ('reply' in op["dump"]): 1091 + self.type_consistent = False 1092 + elif 'reply' in op['do'] and op["do"]["reply"] != op["dump"]["reply"]: 1093 + self.type_consistent = False 1094 + else: 1119 1095 self.type_consistent = False 1120 1096 1121 1097 self.attr_set = attr_set ··· 2444 2414 cw.block_end(line=';') 2445 2415 2446 2416 2417 + def family_contains_bitfield32(family): 2418 + for _, attr_set in family.attr_sets.items(): 2419 + if attr_set.subset_of: 2420 + continue 2421 + for _, attr in attr_set.items(): 2422 + if attr.type == "bitfield32": 2423 + return True 2424 + return False 2425 + 2426 + 2447 2427 def find_kernel_root(full_path): 2448 2428 sub_path = '' 2449 2429 while True: ··· 2539 2499 cw.p('#include <string.h>') 2540 2500 if args.header: 2541 2501 cw.p('#include <linux/types.h>') 2502 + if family_contains_bitfield32(parsed): 2503 + cw.p('#include <linux/netlink.h>') 2542 2504 else: 2543 2505 cw.p(f'#include "{parsed.name}-user.h"') 2544 2506 cw.p('#include "ynl.h"')