Skip to content

Commit 4db4d1f

Browse files
committed
mk: upgrade to Go 1.21
1 parent dd7f7fd commit 4db4d1f

File tree

51 files changed

+103
-98
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+103
-98
lines changed

.clang-format

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ ForEachMacros:
1111
- cds_lfht_for_each
1212
- cds_list_for_each_safe
1313
- HASH_ITER
14-
- PitDnIt_Each
15-
- PitUpIt_Each
14+
- PitDn_Each
15+
- PitUp_Each
1616
- TlvDecoder_EachTL
1717
FixNamespaceComments: true
1818
IncludeIsMainRegex: '(\.t)?$'

.github/workflows/build.yml

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
run: |
2121
docs/ndndpdk-depends.sh -y --node=0 --go=0 --dpdk=0 --spdk=0
2222
echo meson=$(meson --version) >> $GITHUB_OUTPUT
23+
sudo update-alternatives --install /usr/bin/go go $(command -v go) 1
2324
- name: Cache DPDK and SPDK
2425
uses: actions/cache@v3
2526
with:
@@ -123,3 +124,4 @@ jobs:
123124
run: |
124125
tinygo build -o /dev/null -target=wasm ./ndn/ndntestenv/tiny
125126
make -C sample/wasm
127+
continue-on-error: true

