Skip to content

Add RoCEv2 IBTH packet header (ibth_message) to flow model - #496

Open
apratimmukherjee wants to merge 2 commits into
masterfrom
ibth_roce_pkt_template
Open

apratimmukherjee wants to merge 2 commits into
masterfrom
ibth_roce_pkt_template

Conversation

@apratimmukherjee

@apratimmukherjee apratimmukherjee commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Feature Overview

  • Related Issue: (e.g., Fixes #TBD)
  • Brief Description:
    Adds RoCEv2 (RDMA over Converged Ethernet v2) traffic support to the flow packet headers.
    A new ibth_message header models the InfiniBand Transport Header (IBTH, IBTA Volume 1 Chapter 9) carried over UDP destination port 4791, so RoCEv2 flows can be built as Ethernet / IPv4 or IPv6 / UDP / IBTH.
    The message is composite: the user selects the transport service type (reliable connection, unreliable connection, reliable datagram, unreliable datagram, congestion notification) and the operation (for example send, write, read request/response, ack, atomic), and the implementation derives the BTH OpCode and the required extended transport headers (RETH, AETH, AtomicETH, RDETH, DETH, ImmDt, IETH). The trailing 32-bit Invariant CRC (ICRC) is exposed as an icrc pattern field; by default (auto) the implementation computes it, and it falls back to 0 where it cannot (sufficient when only transit switches that do not inspect the ICRC are in the path).

Feature Details

- New Locations/Nomenclature:
New packet header choice ibth_message (Flow.IbthMessage) added to Flow.Header in flow/packet-headers/header.yaml, defined in flow/packet-headers/ibth.yaml.
Extended transport headers are modeled as reusable objects (Flow.Ibth.Reth, Aeth, AtomicEth, Rdeth, Deth, ImmDt, Ieth). The ICRC is the icrc field on Flow.IbthMessage.

go get github.com/open-traffic-generator/snappi/gosnappi@ibth_roce_pkt_template


Code snippets

// Addressing shared by the device config and the flow packet headers
const (
    d1Mac  = "00:00:00:00:00:aa"
    d1IPv6 = "2001:db8:1::2"
    d1Gw   = "2001:db8:1::1"

    d2Mac  = "00:00:00:00:00:bb"
    d2IPv6 = "2001:db8:2::2"
    d2Gw   = "2001:db8:2::1"
)

cfg := gosnappi.NewConfig()

// ---------------------------------------------------------------------
// Ports
// ---------------------------------------------------------------------
p1 := cfg.Ports().Add().SetName("p1")
p2 := cfg.Ports().Add().SetName("p2")

// ---------------------------------------------------------------------
// Devices - one behind each port, the transit switch sits in between.
// The gateway MAC is resolved by the implementation (IPv6 ND).
// ---------------------------------------------------------------------
d1 := cfg.Devices().Add().SetName("d1")
d1Eth := d1.Ethernets().Add().
    SetName("d1.eth").
    SetMac(d1Mac).
    SetMtu(1500)
d1Eth.Connection().SetPortName(p1.Name())
d1Ip := d1Eth.Ipv6Addresses().Add().
    SetName("d1.ipv6").
    SetAddress(d1IPv6).
    SetGateway(d1Gw).
    SetPrefix(64)

d2 := cfg.Devices().Add().SetName("d2")
d2Eth := d2.Ethernets().Add().
    SetName("d2.eth").
    SetMac(d2Mac).
    SetMtu(1500)
d2Eth.Connection().SetPortName(p2.Name())
d2Ip := d2Eth.Ipv6Addresses().Add().
    SetName("d2.ipv6").
    SetAddress(d2IPv6).
    SetGateway(d2Gw).
    SetPrefix(64)

// ---------------------------------------------------------------------
// Flow - device traffic d1 -> d2, 1000 pps, 100000 packets
// ---------------------------------------------------------------------
flow := cfg.Flows().Add().SetName("rocev2-rc-write")
flow.TxRx().Device().
    SetTxNames([]string{d1Ip.Name()}).
    SetRxNames([]string{d2Ip.Name()})
flow.Size().SetFixed(1024)
flow.Rate().SetPps(1000)
flow.Duration().FixedPackets().SetPackets(100000)
flow.Metrics().SetEnable(true)

// Ethernet: dst MAC is auto (gateway MAC learned via ND), src is the d1 MAC
eth := flow.Packet().Add().Ethernet()
eth.Src().SetValue(d1Mac)
eth.Dst().Auto()

// IPv6: traffic_class = DSCP 26 + ECT(0) = (26 << 2) | 0b10 = 106
ip := flow.Packet().Add().Ipv6()
ip.Src().SetValue(d1IPv6)
ip.Dst().SetValue(d2IPv6)
ip.TrafficClass().SetValue(106)
ip.HopLimit().SetValue(64)

// UDP: dst port 4791 = RoCEv2; varying src port gives ECMP entropy
udp := flow.Packet().Add().Udp()
udp.SrcPort().Increment().SetStart(49152).SetStep(1).SetCount(1024)
udp.DstPort().SetValue(4791)

// IBTH: RC RDMA WRITE Only (the BTH OpCode is derived, never set directly)
ibth := flow.Packet().Add().IbthMessage()
write := ibth.ReliableConnection().Write()
write.DestQp().SetValue(0x000102)
write.PartitionKey().SetValue(0xFFFF)
write.Psn().Increment().SetStart(0).SetStep(1).SetCount(0xFFFFFF)

// RETH: remote buffer address, key and length of the write
write.Reth().VirtualAddress().SetValue(0x1000)
write.Reth().RKey().SetValue(0x11223344)
write.Reth().DmaLength().SetValue(1024)

api.SetConfig(cfg)

Test Specification:

Example test scenario:
Configuration details: Test Port - DUT -Test Port
Configure an IPv6 RoCEv2 RC RDMA WRITE flow (Ethernet / IPv6 / UDP 4791 / IBTH) from device d1 (behind p1) through the transit switch to device d2 (behind p2), with the destination MAC resolved automatically.
Verify the switch forwards the traffic, ECMP-hashes on UDP source port, applies QoS from the DSCP, and can ECN-mark packets. Verify all transmitted packets are received on p2.

apratimmukherjee and others added 2 commits October 1, 2026 11:44
- Add flow/packet-headers/ibth.yaml defining Flow.IbthMessage, a composite
  InfiniBand Transport Header (BTH + extended headers) for RoCEv2 flows
  (IBTA Vol 1 Ch 9, UDP dst port 4791)
- Select transport via choice: reliable_connection, unreliable_connection,
  reliable_datagram, unreliable_datagram, congestion_notification; each
  with its operations (send, write, read request/response, ack, atomic,
  atomic ack where defined). The BTH OpCode is derived, never set directly
- Model extended transport headers as reusable objects: RETH, AETH,
  AtomicETH, RDETH, DETH, ImmDt, IETH
- Add icrc pattern field (32 bit, auto/value/values/increment/decrement);
  auto means the implementation SHOULD compute the Invariant CRC and falls
  back to 0 if it cannot
- Register ibth_message in Flow.Header (header.yaml, choice uid 26, property
  uid 27)
- Add .venv to .gitignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants