cilium/cilium · error

XDP mode conflict: trying to set conflicting modes %s and %s

Error message

XDP mode conflict: trying to set conflicting modes %s and %s

What it means

newConfig walks all registered XDP enablers; once one enabler sets a non-disabled mode, a later enabler requesting a different non-disabled mode is a conflict. The config is rejected because only a single XDP acceleration mode can be active on the datapath. Disabled can coexist with setting a mode, but two distinct enabled modes cannot.

Source

Thrown at pkg/datapath/xdp/xdp.go:106

			// that's the default. If an enabler wishes to enforce that
			// XDP is disabled, it should use a verifier.
			if e.mode == AccelerationModeDisabled {
				continue
			}

			// Ensure ModeNative takes precedence over ModeBestEffort.
			// It doesn't make sense the other way around.
			if e.mode == AccelerationModeBestEffort && cfg.mode == AccelerationModeNative {
				continue
			} else if cfg.mode == AccelerationModeBestEffort && e.mode == AccelerationModeNative {
				cfg.mode = e.mode
				continue
			}

			// If a mode has been set and the enabler requests a conflicting
			// mode, then raise an error.
			if cfg.mode != AccelerationModeDisabled {
				return cfg, fmt.Errorf("XDP mode conflict: trying to set conflicting modes %s and %s",
					cfg.mode, e.mode)
			}

			cfg.mode = e.mode
		}
	}

	// Perform validation at the end, when the config is fully determined,
	// to ensure that processing order does not play a role in the validation.
	for _, v := range allValidators {
		if err := v(cfg.AccelerationMode(), cfg.Mode()); err != nil {
			return cfg, err
		}
	}

	return cfg, nil
}

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Set the same acceleration mode for all features/enablers requesting XDP
  2. Disable XDP acceleration in one of the conflicting features (use AccelerationModeDisabled)
  3. Reorder/consolidate configuration so only one component sets the XDP mode
  4. Check which features attach XDP enablers via cilium-dbg and agent debug logs

Example fix

// before
newXDP(cfg, WithXDPMode(AccelerationModeNative), WithXDPMode(AccelerationModeGeneric))
// after
newXDP(cfg, WithXDPMode(AccelerationModeNative), WithXDPMode(AccelerationModeNative))
Defensive patterns

Strategy: validation

Validate before calling

if requestedMode != AccelerationModeDisabled && configuredMode != AccelerationModeDisabled && requestedMode != configuredMode {
	return fmt.Errorf("conflicting xdp modes: %s vs %s", configuredMode, requestedMode)
}

Try / catch

cfg, err := newXDP(cfg, opts...)
if err != nil {
	if strings.Contains(err.Error(), "XDP mode conflict") {
		log.Warn("falling back to disabled XDP due to mode conflict")
		cfg, err = newXDP(cfg, WithXDPMode(AccelerationModeDisabled))
	}
	if err != nil { return err }
}

Prevention

When it happens

Trigger: Registering multiple XDP enablers where one sets e.g. AccelerationModeNative and another sets AccelerationModeGeneric (or best-effort) before newConfig runs; e.g. bpf-lb-acceleration and another feature both requesting XDP with different modes.

Common situations: Enabling multiple cilium features that each want to attach XDP with different acceleration settings (e.g. nodeport with native acceleration plus a generic-mode feature); user sets both --bpf-lb-acceleration=generic and a policy needing native mode.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/9a04245bc8cc86c6. Report an issue: GitHub.