You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TdiTableManager supports the PacketModMeter and DirectPacketModMeter P4Externs, which are ES2K-specific. To support them, TableManager #includes idpf/p4info.pb.h, which is only available in the ipdk-io/p4runtime-dev repository.
This is undesirable, since it couples the DPDK and Tofino platforms to a version of P4Runtime that has been customized for ES2K.
Expected behavior
TdiTableManager should provide for target-specific handling of P4 resources, incorporated as part of the build.
Proposed solution
This is somewhat kludgy, but it changes less code and is easier to review than the more general solution, which is described in issue #304.
Define a generic base class (TdiTableAnnex) and a subclass for each target that requires one (Es2kTableAnnex).
Modify each site in TdiTableManager that performs target-specific processing to support a P4Extern, and add a method to the TableAnnex classes.
Move the ES2K-specific code from TdiTableManager to the corresponding method in Es2kTableAnnex, and replace the original with a call to the method.
Add a method toTdiTargetFactory that creates a TableAnnex class of the correct type.
This will allow us to isolate the ES2K-specific code and prevent it from being included by the other targets.
Sample code
With this approach, the following code fragment:
if (resource_type=="DirectPacketModMeter"&&table_entry.has_meter_config()) {
boolunits_in_packets; // or bytesASSIGN_OR_RETURN(
autometer,
tdi_extern_manager_->FindDirectPktModMeterByID(resource_id));
RETURN_IF_ERROR(GetMeterUnitsInPackets(meter, units_in_packets));
TdiPktModMeterConfigconfig;
config.SetTableEntry(table_entry);
config.isPktModMeter=units_in_packets;
RETURN_IF_ERROR(table_data->SetPktModMeterConfig(config));
}
becomes this:
if (resource_type=="DirectPacketModMeter") {
RETURN_IF_ERROR(tdi_table_annex_->BuildDirPktModTableData(
table_entry, table_data, resource_id));
}
Class model
The text was updated successfully, but these errors were encountered:
Synopsis
TdiTableManager
supports thePacketModMeter
andDirectPacketModMeter
P4Externs, which are ES2K-specific. To support them, TableManager #includesidpf/p4info.pb.h
, which is only available in theipdk-io/p4runtime-dev
repository.This is undesirable, since it couples the DPDK and Tofino platforms to a version of P4Runtime that has been customized for ES2K.
Expected behavior
TdiTableManager
should provide for target-specific handling of P4 resources, incorporated as part of the build.Proposed solution
This is somewhat kludgy, but it changes less code and is easier to review than the more general solution, which is described in issue #304.
TdiTableAnnex
) and a subclass for each target that requires one (Es2kTableAnnex
).TdiTableManager
that performs target-specific processing to support a P4Extern, and add a method to the TableAnnex classes.TdiTableManager
to the corresponding method inEs2kTableAnnex
, and replace the original with a call to the method.TdiTargetFactory
that creates a TableAnnex class of the correct type.Sample code
With this approach, the following code fragment:
becomes this:
Class model
The text was updated successfully, but these errors were encountered: