Skip to content

Commit

Permalink
Extract common member variables (#4656)
Browse files Browse the repository at this point in the history
* Extract common member variables

* fix

* fix
  • Loading branch information
ami-GS authored Nov 14, 2024
1 parent e3ffc71 commit 9640abe
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 95 deletions.
10 changes: 0 additions & 10 deletions src/platform/datapath_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,6 @@ typedef struct CXPLAT_SEND_DATA {
//
QUIC_BUFFER ClientBuffer;

//
// The total buffer size for iovecs.
//
uint32_t TotalSize;

//
// The send segmentation size the app asked for.
//
uint16_t SegmentSize;

//
// Total number of packet buffers allocated (and iovecs used if !GSO).
//
Expand Down
17 changes: 2 additions & 15 deletions src/platform/datapath_kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ typedef struct DATAPATH_RX_IO_BLOCK {
//

typedef struct CXPLAT_SEND_DATA {
CXPLAT_SEND_DATA_COMMON;

//
// The proc context owning this send context.
//
Expand All @@ -108,16 +110,6 @@ typedef struct CXPLAT_SEND_DATA {
//
CXPLAT_LIST_ENTRY PendingSendLinkage;

//
// The total buffer size for Buffers.
//
uint32_t TotalSize;

//
// The type of ECN markings needed for send.
//
CXPLAT_ECN_TYPE ECN;

//
// Total number of Buffers currently in use.
//
Expand All @@ -143,11 +135,6 @@ typedef struct CXPLAT_SEND_DATA {
//
struct iovec Iovs[CXPLAT_MAX_BATCH_SEND];

//
// The send segmentation size; zero if segmentation is not performed.
//
uint16_t SegmentSize;

} CXPLAT_SEND_DATA;

typedef struct CXPLAT_DATAPATH_PARTITION CXPLAT_DATAPATH_PARTITION;
Expand Down
16 changes: 1 addition & 15 deletions src/platform/datapath_winkernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ typedef struct CXPLAT_DATAPATH_SEND_BUFFER {
// Send context.
//
typedef struct CXPLAT_SEND_DATA {
CXPLAT_SEND_DATA_COMMON;

CXPLAT_SOCKET* Binding;

Expand All @@ -225,26 +226,11 @@ typedef struct CXPLAT_SEND_DATA {
//
CXPLAT_DATAPATH_SEND_BUFFER* TailBuf;

//
// The total buffer size for WsaBuffers.
//
uint32_t TotalSize;

//
// The type of ECN markings needed for send.
//
CXPLAT_ECN_TYPE ECN;

//
// The number of WSK buffers allocated.
//
UINT8 WskBufferCount;

//
// The send segmentation size; zero if segmentation is not performed.
//
UINT16 SegmentSize;

//
// The QUIC_BUFFER returned to the client for segmented sends.
//
Expand Down
10 changes: 0 additions & 10 deletions src/platform/datapath_winuser.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,6 @@ typedef struct CXPLAT_SEND_DATA {
//
CXPLAT_POOL* BufferPool;

//
// The total buffer size for WsaBuffers.
//
uint32_t TotalSize;

//
// The send segmentation size; zero if segmentation is not performed.
//
uint16_t SegmentSize;

//
// Set of flags set to configure the send behavior.
//
Expand Down
77 changes: 32 additions & 45 deletions src/platform/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ typedef struct CXPLAT_DATAPATH_COMMON {
// The Worker WorkerPool
//
CXPLAT_WORKER_POOL* WorkerPool;

//
// Set of supported features.
//
uint32_t Features;

CXPLAT_DATAPATH_RAW* RawDataPath;
} CXPLAT_DATAPATH_COMMON;

typedef struct CXPLAT_SOCKET_COMMON {
Expand All @@ -73,6 +80,21 @@ typedef struct CXPLAT_SOCKET_COMMON {
// The remote address and port.
//
QUIC_ADDR RemoteAddress;

//
// Parent datapath.
//
CXPLAT_DATAPATH* Datapath;

//
// The client context for this binding.
//
void *ClientContext;

//
// The local interface's MTU.
//
uint16_t Mtu;
} CXPLAT_SOCKET_COMMON;

typedef struct CXPLAT_SEND_DATA_COMMON {
Expand All @@ -82,6 +104,16 @@ typedef struct CXPLAT_SEND_DATA_COMMON {
// The type of ECN markings needed for send.
//
uint8_t ECN; // CXPLAT_ECN_TYPE

//
// The total buffer size for WsaBuffers.
//
uint32_t TotalSize;

//
// The send segmentation size; zero if segmentation is not performed.
//
uint16_t SegmentSize;
} CXPLAT_SEND_DATA_COMMON;

typedef enum CXPLAT_DATAPATH_TYPE {
Expand Down Expand Up @@ -396,11 +428,6 @@ typedef struct CXPLAT_DATAPATH {
//
CXPLAT_REF_COUNT RefCount;

//
// Set of supported features.
//
uint32_t Features;

//
// The size of each receive datagram array element, including client context,
// internal context, and padding.
Expand Down Expand Up @@ -436,8 +463,6 @@ typedef struct CXPLAT_DATAPATH {

uint8_t UseTcp : 1;

CXPLAT_DATAPATH_RAW* RawDataPath;

//
// Per-processor completion contexts.
//
Expand All @@ -451,17 +476,6 @@ typedef struct CXPLAT_DATAPATH {
typedef struct CXPLAT_SOCKET {
CXPLAT_SOCKET_COMMON;

//
// Parent datapath.
//
// CXPLAT_DATAPATH_BASE* Datapath;
CXPLAT_DATAPATH* Datapath;

//
// Client context pointer.
//
void *ClientContext;

//
// Synchronization mechanism for cleanup.
//
Expand All @@ -472,11 +486,6 @@ typedef struct CXPLAT_SOCKET {
//
uint32_t RecvBufLen;

//
// The local interface's MTU.
//
uint16_t Mtu;

//
// Indicates the binding connected to a remote IP address.
//
Expand Down Expand Up @@ -771,26 +780,11 @@ typedef struct QUIC_CACHEALIGN CXPLAT_SOCKET_CONTEXT {
typedef struct CXPLAT_SOCKET {
CXPLAT_SOCKET_COMMON;

//
// A pointer to datapath object.
//
CXPLAT_DATAPATH* Datapath;

//
// The client context for this binding.
//
void *ClientContext;

//
// Synchronization mechanism for cleanup.
//
CXPLAT_REF_COUNT RefCount;

//
// The MTU for this binding.
//
uint16_t Mtu;

//
// The size of a receive buffer's payload.
//
Expand Down Expand Up @@ -898,11 +892,6 @@ typedef struct CXPLAT_DATAPATH {
//
CXPLAT_REF_COUNT RefCount;

//
// Set of supported features.
//
uint32_t Features;

//
// The proc count to create per proc datapath state.
//
Expand Down Expand Up @@ -946,8 +935,6 @@ typedef struct CXPLAT_DATAPATH {

uint8_t UseTcp : 1;

CXPLAT_DATAPATH_RAW* RawDataPath;

//
// The per proc datapath contexts.
//
Expand Down

0 comments on commit 9640abe

Please sign in to comment.