From f4e780adb77b7959e830ba066b163e9d8706cf37 Mon Sep 17 00:00:00 2001 From: Rastislav Szabo Date: Tue, 28 Jan 2020 13:31:44 +0100 Subject: [PATCH] feat: IP flow hash settings support (#1610) * feat: IP flow hash settings support Signed-off-by: Rastislav Szabo * address review comment Signed-off-by: Rastislav Szabo --- plugins/vpp/l3plugin/descriptor/vrf_table.go | 63 +++++++- plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go | 2 + .../l3plugin/vppcalls/vpp1904/vrf_vppcalls.go | 19 +++ .../vppcalls/vpp1904/vrf_vppcalls_test.go | 27 ++++ .../l3plugin/vppcalls/vpp1908/vrf_vppcalls.go | 19 +++ .../vppcalls/vpp1908/vrf_vppcalls_test.go | 27 ++++ .../l3plugin/vppcalls/vpp2001/vrf_vppcalls.go | 19 +++ .../vppcalls/vpp2001/vrf_vppcalls_test.go | 27 ++++ .../vppcalls/vpp2001_324/vrf_vppcalls.go | 19 +++ .../vppcalls/vpp2001_324/vrf_vppcalls_test.go | 27 ++++ proto/ligato/vpp/l3/vrf.pb.go | 146 +++++++++++++++--- proto/ligato/vpp/l3/vrf.proto | 15 ++ 12 files changed, 385 insertions(+), 25 deletions(-) diff --git a/plugins/vpp/l3plugin/descriptor/vrf_table.go b/plugins/vpp/l3plugin/descriptor/vrf_table.go index fe38e1e931..8aecfd7ebe 100644 --- a/plugins/vpp/l3plugin/descriptor/vrf_table.go +++ b/plugins/vpp/l3plugin/descriptor/vrf_table.go @@ -19,6 +19,7 @@ import ( "math" "strings" + "github.com/golang/protobuf/proto" "github.com/ligato/cn-infra/idxmap" "github.com/ligato/cn-infra/logging" "github.com/pkg/errors" @@ -70,6 +71,8 @@ func NewVrfTableDescriptor( ValueComparator: ctx.EquivalentVrfTables, Validate: ctx.Validate, Create: ctx.Create, + Update: ctx.Update, + UpdateWithRecreate: ctx.UpdateWithRecreate, Delete: ctx.Delete, Retrieve: ctx.Retrieve, } @@ -78,7 +81,8 @@ func NewVrfTableDescriptor( // EquivalentVrfTables is a comparison function for l3.VrfTable. func (d *VrfTableDescriptor) EquivalentVrfTables(key string, oldVrfTable, newVrfTable *l3.VrfTable) bool { - if getVrfTableLabel(oldVrfTable) != getVrfTableLabel(newVrfTable) { + if getVrfTableLabel(oldVrfTable) != getVrfTableLabel(newVrfTable) || + !proto.Equal(oldVrfTable.FlowHashSettings, newVrfTable.FlowHashSettings) { return false } return true @@ -99,14 +103,18 @@ func (d *VrfTableDescriptor) Validate(key string, vrfTable *l3.VrfTable) (err er // Create adds VPP VRF table. func (d *VrfTableDescriptor) Create(key string, vrfTable *l3.VrfTable) (metadata *vrfidx.VRFMetadata, err error) { - if vrfTable.Id == 0 { - // nothing to do, automatically created by VPP - } err = d.vtHandler.AddVrfTable(vrfTable) if err != nil { return nil, err } + if vrfTable.FlowHashSettings != nil { + err = d.vtHandler.SetVrfFlowHashSettings(vrfTable.Id, vrfTable.Protocol == l3.VrfTable_IPV6, vrfTable.FlowHashSettings) + if err != nil { + return nil, err + } + } + // fill the metadata metadata = &vrfidx.VRFMetadata{ Index: vrfTable.Id, @@ -116,11 +124,36 @@ func (d *VrfTableDescriptor) Create(key string, vrfTable *l3.VrfTable) (metadata return metadata, nil } +// UpdateWithRecreate returns true if a VRF update needs to be performed via re-crate. +func (d *VrfTableDescriptor) UpdateWithRecreate(_ string, oldVrfTable, newVrfTable *l3.VrfTable, _ *vrfidx.VRFMetadata) bool { + if oldVrfTable.Protocol == newVrfTable.Protocol && oldVrfTable.Id == newVrfTable.Id { + return false + } + return true // protocol or VRF ID changed = recreate +} + +// Update updates VPP VRF table (ony if protocol or VRF ID has not changed). +func (d *VrfTableDescriptor) Update(_ string, oldVrfTable, newVrfTable *l3.VrfTable, _ *vrfidx.VRFMetadata) ( + metadata *vrfidx.VRFMetadata, err error) { + + if !proto.Equal(oldVrfTable.FlowHashSettings, newVrfTable.FlowHashSettings) { + newSettings := newVrfTable.FlowHashSettings + if newSettings == nil { + newSettings = defaultVrfFlowHashSettings() + } + err = d.vtHandler.SetVrfFlowHashSettings(newVrfTable.Id, newVrfTable.Protocol == l3.VrfTable_IPV6, newSettings) + } + + // fill the metadata + metadata = &vrfidx.VRFMetadata{ + Index: newVrfTable.Id, + Protocol: newVrfTable.Protocol, + } + return metadata, err +} + // Delete removes VPP VRF table. func (d *VrfTableDescriptor) Delete(key string, vrfTable *l3.VrfTable, metadata *vrfidx.VRFMetadata) error { - if vrfTable.Id == 0 { - // nothing to do, VRF ID=0 always exists - } err := d.vtHandler.DelVrfTable(vrfTable) if err != nil { return err @@ -138,6 +171,9 @@ func (d *VrfTableDescriptor) Retrieve(correlate []adapter.VrfTableKVWithMetadata return nil, errors.Errorf("failed to dump VPP VRF tables: %v", err) } + // TODO: implement flow hash settings dump once supported by VPP (https://jira.fd.io/browse/VPP-1829) + // (until implemented, resync will always re-configure flow hash settings if non-default settings are used) + for _, table := range tables { origin := kvs.UnknownOrigin // VRF with ID=0 and ID=MaxUint32 are special @@ -167,3 +203,16 @@ func getVrfTableLabel(vrfTable *l3.VrfTable) string { } return vrfTable.Label } + +// defaultVrfFlowHashSettings returns default flow hash settings (implicitly existing if not set). +func defaultVrfFlowHashSettings() *l3.VrfTable_FlowHashSettings { + return &l3.VrfTable_FlowHashSettings{ + UseSrcIp: true, + UseDstIp: true, + UseSrcPort: true, + UseDstPort: true, + UseProtocol: true, + Symmetric: false, + Reverse: false, + } +} diff --git a/plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go index f2531a22a9..fd07c19dab 100644 --- a/plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go +++ b/plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go @@ -186,6 +186,8 @@ type VrfTableVppAPI interface { AddVrfTable(table *l3.VrfTable) error // DelVrfTable deletes existing VRF table. DelVrfTable(table *l3.VrfTable) error + // SetVrfFlowHashSettings sets IP flow hash settings for a VRF table. + SetVrfFlowHashSettings(vrfID uint32, isIPv6 bool, hashFields *l3.VrfTable_FlowHashSettings) error } // VrfTableVppRead provides read methods for VRF tables. diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1904/vrf_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1904/vrf_vppcalls.go index 9eb10307ab..c4a4fc1fda 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp1904/vrf_vppcalls.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp1904/vrf_vppcalls.go @@ -44,3 +44,22 @@ func (h *VrfTableHandler) addDelVrfTable(table *l3.VrfTable, isAdd bool) error { return nil } + +// SetVrfFlowHashSettings sets IP flow hash settings for a VRF table. +func (h *VrfTableHandler) SetVrfFlowHashSettings(vrfID uint32, isIPv6 bool, hashFields *l3.VrfTable_FlowHashSettings) error { + req := &ip.SetIPFlowHash{ + VrfID: vrfID, + IsIPv6: boolToUint(isIPv6), + Src: boolToUint(hashFields.UseSrcIp), + Dst: boolToUint(hashFields.UseDstIp), + Sport: boolToUint(hashFields.UseSrcPort), + Dport: boolToUint(hashFields.UseDstPort), + Proto: boolToUint(hashFields.UseProtocol), + Reverse: boolToUint(hashFields.Reverse), + Symmetric: boolToUint(hashFields.Symmetric), + } + reply := &ip.SetIPFlowHashReply{} + + err := h.callsChannel.SendRequest(req).ReceiveReply(reply) + return err +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1904/vrf_vppcalls_test.go b/plugins/vpp/l3plugin/vppcalls/vpp1904/vrf_vppcalls_test.go index 551190605c..c9bd3d511b 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp1904/vrf_vppcalls_test.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp1904/vrf_vppcalls_test.go @@ -130,6 +130,33 @@ func TestDeleteVrfTable(t *testing.T) { Expect(err).To(Not(BeNil())) } +// Test VRF flow hash settings +func TestVrfFlowHashSettings(t *testing.T) { + ctx, vtHandler := vrfTableTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.SetIPFlowHashReply{}) + err := vtHandler.SetVrfFlowHashSettings(5, true, + &l3.VrfTable_FlowHashSettings{ + UseSrcIp: true, + UseSrcPort: true, + Symmetric: true, + }) + Expect(err).To(Succeed()) + + vppMsg, ok := ctx.MockChannel.Msg.(*ip.SetIPFlowHash) + Expect(ok).To(BeTrue()) + Expect(vppMsg.VrfID).To(BeEquivalentTo(5)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(1)) + Expect(vppMsg.Src).To(BeEquivalentTo(1)) + Expect(vppMsg.Dst).To(BeEquivalentTo(0)) + Expect(vppMsg.Sport).To(BeEquivalentTo(1)) + Expect(vppMsg.Dport).To(BeEquivalentTo(0)) + Expect(vppMsg.Proto).To(BeEquivalentTo(0)) + Expect(vppMsg.Symmetric).To(BeEquivalentTo(1)) + Expect(vppMsg.Reverse).To(BeEquivalentTo(0)) +} + func vrfTableTestSetup(t *testing.T) (*vppmock.TestCtx, vppcalls.VrfTableVppAPI) { ctx := vppmock.SetupTestCtx(t) log := logrus.NewLogger("test-log") diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls.go index f10c7de2a8..928e3c8162 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls.go @@ -46,3 +46,22 @@ func (h *VrfTableHandler) addDelVrfTable(table *l3.VrfTable, isAdd bool) error { return nil } + +// SetVrfFlowHashSettings sets IP flow hash settings for a VRF table. +func (h *VrfTableHandler) SetVrfFlowHashSettings(vrfID uint32, isIPv6 bool, hashFields *l3.VrfTable_FlowHashSettings) error { + req := &ip.SetIPFlowHash{ + VrfID: vrfID, + IsIPv6: boolToUint(isIPv6), + Src: boolToUint(hashFields.UseSrcIp), + Dst: boolToUint(hashFields.UseDstIp), + Sport: boolToUint(hashFields.UseSrcPort), + Dport: boolToUint(hashFields.UseDstPort), + Proto: boolToUint(hashFields.UseProtocol), + Reverse: boolToUint(hashFields.Reverse), + Symmetric: boolToUint(hashFields.Symmetric), + } + reply := &ip.SetIPFlowHashReply{} + + err := h.callsChannel.SendRequest(req).ReceiveReply(reply) + return err +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls_test.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls_test.go index c4ac8035a3..bf784156c2 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls_test.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls_test.go @@ -130,6 +130,33 @@ func TestDeleteVrfTable(t *testing.T) { Expect(err).To(Not(BeNil())) } +// Test VRF flow hash settings +func TestVrfFlowHashSettings(t *testing.T) { + ctx, vtHandler := vrfTableTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.SetIPFlowHashReply{}) + err := vtHandler.SetVrfFlowHashSettings(5, true, + &l3.VrfTable_FlowHashSettings{ + UseSrcIp: true, + UseSrcPort: true, + Symmetric: true, + }) + Expect(err).To(Succeed()) + + vppMsg, ok := ctx.MockChannel.Msg.(*ip.SetIPFlowHash) + Expect(ok).To(BeTrue()) + Expect(vppMsg.VrfID).To(BeEquivalentTo(5)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(1)) + Expect(vppMsg.Src).To(BeEquivalentTo(1)) + Expect(vppMsg.Dst).To(BeEquivalentTo(0)) + Expect(vppMsg.Sport).To(BeEquivalentTo(1)) + Expect(vppMsg.Dport).To(BeEquivalentTo(0)) + Expect(vppMsg.Proto).To(BeEquivalentTo(0)) + Expect(vppMsg.Symmetric).To(BeEquivalentTo(1)) + Expect(vppMsg.Reverse).To(BeEquivalentTo(0)) +} + func vrfTableTestSetup(t *testing.T) (*vppmock.TestCtx, vppcalls.VrfTableVppAPI) { ctx := vppmock.SetupTestCtx(t) log := logrus.NewLogger("test-log") diff --git a/plugins/vpp/l3plugin/vppcalls/vpp2001/vrf_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp2001/vrf_vppcalls.go index ea301b6e4f..773c093a14 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp2001/vrf_vppcalls.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp2001/vrf_vppcalls.go @@ -46,3 +46,22 @@ func (h *VrfTableHandler) addDelVrfTable(table *l3.VrfTable, isAdd bool) error { return nil } + +// SetVrfFlowHashSettings sets IP flow hash settings for a VRF table. +func (h *VrfTableHandler) SetVrfFlowHashSettings(vrfID uint32, isIPv6 bool, hashFields *l3.VrfTable_FlowHashSettings) error { + req := &vpp_ip.SetIPFlowHash{ + VrfID: vrfID, + IsIPv6: boolToUint(isIPv6), + Src: boolToUint(hashFields.UseSrcIp), + Dst: boolToUint(hashFields.UseDstIp), + Sport: boolToUint(hashFields.UseSrcPort), + Dport: boolToUint(hashFields.UseDstPort), + Proto: boolToUint(hashFields.UseProtocol), + Reverse: boolToUint(hashFields.Reverse), + Symmetric: boolToUint(hashFields.Symmetric), + } + reply := &vpp_ip.SetIPFlowHashReply{} + + err := h.callsChannel.SendRequest(req).ReceiveReply(reply) + return err +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp2001/vrf_vppcalls_test.go b/plugins/vpp/l3plugin/vppcalls/vpp2001/vrf_vppcalls_test.go index 3b85cb6117..7165a35055 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp2001/vrf_vppcalls_test.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp2001/vrf_vppcalls_test.go @@ -130,6 +130,33 @@ func TestDeleteVrfTable(t *testing.T) { Expect(err).To(Not(BeNil())) } +// Test VRF flow hash settings +func TestVrfFlowHashSettings(t *testing.T) { + ctx, vtHandler := vrfTableTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vpp_ip.SetIPFlowHashReply{}) + err := vtHandler.SetVrfFlowHashSettings(5, true, + &l3.VrfTable_FlowHashSettings{ + UseSrcIp: true, + UseSrcPort: true, + Symmetric: true, + }) + Expect(err).To(Succeed()) + + vppMsg, ok := ctx.MockChannel.Msg.(*vpp_ip.SetIPFlowHash) + Expect(ok).To(BeTrue()) + Expect(vppMsg.VrfID).To(BeEquivalentTo(5)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(1)) + Expect(vppMsg.Src).To(BeEquivalentTo(1)) + Expect(vppMsg.Dst).To(BeEquivalentTo(0)) + Expect(vppMsg.Sport).To(BeEquivalentTo(1)) + Expect(vppMsg.Dport).To(BeEquivalentTo(0)) + Expect(vppMsg.Proto).To(BeEquivalentTo(0)) + Expect(vppMsg.Symmetric).To(BeEquivalentTo(1)) + Expect(vppMsg.Reverse).To(BeEquivalentTo(0)) +} + func vrfTableTestSetup(t *testing.T) (*vppmock.TestCtx, vppcalls.VrfTableVppAPI) { ctx := vppmock.SetupTestCtx(t) log := logrus.NewLogger("test-log") diff --git a/plugins/vpp/l3plugin/vppcalls/vpp2001_324/vrf_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp2001_324/vrf_vppcalls.go index 453fd8f42c..609d25d556 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp2001_324/vrf_vppcalls.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp2001_324/vrf_vppcalls.go @@ -46,3 +46,22 @@ func (h *VrfTableHandler) addDelVrfTable(table *l3.VrfTable, isAdd bool) error { return nil } + +// SetVrfFlowHashSettings sets IP flow hash settings for a VRF table. +func (h *VrfTableHandler) SetVrfFlowHashSettings(vrfID uint32, isIPv6 bool, hashFields *l3.VrfTable_FlowHashSettings) error { + req := &vpp_ip.SetIPFlowHash{ + VrfID: vrfID, + IsIPv6: boolToUint(isIPv6), + Src: boolToUint(hashFields.UseSrcIp), + Dst: boolToUint(hashFields.UseDstIp), + Sport: boolToUint(hashFields.UseSrcPort), + Dport: boolToUint(hashFields.UseDstPort), + Proto: boolToUint(hashFields.UseProtocol), + Reverse: boolToUint(hashFields.Reverse), + Symmetric: boolToUint(hashFields.Symmetric), + } + reply := &vpp_ip.SetIPFlowHashReply{} + + err := h.callsChannel.SendRequest(req).ReceiveReply(reply) + return err +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp2001_324/vrf_vppcalls_test.go b/plugins/vpp/l3plugin/vppcalls/vpp2001_324/vrf_vppcalls_test.go index 974b6b8479..0190af7158 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp2001_324/vrf_vppcalls_test.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp2001_324/vrf_vppcalls_test.go @@ -130,6 +130,33 @@ func TestDeleteVrfTable(t *testing.T) { Expect(err).To(Not(BeNil())) } +// Test VRF flow hash settings +func TestVrfFlowHashSettings(t *testing.T) { + ctx, vtHandler := vrfTableTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vpp_ip.SetIPFlowHashReply{}) + err := vtHandler.SetVrfFlowHashSettings(5, true, + &l3.VrfTable_FlowHashSettings{ + UseSrcIp: true, + UseSrcPort: true, + Symmetric: true, + }) + Expect(err).To(Succeed()) + + vppMsg, ok := ctx.MockChannel.Msg.(*vpp_ip.SetIPFlowHash) + Expect(ok).To(BeTrue()) + Expect(vppMsg.VrfID).To(BeEquivalentTo(5)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(1)) + Expect(vppMsg.Src).To(BeEquivalentTo(1)) + Expect(vppMsg.Dst).To(BeEquivalentTo(0)) + Expect(vppMsg.Sport).To(BeEquivalentTo(1)) + Expect(vppMsg.Dport).To(BeEquivalentTo(0)) + Expect(vppMsg.Proto).To(BeEquivalentTo(0)) + Expect(vppMsg.Symmetric).To(BeEquivalentTo(1)) + Expect(vppMsg.Reverse).To(BeEquivalentTo(0)) +} + func vrfTableTestSetup(t *testing.T) (*vppmock.TestCtx, vppcalls.VrfTableVppAPI) { ctx := vppmock.SetupTestCtx(t) log := logrus.NewLogger("test-log") diff --git a/proto/ligato/vpp/l3/vrf.pb.go b/proto/ligato/vpp/l3/vrf.pb.go index 683e352941..ae04162128 100644 --- a/proto/ligato/vpp/l3/vrf.pb.go +++ b/proto/ligato/vpp/l3/vrf.pb.go @@ -56,10 +56,11 @@ type VrfTable struct { // - maximum allowed length is 63 characters // - included in the output from the VPP CLI command "show ip fib" // - if undefined, then VPP will generate label using the template "-VRF:" - Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + FlowHashSettings *VrfTable_FlowHashSettings `protobuf:"bytes,4,opt,name=flow_hash_settings,json=flowHashSettings,proto3" json:"flow_hash_settings,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *VrfTable) Reset() { *m = VrfTable{} } @@ -108,26 +109,135 @@ func (m *VrfTable) GetLabel() string { return "" } +func (m *VrfTable) GetFlowHashSettings() *VrfTable_FlowHashSettings { + if m != nil { + return m.FlowHashSettings + } + return nil +} + +// FlowHashSettings allows tuning of hash calculation of IP flows in the VRF table. +// This affects hash table size as well as the stickiness of flows by load-balancing. +// If not defined, default settings that are implicitly enabled are: +// - use_src_ip, use_dst_ip, use_src_port, use_dst_port, use_protocol +type VrfTable_FlowHashSettings struct { + UseSrcIp bool `protobuf:"varint,1,opt,name=use_src_ip,json=useSrcIp,proto3" json:"use_src_ip,omitempty"` + UseDstIp bool `protobuf:"varint,2,opt,name=use_dst_ip,json=useDstIp,proto3" json:"use_dst_ip,omitempty"` + UseSrcPort bool `protobuf:"varint,3,opt,name=use_src_port,json=useSrcPort,proto3" json:"use_src_port,omitempty"` + UseDstPort bool `protobuf:"varint,4,opt,name=use_dst_port,json=useDstPort,proto3" json:"use_dst_port,omitempty"` + UseProtocol bool `protobuf:"varint,5,opt,name=use_protocol,json=useProtocol,proto3" json:"use_protocol,omitempty"` + Reverse bool `protobuf:"varint,6,opt,name=reverse,proto3" json:"reverse,omitempty"` + Symmetric bool `protobuf:"varint,7,opt,name=symmetric,proto3" json:"symmetric,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VrfTable_FlowHashSettings) Reset() { *m = VrfTable_FlowHashSettings{} } +func (m *VrfTable_FlowHashSettings) String() string { return proto.CompactTextString(m) } +func (*VrfTable_FlowHashSettings) ProtoMessage() {} +func (*VrfTable_FlowHashSettings) Descriptor() ([]byte, []int) { + return fileDescriptor_4ba58f73bd5b6328, []int{0, 0} +} + +func (m *VrfTable_FlowHashSettings) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_VrfTable_FlowHashSettings.Unmarshal(m, b) +} +func (m *VrfTable_FlowHashSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_VrfTable_FlowHashSettings.Marshal(b, m, deterministic) +} +func (m *VrfTable_FlowHashSettings) XXX_Merge(src proto.Message) { + xxx_messageInfo_VrfTable_FlowHashSettings.Merge(m, src) +} +func (m *VrfTable_FlowHashSettings) XXX_Size() int { + return xxx_messageInfo_VrfTable_FlowHashSettings.Size(m) +} +func (m *VrfTable_FlowHashSettings) XXX_DiscardUnknown() { + xxx_messageInfo_VrfTable_FlowHashSettings.DiscardUnknown(m) +} + +var xxx_messageInfo_VrfTable_FlowHashSettings proto.InternalMessageInfo + +func (m *VrfTable_FlowHashSettings) GetUseSrcIp() bool { + if m != nil { + return m.UseSrcIp + } + return false +} + +func (m *VrfTable_FlowHashSettings) GetUseDstIp() bool { + if m != nil { + return m.UseDstIp + } + return false +} + +func (m *VrfTable_FlowHashSettings) GetUseSrcPort() bool { + if m != nil { + return m.UseSrcPort + } + return false +} + +func (m *VrfTable_FlowHashSettings) GetUseDstPort() bool { + if m != nil { + return m.UseDstPort + } + return false +} + +func (m *VrfTable_FlowHashSettings) GetUseProtocol() bool { + if m != nil { + return m.UseProtocol + } + return false +} + +func (m *VrfTable_FlowHashSettings) GetReverse() bool { + if m != nil { + return m.Reverse + } + return false +} + +func (m *VrfTable_FlowHashSettings) GetSymmetric() bool { + if m != nil { + return m.Symmetric + } + return false +} + func init() { proto.RegisterEnum("ligato.vpp.l3.VrfTable_Protocol", VrfTable_Protocol_name, VrfTable_Protocol_value) proto.RegisterType((*VrfTable)(nil), "ligato.vpp.l3.VrfTable") + proto.RegisterType((*VrfTable_FlowHashSettings)(nil), "ligato.vpp.l3.VrfTable.FlowHashSettings") } func init() { proto.RegisterFile("ligato/vpp/l3/vrf.proto", fileDescriptor_4ba58f73bd5b6328) } var fileDescriptor_4ba58f73bd5b6328 = []byte{ - // 196 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0xc9, 0x4c, 0x4f, - 0x2c, 0xc9, 0xd7, 0x2f, 0x2b, 0x28, 0xd0, 0xcf, 0x31, 0xd6, 0x2f, 0x2b, 0x4a, 0xd3, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x48, 0xe8, 0x95, 0x15, 0x14, 0xe8, 0xe5, 0x18, 0x2b, 0xf5, - 0x31, 0x72, 0x71, 0x84, 0x15, 0xa5, 0x85, 0x24, 0x26, 0xe5, 0xa4, 0x0a, 0xf1, 0x71, 0x31, 0x65, - 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x06, 0x31, 0x65, 0xa6, 0x08, 0xd9, 0x70, 0x71, 0x80, - 0x35, 0x25, 0xe7, 0xe7, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xf0, 0x19, 0x29, 0xe8, 0xa1, 0x68, 0xd7, - 0x83, 0x69, 0xd5, 0x0b, 0x80, 0xaa, 0x0b, 0x82, 0xeb, 0x10, 0x12, 0xe1, 0x62, 0xcd, 0x49, 0x4c, - 0x4a, 0xcd, 0x91, 0x60, 0x56, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x70, 0x94, 0xe4, 0xb8, 0x38, 0x60, - 0x6a, 0x85, 0x38, 0xb8, 0x58, 0x3c, 0x03, 0xc2, 0x4c, 0x04, 0x18, 0xa0, 0x2c, 0x33, 0x01, 0x46, - 0x27, 0xb3, 0x28, 0x93, 0xf4, 0x7c, 0x98, 0x2d, 0x99, 0x60, 0x0f, 0xe8, 0x26, 0xa6, 0xa7, 0xe6, - 0x95, 0xe8, 0x97, 0x19, 0xeb, 0x83, 0xcd, 0xd6, 0x47, 0xf1, 0x9a, 0x75, 0x59, 0x41, 0x41, 0x7c, - 0x8e, 0x71, 0x12, 0x1b, 0x58, 0xce, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xa7, 0xf4, 0xfe, 0xe4, - 0xf9, 0x00, 0x00, 0x00, + // 356 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x4f, 0x6b, 0xf2, 0x40, + 0x10, 0x87, 0xdf, 0xc4, 0x7f, 0x71, 0x7c, 0x95, 0xb0, 0x14, 0x1a, 0x8a, 0x94, 0xd4, 0x53, 0x2e, + 0x4d, 0xc0, 0x88, 0x97, 0xf6, 0x54, 0xa4, 0xd4, 0x9b, 0xc4, 0xe2, 0xa1, 0x97, 0x10, 0xe3, 0x26, + 0x06, 0x56, 0x77, 0xd9, 0x5d, 0x23, 0xfd, 0xa2, 0xfd, 0x16, 0xfd, 0x0e, 0xc5, 0x8d, 0x9b, 0xa2, + 0xd0, 0x5b, 0x76, 0x7e, 0xcf, 0x33, 0x64, 0x86, 0x81, 0x5b, 0x52, 0xe4, 0x89, 0xa4, 0x41, 0xc9, + 0x58, 0x40, 0xc2, 0xa0, 0xe4, 0x99, 0xcf, 0x38, 0x95, 0x14, 0xf5, 0xab, 0xc0, 0x2f, 0x19, 0xf3, + 0x49, 0x38, 0xfa, 0x6a, 0x80, 0xb5, 0xe2, 0xd9, 0x7b, 0xb2, 0x26, 0x18, 0x0d, 0xc0, 0x2c, 0x36, + 0x8e, 0xe1, 0x1a, 0x5e, 0x3f, 0x32, 0x8b, 0x0d, 0x7a, 0x06, 0x4b, 0x49, 0x29, 0x25, 0x8e, 0xe9, + 0x1a, 0xde, 0x60, 0xec, 0xfa, 0x17, 0xba, 0xaf, 0x55, 0x7f, 0x71, 0xe6, 0xa2, 0xda, 0x40, 0x37, + 0xd0, 0x22, 0xc9, 0x1a, 0x13, 0xa7, 0xe1, 0x1a, 0x5e, 0x37, 0xaa, 0x1e, 0x68, 0x05, 0x28, 0x23, + 0xf4, 0x18, 0x6f, 0x13, 0xb1, 0x8d, 0x05, 0x96, 0xb2, 0xd8, 0xe7, 0xc2, 0x69, 0xba, 0x86, 0xd7, + 0x1b, 0x7b, 0x7f, 0x75, 0x7f, 0x25, 0xf4, 0xf8, 0x96, 0x88, 0xed, 0xf2, 0xcc, 0x47, 0x76, 0x76, + 0x55, 0xb9, 0xfb, 0x36, 0xc0, 0xbe, 0xc6, 0xd0, 0x10, 0xe0, 0x20, 0x70, 0x2c, 0x78, 0x1a, 0x17, + 0x4c, 0x0d, 0x66, 0x45, 0xd6, 0x41, 0xe0, 0x25, 0x4f, 0xe7, 0x4c, 0xa7, 0x1b, 0x21, 0x4f, 0xa9, + 0x59, 0xa7, 0x33, 0x21, 0xe7, 0x0c, 0xb9, 0xf0, 0x5f, 0xbb, 0x8c, 0x72, 0xa9, 0xa6, 0xb0, 0x22, + 0xa8, 0xec, 0x05, 0xe5, 0x52, 0x13, 0x27, 0x5f, 0x11, 0xcd, 0x9a, 0x98, 0x09, 0xa9, 0x88, 0x87, + 0x8a, 0xa8, 0x97, 0xd8, 0x52, 0x44, 0xef, 0x20, 0xb0, 0xde, 0x17, 0x72, 0xa0, 0xc3, 0x71, 0x89, + 0xb9, 0xc0, 0x4e, 0x5b, 0xa5, 0xfa, 0x89, 0x86, 0xd0, 0x15, 0x9f, 0xbb, 0x1d, 0x96, 0xbc, 0x48, + 0x9d, 0x8e, 0xca, 0x7e, 0x0b, 0xa3, 0x7b, 0xb0, 0xea, 0x1e, 0x16, 0x34, 0xe7, 0x8b, 0xd5, 0xc4, + 0xfe, 0x77, 0xfe, 0x9a, 0xda, 0xc6, 0xcb, 0xf4, 0x63, 0x92, 0x53, 0xbd, 0xcf, 0x42, 0x1d, 0xc2, + 0x63, 0x92, 0xe3, 0xbd, 0x0c, 0xca, 0x30, 0x50, 0x3f, 0x14, 0x5c, 0x9c, 0xc8, 0x53, 0xc9, 0x58, + 0x4c, 0xc2, 0x75, 0x5b, 0x65, 0xe1, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc9, 0xbd, 0x72, 0xd7, + 0x41, 0x02, 0x00, 0x00, } diff --git a/proto/ligato/vpp/l3/vrf.proto b/proto/ligato/vpp/l3/vrf.proto index d31237eb6a..a1d8c74eef 100644 --- a/proto/ligato/vpp/l3/vrf.proto +++ b/proto/ligato/vpp/l3/vrf.proto @@ -22,4 +22,19 @@ message VrfTable { // - included in the output from the VPP CLI command "show ip fib" // - if undefined, then VPP will generate label using the template "-VRF:" string label = 3; + + // FlowHashSettings allows tuning of hash calculation of IP flows in the VRF table. + // This affects hash table size as well as the stickiness of flows by load-balancing. + // If not defined, default settings that are implicitly enabled are: + // - use_src_ip, use_dst_ip, use_src_port, use_dst_port, use_protocol + message FlowHashSettings { + bool use_src_ip = 1; + bool use_dst_ip = 2; + bool use_src_port = 3; + bool use_dst_port = 4; + bool use_protocol = 5; + bool reverse = 6; + bool symmetric = 7; + } + FlowHashSettings flow_hash_settings = 4; }