barefootnetworks / Open-Tofino

Other
314 stars 66 forks source link

Can global registers be implemented? #17

Closed ghost closed 2 years ago

ghost commented 2 years ago

I want to make _deqqdepth (from _egress_intrinsic_metadatat) available in the SwitchIngress. So I try to declare a global Register, and the same register will be used by RegisterAction defined in SwitchIngress and SwitchEgress. In this way, the data can be shared between SwitchIngress and SwitchEgress.

The p4 code looks like:

Register<T, I>(size, initial_value) global_reg;

control SwitchIngress(...) {
    RegisterAction<T, I, U>(global_reg) global_reg_action1 = {...};

    apply {
        ...;
        global_reg_action1.execute(idx);
    }
}

control SwitchEgress(...) {
    RegisterAction<T, I, U>(global_reg) global_reg_action2= {...};

    apply {
        ...;
        global_reg_action2.execute(idx);
    }
}

However, it seems like impossible to implement.

I wonder if there is any approach to achieve this "global register"? Thanks a lot.

vgurevich commented 2 years ago

@zhma989, The main purpose of this repository is to publish the interfaces, which, in turn, makes it possible for everyone to publish their code.

For actual development questions, please use Intel Premier Support (if you are a commercial customer) or Intel Connectivity Research Program Forum (if you represent an academic or a research organization)

Also, please note that posting screenshots, logs, etc. produced by the tools violates the NDA. Please, be careful next time.