diff --git a/configuration/configuration_test.go b/configuration/configuration_test.go index 37aff629..70d1c557 100644 --- a/configuration/configuration_test.go +++ b/configuration/configuration_test.go @@ -85,6 +85,7 @@ global tune.pipesize 32 tune.pool-high-fd-ratio 33 tune.pool-low-fd-ratio 34 + tune.pt.zero-copy-forwarding on tune.rcvbuf.backend 1024 tune.rcvbuf.client 35 tune.rcvbuf.frontend 2048 diff --git a/configuration/global.go b/configuration/global.go index b8c65cbc..880729df 100644 --- a/configuration/global.go +++ b/configuration/global.go @@ -2572,6 +2572,9 @@ func serializeTuneOptions(p parser.Parser, options *models.GlobalTuneOptions) er if err := serializeOnOffOption(p, "tune.h2.zero-copy-fwd-send", options.H2ZeroCopyFwdSend); err != nil { return err } + if err := serializeOnOffOption(p, "tune.pt.zero-copy-forwarding", options.PtZeroCopyForwarding); err != nil { + return err + } return serializeInt64Option(p, "tune.zlib.windowsize", options.ZlibWindowsize) } @@ -3216,6 +3219,12 @@ func parseTuneOptions(p parser.Parser) (*models.GlobalTuneOptions, error) { //no } options.H2ZeroCopyFwdSend = strOption + strOption, err = parseOnOffOption(p, "tune.pt.zero-copy-forwarding") + if err != nil { + return nil, err + } + options.PtZeroCopyForwarding = strOption + return options, nil } diff --git a/configuration/global_test.go b/configuration/global_test.go index 928db53e..499137ba 100644 --- a/configuration/global_test.go +++ b/configuration/global_test.go @@ -381,6 +381,9 @@ func TestGetGlobal(t *testing.T) { if global.TuneOptions.PoolLowFdRatio != 34 { t.Errorf("PoolLowFdRatio is %v, expected 34", global.TuneOptions.PoolLowFdRatio) } + if global.TuneOptions.PtZeroCopyForwarding != "enabled" { + t.Errorf("PtZeroCopyForwarding is %v, expected enabled", global.TuneOptions.PtZeroCopyForwarding) + } if *global.TuneOptions.RcvbufBackend != 1024 { t.Errorf("RcvbufBackend is %v, expected 1024", global.TuneOptions.RcvbufBackend) } @@ -747,6 +750,7 @@ func TestPutGlobal(t *testing.T) { LuaLogStderr: "disabled", MaxChecksPerThread: misc.Int64P(20), PeersMaxUpdatesAtOnce: 100, + PtZeroCopyForwarding: "disabled", QuicFrontendConnTxBuffersLimit: nil, QuicFrontendMaxIdleTimeout: misc.Int64P(5000), QuicSocketOwner: "listener", diff --git a/models/global.go b/models/global.go index 177691b1..3d9dd381 100644 --- a/models/global.go +++ b/models/global.go @@ -3196,6 +3196,10 @@ type GlobalTuneOptions struct { // pool low fd ratio PoolLowFdRatio int64 `json:"pool_low_fd_ratio,omitempty"` + // pt zero copy forwarding + // Enum: [enabled disabled] + PtZeroCopyForwarding string `json:"pt_zero_copy_forwarding,omitempty"` + // quic frontend conn tx buffers limit QuicFrontendConnTxBuffersLimit *int64 `json:"quic_frontend_conn_tx_buffers_limit,omitempty"` @@ -3369,6 +3373,10 @@ func (m *GlobalTuneOptions) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validatePtZeroCopyForwarding(formats); err != nil { + res = append(res, err) + } + if err := m.validateQuicSocketOwner(formats); err != nil { res = append(res, err) } @@ -3851,6 +3859,48 @@ func (m *GlobalTuneOptions) validateLuaLogStderr(formats strfmt.Registry) error return nil } +var globalTuneOptionsTypePtZeroCopyForwardingPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["enabled","disabled"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + globalTuneOptionsTypePtZeroCopyForwardingPropEnum = append(globalTuneOptionsTypePtZeroCopyForwardingPropEnum, v) + } +} + +const ( + + // GlobalTuneOptionsPtZeroCopyForwardingEnabled captures enum value "enabled" + GlobalTuneOptionsPtZeroCopyForwardingEnabled string = "enabled" + + // GlobalTuneOptionsPtZeroCopyForwardingDisabled captures enum value "disabled" + GlobalTuneOptionsPtZeroCopyForwardingDisabled string = "disabled" +) + +// prop value enum +func (m *GlobalTuneOptions) validatePtZeroCopyForwardingEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, globalTuneOptionsTypePtZeroCopyForwardingPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *GlobalTuneOptions) validatePtZeroCopyForwarding(formats strfmt.Registry) error { + if swag.IsZero(m.PtZeroCopyForwarding) { // not required + return nil + } + + // value enum + if err := m.validatePtZeroCopyForwardingEnum("tune_options"+"."+"pt_zero_copy_forwarding", "body", m.PtZeroCopyForwarding); err != nil { + return err + } + + return nil +} + var globalTuneOptionsTypeQuicSocketOwnerPropEnum []interface{} func init() { diff --git a/models/global_compare.go b/models/global_compare.go index 6aa48abd..fe390b0e 100644 --- a/models/global_compare.go +++ b/models/global_compare.go @@ -2170,6 +2170,10 @@ func (s GlobalTuneOptions) Equal(t GlobalTuneOptions, opts ...Options) bool { return false } + if s.PtZeroCopyForwarding != t.PtZeroCopyForwarding { + return false + } + if !equalPointers(s.QuicFrontendConnTxBuffersLimit, t.QuicFrontendConnTxBuffersLimit) { return false } @@ -2497,6 +2501,10 @@ func (s GlobalTuneOptions) Diff(t GlobalTuneOptions, opts ...Options) map[string diff["PoolLowFdRatio"] = []interface{}{s.PoolLowFdRatio, t.PoolLowFdRatio} } + if s.PtZeroCopyForwarding != t.PtZeroCopyForwarding { + diff["PtZeroCopyForwarding"] = []interface{}{s.PtZeroCopyForwarding, t.PtZeroCopyForwarding} + } + if !equalPointers(s.QuicFrontendConnTxBuffersLimit, t.QuicFrontendConnTxBuffersLimit) { diff["QuicFrontendConnTxBuffersLimit"] = []interface{}{ValueOrNil(s.QuicFrontendConnTxBuffersLimit), ValueOrNil(t.QuicFrontendConnTxBuffersLimit)} } diff --git a/models/global_compare_test.go b/models/global_compare_test.go index 03fabd0f..ed425465 100644 --- a/models/global_compare_test.go +++ b/models/global_compare_test.go @@ -2933,7 +2933,7 @@ func TestGlobalTuneOptionsDiffFalse(t *testing.T) { for _, sample := range samples { result := sample.a.Diff(sample.b) - if len(result) != 79 { + if len(result) != 80 { json := jsoniter.ConfigCompatibleWithStandardLibrary a, err := json.Marshal(&sample.a) if err != nil { @@ -2943,7 +2943,7 @@ func TestGlobalTuneOptionsDiffFalse(t *testing.T) { if err != nil { t.Errorf(err.Error()) } - t.Errorf("Expected GlobalTuneOptions to be different in 79 cases, but it is not (%d) %s %s", len(result), a, b) + t.Errorf("Expected GlobalTuneOptions to be different in 80 cases, but it is not (%d) %s %s", len(result), a, b) } } } diff --git a/specification/build/haproxy_spec.yaml b/specification/build/haproxy_spec.yaml index eec32c14..ae31ac69 100644 --- a/specification/build/haproxy_spec.yaml +++ b/specification/build/haproxy_spec.yaml @@ -1751,6 +1751,12 @@ definitions: pool_low_fd_ratio: type: integer x-display-name: Max Used Low FD Ratio + pt_zero_copy_forwarding: + enum: + - enabled + - disabled + type: string + x-display-name: enable or disable the zero-copy forwarding of data for the pass-through multiplexer quic_frontend_conn_tx_buffers_limit: type: integer x-display-name: QUIC Frontend Connection TX Buffer Limit diff --git a/specification/models/configuration/global.yaml b/specification/models/configuration/global.yaml index 9b461292..a9d51337 100644 --- a/specification/models/configuration/global.yaml +++ b/specification/models/configuration/global.yaml @@ -437,6 +437,10 @@ global: pool_low_fd_ratio: type: integer x-display-name: Max Used Low FD Ratio + pt_zero_copy_forwarding: + type: string + enum: [enabled, disabled] + x-display-name: enable or disable the zero-copy forwarding of data for the pass-through multiplexer rcvbuf_backend: type: integer x-display-name: Backend Receive Buffer Size