Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#4614] Unconditionally copy dpdk p4include files to the binary directory #4615

Merged
merged 13 commits into from
Apr 18, 2024
Merged
  •  
  •  
  •  
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -539,18 +539,13 @@ add_custom_target(update_includes ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/*.p4 ${P4C_BINARY_DIR}/p4include
COMMAND ${CMAKE_COMMAND} -E make_directory ${P4C_BINARY_DIR}/p4include/bmv2
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/bmv2/psa.p4 ${P4C_BINARY_DIR}/p4include/bmv2
COMMAND ${CMAKE_COMMAND} -E make_directory ${P4C_BINARY_DIR}/p4include/dpdk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a TODO pointing to #4614 that we should clean this up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By "clean this up," do you mean changing the tests' <pna.p4> includes to either <bmv2/pna.p4> or <dpdk/pna.p4>? Or do you mean that check-p4 should not run these dpdk or bmv2 tests at all?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both cases will end up being the result of resolving #4614. We can also put the TODO as deciding whether to fully disable these tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any downside to running them under check-p4? My understanding now is that for all of the bmv2 and dpdk tests, check-p4 is just checking the frontend-generated and midend-generated IR and/or diagnostics, so they would still be useful to run. However if we are checking what is generated by e.g. the dpdk pna backend, then it wouldn't make sense to run the dpdk pna tests under check-p4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it definitely makes sense to at least make the includes more verbose. I can try doing that in this PR later.

COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/dpdk/psa.p4 ${P4C_BINARY_DIR}/p4include/dpdk
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/dpdk/pna.p4 ${P4C_BINARY_DIR}/p4include/dpdk
COMMAND for h in ${OTHER_HEADERS} \; do
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/\$$h ${P4C_BINARY_DIR}/p4include \;
done
)
if (ENABLE_DPDK)
add_custom_target(dpdk_includes ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${P4C_BINARY_DIR}/p4include/dpdk
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/dpdk/psa.p4 ${P4C_BINARY_DIR}/p4include/dpdk
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/dpdk/pna.p4 ${P4C_BINARY_DIR}/p4include/dpdk
DEPENDS update_includes
)
endif()

# Installation
# Targets install themselves. Here we install the core headers
Expand Down
3 changes: 3 additions & 0 deletions backends/dpdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ set(DPDK_PTF_DRIVER "${CMAKE_CURRENT_SOURCE_DIR}/run-dpdk-ptf-test.py")
set(DPDK_COMPILER_DRIVER "${CMAKE_CURRENT_SOURCE_DIR}/run-dpdk-test.py")

set (P4_16_SUITES
# TODO (issue #4614): Consider moving dpdk pna and psa tests to their own
# subdirectories (e.g. p4_16_psa_samples/), similar to what is done for the
# dpdk/psa/pna errors tests.
"${P4C_SOURCE_DIR}/testdata/p4_16_samples/psa-*.p4"
"${P4C_SOURCE_DIR}/testdata/p4_16_samples/pna-*.p4"
"${P4C_SOURCE_DIR}/testdata/p4_16_psa_errors/*.p4"
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-add-on-miss-err1.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-dpdk-large-constants.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
typedef bit<32> IPv4Address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <dpdk/pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-example-ipsec-err1.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>


#define inbound(meta) (istd.direction == PNA_Direction_t.NET_TO_HOST)
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-example-ipsec-err2.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>


#define inbound(meta) (istd.direction == PNA_Direction_t.NET_TO_HOST)
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-example-ipsec-err3.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>


#define inbound(meta) (istd.direction == PNA_Direction_t.NET_TO_HOST)
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/pna-example-ipsec-err4.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>


#define inbound(meta) (istd.direction == PNA_Direction_t.NET_TO_HOST)
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/psa-dpdk-lpm-match-err1.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/psa-dpdk-lpm-match-err2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_dpdk_errors/psa-dpdk-struct-field.p4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- P4_16 -*- */
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>

/************ H E A D E R S ******************************/
struct EMPTY {};
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_errors/psa-meter2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <bmv2/psa.p4>

struct EMPTY { };

Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-add-on-miss-err.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-counter-err-1.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-counter-err-3.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 14;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-counter-err-4.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-meter-err-2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 14;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-dpdk-direct-meter-err-4.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-example-addhit.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>

const MirrorSlotId_t MIRROR_SLOT_ID = (MirrorSlotId_t) 3;

Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_pna_errors/pna-example-miss.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


// Very simple PNA program intended to demonstrate one use of an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


// Very simple PNA program intended to demonstrate one use of an
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_psa_errors/psa-counter6.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>

struct EMPTY { };

Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/fwd-bmv2-psa.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <bmv2/psa.p4>

typedef bit<48> EthernetAddress;
header ethernet_t {
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/internet_checksum1-bmv2.p4
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


#include <core.p4>
#include "psa.p4"
#include <bmv2/psa.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/issue3550.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <psa.p4>
#include <bmv2/psa.p4>


typedef bit<48> EthernetAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- P4_16 -*- */
#include <core.p4>
#include <psa.p4>
#include <dpdk/psa.p4>

/************ H E A D E R S ******************************/
struct EMPTY {};
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-action-selector-1.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-action-selector.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-add-on-miss.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-add_on_miss_action_name.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-direction-main-parser-err.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-direction.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-bvec_union.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

struct alt_t {
bit<1> valid;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-direct-counter-learner.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-header-union-stack.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-header-union-stack1.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-header-union-stack2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-invalid-hdr-warnings5.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-invalid-hdr-warnings6.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

header Header1 {
bit<32> data;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-small_sample.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include <dpdk/pna.p4>
#include <pna.p4>

// small_sample

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include <pna.p4>


typedef bit<48> EthernetAddress;
Expand Down
Loading
Loading