In order to be able to configure all needed stuff on a port/netdevice of a line card without the line card being present, introduce line card provisioning. Basically by setting a type, provisioning process will start and driver is supposed to create a placeholder for instances (ports/netdevices) for a line card type. Allow the user to query the supported line card types over line card get command. Then implement two netlink command SET to allow user to set/unset the card type. On the driver API side, add provision/unprovision ops and supported types array to be advertised. Upon provision op call, the driver should take care of creating the instances for the particular line card type. Introduce provision_set/clear() functions to be called by the driver once the provisioning/unprovisioning is done on its side. These helpers are not to be called directly due to the async nature of provisioning. Example: $ devlink port # No ports are listed $ devlink lc pci/0000:01:00.0: lc 1 state unprovisioned supported_types: 16x100G lc 2 state unprovisioned supported_types: 16x100G lc 3 state unprovisioned supported_types: 16x100G lc 4 state unprovisioned supported_types: 16x100G lc 5 state unprovisioned supported_types: 16x100G lc 6 state unprovisioned supported_types: 16x100G lc 7 state unprovisioned supported_types: 16x100G lc 8 state unprovisioned supported_types: 16x100G $ devlink lc set pci/0000:01:00.0 lc 8 type 16x100G $ devlink lc show pci/0000:01:00.0 lc 8 pci/0000:01:00.0: lc 8 state active type 16x100G supported_types: 16x100G $ devlink port pci/0000:01:00.0/0: type notset flavour cpu port 0 splittable false pci/0000:01:00.0/53: type eth netdev enp1s0nl8p1 flavour physical lc 8 port 1 splittable true lanes 4 pci/0000:01:00.0/54: type eth netdev enp1s0nl8p2 flavour physical lc 8 port 2 splittable true lanes 4 pci/0000:01:00.0/55: type eth netdev enp1s0nl8p3 flavour physical lc 8 port 3 splittable true lanes 4 pci/0000:01:00.0/56: type eth netdev enp1s0nl8p4 flavour physical lc 8 port 4 splittable true lanes 4 pci/0000:01:00.0/57: type eth netdev enp1s0nl8p5 flavour physical lc 8 port 5 splittable true lanes 4 pci/0000:01:00.0/58: type eth netdev enp1s0nl8p6 flavour physical lc 8 port 6 splittable true lanes 4 pci/0000:01:00.0/59: type eth netdev enp1s0nl8p7 flavour physical lc 8 port 7 splittable true lanes 4 pci/0000:01:00.0/60: type eth netdev enp1s0nl8p8 flavour physical lc 8 port 8 splittable true lanes 4 pci/0000:01:00.0/61: type eth netdev enp1s0nl8p9 flavour physical lc 8 port 9 splittable true lanes 4 pci/0000:01:00.0/62: type eth netdev enp1s0nl8p10 flavour physical lc 8 port 10 splittable true lanes 4 pci/0000:01:00.0/63: type eth netdev enp1s0nl8p11 flavour physical lc 8 port 11 splittable true lanes 4 pci/0000:01:00.0/64: type eth netdev enp1s0nl8p12 flavour physical lc 8 port 12 splittable true lanes 4 pci/0000:01:00.0/125: type eth netdev enp1s0nl8p13 flavour physical lc 8 port 13 splittable true lanes 4 pci/0000:01:00.0/126: type eth netdev enp1s0nl8p14 flavour physical lc 8 port 14 splittable true lanes 4 pci/0000:01:00.0/127: type eth netdev enp1s0nl8p15 flavour physical lc 8 port 15 splittable true lanes 4 pci/0000:01:00.0/128: type eth netdev enp1s0nl8p16 flavour physical lc 8 port 16 splittable true lanes 4 $ devlink lc set pci/0000:01:00.0 lc 8 notype
Showing the changes to include/uapi/linux/devlink.h (1 of 5 files). Show all
Unified · Split
| @@ -343,6 +343,18 @@ enum devlink_reload_limit { · 342 unmodified lines | |||
| 343 | 343 | ||
| 344 | #define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1) | 344 | #define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1) |
| 345 | 345 | ||
| 346 | enum devlink_linecard_state { | ||
| 347 | DEVLINK_LINECARD_STATE_UNSPEC, | ||
| 348 | DEVLINK_LINECARD_STATE_UNPROVISIONED, | ||
| 349 | DEVLINK_LINECARD_STATE_UNPROVISIONING, | ||
| 350 | DEVLINK_LINECARD_STATE_PROVISIONING, | ||
| 351 | DEVLINK_LINECARD_STATE_PROVISIONING_FAILED, | ||
| 352 | DEVLINK_LINECARD_STATE_PROVISIONED, | ||
| 353 | |||
| 354 | __DEVLINK_LINECARD_STATE_MAX, | ||
| 355 | DEVLINK_LINECARD_STATE_MAX = __DEVLINK_LINECARD_STATE_MAX - 1 | ||
| 356 | }; | ||
| 357 | |||
| 346 | enum devlink_attr { | 358 | enum devlink_attr { |
| 347 | /* don't change the order or add anything between, this is ABI! */ | 359 | /* don't change the order or add anything between, this is ABI! */ |
| 348 | DEVLINK_ATTR_UNSPEC, | 360 | DEVLINK_ATTR_UNSPEC, |
| @@ -559,6 +571,9 @@ enum devlink_attr { · 210 unmodified lines | |||
| 559 | DEVLINK_ATTR_REGION_MAX_SNAPSHOTS, /* u32 */ | 571 | DEVLINK_ATTR_REGION_MAX_SNAPSHOTS, /* u32 */ |
| 560 | 572 | ||
| 561 | DEVLINK_ATTR_LINECARD_INDEX, /* u32 */ | 573 | DEVLINK_ATTR_LINECARD_INDEX, /* u32 */ |
| 574 | DEVLINK_ATTR_LINECARD_STATE, /* u8 */ | ||
| 575 | DEVLINK_ATTR_LINECARD_TYPE, /* string */ | ||
| 576 | DEVLINK_ATTR_LINECARD_SUPPORTED_TYPES, /* nested */ | ||
| 562 | 577 | ||
| 563 | /* add new attributes above here, update the policy in devlink.c */ | 578 | /* add new attributes above here, update the policy in devlink.c */ |
| 564 | 579 | ||