app/fetch/fetcher.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package fetch
77
import "C"
88
import (
99
"errors"
10+
"maps"
1011
"math"
1112

1213
"github.com/usnistgov/ndn-dpdk/app/tg/tgdef"
@@ -15,7 +16,6 @@ import (
1516
"github.com/usnistgov/ndn-dpdk/dpdk/ealthread"
1617
"github.com/usnistgov/ndn-dpdk/iface"
1718
"github.com/zyedidia/generic"
18-
"golang.org/x/exp/maps"
1919
)
2020

2121
var logger = logging.New("fetch")

app/fileserver/config.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ type Config struct {
111111

112112
// Validate applies defaults and validates the configuration.
113113
func (cfg *Config) Validate() error {
114-
cfg.NThreads = generic.Max(1, cfg.NThreads)
114+
cfg.NThreads = max(1, cfg.NThreads)
115115

116116
cfg.RxQueue.DisableCoDel = true
117117

@@ -197,7 +197,7 @@ func (cfg *Config) checkPayloadMempool() error {
197197
}
198198

199199
suggestDataroom := pktmbuf.DefaultHeadroom + ndni.NameMaxLength +
200-
generic.Max(cfg.SegmentLen, ndni.NameMaxLength+EstimatedMetadataSize) + ndni.DataEncNullSigLen + 64
200+
max(cfg.SegmentLen, ndni.NameMaxLength+EstimatedMetadataSize) + ndni.DataEncNullSigLen + 64
201201
if tpl.Dataroom < suggestDataroom {
202202
logger.Warn("PAYLOAD dataroom too small for configured segmentLen, Interests with long names may be dropped",
203203
zap.Int("configured-dataroom", tpl.Dataroom),
@@ -206,7 +206,7 @@ func (cfg *Config) checkPayloadMempool() error {
206206
)
207207
}
208208

209-
cfg.payloadHeadroom = tpl.Dataroom - ndni.DataEncNullSigLen - generic.Max(cfg.SegmentLen, EstimatedMetadataSize)
209+
cfg.payloadHeadroom = tpl.Dataroom - ndni.DataEncNullSigLen - max(cfg.SegmentLen, EstimatedMetadataSize)
210210
if cfg.payloadHeadroom < pktmbuf.DefaultHeadroom {
211211
return fmt.Errorf("PAYLOAD dataroom %d too small for segmentLen %d; increase PAYLOAD dataroom to %d",
212212
tpl.Dataroom, cfg.SegmentLen, suggestDataroom)

app/fileserver/server_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"math/rand"
1313
"os"
1414
"path"
15+
"slices"
1516
"strconv"
1617
"sync"
1718
"sync/atomic"
@@ -34,9 +35,7 @@ import (
3435
"github.com/usnistgov/ndn-dpdk/ndn/rdr/ndn6file"
3536
"github.com/usnistgov/ndn-dpdk/ndn/segmented"
3637
"github.com/usnistgov/ndn-dpdk/ndn/tlv"
37-
"github.com/zyedidia/generic"
3838
"go.uber.org/zap"
39-
"golang.org/x/exp/slices"
4039
)
4140

4241
type FileServerFixture struct {
@@ -372,7 +371,7 @@ func (fs *fuseFS) ReadFile(ctx context.Context, op *fuseops.ReadFileOp) (e error
372371
return e
373372
case fuseInoFileZ:
374373
randBytes(op.Dst)
375-
op.BytesRead = generic.Min(len(op.Dst), int(fs.sizeZ-uint64(op.Offset)))
374+
op.BytesRead = min(len(op.Dst), int(fs.sizeZ-uint64(op.Offset)))
376375
return nil
377376
default:
378377
return fuse.EIO
@@ -408,7 +407,7 @@ func (fs *fuseFS) dirRoot(op *fuseops.ReadDirOp) error {
408407
}
409408

410409
func (fs *fuseFS) dirA(op *fuseops.ReadDirOp) error {
411-
for ino := generic.Max(uint64(op.Offset), uint64(fuseInoALo)); ino <= uint64(fuseInoAHi); ino++ {
410+
for ino := max(uint64(op.Offset), uint64(fuseInoALo)); ino <= uint64(fuseInoAHi); ino++ {
412411
n := fuseutil.WriteDirent(op.Dst[op.BytesRead:], fuseutil.Dirent{
413412
Offset: fuseops.DirOffset(1 + ino),
414413
Inode: fuseops.InodeID(ino),

app/fwdp/dataplane.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/usnistgov/ndn-dpdk/dpdk/ealthread"
1717
"github.com/usnistgov/ndn-dpdk/iface"
1818
"github.com/usnistgov/ndn-dpdk/ndni"
19-
"github.com/zyedidia/generic"
2019
"go4.org/must"
2120
)
2221

@@ -62,7 +61,7 @@ func (cfg *Config) validate() error {
6261
cfg.FwdNackQueue.DequeueBurstSize = cfg.FwdDataQueue.DequeueBurstSize
6362
}
6463
if cfg.FwdInterestQueue.DequeueBurstSize <= 0 {
65-
cfg.FwdInterestQueue.DequeueBurstSize = generic.Max(cfg.FwdDataQueue.DequeueBurstSize/2, 1)
64+
cfg.FwdInterestQueue.DequeueBurstSize = max(cfg.FwdDataQueue.DequeueBurstSize/2, 1)
6665
}
6766
if cfg.LatencySampleInterval <= 0 {
6867
cfg.LatencySampleInterval = 1 << 16

app/pdump/face.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"sync"
1414
"unsafe"
1515

16+
"slices"
17+
1618
"github.com/google/gopacket/layers"
1719
"github.com/google/gopacket/pcapgo"
1820
"github.com/usnistgov/ndn-dpdk/core/pcg32"
@@ -23,7 +25,6 @@ import (
2325
"github.com/usnistgov/ndn-dpdk/ndn"
2426
"github.com/usnistgov/ndn-dpdk/ndni"
2527
"go.uber.org/zap"
26-
"golang.org/x/exp/slices"
2728
)
2829

2930
// Direction indicates traffic direction.

app/tgconsumer/config.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/usnistgov/ndn-dpdk/core/nnduration"
1111
"github.com/usnistgov/ndn-dpdk/iface"
1212
"github.com/usnistgov/ndn-dpdk/ndni"
13-
"github.com/zyedidia/generic"
1413
)
1514

1615
const (
@@ -102,5 +101,5 @@ type Pattern struct {
102101
}
103102

104103
func (pattern *Pattern) applyDefaults() {
105-
pattern.Weight = generic.Max(1, pattern.Weight)
104+
pattern.Weight = max(1, pattern.Weight)
106105
}

app/tgproducer/config.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/usnistgov/ndn-dpdk/ndn"
1111
"github.com/usnistgov/ndn-dpdk/ndn/an"
1212
"github.com/usnistgov/ndn-dpdk/ndni"
13-
"github.com/zyedidia/generic"
1413
)
1514

1615
const (
@@ -46,7 +45,7 @@ type Config struct {
4645

4746
// Validate applies defaults and validates the configuration.
4847
func (cfg *Config) Validate() error {
49-
cfg.NThreads = generic.Max(1, cfg.NThreads)
48+
cfg.NThreads = max(1, cfg.NThreads)
5049
cfg.RxQueue.DisableCoDel = true
5150

5251
if len(cfg.Patterns) == 0 {
@@ -92,7 +91,7 @@ func (pattern *Pattern) applyDefaults() (sumWeight, nDataGen int) {
9291

9392
for i := range pattern.Replies {
9493
reply := &pattern.Replies[i]
95-
reply.Weight = generic.Max(1, reply.Weight)
94+
reply.Weight = max(1, reply.Weight)
9695
sumWeight += reply.Weight
9796
if reply.Kind() == ReplyData {
9897
nDataGen++

container/cs/cs.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/usnistgov/ndn-dpdk/container/pcct"
1515
"github.com/usnistgov/ndn-dpdk/core/logging"
1616
"github.com/usnistgov/ndn-dpdk/ndni"
17-
"github.com/zyedidia/generic"
1817
"go.uber.org/zap"
1918
)
2019

@@ -103,7 +102,7 @@ func init() {
103102
if v <= 0 {
104103
v = dflt
105104
}
106-
return generic.Max(v, min)
105+
return max(v, min)
107106
}
108107

109108
capMemory := adjustCapacity(cfg.CsMemoryCapacity, EvictBulk, cfg.PcctCapacity/4)

container/fib/fibdef/entry.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import (
44
"errors"
55
"fmt"
66

7+
"slices"
8+
79
"github.com/suzuki-shunsuke/go-dataeq/dataeq"
810
"github.com/usnistgov/ndn-dpdk/iface"
911
"github.com/usnistgov/ndn-dpdk/ndn"
10-
"golang.org/x/exp/slices"
1112
)
1213

1314
// EntryBody contains logical FIB entry contents except name.

container/fib/fibtree/node.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package fibtree
33
import (
44
"github.com/usnistgov/ndn-dpdk/container/fib/fibdef"
55
"github.com/usnistgov/ndn-dpdk/ndn"
6-
"github.com/zyedidia/generic"
76
)
87

98
type component struct {
@@ -40,7 +39,7 @@ func (n *node) RemoveChild(child *node) {
4039
func (n *node) UpdateHeight() {
4140
h := -1
4241
for _, child := range n.children {
43-
h = generic.Max(h, child.height)
42+
h = max(h, child.height)
4443
}
4544
n.height = h + 1
4645
}

container/pcct/pcct.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/usnistgov/ndn-dpdk/core/logging"
1313
"github.com/usnistgov/ndn-dpdk/dpdk/eal"
1414
"github.com/usnistgov/ndn-dpdk/dpdk/mempool"
15-
"github.com/zyedidia/generic"
1615
"go.uber.org/zap"
1716
)
1817

@@ -64,7 +63,7 @@ func New(cfg Config, socket eal.NumaSocket) (pcct *Pcct, e error) {
6463
cfg.applyDefaults()
6564
mp, e := mempool.New(mempool.Config{
6665
Capacity: cfg.PcctCapacity,
67-
ElementSize: generic.Max(C.sizeof_PccEntry, C.sizeof_PccEntryExt),
66+
ElementSize: max(C.sizeof_PccEntry, C.sizeof_PccEntryExt),
6867
PrivSize: C.sizeof_Pcct,
6968
Socket: socket,
7069
SingleProducer: true,

core/gqlserver/interface.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package gqlserver
22

33
import (
44
"reflect"
5+
"slices"
56

67
"github.com/graphql-go/graphql"
7-
"golang.org/x/exp/slices"
88
)
99

1010
// FieldDefToField converts FieldDefinition to *Field.

core/gqlserver/sub-resolver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package gqlserver
22

33
import (
4+
"maps"
45
"reflect"
56
"time"
67

78
"github.com/graphql-go/graphql"
89
"github.com/usnistgov/ndn-dpdk/core/nnduration"
910
"github.com/usnistgov/ndn-dpdk/core/subtract"
10-
"golang.org/x/exp/maps"
1111
)
1212

1313
// PublishChan publishes a channel in reply to GraphQL subscription.

core/hwinfo/hwinfo.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package hwinfo
33

44
import (
55
"github.com/usnistgov/ndn-dpdk/core/logging"
6-
"github.com/zyedidia/generic"
76
"github.com/zyedidia/generic/mapset"
87
)
98

@@ -32,7 +31,7 @@ func (cores Cores) ByNumaSocket() (m map[int]Cores) {
3231
func (cores Cores) MaxNumaSocket() int {
3332
maxSocket := -1
3433
for _, core := range cores {
35-
maxSocket = generic.Max(maxSocket, core.NumaSocket)
34+
maxSocket = max(maxSocket, core.NumaSocket)
3635
}
3736
return maxSocket
3837
}

core/subtract/subtract.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package subtract
33

44
import (
55
"reflect"
6-
7-
"github.com/zyedidia/generic"
86
)
97

108
// Sub computes the numerical difference between two structs of the same type.
@@ -63,7 +61,7 @@ func subValue(currV, prevV, diffV reflect.Value) {
6361
case reflect.Struct:
6462
diffV.Set(subV(currV, prevV))
6563
case reflect.Slice:
66-
length := generic.Min(currV.Len(), prevV.Len())
64+
length := min(currV.Len(), prevV.Len())
6765
diffV.Set(reflect.MakeSlice(currV.Type(), length, length))
6866
fallthrough
6967
case reflect.Array:

csrc/fwdp/fwd-data.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ FwFwd_DataSatisfy(FwFwd* fwd, FwFwdCtx* ctx) {
4949
uint8_t upCongMark = Packet_GetLpL3Hdr(ctx->npkt)->congMark;
5050
N_LOGD("^ pit-entry=%p(%s)", ctx->pitEntry, PitEntry_ToDebugString(ctx->pitEntry));
5151

52-
PitDn_Each(it, ctx->pitEntry, false) {
52+
PitDn_Each (it, ctx->pitEntry, false) {
5353
PitDn* dn = it.dn;
5454
if (unlikely(dn->face == 0)) {
5555
if (it.index == 0) {

csrc/fwdp/fwd-nack.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ N_LOG_INIT(FwFwd);
1010
__attribute__((nonnull)) static void
1111
FwFwd_TxNacks(FwFwd* fwd, PitEntry* pitEntry, TscTime now, NackReason reason,
1212
uint8_t nackHopLimit) {
13-
PitDn_Each(it, pitEntry, false) {
13+
PitDn_Each (it, pitEntry, false) {
1414
PitDn* dn = it.dn;
1515
if (dn->face == 0) {
1616
break;
@@ -115,7 +115,7 @@ FwFwd_ProcessNack(FwFwd* fwd, FwFwdCtx* ctx) {
115115
// count remaining pending upstreams and find least severe Nack reason
116116
int nPending = 0;
117117
NackReason leastSevere = reason;
118-
PitUp_Each(it, ctx->pitEntry, false) {
118+
PitUp_Each (it, ctx->pitEntry, false) {
119119
if (it.up->face == 0) {
120120
continue;
121121
}

csrc/pcct/pit-entry.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ PitEntry_ToDebugString(PitEntry* entry) {
3737
append(snprintf, ",DN[");
3838
{
3939
const char* delim = "";
40-
PitDn_Each(it, entry, false) {
40+
PitDn_Each (it, entry, false) {
4141
if (it.dn->face == 0) {
4242
break;
4343
}
@@ -53,7 +53,7 @@ PitEntry_ToDebugString(PitEntry* entry) {
5353
append(snprintf, "],UP[");
5454
{
5555
const char* delim = "";
56-
PitUp_Each(it, entry, false) {
56+
PitUp_Each (it, entry, false) {
5757
if (it.up->face == 0) {
5858
break;
5959
}
@@ -123,7 +123,7 @@ PitEntry_Timeout_(MinTmr* tmr, uintptr_t pitPtr) {
123123

124124
FaceID
125125
PitEntry_FindDuplicateNonce(PitEntry* entry, uint32_t nonce, FaceID dnFace) {
126-
PitDn_Each(it, entry, false) {
126+
PitDn_Each (it, entry, false) {
127127
PitDn* dn = it.dn;
128128
if (dn->face == 0) {
129129
break;
@@ -146,7 +146,7 @@ PitEntry_ReserveDn(PitEntry* entry, FaceID face, TscTime now) {
146146
goto NEW;
147147
}
148148

149-
PitDn_Each(it, entry, true) {
149+
PitDn_Each (it, entry, true) {
150150
dn = it.dn;
151151
if (dn->face == face) {
152152
return dn;
@@ -217,7 +217,7 @@ PitEntry_InsertDn(PitEntry* entry, Pit* pit, Packet* npkt) {
217217

218218
PitUp*
219219
PitEntry_FindUp(PitEntry* entry, FaceID face) {
220-
PitUp_Each(it, entry, false) {
220+
PitUp_Each (it, entry, false) {
221221
PitUp* up = it.up;
222222
if (up->face == face) {
223223
return up;
@@ -232,7 +232,7 @@ PitEntry_FindUp(PitEntry* entry, FaceID face) {
232232
PitUp*
233233
PitEntry_ReserveUp(PitEntry* entry, FaceID face) {
234234
PitUp* up = NULL;
235-
PitUp_Each(it, entry, true) {
235+
PitUp_Each (it, entry, true) {
236236
up = it.up;
237237
if (up->face == face) {
238238
return up;

csrc/pcct/pit-up.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PitUp_ChooseNonce(PitUp* up, PitEntry* entry, TscTime now, uint32_t* nonce) {
1717
return true;
1818
}
1919

20-
PitDn_Each(it, entry, false) {
20+
PitDn_Each (it, entry, false) {
2121
PitDn* dn = it.dn;
2222
if (dn->face == 0) {
2323
break;

0 commit comments

Comments
 (0)