|
4 | 4 |
|
5 | 5 | //! Types for messages sent from MGS to SPs.
|
6 | 6 |
|
7 |
| -use crate::ereport; |
8 | 7 | use crate::ignition::TransceiverSelect;
|
9 | 8 | use crate::BadRequestReason;
|
10 | 9 | use crate::PowerState;
|
@@ -437,117 +436,3 @@ pub enum DumpRequest {
|
437 | 436 | key: [u8; 16],
|
438 | 437 | },
|
439 | 438 | }
|
440 |
| - |
441 |
| -/// A versioned request for ereports aggregated by the SP's snitch task. |
442 |
| -/// |
443 |
| -/// See [RFD 545 §4.4.3.1] for details. |
444 |
| -/// [RFD 545 §4.4.3.1]: https://rfd.shared.oxide.computer/rfd/0545#_requestcommit |
445 |
| -#[derive( |
446 |
| - Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, SerializedSize, |
447 |
| -)] |
448 |
| -pub enum EreportRequest { |
449 |
| - // /!\ ORDER MATTERS /!\ |
450 |
| - V0(EreportRequestV0), |
451 |
| -} |
452 |
| - |
453 |
| -/// A request for ereports aggregated by the SP's snitch task, version 0. |
454 |
| -/// |
455 |
| -/// ```text |
456 |
| -/// 0 1 2 3 |
457 |
| -/// +--------+--------+--------+--------+ |
458 |
| -/// | version|-------C| unused | |
459 |
| -/// +--------+--------+--------+--------+ |
460 |
| -/// | | |
461 |
| -/// + + |
462 |
| -/// | | |
463 |
| -/// + restart ID (128 bits) + |
464 |
| -/// | | |
465 |
| -/// + + |
466 |
| -/// | | |
467 |
| -/// +--------+--------+--------+--------+ |
468 |
| -/// | | |
469 |
| -/// + first ENA desired in response + |
470 |
| -/// | | |
471 |
| -/// +--------+--------+--------+--------+ |
472 |
| -/// | | |
473 |
| -/// + last ENA written to database + only present when C bit set |
474 |
| -/// | | |
475 |
| -/// +--------+--------+--------+--------+ |
476 |
| -/// ``` |
477 |
| -/// |
478 |
| -/// See [RFD 545 §4.4.3.1] for details. |
479 |
| -/// [RFD 545 §4.4.3.1]: https://rfd.shared.oxide.computer/rfd/0545#_requestcommit |
480 |
| -#[derive( |
481 |
| - Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, SerializedSize, |
482 |
| -)] |
483 |
| -pub struct EreportRequestV0 { |
484 |
| - pub flags: EreportRequestFlags, |
485 |
| - |
486 |
| - /// Currently unused as of this protocol version. |
487 |
| - _reserved: [u8; 2], |
488 |
| - |
489 |
| - /// The restart ID of the SP's snitch task which the control plane believes |
490 |
| - /// is current. |
491 |
| - /// |
492 |
| - /// If this value does not match the reporter's current restart ID, the |
493 |
| - /// reporter's response will include the current restart ID, and will start |
494 |
| - /// at the earliest known ENA, rather than the provided `start_ena`. |
495 |
| - /// |
496 |
| - /// If the control plane does not know the SP's restart ID, this will be 0. IDs |
497 |
| - /// generated by the snitch task on startup must not be 0. |
498 |
| - pub restart_id: ereport::RestartId, |
499 |
| - |
500 |
| - /// If present, the snitch should not include ENAs earlier than this one |
501 |
| - /// in its response, provided that the requested reporter generation matches |
502 |
| - /// the current generation. |
503 |
| - pub start_ena: ereport::Ena, |
504 |
| - |
505 |
| - /// The ENA of the last ereport committed to persistent storage from the |
506 |
| - /// requested reporter restart. |
507 |
| - /// |
508 |
| - /// If the restart ID parameter matches the reporter's current restart, |
509 |
| - /// it is permitted to discard any ereports with ENAs up to and including |
510 |
| - /// this value. If the restart ID has changed from the provided one, the |
511 |
| - /// reporter will not discard data. |
512 |
| - /// |
513 |
| - /// This value is only present if the [`EreportRequestFlags::COMMIT`] bit is |
514 |
| - /// set. |
515 |
| - pub committed_ena: ereport::Ena, |
516 |
| -} |
517 |
| - |
518 |
| -/// Flags for [`EreportRequest`] packets. |
519 |
| -#[derive( |
520 |
| - Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, SerializedSize, |
521 |
| -)] |
522 |
| -#[repr(transparent)] |
523 |
| -pub struct EreportRequestFlags(u8); |
524 |
| - |
525 |
| -bitflags::bitflags! { |
526 |
| - impl EreportRequestFlags: u8 { |
527 |
| - /// Indicates that a "committed ENA" field is present in this request. |
528 |
| - /// |
529 |
| - /// If this is not set, the "committed ENA" field will be zero, but this |
530 |
| - /// does not indicate that ENA 0 has been committed. |
531 |
| - const COMMIT = 1 << 0; |
532 |
| - } |
533 |
| -} |
534 |
| - |
535 |
| -impl EreportRequestV0 { |
536 |
| - pub const fn new( |
537 |
| - restart_id: ereport::RestartId, |
538 |
| - start_ena: ereport::Ena, |
539 |
| - committed_ena: Option<ereport::Ena>, |
540 |
| - ) -> Self { |
541 |
| - let (committed_ena, flags) = match committed_ena { |
542 |
| - Some(ena) => (ena, EreportRequestFlags::COMMIT), |
543 |
| - None => (ereport::Ena(0), EreportRequestFlags::empty()), |
544 |
| - }; |
545 |
| - Self { |
546 |
| - flags, |
547 |
| - _reserved: [0u8; 2], |
548 |
| - restart_id, |
549 |
| - start_ena, |
550 |
| - committed_ena, |
551 |
| - } |
552 |
| - } |
553 |
| -} |
0 commit comments