From fa5cbd2a2b39c5c011cad770536315540be07250 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Wed, 1 Mar 2023 17:16:08 +0100 Subject: [PATCH 1/2] vpp: upgrade to 156d452750ab37a51984938bf4a8ab0e16650d82 (31 mars 23) This upgrade VPP's version containing mostly changes in the way the memif API allows to create abstract sockets. Notably the syntax changed and is now inconsistent with the tap_v2 api. Changelog also contains patches for avf & wireguard. Signed-off-by: Nathan Skrzypczak --- calico-vpp-agent/cni/cni_pod_test.go | 2 +- calico-vpp-agent/cni/pod_interface/common.go | 2 + calico-vpp-agent/cni/pod_interface/memif.go | 2 +- vpplink/generated/bindings/capo/capo.ba.go | 24 -- vpplink/generated/bindings/cnat/cnat.ba.go | 48 --- vpplink/generated/bindings/ikev2/ikev2.ba.go | 4 - .../bindings/interface/interface.ba.go | 204 ++++++++- .../bindings/interface/interface_rpc.ba.go | 20 + vpplink/generated/bindings/ip/ip.ba.go | 333 +++++++-------- vpplink/generated/bindings/ip/ip_rpc.ba.go | 10 + .../generated/bindings/ip6_nd/ip6_nd.ba.go | 286 ++++++++++++- .../bindings/ip6_nd/ip6_nd_rpc.ba.go | 44 ++ vpplink/generated/bindings/ipip/ipip.ba.go | 3 - vpplink/generated/bindings/ipsec/ipsec.ba.go | 126 ------ .../generated/bindings/memclnt/memclnt.ba.go | 26 -- .../bindings/nat44_ed/nat44_ed.ba.go | 18 - vpplink/generated/bindings/pbl/pbl.ba.go | 20 - vpplink/generated/bindings/punt/punt.ba.go | 19 - .../generated/bindings/session/session.ba.go | 182 +------- .../bindings/session/session_rpc.ba.go | 20 - vpplink/generated/bindings/sr/sr.ba.go | 401 +++++++++++++++++- vpplink/generated/bindings/sr/sr_rpc.ba.go | 64 +++ vpplink/generated/bindings/vlib/vlib.ba.go | 12 - vpplink/generated/bindings/vpe/vpe.ba.go | 8 - vpplink/generated/bindings/vxlan/vxlan.ba.go | 91 ---- .../bindings/wireguard/wireguard.ba.go | 12 - vpplink/generated/generate.log | 12 +- .../0001-pbl-Port-based-balancer.patch | 6 +- ...002-cnat-WIP-no-k8s-maglev-from-pods.patch | 2 +- .../0003-acl-acl-plugin-custom-policies.patch | 2 +- .../0004-capo-Calico-Policies-plugin.patch | 23 +- ...mif-fix-socket-name-null-termination.patch | 41 -- vpplink/generated/vpp_clone_current.sh | 13 +- 33 files changed, 1195 insertions(+), 885 deletions(-) delete mode 100644 vpplink/generated/patches/0005-memif-fix-socket-name-null-termination.patch diff --git a/calico-vpp-agent/cni/cni_pod_test.go b/calico-vpp-agent/cni/cni_pod_test.go index 11bbc729..3f8ac1bc 100644 --- a/calico-vpp-agent/cni/cni_pod_test.go +++ b/calico-vpp-agent/cni/cni_pod_test.go @@ -231,7 +231,7 @@ var _ = Describe("Pod-related functionality of CNI", func() { socket, err := vpp.MemifsocketByID(memifs[0].SocketId) Expect(err).ToNot(HaveOccurred(), "failed to get memif socket") Expect(socket.SocketFilename).To(Equal( - fmt.Sprintf("@netns:%s@vpp/memif-%s", newPod.Netns, newPod.InterfaceName)), + fmt.Sprintf("abstract:%s,netns_name=%s", newPod.InterfaceName, newPod.Netns)), "memif socket file is not configured correctly") By("Checking PBL (packet punting) to redirect some traffic into memif (secondary interface)") diff --git a/calico-vpp-agent/cni/pod_interface/common.go b/calico-vpp-agent/cni/pod_interface/common.go index c6734052..6880a2d1 100644 --- a/calico-vpp-agent/cni/pod_interface/common.go +++ b/calico-vpp-agent/cni/pod_interface/common.go @@ -37,6 +37,8 @@ func (i *PodInterfaceDriverData) SpreadTxQueuesOnWorkers(swIfIndex uint32, numTx "swIfIndex": swIfIndex, }).Debugf("Spreading %d TX queues on %d workers for pod interface: %v", numTxQueues, i.NDataThreads, i.Name) + return nil // FIXME + // set first tx queue for main worker err = i.vpp.SetInterfaceTxPlacement(swIfIndex, 0 /* queue */, 0 /* worker */) if err != nil { diff --git a/calico-vpp-agent/cni/pod_interface/memif.go b/calico-vpp-agent/cni/pod_interface/memif.go index ad0875c3..4d2467be 100644 --- a/calico-vpp-agent/cni/pod_interface/memif.go +++ b/calico-vpp-agent/cni/pod_interface/memif.go @@ -58,7 +58,7 @@ func (i *MemifPodInterfaceDriver) CreateInterface(podSpec *storage.LocalPodSpec, if podSpec.NetworkName == "" { memifName = "@vpp/memif-" + podSpec.InterfaceName } - socketId, err := i.vpp.AddMemifSocketFileName(fmt.Sprintf("@netns:%s%s", podSpec.NetnsName, memifName)) + socketId, err := i.vpp.AddMemifSocketFileName(fmt.Sprintf("abstract:%s,netns_name=%s", memifName, podSpec.NetnsName)) if err != nil { return err } else { diff --git a/vpplink/generated/bindings/capo/capo.ba.go b/vpplink/generated/bindings/capo/capo.ba.go index 883dc138..4c7b780c 100644 --- a/vpplink/generated/bindings/capo/capo.ba.go +++ b/vpplink/generated/bindings/capo/capo.ba.go @@ -332,7 +332,6 @@ func (u *CapoIpsetMemberValUnion) GetTuple() (a CapoThreeTuple) { return } -// // where the packet only needs to match one entry in either category // CapoConfigurePolicies defines message 'capo_configure_policies'. // InProgress: the message form may change in the future versions type CapoConfigurePolicies struct { @@ -576,10 +575,6 @@ func (m *CapoGetVersionReply) Unmarshal(b []byte) error { return nil } -// Control ping from the client to the server response -// - retval - return code for the request -// - vpe_pid - the pid of the vpe, returned by the server -// // CapoIpsetAddDelMembers defines message 'capo_ipset_add_del_members'. // InProgress: the message form may change in the future versions type CapoIpsetAddDelMembers struct { @@ -678,10 +673,6 @@ func (m *CapoIpsetAddDelMembersReply) Unmarshal(b []byte) error { return nil } -// Control ping from the client to the server response -// - retval - return code for the request -// - vpe_pid - the pid of the vpe, returned by the server -// // CapoIpsetCreate defines message 'capo_ipset_create'. // InProgress: the message form may change in the future versions type CapoIpsetCreate struct { @@ -716,10 +707,6 @@ func (m *CapoIpsetCreate) Unmarshal(b []byte) error { return nil } -// Control ping from the client to the server response -// - retval - return code for the request -// - vpe_pid - the pid of the vpe, returned by the server -// // CapoIpsetCreateReply defines message 'capo_ipset_create_reply'. // InProgress: the message form may change in the future versions type CapoIpsetCreateReply struct { @@ -758,10 +745,6 @@ func (m *CapoIpsetCreateReply) Unmarshal(b []byte) error { return nil } -// Control ping from the client to the server response -// - retval - return code for the request -// - vpe_pid - the pid of the vpe, returned by the server -// // CapoIpsetDelete defines message 'capo_ipset_delete'. // InProgress: the message form may change in the future versions type CapoIpsetDelete struct { @@ -830,7 +813,6 @@ func (m *CapoIpsetDeleteReply) Unmarshal(b []byte) error { return nil } -// // where the packet only needs to match one entry in either category // CapoPolicyCreate defines message 'capo_policy_create'. // InProgress: the message form may change in the future versions type CapoPolicyCreate struct { @@ -888,7 +870,6 @@ func (m *CapoPolicyCreate) Unmarshal(b []byte) error { return nil } -// // where the packet only needs to match one entry in either category // CapoPolicyCreateReply defines message 'capo_policy_create_reply'. // InProgress: the message form may change in the future versions type CapoPolicyCreateReply struct { @@ -927,7 +908,6 @@ func (m *CapoPolicyCreateReply) Unmarshal(b []byte) error { return nil } -// // where the packet only needs to match one entry in either category // CapoPolicyDelete defines message 'capo_policy_delete'. // InProgress: the message form may change in the future versions type CapoPolicyDelete struct { @@ -996,7 +976,6 @@ func (m *CapoPolicyDeleteReply) Unmarshal(b []byte) error { return nil } -// // where the packet only needs to match one entry in either category // CapoPolicyUpdate defines message 'capo_policy_update'. // InProgress: the message form may change in the future versions type CapoPolicyUpdate struct { @@ -1176,7 +1155,6 @@ func (m *CapoRuleCreate) Unmarshal(b []byte) error { return nil } -// // where the packet only needs to match one entry in either category // CapoRuleCreateReply defines message 'capo_rule_create_reply'. // InProgress: the message form may change in the future versions type CapoRuleCreateReply struct { @@ -1215,7 +1193,6 @@ func (m *CapoRuleCreateReply) Unmarshal(b []byte) error { return nil } -// // where the packet only needs to match one entry in either category // CapoRuleDelete defines message 'capo_rule_delete'. // InProgress: the message form may change in the future versions type CapoRuleDelete struct { @@ -1284,7 +1261,6 @@ func (m *CapoRuleDeleteReply) Unmarshal(b []byte) error { return nil } -// // where the packet only needs to match one entry in either category // CapoRuleUpdate defines message 'capo_rule_update'. // InProgress: the message form may change in the future versions type CapoRuleUpdate struct { diff --git a/vpplink/generated/bindings/cnat/cnat.ba.go b/vpplink/generated/bindings/cnat/cnat.ba.go index 400ccb75..f9b2c945 100644 --- a/vpplink/generated/bindings/cnat/cnat.ba.go +++ b/vpplink/generated/bindings/cnat/cnat.ba.go @@ -240,10 +240,6 @@ type CnatTranslation struct { Paths []CnatEndpointTuple `binapi:"cnat_endpoint_tuple[n_paths],name=paths" json:"paths,omitempty"` } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatGetSnatAddresses defines message 'cnat_get_snat_addresses'. // InProgress: the message form may change in the future versions type CnatGetSnatAddresses struct{} @@ -272,10 +268,6 @@ func (m *CnatGetSnatAddresses) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatGetSnatAddressesReply defines message 'cnat_get_snat_addresses_reply'. // InProgress: the message form may change in the future versions type CnatGetSnatAddressesReply struct { @@ -326,10 +318,6 @@ func (m *CnatGetSnatAddressesReply) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatSessionDetails defines message 'cnat_session_details'. // InProgress: the message form may change in the future versions type CnatSessionDetails struct { @@ -415,10 +403,6 @@ func (m *CnatSessionDetails) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatSessionDump defines message 'cnat_session_dump'. // InProgress: the message form may change in the future versions type CnatSessionDump struct{} @@ -447,10 +431,6 @@ func (m *CnatSessionDump) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatSessionPurge defines message 'cnat_session_purge'. // InProgress: the message form may change in the future versions type CnatSessionPurge struct{} @@ -513,10 +493,6 @@ func (m *CnatSessionPurgeReply) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatSetSnatAddresses defines message 'cnat_set_snat_addresses'. // InProgress: the message form may change in the future versions type CnatSetSnatAddresses struct { @@ -662,10 +638,6 @@ func (m *CnatSetSnatPolicyReply) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatSnatPolicyAddDelExcludePfx defines message 'cnat_snat_policy_add_del_exclude_pfx'. // InProgress: the message form may change in the future versions type CnatSnatPolicyAddDelExcludePfx struct { @@ -748,10 +720,6 @@ func (m *CnatSnatPolicyAddDelExcludePfxReply) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatSnatPolicyAddDelIf defines message 'cnat_snat_policy_add_del_if'. // InProgress: the message form may change in the future versions type CnatSnatPolicyAddDelIf struct { @@ -830,10 +798,6 @@ func (m *CnatSnatPolicyAddDelIfReply) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatTranslationDel defines message 'cnat_translation_del'. // InProgress: the message form may change in the future versions type CnatTranslationDel struct { @@ -902,10 +866,6 @@ func (m *CnatTranslationDelReply) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatTranslationDetails defines message 'cnat_translation_details'. // InProgress: the message form may change in the future versions type CnatTranslationDetails struct { @@ -1019,10 +979,6 @@ func (m *CnatTranslationDetails) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatTranslationDump defines message 'cnat_translation_dump'. // InProgress: the message form may change in the future versions type CnatTranslationDump struct{} @@ -1168,10 +1124,6 @@ func (m *CnatTranslationUpdate) Unmarshal(b []byte) error { return nil } -// /* An enpoint is either -// - An IP & a port -// - An interface, an address familiy and a port -// // CnatTranslationUpdateReply defines message 'cnat_translation_update_reply'. // InProgress: the message form may change in the future versions type CnatTranslationUpdateReply struct { diff --git a/vpplink/generated/bindings/ikev2/ikev2.ba.go b/vpplink/generated/bindings/ikev2/ikev2.ba.go index 3aff9b88..fdea70d3 100644 --- a/vpplink/generated/bindings/ikev2/ikev2.ba.go +++ b/vpplink/generated/bindings/ikev2/ikev2.ba.go @@ -2082,10 +2082,6 @@ func (m *Ikev2SetResponder) Unmarshal(b []byte) error { return nil } -// IKEv2: Set IKEv2 responder interface and IP address -// - name - IKEv2 profile name -// - responder - responder data -// // Ikev2SetResponderHostname defines message 'ikev2_set_responder_hostname'. // InProgress: the message form may change in the future versions type Ikev2SetResponderHostname struct { diff --git a/vpplink/generated/bindings/interface/interface.ba.go b/vpplink/generated/bindings/interface/interface.ba.go index 358a7392..f586f104 100644 --- a/vpplink/generated/bindings/interface/interface.ba.go +++ b/vpplink/generated/bindings/interface/interface.ba.go @@ -3,7 +3,7 @@ // Package interfaces contains generated bindings for API file interface.api. // // Contents: -// - 68 messages +// - 72 messages package interfaces import ( @@ -23,7 +23,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "interface" APIVersion = "3.2.3" - VersionCrc = 0xddff3487 + VersionCrc = 0xd99dbd4 ) // Enable or disable detailed interface stats @@ -269,7 +269,6 @@ func (m *CreateLoopbackReply) Unmarshal(b []byte) error { return nil } -// /* Gross kludge, DGMS // CreateSubif defines message 'create_subif'. type CreateSubif struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -319,7 +318,6 @@ func (m *CreateSubif) Unmarshal(b []byte) error { return nil } -// /* Gross kludge, DGMS // CreateSubifReply defines message 'create_subif_reply'. type CreateSubifReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` @@ -613,9 +611,6 @@ func (m *GetBuffersStats) Unmarshal(b []byte) error { return nil } -// Get available, cached and used buffers -// - buffer_index - buffer stat index -// // GetBuffersStatsReply defines message 'get_buffers_stats_reply'. type GetBuffersStatsReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` @@ -806,6 +801,186 @@ func (m *InterfaceNameRenumberReply) Unmarshal(b []byte) error { return nil } +// PcapTraceOff defines message 'pcap_trace_off'. +type PcapTraceOff struct{} + +func (m *PcapTraceOff) Reset() { *m = PcapTraceOff{} } +func (*PcapTraceOff) GetMessageName() string { return "pcap_trace_off" } +func (*PcapTraceOff) GetCrcString() string { return "51077d14" } +func (*PcapTraceOff) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PcapTraceOff) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *PcapTraceOff) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *PcapTraceOff) Unmarshal(b []byte) error { + return nil +} + +// PcapTraceOffReply defines message 'pcap_trace_off_reply'. +type PcapTraceOffReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PcapTraceOffReply) Reset() { *m = PcapTraceOffReply{} } +func (*PcapTraceOffReply) GetMessageName() string { return "pcap_trace_off_reply" } +func (*PcapTraceOffReply) GetCrcString() string { return "e8d4e804" } +func (*PcapTraceOffReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PcapTraceOffReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PcapTraceOffReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PcapTraceOffReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// pcap_trace_on +// - capture_rx - capture received packets +// - capture_tx - capture transmitted packets +// - capture_drop - capture dropped packets +// - filter - is a filter is being used on this capture +// - preallocate_data - preallocate the data buffer +// - free_data - free the data buffer +// - max_packets - depth of local buffer +// - max_bytes_per_packet - maximum number of bytes to capture +// for each packet +// - sw_if_index - specify a given interface, or 0 for any +// - error - filter packets based on a specific error. +// - filename - output filename, will be placed in /tmp +// +// PcapTraceOn defines message 'pcap_trace_on'. +type PcapTraceOn struct { + CaptureRx bool `binapi:"bool,name=capture_rx" json:"capture_rx,omitempty"` + CaptureTx bool `binapi:"bool,name=capture_tx" json:"capture_tx,omitempty"` + CaptureDrop bool `binapi:"bool,name=capture_drop" json:"capture_drop,omitempty"` + Filter bool `binapi:"bool,name=filter" json:"filter,omitempty"` + PreallocateData bool `binapi:"bool,name=preallocate_data" json:"preallocate_data,omitempty"` + FreeData bool `binapi:"bool,name=free_data" json:"free_data,omitempty"` + MaxPackets uint32 `binapi:"u32,name=max_packets,default=1000" json:"max_packets,omitempty"` + MaxBytesPerPacket uint32 `binapi:"u32,name=max_bytes_per_packet,default=512" json:"max_bytes_per_packet,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Error string `binapi:"string[128],name=error" json:"error,omitempty"` + Filename string `binapi:"string[64],name=filename" json:"filename,omitempty"` +} + +func (m *PcapTraceOn) Reset() { *m = PcapTraceOn{} } +func (*PcapTraceOn) GetMessageName() string { return "pcap_trace_on" } +func (*PcapTraceOn) GetCrcString() string { return "cb39e968" } +func (*PcapTraceOn) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PcapTraceOn) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.CaptureRx + size += 1 // m.CaptureTx + size += 1 // m.CaptureDrop + size += 1 // m.Filter + size += 1 // m.PreallocateData + size += 1 // m.FreeData + size += 4 // m.MaxPackets + size += 4 // m.MaxBytesPerPacket + size += 4 // m.SwIfIndex + size += 128 // m.Error + size += 64 // m.Filename + return size +} +func (m *PcapTraceOn) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.CaptureRx) + buf.EncodeBool(m.CaptureTx) + buf.EncodeBool(m.CaptureDrop) + buf.EncodeBool(m.Filter) + buf.EncodeBool(m.PreallocateData) + buf.EncodeBool(m.FreeData) + buf.EncodeUint32(m.MaxPackets) + buf.EncodeUint32(m.MaxBytesPerPacket) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.Error, 128) + buf.EncodeString(m.Filename, 64) + return buf.Bytes(), nil +} +func (m *PcapTraceOn) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.CaptureRx = buf.DecodeBool() + m.CaptureTx = buf.DecodeBool() + m.CaptureDrop = buf.DecodeBool() + m.Filter = buf.DecodeBool() + m.PreallocateData = buf.DecodeBool() + m.FreeData = buf.DecodeBool() + m.MaxPackets = buf.DecodeUint32() + m.MaxBytesPerPacket = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Error = buf.DecodeString(128) + m.Filename = buf.DecodeString(64) + return nil +} + +// PcapTraceOnReply defines message 'pcap_trace_on_reply'. +type PcapTraceOnReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PcapTraceOnReply) Reset() { *m = PcapTraceOnReply{} } +func (*PcapTraceOnReply) GetMessageName() string { return "pcap_trace_on_reply" } +func (*PcapTraceOnReply) GetCrcString() string { return "e8d4e804" } +func (*PcapTraceOnReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PcapTraceOnReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PcapTraceOnReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *PcapTraceOnReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // Set or delete one or all ip addresses on a specified interface // - sw_if_index - index of the interface to add/del addresses // - is_add - add address if non-zero, else delete @@ -2824,13 +2999,6 @@ func (m *SwInterfaceTxPlacementGet) Unmarshal(b []byte) error { return nil } -// get the tx queue placement of interface(s) -// - cursor - optional, it allows client to continue a dump -// - sw_if_index - optional interface index for which queue placement to -// be requested. sw_if_index = ~0 will get the placement information for all -// interfaces. It will not get information related to sub-interfaces, p2p -// and pipe interfaces. -// // SwInterfaceTxPlacementGetReply defines message 'sw_interface_tx_placement_get_reply'. type SwInterfaceTxPlacementGetReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` @@ -2966,6 +3134,10 @@ func file_interfaces_binapi_init() { api.RegisterMessage((*HwInterfaceSetMtuReply)(nil), "hw_interface_set_mtu_reply_e8d4e804") api.RegisterMessage((*InterfaceNameRenumber)(nil), "interface_name_renumber_2b8858b8") api.RegisterMessage((*InterfaceNameRenumberReply)(nil), "interface_name_renumber_reply_e8d4e804") + api.RegisterMessage((*PcapTraceOff)(nil), "pcap_trace_off_51077d14") + api.RegisterMessage((*PcapTraceOffReply)(nil), "pcap_trace_off_reply_e8d4e804") + api.RegisterMessage((*PcapTraceOn)(nil), "pcap_trace_on_cb39e968") + api.RegisterMessage((*PcapTraceOnReply)(nil), "pcap_trace_on_reply_e8d4e804") api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "sw_interface_add_del_address_5463d73b") api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "sw_interface_add_del_address_reply_e8d4e804") api.RegisterMessage((*SwInterfaceAddDelMacAddress)(nil), "sw_interface_add_del_mac_address_638bb9f4") @@ -3039,6 +3211,10 @@ func AllMessages() []api.Message { (*HwInterfaceSetMtuReply)(nil), (*InterfaceNameRenumber)(nil), (*InterfaceNameRenumberReply)(nil), + (*PcapTraceOff)(nil), + (*PcapTraceOffReply)(nil), + (*PcapTraceOn)(nil), + (*PcapTraceOnReply)(nil), (*SwInterfaceAddDelAddress)(nil), (*SwInterfaceAddDelAddressReply)(nil), (*SwInterfaceAddDelMacAddress)(nil), diff --git a/vpplink/generated/bindings/interface/interface_rpc.ba.go b/vpplink/generated/bindings/interface/interface_rpc.ba.go index a514c8bd..a823d8c9 100644 --- a/vpplink/generated/bindings/interface/interface_rpc.ba.go +++ b/vpplink/generated/bindings/interface/interface_rpc.ba.go @@ -23,6 +23,8 @@ type RPCService interface { GetBuffersStats(ctx context.Context, in *GetBuffersStats) (*GetBuffersStatsReply, error) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) + PcapTraceOff(ctx context.Context, in *PcapTraceOff) (*PcapTraceOffReply, error) + PcapTraceOn(ctx context.Context, in *PcapTraceOn) (*PcapTraceOnReply, error) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) SwInterfaceAddressReplaceBegin(ctx context.Context, in *SwInterfaceAddressReplaceBegin) (*SwInterfaceAddressReplaceBeginReply, error) @@ -146,6 +148,24 @@ func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *Interface return out, api.RetvalToVPPApiError(out.Retval) } +func (c *serviceClient) PcapTraceOff(ctx context.Context, in *PcapTraceOff) (*PcapTraceOffReply, error) { + out := new(PcapTraceOffReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) PcapTraceOn(ctx context.Context, in *PcapTraceOn) (*PcapTraceOnReply, error) { + out := new(PcapTraceOnReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { out := new(SwInterfaceAddDelAddressReply) err := c.conn.Invoke(ctx, in, out) diff --git a/vpplink/generated/bindings/ip/ip.ba.go b/vpplink/generated/bindings/ip/ip.ba.go index b8ebeef9..47961d98 100644 --- a/vpplink/generated/bindings/ip/ip.ba.go +++ b/vpplink/generated/bindings/ip/ip.ba.go @@ -3,9 +3,9 @@ // Package ip contains generated bindings for API file ip.api. // // Contents: -// - 2 enums +// - 3 enums // - 7 structs -// - 91 messages +// - 93 messages package ip import ( @@ -29,7 +29,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "ip" APIVersion = "3.2.0" - VersionCrc = 0x41299705 + VersionCrc = 0xbd2f873b ) // IPReassType defines enum 'ip_reass_type'. @@ -123,6 +123,73 @@ func (x IPFlowHashConfig) String() string { return s } +// IPFlowHashConfigV2 defines enum 'ip_flow_hash_config_v2'. +type IPFlowHashConfigV2 uint32 + +const ( + IP_API_V2_FLOW_HASH_SRC_IP IPFlowHashConfigV2 = 1 + IP_API_V2_FLOW_HASH_DST_IP IPFlowHashConfigV2 = 2 + IP_API_V2_FLOW_HASH_SRC_PORT IPFlowHashConfigV2 = 4 + IP_API_V2_FLOW_HASH_DST_PORT IPFlowHashConfigV2 = 8 + IP_API_V2_FLOW_HASH_PROTO IPFlowHashConfigV2 = 16 + IP_API_V2_FLOW_HASH_REVERSE IPFlowHashConfigV2 = 32 + IP_API_V2_FLOW_HASH_SYMETRIC IPFlowHashConfigV2 = 64 + IP_API_V2_FLOW_HASH_FLOW_LABEL IPFlowHashConfigV2 = 128 + IP_API_V2_FLOW_HASH_GTPV1_TEID IPFlowHashConfigV2 = 256 +) + +var ( + IPFlowHashConfigV2_name = map[uint32]string{ + 1: "IP_API_V2_FLOW_HASH_SRC_IP", + 2: "IP_API_V2_FLOW_HASH_DST_IP", + 4: "IP_API_V2_FLOW_HASH_SRC_PORT", + 8: "IP_API_V2_FLOW_HASH_DST_PORT", + 16: "IP_API_V2_FLOW_HASH_PROTO", + 32: "IP_API_V2_FLOW_HASH_REVERSE", + 64: "IP_API_V2_FLOW_HASH_SYMETRIC", + 128: "IP_API_V2_FLOW_HASH_FLOW_LABEL", + 256: "IP_API_V2_FLOW_HASH_GTPV1_TEID", + } + IPFlowHashConfigV2_value = map[string]uint32{ + "IP_API_V2_FLOW_HASH_SRC_IP": 1, + "IP_API_V2_FLOW_HASH_DST_IP": 2, + "IP_API_V2_FLOW_HASH_SRC_PORT": 4, + "IP_API_V2_FLOW_HASH_DST_PORT": 8, + "IP_API_V2_FLOW_HASH_PROTO": 16, + "IP_API_V2_FLOW_HASH_REVERSE": 32, + "IP_API_V2_FLOW_HASH_SYMETRIC": 64, + "IP_API_V2_FLOW_HASH_FLOW_LABEL": 128, + "IP_API_V2_FLOW_HASH_GTPV1_TEID": 256, + } +) + +func (x IPFlowHashConfigV2) String() string { + s, ok := IPFlowHashConfigV2_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := IPFlowHashConfigV2_name[uint32(n)] + if ok { + return s + } + return "IPFlowHashConfigV2(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1< Date: Tue, 27 Jul 2021 09:41:55 +0200 -Subject: [PATCH 1/5] pbl: Port based balancer +Subject: [PATCH 1/4] pbl: Port based balancer Type: feature @@ -34,10 +34,10 @@ Signed-off-by: Nathan Skrzypczak create mode 100644 src/plugins/pbl/pbl_node.c diff --git a/MAINTAINERS b/MAINTAINERS -index 5701ebdd9..37d183f6b 100644 +index d65be3844..63447151f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -700,6 +700,11 @@ I: svs +@@ -701,6 +701,11 @@ I: svs M: Neale Ranns F: src/plugins/svs/ diff --git a/vpplink/generated/patches/0002-cnat-WIP-no-k8s-maglev-from-pods.patch b/vpplink/generated/patches/0002-cnat-WIP-no-k8s-maglev-from-pods.patch index 64666251..510b5f52 100644 --- a/vpplink/generated/patches/0002-cnat-WIP-no-k8s-maglev-from-pods.patch +++ b/vpplink/generated/patches/0002-cnat-WIP-no-k8s-maglev-from-pods.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Mon, 8 Mar 2021 19:00:04 +0100 -Subject: [PATCH 2/5] cnat: [WIP] no k8s maglev from pods +Subject: [PATCH 2/4] cnat: [WIP] no k8s maglev from pods Type: improvement diff --git a/vpplink/generated/patches/0003-acl-acl-plugin-custom-policies.patch b/vpplink/generated/patches/0003-acl-acl-plugin-custom-policies.patch index 079ce2d1..476eddf5 100644 --- a/vpplink/generated/patches/0003-acl-acl-plugin-custom-policies.patch +++ b/vpplink/generated/patches/0003-acl-acl-plugin-custom-policies.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Tue, 28 Jul 2020 10:23:06 +0000 -Subject: [PATCH 3/5] acl: acl-plugin custom policies +Subject: [PATCH 3/4] acl: acl-plugin custom policies Type: feature Change-Id: I3117e84d9e822b68b12265e9261992e4d7f50f0f diff --git a/vpplink/generated/patches/0004-capo-Calico-Policies-plugin.patch b/vpplink/generated/patches/0004-capo-Calico-Policies-plugin.patch index 889b8f52..2f39569c 100644 --- a/vpplink/generated/patches/0004-capo-Calico-Policies-plugin.patch +++ b/vpplink/generated/patches/0004-capo-Calico-Policies-plugin.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Wed, 18 Aug 2021 20:10:22 +0200 -Subject: [PATCH 4/5] capo: Calico Policies plugin +Subject: [PATCH 4/4] capo: Calico Policies plugin New plugin that implements Calico policies and profiles in VPP. @@ -15,7 +15,7 @@ Signed-off-by: MathiasRaoul --- MAINTAINERS | 5 + src/plugins/capo/CMakeLists.txt | 28 + - src/plugins/capo/bihash_8_32.h | 107 ++++ + src/plugins/capo/bihash_8_32.h | 112 ++++ src/plugins/capo/capo.api | 261 ++++++++++ src/plugins/capo/capo.h | 59 +++ src/plugins/capo/capo_api.c | 443 ++++++++++++++++ @@ -31,7 +31,7 @@ Signed-off-by: MathiasRaoul src/plugins/capo/capo_rule.h | 91 ++++ src/plugins/capo/capo_test.c | 490 ++++++++++++++++++ src/plugins/capo/test/test_capo.py | 807 +++++++++++++++++++++++++++++ - 18 files changed, 4861 insertions(+) + 18 files changed, 4866 insertions(+) create mode 100644 src/plugins/capo/CMakeLists.txt create mode 100644 src/plugins/capo/bihash_8_32.h create mode 100644 src/plugins/capo/capo.api @@ -51,10 +51,10 @@ Signed-off-by: MathiasRaoul create mode 100644 src/plugins/capo/test/test_capo.py diff --git a/MAINTAINERS b/MAINTAINERS -index 37d183f6b..5705be32f 100644 +index 63447151f..9a0038443 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -743,6 +743,11 @@ M: Nathan Skrzypczak +@@ -744,6 +744,11 @@ M: Nathan Skrzypczak M: Neale Ranns F: src/plugins/cnat @@ -102,10 +102,10 @@ index 000000000..9fa10f710 +) diff --git a/src/plugins/capo/bihash_8_32.h b/src/plugins/capo/bihash_8_32.h new file mode 100644 -index 000000000..13748c557 +index 000000000..06cdd79e2 --- /dev/null +++ b/src/plugins/capo/bihash_8_32.h -@@ -0,0 +1,107 @@ +@@ -0,0 +1,112 @@ +/* + * Copyright (c) 2015 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); @@ -150,14 +150,19 @@ index 000000000..13748c557 + u64 value[4]; /**< the value */ +} clib_bihash_kv_8_32_t; + ++static inline void ++clib_bihash_mark_free_8_32 (clib_bihash_kv_8_32_t *v) ++{ ++ v->value[0] = 0xFEEDFACE8BADF00DULL; ++} ++ +/** Decide if a clib_bihash_kv_8_32_t instance is free + @param v- pointer to the (key,value) pair +*/ +static inline int +clib_bihash_is_free_8_32 (clib_bihash_kv_8_32_t *v) +{ -+ if (v->key == ~0ULL && v->value[0] == ~0ULL && v->value[1] == ~0ULL && -+ v->value[2] == ~0ULL && v->value[3] == ~0ULL) ++ if (v->value[0] == 0xFEEDFACE8BADF00DULL) + return 1; + return 0; +} diff --git a/vpplink/generated/patches/0005-memif-fix-socket-name-null-termination.patch b/vpplink/generated/patches/0005-memif-fix-socket-name-null-termination.patch deleted file mode 100644 index 52dfef2a..00000000 --- a/vpplink/generated/patches/0005-memif-fix-socket-name-null-termination.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nathan Skrzypczak -Date: Wed, 1 Mar 2023 18:51:22 +0100 -Subject: [PATCH 5/5] memif: fix socket name null termination - -Change-Id: I2bccc0c10c8ab2f2330cb8270cff3c10ff460280 -Signed-off-by: Nathan Skrzypczak ---- - src/plugins/memif/memif_api.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/plugins/memif/memif_api.c b/src/plugins/memif/memif_api.c -index 5d32523de..e5ed3b6af 100644 ---- a/src/plugins/memif/memif_api.c -+++ b/src/plugins/memif/memif_api.c -@@ -92,7 +92,7 @@ vl_api_memif_socket_filename_add_del_v2_t_handler ( - { - vl_api_memif_socket_filename_add_del_v2_reply_t *rmp; - memif_main_t *mm = &memif_main; -- u8 *socket_filename = 0; -+ char *socket_filename = 0; - u32 socket_id; - int rv; - -@@ -105,11 +105,11 @@ vl_api_memif_socket_filename_add_del_v2_t_handler ( - } - - /* socket filename */ -- socket_filename = vl_api_from_api_to_new_vec (mp, &mp->socket_filename); -+ socket_filename = vl_api_from_api_to_new_c_string (&mp->socket_filename); - if (mp->is_add && socket_id == (u32) ~0) - socket_id = memif_get_unused_socket_id (); - -- rv = memif_socket_filename_add_del (mp->is_add, socket_id, socket_filename); -+ rv = memif_socket_filename_add_del (mp->is_add, socket_id, (u8*)socket_filename); - - vec_free (socket_filename); - --- -2.39.2 - diff --git a/vpplink/generated/vpp_clone_current.sh b/vpplink/generated/vpp_clone_current.sh index 0b755bce..5745dee8 100755 --- a/vpplink/generated/vpp_clone_current.sh +++ b/vpplink/generated/vpp_clone_current.sh @@ -92,20 +92,13 @@ function git_clone_cd_and_reset () # --------------- Things to cherry pick --------------- -git_clone_cd_and_reset "$1" 8a0fd0669047c90d410d2ed5cb508bfe778b932a +git_clone_cd_and_reset "$1" 156d452750ab37a51984938bf4a8ab0e16650d82 -git_cherry_pick refs/changes/13/34713/4 # 34713: vppinfra: improve & test abstract socket | https://gerrit.fd.io/r/c/vpp/+/34713 -git_cherry_pick refs/changes/71/32271/16 # 32271: memif: add support for ns abstract sockets | https://gerrit.fd.io/r/c/vpp/+/32271 -git_cherry_pick refs/changes/34/34734/3 # 34734: memif: autogenerate socket_ids | https://gerrit.fd.io/r/c/vpp/+/34734 -git_cherry_pick refs/changes/26/34726/1 # 34726: interface: add buffer stats api | https://gerrit.fd.io/r/c/vpp/+/34726 -git_cherry_pick refs/changes/05/35805/2 # 35805: dpdk: add intf tag to dev{} subinput | https://gerrit.fd.io/r/c/vpp/+/35805 -git_cherry_pick refs/changes/31/37931/1 # 37931: ip: add the missing offload check | https://gerrit.fd.io/r/c/vpp/+/37931 +git_cherry_pick refs/changes/26/34726/3 # 34726: interface: add buffer stats api | https://gerrit.fd.io/r/c/vpp/+/34726 # --------------- private plugins --------------- -# Generated with 'git format-patch --zero-commit -o ./patches/ HEAD^' +# Generated with 'git format-patch --zero-commit -o ./patches/ HEAD^^^' git_apply_private 0001-pbl-Port-based-balancer.patch git_apply_private 0002-cnat-WIP-no-k8s-maglev-from-pods.patch git_apply_private 0003-acl-acl-plugin-custom-policies.patch git_apply_private 0004-capo-Calico-Policies-plugin.patch -git_apply_private 0005-memif-fix-socket-name-null-termination.patch - From 546f545e27652d87cd9136bf51475bc66e80bc7d Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Fri, 22 Oct 2021 19:28:03 +0200 Subject: [PATCH 2/2] vpp: cnat performance Signed-off-by: Nathan Skrzypczak --- calico-vpp-agent/cmd/calico_vpp_dataplane.go | 30 ++++++------ calico-vpp-agent/cni/cni_server.go | 7 ++- vpplink/cnat.go | 17 +++++-- vpplink/generated/generate.log | 9 +++- ...002-cnat-WIP-no-k8s-maglev-from-pods.patch | 49 ++++++------------- vpplink/generated/vpp_clone_current.sh | 11 +++++ 6 files changed, 68 insertions(+), 55 deletions(-) diff --git a/calico-vpp-agent/cmd/calico_vpp_dataplane.go b/calico-vpp-agent/cmd/calico_vpp_dataplane.go index 150aa370..ce322d7c 100644 --- a/calico-vpp-agent/cmd/calico_vpp_dataplane.go +++ b/calico-vpp-agent/cmd/calico_vpp_dataplane.go @@ -55,13 +55,15 @@ var ( log *logrus.Logger ) -func Go(f func(t *tomb.Tomb) error) { +func Go(f func(t *tomb.Tomb) error, name string) { if t.Alive() { + log.Infof("STARTING %s", name) t.Go(func() error { err := f(&t) if err != nil { log.Warnf("Tomb function errored with %s", err) } + log.Infof("STOPPED %s", name) return err }) } @@ -160,7 +162,7 @@ func main() { serviceServer.SetBGPConf(bgpConf) watchDog := watchdog.NewWatchDog(log.WithFields(logrus.Fields{"component": "watchDog"}), &t) - Go(policyServer.ServePolicy) + Go(policyServer.ServePolicy, "policyServer.ServePolicy") felixConfig := watchDog.Wait(policyServer.FelixConfigChan, "Waiting for FelixConfig to be provided by the calico pod") ourBGPSpec := watchDog.Wait(policyServer.GotOurNodeBGPchan, "Waiting for bgp spec to be provided on node add") if ourBGPSpec != nil { @@ -173,7 +175,7 @@ func main() { } if *config.GetCalicoVppFeatureGates().MultinetEnabled { - Go(netWatcher.WatchNetworks) + Go(netWatcher.WatchNetworks, "netWatcher.WatchNetworks") watchDog.Wait(netWatcher.InSync, "Waiting for networks to be listed and synced") } @@ -182,20 +184,20 @@ func main() { connectivityServer.SetFelixConfig(felixConfig.(*felixconfig.Config)) } - Go(routeWatcher.WatchRoutes) - Go(linkWatcher.WatchLinks) - Go(bgpConfigurationWatcher.WatchBGPConfiguration) - Go(prefixWatcher.WatchPrefix) - Go(peerWatcher.WatchBGPPeers) - Go(connectivityServer.ServeConnectivity) - Go(routingServer.ServeRouting) - Go(serviceServer.ServeService) - Go(cniServer.ServeCNI) - Go(prometheusServer.ServePrometheus) + Go(routeWatcher.WatchRoutes, "routeWatcher.WatchRoutes") + Go(linkWatcher.WatchLinks, "linkWatcher.WatchLinks") + Go(bgpConfigurationWatcher.WatchBGPConfiguration, "bgpConfigurationWatcher.WatchBGPConfiguration") + Go(prefixWatcher.WatchPrefix, "prefixWatcher.WatchPrefix") + Go(peerWatcher.WatchBGPPeers, "peerWatcher.WatchBGPPeers") + Go(connectivityServer.ServeConnectivity, "connectivityServer.ServeConnectivity") + Go(routingServer.ServeRouting, "routingServer.ServeRouting") + Go(serviceServer.ServeService, "serviceServer.ServeService") + Go(cniServer.ServeCNI, "cniServer.ServeCNI") + Go(prometheusServer.ServePrometheus, "prometheusServer.ServePrometheus") // watch LocalSID if SRv6 is enabled if *config.GetCalicoVppFeatureGates().SRv6Enabled { - Go(localSIDWatcher.WatchLocalSID) + Go(localSIDWatcher.WatchLocalSID, "localSIDWatcher.WatchLocalSID") } log.Infof("Agent started") diff --git a/calico-vpp-agent/cni/cni_server.go b/calico-vpp-agent/cni/cni_server.go index 435194bd..f17dbbea 100644 --- a/calico-vpp-agent/cni/cni_server.go +++ b/calico-vpp-agent/cni/cni_server.go @@ -373,7 +373,8 @@ func (s *Server) cniServerEventLoop(t *tomb.Tomb) error { for { select { case <-t.Dying(): - break + s.log.Warnf("CNI server asked to stop") + return nil case evt := <-s.cniEventChan: switch evt.Type { case common.FelixConfChanged: @@ -482,12 +483,14 @@ func (s *Server) ServeCNI(t *tomb.Tomb) error { } s.log.Infof("CNI Server returned") + s.grpcServer.Stop() + s.log.Infof("GRPC stopped") - s.grpcServer.GracefulStop() err = syscall.Unlink(config.CNIServerSocket) if err != nil { return err } + s.log.Infof("Socket CNI unlink") return nil } diff --git a/vpplink/cnat.go b/vpplink/cnat.go index 772f7252..c0796eab 100644 --- a/vpplink/cnat.go +++ b/vpplink/cnat.go @@ -18,6 +18,7 @@ package vpplink import ( "fmt" "net" + "github.com/pkg/errors" "github.com/projectcalico/vpp-dataplane/v3/vpplink/generated/bindings/cnat" "github.com/projectcalico/vpp-dataplane/v3/vpplink/generated/bindings/interface_types" @@ -25,9 +26,11 @@ import ( ) const ( - FeatureArcCnatInput = "ip?-unicast cnat-input-ip?" - FeatureArcCnatOutput = "ip?-output cnat-output-ip?" - FeatureArcSnat = "ip?-unicast cnat-snat-ip?" + FeatureArcCnatLookup = "ip?-unicast cnat-lookup-ip?" + FeatureArcCnatInput = "ip?-unicast cnat-input-ip?" + FeatureArcCnatOutput = "ip?-output cnat-output-ip?" + FeatureArcCnatWriteBack = "ip?-output cnat-writeback-ip?" + FeatureArcSnat = "ip?-unicast cnat-snat-ip?" ) const InvalidID = ^uint32(0) @@ -124,6 +127,14 @@ func (v *VppLink) CnatDelSnatPrefix(prefix *net.IPNet) error { } func (v *VppLink) CnatEnableFeatures(swIfIndex uint32) (err error) { + err = v.EnableFeatureArc46(swIfIndex, FeatureArcCnatLookup) + if err != nil { + return errors.Wrap(err, "Error enabling arc dnat in") + } + err = v.EnableFeatureArc46(swIfIndex, FeatureArcCnatWriteBack) + if err != nil { + return errors.Wrap(err, "Error enabling arc dnat out") + } err = v.EnableFeatureArc46(swIfIndex, FeatureArcCnatInput) if err != nil { return fmt.Errorf("enabling arc dnat input failed: %w", err) diff --git a/vpplink/generated/generate.log b/vpplink/generated/generate.log index 9aab921b..3b82e407 100755 --- a/vpplink/generated/generate.log +++ b/vpplink/generated/generate.log @@ -1,10 +1,15 @@ -VPP Version : 23.06-rc0~206-gbc006bb5a +VPP Version : 23.06-rc0~211-gf559a7816 Binapi-generator version : govpp v0.8.0-dev -VPP Base commit : 28d74a396 gerrit:34726/3 interface: add buffer stats api +VPP Base commit : 004ebac6a gerrit:34726/3 interface: add buffer stats api ------------------ Cherry picked commits -------------------- capo: Calico Policies plugin acl: acl-plugin custom policies cnat: [WIP] no k8s maglev from pods pbl: Port based balancer +gerrit:34552/8 cnat: add single lookup +gerrit:29748/5 cnat: remove rwlock on ts +gerrit:32821/6 cnat: add ip/client bihash +gerrit:34108/5 cnat: flag to disable rsession +gerrit:31449/10 cnat: dont compute offloaded cksums gerrit:34726/3 interface: add buffer stats api ------------------------------------------------------------- diff --git a/vpplink/generated/patches/0002-cnat-WIP-no-k8s-maglev-from-pods.patch b/vpplink/generated/patches/0002-cnat-WIP-no-k8s-maglev-from-pods.patch index 510b5f52..16249965 100644 --- a/vpplink/generated/patches/0002-cnat-WIP-no-k8s-maglev-from-pods.patch +++ b/vpplink/generated/patches/0002-cnat-WIP-no-k8s-maglev-from-pods.patch @@ -1,49 +1,30 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak -Date: Mon, 8 Mar 2021 19:00:04 +0100 +Date: Fri, 7 Apr 2023 16:57:30 +0200 Subject: [PATCH 2/4] cnat: [WIP] no k8s maglev from pods -Type: improvement - -Change-Id: If0702dbc51c308f0bb0ed16149c293d7adf9a984 +Change-Id: Id262a97986b6de01a42019287377486787f2e606 Signed-off-by: Nathan Skrzypczak --- - src/plugins/cnat/cnat_node_feature.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) + src/plugins/cnat/cnat_node_feature.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/cnat/cnat_node_feature.c b/src/plugins/cnat/cnat_node_feature.c -index 76aa89398..fd3b90a1a 100644 +index f6d4850f8..f2b65b2ff 100644 --- a/src/plugins/cnat/cnat_node_feature.c +++ b/src/plugins/cnat/cnat_node_feature.c -@@ -43,6 +43,7 @@ cnat_input_feature_fn (vlib_main_t *vm, vlib_node_runtime_t *node, - int session_not_found, cnat_session_t *session) - { - vlib_combined_counter_main_t *cntm = &cnat_translation_counters; -+ cnat_snat_policy_main_t *cpm = &cnat_snat_policy_main; - const cnat_translation_t *ct = NULL; - ip4_header_t *ip4 = NULL; - ip_protocol_t iproto; -@@ -53,6 +54,9 @@ cnat_input_feature_fn (vlib_main_t *vm, vlib_node_runtime_t *node, - index_t cti; - u8 trace_flags = 0; +@@ -112,7 +112,10 @@ cnat_input_feature_new_flow_inline (vlib_main_t *vm, vlib_buffer_t *b, + clib_host_to_net_u16 (trk0->ct_ep[VLIB_TX].ce_port) : + rw->tuple.port[VLIB_TX]; +- if (trk0->ct_flags & CNAT_TRK_FLAG_NO_NAT) + u32 in_if = vnet_buffer (b)->sw_if_index[VLIB_RX]; -+ int ispod; -+ - /* By default follow arc default next */ - vnet_feature_next (&next0, b); - -@@ -127,7 +131,9 @@ cnat_input_feature_fn (vlib_main_t *vm, vlib_node_runtime_t *node, - session->value.cs_port[VLIB_RX] = udp0->src_port; - session->value.flags = 0; - -- if (trk0->ct_flags & CNAT_TRK_FLAG_NO_NAT) -+ ispod = clib_bitmap_get ( -+ cpm->interface_maps[CNAT_SNAT_IF_MAP_INCLUDE_POD], in_if); -+ if (trk0->ct_flags & CNAT_TRK_FLAG_NO_NAT && !ispod) - { - const dpo_id_t *dpo0; - const load_balance_t *lb1; ++ int ispod = clib_bitmap_get ( ++ cnat_snat_policy_main.interface_maps[CNAT_SNAT_IF_MAP_INCLUDE_POD], in_if); ++ if (trk0->ct_flags & CNAT_TRK_FLAG_NO_NAT && !ispod) + { + const dpo_id_t *dpo0; + const load_balance_t *lb1; -- 2.39.2 diff --git a/vpplink/generated/vpp_clone_current.sh b/vpplink/generated/vpp_clone_current.sh index 5745dee8..65af6f11 100755 --- a/vpplink/generated/vpp_clone_current.sh +++ b/vpplink/generated/vpp_clone_current.sh @@ -96,9 +96,20 @@ git_clone_cd_and_reset "$1" 156d452750ab37a51984938bf4a8ab0e16650d82 git_cherry_pick refs/changes/26/34726/3 # 34726: interface: add buffer stats api | https://gerrit.fd.io/r/c/vpp/+/34726 +git_cherry_pick refs/changes/49/31449/10 # 31449: cnat: dont compute offloaded cksums | https://gerrit.fd.io/r/c/vpp/+/31449 +git_cherry_pick refs/changes/08/34108/5 # 34108: cnat: flag to disable rsession | https://gerrit.fd.io/r/c/vpp/+/34108 +git_cherry_pick refs/changes/21/32821/6 # 32821: cnat: add ip/client bihash | https://gerrit.fd.io/r/c/vpp/+/32821 +git_cherry_pick refs/changes/48/29748/5 # 29748: cnat: remove rwlock on ts | https://gerrit.fd.io/r/c/vpp/+/29748 +git_cherry_pick refs/changes/52/34552/8 # 34552: cnat: add single lookup | https://gerrit.fd.io/r/c/vpp/+/34552 + # --------------- private plugins --------------- # Generated with 'git format-patch --zero-commit -o ./patches/ HEAD^^^' git_apply_private 0001-pbl-Port-based-balancer.patch git_apply_private 0002-cnat-WIP-no-k8s-maglev-from-pods.patch git_apply_private 0003-acl-acl-plugin-custom-policies.patch git_apply_private 0004-capo-Calico-Policies-plugin.patch + + +# git cp 236423e261385e58556b75c9f9eb56006a2b9d67 # perf WIP +# git cp 7603fd367739e74c47349a1dd9662c78dcf9377d # capo+cnat +