1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 /* Do not edit directly, auto-generated from: */ 3 /* Documentation/netlink/specs/devlink.yaml */ 4 /* YNL-GEN user header */ 5 6 #ifndef _LINUX_DEVLINK_GEN_H 7 #define _LINUX_DEVLINK_GEN_H 8 9 #include <stdlib.h> 10 #include <string.h> 11 #include <linux/types.h> 12 #include <linux/devlink.h> 13 14 struct ynl_sock; 15 16 extern const struct ynl_family ynl_devlink_family; 17 18 /* Enums */ 19 const char *devlink_op_str(int op); 20 const char *devlink_sb_pool_type_str(enum devlink_sb_pool_type value); 21 22 /* Common nested types */ 23 struct devlink_dl_info_version { 24 struct { 25 __u32 info_version_name_len; 26 __u32 info_version_value_len; 27 } _present; 28 29 char *info_version_name; 30 char *info_version_value; 31 }; 32 33 struct devlink_dl_reload_stats_entry { 34 struct { 35 __u32 reload_stats_limit:1; 36 __u32 reload_stats_value:1; 37 } _present; 38 39 __u8 reload_stats_limit; 40 __u32 reload_stats_value; 41 }; 42 43 struct devlink_dl_reload_act_stats { 44 unsigned int n_reload_stats_entry; 45 struct devlink_dl_reload_stats_entry *reload_stats_entry; 46 }; 47 48 struct devlink_dl_reload_act_info { 49 struct { 50 __u32 reload_action:1; 51 } _present; 52 53 __u8 reload_action; 54 unsigned int n_reload_action_stats; 55 struct devlink_dl_reload_act_stats *reload_action_stats; 56 }; 57 58 struct devlink_dl_reload_stats { 59 unsigned int n_reload_action_info; 60 struct devlink_dl_reload_act_info *reload_action_info; 61 }; 62 63 struct devlink_dl_dev_stats { 64 struct { 65 __u32 reload_stats:1; 66 __u32 remote_reload_stats:1; 67 } _present; 68 69 struct devlink_dl_reload_stats reload_stats; 70 struct devlink_dl_reload_stats remote_reload_stats; 71 }; 72 73 /* ============== DEVLINK_CMD_GET ============== */ 74 /* DEVLINK_CMD_GET - do */ 75 struct devlink_get_req { 76 struct { 77 __u32 bus_name_len; 78 __u32 dev_name_len; 79 } _present; 80 81 char *bus_name; 82 char *dev_name; 83 }; 84 85 static inline struct devlink_get_req *devlink_get_req_alloc(void) 86 { 87 return calloc(1, sizeof(struct devlink_get_req)); 88 } 89 void devlink_get_req_free(struct devlink_get_req *req); 90 91 static inline void 92 devlink_get_req_set_bus_name(struct devlink_get_req *req, const char *bus_name) 93 { 94 free(req->bus_name); 95 req->_present.bus_name_len = strlen(bus_name); 96 req->bus_name = malloc(req->_present.bus_name_len + 1); 97 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 98 req->bus_name[req->_present.bus_name_len] = 0; 99 } 100 static inline void 101 devlink_get_req_set_dev_name(struct devlink_get_req *req, const char *dev_name) 102 { 103 free(req->dev_name); 104 req->_present.dev_name_len = strlen(dev_name); 105 req->dev_name = malloc(req->_present.dev_name_len + 1); 106 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 107 req->dev_name[req->_present.dev_name_len] = 0; 108 } 109 110 struct devlink_get_rsp { 111 struct { 112 __u32 bus_name_len; 113 __u32 dev_name_len; 114 __u32 reload_failed:1; 115 __u32 reload_action:1; 116 __u32 dev_stats:1; 117 } _present; 118 119 char *bus_name; 120 char *dev_name; 121 __u8 reload_failed; 122 __u8 reload_action; 123 struct devlink_dl_dev_stats dev_stats; 124 }; 125 126 void devlink_get_rsp_free(struct devlink_get_rsp *rsp); 127 128 /* 129 * Get devlink instances. 130 */ 131 struct devlink_get_rsp * 132 devlink_get(struct ynl_sock *ys, struct devlink_get_req *req); 133 134 /* DEVLINK_CMD_GET - dump */ 135 struct devlink_get_list { 136 struct devlink_get_list *next; 137 struct devlink_get_rsp obj __attribute__ ((aligned (8))); 138 }; 139 140 void devlink_get_list_free(struct devlink_get_list *rsp); 141 142 struct devlink_get_list *devlink_get_dump(struct ynl_sock *ys); 143 144 /* ============== DEVLINK_CMD_PORT_GET ============== */ 145 /* DEVLINK_CMD_PORT_GET - do */ 146 struct devlink_port_get_req { 147 struct { 148 __u32 bus_name_len; 149 __u32 dev_name_len; 150 __u32 port_index:1; 151 } _present; 152 153 char *bus_name; 154 char *dev_name; 155 __u32 port_index; 156 }; 157 158 static inline struct devlink_port_get_req *devlink_port_get_req_alloc(void) 159 { 160 return calloc(1, sizeof(struct devlink_port_get_req)); 161 } 162 void devlink_port_get_req_free(struct devlink_port_get_req *req); 163 164 static inline void 165 devlink_port_get_req_set_bus_name(struct devlink_port_get_req *req, 166 const char *bus_name) 167 { 168 free(req->bus_name); 169 req->_present.bus_name_len = strlen(bus_name); 170 req->bus_name = malloc(req->_present.bus_name_len + 1); 171 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 172 req->bus_name[req->_present.bus_name_len] = 0; 173 } 174 static inline void 175 devlink_port_get_req_set_dev_name(struct devlink_port_get_req *req, 176 const char *dev_name) 177 { 178 free(req->dev_name); 179 req->_present.dev_name_len = strlen(dev_name); 180 req->dev_name = malloc(req->_present.dev_name_len + 1); 181 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 182 req->dev_name[req->_present.dev_name_len] = 0; 183 } 184 static inline void 185 devlink_port_get_req_set_port_index(struct devlink_port_get_req *req, 186 __u32 port_index) 187 { 188 req->_present.port_index = 1; 189 req->port_index = port_index; 190 } 191 192 struct devlink_port_get_rsp { 193 struct { 194 __u32 bus_name_len; 195 __u32 dev_name_len; 196 __u32 port_index:1; 197 } _present; 198 199 char *bus_name; 200 char *dev_name; 201 __u32 port_index; 202 }; 203 204 void devlink_port_get_rsp_free(struct devlink_port_get_rsp *rsp); 205 206 /* 207 * Get devlink port instances. 208 */ 209 struct devlink_port_get_rsp * 210 devlink_port_get(struct ynl_sock *ys, struct devlink_port_get_req *req); 211 212 /* DEVLINK_CMD_PORT_GET - dump */ 213 struct devlink_port_get_req_dump { 214 struct { 215 __u32 bus_name_len; 216 __u32 dev_name_len; 217 } _present; 218 219 char *bus_name; 220 char *dev_name; 221 }; 222 223 static inline struct devlink_port_get_req_dump * 224 devlink_port_get_req_dump_alloc(void) 225 { 226 return calloc(1, sizeof(struct devlink_port_get_req_dump)); 227 } 228 void devlink_port_get_req_dump_free(struct devlink_port_get_req_dump *req); 229 230 static inline void 231 devlink_port_get_req_dump_set_bus_name(struct devlink_port_get_req_dump *req, 232 const char *bus_name) 233 { 234 free(req->bus_name); 235 req->_present.bus_name_len = strlen(bus_name); 236 req->bus_name = malloc(req->_present.bus_name_len + 1); 237 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 238 req->bus_name[req->_present.bus_name_len] = 0; 239 } 240 static inline void 241 devlink_port_get_req_dump_set_dev_name(struct devlink_port_get_req_dump *req, 242 const char *dev_name) 243 { 244 free(req->dev_name); 245 req->_present.dev_name_len = strlen(dev_name); 246 req->dev_name = malloc(req->_present.dev_name_len + 1); 247 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 248 req->dev_name[req->_present.dev_name_len] = 0; 249 } 250 251 struct devlink_port_get_rsp_dump { 252 struct { 253 __u32 bus_name_len; 254 __u32 dev_name_len; 255 __u32 port_index:1; 256 } _present; 257 258 char *bus_name; 259 char *dev_name; 260 __u32 port_index; 261 }; 262 263 struct devlink_port_get_rsp_list { 264 struct devlink_port_get_rsp_list *next; 265 struct devlink_port_get_rsp_dump obj __attribute__ ((aligned (8))); 266 }; 267 268 void devlink_port_get_rsp_list_free(struct devlink_port_get_rsp_list *rsp); 269 270 struct devlink_port_get_rsp_list * 271 devlink_port_get_dump(struct ynl_sock *ys, 272 struct devlink_port_get_req_dump *req); 273 274 /* ============== DEVLINK_CMD_SB_GET ============== */ 275 /* DEVLINK_CMD_SB_GET - do */ 276 struct devlink_sb_get_req { 277 struct { 278 __u32 bus_name_len; 279 __u32 dev_name_len; 280 __u32 sb_index:1; 281 } _present; 282 283 char *bus_name; 284 char *dev_name; 285 __u32 sb_index; 286 }; 287 288 static inline struct devlink_sb_get_req *devlink_sb_get_req_alloc(void) 289 { 290 return calloc(1, sizeof(struct devlink_sb_get_req)); 291 } 292 void devlink_sb_get_req_free(struct devlink_sb_get_req *req); 293 294 static inline void 295 devlink_sb_get_req_set_bus_name(struct devlink_sb_get_req *req, 296 const char *bus_name) 297 { 298 free(req->bus_name); 299 req->_present.bus_name_len = strlen(bus_name); 300 req->bus_name = malloc(req->_present.bus_name_len + 1); 301 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 302 req->bus_name[req->_present.bus_name_len] = 0; 303 } 304 static inline void 305 devlink_sb_get_req_set_dev_name(struct devlink_sb_get_req *req, 306 const char *dev_name) 307 { 308 free(req->dev_name); 309 req->_present.dev_name_len = strlen(dev_name); 310 req->dev_name = malloc(req->_present.dev_name_len + 1); 311 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 312 req->dev_name[req->_present.dev_name_len] = 0; 313 } 314 static inline void 315 devlink_sb_get_req_set_sb_index(struct devlink_sb_get_req *req, __u32 sb_index) 316 { 317 req->_present.sb_index = 1; 318 req->sb_index = sb_index; 319 } 320 321 struct devlink_sb_get_rsp { 322 struct { 323 __u32 bus_name_len; 324 __u32 dev_name_len; 325 __u32 sb_index:1; 326 } _present; 327 328 char *bus_name; 329 char *dev_name; 330 __u32 sb_index; 331 }; 332 333 void devlink_sb_get_rsp_free(struct devlink_sb_get_rsp *rsp); 334 335 /* 336 * Get shared buffer instances. 337 */ 338 struct devlink_sb_get_rsp * 339 devlink_sb_get(struct ynl_sock *ys, struct devlink_sb_get_req *req); 340 341 /* DEVLINK_CMD_SB_GET - dump */ 342 struct devlink_sb_get_req_dump { 343 struct { 344 __u32 bus_name_len; 345 __u32 dev_name_len; 346 } _present; 347 348 char *bus_name; 349 char *dev_name; 350 }; 351 352 static inline struct devlink_sb_get_req_dump * 353 devlink_sb_get_req_dump_alloc(void) 354 { 355 return calloc(1, sizeof(struct devlink_sb_get_req_dump)); 356 } 357 void devlink_sb_get_req_dump_free(struct devlink_sb_get_req_dump *req); 358 359 static inline void 360 devlink_sb_get_req_dump_set_bus_name(struct devlink_sb_get_req_dump *req, 361 const char *bus_name) 362 { 363 free(req->bus_name); 364 req->_present.bus_name_len = strlen(bus_name); 365 req->bus_name = malloc(req->_present.bus_name_len + 1); 366 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 367 req->bus_name[req->_present.bus_name_len] = 0; 368 } 369 static inline void 370 devlink_sb_get_req_dump_set_dev_name(struct devlink_sb_get_req_dump *req, 371 const char *dev_name) 372 { 373 free(req->dev_name); 374 req->_present.dev_name_len = strlen(dev_name); 375 req->dev_name = malloc(req->_present.dev_name_len + 1); 376 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 377 req->dev_name[req->_present.dev_name_len] = 0; 378 } 379 380 struct devlink_sb_get_list { 381 struct devlink_sb_get_list *next; 382 struct devlink_sb_get_rsp obj __attribute__ ((aligned (8))); 383 }; 384 385 void devlink_sb_get_list_free(struct devlink_sb_get_list *rsp); 386 387 struct devlink_sb_get_list * 388 devlink_sb_get_dump(struct ynl_sock *ys, struct devlink_sb_get_req_dump *req); 389 390 /* ============== DEVLINK_CMD_SB_POOL_GET ============== */ 391 /* DEVLINK_CMD_SB_POOL_GET - do */ 392 struct devlink_sb_pool_get_req { 393 struct { 394 __u32 bus_name_len; 395 __u32 dev_name_len; 396 __u32 sb_index:1; 397 __u32 sb_pool_index:1; 398 } _present; 399 400 char *bus_name; 401 char *dev_name; 402 __u32 sb_index; 403 __u16 sb_pool_index; 404 }; 405 406 static inline struct devlink_sb_pool_get_req * 407 devlink_sb_pool_get_req_alloc(void) 408 { 409 return calloc(1, sizeof(struct devlink_sb_pool_get_req)); 410 } 411 void devlink_sb_pool_get_req_free(struct devlink_sb_pool_get_req *req); 412 413 static inline void 414 devlink_sb_pool_get_req_set_bus_name(struct devlink_sb_pool_get_req *req, 415 const char *bus_name) 416 { 417 free(req->bus_name); 418 req->_present.bus_name_len = strlen(bus_name); 419 req->bus_name = malloc(req->_present.bus_name_len + 1); 420 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 421 req->bus_name[req->_present.bus_name_len] = 0; 422 } 423 static inline void 424 devlink_sb_pool_get_req_set_dev_name(struct devlink_sb_pool_get_req *req, 425 const char *dev_name) 426 { 427 free(req->dev_name); 428 req->_present.dev_name_len = strlen(dev_name); 429 req->dev_name = malloc(req->_present.dev_name_len + 1); 430 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 431 req->dev_name[req->_present.dev_name_len] = 0; 432 } 433 static inline void 434 devlink_sb_pool_get_req_set_sb_index(struct devlink_sb_pool_get_req *req, 435 __u32 sb_index) 436 { 437 req->_present.sb_index = 1; 438 req->sb_index = sb_index; 439 } 440 static inline void 441 devlink_sb_pool_get_req_set_sb_pool_index(struct devlink_sb_pool_get_req *req, 442 __u16 sb_pool_index) 443 { 444 req->_present.sb_pool_index = 1; 445 req->sb_pool_index = sb_pool_index; 446 } 447 448 struct devlink_sb_pool_get_rsp { 449 struct { 450 __u32 bus_name_len; 451 __u32 dev_name_len; 452 __u32 sb_index:1; 453 __u32 sb_pool_index:1; 454 } _present; 455 456 char *bus_name; 457 char *dev_name; 458 __u32 sb_index; 459 __u16 sb_pool_index; 460 }; 461 462 void devlink_sb_pool_get_rsp_free(struct devlink_sb_pool_get_rsp *rsp); 463 464 /* 465 * Get shared buffer pool instances. 466 */ 467 struct devlink_sb_pool_get_rsp * 468 devlink_sb_pool_get(struct ynl_sock *ys, struct devlink_sb_pool_get_req *req); 469 470 /* DEVLINK_CMD_SB_POOL_GET - dump */ 471 struct devlink_sb_pool_get_req_dump { 472 struct { 473 __u32 bus_name_len; 474 __u32 dev_name_len; 475 } _present; 476 477 char *bus_name; 478 char *dev_name; 479 }; 480 481 static inline struct devlink_sb_pool_get_req_dump * 482 devlink_sb_pool_get_req_dump_alloc(void) 483 { 484 return calloc(1, sizeof(struct devlink_sb_pool_get_req_dump)); 485 } 486 void 487 devlink_sb_pool_get_req_dump_free(struct devlink_sb_pool_get_req_dump *req); 488 489 static inline void 490 devlink_sb_pool_get_req_dump_set_bus_name(struct devlink_sb_pool_get_req_dump *req, 491 const char *bus_name) 492 { 493 free(req->bus_name); 494 req->_present.bus_name_len = strlen(bus_name); 495 req->bus_name = malloc(req->_present.bus_name_len + 1); 496 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 497 req->bus_name[req->_present.bus_name_len] = 0; 498 } 499 static inline void 500 devlink_sb_pool_get_req_dump_set_dev_name(struct devlink_sb_pool_get_req_dump *req, 501 const char *dev_name) 502 { 503 free(req->dev_name); 504 req->_present.dev_name_len = strlen(dev_name); 505 req->dev_name = malloc(req->_present.dev_name_len + 1); 506 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 507 req->dev_name[req->_present.dev_name_len] = 0; 508 } 509 510 struct devlink_sb_pool_get_list { 511 struct devlink_sb_pool_get_list *next; 512 struct devlink_sb_pool_get_rsp obj __attribute__ ((aligned (8))); 513 }; 514 515 void devlink_sb_pool_get_list_free(struct devlink_sb_pool_get_list *rsp); 516 517 struct devlink_sb_pool_get_list * 518 devlink_sb_pool_get_dump(struct ynl_sock *ys, 519 struct devlink_sb_pool_get_req_dump *req); 520 521 /* ============== DEVLINK_CMD_SB_PORT_POOL_GET ============== */ 522 /* DEVLINK_CMD_SB_PORT_POOL_GET - do */ 523 struct devlink_sb_port_pool_get_req { 524 struct { 525 __u32 bus_name_len; 526 __u32 dev_name_len; 527 __u32 port_index:1; 528 __u32 sb_index:1; 529 __u32 sb_pool_index:1; 530 } _present; 531 532 char *bus_name; 533 char *dev_name; 534 __u32 port_index; 535 __u32 sb_index; 536 __u16 sb_pool_index; 537 }; 538 539 static inline struct devlink_sb_port_pool_get_req * 540 devlink_sb_port_pool_get_req_alloc(void) 541 { 542 return calloc(1, sizeof(struct devlink_sb_port_pool_get_req)); 543 } 544 void 545 devlink_sb_port_pool_get_req_free(struct devlink_sb_port_pool_get_req *req); 546 547 static inline void 548 devlink_sb_port_pool_get_req_set_bus_name(struct devlink_sb_port_pool_get_req *req, 549 const char *bus_name) 550 { 551 free(req->bus_name); 552 req->_present.bus_name_len = strlen(bus_name); 553 req->bus_name = malloc(req->_present.bus_name_len + 1); 554 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 555 req->bus_name[req->_present.bus_name_len] = 0; 556 } 557 static inline void 558 devlink_sb_port_pool_get_req_set_dev_name(struct devlink_sb_port_pool_get_req *req, 559 const char *dev_name) 560 { 561 free(req->dev_name); 562 req->_present.dev_name_len = strlen(dev_name); 563 req->dev_name = malloc(req->_present.dev_name_len + 1); 564 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 565 req->dev_name[req->_present.dev_name_len] = 0; 566 } 567 static inline void 568 devlink_sb_port_pool_get_req_set_port_index(struct devlink_sb_port_pool_get_req *req, 569 __u32 port_index) 570 { 571 req->_present.port_index = 1; 572 req->port_index = port_index; 573 } 574 static inline void 575 devlink_sb_port_pool_get_req_set_sb_index(struct devlink_sb_port_pool_get_req *req, 576 __u32 sb_index) 577 { 578 req->_present.sb_index = 1; 579 req->sb_index = sb_index; 580 } 581 static inline void 582 devlink_sb_port_pool_get_req_set_sb_pool_index(struct devlink_sb_port_pool_get_req *req, 583 __u16 sb_pool_index) 584 { 585 req->_present.sb_pool_index = 1; 586 req->sb_pool_index = sb_pool_index; 587 } 588 589 struct devlink_sb_port_pool_get_rsp { 590 struct { 591 __u32 bus_name_len; 592 __u32 dev_name_len; 593 __u32 port_index:1; 594 __u32 sb_index:1; 595 __u32 sb_pool_index:1; 596 } _present; 597 598 char *bus_name; 599 char *dev_name; 600 __u32 port_index; 601 __u32 sb_index; 602 __u16 sb_pool_index; 603 }; 604 605 void 606 devlink_sb_port_pool_get_rsp_free(struct devlink_sb_port_pool_get_rsp *rsp); 607 608 /* 609 * Get shared buffer port-pool combinations and threshold. 610 */ 611 struct devlink_sb_port_pool_get_rsp * 612 devlink_sb_port_pool_get(struct ynl_sock *ys, 613 struct devlink_sb_port_pool_get_req *req); 614 615 /* DEVLINK_CMD_SB_PORT_POOL_GET - dump */ 616 struct devlink_sb_port_pool_get_req_dump { 617 struct { 618 __u32 bus_name_len; 619 __u32 dev_name_len; 620 } _present; 621 622 char *bus_name; 623 char *dev_name; 624 }; 625 626 static inline struct devlink_sb_port_pool_get_req_dump * 627 devlink_sb_port_pool_get_req_dump_alloc(void) 628 { 629 return calloc(1, sizeof(struct devlink_sb_port_pool_get_req_dump)); 630 } 631 void 632 devlink_sb_port_pool_get_req_dump_free(struct devlink_sb_port_pool_get_req_dump *req); 633 634 static inline void 635 devlink_sb_port_pool_get_req_dump_set_bus_name(struct devlink_sb_port_pool_get_req_dump *req, 636 const char *bus_name) 637 { 638 free(req->bus_name); 639 req->_present.bus_name_len = strlen(bus_name); 640 req->bus_name = malloc(req->_present.bus_name_len + 1); 641 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 642 req->bus_name[req->_present.bus_name_len] = 0; 643 } 644 static inline void 645 devlink_sb_port_pool_get_req_dump_set_dev_name(struct devlink_sb_port_pool_get_req_dump *req, 646 const char *dev_name) 647 { 648 free(req->dev_name); 649 req->_present.dev_name_len = strlen(dev_name); 650 req->dev_name = malloc(req->_present.dev_name_len + 1); 651 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 652 req->dev_name[req->_present.dev_name_len] = 0; 653 } 654 655 struct devlink_sb_port_pool_get_list { 656 struct devlink_sb_port_pool_get_list *next; 657 struct devlink_sb_port_pool_get_rsp obj __attribute__ ((aligned (8))); 658 }; 659 660 void 661 devlink_sb_port_pool_get_list_free(struct devlink_sb_port_pool_get_list *rsp); 662 663 struct devlink_sb_port_pool_get_list * 664 devlink_sb_port_pool_get_dump(struct ynl_sock *ys, 665 struct devlink_sb_port_pool_get_req_dump *req); 666 667 /* ============== DEVLINK_CMD_SB_TC_POOL_BIND_GET ============== */ 668 /* DEVLINK_CMD_SB_TC_POOL_BIND_GET - do */ 669 struct devlink_sb_tc_pool_bind_get_req { 670 struct { 671 __u32 bus_name_len; 672 __u32 dev_name_len; 673 __u32 port_index:1; 674 __u32 sb_index:1; 675 __u32 sb_pool_type:1; 676 __u32 sb_tc_index:1; 677 } _present; 678 679 char *bus_name; 680 char *dev_name; 681 __u32 port_index; 682 __u32 sb_index; 683 enum devlink_sb_pool_type sb_pool_type; 684 __u16 sb_tc_index; 685 }; 686 687 static inline struct devlink_sb_tc_pool_bind_get_req * 688 devlink_sb_tc_pool_bind_get_req_alloc(void) 689 { 690 return calloc(1, sizeof(struct devlink_sb_tc_pool_bind_get_req)); 691 } 692 void 693 devlink_sb_tc_pool_bind_get_req_free(struct devlink_sb_tc_pool_bind_get_req *req); 694 695 static inline void 696 devlink_sb_tc_pool_bind_get_req_set_bus_name(struct devlink_sb_tc_pool_bind_get_req *req, 697 const char *bus_name) 698 { 699 free(req->bus_name); 700 req->_present.bus_name_len = strlen(bus_name); 701 req->bus_name = malloc(req->_present.bus_name_len + 1); 702 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 703 req->bus_name[req->_present.bus_name_len] = 0; 704 } 705 static inline void 706 devlink_sb_tc_pool_bind_get_req_set_dev_name(struct devlink_sb_tc_pool_bind_get_req *req, 707 const char *dev_name) 708 { 709 free(req->dev_name); 710 req->_present.dev_name_len = strlen(dev_name); 711 req->dev_name = malloc(req->_present.dev_name_len + 1); 712 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 713 req->dev_name[req->_present.dev_name_len] = 0; 714 } 715 static inline void 716 devlink_sb_tc_pool_bind_get_req_set_port_index(struct devlink_sb_tc_pool_bind_get_req *req, 717 __u32 port_index) 718 { 719 req->_present.port_index = 1; 720 req->port_index = port_index; 721 } 722 static inline void 723 devlink_sb_tc_pool_bind_get_req_set_sb_index(struct devlink_sb_tc_pool_bind_get_req *req, 724 __u32 sb_index) 725 { 726 req->_present.sb_index = 1; 727 req->sb_index = sb_index; 728 } 729 static inline void 730 devlink_sb_tc_pool_bind_get_req_set_sb_pool_type(struct devlink_sb_tc_pool_bind_get_req *req, 731 enum devlink_sb_pool_type sb_pool_type) 732 { 733 req->_present.sb_pool_type = 1; 734 req->sb_pool_type = sb_pool_type; 735 } 736 static inline void 737 devlink_sb_tc_pool_bind_get_req_set_sb_tc_index(struct devlink_sb_tc_pool_bind_get_req *req, 738 __u16 sb_tc_index) 739 { 740 req->_present.sb_tc_index = 1; 741 req->sb_tc_index = sb_tc_index; 742 } 743 744 struct devlink_sb_tc_pool_bind_get_rsp { 745 struct { 746 __u32 bus_name_len; 747 __u32 dev_name_len; 748 __u32 port_index:1; 749 __u32 sb_index:1; 750 __u32 sb_pool_type:1; 751 __u32 sb_tc_index:1; 752 } _present; 753 754 char *bus_name; 755 char *dev_name; 756 __u32 port_index; 757 __u32 sb_index; 758 enum devlink_sb_pool_type sb_pool_type; 759 __u16 sb_tc_index; 760 }; 761 762 void 763 devlink_sb_tc_pool_bind_get_rsp_free(struct devlink_sb_tc_pool_bind_get_rsp *rsp); 764 765 /* 766 * Get shared buffer port-TC to pool bindings and threshold. 767 */ 768 struct devlink_sb_tc_pool_bind_get_rsp * 769 devlink_sb_tc_pool_bind_get(struct ynl_sock *ys, 770 struct devlink_sb_tc_pool_bind_get_req *req); 771 772 /* DEVLINK_CMD_SB_TC_POOL_BIND_GET - dump */ 773 struct devlink_sb_tc_pool_bind_get_req_dump { 774 struct { 775 __u32 bus_name_len; 776 __u32 dev_name_len; 777 } _present; 778 779 char *bus_name; 780 char *dev_name; 781 }; 782 783 static inline struct devlink_sb_tc_pool_bind_get_req_dump * 784 devlink_sb_tc_pool_bind_get_req_dump_alloc(void) 785 { 786 return calloc(1, sizeof(struct devlink_sb_tc_pool_bind_get_req_dump)); 787 } 788 void 789 devlink_sb_tc_pool_bind_get_req_dump_free(struct devlink_sb_tc_pool_bind_get_req_dump *req); 790 791 static inline void 792 devlink_sb_tc_pool_bind_get_req_dump_set_bus_name(struct devlink_sb_tc_pool_bind_get_req_dump *req, 793 const char *bus_name) 794 { 795 free(req->bus_name); 796 req->_present.bus_name_len = strlen(bus_name); 797 req->bus_name = malloc(req->_present.bus_name_len + 1); 798 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 799 req->bus_name[req->_present.bus_name_len] = 0; 800 } 801 static inline void 802 devlink_sb_tc_pool_bind_get_req_dump_set_dev_name(struct devlink_sb_tc_pool_bind_get_req_dump *req, 803 const char *dev_name) 804 { 805 free(req->dev_name); 806 req->_present.dev_name_len = strlen(dev_name); 807 req->dev_name = malloc(req->_present.dev_name_len + 1); 808 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 809 req->dev_name[req->_present.dev_name_len] = 0; 810 } 811 812 struct devlink_sb_tc_pool_bind_get_list { 813 struct devlink_sb_tc_pool_bind_get_list *next; 814 struct devlink_sb_tc_pool_bind_get_rsp obj __attribute__ ((aligned (8))); 815 }; 816 817 void 818 devlink_sb_tc_pool_bind_get_list_free(struct devlink_sb_tc_pool_bind_get_list *rsp); 819 820 struct devlink_sb_tc_pool_bind_get_list * 821 devlink_sb_tc_pool_bind_get_dump(struct ynl_sock *ys, 822 struct devlink_sb_tc_pool_bind_get_req_dump *req); 823 824 /* ============== DEVLINK_CMD_PARAM_GET ============== */ 825 /* DEVLINK_CMD_PARAM_GET - do */ 826 struct devlink_param_get_req { 827 struct { 828 __u32 bus_name_len; 829 __u32 dev_name_len; 830 __u32 param_name_len; 831 } _present; 832 833 char *bus_name; 834 char *dev_name; 835 char *param_name; 836 }; 837 838 static inline struct devlink_param_get_req *devlink_param_get_req_alloc(void) 839 { 840 return calloc(1, sizeof(struct devlink_param_get_req)); 841 } 842 void devlink_param_get_req_free(struct devlink_param_get_req *req); 843 844 static inline void 845 devlink_param_get_req_set_bus_name(struct devlink_param_get_req *req, 846 const char *bus_name) 847 { 848 free(req->bus_name); 849 req->_present.bus_name_len = strlen(bus_name); 850 req->bus_name = malloc(req->_present.bus_name_len + 1); 851 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 852 req->bus_name[req->_present.bus_name_len] = 0; 853 } 854 static inline void 855 devlink_param_get_req_set_dev_name(struct devlink_param_get_req *req, 856 const char *dev_name) 857 { 858 free(req->dev_name); 859 req->_present.dev_name_len = strlen(dev_name); 860 req->dev_name = malloc(req->_present.dev_name_len + 1); 861 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 862 req->dev_name[req->_present.dev_name_len] = 0; 863 } 864 static inline void 865 devlink_param_get_req_set_param_name(struct devlink_param_get_req *req, 866 const char *param_name) 867 { 868 free(req->param_name); 869 req->_present.param_name_len = strlen(param_name); 870 req->param_name = malloc(req->_present.param_name_len + 1); 871 memcpy(req->param_name, param_name, req->_present.param_name_len); 872 req->param_name[req->_present.param_name_len] = 0; 873 } 874 875 struct devlink_param_get_rsp { 876 struct { 877 __u32 bus_name_len; 878 __u32 dev_name_len; 879 __u32 param_name_len; 880 } _present; 881 882 char *bus_name; 883 char *dev_name; 884 char *param_name; 885 }; 886 887 void devlink_param_get_rsp_free(struct devlink_param_get_rsp *rsp); 888 889 /* 890 * Get param instances. 891 */ 892 struct devlink_param_get_rsp * 893 devlink_param_get(struct ynl_sock *ys, struct devlink_param_get_req *req); 894 895 /* DEVLINK_CMD_PARAM_GET - dump */ 896 struct devlink_param_get_req_dump { 897 struct { 898 __u32 bus_name_len; 899 __u32 dev_name_len; 900 } _present; 901 902 char *bus_name; 903 char *dev_name; 904 }; 905 906 static inline struct devlink_param_get_req_dump * 907 devlink_param_get_req_dump_alloc(void) 908 { 909 return calloc(1, sizeof(struct devlink_param_get_req_dump)); 910 } 911 void devlink_param_get_req_dump_free(struct devlink_param_get_req_dump *req); 912 913 static inline void 914 devlink_param_get_req_dump_set_bus_name(struct devlink_param_get_req_dump *req, 915 const char *bus_name) 916 { 917 free(req->bus_name); 918 req->_present.bus_name_len = strlen(bus_name); 919 req->bus_name = malloc(req->_present.bus_name_len + 1); 920 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 921 req->bus_name[req->_present.bus_name_len] = 0; 922 } 923 static inline void 924 devlink_param_get_req_dump_set_dev_name(struct devlink_param_get_req_dump *req, 925 const char *dev_name) 926 { 927 free(req->dev_name); 928 req->_present.dev_name_len = strlen(dev_name); 929 req->dev_name = malloc(req->_present.dev_name_len + 1); 930 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 931 req->dev_name[req->_present.dev_name_len] = 0; 932 } 933 934 struct devlink_param_get_list { 935 struct devlink_param_get_list *next; 936 struct devlink_param_get_rsp obj __attribute__ ((aligned (8))); 937 }; 938 939 void devlink_param_get_list_free(struct devlink_param_get_list *rsp); 940 941 struct devlink_param_get_list * 942 devlink_param_get_dump(struct ynl_sock *ys, 943 struct devlink_param_get_req_dump *req); 944 945 /* ============== DEVLINK_CMD_REGION_GET ============== */ 946 /* DEVLINK_CMD_REGION_GET - do */ 947 struct devlink_region_get_req { 948 struct { 949 __u32 bus_name_len; 950 __u32 dev_name_len; 951 __u32 port_index:1; 952 __u32 region_name_len; 953 } _present; 954 955 char *bus_name; 956 char *dev_name; 957 __u32 port_index; 958 char *region_name; 959 }; 960 961 static inline struct devlink_region_get_req *devlink_region_get_req_alloc(void) 962 { 963 return calloc(1, sizeof(struct devlink_region_get_req)); 964 } 965 void devlink_region_get_req_free(struct devlink_region_get_req *req); 966 967 static inline void 968 devlink_region_get_req_set_bus_name(struct devlink_region_get_req *req, 969 const char *bus_name) 970 { 971 free(req->bus_name); 972 req->_present.bus_name_len = strlen(bus_name); 973 req->bus_name = malloc(req->_present.bus_name_len + 1); 974 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 975 req->bus_name[req->_present.bus_name_len] = 0; 976 } 977 static inline void 978 devlink_region_get_req_set_dev_name(struct devlink_region_get_req *req, 979 const char *dev_name) 980 { 981 free(req->dev_name); 982 req->_present.dev_name_len = strlen(dev_name); 983 req->dev_name = malloc(req->_present.dev_name_len + 1); 984 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 985 req->dev_name[req->_present.dev_name_len] = 0; 986 } 987 static inline void 988 devlink_region_get_req_set_port_index(struct devlink_region_get_req *req, 989 __u32 port_index) 990 { 991 req->_present.port_index = 1; 992 req->port_index = port_index; 993 } 994 static inline void 995 devlink_region_get_req_set_region_name(struct devlink_region_get_req *req, 996 const char *region_name) 997 { 998 free(req->region_name); 999 req->_present.region_name_len = strlen(region_name); 1000 req->region_name = malloc(req->_present.region_name_len + 1); 1001 memcpy(req->region_name, region_name, req->_present.region_name_len); 1002 req->region_name[req->_present.region_name_len] = 0; 1003 } 1004 1005 struct devlink_region_get_rsp { 1006 struct { 1007 __u32 bus_name_len; 1008 __u32 dev_name_len; 1009 __u32 port_index:1; 1010 __u32 region_name_len; 1011 } _present; 1012 1013 char *bus_name; 1014 char *dev_name; 1015 __u32 port_index; 1016 char *region_name; 1017 }; 1018 1019 void devlink_region_get_rsp_free(struct devlink_region_get_rsp *rsp); 1020 1021 /* 1022 * Get region instances. 1023 */ 1024 struct devlink_region_get_rsp * 1025 devlink_region_get(struct ynl_sock *ys, struct devlink_region_get_req *req); 1026 1027 /* DEVLINK_CMD_REGION_GET - dump */ 1028 struct devlink_region_get_req_dump { 1029 struct { 1030 __u32 bus_name_len; 1031 __u32 dev_name_len; 1032 } _present; 1033 1034 char *bus_name; 1035 char *dev_name; 1036 }; 1037 1038 static inline struct devlink_region_get_req_dump * 1039 devlink_region_get_req_dump_alloc(void) 1040 { 1041 return calloc(1, sizeof(struct devlink_region_get_req_dump)); 1042 } 1043 void devlink_region_get_req_dump_free(struct devlink_region_get_req_dump *req); 1044 1045 static inline void 1046 devlink_region_get_req_dump_set_bus_name(struct devlink_region_get_req_dump *req, 1047 const char *bus_name) 1048 { 1049 free(req->bus_name); 1050 req->_present.bus_name_len = strlen(bus_name); 1051 req->bus_name = malloc(req->_present.bus_name_len + 1); 1052 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1053 req->bus_name[req->_present.bus_name_len] = 0; 1054 } 1055 static inline void 1056 devlink_region_get_req_dump_set_dev_name(struct devlink_region_get_req_dump *req, 1057 const char *dev_name) 1058 { 1059 free(req->dev_name); 1060 req->_present.dev_name_len = strlen(dev_name); 1061 req->dev_name = malloc(req->_present.dev_name_len + 1); 1062 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1063 req->dev_name[req->_present.dev_name_len] = 0; 1064 } 1065 1066 struct devlink_region_get_list { 1067 struct devlink_region_get_list *next; 1068 struct devlink_region_get_rsp obj __attribute__ ((aligned (8))); 1069 }; 1070 1071 void devlink_region_get_list_free(struct devlink_region_get_list *rsp); 1072 1073 struct devlink_region_get_list * 1074 devlink_region_get_dump(struct ynl_sock *ys, 1075 struct devlink_region_get_req_dump *req); 1076 1077 /* ============== DEVLINK_CMD_INFO_GET ============== */ 1078 /* DEVLINK_CMD_INFO_GET - do */ 1079 struct devlink_info_get_req { 1080 struct { 1081 __u32 bus_name_len; 1082 __u32 dev_name_len; 1083 } _present; 1084 1085 char *bus_name; 1086 char *dev_name; 1087 }; 1088 1089 static inline struct devlink_info_get_req *devlink_info_get_req_alloc(void) 1090 { 1091 return calloc(1, sizeof(struct devlink_info_get_req)); 1092 } 1093 void devlink_info_get_req_free(struct devlink_info_get_req *req); 1094 1095 static inline void 1096 devlink_info_get_req_set_bus_name(struct devlink_info_get_req *req, 1097 const char *bus_name) 1098 { 1099 free(req->bus_name); 1100 req->_present.bus_name_len = strlen(bus_name); 1101 req->bus_name = malloc(req->_present.bus_name_len + 1); 1102 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1103 req->bus_name[req->_present.bus_name_len] = 0; 1104 } 1105 static inline void 1106 devlink_info_get_req_set_dev_name(struct devlink_info_get_req *req, 1107 const char *dev_name) 1108 { 1109 free(req->dev_name); 1110 req->_present.dev_name_len = strlen(dev_name); 1111 req->dev_name = malloc(req->_present.dev_name_len + 1); 1112 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1113 req->dev_name[req->_present.dev_name_len] = 0; 1114 } 1115 1116 struct devlink_info_get_rsp { 1117 struct { 1118 __u32 bus_name_len; 1119 __u32 dev_name_len; 1120 __u32 info_driver_name_len; 1121 __u32 info_serial_number_len; 1122 } _present; 1123 1124 char *bus_name; 1125 char *dev_name; 1126 char *info_driver_name; 1127 char *info_serial_number; 1128 unsigned int n_info_version_fixed; 1129 struct devlink_dl_info_version *info_version_fixed; 1130 unsigned int n_info_version_running; 1131 struct devlink_dl_info_version *info_version_running; 1132 unsigned int n_info_version_stored; 1133 struct devlink_dl_info_version *info_version_stored; 1134 }; 1135 1136 void devlink_info_get_rsp_free(struct devlink_info_get_rsp *rsp); 1137 1138 /* 1139 * Get device information, like driver name, hardware and firmware versions etc. 1140 */ 1141 struct devlink_info_get_rsp * 1142 devlink_info_get(struct ynl_sock *ys, struct devlink_info_get_req *req); 1143 1144 /* DEVLINK_CMD_INFO_GET - dump */ 1145 struct devlink_info_get_list { 1146 struct devlink_info_get_list *next; 1147 struct devlink_info_get_rsp obj __attribute__ ((aligned (8))); 1148 }; 1149 1150 void devlink_info_get_list_free(struct devlink_info_get_list *rsp); 1151 1152 struct devlink_info_get_list *devlink_info_get_dump(struct ynl_sock *ys); 1153 1154 /* ============== DEVLINK_CMD_HEALTH_REPORTER_GET ============== */ 1155 /* DEVLINK_CMD_HEALTH_REPORTER_GET - do */ 1156 struct devlink_health_reporter_get_req { 1157 struct { 1158 __u32 bus_name_len; 1159 __u32 dev_name_len; 1160 __u32 port_index:1; 1161 __u32 health_reporter_name_len; 1162 } _present; 1163 1164 char *bus_name; 1165 char *dev_name; 1166 __u32 port_index; 1167 char *health_reporter_name; 1168 }; 1169 1170 static inline struct devlink_health_reporter_get_req * 1171 devlink_health_reporter_get_req_alloc(void) 1172 { 1173 return calloc(1, sizeof(struct devlink_health_reporter_get_req)); 1174 } 1175 void 1176 devlink_health_reporter_get_req_free(struct devlink_health_reporter_get_req *req); 1177 1178 static inline void 1179 devlink_health_reporter_get_req_set_bus_name(struct devlink_health_reporter_get_req *req, 1180 const char *bus_name) 1181 { 1182 free(req->bus_name); 1183 req->_present.bus_name_len = strlen(bus_name); 1184 req->bus_name = malloc(req->_present.bus_name_len + 1); 1185 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1186 req->bus_name[req->_present.bus_name_len] = 0; 1187 } 1188 static inline void 1189 devlink_health_reporter_get_req_set_dev_name(struct devlink_health_reporter_get_req *req, 1190 const char *dev_name) 1191 { 1192 free(req->dev_name); 1193 req->_present.dev_name_len = strlen(dev_name); 1194 req->dev_name = malloc(req->_present.dev_name_len + 1); 1195 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1196 req->dev_name[req->_present.dev_name_len] = 0; 1197 } 1198 static inline void 1199 devlink_health_reporter_get_req_set_port_index(struct devlink_health_reporter_get_req *req, 1200 __u32 port_index) 1201 { 1202 req->_present.port_index = 1; 1203 req->port_index = port_index; 1204 } 1205 static inline void 1206 devlink_health_reporter_get_req_set_health_reporter_name(struct devlink_health_reporter_get_req *req, 1207 const char *health_reporter_name) 1208 { 1209 free(req->health_reporter_name); 1210 req->_present.health_reporter_name_len = strlen(health_reporter_name); 1211 req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); 1212 memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); 1213 req->health_reporter_name[req->_present.health_reporter_name_len] = 0; 1214 } 1215 1216 struct devlink_health_reporter_get_rsp { 1217 struct { 1218 __u32 bus_name_len; 1219 __u32 dev_name_len; 1220 __u32 port_index:1; 1221 __u32 health_reporter_name_len; 1222 } _present; 1223 1224 char *bus_name; 1225 char *dev_name; 1226 __u32 port_index; 1227 char *health_reporter_name; 1228 }; 1229 1230 void 1231 devlink_health_reporter_get_rsp_free(struct devlink_health_reporter_get_rsp *rsp); 1232 1233 /* 1234 * Get health reporter instances. 1235 */ 1236 struct devlink_health_reporter_get_rsp * 1237 devlink_health_reporter_get(struct ynl_sock *ys, 1238 struct devlink_health_reporter_get_req *req); 1239 1240 /* DEVLINK_CMD_HEALTH_REPORTER_GET - dump */ 1241 struct devlink_health_reporter_get_req_dump { 1242 struct { 1243 __u32 bus_name_len; 1244 __u32 dev_name_len; 1245 __u32 port_index:1; 1246 } _present; 1247 1248 char *bus_name; 1249 char *dev_name; 1250 __u32 port_index; 1251 }; 1252 1253 static inline struct devlink_health_reporter_get_req_dump * 1254 devlink_health_reporter_get_req_dump_alloc(void) 1255 { 1256 return calloc(1, sizeof(struct devlink_health_reporter_get_req_dump)); 1257 } 1258 void 1259 devlink_health_reporter_get_req_dump_free(struct devlink_health_reporter_get_req_dump *req); 1260 1261 static inline void 1262 devlink_health_reporter_get_req_dump_set_bus_name(struct devlink_health_reporter_get_req_dump *req, 1263 const char *bus_name) 1264 { 1265 free(req->bus_name); 1266 req->_present.bus_name_len = strlen(bus_name); 1267 req->bus_name = malloc(req->_present.bus_name_len + 1); 1268 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1269 req->bus_name[req->_present.bus_name_len] = 0; 1270 } 1271 static inline void 1272 devlink_health_reporter_get_req_dump_set_dev_name(struct devlink_health_reporter_get_req_dump *req, 1273 const char *dev_name) 1274 { 1275 free(req->dev_name); 1276 req->_present.dev_name_len = strlen(dev_name); 1277 req->dev_name = malloc(req->_present.dev_name_len + 1); 1278 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1279 req->dev_name[req->_present.dev_name_len] = 0; 1280 } 1281 static inline void 1282 devlink_health_reporter_get_req_dump_set_port_index(struct devlink_health_reporter_get_req_dump *req, 1283 __u32 port_index) 1284 { 1285 req->_present.port_index = 1; 1286 req->port_index = port_index; 1287 } 1288 1289 struct devlink_health_reporter_get_list { 1290 struct devlink_health_reporter_get_list *next; 1291 struct devlink_health_reporter_get_rsp obj __attribute__ ((aligned (8))); 1292 }; 1293 1294 void 1295 devlink_health_reporter_get_list_free(struct devlink_health_reporter_get_list *rsp); 1296 1297 struct devlink_health_reporter_get_list * 1298 devlink_health_reporter_get_dump(struct ynl_sock *ys, 1299 struct devlink_health_reporter_get_req_dump *req); 1300 1301 /* ============== DEVLINK_CMD_TRAP_GET ============== */ 1302 /* DEVLINK_CMD_TRAP_GET - do */ 1303 struct devlink_trap_get_req { 1304 struct { 1305 __u32 bus_name_len; 1306 __u32 dev_name_len; 1307 __u32 trap_name_len; 1308 } _present; 1309 1310 char *bus_name; 1311 char *dev_name; 1312 char *trap_name; 1313 }; 1314 1315 static inline struct devlink_trap_get_req *devlink_trap_get_req_alloc(void) 1316 { 1317 return calloc(1, sizeof(struct devlink_trap_get_req)); 1318 } 1319 void devlink_trap_get_req_free(struct devlink_trap_get_req *req); 1320 1321 static inline void 1322 devlink_trap_get_req_set_bus_name(struct devlink_trap_get_req *req, 1323 const char *bus_name) 1324 { 1325 free(req->bus_name); 1326 req->_present.bus_name_len = strlen(bus_name); 1327 req->bus_name = malloc(req->_present.bus_name_len + 1); 1328 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1329 req->bus_name[req->_present.bus_name_len] = 0; 1330 } 1331 static inline void 1332 devlink_trap_get_req_set_dev_name(struct devlink_trap_get_req *req, 1333 const char *dev_name) 1334 { 1335 free(req->dev_name); 1336 req->_present.dev_name_len = strlen(dev_name); 1337 req->dev_name = malloc(req->_present.dev_name_len + 1); 1338 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1339 req->dev_name[req->_present.dev_name_len] = 0; 1340 } 1341 static inline void 1342 devlink_trap_get_req_set_trap_name(struct devlink_trap_get_req *req, 1343 const char *trap_name) 1344 { 1345 free(req->trap_name); 1346 req->_present.trap_name_len = strlen(trap_name); 1347 req->trap_name = malloc(req->_present.trap_name_len + 1); 1348 memcpy(req->trap_name, trap_name, req->_present.trap_name_len); 1349 req->trap_name[req->_present.trap_name_len] = 0; 1350 } 1351 1352 struct devlink_trap_get_rsp { 1353 struct { 1354 __u32 bus_name_len; 1355 __u32 dev_name_len; 1356 __u32 trap_name_len; 1357 } _present; 1358 1359 char *bus_name; 1360 char *dev_name; 1361 char *trap_name; 1362 }; 1363 1364 void devlink_trap_get_rsp_free(struct devlink_trap_get_rsp *rsp); 1365 1366 /* 1367 * Get trap instances. 1368 */ 1369 struct devlink_trap_get_rsp * 1370 devlink_trap_get(struct ynl_sock *ys, struct devlink_trap_get_req *req); 1371 1372 /* DEVLINK_CMD_TRAP_GET - dump */ 1373 struct devlink_trap_get_req_dump { 1374 struct { 1375 __u32 bus_name_len; 1376 __u32 dev_name_len; 1377 } _present; 1378 1379 char *bus_name; 1380 char *dev_name; 1381 }; 1382 1383 static inline struct devlink_trap_get_req_dump * 1384 devlink_trap_get_req_dump_alloc(void) 1385 { 1386 return calloc(1, sizeof(struct devlink_trap_get_req_dump)); 1387 } 1388 void devlink_trap_get_req_dump_free(struct devlink_trap_get_req_dump *req); 1389 1390 static inline void 1391 devlink_trap_get_req_dump_set_bus_name(struct devlink_trap_get_req_dump *req, 1392 const char *bus_name) 1393 { 1394 free(req->bus_name); 1395 req->_present.bus_name_len = strlen(bus_name); 1396 req->bus_name = malloc(req->_present.bus_name_len + 1); 1397 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1398 req->bus_name[req->_present.bus_name_len] = 0; 1399 } 1400 static inline void 1401 devlink_trap_get_req_dump_set_dev_name(struct devlink_trap_get_req_dump *req, 1402 const char *dev_name) 1403 { 1404 free(req->dev_name); 1405 req->_present.dev_name_len = strlen(dev_name); 1406 req->dev_name = malloc(req->_present.dev_name_len + 1); 1407 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1408 req->dev_name[req->_present.dev_name_len] = 0; 1409 } 1410 1411 struct devlink_trap_get_list { 1412 struct devlink_trap_get_list *next; 1413 struct devlink_trap_get_rsp obj __attribute__ ((aligned (8))); 1414 }; 1415 1416 void devlink_trap_get_list_free(struct devlink_trap_get_list *rsp); 1417 1418 struct devlink_trap_get_list * 1419 devlink_trap_get_dump(struct ynl_sock *ys, 1420 struct devlink_trap_get_req_dump *req); 1421 1422 /* ============== DEVLINK_CMD_TRAP_GROUP_GET ============== */ 1423 /* DEVLINK_CMD_TRAP_GROUP_GET - do */ 1424 struct devlink_trap_group_get_req { 1425 struct { 1426 __u32 bus_name_len; 1427 __u32 dev_name_len; 1428 __u32 trap_group_name_len; 1429 } _present; 1430 1431 char *bus_name; 1432 char *dev_name; 1433 char *trap_group_name; 1434 }; 1435 1436 static inline struct devlink_trap_group_get_req * 1437 devlink_trap_group_get_req_alloc(void) 1438 { 1439 return calloc(1, sizeof(struct devlink_trap_group_get_req)); 1440 } 1441 void devlink_trap_group_get_req_free(struct devlink_trap_group_get_req *req); 1442 1443 static inline void 1444 devlink_trap_group_get_req_set_bus_name(struct devlink_trap_group_get_req *req, 1445 const char *bus_name) 1446 { 1447 free(req->bus_name); 1448 req->_present.bus_name_len = strlen(bus_name); 1449 req->bus_name = malloc(req->_present.bus_name_len + 1); 1450 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1451 req->bus_name[req->_present.bus_name_len] = 0; 1452 } 1453 static inline void 1454 devlink_trap_group_get_req_set_dev_name(struct devlink_trap_group_get_req *req, 1455 const char *dev_name) 1456 { 1457 free(req->dev_name); 1458 req->_present.dev_name_len = strlen(dev_name); 1459 req->dev_name = malloc(req->_present.dev_name_len + 1); 1460 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1461 req->dev_name[req->_present.dev_name_len] = 0; 1462 } 1463 static inline void 1464 devlink_trap_group_get_req_set_trap_group_name(struct devlink_trap_group_get_req *req, 1465 const char *trap_group_name) 1466 { 1467 free(req->trap_group_name); 1468 req->_present.trap_group_name_len = strlen(trap_group_name); 1469 req->trap_group_name = malloc(req->_present.trap_group_name_len + 1); 1470 memcpy(req->trap_group_name, trap_group_name, req->_present.trap_group_name_len); 1471 req->trap_group_name[req->_present.trap_group_name_len] = 0; 1472 } 1473 1474 struct devlink_trap_group_get_rsp { 1475 struct { 1476 __u32 bus_name_len; 1477 __u32 dev_name_len; 1478 __u32 trap_group_name_len; 1479 } _present; 1480 1481 char *bus_name; 1482 char *dev_name; 1483 char *trap_group_name; 1484 }; 1485 1486 void devlink_trap_group_get_rsp_free(struct devlink_trap_group_get_rsp *rsp); 1487 1488 /* 1489 * Get trap group instances. 1490 */ 1491 struct devlink_trap_group_get_rsp * 1492 devlink_trap_group_get(struct ynl_sock *ys, 1493 struct devlink_trap_group_get_req *req); 1494 1495 /* DEVLINK_CMD_TRAP_GROUP_GET - dump */ 1496 struct devlink_trap_group_get_req_dump { 1497 struct { 1498 __u32 bus_name_len; 1499 __u32 dev_name_len; 1500 } _present; 1501 1502 char *bus_name; 1503 char *dev_name; 1504 }; 1505 1506 static inline struct devlink_trap_group_get_req_dump * 1507 devlink_trap_group_get_req_dump_alloc(void) 1508 { 1509 return calloc(1, sizeof(struct devlink_trap_group_get_req_dump)); 1510 } 1511 void 1512 devlink_trap_group_get_req_dump_free(struct devlink_trap_group_get_req_dump *req); 1513 1514 static inline void 1515 devlink_trap_group_get_req_dump_set_bus_name(struct devlink_trap_group_get_req_dump *req, 1516 const char *bus_name) 1517 { 1518 free(req->bus_name); 1519 req->_present.bus_name_len = strlen(bus_name); 1520 req->bus_name = malloc(req->_present.bus_name_len + 1); 1521 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1522 req->bus_name[req->_present.bus_name_len] = 0; 1523 } 1524 static inline void 1525 devlink_trap_group_get_req_dump_set_dev_name(struct devlink_trap_group_get_req_dump *req, 1526 const char *dev_name) 1527 { 1528 free(req->dev_name); 1529 req->_present.dev_name_len = strlen(dev_name); 1530 req->dev_name = malloc(req->_present.dev_name_len + 1); 1531 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1532 req->dev_name[req->_present.dev_name_len] = 0; 1533 } 1534 1535 struct devlink_trap_group_get_list { 1536 struct devlink_trap_group_get_list *next; 1537 struct devlink_trap_group_get_rsp obj __attribute__ ((aligned (8))); 1538 }; 1539 1540 void devlink_trap_group_get_list_free(struct devlink_trap_group_get_list *rsp); 1541 1542 struct devlink_trap_group_get_list * 1543 devlink_trap_group_get_dump(struct ynl_sock *ys, 1544 struct devlink_trap_group_get_req_dump *req); 1545 1546 /* ============== DEVLINK_CMD_TRAP_POLICER_GET ============== */ 1547 /* DEVLINK_CMD_TRAP_POLICER_GET - do */ 1548 struct devlink_trap_policer_get_req { 1549 struct { 1550 __u32 bus_name_len; 1551 __u32 dev_name_len; 1552 __u32 trap_policer_id:1; 1553 } _present; 1554 1555 char *bus_name; 1556 char *dev_name; 1557 __u32 trap_policer_id; 1558 }; 1559 1560 static inline struct devlink_trap_policer_get_req * 1561 devlink_trap_policer_get_req_alloc(void) 1562 { 1563 return calloc(1, sizeof(struct devlink_trap_policer_get_req)); 1564 } 1565 void 1566 devlink_trap_policer_get_req_free(struct devlink_trap_policer_get_req *req); 1567 1568 static inline void 1569 devlink_trap_policer_get_req_set_bus_name(struct devlink_trap_policer_get_req *req, 1570 const char *bus_name) 1571 { 1572 free(req->bus_name); 1573 req->_present.bus_name_len = strlen(bus_name); 1574 req->bus_name = malloc(req->_present.bus_name_len + 1); 1575 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1576 req->bus_name[req->_present.bus_name_len] = 0; 1577 } 1578 static inline void 1579 devlink_trap_policer_get_req_set_dev_name(struct devlink_trap_policer_get_req *req, 1580 const char *dev_name) 1581 { 1582 free(req->dev_name); 1583 req->_present.dev_name_len = strlen(dev_name); 1584 req->dev_name = malloc(req->_present.dev_name_len + 1); 1585 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1586 req->dev_name[req->_present.dev_name_len] = 0; 1587 } 1588 static inline void 1589 devlink_trap_policer_get_req_set_trap_policer_id(struct devlink_trap_policer_get_req *req, 1590 __u32 trap_policer_id) 1591 { 1592 req->_present.trap_policer_id = 1; 1593 req->trap_policer_id = trap_policer_id; 1594 } 1595 1596 struct devlink_trap_policer_get_rsp { 1597 struct { 1598 __u32 bus_name_len; 1599 __u32 dev_name_len; 1600 __u32 trap_policer_id:1; 1601 } _present; 1602 1603 char *bus_name; 1604 char *dev_name; 1605 __u32 trap_policer_id; 1606 }; 1607 1608 void 1609 devlink_trap_policer_get_rsp_free(struct devlink_trap_policer_get_rsp *rsp); 1610 1611 /* 1612 * Get trap policer instances. 1613 */ 1614 struct devlink_trap_policer_get_rsp * 1615 devlink_trap_policer_get(struct ynl_sock *ys, 1616 struct devlink_trap_policer_get_req *req); 1617 1618 /* DEVLINK_CMD_TRAP_POLICER_GET - dump */ 1619 struct devlink_trap_policer_get_req_dump { 1620 struct { 1621 __u32 bus_name_len; 1622 __u32 dev_name_len; 1623 } _present; 1624 1625 char *bus_name; 1626 char *dev_name; 1627 }; 1628 1629 static inline struct devlink_trap_policer_get_req_dump * 1630 devlink_trap_policer_get_req_dump_alloc(void) 1631 { 1632 return calloc(1, sizeof(struct devlink_trap_policer_get_req_dump)); 1633 } 1634 void 1635 devlink_trap_policer_get_req_dump_free(struct devlink_trap_policer_get_req_dump *req); 1636 1637 static inline void 1638 devlink_trap_policer_get_req_dump_set_bus_name(struct devlink_trap_policer_get_req_dump *req, 1639 const char *bus_name) 1640 { 1641 free(req->bus_name); 1642 req->_present.bus_name_len = strlen(bus_name); 1643 req->bus_name = malloc(req->_present.bus_name_len + 1); 1644 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1645 req->bus_name[req->_present.bus_name_len] = 0; 1646 } 1647 static inline void 1648 devlink_trap_policer_get_req_dump_set_dev_name(struct devlink_trap_policer_get_req_dump *req, 1649 const char *dev_name) 1650 { 1651 free(req->dev_name); 1652 req->_present.dev_name_len = strlen(dev_name); 1653 req->dev_name = malloc(req->_present.dev_name_len + 1); 1654 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1655 req->dev_name[req->_present.dev_name_len] = 0; 1656 } 1657 1658 struct devlink_trap_policer_get_list { 1659 struct devlink_trap_policer_get_list *next; 1660 struct devlink_trap_policer_get_rsp obj __attribute__ ((aligned (8))); 1661 }; 1662 1663 void 1664 devlink_trap_policer_get_list_free(struct devlink_trap_policer_get_list *rsp); 1665 1666 struct devlink_trap_policer_get_list * 1667 devlink_trap_policer_get_dump(struct ynl_sock *ys, 1668 struct devlink_trap_policer_get_req_dump *req); 1669 1670 /* ============== DEVLINK_CMD_RATE_GET ============== */ 1671 /* DEVLINK_CMD_RATE_GET - do */ 1672 struct devlink_rate_get_req { 1673 struct { 1674 __u32 bus_name_len; 1675 __u32 dev_name_len; 1676 __u32 port_index:1; 1677 __u32 rate_node_name_len; 1678 } _present; 1679 1680 char *bus_name; 1681 char *dev_name; 1682 __u32 port_index; 1683 char *rate_node_name; 1684 }; 1685 1686 static inline struct devlink_rate_get_req *devlink_rate_get_req_alloc(void) 1687 { 1688 return calloc(1, sizeof(struct devlink_rate_get_req)); 1689 } 1690 void devlink_rate_get_req_free(struct devlink_rate_get_req *req); 1691 1692 static inline void 1693 devlink_rate_get_req_set_bus_name(struct devlink_rate_get_req *req, 1694 const char *bus_name) 1695 { 1696 free(req->bus_name); 1697 req->_present.bus_name_len = strlen(bus_name); 1698 req->bus_name = malloc(req->_present.bus_name_len + 1); 1699 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1700 req->bus_name[req->_present.bus_name_len] = 0; 1701 } 1702 static inline void 1703 devlink_rate_get_req_set_dev_name(struct devlink_rate_get_req *req, 1704 const char *dev_name) 1705 { 1706 free(req->dev_name); 1707 req->_present.dev_name_len = strlen(dev_name); 1708 req->dev_name = malloc(req->_present.dev_name_len + 1); 1709 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1710 req->dev_name[req->_present.dev_name_len] = 0; 1711 } 1712 static inline void 1713 devlink_rate_get_req_set_port_index(struct devlink_rate_get_req *req, 1714 __u32 port_index) 1715 { 1716 req->_present.port_index = 1; 1717 req->port_index = port_index; 1718 } 1719 static inline void 1720 devlink_rate_get_req_set_rate_node_name(struct devlink_rate_get_req *req, 1721 const char *rate_node_name) 1722 { 1723 free(req->rate_node_name); 1724 req->_present.rate_node_name_len = strlen(rate_node_name); 1725 req->rate_node_name = malloc(req->_present.rate_node_name_len + 1); 1726 memcpy(req->rate_node_name, rate_node_name, req->_present.rate_node_name_len); 1727 req->rate_node_name[req->_present.rate_node_name_len] = 0; 1728 } 1729 1730 struct devlink_rate_get_rsp { 1731 struct { 1732 __u32 bus_name_len; 1733 __u32 dev_name_len; 1734 __u32 port_index:1; 1735 __u32 rate_node_name_len; 1736 } _present; 1737 1738 char *bus_name; 1739 char *dev_name; 1740 __u32 port_index; 1741 char *rate_node_name; 1742 }; 1743 1744 void devlink_rate_get_rsp_free(struct devlink_rate_get_rsp *rsp); 1745 1746 /* 1747 * Get rate instances. 1748 */ 1749 struct devlink_rate_get_rsp * 1750 devlink_rate_get(struct ynl_sock *ys, struct devlink_rate_get_req *req); 1751 1752 /* DEVLINK_CMD_RATE_GET - dump */ 1753 struct devlink_rate_get_req_dump { 1754 struct { 1755 __u32 bus_name_len; 1756 __u32 dev_name_len; 1757 } _present; 1758 1759 char *bus_name; 1760 char *dev_name; 1761 }; 1762 1763 static inline struct devlink_rate_get_req_dump * 1764 devlink_rate_get_req_dump_alloc(void) 1765 { 1766 return calloc(1, sizeof(struct devlink_rate_get_req_dump)); 1767 } 1768 void devlink_rate_get_req_dump_free(struct devlink_rate_get_req_dump *req); 1769 1770 static inline void 1771 devlink_rate_get_req_dump_set_bus_name(struct devlink_rate_get_req_dump *req, 1772 const char *bus_name) 1773 { 1774 free(req->bus_name); 1775 req->_present.bus_name_len = strlen(bus_name); 1776 req->bus_name = malloc(req->_present.bus_name_len + 1); 1777 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1778 req->bus_name[req->_present.bus_name_len] = 0; 1779 } 1780 static inline void 1781 devlink_rate_get_req_dump_set_dev_name(struct devlink_rate_get_req_dump *req, 1782 const char *dev_name) 1783 { 1784 free(req->dev_name); 1785 req->_present.dev_name_len = strlen(dev_name); 1786 req->dev_name = malloc(req->_present.dev_name_len + 1); 1787 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1788 req->dev_name[req->_present.dev_name_len] = 0; 1789 } 1790 1791 struct devlink_rate_get_list { 1792 struct devlink_rate_get_list *next; 1793 struct devlink_rate_get_rsp obj __attribute__ ((aligned (8))); 1794 }; 1795 1796 void devlink_rate_get_list_free(struct devlink_rate_get_list *rsp); 1797 1798 struct devlink_rate_get_list * 1799 devlink_rate_get_dump(struct ynl_sock *ys, 1800 struct devlink_rate_get_req_dump *req); 1801 1802 /* ============== DEVLINK_CMD_LINECARD_GET ============== */ 1803 /* DEVLINK_CMD_LINECARD_GET - do */ 1804 struct devlink_linecard_get_req { 1805 struct { 1806 __u32 bus_name_len; 1807 __u32 dev_name_len; 1808 __u32 linecard_index:1; 1809 } _present; 1810 1811 char *bus_name; 1812 char *dev_name; 1813 __u32 linecard_index; 1814 }; 1815 1816 static inline struct devlink_linecard_get_req * 1817 devlink_linecard_get_req_alloc(void) 1818 { 1819 return calloc(1, sizeof(struct devlink_linecard_get_req)); 1820 } 1821 void devlink_linecard_get_req_free(struct devlink_linecard_get_req *req); 1822 1823 static inline void 1824 devlink_linecard_get_req_set_bus_name(struct devlink_linecard_get_req *req, 1825 const char *bus_name) 1826 { 1827 free(req->bus_name); 1828 req->_present.bus_name_len = strlen(bus_name); 1829 req->bus_name = malloc(req->_present.bus_name_len + 1); 1830 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1831 req->bus_name[req->_present.bus_name_len] = 0; 1832 } 1833 static inline void 1834 devlink_linecard_get_req_set_dev_name(struct devlink_linecard_get_req *req, 1835 const char *dev_name) 1836 { 1837 free(req->dev_name); 1838 req->_present.dev_name_len = strlen(dev_name); 1839 req->dev_name = malloc(req->_present.dev_name_len + 1); 1840 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1841 req->dev_name[req->_present.dev_name_len] = 0; 1842 } 1843 static inline void 1844 devlink_linecard_get_req_set_linecard_index(struct devlink_linecard_get_req *req, 1845 __u32 linecard_index) 1846 { 1847 req->_present.linecard_index = 1; 1848 req->linecard_index = linecard_index; 1849 } 1850 1851 struct devlink_linecard_get_rsp { 1852 struct { 1853 __u32 bus_name_len; 1854 __u32 dev_name_len; 1855 __u32 linecard_index:1; 1856 } _present; 1857 1858 char *bus_name; 1859 char *dev_name; 1860 __u32 linecard_index; 1861 }; 1862 1863 void devlink_linecard_get_rsp_free(struct devlink_linecard_get_rsp *rsp); 1864 1865 /* 1866 * Get line card instances. 1867 */ 1868 struct devlink_linecard_get_rsp * 1869 devlink_linecard_get(struct ynl_sock *ys, struct devlink_linecard_get_req *req); 1870 1871 /* DEVLINK_CMD_LINECARD_GET - dump */ 1872 struct devlink_linecard_get_req_dump { 1873 struct { 1874 __u32 bus_name_len; 1875 __u32 dev_name_len; 1876 } _present; 1877 1878 char *bus_name; 1879 char *dev_name; 1880 }; 1881 1882 static inline struct devlink_linecard_get_req_dump * 1883 devlink_linecard_get_req_dump_alloc(void) 1884 { 1885 return calloc(1, sizeof(struct devlink_linecard_get_req_dump)); 1886 } 1887 void 1888 devlink_linecard_get_req_dump_free(struct devlink_linecard_get_req_dump *req); 1889 1890 static inline void 1891 devlink_linecard_get_req_dump_set_bus_name(struct devlink_linecard_get_req_dump *req, 1892 const char *bus_name) 1893 { 1894 free(req->bus_name); 1895 req->_present.bus_name_len = strlen(bus_name); 1896 req->bus_name = malloc(req->_present.bus_name_len + 1); 1897 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1898 req->bus_name[req->_present.bus_name_len] = 0; 1899 } 1900 static inline void 1901 devlink_linecard_get_req_dump_set_dev_name(struct devlink_linecard_get_req_dump *req, 1902 const char *dev_name) 1903 { 1904 free(req->dev_name); 1905 req->_present.dev_name_len = strlen(dev_name); 1906 req->dev_name = malloc(req->_present.dev_name_len + 1); 1907 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1908 req->dev_name[req->_present.dev_name_len] = 0; 1909 } 1910 1911 struct devlink_linecard_get_list { 1912 struct devlink_linecard_get_list *next; 1913 struct devlink_linecard_get_rsp obj __attribute__ ((aligned (8))); 1914 }; 1915 1916 void devlink_linecard_get_list_free(struct devlink_linecard_get_list *rsp); 1917 1918 struct devlink_linecard_get_list * 1919 devlink_linecard_get_dump(struct ynl_sock *ys, 1920 struct devlink_linecard_get_req_dump *req); 1921 1922 /* ============== DEVLINK_CMD_SELFTESTS_GET ============== */ 1923 /* DEVLINK_CMD_SELFTESTS_GET - do */ 1924 struct devlink_selftests_get_req { 1925 struct { 1926 __u32 bus_name_len; 1927 __u32 dev_name_len; 1928 } _present; 1929 1930 char *bus_name; 1931 char *dev_name; 1932 }; 1933 1934 static inline struct devlink_selftests_get_req * 1935 devlink_selftests_get_req_alloc(void) 1936 { 1937 return calloc(1, sizeof(struct devlink_selftests_get_req)); 1938 } 1939 void devlink_selftests_get_req_free(struct devlink_selftests_get_req *req); 1940 1941 static inline void 1942 devlink_selftests_get_req_set_bus_name(struct devlink_selftests_get_req *req, 1943 const char *bus_name) 1944 { 1945 free(req->bus_name); 1946 req->_present.bus_name_len = strlen(bus_name); 1947 req->bus_name = malloc(req->_present.bus_name_len + 1); 1948 memcpy(req->bus_name, bus_name, req->_present.bus_name_len); 1949 req->bus_name[req->_present.bus_name_len] = 0; 1950 } 1951 static inline void 1952 devlink_selftests_get_req_set_dev_name(struct devlink_selftests_get_req *req, 1953 const char *dev_name) 1954 { 1955 free(req->dev_name); 1956 req->_present.dev_name_len = strlen(dev_name); 1957 req->dev_name = malloc(req->_present.dev_name_len + 1); 1958 memcpy(req->dev_name, dev_name, req->_present.dev_name_len); 1959 req->dev_name[req->_present.dev_name_len] = 0; 1960 } 1961 1962 struct devlink_selftests_get_rsp { 1963 struct { 1964 __u32 bus_name_len; 1965 __u32 dev_name_len; 1966 } _present; 1967 1968 char *bus_name; 1969 char *dev_name; 1970 }; 1971 1972 void devlink_selftests_get_rsp_free(struct devlink_selftests_get_rsp *rsp); 1973 1974 /* 1975 * Get device selftest instances. 1976 */ 1977 struct devlink_selftests_get_rsp * 1978 devlink_selftests_get(struct ynl_sock *ys, 1979 struct devlink_selftests_get_req *req); 1980 1981 /* DEVLINK_CMD_SELFTESTS_GET - dump */ 1982 struct devlink_selftests_get_list { 1983 struct devlink_selftests_get_list *next; 1984 struct devlink_selftests_get_rsp obj __attribute__ ((aligned (8))); 1985 }; 1986 1987 void devlink_selftests_get_list_free(struct devlink_selftests_get_list *rsp); 1988 1989 struct devlink_selftests_get_list * 1990 devlink_selftests_get_dump(struct ynl_sock *ys); 1991 1992 #endif /* _LINUX_DEVLINK_GEN_H */ 1993