diff --git a/vpplink/binapi/vpp_clone_current.sh b/vpplink/binapi/vpp_clone_current.sh index 158fa3bc4..c879aa3c9 100755 --- a/vpplink/binapi/vpp_clone_current.sh +++ b/vpplink/binapi/vpp_clone_current.sh @@ -84,7 +84,7 @@ function git_clone_cd_and_reset () # --------------- Things to cherry pick --------------- -git_clone_cd_and_reset "$1" 88019c40725704e6998625937c764d1d0c827975 +git_clone_cd_and_reset "$1" 5b9cb0d275959aeb7f4e9dfb7353b638ec9a2e5a git_cherry_pick refs/changes/12/33312/4 # 33312: sr: fix srv6 definition of behavior associated to a LocalSID | https://gerrit.fd.io/r/c/vpp/+/33312 git_cherry_pick refs/changes/13/34713/3 # 34713: vppinfra: improve & test abstract socket | https://gerrit.fd.io/r/c/vpp/+/34713 @@ -92,11 +92,17 @@ git_cherry_pick refs/changes/71/32271/15 # 32271: memif: add support for ns abst git_cherry_pick refs/changes/34/34734/2 # 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/57/34757/1 # 34757: tap: add num_tx_queues API | https://gerrit.fd.io/r/c/vpp/+/34757 +git_cherry_pick refs/changes/74/34674/1 # 34674: vppinfra: add new bihash exports | https://gerrit.fd.io/r/c/vpp/+/34674 + +git_cherry_pick refs/changes/49/31449/8 # 31449: cnat: dont compute offloaded cksums | https://gerrit.fd.io/r/c/vpp/+/31449 +git_cherry_pick refs/changes/08/34108/3 # 34108: cnat: flag to disable rsession | https://gerrit.fd.io/r/c/vpp/+/34108 +git_cherry_pick refs/changes/21/32821/4 # 32821: cnat: add ip/client bihash | https://gerrit.fd.io/r/c/vpp/+/32821 +git_cherry_pick refs/changes/48/29748/3 # 29748: cnat: remove rwlock on ts | https://gerrit.fd.io/r/c/vpp/+/29748 +git_cherry_pick refs/changes/52/34552/4 # 34552: cnat: add single lookup | https://gerrit.fd.io/r/c/vpp/+/34552 +git_cherry_pick refs/changes/88/31588/3 # 31588: cnat: [WIP] no k8s maglev from pods | https://gerrit.fd.io/r/c/vpp/+/31588 # --------------- Dedicated plugins --------------- git_cherry_pick refs/changes/64/33264/7 # 33264: pbl: Port based balancer | https://gerrit.fd.io/r/c/vpp/+/33264 -git_cherry_pick refs/changes/88/31588/1 # 31588: cnat: [WIP] no k8s maglev from pods | https://gerrit.fd.io/r/c/vpp/+/31588 git_cherry_pick refs/changes/83/28083/20 # 28083: acl: acl-plugin custom policies | https://gerrit.fd.io/r/c/vpp/+/28083 git_cherry_pick refs/changes/13/28513/24 # 25813: capo: Calico Policies plugin | https://gerrit.fd.io/r/c/vpp/+/28513 # --------------- Dedicated plugins --------------- - diff --git a/vpplink/binapi/vppapi/af_xdp/af_xdp.ba.go b/vpplink/binapi/vppapi/af_xdp/af_xdp.ba.go index f3e9da1ad..206dc9338 100644 --- a/vpplink/binapi/vppapi/af_xdp/af_xdp.ba.go +++ b/vpplink/binapi/vppapi/af_xdp/af_xdp.ba.go @@ -24,7 +24,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "af_xdp" - APIVersion = "0.2.0" + APIVersion = "1.0.0" VersionCrc = 0x346626ce ) @@ -102,7 +102,6 @@ func (x AfXdpFlag) String() string { } // AfXdpCreate defines message 'af_xdp_create'. -// InProgress: the message form may change in the future versions type AfXdpCreate struct { HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` Name string `binapi:"string[64],name=name" json:"name,omitempty"` @@ -164,7 +163,6 @@ func (m *AfXdpCreate) Unmarshal(b []byte) error { } // AfXdpCreateReply defines message 'af_xdp_create_reply'. -// InProgress: the message form may change in the future versions type AfXdpCreateReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -202,7 +200,6 @@ func (m *AfXdpCreateReply) Unmarshal(b []byte) error { } // AfXdpCreateV2 defines message 'af_xdp_create_v2'. -// InProgress: the message form may change in the future versions type AfXdpCreateV2 struct { HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` Name string `binapi:"string[64],name=name" json:"name,omitempty"` @@ -268,7 +265,6 @@ func (m *AfXdpCreateV2) Unmarshal(b []byte) error { } // AfXdpCreateV2Reply defines message 'af_xdp_create_v2_reply'. -// InProgress: the message form may change in the future versions type AfXdpCreateV2Reply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` @@ -306,7 +302,6 @@ func (m *AfXdpCreateV2Reply) Unmarshal(b []byte) error { } // AfXdpDelete defines message 'af_xdp_delete'. -// InProgress: the message form may change in the future versions type AfXdpDelete struct { SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } @@ -340,7 +335,6 @@ func (m *AfXdpDelete) Unmarshal(b []byte) error { } // AfXdpDeleteReply defines message 'af_xdp_delete_reply'. -// InProgress: the message form may change in the future versions type AfXdpDeleteReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } diff --git a/vpplink/binapi/vppapi/cnat/cnat.ba.go b/vpplink/binapi/vppapi/cnat/cnat.ba.go index 086893297..df91c8bcf 100644 --- a/vpplink/binapi/vppapi/cnat/cnat.ba.go +++ b/vpplink/binapi/vppapi/cnat/cnat.ba.go @@ -4,7 +4,7 @@ // // Contents: // 5 enums -// 4 structs +// 5 structs // 20 messages // package cnat @@ -28,7 +28,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "cnat" APIVersion = "0.2.0" - VersionCrc = 0xfd05573b + VersionCrc = 0xf3a0ede5 ) // CnatEndpointTupleFlags defines enum 'cnat_endpoint_tuple_flags'. @@ -165,15 +165,18 @@ func (x CnatSnatPolicyTable) String() string { type CnatTranslationFlags uint8 const ( - CNAT_TRANSLATION_ALLOC_PORT CnatTranslationFlags = 1 + CNAT_TRANSLATION_ALLOC_PORT CnatTranslationFlags = 1 + CNAT_TRANSLATION_NO_RETURN_SESSION CnatTranslationFlags = 4 ) var ( CnatTranslationFlags_name = map[uint8]string{ 1: "CNAT_TRANSLATION_ALLOC_PORT", + 4: "CNAT_TRANSLATION_NO_RETURN_SESSION", } CnatTranslationFlags_value = map[string]uint8{ - "CNAT_TRANSLATION_ALLOC_PORT": 1, + "CNAT_TRANSLATION_ALLOC_PORT": 1, + "CNAT_TRANSLATION_NO_RETURN_SESSION": 4, } ) @@ -204,6 +207,13 @@ func (x CnatTranslationFlags) String() string { return s } +// Cnat5tuple defines type 'cnat_5tuple'. +type Cnat5tuple struct { + Addr [2]ip_types.Address `binapi:"address[2],name=addr" json:"addr,omitempty"` + Port []uint16 `binapi:"u16[2],name=port" json:"port,omitempty"` + IPProto ip_types.IPProto `binapi:"ip_proto,name=ip_proto" json:"ip_proto,omitempty"` +} + // CnatEndpoint defines type 'cnat_endpoint'. type CnatEndpoint struct { Addr ip_types.Address `binapi:"address,name=addr" json:"addr,omitempty"` @@ -221,12 +231,9 @@ type CnatEndpointTuple struct { // CnatSession defines type 'cnat_session'. type CnatSession struct { - Src CnatEndpoint `binapi:"cnat_endpoint,name=src" json:"src,omitempty"` - Dst CnatEndpoint `binapi:"cnat_endpoint,name=dst" json:"dst,omitempty"` - New CnatEndpoint `binapi:"cnat_endpoint,name=new" json:"new,omitempty"` - IPProto ip_types.IPProto `binapi:"ip_proto,name=ip_proto" json:"ip_proto,omitempty"` - Location uint8 `binapi:"u8,name=location" json:"location,omitempty"` - Timestamp float64 `binapi:"f64,name=timestamp" json:"timestamp,omitempty"` + Tuple Cnat5tuple `binapi:"cnat_5tuple,name=tuple" json:"tuple,omitempty"` + TsIndex uint32 `binapi:"u32,name=ts_index" json:"ts_index,omitempty"` + Flags uint32 `binapi:"u32,name=flags" json:"flags,omitempty"` } // CnatTranslation defines type 'cnat_translation'. @@ -327,7 +334,7 @@ type CnatSessionDetails struct { func (m *CnatSessionDetails) Reset() { *m = CnatSessionDetails{} } func (*CnatSessionDetails) GetMessageName() string { return "cnat_session_details" } -func (*CnatSessionDetails) GetCrcString() string { return "7e5017c7" } +func (*CnatSessionDetails) GetCrcString() string { return "7a78bf3f" } func (*CnatSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -336,24 +343,14 @@ func (m *CnatSessionDetails) Size() (size int) { if m == nil { return 0 } - size += 1 // m.Session.Src.Addr.Af - size += 1 * 16 // m.Session.Src.Addr.Un - size += 4 // m.Session.Src.SwIfIndex - size += 1 // m.Session.Src.IfAf - size += 2 // m.Session.Src.Port - size += 1 // m.Session.Dst.Addr.Af - size += 1 * 16 // m.Session.Dst.Addr.Un - size += 4 // m.Session.Dst.SwIfIndex - size += 1 // m.Session.Dst.IfAf - size += 2 // m.Session.Dst.Port - size += 1 // m.Session.New.Addr.Af - size += 1 * 16 // m.Session.New.Addr.Un - size += 4 // m.Session.New.SwIfIndex - size += 1 // m.Session.New.IfAf - size += 2 // m.Session.New.Port - size += 1 // m.Session.IPProto - size += 1 // m.Session.Location - size += 8 // m.Session.Timestamp + for j3 := 0; j3 < 2; j3++ { + size += 1 // m.Session.Tuple.Addr[j3].Af + size += 1 * 16 // m.Session.Tuple.Addr[j3].Un + } + size += 2 * 2 // m.Session.Tuple.Port + size += 1 // m.Session.Tuple.IPProto + size += 4 // m.Session.TsIndex + size += 4 // m.Session.Flags return size } func (m *CnatSessionDetails) Marshal(b []byte) ([]byte, error) { @@ -361,46 +358,35 @@ func (m *CnatSessionDetails) Marshal(b []byte) ([]byte, error) { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) - buf.EncodeUint8(uint8(m.Session.Src.Addr.Af)) - buf.EncodeBytes(m.Session.Src.Addr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.Session.Src.SwIfIndex)) - buf.EncodeUint8(uint8(m.Session.Src.IfAf)) - buf.EncodeUint16(m.Session.Src.Port) - buf.EncodeUint8(uint8(m.Session.Dst.Addr.Af)) - buf.EncodeBytes(m.Session.Dst.Addr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.Session.Dst.SwIfIndex)) - buf.EncodeUint8(uint8(m.Session.Dst.IfAf)) - buf.EncodeUint16(m.Session.Dst.Port) - buf.EncodeUint8(uint8(m.Session.New.Addr.Af)) - buf.EncodeBytes(m.Session.New.Addr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.Session.New.SwIfIndex)) - buf.EncodeUint8(uint8(m.Session.New.IfAf)) - buf.EncodeUint16(m.Session.New.Port) - buf.EncodeUint8(uint8(m.Session.IPProto)) - buf.EncodeUint8(m.Session.Location) - buf.EncodeFloat64(m.Session.Timestamp) + for j2 := 0; j2 < 2; j2++ { + buf.EncodeUint8(uint8(m.Session.Tuple.Addr[j2].Af)) + buf.EncodeBytes(m.Session.Tuple.Addr[j2].Un.XXX_UnionData[:], 16) + } + for i := 0; i < 2; i++ { + var x uint16 + if i < len(m.Session.Tuple.Port) { + x = uint16(m.Session.Tuple.Port[i]) + } + buf.EncodeUint16(x) + } + buf.EncodeUint8(uint8(m.Session.Tuple.IPProto)) + buf.EncodeUint32(m.Session.TsIndex) + buf.EncodeUint32(m.Session.Flags) return buf.Bytes(), nil } func (m *CnatSessionDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.Session.Src.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Session.Src.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Session.Src.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Session.Src.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) - m.Session.Src.Port = buf.DecodeUint16() - m.Session.Dst.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Session.Dst.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Session.Dst.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Session.Dst.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) - m.Session.Dst.Port = buf.DecodeUint16() - m.Session.New.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) - copy(m.Session.New.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Session.New.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) - m.Session.New.IfAf = ip_types.AddressFamily(buf.DecodeUint8()) - m.Session.New.Port = buf.DecodeUint16() - m.Session.IPProto = ip_types.IPProto(buf.DecodeUint8()) - m.Session.Location = buf.DecodeUint8() - m.Session.Timestamp = buf.DecodeFloat64() + for j2 := 0; j2 < 2; j2++ { + m.Session.Tuple.Addr[j2].Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Session.Tuple.Addr[j2].Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + m.Session.Tuple.Port = make([]uint16, 2) + for i := 0; i < len(m.Session.Tuple.Port); i++ { + m.Session.Tuple.Port[i] = buf.DecodeUint16() + } + m.Session.Tuple.IPProto = ip_types.IPProto(buf.DecodeUint8()) + m.Session.TsIndex = buf.DecodeUint32() + m.Session.Flags = buf.DecodeUint32() return nil } @@ -1162,7 +1148,7 @@ func init() { file_cnat_binapi_init() } func file_cnat_binapi_init() { api.RegisterMessage((*CnatGetSnatAddresses)(nil), "cnat_get_snat_addresses_51077d14") api.RegisterMessage((*CnatGetSnatAddressesReply)(nil), "cnat_get_snat_addresses_reply_879513c1") - api.RegisterMessage((*CnatSessionDetails)(nil), "cnat_session_details_7e5017c7") + api.RegisterMessage((*CnatSessionDetails)(nil), "cnat_session_details_7a78bf3f") api.RegisterMessage((*CnatSessionDump)(nil), "cnat_session_dump_51077d14") api.RegisterMessage((*CnatSessionPurge)(nil), "cnat_session_purge_51077d14") api.RegisterMessage((*CnatSessionPurgeReply)(nil), "cnat_session_purge_reply_e8d4e804") diff --git a/vpplink/binapi/vppapi/generate.log b/vpplink/binapi/vppapi/generate.log index d7dd21a3e..edd1b2650 100644 --- a/vpplink/binapi/vppapi/generate.log +++ b/vpplink/binapi/vppapi/generate.log @@ -1,11 +1,17 @@ -VPP Version : 22.02-rc0~408-g2c81b117d +VPP Version : 22.02-rc0~462-g10486066f Binapi-generator version : govpp v0.4.0-dev -VPP Base commit : 88019c407 vppinfra: toeplitz hash four in parallel +VPP Base commit : 5b9cb0d27 dpdk: remove unused flag ------------------ Cherry picked commits -------------------- gerrit:28513/24 capo: Calico Policies plugin gerrit:28083/20 acl: acl-plugin custom policies -gerrit:31588/1 cnat: [WIP] no k8s maglev from pods gerrit:33264/7 pbl: Port based balancer +gerrit:31588/3 cnat: [WIP] no k8s maglev from pods +gerrit:34552/4 cnat: add single lookup +gerrit:29748/3 cnat: remove rwlock on ts +gerrit:32821/4 cnat: add ip/client bihash +gerrit:34108/3 cnat: flag to disable rsession +gerrit:31449/8 cnat: dont compute offloaded cksums +gerrit:34674/1 vppinfra: add new bihash exports gerrit:34757/1 tap: add num_tx_queues API gerrit:34726/1 interface: add buffer stats api gerrit:34734/2 memif: autogenerate socket_ids diff --git a/vpplink/cnat.go b/vpplink/cnat.go index 970591473..40cf3d666 100644 --- a/vpplink/cnat.go +++ b/vpplink/cnat.go @@ -26,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) @@ -134,6 +136,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 errors.Wrap(err, "Error enabling arc dnat in") diff --git a/vpplink/interfaces.go b/vpplink/interfaces.go index 7f697bf26..dd390acc4 100644 --- a/vpplink/interfaces.go +++ b/vpplink/interfaces.go @@ -123,6 +123,7 @@ func DefaultIntTo(value, defaultValue int) int { } func (v *VppLink) CreateTapV2(tap *types.TapV2) (swIfIndex uint32, err error) { +<<<<<<< HEAD response := &tapv2.TapCreateV3Reply{} request := &tapv2.TapCreateV3{ ID: ^uint32(0), @@ -134,6 +135,20 @@ func (v *VppLink) CreateTapV2(tap *types.TapV2) (swIfIndex uint32, err error) { RxRingSz: uint16(DefaultIntTo(tap.RxQueueSize, DEFAULT_QUEUE_SIZE)), HostMtuSize: uint32(tap.HostMtu), HostMtuSet: bool(tap.HostMtu != 0), +======= + response := &tapv2.TapCreateV2Reply{} + request := &tapv2.TapCreateV2{ + ID: ^uint32(0), + Tag: tap.Tag, + TapFlags: tapv2.TapFlags(tap.Flags), + NumRxQueues: uint8(defaultIntTo(tap.NumRxQueues, 1)), + // FIXME + // NumTxQueuesPerWorker: uint8(defaultIntTo(tap.NumTxQueues, 1)), + TxRingSz: uint16(defaultIntTo(tap.TxQueueSize, 1024)), + RxRingSz: uint16(defaultIntTo(tap.RxQueueSize, 1024)), + HostMtuSize: uint32(tap.HostMtu), + HostMtuSet: bool(tap.HostMtu != 0), +>>>>>>> 61685a5 (vpp: cnat performance) } if tap.HardwareAddr != nil { request.MacAddress = types.ToVppMacAddress(tap.HardwareAddr)