-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AF_XDP transmit checksum offload (#375)
- Loading branch information
Showing
27 changed files
with
1,581 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
// | ||
|
||
#pragma once | ||
|
||
EXTERN_C_START | ||
|
||
#pragma warning(push) | ||
#pragma warning(default:4820) // warn if the compiler inserted padding | ||
#pragma warning(disable:4201) // nonstandard extension used: nameless struct/union | ||
#pragma warning(disable:4214) // nonstandard extension used: bit field types other than int | ||
|
||
typedef enum _XDP_FRAME_TX_CHECKSUM_ACTION { | ||
XdpFrameTxChecksumActionPassthrough = 0, | ||
XdpFrameTxChecksumActionRequired = 1, | ||
} XDP_FRAME_TX_CHECKSUM_ACTION; | ||
|
||
typedef enum _XDP_FRAME_RX_CHECKSUM_EVALUATION { | ||
XdpFrameRxChecksumEvaluationNotChecked = 0, | ||
XdpFrameRxChecksumEvaluationSucceeded = 1, | ||
XdpFrameRxChecksumEvaluationFailed = 2, | ||
XdpFrameRxChecksumEvaluationInvalid = 3, | ||
} XDP_FRAME_RX_CHECKSUM_EVALUATION; | ||
|
||
typedef struct _XDP_FRAME_CHECKSUM { | ||
// One of XDP_FRAME_TX_CHECKSUM_ACTION or XDP_FRAME_RX_CHECKSUM_EVALUATION | ||
UINT8 Layer3 : 2; | ||
|
||
// One of XDP_FRAME_TX_CHECKSUM_ACTION or XDP_FRAME_RX_CHECKSUM_EVALUATION | ||
UINT8 Layer4 : 2; | ||
|
||
UINT8 Reserved : 4; | ||
} XDP_FRAME_CHECKSUM; | ||
|
||
C_ASSERT(sizeof(XDP_FRAME_CHECKSUM) == 1); | ||
|
||
#pragma warning(pop) | ||
|
||
EXTERN_C_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
// | ||
|
||
#pragma once | ||
|
||
EXTERN_C_START | ||
|
||
#include <xdp/framechecksum.h> | ||
|
||
#define XDP_FRAME_EXTENSION_CHECKSUM_NAME L"ms_frame_checksum" | ||
#define XDP_FRAME_EXTENSION_CHECKSUM_VERSION_1 1U | ||
|
||
#include <xdp/extension.h> | ||
|
||
inline | ||
XDP_FRAME_CHECKSUM * | ||
XdpGetChecksumExtension( | ||
_In_ XDP_FRAME *Frame, | ||
_In_ XDP_EXTENSION *Extension | ||
) | ||
{ | ||
return (XDP_FRAME_CHECKSUM *)XdpGetExtensionData(Frame, Extension); | ||
} | ||
|
||
EXTERN_C_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
// | ||
|
||
#pragma once | ||
|
||
EXTERN_C_START | ||
|
||
#pragma warning(push) | ||
#pragma warning(default:4820) // warn if the compiler inserted padding | ||
#pragma warning(disable:4201) // nonstandard extension used: nameless struct/union | ||
#pragma warning(disable:4214) // nonstandard extension used: bit field types other than int | ||
|
||
typedef enum _XDP_FRAME_LAYER2_TYPE { | ||
XdpFrameLayer2TypeUnspecified, | ||
XdpFrameLayer2TypeNull, | ||
XdpFrameLayer2TypeEthernet, | ||
} XDP_FRAME_LAYER2_TYPE; | ||
|
||
typedef enum _XDP_FRAME_LAYER3_TYPE { | ||
XdpFrameLayer3TypeUnspecified, | ||
XdpFrameLayer3TypeIPv4UnspecifiedOptions, | ||
XdpFrameLayer3TypeIPv4WithOptions, | ||
XdpFrameLayer3TypeIPv4NoOptions, | ||
XdpFrameLayer3TypeIPv6UnspecifiedExtensions, | ||
XdpFrameLayer3TypeIPv6WithExtensions, | ||
XdpFrameLayer3TypeIPv6NoExtensions, | ||
} XDP_FRAME_LAYER3_TYPE; | ||
|
||
typedef enum _XDP_FRAME_LAYER4_TYPE { | ||
XdpFrameLayer4TypeUnspecified, | ||
XdpFrameLayer4TypeTcp, | ||
XdpFrameLayer4TypeUdp, | ||
XdpFrameLayer4TypeIPFragment, | ||
XdpFrameLayer4TypeIPNotFragment, | ||
} XDP_FRAME_LAYER4_TYPE; | ||
|
||
#include <pshpack1.h> | ||
typedef struct _XDP_FRAME_LAYOUT { | ||
UINT16 Layer2HeaderLength : 7; | ||
UINT16 Layer3HeaderLength : 9; | ||
UINT8 Layer4HeaderLength : 8; | ||
|
||
// One of the XDP_FRAME_LAYER2_TYPE values | ||
UINT8 Layer2Type : 4; | ||
|
||
// One of the XDP_FRAME_LAYER3_TYPE values | ||
UINT8 Layer3Type : 4; | ||
|
||
// One of the XDP_FRAME_LAYER4_TYPE values | ||
UINT8 Layer4Type : 4; | ||
|
||
UINT8 Reserved0 : 4; | ||
} XDP_FRAME_LAYOUT; | ||
#include <poppack.h> | ||
|
||
C_ASSERT(sizeof(XDP_FRAME_LAYOUT) == 5); | ||
|
||
#pragma warning(pop) | ||
|
||
EXTERN_C_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
// | ||
|
||
#pragma once | ||
|
||
EXTERN_C_START | ||
|
||
#include <xdp/framelayout.h> | ||
|
||
#define XDP_FRAME_EXTENSION_LAYOUT_NAME L"ms_frame_layout" | ||
#define XDP_FRAME_EXTENSION_LAYOUT_VERSION_1 1U | ||
|
||
#include <xdp/extension.h> | ||
|
||
inline | ||
XDP_FRAME_LAYOUT * | ||
XdpGetLayoutExtension( | ||
_In_ XDP_FRAME *Frame, | ||
_In_ XDP_EXTENSION *Extension | ||
) | ||
{ | ||
return (XDP_FRAME_LAYOUT *)XdpGetExtensionData(Frame, Extension); | ||
} | ||
|
||
EXTERN_C_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.