Skip to content

Separate RawPacket and MBufRawPacket #1899

@Dimi1010

Description

@Dimi1010

Preface

Currently there are 2 main "raw" packet container types: RawPacket and MBufRawPacket. Both are specialized in different use cases:

  • RawPacket: Specialized to hold a buffer on the free store or with external storage duration (user must ensure lifetime).
  • MBufRawPacket: Specialized to utilize DPDK's MBuf infrastructure and read/write data to it.

The problem - RawPacket is currently works as both "concrete class" and "base class"

In the majority of the library, a pointer to RawPacket is used where a packet data container is needed. This leads to the current implementation of MBufRawPacket subclassing from RawPacket to be interchangeable.

The primary issue with this design choice is that RawPacket now has double duty of both being a final implementation class and an abstract base class. The need to both have it's own functionality and the need to accommodate subclassing leads to maintainability issues and hard to read code, especially in the copy operations.

Proposed solution

A potential solution would be to extract a base class (or interface) over RawPacket and MBufRawPacket that defines the common interface or functionality between the packets. This disentangles the need for both classes to work around each other, simplifying the code.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions