xref: /f-stack/dpdk/examples/pipeline/examples/l2fwd_macswp.spec (revision 2d9fd380)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; SPDX-License-Identifier: BSD-3-Clause
2; Copyright(c) 2020 Intel Corporation
3
4//
5// Packet headers.
6//
7struct ethernet_h {
8	bit<48> dst_addr
9	bit<48> src_addr
10	bit<16> ether_type
11}
12
13header ethernet instanceof ethernet_h
14
15//
16// Packet meta-data.
17//
18struct metadata_t {
19	bit<32> port
20	bit<48> addr
21}
22
23metadata instanceof metadata_t
24
25//
26// Actions.
27//
28action macswp args none {
29	mov m.addr h.ethernet.dst_addr
30	mov h.ethernet.dst_addr h.ethernet.src_addr
31	mov h.ethernet.src_addr m.addr
32	return
33}
34
35//
36// Tables.
37//
38table stub {
39	key {
40	}
41
42	actions {
43		macswp
44	}
45
46	default_action macswp args none const
47}
48
49//
50// Pipeline.
51//
52apply {
53	rx m.port
54	extract h.ethernet
55	table stub
56	xor m.port 1
57	emit h.ethernet
58	tx m.port
59}
60

served by {OpenGrok

Last Index Update: Tue Oct 21 18:42:31 GMT 2025