Skip to content

Commit

Permalink
vpp: cnat performance
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Skrzypczak <[email protected]>
  • Loading branch information
sknat committed Jan 6, 2022
1 parent b13eba1 commit 6afc066
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 82 deletions.
12 changes: 9 additions & 3 deletions vpplink/binapi/vpp_clone_current.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,25 @@ 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
git_cherry_pick refs/changes/71/32271/15 # 32271: memif: add support for ns abstract sockets | https://gerrit.fd.io/r/c/vpp/+/32271
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 ---------------

8 changes: 1 addition & 7 deletions vpplink/binapi/vppapi/af_xdp/af_xdp.ba.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 52 additions & 66 deletions vpplink/binapi/vppapi/cnat/cnat.ba.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions vpplink/binapi/vppapi/generate.log
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 13 additions & 3 deletions vpplink/cnat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
15 changes: 15 additions & 0 deletions vpplink/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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)
Expand Down

0 comments on commit 6afc066

Please sign in to comment.