/* * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: LicenseRef-NvidiaProprietary * * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual * property and proprietary rights in and to this material, related * documentation and any modifications thereto. Any use, reproduction, * disclosure or distribution of this material and related documentation * without an express license agreement from NVIDIA CORPORATION or * its affiliates is strictly prohibited. */ #include #include #include #include /* * This basic application demonstrates a simple match/action pipeline using NVIDIA * DOCA P4 Target Architecture. * - Match on destination MAC address * - Forward or drop the packet */ control hello_packet( inout nv_headers_t headers, in nv_standard_metadata_t std_meta, inout nv_empty_metadata_t user_meta, inout nv_empty_metadata_t pkt_out_meta ) { action drop() { nv_drop(); } action forward(bit<32> port) { nv_send_to_port(port); } table forward_table { key = { headers.ethernet.dst_addr : exact; } actions = { drop; forward; NoAction; } default_action = forward(3); const entries = { (48w0x001111111111) : forward(1); (48w0x002222222222) : forward(2); (48w0x00dddddddddd) : drop(); (48w0x00aaaaaaaaaa) : NoAction(); (48w0x00bbbbbbbbbb) : NoAction(); } } apply { forward_table.apply(); } } NvDocaPipeline( nv_fixed_parser(), hello_packet() ) main;